Audacity 3.2.0
ClipInterface.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 ClipInterface.h
7
8 Matthieu Hodgkinson
9
10**********************************************************************/
11#pragma once
12
14#include "Observer.h"
15#include "SampleCount.h"
16#include "SampleFormat.h"
17
18class STRETCHING_SEQUENCE_API ClipTimes
19{
20public:
21 virtual ~ClipTimes();
22
27
28 virtual int GetRate() const = 0;
29
30 virtual double GetPlayStartTime() const = 0;
31
32 virtual double GetPlayEndTime() const = 0;
33
34 virtual sampleCount TimeToSamples(double time) const = 0;
35
36 virtual double GetStretchRatio() const = 0;
37};
38
40{
41 Default,
43};
44
45class STRETCHING_SEQUENCE_API ClipInterface : public ClipTimes
46{
47public:
48 ~ClipInterface() override;
49
51 size_t iChannel, sampleCount start, size_t length,
52 bool mayThrow = true) const = 0;
53
54 virtual size_t NChannels() const = 0;
55
56 virtual int GetCentShift() const = 0;
57
58 [[nodiscard]] virtual Observer::Subscription
59 SubscribeToCentShiftChange(std::function<void(int)> cb) const = 0;
60
62
63 [[nodiscard]] virtual Observer::Subscription
65 std::function<void(PitchAndSpeedPreset)> cb) const = 0;
66};
67
68using ClipConstHolders = std::vector<std::shared_ptr<const ClipInterface>>;
std::vector< std::shared_ptr< const ClipInterface > > ClipConstHolders
An audio segment is either a whole clip or the silence between clips. Views allow shared references t...
PitchAndSpeedPreset
Definition: ClipInterface.h:40
virtual int GetCentShift() const =0
~ClipInterface() override
virtual PitchAndSpeedPreset GetPitchAndSpeedPreset() const =0
virtual size_t NChannels() const =0
virtual Observer::Subscription SubscribeToPitchAndSpeedPresetChange(std::function< void(PitchAndSpeedPreset)> cb) const =0
virtual Observer::Subscription SubscribeToCentShiftChange(std::function< void(int)> cb) const =0
virtual AudioSegmentSampleView GetSampleView(size_t iChannel, sampleCount start, size_t length, bool mayThrow=true) const =0
virtual ~ClipTimes()
virtual double GetPlayEndTime() const =0
virtual int GetRate() const =0
virtual double GetStretchRatio() const =0
virtual double GetPlayStartTime() const =0
virtual sampleCount TimeToSamples(double time) const =0
virtual sampleCount GetVisibleSampleCount() const =0
A move-only handle representing a connection to a Publisher.
Definition: Observer.h:70
Positions or offsets within audio files need a wide type.
Definition: SampleCount.h:19