UnisynIndex.cpp 962 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #include "sekai/UnisynIndex.h"
  2. #include <fstream>
  3. #include <iostream>
  4. #include <sstream>
  5. #include <boost/algorithm/string/classification.hpp>
  6. #include <boost/algorithm/string/split.hpp>
  7. #include <boost/lexical_cast.hpp>
  8. bool UnisynIndex::readFromFile(std::string fileName) {
  9. std::ifstream infile(fileName);
  10. bool header = true;
  11. std::string line;
  12. while (std::getline(infile, line)) {
  13. if (line == "EST_Header_End")
  14. header = false;
  15. else {
  16. std::vector<std::string> spl;
  17. boost::split(spl, line, boost::is_any_of("\t "),
  18. boost::token_compress_on);
  19. if (header) {
  20. headerMap[spl[0]] = spl[1];
  21. } else {
  22. PhoInfo p;
  23. p.basename = spl[1];
  24. for(int i=2;i<spl.size();i++)
  25. {
  26. p.alignment.push_back(boost::lexical_cast<float>(spl[i]));
  27. }
  28. phoMap[spl[0]] = p;
  29. }
  30. }
  31. }
  32. return true;
  33. }
  34. //Pitch Track::pitchEmpty = {0};