From 75f3c89b41b589c7ddcafc488177ddaa202400e3 Mon Sep 17 00:00:00 2001 From: hanwen Date: Fri, 10 Mar 2006 09:43:17 +0000 Subject: [PATCH] *** empty log message *** --- ChangeLog | 5 +++++ Documentation/topdocs/NEWS.tely | 5 +++++ Documentation/user/basic-notation.itely | 4 ++++ lily/audio-column.cc | 6 ++++++ lily/include/audio-column.hh | 4 ++++ lily/include/score-performer.hh | 3 +++ lily/score-performer.cc | 25 +++++++++++++++++++++++-- 7 files changed, 50 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9c7b3d87ea..787fac3763 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2006-03-08 Johannes Schindelin + + * lily/audio-column.cc, lily/score-performer.cc: MIDI output now + respects the Score.skipTypesetting property. + 2006-03-09 Han-Wen Nienhuys * scm/framework-ps.scm (ps-embed-cff): no Setup section in diff --git a/Documentation/topdocs/NEWS.tely b/Documentation/topdocs/NEWS.tely index 1ecc6c72f0..e6caa29df6 100644 --- a/Documentation/topdocs/NEWS.tely +++ b/Documentation/topdocs/NEWS.tely @@ -64,6 +64,11 @@ which scares away people. @end ignore +@item The property @code{Score.skipTypesetting} is also respected +by the MIDI output now. + +This feature was contributed by Johannes Schindelin. + @item A score may now be specified to take a fixed number of systems, by setting the @code{system-count} variable in the @code{\layout} block. diff --git a/Documentation/user/basic-notation.itely b/Documentation/user/basic-notation.itely index e64483f204..ee27fdbcdf 100644 --- a/Documentation/user/basic-notation.itely +++ b/Documentation/user/basic-notation.itely @@ -860,6 +860,10 @@ Skipping parts of a score can be controlled in a more fine-grained fashing with the property @code{Score.skipTypesetting}. When it is set, no typesetting is performed at all. +This property is also used to control output to the MIDI file. Note that +it skips all events, including tempo and instrument changes. You have +been warned. + @lilypond[quote,fragment,ragged-right,verbatim] \relative c'' { c8 d diff --git a/lily/audio-column.cc b/lily/audio-column.cc index c9c880ec07..d0a36518a5 100644 --- a/lily/audio-column.cc +++ b/lily/audio-column.cc @@ -29,3 +29,9 @@ Audio_column::at_mom () const return at_mom_; } +void +Audio_column::offset_at_mom (Moment m) +{ + at_mom_ += m; +} + diff --git a/lily/include/audio-column.hh b/lily/include/audio-column.hh index 77eee19537..1cc827a276 100644 --- a/lily/include/audio-column.hh +++ b/lily/include/audio-column.hh @@ -26,6 +26,10 @@ public: vector audio_items_; +protected: + void offset_at_mom (Moment m); + friend class Score_performer; + private: Audio_column (Audio_column const &); diff --git a/lily/include/score-performer.hh b/lily/include/score-performer.hh index ca77b9a7f9..e38f430c62 100644 --- a/lily/include/score-performer.hh +++ b/lily/include/score-performer.hh @@ -37,6 +37,9 @@ private: void header (Midi_stream &); Audio_column *audio_column_; + bool skipping_; + Moment skip_start_mom_; + Moment offset_mom_; }; #endif // SCORE_PERFORMER_HH diff --git a/lily/score-performer.cc b/lily/score-performer.cc index ed9e407775..5bff2797da 100644 --- a/lily/score-performer.cc +++ b/lily/score-performer.cc @@ -6,6 +6,7 @@ (c) 1996--2006 Jan Nieuwenhuizen */ +#include "moment.hh" #include "score-performer.hh" #include "audio-column.hh" @@ -28,6 +29,7 @@ ADD_TRANSLATOR_GROUP (Score_performer, Score_performer::Score_performer () { performance_ = 0; + skipping_ = false; } Score_performer::~Score_performer () @@ -68,8 +70,27 @@ Score_performer::finish () void Score_performer::one_time_step () { - precomputed_recurse_over_translators (context (), PROCESS_MUSIC, UP); - do_announces (); + if (to_boolean (context ()->get_property ("skipTypesetting"))) + { + if (!skipping_) + { + skip_start_mom_ = audio_column_->at_mom (); + skipping_ = true; + } + } + else + { + if (skipping_) + { + offset_mom_ -= audio_column_->at_mom () - skip_start_mom_; + skipping_ = false; + } + + audio_column_->offset_at_mom (offset_mom_); + precomputed_recurse_over_translators (context (), PROCESS_MUSIC, UP); + do_announces (); + } + precomputed_recurse_over_translators (context (), STOP_TRANSLATION_TIMESTEP, UP); } -- 2.39.5