From 76d4ca2b82ebe0b4981474e3746b1479037d54de Mon Sep 17 00:00:00 2001 From: fred Date: Sun, 24 Mar 2002 19:42:00 +0000 Subject: [PATCH] lilypond-0.0.58 --- NEWS | 28 ++++++ TODO | 120 ++++++++++++++++++++++++- bin/convert-mudela | 16 +++- init/script.ini | 27 +++++- init/table_sixteen.ini | 33 ++++--- lib/duration.cc | 18 ++-- lily/.version | 5 +- lily/collision.cc | 12 ++- lily/parser.y | 2 +- lily/script-column.cc | 2 + mi2mu/.version | 2 +- mi2mu/include/midi-track.hh | 6 ++ mi2mu/lily-stream.cc | 2 +- mi2mu/main.cc | 2 +- mi2mu/midi-score.cc | 2 +- mi2mu/midi-track.cc | 172 +++++++++++++++++++++++++++--------- tex/lilyponddefs.tex | 42 +++++---- 17 files changed, 399 insertions(+), 92 deletions(-) diff --git a/NEWS b/NEWS index 7db4f88634..9bbb2e1f44 100644 --- a/NEWS +++ b/NEWS @@ -1,9 +1,37 @@ +pl 58 + - lexer cleanup + - national chars in lyrics + - \stem 2; bf + - long comments: %{ %} + - *.ini mode bf + - bf: partial may be everywhere + - bf: meterchange not at start of measure + - some doc updates + - bf: stem too long if stem is down. + +pl 57.jcn3 + - dank je schat, voor wtk-i + - mi2mu tries to handle rests + - "!date" Thu May 1 02:34:04 MET DST 1997 + - maak je het niet te laat schat? + XXXX HWN + +pl 57.jcn2 + - small toccata-fuga-E.ly fixes + - \bar "||"; is now doublebar, "|." is finishbar + - collision hshift fix, with on-line assistance + pl 57 - lots of TODO doco - text alignment bugfix - bugfix Voice_group_regs::get_register_p() now is actually called too - bugfix init of Text_item::pos_i_ +pl 56.jnc1 + - toccata-fuga-in-E.ly, excerpts with real-life collisions + - \{l,r}{b,f}{toe,heel} --- using cmsy fonts... + - pedal.ly + pl 55.jcn1 - mi2mu man page - make doc fixlet diff --git a/TODO b/TODO index cb39f70019..839412f6ed 100644 --- a/TODO +++ b/TODO @@ -28,6 +28,98 @@ grep for TODO and ugh/ugr PARSER * Duration-> Musical_duration, typedef Rational Duration? +HKN buglist: + +exitcode? (altijd 0) + +\bar || ook dunne streepjes? Sluit de balk niet af! (soms met de +ruimte van een hele maat erachter (bij unmatching staffs) + +logfile? + +Gepunteerde rusten kloppen niet (punt eronder/boven ipv ernaast) + +Hele rusten ook in andere maatsoort dan 4/4 (en centreren in de maat) + + + +------------------------\ +barcheck failed in lyric mode -> assert (zie barcheck.ly) (0.0.57) +------------------------/ + +optie om te stoppen na eerste barcheck fail? (en wellicht in eerder +stadium van precessing) + +noten staan vaak te dicht aan de rechterkant van de maatstreep. + +optie om nummers/markers boven maatstrepen te zetten + +tekst staat erg ver van notenbalken af + +barcheck her-synchroniseren? (evt met optie) + +script ^"3" onder ondanks boven? + +symbolen voor triller? (dus "tr---") + +mogelijkheid om complete regions te commenten (met /* */ ofzo) + +waarom geen ; achter dingen in \paper? (\textwidth 180\mm) +(sowieso: wanneer wel en geen ; ?) + +Onduidelijk wanneer wel en geen \ voor een woord. Maak liever +verplichte regels + +implementeren versieringen door duration *0 ofzo? (geeft nu assertion, +zie duration0.ly) + +midi: instrumenten definieren? +midi: tempo halverwege het stuk wijzigen? +midi: gebonden noten niet herhalen? + +TeX literals invoegen? + +--------/\ +Dit geeft gigantische trubbels + < [d8.( e'32*2/3 d'32*2/3 cis'32*2/3 b16 d'16 cis'16 )b'16] + [b8. cis'32*2/3 b32*2/3 a32*2/3 gis16 fis16 e16 d16] > +(zie file junkjunk.ly) Ik had natuurlijk wat accolades moeten +plaatsen, maar ja... + +--------/\ +Inconsequent: ene keer wel, andere keer niet parse error? +ipt.ini][/usr/local/share/lilypond/init//table_sixteen.ini]]./lacidarem.ly: 56: +error: parse error: + <[d8. b8.> \duration 32; +./lacidarem.ly: 56: error: parse error: + <[d8. b8.> \duration 32; +./lacidarem.ly: 57: error: parse error: + \duration 16; | +]./lacidarem.ly: 65: warning: Score contains errors. Will not process it. : +--------/\ +De beam van de triool klopt niet. + <[d8. b8.> \duration 32; + \duration 16; + | +(zie ook ergens in lacidarem-pianoI.ly) +--------/ +scales.ly compileert niet meer (vanwege transpose?) + +Lengte van de stokken klopt vaak niet, zie bijv. de eerste maat van +langestok.ly. + +Triolen enzo: het zou handig zijn als je het cijfer "3" ook _tussen_ +twee noten kon plaatsen. Dat is bijvoorbeeld nodig in +c4*2/3 c8*2/3 + +---------------\ +\bar "||" \meter 6/8; op het eind van de regel staat door elkaar +gedrukt. + + BUGS * detect -pipe @@ -49,7 +141,7 @@ BUGS * chlapik balk ruimte - * standchen triool beam up/down + * standchen triool beam up/down SEVERELY LACKING: @@ -214,6 +306,9 @@ FUTURE IDEAS + * output an intermediate format, move backend/output routines into + interpreter + * scoping in Lexer: do general id- assignments in mudela. ID '=' EXPR; @@ -251,6 +346,11 @@ IDEAS * PostScript output (esp. Beams, Slurs, etc) + * poor man's ascii output possible? + + * Output an output format independent (ofi) typeset file; and + make ofi2 TeX, MusixTex, PostScript, Ascii... interpreters. + * caching breakpoints * use exceptions iso assert? @@ -267,3 +367,21 @@ IDEAS (junking test.tex and latex.test) - rename {standchen,scsii-menuetto,...}.tex + * (related with above) --simple-mudela option for lily, + to lily input files with one-voice simple mudela + (no red tape) + + * stack scripts in chords: + % fingering: footing: + < a-4 c-2 g-1 > < c-\ltoe e-\lheel > + + * parameterised scripts for fingering and footing: + + % toe to bheel four to five + % ^_u 4_5 + % - + % --|x-- --|x-- + % --|--- --|--- + % --|--- --|--- + (where "to" is a tiny bow) + diff --git a/bin/convert-mudela b/bin/convert-mudela index d879a5c1b0..dbb0f729a4 100644 --- a/bin/convert-mudela +++ b/bin/convert-mudela @@ -29,11 +29,23 @@ sub convert_0_0_52_to_0_0_53 } +sub convert_0_0_54_to_0_0_55 +{ + s/%{/% {/g; +} + + sub convert_0_0_53_to_0_0_54 { print STDERR "Not smart enough to convert \\transpose\n" if (/\\transpose/) ; } +# we-re not at 58 yet, but this is at least one of the rules +sub convert_0_0_55_to_0_0_56 +{ + s/\"\|\|\"/\"|.\"/g; +} + ############################################################### sub last_conversion @@ -66,7 +78,9 @@ sub identify my %minor_conversions = (50 => \&no_conv, 52 => \&convert_0_0_50_to_0_0_52, 53 => \&convert_0_0_52_to_0_0_53, - 54 => \&convert_0_0_53_to_0_0_54 + 54 => \&convert_0_0_53_to_0_0_54, + 55 => \&convert_0_0_54_to_0_0_55, + 56 => \&convert_0_0_55_to_0_0_56 ); diff --git a/init/script.ini b/init/script.ini index f979ee4fcd..eb4633b7d1 100644 --- a/init/script.ini +++ b/init/script.ini @@ -13,9 +13,32 @@ staccato = \script { "staccato" 1 -1 0 0 } tenuto = \script {"tenuto" 0 -1 0 0 } upbow = \script { "upbow" 0 0 1 0 } downbow = \script { "downbow" 0 0 1 0 } -% toe = \script { "toe" 0 -1 0 0 } -% heel = \script { "heel" 0 -1 0 0 } lheel = \script { "heel" 0 0 -1 0 } rheel = \script { "heel" 0 0 1 0 } ltoe = \script { "toe" 0 0 -1 0 } rtoe = \script { "toe" 0 0 1 0 } +lbheel = \script { "bheel" 0 0 -1 0 } +rbheel = \script { "bheel" 0 0 1 0 } +lbtoe = \script { "btoe" 0 0 -1 0 } +rbtoe = \script { "btoe" 0 0 1 0 } +lfheel = \script { "fheel" 0 0 -1 0 } +rfheel = \script { "fheel" 0 0 1 0 } +lftoe = \script { "ftoe" 0 0 -1 0 } +rftoe = \script { "ftoe" 0 0 1 0 } +% +% left toe: right heel: +% +% u - +% - u +% ---|-----|-- --|x----|x-- +% ---|-----|-- --|-----|--- +% --x|----x|-- --|-----|--- +% ^ - +% - ^ +% back front back front +% +% +% heu, me thought for a moment that order in table_xxx.ini was +% being translated into priority... +back = \script { "back" 0 -1 -1 0 } +front = \script { "front" 0 -1 1 0 } diff --git a/init/table_sixteen.ini b/init/table_sixteen.ini index 69167a77f1..b93ddb7b31 100644 --- a/init/table_sixteen.ini +++ b/init/table_sixteen.ini @@ -11,23 +11,33 @@ table_sixteen= % index TeXstring, xmin xmax ymin ymax "scripts" = \table { - "fermata" "\fermata" 0\pt 0\pt 0\pt 6\pt - "-fermata" "\ifermata" 0\pt 0\pt -6\pt 0\pt + "fermata" "\fermata" 0\pt 0\pt 0\pt 6\pt + "-fermata" "\ifermata" 0\pt 0\pt -6\pt 0\pt "portato" "\portato" "-portato" "\iportato" "tenuto" "\tenuto" "-tenuto" "\itenuto" "sforzato" "\sforzato" -0.8\pt 4.8\pt -1.92\pt 1.92\pt - "marcato" "\marcato" 0\pt 4.8\pt 0\pt 4\pt - "-marcato" "\imarcato" 0\pt 4.8\pt -4\pt 0\pt - "staccato" "\staccato" 0\pt 0\pt 0\pt 5\pt - "staccatissimo" "\staccatissimo" 0\pt 0\pt 0\pt 7.5\pt + "marcato" "\marcato" 0\pt 4.8\pt 0\pt 4\pt + "-marcato" "\imarcato" 0\pt 4.8\pt -4\pt 0\pt + "staccato" "\staccato" 0\pt 0\pt 0\pt 5\pt + "staccatissimo" "\staccatissimo" 0\pt 0\pt 0\pt 7.5\pt "-staccatissimo" "\istaccatissimo" 0\pt 0\pt -7.5\pt 0\pt "upbow" "\upbow" -1\pt 6\pt 0\pt 5\pt - "downbow" "\downbow" 0\pt 5\pt 0\pt 7.5\pt - "heel" "\heel" -1\pt 6\pt -5\pt 17.5\pt - "toe" "\toe" 0\pt 5\pt -5\pt 17.5\pt - } + "downbow" "\downbow" 0\pt 5\pt 0\pt 7.5\pt + "back" "\backorfront" 0\pt 6\pt 0\pt 3\pt + "-front" "\backorfront" -3\pt 5\pt 0\pt 3\pt +% oeps, segfault +% "heel" "\heel" 0\pt 6\pt -.5\pt 2\pt + "heel" "\heel" 0\pt 6\pt -1\pt 5\pt + "toe" "\toe" 0\pt 6\pt -1\pt 5\pt + "bheel" "\bheel" 0\pt 6\pt -1\pt 5\pt + "btoe" "\btoe" 0\pt 6\pt -1\pt 5\pt + "fheel" "\fheel" 0\pt 6\pt -1\pt 5\pt + "ftoe" "\ftoe" 0\pt 6\pt -1\pt 5\pt + "-back" "\backorfront" 0\pt 6\pt 0\pt 3\pt + "front" "\backorfront" 0\pt 6\pt 0\pt 3\pt + } "style" = \table { "roman" "\settext{%}" 0\pt 5\pt 0\pt 8\pt @@ -89,7 +99,8 @@ table_sixteen= "bars" = \table { "empty" "\emptybar" "|" "\maatstreep" 0\pt 0.4\pt -8\pt 8\pt - "||" "\finishbar" 0\pt 2\pt -8\pt 8\pt + "||" "\doublebar" 0\pt 4\pt -8\pt 8\pt + "|." "\finishbar" -4\pt 0\pt -8\pt 8\pt ":|" "\repeatbar" -4\pt 0\pt -8\pt 8\pt "|:" "\startrepeat" 0\pt 4\pt -8\pt 8\pt ":|:" "\repeatbarstartrepeat" 0\pt 16\pt -8\pt 8\pt diff --git a/lib/duration.cc b/lib/duration.cc index 0c95c66a37..1b529ccc58 100644 --- a/lib/duration.cc +++ b/lib/duration.cc @@ -20,6 +20,16 @@ // statics Duration int Duration::division_1_i_s = 384 * 4; + +Duration::Duration( int type_i, int dots_i = 0) +{ +// this breaks mi2mu quite effectively +// assert(duration_type_b(type_i)); + type_i_ = type_i; + dots_i_ = dots_i; + ticks_i_ = 0; +} + bool Duration::duration_type_b(int t) { @@ -33,14 +43,6 @@ Duration::duration_type_b(int t) return bit_i == 1; } -Duration::Duration( int type_i, int dots_i = 0) -{ - assert(duration_type_b(type_i)); - type_i_ = type_i; - dots_i_ = dots_i; - ticks_i_ = 0; -} - Moment Duration::length() const { diff --git a/lily/.version b/lily/.version index 515736281a..04ee1d9883 100644 --- a/lily/.version +++ b/lily/.version @@ -1,7 +1,8 @@ MAJOR_VERSION = 0 MINOR_VERSION = 0 -PATCH_LEVEL = 57 +PATCH_LEVEL = 58 + # use to send patches, always empty for released version: # include separator: ".postfix", "-pl" makes rpm barf -MY_PATCH_LEVEL = +MY_PATCH_LEVEL = .jcn3 diff --git a/lily/collision.cc b/lily/collision.cc index 64ceafe19a..7e1f0988d7 100644 --- a/lily/collision.cc +++ b/lily/collision.cc @@ -21,6 +21,7 @@ Collision::add(Note_column* ncol_l) clash_l_arr_.push(ncol_l); add_dependency(ncol_l); } + static int idx(int dir, bool h_shift_b) { @@ -102,7 +103,8 @@ Collision::do_pre_processing() } while ((d *= -1) != 1); - + // y_extent: smallest y-pos noteball interval containing all balls + // 4 (0..3) groups: stem up/down; shift on/off; Interval_t middle( y_extent[0].min(), y_extent[3].max()); Interval_t open_middle( y_extent[3].max()+1, y_extent[0].min()-1); do{ @@ -111,9 +113,10 @@ Collision::do_pre_processing() } while ((d *= -1) != 1); if (!middle.empty_b() && - middle.length() <= 1 && col_l_a[idx(1,0)] && col_l_a[idx(-1,0)]) { - Notehead * nu_l= col_l_a[idx(1,0)]->head_l_arr_[idx(1,0)]; - Notehead * nd_l = col_l_a[idx(-1,0)]->head_l_arr_[idx(1,0)]; + middle.length() <= 2 && col_l_a[idx(1,0)] && col_l_a[idx(-1,0)]) { +// reproduction of bugfix at 3am ? + Notehead * nu_l= col_l_a[idx(1,0)]->head_l_arr_[0]; + Notehead * nd_l = col_l_a[idx(-1,0)]->head_l_arr_.top(); if (! (nu_l->balltype_i_ == nd_l->balltype_i_ && nu_l->dots_i_ == nd_l->dots_i_)) { x_off[idx(1,0)] -= 0.5; x_off[1] -= 0.5; @@ -130,4 +133,5 @@ Collision::do_pre_processing() } } + IMPLEMENT_STATIC_NAME(Collision); diff --git a/lily/parser.y b/lily/parser.y index d831a69670..b384729562 100644 --- a/lily/parser.y +++ b/lily/parser.y @@ -1,7 +1,7 @@ %{ // -*-Fundamental-*- #include -#define MUDELA_VERSION "0.0.54" +#define MUDELA_VERSION "0.0.56" #include "script-def.hh" #include "symtable.hh" diff --git a/lily/script-column.cc b/lily/script-column.cc index bc309b1e04..637eb42dec 100644 --- a/lily/script-column.cc +++ b/lily/script-column.cc @@ -27,6 +27,8 @@ Script_column::translate(Offset o) { for (int i=0; i < script_l_arr_.size(); i++) script_l_arr_[i]->translate(o); + for (int i=0; i < support_l_arr_.size(); i++) + support_l_arr_[i]->translate(o); } diff --git a/mi2mu/.version b/mi2mu/.version index abebfdd4a7..8ebe023f19 100644 --- a/mi2mu/.version +++ b/mi2mu/.version @@ -1,6 +1,6 @@ MAJOR_VERSION = 0 MINOR_VERSION = 0 -PATCH_LEVEL = 13 +PATCH_LEVEL = 14 # use to send patches, always empty for released version: MY_PATCH_LEVEL = # include separator: "-1" or ".a" # diff --git a/mi2mu/include/midi-track.hh b/mi2mu/include/midi-track.hh index e917ebe74f..5173c93532 100644 --- a/mi2mu/include/midi-track.hh +++ b/mi2mu/include/midi-track.hh @@ -31,8 +31,14 @@ public: private: void add_begin_at( PointerList& open_voices_r, Moment mom ); + int check_begin_bar_i( Moment now_mom, int open_bar_i ); + int check_end_bar_i( Moment now_mom, int open_bar_i ); Midi_voice* get_free_midi_voice_l( Moment mom ); void remove_end_at( PointerList& open_voices_r, Moment mom ); + void output_mudela_begin_bar( Lily_stream& lily_stream_r, Moment now_mom, int bar_i ); + void output_mudela_rest( Lily_stream& lily_stream_r, Moment begin_mom, Moment end_mom ); + void output_mudela_rest_remain( Lily_stream& lily_stream_r, Moment mom ); + IPointerList tcol_p_list_; IPointerList midi_voice_p_list_; int number_i_; diff --git a/mi2mu/lily-stream.cc b/mi2mu/lily-stream.cc index ea80a4fd01..8e6806564b 100644 --- a/mi2mu/lily-stream.cc +++ b/mi2mu/lily-stream.cc @@ -107,7 +107,7 @@ Lily_stream::header() *os_p_ << "% from input file: "; *os_p_ << midi_parser_l_g->filename_str_; *os_p_ << "\n\n"; - *os_p_ << "\\version \"0.0.54\";\n"; + *os_p_ << "\\version \"0.0.58\";\n"; } /* snapnie: dit kan toch automaties? Zie ook dstream. diff --git a/mi2mu/main.cc b/mi2mu/main.cc index b3f0577991..33fab2906f 100644 --- a/mi2mu/main.cc +++ b/mi2mu/main.cc @@ -82,7 +82,7 @@ main( int argc_i, char* argv_sz_a[] ) 0, "help", 'h', 0, "no-silly", 'n', 1, "output", 'o', - 1, "no-plets", 'p', + 0, "no-plets", 'p', 0, "quiet", 'q', 1, "smallest", 's', 0, "verbose", 'v', diff --git a/mi2mu/midi-score.cc b/mi2mu/midi-score.cc index 0c0bb5098d..d8bc7bb276 100644 --- a/mi2mu/midi-score.cc +++ b/mi2mu/midi-score.cc @@ -39,7 +39,7 @@ Midi_score::output_mudela( String filename_str ) lily_stream << "\\score{"; lily_stream.indent(); for ( PCursor i( midi_track_p_list_.top() ); i.ok(); i++ ) { - lily_stream << "\\staff{ "; + lily_stream << "\\staff{ melodicregs "; lily_stream << i->name_str(); lily_stream << " }"; lily_stream.newline(); diff --git a/mi2mu/midi-track.cc b/mi2mu/midi-track.cc index ecf889bba6..436bec8aa3 100644 --- a/mi2mu/midi-track.cc +++ b/mi2mu/midi-track.cc @@ -43,11 +43,28 @@ Midi_track::add_event( Moment mom, Midi_event* midi_event_p ) tcol_l( mom - midi_event_p->mom() )->add_event( midi_event_p ); } -// too much red tape? -String -Midi_track::name_str() +int +Midi_track::check_begin_bar_i( Moment now_mom, int open_bar_i ) { - return name_str_; + Moment bar_mom = midi_time_p_->bar_mom(); + int bar_i = (int)( now_mom / bar_mom ) + 1; + if ( bar_i > open_bar_i ) { + tor( NORMAL_ver ) << '[' << flush; + return bar_i; + } + return 0; +} + +int +Midi_track::check_end_bar_i( Moment now_mom, int open_bar_i ) +{ + Moment bar_mom = midi_time_p_->bar_mom(); + int bar_i = (int)( now_mom / bar_mom ) + 1; + if ( bar_i > open_bar_i ) { + tor( NORMAL_ver ) << ']' << flush; + return bar_i; + } + return open_bar_i; } Moment @@ -73,6 +90,13 @@ Midi_track::get_free_midi_voice_l( Moment mom ) return midi_voice_l; } +// too much red tape? +String +Midi_track::name_str() +{ + return name_str_; +} + Moment Midi_track::next_begin_mom( Moment now_mom ) { @@ -99,18 +123,13 @@ void Midi_track::process() { int bar_i = 1; - Moment bar_mom = midi_time_p_->bar_mom(); - for ( PCursor i( tcol_p_list_.top() ); i.ok(); i++ ) { - int bars_i = (int)( i->mom() / bar_mom ); - if ( bars_i > bar_i ) - tor( NORMAL_ver ) << '[' << bar_i << flush; + int begin_bar_i = check_begin_bar_i( i->mom(), bar_i ); + if ( begin_bar_i ) + tor( NORMAL_ver ) << begin_bar_i << flush; while ( i->midi_event_p_list_.size() ) get_free_midi_voice_l( i->mom() )->add_event( i->midi_event_p_list_.top().remove_p() ); - if ( bars_i > bar_i ) { - bar_i = bars_i; - tor( NORMAL_ver ) << ']' << flush; - } + bar_i = check_end_bar_i( i->mom(), bar_i ); } tor( DEBUG_ver ) << "ends: " << endl; @@ -132,37 +151,23 @@ Midi_track::output_mudela( Lily_stream& lily_stream_r ) lily_stream_r.newline(); int bar_i = 0; - Moment bar_mom = midi_time_p_->bar_mom(); PointerList open_voices; Moment now_mom = 0.0; - Moment then_mom = 0.0; - while ( now_mom < end_mom() ) { - int bars_i = (int)( now_mom / bar_mom ) + 1; - if ( bars_i > bar_i ) - tor( NORMAL_ver ) << '[' << flush; - - if ( bars_i > bar_i ) { - Moment into_bar_mom = now_mom - Moment( bars_i - 1 ) * bar_mom; - if ( bars_i > 1 ) { - if ( !into_bar_mom ) - lily_stream_r << "|"; - lily_stream_r.newline(); - } - lily_stream_r << "% " << String_convert::i2dec_str( bars_i, 0, ' ' ); - if ( into_bar_mom ) - lily_stream_r << ":" << Duration_convert::dur2_str( Duration_convert::mom2_dur( into_bar_mom ) ); - lily_stream_r.newline(); - } - + /// ugh, avoid status track 0... + while ( number_i_ && ( now_mom < end_mom() ) ) { + int begin_bar_i = check_begin_bar_i( now_mom, bar_i ); + if ( begin_bar_i ) + output_mudela_begin_bar( lily_stream_r, now_mom, begin_bar_i ); add_begin_at( open_voices, now_mom ); Moment begin_mom = next_begin_mom( now_mom ); - if ( bars_i > bar_i ) - tor( NORMAL_ver ) << bars_i << flush; + if ( begin_bar_i ) + tor( NORMAL_ver ) << begin_bar_i << flush; Moment end_mom = next_end_mom( now_mom ); + Moment then_mom = 0.0; if ( ( begin_mom > now_mom ) && ( begin_mom < end_mom ) ) then_mom = begin_mom; else @@ -171,19 +176,27 @@ Midi_track::output_mudela( Lily_stream& lily_stream_r ) tor( DEBUG_ver ) << "begin: " << begin_mom << " end: " << end_mom << endl; tor( DEBUG_ver ) << "slice: " << now_mom << ", " << then_mom << endl; +// rests, ugh + String str; +// if ( !open_voices.size() ) +// output_mudela_rest( lily_stream_r, now_mom, then_mom ); if ( open_voices.size() > 1 ) lily_stream_r << "< "; for ( PCursor i( open_voices.top() ); i.ok(); i++ ) - lily_stream_r << i->mudela_str( now_mom, then_mom, open_voices.size() - 1 ); +// lily_stream_r << i->mudela_str( now_mom, then_mom, open_voices.size() - 1 ); + str += i->mudela_str( now_mom, then_mom, open_voices.size() - 1 ); + if ( str.length_i() ) + lily_stream_r << str; + else + output_mudela_rest( lily_stream_r, now_mom, then_mom ); + if ( open_voices.size() > 1 ) lily_stream_r << "> "; - now_mom = then_mom; + remove_end_at( open_voices, then_mom ); - remove_end_at( open_voices, now_mom ); - if ( bars_i > bar_i ) { - bar_i = bars_i; - tor( NORMAL_ver ) << ']' << flush; - } + bar_i = check_end_bar_i( now_mom, bar_i ); + + now_mom = then_mom; } bar_i++; tor( NORMAL_ver ) << '[' << bar_i << ']' << flush; @@ -193,11 +206,84 @@ Midi_track::output_mudela( Lily_stream& lily_stream_r ) lily_stream_r.newline(); } + +void +Midi_track::output_mudela_begin_bar( Lily_stream& lily_stream_r, Moment now_mom, int bar_i ) +{ + Moment bar_mom = midi_time_p_->bar_mom(); + Moment into_bar_mom = now_mom - Moment( bar_i - 1 ) * bar_mom; + if ( bar_i > 1 ) { + if ( !into_bar_mom ) + lily_stream_r << "|"; + lily_stream_r.newline(); + } + lily_stream_r << "% " << String_convert::i2dec_str( bar_i, 0, ' ' ); + if ( into_bar_mom ) + lily_stream_r << ":" << Duration_convert::dur2_str( Duration_convert::mom2_dur( into_bar_mom ) ); + lily_stream_r.newline(); +} + + +void +Midi_track::output_mudela_rest( Lily_stream& lily_stream_r, Moment begin_mom, Moment end_mom ) +{ + Moment bar_mom = midi_time_p_->bar_mom(); + Moment now_mom = begin_mom; + int begin_bar_i =(int)( now_mom / bar_mom ) + 1; + Moment remain_mom = now_mom - Moment( begin_bar_i - 1 ) * bar_mom; + if ( remain_mom > Moment( 0 ) ) + output_mudela_rest_remain( lily_stream_r, remain_mom ); + + int end_bar_i = (int)( end_mom / bar_mom ) + 1; + now_mom += remain_mom; + + int bar_i = (int)( now_mom / bar_mom ) + 1; + bar_i = check_end_bar_i( now_mom, bar_i ); + for ( int i = 0; i < end_bar_i - begin_bar_i; i++ ) { + int begin_bar_i = check_begin_bar_i( now_mom, bar_i ); + if ( begin_bar_i ) + output_mudela_begin_bar( lily_stream_r, now_mom, begin_bar_i ); + lily_stream_r << "r1 "; + tor( NORMAL_ver ) << begin_bar_i << flush; + bar_i = check_end_bar_i( now_mom, bar_i ); + now_mom += bar_mom; + } + // use "int i" here, and gcc 2.7.2 hits internal compiler error + int ii = check_begin_bar_i( now_mom, bar_i ); + if ( ii ) + output_mudela_begin_bar( lily_stream_r, now_mom, ii ); + bar_i = check_end_bar_i( now_mom, bar_i ); + + remain_mom = end_mom - Moment( end_bar_i - 1 ) * bar_mom; + if ( remain_mom > Moment( 0 ) ) + output_mudela_rest_remain( lily_stream_r, remain_mom ); +} + + +void +Midi_track::output_mudela_rest_remain( Lily_stream& lily_stream_r, Moment mom ) +{ + int type_i = 2; + while ( mom > Moment( 0 ) ) { + Duration dur( type_i ); + Moment type_mom = Duration_convert::dur2_mom( dur ); + int count_i = (int)( mom / type_mom ); + for( int i = 0; i < count_i; i++ ) + lily_stream_r << "r" << dur.str() << " "; + type_i *= 2; + mom -= Moment( count_i ) * type_mom; + if ( Duration_convert::no_smaller_than_i_s + && ( type_i > Duration_convert::no_smaller_than_i_s ) ) + break; + } + +} + void Midi_track::remove_end_at( PointerList& open_voices_r, Moment mom ) { for ( PCursor i( open_voices_r.top() ); i.ok(); i++ ) -// if ( i->end_mom() == mom ) { +// if ( i->end_mom() == mom ) { } if ( i->end_mom() <= mom ) { tor( DEBUG_ver ) << "open_voices (" << open_voices_r.size() << "): -1\n"; i.remove_p(); diff --git a/tex/lilyponddefs.tex b/tex/lilyponddefs.tex index 19a0a48471..2851557010 100644 --- a/tex/lilyponddefs.tex +++ b/tex/lilyponddefs.tex @@ -13,12 +13,7 @@ \def\vcenter#1{\vbox to 0pt{\vss #1\vss}} \def\mathdef#1#2{\def#1{\mathchar{#2}}} -% \def\mathchar#1{\mathfnt\char#1} -\def\mathchar#1{$#1$} -\def\mathaccentraise#1#2{\dimen0=\noteheight - \rationalmultiply\dimen0*#2% - \raise\dimen0\hbox{#1}} -\def\mathaccentdef#1#2#3{\def#1{\mathaccentraise{\mathchar{#2}}{#3}}} +\def\mathchar#1{\mathfont\char#1} \def\topalign#1{\vbox to 0pt{#1\vss}} \def\botalign#1{\vbox to 0pt{\vss #1}} @@ -54,6 +49,7 @@ \font\musicdraw=musixsps \font\italicfont=cmti10 \font\dynfont=cmbxti10 scaled \magstep1 + \font\mathfont=cmsy10 \balkhoog=20pt \notewidth=6pt \noteheight=5pt @@ -75,6 +71,7 @@ \font\musicfnt=musix16 \font\dynfont=cmbxti12 \font\musicdraw=musixsps + \font\mathfont=cmsy8 \balkhoog=16pt \staffrulethickness=0.4pt \notewidth=5pt @@ -99,7 +96,7 @@ % \def\dyn{\italicfont} \def\dyn{\dynfont} \def\kdynf{\dynfont f\kern-.1ex} -\def\kdynm{\dynfont f\kern-.15ex} +\def\kdynm{\dynfont m\kern-.15ex} \def\kdynp{\dynfont p\kern-.15ex} \def\dynppp{\dynfont\dynp\kdynp p} @@ -159,14 +156,13 @@ \def\emptybar{} \def\thinbar{\vrule height\balkhoog} -%? what-s wrong with rightalign? \def\thickbar{\vrule height\balkhoog width 2\smallspace} \def\maatstreep{\thinbar} -% \def\finishbar{\rightalign{\thinbar\kern\smallspace\thickbar}} -\def\finishbar{\hss\rightalign{\thinbar\kern\smallspace\thickbar}} +%? what-s wrong with rightalign? +\def\finishbar{\rightalign{\thinbar\kern\smallspace\thickbar}} +%%% \def\finishbar{\hss\rightalign{\thinbar\kern\smallspace\thickbar}} % \def\repeatstopbar{\rightalign{\repeatcolon\hskip2\smallspace\thinbar\hskip\smallspace\thickbar}} \def\repeatstopbar{\hss\rightalign{\repeatcolon\hskip2\smallspace\thinbar\hskip\smallspace\thickbar}} -% \def\repeatstopbar{\kern-3\smallspace\rightalign{\repeatcolon\kern2\smallspace\thinbar\kern\smallspace\thickbar}\kern3\smallspace} \def\repeatstartbar{\hbox{\thickbar\kern\smallspace\thinbar\kern2\smallspace\repeatcolon}} \def\repeatstopstart{\hbox{\repeatcolon\kern2\smallspace\thinbar\kern\smallspace\thickbar\kern\smallspace\thickbar\kern\smallspace\thinbar\kern2\smallspace\repeatcolon}} \def\doublebar{\hbox{\thinbar\hskip\smallspace\thinbar}} @@ -248,10 +244,26 @@ \mdef\downbow{22} \mdef\portato{26} -% \mathdef\heel\cup % "225B -% \mathdef\toe\wedge % "225E -\mathaccentdef\heel\cup{-1/1} -\mathaccentdef\toe\wedge{-1/1} +\mathdef\cup{91} % \cup +\mathdef\wedge{94} % \wedge +\mathdef\striepke{0} % heu? + +%% custom characters --- this should go: add to (meta!) font +\def\myheel{\kern-.5ex\vbox{\cup}\kern-.5ex} +\def\mytoe{\kern-.5ex\vbox{\wedge}\kern-.5ex} +\def\mystriepke{\kern-1.1ex\vbox{\hbox{\kern-.05em\striepke}}\kern-1.1ex} + +\def\heel{\vbox{\myheel}} +\def\toe{\vbox{\mytoe}} +\def\backorfront{\mystriepke} + +\def\bheel{\vbox{\myheel\mystriepke}} +\def\btoe{\vbox{\mytoe\mystriepke}} +\def\fheel{\vbox{\mystriepke\myheel}} +\def\ftoe{\vbox{\mystriepke\mytoe}} +\def\heeltoe{\vbox{\myheel\mytoe}} +\def\toeheel{\vbox{\mytoe\myheel}} +%% \def\stem#1#2{\vrule height#2 depth-#1} -- 2.39.5