]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-0.1.46
authorfred <fred>
Sun, 24 Mar 2002 20:05:53 +0000 (20:05 +0000)
committerfred <fred>
Sun, 24 Mar 2002 20:05:53 +0000 (20:05 +0000)
18 files changed:
.dstreamrc
init/performer.ly
lib/duration-convert.cc
lib/include/duration-convert.hh
lib/include/duration.hh
lily/include/midi-walker.hh
lily/include/staff-performer.hh
lily/include/staff-side.hh
lily/include/text-def.hh
lily/include/text-item.hh
lily/midi-stream.cc
lily/midi-walker.cc
lily/spring-spacer.cc
lily/staff-performer.cc
lily/staff-side.cc
lily/template8.cc
lily/text-item.cc
mutopia/standchen.ly

index 03a97fa3a46e03572869341c1a81d2e77c9fc7ef..d92dd4797c844a2e88da9a8638589531d4882541 100644 (file)
@@ -45,7 +45,7 @@ Lookup                        0
 Line_spacer            0
 Melodic_req            0
 Midi_def               0
-Midistrings            1
+Midistrings            0
 Mixed_qp               0
 Music                  0
 Music_iterator         0
index 87ce9ca7d86ecfe97b4a75067d5e5600a41637a7..90b3688412fcdf13a5aaafd4b40c13946ad2ae9e 100644 (file)
@@ -47,7 +47,7 @@ Staff_group = \translator
 
 Score = \translator {
        \type "Score_performer";
-%      instrument = piano;
+       instrument = piano;
        \accepts Staff;
        \accepts Grandstaff;
        \accepts Lyrics; 
index 46bfc1f652208026c1d88e48c132c90af316d2a9..49db74195d657882323897161c6e735421cacecb 100644 (file)
@@ -38,14 +38,6 @@ Duration_convert::dur2_str (Duration dur)
   return str;
 }
 
-#if 0
-int
-Duration_convert::dur2_i (Duration dur, int division_1_i)
-{
-  return dur2_mom (dur) * Moment (division_1_i);
-}
-#endif
-
 int
 Duration_convert::dur2ticks_i (Duration dur)
 {
@@ -100,20 +92,6 @@ Duration_convert::dur2_mom (Duration dur)
   return mom * plet_factor_mom (dur);    
 }
 
-#if 0
-Moment
-Duration_convert::i2_mom (int time_i, int division_1_i)
-{
-  if (!time_i)
-    return Moment (0);
-
-  if (division_1_i > 0)
-    return Moment (time_i, division_1_i);
-  else 
-    return Moment (-division_1_i, time_i);
-}
-#endif
-
 Duration
 Duration_convert::mom2_dur (Moment mom)
 {
@@ -201,28 +179,16 @@ Duration_convert::sync_f (Duration dur, Moment mom)
 Duration
 Duration_convert::ticks2_dur (int ticks_i)
 {
-  //           Duration dur (4, 0);
-  //           dur.set_plet (ticks_i, Duration::division_1_i_s / 4); 
-
   Moment mom (ticks_i, Duration::division_1_i_s);
   if (midi_as_plet_b_s)
     return mom2_dur (mom);
 
   Duration dur = mom2standardised_dur (mom);
 
-  //   if (dur.mom () == mom)
   if (dur.length () == mom)
     return dur;
                
-// huh?
-#if 0
-  dur.durlog_i_ = -100;
-  dur.dots_i_ = 0;
-  dur.set_ticks (ticks_i);
-  return dur;
-#else
   return mom2_dur (mom);
-#endif
 }
 
 Duration
@@ -238,7 +204,6 @@ Duration_iterator::Duration_iterator ()
   cursor_dur_.durlog_i_ = 7;
   if (Duration_convert::no_smaller_than_i_s)
     cursor_dur_.durlog_i_ = Duration_convert::no_smaller_than_i_s;
-  //   cursor_dur_.set_plet (1, 1);
 }
 
 Duration 
index e3926f030cc5e0d8a0bc228e1d42f0b85e58ef96..747363832308284d3ec2f7fc5907f4acde17774d 100644 (file)
@@ -41,12 +41,6 @@ struct Duration_convert {
     static int no_smaller_than_i_s;
     static Array<Duration> dur_array_s;
 
-//     /// Most used division in MIDI, all fine with me.
-//     static int const division_1_c_i = 384;
-
-//     /// Return (integer, division) representation.
-//     static int dur2_i (Duration dur, int division_1_i = division_1_c_i );
-
     /// Return number of ticks in (ticks, division_1) representation
     static int dur2ticks_i (Duration dur );
        
@@ -63,12 +57,6 @@ struct Duration_convert {
     /// Return Mudela string representation.
     static String dur2_str (Duration dur );
 
-//     /// Return Moment from (integer, division) representation.
-//     static Moment i2_mom (int i, int division_1_i = division_1_c_i );
-
-//     /// Return Moment (fraction of whole) representation, best guess.
-//     static Duration mom2_dur (Moment mom );
-
     /// Return duration from Moment (fraction of whole) representation.
     static Duration mom2_dur (Moment mom );
 
index 642701e8d5cf58e8783051a63c0fbbf95b06ecac..69eaf8dcaf769e867573a5e4b215cbdc19111c67 100644 (file)
@@ -25,9 +25,6 @@ extern bool no_triplets_bo_g;
   (dur)
   */
 struct Duration {
-  /**
-    Ctor of Duration. 
-    */
   Duration ();
   /// is the "plet factor" of this note != 1 ?
   bool plet_b ();
index 313e21af3d5284050b45b73f066577506b187eb3..492553ec8bfb95fad741dff90617e92d7ce1a0cb 100644 (file)
@@ -35,7 +35,7 @@ public:
     void process();
 
 private:
-    void do_start_note (Midi_note* note_l);
+    void do_start_note (Midi_note* note_p);
     void do_stop_notes (Moment now_mom);
     void output_event (Moment now_mom, Midi_item* l);
 
index 0d8058634203a58d4b5e8d1df4b9689b32392348..063b3c1b058df6092e11c246e876a4482477c5b2 100644 (file)
@@ -20,15 +20,17 @@ public:
   TRANSLATOR_CLONE(Staff_performer);
   DECLARE_MY_RUNTIME_TYPEINFO;
 
-  Staff_performer();
-  ~Staff_performer();
+  Staff_performer ();
+  ~Staff_performer ();
 
-  String instrument_str();
+  String new_instrument_str ();
+  String instrument_str_;
 
 protected:
   virtual void play (Audio_element* p);
-  virtual void do_removal_processing();
-  virtual void do_creation_processing();
+  virtual void do_removal_processing ();
+  virtual void do_creation_processing ();
+  virtual void do_process_requests ();
 
 private:
   Audio_staff* audio_staff_p_;
index ffc1e37d9f99011cfeea1e58bb651cf3a29d4fd7..1720722284c0c0edcaff7f258d853ca72b5d3ab1 100644 (file)
 /** A symbol which sits along a staff.
 
   */
-class Staff_side : virtual Score_elem {
-  Link_array<Score_elem> support_l_arr_;
-
-  Interval support_height() const;
-  Real get_position_f() const;
-
+class Staff_side : virtual Score_elem
+{
 public:
 
   /**
@@ -38,14 +34,19 @@ public:
 
 
   void set_staffsym (Staff_symbol * );
-  
-  Staff_side();
+  Staff_side ();
   void add_support (Score_elem*);
   DECLARE_MY_RUNTIME_TYPEINFO;
     
 protected:
-  virtual Interval symbol_height() const;
+  virtual Interval symbol_height () const;
+  virtual Real get_position_f () const;
   virtual void do_substitute_dependency (Score_elem *, Score_elem*);
-  virtual void do_post_processing();
+  virtual void do_post_processing ();
+  Interval support_height () const;
+
+private:
+  Link_array<Score_elem> support_l_arr_;
+//  Interval support_height () const;
 };
 #endif // STAFF_SIDE_HH
index 185ea715c799928ffe233bfa14235b760cf56234..6624959140b8e9f5dce4a7fda8bdb81707225f42 100644 (file)
 #include "lily-proto.hh"
 #include "input.hh"
 
-class Text_def : public General_script_def {
-protected:
-//     huh? move to public
-//    virtual Atom get_atom (Paper_def* p, Direction dir_) const;
+class Text_def : public General_script_def 
+{
+public:
     DECLARE_MY_RUNTIME_TYPEINFO;
     VIRTUAL_COPY_CONS(Text_def,General_script_def);
-public:
+
     /**
       centered , or aligned?
 
index ba7ae59db60e656b8ffab3f0761268909f19bb91..4102ba5e88207d2e41fafe341c556ac94a971812 100644 (file)
@@ -14,9 +14,9 @@
 /**
   print a fixed width text above or below the staff.
  */
-class Text_item : public Item ,public Staff_side{
-    void init (Text_def* tdef_l); 
+class Text_item : public Item ,public Staff_side
+{
+public:
 public:
 
     /// do I have width?
@@ -24,17 +24,22 @@ public:
     
     /* ***************/
 
-    Text_item (General_script_def*,Direction dir=0);
-    virtual ~Text_item();
+    Text_item (General_script_def* ,Direction dir=0);
+    virtual ~Text_item ();
     DECLARE_MY_RUNTIME_TYPEINFO;
 
 protected:
-    General_script_def * tdef_p_;
+    // ugh: so, are we a text-def, or can this vary?
+    General_script_def* tdef_p_;
+
+    virtual Interval symbol_height () const;
 
-    virtual Interval symbol_height() const;
+    virtual Molecule* brew_molecule_p () const;
+    virtual void do_pre_processing ();
+    virtual Real get_position_f () const;
 
-    virtual Molecule* brew_molecule_p() const;
-    virtual void do_pre_processing();
+private:
+//    void init (Text_def* tdef_l); 
 };
 
 
index 34833fb24b877381d1b89ed18bbd33c5cea0962c..efc244c5de69538a56b997c85f5be076d2ce8112 100644 (file)
@@ -19,46 +19,51 @@ Midi_stream::Midi_stream (String filename_str)
 {
   filename_str_ = filename_str;
   os_p_ = 0;
-  open();
+  open ();
 }
 
-Midi_stream::~Midi_stream()
+Midi_stream::~Midi_stream ()
 {
   *os_p_ << flush;             // ugh. Share with tex_stream.
   if (!*os_p_)
     {
-      warning(_("error syncing file (disk full?)"));
+      warning (_ ("error syncing file (disk full?)"));
       exit_status_i_ = 1;
     }
   delete os_p_;
 }
 
 Midi_stream&
-Midi_stream::operator <<(String str)
+Midi_stream::operator << (String str)
 {
-  if (check_debug && !monitor->silent_b("Midistrings"))
-    str = String_convert::bin2hex_str (str);
-
   *os_p_ << str;
-
-  if (check_debug && !monitor->silent_b ("Midistrings"))
-    *os_p_ << "\n";
-
   return *this;
 }
 
 Midi_stream&
-Midi_stream::operator <<(Midi_item const& mitem_c_r)
+Midi_stream::operator << (Midi_item const& mitem_c_r)
 {
-  //    *this << mitem_c_r.str();
-  mitem_c_r.output (this);
-  if (check_debug && !monitor->silent_b("Midistrings"))
-    *os_p_ << "\n";
+//    *this <<mitem_c_r.str (); 
+  String str = mitem_c_r.str ();
+  if (check_debug && !monitor->silent_b ("Midistrings")) 
+    {
+    str = String_convert::bin2hex_str (str) + "\n";
+    // ugh, should have separate debugging output with Midi*::print routines
+    int i = str.index_i ("0a");
+    while (i >= 0)
+      {
+        str[i] = '\n';
+        str[i + 1] = '\t';
+       i = str.index_i ("0a");
+      }
+    }
+
+  *os_p_ << str;
   return *this;
 }
 
 Midi_stream&
-Midi_stream::operator <<(int i)
+Midi_stream::operator << (int i)
 {
   // output binary string ourselves
   *this << Midi_item::i2varint_str (i);
@@ -66,9 +71,9 @@ Midi_stream::operator <<(int i)
 }
 
 void
-Midi_stream::open()
+Midi_stream::open ()
 {
   os_p_ = new ofstream (filename_str_.ch_C ());
   if (!*os_p_)
-    error (_("can't open `") + filename_str_ + "\'");
+    error (_ ("can't open `") + filename_str_ + "\'");
 }
index 36c8000024989bc44f85b75a7febbef3cae4e4d2..38fbad9953ee8ae359ce5aefce614688e0e0ccb9 100644 (file)
@@ -43,12 +43,12 @@ Midi_walker::~Midi_walker()
   Find out if start_note event is needed, and do it if needed.
  */
 void 
-Midi_walker::do_start_note (Midi_note* note_l)
+Midi_walker::do_start_note (Midi_note* note_p)
 {
-  Moment stop_mom = note_l->duration() + ptr ()->audio_column_l_->at_mom ();
+  Moment stop_mom = note_p->duration() + ptr ()->audio_column_l_->at_mom ();
   for (int i=0; i < stop_note_queue.size(); i++) 
     {
-       if (stop_note_queue[ i ].val->pitch_i() == note_l->pitch_i ()) 
+       if (stop_note_queue[ i ].val->pitch_i() == note_p->pitch_i ()) 
          {
            if (stop_note_queue[ i ].key < stop_mom)
                stop_note_queue[ i ].ignore_b_ = true;
@@ -58,11 +58,11 @@ Midi_walker::do_start_note (Midi_note* note_l)
     }
 
   Midi_note_event e;
-  e.val = new Midi_note_off (note_l);
+  e.val = new Midi_note_off (note_p);
   e.key = stop_mom;
   stop_note_queue.insert (e);
   
-  output_event (ptr()->audio_column_l_->at_mom (), note_l);
+  output_event (ptr()->audio_column_l_->at_mom (), note_p);
 }
 
 /**
@@ -78,9 +78,9 @@ Midi_walker::do_stop_notes (Moment max_mom)
            continue;
        
        Moment stop_mom = e.key;
-       Midi_note_off* note_l = e.val;
+       Midi_note_off* note_p = e.val;
        
-       output_event (stop_mom, note_l);
+       output_event (stop_mom, note_p);
     }
 }
 
@@ -109,7 +109,5 @@ Midi_walker::process()
        output_event (ptr()->audio_column_l_->at_mom (), p);
   else
        do_start_note ((Midi_note*)p);
-       
-  delete p;
 }
 
index 94fd515d3911dba6a14e74ec7d17d5d17430ec5b..2b030e6c71bc555cc0741cb7983883df846c786b 100644 (file)
@@ -249,7 +249,6 @@ void
 Spring_spacer::make_constraints (Mixed_qp& lp) const
 {
   int dim=cols.size();
-  Real nw_f = paper_l ()->note_width ();
   for (int j=0; j < dim; j++)
     {
       Colinfo c=cols[j];
@@ -635,6 +634,9 @@ Spring_spacer::calc_idealspacing()
              dist = dist >? minimum;
            }
 
+          // ugh: never let columns touch... try to set over here...
+         // ugh: use j iso i triggers ice in gcc-2.7.2.3 
+          cols[i].width_[LEFT] -= nw_f / 4;
          ideal_arr_[i] = dist;
        }
     }
index 6c813df4ae441ae424205b815eca5856f4a4118a..7270d20282ff281d678d7530ac64663c8dbf82fe 100644 (file)
 #include "audio-item.hh"
 #include "audio-staff.hh"
 
-IMPLEMENT_IS_TYPE_B1(Staff_performer,Performer_group_performer);
-ADD_THIS_TRANSLATOR(Staff_performer);
+IMPLEMENT_IS_TYPE_B1 (Staff_performer,Performer_group_performer);
+ADD_THIS_TRANSLATOR (Staff_performer);
 
-Staff_performer::Staff_performer()
+Staff_performer::Staff_performer ()
 {
   audio_staff_p_ = 0;
 }
 
-Staff_performer::~Staff_performer()
+Staff_performer::~Staff_performer ()
 {
   delete audio_staff_p_;
 }
 
 void
-Staff_performer::do_creation_processing()
+Staff_performer::do_creation_processing ()
 {
   audio_staff_p_ = new Audio_staff;
 
-  if (instrument_str().length_i()) 
-    {
-      // staff name
-      play (new Audio_text (Audio_text::TRACK_NAME, id_str_));
-      // instrument description
-      play (new Audio_text (Audio_text::INSTRUMENT_NAME, instrument_str ()));
-    }
+  play (new Audio_text (Audio_text::TRACK_NAME, id_str_));
+
+#if 1
+  String str = new_instrument_str ();
+  if (str.length_i ()) 
+    // instrument description
+    play (new Audio_text (Audio_text::INSTRUMENT_NAME, str));
+#endif
 
   // tempo
   play (new Audio_tempo (get_tempo_i ()));
 
-  if (instrument_str ().length_i ())
+#if 1
+  if (str.length_i ())
     // instrument
-    play (new Audio_instrument (instrument_str ()));
+    play (new Audio_instrument (str));
+#endif
+   
   Performer_group_performer::do_creation_processing ();
 }
 
 void
-Staff_performer::do_removal_processing()
+Staff_performer::do_process_requests ()
+{
+  String str = new_instrument_str ();
+  if (str.length_i ())
+    {
+      play (new Audio_text (Audio_text::INSTRUMENT_NAME, str));
+      play (new Audio_instrument (str));
+    }
+  Performer_group_performer::do_process_requests ();
+}
+
+
+void
+Staff_performer::do_removal_processing ()
 {
   Performer_group_performer::do_removal_processing ();
   Performer::play (audio_staff_p_);
@@ -57,10 +74,16 @@ Staff_performer::do_removal_processing()
 }
 
 String 
-Staff_performer::instrument_str() 
+Staff_performer::new_instrument_str () 
 { 
   // mustn't ask Score for instrument: it will return piano!
-  return get_property ("instrument");
+  String str = get_property ("instrument");
+  if (str == instrument_str_)
+    return "";
+
+  instrument_str_ = str;
+
+  return instrument_str_;
 
 /* ugh, but can't
   if (properties_dict_.elt_b ("instrument"))
@@ -72,9 +95,9 @@ Staff_performer::instrument_str()
 void 
 Staff_performer::play (Audio_element* p)
 {
-  if (p->is_type_b (Audio_item::static_name())) 
+  if (p->is_type_b (Audio_item::static_name ())) 
     {
-      audio_staff_p_->add ((Audio_item*)p);
+      audio_staff_p_->add ( (Audio_item*)p);
     }
   Performer::play (p);
 }
index 06690a0334b272ca4374cba4745da024ab58b628..0a741a104a68af7cf0a8e1309e25542f5f4309d8 100644 (file)
@@ -54,11 +54,11 @@ Staff_side::add_support (Score_elem*i)
 }
 
 Real
-Staff_side::get_position_f() const
+Staff_side::get_position_f () const
 {
   if (!dir_)
     {
-      warning (_("Staff_side::get_position_i(): "
+      warning (_("Staff_side::get_position_f(): "
                 "somebody forgot to set my vertical direction, returning -20"));
       return -20;
     }
@@ -68,8 +68,7 @@ Staff_side::get_position_f() const
   Real inter_f = paper()-> internote_f ();
 
   Interval v= support_height();
-//  y = v[dir_]  + 2*dir_*inter_f;     // ugh
-  y = v[dir_]; // ugh
+  y = v[dir_] + 2 * dir_ * inter_f;    // ugh
 
   return y;
 }
index 301e86f3f754fd79219355de053abf18439406d3..4ce5596d28d166cbe0be551f2e6713c1ef3b7cf6 100644 (file)
 #include "audio-column.hh"
 #include "audio-item.hh"
 #include "audio-staff.hh"
+#include "midi-item.hh"
 #include "pcursor.tcc"
 #include "plist.tcc"
 
 
 template POINTERLIST_INSTANTIATE(Audio_element);
 template POINTERLIST_INSTANTIATE(Audio_column);
-
+template POINTERLIST_INSTANTIATE(Midi_event);
index 16a45977f17d9bcf043e97c4fa2a6c3349ea3e77..952e917052ac4fac493f9d55eedfcf7e9d51f93d 100644 (file)
 #include "stem.hh"
 #include "molecule.hh"
 #include "lookup.hh"
+#include "debug.hh"
 
-Text_item::Text_item (General_script_def*tdef_l, Direction d) 
+Text_item::Text_item (General_script_def* tdef_l, Direction d) 
 {
   dir_ = d;
   fat_b_ = false;
-  tdef_p_ = tdef_l->clone();
+  tdef_p_ = tdef_l->clone ();
 }
 
-Text_item::~Text_item()
+Text_item::~Text_item ()
 {
   delete tdef_p_;
 }
 
 void
-Text_item::do_pre_processing()
+Text_item::do_pre_processing ()
 {
   if (!dir_)
     dir_ = DOWN;
 }
 
+Real
+Text_item::get_position_f () const
+{
+  // uhuh, tdef/gdef?
+  if ( (tdef_p_->name () != Text_def::static_name ()) 
+    || ( ( (Text_def*)tdef_p_)->style_str_ != "finger"))
+    return Staff_side::get_position_f ();
+
+  if (!dir_)
+    {
+      warning (_ ("Text_item::get_position_f(): "
+                "somebody forgot to set my vertical direction, returning -20"));
+      return -20;
+    }
+
+  Interval v = support_height ();
+  // add no extra: fingers should be just above note, no?
+  return v[dir_];
+}
+
 Interval
-Text_item::symbol_height() const
+Text_item::symbol_height () const
 {
-  return tdef_p_->get_atom (paper(), dir_).dim_.y ();
+  return tdef_p_->get_atom (paper (), dir_).dim_.y ();
 }
   
 Molecule*
-Text_item::brew_molecule_p() const
+Text_item::brew_molecule_p () const
 {
-  Atom a (tdef_p_->get_atom (paper(), dir_));
+  Atom a (tdef_p_->get_atom (paper (), dir_));
 
   /*
     if (fat_b_)
-    a.sym.dim.x = tdef_p_->width (paper());
+    a.sym.dim.x = tdef_p_->width (paper ());
     */
   Molecule* mol_p = new Molecule (a);
 
   if (dir_<0)          // should do something better anyway.
-    mol_p->translate_axis (-mol_p->extent().y ().left , Y_AXIS);
+    mol_p->translate_axis (-mol_p->extent ().y ().left , Y_AXIS);
   mol_p->translate_axis (y_, Y_AXIS);
   
   return mol_p;
 }
 
 
-IMPLEMENT_IS_TYPE_B1(Text_item,Item);
+IMPLEMENT_IS_TYPE_B1 (Text_item,Item);
index e50751350ac7be8bc9e0b69ba31db9a30d8dac15..32f0609dcc8218c5eae52d104393103d5d0acb20 100644 (file)
@@ -1,11 +1,10 @@
 \header{
-filename =      "standchen.ly";
-title =         "St\"andchen (Serenade) \"Leise flehen meine Lieder\"";
-opus =  "D. 957 No. 4";
-composer =      "Franz Schubert (1797-1828)"
-        "Text by Ludwig Rellstab (1799-1860)";
-enteredby =     "JCN";
-copyright =     "public domain";
+filename = "standchen.ly";
+title    = "St\"andchen (Serenade)\\\``Leise flehen meine Lieder''";
+opus     = "D. 957 No. 4";
+composer = "Franz Schubert (1797-1828)\\\ \hfill Text by Ludwig Rellstab (1799-1860)";
+enteredby = "JCN";
+copyright = "public domain";
 } 
 
 %{