28{
XO(
"Stereo To Mono") };
49 return XO(
"Converts stereo tracks to mono");
82 bool bGoodResult =
true;
88 while (trackRange.first != trackRange.second)
90 auto left = *trackRange.first;
92 if (channels.size() > 1)
94 auto right = *channels.rbegin();
95 auto leftRate = left->GetRate();
96 auto rightRate = right->GetRate();
98 if (leftRate != rightRate)
114 auto start = wxMin(left->TimeToLongSamples(left->GetStartTime()),
115 right->TimeToLongSamples(right->GetStartTime()));
116 auto end = wxMax(left->TimeToLongSamples(left->GetEndTime()),
117 right->TimeToLongSamples(right->GetEndTime()));
119 totalTime += (
end - start);
128 bool refreshIter =
false;
133 while (trackRange.first != trackRange.second)
135 auto left = *trackRange.first;
137 if (channels.size() > 1)
139 auto right = *channels.rbegin();
141 bGoodResult =
ProcessOne(curTime, totalTime, left, right);
176 for (
auto pTrack : { left, right })
180 Mixer mixer(move(tracks),
195 while (
auto blockLen = mixer.Process()) {
196 auto buffer = mixer.GetBuffer();
197 for (
auto i = 0; i < blockLen; i++)
199 ((
float *)buffer)[i] /= 2.0;
206 outTrack->Append(buffer,
floatSample, blockLen, 1);
218 left->
Paste(minStart, outTrack.get());
std::vector< MixerOptions::StageSpecification > GetEffectStages(const WaveTrack &track)
virtual void SetMessage(const TranslatableString &message)=0
Change an existing dialog's message.
ComponentInterfaceSymbol pairs a persistent string identifier used internally with an optional,...
std::shared_ptr< TrackList > mOutputTracks
const TrackList * inputTracks() const
BasicUI::ProgressDialog * mProgress
void ReplaceProcessedTracks(const bool bGoodResult)
void CopyInputTracks(bool allSyncLockSelected=false)
bool TotalProgress(double frac, const TranslatableString &={}) const
Performs effect computation.
unsigned GetAudioOutCount() const override
How many output buffers to allocate at once.
bool IsInteractive() const override
Whether the effect needs a dialog for entry of settings.
unsigned GetAudioInCount() const override
How many input buffers to allocate at once.
ComponentInterfaceSymbol GetSymbol() const override
static const ComponentInterfaceSymbol Symbol
bool Process(EffectInstance &instance, EffectSettings &settings) override
TranslatableString GetDescription() const override
bool ProcessOne(sampleCount &curTime, sampleCount totalTime, WaveTrack *left, WaveTrack *right)
bool IsHiddenFromMenus() const override
Default is false.
EffectType GetType() const override
Type determines how it behaves.
virtual ~EffectStereoToMono()
Functions for doing the mixdown of the tracks.
std::vector< Input > Inputs
static RealtimeEffectList & Get(AudacityProject &project)
void Clear()
Use only in the main thread. Sends Remove messages.
static auto Channels(TrackType *pTrack) -> TrackIterRange< TrackType >
Holds a msgid for the translation catalog; may also bind format arguments.
A Track that contains audio waveform data.
void Paste(double t0, const Track *src) override
double GetStartTime() const override
Get the time at which the first clip in the track starts.
size_t GetMaxBlockSize() const override
This returns a nonnegative number of samples meant to size a memory buffer.
void Clear(double t0, double t1) override
double GetEndTime() const override
Get the time at which the last clip in the track ends, plus recorded stuff.
double GetRate() const override
Holder EmptyCopy(const SampleBlockFactoryPtr &pFactory={}, bool keepLink=true) const
Positions or offsets within audio files need a wide type.
auto end(const Ptr< Type, BaseDeleter > &p)
Enables range-for.
BuiltinEffectsModule::Registration< EffectStereoToMono > reg
Externalized state of a plug-in.
Immutable structure is an argument to Mixer's constructor.