From: hanwen Date: Thu, 4 Mar 2004 12:09:42 +0000 (+0000) Subject: * scm/output-ps.scm (output-scopes): use ly:paper-lookup for font X-Git-Tag: release/2.1.36~192 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=8225428884e9760997e8c99ad15acccf5c7c18b5;p=lilypond.git * scm/output-ps.scm (output-scopes): use ly:paper-lookup for font props. * input/test/tie-sparse.ly: remove. * lily/tie-performer.cc (try_music): copy & paste from Tie_engraver. * lily/music-output-def.cc (LY_DEFINE): bugfix. Don't do variable_ref twice. * lily/key-performer.cc (create_audio_elements): use alterations-in-key. * scm/midi.scm (accidentals-in-key): divide alterations by 2. --- diff --git a/ChangeLog b/ChangeLog index c1dba36a61..60ae87ef49 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,21 @@ +2004-03-04 Han-Wen Nienhuys + + * scm/output-ps.scm (output-scopes): use ly:paper-lookup for font + props. + + * input/test/tie-sparse.ly: remove. + + * lily/tie-performer.cc (try_music): copy & paste from + Tie_engraver. + + * lily/music-output-def.cc (LY_DEFINE): bugfix. Don't do + variable_ref twice. + + * lily/key-performer.cc (create_audio_elements): use + alterations-in-key. + + * scm/midi.scm (accidentals-in-key): divide alterations by 2. + 2004-03-04 Heikki Junes * input/test/smart-transpose.ly: fix cases fes->e and similar. diff --git a/Documentation/user/introduction.itely b/Documentation/user/introduction.itely index 0d87a1334e..404269b936 100644 --- a/Documentation/user/introduction.itely +++ b/Documentation/user/introduction.itely @@ -4,6 +4,7 @@ @node Introduction @chapter Introduction +[TODO: should have introduction of introduction] The art of music typography is called @emph{(plate) engraving}. The term derives from the traditional process of music printing. Only a diff --git a/Documentation/user/refman.itely b/Documentation/user/refman.itely index edbe18ab2b..7534f142e4 100644 --- a/Documentation/user/refman.itely +++ b/Documentation/user/refman.itely @@ -431,9 +431,6 @@ In this manual: @ref{Automatic note splitting}. Internals: @internalsref{TieEvent}, @internalsref{Tie}. -Examples: if you want less ties created for a chord, see -@inputfileref{input/test,tie-sparse.ly}. - For tying only a subset of the note heads of a pair of chords, see @inputfileref{input/regression,tie-chord-partial.ly}. diff --git a/input/test/tie-sparse.ly b/input/test/tie-sparse.ly deleted file mode 100644 index d4cf9abe91..0000000000 --- a/input/test/tie-sparse.ly +++ /dev/null @@ -1,17 +0,0 @@ - -\version "2.1.28" - -\header { texidoc = "@cindex Tie Sparse -Setting @code{sparseTies} generated only one tie per chord pair. " -} - -% seem not to work -HJJ - -\score { - \context Voice \notes\relative c { - \set sparseTies = ##t - c'' ~ - } - \paper { raggedright = ##t } -} - diff --git a/lily/audio-item.cc b/lily/audio-item.cc index d72adbcc7d..bdcf76b57f 100644 --- a/lily/audio-item.cc +++ b/lily/audio-item.cc @@ -68,21 +68,3 @@ Audio_text::Audio_text (Audio_text::Type type, String text_string) type_ = type; } -Audio_tie::Audio_tie () -{ - note_drul_[RIGHT] = 0; - note_drul_[LEFT] = 0; -} - -void -Audio_tie::set_note (Direction d, Audio_note* note) -{ - assert (!note_drul_[d]); - note_drul_[d] = note; - //set_bound (d, head); - - // add_dependency (head); -} - - - diff --git a/lily/include/audio-item.hh b/lily/include/audio-item.hh index d0eb1fc3e6..312f2fbe40 100644 --- a/lily/include/audio-item.hh +++ b/lily/include/audio-item.hh @@ -103,14 +103,6 @@ public: int per_minute_4_; }; -class Audio_tie : public Audio_item -{ -public: - Audio_tie (); - void set_note (Direction, Audio_note*); - Drul_array note_drul_; -}; - class Audio_time_signature : public Audio_item { public: diff --git a/lily/key-performer.cc b/lily/key-performer.cc index dbdfb4d835..54617f292d 100644 --- a/lily/key-performer.cc +++ b/lily/key-performer.cc @@ -45,7 +45,10 @@ Key_performer::create_audio_elements () if (key_req_) { SCM pitchlist = key_req_->get_property ("pitch-alist"); - SCM proc = scm_primitive_eval (ly_symbol2scm ("accidentals-in-key")); + static SCM proc; + if (!proc) + proc = scm_primitive_eval (ly_symbol2scm ("alterations-in-key")); + SCM acc = gh_call1 (proc, pitchlist); Pitch key_do (0, diff --git a/lily/music-output-def.cc b/lily/music-output-def.cc index ab651a45c7..b618837323 100644 --- a/lily/music-output-def.cc +++ b/lily/music-output-def.cc @@ -138,10 +138,9 @@ LY_DEFINE(ly_paper_lookup, SCM_ASSERT_TYPE (op, pap, SCM_ARG1, __FUNCTION__, "Paper"); SCM_ASSERT_TYPE (gh_symbol_p (sym), sym, SCM_ARG2, __FUNCTION__, "symbol"); - SCM v = op->lookup_variable (sym); - - if (SCM_VARIABLEP(v)) - return SCM_VARIABLE_REF(v); + SCM var = ly_module_lookup (op->scope_, sym); + if (SCM_VARIABLEP (var)) + return SCM_VARIABLE_REF (var); else return SCM_EOL; } diff --git a/lily/tie-engraver.cc b/lily/tie-engraver.cc index b30d40c35e..6b48a88173 100644 --- a/lily/tie-engraver.cc +++ b/lily/tie-engraver.cc @@ -29,14 +29,6 @@ basis of position and duration-log of the heads (not of the events). TODO: support sparseTies. - - TODO: melismata will fuck up now: - - < { c8 ~ c8 } - { c16 c c c } > - - melisma is after the 2nd 8th note, but will now be signaled as - lasting till the 3rd 16th. */ class Tie_engraver : public Engraver { diff --git a/lily/tie-performer.cc b/lily/tie-performer.cc index b38e9f2cb7..2f0c4ecd5e 100644 --- a/lily/tie-performer.cc +++ b/lily/tie-performer.cc @@ -1,9 +1,9 @@ /* - tie-performer.cc -- implement Tie_performer + new-tie-engraver.cc -- implement Tie_performer source file of the GNU LilyPond music typesetter - (c) 1999--2004 Jan Nieuwenhuizen + (c) 1998--2004 Han-Wen Nienhuys */ @@ -13,211 +13,105 @@ #include "pqueue.hh" #include "performer.hh" -struct CNote_melodic_tuple { - Music *event_ ; - Audio_note *note_; - Moment end_; - CNote_melodic_tuple (); - CNote_melodic_tuple (Audio_note*, Music*, Moment); - static int pitch_compare (CNote_melodic_tuple const &, CNote_melodic_tuple const &); - static int time_compare (CNote_melodic_tuple const &, CNote_melodic_tuple const &); -}; - -inline int compare (CNote_melodic_tuple const &a, CNote_melodic_tuple const &b) -{ - return CNote_melodic_tuple::time_compare (a,b); -} - - -/** - Manufacture ties. Acknowledge notes, and put them into a - priority queue. If we have a Music, connect the notes that finish - just at this time, and note that start at this time. - - TODO: should share code with Tie_engraver ? - */ class Tie_performer : public Performer { -public: - TRANSLATOR_DECLARATIONS(Tie_performer); -private: + Music *event_; + Music *last_event_; + Array now_heads_; + Array heads_to_tie_; bool ties_created_; - Array now_notes_; - Array tied_notes_; - - Music *event_; - Music * prev_event_; - - Link_array ties_; protected: - virtual void process_music (); - virtual void start_translation_timestep (); virtual void stop_translation_timestep (); - virtual void acknowledge_audio_element (Audio_element_info); + virtual void start_translation_timestep (); + virtual void acknowledge_grob (Audio_element_info); virtual bool try_music (Music*); - virtual void create_audio_elements (); + virtual void process_music (); +public: + TRANSLATOR_DECLARATIONS(Tie_performer); }; -void -Tie_performer::process_music () -{ - if (event_) - daddy_context_->set_property ("tieMelismaBusy", SCM_BOOL_T); -} Tie_performer::Tie_performer () { event_ = 0; - ties_created_ = false; - prev_event_ = 0; + last_event_ = 0; } -ENTER_DESCRIPTION (Tie_performer, "", "", - "tie-event", - "", "", ""); - - bool -Tie_performer::try_music (Music *m) +Tie_performer::try_music (Music *mus) { - if (!event_) + if (mus->is_mus_type ("tie-event")) { - event_ = m; - return true; + event_ = mus; } - return false; + + return true; } void -Tie_performer::acknowledge_audio_element (Audio_element_info i) +Tie_performer::process_music () { - if (Audio_note *nh = dynamic_cast (i.elem_)) - { - Music *m = i.event_; - if (m->is_mus_type ("note-event")) - now_notes_.push (CNote_melodic_tuple (nh, m, now_mom ()+ m->get_length ())); - } + if (event_) + daddy_context_->set_property ("tieMelismaBusy", SCM_BOOL_T); } void -Tie_performer::create_audio_elements () +Tie_performer::acknowledge_grob (Audio_element_info inf) { - /* - This is a nested loop. Not optimal, but good enough. - */ - if (tied_notes_.size ()) + if (Audio_note * an = dynamic_cast (inf.elem_)) { - Moment now = now_mom(); - for (int i = tied_notes_.size (); i--; ) + now_heads_.push (inf); + for (int i = heads_to_tie_.size (); i--;) { - if (tied_notes_[i].end_ != now) - continue; - - for (int j = now_notes_.size(); j--;) + Music * right_mus = inf.event_; + + Audio_note *th = dynamic_cast (heads_to_tie_[i].elem_); + Music * left_mus = heads_to_tie_[i].event_; + + if (right_mus && left_mus + && gh_equal_p (right_mus->get_property ("pitch"), + left_mus->get_property ("pitch"))) { - int comp - = Pitch::compare (*unsmob_pitch (tied_notes_[i].event_->get_property ("pitch")), - *unsmob_pitch (now_notes_[j].event_->get_property ("pitch"))); - - if (comp == 0) - { - - Audio_tie * p = new Audio_tie; - p->set_note (LEFT, tied_notes_[i].note_); - p->set_note (RIGHT, now_notes_[j].note_); - ties_.push (p); - announce_element (Audio_element_info (p, event_)); - ties_created_ = true; - - tied_notes_.del (i); - break ; - } + an->tie_to (th); } } } } +void +Tie_performer::start_translation_timestep () +{ + daddy_context_->set_property ("tieMelismaBusy", + gh_bool2scm (heads_to_tie_.size ())); + +} void Tie_performer::stop_translation_timestep () { - if (prev_event_ && tied_notes_.size () && !ties_.size () - && now_notes_.size ()) - { - prev_event_->origin ()->warning (_ ("No ties were performed.")); - } - if (ties_created_) { - prev_event_ = 0; - tied_notes_.clear(); + heads_to_tie_.clear (); + last_event_ = 0; } if (event_) { - tied_notes_ = now_notes_ ; - prev_event_ = event_; + heads_to_tie_ = now_heads_; + last_event_ = event_; } - event_ = 0; - now_notes_ .clear (); - - for (int i=ties_.size (); i--;) - { - ties_[i]->note_drul_[RIGHT]->tie_to (ties_[i]->note_drul_[LEFT]); - } - - ties_.clear (); -} - -void -Tie_performer::start_translation_timestep () -{ - event_ =0; - ties_created_ = false; - Moment now = now_mom (); - for (int i= tied_notes_.size (); i-- ;) - { - if (tied_notes_[i].end_ < now) - tied_notes_.del (i); - else - break ; - } -} - - -CNote_melodic_tuple::CNote_melodic_tuple () -{ - note_ =0; - event_ =0; - end_ = 0; -} - -CNote_melodic_tuple::CNote_melodic_tuple (Audio_note *h, Music*m, Moment mom) -{ - note_ = h; - event_ = m; - end_ = mom; -} - -int -CNote_melodic_tuple::pitch_compare (CNote_melodic_tuple const&h1, - CNote_melodic_tuple const &h2) -{ - SCM p1 = h1.event_->get_property ("pitch"); - SCM p2 = h2.event_->get_property ("pitch"); - return Pitch::compare (*unsmob_pitch (p1), - *unsmob_pitch (p2)); -} - -int -CNote_melodic_tuple::time_compare (CNote_melodic_tuple const&h1, - CNote_melodic_tuple const &h2) -{ - return (h1.end_ - h2.end_).main_part_.sign (); + now_heads_.clear (); } +ENTER_DESCRIPTION(Tie_performer, +/* descr */ "Generate ties between noteheads of equal pitch.", +/* creats*/ "", +/* accepts */ "tie-event", +/* acks */ "", +/* reads */ "tieMelismaBusy", +/* write */ ""); diff --git a/ly/performer-init.ly b/ly/performer-init.ly index 26796cbaa0..2bb450759a 100644 --- a/ly/performer-init.ly +++ b/ly/performer-init.ly @@ -31,8 +31,13 @@ \consists "Span_dynamic_performer" \consists "Tie_performer" \consists "Piano_pedal_performer" + \consists "Note_performer" + \consists "Beam_performer" + \consists "Slur_performer" + \consists "Melisma_translator" } + \translator { \VoiceContext \remove "Note_performer" @@ -40,15 +45,6 @@ \name DrumVoice } -\translator { - \type "Performer_group_performer" - \name Voice - \consists "Note_performer" - \consists "Beam_performer" - \consists "Slur_performer" - \consists "Melisma_translator" -} - \translator { \type "Performer_group_performer" \name FiguredBass diff --git a/scm/midi.scm b/scm/midi.scm index 5cfbd59541..807a020a3b 100644 --- a/scm/midi.scm +++ b/scm/midi.scm @@ -283,6 +283,6 @@ returns the program of the instrument ;; urg: we should set this at start of track (define-public dynamic-default-volume 0.71) -(define-public (accidentals-in-key pitch-list) +(define-public (alterations-in-key pitch-list) "Count number of sharps minus number of flats" - (apply + (map cdr pitch-list))) + (/ (apply + (map cdr pitch-list))) 2) diff --git a/scm/output-ps.scm b/scm/output-ps.scm index 5090ef12de..6bb582d441 100644 --- a/scm/output-ps.scm +++ b/scm/output-ps.scm @@ -50,16 +50,9 @@ ;;/output-scale lilypondpaperoutputscale lily-output-units mul def ;; ;; output-scale = 1.75729901757299 * 2.83464 = 4.9813100871731003736 + (define OUTPUT-SCALE 4.98) (define TOP-MARGIN 0) -(define PROPS `(((font-family . roman) - (word-space . 1) - (baseline-skip . ,BASELINE-SKIP) - (font-series . medium) - (font-style . roman) - (font-shape . upright) - (font-size . 0)))) - ;;; helper functions, not part of output interface (define (escape-parentheses s) @@ -361,10 +354,15 @@ (define (output-scopes paper scopes fields basename) ;; FIXME: customise/generate these - (let* ((linewidth (ly:paper-get-number paper 'linewidth)) - (props (cons (acons 'linewidth linewidth '()) PROPS)) - (prefix "lilypond") - (stencils '())) + (let* + ((props + (list + (append + `((linewidth . ,(ly:paper-get-number paper 'linewidth)) + (font-family . roman)) + (ly:paper-lookup paper 'font-defaults)))) + (prefix "lilypond") + (stencils '())) (define (scope-entry->string key var) (let ((val (variable-ref var)))