2 midi-stream.cc -- implement Midi_stream
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--2002 Jan Nieuwenhuizen <janneke@gnu.org>
12 #include "string-convert.hh"
15 #include "midi-item.hh"
16 #include "midi-stream.hh"
18 #include "scm-option.hh"
20 Midi_stream::Midi_stream (String filename)
22 filename_str_ = filename;
24 os_p_ = open_file_stream (filename, ios::out|ios::bin);
26 os_p_ = open_file_stream (filename, ios::out|ios::binary);
30 Midi_stream::~Midi_stream ()
32 close_file_stream (os_p_);
36 Midi_stream::operator << (String str)
38 Byte * b = str.byte_l();
39 for (int sz = str.length_i (); sz--;)
45 Midi_stream::operator << (Midi_item const& midi_c_r)
47 String str = midi_c_r.str ();
50 if (midi_debug_global_b)
52 str = String_convert::bin2hex_str (str) + "\n";
53 // ugh, should have separate debugging output with Midi*::print routines
54 int i = str.index_i ("0a");
59 i = str.index_i ("0a");
63 Byte * b = str.byte_l();
64 for (int sz = str.length_i (); sz--;)
71 Midi_stream::operator << (int i)
73 // output binary string ourselves
74 *this << Midi_item::i2varint_str (i);