Audacity 3.2.0
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
WaveClip Class Referencefinal

This allows multiple clips to be a part of one WaveTrack. More...

#include <WaveClip.h>

Inheritance diagram for WaveClip:
[legend]
Collaboration diagram for WaveClip:
[legend]

Public Types

using Caches = Site< WaveClip, WaveClipListener >
 
- Public Types inherited from ClientData::Site< WaveClip, WaveClipListener >
using DataType = WaveClipListener
 
using DataPointer = UniquePtr< WaveClipListener >
 
using DataFactory = std::function< DataPointer(WaveClip &) >
 Type of function from which RegisteredFactory is constructed; it builds attachments. More...
 

Public Member Functions

 WaveClip (const SampleBlockFactoryPtr &factory, sampleFormat format, int rate, int colourIndex)
 
 WaveClip (const WaveClip &orig, const SampleBlockFactoryPtr &factory, bool copyCutlines)
 
 WaveClip (const WaveClip &orig, const SampleBlockFactoryPtr &factory, bool copyCutlines, double t0, double t1)
 
virtual ~WaveClip ()
 
void ConvertToSampleFormat (sampleFormat format, const std::function< void(size_t)> &progressReport={})
 
sampleCount TimeToSequenceSamples (double t) const
 
sampleCount ToSequenceSamples (sampleCount s) const
 
int GetRate () const
 
void SetRate (int rate)
 
void Resample (int rate, BasicUI::ProgressDialog *progress=NULL)
 
void SetColourIndex (int index)
 
int GetColourIndex () const
 
double GetSequenceStartTime () const noexcept
 
void SetSequenceStartTime (double startTime)
 
double GetSequenceEndTime () const
 
sampleCount GetSequenceStartSample () const
 Returns the index of the first sample of the underlying sequence. More...
 
sampleCount GetSequenceEndSample () const
 Returns the index of the sample next after the last sample of the underlying sequence. More...
 
sampleCount GetSequenceSamplesCount () const
 Returns the total number of samples in underlying sequence (not counting the cutlines) More...
 
double GetPlayStartTime () const noexcept
 
void SetPlayStartTime (double time)
 
double GetPlayEndTime () const
 
sampleCount GetPlayStartSample () const
 
sampleCount GetPlayEndSample () const
 
sampleCount GetPlaySamplesCount () const
 
void SetTrimLeft (double trim)
 Sets the play start offset in seconds from the beginning of the underlying sequence. More...
 
double GetTrimLeft () const noexcept
 Returns the play start offset in seconds from the beginning of the underlying sequence. More...
 
void SetTrimRight (double trim)
 Sets the play end offset in seconds from the ending of the underlying sequence. More...
 
double GetTrimRight () const noexcept
 Returns the play end offset in seconds from the ending of the underlying sequence. More...
 
void TrimLeft (double deltaTime)
 Moves play start position by deltaTime. More...
 
void TrimRight (double deltaTime)
 Moves play end position by deltaTime. More...
 
void TrimLeftTo (double to)
 Sets the the left trimming to the absolute time (if that is in bounds) More...
 
void TrimRightTo (double to)
 Sets the the right trimming to the absolute time (if that is in bounds) More...
 
void Offset (double delta) noexcept
 
bool WithinPlayRegion (double t) const
 
bool BeforePlayStartTime (double t) const
 
bool AfterPlayEndTime (double t) const
 
bool GetSamples (samplePtr buffer, sampleFormat format, sampleCount start, size_t len, bool mayThrow=true) const
 
void SetSamples (constSamplePtr buffer, sampleFormat format, sampleCount start, size_t len)
 
EnvelopeGetEnvelope ()
 
const EnvelopeGetEnvelope () const
 
BlockArrayGetSequenceBlockArray ()
 
const BlockArrayGetSequenceBlockArray () const
 
SequenceGetSequence ()
 
const SequenceGetSequence () const
 
void MarkChanged ()
 
std::pair< float, float > GetMinMax (double t0, double t1, bool mayThrow=true) const
 
float GetRMS (double t0, double t1, bool mayThrow=true) const
 
void UpdateEnvelopeTrackLen ()
 
std::shared_ptr< SampleBlockAppendNewBlock (samplePtr buffer, sampleFormat format, size_t len)
 For use in importing pre-version-3 projects to preserve sharing of blocks. More...
 
void AppendSharedBlock (const std::shared_ptr< SampleBlock > &pBlock)
 For use in importing pre-version-3 projects to preserve sharing of blocks. More...
 
bool Append (constSamplePtr buffer, sampleFormat format, size_t len, unsigned int stride)
 
void Flush ()
 Flush must be called after last Append. More...
 
void Clear (double t0, double t1)
 
void ClearLeft (double t)
 
void ClearRight (double t)
 
void ClearAndAddCutLine (double t0, double t1)
 Clear, and add cut line that starts at t0 and contains everything until t1. More...
 
void Paste (double t0, const WaveClip *other)
 Paste data from other clip, resampling it if not equal rate. More...
 
void InsertSilence (double t, double len, double *pEnvelopeValue=nullptr)
 
void AppendSilence (double len, double envelopeValue)
 
WaveClipHoldersGetCutLines ()
 Get access to cut lines list. More...
 
const WaveClipConstHoldersGetCutLines () const
 
size_t NumCutLines () const
 
bool FindCutLine (double cutLinePosition, double *cutLineStart=NULL, double *cutLineEnd=NULL) const
 
void ExpandCutLine (double cutLinePosition)
 
bool RemoveCutLine (double cutLinePosition)
 Remove cut line, without expanding the audio in it. More...
 
void OffsetCutLines (double t0, double len)
 Offset cutlines right to time 't0' by time amount 'len'. More...
 
void CloseLock ()
 
bool HandleXMLTag (const std::string_view &tag, const AttributesList &attrs) override
 
void HandleXMLEndTag (const std::string_view &tag) override
 
XMLTagHandlerHandleXMLChild (const std::string_view &tag) override
 
void WriteXML (XMLWriter &xmlFile) const
 
bool GetIsPlaceholder () const
 
void SetIsPlaceholder (bool val)
 
bool SharesBoundaryWithNextClip (const WaveClip *next) const
 
void SetName (const wxString &name)
 
const wxString & GetName () const
 
sampleCount TimeToSamples (double time) const noexcept
 
double SamplesToTime (sampleCount s) const noexcept
 
void SetSilence (sampleCount offset, sampleCount length)
 Silences the 'length' amount of samples starting from 'offset'(relative to the play start) More...
 
const SampleBufferGetAppendBuffer () const
 
size_t GetAppendBufferLen () const
 
- Public Member Functions inherited from XMLTagHandler
 XMLTagHandler ()
 
virtual ~XMLTagHandler ()
 
virtual bool HandleXMLTag (const std::string_view &tag, const AttributesList &attrs)=0
 
virtual void HandleXMLEndTag (const std::string_view &WXUNUSED(tag))
 
virtual void HandleXMLContent (const std::string_view &WXUNUSED(content))
 
virtual XMLTagHandlerHandleXMLChild (const std::string_view &tag)=0
 
void ReadXMLEndTag (const char *tag)
 
void ReadXMLContent (const char *s, int len)
 
XMLTagHandlerReadXMLChild (const char *tag)
 
- Public Member Functions inherited from ClientData::Site< WaveClip, WaveClipListener >
 ~Site ()
 
 Site ()
 
 Site (const Site &other)
 
 Site (Site &&other)
 
Siteoperator= (const Site &other)
 
Siteoperator= (Site &&other)
 
size_t size () const
 How many attachment pointers are in the Site. More...
 
Subclass & Get (const RegisteredFactory &key)
 Get reference to an attachment, creating on demand if not present, down-cast it to Subclass. More...
 
auto Get (const RegisteredFactory &key) const -> std::enable_if_t< std::is_const< Subclass >::value, Subclass & >
 Get reference to an attachment, creating on demand if not present, down-cast it to Subclass. More...
 
Subclass * Find (const RegisteredFactory &key)
 Get a (bare) pointer to an attachment, or null, down-cast it to Subclass *; will not create on demand. More...
 
auto Find (const RegisteredFactory &key) const -> std::enable_if_t< std::is_const< Subclass >::value, Subclass * >
 Get a (bare) pointer to an attachment, or null, down-cast it to Subclass *; will not create on demand. More...
 
void Assign (const RegisteredFactory &key, ReplacementPointer &&replacement)
 Reassign Site's pointer to ClientData. More...
 

Protected Member Functions

void ClearSequence (double t0, double t1)
 
- Protected Member Functions inherited from ClientData::Site< WaveClip, WaveClipListener >
void ForEach (const Function &function)
 Invoke function on each ClientData object that has been created in this. More...
 
void ForEach (const Function &function) const
 Invoke function on each ClientData object that has been created in this. More...
 
WaveClipListenerFindIf (const Function &function)
 Return pointer to first attachment in this that is not null and satisfies a predicate, or nullptr. More...
 
const WaveClipListenerFindIf (const Function &function) const
 Return pointer to first attachment in this that is not null and satisfies a predicate, or nullptr. More...
 
void BuildAll ()
 For each RegisteredFactory, if the corresponding attachment is absent in this, build and store it. More...
 

Protected Attributes

double mSequenceOffset { 0 }
 
double mTrimLeft { 0 }
 
double mTrimRight { 0 }
 
int mRate
 
int mColourIndex
 
std::unique_ptr< SequencemSequence
 
std::unique_ptr< EnvelopemEnvelope
 
SampleBuffer mAppendBuffer {}
 
size_t mAppendBufferLen { 0 }
 
WaveClipHolders mCutLines {}
 
bool mIsPlaceholder { false }
 

Private Member Functions

 WaveClip (const WaveClip &) PROHIBITED
 
WaveClipoperator= (const WaveClip &) PROHIBITED
 

Private Attributes

wxString mName
 

Additional Inherited Members

- Static Public Member Functions inherited from ClientData::Site< WaveClip, WaveClipListener >
static size_t slots ()
 How many static factories have been registered with this specialization of Site. More...
 

Detailed Description

This allows multiple clips to be a part of one WaveTrack.

Definition at line 99 of file WaveClip.h.

Member Typedef Documentation

◆ Caches

Definition at line 110 of file WaveClip.h.

Constructor & Destructor Documentation

◆ WaveClip() [1/4]

WaveClip::WaveClip ( const WaveClip )
private

◆ WaveClip() [2/4]

WaveClip::WaveClip ( const SampleBlockFactoryPtr factory,
sampleFormat  format,
int  rate,
int  colourIndex 
)

Definition at line 43 of file WaveClip.cpp.

45{
46 mRate = rate;
47 mColourIndex = colourIndex;
48 mSequence = std::make_unique<Sequence>(factory, format);
49
50 mEnvelope = std::make_unique<Envelope>(true, 1e-7, 2.0, 1.0);
51}
int format
Definition: ExportPCM.cpp:56
std::unique_ptr< Sequence > mSequence
Definition: WaveClip.h:344
std::unique_ptr< Envelope > mEnvelope
Definition: WaveClip.h:345
int mRate
Definition: WaveClip.h:341
int mColourIndex
Definition: WaveClip.h:342
static RegisteredToolbarFactory factory

References cloud::factory, format, mColourIndex, mEnvelope, mRate, and mSequence.

◆ WaveClip() [3/4]

WaveClip::WaveClip ( const WaveClip orig,
const SampleBlockFactoryPtr factory,
bool  copyCutlines 
)

Definition at line 53 of file WaveClip.cpp.

56{
57 // essentially a copy constructor - but you must pass in the
58 // current sample block factory, because we might be copying
59 // from one project to another
60
62 mTrimLeft = orig.mTrimLeft;
64 mRate = orig.mRate;
66 mSequence = std::make_unique<Sequence>(*orig.mSequence, factory);
67
68 mEnvelope = std::make_unique<Envelope>(*orig.mEnvelope);
69
70 mName = orig.mName;
71
72 if ( copyCutlines )
73 for (const auto &clip: orig.mCutLines)
74 mCutLines.push_back
75 ( std::make_unique<WaveClip>( *clip, factory, true ) );
76
78}
bool mIsPlaceholder
Definition: WaveClip.h:355
double mTrimRight
Definition: WaveClip.h:339
wxString mName
Definition: WaveClip.h:358
bool GetIsPlaceholder() const
Definition: WaveClip.h:312
double mSequenceOffset
Definition: WaveClip.h:337
double mTrimLeft
Definition: WaveClip.h:338
WaveClipHolders mCutLines
Definition: WaveClip.h:352

References cloud::factory, GetIsPlaceholder(), mColourIndex, mCutLines, mEnvelope, mIsPlaceholder, mName, mRate, mSequence, mSequenceOffset, mTrimLeft, and mTrimRight.

Here is the call graph for this function:

◆ WaveClip() [4/4]

WaveClip::WaveClip ( const WaveClip orig,
const SampleBlockFactoryPtr factory,
bool  copyCutlines,
double  t0,
double  t1 
)

Definition at line 80 of file WaveClip.cpp.

84{
86 mTrimLeft = orig.mTrimLeft + (t0 > orig.GetPlayStartTime()? t0 - orig.GetPlayStartTime() : 0);
87 mTrimRight = orig.mTrimRight + (t1 < orig.GetPlayEndTime()? orig.GetPlayEndTime() - t1 : 0);
88
89 mRate = orig.mRate;
91
93
94 auto s0 = orig.TimeToSequenceSamples(t0);
95 auto s1 = orig.TimeToSequenceSamples(t1);
96
97 mSequence = std::make_unique<Sequence>(*orig.mSequence, factory);
98
99 mEnvelope = std::make_unique<Envelope>(*orig.mEnvelope);
100
101 if ( copyCutlines )
102 // Copy cutline clips that fall in the range
103 for (const auto &ppClip : orig.mCutLines)
104 {
105 const WaveClip* clip = ppClip.get();
106 double cutlinePosition = orig.GetSequenceStartTime() + clip->GetSequenceStartTime();
107 if (cutlinePosition >= t0 && cutlinePosition <= t1)
108 {
109 auto newCutLine =
110 std::make_unique< WaveClip >( *clip, factory, true );
111 newCutLine->SetSequenceStartTime( cutlinePosition - t0 );
112 mCutLines.push_back(std::move(newCutLine));
113 }
114 }
115}
This allows multiple clips to be a part of one WaveTrack.
Definition: WaveClip.h:101
double GetSequenceStartTime() const noexcept
Definition: WaveClip.cpp:978
sampleCount TimeToSequenceSamples(double t) const
Definition: WaveClip.cpp:1039
double GetPlayStartTime() const noexcept
Definition: WaveClip.cpp:900
double GetPlayEndTime() const
Definition: WaveClip.cpp:910

References cloud::factory, GetIsPlaceholder(), GetPlayEndTime(), GetPlayStartTime(), GetSequenceStartTime(), mColourIndex, mCutLines, mEnvelope, mIsPlaceholder, mRate, mSequence, mSequenceOffset, mTrimLeft, mTrimRight, and TimeToSequenceSamples().

Here is the call graph for this function:

◆ ~WaveClip()

WaveClip::~WaveClip ( )
virtual

Definition at line 118 of file WaveClip.cpp.

119{
120}

Member Function Documentation

◆ AfterPlayEndTime()

bool WaveClip::AfterPlayEndTime ( double  t) const

Definition at line 1033 of file WaveClip.cpp.

1034{
1035 auto ts = TimeToSamples(t);
1036 return ts >= GetPlayEndSample() + mAppendBufferLen;
1037}
size_t mAppendBufferLen
Definition: WaveClip.h:348
sampleCount GetPlayEndSample() const
Definition: WaveClip.cpp:927
sampleCount TimeToSamples(double time) const noexcept
Definition: WaveClip.cpp:879

References GetPlayEndSample(), mAppendBufferLen, and TimeToSamples().

Here is the call graph for this function:

◆ Append()

bool WaveClip::Append ( constSamplePtr  buffer,
sampleFormat  format,
size_t  len,
unsigned int  stride 
)

You must call Flush after the last Append

Returns
true if at least one complete block was created
Exception safety guarantee:
Partial – Some prefix (maybe none) of the buffer is appended, and no content already flushed to disk is lost.

Definition at line 229 of file WaveClip.cpp.

231{
232 //wxLogDebug(wxT("Append: len=%lli"), (long long) len);
233 bool result = false;
234
235 auto maxBlockSize = mSequence->GetMaxBlockSize();
236 auto blockSize = mSequence->GetIdealAppendLen();
237 sampleFormat seqFormat = mSequence->GetSampleFormat();
238
239 if (!mAppendBuffer.ptr())
240 mAppendBuffer.Allocate(maxBlockSize, seqFormat);
241
242 auto cleanup = finally( [&] {
243 // use No-fail-guarantee
245 MarkChanged();
246 } );
247
248 for(;;) {
249 if (mAppendBufferLen >= blockSize) {
250 // flush some previously appended contents
251 // use Strong-guarantee
252 mSequence->Append(mAppendBuffer.ptr(), seqFormat, blockSize);
253 result = true;
254
255 // use No-fail-guarantee for rest of this "if"
256 memmove(mAppendBuffer.ptr(),
257 mAppendBuffer.ptr() + blockSize * SAMPLE_SIZE(seqFormat),
258 (mAppendBufferLen - blockSize) * SAMPLE_SIZE(seqFormat));
259 mAppendBufferLen -= blockSize;
260 blockSize = mSequence->GetIdealAppendLen();
261 }
262
263 if (len == 0)
264 break;
265
266 // use No-fail-guarantee for rest of this "for"
267 wxASSERT(mAppendBufferLen <= maxBlockSize);
268 auto toCopy = std::min(len, maxBlockSize - mAppendBufferLen);
269
270 CopySamples(buffer, format,
272 seqFormat,
273 toCopy,
275 stride);
276
277 mAppendBufferLen += toCopy;
278 buffer += toCopy * SAMPLE_SIZE(format) * stride;
279 len -= toCopy;
280 }
281
282 return result;
283}
int min(int a, int b)
DitherType gHighQualityDither
void CopySamples(constSamplePtr src, sampleFormat srcFormat, samplePtr dst, sampleFormat dstFormat, size_t len, DitherType ditherType, unsigned int srcStride, unsigned int dstStride)
Copy samples from any format to any other format; apply dithering only if narrowing the format.
sampleFormat
Definition: SampleFormat.h:29
#define SAMPLE_SIZE(SampleFormat)
Definition: SampleFormat.h:44
SampleBuffer & Allocate(size_t count, sampleFormat format)
Definition: SampleFormat.h:96
samplePtr ptr() const
Definition: SampleFormat.h:110
void MarkChanged()
Definition: WaveClip.cpp:149
SampleBuffer mAppendBuffer
Definition: WaveClip.h:347
void UpdateEnvelopeTrackLen()
Definition: WaveClip.cpp:206

References SampleBuffer::Allocate(), CopySamples(), format, gHighQualityDither, mAppendBuffer, mAppendBufferLen, MarkChanged(), min(), mSequence, SampleBuffer::ptr(), SAMPLE_SIZE, and UpdateEnvelopeTrackLen().

Referenced by WaveTrack::Append().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ AppendNewBlock()

std::shared_ptr< SampleBlock > WaveClip::AppendNewBlock ( samplePtr  buffer,
sampleFormat  format,
size_t  len 
)

For use in importing pre-version-3 projects to preserve sharing of blocks.

Exception safety guarantee:
Strong

Definition at line 214 of file WaveClip.cpp.

216{
217 return mSequence->AppendNewBlock( buffer, format, len );
218}

References format, and mSequence.

◆ AppendSharedBlock()

void WaveClip::AppendSharedBlock ( const std::shared_ptr< SampleBlock > &  pBlock)

For use in importing pre-version-3 projects to preserve sharing of blocks.

Exception safety guarantee:
Strong

Definition at line 221 of file WaveClip.cpp.

222{
223 mSequence->AppendSharedBlock( pBlock );
224}

References mSequence.

◆ AppendSilence()

void WaveClip::AppendSilence ( double  len,
double  envelopeValue 
)

Insert silence at the end, and causes the envelope to ramp linearly to the given value

Exception safety guarantee:
Strong

Definition at line 521 of file WaveClip.cpp.

522{
523 auto t = GetPlayEndTime();
524 InsertSilence( t, len, &envelopeValue );
525}
void InsertSilence(double t, double len, double *pEnvelopeValue=nullptr)
Definition: WaveClip.cpp:482

References GetPlayEndTime(), and InsertSilence().

Here is the call graph for this function:

◆ BeforePlayStartTime()

bool WaveClip::BeforePlayStartTime ( double  t) const

Definition at line 1027 of file WaveClip.cpp.

1028{
1029 auto ts = TimeToSamples(t);
1030 return ts <= GetPlayStartSample();
1031}
sampleCount GetPlayStartSample() const
Definition: WaveClip.cpp:922

References GetPlayStartSample(), and TimeToSamples().

Here is the call graph for this function:

◆ Clear()

void WaveClip::Clear ( double  t0,
double  t1 
)

This name is consistent with WaveTrack::Clear. It performs a "Cut" operation (but without putting the cut audio to the clipboard)

Exception safety guarantee:
Strong

Definition at line 528 of file WaveClip.cpp.

529{
530 auto st0 = t0;
531 auto st1 = t1;
532 auto offset = .0;
533 if (st0 <= GetPlayStartTime())
534 {
535 offset = (t0 - GetPlayStartTime()) + GetTrimLeft();
536 st0 = GetSequenceStartTime();
537
538 SetTrimLeft(.0);
539 }
540 if (st1 >= GetPlayEndTime())
541 {
542 st1 = GetSequenceEndTime();
543 SetTrimRight(.0);
544 }
545 ClearSequence(st0, st1);
546
547 if (offset != .0)
548 Offset(offset);
549}
double GetTrimLeft() const noexcept
Returns the play start offset in seconds from the beginning of the underlying sequence.
Definition: WaveClip.cpp:943
void SetTrimRight(double trim)
Sets the play end offset in seconds from the ending of the underlying sequence.
Definition: WaveClip.cpp:948
void Offset(double delta) noexcept
Definition: WaveClip.cpp:1011
void ClearSequence(double t0, double t1)
Definition: WaveClip.cpp:570
void SetTrimLeft(double trim)
Sets the play start offset in seconds from the beginning of the underlying sequence.
Definition: WaveClip.cpp:938
double GetSequenceEndTime() const
Definition: WaveClip.cpp:990

References ClearSequence(), GetPlayEndTime(), GetPlayStartTime(), GetSequenceEndTime(), GetSequenceStartTime(), GetTrimLeft(), Offset(), SetTrimLeft(), and SetTrimRight().

Here is the call graph for this function:

◆ ClearAndAddCutLine()

void WaveClip::ClearAndAddCutLine ( double  t0,
double  t1 
)

Clear, and add cut line that starts at t0 and contains everything until t1.

Exception safety guarantee:
Weak – This WaveClip remains destructible in case of AudacityException. But some cutlines may be deleted

Definition at line 630 of file WaveClip.cpp.

631{
632 if (t0 > GetPlayEndTime() || t1 < GetPlayStartTime())
633 return; // time out of bounds
634
635 const double clip_t0 = std::max( t0, GetPlayStartTime() );
636 const double clip_t1 = std::min( t1, GetPlayEndTime() );
637
638 auto newClip = std::make_unique< WaveClip >
639 (*this, mSequence->GetFactory(), true, clip_t0, clip_t1);
640
641 newClip->SetSequenceStartTime( clip_t0 - GetSequenceStartTime() );
642
643 // Remove cutlines from this clip that were in the selection, shift
644 // left those that were after the selection
645 // May DELETE as we iterate, so don't use range-for
646 for (auto it = mCutLines.begin(); it != mCutLines.end();)
647 {
648 WaveClip* clip = it->get();
649 double cutlinePosition = GetSequenceStartTime() + clip->GetSequenceStartTime();
650 if (cutlinePosition >= t0 && cutlinePosition <= t1)
651 it = mCutLines.erase(it);
652 else
653 {
654 if (cutlinePosition >= t1)
655 {
656 clip->Offset(clip_t0 - clip_t1);
657 }
658 ++it;
659 }
660 }
661
662 // Clear actual audio data
663 auto s0 = TimeToSequenceSamples(t0);
664 auto s1 = TimeToSequenceSamples(t1);
665
666 // use Weak-guarantee
667 GetSequence()->Delete(s0, s1-s0);
668
669 // Collapse envelope
670 auto sampleTime = 1.0 / GetRate();
671 GetEnvelope()->CollapseRegion( t0, t1, sampleTime );
672
673 MarkChanged();
674
675 mCutLines.push_back(std::move(newClip));
676}
void CollapseRegion(double t0, double t1, double sampleDur)
Definition: Envelope.cpp:372
void Delete(sampleCount start, sampleCount len)
Definition: Sequence.cpp:1385
Sequence * GetSequence()
Definition: WaveClip.h:213
Envelope * GetEnvelope()
Definition: WaveClip.h:205
int GetRate() const
Definition: WaveClip.h:139

References Envelope::CollapseRegion(), Sequence::Delete(), GetEnvelope(), GetPlayEndTime(), GetPlayStartTime(), GetRate(), GetSequence(), GetSequenceStartTime(), MarkChanged(), mCutLines, min(), mSequence, Offset(), and TimeToSequenceSamples().

Here is the call graph for this function:

◆ ClearLeft()

void WaveClip::ClearLeft ( double  t)

Removes samples starting from the left boundary of the clip till t, if it's inside the play region. Also removes trimmed (hidden) data, if present. Changes offset to make remaining samples stay at their old place. Destructive operation.

Definition at line 551 of file WaveClip.cpp.

552{
553 if (t > GetPlayStartTime() && t < GetPlayEndTime())
554 {
556 SetTrimLeft(.0);
558 }
559}
void SetSequenceStartTime(double startTime)
Definition: WaveClip.cpp:984

References ClearSequence(), GetPlayEndTime(), GetPlayStartTime(), GetSequenceStartTime(), SetSequenceStartTime(), and SetTrimLeft().

Here is the call graph for this function:

◆ ClearRight()

void WaveClip::ClearRight ( double  t)

Removes samples starting from t (if it's inside the clip), till the right boundary. Also removes trimmed (hidden) data, if present. Destructive operation.

Definition at line 561 of file WaveClip.cpp.

562{
563 if (t > GetPlayStartTime() && t < GetPlayEndTime())
564 {
566 SetTrimRight(.0);
567 }
568}

References ClearSequence(), GetPlayEndTime(), GetPlayStartTime(), GetSequenceEndTime(), and SetTrimRight().

Here is the call graph for this function:

◆ ClearSequence()

void WaveClip::ClearSequence ( double  t0,
double  t1 
)
protected

This name is consistent with WaveTrack::Clear. It performs a "Cut" operation (but without putting the cut audio to the clipboard)

Definition at line 570 of file WaveClip.cpp.

571{
572 auto clip_t0 = std::max(t0, GetSequenceStartTime());
573 auto clip_t1 = std::min(t1, GetSequenceEndTime());
574
575 auto s0 = TimeToSequenceSamples(clip_t0);
576 auto s1 = TimeToSequenceSamples(clip_t1);
577
578 if (s0 != s1)
579 {
580 // use Strong-guarantee
581 GetSequence()->Delete(s0, s1 - s0);
582
583 // use No-fail-guarantee in the remaining
584
585 // msmeyer
586 //
587 // Delete all cutlines that are within the given area, if any.
588 //
589 // Note that when cutlines are active, two functions are used:
590 // Clear() and ClearAndAddCutLine(). ClearAndAddCutLine() is called
591 // whenever the user directly calls a command that removes some audio, e.g.
592 // "Cut" or "Clear" from the menu. This command takes care about recursive
593 // preserving of cutlines within clips. Clear() is called when internal
594 // operations want to remove audio. In the latter case, it is the right
595 // thing to just remove all cutlines within the area.
596 //
597
598 // May DELETE as we iterate, so don't use range-for
599 for (auto it = mCutLines.begin(); it != mCutLines.end();)
600 {
601 WaveClip* clip = it->get();
602 double cutlinePosition = GetSequenceStartTime() + clip->GetSequenceStartTime();
603 if (cutlinePosition >= t0 && cutlinePosition <= t1)
604 {
605 // This cutline is within the area, DELETE it
606 it = mCutLines.erase(it);
607 }
608 else
609 {
610 if (cutlinePosition >= t1)
611 {
612 clip->Offset(clip_t0 - clip_t1);
613 }
614 ++it;
615 }
616 }
617
618 // Collapse envelope
619 auto sampleTime = 1.0 / GetRate();
620 GetEnvelope()->CollapseRegion(t0, t1, sampleTime);
621 }
622
623
624 MarkChanged();
625}

References Envelope::CollapseRegion(), Sequence::Delete(), GetEnvelope(), GetRate(), GetSequence(), GetSequenceEndTime(), GetSequenceStartTime(), MarkChanged(), mCutLines, min(), Offset(), and TimeToSequenceSamples().

Referenced by Clear(), ClearLeft(), ClearRight(), InsertSilence(), and Paste().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CloseLock()

void WaveClip::CloseLock ( )

Definition at line 757 of file WaveClip.cpp.

758{
760 for (const auto &cutline: mCutLines)
761 cutline->CloseLock();
762}
bool CloseLock()
Definition: Sequence.cpp:87

References Sequence::CloseLock(), GetSequence(), and mCutLines.

Here is the call graph for this function:

◆ ConvertToSampleFormat()

void WaveClip::ConvertToSampleFormat ( sampleFormat  format,
const std::function< void(size_t)> &  progressReport = {} 
)

Definition at line 194 of file WaveClip.cpp.

196{
197 // Note: it is not necessary to do this recursively to cutlines.
198 // They get converted as needed when they are expanded.
199
200 auto bChanged = mSequence->ConvertToSampleFormat(format, progressReport);
201 if (bChanged)
202 MarkChanged();
203}

References format, MarkChanged(), and mSequence.

Here is the call graph for this function:

◆ ExpandCutLine()

void WaveClip::ExpandCutLine ( double  cutLinePosition)

Expand cut line (that is, re-insert audio, then DELETE audio saved in cut line). Returns true if a cut line could be found and successfully expanded, false otherwise

Exception safety guarantee:
Strong

Definition at line 699 of file WaveClip.cpp.

700{
701 auto end = mCutLines.end();
702 auto it = std::find_if( mCutLines.begin(), end,
703 [&](const WaveClipHolder &cutline) {
704 return fabs(GetSequenceStartTime() + cutline->GetSequenceStartTime() - cutLinePosition) < 0.0001;
705 } );
706
707 if ( it != end ) {
708 auto cutline = it->get();
709 // assume Strong-guarantee from Paste
710
711 // Envelope::Paste takes offset into account, WaveClip::Paste doesn't!
712 // Do this to get the right result:
713 cutline->mEnvelope->SetOffset(0);
714
715 Paste(GetSequenceStartTime()+cutline->GetSequenceStartTime(), cutline);
716 // Now erase the cutline,
717 // but be careful to find it again, because Paste above may
718 // have modified the array of cutlines (if our cutline contained
719 // another cutline!), invalidating the iterator we had.
720 end = mCutLines.end();
721 it = std::find_if(mCutLines.begin(), end,
722 [=](const WaveClipHolder &p) { return p.get() == cutline; });
723 if (it != end)
724 mCutLines.erase(it); // deletes cutline!
725 else {
726 wxASSERT(false);
727 }
728 }
729}
std::shared_ptr< WaveClip > WaveClipHolder
Definition: WaveClip.h:41
void Paste(double t0, const WaveClip *other)
Paste data from other clip, resampling it if not equal rate.
Definition: WaveClip.cpp:406
auto end(const Ptr< Type, BaseDeleter > &p)
Enables range-for.
Definition: PackedArray.h:159

References PackedArray::end(), GetSequenceStartTime(), mCutLines, and Paste().

Here is the call graph for this function:

◆ FindCutLine()

bool WaveClip::FindCutLine ( double  cutLinePosition,
double *  cutLineStart = NULL,
double *  cutLineEnd = NULL 
) const

Find cut line at (approximately) this position. Returns true and fills in cutLineStart and cutLineEnd (if specified) if a cut line at this position could be found. Return false otherwise.

Definition at line 678 of file WaveClip.cpp.

681{
682 for (const auto &cutline: mCutLines)
683 {
684 if (fabs(GetSequenceStartTime() + cutline->GetSequenceStartTime() - cutLinePosition) < 0.0001)
685 {
686 auto startTime = GetSequenceStartTime() + cutline->GetSequenceStartTime();
687 if (cutlineStart)
688 *cutlineStart = startTime;
689 if (cutlineEnd)
690 *cutlineEnd = startTime + cutline->SamplesToTime(cutline->GetPlaySamplesCount());
691 return true;
692 }
693 }
694
695 return false;
696}

References GetSequenceStartTime(), and mCutLines.

Here is the call graph for this function:

◆ Flush()

void WaveClip::Flush ( )

Flush must be called after last Append.

Exception safety guarantee:
Mixed
Exception safety guarantee:
No-fail – The clip will be in a flushed state.
Exception safety guarantee:
Partial – Some initial portion (maybe none) of the append buffer of the clip gets appended; no previously flushed contents are lost.

Definition at line 290 of file WaveClip.cpp.

291{
292 //wxLogDebug(wxT("WaveClip::Flush"));
293 //wxLogDebug(wxT(" mAppendBufferLen=%lli"), (long long) mAppendBufferLen);
294 //wxLogDebug(wxT(" previous sample count %lli"), (long long) mSequence->GetNumSamples());
295
296 if (mAppendBufferLen > 0) {
297
298 auto cleanup = finally( [&] {
299 // Blow away the append buffer even in case of failure. May lose some
300 // data but don't leave the track in an un-flushed state.
301
302 // Use No-fail-guarantee of these steps.
305 MarkChanged();
306 } );
307
308 mSequence->Append(mAppendBuffer.ptr(), mSequence->GetSampleFormat(),
310 }
311
312 //wxLogDebug(wxT("now sample count %lli"), (long long) mSequence->GetNumSamples());
313}

References mAppendBuffer, mAppendBufferLen, MarkChanged(), mSequence, SampleBuffer::ptr(), and UpdateEnvelopeTrackLen().

Referenced by WaveTrack::Flush().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetAppendBuffer()

const SampleBuffer & WaveClip::GetAppendBuffer ( ) const
inline

Definition at line 327 of file WaveClip.h.

327{ return mAppendBuffer; }

Referenced by WaveClipWaveformCache::GetWaveDisplay().

Here is the caller graph for this function:

◆ GetAppendBufferLen()

size_t WaveClip::GetAppendBufferLen ( ) const
inline

Definition at line 328 of file WaveClip.h.

328{ return mAppendBufferLen; }

Referenced by WaveClipWaveformCache::GetWaveDisplay().

Here is the caller graph for this function:

◆ GetColourIndex()

int WaveClip::GetColourIndex ( ) const
inline

Definition at line 149 of file WaveClip.h.

149{ return mColourIndex;};

Referenced by anonymous_namespace{WaveformView.cpp}::DrawClipWaveform().

Here is the caller graph for this function:

◆ GetCutLines() [1/2]

WaveClipHolders & WaveClip::GetCutLines ( )
inline

Get access to cut lines list.

Definition at line 276 of file WaveClip.h.

276{ return mCutLines; }

◆ GetCutLines() [2/2]

const WaveClipConstHolders & WaveClip::GetCutLines ( ) const
inline

Definition at line 277 of file WaveClip.h.

278 { return reinterpret_cast< const WaveClipConstHolders& >( mCutLines ); }
std::vector< std::shared_ptr< const WaveClip > > WaveClipConstHolders
Definition: WaveClip.h:43

◆ GetEnvelope() [1/2]

Envelope * WaveClip::GetEnvelope ( )
inline

Definition at line 205 of file WaveClip.h.

205{ return mEnvelope.get(); }

Referenced by SetEnvelopeCommand::ApplyInner(), ClearAndAddCutLine(), ClearSequence(), anonymous_namespace{WaveformView.cpp}::DrawClipWaveform(), anonymous_namespace{WaveformView.cpp}::DrawIndividualSamples(), WaveTrack::GetEnvelopeAtTime(), AUPImportFileHandle::HandleEnvelope(), WaveTrack::HandleXMLChild(), and InsertSilence().

Here is the caller graph for this function:

◆ GetEnvelope() [2/2]

const Envelope * WaveClip::GetEnvelope ( ) const
inline

Definition at line 206 of file WaveClip.h.

206{ return mEnvelope.get(); }

◆ GetIsPlaceholder()

bool WaveClip::GetIsPlaceholder ( ) const
inline

Definition at line 312 of file WaveClip.h.

312{ return mIsPlaceholder; }

Referenced by WaveClip().

Here is the caller graph for this function:

◆ GetMinMax()

std::pair< float, float > WaveClip::GetMinMax ( double  t0,
double  t1,
bool  mayThrow = true 
) const

Getting high-level data for screen display and clipping calculations and Contrast

Definition at line 154 of file WaveClip.cpp.

156{
157 t0 = std::max(t0, GetPlayStartTime());
158 t1 = std::min(t1, GetPlayEndTime());
159 if (t0 > t1) {
160 if (mayThrow)
162 return {
163 0.f, // harmless, but unused since Sequence::GetMinMax does not use these values
164 0.f // harmless, but unused since Sequence::GetMinMax does not use these values
165 };
166 }
167
168 if (t0 == t1)
169 return{ 0.f, 0.f };
170
171 auto s0 = TimeToSequenceSamples(t0);
172 auto s1 = TimeToSequenceSamples(t1);
173
174 return mSequence->GetMinMax(s0, s1-s0, mayThrow);
175}
#define THROW_INCONSISTENCY_EXCEPTION
Throw InconsistencyException, using C++ preprocessor to identify the source code location.

References GetPlayEndTime(), GetPlayStartTime(), min(), mSequence, THROW_INCONSISTENCY_EXCEPTION, and TimeToSequenceSamples().

Here is the call graph for this function:

◆ GetName()

const wxString & WaveClip::GetName ( ) const

Definition at line 874 of file WaveClip.cpp.

875{
876 return mName;
877}

References mName.

◆ GetPlayEndSample()

sampleCount WaveClip::GetPlayEndSample ( ) const

Definition at line 927 of file WaveClip.cpp.

928{
930}
sampleCount GetPlaySamplesCount() const
Definition: WaveClip.cpp:932

References GetPlaySamplesCount(), and GetPlayStartSample().

Referenced by AfterPlayEndTime(), EffectReverse::ProcessOneWave(), and WithinPlayRegion().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetPlayEndTime()

double WaveClip::GetPlayEndTime ( ) const

Definition at line 910 of file WaveClip.cpp.

911{
912 auto numSamples = mSequence->GetNumSamples();
913
914 double maxLen = GetSequenceStartTime() + ((numSamples + mAppendBufferLen).as_double()) / mRate
916 // JS: calculated value is not the length;
917 // it is a maximum value and can be negative; no clipping to 0
918
919 return maxLen;
920}
double SamplesToTime(sampleCount s) const noexcept
Definition: WaveClip.cpp:884

References GetSequenceStartTime(), mAppendBufferLen, mRate, mSequence, mTrimRight, SamplesToTime(), and TimeToSamples().

Referenced by AUPImportFileHandle::AddSilence(), AppendSilence(), SetClipCommand::ApplyInner(), SetEnvelopeCommand::ApplyInner(), WaveTrack::CanInsertClip(), Clear(), ClearAndAddCutLine(), WaveTrack::ClearAndPaste(), ClearLeft(), ClearRight(), ClipParameters::ClipParameters(), ClipParameters::GetClipRect(), GetMinMax(), InsertSilence(), WaveTrackUtils::IsClipSelected(), WaveTrack::MergeClips(), Paste(), WaveTrack::PasteWaveTrack(), TrimLeftTo(), WaveTrack::UpdateLocationsCache(), and WaveClip().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetPlaySamplesCount()

sampleCount WaveClip::GetPlaySamplesCount ( ) const

Definition at line 932 of file WaveClip.cpp.

933{
934 return mSequence->GetNumSamples()
936}

References mSequence, mTrimLeft, mTrimRight, and TimeToSamples().

Referenced by anonymous_namespace{SpectrumView.cpp}::DrawClipSpectrum(), anonymous_namespace{WaveformView.cpp}::DrawClipWaveform(), anonymous_namespace{WaveformView.cpp}::DrawIndividualSamples(), GetPlayEndSample(), and SharesBoundaryWithNextClip().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetPlayStartSample()

sampleCount WaveClip::GetPlayStartSample ( ) const

Definition at line 922 of file WaveClip.cpp.

923{
925}

References GetPlayStartTime(), and TimeToSamples().

Referenced by BeforePlayStartTime(), WaveTrack::GetClipAtSample(), GetPlayEndSample(), EffectReverse::ProcessOneWave(), and WithinPlayRegion().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetPlayStartTime()

double WaveClip::GetPlayStartTime ( ) const
noexcept

Definition at line 900 of file WaveClip.cpp.

References mSequenceOffset, mTrimLeft, SamplesToTime(), and TimeToSamples().

Referenced by SetClipCommand::ApplyInner(), SetEnvelopeCommand::ApplyInner(), WaveTrack::CanInsertClip(), Clear(), ClearAndAddCutLine(), WaveTrack::ClearAndPaste(), ClearLeft(), ClearRight(), ClipParameters::ClipParameters(), anonymous_namespace{WaveformView.cpp}::DrawIndividualSamples(), ClipParameters::GetClipRect(), GetMinMax(), GetPlayStartSample(), InsertSilence(), WaveTrackUtils::IsClipSelected(), Paste(), WaveTrack::PasteWaveTrack(), WaveTrack::RightmostOrNewClip(), SharesBoundaryWithNextClip(), TrimRightTo(), and WaveClip().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetRate()

int WaveClip::GetRate ( ) const
inline

Definition at line 139 of file WaveClip.h.

139{ return mRate; }

Referenced by ClearAndAddCutLine(), ClearSequence(), ClipParameters::ClipParameters(), anonymous_namespace{WaveformView.cpp}::DrawIndividualSamples(), ClipParameters::GetClipRect(), WaveClipSpectrumCache::GetSpectrogram(), WaveClipWaveformCache::GetWaveDisplay(), InsertSilence(), Paste(), SharesBoundaryWithNextClip(), and UpdateEnvelopeTrackLen().

Here is the caller graph for this function:

◆ GetRMS()

float WaveClip::GetRMS ( double  t0,
double  t1,
bool  mayThrow = true 
) const

Definition at line 177 of file WaveClip.cpp.

178{
179 if (t0 > t1) {
180 if (mayThrow)
182 return 0.f;
183 }
184
185 if (t0 == t1)
186 return 0.f;
187
188 auto s0 = TimeToSequenceSamples(t0);
189 auto s1 = TimeToSequenceSamples(t1);
190
191 return mSequence->GetRMS(s0, s1-s0, mayThrow);
192}

References mSequence, THROW_INCONSISTENCY_EXCEPTION, and TimeToSequenceSamples().

Here is the call graph for this function:

◆ GetSamples()

bool WaveClip::GetSamples ( samplePtr  buffer,
sampleFormat  format,
sampleCount  start,
size_t  len,
bool  mayThrow = true 
) const

Definition at line 122 of file WaveClip.cpp.

124{
125 return mSequence->Get(buffer, format, start + TimeToSamples(mTrimLeft), len, mayThrow);
126}

References format, mSequence, mTrimLeft, and TimeToSamples().

Referenced by anonymous_namespace{WaveformView.cpp}::DrawIndividualSamples().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetSequence() [1/2]

Sequence * WaveClip::GetSequence ( )
inline

Definition at line 213 of file WaveClip.h.

213{ return mSequence.get(); }

Referenced by ClearAndAddCutLine(), ClearSequence(), CloseLock(), WaveTrack::GetIdealBlockSize(), WaveTrack::GetSequenceAtTime(), WaveClipWaveformCache::GetWaveDisplay(), AUPImportFileHandle::HandleSequence(), WaveTrack::HandleXMLChild(), InsertSilence(), and SetSilence().

Here is the caller graph for this function:

◆ GetSequence() [2/2]

const Sequence * WaveClip::GetSequence ( ) const
inline

Definition at line 214 of file WaveClip.h.

214{ return mSequence.get(); }

◆ GetSequenceBlockArray() [1/2]

BlockArray * WaveClip::GetSequenceBlockArray ( )

Definition at line 139 of file WaveClip.cpp.

140{
141 return &mSequence->GetBlockArray();
142}

References mSequence.

◆ GetSequenceBlockArray() [2/2]

const BlockArray * WaveClip::GetSequenceBlockArray ( ) const

Definition at line 144 of file WaveClip.cpp.

145{
146 return &mSequence->GetBlockArray();
147}

References mSequence.

◆ GetSequenceEndSample()

sampleCount WaveClip::GetSequenceEndSample ( ) const

Returns the index of the sample next after the last sample of the underlying sequence.

Definition at line 1006 of file WaveClip.cpp.

1007{
1008 return GetSequenceStartSample() + mSequence->GetNumSamples();
1009}
sampleCount GetSequenceStartSample() const
Returns the index of the first sample of the underlying sequence.
Definition: WaveClip.cpp:1001

References GetSequenceStartSample(), and mSequence.

Here is the call graph for this function:

◆ GetSequenceEndTime()

double WaveClip::GetSequenceEndTime ( ) const

Definition at line 990 of file WaveClip.cpp.

991{
992 auto numSamples = mSequence->GetNumSamples();
993
994 double maxLen = GetSequenceStartTime() + (numSamples + mAppendBufferLen).as_double() / mRate;
995 // JS: calculated value is not the length;
996 // it is a maximum value and can be negative; no clipping to 0
997
998 return maxLen;
999}

References GetSequenceStartTime(), mAppendBufferLen, mRate, and mSequence.

Referenced by Clear(), ClearRight(), ClearSequence(), InsertSilence(), Paste(), TimeToSequenceSamples(), and TrimRightTo().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetSequenceSamplesCount()

sampleCount WaveClip::GetSequenceSamplesCount ( ) const

Returns the total number of samples in underlying sequence (not counting the cutlines)

Definition at line 895 of file WaveClip.cpp.

896{
897 return mSequence->GetNumSamples();
898}

References mSequence.

Referenced by WaveClipSpectrumCache::GetSpectrogram().

Here is the caller graph for this function:

◆ GetSequenceStartSample()

sampleCount WaveClip::GetSequenceStartSample ( ) const

Returns the index of the first sample of the underlying sequence.

Definition at line 1001 of file WaveClip.cpp.

1002{
1004}

References mSequenceOffset, and TimeToSamples().

Referenced by GetSequenceEndSample(), and ToSequenceSamples().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetSequenceStartTime()

double WaveClip::GetSequenceStartTime ( ) const
noexcept

Definition at line 978 of file WaveClip.cpp.

979{
980 // JS: mSequenceOffset is the minimum value and it is returned; no clipping to 0
981 return mSequenceOffset;
982}

References mSequenceOffset.

Referenced by Clear(), ClearAndAddCutLine(), WaveTrack::ClearAndPaste(), ClearLeft(), ClearSequence(), ExpandCutLine(), FindCutLine(), GetPlayEndTime(), GetSequenceEndTime(), WaveClipSpectrumCache::GetSpectrogram(), InsertSilence(), OffsetCutLines(), Paste(), RemoveCutLine(), TimeToSequenceSamples(), TrimLeftTo(), WaveTrack::UpdateLocationsCache(), and WaveClip().

Here is the caller graph for this function:

◆ GetTrimLeft()

double WaveClip::GetTrimLeft ( ) const
noexcept

Returns the play start offset in seconds from the beginning of the underlying sequence.

Definition at line 943 of file WaveClip.cpp.

944{
945 return mTrimLeft;
946}

References mTrimLeft.

Referenced by Clear(), WaveTrack::ClearAndPaste(), WaveClipSpectrumCache::GetSpectrogram(), WaveClipWaveformCache::GetWaveDisplay(), Paste(), and SetSilence().

Here is the caller graph for this function:

◆ GetTrimRight()

double WaveClip::GetTrimRight ( ) const
noexcept

Returns the play end offset in seconds from the ending of the underlying sequence.

Definition at line 953 of file WaveClip.cpp.

954{
955 return mTrimRight;
956}

References mTrimRight.

Referenced by WaveTrack::ClearAndPaste(), WaveClipSpectrumCache::GetSpectrogram(), and Paste().

Here is the caller graph for this function:

◆ HandleXMLChild()

XMLTagHandler * WaveClip::HandleXMLChild ( const std::string_view &  tag)
overridevirtual

Implements XMLTagHandler.

Definition at line 368 of file WaveClip.cpp.

369{
370 if (tag == "sequence")
371 return mSequence.get();
372 else if (tag == "envelope")
373 return mEnvelope.get();
374 else if (tag == "waveclip")
375 {
376 // Nested wave clips are cut lines
377 mCutLines.push_back(
378 std::make_unique<WaveClip>(mSequence->GetFactory(),
379 mSequence->GetSampleFormat(), mRate, 0 /*colourindex*/));
380 return mCutLines.back().get();
381 }
382 else
383 return NULL;
384}

References mCutLines, mEnvelope, mRate, and mSequence.

Referenced by AUPImportFileHandle::HandleWaveClip().

Here is the caller graph for this function:

◆ HandleXMLEndTag()

void WaveClip::HandleXMLEndTag ( const std::string_view &  tag)
override

Definition at line 362 of file WaveClip.cpp.

363{
364 if (tag == "waveclip")
366}

References UpdateEnvelopeTrackLen().

Referenced by WaveTrack::HandleXMLEndTag().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ HandleXMLTag()

bool WaveClip::HandleXMLTag ( const std::string_view &  tag,
const AttributesList attrs 
)
overridevirtual

Implements XMLTagHandler.

Definition at line 315 of file WaveClip.cpp.

316{
317 if (tag == "waveclip")
318 {
319 double dblValue;
320 long longValue;
321 for (auto pair : attrs)
322 {
323 auto attr = pair.first;
324 auto value = pair.second;
325
326 if (attr == "offset")
327 {
328 if (!value.TryGet(dblValue))
329 return false;
330 SetSequenceStartTime(dblValue);
331 }
332 else if (attr == "trimLeft")
333 {
334 if (!value.TryGet(dblValue))
335 return false;
336 SetTrimLeft(dblValue);
337 }
338 else if (attr == "trimRight")
339 {
340 if (!value.TryGet(dblValue))
341 return false;
342 SetTrimRight(dblValue);
343 }
344 else if (attr == "name")
345 {
346 if(value.IsStringView())
347 SetName(value.ToWString());
348 }
349 else if (attr == "colorindex")
350 {
351 if (!value.TryGet(longValue))
352 return false;
353 SetColourIndex(longValue);
354 }
355 }
356 return true;
357 }
358
359 return false;
360}
void SetName(const wxString &name)
Definition: WaveClip.cpp:869
void SetColourIndex(int index)
Definition: WaveClip.h:148

References SetColourIndex(), SetName(), SetSequenceStartTime(), SetTrimLeft(), and SetTrimRight().

Here is the call graph for this function:

◆ InsertSilence()

void WaveClip::InsertSilence ( double  t,
double  len,
double *  pEnvelopeValue = nullptr 
)

Insert silence - note that this is an efficient operation for large amounts of silence

Exception safety guarantee:
Strong

Definition at line 482 of file WaveClip.cpp.

483{
484 if (t == GetPlayStartTime() && t > GetSequenceStartTime())
486 else if (t == GetPlayEndTime() && t < GetSequenceEndTime()) {
488 SetTrimRight(.0);
489 }
490
491 auto s0 = TimeToSequenceSamples(t);
492 auto slen = (sampleCount)floor(len * mRate + 0.5);
493
494 // use Strong-guarantee
495 GetSequence()->InsertSilence(s0, slen);
496
497 // use No-fail-guarantee
498 OffsetCutLines(t, len);
499
500 const auto sampleTime = 1.0 / GetRate();
501 auto pEnvelope = GetEnvelope();
502 if ( pEnvelopeValue ) {
503
504 // Preserve limit value at the end
505 auto oldLen = pEnvelope->GetTrackLen();
506 auto newLen = oldLen + len;
507 pEnvelope->Cap( sampleTime );
508
509 // Ramp across the silence to the given value
510 pEnvelope->SetTrackLen( newLen, sampleTime );
511 pEnvelope->InsertOrReplace
512 ( pEnvelope->GetOffset() + newLen, *pEnvelopeValue );
513 }
514 else
515 pEnvelope->InsertSpace( t, len );
516
517 MarkChanged();
518}
void InsertSilence(sampleCount s0, sampleCount len)
Definition: Sequence.cpp:683
void OffsetCutLines(double t0, double len)
Offset cutlines right to time 't0' by time amount 'len'.
Definition: WaveClip.cpp:748
Positions or offsets within audio files need a wide type.
Definition: SampleCount.h:19

References ClearSequence(), GetEnvelope(), GetPlayEndTime(), GetPlayStartTime(), GetRate(), GetSequence(), GetSequenceEndTime(), GetSequenceStartTime(), Sequence::InsertSilence(), MarkChanged(), mRate, OffsetCutLines(), SetTrimRight(), and TimeToSequenceSamples().

Referenced by AUPImportFileHandle::AddSilence(), and AppendSilence().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MarkChanged()

void WaveClip::MarkChanged ( )

WaveTrack calls this whenever data in the wave clip changes. It is called automatically when WaveClip has a chance to know that something has changed, like when member functions SetSamples() etc. are called.

Exception safety guarantee:
No-fail

Definition at line 149 of file WaveClip.cpp.

150{
151 Caches::ForEach( std::mem_fn( &WaveClipListener::MarkChanged ) );
152}
virtual void MarkChanged()=0

References WaveClipListener::MarkChanged().

Referenced by Append(), ClearAndAddCutLine(), ClearSequence(), ConvertToSampleFormat(), Flush(), InsertSilence(), Paste(), SetRate(), SetSamples(), and SetSilence().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ NumCutLines()

size_t WaveClip::NumCutLines ( ) const
inline

Definition at line 279 of file WaveClip.h.

279{ return mCutLines.size(); }

Referenced by WaveTrack::UpdateLocationsCache().

Here is the caller graph for this function:

◆ Offset()

void WaveClip::Offset ( double  delta)
noexcept
Exception safety guarantee:
No-fail

Definition at line 1011 of file WaveClip.cpp.

1012{
1014}

Referenced by Clear(), ClearAndAddCutLine(), WaveTrack::ClearAndPaste(), ClearSequence(), and WaveTrack::Copy().

Here is the caller graph for this function:

◆ OffsetCutLines()

void WaveClip::OffsetCutLines ( double  t0,
double  len 
)

Offset cutlines right to time 't0' by time amount 'len'.

Exception safety guarantee:
No-fail

Definition at line 748 of file WaveClip.cpp.

749{
750 for (const auto &cutLine : mCutLines)
751 {
752 if (GetSequenceStartTime() + cutLine->GetSequenceStartTime() >= t0)
753 cutLine->Offset(len);
754 }
755}

References GetSequenceStartTime(), and mCutLines.

Referenced by InsertSilence(), and Paste().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator=()

WaveClip & WaveClip::operator= ( const WaveClip )
private

◆ Paste()

void WaveClip::Paste ( double  t0,
const WaveClip other 
)

Paste data from other clip, resampling it if not equal rate.

Exception safety guarantee:
Strong

Definition at line 406 of file WaveClip.cpp.

407{
408 const bool clipNeedsResampling = other->mRate != mRate;
409 const bool clipNeedsNewFormat =
410 other->mSequence->GetSampleFormat() != mSequence->GetSampleFormat();
411 std::unique_ptr<WaveClip> newClip;
412
413 t0 = std::clamp(t0, GetPlayStartTime(), GetPlayEndTime());
414
415 //seems like edge cases cannot happen, see WaveTrack::PasteWaveTrack
416 if (t0 == GetPlayStartTime())
417 {
419 SetTrimLeft(other->GetTrimLeft());
420
421 auto copy = std::make_unique<WaveClip>(*other, mSequence->GetFactory(), true);
422 copy->ClearSequence(copy->GetPlayEndTime(), copy->GetSequenceEndTime());
423 newClip = std::move(copy);
424 }
425 else if (t0 == GetPlayEndTime())
426 {
428 SetTrimRight(other->GetTrimRight());
429
430 auto copy = std::make_unique<WaveClip>(*other, mSequence->GetFactory(), true);
431 copy->ClearSequence(copy->GetSequenceStartTime(), copy->GetPlayStartTime());
432 newClip = std::move(copy);
433 }
434 else
435 {
436 newClip = std::make_unique<WaveClip>(*other, mSequence->GetFactory(), true);
437 newClip->ClearSequence(newClip->GetPlayEndTime(), newClip->GetSequenceEndTime());
438 newClip->ClearSequence(newClip->GetSequenceStartTime(), newClip->GetPlayStartTime());
439 }
440
441 if (clipNeedsResampling || clipNeedsNewFormat)
442 {
443 auto copy = std::make_unique<WaveClip>(*newClip.get(), mSequence->GetFactory(), true);
444 if (clipNeedsResampling)
445 // The other clip's rate is different from ours, so resample
446 copy->Resample(mRate);
447 if (clipNeedsNewFormat)
448 // Force sample formats to match.
449 copy->ConvertToSampleFormat(mSequence->GetSampleFormat());
450 newClip = std::move(copy);
451 }
452
453 // Paste cut lines contained in pasted clip
454 WaveClipHolders newCutlines;
455 for (const auto &cutline: newClip->mCutLines)
456 {
457 auto cutlineCopy = std::make_unique<WaveClip>(*cutline, mSequence->GetFactory(),
458 // Recursively copy cutlines of cutlines. They don't need
459 // their offsets adjusted.
460 true);
461 cutlineCopy->Offset(t0 - GetSequenceStartTime());
462 newCutlines.push_back(std::move(cutlineCopy));
463 }
464
466
467 // Assume Strong-guarantee from Sequence::Paste
468 mSequence->Paste(s0, newClip->mSequence.get());
469
470 // Assume No-fail-guarantee in the remaining
471 MarkChanged();
472 auto sampleTime = 1.0 / GetRate();
473 mEnvelope->PasteEnvelope
474 (s0.as_double()/mRate + GetSequenceStartTime(), newClip->mEnvelope.get(), sampleTime);
475 OffsetCutLines(t0, newClip->GetPlayEndTime() - newClip->GetPlayStartTime());
476
477 for (auto &holder : newCutlines)
478 mCutLines.push_back(std::move(holder));
479}
std::vector< WaveClipHolder > WaveClipHolders
Definition: WaveClip.h:42
double GetTrimRight() const noexcept
Returns the play end offset in seconds from the ending of the underlying sequence.
Definition: WaveClip.cpp:953
double as_double() const
Definition: SampleCount.h:46

References sampleCount::as_double(), ClearSequence(), GetPlayEndTime(), GetPlayStartTime(), GetRate(), GetSequenceEndTime(), GetSequenceStartTime(), GetTrimLeft(), GetTrimRight(), MarkChanged(), mCutLines, mEnvelope, mRate, mSequence, OffsetCutLines(), SetTrimLeft(), SetTrimRight(), and TimeToSequenceSamples().

Referenced by WaveTrack::ClearAndPaste(), ExpandCutLine(), WaveTrack::MergeClips(), and WaveTrack::PasteWaveTrack().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ RemoveCutLine()

bool WaveClip::RemoveCutLine ( double  cutLinePosition)

Remove cut line, without expanding the audio in it.

Definition at line 731 of file WaveClip.cpp.

732{
733 for (auto it = mCutLines.begin(); it != mCutLines.end(); ++it)
734 {
735 const auto &cutline = *it;
736 //std::numeric_limits<double>::epsilon() or (1.0 / static_cast<double>(mRate))?
737 if (fabs(GetSequenceStartTime() + cutline->GetSequenceStartTime() - cutLinePosition) < 0.0001)
738 {
739 mCutLines.erase(it); // deletes cutline!
740 return true;
741 }
742 }
743
744 return false;
745}

References GetSequenceStartTime(), and mCutLines.

Here is the call graph for this function:

◆ Resample()

void WaveClip::Resample ( int  rate,
BasicUI::ProgressDialog progress = NULL 
)
Exception safety guarantee:
Strong

We want to keep going as long as we have something to feed the resampler with OR as long as the resampler spews out samples (which could continue for a few iterations after we stop feeding it)

Definition at line 773 of file WaveClip.cpp.

774{
775 // Note: it is not necessary to do this recursively to cutlines.
776 // They get resampled as needed when they are expanded.
777
778 if (rate == mRate)
779 return; // Nothing to do
780
781 double factor = (double)rate / (double)mRate;
782 ::Resample resample(true, factor, factor); // constant rate resampling
783
784 const size_t bufsize = 65536;
785 Floats inBuffer{ bufsize };
786 Floats outBuffer{ bufsize };
787 sampleCount pos = 0;
788 bool error = false;
789 int outGenerated = 0;
790 auto numSamples = mSequence->GetNumSamples();
791
792 auto newSequence =
793 std::make_unique<Sequence>(mSequence->GetFactory(), mSequence->GetSampleFormat());
794
800 while (pos < numSamples || outGenerated > 0)
801 {
802 const auto inLen = limitSampleBufferSize( bufsize, numSamples - pos );
803
804 bool isLast = ((pos + inLen) == numSamples);
805
806 if (!mSequence->Get((samplePtr)inBuffer.get(), floatSample, pos, inLen, true))
807 {
808 error = true;
809 break;
810 }
811
812 const auto results = resample.Process(factor, inBuffer.get(), inLen, isLast,
813 outBuffer.get(), bufsize);
814 outGenerated = results.second;
815
816 pos += results.first;
817
818 if (outGenerated < 0)
819 {
820 error = true;
821 break;
822 }
823
824 newSequence->Append((samplePtr)outBuffer.get(), floatSample,
825 outGenerated);
826
827 if (progress)
828 {
829 auto updateResult = progress->Poll(
830 pos.as_long_long(),
831 numSamples.as_long_long()
832 );
833 error = (updateResult != BasicUI::ProgressResult::Success);
834 if (error)
835 throw UserException{};
836 }
837 }
838
839 if (error)
842 XO("Resampling failed."),
843 XO("Warning"),
844 "Error:_Resampling"
845 };
846 else
847 {
848 // Use No-fail-guarantee in these steps
849 mSequence = std::move(newSequence);
850 mRate = rate;
851 Caches::ForEach( std::mem_fn( &WaveClipListener::Invalidate ) );
852 }
853}
@ Internal
Indicates internal failure from Audacity.
#define XO(s)
Definition: Internat.h:31
size_t limitSampleBufferSize(size_t bufferSize, sampleCount limit)
Definition: SampleCount.cpp:22
@ floatSample
Definition: SampleFormat.h:34
char * samplePtr
Definition: SampleFormat.h:49
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.
Interface to libsoxr.
Definition: Resample.h:27
A MessageBoxException that shows a given, unvarying string.
Can be thrown when user cancels operations, as with a progress dialog. Delayed handler does nothing.
Definition: UserException.h:17
virtual void Invalidate()=0

References floatSample, Internal, WaveClipListener::Invalidate(), limitSampleBufferSize(), mRate, mSequence, BasicUI::ProgressDialog::Poll(), Resample::Process(), BasicUI::Success, and XO.

Here is the call graph for this function:

◆ SamplesToTime()

double WaveClip::SamplesToTime ( sampleCount  s) const
noexcept

Definition at line 884 of file WaveClip.cpp.

885{
886 return s.as_double() / mRate;
887}

Referenced by GetPlayEndTime(), and GetPlayStartTime().

Here is the caller graph for this function:

◆ SetColourIndex()

void WaveClip::SetColourIndex ( int  index)
inline

Definition at line 148 of file WaveClip.h.

148{ mColourIndex = index;};

Referenced by SetClipCommand::ApplyInner(), and HandleXMLTag().

Here is the caller graph for this function:

◆ SetIsPlaceholder()

void WaveClip::SetIsPlaceholder ( bool  val)
inline

Definition at line 313 of file WaveClip.h.

313{ mIsPlaceholder = val; }

◆ SetName()

void WaveClip::SetName ( const wxString &  name)

Definition at line 869 of file WaveClip.cpp.

870{
871 mName = name;
872}
const TranslatableString name
Definition: Distortion.cpp:82

References mName, and name.

Referenced by SetClipCommand::ApplyInner(), and HandleXMLTag().

Here is the caller graph for this function:

◆ SetPlayStartTime()

void WaveClip::SetPlayStartTime ( double  time)

Definition at line 905 of file WaveClip.cpp.

906{
908}

References mTrimLeft, and SetSequenceStartTime().

Referenced by SetClipCommand::ApplyInner().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetRate()

void WaveClip::SetRate ( int  rate)

Definition at line 764 of file WaveClip.cpp.

765{
766 mRate = rate;
767 auto newLength = mSequence->GetNumSamples().as_double() / mRate;
768 mEnvelope->RescaleTimes( newLength );
769 MarkChanged();
770}

References MarkChanged(), mEnvelope, mRate, and mSequence.

Here is the call graph for this function:

◆ SetSamples()

void WaveClip::SetSamples ( constSamplePtr  buffer,
sampleFormat  format,
sampleCount  start,
size_t  len 
)
Exception safety guarantee:
Strong

Definition at line 129 of file WaveClip.cpp.

131{
132 // use Strong-guarantee
133 mSequence->SetSamples(buffer, format, start + TimeToSamples(mTrimLeft), len);
134
135 // use No-fail-guarantee
136 MarkChanged();
137}

References format, MarkChanged(), mSequence, mTrimLeft, and TimeToSamples().

Here is the call graph for this function:

◆ SetSequenceStartTime()

void WaveClip::SetSequenceStartTime ( double  startTime)

Definition at line 984 of file WaveClip.cpp.

985{
986 mSequenceOffset = startTime;
987 mEnvelope->SetOffset(startTime);
988}

References mEnvelope, and mSequenceOffset.

Referenced by WaveTrack::ClearAndPaste(), ClearLeft(), WaveTrack::HandleXMLChild(), HandleXMLTag(), and SetPlayStartTime().

Here is the caller graph for this function:

◆ SetSilence()

void WaveClip::SetSilence ( sampleCount  offset,
sampleCount  length 
)

Silences the 'length' amount of samples starting from 'offset'(relative to the play start)

Definition at line 889 of file WaveClip.cpp.

890{
891 GetSequence()->SetSilence(TimeToSamples(GetTrimLeft()) + offset, length);
892 MarkChanged();
893}
void SetSilence(sampleCount s0, sampleCount len)
Definition: Sequence.cpp:677

References GetSequence(), GetTrimLeft(), MarkChanged(), Sequence::SetSilence(), and TimeToSamples().

Here is the call graph for this function:

◆ SetTrimLeft()

void WaveClip::SetTrimLeft ( double  trim)

Sets the play start offset in seconds from the beginning of the underlying sequence.

Definition at line 938 of file WaveClip.cpp.

939{
940 mTrimLeft = std::max(.0, trim);
941}

References mTrimLeft.

Referenced by Clear(), WaveTrack::ClearAndPaste(), ClearLeft(), HandleXMLTag(), and Paste().

Here is the caller graph for this function:

◆ SetTrimRight()

void WaveClip::SetTrimRight ( double  trim)

Sets the play end offset in seconds from the ending of the underlying sequence.

Definition at line 948 of file WaveClip.cpp.

949{
950 mTrimRight = std::max(.0, trim);
951}

References mTrimRight.

Referenced by Clear(), WaveTrack::ClearAndPaste(), ClearRight(), HandleXMLTag(), InsertSilence(), and Paste().

Here is the caller graph for this function:

◆ SharesBoundaryWithNextClip()

bool WaveClip::SharesBoundaryWithNextClip ( const WaveClip next) const

Definition at line 859 of file WaveClip.cpp.

860{
861 double endThis = GetRate() * GetPlayStartTime() + GetPlaySamplesCount().as_double();
862 double startNext = next->GetRate() * next->GetPlayStartTime();
863
864 // given that a double has about 15 significant digits, using a criterion
865 // of half a sample should be safe in all normal usage.
866 return fabs(startNext - endThis) < 0.5;
867}

References sampleCount::as_double(), GetPlaySamplesCount(), GetPlayStartTime(), and GetRate().

Here is the call graph for this function:

◆ TimeToSamples()

sampleCount WaveClip::TimeToSamples ( double  time) const
noexcept

Definition at line 879 of file WaveClip.cpp.

880{
881 return sampleCount(floor(time * mRate + 0.5));
882}

Referenced by AfterPlayEndTime(), BeforePlayStartTime(), GetPlayEndTime(), GetPlaySamplesCount(), GetPlayStartSample(), GetPlayStartTime(), GetSamples(), GetSequenceStartSample(), SetSamples(), SetSilence(), TimeToSequenceSamples(), and WithinPlayRegion().

Here is the caller graph for this function:

◆ TimeToSequenceSamples()

sampleCount WaveClip::TimeToSequenceSamples ( double  t) const

Definition at line 1039 of file WaveClip.cpp.

1040{
1041 if (t < GetSequenceStartTime())
1042 return 0;
1043 else if (t > GetSequenceEndTime())
1044 return mSequence->GetNumSamples();
1045 return TimeToSamples(t - GetSequenceStartTime());
1046}

References GetSequenceEndTime(), GetSequenceStartTime(), mSequence, and TimeToSamples().

Referenced by ClearAndAddCutLine(), ClearSequence(), GetMinMax(), GetRMS(), InsertSilence(), Paste(), and WaveClip().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ToSequenceSamples()

sampleCount WaveClip::ToSequenceSamples ( sampleCount  s) const

Definition at line 1048 of file WaveClip.cpp.

1049{
1050 return s - GetSequenceStartSample();
1051}

References GetSequenceStartSample().

Here is the call graph for this function:

◆ TrimLeft()

void WaveClip::TrimLeft ( double  deltaTime)

Moves play start position by deltaTime.

Definition at line 958 of file WaveClip.cpp.

959{
960 mTrimLeft += deltaTime;
961}

References mTrimLeft.

◆ TrimLeftTo()

void WaveClip::TrimLeftTo ( double  to)

Sets the the left trimming to the absolute time (if that is in bounds)

Definition at line 968 of file WaveClip.cpp.

969{
971}

References GetPlayEndTime(), GetSequenceStartTime(), and mTrimLeft.

Here is the call graph for this function:

◆ TrimRight()

void WaveClip::TrimRight ( double  deltaTime)

Moves play end position by deltaTime.

Definition at line 963 of file WaveClip.cpp.

964{
965 mTrimRight += deltaTime;
966}

References mTrimRight.

◆ TrimRightTo()

void WaveClip::TrimRightTo ( double  to)

Sets the the right trimming to the absolute time (if that is in bounds)

Definition at line 973 of file WaveClip.cpp.

974{
976}

References GetPlayStartTime(), GetSequenceEndTime(), and mTrimRight.

Here is the call graph for this function:

◆ UpdateEnvelopeTrackLen()

void WaveClip::UpdateEnvelopeTrackLen ( )

Whenever you do an operation to the sequence that will change the number of samples (that is, the length of the clip), you will want to call this function to tell the envelope about it.

Exception safety guarantee:
No-fail

Definition at line 206 of file WaveClip.cpp.

207{
208 auto len = (mSequence->GetNumSamples().as_double()) / mRate;
209 if (len != mEnvelope->GetTrackLen())
210 mEnvelope->SetTrackLen(len, 1.0 / GetRate());
211}

References GetRate(), mEnvelope, mRate, and mSequence.

Referenced by Append(), Flush(), and HandleXMLEndTag().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ WithinPlayRegion()

bool WaveClip::WithinPlayRegion ( double  t) const

Definition at line 1021 of file WaveClip.cpp.

1022{
1023 auto ts = TimeToSamples(t);
1024 return ts > GetPlayStartSample() && ts < GetPlayEndSample() + mAppendBufferLen;
1025}

References GetPlayEndSample(), GetPlayStartSample(), mAppendBufferLen, and TimeToSamples().

Here is the call graph for this function:

◆ WriteXML()

void WaveClip::WriteXML ( XMLWriter xmlFile) const

Definition at line 386 of file WaveClip.cpp.

388{
389 xmlFile.StartTag(wxT("waveclip"));
390 xmlFile.WriteAttr(wxT("offset"), mSequenceOffset, 8);
391 xmlFile.WriteAttr(wxT("trimLeft"), mTrimLeft, 8);
392 xmlFile.WriteAttr(wxT("trimRight"), mTrimRight, 8);
393 xmlFile.WriteAttr(wxT("name"), mName);
394 xmlFile.WriteAttr(wxT("colorindex"), mColourIndex );
395
396 mSequence->WriteXML(xmlFile);
397 mEnvelope->WriteXML(xmlFile);
398
399 for (const auto &clip: mCutLines)
400 clip->WriteXML(xmlFile);
401
402 xmlFile.EndTag(wxT("waveclip"));
403}
wxT("CloseDown"))
virtual void StartTag(const wxString &name)
Definition: XMLWriter.cpp:80
void WriteAttr(const wxString &name, const Identifier &value)
Definition: XMLWriter.h:37
virtual void EndTag(const wxString &name)
Definition: XMLWriter.cpp:103

References wxT().

Here is the call graph for this function:

Member Data Documentation

◆ mAppendBuffer

SampleBuffer WaveClip::mAppendBuffer {}
protected

Definition at line 347 of file WaveClip.h.

Referenced by Append(), and Flush().

◆ mAppendBufferLen

size_t WaveClip::mAppendBufferLen { 0 }
protected

◆ mColourIndex

int WaveClip::mColourIndex
protected

Definition at line 342 of file WaveClip.h.

Referenced by WaveClip().

◆ mCutLines

WaveClipHolders WaveClip::mCutLines {}
protected

◆ mEnvelope

std::unique_ptr<Envelope> WaveClip::mEnvelope
protected

◆ mIsPlaceholder

bool WaveClip::mIsPlaceholder { false }
protected

Definition at line 355 of file WaveClip.h.

Referenced by WaveClip().

◆ mName

wxString WaveClip::mName
private

Definition at line 358 of file WaveClip.h.

Referenced by GetName(), SetName(), and WaveClip().

◆ mRate

int WaveClip::mRate
protected

◆ mSequence

std::unique_ptr<Sequence> WaveClip::mSequence
protected

◆ mSequenceOffset

double WaveClip::mSequenceOffset { 0 }
protected

◆ mTrimLeft

double WaveClip::mTrimLeft { 0 }
protected

◆ mTrimRight

double WaveClip::mTrimRight { 0 }
protected

The documentation for this class was generated from the following files: