From ed2f7473be57e99f15acc48c06fe18fed27d43b3 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Thu, 25 Mar 2004 01:45:15 +0000 Subject: [PATCH] * lily/lily-guile.cc (type_check_assignment): use ly_scheme_function iso. scm_primitive_eval where possible. * lily/performance.cc (output): limit channels at 15. This fixes percussion inadvertently showing up in large scores. --- ChangeLog | 8 ++++++++ Documentation/user/notation.itely | 8 ++++---- lily/global-context.cc | 2 +- lily/include/audio-element.hh | 2 +- lily/include/audio-staff.hh | 3 ++- lily/key-performer.cc | 6 ++---- lily/lily-guile.cc | 2 +- lily/midi-item.cc | 2 +- lily/music.cc | 4 +--- lily/paper-book.cc | 14 +++++++------- lily/performance.cc | 13 ++++++++++++- lily/staff-performer.cc | 4 +--- scm/define-grobs.scm | 1 + 13 files changed, 42 insertions(+), 27 deletions(-) diff --git a/ChangeLog b/ChangeLog index b19f54124f..891cd3de29 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2004-03-25 Han-Wen Nienhuys + + * lily/lily-guile.cc (type_check_assignment): use + ly_scheme_function iso. scm_primitive_eval where possible. + + * lily/performance.cc (output): limit channels at 15. This fixes + percussion inadvertently showing up in large scores. + 2004-03-24 Han-Wen Nienhuys * input/regression/tuplet-gap.ly: new file. diff --git a/Documentation/user/notation.itely b/Documentation/user/notation.itely index 23c3e4370f..cb15cd64b3 100644 --- a/Documentation/user/notation.itely +++ b/Documentation/user/notation.itely @@ -3461,10 +3461,10 @@ The complete example is shown here: << \notes \relative c'' \context Voice = duet { \time 3/4 g2 e4 a2 f4 g2. } \lyrics << \lyricsto "duet" \new Lyrics { - \set vocNam = "Bert" + \set vocalName = "Bert" Hi, my name is Bert. } \lyricsto "duet" \new Lyrics { - \set vocNam = "Ernie" + \set vocalName = "Ernie" Ooooo, ch\'e -- ri, je t'aime. } >> >> @@ -3477,11 +3477,11 @@ The complete example is shown here: Stanza numbers can be added by setting @code{stanza}, e.g. -@lilypond +@lilypond[verbatim,relative=2] << \context Voice = duet { \time 3/4 g2 e4 a2 f4 g2. } \lyrics \lyricsto "duet" \new Lyrics { - \set vocNam = "1. " + \set stanza = "1. " Hi, my name is Bert. } >> diff --git a/lily/global-context.cc b/lily/global-context.cc index 7cd21b0246..dbb66d10ef 100644 --- a/lily/global-context.cc +++ b/lily/global-context.cc @@ -168,7 +168,7 @@ Global_context::apply_finalizations () set_property ("finalizations" , SCM_EOL); for (SCM s = lst ; gh_pair_p (s); s = gh_cdr (s)) { - scm_primitive_eval (gh_car (s)); + scm_primitive_eval (gh_car (s)); // TODO: make safe. } } diff --git a/lily/include/audio-element.hh b/lily/include/audio-element.hh index 3e25ad8026..ca54756ac4 100644 --- a/lily/include/audio-element.hh +++ b/lily/include/audio-element.hh @@ -10,7 +10,7 @@ #ifndef AUDIO_ELEMENT_HH #define AUDIO_ELEMENT_HH - #include +#include #include "virtual-methods.hh" class Audio_element diff --git a/lily/include/audio-staff.hh b/lily/include/audio-staff.hh index 20c57ec9fa..19f3bb04a7 100644 --- a/lily/include/audio-staff.hh +++ b/lily/include/audio-staff.hh @@ -11,7 +11,8 @@ #include "lily-proto.hh" #include "audio-element.hh" -struct Audio_staff : public Audio_element { +struct Audio_staff : public Audio_element +{ void add_audio_item (Audio_item* l); void output (Midi_stream& midi_stream_r, int track_i); diff --git a/lily/key-performer.cc b/lily/key-performer.cc index 50a352bed1..c9ced39f6a 100644 --- a/lily/key-performer.cc +++ b/lily/key-performer.cc @@ -45,9 +45,7 @@ Key_performer::create_audio_elements () if (key_req_) { SCM pitchlist = key_req_->get_property ("pitch-alist"); - static SCM proc; - if (!proc) - proc = scm_primitive_eval (ly_symbol2scm ("alterations-in-key")); + SCM proc = ly_scheme_function ("alterations-in-key"); SCM acc = gh_call1 (proc, pitchlist); @@ -63,7 +61,7 @@ Key_performer::create_audio_elements () /* MIDI keys are too limited for lilypond scales. We check for minor scale and assume major otherwise. */ - SCM minor = scm_primitive_eval (ly_symbol2scm ("minor")); + SCM minor = scm_c_eval_string ("minor"); audio_ = new Audio_key (gh_scm2int (acc), SCM_BOOL_T != scm_equal_p (minor, c_pitchlist)); diff --git a/lily/lily-guile.cc b/lily/lily-guile.cc index 9562ba7bd5..d9dc08382b 100644 --- a/lily/lily-guile.cc +++ b/lily/lily-guile.cc @@ -600,7 +600,7 @@ type_check_assignment (SCM sym, SCM val, SCM type_symbol) { SCM errport = scm_current_error_port (); ok = false; - SCM typefunc = scm_primitive_eval (ly_symbol2scm ("type-name")); + SCM typefunc = ly_scheme_function ("type-name"); SCM type_name = gh_call1 (typefunc, type); diff --git a/lily/midi-item.cc b/lily/midi-item.cc index 9ade245a71..1fd33773ad 100644 --- a/lily/midi-item.cc +++ b/lily/midi-item.cc @@ -144,7 +144,7 @@ Midi_instrument::to_string () const /* UGH. don't use eval. */ - SCM proc = scm_primitive_eval (ly_symbol2scm ("midi-program")); + SCM proc = ly_scheme_function ("midi-program"); SCM program = gh_call1 (proc, ly_symbol2scm (audio_->str_.to_str0 ())); found = (program != SCM_BOOL_F); if (found) diff --git a/lily/music.cc b/lily/music.cc index 81ff4f92a0..df19f5cb36 100644 --- a/lily/music.cc +++ b/lily/music.cc @@ -342,13 +342,11 @@ LY_DEFINE (ly_music_transpose, "ly:music-transpose", return sc->self_scm (); } -SCM make_music_proc; Music* make_music_by_name (SCM sym) { - if (!make_music_proc) - make_music_proc = scm_primitive_eval (ly_symbol2scm ("make-music")); + SCM make_music_proc = ly_scheme_function ("make-music"); SCM rv = scm_call_1 (make_music_proc, sym); diff --git a/lily/paper-book.cc b/lily/paper-book.cc index 4f48f7a5ad..ae8e547c1c 100644 --- a/lily/paper-book.cc +++ b/lily/paper-book.cc @@ -98,8 +98,8 @@ Page::Page (Paper_def *paper, int number) copyright_ = SCM_EOL; tagline_ = SCM_EOL; - SCM make_header = scm_primitive_eval (ly_symbol2scm ("make-header")); - SCM make_footer = scm_primitive_eval (ly_symbol2scm ("make-footer")); + SCM make_header = ly_scheme_function ("make-header"); + SCM make_footer = ly_scheme_function ("make-footer"); header_ = scm_call_2 (make_header, paper_->self_scm (), scm_int2num (number_)); @@ -288,9 +288,9 @@ Paper_book::scopes (int i) Stencil* Paper_book::title (int i) { - SCM user_title = scm_primitive_eval (ly_symbol2scm ("user-title")); - SCM book_title = scm_primitive_eval (ly_symbol2scm ("book-title")); - SCM score_title = scm_primitive_eval (ly_symbol2scm ("score-title")); + SCM user_title = ly_scheme_function ("user-title"); + SCM book_title = ly_scheme_function ("book-title"); + SCM score_title = ly_scheme_function ("score-title"); SCM field = (i == 0 ? ly_symbol2scm ("bookTitle") : ly_symbol2scm ("scoreTitle")); @@ -354,14 +354,14 @@ Paper_book::init () Paper_def *paper = papers_[0]; SCM scopes = this->scopes (0); - SCM make_tagline = scm_primitive_eval (ly_symbol2scm ("make-tagline")); + SCM make_tagline = ly_scheme_function ("make-tagline"); tagline_ = scm_call_2 (make_tagline, paper->self_scm (), scopes); Real tag_height = 0; if (Stencil *s = unsmob_stencil (tagline_)) tag_height = s->extent (Y_AXIS).length (); height_ += tag_height; - SCM make_copyright = scm_primitive_eval (ly_symbol2scm ("make-copyright")); + SCM make_copyright = ly_scheme_function ("make-copyright"); copyright_ = scm_call_2 (make_copyright, paper->self_scm (), scopes); Real copy_height = 0; if (Stencil *s = unsmob_stencil (copyright_)) diff --git a/lily/performance.cc b/lily/performance.cc index 71a84ddb5a..270bc87d10 100644 --- a/lily/performance.cc +++ b/lily/performance.cc @@ -62,8 +62,19 @@ Performance::output (Midi_stream& midi_stream) */ if (channel == 9) channel++; + + + /* + Huh? Why does each staff also have a separate channel? We + should map channels to voices, not staves. --hwn. + */ if (s->channel_ < 0) - s->channel_ = channel; + { + s->channel_ = channel 15) + warning ("MIDI channel wrapped around. Mapping to channel 15."); + } + s->output (midi_stream, channel++); if (verbose_global_b) progress_indication ("]"); diff --git a/lily/staff-performer.cc b/lily/staff-performer.cc index a969143440..4969d4f85e 100644 --- a/lily/staff-performer.cc +++ b/lily/staff-performer.cc @@ -91,9 +91,7 @@ Staff_performer::create_audio_elements () void Staff_performer::stop_translation_timestep () { - static SCM proc; - if (!proc) - proc = scm_primitive_eval (ly_symbol2scm ("percussion?")); + SCM proc = ly_scheme_function ("percussion?"); SCM drums = gh_call1 (proc, ly_symbol2scm (instrument_string_.to_str0 ())); audio_staff_->channel_ = (drums == SCM_BOOL_T ? 9 : -1 ); diff --git a/scm/define-grobs.scm b/scm/define-grobs.scm index 197733cccc..745df7d3c9 100644 --- a/scm/define-grobs.scm +++ b/scm/define-grobs.scm @@ -459,6 +459,7 @@ (direction . 0) (space-alist . ((left-edge . (extra-space . 1.0)) )) + (break-align-symbol . instrument-name) (print-function . ,Text_item::print) (break-align-symbol . clef) (break-visibility . ,begin-of-line-visible) -- 2.39.2