| 122 | } |
| 123 | |
| 124 | void MultitrackRecorder::ButtonClicked(ClickButton* button, double time) |
| 125 | { |
| 126 | if (button == mAddTrackButton) |
| 127 | { |
| 128 | AddTrack(); |
| 129 | } |
| 130 | |
| 131 | if (button == mBounceButton) |
| 132 | { |
| 133 | std::string save_prefix = "multitrack_"; |
| 134 | if (!TheSynth->GetLastSavePath().empty()) |
| 135 | { |
| 136 | // This assumes that mCurrentSaveStatePath always has a valid filename at the end |
| 137 | std::string filename = juce::File(TheSynth->GetLastSavePath()).getFileNameWithoutExtension().toStdString(); |
| 138 | save_prefix = filename + "_"; |
| 139 | } |
| 140 | // Crude way of checking if the filename does not have a date/time in it. |
| 141 | if (std::count(save_prefix.begin(), save_prefix.end(), '-') < 3) |
| 142 | { |
| 143 | save_prefix += "%Y-%m-%d_%H-%M_"; |
| 144 | } |
| 145 | std::string filenamePrefix = ofGetTimestampString(UserPrefs.recordings_path.Get() + save_prefix); |
| 146 | |
| 147 | int numFiles = 0; |
| 148 | for (int i = 0; i < (int)mTracks.size(); ++i) |
| 149 | { |
| 150 | Sample* sample = mTracks[i]->BounceRecording(); |
| 151 | |
| 152 | if (sample) |
| 153 | { |
| 154 | std::string filename = filenamePrefix + ofToString(i + 1) + ".wav"; |
| 155 | sample->Write(filename.c_str()); |
| 156 | ++numFiles; |
| 157 | } |
| 158 | } |
| 159 | |
| 160 | if (numFiles > 0) |
| 161 | { |
| 162 | mStatusString = "wrote " + ofToString(numFiles) + " files to " + filenamePrefix + "*.wav"; |
| 163 | mStatusStringTime = gTime; |
| 164 | } |
| 165 | } |
| 166 | |
| 167 | if (button == mClearButton) |
| 168 | { |
| 169 | for (auto* track : mTracks) |
| 170 | track->Clear(); |
| 171 | } |
| 172 | } |
| 173 | |
| 174 | void MultitrackRecorder::CheckboxUpdated(Checkbox* checkbox, double time) |
| 175 | { |
nothing calls this directly
no test coverage detected