ardour
midi_automation_list_binder.cc
Go to the documentation of this file.
1 /*
2  Copyright (C) 2010 Paul Davis
3 
4  This program is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation; either version 2 of the License, or
7  (at your option) any later version.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program; if not, write to the Free Software
16  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 
18 */
19 
21 #include "ardour/automation_list.h"
23 #include "ardour/midi_source.h"
24 #include "ardour/midi_model.h"
25 
26 using namespace ARDOUR;
27 
29  : _source (s)
30  , _parameter (p)
31 {
32 
33 }
34 
36  : _parameter (0, 0, 0)
37 {
38  XMLProperty* source = node->property ("source-id");
39  assert (source);
40 
41  XMLProperty* parameter = node->property ("parameter");
42  assert (parameter);
43 
44  Session::SourceMap::const_iterator i = sources.find (PBD::ID (source->value()));
45  assert (i != sources.end());
47 
49 }
50 
53 {
54  boost::shared_ptr<MidiModel> model = _source->model ();
55  assert (model);
56 
58  assert (control);
59 
60  return control->alist().get();
61 }
62 
63 void
65 {
66  node->add_property ("source-id", _source->id().to_s());
67  node->add_property ("parameter", EventTypeMap::instance().to_symbol (_parameter));
68 }
const std::string & value() const
Definition: xml++.h:159
boost::shared_ptr< ARDOUR::MidiSource > _source
shared_ptr< T > dynamic_pointer_cast(shared_ptr< U > const &r)
Definition: shared_ptr.hpp:396
MidiAutomationListBinder(boost::shared_ptr< ARDOUR::MidiSource >, Evoral::Parameter)
Definition: id.h:32
XMLProperty * property(const char *)
Definition: xml++.cc:413
ARDOUR::AutomationList * get() const
Definition: amp.h:29
std::map< PBD::ID, boost::shared_ptr< Source > > SourceMap
Definition: session.h:1490
static EventTypeMap & instance()
Evoral::Parameter from_symbol(const std::string &str) const
T * get() const
Definition: shared_ptr.hpp:268
XMLProperty * add_property(const char *name, const std::string &value)
Definition: xml++.h:95
boost::shared_ptr< AutomationControl > automation_control(const Evoral::Parameter &id, bool create_if_missing=false)
Definition: automatable.cc:475
boost::shared_ptr< AutomationList > alist() const