Audacity 3.2.0
Public Member Functions | Private Attributes | List of all members
WideClip Class Reference

#include <WideClip.h>

Inheritance diagram for WideClip:
[legend]
Collaboration diagram for WideClip:
[legend]

Public Member Functions

 WideClip (std::shared_ptr< ClipInterface > left, std::shared_ptr< ClipInterface > right)
 
Observer::Subscription SubscribeToCentShiftChange (std::function< void(int)> cb) override
 
Observer::Subscription SubscribeToPitchAndSpeedPresetChange (std::function< void(PitchAndSpeedPreset)> cb) override
 
AudioSegmentSampleView GetSampleView (size_t ii, sampleCount start, size_t len, bool mayThrow) const override
 
sampleCount GetVisibleSampleCount () const override
 
size_t GetWidth () const override
 
int GetRate () const override
 
double GetPlayStartTime () const override
 
double GetPlayEndTime () const override
 
sampleCount TimeToSamples (double time) const override
 
double GetStretchRatio () const override
 
int GetCentShift () const override
 
PitchAndSpeedPreset GetPitchAndSpeedPreset () const override
 
- 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
 

Private Attributes

const std::array< std::shared_ptr< ClipInterface >, 2 > mChannels
 

Detailed Description


Audacity: A Digital Audio Editor

WideClip.h

Matthieu Hodgkinson

Definition at line 21 of file WideClip.h.

Constructor & Destructor Documentation

◆ WideClip()

WideClip::WideClip ( std::shared_ptr< ClipInterface left,
std::shared_ptr< ClipInterface right 
)

Audacity: A Digital Audio Editor

WideClip.cpp

Matthieu Hodgkinson

Definition at line 13 of file WideClip.cpp.

15 : mChannels { std::move(left), std::move(right) }
16{
17}
const std::array< std::shared_ptr< ClipInterface >, 2 > mChannels
Definition: WideClip.h:60

Member Function Documentation

◆ GetCentShift()

int WideClip::GetCentShift ( ) const
overridevirtual

Implements ClipInterface.

Definition at line 60 of file WideClip.cpp.

61{
62 return mChannels[0u]->GetCentShift();
63}

References mChannels.

◆ GetPitchAndSpeedPreset()

PitchAndSpeedPreset WideClip::GetPitchAndSpeedPreset ( ) const
overridevirtual

Implements ClipInterface.

Definition at line 65 of file WideClip.cpp.

66{
67 return mChannels[0u]->GetPitchAndSpeedPreset();
68}

References mChannels.

◆ GetPlayEndTime()

double WideClip::GetPlayEndTime ( ) const
overridevirtual

Implements ClipTimes.

Definition at line 45 of file WideClip.cpp.

46{
47 return mChannels[0u]->GetPlayEndTime();
48}

References mChannels.

◆ GetPlayStartTime()

double WideClip::GetPlayStartTime ( ) const
overridevirtual

Implements ClipTimes.

Definition at line 40 of file WideClip.cpp.

41{
42 return mChannels[0u]->GetPlayStartTime();
43}

References mChannels.

◆ GetRate()

int WideClip::GetRate ( ) const
overridevirtual

Implements ClipTimes.

Definition at line 35 of file WideClip.cpp.

36{
37 return mChannels[0u]->GetRate();
38}

References mChannels.

◆ GetSampleView()

AudioSegmentSampleView WideClip::GetSampleView ( size_t  ii,
sampleCount  start,
size_t  len,
bool  mayThrow 
) const
overridevirtual

Implements ClipInterface.

Definition at line 19 of file WideClip.cpp.

21{
22 return mChannels[ii]->GetSampleView(0u, start, len, mayThrow);
23}

References mChannels.

◆ GetStretchRatio()

double WideClip::GetStretchRatio ( ) const
overridevirtual

Implements ClipTimes.

Definition at line 55 of file WideClip.cpp.

56{
57 return mChannels[0u]->GetStretchRatio();
58}

References mChannels.

◆ GetVisibleSampleCount()

sampleCount WideClip::GetVisibleSampleCount ( ) const
overridevirtual

The number of raw audio samples not hidden by trimming.

Implements ClipTimes.

Definition at line 25 of file WideClip.cpp.

26{
27 return mChannels[0u]->GetVisibleSampleCount();
28}

References mChannels.

◆ GetWidth()

size_t WideClip::GetWidth ( ) const
overridevirtual

Implements ClipInterface.

Definition at line 30 of file WideClip.cpp.

31{
32 return mChannels[1u] == nullptr ? 1u : 2u;
33}

References mChannels.

◆ SubscribeToCentShiftChange()

Observer::Subscription WideClip::SubscribeToCentShiftChange ( std::function< void(int)>  cb)
overridevirtual

Implements ClipInterface.

Definition at line 71 of file WideClip.cpp.

72{
73 // On purpose set the publisher on the left channel only. This is not a clip
74 // property that is saved to disk, and else we'll get two callbacks for the
75 // same event.
76 return mChannels[0u]->SubscribeToCentShiftChange(std::move(cb));
77}

References mChannels.

◆ SubscribeToPitchAndSpeedPresetChange()

Observer::Subscription WideClip::SubscribeToPitchAndSpeedPresetChange ( std::function< void(PitchAndSpeedPreset)>  cb)
overridevirtual

Implements ClipInterface.

Definition at line 80 of file WideClip.cpp.

81{
82 // On purpose set the publisher on the left channel only. This is not a clip
83 // property that is saved to disk, and else we'll get two callbacks for the
84 // same event.
85 return mChannels[0u]->SubscribeToPitchAndSpeedPresetChange(std::move(cb));
86}

References mChannels.

◆ TimeToSamples()

sampleCount WideClip::TimeToSamples ( double  time) const
overridevirtual

Implements ClipTimes.

Definition at line 50 of file WideClip.cpp.

51{
52 return mChannels[0u]->TimeToSamples(time);
53}

References mChannels.

Member Data Documentation

◆ mChannels

const std::array<std::shared_ptr<ClipInterface>, 2> WideClip::mChannels
private

The documentation for this class was generated from the following files: