Remove unused codes

This commit is contained in:
Takeshi Yokemura 2021-05-21 21:34:23 +09:00
parent 97aadde9ab
commit 7efbf2a409
3 changed files with 5 additions and 148 deletions

View File

@ -293,67 +293,13 @@ bool Magical8bitPlug2AudioProcessor::isBusesLayoutSupported (const BusesLayout&
void Magical8bitPlug2AudioProcessor::processBlock (AudioBuffer<float>& 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()

View File

@ -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<currentNumNoteBuffer; i++) {
// if (noteBuffer[i] == midiNoteNumber) break;
// }
// if (i == currentNumNoteBuffer) { // not found
// return currentNumNoteBuffer;
// }
// shiftNoteBuffer(i);
// currentNumNoteBuffer--;
if (midiNoteNumber == noteNumber) {
return 0;
} else {

View File

@ -73,73 +73,4 @@ struct TonalVoice : public BaseVoice // The base for Pulse and Triangle
bool isArpeggioEnabled() {
return arpeggioFrameLength > 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);
}
*/
};