]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-1.1.1
authorfred <fred>
Tue, 26 Mar 2002 21:28:37 +0000 (21:28 +0000)
committerfred <fred>
Tue, 26 Mar 2002 21:28:37 +0000 (21:28 +0000)
lily/axis-group-item.cc
lily/axis-group-spanner.cc
lily/include/lyric-performer.hh
lily/lyric-performer.cc
lily/midi-item.cc
lily/midi-walker.cc

index 273116d1ea1ef8d8de756902dfb8bca7d66ea537..6eabab3a58ffa44e65f0e3bf14fad0d0ee62831b 100644 (file)
@@ -40,7 +40,7 @@ Axis_group_item::do_breakable_col_processing()
        {
          Item *new_l = 
            it_l->find_prebroken_piece (broken_to_drul_[j]->break_status_dir_);
-         ((Axis_group_item*)broken_to_drul_[j])->add_element (new_l);
+         (dynamic_cast<Axis_group_item*> (broken_to_drul_[j]))->add_element (new_l);
        }
       while (flip(&j)!=LEFT);
     }
index 70c70c297f063bee6db0af7b60a6fd1e89900441..fdd2969b5e359964ec913c6dc76c6fda3b05d250 100644 (file)
@@ -65,39 +65,36 @@ Axis_group_spanner::do_break_processing()
          /* this piece doesn't know where it belongs.
             Find out if it was broken, and use the broken remains
             */
-         if (dynamic_cast <Spanner *> (elt)) 
+         Spanner * sp =dynamic_cast <Spanner *> (elt);
+         Item *it = dynamic_cast <Item *> (elt) ;        
+         if (sp)
            {
-             Spanner * sp = dynamic_cast <Spanner *> (elt);
-               
              for (int j =0; j < broken_into_l_arr_.size(); j++) 
                {
                  Axis_group_spanner * my_broken_l
-                   = (Axis_group_spanner*)broken_into_l_arr_[j];
+                   = dynamic_cast<Axis_group_spanner*>(broken_into_l_arr_[j]);
                    
                  Spanner * broken_span_l 
-                   = sp->find_broken_piece (
-                                            ((Score_element*)my_broken_l)->line_l());
+                   = sp->find_broken_piece (dynamic_cast<Score_element*>(my_broken_l)->line_l());
                    
                  if (broken_span_l) 
                    my_broken_l->add_element (broken_span_l);
                    
                }
            }
-         else if (dynamic_cast <Item *> (elt) 
-                  && dynamic_cast <Item *> (elt)->breakable_b_ 
-                  && dynamic_cast <Item *> (elt)->break_status_dir () == 0) 
+         else if (it && it->breakable_b_ && it->break_status_dir () == 0) 
            {
              // broken items
              Direction  j=LEFT;
              do 
                {
-                 Item * my_item = dynamic_cast <Item *> (elt)->broken_to_drul_[j];
+                 Item * my_item = it->broken_to_drul_[j];
                  Line_of_score * item_line_l = my_item->line_l() ;
                  if (! item_line_l) 
                    continue;
                    
                  Axis_group_spanner * v
-                   = (Axis_group_spanner*)find_broken_piece (item_line_l);
+                   = dynamic_cast<Axis_group_spanner*>(find_broken_piece (item_line_l));
                  if (v)
                    v->add_element (my_item);
                  else
@@ -118,7 +115,7 @@ Axis_group_spanner::do_break_processing()
             Put it in appropriate piece of this spanner
             */
          Axis_group_spanner * my_broken_l
-           = (Axis_group_spanner*)find_broken_piece (elt->line_l());
+           = dynamic_cast<Axis_group_spanner*> (find_broken_piece (elt->line_l()));
          my_broken_l->add_element (elt);
        }
     }
index 29a5f92390160778e235800a20f1dd40dde73cd0..df77b0f02878924915e46b214d9e526a9b3ec5ac 100644 (file)
 class Lyric_performer : public Performer {
 public:
   TRANSLATOR_CLONE(Lyric_performer);
-    DECLARE_MY_RUNTIME_TYPEINFO;
-    Lyric_performer();
-    ~Lyric_performer();
+  DECLARE_MY_RUNTIME_TYPEINFO;
 
 protected:
-    void do_print() const;
-    virtual bool do_try_request (Request* req_l);
-    virtual void do_process_requests();
+  void do_print() const;
+  virtual bool do_try_request (Request* req_l);
+  virtual void do_process_requests();
 
 private:
-    Array<Lyric_req*> lreq_arr_;
+  Array<Lyric_req*> lreq_arr_;
 };
 
 #endif // LYRIC_PERFOMER_HH
index 43fe0f26342269eff31fd571ec7f23eae27ddd07..e8c8892339c85784b87f93bec8c8cc77ca56676d 100644 (file)
 IMPLEMENT_IS_TYPE_B1(Lyric_performer,Performer);
 ADD_THIS_TRANSLATOR(Lyric_performer);
 
-Lyric_performer::Lyric_performer()
-{
-}
-
-Lyric_performer::~Lyric_performer()
-{
-}
-
 void 
 Lyric_performer::do_print() const
 {
 #ifndef NPRINT
   if (lreq_arr_.size())
-    lreq_arr_[ 0 ]->print();
+    lreq_arr_[0]->print();
 #endif
 }
 
@@ -37,18 +29,18 @@ void
 Lyric_performer::do_process_requests()
 {
   if (lreq_arr_.size() && lreq_arr_[0]->text_str_.length_i())
-    play (new Audio_text (Audio_text::LYRIC, lreq_arr_[ 0 ]->text_str_));
+    play (new Audio_text (Audio_text::LYRIC, lreq_arr_[0]->text_str_));
   lreq_arr_.clear();
 }
 
 bool
 Lyric_performer::do_try_request (Request* req_l)
 {
-  Musical_req* m_l = dynamic_cast <Musical_req *> (req_l);
-  if (!m_l || ! dynamic_cast <Lyric_req *> (m_l)) 
-    return false;
-  lreq_arr_.push (dynamic_cast <Lyric_req *> (m_l));
-
-  return true;
+  if (Lyric_req *lr = dynamic_cast <Lyric_req *> (req_l))
+    {
+      lreq_arr_.push (lr);
+      return true;
+    }
+  return false;
 }
 
index 362508ee647c51c1b034c3583d7cbe47692cdd26..7ae9551f7d91f21d39533425af072f3d32f6849e 100644 (file)
@@ -399,6 +399,7 @@ Midi_note::Midi_note (Audio_item* audio_item_l)
   : Midi_item (audio_item_l)
 {
   dynamic_byte_ = 0x7f;
+  assert (dynamic_cast<Audio_note*> (audio_item_l));
 }
 
 Moment
index 81489c2ad0cfc7fe8045bce9a107c7e18eb21206..90477a3009ac19e3702807b5e1ede691f4275d72 100644 (file)
@@ -48,10 +48,10 @@ Midi_walker::do_start_note (Midi_note* note_p)
   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_p->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;
+         if (stop_note_queue[i].key < stop_mom)
+           stop_note_queue[i].ignore_b_ = true;
          else {
            // skip the stopnote
            delete note_p;
@@ -111,9 +111,9 @@ Midi_walker::process()
     return;
   p->channel_i_ = track_l_->number_i_;
   
-  if (p->name() != Midi_note::static_name ())
-    output_event (ptr()->audio_column_l_->at_mom (), p);
+  if (Midi_item *mi = dynamic_cast<Midi_note*>(p))
+    do_start_note (mi);
   else
-    do_start_note ((Midi_note*)p);
+    output_event (ptr()->audio_column_l_->at_mom (), p);
 }