]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/tie-performer.hh
08fe1b98f9dcd7862983ce9b6b1a640f25fc7a8d
[lilypond.git] / lily / include / tie-performer.hh
1 /*   
2   tie-performer.hh -- declare 
3   
4   source file of the GNU LilyPond music typesetter
5   
6   (c) 1999 Jan Nieuwenhuizen <janneke@gnu.org>
7   
8  */
9
10 #ifndef TIE_PERFORMER_HH
11 #define TIE_PERFORMER_HH
12
13 #include "pqueue.hh"
14 #include "performer.hh"
15
16 struct CNote_melodic_tuple {
17   Melodic_req *req_l_ ;
18   Audio_note *note_l_;
19   Moment end_;
20   CNote_melodic_tuple ();
21   CNote_melodic_tuple (Audio_note*, Melodic_req*, Moment);
22   static int pitch_compare (CNote_melodic_tuple const &, CNote_melodic_tuple const &);
23   static int time_compare (CNote_melodic_tuple const &, CNote_melodic_tuple const &);  
24 };
25
26 inline int compare (CNote_melodic_tuple const &a, CNote_melodic_tuple const &b)
27 {
28   return CNote_melodic_tuple::time_compare (a,b);
29 }
30
31
32 /**
33    Manufacture ties.  Acknowledge notes, and put them into a
34    priority queue. If we have a Tie_req, connect the notes that finish
35    just at this time, and note that start at this time.
36
37    TODO: should share code with Tie_engraver ?
38  */
39 class Tie_performer : public Performer
40 {
41 public:
42   VIRTUAL_COPY_CONS(Translator);
43   Tie_performer ();
44
45 private:
46   PQueue<CNote_melodic_tuple> past_notes_pq_;
47   Tie_req *req_l_;
48   Array<CNote_melodic_tuple> now_notes_;
49   Array<CNote_melodic_tuple> stopped_notes_;
50   Link_array<Audio_tie> tie_p_arr_;
51   
52 protected:
53   virtual void do_post_move_processing ();
54   virtual void do_pre_move_processing ();
55   virtual void acknowledge_element (Audio_element_info);
56   virtual bool do_try_music (Music*);
57   virtual void do_process_requests ();
58   virtual void process_acknowledged ();
59
60 };
61
62
63 #endif /* TIE_PERFORMER_HH */
64