* 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)
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
PACKAGE_NAME=LilyPond
MAJOR_VERSION=2
MINOR_VERSION=9
-PATCH_LEVEL=15
+PATCH_LEVEL=16
MY_PATCH_LEVEL=
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.")
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 "
#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,
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
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;
}
}
"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 */ "");
| 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 {
}
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));
+ }
;
/*
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;
}
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;
}
}
}
}
-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 ",
+ "");
\version "2.7.39"
\midi {
- \tempo 4=60
\include "performer-init.ly"
}
melismaBusyProperties = #default-melisma-properties
instrumentName = #"bright acoustic"
+
+ %% quarter = 60
+ tempoWholesPerMinute = #(ly:make-moment 15 1)
+
\accepts Staff
\accepts DrumStaff
\accepts GrandStaff
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"""))
+
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
(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
(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 . "")
(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))
;;;; 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)