diff options
Diffstat (limited to 'muse2/muse/helper.cpp')
-rw-r--r-- | muse2/muse/helper.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/muse2/muse/helper.cpp b/muse2/muse/helper.cpp index 605d6f5c..d4a237ea 100644 --- a/muse2/muse/helper.cpp +++ b/muse2/muse/helper.cpp @@ -6,6 +6,9 @@ //========================================================= #include "helper.h" +#include "part.h" +#include "track.h" +#include "song.h" extern bool hIsB; static const char* vall[] = { @@ -38,3 +41,25 @@ QString pitch2string(int v) } + + +int partToIndex(Part* p) +{ + return p->track()->parts()->index(p); +} + +Part* partFromIndex(int index) +{ + TrackList* tl = song->tracks(); + for (iTrack it = tl->begin(); it != tl->end(); ++it) + { + PartList* pl = (*it)->parts(); + iPart ip; + for (ip = pl->begin(); ip != pl->end(); ++ip) + if (ip->second->sn() == index) + return ip->second; + } + + printf("ERROR: partFromIndex(%i) wasn't able to find an appropriate part!\n",index); + return NULL; +} |