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
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
6 changed files with 9 additions and 15 deletions

View File

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

View File

@ -45,14 +45,13 @@ namespace ARDOUR {
class CoreAudioBackend;
class CoreMidiEvent {
class CoreMidiEvent : public BackendMIDIEvent {
public:
CoreMidiEvent (const pframes_t timestamp, const uint8_t* data, size_t size);
CoreMidiEvent (const CoreMidiEvent& other);
size_t size () const { return _size; };
pframes_t timestamp () const { return _timestamp; };
const uint8_t* data () const { return _data; };
bool operator< (const CoreMidiEvent &other) const { return timestamp () < other.timestamp (); };
private:
size_t _size;
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
float v = -.5f;
if ((*it)->size() == 3) {
const unsigned char *d = (*it)->const_data();
const unsigned char *d = (*it)->data();
if ((d[0] & 0xf0) == 0x90) { // note on
v = .25f + d[2] / 512.f;
}
@ -1890,9 +1890,9 @@ DummyMidiEvent::DummyMidiEvent (const DummyMidiEvent& other)
, _timestamp (other.timestamp ())
, _data (0)
{
if (other.size () && other.const_data ()) {
if (other.size () && other.data ()) {
_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:
DummyMidiEvent (const pframes_t timestamp, const uint8_t* data, size_t size);
DummyMidiEvent (const DummyMidiEvent& other);
~DummyMidiEvent ();
size_t size () const { return _size; };
pframes_t timestamp () const { return _timestamp; };
const unsigned char* const_data () const { return _data; };
unsigned char* data () { return _data; };
bool operator< (const DummyMidiEvent &other) const { return timestamp () < other.timestamp (); };
const uint8_t* data () const { return _data; };
private:
size_t _size;
pframes_t _timestamp;

View File

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

View File

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