From: fred Date: Tue, 26 Mar 2002 22:46:39 +0000 (+0000) Subject: lilypond-1.3.31 X-Git-Tag: release/1.5.59~1844 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=5799cc67043ad636fbf64f4fad6597be90733d34;p=lilypond.git lilypond-1.3.31 --- diff --git a/input/test/absolute-volume.ly b/input/test/absolute-volume.ly new file mode 100644 index 0000000000..b372e4772d --- /dev/null +++ b/input/test/absolute-volume.ly @@ -0,0 +1,19 @@ +\score{ +\notes\relative c''{ +%segfault in engraver +a1\ppp +a1\pp +a\p +a\mp +a\mf +a\f +a\ff +a\fff +a\sf +} +\paper{ +} +\midi{ +\tempo 1 = 60; +} +} diff --git a/input/test/crescendi.ly b/input/test/crescendi.ly new file mode 100644 index 0000000000..3d47741875 --- /dev/null +++ b/input/test/crescendi.ly @@ -0,0 +1,17 @@ +\score{ +\notes\relative c''{ +a1\fff\< \!a +a\> \!a +\property Voice.crescendoText = "cresc." +\property Voice.crescendoSpanner = "dashed-line" +a\mf\cresc \endcresc a +%a\decresc \enddecresc a +a1\< \!a +a\> \!a +} +\paper{ +} +\midi{ +\tempo 1 = 60; +} +} diff --git a/input/test/span-dynamic.ly b/input/test/span-dynamic.ly new file mode 100644 index 0000000000..8c48f7d3a0 --- /dev/null +++ b/input/test/span-dynamic.ly @@ -0,0 +1,17 @@ +\score{ +\notes\relative c''{ +a1\ppp\< +a +a +a +a +a +a +\!a\fff +} +\paper{ +} +\midi{ +\tempo 1 = 60; +} +} diff --git a/lily/audio-item.cc b/lily/audio-item.cc index 089469ba05..410222f0e5 100644 --- a/lily/audio-item.cc +++ b/lily/audio-item.cc @@ -45,6 +45,11 @@ Audio_key::Audio_key (Key_def const& k) key_ = k; } +Audio_dynamic::Audio_dynamic (int volume) +{ + volume_i_ = volume; +} + Audio_tempo::Audio_tempo (int per_minute_4_i) { per_minute_4_i_ = per_minute_4_i; diff --git a/lily/crescendo.cc b/lily/crescendo.cc index bdf26864df..ca1cf50cd0 100644 --- a/lily/crescendo.cc +++ b/lily/crescendo.cc @@ -69,28 +69,45 @@ Crescendo::do_brew_molecule () const Drul_array broken; Direction d = LEFT; - do { - Paper_column* s = dynamic_cast(spanned_drul_[d]); // UGH - broken[d] = (!s->musical_b ()); - } while (flip (&d) != LEFT); + do + { + Paper_column* s = dynamic_cast(spanned_drul_[d]); // UGH + broken[d] = (!s->musical_b ()); + } + while (flip (&d) != LEFT); - bool continued = broken[Direction (-gd)]; - Real height = paper_l()->get_var ("crescendo_height"); - Real thick = paper_l ()->get_var ("crescendo_thickness"); - - const char* hairpin = (gd < 0)? "decrescendo" : "crescendo"; - - Box b (Interval (0, width), - Interval (-2*height, 2*height)); - - SCM at = gh_list (ly_symbol2scm (hairpin), - gh_double2scm (thick), - gh_double2scm (width), - gh_double2scm (height), - gh_double2scm (continued ? height/2 : 0.0), - SCM_UNDEFINED); - + SCM at; + SCM s = get_elt_property ("spanner"); + Real height; + if (gh_string_p (s) && ly_scm2string (s) == "dashed-line") + { + Real thick = paper_l ()->get_var ("crescendo_dash_thickness"); + Real dash = paper_l ()->get_var ("crescendo_dash"); + height = thick; + at = gh_list (ly_symbol2scm (ly_scm2string (s).ch_C ()), + gh_double2scm (thick), + gh_double2scm (dash), + gh_double2scm (width), + SCM_UNDEFINED); + } + else + { + bool continued = broken[Direction (-gd)]; + height = paper_l()->get_var ("crescendo_height"); + Real thick = paper_l ()->get_var ("crescendo_thickness"); + + const char* hairpin = (gd < 0)? "decrescendo" : "crescendo"; + + at = gh_list (ly_symbol2scm (hairpin), + gh_double2scm (thick), + gh_double2scm (width), + gh_double2scm (height), + gh_double2scm (continued ? height/2 : 0.0), + SCM_UNDEFINED); + } + + Box b (Interval (0, width), Interval (-2*height, 2*height)); Molecule m (b, at); m.translate_axis (extra_left, X_AXIS); diff --git a/lily/dynamic-engraver.cc b/lily/dynamic-engraver.cc index 977053e621..254271080f 100644 --- a/lily/dynamic-engraver.cc +++ b/lily/dynamic-engraver.cc @@ -20,12 +20,24 @@ #include "note-head.hh" #include "group-interface.hh" +/* + TODO: + * why handle absolute and span requests in one cryptic engraver, + what about Span_dynamic_engraver? + + * hairpin + * text: + - `cresc. -- -- --' + - `cresc. poco a poco -- -- --' + */ + /** print text & hairpin dynamics. */ class Dynamic_engraver : public Engraver { - Text_item * text_p_; + Text_item * abs_text_p_; + Text_item * cr_text_p_; Crescendo * to_end_cresc_p_; Crescendo * cresc_p_; @@ -61,10 +73,9 @@ Dynamic_engraver::announce_element (Score_element_info i) Dynamic_engraver::Dynamic_engraver() { do_post_move_processing(); - text_p_ =0; - + abs_text_p_ = 0; + cr_text_p_ = 0; to_end_cresc_p_ = cresc_p_ = 0; - cresc_req_l_ = 0; } @@ -112,7 +123,7 @@ Dynamic_engraver::do_process_requests() if (Text_script_req *absd = dynamic_cast ( dynamic_req_l_arr_[i])) { - if (text_p_) + if (abs_text_p_) { dynamic_req_l_arr_[i]->warning (_("Got a dynamic already. Continuing dazed and confused.")); continue; @@ -120,19 +131,19 @@ Dynamic_engraver::do_process_requests() String loud = absd->text_str_; - text_p_ = new Text_item; - text_p_->set_elt_property ("text", + abs_text_p_ = new Text_item; + abs_text_p_->set_elt_property ("text", ly_str02scm (loud.ch_C())); - text_p_->set_elt_property ("style", gh_str02scm ("dynamic")); - text_p_->set_elt_property ("script-priority", + abs_text_p_->set_elt_property ("style", gh_str02scm ("dynamic")); + abs_text_p_->set_elt_property ("script-priority", gh_int2scm (100)); - Side_position_interface (text_p_).set_axis (Y_AXIS); + Side_position_interface (abs_text_p_).set_axis (Y_AXIS); if (absd->get_direction ()) { - text_p_->set_elt_property ("direction", gh_int2scm (absd->get_direction ())); + abs_text_p_->set_elt_property ("direction", gh_int2scm (absd->get_direction ())); } @@ -146,14 +157,14 @@ Dynamic_engraver::do_process_requests() } if (isdir_b (prop) && to_dir (prop)) - text_p_->set_elt_property ("direction", prop); + abs_text_p_->set_elt_property ("direction", prop); prop = get_property ("dynamicPadding"); if (gh_number_p(prop)) { - text_p_->set_elt_property ("padding", prop); + abs_text_p_->set_elt_property ("padding", prop); } - announce_element (Score_element_info (text_p_, absd)); + announce_element (Score_element_info (abs_text_p_, absd)); } else if (Span_req *span_l = dynamic_cast (dynamic_req_l_arr_[i])) @@ -177,10 +188,50 @@ Dynamic_engraver::do_process_requests() cresc_req_l_ = span_l; assert (!new_cresc_p); new_cresc_p = new Crescendo; - new_cresc_p - ->set_elt_property ("grow-direction", - gh_int2scm ((span_l->span_type_str_ == "crescendo") ? BIGGER : SMALLER)); + new_cresc_p->set_elt_property + ("grow-direction", + gh_int2scm ((span_l->span_type_str_ == "crescendo") + ? BIGGER : SMALLER)); + SCM s = get_property (span_l->span_type_str_ + "Text"); + if (gh_string_p (s)) + { + cr_text_p_ = new Text_item; + cr_text_p_->set_elt_property ("text", s); + // urg + cr_text_p_->set_elt_property ("style", gh_str02scm ("italic")); + // ? + cr_text_p_->set_elt_property ("script-priority", + gh_int2scm (100)); + + /* + This doesn't work. + I'd like to have support like this: + | + x| + cresc. - - - + + or + | + x| + ff cresc. - - - + + */ + if (0) //abs_text_p_) + { + Side_position_interface (cr_text_p_).set_axis (X_AXIS); + Side_position_interface (cr_text_p_).add_support (abs_text_p_); + } + //Side_position_interface (cr_text_p_).set_axis (Y_AXIS); + announce_element (Score_element_info (cr_text_p_, span_l)); + } + + s = get_property (span_l->span_type_str_ + "Spanner"); + if (gh_string_p (s)) //&& ly_scm2string (s) != "hairpin") + { + new_cresc_p->set_elt_property ("spanner", s); + } + side_position (new_cresc_p).set_axis (Y_AXIS); announce_element (Score_element_info (new_cresc_p, span_l)); } @@ -201,7 +252,8 @@ Dynamic_engraver::do_process_requests() cresc_p_ = new_cresc_p; cresc_p_->set_bounds(LEFT,get_staff_info().musical_pcol_l ()); - if (text_p_) + // arrragh, brr, urg: we know how wide text is, no? + if (abs_text_p_) { index_set_cell (cresc_p_->get_elt_property ("dynamic-drul"), LEFT, SCM_BOOL_T); @@ -247,10 +299,16 @@ Dynamic_engraver::typeset_all () } - if (text_p_) + if (abs_text_p_) { - typeset_element (text_p_); - text_p_ =0; + typeset_element (abs_text_p_); + abs_text_p_ = 0; + } + + if (cr_text_p_) + { + typeset_element (cr_text_p_); + cr_text_p_ = 0; } } @@ -268,8 +326,14 @@ Dynamic_engraver::acknowledge_element (Score_element_info i) || dynamic_cast (i.elem_l_) ) { - if (text_p_) - Side_position_interface (text_p_).add_support (i.elem_l_); + if (abs_text_p_) + Side_position_interface (abs_text_p_).add_support (i.elem_l_); + + if (cr_text_p_) ///&& !abs_text_p_) + { + Side_position_interface (cr_text_p_).set_axis (Y_AXIS); + Side_position_interface (cr_text_p_).add_support (i.elem_l_); + } if (to_end_cresc_p_) Side_position_interface (to_end_cresc_p_).add_support (i.elem_l_); diff --git a/lily/dynamic-performer.cc b/lily/dynamic-performer.cc new file mode 100644 index 0000000000..b7472eaf51 --- /dev/null +++ b/lily/dynamic-performer.cc @@ -0,0 +1,112 @@ +/* + dynamic-performer.cc -- implement Dynamic_performer + + source file of the GNU LilyPond music typesetter + + (c) 2000 Jan Nieuwenhuizen +*/ + +#include "performer.hh" +#include "command-request.hh" +#include "musical-request.hh" +#include "audio-item.hh" + +/* + TODO: + handle multiple requests + handle span requests (crescendo/decrescendo) + */ + +/** + perform absolute (text) dynamics + */ +class Dynamic_performer : public Performer +{ +public: + VIRTUAL_COPY_CONS (Translator); + + Dynamic_performer (); + ~Dynamic_performer (); + +protected: + void do_print () const; + virtual bool do_try_music (Music* req_l); + virtual void do_process_requests (); + virtual void do_pre_move_processing (); + +private: + Text_script_req* text_script_req_l_; + Audio_dynamic* audio_p_; +}; + +ADD_THIS_TRANSLATOR (Dynamic_performer); + +Dynamic_performer::Dynamic_performer () +{ + text_script_req_l_ = 0; + audio_p_ = 0; +} + +Dynamic_performer::~Dynamic_performer () +{ +} + +void +Dynamic_performer::do_print () const +{ +#ifndef NPRINT + if (text_script_req_l_) + text_script_req_l_->print (); +#endif +} + +void +Dynamic_performer::do_process_requests () +{ + if (text_script_req_l_) + { + + SCM s = scm_eval + (gh_list + (ly_symbol2scm ("dynamic-absolute-volume"), + ly_quote_scm (ly_str02scm (text_script_req_l_->text_str_.ch_C ())), + SCM_UNDEFINED)); + int volume = gh_scm2int (ly_eval_str ("dynamic-default-volume")); + if (gh_number_p (s)) + volume = gh_scm2int (s); + + audio_p_ = new Audio_dynamic (volume); + Audio_element_info info (audio_p_, text_script_req_l_); + announce_element (info); + text_script_req_l_ = 0; + } +} + +void +Dynamic_performer::do_pre_move_processing () +{ + if (audio_p_) + { + play_element (audio_p_); + audio_p_ = 0; + } +} + +bool +Dynamic_performer::do_try_music (Music* r) +{ + if (!text_script_req_l_) + { + // urg, text script, style `dynamic' is how absolute dynamics appear + if(Text_script_req* t = dynamic_cast (r)) + { + if (t->style_str_ == "dynamic") + { + text_script_req_l_ = t; + return true; + } + } + } + return false; +} + diff --git a/lily/include/audio-item.hh b/lily/include/audio-item.hh index 08c780fecf..8edd0ef388 100644 --- a/lily/include/audio-item.hh +++ b/lily/include/audio-item.hh @@ -37,6 +37,14 @@ private: Audio_item& operator=( Audio_item const&); }; +class Audio_dynamic : public Audio_item +{ +public: + Audio_dynamic (int volume); + + int volume_i_; +}; + class Audio_key : public Audio_item { public: diff --git a/lily/include/lily-proto.hh b/lily/include/lily-proto.hh index af8c468994..3a6f324771 100644 --- a/lily/include/lily-proto.hh +++ b/lily/include/lily-proto.hh @@ -19,6 +19,7 @@ struct Align_element; struct All_font_metrics; struct Articulation_req; struct Audio_column; +struct Audio_dynamic; struct Audio_element; struct Audio_element_info; struct Audio_instrument; @@ -80,6 +81,7 @@ struct Command_script_req; struct Command_tie_engraver; struct Crescendo ; struct Dimension_cache; +struct Dynamic_performer; struct Spanner; struct Dot_column; struct Dots; @@ -128,6 +130,7 @@ struct Measure_grouping_req; struct Melodic_req; struct Midi_def; struct Midi_duration; +struct Midi_dynamic; struct Midi_header; struct Midi_item; struct Midi_key; @@ -216,6 +219,7 @@ struct Simultaneous_music; struct Single_malt_grouping_item; struct Skip_req; struct Slur; +struct Slur_bezier_bow; struct Slur_engraver; struct Spacing_spanner; struct Span_bar; diff --git a/lily/include/midi-item.hh b/lily/include/midi-item.hh index b10ad8c5f9..c9823dbcf2 100644 --- a/lily/include/midi-item.hh +++ b/lily/include/midi-item.hh @@ -160,6 +160,16 @@ public: Audio_text* audio_l_; }; +class Midi_dynamic : public Midi_item +{ +public: + Midi_dynamic (Audio_dynamic*); + + virtual String str () const; + + Audio_dynamic* audio_l_; +}; + class Midi_tempo : public Midi_item { public: diff --git a/lily/include/slur.hh b/lily/include/slur.hh index 4f14512047..93844719cc 100644 --- a/lily/include/slur.hh +++ b/lily/include/slur.hh @@ -35,7 +35,7 @@ protected: Array get_rods () const; private: - void de_uglyfy (class Slur_bezier_bow* bb, Real default_height); + void de_uglyfy (Slur_bezier_bow* bb, Real default_height); void set_extremities (); void set_control_points (); int cross_staff_count () const; diff --git a/lily/midi-item.cc b/lily/midi-item.cc index aeaa53ffa2..b822a6655e 100644 --- a/lily/midi-item.cc +++ b/lily/midi-item.cc @@ -27,6 +27,8 @@ Midi_item::midi_p (Audio_item* a) return i->str_.length_i () ? new Midi_instrument (i) : 0; else if (Audio_note* i = dynamic_cast (a)) return new Midi_note (i); + else if (Audio_dynamic* i = dynamic_cast (a)) + return new Midi_dynamic (i); else if (Audio_tempo* i = dynamic_cast (a)) return new Midi_tempo (i); else if (Audio_time_signature* i = dynamic_cast (a)) @@ -458,6 +460,27 @@ Midi_note_off::str () const return str; } +Midi_dynamic::Midi_dynamic (Audio_dynamic* a) +{ + audio_l_ = a; +} + +String +Midi_dynamic::str () const +{ + Byte status_byte = (char) (0xB0 + channel_i_); + String str = to_str ((char)status_byte); + + /* + Main volume controller (per channel): + 07 MSB + 27 LSB + */ + str += to_str ((char)0x07); + str += to_str ((char)audio_l_->volume_i_); + return str; +} + Midi_tempo::Midi_tempo (Audio_tempo* a) { audio_l_ = a; diff --git a/lily/span-dynamic-performer.cc b/lily/span-dynamic-performer.cc new file mode 100644 index 0000000000..c6f115901a --- /dev/null +++ b/lily/span-dynamic-performer.cc @@ -0,0 +1,153 @@ +/* + span-dynamic-performer.cc -- implement Span_dynamic_performer + + source file of the GNU LilyPond music typesetter + + (c) 2000 Jan Nieuwenhuizen +*/ + +#include "performer.hh" +#include "command-request.hh" +#include "musical-request.hh" +#include "audio-item.hh" + +struct Audio_dynamic_tuple +{ + Audio_dynamic* audio_l_; + Moment mom_; +}; + +/** + handle perform span-dynamics + */ +class Span_dynamic_performer : public Performer +{ +public: + VIRTUAL_COPY_CONS (Translator); + + Span_dynamic_performer (); + +protected: + virtual bool do_try_music (Music* req_l); + virtual void acknowledge_element (Audio_element_info); + virtual void do_process_requests (); + virtual void do_pre_move_processing (); + +private: + Drul_array request_drul_; + Drul_array moment_drul_; + Drul_array volume_drul_; + Array dynamic_tuple_arr_; + + // BURP + Drul_array done_moment_drul_; + Drul_array done_volume_drul_; + Array done_dynamic_tuple_arr_; + + Audio_dynamic* audio_p_; +}; + +ADD_THIS_TRANSLATOR (Span_dynamic_performer); + +Span_dynamic_performer::Span_dynamic_performer () +{ + request_drul_[START] = request_drul_[STOP] = 0; + volume_drul_[START] = volume_drul_[STOP] = 0; + audio_p_ = 0; +} + +void +Span_dynamic_performer::acknowledge_element (Audio_element_info i) +{ + if (Audio_dynamic * d = dynamic_cast (i.elem_l_)) + { + Direction dir = volume_drul_[START] ? STOP : START; + volume_drul_[dir] = d->volume_i_; + if (done_dynamic_tuple_arr_.size ()) + done_volume_drul_[STOP] = d->volume_i_; +#if 0 + Audio_dynamic_tuple a = { d, now_mom () }; + dynamic_tuple_arr_.push (a); +#endif + } +} + +void +Span_dynamic_performer::do_process_requests () +{ + if (request_drul_[START]) + { + audio_p_ = new Audio_dynamic (volume_drul_[START]); + Audio_element_info info (audio_p_, 0); + announce_element (info); + + Audio_dynamic_tuple a = { audio_p_, now_mom () }; + dynamic_tuple_arr_.push (a); + } + + if (done_dynamic_tuple_arr_.size ()) + { + if (done_volume_drul_[STOP]) + { + Real dv = done_volume_drul_[STOP] - done_volume_drul_[START]; + Moment dt = done_moment_drul_[STOP] - done_moment_drul_[START]; + for (int i=0; i < done_dynamic_tuple_arr_.size (); i++) + { + Real volume = + (done_volume_drul_[START] + + dv * (Real)(done_dynamic_tuple_arr_[i].mom_ + - done_moment_drul_[START]) / (Real)dt); + done_dynamic_tuple_arr_[i].audio_l_->volume_i_ = (int)volume; + } + } + done_dynamic_tuple_arr_.clear (); + } + + if (request_drul_[STOP]) + { + done_dynamic_tuple_arr_ = dynamic_tuple_arr_; + dynamic_tuple_arr_.clear (); + done_volume_drul_[START] = volume_drul_[START]; + done_volume_drul_[STOP] = volume_drul_[STOP]; + done_moment_drul_[START] = moment_drul_[START]; + done_moment_drul_[STOP] = moment_drul_[STOP]; + request_drul_[STOP] = 0; + volume_drul_[START] = volume_drul_[STOP]; + volume_drul_[STOP] = 0; + } +} + +void +Span_dynamic_performer::do_pre_move_processing () +{ + if (audio_p_) + { + play_element (audio_p_); + audio_p_ = 0; + } +} + +bool +Span_dynamic_performer::do_try_music (Music* r) +{ + if (Span_req * s = dynamic_cast(r)) + { + if (s-> span_type_str_ != "crescendo" + && s->span_type_str_ != "decrescendo") + return false; + + Direction d = s->span_dir_; + + if (d == STOP && !request_drul_[START]) + { + r->warning (_ ("No (de)crescendo to end")); + return false; + } + request_drul_[d] = s; + moment_drul_[d] = now_mom (); + if (d == START && volume_drul_[STOP]) + volume_drul_[START] = volume_drul_[STOP]; + return true; + } + return false; +} diff --git a/lily/tie-performer.cc b/lily/tie-performer.cc index a05b54cce6..b9109b9d86 100644 --- a/lily/tie-performer.cc +++ b/lily/tie-performer.cc @@ -23,10 +23,13 @@ Tie_performer::Tie_performer() bool Tie_performer::do_try_music (Music *m) { - if (Tie_req * c = dynamic_cast (m)) + if (!req_l_) { - req_l_ = c; - return true; + if (Tie_req * c = dynamic_cast (m)) + { + req_l_ = c; + return true; + } } return false; } diff --git a/ly/midi.ly b/ly/midi.ly index d47242bf58..b41614cc2b 100644 --- a/ly/midi.ly +++ b/ly/midi.ly @@ -1,4 +1,6 @@ +#(eval-string (ly-gulp-file "midi.scm")) + \midi { \tempo 4=60; \include "performer.ly" diff --git a/ly/params.ly b/ly/params.ly index 5c5d505123..d02f17dd97 100644 --- a/ly/params.ly +++ b/ly/params.ly @@ -175,6 +175,8 @@ multi_measure_rest_expand_limit = 10.0; crescendo_shorten = 4.0 * \staffspace; crescendo_thickness = \stafflinethickness; crescendo_height = 0.666 * \staffspace; +crescendo_dash_thickness = 1.2*\stafflinethickness; +crescendo_dash = 4.0*\staffspace; % in internote. restcollision_minimum_dist = 3.0; diff --git a/ly/performer.ly b/ly/performer.ly index 44e3272c53..132d0e8c84 100644 --- a/ly/performer.ly +++ b/ly/performer.ly @@ -14,6 +14,8 @@ StaffContext = \translator { \consists "Key_performer"; \consists "Time_signature_performer"; \consists "Tempo_performer"; +% \consists "Span_dynamic_performer"; + dynamicStyle = #"dynamic" }; \translator { \StaffContext } @@ -41,6 +43,8 @@ VoiceContext = \translator { \type "Performer_group_performer"; \name Voice; % All notes fall to Grace if you leave Thread out (huh?) + \consists "Dynamic_performer"; % must come before text_engraver. + \consists "Span_dynamic_performer"; \consists "Grace_position_performer"; \accepts Thread; \accepts Grace; diff --git a/ly/property.ly b/ly/property.ly index d416d2edd9..8fe96e79a8 100644 --- a/ly/property.ly +++ b/ly/property.ly @@ -123,3 +123,4 @@ autoBeamOn = \property Voice.noAutoBeaming = ##f emptyText = \property Voice.textEmptyDimension = ##t fatText = \property Voice.textEmptyDimension = ##f + diff --git a/ly/spanners.ly b/ly/spanners.ly index bf8cafcee2..b21bcc7165 100644 --- a/ly/spanners.ly +++ b/ly/spanners.ly @@ -5,3 +5,23 @@ cr = \spanrequest \start "crescendo" decr = \spanrequest \start "decrescendo" rc = \spanrequest \stop "crescendo" rced = \spanrequest \stop "decrescendo" + +%% urg, these don't work yet. +xcresc = { +%\spanrequest \start "crescendo" +\property Voice.crescendoText = "cresc." +\property Voice.crescendoSpanner = "dashed" +} + +xendcresc = { +%\spanrequest \start "crescendo" +\property Voice.crescendoText = ##f +\property Voice.crescendoSpanner = ##f +} + +cresc = \spanrequest \start "crescendo" +endcresc = \spanrequest \stop "crescendo" + +%crescpoco = \property Voice.crescendoText = "cresc. poco a poco" +%decresc = \property Voice.crescendoText = "decr." +%dim = \property Voice.crescendoText = "dim." diff --git a/ps/lily.ps b/ps/lily.ps index c88e20c71e..72da29ec20 100644 --- a/ps/lily.ps +++ b/ps/lily.ps @@ -104,7 +104,7 @@ } bind def % % this is for drawing slurs. -/draw_bezier_sandwich % thickness +/draw_bezier_sandwich % thickness controls { setlinewidth moveto @@ -117,7 +117,18 @@ stroke } bind def % -/draw_dashed_slur +/draw_dashed_line % dash thickness width +{ + 1 setlinecap + 1 setlinejoin + setdash + setlinewidth + 0 0 moveto + 0 lineto + stroke +} bind def +% +/draw_dashed_slur % dash thickness controls { 1 setlinecap 1 setlinejoin diff --git a/scm/lily.scm b/scm/lily.scm index f2b009aa9e..841ecade60 100644 --- a/scm/lily.scm +++ b/scm/lily.scm @@ -281,6 +281,9 @@ (define (char i) (string-append "\\char" (inexact->string i 10) " ")) + (define (dashed-line thick dash w) + (embedded-ps ((ps-scm 'dashed-line) thick dash w))) + (define (decrescendo thick w h cont) (embedded-ps ((ps-scm 'decrescendo) thick w h cont))) @@ -405,6 +408,7 @@ (define bracket ,bracket) (define char ,char) (define crescendo ,crescendo) + (define dashed-line ,dashed-line) (define dashed-slur ,dashed-slur) (define decrescendo ,decrescendo) (define end-output ,end-output) @@ -431,6 +435,7 @@ ((eq? action-name 'tuplet) tuplet) ((eq? action-name 'bracket) bracket) ((eq? action-name 'crescendo) crescendo) + ((eq? action-name 'dashed-line) dashed-line) ((eq? action-name 'dashed-slur) dashed-slur) ((eq? action-name 'decrescendo) decrescendo) ((eq? action-name 'end-output) end-output) @@ -538,6 +543,17 @@ (number->string (* 10 thick)) ;UGH. 10 ? " ] 0 draw_dashed_slur")) + (define (dashed-line thick dash width) + (string-append + (number->string width) + " " + (number->string thick) + " [ " + (number->string dash) + " " + (number->string dash) + " ] 0 draw_dashed_line")) + (define (decrescendo thick w h cont) (string-append (numbers->string (list w h (inexact->exact cont) thick)) @@ -641,6 +657,7 @@ (define crescendo ,crescendo) (define volta ,volta) (define bezier-sandwich ,bezier-sandwich) + (define dashed-line ,dashed-line) (define dashed-slur ,dashed-slur) (define decrescendo ,decrescendo) (define end-output ,end-output) @@ -668,6 +685,7 @@ ((eq? action-name 'bracket) bracket) ((eq? action-name 'char) char) ((eq? action-name 'crescendo) crescendo) + ((eq? action-name 'dashed-line) dashed-line) ((eq? action-name 'dashed-slur) dashed-slur) ((eq? action-name 'decrescendo) decrescendo) ((eq? action-name 'experimental-on) experimental-on) diff --git a/scm/midi.scm b/scm/midi.scm new file mode 100644 index 0000000000..0e42d834a2 --- /dev/null +++ b/scm/midi.scm @@ -0,0 +1,31 @@ +;;; midi.scm -- scm midi variables and functions +;;; +;;; source file of the GNU LilyPond music typesetter +;;; +;;; (c) 2000 Jan Nieuwenhuizen + + +(define absolute-volume-alist '()) +(set! absolute-volume-alist + (append + '( + ("sf" . 115) + ("fff" . 102) + ("ff" . 90) + ("f" . 77) + ("mf" . 64) + ("mp" . 51) + ("p" . 38) + ("pp" . 26) + ("ppp" . 13) + ) + absolute-volume-alist)) + +(define (dynamic-absolute-volume s) + (let ((entry (assoc s absolute-volume-alist))) + (if entry + (cdr entry)))) + +;; 90 is supposed to be the default value +;; urg: we should set this at start of track +(define dynamic-default-volume 90)