16#pragma GCC diagnostic ignored "-Wparentheses"
17#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
18#elif defined(__clang__)
19#pragma clang diagnostic ignored "-Wparentheses"
20#pragma clang diagnostic ignored "-Wdeprecated-declarations"
31 , mFeatures{ features }
58std::unique_ptr<LV2Wrapper>
69 std::min({maxBlockSize, mUserBlockSize, mFeatures.mMaxBlockSize}));
73 pSlave->SendBlockSize();
95 if (mMaster && mUseLatency && mPorts.mLatencyPort >= 0)
96 return mMaster->GetLatency();
108 state.mBuffer.reinit(
GetBlockSize(), state.mpPort->mIsInput);
114 const float *
const *inbuf,
float *
const *outbuf,
size_t size)
120 const auto instance = &
mMaster->GetInstance();
125 lilv_instance_connect_port(instance,
127 const_cast<float*
>(port->mIsInput ? inbuf[i++] : outbuf[o++]));
132 lilv_instance_run(instance,
size);
138 state->ResetForInstanceOutput();
146 state.mBuffer.reinit(
GetBlockSize(), state.mpPort->mIsInput);
152return GuardedCall<bool>([&]{
154 for (
auto & state : mPortStates.mCVPortStates)
155 state.mBuffer.reset();
171 pInstance->Activate();
172 mSlaves.push_back(move(pInstance));
181 pSlave->Deactivate();
213 const float *
const *inbuf,
float *
const *outbuf,
size_t numSamples)
219 if (group < 0 || group >= (
int)
mSlaves.size())
222 const auto slave =
mSlaves[group].get();
223 const auto instance = &slave->GetInstance();
228 lilv_instance_connect_port(instance,
230 const_cast<float*
>(port->mIsInput ? inbuf[i++] : outbuf[o++]));
235 lilv_instance_run(instance, numSamples);
238 for (
decltype(numSamples) s = 0; s < numSamples; s++)
239 outbuf[i][s] = inbuf[i][s];
242 slave->ConsumeResponses();
245 state->ResetForInstanceOutput();
255return GuardedCall<bool>([&]{
257 if (mNumSamples == 0)
262 for (
auto & state : mPortStates.mAtomPortStates)
263 state->ReceiveFromInstance();
Declare abstract class AudacityException, some often-used subclasses, and GuardedCall.
static Settings & settings()
Hold values to send to effect output meters.
LV2_URID_Map * URIDMapFeature() const
bool RealtimeSuspend() override
std::vector< std::unique_ptr< LV2Wrapper > > mSlaves
Each holds lv2 library state for realtime processing of one track.
unsigned GetAudioInCount() const override
How many input buffers to allocate at once.
LV2InstanceFeaturesList mFeatures
LV2Instance(const PerTrackEffect &effect, const LV2FeaturesList &features, const LV2Ports &ports)
std::unique_ptr< LV2Wrapper > mMaster
Holds lv2 library state for destructive processing.
bool RealtimeInitialize(EffectSettings &settings, double sampleRate) override
LV2PortStates mPortStates
size_t RealtimeProcess(size_t group, EffectSettings &settings, const float *const *inbuf, float *const *outbuf, size_t numSamples) override
bool RealtimeFinalize(EffectSettings &settings) noexcept override
bool ProcessInitialize(EffectSettings &settings, double sampleRate, ChannelNames chanMap) override
bool RealtimeResume() override
unsigned GetAudioOutCount() const override
How many output buffers to allocate at once.
size_t SetBlockSize(size_t maxBlockSize) override
bool RealtimeAddProcessor(EffectSettings &settings, EffectOutputs *pOutputs, unsigned numChannels, float sampleRate) override
SampleCount GetLatency(const EffectSettings &settings, double sampleRate) const override
std::unique_ptr< LV2Wrapper > MakeWrapper(const EffectSettings &settings, double sampleRate, EffectOutputs *pOutputs)
void MakeMaster(const EffectSettings &settings, double sampleRate)
bool RealtimeProcessStart(MessagePackage &package) override
settings are possibly changed, since last call, by an asynchronous dialog
size_t GetBlockSize() const override
bool RealtimeProcessEnd(EffectSettings &settings) noexcept override
settings can be updated to let a dialog change appearance at idle
size_t ProcessBlock(EffectSettings &settings, const float *const *inBlock, float *const *outBlock, size_t blockLen) override
Called for destructive effect computation.
LV2CVPortStateArray mCVPortStates
LV2AtomPortStateArray mAtomPortStates
LV2AudioPortArray mAudioPorts
static std::unique_ptr< LV2Wrapper > Create(LV2InstanceFeaturesList &baseFeatures, const LV2Ports &ports, LV2PortStates &portStates, const LV2EffectSettings &settings, float sampleRate, EffectOutputs *pOutputs)
Factory.
Base class for many of the effects in Audacity.
LV2_API bool GetUseLatency(const EffectDefinitionInterface &effect, bool &useLatency)
LV2_API bool GetBufferSize(const EffectDefinitionInterface &effect, int &bufferSize)
constexpr auto sampleRate
DynamicRangeProcessorSettings GetSettings(EffectSettingsAccess &access)
constexpr auto maxBlockSize
Externalized state of a plug-in.
Carry output control port information back to main thread.
const LV2FeaturesList & Base() const