* set right interpolation on MidiModel controls after recording too

git-svn-id: svn://localhost/ardour2/branches/3.0@4459 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Hans Baier 2009-01-29 00:18:26 +00:00
parent a1234aa21e
commit f55b902c73
2 changed files with 26 additions and 12 deletions

View File

@ -113,6 +113,8 @@ class SMFSource : public MidiSource, public Evoral::SMF {
bool find (std::string path, bool must_exist, bool& is_new);
bool removable() const;
bool writable() const { return _flags & Writable; }
void make_sure_controls_have_the_right_interpolation();
Glib::ustring _path;
Flag _flags;

View File

@ -235,7 +235,7 @@ SMFSource::write_unlocked (MidiRingBuffer& src, nframes_t cnt)
ev.set(buf, size, time);
ev.set_event_type(EventTypeMap::instance().midi_event_type(ev.buffer()[0]));
if (! (ev.is_channel_event() || ev.is_smf_meta_event() || ev.is_sysex()) ) {
//cerr << "SMFSource: WARNING: caller tried to write non SMF-Event of type " << std::hex << int(ev.buffer()[0]) << endl;
cerr << "SMFSource: WARNING: caller tried to write non SMF-Event of type " << std::hex << int(ev.buffer()[0]) << endl;
continue;
}
@ -246,6 +246,10 @@ SMFSource::write_unlocked (MidiRingBuffer& src, nframes_t cnt)
}
}
if (_model) {
make_sure_controls_have_the_right_interpolation();
}
SMF::flush();
free(buf);
@ -660,17 +664,7 @@ SMFSource::load_model(bool lock, bool force_reload)
}
}
// set interpolation style to defaults, can be changed by the GUI later
Evoral::ControlSet::Controls controls = _model->controls();
for (Evoral::ControlSet::Controls::iterator c = controls.begin(); c != controls.end(); ++c) {
(*c).second->list()->set_interpolation(
// to be enabled when ControlList::rt_safe_earliest_event_linear_unlocked works properly
#if 0
EventTypeMap::instance().interpolation_of((*c).first));
#else
Evoral::ControlList::Discrete);
#endif
}
make_sure_controls_have_the_right_interpolation();
_model->end_write(false);
_model->set_edited(false);
@ -678,6 +672,24 @@ SMFSource::load_model(bool lock, bool force_reload)
free(buf);
}
#define LINEAR_INTERPOLATION_MODE_WORKS_PROPERLY 0
void
SMFSource::make_sure_controls_have_the_right_interpolation()
{
// set interpolation style to defaults, can be changed by the GUI later
Evoral::ControlSet::Controls controls = _model->controls();
for (Evoral::ControlSet::Controls::iterator c = controls.begin(); c != controls.end(); ++c) {
(*c).second->list()->set_interpolation(
// to be enabled when ControlList::rt_safe_earliest_event_linear_unlocked works properly
#if LINEAR_INTERPOLATION_MODE_WORKS_PROPERLY
EventTypeMap::instance().interpolation_of((*c).first));
#else
Evoral::ControlList::Discrete);
#endif
}
}
void
SMFSource::destroy_model()