Ardour  9.0-pre0-582-g084a23a80d
vst_plugin.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2011 David Robillard <d@drobilla.net>
3  * Copyright (C) 2007-2011 Carl Hetherington <carl@carlh.net>
4  * Copyright (C) 2007-2018 Paul Davis <paul@linuxaudiosystems.com>
5  * Copyright (C) 2014-2019 Robin Gareus <robin@gareus.org>
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License along
18  * with this program; if not, write to the Free Software Foundation, Inc.,
19  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20  */
21 
22 #pragma once
23 
24 #include <pbd/signals.h>
25 #include "ardour/plugin.h"
26 
27 struct _AEffect;
28 typedef struct _AEffect AEffect;
29 struct _VSTHandle;
30 typedef struct _VSTHandle VSTHandle;
31 struct _VSTState;
32 typedef struct _VSTState VSTState;
33 
34 #include "ardour/vestige/vestige.h"
35 
36 namespace ARDOUR {
37 
38 class PluginInsert;
39 struct VST2Info;
40 
43 {
44 public:
45  friend class Session;
47  VSTPlugin (const VSTPlugin& other);
48  virtual ~VSTPlugin ();
49 
50  void activate ();
51  void deactivate ();
52 
55  bool inplace_broken() const { return true; }
56  float default_value (uint32_t port);
57  float get_parameter (uint32_t port) const;
58  uint32_t nth_parameter (uint32_t port, bool& ok) const;
59  void set_parameter (uint32_t port, float val, sampleoffset_t);
60  void set_parameter_automated (uint32_t port, float val);
62  int get_parameter_descriptor (uint32_t which, ParameterDescriptor&) const;
64  std::set<Evoral::Parameter> automatable() const;
65 
68 
69  bool parameter_is_audio (uint32_t) const { return false; }
70  bool parameter_is_control (uint32_t) const { return true; }
71  bool parameter_is_input (uint32_t) const { return true; }
72  bool parameter_is_output (uint32_t) const { return false; }
73 
75 
77  samplepos_t start, samplepos_t end, double speed,
78  ChanMapping const& in, ChanMapping const& out,
79  pframes_t nframes, samplecnt_t offset
80  );
81 
82  std::string unique_id () const;
83  const char * label () const;
84  const char * name () const;
85  const char * maker () const;
86  int32_t version () const;
87  uint32_t parameter_count () const;
88  bool print_parameter (uint32_t, std::string&) const;
89 
90  bool has_editor () const;
91 
92  AEffect * plugin () const { return _plugin; }
93  VSTState * state () const { return _state; }
94  MidiBuffer * midi_buffer () const { return _midi_out_buf; }
95 
96  int set_state (XMLNode const &, int);
97 
99 
100  VstTimeInfo* timeinfo () { return &_timeInfo; }
101  samplepos_t transport_sample () const { return _transport_sample; }
102  float transport_speed () const { return _transport_speed; }
103 
104 
105 protected:
106  void parameter_changed_externally (uint32_t which, float val);
107  virtual void open_plugin ();
108  void init_plugin ();
109  gchar* get_chunk (bool) const;
110  int set_chunk (gchar const *, bool);
111  void add_state (XMLNode *) const;
114  std::string do_save_preset (std::string name);
115  void do_remove_preset (std::string name);
116  XMLTree * presets_tree () const;
117  std::string presets_file () const;
119  void find_presets ();
120 
124 
127 
130  mutable std::map <uint32_t, float> _parameter_defaults;
132 };
133 
135 {
136 public:
138  bool is_instrument () const;
139 protected:
141 };
142 
143 }
144 
VSTPluginInfo(VST2Info const &)
bool is_instrument() const
int first_user_preset_index() const
void do_remove_preset(std::string name)
float default_value(uint32_t port)
VstTimeInfo * timeinfo()
Definition: vst_plugin.h:100
void parameter_changed_externally(uint32_t which, float val)
void set_parameter_automated(uint32_t port, float val)
uint32_t parameter_count() const
void set_parameter(uint32_t port, float val, sampleoffset_t)
bool load_plugin_preset(PresetRecord)
int32_t version() const
VSTHandle * _handle
Definition: vst_plugin.h:121
VSTState * state() const
Definition: vst_plugin.h:93
bool load_user_preset(PresetRecord)
AEffect * _plugin
Definition: vst_plugin.h:123
bool parameter_is_input(uint32_t) const
Definition: vst_plugin.h:71
int set_chunk(gchar const *, bool)
std::set< Evoral::Parameter > automatable() const
PBD::Signal< void()> VSTSizeWindow
Definition: vst_plugin.h:67
virtual ~VSTPlugin()
bool parameter_is_control(uint32_t) const
Definition: vst_plugin.h:70
samplepos_t transport_sample() const
Definition: vst_plugin.h:101
float get_parameter(uint32_t port) const
bool requires_fixed_sized_buffers() const
PBD::Signal< void()> LoadPresetProgram
Definition: vst_plugin.h:66
std::string presets_file() const
float transport_speed() const
Definition: vst_plugin.h:102
bool parameter_is_audio(uint32_t) const
Definition: vst_plugin.h:69
XMLTree * presets_tree() const
uint32_t nth_parameter(uint32_t port, bool &ok) const
bool load_preset(PresetRecord)
samplepos_t _transport_sample
Definition: vst_plugin.h:128
const char * label() const
gchar * get_chunk(bool) const
std::string describe_parameter(Evoral::Parameter)
MidiBuffer * _midi_out_buf
Definition: vst_plugin.h:125
VSTPlugin(AudioEngine &, Session &, VSTHandle *)
bool has_editor() const
VSTPlugin(const VSTPlugin &other)
uint32_t designated_bypass_port()
AEffect * plugin() const
Definition: vst_plugin.h:92
const char * maker() const
float _transport_speed
Definition: vst_plugin.h:129
VstTimeInfo _timeInfo
Definition: vst_plugin.h:126
int get_parameter_descriptor(uint32_t which, ParameterDescriptor &) const
int set_state(XMLNode const &, int)
std::map< uint32_t, float > _parameter_defaults
Definition: vst_plugin.h:130
bool inplace_broken() const
Definition: vst_plugin.h:55
samplecnt_t plugin_latency() const
int connect_and_run(BufferSet &, samplepos_t start, samplepos_t end, double speed, ChanMapping const &in, ChanMapping const &out, pframes_t nframes, samplecnt_t offset)
virtual void open_plugin()
std::string unique_id() const
int set_block_size(pframes_t)
void add_state(XMLNode *) const
VSTState * _state
Definition: vst_plugin.h:122
bool print_parameter(uint32_t, std::string &) const
bool parameter_is_output(uint32_t) const
Definition: vst_plugin.h:72
std::string do_save_preset(std::string name)
const char * name() const
MidiBuffer * midi_buffer() const
Definition: vst_plugin.h:94
Definition: xml++.h:114
Definition: xml++.h:74
GtkImageIconNameData name
Definition: gtkimage.h:6
#define LIBARDOUR_API
PBD::PropertyDescriptor< timepos_t > start
uint32_t pframes_t
Temporal::samplecnt_t samplecnt_t
Temporal::sampleoffset_t sampleoffset_t
Temporal::samplepos_t samplepos_t