Audacity 3.2.0
WaveClip.h
Go to the documentation of this file.
1/**********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 WaveClip.h
6
7 ?? Dominic Mazzoni
8 ?? Markus Meyer
9
10*******************************************************************/
11#ifndef __AUDACITY_WAVECLIP__
12#define __AUDACITY_WAVECLIP__
13
14#include "Channel.h"
15#include "ClientData.h"
16#include "CRTPBase.h"
17#include "SampleFormat.h"
18#include "ClipInterface.h"
19#include "XMLTagHandler.h"
20#include "SampleCount.h"
22
23#include <wx/longlong.h>
24
25#include <cassert>
26#include <functional>
27#include <optional>
28#include <vector>
29
30class BlockArray;
31class Envelope;
32class sampleCount;
33class SampleBlock;
35using SampleBlockFactoryPtr = std::shared_ptr<SampleBlockFactory>;
36class Sequence;
38namespace BasicUI { class ProgressDialog; }
39
40class WaveClip;
41
42// Array of pointers that assume ownership
43using WaveClipHolder = std::shared_ptr<WaveClip>;
44using WaveClipConstHolder = std::shared_ptr<const WaveClip>;
45using WaveClipHolders = std::vector <WaveClipHolder>;
46using WaveClipConstHolders = std::vector<WaveClipConstHolder>;
47using ProgressReporter = std::function<void(double)>;
48
49struct WAVE_TRACK_API WaveClipListener;
50CRTP_BASE(WaveClipListenerBase, struct,
52struct WaveClipListener : WaveClipListenerBase {
53 virtual ~WaveClipListener() = 0;
54 virtual void MarkChanged() noexcept = 0;
55 virtual void Invalidate() = 0;
56
57 // Default implementation does nothing
58 virtual void WriteXMLAttributes(XMLWriter &writer) const;
59
60 // Default implementation just returns false
61 virtual bool HandleXMLAttribute(
62 const std::string_view &attr, const XMLAttributeValueView &valueView);
63
66
72 virtual void MakeStereo(WaveClipListener &&other, bool aligned);
73
75 virtual void SwapChannels();
76
79
82 virtual void Erase(size_t index);
83};
84
85class WAVE_TRACK_API WaveClipChannel
86 : public ChannelInterval
87 , public ClipTimes
88{
89public:
91 : mClip{ clip }
92 , miChannel{ iChannel }
93 {}
94 ~WaveClipChannel() override;
95
96 WaveClip &GetClip() { return mClip; }
97 const WaveClip &GetClip() const { return mClip; }
98
99 size_t GetChannelIndex() const { return miChannel; }
100
101 Envelope &GetEnvelope();
102 const Envelope &GetEnvelope() const;
103
104 bool Intersects(double t0, double t1) const;
105 double Start() const;
106 double End() const;
107
119 GetSampleView(double t0, double t1, bool mayThrow) const;
120
124 bool WithinPlayRegion(double t) const;
125 double SamplesToTime(sampleCount s) const noexcept;
126 bool HasPitchOrSpeed() const;
127
128 double GetTrimLeft() const;
129 double GetTrimRight() const;
130
131 bool GetSamples(samplePtr buffer, sampleFormat format,
132 sampleCount start, size_t len, bool mayThrow = true) const;
133
134 AudioSegmentSampleView GetSampleView(
135 sampleCount start, size_t length, bool mayThrow) const;
136
137 const Sequence &GetSequence() const;
138
139 constSamplePtr GetAppendBuffer() const;
140 size_t GetAppendBufferLen() const;
141
142 const BlockArray *GetSequenceBlockArray() const;
143
148 std::pair<float, float> GetMinMax(double t0, double t1, bool mayThrow) const;
149
153 float GetRMS(double t0, double t1, bool mayThrow) const;
154
156 sampleCount GetPlayStartSample() const;
157
159 sampleCount GetPlayEndSample() const;
160
164 void SetSamples(constSamplePtr buffer, sampleFormat format,
165 sampleCount start, size_t len,
166 sampleFormat effectiveFormat
172 );
173
174 void WriteXML(XMLWriter &xmlFile) const;
175
176 // implement ClipTimes
177 sampleCount GetVisibleSampleCount() const override;
178 int GetRate() const override;
179 double GetPlayStartTime() const override;
180 double GetPlayEndTime() const override;
181 double GetPlayDuration() const;
182 sampleCount TimeToSamples(double time) const override;
183 double GetStretchRatio() const override;
184
185 friend inline bool operator ==(
186 const WaveClipChannel &a, const WaveClipChannel &b)
187 { return &a.mClip == &b.mClip && a.miChannel == b.miChannel; }
188 friend inline bool operator !=(
189 const WaveClipChannel &a, const WaveClipChannel &b)
190 { return !(a == b); }
191
192private:
194 const size_t miChannel;
195};
196
198{
199 explicit CentShiftChange(int newValue)
200 : newValue(newValue)
201 {
202 }
203 const int newValue;
204};
205
207{
209 : newValue(newValue)
210 {
211 }
213};
214
216{
217 explicit StretchRatioChange(double newValue)
218 : newValue(newValue)
219 {
220 }
221 const double newValue;
222};
223
225{
226};
227
228class WAVE_TRACK_API WaveClip final :
229 public ClipInterface,
231 public XMLTagHandler,
232 public ClientData::Site<
233 WaveClip, WaveClipListener, ClientData::DeepCopying>,
234 public Observer::Publisher<CentShiftChange>,
235 public Observer::Publisher<PitchAndSpeedPresetChange>,
236 public Observer::Publisher<StretchRatioChange>,
237 public Observer::Publisher<WaveClipDtorCalled>
238{
239private:
240 struct CreateToken{ bool emptyCopy = false; };
241
242 // It is an error to copy a WaveClip without specifying the
243 // sample block factory.
244
245 WaveClip(const WaveClip&) = delete;
246 WaveClip& operator= (const WaveClip&) = delete;
247
248public:
249 static const char *WaveClip_tag;
250
251 using Attachments = Site<WaveClip, WaveClipListener, ClientData::DeepCopying>;
252
254
259 WaveClip(size_t width,
261 int rate);
262
266
270 WaveClip(const WaveClip& orig,
272 bool copyCutlines)
273 : WaveClip{ orig, factory, copyCutlines, {} }
274 {}
275
277
281 WaveClip(const WaveClip& orig,
283 bool copyCutlines,
284 double t0, double t1);
285
286 virtual ~WaveClip();
287
288 // Satisfying WideChannelGroupInterval
289 double Start() const override;
290 double End() const override;
291 std::shared_ptr<ChannelInterval> DoGetChannel(size_t iChannel) override;
292
294
295 auto Channels() { return
296 WideChannelGroupInterval::Channels<Channel>(); }
297
298 auto Channels() const { return
299 WideChannelGroupInterval::Channels<const Channel>(); }
300
302
309 bool CheckInvariants() const;
310
315 bool StrongInvariant() const;
316
319
320 void AssertOrRepairStrongInvariant();
321
325 explicit StrongInvariantScope(WaveClip &clip);
327 private:
329 };
330
332 size_t NChannels() const override;
333
334 void ConvertToSampleFormat(sampleFormat format,
335 const std::function<void(size_t)> & progressReport = {});
336
337 int GetRate() const override
338 {
339 return mRate;
340 }
341
342 // Set rate without resampling. This will change the length of the clip
343 void SetRate(int rate);
344 void SetRawAudioTempo(double tempo);
345
346 PitchAndSpeedPreset GetPitchAndSpeedPreset() const;
347
349 void StretchLeftTo(double to);
351 void StretchRightTo(double to);
352 void StretchBy(double ratio);
353
354 double GetStretchRatio() const override;
355
358 bool HasEqualPitchAndSpeed(const WaveClip& other) const;
359 bool HasPitchOrSpeed() const;
361
362 /*
363 * @post `true` if `TimeAndPitchInterface::MinCent <= cents && cents <=
364 * TimeAndPitchInterface::MaxCent`
365 */
366 bool SetCentShift(int cents);
367 int GetCentShift() const override;
368 [[nodiscard]] Observer::Subscription
369 SubscribeToCentShiftChange(std::function<void(int)> cb) const override;
370
371 void SetPitchAndSpeedPreset(PitchAndSpeedPreset preset);
372 [[nodiscard]] virtual Observer::Subscription
373 SubscribeToPitchAndSpeedPresetChange(
374 std::function<void(PitchAndSpeedPreset)> cb) const override;
375
376 // Resample clip. This also will set the rate, but without changing
377 // the length of the clip
378 void Resample(int rate, BasicUI::ProgressDialog *progress = nullptr);
379
380 double GetSequenceStartTime() const noexcept;
381 void SetSequenceStartTime(double startTime);
382 double GetSequenceEndTime() const;
384 sampleCount GetSequenceStartSample() const;
388
391 double GetPlayStartTime() const noexcept override;
392 void SetPlayStartTime(double time);
393
396 double GetPlayEndTime() const override;
397
400 double GetPlayDuration() const;
401
402 bool IsEmpty() const;
403
405 sampleCount GetPlayStartSample() const;
407 sampleCount GetPlayEndSample() const;
408
412 sampleCount GetVisibleSampleCount() const override;
413
415 void SetTrimLeft(double trim);
417 double GetTrimLeft() const noexcept;
418
420 void SetTrimRight(double trim);
422 double GetTrimRight() const noexcept;
423
425 void TrimLeft(double deltaTime);
427 void TrimRight(double deltaTime);
429 void TrimQuarternotesFromRight(double quarters);
430
432 void TrimLeftTo(double to);
434 void TrimRightTo(double to);
435
437 void ShiftBy(double delta) noexcept;
438
441
446 bool SplitsPlayRegion(double t) const;
450 bool WithinPlayRegion(double t) const;
454 bool BeforePlayRegion(double t) const;
458 bool AtOrBeforePlayRegion(double t) const;
462 bool AfterPlayRegion(double t) const;
467 bool EntirelyWithinPlayRegion(double t0, double t1) const;
472 bool PartlyWithinPlayRegion(double t0, double t1) const;
477 bool IntersectsPlayRegion(double t0, double t1) const;
483 bool CoversEntirePlayRegion(double t0, double t1) const;
484
489 sampleCount CountSamples(double t0, double t1) const;
490
499 AudioSegmentSampleView GetSampleView(
500 size_t iChannel, sampleCount start, size_t length,
501 bool mayThrow = true) const override;
502
514 AudioSegmentSampleView GetSampleView(
515 size_t iChannel, double t0, double t1, bool mayThrow = true) const;
516
518
523 bool GetSamples(size_t ii, samplePtr buffer, sampleFormat format,
524 sampleCount start, size_t len, bool mayThrow = true) const;
525
527
531 bool GetSamples(samplePtr buffers[], sampleFormat format,
532 sampleCount start, size_t len, bool mayThrow = true) const;
533
535
541 void SetSamples(size_t ii, constSamplePtr buffer, sampleFormat format,
542 sampleCount start, size_t len,
543 sampleFormat effectiveFormat
549 );
550
552
553 Envelope &GetEnvelope() noexcept { return *mEnvelope; }
554 const Envelope &GetEnvelope() const noexcept { return *mEnvelope; }
555
557 void SetEnvelope(std::unique_ptr<Envelope> p);
558
560
563 const BlockArray* GetSequenceBlockArray(size_t ii) const;
564
568
571 Sequence* GetSequence(size_t ii) {
572 assert(ii < NChannels());
573 return mSequences[ii].get();
574 }
578 const Sequence* GetSequence(size_t ii) const { return mSequences[ii].get(); }
579
586 std::pair<float, float> GetMinMax(size_t ii,
587 double t0, double t1, bool mayThrow) const;
591 float GetRMS(size_t ii, double t0, double t1, bool mayThrow) const;
592
596 void UpdateEnvelopeTrackLen();
597
601 std::shared_ptr<SampleBlock>
602 AppendToChannel(size_t iChannel,
603 constSamplePtr buffer, sampleFormat format, size_t len);
604
608 std::shared_ptr<SampleBlock>
609 AppendLegacyNewBlock(constSamplePtr buffer, sampleFormat format, size_t len);
610
613
616 void AppendLegacySharedBlock(const std::shared_ptr<SampleBlock> &pBlock);
617
620
633 bool Append(size_t iChannel, size_t nChannels,
635 size_t len, unsigned int stride,
636 sampleFormat effectiveFormat
642 );
643
646
656 size_t len, unsigned int stride,
657 sampleFormat effectiveFormat
663 );
664
666
670 void Flush();
671
673 void RepairChannels();
674
677 void Clear(double t0, double t1);
678
683 void ClearLeft(double t);
687 void ClearRight(double t);
688
691
695 void ClearAndAddCutLine(double t0, double t1);
696
698 void AddCutLine(WaveClipHolder pClip);
699
713 bool Paste(double t0, const WaveClip& other);
714
717
721 void InsertSilence( double t, double len, double *pEnvelopeValue = nullptr );
722
725 void AppendSilence( double len, double envelopeValue );
726
728 const WaveClipHolders &GetCutLines() { return mCutLines; }
730 { return reinterpret_cast< const WaveClipConstHolders& >( mCutLines ); }
731 size_t NumCutLines() const { return mCutLines.size(); }
732
736 bool FindCutLine(double cutLinePosition,
737 double* cutLineStart = nullptr,
738 double *cutLineEnd = nullptr) const;
739
743 void ExpandCutLine(double cutLinePosition);
744
746 bool RemoveCutLine(double cutLinePosition);
747
749 void OffsetCutLines(double t0, double len);
750
752
753 void CloseLock() noexcept;
754
755 //
756 // XMLTagHandler callback methods for loading and saving
757 //
758
759 bool HandleXMLTag(const std::string_view& tag, const AttributesList &attrs) override;
760 void HandleXMLEndTag(const std::string_view& tag) override;
761 XMLTagHandler *HandleXMLChild(const std::string_view& tag) override;
762
765
769 void WriteXML(size_t ii, XMLWriter &xmlFile) const;
770
771 // AWD, Oct 2009: for pasting whitespace at the end of selection
772 bool GetIsPlaceholder() const { return mIsPlaceholder; }
773 void SetIsPlaceholder(bool val) { mIsPlaceholder = val; }
774
775 void SetName(const wxString& name);
776 const wxString& GetName() const;
777
778 // TimeToSamples and SamplesToTime take clip stretch ratio into account.
779 // Use them to convert time / sample offsets.
780 sampleCount TimeToSamples(double time) const override;
781 double SamplesToTime(sampleCount s) const noexcept;
782
784
788 void SetSilence(sampleCount offset, sampleCount length);
789
791
795 constSamplePtr GetAppendBuffer(size_t ii) const;
800 size_t GetAppendBufferLen(size_t ii) const;
801
802 void
803 OnProjectTempoChange(const std::optional<double>& oldTempo, double newTempo);
804
805 SampleFormats GetSampleFormats() const;
806
807 size_t CountBlocks() const;
808
810
813 void DiscardRightChannel();
814
816 void SwapChannels();
817
820
825 std::shared_ptr<WaveClip> SplitChannels();
826
829
841 void MakeStereo(WaveClip &&other, bool mustAlign);
842
843 // These return a nonnegative number of samples meant to size a memory buffer
844 size_t GetBestBlockSize(sampleCount t) const;
845 size_t GetMaxBlockSize() const;
846
850
861 WaveClip(const WaveClip& orig,
863 bool copyCutlines, CreateToken token);
864
865private:
866 static void TransferSequence(WaveClip &origClip, WaveClip &newClip);
867 static void FixSplitCutlines(
868 WaveClipHolders &myCutlines, WaveClipHolders &newCutlines);
869
870 size_t GreatestAppendBufferLen() const;
871
873
874 void MarkChanged() noexcept;
875
876 // Always gives non-negative answer, not more than sample sequence length
877 // even if t0 really falls outside that range
878 sampleCount TimeToSequenceSamples(double t) const;
879 bool StretchRatioEquals(double value) const;
880 sampleCount GetNumSamples() const;
881 const SampleBlockFactoryPtr &GetFactory() const;
882 std::vector<std::unique_ptr<Sequence>> GetEmptySequenceCopies() const;
883 void StretchCutLines(double ratioChange);
884 double SnapToTrackSample(double time) const noexcept;
885
887
891 public:
892 ClearSequenceFinisher() noexcept = default;
893 /*
894 @param t0 start of deleted range
895 @param t1 end of deleted range
896 @param clip_t0 t0 clamped to previous play region
897 @param clip_t1 t1 clamped to previous play region
898 */
900 double t0, double t1, double clip_t0, double clip_t1) noexcept
901 : pClip{ pClip }
902 , t0{ t0 }, t1{ t1 }, clip_t0{ clip_t0 }, clip_t1{ clip_t1 }
903 {}
905 {
906 *this = other;
907 other.pClip = nullptr;
908 return *this;
909 }
910 ~ClearSequenceFinisher() noexcept;
911 void Commit() noexcept { committed = true; }
912
913 private:
915 operator =(const ClearSequenceFinisher &other) = default;
916 WaveClip *pClip{};
917 double t0{}, t1{}, clip_t0{}, clip_t1{};
918 bool committed = false;
919 };
920
923
927 [[nodiscard]] ClearSequenceFinisher ClearSequence(double t0, double t1);
928
930 struct Transaction {
931 explicit Transaction(WaveClip &clip);
932 ~Transaction();
933 void Commit() { committed = true; }
934
936 std::vector<std::unique_ptr<Sequence>> sequences;
937 const double mTrimLeft,
939 bool committed{ false };
940 };
941
944 double mSequenceOffset { 0 };
945 double mTrimLeft { 0 };
946 double mTrimRight { 0 };
948
950 int mCentShift { 0 };
951
952 // Used in GetStretchRatio which computes the factor, by which the sample
953 // interval is multiplied, to get a realtime duration.
954 double mClipStretchRatio = 1.;
955 std::optional<double> mRawAudioTempo;
956 std::optional<double> mProjectTempo;
957
959 int mRate;
960
964 std::vector<std::unique_ptr<Sequence>> mSequences;
966 std::unique_ptr<Envelope> mEnvelope;
967
970
973 WaveClipHolders mCutLines {};
974
975 // AWD, Oct. 2009: for whitespace-at-end-of-selection pasting
976 bool mIsPlaceholder { false };
977
978 wxString mName;
979};
980
981#endif
An audio segment is either a whole clip or the silence between clips. Views allow shared references t...
static RegisteredToolbarFactory factory
Abstract class ChannelGroup with two discrete iterable dimensions, channels and intervals; subclasses...
Utility ClientData::Site to register hooks into a host class that attach client data.
PitchAndSpeedPreset
Definition: ClipInterface.h:40
const TranslatableString name
Definition: Distortion.cpp:76
EffectReverbSettings preset
Definition: Reverb.cpp:44
bool operator==(const EffectReverbSettings &a, const EffectReverbSettings &b)
Definition: Reverb.cpp:632
std::shared_ptr< SampleBlockFactory > SampleBlockFactoryPtr
Definition: SampleBlock.h:31
sampleFormat
The ordering of these values with operator < agrees with the order of increasing bit width.
Definition: SampleFormat.h:30
char * samplePtr
Definition: SampleFormat.h:57
const char * constSamplePtr
Definition: SampleFormat.h:58
AttachedVirtualFunction< struct OnProjectTempoChangeTag, void, ChannelGroup, const std::optional< double > &, double > OnProjectTempoChange
Method to set project tempo on a channel group, defaulting to no-op.
Definition: TempoChange.h:22
std::function< void(double)> ProgressReporter
Definition: Track.h:48
std::vector< WaveClipConstHolder > WaveClipConstHolders
Definition: WaveClip.h:46
std::shared_ptr< const WaveClip > WaveClipConstHolder
Definition: WaveClip.h:44
std::shared_ptr< WaveClip > WaveClipHolder
Definition: WaveClip.h:43
CRTP_BASE(WaveClipListenerBase, struct, ClientData::Cloneable< WaveClipListener >)
std::vector< WaveClipHolder > WaveClipHolders
Definition: WaveClip.h:45
Append(Adapt< My >([](My &table) { return(WaveChannelSubViews::numFactories() > 1) ? std::make_unique< Entry >("MultiView", Entry::CheckItem, OnMultiViewID, XXO("&Multi-view"), POPUP_MENU_FN(OnMultiView), table, [](PopupMenuHandler &handler, wxMenu &menu, int id){ auto &table=static_cast< WaveTrackMenuTable & >(handler);auto &track=table.FindWaveTrack();const auto &view=WaveChannelView::GetFirst(track);menu.Check(id, view.GetMultiView());}) :nullptr;}))
bool operator!=(const WaveTrackLocation &a, const WaveTrackLocation &b)
std::vector< Attribute > AttributesList
Definition: XMLTagHandler.h:40
Abstraction of a progress dialog with well defined time-to-completion estimate.
Definition: BasicUI.h:157
The intersection of a Channel and a WideChannelGroupInterval.
Definition: Channel.h:42
Utility to register hooks into a host class that attach client data.
Definition: ClientData.h:229
Piecewise linear or piecewise exponential function from double to double.
Definition: Envelope.h:72
An object that sends messages to an open-ended list of subscribed callbacks.
Definition: Observer.h:108
A move-only handle representing a connection to a Publisher.
Definition: Observer.h:70
ProgressDialog Class.
Interface to libsoxr.
Definition: Resample.h:27
abstract base class with methods to produce SampleBlock objects
Definition: SampleBlock.h:120
Abstract class allows access to contents of a block of sound samples, serialization as XML,...
Definition: SampleBlock.h:47
Two sample formats, remembering format of original source and describing stored format.
Definition: SampleFormat.h:79
A WaveTrack contains WaveClip(s). A WaveClip contains a Sequence. A Sequence is primarily an interfac...
Definition: Sequence.h:53
Fix consistency of cutlines and envelope after deleting from Sequences.
Definition: WaveClip.h:890
ClearSequenceFinisher() noexcept=default
WaveClip & GetClip()
Definition: WaveClip.h:96
const WaveClip & GetClip() const
Definition: WaveClip.h:97
WaveClip & mClip
Definition: WaveClip.h:193
size_t GetChannelIndex() const
Definition: WaveClip.h:99
~WaveClipChannel() override
WaveClipChannel(WaveClip &clip, size_t iChannel)
Definition: WaveClip.h:90
const size_t miChannel
Definition: WaveClip.h:194
This allows multiple clips to be a part of one WaveTrack.
Definition: WaveClip.h:238
std::optional< double > mRawAudioTempo
Definition: WaveClip.h:955
Site< WaveClip, WaveClipListener, ClientData::DeepCopying > Attachments
Definition: WaveClip.h:251
void SetIsPlaceholder(bool val)
Definition: WaveClip.h:773
auto Channels() const
Definition: WaveClip.h:298
WaveClip(const WaveClip &orig, const SampleBlockFactoryPtr &factory, bool copyCutlines)
Definition: WaveClip.h:270
std::unique_ptr< Envelope > mEnvelope
Envelope is unique, not per-sequence, and always non-null.
Definition: WaveClip.h:966
std::optional< double > mProjectTempo
Definition: WaveClip.h:956
wxString mName
Definition: WaveClip.h:978
const Envelope & GetEnvelope() const noexcept
Definition: WaveClip.h:554
int GetRate() const override
Definition: WaveClip.h:337
int mRate
Sample rate of the raw audio, i.e., before stretching.
Definition: WaveClip.h:959
auto Channels()
Definition: WaveClip.h:295
const WaveClipHolders & GetCutLines()
Get access to cut lines list.
Definition: WaveClip.h:728
WaveClip(const WaveClip &)=delete
const Sequence * GetSequence(size_t ii) const
Definition: WaveClip.h:578
static const char * WaveClip_tag
Definition: WaveClip.h:249
Sequence * GetSequence(size_t ii)
Definition: WaveClip.h:571
const WaveClipConstHolders & GetCutLines() const
Definition: WaveClip.h:729
size_t NumCutLines() const
Definition: WaveClip.h:731
std::vector< std::unique_ptr< Sequence > > mSequences
Definition: WaveClip.h:964
A view into an attribute value. The class does not take the ownership of the data.
This class is an interface which should be implemented by classes which wish to be able to load and s...
Definition: XMLTagHandler.h:42
Base class for XMLFileWriter and XMLStringWriter that provides the general functionality for creating...
Definition: XMLWriter.h:25
Positions or offsets within audio files need a wide type.
Definition: SampleCount.h:19
WAVE_TRACK_API bool HasPitchOrSpeed(const WaveTrack &track, double t0, double t1)
WAVE_TRACK_API std::pair< float, float > GetMinMax(const WaveChannel &channel, double t0, double t1, bool mayThrow=true)
WAVE_TRACK_API float GetRMS(const WaveChannel &channel, double t0, double t1, bool mayThrow=true)
WAVE_TRACK_API size_t CountBlocks(const WaveTrack &track)
WAVE_TRACK_API sampleCount GetSequenceSamplesCount(const WaveTrack &track)
WAVE_TRACK_API void ExpandCutLine(WaveTrack &track, double cutLinePosition, double *cutlineStart=nullptr, double *cutlineEnd=nullptr)
WAVE_TRACK_API void CloseLock(WaveTrack &track) noexcept
Should be called upon project close. Not balanced by unlocking calls.
WAVE_TRACK_API bool RemoveCutLine(WaveTrack &track, double cutLinePosition)
Remove cut line, without expanding the audio in it.
double GetRate(const Track &track)
Definition: TimeTrack.cpp:182
void StretchRightTo(WaveTrack::Interval &interval, double t)
void StretchLeftTo(WaveTrack::Interval &interval, double t)
void TrimLeftTo(WaveTrack::Interval &interval, double t)
void TrimRightTo(WaveTrack::Interval &interval, double t)
STL namespace.
const int newValue
Definition: WaveClip.h:203
CentShiftChange(int newValue)
Definition: WaveClip.h:199
A convenient base class defining abstract virtual Clone() for a given kind of pointer.
Definition: ClientData.h:50
const PitchAndSpeedPreset newValue
Definition: WaveClip.h:212
PitchAndSpeedPresetChange(PitchAndSpeedPreset newValue)
Definition: WaveClip.h:208
StretchRatioChange(double newValue)
Definition: WaveClip.h:217
const double newValue
Definition: WaveClip.h:221
Restores state when an update loop over mSequences fails midway.
Definition: WaveClip.h:930
const double mTrimLeft
Definition: WaveClip.h:937
std::vector< std::unique_ptr< Sequence > > sequences
Definition: WaveClip.h:936
const double mTrimRight
Definition: WaveClip.h:938
virtual void MarkChanged() noexcept=0
virtual void MakeStereo(WaveClipListener &&other, bool aligned)
Definition: WaveClip.cpp:50
virtual void Erase(size_t index)
Definition: WaveClip.cpp:58
virtual void WriteXMLAttributes(XMLWriter &writer) const
Definition: WaveClip.cpp:40
virtual ~WaveClipListener()=0
virtual bool HandleXMLAttribute(const std::string_view &attr, const XMLAttributeValueView &valueView)
Definition: WaveClip.cpp:44
virtual void SwapChannels()
Default implementation does nothing.
Definition: WaveClip.cpp:54
virtual void Invalidate()=0