diff options
author | David Robillard <d@drobilla.net> | 2009-10-23 20:11:56 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2009-10-23 20:11:56 +0000 |
commit | c3a2f704c9226e2d871a91a3d9699b50ef82c7c8 (patch) | |
tree | 2155962f8e26852593453ddb4b97d082ac2f840b /libs/ardour/automatable.cc | |
parent | 8340dcdd57ec32c9a5b59e2058740d5607f95521 (diff) |
Fix sketchy casts.
git-svn-id: svn://localhost/ardour2/branches/3.0@5893 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/automatable.cc')
-rw-r--r-- | libs/ardour/automatable.cc | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/libs/ardour/automatable.cc b/libs/ardour/automatable.cc index 85f083ca37..1ef39a61f0 100644 --- a/libs/ardour/automatable.cc +++ b/libs/ardour/automatable.cc @@ -408,21 +408,39 @@ Automatable::control_factory(const Evoral::Parameter& param) boost::shared_ptr<AutomationList> list(new AutomationList(param)); Evoral::Control* control = NULL; if (param.type() >= MidiCCAutomation && param.type() <= MidiChannelPressureAutomation) { - control = new MidiTrack::MidiControl((MidiTrack*)this, param); + MidiTrack* mt = dynamic_cast<MidiTrack*>(this); + if (mt) { + control = new MidiTrack::MidiControl(mt, param); + } else { + warning << "MidiCCAutomation for non-MidiTrack" << endl; + } } else if (param.type() == PluginAutomation) { - control = new PluginInsert::PluginControl((PluginInsert*)this, param); + PluginInsert* pi = dynamic_cast<PluginInsert*>(this); + if (pi) { + control = new PluginInsert::PluginControl(pi, param); + } else { + warning << "PluginAutomation for non-Plugin" << endl; + } } else if (param.type() == GainAutomation) { - control = new Amp::GainControl( X_("gaincontrol"), _a_session, (Amp*)this, param); + Amp* amp = dynamic_cast<Amp*>(this); + if (amp) { + control = new Amp::GainControl(X_("gaincontrol"), _a_session, amp, param); + } else { + warning << "GainAutomation for non-Amp" << endl; + } } else if (param.type() == PanAutomation) { Panner* me = dynamic_cast<Panner*>(this); if (me) { control = new Panner::PanControllable(me->session(), X_("panner"), *me, param); } else { - cerr << "ERROR: PanAutomation for non-Panner" << endl; + warning << "PanAutomation for non-Panner" << endl; } - } else { + } + + if (!control) { control = new AutomationControl(_a_session, param); } + control->set_list(list); return boost::shared_ptr<Evoral::Control>(control); } |