4 // source file of the GNU LilyPond music typesetter
6 // (c) 1997 Jan Nieuwenhuizen <jan@digicash.com>
11 #include "string-convert.hh"
14 #include "midi-item.hh"
15 #include "midi-stream.hh"
18 Midi_stream::Midi_stream (String filename_str)
20 filename_str_ = filename_str;
25 Midi_stream::~Midi_stream ()
27 *os_p_ << flush; // ugh. Share with tex_stream.
30 warning (_ ("error syncing file (disk full?)"));
37 Midi_stream::operator << (String str)
44 Midi_stream::operator << (Midi_item const& mitem_c_r)
46 // *this <<mitem_c_r.str ();
47 String str = mitem_c_r.str ();
48 if (check_debug && !monitor->silent_b ("Midistrings"))
50 str = String_convert::bin2hex_str (str) + "\n";
51 // ugh, should have separate debugging output with Midi*::print routines
52 int i = str.index_i ("0a");
57 i = str.index_i ("0a");
66 Midi_stream::operator << (int i)
68 // output binary string ourselves
69 *this << Midi_item::i2varint_str (i);
76 os_p_ = new ofstream (filename_str_.ch_C ());
78 error (_ ("can't open `") + filename_str_ + "\'");