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

Method MatchesFilter

Source/QuickSpawnMenu.cpp:302–377  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

300}
301
302bool QuickSpawnMenu::MatchesFilter(const ModuleFactory::Spawnable& spawnable) const
303{
304 if (mFilterForCable == nullptr)
305 return true;
306
307 bool inputMatches = false;
308 bool outputMatches = false;
309
310 ModuleFactory::ModuleInfo info;
311
312 if (spawnable.mSpawnMethod == ModuleFactory::SpawnMethod::Preset)
313 info = TheSynth->GetModuleFactory()->GetModuleInfo(spawnable.mPresetModuleType);
314 else
315 info = TheSynth->GetModuleFactory()->GetModuleInfo(spawnable.mLabel);
316
317 if (mFilterForCable->GetConnectionType() == kConnectionType_Note)
318 {
319 if (spawnable.mSpawnMethod == ModuleFactory::SpawnMethod::Plugin)
320 inputMatches = true;
321 if (info.mCanReceiveNotes)
322 inputMatches = true;
323 }
324
325 if (mFilterForCable->GetConnectionType() == kConnectionType_Audio)
326 {
327 if (spawnable.mSpawnMethod == ModuleFactory::SpawnMethod::Plugin)
328 inputMatches = true;
329 if (spawnable.mSpawnMethod == ModuleFactory::SpawnMethod::EffectChain)
330 inputMatches = true;
331 if (info.mCanReceiveAudio)
332 inputMatches = true;
333 }
334
335 if (mFilterForCable->GetConnectionType() == kConnectionType_Pulse)
336 {
337 if (info.mCanReceivePulses)
338 inputMatches = true;
339 }
340
341 if (mMainContainerFollower->mTempConnectionCable->IsShowing())
342 {
343 if (mMainContainerFollower->mTempConnectionCable->GetConnectionType() == kConnectionType_Note)
344 {
345 if (info.mCategory == kModuleCategory_Instrument)
346 outputMatches = true;
347 if (info.mCategory == kModuleCategory_Note)
348 outputMatches = true;
349 }
350
351 if (mMainContainerFollower->mTempConnectionCable->GetConnectionType() == kConnectionType_Audio)
352 {
353 if (spawnable.mSpawnMethod == ModuleFactory::SpawnMethod::Plugin)
354 outputMatches = true;
355 if (spawnable.mSpawnMethod == ModuleFactory::SpawnMethod::EffectChain)
356 outputMatches = true;
357 if (info.mCategory == kModuleCategory_Synth)
358 outputMatches = true;
359 if (info.mCategory == kModuleCategory_Audio)

Callers

nothing calls this directly

Calls 4

GetModuleInfoMethod · 0.80
GetModuleFactoryMethod · 0.80
IsShowingMethod · 0.80
GetConnectionTypeMethod · 0.45

Tested by

no test coverage detected