2 This file is part of LilyPond, the GNU music typesetter.
4 Copyright (C) 1997--2011 Jan Nieuwenhuizen <janneke@gnu.org>
6 LilyPond is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
11 LilyPond is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
20 #include "performance.hh"
25 #include "audio-column.hh"
26 #include "audio-staff.hh"
27 #include "file-name.hh"
28 #include "international.hh"
29 #include "lily-version.hh"
31 #include "midi-chunk.hh"
32 #include "midi-stream.hh"
34 #include "string-convert.hh"
37 Performance::Performance (bool ports
)
43 Performance::~Performance ()
45 junk_pointers (audio_elements_
);
49 Performance::output (Midi_stream
&midi_stream
) const
51 int tracks_
= audio_staffs_
.size ();
53 midi_stream
.write (Midi_header (1, tracks_
, 384));
54 if (be_verbose_global
)
55 progress_indication (_ ("Track...") + " ");
57 for (vsize i
= 0; i
< audio_staffs_
.size (); i
++)
59 Audio_staff
*s
= audio_staffs_
[i
];
60 if (be_verbose_global
)
61 progress_indication ("[" + to_string (i
));
62 s
->output (midi_stream
, i
, ports_
);
63 if (be_verbose_global
)
64 progress_indication ("]");
69 Performance::add_element (Audio_element
*p
)
71 audio_elements_
.push_back (p
);
75 Performance::write_output (string out
) const
80 /* Maybe a bit crude, but we had this before */
81 File_name
file_name (out
);
82 out
= file_name
.to_string ();
84 Midi_stream
midi_stream (out
);
85 message (_f ("MIDI output to `%s'...", out
));
88 progress_indication ("\n");
93 Performance::process ()
98 unsmob_performance (SCM x
)
100 return dynamic_cast<Performance
*> (unsmob_music_output (x
));