diff options
author | Werner Schweer <ws.seh.de> | 2006-08-28 19:24:58 +0000 |
---|---|---|
committer | Werner Schweer <ws.seh.de> | 2006-08-28 19:24:58 +0000 |
commit | a5714cfa3280425c0e6c452a7f2bb4a89606bd92 (patch) | |
tree | e34d549b9af2fd04d24824c36662c2ddd388fe63 | |
parent | 0c493461b6b2f5156909bd36bfbbb6451c7424a7 (diff) |
added midi plugin rack for midi port strips
added simple midi dump plugin
-rw-r--r-- | muse/ChangeLog | 2 | ||||
-rw-r--r-- | muse/midiplugins/CMakeLists.txt | 2 | ||||
-rw-r--r-- | muse/muse/midi.cpp | 100 | ||||
-rw-r--r-- | muse/muse/mixer/mstrip.cpp | 12 |
4 files changed, 70 insertions, 46 deletions
diff --git a/muse/ChangeLog b/muse/ChangeLog index 0b95f357..0aea89c9 100644 --- a/muse/ChangeLog +++ b/muse/ChangeLog @@ -1,4 +1,6 @@ 28.8 (ws) + * added simple midi event dump plugin + * add midi plugin rack to midi port strips * supply correct position information to midi plugins in midi input strips * fixed: playing synti from midi track diff --git a/muse/midiplugins/CMakeLists.txt b/muse/midiplugins/CMakeLists.txt index cca0fb38..dca0bcaa 100644 --- a/muse/midiplugins/CMakeLists.txt +++ b/muse/midiplugins/CMakeLists.txt @@ -18,7 +18,7 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. #============================================================================= -subdirs(libmidiplugin filter metronom transform trigg ) +subdirs(libmidiplugin filter metronom transform trigg dump ) set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DQT_NO_DEBUG -DQT_PLUGIN -DQT_SHARED -fPIC" diff --git a/muse/muse/midi.cpp b/muse/muse/midi.cpp index ced92d9e..5cd6d8a9 100644 --- a/muse/muse/midi.cpp +++ b/muse/muse/midi.cpp @@ -36,6 +36,7 @@ #include "al/tempo.h" #include "al/sig.h" #include "part.h" +#include "midiplugin.h" extern void dump(const unsigned char* p, int n); @@ -738,64 +739,75 @@ void MidiOutPort::process(unsigned from, unsigned to, const Pos& pos, unsigned f } } addMidiMeter(portVelo); + + // TODO: maybe this copying can be avoided + // + MPEventList il; + for (iMPEvent i = _playEvents.begin(); i != _playEvents.end(); ++i) { + il.add(*i); + } + _playEvents.clear(); + pipeline()->apply(from, to, &il, &_playEvents); + _nextPlayEvent = _playEvents.begin(); // // route events to destination // - if (_playEvents.size() > 0) { - //printf("_playEvents.size() == %d\n", _playEvents.size()); - unsigned endFrame = pos.frame() + frames + audio->getFrameOffset(); - for (iRoute r = _outRoutes.begin(); r != _outRoutes.end(); ++r) { - switch (r->type) { - - // - // Send events to software synthesizer - // - case Route::SYNTIPORT: { - SynthI* s = (SynthI*)(r->track); - MPEventList* el = s->playEvents(); - iMPEvent is = _playEvents.begin(); - iMPEvent ie = _playEvents.end(); - - for (; is != ie; ++is) { - if ((from != to) && (is->time() >= endFrame)) { - break; - } + if (_playEvents.empty()) + return; - el->insert(*is); - _nextPlayEvent = is; - _nextPlayEvent++; - } - } - break; + //printf("_playEvents.size() == %d\n", _playEvents.size()); + unsigned endFrame = pos.frame() + frames + audio->getFrameOffset(); + for (iRoute r = _outRoutes.begin(); r != _outRoutes.end(); ++r) { + switch (r->type) { - // - // Send events to midi port - // - case Route::MIDIPORT: { - //playEventList(); - for (iMPEvent ev = _playEvents.begin(); ev != _playEvents.end(); ev++) { - if ((from != to) && (ev->time() >= endFrame)) { - break; - } + // + // Send events to software synthesizer + // + case Route::SYNTIPORT: { + SynthI* s = (SynthI*)(r->track); + MPEventList* el = s->playEvents(); + iMPEvent is = _playEvents.begin(); + iMPEvent ie = _playEvents.end(); - midiDriver->putEvent(alsaPort, *ev); - _nextPlayEvent = ev; - _nextPlayEvent++; + for (; is != ie; ++is) { + if ((from != to) && (is->time() >= endFrame)) { + break; } + + el->insert(*is); + _nextPlayEvent = is; + _nextPlayEvent++; } - break; + } + break; + // + // Send events to midi port + // + case Route::MIDIPORT: { + //playEventList(); + for (iMPEvent ev = _playEvents.begin(); ev != _playEvents.end(); ev++) { + if ((from != to) && (ev->time() >= endFrame)) { + break; + } - // Invalid routetypes to send midi events to - should not happen - case Route::AUDIOPORT: - case Route::TRACK: - default: - printf("Error - invalid routetype\n"); - break; + midiDriver->putEvent(alsaPort, *ev); + _nextPlayEvent = ev; + _nextPlayEvent++; + } } + break; + + + // Invalid routetypes to send midi events to - should not happen + case Route::AUDIOPORT: + case Route::TRACK: + default: + printf("Error - invalid routetype\n"); + break; } } } diff --git a/muse/muse/mixer/mstrip.cpp b/muse/muse/mixer/mstrip.cpp index 0309a0b2..fad96b07 100644 --- a/muse/muse/mixer/mstrip.cpp +++ b/muse/muse/mixer/mstrip.cpp @@ -683,9 +683,19 @@ void MidiStrip::oRoutePressed() MidiOutPortStrip::MidiOutPortStrip(Mixer* m, MidiOutPort* t, bool align) : Strip(m, t, align) { + //--------------------------------------------------- + // plugin rack + //--------------------------------------------------- + + MidiRack* rack = new MidiRack(this, t); + rack->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); + rack->setFixedSize(STRIP_WIDTH, rack->sizeHint().height()+2); + layout->addWidget(rack); + int auxsSize = song->auxs()->size(); if (_align) - layout->addSpacing((STRIP_WIDTH/2 + 1) * auxsSize + STRIP_WIDTH/2 * 3); +// layout->addSpacing((STRIP_WIDTH/2 + 1) * auxsSize + STRIP_WIDTH/2 * 3); + layout->addSpacing((STRIP_WIDTH/2 + 1) * auxsSize + STRIP_WIDTH/2); volumeTouched = false; |