| 101 | } |
| 102 | |
| 103 | void ControllingSong::LoadSong(int index) |
| 104 | { |
| 105 | mLoadingSong = true; |
| 106 | |
| 107 | mLoadSongMutex.lock(); |
| 108 | |
| 109 | mCurrentSongIndex = index; |
| 110 | |
| 111 | mMidiReader.Read(ofToDataPath(mSongList["songs"][index]["midi"].asString()).c_str()); |
| 112 | |
| 113 | for (int i = 0; i < mSongList["songs"][index]["wavs"].size(); ++i) |
| 114 | { |
| 115 | if (i == 0) |
| 116 | { |
| 117 | mSample.Read(ofToDataPath(mSongList["songs"][index]["wavs"][i].asString()).c_str()); |
| 118 | mSample.SetPlayPosition(0); |
| 119 | } |
| 120 | else |
| 121 | { |
| 122 | int followIdx = i - 1; |
| 123 | if (followIdx < mFollowSongs.size()) |
| 124 | mFollowSongs[followIdx]->LoadSample(ofToDataPath(mSongList["songs"][index]["wavs"][i].asString()).c_str()); |
| 125 | } |
| 126 | } |
| 127 | |
| 128 | std::string keyroot = mSongList["songs"][index]["keyroot"].asString(); |
| 129 | if (keyroot != "X" && keyroot != "") |
| 130 | { |
| 131 | TheScale->SetRoot(PitchFromNoteName(keyroot)); |
| 132 | TheScale->SetScaleType(mSongList["songs"][index]["keytype"].asString()); |
| 133 | } |
| 134 | |
| 135 | mMidiReader.SetBeatOffset(mSongList["songs"][index]["beatoffset"].asInt()); |
| 136 | |
| 137 | mSongStartTime = gTime; |
| 138 | |
| 139 | mLoadSongMutex.unlock(); |
| 140 | |
| 141 | mLoadingSong = false; |
| 142 | } |
| 143 | |
| 144 | void ControllingSong::Process(double time) |
| 145 | { |
nothing calls this directly
no test coverage detected