diff options
Diffstat (limited to 'rotord/src/rotor.h')
| -rw-r--r-- | rotord/src/rotor.h | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/rotord/src/rotor.h b/rotord/src/rotor.h index 1c8e992..0833096 100644 --- a/rotord/src/rotor.h +++ b/rotord/src/rotor.h @@ -264,13 +264,19 @@ namespace Rotor { for (auto l:lyrics){ cerr<<l.first<<":"<<l.second.first<<" ("<<l.second.second<<")"<<endl; } + lyrics[-1.0f]=make_pair("",0.0f); //start with an empty entry } const string &get_lyric(const Time_spec &time){ - + if (lyrics.size()) { + auto l=lyrics.upper_bound(time.time); + l--; + //cerr<<(time.time)<<" "<<l->second.first<<","<<(l->first)<<" ("<<(l->second.second)<<")"<<endl; + if ((time.time>l->first)&&((time.time-l->first) < l->second.second)) return l->second.first; + } + return ""; } private: - std::map<float,std::pair<string,float> > lyrics; - + std::map<float,std::pair<string,float> > lyrics; //lyrics[startime]=pair<lyric,endtime> }; class Node{ public: |
