Audacity 3.2.0
AudioGraphChannel.h
Go to the documentation of this file.
1/**********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 @file AudioGraphChannel.h
6
7 @brief Abstraction of a channel of a wide stream that knows whether it is mono,
8 left, or right
9
10 Paul Licameli
11
12 **********************************************************************/
13#ifndef __AUDACITY_AUDIO_GRAPH_CHANNEL__
14#define __AUDACITY_AUDIO_GRAPH_CHANNEL__
15
16namespace AudioGraph {
18enum ChannelType : unsigned
19{
23};
24
25struct AUDIO_GRAPH_API Channel {
26 virtual ~Channel();
28 virtual ChannelType GetChannelType() const = 0;
29};
30
32inline bool IsMono(const Channel &channel) {
33 return channel.GetChannelType() == MonoChannel;
34}
35
37inline bool PlaysLeft(const Channel &channel) {
38 const auto type = channel.GetChannelType();
39 return type == MonoChannel || type == LeftChannel;
40}
42inline bool PlaysRight(const Channel &channel) {
43 const auto type = channel.GetChannelType();
44 return type == MonoChannel || type == RightChannel;
45}
46
47}
48
49#endif
ChannelType
Mutually exclusive channel classifications.
bool PlaysRight(const Channel &channel)
Whether the channel may play through a right speaker.
bool IsMono(const Channel &channel)
Whether the channel is mono.
bool PlaysLeft(const Channel &channel)
Whether the channel may play through a left speaker.
virtual ChannelType GetChannelType() const =0
Classify this channel.