4 // source file of the GNU LilyPond music typesetter
6 // (c) 1997--2000 Jan Nieuwenhuizen <janneke@gnu.org>
10 #include "string-convert.hh"
13 #include "midi-item.hh"
14 #include "midi-stream.hh"
17 Midi_stream::Midi_stream (String filename_str)
19 filename_str_ = filename_str;
24 Midi_stream::~Midi_stream ()
26 *os_p_ << flush; // ugh. Share with tex_stream.
29 warning (_ ("Error syncing file (disk full?)"));
36 Midi_stream::operator << (String str)
43 Midi_stream::operator << (Midi_item const& midi_c_r)
45 // *this <<midi_c_r.str ();
46 String str = midi_c_r.str ();
47 if (flower_dstream && !flower_dstream->silent_b ("Midistrings"))
49 str = String_convert::bin2hex_str (str) + "\n";
50 // ugh, should have separate debugging output with Midi*::print routines
51 int i = str.index_i ("0a");
56 i = str.index_i ("0a");
65 Midi_stream::operator << (int i)
67 // output binary string ourselves
68 *this << Midi_item::i2varint_str (i);
75 os_p_ = new ofstream (filename_str_.ch_C (),ios::out|ios::bin);
77 error (_f ("can't open file: `%s'", filename_str_));