| 205 | } |
| 206 | |
| 207 | void SampleCapturer::ButtonClicked(ClickButton* button, double time) |
| 208 | { |
| 209 | using namespace juce; |
| 210 | if (button == mPlayButton) |
| 211 | { |
| 212 | mSamples[mCurrentSampleIndex].mPlaybackPos = 0; |
| 213 | } |
| 214 | |
| 215 | if (button == mSaveButton) |
| 216 | { |
| 217 | FileChooser chooser("Save sample as...", File(ofToSamplePath(ofGetTimestampString("%Y-%m-%d_%H-%M-%S.wav"))), "*.wav", true, false, TheSynth->GetFileChooserParent()); |
| 218 | if (chooser.browseForFileToSave(true)) |
| 219 | Sample::WriteDataToFile(chooser.getResult().getFullPathName().toStdString(), &mSamples[mCurrentSampleIndex].mBuffer, mSamples[mCurrentSampleIndex].mRecordingLength); |
| 220 | } |
| 221 | |
| 222 | if (button == mDeleteButton) |
| 223 | { |
| 224 | mSamples[mCurrentSampleIndex].mBuffer.Clear(); |
| 225 | mSamples[mCurrentSampleIndex].mRecordingLength = 0; |
| 226 | } |
| 227 | } |
| 228 | |
| 229 | void SampleCapturer::GetModuleDimensions(float& w, float& h) |
| 230 | { |
nothing calls this directly
no test coverage detected