102 return GetClip().SamplesToTime(s);
116 sampleCount start,
size_t len,
bool mayThrow)
const
122 sampleCount start,
size_t length,
bool mayThrow)
const
150std::pair<float, float>
175 buffer,
format, start, len, effectiveFormat);
231 pSequence = std::make_unique<Sequence>(
factory,
234 mEnvelope = std::make_unique<Envelope>(
true, 1e-7, 2.0, 1.0);
241 : mCentShift { orig.mCentShift }
242 , mPitchAndSpeedPreset { orig.mPitchAndSpeedPreset }
243 , mClipStretchRatio { orig.mClipStretchRatio }
244 , mRawAudioTempo { orig.mRawAudioTempo }
245 , mProjectTempo { orig.mProjectTempo }
272 std::make_shared<WaveClip>(*clip,
factory,
true, token));
283 bool copyCutlines,
double t0,
double t1)
284 : mCentShift { orig.mCentShift }
285 , mClipStretchRatio { orig.mClipStretchRatio }
286 , mRawAudioTempo { orig.mRawAudioTempo }
287 , mProjectTempo { orig.mProjectTempo }
321 std::make_unique<Sequence>(*pSequence,
factory));
326 for (
const auto &cutline : orig.
mCutLines)
328 std::make_shared<WaveClip>(*cutline,
factory,
true));
352 return std::make_shared<Channel>(*
this,
iChannel);
356 size_t ii,
sampleCount start,
size_t length,
bool mayThrow)
const
364 size_t iChannel,
double t0,
double t1,
bool mayThrow)
const
380 sampleCount start,
size_t len,
bool mayThrow)
const
388 sampleCount start,
size_t len,
bool mayThrow)
const
391 for (
size_t ii = 0, width =
NChannels(); result && ii < width; ++ii)
436 pCutline->DiscardRightChannel();
449 pCutline->SwapChannels();
465 auto beginMe = myCutlines.begin(),
466 endMe = myCutlines.end();
467 auto iterNew = newCutlines.begin(),
468 endNew = newCutlines.end();
469 for_each(beginMe, endMe, [&](
const auto &myCutline){
470 assert(iterNew != endNew);
471 const auto pNew = *iterNew;
477 assert(iterNew == endNew);
486 auto result = std::make_shared<WaveClip>(*
this,
GetFactory(),
true, token);
501 assert(result->CheckInvariants());
508 assert(result->NChannels() == 1);
515 assert(other.NChannels() == 1);
518 assert(!mustAlign ||
GetNumSamples() == other.GetNumSamples());
524 this->Attachments::ForCorresponding(other,
527 assert(pLeft && pRight);
528 pLeft->
MakeStereo(std::move(*pRight), mustAlign);
546 const std::optional<double>& oldTempo,
double newTempo)
555 if (oldTempo.has_value())
557 const auto ratioChange = *oldTempo / newTempo;
575 const auto newPlayDuration = pet - to;
576 const auto ratioChange = newPlayDuration / oldPlayDuration;
594 const auto newPlayDuration = to - pst;
595 const auto ratioChange = newPlayDuration / oldPlayDuration;
617 cutline->mSequenceOffset *= ratioChange;
618 cutline->mTrimLeft *= ratioChange;
619 cutline->mTrimRight *= ratioChange;
620 cutline->mClipStretchRatio *= ratioChange;
621 cutline->mEnvelope->RescaleTimesBy(ratioChange);
627 const auto dstSrcRatio =
644 return const_cast<WaveClip*
>(
this)->
654 return const_cast<WaveClip*
>(
this)->
683 result = std::max(result, pSequence->GetNumSamples());
696 [](
size_t acc,
auto &pSequence){
697 return acc + pSequence->GetBlockArray().size(); });
709 [](
size_t acc,
auto &pSequence){
710 return std::max(acc, pSequence->GetMaxBlockSize()); });
724 newSequences.push_back(std::make_unique<Sequence>(
725 pSequence->GetFactory(), pSequence->GetSampleFormats()));
741 double t0,
double t1,
bool mayThrow)
const
761 return mSequences[ii]->GetMinMax(s0, s1 - s0, mayThrow);
779 return mSequences[ii]->GetRMS(s0, s1-s0, mayThrow);
783 const std::function<
void(
size_t)> & progressReport)
793 auto bChanged =
mSequences[0]->ConvertToSampleFormat(
format, progressReport);
794 for (
size_t ii = 1, width =
NChannels(); ii < width; ++ii) {
798 assert(bChanged == alsoChanged);
803 transaction.Commit();
816std::shared_ptr<SampleBlock>
825std::shared_ptr<SampleBlock>
836 const std::shared_ptr<SampleBlock> &pBlock)
846 size_t len,
unsigned int stride,
sampleFormat effectiveFormat)
856 bool appended =
false;
857 for (
size_t ii = 0; ii < nChannels; ++ii)
859 buffers[ii],
format, len, stride, effectiveFormat)
870 size_t len,
unsigned int stride,
sampleFormat effectiveFormat)
879 bool appended =
false;
882 pSequence->Append(buffers[ii++],
format, len, stride, effectiveFormat)
931 const auto numSamples = pSequence->GetNumSamples();
932 if (pSequence->GetNumSamples() != maxSamples)
933 pSequence->InsertSilence(numSamples, maxSamples - numSamples);
935 transaction.Commit();
953 for (
auto pair : attrs)
955 auto attr = pair.first;
956 auto value = pair.second;
960 if (!value.TryGet(dblValue))
966 if (!value.TryGet(dblValue))
972 if (!value.TryGet(dblValue))
978 if (!value.TryGet(dblValue))
984 if (!value.TryGet(longValue))
990 if (!value.TryGet(dblValue))
999 if (!value.TryGet(dblValue))
1005 if(value.IsStringView())
1008 else if (Attachments::FindIf(
1041 mSequences.push_back(std::make_unique<Sequence>(
1042 pFirst->GetFactory(), pFirst->GetSampleFormats()));
1045 else if (tag ==
"envelope")
1050 auto format = pFirst->GetSampleFormats().Stored();
1055 std::make_shared<WaveClip>(
1058 1, pFirst->GetFactory(),
1069 assert(ii < NChannels());
1076 xmlFile.StartTag(WaveClip_tag);
1077 xmlFile.WriteAttr(
Offset_attr, mSequenceOffset, 8);
1082 static_cast<long>(mPitchAndSpeedPreset));
1090 mSequences[ii]->WriteXML(xmlFile);
1091 mEnvelope->WriteXML(xmlFile);
1093 for (
const auto &clip: mCutLines)
1094 clip->WriteXML(ii, xmlFile);
1096 xmlFile.EndTag(WaveClip_tag);
1107 dup = std::make_shared<WaveClip>(o, o.
GetFactory(),
true);
1108 dup->RepairChannels();
1111 auto &other = *pOther;
1132 const bool clipNeedsResampling = other.mRate !=
mRate;
1133 const bool clipNeedsNewFormat =
1135 std::shared_ptr<WaveClip> newClip;
1148 auto copy = std::make_shared<WaveClip>(other,
factory,
true);
1149 copy->ClearSequence(
copy->GetPlayEndTime(),
copy->GetSequenceEndTime())
1151 newClip = std::move(
copy);
1158 auto copy = std::make_shared<WaveClip>(other,
factory,
true);
1159 copy->ClearSequence(
copy->GetSequenceStartTime(),
copy->GetPlayStartTime())
1161 newClip = std::move(
copy);
1165 newClip = std::make_shared<WaveClip>(other,
factory,
true);
1166 newClip->ClearSequence(newClip->GetPlayEndTime(), newClip->GetSequenceEndTime())
1168 newClip->ClearSequence(newClip->GetSequenceStartTime(), newClip->GetPlayStartTime())
1170 newClip->SetTrimLeft(0);
1171 newClip->SetTrimRight(0);
1174 if (clipNeedsResampling || clipNeedsNewFormat)
1176 auto copy = std::make_shared<WaveClip>(*newClip.get(),
factory,
true);
1178 if (clipNeedsResampling)
1182 if (clipNeedsNewFormat)
1185 newClip = std::move(
copy);
1190 for (
const auto &cutline: newClip->mCutLines)
1192 auto cutlineCopy = std::make_shared<WaveClip>(*cutline,
factory,
1197 newCutlines.push_back(std::move(cutlineCopy));
1203 assert(other.NChannels() == newClip->NChannels());
1206 for (
size_t ii = 0, width =
NChannels(); ii < width; ++ii)
1212 transaction.Commit();
1215 const auto sampleTime = 1.0 /
GetRate();
1216 const auto timeOffsetInEnvelope =
1219 timeOffsetInEnvelope, newClip->mEnvelope.get(), sampleTime);
1220 OffsetCutLines(t0, newClip->GetPlayEndTime() - newClip->GetPlayStartTime());
1222 for (
auto &holder : newCutlines)
1247 pSequence->InsertSilence(s0, slen);
1251 transaction.Commit();
1255 const auto sampleTime = 1.0 /
GetRate();
1257 if ( pEnvelopeValue ) {
1260 auto oldLen = envelope.GetTrackLen();
1261 auto newLen = oldLen + len;
1262 envelope.Cap( sampleTime );
1265 envelope.SetTrackLen( newLen, sampleTime );
1266 envelope.InsertOrReplace
1267 ( envelope.GetOffset() + newLen, *pEnvelopeValue );
1270 envelope.InsertSpace( t, len );
1303 transaction.Commit();
1317 transaction.Commit();
1331 transaction.Commit();
1341 auto clip_t0 = std::max(t0, GetSequenceStartTime());
1342 auto clip_t1 =
std::min(t1, GetSequenceEndTime());
1344 auto s0 = TimeToSequenceSamples(clip_t0);
1345 auto s1 = TimeToSequenceSamples(clip_t1);
1351 for (
auto &pSequence : mSequences)
1352 pSequence->Delete(s0, s1 - s0);
1354 return {
this, t0, t1, clip_t0, clip_t1 };
1381 double cutlinePosition =
1383 if (cutlinePosition >=
t0 && cutlinePosition <=
t1)
1390 if (cutlinePosition >=
t1)
1417 auto newClip = std::make_shared<WaveClip>(
1418 *
this,
GetFactory(),
true, clip_t0, clip_t1);
1421 newClip->ClearSequence(t1, newClip->GetSequenceEndTime())
1423 newClip->SetTrimRight(.0);
1427 newClip->ClearSequence(newClip->GetSequenceStartTime(), t0)
1429 newClip->SetTrimLeft(.0);
1441 if (cutlinePosition >= t0 && cutlinePosition <= t1)
1445 if (cutlinePosition >= t1)
1447 clip->
ShiftBy(clip_t0 - clip_t1);
1459 pSequence->Delete(s0, s1-s0);
1462 auto sampleTime = 1.0 /
GetRate();
1465 transaction.Commit();
1472 assert(
NChannels() == pClip->NChannels());
1479 double* cutlineStart ,
1480 double* cutlineEnd )
const
1488 *cutlineStart = startTime;
1490 *cutlineEnd = startTime + cutline->SamplesToTime(cutline->GetVisibleSampleCount());
1504 return fabs(GetSequenceStartTime() + cutline->GetSequenceStartTime() - cutLinePosition) < 0.0001;
1508 auto *cutline = it->get();
1513 cutline->mEnvelope->SetOffset(0);
1514 bool success =
Paste(
1537 const auto &cutline = *it;
1555 cutLine->ShiftBy(len);
1563 pSequence->CloseLock();
1565 cutline->CloseLock();
1572 auto ratio =
static_cast<double>(
mRate) / rate;
1576 const auto newLength =
1624 double factor = (double)rate / (
double)
mRate;
1627 std::vector<::Resample> resample;
1628 for (
unsigned n = 0; n <
mSequences.size(); ++n)
1629 resample.emplace_back(
true, factor, factor);
1631 const size_t bufsize = 65536;
1632 Floats inBuffer{ bufsize };
1633 Floats outBuffer{ bufsize };
1636 int outGenerated = 0;
1647 while (pos < numSamples || outGenerated > 0) {
1650 bool isLast = ((pos + inLen) == numSamples);
1652 auto ppNewSequence = newSequences.begin();
1653 std::optional<std::pair<size_t, size_t>> results{};
1654 size_t nSequence = 0;
1656 auto &pNewSequence = *ppNewSequence++;
1667 auto newResults = resample[nSequence].Process(factor, inBuffer.get(), inLen,
1668 isLast, outBuffer.get(), bufsize);
1670 results.emplace(newResults);
1671 else if (*results != newResults) {
1676 outGenerated = results->second;
1677 if (outGenerated < 0) {
1689 pos += results->first;
1693 auto updateResult = progress->
Poll(
1695 numSamples.as_long_long()
1706 XO(
"Resampling failed."),
1752 pSequence->SetSilence(start, length);
1854 const auto quantizedTrim =
1987 auto &pFirst = *iter++;
1992 std::all_of(iter,
end, [&](
decltype(pFirst) pSequence) {
1994 pSequence->GetSampleFormats() == pFirst->GetSampleFormats() &&
1995 pSequence->GetFactory() == pFirst->GetFactory();
2000 if (!(pCutLine && pCutLine->NChannels() == width))
2002 if (!pCutLine->StrongInvariant()) {
2003 pCutLine->AssertOrRepairStrongInvariant();
2020 assert(iter !=
end);
2021 auto &pFirst = *iter++;
2024 return all_of(iter,
end, [&](
decltype(pFirst) pSequence) {
2026 return pSequence->GetNumSamples() == pFirst->GetNumSamples();
2047 assert(mClip.StrongInvariant());
2060 std::make_unique<Sequence>(*pSequence,
factory));
2066 clip.mSequences.swap(sequences);
@ Internal
Indicates internal failure from Audacity.
Toolkit-neutral facade for basic user interface services.
MessageBoxException for violation of preconditions or assertions.
#define THROW_INCONSISTENCY_EXCEPTION
Throw InconsistencyException, using C++ preprocessor to identify the source code location.
std::shared_ptr< SampleBlockFactory > SampleBlockFactoryPtr
size_t limitSampleBufferSize(size_t bufferSize, sampleCount limit)
An AudacityException with no visible message.
static constexpr auto TrimRight_attr
static constexpr auto RawAudioTempo_attr
static constexpr auto ClipStretchRatio_attr
static constexpr auto Name_attr
static constexpr auto CentShiftAttr
static constexpr auto Offset_attr
static constexpr auto TrimLeft_attr
static constexpr auto PitchAndSpeedPreset_attr
std::shared_ptr< WaveClip > WaveClipHolder
std::vector< WaveClipHolder > WaveClipHolders
std::vector< Attribute > AttributesList
Abstraction of a progress dialog with well defined time-to-completion estimate.
virtual ProgressResult Poll(unsigned long long numerator, unsigned long long denominator, const TranslatableString &message={})=0
Update the bar and poll for clicks. Call only on the main thread.
Piecewise linear or piecewise exponential function from double to double.
void CollapseRegion(double t0, double t1, double sampleDur) noexcept
An object that sends messages to an open-ended list of subscribed callbacks.
CallbackReturn Publish(const Message &message)
Send a message to connected callbacks.
A move-only handle representing a connection to a Publisher.
A WaveTrack contains WaveClip(s). A WaveClip contains a Sequence. A Sequence is primarily an interfac...
static const char * Sequence_tag
A MessageBoxException that shows a given, unvarying string.
static constexpr auto MaxCents
static constexpr auto MinCents
static bool IsPassThroughMode(double stretchRatio)
Can be thrown when user cancels operations, as with a progress dialog. Delayed handler does nothing.
Fix consistency of cutlines and envelope after deleting from Sequences.
~ClearSequenceFinisher() noexcept
const BlockArray * GetSequenceBlockArray() const
sampleCount GetPlayEndSample() const
Real end time of the clip, quantized to raw sample rate (track's rate)
void WriteXML(XMLWriter &xmlFile) const
sampleCount GetVisibleSampleCount() const override
std::pair< float, float > GetMinMax(double t0, double t1, bool mayThrow) const
double SamplesToTime(sampleCount s) const noexcept
double GetPlayEndTime() const override
double GetTrimRight() const
constSamplePtr GetAppendBuffer() const
void SetSamples(constSamplePtr buffer, sampleFormat format, sampleCount start, size_t len, sampleFormat effectiveFormat)
int GetRate() const override
~WaveClipChannel() override
double GetTrimLeft() const
double GetPlayStartTime() const override
bool HasPitchOrSpeed() const
bool Intersects(double t0, double t1) const
const Sequence & GetSequence() const
double GetStretchRatio() const override
AudioSegmentSampleView GetSampleView(double t0, double t1, bool mayThrow) const
Request interval samples within [t0, t1). t0 and t1 are truncated to the interval start and end....
sampleCount TimeToSamples(double time) const override
sampleCount GetPlayStartSample() const
Real start time of the clip, quantized to raw sample rate (track's rate)
bool GetSamples(samplePtr buffer, sampleFormat format, sampleCount start, size_t len, bool mayThrow=true) const
double GetPlayDuration() const
float GetRMS(double t0, double t1, bool mayThrow) const
size_t GetAppendBufferLen() const
bool WithinPlayRegion(double t) const
t ∈ [...)
This allows multiple clips to be a part of one WaveTrack.
bool WithinPlayRegion(double t) const
t ∈ [...)
std::shared_ptr< SampleBlock > AppendLegacyNewBlock(constSamplePtr buffer, sampleFormat format, size_t len)
int GetCentShift() const override
PitchAndSpeedPreset mPitchAndSpeedPreset
std::optional< double > mRawAudioTempo
std::vector< std::unique_ptr< Sequence > > GetEmptySequenceCopies() const
bool SetCentShift(int cents)
bool HasPitchOrSpeed() const
void ClearRight(double t)
bool CoversEntirePlayRegion(double t0, double t1) const
t0 <= [ and ) <= t1, such that removing [t0, t1) from the track deletes this clip.
double GetStretchRatio() const override
double GetSequenceStartTime() const noexcept
bool CheckInvariants() const
Check weak invariant conditions on mSequences and mCutlines.
Site< WaveClip, WaveClipListener, ClientData::DeepCopying > Attachments
void SetPlayStartTime(double time)
size_t GetMaxBlockSize() const
virtual Observer::Subscription SubscribeToPitchAndSpeedPresetChange(std::function< void(PitchAndSpeedPreset)> cb) const override
void SetSequenceStartTime(double startTime)
void SetEnvelope(std::unique_ptr< Envelope > p)
void CloseLock() noexcept
Should be called upon project close. Not balanced by unlocking calls.
size_t CountBlocks() const
void SetName(const wxString &name)
sampleCount TimeToSamples(double time) const override
bool RemoveCutLine(double cutLinePosition)
Remove cut line, without expanding the audio in it.
sampleCount TimeToSequenceSamples(double t) const
PitchAndSpeedPreset GetPitchAndSpeedPreset() const
bool StretchRatioEquals(double value) const
double Start() const override
std::shared_ptr< ChannelInterval > DoGetChannel(size_t iChannel) override
Retrieve a channel.
void ShiftBy(double delta) noexcept
std::unique_ptr< Envelope > mEnvelope
Envelope is unique, not per-sequence, and always non-null.
sampleCount GetVisibleSampleCount() const override
double End() const override
double GetTrimRight() const noexcept
Returns the play end offset in seconds from the ending of the underlying sequence.
double GetPlayStartTime() const noexcept override
std::optional< double > mProjectTempo
bool AtOrBeforePlayRegion(double t) const
t <= [
Observer::Subscription SubscribeToCentShiftChange(std::function< void(int)> cb) const override
int GetRate() const override
int mRate
Sample rate of the raw audio, i.e., before stretching.
double GetTrimLeft() const noexcept
Returns the play start offset in seconds from the beginning of the underlying sequence.
XMLTagHandler * HandleXMLChild(const std::string_view &tag) override
ClearSequenceFinisher ClearSequence(double t0, double t1)
void AppendLegacySharedBlock(const std::shared_ptr< SampleBlock > &pBlock)
sampleCount CountSamples(double t0, double t1) const
sampleCount GetPlayEndSample() const
Real end time of the clip, quantized to raw sample rate (track's rate)
constSamplePtr GetAppendBuffer(size_t ii) const
Get one channel of the append buffer.
double GetPlayEndTime() const override
const wxString & GetName() const
std::shared_ptr< SampleBlock > AppendToChannel(size_t iChannel, constSamplePtr buffer, sampleFormat format, size_t len)
void Resample(int rate, BasicUI::ProgressDialog *progress=nullptr)
void TrimLeftTo(double to)
Sets the the left trimming to the absolute time (if that is in bounds)
sampleCount GetPlayStartSample() const
Real start time of the clip, quantized to raw sample rate (track's rate)
void AppendSilence(double len, double envelopeValue)
bool FindCutLine(double cutLinePosition, double *cutLineStart=nullptr, double *cutLineEnd=nullptr) const
void WriteXML(size_t ii, XMLWriter &xmlFile) const
void RepairChannels()
Ensure that all sequences have the same sample count.
SampleFormats GetSampleFormats() const
sampleCount GetSequenceStartSample() const
Returns the index of the first sample of the underlying sequence.
void OnProjectTempoChange(const std::optional< double > &oldTempo, double newTempo)
bool GetIsPlaceholder() const
void HandleXMLEndTag(const std::string_view &tag) override
void InsertSilence(double t, double len, double *pEnvelopeValue=nullptr)
bool HandleXMLTag(const std::string_view &tag, const AttributesList &attrs) override
void TrimQuarternotesFromRight(double quarters)
Same as TrimRight, but expressed as quarter notes.
void AssertOrRepairStrongInvariant()
void SetPitchAndSpeedPreset(PitchAndSpeedPreset preset)
void SetSilence(sampleCount offset, sampleCount length)
Silences the 'length' amount of samples starting from 'offset'(relative to the play start)
bool BeforePlayRegion(double t) const
t < [
void SetSamples(size_t ii, constSamplePtr buffer, sampleFormat format, sampleCount start, size_t len, sampleFormat effectiveFormat)
Envelope & GetEnvelope() noexcept
void TrimRightTo(double to)
Sets the the right trimming to the absolute time (if that is in bounds)
bool SplitsPlayRegion(double t) const
[ < t and t < ), such that if the track were split at t, it would split this clip in two of lengths >...
bool GetSamples(size_t ii, samplePtr buffer, sampleFormat format, sampleCount start, size_t len, bool mayThrow=true) const
Get samples from one channel.
float GetRMS(size_t ii, double t0, double t1, bool mayThrow) const
double SnapToTrackSample(double time) const noexcept
void StretchRightTo(double to)
Sets from the right to the absolute time (if in expected range)
bool EntirelyWithinPlayRegion(double t0, double t1) const
t0 and t1 both ∈ [...)
void OffsetCutLines(double t0, double len)
Offset cutlines right to time 't0' by time amount 'len'.
void SetTrimRight(double trim)
Sets the play end offset in seconds from the ending of the underlying sequence.
std::shared_ptr< WaveClip > SplitChannels()
std::pair< float, float > GetMinMax(size_t ii, double t0, double t1, bool mayThrow) const
void TrimRight(double deltaTime)
Moves play end position by deltaTime.
bool AfterPlayRegion(double t) const
) <= t
size_t GetAppendBufferLen(size_t ii) const
size_t GetBestBlockSize(sampleCount t) const
A hint for sizing of well aligned fetches.
double SamplesToTime(sampleCount s) const noexcept
static void FixSplitCutlines(WaveClipHolders &myCutlines, WaveClipHolders &newCutlines)
const BlockArray * GetSequenceBlockArray(size_t ii) const
sampleCount GetSequenceSamplesCount() const
void SetRawAudioTempo(double tempo)
size_t GreatestAppendBufferLen() const
void ExpandCutLine(double cutLinePosition)
void ConvertToSampleFormat(sampleFormat format, const std::function< void(size_t)> &progressReport={})
const SampleBlockFactoryPtr & GetFactory() const
double GetPlayDuration() const
size_t NChannels() const override
How many Sequences the clip contains.
WaveClip(const WaveClip &)=delete
bool IntersectsPlayRegion(double t0, double t1) const
[t0, t1) ∩ [...) != ∅
AudioSegmentSampleView GetSampleView(size_t iChannel, sampleCount start, size_t length, bool mayThrow=true) const override
Request up to length samples. The actual number of samples available from the returned view is querie...
void ClearAndAddCutLine(double t0, double t1)
void MarkChanged() noexcept
Called by mutating operations; notifies listeners.
bool HasEqualPitchAndSpeed(const WaveClip &other) const
sampleCount GetNumSamples() const
void AddCutLine(WaveClipHolder pClip)
bool StrongInvariant() const
WaveClipHolders mCutLines
void SetTrimLeft(double trim)
Sets the play start offset in seconds from the beginning of the underlying sequence.
double GetSequenceEndTime() const
static const char * WaveClip_tag
Sequence * GetSequence(size_t ii)
void Clear(double t0, double t1)
bool Paste(double t0, const WaveClip &other)
void UpdateEnvelopeTrackLen()
size_t NumCutLines() const
void StretchCutLines(double ratioChange)
bool Append(size_t iChannel, size_t nChannels, constSamplePtr buffers[], sampleFormat format, size_t len, unsigned int stride, sampleFormat effectiveFormat)
static void TransferSequence(WaveClip &origClip, WaveClip &newClip)
void StretchLeftTo(double to)
Stretches from left to the absolute time (if in expected range)
bool PartlyWithinPlayRegion(double t0, double t1) const
t0 xor t1 ∈ [...)
void StretchBy(double ratio)
void MakeStereo(WaveClip &&other, bool mustAlign)
void Flush()
Flush must be called after last Append.
std::vector< std::unique_ptr< Sequence > > mSequences
void TrimLeft(double deltaTime)
Moves play start position by deltaTime.
void DiscardRightChannel()
Reduce width.
A view into an attribute value. The class does not take the ownership of the data.
This class is an interface which should be implemented by classes which wish to be able to load and s...
Base class for XMLFileWriter and XMLStringWriter that provides the general functionality for creating...
Positions or offsets within audio files need a wide type.
long long as_long_long() const
WAVE_TRACK_API sampleCount GetSequenceSamplesCount(const WaveTrack &track)
void swap(std::unique_ptr< Alg_seq > &a, std::unique_ptr< Alg_seq > &b)
static CommandContext::TargetFactory::SubstituteInUnique< InteractiveOutputTargets > scope
const char * end(const char *str) noexcept
fastfloat_really_inline void round(adjusted_mantissa &am, callback cb) noexcept
void copy(const T *src, T *dst, int32_t n)
const PitchAndSpeedPreset newValue
StrongInvariantScope(WaveClip &clip)
Restores state when an update loop over mSequences fails midway.
std::vector< std::unique_ptr< Sequence > > sequences
Transaction(WaveClip &clip)
virtual void MarkChanged() noexcept=0
virtual void MakeStereo(WaveClipListener &&other, bool aligned)
virtual void Erase(size_t index)
virtual void WriteXMLAttributes(XMLWriter &writer) const
virtual ~WaveClipListener()=0
virtual bool HandleXMLAttribute(const std::string_view &attr, const XMLAttributeValueView &valueView)
virtual void SwapChannels()
Default implementation does nothing.
virtual void Invalidate()=0