diff --git a/Source/PluginProcessor.cpp b/Source/PluginProcessor.cpp index 39563ad..66618bc 100644 --- a/Source/PluginProcessor.cpp +++ b/Source/PluginProcessor.cpp @@ -293,67 +293,13 @@ bool Magical8bitPlug2AudioProcessor::isBusesLayoutSupported (const BusesLayout& void Magical8bitPlug2AudioProcessor::processBlock (AudioBuffer& buffer, MidiBuffer& midiMessages) { - - synth.renderNextBlock (buffer, midiMessages, 0, buffer.getNumSamples()); // [5] - - /* - buffer.clear(); - MidiBuffer processedMidi; - int time; - MidiMessage m; - for (MidiBuffer::Iterator i (midiMessages); i.getNextEvent (m, time);) - { - if (m.isNoteOn()) - { - uint8 newVel = (uint8)noteOnVel; - m = MidiMessage::noteOn(m.getChannel(), m.getNoteNumber(), newVel); - } - else if (m.isNoteOff()) - { - } - else if (m.isAftertouch()) - { - } - else if (m.isPitchWheel()) - { - } - processedMidi.addEvent (m, time); - } - midiMessages.swapWith (processedMidi); - - - ScopedNoDenormals noDenormals; - auto totalNumInputChannels = getTotalNumInputChannels(); - auto totalNumOutputChannels = getTotalNumOutputChannels(); - - // In case we have more outputs than inputs, this code clears any output - // channels that didn't contain input data, (because these aren't - // guaranteed to be empty - they may contain garbage). - // This is here to avoid people getting screaming feedback - // when they first compile a plugin, but obviously you don't need to keep - // this code if your algorithm always overwrites all the output channels. - for (auto i = totalNumInputChannels; i < totalNumOutputChannels; ++i) - buffer.clear (i, 0, buffer.getNumSamples()); - - // This is the place where you'd normally do the guts of your plugin's - // audio processing... - // Make sure to reset the state if your inner loop is processing - // the samples and the outer loop is handling the channels. - // Alternatively, you can process the samples with the channels - // interleaved by keeping the same state. - for (int channel = 0; channel < totalNumInputChannels; ++channel) - { - auto* channelData = buffer.getWritePointer (channel); - - // ..do something to the data... - } - */ + synth.renderNextBlock (buffer, midiMessages, 0, buffer.getNumSamples()); } //============================================================================== bool Magical8bitPlug2AudioProcessor::hasEditor() const { - return true; // (change this to false if you choose to not supply an editor) + return true; } AudioProcessorEditor* Magical8bitPlug2AudioProcessor::createEditor() diff --git a/Source/TonalVoice.cpp b/Source/TonalVoice.cpp index 937cfd4..2939b09 100644 --- a/Source/TonalVoice.cpp +++ b/Source/TonalVoice.cpp @@ -16,9 +16,7 @@ // The base for pulse/triangle (Abstract) // //--------------------------------------------- -TonalVoice::TonalVoice (SettingRefs* sRefs) : BaseVoice (sRefs) { - // testArpeggioNotes(); -} +TonalVoice::TonalVoice (SettingRefs* sRefs) : BaseVoice (sRefs) {} void TonalVoice::startNote (int midiNoteNumber, float velocity, SynthesiserSound*, int currentPitchBendPosition) { @@ -102,18 +100,14 @@ void TonalVoice::controllerMoved (int type, int amount) void TonalVoice::setLegatoMode(double time) { portamentoTime = time; -// currentNumNoteBuffer = 1; -// noteBuffer[0] = noteNumber; } +// The interface says "add" but the implementation is just using the latest value. +// It is because the original intension was to keep all the pressing keys and choose the apropriate one with certain algorithm void TonalVoice::addLegatoNote (int midiNoteNumber, float velocity) { if (currentNumNoteBuffer >= 10) { return; } - - // Push to last -// noteBuffer[currentNumNoteBuffer] = midiNoteNumber; -// currentNumNoteBuffer++; int previousNoteNo = noteNumber; BaseVoice::changeNote(midiNoteNumber, velocity); @@ -126,20 +120,6 @@ void TonalVoice::addLegatoNote (int midiNoteNumber, float velocity) { } int TonalVoice::removeLegatoNote(int midiNoteNumber) { -// if (currentNumNoteBuffer==0) { -// return 0; -// } -// -// int i; -// for (i=0; i 0; } - - /* - void testArpeggioNotes() { - startNote(100, 1, NULL, 0); - - setArpeggioMode(1.0); - jassert(isArpeggioEnabled()); - jassert(arpeggioNotes[0] == 100); - jassert(currentNumArpeggioNotes == 1); - - addArpeggioNoteAscending(90); - jassert(arpeggioNotes[0] == 90); - jassert(arpeggioNotes[1] == 100); - jassert(currentNumArpeggioNotes == 2); - - addArpeggioNoteAscending(95); - jassert(arpeggioNotes[0] == 90); - jassert(arpeggioNotes[1] == 95); - jassert(arpeggioNotes[2] == 100); - jassert(currentNumArpeggioNotes == 3); - - jassert(removeArpeggioNote(92) == 3); - jassert(arpeggioNotes[0] == 90); - jassert(arpeggioNotes[1] == 95); - jassert(arpeggioNotes[2] == 100); - - jassert(removeArpeggioNote(100) == 2); - jassert(arpeggioNotes[0] == 90); - jassert(arpeggioNotes[1] == 95); - - jassert(removeArpeggioNote(90) == 1); - jassert(arpeggioNotes[0] == 95); - - jassert(removeArpeggioNote(95) == 0); - - - startNote(100, 1, NULL, 0); - - setArpeggioMode(1.0); - jassert(isArpeggioEnabled()); - jassert(arpeggioNotes[0] == 100); - jassert(currentNumArpeggioNotes == 1); - - addArpeggioNoteDescending(90); - jassert(arpeggioNotes[0] == 100); - jassert(arpeggioNotes[1] == 90); - jassert(currentNumArpeggioNotes == 2); - - addArpeggioNoteDescending(95); - jassert(arpeggioNotes[0] == 100); - jassert(arpeggioNotes[1] == 95); - jassert(arpeggioNotes[2] == 90); - jassert(currentNumArpeggioNotes == 3); - - jassert(removeArpeggioNote(92) == 3); - jassert(arpeggioNotes[0] == 100); - jassert(arpeggioNotes[1] == 95); - jassert(arpeggioNotes[2] == 90); - - jassert(removeArpeggioNote(100) == 2); - jassert(arpeggioNotes[0] == 95); - jassert(arpeggioNotes[1] == 90); - - jassert(removeArpeggioNote(90) == 1); - jassert(arpeggioNotes[0] == 95); - - jassert(removeArpeggioNote(95) == 0); - } - */ };