Browse Source

Fix minor vexArp issue

tags/1.9.4
falkTX 11 years ago
parent
commit
6e781f09ce
1 changed files with 25 additions and 11 deletions
  1. +25
    -11
      source/modules/carla_native/vex-fx.cpp

+ 25
- 11
source/modules/carla_native/vex-fx.cpp View File

@@ -103,7 +103,8 @@ public:

VexArpPlugin(const HostDescriptor* const host)
: PluginClass(host),
fArp(&fSettings)
fArp(&fSettings),
fNeedsUpdate(true)
{
fArp.setSampleRate(getSampleRate());
fMidiInBuffer.ensureSize(512*4);
@@ -354,27 +355,28 @@ protected:
for (uint32_t i=0; i < midiEventCount; ++i)
{
const MidiEvent* const midiEvent(&midiEvents[i]);
fMidiInBuffer.addEvent(MidiMessage(midiEvent->data, midiEvent->size), midiEvent->time);
fMidiInBuffer.addEvent(midiEvent->data, midiEvent->size, midiEvent->time);
}

const MidiBuffer& outMidiBuffer(fArp.processMidi(fMidiInBuffer, timePlaying, ppqPos, barStartPos, bpm, frames));

MidiBuffer::Iterator outBufferIterator(outMidiBuffer);
MidiMessage midiMessage(0xf4);
const uint8_t* midiData;
int numBytes;
int sampleNumber;

MidiEvent tmpEvent;
tmpEvent.port = 0;

while (outBufferIterator.getNextEvent(midiMessage, sampleNumber))
while (outBufferIterator.getNextEvent(midiData, numBytes, sampleNumber))
{
tmpEvent.size = midiMessage.getRawDataSize();
tmpEvent.time = sampleNumber;

if (tmpEvent.size > 4)
if (numBytes <= 0 || numBytes > 4)
continue;

std::memcpy(tmpEvent.data, midiMessage.getRawData(), sizeof(uint8_t)*tmpEvent.size);
tmpEvent.size = numBytes;
tmpEvent.time = sampleNumber;

std::memcpy(tmpEvent.data, midiData, sizeof(uint8_t)*tmpEvent.size);
writeMidiEvent(&tmpEvent);
}
}
@@ -416,6 +418,17 @@ protected:
if (fWindow == nullptr)
return;

if (fNeedsUpdate)
{
if (fView != nullptr)
{
MessageManagerLock mmLock;
fView->update();
}

fNeedsUpdate = false;
}

if (fWindow->wasClosedByUser())
{
uiShow(false);
@@ -428,8 +441,7 @@ protected:
if (fView == nullptr)
return;

MessageManagerLock mmLock;
fView->update();
fNeedsUpdate = true;
}

// -------------------------------------------------------------------
@@ -462,6 +474,8 @@ private:
VexArp fArp;
MidiBuffer fMidiInBuffer;

volatile bool fNeedsUpdate;

ScopedPointer<PeggyViewComponent> fView;
ScopedPointer<HelperWindow> fWindow;



Loading…
Cancel
Save