-Sequential_music_iterator::get_music (Moment until)const
-{
- SCM s = SCM_EOL;
- if (until < pending_moment ())
- return s;
-
- SCM curs = cursor_;
- Music_iterator * iter = iter_p_->clone ();
- while (1)
- {
- SCM nm = iter->get_music (until - here_mom_);
- s = gh_append2 (nm, s);
-
- Moment m = 0;
- for (SCM i = nm; gh_pair_p(i); i = gh_cdr (i))
- m = m >? unsmob_music (gh_car (i))->length_mom ();
-
- delete iter;
-
- curs = gh_cdr (curs);
-
- if (!gh_pair_p (curs) || m > Moment (0))
- return s;
- else
- {
- iter = get_iterator_p (unsmob_music (gh_car (curs)));
- }
- }
- return s;
-}
-/*
- Skip events till UNTIL. We don't do any other side effects (such as
- moving descending to child iterator contexts, because they might
- depend on \context specs and \translator changes being executed
-
- */
-void
-Sequential_music_iterator::skip (Moment until)
-{
- while (1)
- {
- Moment l =iter_p_->music_length_mom ();
- if (l >= until - here_mom_)
- iter_p_->skip (until - here_mom_);
-
- if (iter_p_->ok ())
- return ;
-
- here_mom_ = here_mom_ + l;
- delete iter_p_;
- iter_p_ =0;
-
- cursor_ = gh_cdr (cursor_);
-
- if (!gh_pair_p (cursor_))
- return ;
- else
- iter_p_ = get_iterator_p (unsmob_music (gh_car (cursor_)));
- }
-}
-
-void
-Sequential_music_iterator::process (Moment until)
-{
- while (1)
- {
- iter_p_->process (until - here_mom_);
-
- /*
- if the iter is still OK, there must be events left that have
-
- TIME > LEFT
-
- */
- if (iter_p_->ok ())
- return ;
-
- here_mom_ += iter_p_->music_length_mom ();
-
- descend_to_child ();
- delete iter_p_;
- iter_p_ =0;
-
- cursor_ = gh_cdr (cursor_);
-
- if (!gh_pair_p (cursor_))
- return ;
- else
- {
- delete iter_p_;
- iter_p_ = get_iterator_p (unsmob_music (gh_car (cursor_)));
- }
- }
-
-}
-
-Moment
-Sequential_music_iterator::pending_moment() const