]> git.donarmstrong.com Git - lilypond.git/commitdiff
patch::: 1.3.42.jcn3
authorJan Nieuwenhuizen <janneke@gnu.org>
Sun, 9 Apr 2000 19:59:31 +0000 (21:59 +0200)
committerJan Nieuwenhuizen <janneke@gnu.org>
Sun, 9 Apr 2000 19:59:31 +0000 (21:59 +0200)
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

CHANGES
VERSION
lily/include/audio-item.hh
lily/include/midi-item.hh
lily/midi-item.cc
lily/piano-pedal-performer.cc [new file with mode: 0644]
ly/performer.ly
ly/spanners.ly

diff --git a/CHANGES b/CHANGES
index c0dc9656007c4a5c22bf36d7527dfc12b6d52aea..b928854f9513aa2c1439362b3acd78e1ea84a3b9 100644 (file)
--- 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 abd178b3753fb5f6f5aa53051c27b6693be70f53..d8cad6bcf393f2d5fd8a4b8cbd6e0488db1cbbde 100644 (file)
--- 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.
index 9b59283804b7aadf1f175db801a36b611b265f90..9c01181055731e33127fb646eba17dba752d9871 100644 (file)
@@ -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:
index c9823dbcf2b50b1a78b1280fc9733e1ebcae8762..2dac25e853e644727c6ed67b4c79b5118b0cf69a 100644 (file)
@@ -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:
index a5921325e248607c02cadc7192891f4654467412..683269212963467181b66a7acc333b56cc307b29 100644 (file)
@@ -29,6 +29,8 @@ Midi_item::midi_p (Audio_item* a)
     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))
@@ -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 (file)
index 0000000..f5cfd90
--- /dev/null
@@ -0,0 +1,106 @@
+/*
+ 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;
+}
index ff373d52197ac71af5d68ab31cd49f5a28b0d949..3337c51cc821c1ed66703adbce4fcc819e51d4dc 100644 (file)
@@ -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;
index 4b3d6bdb138d20297547329ac59378992e11933a..4d1025cb0aa2646408c87addc4e579e25855ad81 100644 (file)
@@ -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."