#include <set>
#include <string>
#include <vector>
+#include <boost/enable_shared_from_this.hpp>
#include "ardour/plugin.h"
#include "ardour/uri_map.h"
#include "ardour/worker.h"
#include "pbd/ringbuffer.h"
+#ifndef PATH_MAX
+#define PATH_MAX 1024
+#endif
+
+typedef struct LV2_Evbuf_Impl LV2_Evbuf;
+
namespace ARDOUR {
// a callback function for lilv_state_new_from_instance(). friend of LV2Plugin
class AudioEngine;
class Session;
-class LV2Plugin : public ARDOUR::Plugin, public ARDOUR::Workee
+class LIBARDOUR_API LV2Plugin : public ARDOUR::Plugin, public ARDOUR::Workee
{
public:
LV2Plugin (ARDOUR::AudioEngine& engine,
const void* c_ui_type();
bool is_external_ui () const;
+ bool is_external_kx () const;
bool ui_is_resizable () const;
const char* port_symbol (uint32_t port) const;
void deactivate ();
void cleanup ();
- int set_block_size (pframes_t /*nframes*/) { return 0; }
+ int set_block_size (pframes_t);
+ bool requires_fixed_sized_buffers () const;
int connect_and_run (BufferSet& bufs,
ChanMapping in, ChanMapping out,
bool parameter_is_output (uint32_t) const;
bool parameter_is_toggled (uint32_t) const;
- boost::shared_ptr<Plugin::ScalePoints>
+ boost::shared_ptr<ScalePoints>
get_scale_points(uint32_t port_index) const;
- static uint32_t midi_event_type() { return _midi_event_type; }
-
- void set_insert_info(const PluginInsert* insert);
+ void set_insert_id(PBD::ID id);
+ void set_state_dir (const std::string& d = "");
int set_state (const XMLNode& node, int version);
bool save_preset (std::string uri);
bool has_editor () const;
bool has_message_output () const;
- uint32_t atom_eventTransfer() const;
-
- void write_from_ui(uint32_t index, uint32_t protocol, uint32_t size, uint8_t* body);
+ bool write_from_ui(uint32_t index,
+ uint32_t protocol,
+ uint32_t size,
+ const uint8_t* body);
typedef void UIMessageSink(void* controller,
uint32_t index,
uint32_t format,
const void* buffer);
- void enable_ui_emmission();
+ void enable_ui_emission();
void emit_to_ui(void* controller, UIMessageSink sink);
Worker* worker() { return _worker; }
+ URIMap& uri_map() { return _uri_map; }
+ const URIMap& uri_map() const { return _uri_map; }
+
int work(uint32_t size, const void* data);
int work_response(uint32_t size, const void* data);
- static URIMap _uri_map;
-
- static uint32_t _midi_event_type;
- static uint32_t _chunk_type;
- static uint32_t _sequence_type;
- static uint32_t _event_transfer_type;
- static uint32_t _path_type;
- static uint32_t _log_Error;
- static uint32_t _log_Warning;
- static uint32_t _log_Note;
+ void set_property(uint32_t key, const Variant& value);
+ const PropertyDescriptors& get_supported_properties() const { return _property_descriptors; }
+ const ParameterDescriptor& get_property_descriptor(uint32_t id) const;
+ void announce_property_values();
private:
struct Impl;
float* _shadow_data;
float* _defaults;
LV2_Evbuf** _ev_buffers;
+ LV2_Evbuf** _atom_ev_buffers;
float* _bpm_control_port; ///< Special input set by ardour
float* _freewheel_control_port; ///< Special input set by ardour
float* _latency_control_port; ///< Special output set by ardour
+ framepos_t _next_cycle_start; ///< Expected start frame of next run cycle
+ double _next_cycle_speed; ///< Expected start frame of next run cycle
PBD::ID _insert_id;
+ std::string _plugin_state_dir;
+ uint32_t _patch_port_in_index;
+ uint32_t _patch_port_out_index;
+ URIMap& _uri_map;
+ bool _no_sample_accurate_ctrl;
friend const void* lv2plugin_get_port_value(const char* port_symbol,
void* user_data,
uint32_t* type);
typedef enum {
- PORT_INPUT = 1,
- PORT_OUTPUT = 1 << 1,
- PORT_AUDIO = 1 << 2,
- PORT_CONTROL = 1 << 3,
- PORT_EVENT = 1 << 4,
- PORT_MESSAGE = 1 << 5
+ PORT_INPUT = 1, ///< Input port
+ PORT_OUTPUT = 1 << 1, ///< Output port
+ PORT_AUDIO = 1 << 2, ///< Audio (buffer of float)
+ PORT_CONTROL = 1 << 3, ///< Control (single float)
+ PORT_EVENT = 1 << 4, ///< Old event API event port
+ PORT_SEQUENCE = 1 << 5, ///< New atom API event port
+ PORT_MIDI = 1 << 6, ///< Event port understands MIDI
+ PORT_POSITION = 1 << 7, ///< Event port understands position
+ PORT_PATCHMSG = 1 << 8 ///< Event port supports patch:Message
} PortFlag;
typedef unsigned PortFlags;
std::vector<PortFlags> _port_flags;
+ std::vector<size_t> _port_minimumSize;
std::map<std::string,uint32_t> _port_indices;
+ PropertyDescriptors _property_descriptors;
+
/// Message send to/from UI via ports
struct UIMessage {
uint32_t index;
uint32_t size;
};
- void write_to_ui(uint32_t index,
- uint32_t protocol,
- uint32_t size,
- uint8_t* body);
+ bool write_to_ui(uint32_t index,
+ uint32_t protocol,
+ uint32_t size,
+ const uint8_t* body);
- void write_to(RingBuffer<uint8_t>* dest,
+ bool write_to(RingBuffer<uint8_t>* dest,
uint32_t index,
uint32_t protocol,
uint32_t size,
- uint8_t* body);
+ const uint8_t* body);
// Created on demand so the space is only consumed if necessary
RingBuffer<uint8_t>* _to_ui;
LV2_Feature _make_path_feature;
LV2_Feature _log_feature;
LV2_Feature _work_schedule_feature;
- LV2_Feature _buf_size_feature;
+ LV2_Feature _options_feature;
+ LV2_Feature _def_state_feature;
+
+ // Options passed to plugin
+ int32_t _seq_size;
mutable unsigned _state_version;
const char* path);
void init (const void* c_plugin, framecnt_t rate);
+ void allocate_atom_event_buffers ();
void run (pframes_t nsamples);
+ void load_supported_properties(PropertyDescriptors& descs);
+
void latency_compute_run ();
std::string do_save_preset (std::string);
void do_remove_preset (std::string);
};
-class LV2PluginInfo : public PluginInfo {
+class LIBARDOUR_API LV2PluginInfo : public PluginInfo , public boost::enable_shared_from_this<ARDOUR::LV2PluginInfo> {
public:
- LV2PluginInfo (const void* c_plugin);
+ LV2PluginInfo (const char* plugin_uri);
~LV2PluginInfo ();
static PluginInfoList* discover ();
PluginPtr load (Session& session);
+ std::vector<Plugin::PresetRecord> get_presets (bool user_only) const;
+ virtual bool in_category (const std::string &c) const;
+ virtual bool is_instrument() const;
- const void* _c_plugin;
+ char * _plugin_uri;
};
typedef boost::shared_ptr<LV2PluginInfo> LV2PluginInfoPtr;