* fixed some valgrind issues (uninitialized instance vars)
* Added preliminary support for program changes flags from automation lists git-svn-id: svn://localhost/ardour2/branches/3.0@3327 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
@@ -74,7 +74,8 @@ AudioClock::AudioClock (std::string clock_name, bool transient, std::string widg
|
||||
colon4 (":"),
|
||||
colon5 (":"),
|
||||
b1 ("|"),
|
||||
b2 ("|")
|
||||
b2 ("|"),
|
||||
last_when(0)
|
||||
{
|
||||
session = 0;
|
||||
last_when = 0;
|
||||
|
||||
@@ -460,7 +460,7 @@ MidiRegionView::redisplay_model()
|
||||
|
||||
_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) {
|
||||
@@ -471,13 +471,29 @@ MidiRegionView::redisplay_model()
|
||||
//<< " 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();
|
||||
|
||||
|
||||
@@ -39,7 +39,9 @@ namespace ARDOUR {
|
||||
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;
|
||||
@@ -197,6 +199,7 @@ public:
|
||||
|
||||
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;
|
||||
@@ -204,7 +207,6 @@ private:
|
||||
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;
|
||||
|
||||
@@ -121,10 +121,11 @@ MidiModel::const_iterator::const_iterator(const MidiModel& model, double t)
|
||||
++_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;
|
||||
@@ -165,7 +166,7 @@ const MidiModel::const_iterator& MidiModel::const_iterator::operator++()
|
||||
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;
|
||||
|
||||
@@ -68,6 +68,7 @@ Region::Region (Session& s, nframes_t start, nframes_t length, const string& nam
|
||||
, _layer(layer)
|
||||
, _first_edit(EditChangesNothing)
|
||||
, _frozen(0)
|
||||
, _stretch(1.0)
|
||||
, _read_data_count(0)
|
||||
, _pending_changed(Change (0))
|
||||
, _last_layer_op(0)
|
||||
@@ -97,6 +98,7 @@ Region::Region (boost::shared_ptr<Source> src, nframes_t start, nframes_t length
|
||||
, _read_data_count(0)
|
||||
, _pending_changed(Change (0))
|
||||
, _last_layer_op(0)
|
||||
|
||||
{
|
||||
_sources.push_back (src);
|
||||
_master_sources.push_back (src);
|
||||
@@ -121,6 +123,7 @@ Region::Region (const SourceList& srcs, nframes_t start, nframes_t length, const
|
||||
, _layer(layer)
|
||||
, _first_edit(EditChangesNothing)
|
||||
, _frozen(0)
|
||||
, _stretch(1.0)
|
||||
, _read_data_count(0)
|
||||
, _pending_changed(Change (0))
|
||||
, _last_layer_op(0)
|
||||
@@ -254,6 +257,7 @@ Region::Region (const SourceList& srcs, const XMLNode& node)
|
||||
, _layer(0)
|
||||
, _first_edit(EditChangesNothing)
|
||||
, _frozen(0)
|
||||
, _stretch(1.0)
|
||||
, _read_data_count(0)
|
||||
, _pending_changed(Change(0))
|
||||
, _last_layer_op(0)
|
||||
@@ -294,6 +298,7 @@ Region::Region (boost::shared_ptr<Source> src, const XMLNode& node)
|
||||
, _layer(0)
|
||||
, _first_edit(EditChangesNothing)
|
||||
, _frozen(0)
|
||||
, _stretch(1.0)
|
||||
, _read_data_count(0)
|
||||
, _pending_changed(Change(0))
|
||||
, _last_layer_op(0)
|
||||
|
||||
@@ -195,7 +195,7 @@ SMFSource::seek_to_footer_position()
|
||||
// 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 &&
|
||||
|
||||
Reference in New Issue
Block a user