15#ifndef __AUDACITY_EFFECT_STAGE__
16#define __AUDACITY_EFFECT_STAGE__
30 using Factory = std::function<std::shared_ptr<EffectInstance>()>;
45 CreateToken,
int channel,
int nInputChannels, Source& upstream,
47 double sampleRate, std::optional<sampleCount> genLength);
50 static std::unique_ptr<EffectStage> Create(
51 int channel,
int nInputChannels, Source& upstream,
Buffers& inBuffers,
53 std::optional<sampleCount> genLength);
67 std::optional<size_t>
Acquire(
Buffers &data,
size_t bound)
override;
73 {
return std::max<sampleCount>(0, mDelayRemaining); }
83 const Buffers &data,
size_t curBlockSize,
size_t outBufferOffset)
const;
85 [[nodiscard]] std::optional<size_t> FetchProcessAndAdvance(
86 Buffers &data,
size_t bound,
bool doZeros,
size_t outBufferOffset = 0);
91 const std::vector<std::shared_ptr<EffectInstance>>
mInstances;
97 size_t mLastProduced{};
99 bool mLatencyDone{
false };
100 bool mCleared{
false };
112 int nInputChannels,
int channel,
MIXER_API unsigned MakeChannelMap(int nInputChannels, int channel, ChannelName map[3])
static Settings & settings()
Accumulates (non-interleaved) data during effect processing.
Upstream producer of sample streams, taking Buffers as external context.
virtual sampleCount Remaining() const =0
Result includes any amount Acquired and not yet Released.
virtual bool AcceptsBlockSize(size_t blockSize) const =0
virtual bool AcceptsBuffers(const Buffers &buffers) const =0
virtual std::optional< size_t > Acquire(Buffers &data, size_t bound)=0
Occupy vacant space in Buffers with some data.
virtual bool Release()=0
Caller is done examining last Acquire()d positions.
Performs effect computation.
Decorates a source with a non-timewarping effect, which may have latency.
const std::vector< std::shared_ptr< EffectInstance > > mInstances
sampleCount mDelayRemaining
EffectStage(const EffectStage &)=delete
std::function< std::shared_ptr< EffectInstance >()> Factory
sampleCount DelayRemaining() const
EffectSettings & mSettings
Positions or offsets within audio files need a wide type.
constexpr auto sampleRate
Externalized state of a plug-in.