return new Midi_note (i);
else if (Audio_dynamic* i = dynamic_cast<Audio_dynamic*> (a))
return new Midi_dynamic (i);
+ else if (Audio_piano_pedal* i = dynamic_cast<Audio_piano_pedal*> (a))
+ return new Midi_piano_pedal (i);
else if (Audio_tempo* i = dynamic_cast<Audio_tempo*> (a))
return new Midi_tempo (i);
else if (Audio_time_signature* i = dynamic_cast<Audio_time_signature*> (a))
return str;
}
+Midi_piano_pedal::Midi_piano_pedal (Audio_piano_pedal* a)
+{
+ audio_l_ = a;
+}
+
+String
+Midi_piano_pedal::str () const
+{
+ Byte status_byte = (char) (0xB0 + channel_i_);
+ String str = to_str ((char)status_byte);
+
+ str += to_str ((char)0x40);
+ int pedal = audio_l_->type_b_ ? 0x7f : 0;
+ str += to_str ((char)pedal);
+ return str;
+}
+
Midi_tempo::Midi_tempo (Audio_tempo* a)
{
audio_l_ = a;
--- /dev/null
+/*
+ piano-pedal-performer.cc -- implement Piano_pedal_performer
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 2000 Jan Nieuwenhuizen <janneke@gnu.org>
+*/
+
+#include "performer.hh"
+#include "command-request.hh"
+#include "musical-request.hh"
+#include "audio-item.hh"
+
+
+/*
+ TODO:
+ sostenuto
+ una-chorda ?
+ */
+
+/**
+ perform Piano pedals
+ */
+class Piano_pedal_performer : public Performer
+{
+public:
+ VIRTUAL_COPY_CONS (Translator);
+
+ Piano_pedal_performer ();
+
+protected:
+ virtual bool do_try_music (Music*);
+ virtual void do_process_music ();
+ virtual void do_pre_move_processing ();
+ virtual void do_post_move_processing ();
+
+private:
+ Link_array<Audio_piano_pedal> audio_p_arr_;
+ Span_req* span_start_req_l_;
+ Drul_array<Span_req*> span_req_l_drul_;
+};
+
+ADD_THIS_TRANSLATOR (Piano_pedal_performer);
+
+Piano_pedal_performer::Piano_pedal_performer ()
+{
+ span_req_l_drul_[START] = 0;
+ span_req_l_drul_[STOP] = 0;
+ span_start_req_l_ = 0;
+}
+
+void
+Piano_pedal_performer::do_process_music ()
+{
+ if (span_req_l_drul_[STOP])
+ {
+ if (!span_start_req_l_)
+ {
+ span_req_l_drul_[STOP]->warning (_ ("can't find start of piano_pedal"));
+ }
+ else
+ {
+ Audio_piano_pedal* p = new Audio_piano_pedal;
+ p->type_b_ = false;
+ audio_p_arr_.push (p);
+ }
+ span_start_req_l_ = 0;
+ }
+
+ if (span_req_l_drul_[START])
+ {
+ span_start_req_l_ = span_req_l_drul_[START];
+ Audio_piano_pedal* p = new Audio_piano_pedal;
+ p->type_b_ = true;
+ audio_p_arr_.push (p);
+ }
+}
+
+void
+Piano_pedal_performer::do_pre_move_processing ()
+{
+ for (int i=0; i < audio_p_arr_.size (); i++)
+ play_element (audio_p_arr_[i]);
+ audio_p_arr_.clear ();
+}
+
+void
+Piano_pedal_performer::do_post_move_processing ()
+{
+ span_req_l_drul_[STOP] = 0;
+ span_req_l_drul_[START] = 0;
+}
+
+bool
+Piano_pedal_performer::do_try_music (Music* r)
+{
+ if (Span_req * s = dynamic_cast<Span_req*>(r))
+ {
+ if (s-> span_type_str_ == "sustain")
+ {
+ span_req_l_drul_[s->span_dir_] = s;
+ return true;
+ }
+ }
+ return false;
+}
cresc = \spanrequest \start "crescendo"
endcresc = \spanrequest \stop "crescendo"
+% better name sustainstart/stop?
+sustaindown = \spanrequest \start "sustain"
+sustainup = \spanrequest \stop "sustain"
+
%crescpoco = \property Voice.crescendoText = "cresc. poco a poco"
%decresc = \property Voice.crescendoText = "decr."
%dim = \property Voice.crescendoText = "dim."