27#include <wx/stattext.h>
34#include "../widgets/NumericTextCtrl.h"
35#include "../widgets/valnum.h"
58 Parameters().Reset(*
this);
59 SetLinearEffectFlag(
true);
75 return XO(
"Repeats the selection the specified number of times");
99 bool bGoodResult =
true;
100 double maxDestLen = 0.0;
102 outputs.Get().Any().VisitWhile(bGoodResult,
110 [&](
auto &&fallthrough){
return [&](
WaveTrack &track) {
112 return fallthrough();
113 auto start = track.TimeToLongSamples(
mT0);
114 auto end = track.TimeToLongSamples(
mT1);
115 auto len =
end - start;
116 const double tLen = track.LongSamplesToTime(len);
117 const double tc =
mT0 + tLen;
123 std::static_pointer_cast<WaveTrack>(track.
Copy(
mT0,
mT1));
132 track.
Paste(t0, *firstTemp);
138 const auto compareIntervals = [](
const auto& a,
const auto& b) {
139 return a->Start() < b->Start();
142 const auto eps = 0.5 / track.GetRate();
143 auto sortedIntervals = std::vector(
147 auto sourceIntervals = std::vector(
148 firstTemp->Intervals().begin(),
149 firstTemp->Intervals().end()
151 std::sort(sortedIntervals.begin(), sortedIntervals.end(), compareIntervals);
152 std::sort(sourceIntervals.begin(), sourceIntervals.end(), compareIntervals);
153 for (
auto it = sortedIntervals.begin(); it != sortedIntervals.end(); ++it)
155 const auto& interval = *it;
157 if (std::abs((*it)->GetPlayStartTime() - tc) > eps)
163 for (
const auto& src : sourceIntervals)
165 if(it == sortedIntervals.end())
167 (*it++)->SetName(src->GetName());
197 S.StartHorizontalLay(wxCENTER,
false);
202 .AddTextBox(
XXO(
"&Number of repeats to add:"), L
"", 12);
204 S.EndHorizontalLay();
206 S.StartMultiColumn(1, wxCENTER);
209 XO(
"Current selection length: dd:hh:mm:ss"));
210 mTotalTime =
S.AddVariableText(
XO(
"New selection length: dd:hh:mm:ss"));
252 str = wxString::Format(
_(
"Current selection length: %s"), nc.
GetString() );
262 str = wxString::Format(
_(
"New selection length: %s"), nc.
GetString() );
265 str =
_(
"Warning: No repeats.");
XXO("&Cut/Copy/Paste Toolbar")
const NumericConverterType & NumericConverterType_TIME()
Generates EffectParameterMethods overrides from variadic template arguments.
IteratorRange< IntervalIterator< IntervalType > > Intervals()
Get range of intervals with mutative access.
ComponentInterfaceSymbol pairs a persistent string identifier used internally with an optional,...
std::shared_ptr< TrackList > mTracks
static bool EnableApply(wxWindow *parent, bool enable=true)
Enable or disable the Apply button of the dialog that contains parent.
virtual NumericFormatID GetSelectionFormat()
bool TrackProgress(int whichTrack, double frac, const TranslatableString &={}) const
Performs effect computation.
Use this object to copy the input tracks to tentative outputTracks.
Hold values to send to effect output meters.
Interface for manipulations of an Effect's settings.
An Effect that repeats audio several times over.
ComponentInterfaceSymbol GetSymbol() const override
wxStaticText * mTotalTime
wxWeakRef< wxWindow > mUIParent
bool NeedsDither() const override
bool Process(EffectInstance &instance, EffectSettings &settings) override
static const ComponentInterfaceSymbol Symbol
const EffectParameterMethods & Parameters() const override
wxTextCtrl * mRepeatCount
std::unique_ptr< EffectEditor > PopulateOrExchange(ShuttleGui &S, EffectInstance &instance, EffectSettingsAccess &access, const EffectOutputs *pOutputs) override
Add controls to effect panel; always succeeds.
bool TransferDataToWindow(const EffectSettings &settings) override
TranslatableString GetDescription() const override
ManualPageID ManualPage() const override
Name of a page in the Audacity alpha manual, default is empty.
void OnRepeatTextChange(wxCommandEvent &evt)
static constexpr EffectParameter Count
bool TransferDataFromWindow(EffectSettings &settings) override
EffectType GetType() const override
Type determines how it behaves.
wxStaticText * mCurrentTime
static FormatterContext SampleRateContext(double sampleRate)
A LabelTrack is a Track that holds labels (LabelStruct).
bool Repeat(double t0, double t1, int n)
void Paste(double t, const Track &src) override
Weak precondition allows overrides to replicate one channel into many.
Track::Holder Copy(double t0, double t1, bool forClipboard=true) const override
Create new tracks and don't modify this track.
NumericConverter provides the advanced formatting control used in the selection bar of Audacity.
void SetValue(double newValue)
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
static bool IsSelectedOrSyncLockSelected(const Track &track)
static bool IsSyncLockSelected(const Track &track)
Abstract base class for an object holding data associated with points on a time axis.
bool GetSelected() const
Selectedness is always the same for all channels of a group.
Holds a msgid for the translation catalog; may also bind format arguments.
A Track that contains audio waveform data.
BuiltinEffectsModule::Registration< EffectRepeat > reg
const char * end(const char *str) noexcept
const Type min
Minimum value.
Externalized state of a plug-in.