From: Jan Nieuwenhuizen Date: Sun, 9 Apr 2000 19:59:31 +0000 (+0200) Subject: patch::: 1.3.42.jcn3 X-Git-Tag: release/1.3.43~1 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=8078cece904bd8f6e95c0cb9aa23edc543f5c7e3;p=lilypond.git patch::: 1.3.42.jcn3 1.3.42.jcn3 =========== * Made a quick try at piano pedal performer, damper pedal only. --- Generated by janneke@gnu.org, From = lilypond-1.3.42.jcn2, To = lilypond-1.3.42.jcn3 usage cd lilypond-source-dir; patch -E -p1 < lilypond-1.3.42.jcn3.diff Patches do not contain automatically generated files or (urg) empty directories, i.e., you should rerun autoconf, configure --- diff --git a/CHANGES b/CHANGES index c0dc965600..b928854f95 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,14 @@ ---- ../lilypond-1.3.42/CHANGES Mon Apr 03 03:19:38 2000 +--- ../lilypond-1.3.42.jcn2/CHANGES Wed Apr 5 11:58:51 2000 +++ b/CHANGES Sun Apr 9 21:59:31 2000 +@@ -1,3 +1,8 @@ +1.3.42.jcn3 +=========== + +* Made a quick try at piano pedal performer, damper pedal only. + + 1.3.42.jcn2 + =========== + --- ../lilypond-1.3.42/CHANGES Mon Apr 03 03:19:38 2000 ++ b/CHANGES Sun Apr 09 10:06:47 2000 @@ -1,4 +1,8 @@ 1.3.42.jbr1 diff --git a/VERSION b/VERSION index abd178b375..d8cad6bcf3 100644 --- a/VERSION +++ b/VERSION @@ -2,7 +2,7 @@ PACKAGE_NAME=LilyPond MAJOR_VERSION=1 MINOR_VERSION=3 PATCH_LEVEL=42 -MY_PATCH_LEVEL=jbr1 +MY_PATCH_LEVEL=jcn3 # use the above to send patches: MY_PATCH_LEVEL is always empty for a # released version. diff --git a/lily/include/audio-item.hh b/lily/include/audio-item.hh index 9b59283804..9c01181055 100644 --- a/lily/include/audio-item.hh +++ b/lily/include/audio-item.hh @@ -76,6 +76,12 @@ public: Audio_note* tied_; }; +class Audio_piano_pedal : public Audio_item +{ +public: + bool type_b_; +}; + class Audio_text : public Audio_item { public: diff --git a/lily/include/midi-item.hh b/lily/include/midi-item.hh index c9823dbcf2..2dac25e853 100644 --- a/lily/include/midi-item.hh +++ b/lily/include/midi-item.hh @@ -12,6 +12,7 @@ #include "lily-proto.hh" #include "proto.hh" #include "moment.hh" +#include "audio-item.hh" /** Any piece of midi information. @@ -170,6 +171,16 @@ public: Audio_dynamic* audio_l_; }; +class Midi_piano_pedal : public Midi_item +{ +public: + Midi_piano_pedal (Audio_piano_pedal*); + + virtual String str () const; + + Audio_piano_pedal* audio_l_; +}; + class Midi_tempo : public Midi_item { public: diff --git a/lily/midi-item.cc b/lily/midi-item.cc index a5921325e2..6832692129 100644 --- a/lily/midi-item.cc +++ b/lily/midi-item.cc @@ -29,6 +29,8 @@ Midi_item::midi_p (Audio_item* a) return new Midi_note (i); else if (Audio_dynamic* i = dynamic_cast (a)) return new Midi_dynamic (i); + else if (Audio_piano_pedal* i = dynamic_cast (a)) + return new Midi_piano_pedal (i); else if (Audio_tempo* i = dynamic_cast (a)) return new Midi_tempo (i); else if (Audio_time_signature* i = dynamic_cast (a)) @@ -489,6 +491,23 @@ Midi_dynamic::str () const 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; diff --git a/lily/piano-pedal-performer.cc b/lily/piano-pedal-performer.cc new file mode 100644 index 0000000000..f5cfd90895 --- /dev/null +++ b/lily/piano-pedal-performer.cc @@ -0,0 +1,106 @@ +/* + piano-pedal-performer.cc -- implement Piano_pedal_performer + + source file of the GNU LilyPond music typesetter + + (c) 2000 Jan Nieuwenhuizen +*/ + +#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_p_arr_; + Span_req* span_start_req_l_; + Drul_array 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(r)) + { + if (s-> span_type_str_ == "sustain") + { + span_req_l_drul_[s->span_dir_] = s; + return true; + } + } + return false; +} diff --git a/ly/performer.ly b/ly/performer.ly index ff373d5219..3337c51cc8 100644 --- a/ly/performer.ly +++ b/ly/performer.ly @@ -24,6 +24,7 @@ VoiceContext = \translator { % All notes fall to Grace if you leave Thread out (huh?) \consists "Dynamic_performer"; \consists "Span_dynamic_performer"; + \consists "Piano_pedal_performer"; \consists "Grace_position_performer"; \accepts Thread; \accepts Grace; diff --git a/ly/spanners.ly b/ly/spanners.ly index 4b3d6bdb13..4d1025cb0a 100644 --- a/ly/spanners.ly +++ b/ly/spanners.ly @@ -23,6 +23,9 @@ xendcresc = { cresc = \spanrequest \start "crescendo" endcresc = \spanrequest \stop "crescendo" +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."