Use shared port engine MIDI event compare operator

This commit is contained in:
Robin Gareus 2021-11-30 18:37:29 +01:00
parent dbd8089fb8
commit a393f75694
No known key found for this signature in database
GPG key ID: A090BCE02CF57F04
6 changed files with 9 additions and 15 deletions

View file

@ -50,14 +50,13 @@ namespace ARDOUR {
class AlsaAudioBackend; class AlsaAudioBackend;
class AlsaMidiEvent { class AlsaMidiEvent : public BackendMIDIEvent {
public: public:
AlsaMidiEvent (const pframes_t timestamp, const uint8_t* data, size_t size); AlsaMidiEvent (const pframes_t timestamp, const uint8_t* data, size_t size);
AlsaMidiEvent (const AlsaMidiEvent& other); AlsaMidiEvent (const AlsaMidiEvent& other);
size_t size () const { return _size; }; size_t size () const { return _size; };
pframes_t timestamp () const { return _timestamp; }; pframes_t timestamp () const { return _timestamp; };
const uint8_t* data () const { return _data; }; const uint8_t* data () const { return _data; };
bool operator< (const AlsaMidiEvent &other) const { return timestamp () < other.timestamp (); };
private: private:
size_t _size; size_t _size;
pframes_t _timestamp; pframes_t _timestamp;

View file

@ -45,14 +45,13 @@ namespace ARDOUR {
class CoreAudioBackend; class CoreAudioBackend;
class CoreMidiEvent { class CoreMidiEvent : public BackendMIDIEvent {
public: public:
CoreMidiEvent (const pframes_t timestamp, const uint8_t* data, size_t size); CoreMidiEvent (const pframes_t timestamp, const uint8_t* data, size_t size);
CoreMidiEvent (const CoreMidiEvent& other); CoreMidiEvent (const CoreMidiEvent& other);
size_t size () const { return _size; }; size_t size () const { return _size; };
pframes_t timestamp () const { return _timestamp; }; pframes_t timestamp () const { return _timestamp; };
const uint8_t* data () const { return _data; }; const uint8_t* data () const { return _data; };
bool operator< (const CoreMidiEvent &other) const { return timestamp () < other.timestamp (); };
private: private:
size_t _size; size_t _size;
pframes_t _timestamp; pframes_t _timestamp;

View file

@ -1387,7 +1387,7 @@ void DummyAudioPort::midi_to_wavetable (DummyMidiBuffer const * const src, size_
// somewhat arbitrary mapping for quick visual feedback // somewhat arbitrary mapping for quick visual feedback
float v = -.5f; float v = -.5f;
if ((*it)->size() == 3) { if ((*it)->size() == 3) {
const unsigned char *d = (*it)->const_data(); const unsigned char *d = (*it)->data();
if ((d[0] & 0xf0) == 0x90) { // note on if ((d[0] & 0xf0) == 0x90) { // note on
v = .25f + d[2] / 512.f; v = .25f + d[2] / 512.f;
} }
@ -1890,9 +1890,9 @@ DummyMidiEvent::DummyMidiEvent (const DummyMidiEvent& other)
, _timestamp (other.timestamp ()) , _timestamp (other.timestamp ())
, _data (0) , _data (0)
{ {
if (other.size () && other.const_data ()) { if (other.size () && other.data ()) {
_data = (uint8_t*) malloc (other.size ()); _data = (uint8_t*) malloc (other.size ());
memcpy (_data, other.const_data (), other.size ()); memcpy (_data, other.data (), other.size ());
} }
}; };

View file

@ -52,16 +52,14 @@ namespace DummyMidiData {
}; };
class DummyMidiEvent { class DummyMidiEvent : public BackendMIDIEvent {
public: public:
DummyMidiEvent (const pframes_t timestamp, const uint8_t* data, size_t size); DummyMidiEvent (const pframes_t timestamp, const uint8_t* data, size_t size);
DummyMidiEvent (const DummyMidiEvent& other); DummyMidiEvent (const DummyMidiEvent& other);
~DummyMidiEvent (); ~DummyMidiEvent ();
size_t size () const { return _size; }; size_t size () const { return _size; };
pframes_t timestamp () const { return _timestamp; }; pframes_t timestamp () const { return _timestamp; };
const unsigned char* const_data () const { return _data; }; const uint8_t* data () const { return _data; };
unsigned char* data () { return _data; };
bool operator< (const DummyMidiEvent &other) const { return timestamp () < other.timestamp (); };
private: private:
size_t _size; size_t _size;
pframes_t _timestamp; pframes_t _timestamp;

View file

@ -43,14 +43,13 @@ namespace ARDOUR {
class PortAudioBackend; class PortAudioBackend;
class PortMidiEvent { class PortMidiEvent : public BackendMIDIEvent {
public: public:
PortMidiEvent (const pframes_t timestamp, const uint8_t* data, size_t size); PortMidiEvent (const pframes_t timestamp, const uint8_t* data, size_t size);
PortMidiEvent (const PortMidiEvent& other); PortMidiEvent (const PortMidiEvent& other);
size_t size () const { return _size; }; size_t size () const { return _size; };
pframes_t timestamp () const { return _timestamp; }; pframes_t timestamp () const { return _timestamp; };
const uint8_t* data () const { return _data; }; const uint8_t* data () const { return _data; };
bool operator< (const PortMidiEvent &other) const { return timestamp () < other.timestamp (); };
private: private:
size_t _size; size_t _size;
pframes_t _timestamp; pframes_t _timestamp;

View file

@ -43,7 +43,7 @@ namespace ARDOUR {
class PulseAudioBackend; class PulseAudioBackend;
class PulseMidiEvent class PulseMidiEvent : public BackendMIDIEvent
{ {
public: public:
PulseMidiEvent (const pframes_t timestamp, const uint8_t* data, size_t size); PulseMidiEvent (const pframes_t timestamp, const uint8_t* data, size_t size);
@ -53,7 +53,6 @@ public:
pframes_t timestamp () const { return _timestamp; }; pframes_t timestamp () const { return _timestamp; };
const uint8_t* data () const { return _data; }; const uint8_t* data () const { return _data; };
const uint8_t* const_data () const { return _data; }; const uint8_t* const_data () const { return _data; };
bool operator< (const PulseMidiEvent& other) const { return timestamp () < other.timestamp (); };
private: private:
size_t _size; size_t _size;