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 > |
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 Types inherited from Observer::Publisher< CentShiftChange > | |
using | message_type = CentShiftChange |
using | CallbackReturn = std::conditional_t< true, void, bool > |
using | Callback = std::function< CallbackReturn(const CentShiftChange &) > |
Type of functions that can be connected to the Publisher. More... | |
Public Types inherited from Observer::Publisher< PitchAndSpeedPresetChange > | |
using | message_type = PitchAndSpeedPresetChange |
using | CallbackReturn = std::conditional_t< true, void, bool > |
using | Callback = std::function< CallbackReturn(const PitchAndSpeedPresetChange &) > |
Type of functions that can be connected to the Publisher. More... | |
Public Types inherited from Observer::Publisher< StretchRatioChange > | |
using | message_type = StretchRatioChange |
using | CallbackReturn = std::conditional_t< true, void, bool > |
using | Callback = std::function< CallbackReturn(const StretchRatioChange &) > |
Type of functions that can be connected to the Publisher. More... | |
Public Types inherited from Observer::Publisher< WaveClipDtorCalled > | |
using | message_type = WaveClipDtorCalled |
using | CallbackReturn = std::conditional_t< true, void, bool > |
using | Callback = std::function< CallbackReturn(const WaveClipDtorCalled &) > |
Type of functions that can be connected to the Publisher. 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 | SetRawAudioTempo (double tempo) |
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... | |
void | StretchBy (double ratio) |
double | GetStretchRatio () const override |
bool | SetCentShift (int cents) |
int | GetCentShift () const override |
Observer::Subscription | SubscribeToCentShiftChange (std::function< void(int)> cb) override |
void | SetPitchAndSpeedPreset (PitchAndSpeedPreset preset) |
PitchAndSpeedPreset | GetPitchAndSpeedPreset () const override |
Observer::Subscription | SubscribeToPitchAndSpeedPresetChange (std::function< void(PitchAndSpeedPreset)> cb) override |
void | Resample (int rate, BasicUI::ProgressDialog *progress=nullptr) |
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 |
bool | IsEmpty () 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 | TrimQuarternotesFromRight (double quarters) |
Same as TrimRight , but expressed as quarter notes. 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 |
void | SetEnvelope (std::unique_ptr< Envelope > p) |
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 (constSamplePtr 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) |
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 | HasEqualPitchAndSpeed (const WaveClip &other) const |
bool | HasPitchOrSpeed () 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) |
Public Member Functions inherited from ClipInterface | |
~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 int | GetCentShift () const =0 |
virtual Observer::Subscription | SubscribeToCentShiftChange (std::function< void(int)> cb)=0 |
virtual PitchAndSpeedPreset | GetPitchAndSpeedPreset () const =0 |
virtual Observer::Subscription | SubscribeToPitchAndSpeedPresetChange (std::function< void(PitchAndSpeedPreset)> cb)=0 |
Public Member Functions inherited from ClipTimes | |
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 |
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 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) |
Public Member Functions inherited from ClientData::Site< WaveClip, WaveClipListener > | |
~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... | |
Public Member Functions inherited from Observer::Publisher< CentShiftChange > | |
Publisher (ExceptionPolicy *pPolicy=nullptr, Alloc a={}) | |
Constructor supporting type-erased custom allocation/deletion. More... | |
Publisher (Publisher &&)=default | |
Publisher & | operator= (Publisher &&)=default |
Subscription | Subscribe (Callback callback) |
Connect a callback to the Publisher; later-connected are called earlier. More... | |
Subscription | Subscribe (Object &obj, Return(Object::*callback)(Args...)) |
Overload of Subscribe takes an object and pointer-to-member-function. More... | |
Public Member Functions inherited from Observer::Publisher< PitchAndSpeedPresetChange > | |
Publisher (ExceptionPolicy *pPolicy=nullptr, Alloc a={}) | |
Constructor supporting type-erased custom allocation/deletion. More... | |
Publisher (Publisher &&)=default | |
Publisher & | operator= (Publisher &&)=default |
Subscription | Subscribe (Callback callback) |
Connect a callback to the Publisher; later-connected are called earlier. More... | |
Subscription | Subscribe (Object &obj, Return(Object::*callback)(Args...)) |
Overload of Subscribe takes an object and pointer-to-member-function. More... | |
Public Member Functions inherited from Observer::Publisher< StretchRatioChange > | |
Publisher (ExceptionPolicy *pPolicy=nullptr, Alloc a={}) | |
Constructor supporting type-erased custom allocation/deletion. More... | |
Publisher (Publisher &&)=default | |
Publisher & | operator= (Publisher &&)=default |
Subscription | Subscribe (Callback callback) |
Connect a callback to the Publisher; later-connected are called earlier. More... | |
Subscription | Subscribe (Object &obj, Return(Object::*callback)(Args...)) |
Overload of Subscribe takes an object and pointer-to-member-function. More... | |
Public Member Functions inherited from Observer::Publisher< WaveClipDtorCalled > | |
Publisher (ExceptionPolicy *pPolicy=nullptr, Alloc a={}) | |
Constructor supporting type-erased custom allocation/deletion. More... | |
Publisher (Publisher &&)=default | |
Publisher & | operator= (Publisher &&)=default |
Subscription | Subscribe (Callback callback) |
Connect a callback to the Publisher; later-connected are called earlier. More... | |
Subscription | Subscribe (Object &obj, Return(Object::*callback)(Args...)) |
Overload of Subscribe takes an object and pointer-to-member-function. More... | |
Private Member Functions | |
WaveClip (const WaveClip &)=delete | |
WaveClip & | operator= (const WaveClip &)=delete |
sampleCount | TimeToSequenceSamples (double t) const |
bool | StretchRatioEquals (double value) 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 | |
PitchAndSpeedPreset | mPitchAndSpeedPreset { PitchAndSpeedPreset::Default } |
int | mCentShift { 0 } |
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 Public Member Functions inherited from ClientData::Site< WaveClip, WaveClipListener > | |
static size_t | numFactories () |
How many static factories have been registered with this specialization of Site. More... | |
Static Public Attributes inherited from Observer::Publisher< CentShiftChange > | |
static constexpr bool | notifies_all |
Static Public Attributes inherited from Observer::Publisher< PitchAndSpeedPresetChange > | |
static constexpr bool | notifies_all |
Static Public Attributes inherited from Observer::Publisher< StretchRatioChange > | |
static constexpr bool | notifies_all |
Static Public Attributes inherited from Observer::Publisher< WaveClipDtorCalled > | |
static constexpr bool | notifies_all |
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... | |
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 Member Functions inherited from Observer::Publisher< CentShiftChange > | |
CallbackReturn | Publish (const CentShiftChange &message) |
Send a message to connected callbacks. More... | |
Protected Member Functions inherited from Observer::Publisher< PitchAndSpeedPresetChange > | |
CallbackReturn | Publish (const PitchAndSpeedPresetChange &message) |
Send a message to connected callbacks. More... | |
Protected Member Functions inherited from Observer::Publisher< StretchRatioChange > | |
CallbackReturn | Publish (const StretchRatioChange &message) |
Send a message to connected callbacks. More... | |
Protected Member Functions inherited from Observer::Publisher< WaveClipDtorCalled > | |
CallbackReturn | Publish (const WaveClipDtorCalled &message) |
Send a message to connected callbacks. More... | |
This allows multiple clips to be a part of one WaveTrack.
Definition at line 130 of file WaveClip.h.
using WaveClip::Caches = Site< WaveClip, WaveClipListener > |
Definition at line 147 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 40 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 56 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 93 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 144 of file WaveClip.cpp.
References Observer::Publisher< Message, NotifyAll >::Publish().
bool WaveClip::AfterPlayRegion | ( | double | t | ) | const |
) <= t
Definition at line 1532 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 533 of file WaveClip.cpp.
References CheckInvariants(), anonymous_namespace{ExportPCM.cpp}::format, MarkChanged(), mSequences, and UpdateEnvelopeTrackLen().
std::shared_ptr< SampleBlock > WaveClip::AppendNewBlock | ( | constSamplePtr | 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 516 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 525 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 880 of file WaveClip.cpp.
References GetPlayEndTime(), and InsertSilence().
bool WaveClip::AtOrBeforePlayRegion | ( | double | t | ) | const |
t <= [
Definition at line 1527 of file WaveClip.cpp.
References GetPlayStartTime().
bool WaveClip::BeforePlayRegion | ( | double | t | ) | const |
t < [
Definition at line 1522 of file WaveClip.cpp.
References GetPlayStartTime().
Referenced by EntirelyWithinPlayRegion().
bool WaveClip::CheckInvariants | ( | ) | const |
Check invariant conditions on mSequences and mCutlines.
Definition at line 1559 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 887 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 992 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 910 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 920 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 929 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 1138 of file WaveClip.cpp.
References mCutLines, and mSequences.
void WaveClip::ConvertToSampleFormat | ( | sampleFormat | format, |
const std::function< void(size_t)> & | progressReport = {} |
||
) |
Definition at line 484 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 1537 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 1516 of file WaveClip.cpp.
References GetPlayEndTime(), and GetPlayStartTime().
bool WaveClip::EntirelyWithinPlayRegion | ( | double | t0, |
double | t1 | ||
) | const |
t0 and t1 both ∈ [...)
Definition at line 1494 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 1078 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 1057 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 557 of file WaveClip.cpp.
References WaveClip::Transaction::Commit(), GetAppendBufferLen(), MarkChanged(), mSequences, and UpdateEnvelopeTrackLen().
Referenced by 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 431 of file WaveClip.cpp.
References GetWidth(), and mSequences.
Referenced by WaveChannelInterval::GetAppendBuffer().
size_t WaveClip::GetAppendBufferLen | ( | ) | const |
Definition at line 270 of file WaveClip.cpp.
References mSequences.
Referenced by Flush(), WaveChannelInterval::GetAppendBufferLen(), and GetPlayEndTime().
|
overridevirtual |
Implements ClipInterface.
Definition at line 365 of file WaveClip.cpp.
References mCentShift.
Referenced by anonymous_namespace{PitchAndSpeedDialog.cpp}::GetClipShift(), HasEqualPitchAndSpeed(), and HasPitchOrSpeed().
|
inline |
Definition at line 233 of file WaveClip.h.
Referenced by WaveChannelInterval::GetColourIndex().
|
inline |
|
inline |
Definition at line 563 of file WaveClip.h.
|
private |
Definition at line 421 of file WaveClip.cpp.
References mSequences.
Referenced by Resample().
|
inline |
Definition at line 441 of file WaveClip.h.
Referenced by ClearAndAddCutLine(), ClearSequence(), WaveChannelInterval::GetEnvelope(), WaveTrack::GetEnvelopeAtTime(), AUPImportFileHandle::HandleEnvelope(), WaveTrack::HandleXMLChild(), and InsertSilence().
|
inline |
Definition at line 442 of file WaveClip.h.
|
private |
Definition at line 415 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 599 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 442 of file WaveClip.cpp.
References GetPlayEndTime(), GetPlayStartTime(), GetWidth(), min(), mSequences, THROW_INCONSISTENCY_EXCEPTION, and TimeToSequenceSamples().
const wxString & WaveClip::GetName | ( | ) | const |
|
private |
Definition at line 403 of file WaveClip.cpp.
References mSequences.
Referenced by GetPlayEndTime(), GetSampleView(), GetSequenceEndTime(), GetSequenceSamplesCount(), GetVisibleSampleCount(), Resample(), SetRate(), TimeToSequenceSamples(), and UpdateEnvelopeTrackLen().
|
overridevirtual |
Implements ClipInterface.
Definition at line 1185 of file WaveClip.cpp.
References mPitchAndSpeedPreset.
double WaveClip::GetPlayDuration | ( | ) | const |
Always a multiple of the track's sample period, whether the clip is stretched or not.
Definition at line 1365 of file WaveClip.cpp.
References GetPlayEndTime(), and GetPlayStartTime().
Referenced by anonymous_namespace{WaveTrack.cpp}::GetSampleAccessArgs(), and IsEmpty().
sampleCount WaveClip::GetPlayEndSample | ( | ) | const |
Real end time of the clip, quantized to raw sample rate (track's rate)
Definition at line 1380 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 1353 of file WaveClip.cpp.
References GetAppendBufferLen(), GetNumSamples(), GetStretchRatio(), mRate, mSequenceOffset, mTrimRight, and SnapToTrackSample().
Referenced by AUPImportFileHandle::AddSilence(), AfterPlayRegion(), AppendSilence(), 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 1375 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 1343 of file WaveClip.cpp.
References mSequenceOffset, mTrimLeft, and SnapToTrackSample().
Referenced by 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(), anonymous_namespace{SampleHandle.cpp}::SampleResolutionTest(), SharesBoundaryWithNextClip(), SplitsPlayRegion(), WaveChannelInterval::Start(), StretchBy(), StretchLeftTo(), StretchRightTo(), TrimRightTo(), WaveClip(), and WithinPlayRegion().
|
inlineoverridevirtual |
Implements ClipTimes.
Definition at line 191 of file WaveClip.h.
Referenced by ClearAndAddCutLine(), ClearSequence(), WaveChannelInterval::GetRate(), anonymous_namespace{WaveTrack.cpp}::GetSampleAccessArgs(), InsertSilence(), Paste(), anonymous_namespace{SampleHandle.cpp}::SampleResolutionTest(), SharesBoundaryWithNextClip(), TrimQuarternotesFromRight(), 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 466 of file WaveClip.cpp.
References GetWidth(), mSequences, THROW_INCONSISTENCY_EXCEPTION, and TimeToSequenceSamples().
|
private |
Definition at line 409 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 461 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 468 of file WaveClip.h.
BlockArray * WaveClip::GetSequenceBlockArray | ( | size_t | ii | ) |
ii | identifies the channel |
ii < GetWidth()
Definition at line 258 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 264 of file WaveClip.cpp.
References GetWidth(), and mSequences.
double WaveClip::GetSequenceEndTime | ( | ) | const |
Definition at line 1466 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 1338 of file WaveClip.cpp.
References GetNumSamples(), and GetWidth().
Referenced by Paste().
sampleCount WaveClip::GetSequenceStartSample | ( | ) | const |
Returns the index of the first sample of the underlying sequence.
Definition at line 1474 of file WaveClip.cpp.
References mSequenceOffset, and TimeToSamples().
|
noexcept |
Definition at line 1453 of file WaveClip.cpp.
References mSequenceOffset.
Referenced by Clear(), ClearAndAddCutLine(), WaveTrack::ClearAndPasteOne(), ClearLeft(), ClearSequence(), ExpandCutLine(), FindCutLine(), GetSequenceEndTime(), InsertSilence(), OffsetCutLines(), Paste(), RemoveCutLine(), SetRate(), TimeToSequenceSamples(), and WaveClip().
|
overridevirtual |
Implements ClipTimes.
Definition at line 356 of file WaveClip.cpp.
References mClipStretchRatio, mProjectTempo, and mRawAudioTempo.
Referenced by GetPlayEndTime(), anonymous_namespace{WaveTrack.cpp}::GetSampleAccessArgs(), GetSequenceEndTime(), WaveChannelInterval::GetStretchRatio(), HasEqualPitchAndSpeed(), OnProjectTempoChange(), Paste(), anonymous_namespace{SampleHandle.cpp}::SampleResolutionTest(), SetRate(), SharesBoundaryWithNextClip(), StretchBy(), StretchLeftTo(), StretchRatioEquals(), TimeToSamples(), TrimQuarternotesFromRight(), and UpdateEnvelopeTrackLen().
|
noexcept |
Returns the play start offset in seconds from the beginning of the underlying sequence.
Definition at line 1396 of file WaveClip.cpp.
References mTrimLeft.
Referenced by 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 1406 of file WaveClip.cpp.
References mTrimRight.
Referenced by WaveTrack::ClearAndPasteOne(), WaveChannelInterval::GetTrimRight(), and Paste().
|
overridevirtual |
Returns a number of raw samples, not accounting for stretching.
Implements ClipTimes.
Definition at line 1385 of file WaveClip.cpp.
References GetNumSamples(), mTrimLeft, mTrimRight, and TimeToSamples().
Referenced by 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(), CheckInvariants(), WaveTrack::ClearAndPasteOne(), ConvertToSampleFormat(), GetAppendBuffer(), GetMinMax(), GetRMS(), GetSamples(), GetSampleView(), GetSequenceBlockArray(), GetSequenceSamplesCount(), Paste(), SetSamples(), and WaveClip().
|
overridevirtual |
Implements XMLTagHandler.
Definition at line 668 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 654 of file WaveClip.cpp.
References CheckInvariants(), mSequences, and UpdateEnvelopeTrackLen().
Referenced by WaveTrack::HandleXMLEndTag().
|
overridevirtual |
Implements XMLTagHandler.
Definition at line 580 of file WaveClip.cpp.
References mCentShift, mClipStretchRatio, mPitchAndSpeedPreset, mRawAudioTempo, SetColourIndex(), SetName(), SetSequenceStartTime(), SetTrimLeft(), and SetTrimRight().
bool WaveClip::HasEqualPitchAndSpeed | ( | const WaveClip & | other | ) | const |
Checks for stretch-ratio equality, accounting for rounding errors.
Definition at line 386 of file WaveClip.cpp.
References GetCentShift(), GetStretchRatio(), and StretchRatioEquals().
Referenced by WaveTrack::ClearAndPasteOne(), and WaveTrack::MergeOneClipPair().
bool WaveClip::HasPitchOrSpeed | ( | ) | const |
Definition at line 392 of file WaveClip.cpp.
References GetCentShift(), and StretchRatioEquals().
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 836 of file WaveClip.cpp.
References ClearSequence(), GetEnvelope(), GetPlayEndTime(), GetPlayStartTime(), GetRate(), GetSequenceEndTime(), GetSequenceStartTime(), MarkChanged(), mSequences, OffsetCutLines(), SetTrimRight(), TimeToSamples(), and TimeToSequenceSamples().
Referenced by AUPImportFileHandle::AddSilence(), and AppendSilence().
bool WaveClip::IntersectsPlayRegion | ( | double | t0, |
double | t1 | ||
) | const |
[t0, t1) ∩ [...) != ∅
Definition at line 1508 of file WaveClip.cpp.
References GetPlayEndTime(), and GetPlayStartTime().
Referenced by WaveChannelInterval::Intersects().
bool WaveClip::IsEmpty | ( | ) | const |
Definition at line 1370 of file WaveClip.cpp.
References GetPlayDuration(), and mRate.
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 437 of file WaveClip.cpp.
References WaveClipListener::MarkChanged().
Referenced by Append(), ClearAndAddCutLine(), ClearSequence(), ConvertToSampleFormat(), Flush(), InsertSilence(), Paste(), SetRate(), SetSamples(), and SetSilence().
|
inline |
Definition at line 565 of file WaveClip.h.
void WaveClip::OffsetCutLines | ( | double | t0, |
double | len | ||
) |
Offset cutlines right to time 't0' by time amount 'len'.
Definition at line 1129 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 276 of file WaveClip.cpp.
References GetStretchRatio(), mEnvelope, mProjectTempo, mRawAudioTempo, mSequenceOffset, mTrimLeft, mTrimRight, Observer::Publisher< Message, NotifyAll >::Publish(), and StretchCutLines().
bool WaveClip::PartlyWithinPlayRegion | ( | double | t0, |
double | t1 | ||
) | const |
t0 xor t1 ∈ [...)
Definition at line 1502 of file WaveClip.cpp.
References WithinPlayRegion().
bool WaveClip::Paste | ( | double | t0, |
const WaveClip & | other | ||
) |
this->GetWidth() == other.GetWidth()
and either this is empty or this->GetStretchRatio() == other.GetStretchRatio()
.Definition at line 728 of file WaveClip.cpp.
References sampleCount::as_double(), CheckInvariants(), ClearSequence(), staffpad::vo::copy(), cloud::factory, GetFactory(), GetPlayEndTime(), GetPlayStartTime(), GetRate(), GetSampleFormats(), GetSequenceEndTime(), GetSequenceSamplesCount(), GetSequenceStartTime(), GetStretchRatio(), GetTrimLeft(), GetTrimRight(), GetWidth(), MarkChanged(), mClipStretchRatio, mCutLines, mEnvelope, mProjectTempo, mRate, mRawAudioTempo, 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 1112 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 1191 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 1318 of file WaveClip.cpp.
Referenced by anonymous_namespace{WaveTrack.cpp}::RoundToNearestClipSample(), SetFloatsCenteredAroundTime(), SetRate(), and WaveClip().
bool WaveClip::SetCentShift | ( | int | cents | ) |
Definition at line 1167 of file WaveClip.cpp.
References TimeAndPitchInterface::MaxCents, mCentShift, TimeAndPitchInterface::MinCents, and Observer::Publisher< Message, NotifyAll >::Publish().
|
inline |
Definition at line 232 of file WaveClip.h.
Referenced by HandleXMLTag().
void WaveClip::SetEnvelope | ( | std::unique_ptr< Envelope > | p | ) |
Definition at line 253 of file WaveClip.cpp.
References mEnvelope.
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 600 of file WaveClip.h.
void WaveClip::SetName | ( | const wxString & | name | ) |
Definition at line 1303 of file WaveClip.cpp.
Referenced by HandleXMLTag().
void WaveClip::SetPitchAndSpeedPreset | ( | PitchAndSpeedPreset | preset | ) |
Definition at line 1178 of file WaveClip.cpp.
References mPitchAndSpeedPreset, preset, and Observer::Publisher< Message, NotifyAll >::Publish().
void WaveClip::SetPlayStartTime | ( | double | time | ) |
Definition at line 1348 of file WaveClip.cpp.
References mTrimLeft, and SetSequenceStartTime().
void WaveClip::SetRate | ( | int | rate | ) |
Definition at line 1147 of file WaveClip.cpp.
References sampleCount::as_double(), GetNumSamples(), GetSequenceStartTime(), GetStretchRatio(), MarkChanged(), mEnvelope, mRate, mTrimLeft, mTrimRight, SamplesToTime(), SetSequenceStartTime(), and TimeToSamples().
void WaveClip::SetRawAudioTempo | ( | double | tempo | ) |
Definition at line 1162 of file WaveClip.cpp.
References mRawAudioTempo.
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 1460 of file WaveClip.cpp.
References mEnvelope, and mSequenceOffset.
Referenced by 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 1328 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 1391 of file WaveClip.cpp.
References mTrimLeft.
Referenced by 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 1401 of file WaveClip.cpp.
References mTrimRight.
Referenced by Clear(), WaveTrack::ClearAndPasteOne(), ClearRight(), HandleXMLTag(), InsertSilence(), Paste(), and TrimRight().
bool WaveClip::SharesBoundaryWithNextClip | ( | const WaveClip * | next | ) | const |
Definition at line 1292 of file WaveClip.cpp.
References sampleCount::as_double(), GetPlayStartTime(), GetRate(), GetStretchRatio(), and GetVisibleSampleCount().
|
noexcept |
Definition at line 1479 of file WaveClip.cpp.
Referenced by Clear(), ClearAndAddCutLine(), WaveTrack::ClearAndPasteOne(), ClearSequence(), and WaveTrack::CopyOne().
|
privatenoexcept |
Definition at line 1323 of file WaveClip.cpp.
References fast_float::round().
Referenced by GetPlayEndTime(), GetPlayStartTime(), TrimLeftTo(), and TrimRightTo().
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 1484 of file WaveClip.cpp.
References GetPlayEndTime(), and GetPlayStartTime().
Referenced by WaveTrack::ApplyPitchAndSpeed().
void WaveClip::StretchBy | ( | double | ratio | ) |
Definition at line 330 of file WaveClip.cpp.
References GetPlayStartTime(), GetStretchRatio(), mClipStretchRatio, mEnvelope, mSequenceOffset, mTrimLeft, mTrimRight, Observer::Publisher< Message, NotifyAll >::Publish(), and StretchCutLines().
Referenced by StretchRightTo().
|
private |
Definition at line 344 of file WaveClip.cpp.
References mCutLines.
Referenced by OnProjectTempoChange(), StretchBy(), and StretchLeftTo().
void WaveClip::StretchLeftTo | ( | double | to | ) |
Stretches from left to the absolute time (if in expected range)
Definition at line 300 of file WaveClip.cpp.
References GetPlayEndTime(), GetPlayStartTime(), GetStretchRatio(), mClipStretchRatio, mEnvelope, mSequenceOffset, mTrimLeft, mTrimRight, Observer::Publisher< Message, NotifyAll >::Publish(), and StretchCutLines().
|
private |
Definition at line 397 of file WaveClip.cpp.
References GetStretchRatio(), and TimeAndPitchInterface::IsPassThroughMode().
Referenced by HasEqualPitchAndSpeed(), and HasPitchOrSpeed().
void WaveClip::StretchRightTo | ( | double | to | ) |
Sets from the right to the absolute time (if in expected range)
Definition at line 319 of file WaveClip.cpp.
References GetPlayEndTime(), GetPlayStartTime(), and StretchBy().
|
overridevirtual |
Implements ClipInterface.
Definition at line 371 of file WaveClip.cpp.
References CentShiftChange::newValue, and Observer::Publisher< Message, NotifyAll >::Subscribe().
|
overridevirtual |
Implements ClipInterface.
Definition at line 377 of file WaveClip.cpp.
References PitchAndSpeedPresetChange::newValue, and Observer::Publisher< Message, NotifyAll >::Subscribe().
|
overridevirtual |
Implements ClipTimes.
Definition at line 1313 of file WaveClip.cpp.
References GetStretchRatio(), and mRate.
Referenced by CountSamples(), GetFloatAtTime(), GetSamples(), GetSampleView(), GetSequenceStartSample(), GetVisibleSampleCount(), InsertSilence(), SetFloatsFromTime(), SetRate(), SetSamples(), SetSilence(), WaveChannelInterval::TimeToSamples(), TimeToSequenceSamples(), and WaveClip().
|
private |
Definition at line 1550 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 1411 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 1440 of file WaveClip.cpp.
References GetPlayEndTime(), mSequenceOffset, mTrimLeft, and SnapToTrackSample().
void WaveClip::TrimQuarternotesFromRight | ( | double | quarters | ) |
Same as TrimRight
, but expressed as quarter notes.
Definition at line 1421 of file WaveClip.cpp.
References GetRate(), GetStretchRatio(), mRawAudioTempo, and TrimRight().
void WaveClip::TrimRight | ( | double | deltaTime | ) |
Moves play end position by deltaTime.
Definition at line 1416 of file WaveClip.cpp.
References mTrimRight, and SetTrimRight().
Referenced by TrimQuarternotesFromRight().
void WaveClip::TrimRightTo | ( | double | to | ) |
Sets the the right trimming to the absolute time (if that is in bounds)
Definition at line 1447 of file WaveClip.cpp.
References GetPlayStartTime(), GetSequenceEndTime(), mTrimRight, and SnapToTrackSample().
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 506 of file WaveClip.cpp.
References sampleCount::as_double(), GetNumSamples(), GetRate(), GetStretchRatio(), mEnvelope, and mRate.
Referenced by Append(), Flush(), and HandleXMLEndTag().
bool WaveClip::WithinPlayRegion | ( | double | t | ) | const |
t ∈ [...)
Definition at line 1489 of file WaveClip.cpp.
References GetPlayEndTime(), and GetPlayStartTime().
Referenced by GetFloatAtTime(), and PartlyWithinPlayRegion().
void WaveClip::WriteXML | ( | XMLWriter & | xmlFile | ) | const |
Definition at line 697 of file WaveClip.cpp.
References wxT().
|
private |
Definition at line 664 of file WaveClip.h.
Referenced by GetCentShift(), HandleXMLTag(), and SetCentShift().
|
private |
Definition at line 668 of file WaveClip.h.
Referenced by GetStretchRatio(), HandleXMLTag(), Paste(), StretchBy(), and StretchLeftTo().
|
private |
Definition at line 674 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 692 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 685 of file WaveClip.h.
Referenced by HandleXMLChild(), OnProjectTempoChange(), Paste(), SetEnvelope(), SetRate(), SetSequenceStartTime(), StretchBy(), StretchLeftTo(), UpdateEnvelopeTrackLen(), and WaveClip().
|
private |
Definition at line 695 of file WaveClip.h.
Referenced by WaveClip().
|
private |
Definition at line 698 of file WaveClip.h.
Referenced by GetName(), SetName(), and WaveClip().
|
private |
Definition at line 663 of file WaveClip.h.
Referenced by GetPitchAndSpeedPreset(), HandleXMLTag(), and SetPitchAndSpeedPreset().
|
private |
Definition at line 670 of file WaveClip.h.
Referenced by GetStretchRatio(), OnProjectTempoChange(), and Paste().
|
private |
Sample rate of the raw audio, i.e., before stretching.
Definition at line 673 of file WaveClip.h.
Referenced by GetPlayEndSample(), GetPlayEndTime(), GetPlayStartSample(), GetSequenceEndTime(), HandleXMLChild(), IsEmpty(), Paste(), Resample(), SetRate(), TimeToSamples(), UpdateEnvelopeTrackLen(), and WaveClip().
|
private |
Definition at line 669 of file WaveClip.h.
Referenced by GetStretchRatio(), HandleXMLTag(), OnProjectTempoChange(), Paste(), SetRawAudioTempo(), and TrimQuarternotesFromRight().
|
private |
Real-time durations, i.e., stretching the clip modifies these.
Definition at line 658 of file WaveClip.h.
Referenced by GetPlayEndTime(), GetPlayStartTime(), GetSequenceStartSample(), GetSequenceStartTime(), OnProjectTempoChange(), SetSequenceStartTime(), StretchBy(), StretchLeftTo(), TrimLeftTo(), and WaveClip().
|
private |
mSequences.size() > 0
Definition at line 683 of file WaveClip.h.
Referenced by Append(), AppendNewBlock(), AppendSharedBlock(), 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 659 of file WaveClip.h.
Referenced by GetPlayStartTime(), GetSamples(), GetSampleView(), GetTrimLeft(), GetVisibleSampleCount(), OnProjectTempoChange(), SetPlayStartTime(), SetRate(), SetSamples(), SetSilence(), SetTrimLeft(), StretchBy(), StretchLeftTo(), TrimLeft(), TrimLeftTo(), WaveClip(), and WaveClip::Transaction::~Transaction().
|
private |
Definition at line 660 of file WaveClip.h.
Referenced by GetPlayEndTime(), GetTrimRight(), GetVisibleSampleCount(), OnProjectTempoChange(), SetRate(), SetTrimRight(), StretchBy(), StretchLeftTo(), TrimRight(), TrimRightTo(), WaveClip(), and WaveClip::Transaction::~Transaction().