diff options
author | Hans Baier <hansfbaier@googlemail.com> | 2008-05-08 09:53:19 +0000 |
---|---|---|
committer | Hans Baier <hansfbaier@googlemail.com> | 2008-05-08 09:53:19 +0000 |
commit | f65119016207d9c413437227bd5117fef7dc31b1 (patch) | |
tree | e3315e832c08526ee9416b4c0c80135414587da2 | |
parent | a42913736ab4bd1743d7c29feaaa431094ccb4c9 (diff) |
* 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
-rw-r--r-- | gtk2_ardour/audio_clock.cc | 3 | ||||
-rw-r--r-- | gtk2_ardour/midi_region_view.cc | 22 | ||||
-rw-r--r-- | libs/ardour/ardour/midi_model.h | 6 | ||||
-rw-r--r-- | libs/ardour/midi_model.cc | 7 | ||||
-rw-r--r-- | libs/ardour/region.cc | 5 | ||||
-rw-r--r-- | libs/ardour/smf_source.cc | 2 |
6 files changed, 35 insertions, 10 deletions
diff --git a/gtk2_ardour/audio_clock.cc b/gtk2_ardour/audio_clock.cc index 3ca5ca38e4..5ce5159e72 100644 --- a/gtk2_ardour/audio_clock.cc +++ b/gtk2_ardour/audio_clock.cc @@ -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; diff --git a/gtk2_ardour/midi_region_view.cc b/gtk2_ardour/midi_region_view.cc index aa245ed0e1..5b0f3070d4 100644 --- a/gtk2_ardour/midi_region_view.cc +++ b/gtk2_ardour/midi_region_view.cc @@ -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(); diff --git a/libs/ardour/ardour/midi_model.h b/libs/ardour/ardour/midi_model.h index 39987dfe7a..3d49123b94 100644 --- a/libs/ardour/ardour/midi_model.h +++ b/libs/ardour/ardour/midi_model.h @@ -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; diff --git a/libs/ardour/midi_model.cc b/libs/ardour/midi_model.cc index f17324e8c6..e544a64afb 100644 --- a/libs/ardour/midi_model.cc +++ b/libs/ardour/midi_model.cc @@ -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; diff --git a/libs/ardour/region.cc b/libs/ardour/region.cc index 456fc15235..a6d153f359 100644 --- a/libs/ardour/region.cc +++ b/libs/ardour/region.cc @@ -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) diff --git a/libs/ardour/smf_source.cc b/libs/ardour/smf_source.cc index 46c8e4bf6f..8c2ee6031f 100644 --- a/libs/ardour/smf_source.cc +++ b/libs/ardour/smf_source.cc @@ -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 && |