Audacity 3.2.0
Functions
anonymous_namespace{EffectStage.cpp} Namespace Reference

Functions

std::vector< std::shared_ptr< EffectInstance > > MakeInstances (const EffectStage::Factory &factory, EffectSettings &settings, double sampleRate, std::optional< sampleCount > genLength, int channel, int nInputChannels)
 

Function Documentation

◆ MakeInstances()

std::vector< std::shared_ptr< EffectInstance > > anonymous_namespace{EffectStage.cpp}::MakeInstances ( const EffectStage::Factory factory,
EffectSettings settings,
double  sampleRate,
std::optional< sampleCount genLength,
int  channel,
int  nInputChannels 
)

Definition at line 20 of file EffectStage.cpp.

24{
25 std::vector<std::shared_ptr<EffectInstance>> instances;
26 // Make as many instances as needed for the channels of the source, which
27 // depends on how the instances report how many channels they accept
28 const auto nChannels = (channel < 0) ? nInputChannels : 1;
29 for (size_t ii = 0; ii < nChannels;)
30 {
31 auto pInstance = factory();
32 if (!pInstance)
33 // A constructor that can't satisfy its post should throw instead
34 throw std::exception{};
35 auto count = pInstance->GetAudioInCount();
37 MakeChannelMap(nInputChannels, channel, map);
38 // Give the plugin a chance to initialize
39 if (!pInstance->ProcessInitialize(settings, sampleRate, map))
40 throw std::exception{};
41 instances.resize(ii);
42
43 // Beware generators with zero in count
44 if (genLength)
45 count = nChannels;
46
47 instances.push_back(move(pInstance));
48
49 // Advance ii
50 if (count == 0)
51 // What? Can't make progress
52 throw std::exception();
53 ii += count;
54 }
55 return instances;
56}
static RegisteredToolbarFactory factory
ChannelName
@ ChannelNameEOL
unsigned MakeChannelMap(int nChannels, int channel, ChannelName map[3])
static Settings & settings()
Definition: TrackInfo.cpp:51

References ChannelNameEOL, factory, MakeChannelMap(), anonymous_namespace{ClipSegmentTest.cpp}::sampleRate, and settings().

Here is the call graph for this function: