]> git.donarmstrong.com Git - lilypond.git/commitdiff
* python/convertrules.py (conv): warning on \tempo{}
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Tue, 22 Aug 2006 10:23:27 +0000 (10:23 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Tue, 22 Aug 2006 10:23:27 +0000 (10:23 +0000)
* ly/performer-init.ly: set tempoWholesPerMinute.

* ly/midi-init.ly: remove \midi

* lily/tempo-performer.cc: look at tempoWholesPerMinute to set
MIDI tempo.

* lily/metronome-engraver.cc (process_music): use tempoUnitCount
tempoUnitDuration for determining what to print.

* lily/lyric-extender.cc: typo.

* lily/parser.yy (output_def_body): disallow \tempo in \midi{}

* lily/duration-scheme.cc (LY_DEFINE): ly:duration-length: new function.

* THANKS: update sponsors.

* ly/english.ly: quarter tone naming (thanks, Trevor Baca)

15 files changed:
ChangeLog
VERSION
lily/duration-scheme.cc
lily/lyric-extender.cc
lily/metronome-engraver.cc
lily/parser.yy
lily/tempo-performer.cc
ly/midi-init.ly
ly/performer-init.ly
python/convertrules.py
scm/define-context-properties.scm
scm/define-event-classes.scm
scm/define-music-types.scm
scm/ly-syntax-constructors.scm
scm/translation-functions.scm

index 8f067a5be64c65321b64c9aa63327753dae4c4c5..fa82ee28f6af8bed7bdecbca67cee79babc16658 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,23 @@
 2006-08-22  Han-Wen Nienhuys  <hanwen@lilypond.org>
 
+       * python/convertrules.py (conv): warning on \tempo{}
+
+       * ly/performer-init.ly: set tempoWholesPerMinute.
+
+       * ly/midi-init.ly: remove \midi
+
+       * lily/tempo-performer.cc: look at tempoWholesPerMinute to set
+       MIDI tempo.
+
+       * lily/metronome-engraver.cc (process_music): use tempoUnitCount
+       tempoUnitDuration for determining what to print.
+
+       * lily/lyric-extender.cc: typo.
+
+       * lily/parser.yy (output_def_body): disallow \tempo in \midi{}
+
+       * lily/duration-scheme.cc (LY_DEFINE): ly:duration-length: new function.
+
        * scm/lily.scm (define-scheme-options): alphabetize, add eps-pad-boxes.
 
        * scm/framework-ps.scm (dump-stencil-as-EPS): only pad boxes if
diff --git a/VERSION b/VERSION
index 6839e1d0aa858176a49fee0d4690f47fe43d98e9..3f435dd7817661d630b262b739dcba1cd884b0ac 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -1,6 +1,6 @@
 PACKAGE_NAME=LilyPond
 MAJOR_VERSION=2
 MINOR_VERSION=9
-PATCH_LEVEL=15
+PATCH_LEVEL=16
 MY_PATCH_LEVEL=
 
index 6f1ea4ef908b5336be9ade2c059b38d95363ce5d..fb4bb102632b9946286d07abc048dfb4308b306a 100644 (file)
@@ -113,6 +113,14 @@ LY_DEFINE (ly_intlog2, "ly:intlog2",
   return scm_from_int (log);
 }
 
+LY_DEFINE (ly_duration_length, "ly:duration-length",
+          1, 0, 0, (SCM dur),
+          "The length of the duration as a Moment.")
+{
+  SCM_ASSERT_TYPE (unsmob_duration (dur), dur, SCM_ARG1, __FUNCTION__, "duration");
+  return Moment (unsmob_duration (dur)->get_length ()).smobbed_copy ();
+}
+
 LY_DEFINE (ly_duration_factor, "ly:duration-factor",
           1, 0, 0, (SCM dur),
           "Extract the compression factor from @var{dur}. Return as a pair.")
index f507ddddaf0c96d7f12bbaeb8b3a27edc3de85bf..867a6d83d30f903a8853f66c1d0d047bb1a39791 100644 (file)
@@ -87,7 +87,8 @@ Lyric_extender::print (SCM smob)
 ADD_INTERFACE (Lyric_extender, "lyric-extender-interface",
               "The extender is a simple line at the baseline of the lyric "
               "that helps show the length of a melissima (tied/slurred note).",
-              "heads"
+
+              "heads "
               "left-padding "
               "next "
               "right-padding "
index 21eb711a24636c21f8c480c8238ead3397b5f8fa..40be81e22181a15f51b3505c49fdb9b67b900162 100644 (file)
@@ -11,9 +11,10 @@ using namespace std;
 
 #include "engraver.hh"
 
-#include "note-column.hh"
+#include "item.hh"
 #include "context.hh"
 #include "grob-array.hh"
+#include "duration.hh"
 
 /**
    put stuff over or next to  bars.  Examples: bar numbers, marginal notes,
@@ -26,19 +27,28 @@ public:
 protected:
   Item *text_;
   Grob *bar_line_;
-  Music *mark_ev_;
 
-  void create_items (Music *);
+  SCM last_duration_;
+  SCM last_count_;
+  
 protected:
+  virtual void derived_mark () const;
   void stop_translation_timestep ();
-  virtual bool try_music (Music *ev);
   void process_music ();
 };
 
 Metronome_mark_engraver::Metronome_mark_engraver ()
 {
   text_ = 0;
-  mark_ev_ = 0;
+  last_duration_ = SCM_EOL;
+  last_count_ = SCM_EOL;
+}
+
+void
+Metronome_mark_engraver::derived_mark () const
+{
+  scm_gc_mark (last_count_);
+  scm_gc_mark (last_duration_);
 }
 
 void
@@ -53,37 +63,31 @@ Metronome_mark_engraver::stop_translation_timestep ()
 
       text_ = 0;
     }
-  mark_ev_ = 0;
-}
-
-void
-Metronome_mark_engraver::create_items (Music *rq)
-{
-  if (text_)
-    return;
-
-  text_ = make_item ("MetronomeMark", rq->self_scm ());
-}
-
-bool
-Metronome_mark_engraver::try_music (Music *r)
-{
-  mark_ev_ = r;
-  return true;
 }
 
 void
 Metronome_mark_engraver::process_music ()
 {
-  if (mark_ev_)
+  SCM count = get_property ("tempoUnitCount");
+  SCM duration = get_property ("tempoUnitDuration");
+  
+  if (unsmob_duration (duration)
+      && scm_is_number (count)
+      && !(ly_is_equal (count, last_count_)
+          && ly_is_equal (duration, last_duration_)))
     {
-      create_items (mark_ev_);
+      text_ = make_item ("MetronomeMark", SCM_EOL);
 
       SCM proc = get_property ("metronomeMarkFormatter");
-      SCM result = scm_call_2 (proc, mark_ev_->self_scm (),
+      SCM result = scm_call_3 (proc,
+                              duration,
+                              count,
                               context ()->self_scm ());
 
       text_->set_property ("text", result);
+
+      last_duration_ = duration;
+      last_count_ = count;
     }
 }
 
@@ -96,6 +100,13 @@ ADD_TRANSLATOR (Metronome_mark_engraver,
                "The staves are taken from the @code{stavesFound} property, "
                "which is maintained by @code{@ref{Staff_collecting_engraver}}. ",
                /* create */ "MetronomeMark",
-               /* accept */ "metronome-change-event",
-               /* read */ "stavesFound metronomeMarkFormatter",
+               /* accept */ "",
+
+               /* read */
+               "stavesFound "
+               "metronomeMarkFormatter "
+               "tempoUnitDuration "
+               "tempoUnitCount "
+               ,
+
                /* write */ "");
index 1d54ba97601290bdb5da524b8be090286f9080f0..7c04cb0c262f46160f64e10044a6a2f92f29eb55 100644 (file)
@@ -800,15 +800,6 @@ output_def_body:
        | output_def_body context_def_spec_block        {
                assign_context_def ($$, $2);
        }
-       | output_def_body tempo_event  {
-               /*
-                       junk this ? there already is tempo stuff in
-                       music.
-               */
-               int m = scm_to_int (unsmob_music($2)->get_property ("metronome-count"));
-               Duration *d = unsmob_duration (unsmob_music($2)->get_property ("tempo-unit"));
-               set_tempo ($$, d->get_length (), m);
-       }
        | output_def_body error {
 
        }
@@ -816,11 +807,8 @@ output_def_body:
 
 tempo_event:
        TEMPO steno_duration '=' bare_unsigned  {
-               Music *m = MY_MAKE_MUSIC ("MetronomeChangeEvent");
-               m->set_property ("tempo-unit", $2);
-               m->set_property ("metronome-count", scm_from_int ( $4));
-               $$ = m->unprotect ();
-       }
+               $$ = MAKE_SYNTAX ("tempo", @$, $2, scm_int2num ($4));
+       }                               
        ;
 
 /*
index e21f617b60f94a5e27e48152452a5a5fdafebae3..52796a8947c46c4b57e786934abd9e5a204fa974 100644 (file)
@@ -22,17 +22,23 @@ public:
 
 protected:
 
+  virtual void derived_mark () const; 
   void stop_translation_timestep ();
   void process_music ();
-  DECLARE_TRANSLATOR_LISTENER (metronome_change);
 private:
-  Stream_event *tempo_event_;
   Audio_tempo *audio_;
+  SCM last_tempo_; 
 };
 
+void
+Tempo_performer::derived_mark () const
+{
+  scm_gc_mark (last_tempo_);
+}
+
 Tempo_performer::Tempo_performer ()
 {
-  tempo_event_ = 0;
+  last_tempo_ = SCM_EOL;
   audio_ = 0;
 }
 
@@ -43,18 +49,19 @@ Tempo_performer::~Tempo_performer ()
 void
 Tempo_performer::process_music ()
 {
-  if (tempo_event_)
+  SCM w = get_property ("tempoWholesPerMinute");
+  if (unsmob_moment (w)
+      && !ly_is_equal (w, last_tempo_))
     {
-      SCM met = tempo_event_->get_property ("metronome-count");
-      Duration *d = unsmob_duration (tempo_event_->get_property ("tempo-unit"));
-
-      Rational r = (d->get_length () / Moment (Rational (1, 4)) * Moment (scm_to_int (met))).main_part_;
+      Rational r = unsmob_moment (w)->main_part_;
+      r *= Rational (4, 1);
 
       audio_ = new Audio_tempo (r.to_int ());
 
-      Audio_element_info info (audio_, tempo_event_);
+      Audio_element_info info (audio_, 0);
       announce_element (info);
-      tempo_event_ = 0;
+
+      last_tempo_ = w;
     }
 }
 
@@ -68,13 +75,7 @@ Tempo_performer::stop_translation_timestep ()
     }
 }
 
-IMPLEMENT_TRANSLATOR_LISTENER (Tempo_performer, metronome_change);
-void
-Tempo_performer::listen_metronome_change (Stream_event *event)
-{
-  tempo_event_ = event;
-}
-
 ADD_TRANSLATOR (Tempo_performer, "", "",
-               "metronome-change-event",
-               "", "");
+               "",
+               "tempoWholesPerMinute ",
+               "");
index a2a65b51cdb5ed3229da2dbe37cccdd3c941c8f0..f4e50d89ece50e2ce2bbb6d4ecd7f5e55b64b88f 100644 (file)
@@ -1,6 +1,5 @@
 \version "2.7.39"
 \midi {
-        \tempo 4=60
        \include "performer-init.ly"
 }
 
index 76ea46221d8b24cbaaef67e7c5db6bb23932721d..d74ea2651f3074100cd8016d38007fe1f47de947 100644 (file)
     
     melismaBusyProperties = #default-melisma-properties
     instrumentName = #"bright acoustic"
+
+    %% quarter = 60
+    tempoWholesPerMinute = #(ly:make-moment 15 1)
+    
     \accepts Staff
     \accepts DrumStaff
     \accepts GrandStaff
index c4f2bb18f5e2e0b8d7bb640d7f9fa82eaaa12cdc..3f10e386fb1f973ee98d368882bc946b40546efd 100644 (file)
@@ -2832,3 +2832,36 @@ def conv (str):
 
 conversions.append (((2, 9, 13), conv, """instrument -> instrumentName, instr -> shortInstrumentName, vocNam -> shortVocalName"""))
 
+
+def conv (str):
+    m = re.search (r'\\tempo ([0-9]+)\s*([.]*)\s*=\s*([0-9]+)', str)
+    if m and re.search (r'\\midi', str):
+        dur = int (m.group (1))
+        dots = len (m.group (2))
+        count = int (m.group (3))
+
+        log2 = 0
+        while dur > 1 :
+            dur /= 2
+            log2 += 1
+        
+        den = (1 << dots) * (1 << log2)
+        num = ((1 << (dots+1))  - 1)
+
+        error_file.write (r"""
+
+\tempo in \midi is no longer supported. Use
+
+  \midi {
+    \context {
+      \Score
+      tempoWholesPerMinute = #(ly:make-moment %d %d)
+      }
+    }
+
+""" % (num*count, den))
+        
+    return str
+
+conversions.append (((2, 9, 16), conv, """deprecate \\tempo in \\midi"""))
+
index af87ed9220a5c2c3af97c29b105c60d9b5578f9b..caaa39c704458bb0b532f0949bbfdb3adba2596c 100644 (file)
@@ -472,6 +472,10 @@ Example:
 This will create a start-repeat bar in this staff only.
 Valid values are described in @internalsref{bar-line-interface}.
 ")
+     (tempoWholesPerMinute 'ly:moment? "The tempo in whole notes per minute.")
+     (tempoUnitDuration 'ly:duration? "Unit for specifying tempo.")
+     (tempoUnitCount 'number? "Count for specifying tempo.")
+     
      )))
 
 (define-public all-internal-translation-properties
index b0fe109e2fd4cbe9b4fa53e5004e829c13cb3f7f..30f48999adcb17661af1a52130d99598903974ed 100644 (file)
@@ -17,7 +17,7 @@
     (music-event . (arpeggio-event breathing-event extender-event span-event
       rhythmic-event dynamic-event break-event percent-event
       key-change-event string-number-event tie-event part-combine-event
-      metronome-change-event beam-forbid-event script-event
+      beam-forbid-event script-event
       tremolo-event bend-after-event fingering-event glissando-event
       harmonic-event hyphen-event laissez-vibrer-event mark-event
       multi-measure-text-event note-grouping-event
index 7a06764063cbee8827fbeea1176481500b881966..cf9ea3505d023962a9de64441b6ea6863fe1914e 100644 (file)
@@ -631,12 +631,6 @@ Syntax: @code{\\@var{number}}.")
        (types . (general-music string-number-event event))
        )) 
 
-    (MetronomeChangeEvent
-     . (
-       (description .  "Change tempo setting (in beats per minute).")
-       (types . (general-music metronome-change-event tempo-event event))
-       ))
-    
     (TextScriptEvent
      . (
        (description .  "")
index f4d23debdbfbbde88884fce1b441c773e92ee116..23befc939e7b0605b556e465f4afed901cde5936 100644 (file)
   (make-music 'TransposedMusic
              'element (ly:music-transpose music pitch)))
 
+(define-ly-syntax-simple (tempo duration tempo)
+  (context-spec-music
+   (make-sequential-music
+    (list
+     (make-property-set 'tempoWholesPerMinute
+                       (ly:moment-mul (ly:make-moment tempo 1)
+                                      (ly:duration-length duration)))
+     (make-property-set 'tempoUnitDuration duration)
+     (make-property-set 'tempoUnitCount tempo)))
+   'Score))
+
 (define-ly-syntax-simple (skip-music dur)
   (make-music 'SkipMusic
              'duration dur))
index 2767a7b212dd53885322c64b92eb49234194a017..998d05e836226e00d69e945c120560c0692d06a5 100644 (file)
@@ -6,13 +6,11 @@
 ;;;;                Jan Nieuwenhuizen <janneke@gnu.org>
 
 ;; metronome marks
-(define-public (format-metronome-markup event context)
-  (let* ((dur (ly:music-property event 'tempo-unit))
-       (count (ly:music-property event 'metronome-count))
-       (note-mark (make-smaller-markup
-                  (make-note-by-number-markup (ly:duration-log dur)
-                                              (ly:duration-dot-count dur)
-                                              1))))  
+(define-public (format-metronome-markup dur count context)
+  (let* ((note-mark (make-smaller-markup
+                    (make-note-by-number-markup (ly:duration-log dur)
+                                                (ly:duration-dot-count dur)
+                                                1))))  
     (make-line-markup
      (list
       (make-general-align-markup Y DOWN note-mark)