13
0

DummyBackend: fix midi event mux+sorting

This commit is contained in:
Robin Gareus 2014-06-02 12:19:35 +02:00
parent 3f82052d11
commit f6d29abfc7

View File

@ -1264,6 +1264,12 @@ DummyMidiPort::DummyMidiPort (DummyAudioBackend &b, const std::string& name, Por
DummyMidiPort::~DummyMidiPort () { }
struct MidiEventSorter {
bool operator() (const boost::shared_ptr<DummyMidiEvent>& a, const boost::shared_ptr<DummyMidiEvent>& b) {
return *a < *b;
}
};
void* DummyMidiPort::get_buffer (pframes_t /* nframes */)
{
if (is_input ()) {
@ -1276,7 +1282,7 @@ void* DummyMidiPort::get_buffer (pframes_t /* nframes */)
_buffer.push_back (boost::shared_ptr<DummyMidiEvent>(new DummyMidiEvent (**it)));
}
}
std::sort (_buffer.begin (), _buffer.end ());
std::sort (_buffer.begin (), _buffer.end (), MidiEventSorter());
} else if (is_output () && is_physical () && is_terminal()) {
_buffer.clear ();
}