colon4 (":"),
colon5 (":"),
b1 ("|"),
- b2 ("|")
+ b2 ("|"),
+ last_when(0)
{
session = 0;
last_when = 0;
_model->read_lock();
- /*
+
MidiModel::Notes notes = _model->notes();
cerr << endl << "Model contains " << notes.size() << " Notes:" << endl;
for(MidiModel::Notes::iterator i = notes.begin(); i != notes.end(); ++i) {
//<< " Note-on: " << note.on_event().
//<< " Note-off: " << note.off_event()
<< endl;
- }*/
+ }
for (size_t i=0; i < _model->n_notes(); ++i) {
add_note(_model->note_at(i));
}
- // TODO: Add program changes here
+ for (Automatable::Controls::iterator
+ control = _model->controls().begin();
+ control != _model->controls().end(); ++control) {
+
+ if( control->first.type() == MidiPgmChangeAutomation ) {
+ Glib::Mutex::Lock list_lock (control->second->list()->lock());
+
+ for(AutomationList::const_iterator event = control->second->list()->begin();
+ event != control->second->list()->end(); ++event) {
+ boost::shared_ptr<MIDI::Event> midi_event(new MIDI::Event());
+ MidiControlIterator iter(control->second->list(), (*event)->when, (*event)->value);
+ _model->control_to_midi_event(*midi_event, iter);
+ add_pgm_change(midi_event);
+ }
+ break;
+ }
+ }
end_write();
class Session;
class MidiSource;
-
+/**
+ * This class keeps track of the current x and y for a control
+ */
class MidiControlIterator {
public:
boost::shared_ptr<const AutomationList> automation_list;
const MidiSource* midi_source() const { return _midi_source; }
void set_midi_source(MidiSource* source) { _midi_source = source; }
+ bool control_to_midi_event(MIDI::Event& ev, const MidiControlIterator& iter) const;
private:
friend class DeltaCommand;
void remove_note_unlocked(const boost::shared_ptr<const Note> note);
friend class const_iterator;
- bool control_to_midi_event(MIDI::Event& ev, const MidiControlIterator& iter) const;
#ifndef NDEBUG
bool is_sorted() const;
++_note_iter;
}
- if (earliest_control.automation_list.get() && earliest_control.x < _event.time())
+ if (earliest_control.automation_list.get() && earliest_control.x < _event.time()) {
model.control_to_midi_event(_event, earliest_control);
- else
+ } else {
_control_iter = _control_iters.end();
+ }
if (_event.size() == 0) {
//cerr << "Created MIDI iterator @ " << t << " is at end." << endl;
double x = 0.0, y = 0.0;
const bool ret = _control_iter->automation_list->rt_safe_earliest_event_unlocked(
_control_iter->x, DBL_MAX, x, y, false);
- cerr << "control_iter x:" << _control_iter->x << " y:" << _control_iter->y << endl;
+ //cerr << "control_iter x:" << _control_iter->x << " y:" << _control_iter->y << endl;
if (ret) {
cerr << "Incremented " << _control_iter->automation_list->parameter().id() << " to " << x << endl;
, _layer(layer)
, _first_edit(EditChangesNothing)
, _frozen(0)
+ , _stretch(1.0)
, _read_data_count(0)
, _pending_changed(Change (0))
, _last_layer_op(0)
, _read_data_count(0)
, _pending_changed(Change (0))
, _last_layer_op(0)
+
{
_sources.push_back (src);
_master_sources.push_back (src);
, _layer(layer)
, _first_edit(EditChangesNothing)
, _frozen(0)
+ , _stretch(1.0)
, _read_data_count(0)
, _pending_changed(Change (0))
, _last_layer_op(0)
, _layer(0)
, _first_edit(EditChangesNothing)
, _frozen(0)
+ , _stretch(1.0)
, _read_data_count(0)
, _pending_changed(Change(0))
, _last_layer_op(0)
, _layer(0)
, _first_edit(EditChangesNothing)
, _frozen(0)
+ , _stretch(1.0)
, _read_data_count(0)
, _pending_changed(Change(0))
, _last_layer_op(0)
// lets check if there is a track end marker at the end of the data
fseek(_fd, -4, SEEK_END);
size_t read_bytes = fread(buffer, sizeof(uint8_t), 4, _fd);
- cerr << "SMFSource::seek_to_footer_position: read size: " << read_bytes << endl;
+ //cerr << "SMFSource::seek_to_footer_position: read size: " << read_bytes << endl;
if( (read_bytes == 4) &&
buffer[0] == 0x00 &&
buffer[1] == 0xFF &&