From 537c6fdcce5e1b232203d76a5c55699797290b13 Mon Sep 17 00:00:00 2001 From: fred Date: Tue, 26 Mar 2002 23:55:13 +0000 Subject: [PATCH] lilypond-1.3.83 --- buildscripts/pmx2ly.py | 206 +++++++++++++++++- flower/include/cons.hh | 2 +- lily/align-note-column-engraver.cc | 2 +- lily/beam.cc | 36 +-- lily/breathing-sign.cc | 4 +- lily/chord-tremolo-engraver.cc | 2 +- lily/command-request.cc | 17 +- lily/directional-element-interface.cc | 27 ++- lily/dot-column.cc | 2 +- lily/dots.cc | 6 +- lily/dynamic-engraver.cc | 5 +- lily/engraver.cc | 3 - lily/include/bar-engraver.hh | 1 + lily/include/command-request.hh | 9 +- lily/include/directional-element-interface.hh | 12 +- lily/include/music.hh | 2 + lily/include/score-element.hh | 2 +- lily/include/timing-translator.hh | 3 - lily/include/translator-group.hh | 3 +- lily/repeat-engraver.cc | 92 ++++---- lily/score-element.cc | 8 +- lily/score-engraver.cc | 2 +- lily/separating-group-spanner.cc | 2 +- lily/slur.cc | 24 +- lily/spanner.cc | 4 +- lily/stem-tremolo.cc | 2 +- lily/stem.cc | 10 +- lily/tie-column.cc | 15 +- lily/tie.cc | 14 +- lily/timing-translator.cc | 18 +- lily/translator-group.cc | 12 +- lily/tuplet-spanner.cc | 10 +- lily/volta-spanner.cc | 2 +- scripts/etf2ly.py | 175 ++++++++++++--- 34 files changed, 513 insertions(+), 221 deletions(-) diff --git a/buildscripts/pmx2ly.py b/buildscripts/pmx2ly.py index 58d32cb4bb..2f9155005e 100644 --- a/buildscripts/pmx2ly.py +++ b/buildscripts/pmx2ly.py @@ -1,25 +1,217 @@ #!@PYTHON@ + +# (urg! wat een pokkeformaat (pokkenformaat?)) + import string +import sys +import re + +fn = sys.argv[1] -ls = open ('barsant.pmx').readlines () +ls = open (fn).readlines () def stripcomment (l): - return re.sub ('^%.*$', '', l) + return re.sub ('[ \t]*%.*$\n', '', l) + +def stripwhite (l): + return re.sub ('[ \n\t]+', ' ', l) + +def stripeols (l): + return re.sub ('^ ', '', re.sub (' $', '', l)) ls = map (stripcomment, ls) +ls = map (stripwhite, ls) +ls = map (stripeols, ls) + + ls = filter (lambda x: x <> '', ls) opening = ls[0] ls = ls[1:] + opening = map (string.atoi, re.split ('[\t ]+', opening)) -(nv,noinst,mtrnuml,mtrdenl,mtrnump,mtrdenp,xmtrnum0,isig) = tuple (opening) + +(no_staffs, no_instruments, timesig_num,timesig_den, ptimesig_num, + ptimesig_den, pickup_beats,keysig_number) = tuple (opening) opening = ls[0] ls = ls[1:] -opening = map (string.atoi, re.split ('[\t ]+', opening)) -(npages,nsyst,musicsize,fracindent) = tuple (opening) -for l in ls: - pass +# ignore this. +# opening = map (string.atoi, re.split ('[\t ]+', opening)) +# (no_pages,no_systems, musicsize, fracindent) = tuple (opening) + +instruments = [] +while len (instruments) < no_instruments: + instruments.append (ls[0]) + ls = ls[1:] + +class Staff: + def __init__ (self): + self.voices = ([],[]) + self.clef = None + self.instrument = 0 +l = ls[0] +ls = ls[1:] + +staffs = map (lambda x: Staff (), range(0, no_staffs)) +staff_idx = 0 + +for s in staffs: + s.clef = l[0] + l = l[1:] + +# dump path +ls = ls[1:] + +# dump more ? +ls = ls[2:] + +actab = {-2: 'eses', -1: 'es', 0 : '', 1: 'is', 2:'isis'} + +def pitch_to_lily_string (tup): + (o,n,a) = tup + + nm = chr((n + 2) % 7 + ord ('a')) + nm = nm + actab[a] + if o > 0: + nm = nm + "'" * o + elif o < 0: + nm = nm + "," * -o + return nm + +class Chord: + def __init__ (self): + self.pitches = [] + self.dots = 0 + self.basic_duration = 0 + + def dump (self): + str = '' + + for p in self.pitches: + if str: + str = str + ' ' + str = str + pitch_to_lily_string (p) + + if len (self.pitches) > 1: + str = '<%s>' % str + elif len (self.pitches) == 0: + str = 'r' + + + sd = '' + if self.basic_duration == 0.5: + sd = '\\breve' + else: + sd = '%d' % self.basic_duration + + str = str + sd + '.' * self.dots + return str + + +input_left = string.join (ls, ' ') + + +input_left = re.sub ('[ \t\n]+', ' ', input_left) + +SPACE=' \t\n' +DIGITS ='0123456789' +basicdur_table = { + 9: 0.5, + 0: 0 , + 2: 2 , + 4: 4 , + 8: 8 , + 1: 16, + 3: 32, + 6: 64 + } + +class Parser: + def __init__ (self): + self.chords = [] + self.forced_duration = None + self.last_octave = 4 + + def parse_note (self, str): + ch = Chord () + + name = None + if str[0] <> 'r': + name = (ord (str[0]) - ord('a') + 5) % 7 + str = str[1:] + + forced_duration = 0 + alteration = 0 + dots = 0 + oct = None + durdigit = None + multibar = 0 + while str[0] in 'dsfmnul0123456789.,': + c = str[0] + str = str[1:] + if c == 'f': + alteration = alteration -1 + elif c == 'n': + alteration = 0 + elif c == 'm': + multibar = 1 + elif c == 's': + alteration = alteration +1 + elif c == 'd': + dots = dots + 1 + elif c in DIGITS and durdigit == None: + durdigit = string.atoi (c) + elif c in DIGITS: + oct = string.atoi (c) - 4 + elif c == '.': + dots = dots+ 1 + forced_duration = 2 + elif c == ',': + forced_duration = 2 + + + if durdigit: + ch.basic_duration = basicdur_table[durdigit] + self.last_basic_duration = ch.basic_duration + else: + ch.basic_duration = self.last_basic_duration + + if name: + if oct: + self.last_octave =oct + else: + oct = self.last_octave + + if name: + ch.pitches.append ((oct, name, alteration)) + + ch.dots = dots + + + if forced_duration: + self.forced_duration = ch.basic_duration / forced_duration + + + self.chords.append (ch) + while str[0] in SPACE: + str = str [1:] + return str + + +parser = Parser() +while input_left: + while input_left[0] in 'abcdefgr': + input_left = parser.parse_note (input_left) + print input_left[0] + + sys.stderr.write ("\nHuh? Unknown directive %s" %input_left[0:1]) + input_left = input_left[1:] + + + +for c in parser.chords: + print c.dump () diff --git a/flower/include/cons.hh b/flower/include/cons.hh index 266b9ce51c..a2ebc352d7 100644 --- a/flower/include/cons.hh +++ b/flower/include/cons.hh @@ -75,7 +75,7 @@ template int cons_list_size_i (Cons *l) template Cons * last_cons (Cons * head) { - while (head->next_) + while (head && head->next_) { head = head->next_; } diff --git a/lily/align-note-column-engraver.cc b/lily/align-note-column-engraver.cc index 75fb5b94e3..d29bc1d78c 100644 --- a/lily/align-note-column-engraver.cc +++ b/lily/align-note-column-engraver.cc @@ -61,7 +61,7 @@ Align_note_column_engraver::do_removal_processing () if (isdir_b (al)) { Direction d = to_dir (al); - Directional_element_interface (align_item_p_).set (d); + Directional_element_interface::set (align_item_p_,d); } typeset_element (align_item_p_); diff --git a/lily/beam.cc b/lily/beam.cc index a9ba9b076e..ad90e51814 100644 --- a/lily/beam.cc +++ b/lily/beam.cc @@ -84,8 +84,8 @@ Beam::before_line_breaking (SCM smob) warning (_ ("beam has less than two stems")); } - if (!Directional_element_interface (me).get ()) - Directional_element_interface (me).set (get_default_dir (me)); + if (!Directional_element_interface::get (me)) + Directional_element_interface::set (me, get_default_dir (me)); auto_knees (me); set_stem_directions (me); @@ -112,7 +112,7 @@ Beam::get_default_dir (Score_element*me) for (int i=0; i stems =Pointer_group_interface__extract_elements (me, (Item*) 0, "stems"); - Direction d = Directional_element_interface (me).get (); + Direction d = Directional_element_interface::get (me); for (int i=0; i remove_elt_property ("dir-forced"); if (!gh_boolean_p (force) || !gh_scm2bool (force)) - Directional_element_interface (s).set (d); + Directional_element_interface ::set (s,d); } } @@ -183,8 +183,8 @@ Beam::auto_knee (Score_element*me, String gap_str, bool interstaff_b) bool knee_b = false; int knee_y = 0; SCM gap = me->get_elt_property (gap_str.ch_C()); - - Direction d = Directional_element_interface (me).get (); + + Direction d = Directional_element_interface::get (me); Link_array stems= Pointer_group_interface__extract_elements (me, (Item*)0, "stems"); @@ -218,7 +218,7 @@ Beam::auto_knee (Score_element*me, String gap_str, bool interstaff_b) int y = (int)(Stem::head_positions(s)[d]) + (int)calc_interstaff_dist (s, dynamic_cast (me)); - Directional_element_interface (s).set (y < knee_y ? UP : DOWN); + Directional_element_interface::set (s,y < knee_y ? UP : DOWN); s->set_elt_property ("dir-forced", SCM_BOOL_T); } } @@ -300,8 +300,8 @@ Beam::after_line_breaking (SCM smob) /* until here, we used only stem_info, which acts as if dir=up */ - y *= Directional_element_interface (me).get (); - dy *= Directional_element_interface (me).get (); + y *= Directional_element_interface::get (me); + dy *= Directional_element_interface::get (me); Real half_space = Staff_symbol_referencer::staff_space (me) / 2; @@ -343,7 +343,7 @@ Beam::after_line_breaking (SCM smob) */ int quant_dir = 0; if (abs (y_shift) > half_space / 2) - quant_dir = sign (y_shift) * Directional_element_interface (me).get (); + quant_dir = sign (y_shift) * Directional_element_interface::get (me); y = quantise_y_f (me, y, dy, quant_dir); } } @@ -459,8 +459,8 @@ Beam::calc_stem_y_f (Score_element*me,Item* s, Real y, Real dy) Real stem_y = (dy && dx ? (s->relative_coordinate (0, X_AXIS) - x0) / dx * dy : 0) + y; /* knee */ - Direction dir = Directional_element_interface(me).get (); - Direction sdir = Directional_element_interface (s).get (); + Direction dir = Directional_element_interface::get (me); + Direction sdir = Directional_element_interface::get (s); /* knee */ if (dir!= sdir) @@ -473,7 +473,7 @@ Beam::calc_stem_y_f (Score_element*me,Item* s, Real y, Real dy) // huh, why not for first visible? if (Staff_symbol_referencer::staff_symbol_l (s) != Staff_symbol_referencer::staff_symbol_l (last_visible_stem (me))) - stem_y += Directional_element_interface (me).get () + stem_y += Directional_element_interface::get (me) * (beam_multiplicity - stem_multiplicity) * interbeam_f; } @@ -485,7 +485,7 @@ Beam::check_stem_length_f (Score_element*me,Real y, Real dy) { Real shorten = 0; Real lengthen = 0; - Direction dir = Directional_element_interface (me).get (); + Direction dir = Directional_element_interface::get (me); Link_array stems= Pointer_group_interface__extract_elements (me, (Item*)0, "stems"); @@ -596,7 +596,7 @@ Beam::quantise_y_f (Score_element*me,Real y, Real dy, int quant_dir) if (a.size () <= 1) return y; - Real up_y = Directional_element_interface (me).get () * y; + Real up_y = Directional_element_interface::get (me) * y; Interval iv = quantise_iv (a, up_y/staff_space) * staff_space; Real q = up_y - iv[SMALLER] <= iv[BIGGER] - up_y @@ -604,7 +604,7 @@ Beam::quantise_y_f (Score_element*me,Real y, Real dy, int quant_dir) if (quant_dir) q = iv[(Direction)quant_dir]; - return q * Directional_element_interface (me).get (); + return q * Directional_element_interface::get (me); } void @@ -674,7 +674,7 @@ Beam::stem_beams (Score_element*me,Item *here, Item *next, Item *prev) nw_f = me->paper_l ()->get_var ("quartwidth"); - Direction dir = Directional_element_interface (me).get (); + Direction dir = Directional_element_interface::get (me); /* half beams extending to the left. */ if (prev) diff --git a/lily/breathing-sign.cc b/lily/breathing-sign.cc index 8dd2d4298d..f6225e51e1 100644 --- a/lily/breathing-sign.cc +++ b/lily/breathing-sign.cc @@ -43,11 +43,11 @@ Breathing_sign::offset_callback (Score_element * b, Axis a) Score_element * me = (Score_element*)b; Real space = Staff_symbol_referencer::staff_space (b); - Direction d = Directional_element_interface (b). get (); + Direction d = Directional_element_interface::get (b); if (!d) { d = UP; - Directional_element_interface (me).set (d); + Directional_element_interface::set (me, d); } return 2.0 * space * d; diff --git a/lily/chord-tremolo-engraver.cc b/lily/chord-tremolo-engraver.cc index 289ad00b28..1891eea844 100644 --- a/lily/chord-tremolo-engraver.cc +++ b/lily/chord-tremolo-engraver.cc @@ -151,7 +151,7 @@ Chord_tremolo_engraver::acknowledge_element (Score_element_info info) It's amazing Mike: Stem:: type_i () ->first_head ()->get_direction () -> - Directional_element_interface (me).set (d); + Directional_element_interface::set (me, d); don't understand this comment. diff --git a/lily/command-request.cc b/lily/command-request.cc index bc919f63e7..1aaaea84ea 100644 --- a/lily/command-request.cc +++ b/lily/command-request.cc @@ -11,24 +11,9 @@ #include "musical-request.hh" -bool -Bar_req::do_equal_b (Request const *r) const -{ - Bar_req const* b = dynamic_cast (r); - return b && type_str_ == b->type_str_; -} - -void -Bar_req::do_print () const -{ -#ifndef NPRINT - DEBUG_OUT << type_str_; -#endif -} - Bar_req::Bar_req (String s) { - type_str_ = s; + set_mus_property ("type", ly_str02scm (s.ch_C())); } bool diff --git a/lily/directional-element-interface.cc b/lily/directional-element-interface.cc index 4a6a9e4d11..9689529f43 100644 --- a/lily/directional-element-interface.cc +++ b/lily/directional-element-interface.cc @@ -10,25 +10,27 @@ #include "directional-element-interface.hh" -Directional_element_interface::Directional_element_interface (Score_element const *s) +static SCM Directional_element_interface::direction_sym; + +static void +init_functions () { - elt_l_ = (Score_element*)s; + Directional_element_interface::direction_sym = scm_permanent_object (ly_symbol2scm ("direction")); } +ADD_SCM_INIT_FUNC(Directional, init_functions); + bool -Directional_element_interface::has_interface () const +Directional_element_interface::has_interface (Score_element*me) { - return isdir_b (elt_l_->get_elt_property ("direction")); + return isdir_b (me->get_elt_property (direction_sym)); } - - - Direction -Directional_element_interface::get () const +Directional_element_interface::get (Score_element*me) { // return dir_; - SCM d= elt_l_->get_elt_property ("direction"); + SCM d= me->get_elt_property (direction_sym); if (!isdir_b(d)) return CENTER; @@ -36,7 +38,10 @@ Directional_element_interface::get () const } void -Directional_element_interface::set (Direction d) +Directional_element_interface::set (Score_element*me, Direction d) { - elt_l_->set_elt_property ("direction", gh_int2scm (d)); + SCM sd = gh_int2scm (d); + + if (me->get_elt_property (direction_sym) != sd) + me->set_elt_property (direction_sym, sd); } diff --git a/lily/dot-column.cc b/lily/dot-column.cc index 5557790b33..38777cb569 100644 --- a/lily/dot-column.cc +++ b/lily/dot-column.cc @@ -40,7 +40,7 @@ void Dot_column::set_interface (Score_element* me) { me->set_elt_property ("dots", SCM_EOL); - Directional_element_interface (me).set (RIGHT); + Directional_element_interface::set (me, RIGHT); Axis_group_interface::set_interface (me); Axis_group_interface::set_axes (me, X_AXIS,X_AXIS); diff --git a/lily/dots.cc b/lily/dots.cc index 1b702e2932..c249d6a1cf 100644 --- a/lily/dots.cc +++ b/lily/dots.cc @@ -23,13 +23,13 @@ Dots::quantised_position_callback (Score_element * me, Axis a) SCM d= me->get_elt_property ("dot-count"); if (gh_number_p (d) && gh_scm2int (d)) { - if (!Directional_element_interface (me).get ()) - Directional_element_interface (me).set (UP); + if (!Directional_element_interface::get (me)) + Directional_element_interface::set (me, UP); int pos = int (Staff_symbol_referencer::position_f (me)); if (!(pos % 2)) - return Staff_symbol_referencer::staff_space (me) / 2.0 * Directional_element_interface (me).get (); + return Staff_symbol_referencer::staff_space (me) / 2.0 * Directional_element_interface::get (me); } return 0.0; diff --git a/lily/dynamic-engraver.cc b/lily/dynamic-engraver.cc index c399d36f63..9093c2aa66 100644 --- a/lily/dynamic-engraver.cc +++ b/lily/dynamic-engraver.cc @@ -167,7 +167,7 @@ Dynamic_engraver::do_process_music () text_p_ = new Item (get_property ("basicDynamicTextProperties")); text_p_->set_elt_property ("text", ly_str02scm (loud.ch_C ())); if (Direction d=text_req_l_->get_direction ()) - Directional_element_interface (line_spanner_).set (d); + Directional_element_interface::set (line_spanner_, d); Axis_group_interface::add_element (line_spanner_, text_p_); @@ -199,8 +199,7 @@ Dynamic_engraver::do_process_music () { accepted_spanreqs_drul_[START]->origin ()->warning (current_cresc_req_->span_dir_ == 1 - ? - _ ("already have a crescendo") + ? _ ("already have a crescendo") : _ ("already have a decrescendo")); } else diff --git a/lily/engraver.cc b/lily/engraver.cc index 896c206f12..60a72fa594 100644 --- a/lily/engraver.cc +++ b/lily/engraver.cc @@ -25,9 +25,6 @@ Engraver::announce_element (Score_element_info inf) void Engraver::announce_element (Score_element* e, Music *m) { - if (e->get_elt_property ("interfaces") == SCM_EOL) - Group_interface (e, "interfaces").add_thing (ly_symbol2scm (e->name())); - if (m && m->origin ()->location_str ().length_i ()) { e->set_elt_property ("origin", m->get_mus_property ("origin")); diff --git a/lily/include/bar-engraver.hh b/lily/include/bar-engraver.hh index 89ad0898f7..5d91c15b89 100644 --- a/lily/include/bar-engraver.hh +++ b/lily/include/bar-engraver.hh @@ -31,6 +31,7 @@ protected: private: + void typeset_bar (); void create_bar (); Item * bar_p_; diff --git a/lily/include/command-request.hh b/lily/include/command-request.hh index 7593325081..7ef86dda91 100644 --- a/lily/include/command-request.hh +++ b/lily/include/command-request.hh @@ -26,10 +26,8 @@ protected: class Mark_req : public Request { public: - SCM mark_label (); - - virtual bool do_equal_b (Request const*) const; + SCM mark_label (); VIRTUAL_COPY_CONS(Music); }; @@ -84,12 +82,9 @@ public: the latter should only happen at the start of a measure. */ class Bar_req : public Request { public: - String type_str_; + Bar_req (String); protected: - virtual bool do_equal_b (Request const*) const; - virtual void do_print () const; - VIRTUAL_COPY_CONS(Music); }; diff --git a/lily/include/directional-element-interface.hh b/lily/include/directional-element-interface.hh index 57e1e228df..92546cee4e 100644 --- a/lily/include/directional-element-interface.hh +++ b/lily/include/directional-element-interface.hh @@ -14,15 +14,11 @@ struct Directional_element_interface { - public: - Score_element *elt_l_; - - Directional_element_interface (Score_element const *); - void set (Direction d); - Direction get () const; - bool has_interface () const; - // bool set_interface (); + static SCM direction_sym ; + static void set (Score_element*,Direction d); + static Direction get (Score_element*) ; + static bool has_interface (Score_element*) ; }; diff --git a/lily/include/music.hh b/lily/include/music.hh index fc3d8ae05c..9e50aa0998 100644 --- a/lily/include/music.hh +++ b/lily/include/music.hh @@ -27,6 +27,8 @@ @see Music_sequence + + TODO: make a equalp function for general music. */ class Music { public: diff --git a/lily/include/score-element.hh b/lily/include/score-element.hh index f1a86dee28..b867d2119e 100644 --- a/lily/include/score-element.hh +++ b/lily/include/score-element.hh @@ -72,7 +72,7 @@ public: 0 means ORPHAN, */ char status_i_; - char const * name () const; + String name () const; /* IDEA: make this a global variable. This is the same for all diff --git a/lily/include/timing-translator.hh b/lily/include/timing-translator.hh index 7735562b3d..579b158484 100644 --- a/lily/include/timing-translator.hh +++ b/lily/include/timing-translator.hh @@ -19,7 +19,6 @@ class Timing_translator : public virtual Translator { public: VIRTUAL_COPY_CONS(Translator); - Time_signature_change_req * time_signature_req_l () const; Timing_translator (); Link_array timing_req_l_arr_; @@ -31,10 +30,8 @@ protected: virtual void do_post_move_processing(); public: - Moment measure_position () const; Moment measure_length () const; void set_time_signature (int, int); - }; #endif // TIMING_TRANSLATOR_HH diff --git a/lily/include/translator-group.hh b/lily/include/translator-group.hh index 126c232c8d..4701c48bbb 100644 --- a/lily/include/translator-group.hh +++ b/lily/include/translator-group.hh @@ -63,7 +63,6 @@ public: VIRTUAL_COPY_CONS(Translator); Translator_group(Translator_group const &); Translator_group(); - void add_simple_translator (Translator *trans_p); void add_group_translator (Translator *trans_p); @@ -75,7 +74,7 @@ public: void terminate_translator (Translator*r_l); Translator *remove_translator_p (Translator*trans_l); void check_removal (); - Translator *get_simple_translator (String) const; + // Translator *get_simple_translator (String) const; Translator_group *find_existing_translator_l (String n, String id); Translator_group *find_create_translator_l (String n, String id); Link_array path_to_acceptable_translator (String alias, Music_output_def*) const; diff --git a/lily/repeat-engraver.cc b/lily/repeat-engraver.cc index 2cae99cb09..96b11d5e11 100644 --- a/lily/repeat-engraver.cc +++ b/lily/repeat-engraver.cc @@ -136,10 +136,10 @@ Repeat_engraver::queue_events () happens at the begin of the alt. The :| bar event at the ending. */ - for (SCM s = repeated_music_l_->alternatives ()->music_list (); - gh_pair_p (s); s = gh_cdr (s)) - { - Music *mus =unsmob_music (gh_car (s)); + for (SCM s = repeated_music_l_->alternatives ()->music_list (); + gh_pair_p (s); s = gh_cdr (s)) + { + Music *mus =unsmob_music (gh_car (s)); /* some idiot might typeset a repeat not starting on a @@ -164,8 +164,8 @@ Repeat_engraver::queue_events () becel.append (c); last_number = volta_number; volta_number ++; - SCM l (get_property ("voltaSpannerDuration")); - if (unsmob_moment(l)) + SCM l (get_property ("voltaSpannerDuration")); + if (unsmob_moment(l)) { Moment vSD_mom = *unsmob_moment (l); if ( vSD_mom < mus->length_mom() ) // terminate volta early ? @@ -185,11 +185,15 @@ Repeat_engraver::queue_events () } } - Cons *&tail = create_barmoments_queue_ - ? last_cons (create_barmoments_queue_)->next_ - : create_barmoments_queue_; + /* + ugh, should merge :| and |: here. + */ + Cons * last = last_cons (create_barmoments_queue_); + Cons **tail = last? & last->next_ + : & create_barmoments_queue_; - tail = becel.head_ ; + *tail = becel.head_ ; + becel.head_ = 0; } @@ -203,13 +207,10 @@ Repeat_engraver::do_process_music () } - Cons * head = create_barmoments_queue_; + Cons * head = create_barmoments_queue_; if (!head) return; - Bar_engraver* bar_engraver_l = dynamic_cast - (daddy_grav_l ()->get_simple_translator ("Bar_engraver")); // UGH - /* Do all the events that need to be done now. */ @@ -217,41 +218,52 @@ Repeat_engraver::do_process_music () { create_barmoments_queue_ = create_barmoments_queue_->next_; head->next_ =0; - if (bar_engraver_l) + String t = head->car_->type_; + if (head->car_->bar_b_) { - String t = head->car_->type_; - if (head->car_->bar_b_) + if (t == "stop" || t == ":|") { - if (t == "stop" || t == ":|") - { - end_volta_span_p_ = volta_span_p_; - volta_span_p_ =0; - } - - if (t != "stop") - bar_engraver_l->request_bar (t); - else - bar_engraver_l->request_bar (""); + end_volta_span_p_ = volta_span_p_; + volta_span_p_ =0; } - else + + SCM whsym = ly_symbol2scm ("whichBar"); + Translator_group* where = daddy_trans_l_->where_defined (whsym); + SCM which = where->get_property (whsym); + + /* + Should use symbols for bar glyphs. + */ + if (t == "stop" && which == SCM_UNDEFINED) + which = ly_str02scm (""); + else if (t != "stop") { - assert (!volta_span_p_); - volta_span_p_ = new Spanner (get_property ("basicVoltaSpannerProperties")); - Volta_spanner::set_interface (volta_span_p_); - announce_element (volta_span_p_,0); - volta_span_p_->set_elt_property ("text", - ly_str02scm (t.ch_C())); - volta_span_p_->set_elt_property ("last-volta", - gh_bool2scm (head->car_->last_b_)); - // voltaSpannerDuration stuff here. - // other property stuff here. + SCM l = ly_str02scm (":|"); + SCM r = ly_str02scm ("|:"); + + if ( (t == "|:" && scm_equal_p (which, l) == SCM_BOOL_T) + || (t == ":|" && scm_equal_p (which, r)== SCM_BOOL_T)) + t = ":|:"; + + if (t != "" || !gh_string_p (which)) + which = ly_str02scm (t.ch_C()); } - + where->set_property (whsym, which); } else { - warning (_ ("No bar engraver found. Ignoring repeats.")); + assert (!volta_span_p_); + volta_span_p_ = new Spanner (get_property ("basicVoltaSpannerProperties")); + Volta_spanner::set_interface (volta_span_p_); + announce_element (volta_span_p_,0); + volta_span_p_->set_elt_property ("text", + ly_str02scm (t.ch_C())); + volta_span_p_->set_elt_property ("last-volta", + gh_bool2scm (head->car_->last_b_)); + // voltaSpannerDuration stuff here. + // other property stuff here. } + delete head->car_; delete head; diff --git a/lily/score-element.cc b/lily/score-element.cc index 26a62293fc..06a9cf70fc 100644 --- a/lily/score-element.cc +++ b/lily/score-element.cc @@ -629,10 +629,12 @@ Score_element::common_refpoint (SCM elist, Axis a) const return common; } -char const * +String Score_element::name () const { - return classname (this); + SCM nm = get_elt_property ("name"); + + return nm == SCM_EOL ? classname (this) :ly_scm2string (nm) ; } void @@ -749,7 +751,7 @@ Score_element::print_smob (SCM s, SCM port, scm_print_state *) Score_element *sc = (Score_element *) gh_cdr (s); scm_puts ("#name (), port); + scm_puts ((char *)sc->name ().ch_C(), port); /* don't try to print properties, that is too much hassle. diff --git a/lily/score-engraver.cc b/lily/score-engraver.cc index 80ad78157a..2cbeafd1eb 100644 --- a/lily/score-engraver.cc +++ b/lily/score-engraver.cc @@ -148,7 +148,7 @@ Score_engraver::typeset_all() if (!s->get_bound (d)) { s->set_bound(d, command_column_l_); - ::warning (_f ("unbound spanner `%s'", classname(s))); + ::warning (_f ("unbound spanner `%s'", s->name().ch_C())); } } while (flip(&d) != LEFT); } diff --git a/lily/separating-group-spanner.cc b/lily/separating-group-spanner.cc index e0082e84b0..628af83903 100644 --- a/lily/separating-group-spanner.cc +++ b/lily/separating-group-spanner.cc @@ -106,5 +106,5 @@ Separating_group_spanner::add_spacing_unit (Score_element* me ,Item*i) void Separating_group_spanner::set_interface (Score_element*me) { - me->set_elt_property ("elements", SCM_EOL); + } diff --git a/lily/slur.cc b/lily/slur.cc index e59f5fdf03..5be17a25d6 100644 --- a/lily/slur.cc +++ b/lily/slur.cc @@ -122,8 +122,8 @@ Slur::after_line_breaking (SCM smob) void Slur::set_extremities (Score_element*me) { - if (!Directional_element_interface (me).get ()) - Directional_element_interface (me).set (get_default_dir (me)); + if (!Directional_element_interface::get (me)) + Directional_element_interface ::set (me,get_default_dir (me)); Direction dir = LEFT; do @@ -234,12 +234,12 @@ Slur::get_attachment (Score_element*me,Direction dir, if (str == "head") { o = Offset (0, Stem::head_positions (stem) - [Directional_element_interface (me).get ()] * hs); + [Directional_element_interface::get (me)] * hs); /* Default position is centered in X, on outer side of head Y */ o += Offset (0.5 * n->extent (X_AXIS).length (), - 0.5 * ss * Directional_element_interface (me).get ()); + 0.5 * ss * Directional_element_interface::get (me)); } else if (str == "alongside-stem") { @@ -249,7 +249,7 @@ Slur::get_attachment (Score_element*me,Direction dir, */ o += Offset (n->extent (X_AXIS).length () * (1 + Stem::get_direction (stem)), - 0.5 * ss * Directional_element_interface (me).get ()); + 0.5 * ss * Directional_element_interface::get (me)); } else if (str == "stem") { @@ -287,7 +287,7 @@ Slur::get_attachment (Score_element*me,Direction dir, SCM l = scm_assoc (scm_listify (a, gh_int2scm (stem ? Stem::get_direction (stem) : 1 * dir), - gh_int2scm (Directional_element_interface (me).get () * dir), + gh_int2scm (Directional_element_interface::get (me) * dir), SCM_UNDEFINED), scm_eval2 (ly_symbol2scm ("slur-extremity-offset-alist"), SCM_EOL)); @@ -317,7 +317,7 @@ Slur::encompass_offset (Score_element*me, Offset o; Score_element* stem_l = unsmob_element (col->get_elt_property ("stem")); - Direction dir = Directional_element_interface (me).get (); + Direction dir = Directional_element_interface::get (me); if (!stem_l) { @@ -326,7 +326,7 @@ Slur::encompass_offset (Score_element*me, o[Y_AXIS] = col->relative_coordinate (common[Y_AXIS], Y_AXIS); return o; } - Direction stem_dir = Directional_element_interface (stem_l).get (); + Direction stem_dir = Directional_element_interface::get (stem_l); o[X_AXIS] = stem_l->relative_coordinate (0, X_AXIS); /* @@ -467,7 +467,7 @@ Slur::brew_molecule (SCM smob) if (gh_number_p (d)) a = me->lookup_l ()->dashed_slur (one, thick, thick * gh_scm2double (d)); else - a = me->lookup_l ()->slur (one, Directional_element_interface (me).get () * thick, thick); + a = me->lookup_l ()->slur (one, Directional_element_interface::get (me) * thick, thick); return a.create_scheme(); } @@ -481,7 +481,7 @@ Slur::set_control_points (Score_element*me) Real r_0 = me->paper_l ()->get_var ("slur_ratio"); Slur_bezier_bow bb (get_encompass_offset_arr (me), - Directional_element_interface (me).get (), + Directional_element_interface::get (me), h_inf, r_0); if (bb.fit_factor () > 1.0) @@ -530,7 +530,7 @@ Slur::get_curve (Score_element*me) Bezier b; int i = 0; - if (!Directional_element_interface (me).get () + if (!Directional_element_interface::get (me) || ! gh_symbol_p (index_cell (me->get_elt_property ("attachment"), LEFT))) set_extremities (me); @@ -544,7 +544,7 @@ Slur::get_curve (Score_element*me) } Array enc (get_encompass_offset_arr (me)); - Direction dir = Directional_element_interface (me).get (); + Direction dir = Directional_element_interface::get (me); Real x1 = enc[0][X_AXIS]; Real x2 = enc.top ()[X_AXIS]; diff --git a/lily/spanner.cc b/lily/spanner.cc index 3328d26636..131f19e5af 100644 --- a/lily/spanner.cc +++ b/lily/spanner.cc @@ -41,8 +41,8 @@ Spanner::do_break_processing () if (!parent->spanned_rank_iv ().contains_b (this->spanned_rank_iv ())) { programming_error (to_str ("Spanner `%s' is not fully contained in parent spanner `%s'.", - classname (this), - classname (parent))); + name().ch_C(), + parent->name ().ch_C ())); } } } diff --git a/lily/stem-tremolo.cc b/lily/stem-tremolo.cc index fc0ed1023f..e52df9fd05 100644 --- a/lily/stem-tremolo.cc +++ b/lily/stem-tremolo.cc @@ -95,7 +95,7 @@ Stem_tremolo::brew_molecule (SCM smob) int beams_i = Stem::beam_count(stem, RIGHT) >? Stem::beam_count (stem, LEFT); mol.translate (Offset(stem->relative_coordinate (0, X_AXIS) - me->relative_coordinate (0, X_AXIS), Stem::stem_end_position (stem ) * ss / 2 - - Directional_element_interface (beam).get () * beams_i * interbeam_f)); + Directional_element_interface::get (beam) * beams_i * interbeam_f)); } else { diff --git a/lily/stem.cc b/lily/stem.cc index 36f9c46793..b64f89bafa 100644 --- a/lily/stem.cc +++ b/lily/stem.cc @@ -94,13 +94,13 @@ Stem::stem_end_position (Score_element*me) Direction Stem::get_direction (Score_element*me) { - Direction d = Directional_element_interface (me).get (); + Direction d = Directional_element_interface::get (me); if (!d) { d = get_default_dir (me); // urg, AAARGH! - Directional_element_interface (me).set (d); + Directional_element_interface::set (me, d); } return d ; } @@ -289,7 +289,7 @@ Stem::get_default_stem_end_position (Score_element*me) if (!dir) { dir = get_default_dir (me); - Directional_element_interface (me).set (dir); + Directional_element_interface::set (me, dir); } /* @@ -522,7 +522,7 @@ Stem::calc_stem_info (Score_element*me) { Score_element * beam = beam_l (me); - Direction beam_dir = Directional_element_interface (beam).get (); + Direction beam_dir = Directional_element_interface::get (beam); if (!beam_dir) { programming_error ("Beam dir not set."); @@ -565,7 +565,7 @@ Stem::calc_stem_info (Score_element*me) Real stem_length = a[multiplicity paper_l ()->get_var ("tie_height_limit_factor") * staff_space; Real r_0 = me->paper_l ()->get_var ("tie_ratio"); @@ -290,7 +290,7 @@ Tie::brew_molecule (SCM smob) i++; } - Molecule a = me->lookup_l ()->slur (b, Directional_element_interface (me).get () * thick, thick); + Molecule a = me->lookup_l ()->slur (b, Directional_element_interface::get (me) * thick, thick); return a.create_scheme (); } diff --git a/lily/timing-translator.cc b/lily/timing-translator.cc index ab453e5a45..430a9939bc 100644 --- a/lily/timing-translator.cc +++ b/lily/timing-translator.cc @@ -44,20 +44,6 @@ Timing_translator::do_try_music (Music*r) } return false; } - -/*ugh. - */ -Time_signature_change_req* -Timing_translator::time_signature_req_l() const -{ - Time_signature_change_req *m_l=0; - for (int i=0; !m_l && i < timing_req_l_arr_.size (); i++) - { - m_l=dynamic_cast (timing_req_l_arr_[i]); - } - return m_l; -} - void Timing_translator::do_process_music() { @@ -127,6 +113,8 @@ Timing_translator::do_creation_processing() daddy_trans_l_->set_property ("measurePosition", m.make_scm ()); daddy_trans_l_->set_property ("beatLength", Moment (1,4).make_scm ()); daddy_trans_l_->set_property ("measureLength", Moment (1).make_scm()); + daddy_trans_l_->set_property ("timeSignatureFraction", + gh_cons (gh_int2scm (4), gh_int2scm (4))); } Moment @@ -147,6 +135,8 @@ Timing_translator::set_time_signature (int l, int o) Moment len = Moment (l) * one_beat; daddy_trans_l_->set_property ("measureLength", len.make_scm ()); daddy_trans_l_->set_property ("beatLength", one_beat.make_scm ()); + daddy_trans_l_->set_property ("timeSignatureFraction", + gh_cons (gh_int2scm (l), gh_int2scm (o))); } Timing_translator::Timing_translator() diff --git a/lily/translator-group.cc b/lily/translator-group.cc index d2b7c83a04..74cee77b61 100644 --- a/lily/translator-group.cc +++ b/lily/translator-group.cc @@ -73,11 +73,6 @@ Translator_group::add_translator (SCM list, Translator *t) return list; } void -Translator_group::add_simple_translator (Translator*t) -{ - simple_trans_list_ = add_translator (simple_trans_list_, t); -} -void Translator_group::add_group_translator (Translator *t) { trans_group_list_ = add_translator (trans_group_list_,t); @@ -247,7 +242,10 @@ Translator_group::remove_translator_p (Translator*trans_l) return trans_l; } - +#if 0 +/* + should not use, instead: use properties to communicate between engravers. + */ Translator* Translator_group::get_simple_translator (String type) const { @@ -260,7 +258,7 @@ Translator_group::get_simple_translator (String type) const return daddy_trans_l_->get_simple_translator (type); return 0; } - +#endif bool Translator_group::is_bottom_translator_b () const diff --git a/lily/tuplet-spanner.cc b/lily/tuplet-spanner.cc index a86a222c84..a74e155f0f 100644 --- a/lily/tuplet-spanner.cc +++ b/lily/tuplet-spanner.cc @@ -73,7 +73,7 @@ Tuplet_spanner::brew_molecule (SCM smob) Real w = dynamic_cast(me)->spanner_length () + ncw; Real staff_space = me->paper_l ()->get_var ("interline"); - Direction dir = Directional_element_interface (me).get (); + Direction dir = Directional_element_interface::get (me); Real dy = gh_scm2double (me->get_elt_property ("delta-y")); SCM number = me->get_elt_property ("text"); if (gh_string_p (number) && number_visibility) @@ -131,7 +131,7 @@ Tuplet_spanner::calc_position_and_height (Score_element*me,Real *offset, Real * Score_element * commony = me->common_refpoint (me->get_elt_property ("columns"), Y_AXIS); Score_element * commonx = me->common_refpoint (me->get_elt_property ("columns"), X_AXIS); - Direction d = Directional_element_interface (me).get (); + Direction d = Directional_element_interface::get (me); /* Use outer non-rest columns to determine slope @@ -186,7 +186,7 @@ Tuplet_spanner::calc_dy (Score_element*me,Real * dy) Link_array column_arr= Pointer_group_interface__extract_elements (me, (Score_element*)0, "columns"); - Direction d = Directional_element_interface (me).get (); + Direction d = Directional_element_interface::get (me); *dy = column_arr.top ()->extent (Y_AXIS) [d] - column_arr[0]->extent (Y_AXIS) [d]; } @@ -207,11 +207,11 @@ Tuplet_spanner::after_line_breaking (SCM smob) return SCM_UNSPECIFIED; } - Direction d = Directional_element_interface (me).get (); + Direction d = Directional_element_interface::get (me); if (!d) { d = Tuplet_spanner::get_default_dir (me); - Directional_element_interface (me).set (d); + Directional_element_interface::set (me, d); } Real dy, offset; diff --git a/lily/volta-spanner.cc b/lily/volta-spanner.cc index 295e1665ae..7e73842989 100644 --- a/lily/volta-spanner.cc +++ b/lily/volta-spanner.cc @@ -24,7 +24,7 @@ Volta_spanner::set_interface (Score_element*me) { me->set_elt_property ("bars", SCM_EOL); Side_position::set_axis (me, Y_AXIS); - Directional_element_interface (me).set (UP); + Directional_element_interface::set (me, UP); } diff --git a/scripts/etf2ly.py b/scripts/etf2ly.py index b194f28561..1835fd340b 100644 --- a/scripts/etf2ly.py +++ b/scripts/etf2ly.py @@ -11,15 +11,18 @@ # * slurs # * lyrics # * articulation -# +# * grace notes +# * tuplets + # todo: -# * automatic PC/mac/unix conversion # * slur/stem directions # * voices (2nd half of frame?) # * more intelligent lyrics # * beams (better use autobeam?) -# * more robust: try entertainer.etf (freenote), schubert ave maria (gmd) +# * more robust: try entertainer.etf (freenote) +# * dynamics +# program_name = 'etf2ly' version = '@TOPLEVEL_VERSION@' @@ -142,6 +145,44 @@ def lily_notename (tuple2): return nn +class Tuplet: + def __init__ (self, number): + self.start_note = number + self.finale = [] + + def append_finale (self, fin): + self.finale.append (fin) + + def factor (self): + n = self.finale[0][2]*self.finale[0][3] + d = self.finale[0][0]*self.finale[0][1] + return rat_simplify( (n, d)) + + def dump_start (self): + return '\\times %d/%d { ' % self.factor () + + def dump_end (self): + return ' }' + + def calculate (self, chords): + edu_left = self.finale[0][0] * self.finale[0][1] + + startch = chords[self.start_note] + c = startch + while c and edu_left: + c.tuplet = self + if c == startch: + c.chord_prefix = self.dump_start () + c.chord_prefix + + if not c.grace: + edu_left = edu_left - c.EDU_duration () + if edu_left == 0: + c.chord_suffix = c.chord_suffix+ self.dump_end () + c = c.next + + if edu_left: + sys.stderr.write ("\nHuh? Tuplet starting at entry %d was too short." % self.start_note) + class Slur: def __init__ (self, number): self.number = number @@ -163,8 +204,7 @@ class Slur: cs.note_suffix = '(' + cs.note_suffix ce.note_prefix = ce.note_prefix + ')' except IndexError: - sys.stderr.write ("""\nHuh? Incorrect slur start/endpoint -len(list) is %d, start/end is (%d,%d)\n""" % (len (chords), startnote, endnote)) + sys.stderr.write ("""\nHuh? Slur no %d between (%d,%d), with %d notes""" % (self.number, startnote, endnote, len (chords))) class Global_measure: @@ -198,6 +238,9 @@ articulation_dict ={ 11: '\\prall', 12: '\\mordent', 8: '\\fermata', + 4: '^', + 1: '.', + 3: '>', 18: '"arp"' , # arpeggio }; @@ -211,6 +254,7 @@ class Articulation: try: a = articulation_dict[self.type] except KeyError: + sys.stderr.write ("\nUnknown articulation no. %d on note no. %d" % (self.type, self.notenumber)) a = '"art"' c.note_suffix = '-' + a + c.note_suffix @@ -299,22 +343,43 @@ class Frame: def set_measure (self, m): self.measure = m + def calculate (self): + + # do grace notes. + lastch = None + for c in self.chords: + if c.grace and (lastch == None or (not lastch.grace)): + c.chord_prefix = r'\grace {' + c.chord_prefix + elif not c.grace and lastch and lastch.grace: + lastch.chord_suffix = lastch.chord_suffix + ' } ' + + lastch = c + + + def dump (self): - str = '' + str = '%% FR(%d)\n' % self.number left = self.measure.global_measure.length () + + + ln = '' for c in self.chords: - str = str + c.ly_string () + ' ' + add = c.ly_string () + ' ' + if len (ln) + len(add) > 72: + str = str + ln + '\n' + ln = '' + ln = ln + add left = rat_subtract (left, c.length ()) - + + str = str + ln + if left[0] < 0: - sys.stderr.write ("""Huh? Going backwards. -Frame no %d, start/end (%d,%d) -""" % (self.number, self.start, self.end)) + sys.stderr.write ("""\nHuh? Going backwards in frame no %d, start/end (%d,%d)""" % (self.number, self.start, self.end)) left = (0,1) if left[0]: - str = str + 's*%d/%d' % left - - str = str + '\n' + str = str + rat_to_lily_duration (left) + + str = str + ' | \n' return str def encodeint (i): @@ -364,7 +429,7 @@ class Staff: last_clef = m.clef if e: if gap <> (0,1): - k = k +' s1*%d/%d \n ' % gap + k = k +' ' + rat_to_lily_duration (gap) + '\n' gap = (0,1) k = k + e @@ -393,7 +458,7 @@ class Staff: if fr: first_frame = fr if gap <> (0,1): - laystr = laystr +'} s1*%d/%d {\n ' % gap + laystr = laystr +'} %s {\n ' % rat_to_lily_duration (gap) gap = (0,1) laystr = laystr + fr.dump () else: @@ -431,6 +496,23 @@ def EDU_to_duration (edu): dots = 2 return (log, dots) +def rat_to_lily_duration (rat): + (n,d) = rat + + basedur = 1 + while d and d % 2 == 0: + basedur = basedur << 1 + d = d >> 1 + + str = 's%d' % basedur + if n <> 1: + str = str + '*%d' % n + if d <> 1: + str = str + '/%d' % d + + return str + + class Chord: def __init__ (self, finale_entry): self.pitches = [] @@ -443,6 +525,8 @@ class Chord: self.note_suffix = '' self.chord_suffix = '' self.chord_prefix = '' + self.tuplet = None + self.grace = 0 def measure (self): if not self.frame: @@ -450,19 +534,36 @@ class Chord: return self.frame.measure def length (self): + if self.grace: + return (0,1) + l = (1, self.duration[0]) d = 1 << self.duration[1] dotfact = rat_subtract ((2,1), (1,d)) - return rat_multiply (dotfact, l) + mylen = rat_multiply (dotfact, l) + + if self.tuplet: + mylen = rat_multiply (mylen, self.tuplet.factor()) + return mylen def number (self): return self.finale[0][0] + + def EDU_duration (self): + return self.finale[0][3] def set_duration (self): - ((no, prev, next, dur, pos, entryflag, extended, follow), - notelist) = self.finale - self.duration = EDU_to_duration(dur) + self.duration = EDU_to_duration(self.EDU_duration ()) + def calculate (self): + self.find_realpitch () + self.set_duration () + + flag = self.finale[0][5] + if Chord.GRACE_MASK & flag: + self.grace = 1 + + def find_realpitch (self): ((no, prev, next, dur, pos, entryflag, extended, follow), notelist) = self.finale @@ -493,6 +594,8 @@ class Chord: REST_MASK = 0x40000000L TIE_START_MASK = 0x40000000L + GRACE_MASK = 0x00800000L + def ly_string (self): s = '' @@ -541,12 +644,16 @@ IMre = re.compile (r"""^\^IM\(([0-9-]+),([0-9-]+)\) ([0-9-]+) ([0-9-]+) ([0-9-]+ vere = re.compile(r"""^\^(ve|ch|se)\(([0-9-]+),([0-9-]+)\) ([0-9-]+) ([0-9-]+) ([0-9-]+) ([0-9-]+) ([0-9-]+)""") versere = re.compile(r"""^\^verse\(([0-9]+)\)(.*)\^end""") +TPre = re.compile(r"""^\^TP\(([0-9]+),([0-9]+)\) *([0-9-]+) ([0-9-]+) ([0-9-]+) ([0-9-]+)""") + + class Etf_file: def __init__ (self, name): self.measures = [None] self.entries = [None] self.chords = [None] self.frames = [None] + self.tuplets = [None] self.staffs = [None] self.slurs = [None] self.articulations = [None] @@ -585,7 +692,17 @@ class Etf_file: bn = string.atoi (m.group (1)) where = string.atoi (m.group (2)) / 1024.0 return m + def try_TP(self, l): + m = TPre.match (l) + if m: + (nil, num) = map (string.atoi, (m.groups ()[0:2])) + entries = map (string.atoi, (m.groups ()[2:])) + + if self.tuplets[-1] == None or num <> self.tuplets[-1].start_note: + self.tuplets.append (Tuplet (num)) + self.tuplets[-1].append_finale (entries) + def try_IM (self, l): m = IMre.match (l) if m: @@ -627,7 +744,7 @@ class Etf_file: entryflag = string.atol (entryflag,16) if no > len (self.entries): - sys.stderr.write ("Huh? Entry number to large,\nexpected %d got %d. Filling with void entries.\n" % (len(self.entries), no )) + sys.stderr.write ("\nHuh? Entry number to large,\nexpected %d got %d. Filling with void entries.\n" % (len(self.entries), no )) while len (self.entries) <> no: c = ((len (self.entries), 0, 0, 0, 0, 0L, 0, 0), []) self.entries.append (c) @@ -722,6 +839,8 @@ class Etf_file: m = self.try_IM (l) if not m: m = self.try_Sx (l) + if not m: + m = self.try_TP (l) if not m: m = self.try_verse (l) @@ -759,8 +878,13 @@ class Etf_file: mno = mno + 1 for c in self.chords[1:]: - c.find_realpitch () - c.set_duration () + c.calculate() + + for f in self.frames[1:]: + f.calculate () + + for t in self.tuplets[1:]: + t.calculate (self.chords) for s in self.slurs [1:]: s.calculate (self.chords) @@ -788,8 +912,6 @@ class Etf_file: str = str + '\n\n' + s.dump () staffs.append ('\\' + s.staffid ()) - if staffs: - str = str + '\\score { < %s > } ' % string.join (staffs) # should use \addlyrics ? @@ -799,6 +921,9 @@ class Etf_file: if len (self.verses) > 1: sys.stderr.write ("\nLyrics found; edit to use \\addlyrics to couple to a staff\n") + if staffs: + str = str + '\\score { < %s > } ' % string.join (staffs) + return str -- 2.39.5