@@ -304,7 +304,7 @@ midi-sequencer.cpp.o: midi-sequencer.cpp midi-base.hpp $(CXXDEPS) | |||||
notes.cpp.o: notes.cpp $(CXXDEPS) ../CarlaNativeExtUI.hpp | notes.cpp.o: notes.cpp $(CXXDEPS) ../CarlaNativeExtUI.hpp | ||||
$(CXX) $< $(BUILD_CXX_FLAGS) -c -o $@ | $(CXX) $< $(BUILD_CXX_FLAGS) -c -o $@ | ||||
vex-%.cpp.o: vex-%.cpp | |||||
vex-%.cpp.o: vex-%.cpp vex/* | |||||
$(CXX) $< $(BUILD_CXX_FLAGS) -c -o $@ | $(CXX) $< $(BUILD_CXX_FLAGS) -c -o $@ | ||||
zynaddsubfx-%.cpp.o: zynaddsubfx-%.cpp $(CXXDEPS) $(ZYN_UI_FILES_H) | zynaddsubfx-%.cpp.o: zynaddsubfx-%.cpp $(CXXDEPS) $(ZYN_UI_FILES_H) | ||||
@@ -254,7 +254,7 @@ public: | |||||
startTimer(50); | startTimer(50); | ||||
} | } | ||||
~VexEditorComponent() | |||||
~VexEditorComponent() override | |||||
{ | { | ||||
stopTimer(); | stopTimer(); | ||||
removeAllChildren(); | removeAllChildren(); | ||||
@@ -474,7 +474,7 @@ protected: | |||||
bool params[92]; | bool params[92]; | ||||
fCallback->getChangedParameters(params); | fCallback->getChangedParameters(params); | ||||
for (int i=0; i < 89; ++i) | |||||
for (int i=0; i < kSliderCount; ++i) | |||||
{ | { | ||||
if (params[i]) | if (params[i]) | ||||
sliders[i]->setValue(fCallback->getFilterParameterValue(i), dontSendNotification); | sliders[i]->setValue(fCallback->getFilterParameterValue(i), dontSendNotification); | ||||
@@ -944,74 +944,75 @@ protected: | |||||
int snum; | int snum; | ||||
MidiMessage midiMessage(0xf4); | MidiMessage midiMessage(0xf4); | ||||
MidiBuffer::Iterator Iterator1(part1Midi); | |||||
while (Iterator1.getNextEvent(midiMessage, snum)) | |||||
for (MidiBuffer::Iterator Iterator1(part1Midi); Iterator1.getNextEvent(midiMessage, snum);) | |||||
{ | { | ||||
if (midiMessage.isNoteOn()) | if (midiMessage.isNoteOn()) | ||||
fSynth.playNote(midiMessage.getNoteNumber(), midiMessage.getVelocity(), snum, 1); | fSynth.playNote(midiMessage.getNoteNumber(), midiMessage.getVelocity(), snum, 1); | ||||
else if (midiMessage.isNoteOff()) | else if (midiMessage.isNoteOff()) | ||||
fSynth.releaseNote(midiMessage.getNoteNumber(), snum, 1 ); | |||||
fSynth.releaseNote(midiMessage.getNoteNumber(), snum, 1); | |||||
else if (midiMessage.isAllSoundOff()) | else if (midiMessage.isAllSoundOff()) | ||||
fSynth.kill(); | fSynth.kill(); | ||||
else if (midiMessage.isAllNotesOff()) | else if (midiMessage.isAllNotesOff()) | ||||
fSynth.releaseAll(snum); | fSynth.releaseAll(snum); | ||||
} | } | ||||
MidiBuffer::Iterator Iterator2(part2Midi); | |||||
while (Iterator2.getNextEvent(midiMessage, snum)) | |||||
for (MidiBuffer::Iterator Iterator2(part2Midi); Iterator2.getNextEvent(midiMessage, snum);) | |||||
{ | { | ||||
if (midiMessage.isNoteOn()) | if (midiMessage.isNoteOn()) | ||||
fSynth.playNote(midiMessage.getNoteNumber(), midiMessage.getVelocity(), snum, 2); | fSynth.playNote(midiMessage.getNoteNumber(), midiMessage.getVelocity(), snum, 2); | ||||
else if (midiMessage.isNoteOff()) | else if (midiMessage.isNoteOff()) | ||||
fSynth.releaseNote(midiMessage.getNoteNumber(), snum, 2 ); | |||||
fSynth.releaseNote(midiMessage.getNoteNumber(), snum, 2); | |||||
} | } | ||||
MidiBuffer::Iterator Iterator3(part3Midi); | |||||
while (Iterator3.getNextEvent(midiMessage, snum)) | |||||
for (MidiBuffer::Iterator Iterator3(part3Midi); Iterator3.getNextEvent(midiMessage, snum);) | |||||
{ | { | ||||
if (midiMessage.isNoteOn()) | if (midiMessage.isNoteOn()) | ||||
fSynth.playNote(midiMessage.getNoteNumber(), midiMessage.getVelocity(), snum, 3); | fSynth.playNote(midiMessage.getNoteNumber(), midiMessage.getVelocity(), snum, 3); | ||||
else if (midiMessage.isNoteOff()) | else if (midiMessage.isNoteOff()) | ||||
fSynth.releaseNote(midiMessage.getNoteNumber(), snum, 3 ); | |||||
fSynth.releaseNote(midiMessage.getNoteNumber(), snum, 3); | |||||
} | } | ||||
fMidiInBuffer.clear(); | fMidiInBuffer.clear(); | ||||
if (obf->getNumSamples() < (int)frames) | |||||
if (obf.getNumSamples() < (int)frames) | |||||
{ | { | ||||
obf->setSize(2, frames, 0, 0, 1); | |||||
abf->setSize(2, frames, 0, 0, 1); | |||||
dbf1->setSize(2, frames, 0, 0, 1); | |||||
dbf2->setSize(2, frames, 0, 0, 1); | |||||
dbf3->setSize(2, frames, 0, 0, 1); | |||||
obf.setSize(2, frames, false, false, true); | |||||
dbf1.setSize(2, frames, false, false, true); | |||||
dbf2.setSize(2, frames, false, false, true); | |||||
dbf3.setSize(2, frames, false, false, true); | |||||
} | } | ||||
obf ->clear(); | |||||
dbf1->clear(); | |||||
dbf2->clear(); | |||||
dbf3->clear(); | |||||
obf .clear(); | |||||
dbf1.clear(); | |||||
dbf2.clear(); | |||||
dbf3.clear(); | |||||
fSynth.doProcess(*obf, *abf, *dbf1, *dbf2, *dbf3); | |||||
fSynth.doProcess(obf, dbf1, dbf2, dbf3); | |||||
if (fParameters[75] > 0.001f) fDelay.processBlock(dbf1, bpm); | |||||
if (fParameters[78] > 0.001f) fChorus.processBlock(dbf2); | |||||
if (fParameters[82] > 0.001f) fReverb.processBlock(dbf3); | |||||
if (fParameters[75] > 0.001f) | |||||
{ | |||||
fDelay.processBlock(dbf1, bpm); | |||||
obf.addFrom(0, 0, dbf1, 0, 0, frames, fParameters[75]); | |||||
obf.addFrom(1, 0, dbf1, 1, 0, frames, fParameters[75]); | |||||
} | |||||
AudioSampleBuffer output(outBuffer, 2, 0, frames); | |||||
output.clear(); | |||||
if (fParameters[78] > 0.001f) | |||||
{ | |||||
fChorus.processBlock(dbf2); | |||||
obf.addFrom(0, 0, dbf2, 0, 0, frames, fParameters[78]); | |||||
obf.addFrom(1, 0, dbf2, 1, 0, frames, fParameters[78]); | |||||
} | |||||
obf->addFrom(0, 0, *dbf1, 0, 0, frames, fParameters[75]); | |||||
obf->addFrom(1, 0, *dbf1, 1, 0, frames, fParameters[75]); | |||||
obf->addFrom(0, 0, *dbf2, 0, 0, frames, fParameters[78]); | |||||
obf->addFrom(1, 0, *dbf2, 1, 0, frames, fParameters[78]); | |||||
obf->addFrom(0, 0, *dbf3, 0, 0, frames, fParameters[82]); | |||||
obf->addFrom(1, 0, *dbf3, 1, 0, frames, fParameters[82]); | |||||
if (fParameters[82] > 0.001f) | |||||
{ | |||||
fReverb.processBlock(dbf3); | |||||
obf.addFrom(0, 0, dbf3, 0, 0, frames, fParameters[82]); | |||||
obf.addFrom(1, 0, dbf3, 1, 0, frames, fParameters[82]); | |||||
} | |||||
output.addFrom(0, 0, *obf, 0, 0, frames, fParameters[0]); | |||||
output.addFrom(1, 0, *obf, 1, 0, frames, fParameters[0]); | |||||
FloatVectorOperations::copyWithMultiply(outBuffer[0], obf.getReadPointer(0), fParameters[0], frames); | |||||
FloatVectorOperations::copyWithMultiply(outBuffer[1], obf.getReadPointer(1), fParameters[0], frames); | |||||
} | } | ||||
// ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
@@ -1123,11 +1124,11 @@ protected: | |||||
void bufferSizeChanged(const uint32_t bufferSize) override | void bufferSizeChanged(const uint32_t bufferSize) override | ||||
{ | { | ||||
obf = new AudioSampleBuffer(2, bufferSize); | |||||
abf = new AudioSampleBuffer(2, bufferSize); | |||||
dbf1 = new AudioSampleBuffer(2, bufferSize); | |||||
dbf2 = new AudioSampleBuffer(2, bufferSize); | |||||
dbf3 = new AudioSampleBuffer(2, bufferSize); | |||||
obf.setSize(2, bufferSize); | |||||
dbf1.setSize(2, bufferSize); | |||||
dbf2.setSize(2, bufferSize); | |||||
dbf3.setSize(2, bufferSize); | |||||
fSynth.setBufferSize(bufferSize); | |||||
} | } | ||||
void sampleRateChanged(const double sampleRate) override | void sampleRateChanged(const double sampleRate) override | ||||
@@ -1196,11 +1197,10 @@ private: | |||||
float fParameters[kParamCount]; | float fParameters[kParamCount]; | ||||
bool fParamsChanged[92]; | bool fParamsChanged[92]; | ||||
ScopedPointer<AudioSampleBuffer> obf; | |||||
ScopedPointer<AudioSampleBuffer> abf; | |||||
ScopedPointer<AudioSampleBuffer> dbf1; // delay | |||||
ScopedPointer<AudioSampleBuffer> dbf2; // chorus | |||||
ScopedPointer<AudioSampleBuffer> dbf3; // reverb | |||||
AudioSampleBuffer obf; | |||||
AudioSampleBuffer dbf1; // delay | |||||
AudioSampleBuffer dbf2; // chorus | |||||
AudioSampleBuffer dbf3; // reverb | |||||
VexArpSettings fArpSet1, fArpSet2, fArpSet3; | VexArpSettings fArpSet1, fArpSet2, fArpSet3; | ||||
VexArp fArp1, fArp2, fArp3; | VexArp fArp1, fArp2, fArp3; | ||||
@@ -1223,8 +1223,8 @@ private: | |||||
static const NativePluginDescriptor vexsynthDesc = { | static const NativePluginDescriptor vexsynthDesc = { | ||||
/* category */ PLUGIN_CATEGORY_SYNTH, | /* category */ PLUGIN_CATEGORY_SYNTH, | ||||
/* hints */ static_cast<NativePluginHints>(PLUGIN_IS_SYNTH|PLUGIN_HAS_UI|PLUGIN_NEEDS_UI_JUCE|PLUGIN_USES_STATE|PLUGIN_USES_TIME|PLUGIN_USES_PARENT_ID), | |||||
/* supports */ static_cast<NativePluginSupports>(0x0), | |||||
/* hints */ static_cast<NativePluginHints>(PLUGIN_IS_SYNTH|PLUGIN_HAS_UI|PLUGIN_NEEDS_FIXED_BUFFERS|PLUGIN_NEEDS_UI_JUCE|PLUGIN_USES_STATE|PLUGIN_USES_TIME|PLUGIN_USES_PARENT_ID), | |||||
/* supports */ static_cast<NativePluginSupports>(PLUGIN_SUPPORTS_ALL_SOUND_OFF), | |||||
/* audioIns */ 0, | /* audioIns */ 0, | ||||
/* audioOuts */ 2, | /* audioOuts */ 2, | ||||
/* midiIns */ 1, | /* midiIns */ 1, | ||||
@@ -86,9 +86,9 @@ public: | |||||
buffer.clear(); | buffer.clear(); | ||||
} | } | ||||
void processBlock(AudioSampleBuffer* const outBuffer) | |||||
void processBlock(AudioSampleBuffer& outBuffer) | |||||
{ | { | ||||
processBlock(outBuffer->getWritePointer(0), outBuffer->getWritePointer(1), outBuffer->getNumSamples()); | |||||
processBlock(outBuffer.getWritePointer(0), outBuffer.getWritePointer(1), outBuffer.getNumSamples()); | |||||
} | } | ||||
void processBlock(float* const outBufferL, float* const outBufferR, const int numSamples) | void processBlock(float* const outBufferL, float* const outBufferR, const int numSamples) | ||||
@@ -81,9 +81,9 @@ public: | |||||
buffer.clear(); | buffer.clear(); | ||||
} | } | ||||
void processBlock(AudioSampleBuffer* const outBuffer, double bpm) | |||||
void processBlock(AudioSampleBuffer& outBuffer, double bpm) | |||||
{ | { | ||||
processBlock(outBuffer->getWritePointer(0), outBuffer->getWritePointer(1), outBuffer->getNumSamples(), bpm); | |||||
processBlock(outBuffer.getWritePointer(0), outBuffer.getWritePointer(1), outBuffer.getNumSamples(), bpm); | |||||
} | } | ||||
void processBlock(float* const outBufferL, float* const outBufferR, const int numSamples, double bpm) | void processBlock(float* const outBufferL, float* const outBufferR, const int numSamples, double bpm) | ||||
@@ -62,9 +62,9 @@ public: | |||||
parameters = p; | parameters = p; | ||||
} | } | ||||
void processBlock(AudioSampleBuffer* const outBuffer) | |||||
void processBlock(AudioSampleBuffer& outBuffer) | |||||
{ | { | ||||
processBlock(outBuffer->getWritePointer(0), outBuffer->getWritePointer(1), outBuffer->getNumSamples()); | |||||
processBlock(outBuffer.getWritePointer(0), outBuffer.getWritePointer(1), outBuffer.getNumSamples()); | |||||
} | } | ||||
void processBlock(float* const outBufferL, float* const outBufferR, const int numSamples) | void processBlock(float* const outBufferL, float* const outBufferR, const int numSamples) | ||||
@@ -77,11 +77,13 @@ public: | |||||
} | } | ||||
} | } | ||||
void doProcess(AudioSampleBuffer& obf, AudioSampleBuffer& assbf, AudioSampleBuffer& ebf1, AudioSampleBuffer& ebf2, AudioSampleBuffer& ebf3) | |||||
void doProcess(AudioSampleBuffer& obf, AudioSampleBuffer& ebf1, AudioSampleBuffer& ebf2, AudioSampleBuffer& ebf3) | |||||
{ | { | ||||
const int numSamples = obf.getNumSamples(); | const int numSamples = obf.getNumSamples(); | ||||
float* const outPtrL = assbf.getWritePointer(0); | |||||
float* const outPtrR = assbf.getWritePointer(1); | |||||
tmpBuf.clear(); | |||||
float* const outPtrL = tmpBuf.getWritePointer(0); | |||||
float* const outPtrR = tmpBuf.getWritePointer(1); | |||||
if (part1) | if (part1) | ||||
{ | { | ||||
@@ -93,14 +95,14 @@ public: | |||||
if (vo1[i]->getIsOn()) | if (vo1[i]->getIsOn()) | ||||
{ | { | ||||
vo1[i]->doProcess(outPtrL, outPtrR, numSamples); | vo1[i]->doProcess(outPtrL, outPtrR, numSamples); | ||||
obf.addFrom(0, 0, assbf, 0, 0, numSamples, left); | |||||
obf.addFrom(1, 0, assbf, 1, 0, numSamples, right); | |||||
ebf1.addFrom(0, 0, assbf, 0, 0, numSamples, parameters[22] * left); | |||||
ebf1.addFrom(1, 0, assbf, 1, 0, numSamples, parameters[22] * right); | |||||
ebf2.addFrom(0, 0, assbf, 0, 0, numSamples, parameters[23] * left); | |||||
ebf2.addFrom(1, 0, assbf, 1, 0, numSamples, parameters[23] * right); | |||||
ebf3.addFrom(0, 0, assbf, 0, 0, numSamples, parameters[24] * left); | |||||
ebf3.addFrom(1, 0, assbf, 1, 0, numSamples, parameters[24] * right); | |||||
obf.addFrom(0, 0, tmpBuf, 0, 0, numSamples, left); | |||||
obf.addFrom(1, 0, tmpBuf, 1, 0, numSamples, right); | |||||
ebf1.addFrom(0, 0, tmpBuf, 0, 0, numSamples, parameters[22] * left); | |||||
ebf1.addFrom(1, 0, tmpBuf, 1, 0, numSamples, parameters[22] * right); | |||||
ebf2.addFrom(0, 0, tmpBuf, 0, 0, numSamples, parameters[23] * left); | |||||
ebf2.addFrom(1, 0, tmpBuf, 1, 0, numSamples, parameters[23] * right); | |||||
ebf3.addFrom(0, 0, tmpBuf, 0, 0, numSamples, parameters[24] * left); | |||||
ebf3.addFrom(1, 0, tmpBuf, 1, 0, numSamples, parameters[24] * right); | |||||
} | } | ||||
} | } | ||||
} | } | ||||
@@ -115,14 +117,14 @@ public: | |||||
if (vo2[i]->getIsOn()) | if (vo2[i]->getIsOn()) | ||||
{ | { | ||||
vo2[i]->doProcess(outPtrL, outPtrR, numSamples); | vo2[i]->doProcess(outPtrL, outPtrR, numSamples); | ||||
obf.addFrom(0, 0, assbf, 0, 0, numSamples, left); | |||||
obf.addFrom(1, 0, assbf, 1, 0, numSamples, right); | |||||
ebf1.addFrom(0, 0, assbf, 0, 0, numSamples, parameters[22 + 24] * left); | |||||
ebf1.addFrom(1, 0, assbf, 1, 0, numSamples, parameters[22 + 24] * right); | |||||
ebf2.addFrom(0, 0, assbf, 0, 0, numSamples, parameters[23 + 24] * left); | |||||
ebf2.addFrom(1, 0, assbf, 1, 0, numSamples, parameters[23 + 24] * right); | |||||
ebf3.addFrom(0, 0, assbf, 0, 0, numSamples, parameters[24 + 24] * left); | |||||
ebf3.addFrom(1, 0, assbf, 1, 0, numSamples, parameters[24 + 24] * right); | |||||
obf.addFrom(0, 0, tmpBuf, 0, 0, numSamples, left); | |||||
obf.addFrom(1, 0, tmpBuf, 1, 0, numSamples, right); | |||||
ebf1.addFrom(0, 0, tmpBuf, 0, 0, numSamples, parameters[22 + 24] * left); | |||||
ebf1.addFrom(1, 0, tmpBuf, 1, 0, numSamples, parameters[22 + 24] * right); | |||||
ebf2.addFrom(0, 0, tmpBuf, 0, 0, numSamples, parameters[23 + 24] * left); | |||||
ebf2.addFrom(1, 0, tmpBuf, 1, 0, numSamples, parameters[23 + 24] * right); | |||||
ebf3.addFrom(0, 0, tmpBuf, 0, 0, numSamples, parameters[24 + 24] * left); | |||||
ebf3.addFrom(1, 0, tmpBuf, 1, 0, numSamples, parameters[24 + 24] * right); | |||||
} | } | ||||
} | } | ||||
} | } | ||||
@@ -137,19 +139,24 @@ public: | |||||
if (vo3[i]->getIsOn()) | if (vo3[i]->getIsOn()) | ||||
{ | { | ||||
vo3[i]->doProcess(outPtrL, outPtrR, numSamples); | vo3[i]->doProcess(outPtrL, outPtrR, numSamples); | ||||
obf.addFrom(0, 0, assbf, 0, 0, numSamples, left); | |||||
obf.addFrom(1, 0, assbf, 1, 0, numSamples, right); | |||||
ebf1.addFrom(0, 0, assbf, 0, 0, numSamples, parameters[22 + 48] * left); | |||||
ebf1.addFrom(1, 0, assbf, 1, 0, numSamples, parameters[22 + 48] * right); | |||||
ebf2.addFrom(0, 0, assbf, 0, 0, numSamples, parameters[23 + 48] * left); | |||||
ebf2.addFrom(1, 0, assbf, 1, 0, numSamples, parameters[23 + 48] * right); | |||||
ebf3.addFrom(0, 0, assbf, 0, 0, numSamples, parameters[24 + 48] * left); | |||||
ebf3.addFrom(1, 0, assbf, 1, 0, numSamples, parameters[24 + 48] * right); | |||||
obf.addFrom(0, 0, tmpBuf, 0, 0, numSamples, left); | |||||
obf.addFrom(1, 0, tmpBuf, 1, 0, numSamples, right); | |||||
ebf1.addFrom(0, 0, tmpBuf, 0, 0, numSamples, parameters[22 + 48] * left); | |||||
ebf1.addFrom(1, 0, tmpBuf, 1, 0, numSamples, parameters[22 + 48] * right); | |||||
ebf2.addFrom(0, 0, tmpBuf, 0, 0, numSamples, parameters[23 + 48] * left); | |||||
ebf2.addFrom(1, 0, tmpBuf, 1, 0, numSamples, parameters[23 + 48] * right); | |||||
ebf3.addFrom(0, 0, tmpBuf, 0, 0, numSamples, parameters[24 + 48] * left); | |||||
ebf3.addFrom(1, 0, tmpBuf, 1, 0, numSamples, parameters[24 + 48] * right); | |||||
} | } | ||||
} | } | ||||
} | } | ||||
} | } | ||||
void setBufferSize(const int size) | |||||
{ | |||||
tmpBuf.setSize(2, size); | |||||
} | |||||
void setSampleRate(const double s) | void setSampleRate(const double s) | ||||
{ | { | ||||
if (sampleRate == s) | if (sampleRate == s) | ||||
@@ -224,7 +231,7 @@ public: | |||||
break; | break; | ||||
} | } | ||||
if (vo1[i]->getIsReleased()) | |||||
if (v[i]->getIsReleased()) | |||||
{ | { | ||||
OldestReleased = (v[i]->getOrdinal() < tmpReleased) ? i : OldestReleased; | OldestReleased = (v[i]->getOrdinal() < tmpReleased) ? i : OldestReleased; | ||||
tmpReleased = v[OldestReleased]->getOrdinal(); | tmpReleased = v[OldestReleased]->getOrdinal(); | ||||
@@ -400,6 +407,8 @@ private: | |||||
double sampleRate; | double sampleRate; | ||||
int benchwarmer; | int benchwarmer; | ||||
AudioSampleBuffer tmpBuf; | |||||
VexVoice* vo1[kNumVoices]; | VexVoice* vo1[kNumVoices]; | ||||
VexVoice* vo2[kNumVoices]; | VexVoice* vo2[kNumVoices]; | ||||
VexVoice* vo3[kNumVoices]; | VexVoice* vo3[kNumVoices]; | ||||
@@ -158,7 +158,7 @@ void VexVoice::start(float f, float v, int n, int preroll, double s, long o) | |||||
isOn = true; | isOn = true; | ||||
isReleased = false; | isReleased = false; | ||||
v = (v * v) - 1.0f; | |||||
v = (v * v) - 1.0f; | |||||
Avelocity = (v * bipolar(parameters[18 + poff])); | Avelocity = (v * bipolar(parameters[18 + poff])); | ||||
Fvelocity = (1.0f + v) * bipolar(parameters[13 + poff]); | Fvelocity = (1.0f + v) * bipolar(parameters[13 + poff]); | ||||
@@ -8,7 +8,7 @@ | |||||
#ifndef _denormals_ | #ifndef _denormals_ | ||||
#define _denormals_ | #define _denormals_ | ||||
#define undenormalise(sample) if(((*(unsigned int*)&sample)&0x7f800000)==0) sample=0.0f | |||||
#define undenormalise(sample) { float* const _tmp_s(&sample); if (((*(unsigned int*)_tmp_s)&0x7f800000)==0) sample=0.0f; } | |||||
#endif//_denormals_ | #endif//_denormals_ | ||||