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, const WideSampleSequence &sequence, std::optional< sampleCount > genLength, int channel)
 

Function Documentation

◆ MakeInstances()

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

Definition at line 21 of file EffectStage.cpp.

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

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

Here is the call graph for this function: