4 // source file of the GNU LilyPond music typesetter
6 // (c) 1997--1998 Jan Nieuwenhuizen <jan@digicash.com>
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& mitem_c_r)
45 // *this <<mitem_c_r.str ();
46 String str = mitem_c_r.str ();
47 if (check_debug && !monitor->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 ());
77 error (_ ("can't open `") + filename_str_ + "\'");