]> git.donarmstrong.com Git - lilypond.git/blob - lily/score-performer.cc
patch::: 0.0.74pre.jcn1: pats
[lilypond.git] / lily / score-performer.cc
1 /*
2   score-performer.cc -- implement Score_performer
3
4   (c) 1996, 1997 Han-Wen Nienhuys <hanwen@stack.nl>
5                  Jan Nieuwenhuizen <jan@digicash.com>
6  */
7
8 #include "score-performer.hh"
9 #include "input-translator.hh"
10 #include "midi-item.hh"
11 #include "midi-stream.hh"
12 #include "string-convert.hh"
13 #include "debug.hh"
14
15 IMPLEMENT_IS_TYPE_B1(Score_performer,Performer_group_performer);
16 IMPLEMENT_STATIC_NAME(Score_performer);
17 ADD_THIS_PERFORMER(Score_performer);
18
19 Score_performer::Score_performer()
20 {
21     // not so much ugh, as [todo]
22     *mlog << "MIDI output to " << "lelie.midi" << " ...\n";    
23     midi_stream_p_ = new Midi_stream( "lelie.midi", 
24         // don-t forget: extra track 0 for tempo/copyright stuff...
25         //score_l_->staffs_.size() + 1, 
26         1, 
27         384 );
28 }
29
30 Score_performer::~Score_performer()
31 {
32     delete midi_stream_p_;
33 }
34
35 Translator* 
36 Score_performer::ancestor_l( int l ) 
37
38     return Global_translator::ancestor_l( l );
39 }
40
41 int 
42 Score_performer::depth_i() const 
43
44     return Global_translator::depth_i();
45 }
46
47 void 
48 Score_performer::play_event( Midi_item* l )
49 {
50 //    file_p_->output( l );
51 //    cerr << String_convert::bin2hex_str( l->str() );
52     // this should be done at staff level, 
53     // cached per staff probably.
54     // but it generates output...
55     *midi_stream_p_ << *l;
56 }
57
58 void 
59 Score_performer::prepare( Moment m )
60 {
61     now_mom_ = m;
62 }
63
64 void 
65 Score_performer::process()
66 {
67     process_requests();
68     prev_mom_ = now_mom_;
69 }
70