map<string, Audio_staff*> staff_map_;
map<string, int> channel_map_;
map<string, Audio_dynamic*> dynamic_map_;
+ // Would prefer to have the following two items be
+ // members of the containing class Performance,
+ // so they can be reset for each new midi file output.
static map<string, int> static_channel_map_;
static int channel_count_;
+ // For now, ask the last Staff_performer clean up during its finalize method
+ static int staff_performer_count_;
};
map<string, int> Staff_performer::static_channel_map_;
int Staff_performer::channel_count_ = 0;
+int Staff_performer::staff_performer_count_ = 0;
#include "translator.icc"
void
Staff_performer::initialize ()
{
+ ++staff_performer_count_;
}
Audio_staff*
Staff_performer::new_audio_staff (string voice)
{
Audio_staff* audio_staff = new Audio_staff;
+ audio_staff->merge_unisons_
+ = to_boolean (get_property ("midiMergeUnisons"));
string track_name = context ()->id_string () + ":" + voice;
if (track_name != ":")
{
{
staff_map_.clear ();
channel_map_.clear ();
+ if (staff_performer_count_)
+ --staff_performer_count_;
+ if (0 == staff_performer_count_)
+ {
+ static_channel_map_.clear ();
+ channel_count_ = 0;
+ }
}
string
string str = new_instrument_string ();
if (channel_mapping != ly_symbol2scm ("instrument"))
channel_ = get_channel (voice);
- else if (str.empty ())
+ else if (channel_ < 0 && str.empty ())
channel_ = get_channel (str);
if (str.length ())
{