diff options
author | Tim E. Real <termtech@rogers.com> | 2012-10-28 01:34:16 +0000 |
---|---|---|
committer | Tim E. Real <termtech@rogers.com> | 2012-10-28 01:34:16 +0000 |
commit | b45ce65ca39817a0678f2172410b71433f79f736 (patch) | |
tree | 4a193aaa1ba899f17e298826ae4b44a15a763b7a /muse2/muse/track.cpp | |
parent | b1776f093d4b87ad2635990f429f4503157f6288 (diff) |
Improved: Eliminated copious unrequired "controller" sections from songs and templates.
Eliminated ALL "controller" and "midiport" sections from built-in templates.
For template "synth.med", changed synth ports to 198 and 199.
Improved: Templates, use your chosen default output port/channel from the midi ports setup dialog.
Diffstat (limited to 'muse2/muse/track.cpp')
-rw-r--r-- | muse2/muse/track.cpp | 47 |
1 files changed, 43 insertions, 4 deletions
diff --git a/muse2/muse/track.cpp b/muse2/muse/track.cpp index 0fa419c6..b18a9410 100644 --- a/muse2/muse/track.cpp +++ b/muse2/muse/track.cpp @@ -1037,10 +1037,49 @@ void MidiTrack::read(Xml& xml) if(p) parts()->add(p); } - else if (tag == "device") - setOutPort(xml.parseInt()); - else if (tag == "channel") - setOutChannel(xml.parseInt()); + // TODO: These two device and channel sections will need to change + // if and when multiple output routes are supported. + // For now just look for the first default (there's only one)... + else if (tag == "device") { + int port = xml.parseInt(); + if(port == -1) + { + for(int i = 0; i < MIDI_PORTS; ++i) + { + if(MusEGlobal::midiPorts[i].defaultOutChannels()) + { + port = i; + break; + } + } + } + if(port == -1) + port = 0; + setOutPort(port); + } + else if (tag == "channel") { + int chan = xml.parseInt(); + if(chan == -1) + { + for(int i = 0; i < MIDI_PORTS; ++i) + { + int defchans = MusEGlobal::midiPorts[i].defaultOutChannels(); + for(int c = 0; c < MIDI_CHANNELS; ++c) + { + if(defchans & (1 << c)) + { + chan = c; + break; + } + } + if(chan != -1) + break; + } + } + if(chan == -1) + chan = 0; + setOutChannel(chan); + } else if (tag == "inportMap") portmask = xml.parseUInt(); // Obsolete but support old files. else if (tag == "inchannelMap") |