Audacity 3.2.0
Classes | Public Member Functions | Protected Member Functions | List of all members
Channel Class Referenceabstract

#include <Channel.h>

Inheritance diagram for Channel:
[legend]

Classes

class  IntervalIterator
 

Public Member Functions

virtual ~Channel ()
 
ChannelGroupGetChannelGroup ()
 Channel object's lifetime is assumed to be nested in its Track's. More...
 
const ChannelGroupGetChannelGroup () const
 Channel object's lifetime is assumed to be nested in its Track's. More...
 
size_t GetChannelIndex () const
 

Protected Member Functions

virtual ChannelGroupDoGetChannelGroup () const =0
 Subclass must override. More...
 

Acesss to intervals

using Interval = ChannelInterval
 
size_t NIntervals () const
 Report the number of intervals. More...
 
template<typename IntervalType = Interval>
std::shared_ptr< IntervalType > GetInterval (size_t iInterval)
 Retrieve an interval, cast to the given type. More...
 
template<typename IntervalType = const Interval>
auto GetInterval (size_t iInterval) const -> std::enable_if_t< std::is_const_v< IntervalType >, std::shared_ptr< IntervalType > >
 
template<typename IntervalType = Interval>
IteratorRange< IntervalIterator< IntervalType > > Intervals ()
 Get range of intervals with mutative access. More...
 
template<typename IntervalType = const Interval>
auto Intervals () const -> std::enable_if_t< std::is_const_v< IntervalType >, IteratorRange< IntervalIterator< IntervalType > > >
 Get range of intervals with read-only access. More...
 

Detailed Description

Definition at line 158 of file Channel.h.

Member Typedef Documentation

◆ Interval

Definition at line 180 of file Channel.h.

Constructor & Destructor Documentation

◆ ~Channel()

Channel::~Channel ( )
virtualdefault

Member Function Documentation

◆ DoGetChannelGroup()

virtual ChannelGroup & Channel::DoGetChannelGroup ( ) const
protectedpure virtual

Subclass must override.

Postcondition
result: for some ii less than result.NChannels(), this == result.GetChannel(ii).get()

Implemented in UniqueChannelTrack< Base >, UniqueChannelTrack< PlayableTrack >, and WaveChannel.

Referenced by GetChannelGroup(), GetChannelIndex(), and GetInterval().

Here is the caller graph for this function:

◆ GetChannelGroup() [1/2]

ChannelGroup & Channel::GetChannelGroup ( )

Channel object's lifetime is assumed to be nested in its Track's.

Definition at line 43 of file Channel.cpp.

44{
45 return DoGetChannelGroup();
46}
virtual ChannelGroup & DoGetChannelGroup() const =0
Subclass must override.

References DoGetChannelGroup().

Referenced by WaveformView::DoDraw(), TrackArt::DrawBackgroundWithSelection(), CommonTrackInfo::DrawCloseButton(), ChannelView::Find(), SelectHandle::FindTrack(), TrackPanelResizerCell::Get(), ChannelView::Get(), anonymous_namespace{TrackPanel.cpp}::GetTrack(), TrackPanelResizeHandle::GetTrack(), NIntervals(), PendingTracks::SubstituteOriginalChannel(), and PendingTracks::SubstitutePendingChangedChannel().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetChannelGroup() [2/2]

const ChannelGroup & Channel::GetChannelGroup ( ) const

Channel object's lifetime is assumed to be nested in its Track's.

Definition at line 38 of file Channel.cpp.

39{
40 return DoGetChannelGroup();
41}

References DoGetChannelGroup().

Here is the call graph for this function:

◆ GetChannelIndex()

size_t Channel::GetChannelIndex ( ) const
Returns
ii such that this == GetChannelGroup().GetChannel(ii).get()

Definition at line 25 of file Channel.cpp.

26{
27 auto &group = DoGetChannelGroup();
28 int index = -1;
29 for (size_t ii = 0, nn = group.NChannels(); ii < nn; ++ii)
30 if (group.GetChannel(ii).get() == this) {
31 index = ii;
32 break;
33 }
34 assert(index >= 0);
35 return index;
36}

References DoGetChannelGroup().

Referenced by WaveChannel::Append(), WaveChannel::AppendBuffer(), WaveChannel::DoGet(), ChannelView::Find(), TrackPanelResizerCell::Get(), ChannelView::Get(), WaveChannel::GetChannelType(), GetInterval(), CommonChannelView::GetMinimizedHeight(), PendingTracks::SubstituteOriginalChannel(), and PendingTracks::SubstitutePendingChangedChannel().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetInterval() [1/2]

template<typename IntervalType >
std::shared_ptr< IntervalType > Channel::GetInterval ( size_t  iInterval)

Retrieve an interval, cast to the given type.

Postcondition
if IntervalType is default, then: result: !(iInterval < NIntervals()) || result

Definition at line 546 of file Channel.h.

547{
548 return DoGetChannelGroup().GetInterval(iInterval)
549 ->template GetChannel<IntervalType>(GetChannelIndex());
550}
std::shared_ptr< IntervalType > GetInterval(size_t iInterval)
Retrieve an interval, cast to the given type.
Definition: Channel.h:430
size_t GetChannelIndex() const
Definition: Channel.cpp:25

References DoGetChannelGroup(), GetChannelIndex(), and ChannelGroup::GetInterval().

Here is the call graph for this function:

◆ GetInterval() [2/2]

template<typename IntervalType >
auto Channel::GetInterval ( size_t  iInterval) const -> std::enable_if_t<std::is_const_v<IntervalType>, std::shared_ptr<IntervalType>>
Postcondition
if IntervalType is default, then: result: !(iInterval < NIntervals()) || result

Definition at line 553 of file Channel.h.

556{
557 return DoGetChannelGroup().GetInterval(iInterval)
558 ->template GetChannel<IntervalType>(GetChannelIndex());
559}

◆ Intervals() [1/2]

template<typename IntervalType = Interval>
IteratorRange< IntervalIterator< IntervalType > > Channel::Intervals ( )
inline

Get range of intervals with mutative access.

Definition at line 248 of file Channel.h.

249 {
250 return { { this, 0 }, { this, NIntervals() } };
251 }
size_t NIntervals() const
Report the number of intervals.
Definition: Channel.h:540

Referenced by RepeatBase::Process().

Here is the caller graph for this function:

◆ Intervals() [2/2]

template<typename IntervalType = const Interval>
auto Channel::Intervals ( ) const -> std::enable_if_t<std::is_const_v<IntervalType>, IteratorRange<IntervalIterator<IntervalType>> >
inline

Get range of intervals with read-only access.

Definition at line 255 of file Channel.h.

259 {
260 return { { this, 0 }, { this, NIntervals() } };
261 }

◆ NIntervals()

size_t Channel::NIntervals ( ) const
inline

Report the number of intervals.

Definition at line 540 of file Channel.h.

541{
542 return GetChannelGroup().NIntervals();
543}
virtual size_t NIntervals() const =0
Report the number of intervals.
ChannelGroup & GetChannelGroup()
Channel object's lifetime is assumed to be nested in its Track's.
Definition: Channel.cpp:43

References GetChannelGroup(), and ChannelGroup::NIntervals().

Here is the call graph for this function:

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