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

Method ButtonClicked

Source/SampleCapturer.cpp:207–227  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

205}
206
207void 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
229void SampleCapturer::GetModuleDimensions(float& w, float& h)
230{

Callers

nothing calls this directly

Calls 4

ofToSamplePathFunction · 0.85
ofGetTimestampStringFunction · 0.85
GetFileChooserParentMethod · 0.80
ClearMethod · 0.45

Tested by

no test coverage detected