![]() |
Audacity 3.2.0
|
This allows multiple clips to be a part of one WaveTrack. More...
#include <WaveClip.h>
Classes | |
struct | Transaction |
Restores state when an update loop over mSequences fails midway. More... | |
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 (size_t width, const SampleBlockFactoryPtr &factory, sampleFormat format, int rate, int colourIndex) | |
typical constructor More... | |
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 () |
bool | CheckInvariants () const |
Check invariant conditions on mSequences and mCutlines. More... | |
size_t | GetWidth () const override |
void | ConvertToSampleFormat (sampleFormat format, const std::function< void(size_t)> &progressReport={}) |
int | GetRate () const override |
void | SetRate (int rate) |
void | StretchLeftTo (double to) |
Stretches from left to the absolute time (if in expected range) More... | |
void | StretchRightTo (double to) |
Sets from the right to the absolute time (if in expected range) More... | |
double | GetStretchRatio () const override |
void | Resample (int rate, BasicUI::ProgressDialog *progress=nullptr) |
void | ApplyStretchRatio (const std::function< void(double)> &reportProgress) |
Renders the stretching of the clip (preserving duration). More... | |
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 | GetSequenceSamplesCount () const |
double | GetPlayStartTime () const noexcept override |
void | SetPlayStartTime (double time) |
double | GetPlayEndTime () const override |
double | GetPlayDuration () const |
sampleCount | GetPlayStartSample () const |
Real start time of the clip, quantized to raw sample rate (track's rate) More... | |
sampleCount | GetPlayEndSample () const |
Real end time of the clip, quantized to raw sample rate (track's rate) More... | |
sampleCount | GetVisibleSampleCount () const override |
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 | ShiftBy (double delta) noexcept |
bool | SplitsPlayRegion (double t) const |
[ < t and t < ), such that if the track were split at t , it would split this clip in two of lengths > 0. More... | |
bool | WithinPlayRegion (double t) const |
t ∈ [...) More... | |
bool | BeforePlayRegion (double t) const |
t < [ More... | |
bool | AtOrBeforePlayRegion (double t) const |
t <= [ More... | |
bool | AfterPlayRegion (double t) const |
) <= t More... | |
bool | EntirelyWithinPlayRegion (double t0, double t1) const |
t0 and t1 both ∈ [...) More... | |
bool | PartlyWithinPlayRegion (double t0, double t1) const |
t0 xor t1 ∈ [...) More... | |
bool | IntersectsPlayRegion (double t0, double t1) const |
[t0, t1) ∩ [...) != ∅ More... | |
bool | CoversEntirePlayRegion (double t0, double t1) const |
t0 <= [ and ) <= t1, such that removing [t0, t1) from the track deletes this clip. More... | |
sampleCount | CountSamples (double t0, double t1) const |
AudioSegmentSampleView | GetSampleView (size_t iChannel, sampleCount start, size_t length, bool mayThrow=true) const override |
Request up to length samples. The actual number of samples available from the returned view is queried through AudioSegmentSampleView::GetSampleCount() . More... | |
AudioSegmentSampleView | GetSampleView (size_t iChannel, double t0, double t1, bool mayThrow=true) const |
Request interval samples within [t0, t1). t0 and t1 are truncated to the clip's play start and end. Stretching influences the number of samples fitting into [t0, t1), i.e., half as many for twice as large a stretch ratio, due to a larger spacing of the raw samples. The actual number of samples available from the returned view is queried through AudioSegmentSampleView::GetSampleCount() . More... | |
bool | GetSamples (size_t ii, samplePtr buffer, sampleFormat format, sampleCount start, size_t len, bool mayThrow=true) const |
Get samples from one channel. More... | |
bool | GetSamples (samplePtr buffers[], sampleFormat format, sampleCount start, size_t len, bool mayThrow=true) const |
Get (non-interleaved) samples from all channels. More... | |
void | SetSamples (size_t ii, constSamplePtr buffer, sampleFormat format, sampleCount start, size_t len, sampleFormat effectiveFormat) |
bool | GetFloatAtTime (double t, size_t iChannel, float &value, bool mayThrow) const |
Envelope * | GetEnvelope () |
const Envelope * | GetEnvelope () const |
BlockArray * | GetSequenceBlockArray (size_t ii) |
const BlockArray * | GetSequenceBlockArray (size_t ii) const |
Sequence * | GetSequence (size_t ii) |
const Sequence * | GetSequence (size_t ii) const |
void | MarkChanged () |
std::pair< float, float > | GetMinMax (size_t ii, double t0, double t1, bool mayThrow) const |
float | GetRMS (size_t ii, double t0, double t1, bool mayThrow) const |
void | UpdateEnvelopeTrackLen () |
std::shared_ptr< SampleBlock > | AppendNewBlock (samplePtr buffer, sampleFormat format, size_t len) |
void | AppendSharedBlock (const std::shared_ptr< SampleBlock > &pBlock) |
bool | Append (constSamplePtr buffers[], 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) |
bool | 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 () noexcept |
Should be called upon project close. Not balanced by unlocking calls. More... | |
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 override |
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 (size_t ii) const |
Get one channel of the append buffer. More... | |
size_t | GetAppendBufferLen () const |
void | OnProjectTempoChange (const std::optional< double > &oldTempo, double newTempo) |
bool | HasEqualStretchRatio (const WaveClip &other) const |
bool | StretchRatioEquals (double value) const |
void | SetFloatsFromTime (double t, size_t iChannel, const float *buffer, size_t numSamples, sampleFormat effectiveFormat) |
Considers buffer as audio starting at TimeToSamples(t) (relative to clip play start time) and with equal stretch ratio. Samples at intersecting indices are then copied, leaving non-intersecting clip samples untouched. E.g., buffer: [a b c d e] clip : [x y z] result: [d e z]. More... | |
void | SetFloatsCenteredAroundTime (double t, size_t iChannel, const float *buffer, size_t numSideSamples, sampleFormat effectiveFormat) |
Same as SetFloatsFromTime , but with buffer starting at TimeToSamples(t0 - SamplesToTime(numSideSamples)) . [buffer, buffer + 2 * numSizeSamples + 1) is assumed to be a valid span of addresses. More... | |
void | SetFloatAtTime (double t, size_t iChannel, float value, sampleFormat effectiveFormat) |
![]() | |
~ClipInterface () override | |
virtual AudioSegmentSampleView | GetSampleView (size_t iChannel, sampleCount start, size_t length, bool mayThrow=true) const =0 |
virtual size_t | GetWidth () const =0 |
![]() | |
virtual | ~ClipTimes () |
virtual sampleCount | GetVisibleSampleCount () const =0 |
virtual int | GetRate () const =0 |
virtual double | GetPlayStartTime () const =0 |
virtual double | GetPlayEndTime () const =0 |
virtual sampleCount | TimeToSamples (double time) const =0 |
virtual double | GetStretchRatio () const =0 |
![]() | |
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... | |
Private Member Functions | |
WaveClip (const WaveClip &)=delete | |
WaveClip & | operator= (const WaveClip &)=delete |
sampleCount | TimeToSequenceSamples (double t) const |
sampleCount | GetNumSamples () const |
SampleFormats | GetSampleFormats () const |
const SampleBlockFactoryPtr & | GetFactory () |
std::vector< std::unique_ptr< Sequence > > | GetEmptySequenceCopies () const |
void | StretchCutLines (double ratioChange) |
double | SnapToTrackSample (double time) const noexcept |
void | ClearSequence (double t0, double t1) |
Private Attributes | |
double | mClipStretchRatio = 1. |
std::optional< double > | mRawAudioTempo |
std::optional< double > | mProjectTempo |
int | mRate |
Sample rate of the raw audio, i.e., before stretching. More... | |
int | mColourIndex |
std::vector< std::unique_ptr< Sequence > > | mSequences |
std::unique_ptr< Envelope > | mEnvelope |
Envelope is unique, not per-sequence. More... | |
WaveClipHolders | mCutLines {} |
bool | mIsPlaceholder { false } |
wxString | mName |
double | mSequenceOffset { 0 } |
double | mTrimLeft { 0 } |
double | mTrimRight { 0 } |
Additional Inherited Members | |
![]() | |
static size_t | numFactories () |
How many static factories have been registered with this specialization of Site. More... | |
![]() | |
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... | |
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 112 of file WaveClip.h.
|
privatedelete |
WaveClip::WaveClip | ( | size_t | width, |
const SampleBlockFactoryPtr & | factory, | ||
sampleFormat | format, | ||
int | rate, | ||
int | colourIndex | ||
) |
typical constructor
width | how many sequences |
width > 0
GetWidth() == width
Definition at line 44 of file WaveClip.cpp.
References CheckInvariants(), cloud::factory, anonymous_namespace{ExportPCM.cpp}::format, mColourIndex, mEnvelope, mRate, mSequences, and narrowestSampleFormat.
WaveClip::WaveClip | ( | const WaveClip & | orig, |
const SampleBlockFactoryPtr & | factory, | ||
bool | copyCutlines | ||
) |
essentially a copy constructor - but you must pass in the current sample block factory, because we might be copying from one project to another
GetWidth() == orig.GetWidth()
Definition at line 60 of file WaveClip.cpp.
References CheckInvariants(), cloud::factory, GetIsPlaceholder(), GetWidth(), mColourIndex, mCutLines, mEnvelope, mIsPlaceholder, mName, mRate, mSequenceOffset, mSequences, 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.
GetWidth() == orig.GetWidth()
Definition at line 95 of file WaveClip.cpp.
References CheckInvariants(), CountSamples(), cloud::factory, GetIsPlaceholder(), GetPlayEndTime(), GetPlayStartTime(), GetSequenceEndTime(), GetSequenceStartTime(), GetWidth(), mColourIndex, mCutLines, mEnvelope, mIsPlaceholder, mRate, mSequenceOffset, mSequences, mTrimLeft, mTrimRight, SamplesToTime(), and TimeToSamples().
|
virtual |
Definition at line 145 of file WaveClip.cpp.
bool WaveClip::AfterPlayRegion | ( | double | t | ) | const |
) <= t
Definition at line 1502 of file WaveClip.cpp.
References GetPlayEndTime().
bool WaveClip::Append | ( | constSamplePtr | buffers[], |
sampleFormat | format, | ||
size_t | len, | ||
unsigned int | stride, | ||
sampleFormat | effectiveFormat | ||
) |
Append (non-interleaved) samples to all channels 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 488 of file WaveClip.cpp.
References CheckInvariants(), WaveClip::Transaction::Commit(), anonymous_namespace{ExportPCM.cpp}::format, MarkChanged(), mSequences, and UpdateEnvelopeTrackLen().
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; no dithering applied
GetWidth() == 1
Definition at line 470 of file WaveClip.cpp.
References anonymous_namespace{ExportPCM.cpp}::format, GetWidth(), and mSequences.
void WaveClip::AppendSharedBlock | ( | const std::shared_ptr< SampleBlock > & | pBlock | ) |
For use in importing pre-version-3 projects to preserve sharing of blocks
GetWidth() == 1
Definition at line 480 of file WaveClip.cpp.
References GetWidth(), and mSequences.
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 801 of file WaveClip.cpp.
References GetPlayEndTime(), and InsertSilence().
void WaveClip::ApplyStretchRatio | ( | const std::function< void(double)> & | reportProgress | ) |
Renders the stretching of the clip (preserving duration).
Definition at line 1182 of file WaveClip.cpp.
References sampleCount::as_double(), floatSample, Flush(), forward, AudioContainer::Get(), GetEmptySequenceCopies(), GetPlayEndTime(), GetPlayStartTime(), GetRate(), GetSequenceStartTime(), GetStretchRatio(), GetTrimLeft(), GetTrimRight(), GetVisibleSampleCount(), GetWidth(), WaveClipListener::Invalidate(), limitSampleBufferSize(), mClipStretchRatio, mProjectTempo, mRawAudioTempo, mSequences, params, SetSequenceStartTime(), SetTrimLeft(), SetTrimRight(), anonymous_namespace{NoteTrack.cpp}::swap(), TrimLeftTo(), TrimRightTo(), and widestSampleFormat.
bool WaveClip::AtOrBeforePlayRegion | ( | double | t | ) | const |
t <= [
Definition at line 1497 of file WaveClip.cpp.
References GetPlayStartTime().
bool WaveClip::BeforePlayRegion | ( | double | t | ) | const |
t < [
Definition at line 1492 of file WaveClip.cpp.
References GetPlayStartTime().
Referenced by EntirelyWithinPlayRegion().
bool WaveClip::CheckInvariants | ( | ) | const |
Check invariant conditions on mSequences and mCutlines.
Definition at line 1529 of file WaveClip.cpp.
References PackedArray::end(), GetWidth(), mCutLines, and mSequences.
Referenced by Append(), ClearAndAddCutLine(), HandleXMLEndTag(), Paste(), and WaveClip().
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 808 of file WaveClip.cpp.
References ClearSequence(), GetPlayEndTime(), GetPlayStartTime(), GetSequenceEndTime(), GetSequenceStartTime(), GetTrimLeft(), SetTrimLeft(), SetTrimRight(), and ShiftBy().
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 913 of file WaveClip.cpp.
References CheckInvariants(), Envelope::CollapseRegion(), CountSamples(), GetEnvelope(), GetFactory(), GetPlayEndTime(), GetPlayStartTime(), GetRate(), GetSequenceStartTime(), MarkChanged(), mCutLines, min(), mSequences, ShiftBy(), 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 831 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 841 of file WaveClip.cpp.
References ClearSequence(), GetPlayEndTime(), GetPlayStartTime(), GetSequenceEndTime(), and SetTrimRight().
|
private |
This name is consistent with WaveTrack::Clear. It performs a "Cut" operation (but without putting the cut audio to the clipboard)
Definition at line 850 of file WaveClip.cpp.
References Envelope::CollapseRegion(), GetEnvelope(), GetRate(), GetSequenceEndTime(), GetSequenceStartTime(), MarkChanged(), mCutLines, min(), mSequences, ShiftBy(), and TimeToSequenceSamples().
Referenced by Clear(), ClearLeft(), ClearRight(), InsertSilence(), and Paste().
|
noexcept |
Should be called upon project close. Not balanced by unlocking calls.
Definition at line 1061 of file WaveClip.cpp.
References mCutLines, and mSequences.
void WaveClip::ConvertToSampleFormat | ( | sampleFormat | format, |
const std::function< void(size_t)> & | progressReport = {} |
||
) |
Definition at line 440 of file WaveClip.cpp.
References anonymous_namespace{ExportPCM.cpp}::format, GetWidth(), MarkChanged(), and mSequences.
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 1507 of file WaveClip.cpp.
References GetPlayEndTime(), GetPlayStartTime(), min(), and TimeToSamples().
Referenced by ClearAndAddCutLine(), and WaveClip().
bool WaveClip::CoversEntirePlayRegion | ( | double | t0, |
double | t1 | ||
) | const |
t0 <= [ and ) <= t1, such that removing [t0, t1) from the track deletes this clip.
Definition at line 1486 of file WaveClip.cpp.
References GetPlayEndTime(), and GetPlayStartTime().
bool WaveClip::EntirelyWithinPlayRegion | ( | double | t0, |
double | t1 | ||
) | const |
t0 and t1 both ∈ [...)
Definition at line 1464 of file WaveClip.cpp.
References BeforePlayRegion(), and GetPlayEndTime().
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 999 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 978 of file WaveClip.cpp.
References GetSequenceStartTime(), and mCutLines.
void WaveClip::Flush | ( | ) |
Flush must be called after last Append.
In case of exceptions, the clip contents are unchanged but un-flushed data are lost
Definition at line 512 of file WaveClip.cpp.
References WaveClip::Transaction::Commit(), GetAppendBufferLen(), MarkChanged(), mSequences, and UpdateEnvelopeTrackLen().
Referenced by ApplyStretchRatio(), WaveTrack::FlushOne(), and Resample().
constSamplePtr WaveClip::GetAppendBuffer | ( | size_t | ii | ) | const |
Get one channel of the append buffer.
ii | identifies the channel |
ii < GetWidth()
Definition at line 387 of file WaveClip.cpp.
References GetWidth(), and mSequences.
Referenced by WaveChannelInterval::GetAppendBuffer().
size_t WaveClip::GetAppendBufferLen | ( | ) | const |
Definition at line 265 of file WaveClip.cpp.
References mSequences.
Referenced by Flush(), WaveChannelInterval::GetAppendBufferLen(), and GetPlayEndTime().
|
inline |
Definition at line 189 of file WaveClip.h.
Referenced by WaveChannelInterval::GetColourIndex().
|
inline |
|
inline |
Definition at line 513 of file WaveClip.h.
|
private |
Definition at line 377 of file WaveClip.cpp.
References mSequences.
Referenced by ApplyStretchRatio(), and Resample().
|
inline |
Definition at line 393 of file WaveClip.h.
Referenced by ClearAndAddCutLine(), ClearSequence(), WaveChannelInterval::GetEnvelope(), WaveTrack::GetEnvelopeAtTime(), AUPImportFileHandle::HandleEnvelope(), WaveTrack::HandleXMLChild(), and InsertSilence().
|
inline |
Definition at line 394 of file WaveClip.h.
|
private |
Definition at line 371 of file WaveClip.cpp.
References mSequences.
Referenced by ClearAndAddCutLine(), Paste(), and WaveClip::Transaction::Transaction().
bool WaveClip::GetFloatAtTime | ( | double | t, |
size_t | iChannel, | ||
float & | value, | ||
bool | mayThrow | ||
) | const |
t | relative to clip start sample |
Definition at line 204 of file WaveClip.cpp.
References floatSample, GetSamples(), anonymous_namespace{StretchingSequenceIntegrationTest.cpp}::iChannel, TimeToSamples(), and WithinPlayRegion().
|
inline |
Definition at line 549 of file WaveClip.h.
Referenced by WaveClip().
std::pair< float, float > WaveClip::GetMinMax | ( | size_t | ii, |
double | t0, | ||
double | t1, | ||
bool | mayThrow | ||
) | const |
Getting high-level data for one channel for screen display and clipping calculations and Contrast
ii | identifies the channel |
ii < GetWidth()
Definition at line 398 of file WaveClip.cpp.
References GetPlayEndTime(), GetPlayStartTime(), GetWidth(), min(), mSequences, THROW_INCONSISTENCY_EXCEPTION, and TimeToSequenceSamples().
const wxString & WaveClip::GetName | ( | ) | const |
|
private |
Definition at line 359 of file WaveClip.cpp.
References mSequences.
Referenced by GetPlayEndTime(), GetSampleView(), GetSequenceEndTime(), GetSequenceSamplesCount(), GetVisibleSampleCount(), Resample(), SetRate(), TimeToSequenceSamples(), and UpdateEnvelopeTrackLen().
double WaveClip::GetPlayDuration | ( | ) | const |
Always a multiple of the track's sample period, whether the clip is stretched or not.
Definition at line 1362 of file WaveClip.cpp.
References GetPlayEndTime(), and GetPlayStartTime().
Referenced by anonymous_namespace{WaveTrack.cpp}::GetSampleAccessArgs().
sampleCount WaveClip::GetPlayEndSample | ( | ) | const |
Real end time of the clip, quantized to raw sample rate (track's rate)
Definition at line 1372 of file WaveClip.cpp.
References GetPlayEndTime(), and mRate.
Referenced by WaveTrack::ReverseOne().
|
overridevirtual |
Open-end of play region. Always a multiple of the track's sample period, whether the clip is stretched or not.
Implements ClipTimes.
Definition at line 1350 of file WaveClip.cpp.
References GetAppendBufferLen(), GetNumSamples(), GetStretchRatio(), mRate, mSequenceOffset, mTrimRight, and SnapToTrackSample().
Referenced by AUPImportFileHandle::AddSilence(), AfterPlayRegion(), AppendSilence(), ApplyStretchRatio(), WaveTrack::CanInsertClip(), Clear(), ClearAndAddCutLine(), WaveTrack::ClearAndPasteOne(), ClearLeft(), ClearRight(), CountSamples(), CoversEntirePlayRegion(), WaveChannelInterval::End(), EntirelyWithinPlayRegion(), WaveTrack::GetAdjacentClip(), GetMinMax(), GetPlayDuration(), GetPlayEndSample(), WaveChannelInterval::GetPlayEndTime(), InsertSilence(), IntersectsPlayRegion(), WaveTrackUtils::IsClipSelected(), WaveTrack::MergeOneClipPair(), Paste(), WaveTrack::PasteOne(), SplitsPlayRegion(), StretchLeftTo(), StretchRightTo(), TrimLeftTo(), WaveClip(), and WithinPlayRegion().
sampleCount WaveClip::GetPlayStartSample | ( | ) | const |
Real start time of the clip, quantized to raw sample rate (track's rate)
Definition at line 1367 of file WaveClip.cpp.
References GetPlayStartTime(), and mRate.
Referenced by WaveTrack::ReverseOne().
|
overridevirtualnoexcept |
Closed-begin of play region. Always a multiple of the track's sample period, whether the clip is stretched or not.
Implements ClipTimes.
Definition at line 1340 of file WaveClip.cpp.
References mSequenceOffset, mTrimLeft, and SnapToTrackSample().
Referenced by ApplyStretchRatio(), AtOrBeforePlayRegion(), BeforePlayRegion(), WaveTrack::CanInsertClip(), Clear(), ClearAndAddCutLine(), WaveTrack::ClearAndPasteOne(), ClearLeft(), ClearRight(), CountSamples(), CoversEntirePlayRegion(), WaveTrack::GetAdjacentClip(), GetMinMax(), GetPlayDuration(), GetPlayStartSample(), WaveChannelInterval::GetPlayStartTime(), anonymous_namespace{WaveTrack.cpp}::GetSampleAccessArgs(), InsertSilence(), IntersectsPlayRegion(), WaveTrackUtils::IsClipSelected(), WaveTrack::JoinOne(), Paste(), WaveTrack::PasteOne(), WaveTrack::RightmostOrNewClip(), SharesBoundaryWithNextClip(), SplitsPlayRegion(), WaveChannelInterval::Start(), StretchLeftTo(), StretchRightTo(), TrimRightTo(), WaveClip(), and WithinPlayRegion().
|
inlineoverridevirtual |
Implements ClipTimes.
Definition at line 156 of file WaveClip.h.
Referenced by ApplyStretchRatio(), ClearAndAddCutLine(), ClearSequence(), WaveChannelInterval::GetRate(), anonymous_namespace{WaveTrack.cpp}::GetSampleAccessArgs(), InsertSilence(), Paste(), anonymous_namespace{SampleHandle.cpp}::SampleResolutionTest(), SharesBoundaryWithNextClip(), and UpdateEnvelopeTrackLen().
float WaveClip::GetRMS | ( | size_t | ii, |
double | t0, | ||
double | t1, | ||
bool | mayThrow | ||
) | const |
Getting high-level data for one channel for screen display and clipping calculations and Contrast
ii | identifies the channel |
ii < GetWidth()
Definition at line 422 of file WaveClip.cpp.
References GetWidth(), mSequences, THROW_INCONSISTENCY_EXCEPTION, and TimeToSequenceSamples().
|
private |
Definition at line 365 of file WaveClip.cpp.
References mSequences.
Referenced by Paste().
bool WaveClip::GetSamples | ( | samplePtr | buffers[], |
sampleFormat | format, | ||
sampleCount | start, | ||
size_t | len, | ||
bool | mayThrow = true |
||
) | const |
Get (non-interleaved) samples from all channels.
assume as many buffers available as GetWidth()
start | relative to clip play start sample |
Definition at line 181 of file WaveClip.cpp.
References anonymous_namespace{ExportPCM.cpp}::format, GetSamples(), and GetWidth().
bool WaveClip::GetSamples | ( | size_t | ii, |
samplePtr | buffer, | ||
sampleFormat | format, | ||
sampleCount | start, | ||
size_t | len, | ||
bool | mayThrow = true |
||
) | const |
Get samples from one channel.
ii | identifies the channel |
start | relative to clip play start sample |
ii < GetWidth()
Definition at line 172 of file WaveClip.cpp.
References anonymous_namespace{ExportPCM.cpp}::format, GetWidth(), mSequences, mTrimLeft, and TimeToSamples().
Referenced by GetFloatAtTime(), WaveChannelInterval::GetSamples(), and GetSamples().
AudioSegmentSampleView WaveClip::GetSampleView | ( | size_t | iChannel, |
double | t0, | ||
double | t1, | ||
bool | mayThrow = true |
||
) | const |
Request interval samples within [t0, t1). t0
and t1
are truncated to the clip's play start and end. Stretching influences the number of samples fitting into [t0, t1), i.e., half as many for twice as large a stretch ratio, due to a larger spacing of the raw samples. The actual number of samples available from the returned view is queried through AudioSegmentSampleView::GetSampleCount()
.
iChannel < GetWidth()
size_t
Definition at line 157 of file WaveClip.cpp.
References GetNumSamples(), GetSampleView(), GetWidth(), anonymous_namespace{StretchingSequenceIntegrationTest.cpp}::iChannel, min(), and TimeToSamples().
|
overridevirtual |
Request up to length
samples. The actual number of samples available from the returned view is queried through AudioSegmentSampleView::GetSampleCount()
.
start | index of first clip sample from play start |
iChannel < GetWidth()
Implements ClipInterface.
Definition at line 149 of file WaveClip.cpp.
References GetWidth(), mSequences, mTrimLeft, and TimeToSamples().
Referenced by WaveChannelInterval::GetSampleView(), and GetSampleView().
|
inline |
Get low-level access to a sequence. Whenever possible, don't use this, but use more high-level functions inside WaveClip (or add them if you think they are useful for general use)
ii < GetWidth()
Definition at line 412 of file WaveClip.h.
Referenced by WaveTrack::GetIdealBlockSize(), WaveChannelInterval::GetSequence(), and WaveTrack::HandleXMLChild().
|
inline |
Get low-level access to a sequence. Whenever possible, don't use this, but use more high-level functions inside WaveClip (or add them if you think they are useful for general use)
ii < GetWidth()
Definition at line 419 of file WaveClip.h.
BlockArray * WaveClip::GetSequenceBlockArray | ( | size_t | ii | ) |
ii | identifies the channel |
ii < GetWidth()
Definition at line 253 of file WaveClip.cpp.
References GetWidth(), and mSequences.
const BlockArray * WaveClip::GetSequenceBlockArray | ( | size_t | ii | ) | const |
ii | identifies the channel |
ii < GetWidth()
Definition at line 259 of file WaveClip.cpp.
References GetWidth(), and mSequences.
double WaveClip::GetSequenceEndTime | ( | ) | const |
Definition at line 1436 of file WaveClip.cpp.
References GetNumSamples(), GetSequenceStartTime(), GetStretchRatio(), and mRate.
Referenced by Clear(), ClearRight(), ClearSequence(), InsertSilence(), Paste(), TimeToSequenceSamples(), TrimRightTo(), and WaveClip().
sampleCount WaveClip::GetSequenceSamplesCount | ( | ) | const |
Returns the total number of samples in all underlying sequences (but not counting the cutlines)
Definition at line 1335 of file WaveClip.cpp.
References GetNumSamples(), and GetWidth().
sampleCount WaveClip::GetSequenceStartSample | ( | ) | const |
Returns the index of the first sample of the underlying sequence.
Definition at line 1444 of file WaveClip.cpp.
References mSequenceOffset, and TimeToSamples().
|
noexcept |
Definition at line 1424 of file WaveClip.cpp.
References mSequenceOffset.
Referenced by ApplyStretchRatio(), Clear(), ClearAndAddCutLine(), WaveTrack::ClearAndPasteOne(), ClearLeft(), ClearSequence(), ExpandCutLine(), FindCutLine(), GetSequenceEndTime(), InsertSilence(), OffsetCutLines(), Paste(), RemoveCutLine(), SetRate(), TimeToSequenceSamples(), and WaveClip().
|
overridevirtual |
Implements ClipTimes.
Definition at line 339 of file WaveClip.cpp.
References mClipStretchRatio, mProjectTempo, and mRawAudioTempo.
Referenced by ApplyStretchRatio(), GetPlayEndTime(), anonymous_namespace{WaveTrack.cpp}::GetSampleAccessArgs(), GetSequenceEndTime(), WaveChannelInterval::GetStretchRatio(), HasEqualStretchRatio(), SharesBoundaryWithNextClip(), StretchRatioEquals(), and TimeToSamples().
|
noexcept |
Returns the play start offset in seconds from the beginning of the underlying sequence.
Definition at line 1388 of file WaveClip.cpp.
References mTrimLeft.
Referenced by ApplyStretchRatio(), Clear(), WaveTrack::ClearAndPasteOne(), WaveChannelInterval::GetTrimLeft(), and Paste().
|
noexcept |
Returns the play end offset in seconds from the ending of the underlying sequence.
Definition at line 1398 of file WaveClip.cpp.
References mTrimRight.
Referenced by ApplyStretchRatio(), WaveTrack::ClearAndPasteOne(), WaveChannelInterval::GetTrimRight(), and Paste().
|
overridevirtual |
Returns a number of raw samples, not accounting for stretching.
Implements ClipTimes.
Definition at line 1377 of file WaveClip.cpp.
References GetNumSamples(), mTrimLeft, mTrimRight, and TimeToSamples().
Referenced by ApplyStretchRatio(), anonymous_namespace{WaveTrack.cpp}::GetSampleAccessArgs(), WaveChannelInterval::GetVisibleSampleCount(), SetFloatsFromTime(), and SharesBoundaryWithNextClip().
|
overridevirtual |
How many Sequences the clip contains. Set at construction time; changes only if increased by deserialization
Implements ClipInterface.
Definition at line 167 of file WaveClip.cpp.
References mSequences.
Referenced by AppendNewBlock(), AppendSharedBlock(), ApplyStretchRatio(), CheckInvariants(), WaveTrack::ClearAndPasteOne(), ConvertToSampleFormat(), GetAppendBuffer(), GetMinMax(), GetRMS(), GetSamples(), GetSampleView(), GetSequenceBlockArray(), GetSequenceSamplesCount(), Paste(), SetSamples(), and WaveClip().
|
overridevirtual |
Implements XMLTagHandler.
Definition at line 611 of file WaveClip.cpp.
References anonymous_namespace{ExportPCM.cpp}::format, mCutLines, mEnvelope, mRate, and mSequences.
Referenced by AUPImportFileHandle::HandleSequence(), and AUPImportFileHandle::HandleWaveClip().
|
override |
Definition at line 597 of file WaveClip.cpp.
References CheckInvariants(), mSequences, and UpdateEnvelopeTrackLen().
Referenced by WaveTrack::HandleXMLEndTag().
|
overridevirtual |
Implements XMLTagHandler.
Definition at line 535 of file WaveClip.cpp.
References mClipStretchRatio, mRawAudioTempo, SetColourIndex(), SetName(), SetSequenceStartTime(), SetTrimLeft(), and SetTrimRight().
bool WaveClip::HasEqualStretchRatio | ( | const WaveClip & | other | ) | const |
Checks for stretch-ratio equality, accounting for rounding errors.
Definition at line 348 of file WaveClip.cpp.
References GetStretchRatio(), and StretchRatioEquals().
Referenced by WaveTrack::ClearAndPasteOne(), and WaveTrack::MergeOneClipPair().
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 757 of file WaveClip.cpp.
References ClearSequence(), GetEnvelope(), GetPlayEndTime(), GetPlayStartTime(), GetRate(), GetSequenceEndTime(), GetSequenceStartTime(), MarkChanged(), mRate, mSequences, OffsetCutLines(), SetTrimRight(), and TimeToSequenceSamples().
Referenced by AUPImportFileHandle::AddSilence(), and AppendSilence().
bool WaveClip::IntersectsPlayRegion | ( | double | t0, |
double | t1 | ||
) | const |
[t0, t1) ∩ [...) != ∅
Definition at line 1478 of file WaveClip.cpp.
References GetPlayEndTime(), and GetPlayStartTime().
Referenced by WaveChannelInterval::Intersects().
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 393 of file WaveClip.cpp.
References WaveClipListener::MarkChanged().
Referenced by Append(), ClearAndAddCutLine(), ClearSequence(), ConvertToSampleFormat(), Flush(), InsertSilence(), Paste(), SetRate(), SetSamples(), and SetSilence().
|
inline |
Definition at line 515 of file WaveClip.h.
void WaveClip::OffsetCutLines | ( | double | t0, |
double | len | ||
) |
Offset cutlines right to time 't0' by time amount 'len'.
Definition at line 1052 of file WaveClip.cpp.
References GetSequenceStartTime(), and mCutLines.
Referenced by InsertSilence(), and Paste().
void WaveClip::OnProjectTempoChange | ( | const std::optional< double > & | oldTempo, |
double | newTempo | ||
) |
Definition at line 271 of file WaveClip.cpp.
References mEnvelope, mProjectTempo, mRawAudioTempo, mSequenceOffset, mTrimLeft, mTrimRight, and StretchCutLines().
bool WaveClip::PartlyWithinPlayRegion | ( | double | t0, |
double | t1 | ||
) | const |
t0 xor t1 ∈ [...)
Definition at line 1472 of file WaveClip.cpp.
References WithinPlayRegion().
bool WaveClip::Paste | ( | double | t0, |
const WaveClip & | other | ||
) |
Paste data from other clip, resampling it if not equal rate.
this->GetWidth() == other.GetWidth()
Definition at line 663 of file WaveClip.cpp.
References sampleCount::as_double(), CheckInvariants(), ClearSequence(), staffpad::vo::copy(), cloud::factory, GetFactory(), GetPlayEndTime(), GetPlayStartTime(), GetRate(), GetSampleFormats(), GetSequenceEndTime(), GetSequenceStartTime(), GetTrimLeft(), GetTrimRight(), GetWidth(), MarkChanged(), mCutLines, mEnvelope, mRate, mSequences, OffsetCutLines(), Paste(), SetTrimLeft(), SetTrimRight(), SampleFormats::Stored(), and TimeToSequenceSamples().
Referenced by WaveTrack::ClearAndPasteOne(), ExpandCutLine(), WaveTrack::MergeOneClipPair(), Paste(), and WaveTrack::PasteOne().
bool WaveClip::RemoveCutLine | ( | double | cutLinePosition | ) |
Remove cut line, without expanding the audio in it.
Definition at line 1035 of file WaveClip.cpp.
References GetSequenceStartTime(), and mCutLines.
void WaveClip::Resample | ( | int | rate, |
BasicUI::ProgressDialog * | progress = nullptr |
||
) |
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 1085 of file WaveClip.cpp.
References sampleCount::as_long_long(), floatSample, Flush(), GetEmptySequenceCopies(), GetNumSamples(), Internal, WaveClipListener::Invalidate(), limitSampleBufferSize(), mRate, mSequences, BasicUI::ProgressDialog::Poll(), Resample::Process(), BasicUI::Success, widestSampleFormat, and XO().
|
noexcept |
Definition at line 1315 of file WaveClip.cpp.
Referenced by anonymous_namespace{WaveTrack.cpp}::RoundToNearestClipSample(), SetFloatsCenteredAroundTime(), SetRate(), and WaveClip().
|
inline |
Definition at line 188 of file WaveClip.h.
Referenced by HandleXMLTag().
void WaveClip::SetFloatAtTime | ( | double | t, |
size_t | iChannel, | ||
float | value, | ||
sampleFormat | effectiveFormat | ||
) |
Definition at line 247 of file WaveClip.cpp.
References anonymous_namespace{StretchingSequenceIntegrationTest.cpp}::iChannel, and SetFloatsCenteredAroundTime().
void WaveClip::SetFloatsCenteredAroundTime | ( | double | t, |
size_t | iChannel, | ||
const float * | buffer, | ||
size_t | numSideSamples, | ||
sampleFormat | effectiveFormat | ||
) |
Same as SetFloatsFromTime
, but with buffer
starting at TimeToSamples(t0 - SamplesToTime(numSideSamples))
. [buffer, buffer + 2 * numSizeSamples + 1)
is assumed to be a valid span of addresses.
Definition at line 238 of file WaveClip.cpp.
References anonymous_namespace{StretchingSequenceIntegrationTest.cpp}::iChannel, SamplesToTime(), and SetFloatsFromTime().
Referenced by SetFloatAtTime().
void WaveClip::SetFloatsFromTime | ( | double | t, |
size_t | iChannel, | ||
const float * | buffer, | ||
size_t | numSamples, | ||
sampleFormat | effectiveFormat | ||
) |
Considers buffer
as audio starting at TimeToSamples(t)
(relative to clip play start time) and with equal stretch ratio. Samples at intersecting indices are then copied, leaving non-intersecting clip samples untouched. E.g., buffer: [a b c d e] clip : [x y z] result: [d e z].
Succeed with out-of-bounds requests, only changing what is in bounds.
Definition at line 215 of file WaveClip.cpp.
References floatSample, GetVisibleSampleCount(), anonymous_namespace{StretchingSequenceIntegrationTest.cpp}::iChannel, min(), SetSamples(), and TimeToSamples().
Referenced by SetFloatsCenteredAroundTime().
|
inline |
Definition at line 550 of file WaveClip.h.
void WaveClip::SetName | ( | const wxString & | name | ) |
Definition at line 1300 of file WaveClip.cpp.
Referenced by HandleXMLTag(), and PasteOverPreservingClips().
void WaveClip::SetPlayStartTime | ( | double | time | ) |
Definition at line 1345 of file WaveClip.cpp.
References mTrimLeft, and SetSequenceStartTime().
void WaveClip::SetRate | ( | int | rate | ) |
Definition at line 1070 of file WaveClip.cpp.
References sampleCount::as_double(), GetNumSamples(), GetSequenceStartTime(), MarkChanged(), mEnvelope, mRate, mTrimLeft, mTrimRight, SamplesToTime(), SetSequenceStartTime(), and TimeToSamples().
void WaveClip::SetSamples | ( | size_t | ii, |
constSamplePtr | buffer, | ||
sampleFormat | format, | ||
sampleCount | start, | ||
size_t | len, | ||
sampleFormat | effectiveFormat | ||
) |
ii | identifies the channel |
ii < GetWidth()
start | relative to clip play start sample |
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 191 of file WaveClip.cpp.
References anonymous_namespace{ExportPCM.cpp}::format, GetWidth(), MarkChanged(), mSequences, mTrimLeft, and TimeToSamples().
Referenced by SetFloatsFromTime().
void WaveClip::SetSequenceStartTime | ( | double | startTime | ) |
Definition at line 1430 of file WaveClip.cpp.
References mEnvelope, and mSequenceOffset.
Referenced by ApplyStretchRatio(), WaveTrack::ClearAndPasteOne(), ClearLeft(), WaveTrack::HandleXMLChild(), HandleXMLTag(), SetPlayStartTime(), and SetRate().
void WaveClip::SetSilence | ( | sampleCount | offset, |
sampleCount | length | ||
) |
Silences the 'length' amount of samples starting from 'offset'(relative to the play start)
Definition at line 1325 of file WaveClip.cpp.
References WaveClip::Transaction::Commit(), MarkChanged(), mSequences, mTrimLeft, and TimeToSamples().
void WaveClip::SetTrimLeft | ( | double | trim | ) |
Sets the play start offset in seconds from the beginning of the underlying sequence.
Definition at line 1383 of file WaveClip.cpp.
References mTrimLeft.
Referenced by ApplyStretchRatio(), Clear(), WaveTrack::ClearAndPasteOne(), ClearLeft(), HandleXMLTag(), Paste(), and TrimLeft().
void WaveClip::SetTrimRight | ( | double | trim | ) |
Sets the play end offset in seconds from the ending of the underlying sequence.
Definition at line 1393 of file WaveClip.cpp.
References mTrimRight.
Referenced by ApplyStretchRatio(), Clear(), WaveTrack::ClearAndPasteOne(), ClearRight(), HandleXMLTag(), InsertSilence(), Paste(), and TrimRight().
bool WaveClip::SharesBoundaryWithNextClip | ( | const WaveClip * | next | ) | const |
Definition at line 1289 of file WaveClip.cpp.
References sampleCount::as_double(), GetPlayStartTime(), GetRate(), GetStretchRatio(), and GetVisibleSampleCount().
|
noexcept |
Definition at line 1449 of file WaveClip.cpp.
Referenced by Clear(), ClearAndAddCutLine(), WaveTrack::ClearAndPasteOne(), ClearSequence(), and WaveTrack::CopyOne().
|
privatenoexcept |
Definition at line 1320 of file WaveClip.cpp.
References fast_float::round().
Referenced by GetPlayEndTime(), and GetPlayStartTime().
bool WaveClip::SplitsPlayRegion | ( | double | t | ) | const |
[ < t and t < ), such that if the track were split at t
, it would split this clip in two of lengths > 0.
The play region is an open-closed interval, [...), where "[ = GetPlayStartTime()", and ") = GetPlayEndTime()."
Definition at line 1454 of file WaveClip.cpp.
References GetPlayEndTime(), and GetPlayStartTime().
Referenced by WaveTrack::ApplyStretchRatioOne().
|
private |
Definition at line 327 of file WaveClip.cpp.
References mCutLines.
Referenced by OnProjectTempoChange(), StretchLeftTo(), and StretchRightTo().
void WaveClip::StretchLeftTo | ( | double | to | ) |
Stretches from left to the absolute time (if in expected range)
Definition at line 293 of file WaveClip.cpp.
References GetPlayEndTime(), GetPlayStartTime(), mClipStretchRatio, mEnvelope, mSequenceOffset, mTrimLeft, mTrimRight, and StretchCutLines().
bool WaveClip::StretchRatioEquals | ( | double | value | ) | const |
Definition at line 353 of file WaveClip.cpp.
References GetStretchRatio(), and TimeAndPitchInterface::IsPassThroughMode().
Referenced by HasEqualStretchRatio().
void WaveClip::StretchRightTo | ( | double | to | ) |
Sets from the right to the absolute time (if in expected range)
Definition at line 310 of file WaveClip.cpp.
References GetPlayEndTime(), GetPlayStartTime(), mClipStretchRatio, mEnvelope, mSequenceOffset, mTrimLeft, mTrimRight, and StretchCutLines().
|
overridevirtual |
Implements ClipTimes.
Definition at line 1310 of file WaveClip.cpp.
References GetStretchRatio(), and mRate.
Referenced by CountSamples(), GetFloatAtTime(), GetSamples(), GetSampleView(), GetSequenceStartSample(), GetVisibleSampleCount(), SetFloatsFromTime(), SetRate(), SetSamples(), SetSilence(), WaveChannelInterval::TimeToSamples(), TimeToSequenceSamples(), and WaveClip().
|
private |
Definition at line 1520 of file WaveClip.cpp.
References GetNumSamples(), GetSequenceEndTime(), GetSequenceStartTime(), and TimeToSamples().
Referenced by ClearAndAddCutLine(), ClearSequence(), GetMinMax(), GetRMS(), InsertSilence(), and Paste().
void WaveClip::TrimLeft | ( | double | deltaTime | ) |
Moves play start position by deltaTime.
Definition at line 1403 of file WaveClip.cpp.
References mTrimLeft, and SetTrimLeft().
void WaveClip::TrimLeftTo | ( | double | to | ) |
Sets the the left trimming to the absolute time (if that is in bounds)
Definition at line 1413 of file WaveClip.cpp.
References GetPlayEndTime(), mSequenceOffset, and mTrimLeft.
Referenced by ApplyStretchRatio().
void WaveClip::TrimRight | ( | double | deltaTime | ) |
Moves play end position by deltaTime.
Definition at line 1408 of file WaveClip.cpp.
References mTrimRight, and SetTrimRight().
void WaveClip::TrimRightTo | ( | double | to | ) |
Sets the the right trimming to the absolute time (if that is in bounds)
Definition at line 1419 of file WaveClip.cpp.
References GetPlayStartTime(), GetSequenceEndTime(), and mTrimRight.
Referenced by ApplyStretchRatio().
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 462 of file WaveClip.cpp.
References sampleCount::as_double(), GetNumSamples(), GetRate(), mEnvelope, and mRate.
Referenced by Append(), Flush(), and HandleXMLEndTag().
bool WaveClip::WithinPlayRegion | ( | double | t | ) | const |
t ∈ [...)
Definition at line 1459 of file WaveClip.cpp.
References GetPlayEndTime(), and GetPlayStartTime().
Referenced by GetFloatAtTime(), and PartlyWithinPlayRegion().
void WaveClip::WriteXML | ( | XMLWriter & | xmlFile | ) | const |
Definition at line 640 of file WaveClip.cpp.
References wxT().
|
private |
Definition at line 615 of file WaveClip.h.
Referenced by ApplyStretchRatio(), GetStretchRatio(), HandleXMLTag(), StretchLeftTo(), and StretchRightTo().
|
private |
Definition at line 621 of file WaveClip.h.
Referenced by WaveClip().
|
private |
Cut Lines are nothing more than ordinary wave clips, with the offset relative to the start of the clip.
Definition at line 639 of file WaveClip.h.
Referenced by CheckInvariants(), ClearAndAddCutLine(), ClearSequence(), CloseLock(), ExpandCutLine(), FindCutLine(), HandleXMLChild(), OffsetCutLines(), Paste(), RemoveCutLine(), StretchCutLines(), and WaveClip().
|
private |
Envelope is unique, not per-sequence.
Definition at line 632 of file WaveClip.h.
Referenced by HandleXMLChild(), OnProjectTempoChange(), Paste(), SetRate(), SetSequenceStartTime(), StretchLeftTo(), StretchRightTo(), UpdateEnvelopeTrackLen(), and WaveClip().
|
private |
Definition at line 642 of file WaveClip.h.
Referenced by WaveClip().
|
private |
Definition at line 645 of file WaveClip.h.
Referenced by GetName(), SetName(), and WaveClip().
|
private |
Definition at line 617 of file WaveClip.h.
Referenced by ApplyStretchRatio(), GetStretchRatio(), and OnProjectTempoChange().
|
private |
Sample rate of the raw audio, i.e., before stretching.
Definition at line 620 of file WaveClip.h.
Referenced by GetPlayEndSample(), GetPlayEndTime(), GetPlayStartSample(), GetSequenceEndTime(), HandleXMLChild(), InsertSilence(), Paste(), Resample(), SetRate(), TimeToSamples(), UpdateEnvelopeTrackLen(), and WaveClip().
|
private |
Definition at line 616 of file WaveClip.h.
Referenced by ApplyStretchRatio(), GetStretchRatio(), HandleXMLTag(), and OnProjectTempoChange().
|
private |
Real-time durations, i.e., stretching the clip modifies these.
Definition at line 608 of file WaveClip.h.
Referenced by GetPlayEndTime(), GetPlayStartTime(), GetSequenceStartSample(), GetSequenceStartTime(), OnProjectTempoChange(), SetSequenceStartTime(), StretchLeftTo(), StretchRightTo(), TrimLeftTo(), and WaveClip().
|
private |
mSequences.size() > 0
Definition at line 630 of file WaveClip.h.
Referenced by Append(), AppendNewBlock(), AppendSharedBlock(), ApplyStretchRatio(), CheckInvariants(), ClearAndAddCutLine(), ClearSequence(), CloseLock(), ConvertToSampleFormat(), Flush(), GetAppendBuffer(), GetAppendBufferLen(), GetEmptySequenceCopies(), GetFactory(), GetMinMax(), GetNumSamples(), GetRMS(), GetSampleFormats(), GetSamples(), GetSampleView(), GetSequenceBlockArray(), GetWidth(), HandleXMLChild(), HandleXMLEndTag(), InsertSilence(), Paste(), Resample(), SetSamples(), SetSilence(), WaveClip::Transaction::Transaction(), and WaveClip().
|
private |
Definition at line 609 of file WaveClip.h.
Referenced by GetPlayStartTime(), GetSamples(), GetSampleView(), GetTrimLeft(), GetVisibleSampleCount(), OnProjectTempoChange(), SetPlayStartTime(), SetRate(), SetSamples(), SetSilence(), SetTrimLeft(), StretchLeftTo(), StretchRightTo(), TrimLeft(), TrimLeftTo(), WaveClip(), and WaveClip::Transaction::~Transaction().
|
private |
Definition at line 610 of file WaveClip.h.
Referenced by GetPlayEndTime(), GetTrimRight(), GetVisibleSampleCount(), OnProjectTempoChange(), SetRate(), SetTrimRight(), StretchLeftTo(), StretchRightTo(), TrimRight(), TrimRightTo(), WaveClip(), and WaveClip::Transaction::~Transaction().