Hosted by
|
with Token_Readers; use Token_Readers;
with Integer_Strings; use Integer_Strings;
package body Midi_Instruments.MusicXML is
function Read_Midi_Instrument
(XML : access XML_Reader)
return Midi_Instrument_Access
is
Channel : Natural;
Program : Natural;
begin
Assert_Attribute_Name(XML, "id");
Read_Attribute_Value(XML);
Exit_Tag(XML);
Channel := To_Number(Read_Element_Data(XML, "midi-channel"));
Program := To_Number(Read_Element_Data(XML, "midi-program"));
return Create(Get_Token(XML), Channel, Program);
end Read_Midi_Instrument;
procedure Write_Midi_Instrument
(XML : access XML_Writer;
This : access Midi_Instrument)
is
begin
Start_Element(XML, "midi-instrument", "id", Get_ID(This));
Write_Element(XML, "midi-channel", To_String(Get_Channel(This)));
Write_Element(XML, "midi-program", To_String(Get_Program(This)));
Close_Element(XML, "midi-instrument");
end Write_Midi_Instrument;
end Midi_Instruments.MusicXML;
|