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 size_t ii, sampleCount start, size_t len, bool mayThrow) const override;
37
38 sampleCount GetVisibleSampleCount() const override;
39
40 size_t GetWidth() const override;
41
42 int GetRate() const override;
43
44 double GetPlayStartTime() const override;
45
46 double GetPlayEndTime() const override;
47
48 sampleCount TimeToSamples(double time) const override;
49
50 double GetStretchRatio() const override;
51
52 int GetCentShift() const override;
53
54private:
55 const std::array<std::shared_ptr<ClipInterface>, 2> mChannels;
56};
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:66
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:55
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
sampleCount TimeToSamples(double time) const override
Definition: WideClip.cpp:50
Positions or offsets within audio files need a wide type.
Definition: SampleCount.h:19