27#include <wx/stattext.h>
29#include "../LabelTrack.h"
33#include "../widgets/NumericTextCtrl.h"
34#include "../widgets/valnum.h"
57 Parameters().Reset(*
this);
58 SetLinearEffectFlag(
true);
74 return XO(
"Repeats the selection the specified number of times");
98 bool bGoodResult =
true;
99 double maxDestLen = 0.0;
101 outputs.Get().Any().VisitWhile(bGoodResult,
109 [&](
auto &&fallthrough){
return [&](
WaveTrack &track) {
111 return fallthrough();
112 auto start = track.TimeToLongSamples(
mT0);
113 auto end = track.TimeToLongSamples(
mT1);
114 auto len =
end - start;
115 const double tLen = track.LongSamplesToTime(len);
116 const double tc =
mT0 + tLen;
133 track.
Paste(t0, *firstTemp);
139 const auto compareIntervals = [](
const auto& a,
const auto& b) {
140 return a->Start() < b->Start();
143 const auto eps = 0.5 / track.GetRate();
144 auto sortedIntervals = std::vector(
148 auto sourceIntervals = std::vector(
149 firstTemp->Intervals().begin(),
150 firstTemp->Intervals().end()
152 std::sort(sortedIntervals.begin(), sortedIntervals.end(), compareIntervals);
153 std::sort(sourceIntervals.begin(), sourceIntervals.end(), compareIntervals);
154 for (
auto it = sortedIntervals.begin(); it != sortedIntervals.end(); ++it)
156 const auto& interval = *it;
158 if (std::abs((*it)->GetPlayStartTime() - tc) > eps)
164 for (
const auto& src : sourceIntervals)
166 if(it == sortedIntervals.end())
168 (*it++)->SetName(src->GetName());
198 S.StartHorizontalLay(wxCENTER,
false);
203 .AddTextBox(
XXO(
"&Number of repeats to add:"), L
"", 12);
205 S.EndHorizontalLay();
207 S.StartMultiColumn(1, wxCENTER);
210 XO(
"Current selection length: dd:hh:mm:ss"));
211 mTotalTime =
S.AddVariableText(
XO(
"New selection length: dd:hh:mm:ss"));
253 str = wxString::Format(
_(
"Current selection length: %s"), nc.
GetString() );
263 str = wxString::Format(
_(
"New selection length: %s"), nc.
GetString() );
266 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)
TrackListHolder Copy(double t0, double t1, bool forClipboard=true) const override
Create new tracks and don't modify this track.
void Paste(double t, const Track &src) override
Weak precondition allows overrides to replicate one channel into many.
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 *pTrack)
static bool IsSyncLockSelected(const Track *pTrack)
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.
auto end(const Ptr< Type, BaseDeleter > &p)
Enables range-for.
auto begin(const Ptr< Type, BaseDeleter > &p)
Enables range-for.
BuiltinEffectsModule::Registration< EffectRepeat > reg
const Type min
Minimum value.
Externalized state of a plug-in.