![]() |
Audacity 3.2.0
|
This allows multiple clips to be a part of one WaveTrack. More...
#include <WaveClip.h>
Public Types | |
using | Caches = 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) | |
Copy only a range from the given WaveClip. More... | |
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 |
sampleCount | CountSamples (double t0, double t1) 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, sampleFormat effectiveFormat) |
Envelope * | GetEnvelope () |
const Envelope * | GetEnvelope () const |
BlockArray * | GetSequenceBlockArray () |
const BlockArray * | GetSequenceBlockArray () const |
Sequence * | GetSequence () |
const Sequence * | GetSequence () 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< SampleBlock > | AppendNewBlock (samplePtr buffer, sampleFormat format, size_t len) |
For use in importing pre-version-3 projects to preserve sharing of blocks; no dithering applied. 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, sampleFormat effectiveFormat) |
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) |
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) |
WaveClipHolders & | GetCutLines () |
Get access to cut lines list. More... | |
const WaveClipConstHolders & | GetCutLines () 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 |
XMLTagHandler * | HandleXMLChild (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... | |
constSamplePtr | GetAppendBuffer () const |
size_t | GetAppendBufferLen () const |
![]() | |
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 XMLTagHandler * | HandleXMLChild (const std::string_view &tag)=0 |
void | ReadXMLEndTag (const char *tag) |
void | ReadXMLContent (const char *s, int len) |
XMLTagHandler * | ReadXMLChild (const char *tag) |
![]() | |
~Site () | |
Site () | |
Site (const Site &other) | |
Site (Site &&other) | |
Site & | operator= (const Site &other) |
Site & | operator= (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) |
![]() | |
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... | |
WaveClipListener * | FindIf (const Function &function) |
Return pointer to first attachment in this that is not null and satisfies a predicate, or nullptr. More... | |
const WaveClipListener * | FindIf (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< Sequence > | mSequence |
std::unique_ptr< Envelope > | mEnvelope |
WaveClipHolders | mCutLines {} |
bool | mIsPlaceholder { false } |
Private Member Functions | |
WaveClip (const WaveClip &) PROHIBITED | |
WaveClip & | operator= (const WaveClip &) PROHIBITED |
Private Attributes | |
wxString | mName |
Additional Inherited Members | |
![]() | |
static size_t | slots () |
How many static factories have been registered with this specialization of Site. More... | |
This allows multiple clips to be a part of one WaveTrack.
Definition at line 99 of file WaveClip.h.
using WaveClip::Caches = Site< WaveClip, WaveClipListener > |
Definition at line 110 of file WaveClip.h.
|
private |
WaveClip::WaveClip | ( | const SampleBlockFactoryPtr & | factory, |
sampleFormat | format, | ||
int | rate, | ||
int | colourIndex | ||
) |
Definition at line 41 of file WaveClip.cpp.
References cloud::factory, format, mColourIndex, mEnvelope, mRate, mSequence, and narrowestSampleFormat.
WaveClip::WaveClip | ( | const WaveClip & | orig, |
const SampleBlockFactoryPtr & | factory, | ||
bool | copyCutlines | ||
) |
Definition at line 52 of file WaveClip.cpp.
References cloud::factory, GetIsPlaceholder(), mColourIndex, mCutLines, mEnvelope, mIsPlaceholder, mName, mRate, mSequence, mSequenceOffset, mTrimLeft, and mTrimRight.
WaveClip::WaveClip | ( | const WaveClip & | orig, |
const SampleBlockFactoryPtr & | factory, | ||
bool | copyCutlines, | ||
double | t0, | ||
double | t1 | ||
) |
Copy only a range from the given WaveClip.
Definition at line 79 of file WaveClip.cpp.
References CountSamples(), cloud::factory, GetIsPlaceholder(), GetPlayEndTime(), GetPlayStartTime(), GetSequenceEndTime(), GetSequenceStartTime(), mColourIndex, mCutLines, mEnvelope, mIsPlaceholder, mRate, mSequence, mSequenceOffset, mTrimLeft, mTrimRight, SamplesToTime(), and TimeToSamples().
|
virtual |
Definition at line 120 of file WaveClip.cpp.
bool WaveClip::AfterPlayEndTime | ( | double | t | ) | const |
Definition at line 1011 of file WaveClip.cpp.
References GetAppendBufferLen(), GetPlayEndSample(), and TimeToSamples().
bool WaveClip::Append | ( | constSamplePtr | buffer, |
sampleFormat | format, | ||
size_t | len, | ||
unsigned int | stride, | ||
sampleFormat | effectiveFormat | ||
) |
You must call Flush after the last Append
effectiveFormat | Make the effective format of the data at least the minumum of this value and `format`. (Maybe wider, if merging with preexistent data.) If the data are later narrowed from stored format, but not narrower than the effective, then no dithering will occur. |
Definition at line 242 of file WaveClip.cpp.
References format, MarkChanged(), mSequence, and UpdateEnvelopeTrackLen().
Referenced by WaveTrack::Append().
std::shared_ptr< SampleBlock > WaveClip::AppendNewBlock | ( | samplePtr | buffer, |
sampleFormat | format, | ||
size_t | len | ||
) |
void WaveClip::AppendSharedBlock | ( | const std::shared_ptr< SampleBlock > & | pBlock | ) |
For use in importing pre-version-3 projects to preserve sharing of blocks.
Definition at line 234 of file WaveClip.cpp.
References mSequence.
void WaveClip::AppendSilence | ( | double | len, |
double | envelopeValue | ||
) |
Insert silence at the end, and causes the envelope to ramp linearly to the given value
Definition at line 492 of file WaveClip.cpp.
References GetPlayEndTime(), and InsertSilence().
bool WaveClip::BeforePlayStartTime | ( | double | t | ) | const |
Definition at line 1005 of file WaveClip.cpp.
References GetPlayStartSample(), and TimeToSamples().
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)
Definition at line 499 of file WaveClip.cpp.
References ClearSequence(), GetPlayEndTime(), GetPlayStartTime(), GetSequenceEndTime(), GetSequenceStartTime(), GetTrimLeft(), Offset(), SetTrimLeft(), and SetTrimRight().
void WaveClip::ClearAndAddCutLine | ( | double | t0, |
double | t1 | ||
) |
Clear, and add cut line that starts at t0 and contains everything until t1 if there is at least one clip sample between t0 and t1, noop otherwise.
Definition at line 601 of file WaveClip.cpp.
References Envelope::CollapseRegion(), CountSamples(), Sequence::Delete(), GetEnvelope(), GetPlayEndTime(), GetPlayStartTime(), GetRate(), GetSequence(), GetSequenceStartTime(), MarkChanged(), mCutLines, min(), mSequence, Offset(), and TimeToSequenceSamples().
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 522 of file WaveClip.cpp.
References ClearSequence(), GetPlayEndTime(), GetPlayStartTime(), GetSequenceStartTime(), SetSequenceStartTime(), and SetTrimLeft().
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 532 of file WaveClip.cpp.
References ClearSequence(), GetPlayEndTime(), GetPlayStartTime(), GetSequenceEndTime(), and SetTrimRight().
|
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 541 of file WaveClip.cpp.
References Envelope::CollapseRegion(), Sequence::Delete(), GetEnvelope(), GetRate(), GetSequence(), GetSequenceEndTime(), GetSequenceStartTime(), MarkChanged(), mCutLines, min(), Offset(), and TimeToSequenceSamples().
Referenced by Clear(), ClearLeft(), ClearRight(), InsertSilence(), and Paste().
void WaveClip::CloseLock | ( | ) |
Definition at line 728 of file WaveClip.cpp.
References Sequence::CloseLock(), GetSequence(), and mCutLines.
void WaveClip::ConvertToSampleFormat | ( | sampleFormat | format, |
const std::function< void(size_t)> & | progressReport = {} |
||
) |
Definition at line 207 of file WaveClip.cpp.
References format, MarkChanged(), and mSequence.
sampleCount WaveClip::CountSamples | ( | double | t0, |
double | t1 | ||
) | const |
Counts number of samples within t0 and t1 region. t0 and t1 are rounded to the nearest clip sample boundary, i.e. relative to clips start time offset.
Definition at line 1017 of file WaveClip.cpp.
References GetPlayEndTime(), GetPlayStartTime(), min(), and TimeToSamples().
Referenced by ClearAndAddCutLine(), and WaveClip().
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
Definition at line 670 of file WaveClip.cpp.
References PackedArray::end(), GetSequenceStartTime(), mCutLines, and Paste().
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 649 of file WaveClip.cpp.
References GetSequenceStartTime(), and mCutLines.
void WaveClip::Flush | ( | ) |
Flush must be called after last Append.
Definition at line 260 of file WaveClip.cpp.
References GetAppendBufferLen(), MarkChanged(), mSequence, and UpdateEnvelopeTrackLen().
Referenced by WaveTrack::Flush().
constSamplePtr WaveClip::GetAppendBuffer | ( | ) | const |
Definition at line 157 of file WaveClip.cpp.
References Sequence::GetAppendBuffer(), and GetSequence().
Referenced by WaveClipWaveformCache::GetWaveDisplay().
size_t WaveClip::GetAppendBufferLen | ( | ) | const |
Definition at line 152 of file WaveClip.cpp.
References Sequence::GetAppendBufferLen(), and GetSequence().
Referenced by AfterPlayEndTime(), Flush(), GetPlayEndTime(), GetSequenceEndTime(), WaveClipWaveformCache::GetWaveDisplay(), and WithinPlayRegion().
|
inline |
Definition at line 150 of file WaveClip.h.
Referenced by anonymous_namespace{WaveformView.cpp}::DrawClipWaveform().
|
inline |
|
inline |
Definition at line 299 of file WaveClip.h.
|
inline |
Definition at line 219 of file WaveClip.h.
Referenced by SetEnvelopeCommand::ApplyInner(), ClearAndAddCutLine(), ClearSequence(), anonymous_namespace{WaveformView.cpp}::DrawClipWaveform(), anonymous_namespace{WaveformView.cpp}::DrawIndividualSamples(), WaveTrack::GetEnvelopeAtTime(), AUPImportFileHandle::HandleEnvelope(), WaveTrack::HandleXMLChild(), and InsertSilence().
|
inline |
Definition at line 220 of file WaveClip.h.
|
inline |
Definition at line 334 of file WaveClip.h.
Referenced by WaveClip().
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 167 of file WaveClip.cpp.
References GetPlayEndTime(), GetPlayStartTime(), min(), mSequence, THROW_INCONSISTENCY_EXCEPTION, and TimeToSequenceSamples().
const wxString & WaveClip::GetName | ( | ) | const |
sampleCount WaveClip::GetPlayEndSample | ( | ) | const |
Definition at line 905 of file WaveClip.cpp.
References GetPlaySamplesCount(), and GetPlayStartSample().
Referenced by AfterPlayEndTime(), EffectReverse::ProcessOneWave(), and WithinPlayRegion().
double WaveClip::GetPlayEndTime | ( | ) | const |
Definition at line 888 of file WaveClip.cpp.
References GetAppendBufferLen(), GetSequenceStartTime(), 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(), CountSamples(), ClipParameters::GetClipRect(), GetMinMax(), InsertSilence(), WaveTrackUtils::IsClipSelected(), WaveTrack::MergeClips(), Paste(), WaveTrack::PasteWaveTrack(), TrimLeftTo(), WaveTrackLocations::Update(), and WaveClip().
sampleCount WaveClip::GetPlaySamplesCount | ( | ) | const |
Definition at line 910 of file WaveClip.cpp.
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().
sampleCount WaveClip::GetPlayStartSample | ( | ) | const |
Definition at line 900 of file WaveClip.cpp.
References GetPlayStartTime(), and TimeToSamples().
Referenced by BeforePlayStartTime(), GetPlayEndSample(), EffectReverse::ProcessOneWave(), and WithinPlayRegion().
|
noexcept |
Definition at line 878 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(), CountSamples(), anonymous_namespace{WaveformView.cpp}::DrawIndividualSamples(), ClipParameters::GetClipRect(), GetMinMax(), GetPlayStartSample(), InsertSilence(), WaveTrackUtils::IsClipSelected(), Paste(), WaveTrack::PasteWaveTrack(), WaveTrack::RightmostOrNewClip(), SharesBoundaryWithNextClip(), TrimRightTo(), and WaveClip().
|
inline |
Definition at line 140 of file WaveClip.h.
Referenced by ClearAndAddCutLine(), ClearSequence(), ClipParameters::ClipParameters(), anonymous_namespace{WaveformView.cpp}::DrawIndividualSamples(), ClipParameters::GetClipRect(), WaveClipSpectrumCache::GetSpectrogram(), WaveClipWaveformCache::GetWaveDisplay(), InsertSilence(), Paste(), SharesBoundaryWithNextClip(), and UpdateEnvelopeTrackLen().
float WaveClip::GetRMS | ( | double | t0, |
double | t1, | ||
bool | mayThrow = true |
||
) | const |
Definition at line 190 of file WaveClip.cpp.
References mSequence, THROW_INCONSISTENCY_EXCEPTION, and TimeToSequenceSamples().
bool WaveClip::GetSamples | ( | samplePtr | buffer, |
sampleFormat | format, | ||
sampleCount | start, | ||
size_t | len, | ||
bool | mayThrow = true |
||
) | const |
Definition at line 124 of file WaveClip.cpp.
References format, mSequence, mTrimLeft, and TimeToSamples().
Referenced by anonymous_namespace{WaveformView.cpp}::DrawIndividualSamples().
|
inline |
Definition at line 227 of file WaveClip.h.
Referenced by ClearAndAddCutLine(), ClearSequence(), CloseLock(), GetAppendBuffer(), GetAppendBufferLen(), WaveTrack::GetIdealBlockSize(), WaveTrack::GetSequenceAtTime(), WaveClipWaveformCache::GetWaveDisplay(), AUPImportFileHandle::HandleSequence(), WaveTrack::HandleXMLChild(), InsertSilence(), and SetSilence().
|
inline |
Definition at line 228 of file WaveClip.h.
BlockArray * WaveClip::GetSequenceBlockArray | ( | ) |
Definition at line 142 of file WaveClip.cpp.
References mSequence.
const BlockArray * WaveClip::GetSequenceBlockArray | ( | ) | const |
Definition at line 147 of file WaveClip.cpp.
References mSequence.
sampleCount WaveClip::GetSequenceEndSample | ( | ) | const |
Returns the index of the sample next after the last sample of the underlying sequence.
Definition at line 984 of file WaveClip.cpp.
References GetSequenceStartSample(), and mSequence.
double WaveClip::GetSequenceEndTime | ( | ) | const |
Definition at line 968 of file WaveClip.cpp.
References GetAppendBufferLen(), GetSequenceStartTime(), mRate, and mSequence.
Referenced by Clear(), ClearRight(), ClearSequence(), InsertSilence(), Paste(), TimeToSequenceSamples(), TrimRightTo(), and WaveClip().
sampleCount WaveClip::GetSequenceSamplesCount | ( | ) | const |
Returns the total number of samples in underlying sequence (not counting the cutlines)
Definition at line 873 of file WaveClip.cpp.
References mSequence.
Referenced by WaveClipSpectrumCache::GetSpectrogram().
sampleCount WaveClip::GetSequenceStartSample | ( | ) | const |
Returns the index of the first sample of the underlying sequence.
Definition at line 979 of file WaveClip.cpp.
References mSequenceOffset, and TimeToSamples().
Referenced by GetSequenceEndSample(), and ToSequenceSamples().
|
noexcept |
Definition at line 956 of file WaveClip.cpp.
References mSequenceOffset.
Referenced by Clear(), ClearAndAddCutLine(), WaveTrack::ClearAndPaste(), ClearLeft(), ClearSequence(), ExpandCutLine(), FindCutLine(), GetPlayEndTime(), GetSequenceEndTime(), WaveClipSpectrumCache::GetSpectrogram(), InsertSilence(), OffsetCutLines(), Paste(), RemoveCutLine(), TimeToSequenceSamples(), TrimLeftTo(), WaveTrackLocations::Update(), and WaveClip().
|
noexcept |
Returns the play start offset in seconds from the beginning of the underlying sequence.
Definition at line 921 of file WaveClip.cpp.
References mTrimLeft.
Referenced by Clear(), WaveTrack::ClearAndPaste(), WaveClipSpectrumCache::GetSpectrogram(), WaveClipWaveformCache::GetWaveDisplay(), Paste(), and SetSilence().
|
noexcept |
Returns the play end offset in seconds from the ending of the underlying sequence.
Definition at line 931 of file WaveClip.cpp.
References mTrimRight.
Referenced by WaveTrack::ClearAndPaste(), WaveClipSpectrumCache::GetSpectrogram(), and Paste().
|
overridevirtual |
Implements XMLTagHandler.
Definition at line 332 of file WaveClip.cpp.
References format, mCutLines, mEnvelope, mRate, and mSequence.
Referenced by AUPImportFileHandle::HandleWaveClip().
|
override |
Definition at line 326 of file WaveClip.cpp.
References UpdateEnvelopeTrackLen().
Referenced by WaveTrack::HandleXMLEndTag().
|
overridevirtual |
Implements XMLTagHandler.
Definition at line 279 of file WaveClip.cpp.
References SetColourIndex(), SetName(), SetSequenceStartTime(), SetTrimLeft(), and SetTrimRight().
void WaveClip::InsertSilence | ( | double | t, |
double | len, | ||
double * | pEnvelopeValue = nullptr |
||
) |
Insert silence - note that this is an efficient operation for large amounts of silence
Definition at line 453 of file WaveClip.cpp.
References ClearSequence(), GetEnvelope(), GetPlayEndTime(), GetPlayStartTime(), GetRate(), GetSequence(), GetSequenceEndTime(), GetSequenceStartTime(), Sequence::InsertSilence(), MarkChanged(), mRate, OffsetCutLines(), SetTrimRight(), and TimeToSequenceSamples().
Referenced by AUPImportFileHandle::AddSilence(), and AppendSilence().
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.
Definition at line 162 of file WaveClip.cpp.
References WaveClipListener::MarkChanged().
Referenced by Append(), ClearAndAddCutLine(), ClearSequence(), ConvertToSampleFormat(), Flush(), InsertSilence(), Paste(), SetRate(), SetSamples(), and SetSilence().
|
inline |
Definition at line 301 of file WaveClip.h.
Referenced by WaveTrackLocations::Update().
|
noexcept |
Definition at line 989 of file WaveClip.cpp.
Referenced by Clear(), ClearAndAddCutLine(), WaveTrack::ClearAndPaste(), ClearSequence(), and WaveTrack::Copy().
void WaveClip::OffsetCutLines | ( | double | t0, |
double | len | ||
) |
Offset cutlines right to time 't0' by time amount 'len'.
Definition at line 719 of file WaveClip.cpp.
References GetSequenceStartTime(), and mCutLines.
Referenced by InsertSilence(), and Paste().
void WaveClip::Paste | ( | double | t0, |
const WaveClip * | other | ||
) |
Paste data from other clip, resampling it if not equal rate.
Definition at line 374 of file WaveClip.cpp.
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().
bool WaveClip::RemoveCutLine | ( | double | cutLinePosition | ) |
Remove cut line, without expanding the audio in it.
Definition at line 702 of file WaveClip.cpp.
References GetSequenceStartTime(), and mCutLines.
void WaveClip::Resample | ( | int | rate, |
BasicUI::ProgressDialog * | progress = NULL |
||
) |
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 748 of file WaveClip.cpp.
References floatSample, Internal, WaveClipListener::Invalidate(), limitSampleBufferSize(), mRate, mSequence, BasicUI::ProgressDialog::Poll(), Resample::Process(), BasicUI::Success, widestSampleFormat, and XO().
|
noexcept |
Definition at line 862 of file WaveClip.cpp.
Referenced by GetPlayEndTime(), GetPlayStartTime(), SetRate(), and WaveClip().
|
inline |
Definition at line 149 of file WaveClip.h.
Referenced by SetClipCommand::ApplyInner(), and HandleXMLTag().
|
inline |
Definition at line 335 of file WaveClip.h.
void WaveClip::SetName | ( | const wxString & | name | ) |
Definition at line 847 of file WaveClip.cpp.
Referenced by SetClipCommand::ApplyInner(), HandleXMLTag(), and PasteOverPreservingClips().
void WaveClip::SetPlayStartTime | ( | double | time | ) |
Definition at line 883 of file WaveClip.cpp.
References mTrimLeft, and SetSequenceStartTime().
Referenced by SetClipCommand::ApplyInner().
void WaveClip::SetRate | ( | int | rate | ) |
Definition at line 735 of file WaveClip.cpp.
References MarkChanged(), mEnvelope, mRate, mSequence, mTrimLeft, mTrimRight, SamplesToTime(), and TimeToSamples().
void WaveClip::SetSamples | ( | constSamplePtr | buffer, |
sampleFormat | format, | ||
sampleCount | start, | ||
size_t | len, | ||
sampleFormat | effectiveFormat | ||
) |
effectiveFormat | Make the effective format of the data at least the minumum of this value and `format`. (Maybe wider, if merging with preexistent data.) If the data are later narrowed from stored format, but not narrower than the effective, then no dithering will occur. |
Definition at line 131 of file WaveClip.cpp.
References format, MarkChanged(), mSequence, mTrimLeft, and TimeToSamples().
void WaveClip::SetSequenceStartTime | ( | double | startTime | ) |
Definition at line 962 of file WaveClip.cpp.
References mEnvelope, and mSequenceOffset.
Referenced by WaveTrack::ClearAndPaste(), ClearLeft(), WaveTrack::HandleXMLChild(), HandleXMLTag(), and SetPlayStartTime().
void WaveClip::SetSilence | ( | sampleCount | offset, |
sampleCount | length | ||
) |
Silences the 'length' amount of samples starting from 'offset'(relative to the play start)
Definition at line 867 of file WaveClip.cpp.
References GetSequence(), GetTrimLeft(), MarkChanged(), Sequence::SetSilence(), and TimeToSamples().
void WaveClip::SetTrimLeft | ( | double | trim | ) |
Sets the play start offset in seconds from the beginning of the underlying sequence.
Definition at line 916 of file WaveClip.cpp.
References mTrimLeft.
Referenced by Clear(), WaveTrack::ClearAndPaste(), ClearLeft(), HandleXMLTag(), and Paste().
void WaveClip::SetTrimRight | ( | double | trim | ) |
Sets the play end offset in seconds from the ending of the underlying sequence.
Definition at line 926 of file WaveClip.cpp.
References mTrimRight.
Referenced by Clear(), WaveTrack::ClearAndPaste(), ClearRight(), HandleXMLTag(), InsertSilence(), and Paste().
bool WaveClip::SharesBoundaryWithNextClip | ( | const WaveClip * | next | ) | const |
Definition at line 837 of file WaveClip.cpp.
References sampleCount::as_double(), GetPlaySamplesCount(), GetPlayStartTime(), and GetRate().
|
noexcept |
Definition at line 857 of file WaveClip.cpp.
Referenced by AfterPlayEndTime(), BeforePlayStartTime(), CountSamples(), GetPlayEndTime(), GetPlaySamplesCount(), GetPlayStartSample(), GetPlayStartTime(), GetSamples(), GetSequenceStartSample(), SetRate(), SetSamples(), SetSilence(), TimeToSequenceSamples(), WaveClip(), and WithinPlayRegion().
sampleCount WaveClip::TimeToSequenceSamples | ( | double | t | ) | const |
Definition at line 1030 of file WaveClip.cpp.
References GetSequenceEndTime(), GetSequenceStartTime(), mSequence, and TimeToSamples().
Referenced by ClearAndAddCutLine(), ClearSequence(), GetMinMax(), GetRMS(), InsertSilence(), and Paste().
sampleCount WaveClip::ToSequenceSamples | ( | sampleCount | s | ) | const |
Definition at line 1039 of file WaveClip.cpp.
References GetSequenceStartSample().
void WaveClip::TrimLeft | ( | double | deltaTime | ) |
Moves play start position by deltaTime.
Definition at line 936 of file WaveClip.cpp.
References mTrimLeft.
void WaveClip::TrimLeftTo | ( | double | to | ) |
Sets the the left trimming to the absolute time (if that is in bounds)
Definition at line 946 of file WaveClip.cpp.
References GetPlayEndTime(), GetSequenceStartTime(), and mTrimLeft.
void WaveClip::TrimRight | ( | double | deltaTime | ) |
Moves play end position by deltaTime.
Definition at line 941 of file WaveClip.cpp.
References mTrimRight.
void WaveClip::TrimRightTo | ( | double | to | ) |
Sets the the right trimming to the absolute time (if that is in bounds)
Definition at line 951 of file WaveClip.cpp.
References GetPlayStartTime(), GetSequenceEndTime(), and mTrimRight.
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.
Definition at line 219 of file WaveClip.cpp.
References GetRate(), mEnvelope, mRate, and mSequence.
Referenced by Append(), Flush(), and HandleXMLEndTag().
bool WaveClip::WithinPlayRegion | ( | double | t | ) | const |
Definition at line 999 of file WaveClip.cpp.
References GetAppendBufferLen(), GetPlayEndSample(), GetPlayStartSample(), and TimeToSamples().
void WaveClip::WriteXML | ( | XMLWriter & | xmlFile | ) | const |
Definition at line 354 of file WaveClip.cpp.
References wxT().
|
protected |
Definition at line 364 of file WaveClip.h.
Referenced by WaveClip().
|
protected |
Definition at line 371 of file WaveClip.h.
Referenced by ClearAndAddCutLine(), ClearSequence(), CloseLock(), ExpandCutLine(), FindCutLine(), HandleXMLChild(), OffsetCutLines(), Paste(), RemoveCutLine(), and WaveClip().
|
protected |
Definition at line 367 of file WaveClip.h.
Referenced by HandleXMLChild(), Paste(), SetRate(), SetSequenceStartTime(), UpdateEnvelopeTrackLen(), and WaveClip().
|
protected |
Definition at line 374 of file WaveClip.h.
Referenced by WaveClip().
|
private |
Definition at line 377 of file WaveClip.h.
Referenced by GetName(), SetName(), and WaveClip().
|
protected |
Definition at line 363 of file WaveClip.h.
Referenced by GetPlayEndTime(), GetSequenceEndTime(), HandleXMLChild(), InsertSilence(), Paste(), Resample(), SetRate(), UpdateEnvelopeTrackLen(), and WaveClip().
|
protected |
Definition at line 366 of file WaveClip.h.
Referenced by Append(), AppendNewBlock(), AppendSharedBlock(), ClearAndAddCutLine(), ConvertToSampleFormat(), Flush(), GetMinMax(), GetPlayEndTime(), GetPlaySamplesCount(), GetRMS(), GetSamples(), GetSequenceBlockArray(), GetSequenceEndSample(), GetSequenceEndTime(), GetSequenceSamplesCount(), HandleXMLChild(), Paste(), Resample(), SetRate(), SetSamples(), TimeToSequenceSamples(), UpdateEnvelopeTrackLen(), and WaveClip().
|
protected |
Definition at line 359 of file WaveClip.h.
Referenced by GetPlayStartTime(), GetSequenceStartSample(), GetSequenceStartTime(), SetSequenceStartTime(), and WaveClip().
|
protected |
Definition at line 360 of file WaveClip.h.
Referenced by GetPlaySamplesCount(), GetPlayStartTime(), GetSamples(), GetTrimLeft(), SetPlayStartTime(), SetRate(), SetSamples(), SetTrimLeft(), TrimLeft(), TrimLeftTo(), and WaveClip().
|
protected |
Definition at line 361 of file WaveClip.h.
Referenced by GetPlayEndTime(), GetPlaySamplesCount(), GetTrimRight(), SetRate(), SetTrimRight(), TrimRight(), TrimRightTo(), and WaveClip().