Audacity 3.2.0
LV2Instance.h
Go to the documentation of this file.
1/**********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 @file LV2Instance.h
6 @brief Holds non-UI processing state for an instance of an LV2 effect
7
8 Paul Licameli split from LV2Effect.h
9
10 Audacity(R) is copyright (c) 1999-2013 Audacity Team.
11 License: GPL v2 or later. See License.txt.
12
13*********************************************************************/
14
15#ifndef __AUDACITY_LV2_INSTANCE__
16#define __AUDACITY_LV2_INSTANCE__
17
18
19#if USE_LV2
20
22#include "LV2Ports.h"
23#include "../PerTrackEffect.h"
24
25class LV2Wrapper;
26
28{
29public:
30 LV2Instance(const PerTrackEffect &effect,
31 const LV2FeaturesList &features, const LV2Ports &ports);
32 ~LV2Instance() override;
33
34 bool IsOk() const { return mFeatures.mOk; }
35
36 const LV2PortStates &GetPortStates() const { return mPortStates; }
37
38 bool ProcessInitialize(EffectSettings &settings, double sampleRate,
39 ChannelNames chanMap) override;
41 const float *const *inBlock, float *const *outBlock, size_t blockLen)
42 override;
44 const EffectSettings &settings, double sampleRate) const override;
45
46 const LV2Wrapper *GetMaster() const { return mMaster.get(); }
47
51 void MakeMaster(const EffectSettings &settings, double sampleRate);
52
53 std::unique_ptr<LV2Wrapper> MakeWrapper(const EffectSettings &settings,
54 double sampleRate, EffectOutputs *pOutputs);
55
56 size_t GetBlockSize() const override;
57 size_t SetBlockSize(size_t maxBlockSize) override;
58
59 unsigned GetAudioInCount() const override;
60 unsigned GetAudioOutCount() const override;
61
62 bool RealtimeInitialize(EffectSettings &settings, double sampleRate)
63 override;
65 unsigned numChannels, float sampleRate) override;
66 bool RealtimeFinalize(EffectSettings &settings) noexcept override;
67 bool RealtimeSuspend() override;
68 bool RealtimeResume() override;
69 bool RealtimeProcessStart(MessagePackage &package) override;
70 size_t RealtimeProcess(size_t group, EffectSettings &settings,
71 const float *const *inbuf, float *const *outbuf, size_t numSamples)
72 override;
73 bool RealtimeProcessEnd(EffectSettings &settings) noexcept override;
74
75private:
79
81 std::unique_ptr<LV2Wrapper> mMaster;
82
84 std::vector<std::unique_ptr<LV2Wrapper>> mSlaves;
85
86 LV2_Atom_Forge mForge{};
87
88 // Position info
89 float mPositionSpeed{ 1.0f };
90 int64_t mPositionFrame{ 0 };
91
93
94 size_t mNumSamples{};
95 bool mRolling{ true };
96 bool mUseLatency{ false };
97};
98
99#endif
100#endif
ChannelName
static Settings & settings()
Definition: TrackInfo.cpp:87
uint64_t SampleCount
Hold values to send to effect output meters.
bool RealtimeSuspend() override
std::vector< std::unique_ptr< LV2Wrapper > > mSlaves
Each holds lv2 library state for realtime processing of one track.
Definition: LV2Instance.h:84
unsigned GetAudioInCount() const override
How many input buffers to allocate at once.
Definition: LV2Instance.cpp:82
LV2InstanceFeaturesList mFeatures
Definition: LV2Instance.h:76
LV2Instance(const PerTrackEffect &effect, const LV2FeaturesList &features, const LV2Ports &ports)
Definition: LV2Instance.cpp:27
std::unique_ptr< LV2Wrapper > mMaster
Holds lv2 library state for destructive processing.
Definition: LV2Instance.h:81
size_t mNumSamples
Definition: LV2Instance.h:94
const LV2PortStates & GetPortStates() const
Definition: LV2Instance.h:36
LV2_Atom_Forge mForge
Definition: LV2Instance.h:86
bool RealtimeInitialize(EffectSettings &settings, double sampleRate) override
const LV2Wrapper * GetMaster() const
Definition: LV2Instance.h:46
float mPositionSpeed
Definition: LV2Instance.h:89
LV2PortStates mPortStates
Definition: LV2Instance.h:78
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
size_t mUserBlockSize
Definition: LV2Instance.h:92
const LV2Ports & mPorts
Definition: LV2Instance.h:77
bool RealtimeResume() override
bool mUseLatency
Definition: LV2Instance.h:96
unsigned GetAudioOutCount() const override
How many output buffers to allocate at once.
Definition: LV2Instance.cpp:87
size_t SetBlockSize(size_t maxBlockSize) override
Definition: LV2Instance.cpp:66
bool mRolling
Definition: LV2Instance.h:95
bool RealtimeAddProcessor(EffectSettings &settings, EffectOutputs *pOutputs, unsigned numChannels, float sampleRate) override
SampleCount GetLatency(const EffectSettings &settings, double sampleRate) const override
Definition: LV2Instance.cpp:92
std::unique_ptr< LV2Wrapper > MakeWrapper(const EffectSettings &settings, double sampleRate, EffectOutputs *pOutputs)
Definition: LV2Instance.cpp:59
~LV2Instance() override
bool IsOk() const
Definition: LV2Instance.h:34
void MakeMaster(const EffectSettings &settings, double sampleRate)
Definition: LV2Instance.cpp:44
bool RealtimeProcessStart(MessagePackage &package) override
settings are possibly changed, since last call, by an asynchronous dialog
size_t GetBlockSize() const override
Definition: LV2Instance.cpp:77
bool RealtimeProcessEnd(EffectSettings &settings) noexcept override
settings can be updated to let a dialog change appearance at idle
int64_t mPositionFrame
Definition: LV2Instance.h:90
size_t ProcessBlock(EffectSettings &settings, const float *const *inBlock, float *const *outBlock, size_t blockLen) override
Called for destructive effect computation.
Manager of a handle to an LV2 plug-in instantiation.
Definition: LV2Wrapper.h:45
Base class for many of the effects in Audacity.
Externalized state of a plug-in.