mirror of
https://github.com/yokemura/Magical8bitPlug2.git
synced 2025-07-17 11:04:16 -04:00
Basic monophonic
This commit is contained in:
@ -9,13 +9,36 @@
|
||||
*/
|
||||
|
||||
#include "CustomSynth.h"
|
||||
#include "BaseVoice.h"
|
||||
#include "PluginProcessor.h"
|
||||
|
||||
CustomSynth::CustomSynth(Magical8bitPlug2AudioProcessor& p) : processor(p) {}
|
||||
|
||||
void CustomSynth::noteOn(int midiChannel, int midiNoteNumber, float velocity) {
|
||||
Synthesiser::noteOn(midiChannel, midiNoteNumber, velocity);
|
||||
// Poly
|
||||
if (!processor.settingRefs.isMonophonic()) {
|
||||
Synthesiser::noteOn(midiChannel, midiNoteNumber, velocity);
|
||||
return;
|
||||
}
|
||||
|
||||
// Mono
|
||||
auto voice = voices.getFirst();
|
||||
|
||||
if (voice == nullptr) {
|
||||
return;
|
||||
}
|
||||
if (voice->isKeyDown()) {
|
||||
((BaseVoice*)voice)->changeNote(midiNoteNumber, velocity);
|
||||
} else {
|
||||
Synthesiser::noteOn(midiChannel, midiNoteNumber, velocity);
|
||||
}
|
||||
}
|
||||
|
||||
void CustomSynth::noteOff(int midiChannel, int midiNoteNumber, float velocity, bool allowTailOff) {
|
||||
Synthesiser::noteOff(midiChannel, midiNoteNumber, velocity, allowTailOff);
|
||||
}
|
||||
|
||||
void CustomSynth::allNotesOff (const int midiChannel, const bool allowTailOff) {
|
||||
Synthesiser::allNotesOff(midiChannel, allowTailOff);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user