diff options
author | Damien Zammit <damien@zamaudio.com> | 2019-06-16 14:59:08 +1000 |
---|---|---|
committer | Damien Zammit <damien@zamaudio.com> | 2019-06-16 14:59:08 +1000 |
commit | 21da681ec1360970c8407205982c7fea6af0ff4d (patch) | |
tree | f5d99f262a2f891deb3ffb893789d00594c9e004 /ptformat | |
parent | 63c344d9487923b90092cf02819df57efaf90206 (diff) |
Fixing track info
Diffstat (limited to 'ptformat')
-rw-r--r-- | ptformat/ptfformat.h | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/ptformat/ptfformat.h b/ptformat/ptfformat.h index 3b1b5cb..77143f4 100644 --- a/ptformat/ptfformat.h +++ b/ptformat/ptfformat.h @@ -120,7 +120,7 @@ public: region_t reg; bool operator ==(const struct track& other) { - return (this->name == other.name); + return (this->index == other.index); } } track_t; @@ -132,6 +132,24 @@ public: std::vector<track_t> tracks; std::vector<track_t> miditracks; + bool find_track(uint16_t index, std::vector<track_t>::iterator& ti) { + std::vector<track_t>::iterator begin = tracks.begin(); + std::vector<track_t>::iterator finish = tracks.end(); + std::vector<track_t>::iterator found; + + // Create dummy track with index + wav_t w = { std::string(""), 0, 0, 0 }; + std::vector<midi_ev_t> m; + region_t r = { std::string(""), 0, 0, 0, 0, w, m}; + track_t t = { std::string(""), index, 0, r}; + + if ((found = std::find(begin, finish, t)) != finish) { + ti = found; + return true; + } + return false; + } + bool find_region(uint16_t index, std::vector<region_t>::iterator& ri) { std::vector<region_t>::iterator begin = regions.begin(); std::vector<region_t>::iterator finish = regions.end(); |