MCPcopy Create free account
hub / github.com/BespokeSynth/BespokeSynth / LoadSong

Method LoadSong

Source/ControllingSong.cpp:103–142  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

101}
102
103void 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
144void ControllingSong::Process(double time)
145{

Callers

nothing calls this directly

Calls 9

ofToDataPathFunction · 0.85
PitchFromNoteNameFunction · 0.85
sizeMethod · 0.80
SetPlayPositionMethod · 0.80
SetRootMethod · 0.80
SetScaleTypeMethod · 0.80
SetBeatOffsetMethod · 0.80
ReadMethod · 0.45
LoadSampleMethod · 0.45

Tested by

no test coverage detected