40 return std::make_unique<LadspaEffectOutputs>(*
this);
48 assert(srcValues.size() == dstValues.size());
49 copy(srcValues.begin(), srcValues.end(), dstValues.data());
53std::pair<float, float>
57 const auto multiplier =
77 const auto combine = [bounds,
79 ](
float lowWeight,
float highWeight){
80 auto [lower, upper] = bounds;
82 ? exp(log(lower) * lowWeight + log(upper) * highWeight)
83 : lower * lowWeight + upper * highWeight;
86 auto [lower, upper] = bounds;
96 val = combine(0.75, 0.25);
break;
98 val = combine(0.5, 0.5);
break;
100 val = combine(0.25, 0.75);
break;
121 unsigned audioIns,
unsigned audioOuts,
int latencyPort
123 , mData{ pData }, mInputPorts{ inputPorts }, mOutputPorts{ outputPorts }
124 , mAudioIns{ audioIns }, mAudioOuts{ audioOuts }
125 , mLatencyPort{ latencyPort }
126 , mUseLatency{ LoadUseLatency(processor) }
135 if (mUseLatency && mLatencyPort >= 0)
136 return controls[mLatencyPort];
157return GuardedCall<bool>([&]{
169 const float *
const *inBlock,
float *
const *outBlock,
size_t blockLen)
173 const_cast<float*
>(inBlock[i]));
194 auto pLadspaOutputs =
mSlaves.empty()
215return GuardedCall<bool>([&]{
216 for (
size_t i = 0, cnt = mSlaves.size(); i < cnt; ++i)
217 FreeInstance(mSlaves[i]);
246 const float *
const *inbuf,
float *
const *outbuf,
size_t numSamples)
253 const_cast<float*
>(inbuf[i]));
287 pOutputs ? &pOutputs->
controls[p] : &sink);
Declare abstract class AudacityException, some often-used subclasses, and GuardedCall.
static const wchar_t * UseLatencyKey
static const wchar_t * OptionsKey
static Settings & settings()
EffectDefinitionInterface is a ComponentInterface that adds some basic read-only information about ef...
Hold values to send to effect output meters.
Base class for many of the effects in Audacity.
#define LADSPA_HINT_DEFAULT_100
#define LADSPA_IS_HINT_BOUNDED_BELOW(x)
#define LADSPA_HINT_DEFAULT_MAXIMUM
#define LADSPA_HINT_DEFAULT_440
#define LADSPA_HINT_DEFAULT_LOW
#define LADSPA_IS_HINT_BOUNDED_ABOVE(x)
#define LADSPA_HINT_DEFAULT_0
#define LADSPA_IS_HINT_LOGARITHMIC(x)
#define LADSPA_HINT_DEFAULT_HIGH
#define LADSPA_HINT_DEFAULT_MASK
#define LADSPA_HINT_DEFAULT_MIDDLE
int LADSPA_PortDescriptor
#define LADSPA_HINT_DEFAULT_1
#define LADSPA_HINT_DEFAULT_MINIMUM
#define LADSPA_IS_PORT_INPUT(x)
#define LADSPA_IS_PORT_CONTROL(x)
#define LADSPA_HINT_DEFAULT_NONE
#define LADSPA_IS_HINT_SAMPLE_RATE(x)
bool SetConfig(const EffectDefinitionInterface &ident, ConfigurationType type, const RegistryPath &group, const RegistryPath &key, const Value &value)
bool GetConfig(const EffectDefinitionInterface &ident, ConfigurationType type, const RegistryPath &group, const RegistryPath &key, Value &var, const Value &defval)
constexpr auto sampleRate
DynamicRangeProcessorSettings GetSettings(EffectSettingsAccess &access)
float ClampInputControlValue(const LADSPA_PortRangeHint &hint, float val, float lower, float upper)
float InputControlPortDefaultValue(const LADSPA_PortRangeHint &hint, double sampleRate)
std::pair< float, float > InputControlPortBounds(const LADSPA_PortRangeHint &hint, double sampleRate)
void copy(const T *src, T *dst, int32_t n)
_LADSPA_Descriptor is a structure that provides the API to a LADSPA (Linux Audio Plugin Architecture)...
LADSPA_Handle(* instantiate)(const struct _LADSPA_Descriptor *Descriptor, unsigned long SampleRate)
void(* deactivate)(LADSPA_Handle Instance)
void(* cleanup)(LADSPA_Handle Instance)
void(* run)(LADSPA_Handle Instance, unsigned long SampleCount)
void(* activate)(LADSPA_Handle Instance)
void(* connect_port)(LADSPA_Handle Instance, unsigned long Port, LADSPA_Data *DataLocation)
const LADSPA_PortDescriptor * PortDescriptors
_LADSPA_PortRangeHint is a structure that gives parameter validation information for a LADSPA (Linux ...
LADSPA_PortRangeHintDescriptor HintDescriptor
Externalized state of a plug-in.
Carry output control port information back to main thread.
~LadspaEffectOutputs() override
void Assign(EffectOutputs &&src) override
Update one Outputs object from another.
std::vector< float > controls
std::unique_ptr< EffectOutputs > Clone() const override
bool ProcessInitialize(EffectSettings &settings, double sampleRate, ChannelNames chanMap) override
static LadspaEffectSettings & GetSettings(EffectSettings &settings)
Assume settings originated from MakeSettings() and copies thereof.
bool RealtimeSuspend() override
size_t ProcessBlock(EffectSettings &settings, const float *const *inBlock, float *const *outBlock, size_t blockLen) override
Called for destructive effect computation.
bool ProcessFinalize() noexcept override
unsigned GetAudioInCount() const override
How many input buffers to allocate at once.
bool RealtimeFinalize(EffectSettings &settings) noexcept override
LadspaInstance(const PerTrackEffect &processor, const LADSPA_Descriptor *pData, const ArrayOf< unsigned long > &inputPorts, const ArrayOf< unsigned long > &outputPorts, unsigned audioIns, unsigned audioOuts, int latencyPort)
size_t RealtimeProcess(size_t group, EffectSettings &settings, const float *const *inBuf, float *const *outBuf, size_t numSamples) override
const ArrayOf< unsigned long > & mInputPorts
LADSPA_Handle InitInstance(float sampleRate, LadspaEffectSettings &settings, LadspaEffectOutputs *pOutputs) const
unsigned GetAudioOutCount() const override
How many output buffers to allocate at once.
void FreeInstance(LADSPA_Handle handle) const
const unsigned mAudioOuts
std::vector< LADSPA_Handle > mSlaves
const LADSPA_Descriptor *const mData
bool RealtimeAddProcessor(EffectSettings &settings, EffectOutputs *pOutputs, unsigned numChannels, float sampleRate) override
bool RealtimeProcessEnd(EffectSettings &settings) noexcept override
settings can be updated to let a dialog change appearance at idle
const ArrayOf< unsigned long > & mOutputPorts
bool RealtimeInitialize(EffectSettings &settings, double sampleRate) override
static bool LoadUseLatency(const EffectDefinitionInterface &effect)
Get the preference for using latency.
static bool SaveUseLatency(const EffectDefinitionInterface &effect, bool value)
Set the preference for using latency.
bool RealtimeProcessStart(MessagePackage &package) override
settings are possibly changed, since last call, by an asynchronous dialog
bool RealtimeResume() override
SampleCount GetLatency(const EffectSettings &settings, double sampleRate) const override