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_string_ = filename;
23 out_file_ = fopen (filename.to_str0(), "wb");
26 Midi_stream::~Midi_stream ()
32 Midi_stream::operator << (String str)
34 Byte * b = str.get_bytes ();
35 for (int sz = str.length (); sz--;)
37 fputc (*b, out_file_);
44 Midi_stream::operator << (Midi_item const& midi_c_r)
46 String str = midi_c_r.string ();
49 if (midi_debug_global_b)
51 str = String_convert::bin2hex (str) + "\n";
52 // ugh, should have separate debugging output with Midi*::print routines
53 int i = str.index ("0a");
63 Byte * b = str.get_bytes ();
64 for (int sz = str.length (); sz--;)
66 fputc (*b, out_file_);
75 Midi_stream::operator << (int i)
77 // output binary string ourselves
78 *this << Midi_item::i2varint_string (i);