Audacity 3.2.0
WideClip.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*!********************************************************************
3
4 Audacity: A Digital Audio Editor
5
6 WideClip.h
7
8 Matthieu Hodgkinson
9
10**********************************************************************/
11#pragma once
12
13#include "ClipInterface.h"
14
15#include <array>
16
17// A provisional class we can get rid of when Audacity actually uses wide clips.
18// In the meantime, `WaveTrack::GetClipInterfaces()` must construct these
19// querying clips of the other channel tracks if any. If that's not clear please
20// take a look into the `GetClipInterface` implementation.
21class WideClip : public ClipInterface
22{
23public:
24 /*
25 * @pre `left` is not null, and `right` is null or equal to `left` in
26 * sample rate, play start time, play end time and stretch ratio.
27 */
29 std::shared_ptr<ClipInterface> left,
30 std::shared_ptr<ClipInterface> right);
31
32 [[nodiscard]] Observer::Subscription
33 SubscribeToCentShiftChange(std::function<void(int)> cb) override;
34
36 std::function<void(PitchAndSpeedPreset)> cb) override;
37
39 size_t ii, sampleCount start, size_t len, bool mayThrow) const override;
40
41 sampleCount GetVisibleSampleCount() const override;
42
43 size_t GetWidth() const override;
44
45 int GetRate() const override;
46
47 double GetPlayStartTime() const override;
48
49 double GetPlayEndTime() const override;
50
51 sampleCount TimeToSamples(double time) const override;
52
53 double GetStretchRatio() const override;
54
55 int GetCentShift() const override;
56
58
59private:
60 const std::array<std::shared_ptr<ClipInterface>, 2> mChannels;
61};
PitchAndSpeedPreset
Definition: ClipInterface.h:40
A move-only handle representing a connection to a Publisher.
Definition: Observer.h:70
int GetCentShift() const override
Definition: WideClip.cpp:60
sampleCount GetVisibleSampleCount() const override
Definition: WideClip.cpp:25
double GetPlayStartTime() const override
Definition: WideClip.cpp:40
double GetPlayEndTime() const override
Definition: WideClip.cpp:45
Observer::Subscription SubscribeToCentShiftChange(std::function< void(int)> cb) override
Definition: WideClip.cpp:71
WideClip(std::shared_ptr< ClipInterface > left, std::shared_ptr< ClipInterface > right)
Definition: WideClip.cpp:13
const std::array< std::shared_ptr< ClipInterface >, 2 > mChannels
Definition: WideClip.h:60
int GetRate() const override
Definition: WideClip.cpp:35
AudioSegmentSampleView GetSampleView(size_t ii, sampleCount start, size_t len, bool mayThrow) const override
Definition: WideClip.cpp:19
size_t GetWidth() const override
Definition: WideClip.cpp:30
double GetStretchRatio() const override
Definition: WideClip.cpp:55
PitchAndSpeedPreset GetPitchAndSpeedPreset() const override
Definition: WideClip.cpp:65
Observer::Subscription SubscribeToPitchAndSpeedPresetChange(std::function< void(PitchAndSpeedPreset)> cb) override
Definition: WideClip.cpp:80
sampleCount TimeToSamples(double time) const override
Definition: WideClip.cpp:50
Positions or offsets within audio files need a wide type.
Definition: SampleCount.h:19