Browse Source

Unsort the testing midiseq events to really test RtList, works :)

tags/1.9.4
falkTX 11 years ago
parent
commit
96c9d10c5e
1 changed files with 51 additions and 38 deletions
  1. +51
    -38
      source/backend/native/midi-sequencer.cpp

+ 51
- 38
source/backend/native/midi-sequencer.cpp View File

@@ -38,7 +38,7 @@ public:
: PluginDescriptorClass(host), : PluginDescriptorClass(host),
fWantInEvents(false) fWantInEvents(false)
{ {
// TEST SONG
// TEST SONG (unsorted to test RtList API)


uint32_t m = 44; uint32_t m = 44;


@@ -46,15 +46,15 @@ public:
fOutEvents.addControl(0*m, 0, 10, 63); fOutEvents.addControl(0*m, 0, 10, 63);
fOutEvents.addProgram(0*m, 0, 0, 0); fOutEvents.addProgram(0*m, 0, 0, 0);


// 0 On ch=1 n=64 v=90
// 325 Off ch=1 n=64 v=90
// 384 On ch=1 n=62 v=90
// 709 Off ch=1 n=62 v=90
// 768 On ch=1 n=60 v=90
//1093 Off ch=1 n=60 v=90
fOutEvents.addNote( 0*m, 0, 64, 90, 325*m);
fOutEvents.addNote(384*m, 0, 62, 90, 325*m);
fOutEvents.addNote(768*m, 0, 60, 90, 325*m);
// 6912 On ch=1 n=60 v=90
// 7237 Off ch=1 n=60 v=90
// 7296 On ch=1 n=62 v=90
// 7621 Off ch=1 n=62 v=90
// 7680 On ch=1 n=64 v=90
// 8005 Off ch=1 n=64 v=90
fOutEvents.addNote(6912*m, 0, 60, 90, 325*m);
fOutEvents.addNote(7680*m, 0, 64, 90, 325*m);
fOutEvents.addNote(7296*m, 0, 62, 90, 325*m);


// 1152 On ch=1 n=62 v=90 // 1152 On ch=1 n=62 v=90
// 1477 Off ch=1 n=62 v=90 // 1477 Off ch=1 n=62 v=90
@@ -63,18 +63,8 @@ public:
// 1920 On ch=1 n=64 v=90 // 1920 On ch=1 n=64 v=90
// 2245 Off ch=1 n=64 v=90 // 2245 Off ch=1 n=64 v=90
fOutEvents.addNote(1152*m, 0, 62, 90, 325*m); fOutEvents.addNote(1152*m, 0, 62, 90, 325*m);
fOutEvents.addNote(1536*m, 0, 64, 90, 325*m);
fOutEvents.addNote(1920*m, 0, 64, 90, 325*m); fOutEvents.addNote(1920*m, 0, 64, 90, 325*m);

// 2304 On ch=1 n=64 v=90
// 2955 Off ch=1 n=64 v=90
// 3072 On ch=1 n=62 v=90
// 3397 Off ch=1 n=62 v=90
// 3456 On ch=1 n=62 v=90
// 3781 Off ch=1 n=62 v=90
fOutEvents.addNote(2304*m, 0, 64, 90, 650*m);
fOutEvents.addNote(3072*m, 0, 62, 90, 325*m);
fOutEvents.addNote(3456*m, 0, 62, 90, 325*m);
fOutEvents.addNote(1536*m, 0, 64, 90, 325*m);


// 3840 On ch=1 n=62 v=90 // 3840 On ch=1 n=62 v=90
// 4491 Off ch=1 n=62 v=90 // 4491 Off ch=1 n=62 v=90
@@ -83,8 +73,22 @@ public:
// 4992 On ch=1 n=67 v=90 // 4992 On ch=1 n=67 v=90
// 5317 Off ch=1 n=67 v=90 // 5317 Off ch=1 n=67 v=90
fOutEvents.addNote(3840*m, 0, 62, 90, 650*m); fOutEvents.addNote(3840*m, 0, 62, 90, 650*m);
fOutEvents.addNote(4608*m, 0, 64, 90, 325*m);
fOutEvents.addNote(4992*m, 0, 67, 90, 325*m); fOutEvents.addNote(4992*m, 0, 67, 90, 325*m);
fOutEvents.addNote(4608*m, 0, 64, 90, 325*m);

// 0 On ch=1 n=64 v=90
// 325 Off ch=1 n=64 v=90
// 384 On ch=1 n=62 v=90
// 709 Off ch=1 n=62 v=90
// 768 On ch=1 n=60 v=90
//1093 Off ch=1 n=60 v=90
fOutEvents.addNote( 0*m, 0, 64, 90, 325*m);
fOutEvents.addNote(768*m, 0, 60, 90, 325*m);
fOutEvents.addNote(384*m, 0, 62, 90, 325*m);

// 10752 On ch=1 n=60 v=90
// 12056 Off ch=1 n=60 v=90
fOutEvents.addNote(10752*m, 0, 60, 90, 650*m);


// 5376 On ch=1 n=67 v=90 // 5376 On ch=1 n=67 v=90
// 6027 Off ch=1 n=67 v=90 // 6027 Off ch=1 n=67 v=90
@@ -96,16 +100,6 @@ public:
fOutEvents.addNote(6144*m, 0, 64, 90, 325*m); fOutEvents.addNote(6144*m, 0, 64, 90, 325*m);
fOutEvents.addNote(6528*m, 0, 62, 90, 325*m); fOutEvents.addNote(6528*m, 0, 62, 90, 325*m);


// 6912 On ch=1 n=60 v=90
// 7237 Off ch=1 n=60 v=90
// 7296 On ch=1 n=62 v=90
// 7621 Off ch=1 n=62 v=90
// 7680 On ch=1 n=64 v=90
// 8005 Off ch=1 n=64 v=90
fOutEvents.addNote(6912*m, 0, 60, 90, 325*m);
fOutEvents.addNote(7296*m, 0, 62, 90, 325*m);
fOutEvents.addNote(7680*m, 0, 64, 90, 325*m);

// 8064 On ch=1 n=64 v=90 // 8064 On ch=1 n=64 v=90
// 8389 Off ch=1 n=64 v=90 // 8389 Off ch=1 n=64 v=90
// 8448 On ch=1 n=64 v=90 // 8448 On ch=1 n=64 v=90
@@ -126,9 +120,15 @@ public:
fOutEvents.addNote(9984*m, 0, 64, 90, 325*m); fOutEvents.addNote(9984*m, 0, 64, 90, 325*m);
fOutEvents.addNote(10368*m, 0, 62, 90, 325*m); fOutEvents.addNote(10368*m, 0, 62, 90, 325*m);


// 10752 On ch=1 n=60 v=90
// 12056 Off ch=1 n=60 v=90
fOutEvents.addNote(10752*m, 0, 60, 90, 650*m);
// 2304 On ch=1 n=64 v=90
// 2955 Off ch=1 n=64 v=90
// 3072 On ch=1 n=62 v=90
// 3397 Off ch=1 n=62 v=90
// 3456 On ch=1 n=62 v=90
// 3781 Off ch=1 n=62 v=90
fOutEvents.addNote(2304*m, 0, 64, 90, 650*m);
fOutEvents.addNote(3072*m, 0, 62, 90, 325*m);
fOutEvents.addNote(3456*m, 0, 62, 90, 325*m);
} }


~MidiSequencerPlugin() ~MidiSequencerPlugin()
@@ -254,18 +254,31 @@ private:
return; return;
} }


uint32_t lastTime = 0;

for (auto it = data.begin(); it.valid(); it.next()) for (auto it = data.begin(); it.valid(); it.next())
{ {
RawMidiEvent* const oldEvent(*it); RawMidiEvent* const oldEvent(*it);


if (time > oldEvent->time)
if (lastTime > time)
{ {
mutex.lock(); mutex.lock();
data.appendAt(event, it);
data.insertAt(event, it);
mutex.unlock(); mutex.unlock();
break;
return;
} }

lastTime = oldEvent->time;
}

if (time >= lastTime)
{
mutex.lock();
data.append(event);
mutex.unlock();
} }
else
carla_stderr2("MidiSequencerPlugin::appendAt() failed for time %i", time);
} }


void addControl(uint32_t time, uint8_t channel, uint8_t control, uint8_t value) void addControl(uint32_t time, uint8_t channel, uint8_t control, uint8_t value)


Loading…
Cancel
Save