diff options
author | Hans Baier <hansfbaier@googlemail.com> | 2012-10-09 08:33:27 +0000 |
---|---|---|
committer | Hans Baier <hansfbaier@googlemail.com> | 2012-10-09 08:33:27 +0000 |
commit | c3850cfb35882fe330681fefe37cb8aaf519917f (patch) | |
tree | d02ad4f2139464254f4d67caa154d542e6e5d1fc /libs | |
parent | 5c2d7d36441131306b21b96f135ffd0a91b0c876 (diff) |
evoral/MIDIEvent: Whitespace cosmetics in header, make XML output work properly eg show the numbers instead of blanks
git-svn-id: svn://localhost/ardour2/branches/3.0@13221 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r-- | libs/evoral/evoral/MIDIEvent.hpp | 30 | ||||
-rw-r--r-- | libs/evoral/src/MIDIEvent.cpp | 10 |
2 files changed, 21 insertions, 19 deletions
diff --git a/libs/evoral/evoral/MIDIEvent.hpp b/libs/evoral/evoral/MIDIEvent.hpp index e38f4f55db..6ba7269571 100644 --- a/libs/evoral/evoral/MIDIEvent.hpp +++ b/libs/evoral/evoral/MIDIEvent.hpp @@ -57,9 +57,11 @@ public: inline uint8_t type() const { return (this->_buf[0] & 0xF0); } inline void set_type(uint8_t type) { this->_buf[0] = (0x0F & this->_buf[0]) | (0xF0 & type); } + inline uint8_t channel() const { return (this->_buf[0] & 0x0F); } inline void set_channel(uint8_t channel) { this->_buf[0] = (0xF0 & this->_buf[0]) | (0x0F & channel); } + inline bool is_note_on() const { return (type() == MIDI_CMD_NOTE_ON); } inline bool is_note_off() const { return (type() == MIDI_CMD_NOTE_OFF); } inline bool is_cc() const { return (type() == MIDI_CMD_CONTROL); } @@ -80,24 +82,24 @@ public: inline uint8_t cc_number() const { return (this->_buf[1]); } inline void set_cc_number(uint8_t number) { this->_buf[1] = number; } inline uint8_t cc_value() const { return (this->_buf[2]); } - inline void set_cc_value(uint8_t value) { this->_buf[2] = value; } + inline void set_cc_value(uint8_t value) { this->_buf[2] = value; } inline uint8_t pitch_bender_lsb() const { return (this->_buf[1]); } inline uint8_t pitch_bender_msb() const { return (this->_buf[2]); } inline uint16_t pitch_bender_value() const { return ( ((0x7F & this->_buf[2]) << 7) | (0x7F & this->_buf[1]) ); } - inline uint8_t pgm_number() const { return (this->_buf[1]); } - inline void set_pgm_number(uint8_t number){ this->_buf[1] = number; } - inline uint8_t aftertouch() const { return (this->_buf[1]); } - inline uint8_t channel_pressure() const { return (this->_buf[1]); } - inline bool is_channel_event() const { return (0x80 <= type()) && (type() <= 0xE0); } - inline bool is_smf_meta_event() const { return this->_buf[0] == 0xFF; } - inline bool is_sysex() const { return this->_buf[0] == 0xF0 - || this->_buf[0] == 0xF7; } - inline bool is_spp() const { return this->_buf[0] == 0xF2 && this->size() == 1; } - inline bool is_mtc_quarter() const { return this->_buf[0] == 0xF1 && this->size() == 1; } - inline bool is_mtc_full() const { - return this->size() == 10 && this->_buf[0] == 0xf0 && this->_buf[1] == 0x7f && - this->_buf[3] == 0x01 && this->_buf[4] == 0x01; + inline uint8_t pgm_number() const { return (this->_buf[1]); } + inline void set_pgm_number(uint8_t number) { this->_buf[1] = number; } + inline uint8_t aftertouch() const { return (this->_buf[1]); } + inline uint8_t channel_pressure() const { return (this->_buf[1]); } + inline bool is_channel_event() const { return (0x80 <= type()) && (type() <= 0xE0); } + inline bool is_smf_meta_event() const { return this->_buf[0] == 0xFF; } + inline bool is_sysex() const { return this->_buf[0] == 0xF0 + || this->_buf[0] == 0xF7; } + inline bool is_spp() const { return this->_buf[0] == 0xF2 && this->size() == 1; } + inline bool is_mtc_quarter() const { return this->_buf[0] == 0xF1 && this->size() == 1; } + inline bool is_mtc_full() const { + return this->size() == 10 && this->_buf[0] == 0xf0 && this->_buf[1] == 0x7f && + this->_buf[3] == 0x01 && this->_buf[4] == 0x01; } }; diff --git a/libs/evoral/src/MIDIEvent.cpp b/libs/evoral/src/MIDIEvent.cpp index c642bc3cc3..53dfbbc423 100644 --- a/libs/evoral/src/MIDIEvent.cpp +++ b/libs/evoral/src/MIDIEvent.cpp @@ -60,15 +60,15 @@ MIDIEvent<Time>::to_xml() const switch (type()) { case MIDI_CMD_CONTROL: result = new XMLNode("ControlChange"); - result->add_property("Channel", channel()); - result->add_property("Control", cc_number()); - result->add_property("Value", cc_value()); + result->add_property("Channel", long(channel())); + result->add_property("Control", long(cc_number())); + result->add_property("Value", long(cc_value())); break; case MIDI_CMD_PGM_CHANGE: result = new XMLNode("ProgramChange"); - result->add_property("Channel", channel()); - result->add_property("Number", pgm_number()); + result->add_property("Channel", long(channel())); + result->add_property("Number", long(pgm_number())); break; default: |