]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/note-performer.cc
release: 0.1.7
[lilypond.git] / lily / note-performer.cc
index 95adb43ae6c22956a3b76d7fef78c2df06f4231d..5471110e900fc0585a5ee7ced49ca30785a26eda 100644 (file)
@@ -1,17 +1,57 @@
 /*
   note-performer.cc -- implement Note_performer
 
-  (c) 1996, 1997 Han-Wen Nienhuys <hanwen@stack.nl>
-                 Jan Nieuwenhuizen <jan@digicash.com>
+  source file of the GNU LilyPond music typesetter
+
+  (c) 1996, 1997 Jan Nieuwenhuizen <jan@digicash.com>
  */
 
-#if 0
 #include "note-performer.hh"
+#include "translator.hh"
+#include "input-translator.hh"
+#include "musical-request.hh"
+#include "audio-item.hh"
+#include "debug.hh"
 
-void 
-process_request() 
+IMPLEMENT_IS_TYPE_B1(Note_performer,Performer);
+
+ADD_THIS_PERFORMER(Note_performer);
+
+Note_performer::Note_performer()
 {
-    if ( when() == off_mom_ )
-       play_event( Note_event( current_l_->pitch() ) );
+    note_req_l_ = 0;
 }
+
+void 
+Note_performer::do_print() const
+{
+#ifndef NPRINT
+    if ( note_req_l_ ) {
+       note_req_l_->print();
+    }
 #endif
+}
+
+void 
+Note_performer::process_requests() 
+{
+    // this is _really_ braindead, but it generates some output
+    if ( !note_req_l_ || !note_req_l_->melodic()  || !note_req_l_->rhythmic() )
+       return;
+
+    play( new Audio_note( note_req_l_ ) );
+    note_req_l_ = 0;
+}
+
+bool 
+Note_performer::do_try_request( Request* req_l )
+{
+    if ( note_req_l_ )
+       return false;
+    
+    if ( !req_l->musical() || !req_l->musical()->note() )
+       return false;
+
+    note_req_l_ = req_l->musical()->melodic();
+    return true;
+}