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}
static RegisteredToolbarFactory factory
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

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

References 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 120 of file WaveClip.cpp.

121{
122}

Member Function Documentation

◆ AfterPlayEndTime()

bool WaveClip::AfterPlayEndTime ( double  t) const

Definition at line 1031 of file WaveClip.cpp.

1032{
1033 auto ts = TimeToSamples(t);
1034 return ts >= GetPlayEndSample() + mAppendBufferLen;
1035}
size_t mAppendBufferLen
Definition: WaveClip.h:348
sampleCount GetPlayEndSample() const
Definition: WaveClip.cpp:925
sampleCount TimeToSamples(double time) const noexcept
Definition: WaveClip.cpp:877

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:151
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 520 of file WaveClip.cpp.

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

References GetPlayEndTime(), and InsertSilence().

Here is the call graph for this function:

◆ BeforePlayStartTime()

bool WaveClip::BeforePlayStartTime ( double  t) const

Definition at line 1025 of file WaveClip.cpp.

1026{
1027 auto ts = TimeToSamples(t);
1028 return ts <= GetPlayStartSample();
1029}
sampleCount GetPlayStartSample() const
Definition: WaveClip.cpp:920

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 527 of file WaveClip.cpp.

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

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 629 of file WaveClip.cpp.

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

551{
552 if (t > GetPlayStartTime() && t < GetPlayEndTime())
553 {
555 SetTrimLeft(.0);
557 }
558}
void SetSequenceStartTime(double startTime)
Definition: WaveClip.cpp:982

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 560 of file WaveClip.cpp.

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

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 569 of file WaveClip.cpp.

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

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 755 of file WaveClip.cpp.

756{
758 for (const auto &cutline: mCutLines)
759 cutline->CloseLock();
760}
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 697 of file WaveClip.cpp.

698{
699 auto end = mCutLines.end();
700 auto it = std::find_if( mCutLines.begin(), end,
701 [&](const WaveClipHolder &cutline) {
702 return fabs(GetSequenceStartTime() + cutline->GetSequenceStartTime() - cutLinePosition) < 0.0001;
703 } );
704
705 if ( it != end ) {
706 auto cutline = it->get();
707 // assume Strong-guarantee from Paste
708
709 // Envelope::Paste takes offset into account, WaveClip::Paste doesn't!
710 // Do this to get the right result:
711 cutline->mEnvelope->SetOffset(0);
712
713 Paste(GetSequenceStartTime()+cutline->GetSequenceStartTime(), cutline);
714 // Now erase the cutline,
715 // but be careful to find it again, because Paste above may
716 // have modified the array of cutlines (if our cutline contained
717 // another cutline!), invalidating the iterator we had.
718 end = mCutLines.end();
719 it = std::find_if(mCutLines.begin(), end,
720 [=](const WaveClipHolder &p) { return p.get() == cutline; });
721 if (it != end)
722 mCutLines.erase(it); // deletes cutline!
723 else {
724 wxASSERT(false);
725 }
726 }
727}
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 677 of file WaveClip.cpp.

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

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 156 of file WaveClip.cpp.

158{
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 mSequence, THROW_INCONSISTENCY_EXCEPTION, and TimeToSequenceSamples().

Here is the call graph for this function:

◆ GetName()

const wxString & WaveClip::GetName ( ) const

Definition at line 872 of file WaveClip.cpp.

873{
874 return mName;
875}

References mName.

◆ GetPlayEndSample()

sampleCount WaveClip::GetPlayEndSample ( ) const

Definition at line 925 of file WaveClip.cpp.

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

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 908 of file WaveClip.cpp.

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

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(), 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 930 of file WaveClip.cpp.

931{
932 return mSequence->GetNumSamples()
934}

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 920 of file WaveClip.cpp.

921{
923}

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 898 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(), 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 124 of file WaveClip.cpp.

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

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 141 of file WaveClip.cpp.

142{
143 return &mSequence->GetBlockArray();
144}

References mSequence.

◆ GetSequenceBlockArray() [2/2]

const BlockArray * WaveClip::GetSequenceBlockArray ( ) const

Definition at line 146 of file WaveClip.cpp.

147{
148 return &mSequence->GetBlockArray();
149}

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 1004 of file WaveClip.cpp.

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

References GetSequenceStartSample(), and mSequence.

Here is the call graph for this function:

◆ GetSequenceEndTime()

double WaveClip::GetSequenceEndTime ( ) const

Definition at line 988 of file WaveClip.cpp.

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

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 893 of file WaveClip.cpp.

894{
895 return mSequence->GetNumSamples();
896}

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 999 of file WaveClip.cpp.

1000{
1002}

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 976 of file WaveClip.cpp.

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

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 941 of file WaveClip.cpp.

942{
943 return mTrimLeft;
944}

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 951 of file WaveClip.cpp.

952{
953 return mTrimRight;
954}

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:867
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 481 of file WaveClip.cpp.

482{
483 if (t == GetPlayStartTime() && t > GetSequenceStartTime())
485 else if (t == GetPlayEndTime() && t < GetSequenceEndTime()) {
487 SetTrimRight(.0);
488 }
489
490 auto s0 = TimeToSequenceSamples(t);
491 auto slen = (sampleCount)floor(len * mRate + 0.5);
492
493 // use Strong-guarantee
494 GetSequence()->InsertSilence(s0, slen);
495
496 // use No-fail-guarantee
497 OffsetCutLines(t, len);
498
499 const auto sampleTime = 1.0 / GetRate();
500 auto pEnvelope = GetEnvelope();
501 if ( pEnvelopeValue ) {
502
503 // Preserve limit value at the end
504 auto oldLen = pEnvelope->GetTrackLen();
505 auto newLen = oldLen + len;
506 pEnvelope->Cap( sampleTime );
507
508 // Ramp across the silence to the given value
509 pEnvelope->SetTrackLen( newLen, sampleTime );
510 pEnvelope->InsertOrReplace
511 ( pEnvelope->GetOffset() + newLen, *pEnvelopeValue );
512 }
513 else
514 pEnvelope->InsertSpace( t, len );
515
516 MarkChanged();
517}
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:746
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 151 of file WaveClip.cpp.

152{
153 Caches::ForEach( std::mem_fn( &WaveClipListener::MarkChanged ) );
154}
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 1009 of file WaveClip.cpp.

1010{
1012}

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 746 of file WaveClip.cpp.

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

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 other->GetPlayStartTime(), other->GetPlayEndTime());
438 }
439
440 if (clipNeedsResampling || clipNeedsNewFormat)
441 {
442 auto copy = std::make_unique<WaveClip>(*newClip.get(), mSequence->GetFactory(), true);
443 if (clipNeedsResampling)
444 // The other clip's rate is different from ours, so resample
445 copy->Resample(mRate);
446 if (clipNeedsNewFormat)
447 // Force sample formats to match.
448 copy->ConvertToSampleFormat(mSequence->GetSampleFormat());
449 newClip = std::move(copy);
450 }
451
452 // Paste cut lines contained in pasted clip
453 WaveClipHolders newCutlines;
454 for (const auto &cutline: newClip->mCutLines)
455 {
456 auto cutlineCopy = std::make_unique<WaveClip>(*cutline, mSequence->GetFactory(),
457 // Recursively copy cutlines of cutlines. They don't need
458 // their offsets adjusted.
459 true);
460 cutlineCopy->Offset(t0 - GetSequenceStartTime());
461 newCutlines.push_back(std::move(cutlineCopy));
462 }
463
465
466 // Assume Strong-guarantee from Sequence::Paste
467 mSequence->Paste(s0, newClip->mSequence.get());
468
469 // Assume No-fail-guarantee in the remaining
470 MarkChanged();
471 auto sampleTime = 1.0 / GetRate();
472 mEnvelope->PasteEnvelope
473 (s0.as_double()/mRate + GetSequenceStartTime(), newClip->mEnvelope.get(), sampleTime);
474 OffsetCutLines(t0, newClip->GetPlayEndTime() - newClip->GetPlayStartTime());
475
476 for (auto &holder : newCutlines)
477 mCutLines.push_back(std::move(holder));
478}
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:951
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 729 of file WaveClip.cpp.

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

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 771 of file WaveClip.cpp.

772{
773 // Note: it is not necessary to do this recursively to cutlines.
774 // They get resampled as needed when they are expanded.
775
776 if (rate == mRate)
777 return; // Nothing to do
778
779 double factor = (double)rate / (double)mRate;
780 ::Resample resample(true, factor, factor); // constant rate resampling
781
782 const size_t bufsize = 65536;
783 Floats inBuffer{ bufsize };
784 Floats outBuffer{ bufsize };
785 sampleCount pos = 0;
786 bool error = false;
787 int outGenerated = 0;
788 auto numSamples = mSequence->GetNumSamples();
789
790 auto newSequence =
791 std::make_unique<Sequence>(mSequence->GetFactory(), mSequence->GetSampleFormat());
792
798 while (pos < numSamples || outGenerated > 0)
799 {
800 const auto inLen = limitSampleBufferSize( bufsize, numSamples - pos );
801
802 bool isLast = ((pos + inLen) == numSamples);
803
804 if (!mSequence->Get((samplePtr)inBuffer.get(), floatSample, pos, inLen, true))
805 {
806 error = true;
807 break;
808 }
809
810 const auto results = resample.Process(factor, inBuffer.get(), inLen, isLast,
811 outBuffer.get(), bufsize);
812 outGenerated = results.second;
813
814 pos += results.first;
815
816 if (outGenerated < 0)
817 {
818 error = true;
819 break;
820 }
821
822 newSequence->Append((samplePtr)outBuffer.get(), floatSample,
823 outGenerated);
824
825 if (progress)
826 {
827 auto updateResult = progress->Poll(
828 pos.as_long_long(),
829 numSamples.as_long_long()
830 );
831 error = (updateResult != BasicUI::ProgressResult::Success);
832 if (error)
833 throw UserException{};
834 }
835 }
836
837 if (error)
840 XO("Resampling failed."),
841 XO("Warning"),
842 "Error:_Resampling"
843 };
844 else
845 {
846 // Use No-fail-guarantee in these steps
847 mSequence = std::move(newSequence);
848 mRate = rate;
849 Caches::ForEach( std::mem_fn( &WaveClipListener::Invalidate ) );
850 }
851}
@ 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 882 of file WaveClip.cpp.

883{
884 return s.as_double() / mRate;
885}

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 867 of file WaveClip.cpp.

868{
869 mName = name;
870}
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 903 of file WaveClip.cpp.

904{
906}

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 762 of file WaveClip.cpp.

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

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 131 of file WaveClip.cpp.

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

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

Here is the call graph for this function:

◆ SetSequenceStartTime()

void WaveClip::SetSequenceStartTime ( double  startTime)

Definition at line 982 of file WaveClip.cpp.

983{
984 mSequenceOffset = startTime;
985 mEnvelope->SetOffset(startTime);
986}

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 887 of file WaveClip.cpp.

888{
889 GetSequence()->SetSilence(TimeToSamples(GetTrimLeft()) + offset, length);
890 MarkChanged();
891}
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 936 of file WaveClip.cpp.

937{
938 mTrimLeft = std::max(.0, trim);
939}

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 946 of file WaveClip.cpp.

947{
948 mTrimRight = std::max(.0, trim);
949}

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 857 of file WaveClip.cpp.

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

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 877 of file WaveClip.cpp.

878{
879 return sampleCount(floor(time * mRate + 0.5));
880}

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 1037 of file WaveClip.cpp.

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

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 1046 of file WaveClip.cpp.

1047{
1048 return s - GetSequenceStartSample();
1049}

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 956 of file WaveClip.cpp.

957{
958 mTrimLeft += deltaTime;
959}

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 966 of file WaveClip.cpp.

967{
969}

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 961 of file WaveClip.cpp.

962{
963 mTrimRight += deltaTime;
964}

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 971 of file WaveClip.cpp.

972{
974}

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 1019 of file WaveClip.cpp.

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

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}
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

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: