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

Method OnMidiNote

Source/Push2Control.cpp:1394–1594  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1392}
1393
1394void Push2Control::OnMidiNote(MidiNote& note)
1395{
1396 if (mGridControlInterface != nullptr)
1397 {
1398 bool handled = mGridControlInterface->OnPush2Control(this, kMidiMessage_Note, note.mPitch, note.mVelocity);
1399 if (handled)
1400 return;
1401 }
1402
1403 if (note.mPitch >= 0 && note.mPitch <= 7) //main encoders
1404 {
1405 if (mScreenDisplayMode == ScreenDisplayMode::kNormal || mScreenDisplayMode == ScreenDisplayMode::kMap)
1406 {
1407 int controlIndex = note.mPitch + mModuleViewOffset;
1408 if (controlIndex < mSliderControls.size())
1409 {
1410 if (note.mVelocity > 0)
1411 {
1412 mSliderControls[controlIndex]->StartBeacon();
1413
1414 if (mNewButtonHeld)
1415 {
1416 AddFavoriteControl(mSliderControls[controlIndex]);
1417 }
1418 else if (mDeleteButtonHeld)
1419 {
1420 RemoveFavoriteControl(mSliderControls[controlIndex]);
1421 }
1422 else if (mLFOButtonHeld)
1423 {
1424 FloatSlider* slider = dynamic_cast<FloatSlider*>(mSliderControls[controlIndex]);
1425 if (slider != nullptr)
1426 {
1427 bool hadLFO = (slider->GetLFO() != nullptr);
1428 FloatSliderLFOControl* lfo = slider->AcquireLFO();
1429 if (!hadLFO)
1430 lfo->SetLFOEnabled(true);
1431 SetDisplayModule(lfo, true);
1432 }
1433 }
1434 else if (mAutomateButtonHeld)
1435 {
1436 if (mSliderControls[controlIndex] != nullptr && mCurrentControlRecorder == nullptr)
1437 {
1438 std::vector<IDrawableModule*> modules;
1439 TheSynth->GetAllModules(modules);
1440 for (auto* searchModule : modules)
1441 {
1442 ControlRecorder* controlRecorderModule = dynamic_cast<ControlRecorder*>(searchModule);
1443 if (controlRecorderModule != nullptr)
1444 {
1445 if (controlRecorderModule->GetPatchCableSource()->GetTarget() == mSliderControls[controlIndex])
1446 mCurrentControlRecorder = controlRecorderModule;
1447 }
1448 }
1449
1450 if (mCurrentControlRecorder == nullptr) //couldn't find one, so make one
1451 {

Callers 5

oscMessageReceivedMethod · 0.45
SendMidiMessageMethod · 0.45
oscMessageReceivedMethod · 0.45
OnKeyPressedMethod · 0.45
OnKeyReleasedMethod · 0.45

Calls 15

sizeMethod · 0.80
AcquireLFOMethod · 0.80
SetLFOEnabledMethod · 0.80
SpawnModuleOnTheFlyMethod · 0.80
getMaxXMethod · 0.80
GetPatchCableSourcesMethod · 0.80
FindValidTargetsMethod · 0.80
GetListMethod · 0.80
ClearPatchCablesMethod · 0.80
OnPush2ControlMethod · 0.45
StartBeaconMethod · 0.45
GetLFOMethod · 0.45

Tested by

no test coverage detected