2 Copyright (C) 2006 Paul Davis
3 Written by Taybin Rutkin
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 #ifndef __ardour_audio_unit_h__
22 #define __ardour_audio_unit_h__
31 #include <ardour/plugin.h>
33 #include <boost/shared_ptr.hpp>
37 class CAComponentDescription;
38 struct AudioBufferList;
45 class AUPlugin : public ARDOUR::Plugin
48 AUPlugin (AudioEngine& engine, Session& session, CAComponent* comp);
51 uint32_t unique_id () const;
52 const char * label () const;
53 const char * name () const { return _info->name.c_str(); }
54 const char * maker () const;
55 uint32_t parameter_count () const;
56 float default_value (uint32_t port);
57 nframes_t latency () const;
58 void set_parameter (uint32_t which, float val);
59 float get_parameter (uint32_t which) const;
61 int get_parameter_descriptor (uint32_t which, ParameterDescriptor&) const;
62 uint32_t nth_parameter (uint32_t which, bool& ok) const;
65 void set_block_size (nframes_t nframes);
67 int connect_and_run (vector<Sample*>& bufs, uint32_t maxbuf, int32_t& in, int32_t& out, nframes_t nframes, nframes_t offset);
68 std::set<uint32_t> automatable() const;
69 string describe_parameter (uint32_t);
70 string state_node_name () const { return "audiounit"; }
71 void print_parameter (uint32_t, char*, uint32_t len) const;
73 bool parameter_is_audio (uint32_t) const;
74 bool parameter_is_control (uint32_t) const;
75 bool parameter_is_input (uint32_t) const;
76 bool parameter_is_output (uint32_t) const;
79 int set_state(const XMLNode& node);
81 bool save_preset (string name);
82 bool load_preset (const string preset_label);
83 std::vector<std::string> get_presets ();
85 bool has_editor () const;
87 CAAudioUnit* get_au () { return unit; }
88 CAComponent* get_comp () { return comp; }
94 AudioBufferList* in_list;
95 AudioBufferList* out_list;
97 std::vector<std::pair<uint32_t, uint32_t> > parameter_map;
100 typedef boost::shared_ptr<AUPlugin> AUPluginPtr;
102 class AUPluginInfo : public PluginInfo {
107 CAComponentDescription* desc;
109 static PluginInfoList discover ();
110 PluginPtr load (Session& session);
113 static std::string get_name (CAComponentDescription&);
114 void setup_nchannels (CAComponentDescription&);
117 typedef boost::shared_ptr<AUPluginInfo> AUPluginInfoPtr;
119 } // namespace ARDOUR
121 #endif // __ardour_audio_unit_h__