Browse Source

Cleanup

Signed-off-by: falkTX <falktx@falktx.com>
tags/v2.3.0-RC1
falkTX 4 years ago
parent
commit
c3c57aceb3
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
1 changed files with 7 additions and 5 deletions
  1. +7
    -5
      source/native-plugins/midi-base.hpp

+ 7
- 5
source/native-plugins/midi-base.hpp View File

@@ -233,6 +233,8 @@ public:


void play(long double timePosFrame, const double frames, const double offset = 0.0) void play(long double timePosFrame, const double frames, const double offset = 0.0)
{ {
long double ldtime;

if (! fMutex.tryLock()) if (! fMutex.tryLock())
return; return;


@@ -244,14 +246,14 @@ public:
const RawMidiEvent* const rawMidiEvent(it.getValue(nullptr)); const RawMidiEvent* const rawMidiEvent(it.getValue(nullptr));
CARLA_SAFE_ASSERT_CONTINUE(rawMidiEvent != nullptr); CARLA_SAFE_ASSERT_CONTINUE(rawMidiEvent != nullptr);


if (rawMidiEvent->time < timePosFrame)
ldtime = static_cast<long double>(rawMidiEvent->time);

if (ldtime < timePosFrame)
continue; continue;
if (static_cast<long double>(rawMidiEvent->time) > timePosFrame + frames)
if (ldtime > timePosFrame + frames)
break; break;


kPlayer->writeMidiEvent(fMidiPort,
static_cast<long double>(rawMidiEvent->time) - timePosFrame + offset,
rawMidiEvent);
kPlayer->writeMidiEvent(fMidiPort, ldtime + offset - timePosFrame, rawMidiEvent);
} }


fMutex.unlock(); fMutex.unlock();


Loading…
Cancel
Save