EHS
BaseAudioDevice.h
Go to the documentation of this file.
1#pragma once
2
3#include "ehs/EHS.h"
4#include "ehs/Str.h"
5#include "ehs/Vector.h"
6#include "ehs/Array.h"
7#include "ehs/DataType.h"
8
9namespace ehs
10{
11 enum class AudioDeviceType
12 {
13 INPUT = 0x1,
14 OUTPUT = 0x0,
15 ALL = 0x2
16 };
17
19 {
20 ACTIVE = 0x1,
21 DISABLED = 0x2,
22 NOT_PRESENT = 0x4,
23 UNPLUGGED = 0x8
24 };
25
26 class EHS_LIB_IO BaseAudioDevice
27 {
28 protected:
36 UInt_64 maxFrames;
37
38 public:
39 virtual ~BaseAudioDevice() = default;
40
42
43 BaseAudioDevice(const BaseAudioDevice& device);
44
45 BaseAudioDevice& operator=(const BaseAudioDevice& device);
46
47 virtual void OpenStream();
48
49 virtual void CloseStream();
50
51 virtual UInt_64 SendStream(const void *data, UInt_64 size);
52
53 virtual UInt_64 ReceiveStream(void *data, UInt_64 size);
54
55 void BridgeStreams(BaseAudioDevice *input, UInt_64 frameBufferSize);
56
57 void BridgeStreams(UInt_64 frameBufferSize);
58
59 AudioDeviceType GetType() const;
60
61 void SetDataType(DataType newDataType);
62
63 DataType GetDataType() const;
64
65 UInt_8 GetByteDepth() const;
66
67 UInt_16 GetBitDepth() const;
68
69 void SetSampleRate(UInt_32 newSampleRate);
70
71 UInt_32 GetSampleRate() const;
72
73 void SetChannels(UInt_32 newChannels);
74
75 UInt_16 GetChannels() const;
76
77 UInt_32 GetFrameSize() const;
78
79 void SetPeriod(UInt_32 newPeriod);
80
81 UInt_32 GetPeriod() const;
82
83 void SetLatency(UInt_32 newLatency);
84
85 UInt_32 GetLatency() const;
86
87 UInt_64 GetMaxFrames() const;
88
89 virtual bool IsStreaming() const;
90
91 virtual bool IsValid() const;
92
96 static BaseAudioDevice GetDefault(AudioDeviceType type);
97
103 };
104}
Definition: Array.h:16
Definition: BaseAudioDevice.h:27
UInt_32 channels
Definition: BaseAudioDevice.h:33
UInt_32 period
Definition: BaseAudioDevice.h:34
UInt_16 byteDepth
Definition: BaseAudioDevice.h:31
UInt_32 sampleRate
Definition: BaseAudioDevice.h:32
DataType dataType
Definition: BaseAudioDevice.h:30
UInt_64 maxFrames
Definition: BaseAudioDevice.h:36
UInt_32 latency
Definition: BaseAudioDevice.h:35
virtual ~BaseAudioDevice()=default
AudioDeviceType type
Definition: BaseAudioDevice.h:29
Definition: Anchor.h:6
AudioDeviceState
Definition: BaseAudioDevice.h:19
AudioDeviceType
Definition: BaseAudioDevice.h:12
unsigned int UInt_32
Definition: Types.h:49
unsigned char UInt_8
Definition: Types.h:43
DataType
Definition: DataType.h:8
unsigned short UInt_16
Definition: Types.h:46