X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fstaff-performer.cc;h=d3368ad683820c771dd6ce398d60ea606927bec3;hb=e7aa6c445f463844dbaa52d38ea4aac2882b5601;hp=c06ad9b72189a6416b93848c7f70f9b353071de1;hpb=00216e16c717470ae53dbbfd1d52850d1b102e29;p=lilypond.git diff --git a/lily/staff-performer.cc b/lily/staff-performer.cc index c06ad9b721..d3368ad683 100644 --- a/lily/staff-performer.cc +++ b/lily/staff-performer.cc @@ -1,7 +1,7 @@ /* This file is part of LilyPond, the GNU music typesetter. - Copyright (C) 1997--2012 Jan Nieuwenhuizen + Copyright (C) 1997--2014 Jan Nieuwenhuizen LilyPond is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -128,6 +128,32 @@ Staff_performer::new_audio_staff (const string &voice) staff_map_[voice] = audio_staff; if (!instrument_string_.empty ()) set_instrument (channel_, voice); + // Set initial values (if any) for control functions. + for (const Audio_control_function_value_change::Context_property *p + = Audio_control_function_value_change::context_properties_; + p->name_; ++p) + { + SCM value = get_property (p->name_); + if (scm_is_number (value)) + { + Real val = scm_to_double (value); + if (val >= p->range_min_ && val <= p->range_max_) + { + // Normalize the value to the 0.0 to 1.0 range. + val = ((val - p->range_min_) + / (p->range_max_ - p->range_min_)); + Audio_control_function_value_change *item + = new Audio_control_function_value_change (p->control_, val); + item->channel_ = channel_; + audio_staff->add_audio_item (item); + announce_element (Audio_element_info (item, 0)); + } + else + warning (_f ("ignoring out-of-range value change for MIDI " + "property `%s'", + p->name_)); + } + } return audio_staff; }