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

Method OnClicked

Source/SampleCapturer.cpp:235–260  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

233}
234
235void SampleCapturer::OnClicked(float x, float y, bool right)
236{
237 IDrawableModule::OnClicked(x, y, right);
238
239 if (right)
240 return;
241
242 for (int i = 0; i < (int)mSamples.size(); ++i)
243 {
244 if (y >= kBufferStartY + i * (kBufferHeight + kBufferSpacing) && y <= kBufferStartY + i * (kBufferHeight + kBufferSpacing) + kBufferHeight)
245 {
246 mCurrentSampleIndex = i;
247
248 if (x < kBufferWidth + 10)
249 {
250 ChannelBuffer grab(mSamples[i].mRecordingLength);
251 grab.SetNumActiveChannels(mSamples[i].mBuffer.NumActiveChannels());
252 for (int ch = 0; ch < grab.NumActiveChannels(); ++ch)
253 BufferCopy(grab.GetChannel(ch), mSamples[i].mBuffer.GetChannel(ch), mSamples[i].mRecordingLength);
254 TheSynth->GrabSample(&grab, "captured", false);
255 }
256 }
257 }
258
259 mIsDragging = true;
260}
261
262void SampleCapturer::MouseReleased()
263{

Callers

nothing calls this directly

Calls 6

BufferCopyFunction · 0.85
sizeMethod · 0.80
SetNumActiveChannelsMethod · 0.80
NumActiveChannelsMethod · 0.80
GetChannelMethod · 0.80
GrabSampleMethod · 0.45

Tested by

no test coverage detected