19 #ifndef EVORAL_MIDI_XML_HPP
20 #define EVORAL_MIDI_XML_HPP
28 template<
typename Time>
32 if (node.
name() ==
"ControlChange") {
37 }
else if (node.
name() ==
"ProgramChange") {
46 template<
typename Time>
47 std::shared_ptr<XMLNode>
54 result =
new XMLNode(
"ControlChange");
55 result->add_property(
"Channel",
long(ev.
channel()));
56 result->add_property(
"Control",
long(ev.
cc_number()));
57 result->add_property(
"Value",
long(ev.
cc_value()));
61 result =
new XMLNode(
"ProgramChange");
62 result->add_property(
"Channel",
long(ev.
channel()));
63 result->add_property(
"Number",
long(ev.
pgm_number()));
68 result->add_property(
"Channel",
long(ev.
channel()));
69 result->add_property(
"Note",
long(ev.
note()));
70 result->add_property(
"Velocity",
long(ev.
velocity()));
74 result =
new XMLNode(
"NoteOff");
75 result->add_property(
"Channel",
long(ev.
channel()));
76 result->add_property(
"Note",
long(ev.
note()));
77 result->add_property(
"Velocity",
long(ev.
velocity()));
81 result =
new XMLNode(
"PitchBendChange");
82 result->add_property(
"Channel",
long(ev.
channel()));
87 return std::shared_ptr<XMLNode>();
90 return std::shared_ptr<XMLNode>(result);
uint8_t cc_number() const
uint8_t pgm_number() const
void set_pgm_number(uint8_t num)
void set_cc_value(uint8_t val)
void set_type(uint8_t type)
uint16_t pitch_bender_value() const
void set_cc_number(uint8_t num)
const std::string & name() const
XMLProperty const * property(const char *) const
const std::string & value() const
#define MIDI_CMD_PGM_CHANGE
#define MIDI_CMD_NOTE_OFF
std::shared_ptr< XMLNode > midi_to_xml(const Evoral::Event< Time > &ev)
bool xml_to_midi(const XMLNode &node, Evoral::Event< Time > &ev)
int atoi(const std::string &)