15#ifndef __AUDACITY_LV2_PORTS__
16#define __AUDACITY_LV2_PORTS__
22#include <unordered_map>
29#include "lv2/atom/forge.h"
37 LV2Port(
const LilvPort *port,
int index,
bool isInput,
38 const wxString &symbol,
const wxString &
name,
63 const wxString & symbol,
const wxString &
name,
65 uint32_t minimumSize,
bool isMidi,
bool wantsPosition
66 ) :
LV2Port{ port, index, isInput, symbol,
name, group }
105 void SendToInstance(LV2_Atom_Forge &forge, int64_t frameTime,
float speed);
116 std::function<
void(
const LV2_Atom *atom, uint32_t
size)>
handler);
131 LV2CVPort(
const LilvPort *port,
int index,
bool isInput,
132 const wxString & symbol,
const wxString &
name,
134 float min,
float max,
float def,
bool hasLo,
bool hasHi
135 ) :
LV2Port(port, index, isInput, symbol,
name, group)
164 const wxString & symbol,
const wxString &
name,
166 std::vector<double> scaleValues, wxArrayString scaleLabels,
167 const wxString &units,
168 float min,
float max,
float def,
bool hasLo,
bool hasHi,
169 bool toggle,
bool enumeration,
bool integer,
bool sampleRate,
170 bool trigger,
bool logarithmic
171 ) :
LV2Port{ port, index, isInput, symbol,
name, group }
210 mutable std::shared_ptr<const LilvState>
mpState;
230 std::unique_ptr<EffectOutputs>
Clone()
const override;
260 explicit LV2Ports(
const LilvPlugin &plug);
266 const char *port_symbol, uint32_t *
size, uint32_t *type)
const;
269 const void *value, uint32_t
size, uint32_t type)
const;
285 std::unordered_map<TranslatableString, std::vector<int>>
mGroupMap;
const TranslatableString name
std::vector< LV2CVPortState > LV2CVPortStateArray
No need yet for extra indirection.
std::shared_ptr< LV2AtomPortState > LV2AtomPortStatePtr
std::shared_ptr< LV2AudioPort > LV2AudioPortPtr
std::shared_ptr< LV2ControlPort > LV2ControlPortPtr
std::vector< LV2AtomPortPtr > LV2AtomPortArray
LV2EffectSettings & GetSettings(EffectSettings &settings)
std::vector< LV2CVPortPtr > LV2CVPortArray
std::vector< LV2AtomPortStatePtr > LV2AtomPortStateArray
std::shared_ptr< LV2CVPort > LV2CVPortPtr
std::vector< LV2AudioPortPtr > LV2AudioPortArray
std::vector< LV2ControlPortState > LV2ControlPortStateArray
No need yet for extra indirection.
std::shared_ptr< LV2AtomPort > LV2AtomPortPtr
std::vector< LV2ControlPortPtr > LV2ControlPortArray
std::unique_ptr< Type, Lilv_deleter< Type, f > > Lilv_ptr
Generate classes of smart pointers to lv2 resources.
static Settings & settings()
std::vector< TranslatableString > TranslatableStrings
Hold values to send to effect output meters.
Immutable description of an LV2 Atom port.
LV2AtomPort(const LilvPort *port, int index, bool isInput, const wxString &symbol, const wxString &name, const TranslatableString &group, uint32_t minimumSize, bool isMidi, bool wantsPosition)
const uint32_t mMinimumSize
const bool mWantsPosition
Immutable description of an LV2 Audio port.
Immutable description of an LV2 CV port (control data signal at sample rate)
LV2CVPort(const LilvPort *port, int index, bool isInput, const wxString &symbol, const wxString &name, const TranslatableString &group, float min, float max, float def, bool hasLo, bool hasHi)
Immutable description of an LV2 control port.
LV2ControlPort(const LilvPort *port, int index, bool isInput, const wxString &symbol, const wxString &name, const TranslatableString &group, std::vector< double > scaleValues, wxArrayString scaleLabels, const wxString &units, float min, float max, float def, bool hasLo, bool hasHi, bool toggle, bool enumeration, bool integer, bool sampleRate, bool trigger, bool logarithmic)
size_t Discretize(float value) const
Map a real number to one of the scale points.
const wxArrayString mScaleLabels
const std::vector< double > mScaleValues
Immutable description of an LV2 port.
const TranslatableString mGroup
const LilvPort *const mPort
LV2Port(const LilvPort *port, int index, bool isInput, const wxString &symbol, const wxString &name, const TranslatableString &group)
LV2PortStates(const LV2Ports &ports)
LV2CVPortStateArray mCVPortStates
LV2AtomPortStateArray mAtomPortStates
LV2AtomPortStatePtr mControlIn
LV2PortUIStates(const LV2PortStates &states, const LV2Ports &ports)
LV2ControlPortStateArray mControlPortStates
LV2AtomPortStatePtr mControlOut
std::unordered_map< TranslatableString, std::vector< int > > mGroupMap
void EmitPortValues(const LilvState &state, LV2EffectSettings &settings) const
std::optional< size_t > mControlInIdx
const void * GetPortValue(const LV2EffectSettings &settings, const char *port_symbol, uint32_t *size, uint32_t *type) const
TranslatableStrings mGroups
LV2Ports(const LilvPlugin &plug)
LV2ControlPortArray mControlPorts
LV2AtomPortArray mAtomPorts
std::optional< size_t > mControlOutIdx
void SetPortValue(LV2EffectSettings &settings, const char *port_symbol, const void *value, uint32_t size, uint32_t type) const
std::unordered_map< uint32_t, size_t > mControlPortMap
LV2AudioPortArray mAudioPorts
Holds a msgid for the translation catalog; may also bind format arguments.
ZixRing * zix_ring_new(uint32_t size)
void zix_ring_mlock(ZixRing *ring)
AuthorizationHandler handler
Externalized state of a plug-in.
State of an instance of an LV2 Atom port.
void SendToInstance(LV2_Atom_Forge &forge, int64_t frameTime, float speed)
Transfer incoming events from the ring buffer to the event buffer.
const std::unique_ptr< uint8_t[]> mBuffer
const Lilv_ptr< ZixRing, zix_ring_free > mRing
LV2AtomPortState(LV2AtomPortPtr pPort)
void SendToDialog(std::function< void(const LV2_Atom *atom, uint32_t size)> handler)
Dialog can poll one ring buffer for messages at idle time.
void ReceiveFromDialog(const void *buffer, uint32_t buffer_size)
Dialog pushes to other ring buffer when it gets a user interface event.
void ReceiveFromInstance()
Take responses from the instance and send cross-thread for the dialog.
void ResetForInstanceOutput()
const LV2AtomPortPtr mpPort
State of an instance of an LV2 CV port.
LV2CVPortState(LV2CVPortPtr pPort)
const LV2CVPortPtr mpPort
Other UI related state of an instance of an LV2 Control port.
float mLst
Value of mTmp last seen by idle-time updater.
float mLo
Lower bound, as scaled by sample rate if that is required.
float mHi
Upper bound, as scaled by sample rate if that is required.
float mTmp
Value of UI control, as scaled by sample rate if that is required.
const LV2ControlPortPtr mpPort
LV2ControlPortState(LV2ControlPortPtr pPort)
Carry output control port information back to main thread.
std::unique_ptr< EffectOutputs > Clone() const override
void Assign(EffectOutputs &&src) override
Update one Outputs object from another.
~LV2EffectOutputs() override
std::vector< float > values
vector of values in correspondence with the control ports
Storage locations to be connected to LV2 control ports.
std::vector< float > values
vector of values in correspondence with the control ports
std::shared_ptr< const LilvState > mpState
Result of last load of a preset; may be null.