+
+ if (dynamics_.size () <= 1)
+ {
+ programming_error ("Impossible or ambiguous (de)crescendo in MIDI.");
+ return;
+ }
+
+ Real start_v = dynamics_[0]->volume_;
+ if (dynamics_.back ()->volume_ < 0)
+ {
+ // The dynamic spanner does not end with an explicit dynamic script
+ // event. Adjust the end volume by at most 1/4 of the available
+ // volume range in this case.
+ dynamics_.back ()->volume_ = max (min (start_v + grow_dir_ * (max_volume_ - min_volume_) * 0.25, max_volume_), min_volume_);
+ }
+
+ Real delta_v = dynamics_.back ()->volume_ - dynamics_[0]->volume_;
+
+ Moment start = dynamics_[0]->get_column ()->when ();
+
+ Real total_t = moment_to_real (dynamics_.back ()->get_column ()->when () - start);
+
+ for (vsize i = 1; i < dynamics_.size (); i++)
+ {
+ Moment dt_moment = dynamics_[i]->get_column ()->when ()
+ - start;
+
+ Real dt = moment_to_real (dt_moment);
+
+ Real v = start_v + delta_v * (dt / total_t);
+
+ dynamics_[i]->volume_ = v;
+ }
+}
+
+Audio_tempo::Audio_tempo (int per_minute_4)
+{
+ per_minute_4_ = per_minute_4;
+}
+
+Audio_time_signature::Audio_time_signature (int beats, int one_beat)
+{
+ beats_ = beats;
+ one_beat_ = one_beat;
+}
+
+Audio_text::Audio_text (Audio_text::Type type, const string &text_string)
+{
+ text_string_ = text_string;
+ type_ = type;
+}
+
+Audio_control_function_value_change
+::Audio_control_function_value_change (Control control, Real value)
+ : control_ (control), value_ (value)
+{