22#include <alsa/asoundlib.h>
27#define PCM_DMIX "plug:dmix"
30#define ALSA_CAPTURE_DEVICE 0x0001
31#define ALSA_PLAYBACK_DEVICE 0x0010
141 std::vector<HwIDPair> getAudioDeviceIndexMap(
bool getCapture)
const;
149 const std::string&
dev,
174 void closeCaptureStream();
175 void stopCaptureStream();
176 void startCaptureStream();
177 void prepareCaptureStream();
179 void closePlaybackStream();
180 void stopPlaybackStream();
181 void startPlaybackStream();
182 void closeRingtoneStream();
204 std::unique_ptr<AudioFrame> read(
unsigned frames);
229 std::string audioPlugin_;
231 bool is_capture_prepared_ {
false};
232 bool is_playback_running_ {
false};
233 bool is_capture_running_ {
false};
234 bool is_playback_open_ {
false};
235 bool is_capture_open_ {
false};
237 std::atomic_bool running_ {
false};
238 std::thread audioThread_;
virtual int getIndexPlayback() const
Get the index of the audio card for playback.
virtual int getIndexCapture() const
Get the index of the audio card for capture.
std::string getAudioDeviceName(int index, AudioDeviceType type) const
std::string buildDeviceTopo(const std::string &plugin, int card)
Concatenate two strings.
int getAudioDeviceIndex(const std::string &description, AudioDeviceType type) const
An index is associated with its string description.
virtual std::vector< std::string > getCaptureDeviceList() const
Scan the sound card available on the system.
virtual std::vector< std::string > getPlaybackDeviceList() const
virtual int getIndexRingtone() const
Get the index of the audio card for ringtone (could be differnet from playback)
void run()
Reimplementation of run()
static bool soundCardIndexExists(int card, AudioDeviceType stream)
Check if the given index corresponds to an existing sound card and supports the specified streaming m...
virtual void startStream(AudioDeviceType stream=AudioDeviceType::ALL)
Start the capture stream and prepare the playback stream.
virtual void stopStream(AudioDeviceType stream=AudioDeviceType::ALL)
Stop the playback and capture streams.
void emitSignal(Args... args)
std::pair< int, std::string > HwIDPair
Associate a sound card index to its string description.
Simple macro to hide class' copy constructor and assignment operator.
#define NON_COPYABLE(ClassName)