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;
171 void closeCaptureStream();
172 void stopCaptureStream();
173 void startCaptureStream();
174 void prepareCaptureStream();
176 void closePlaybackStream();
177 void stopPlaybackStream();
178 void startPlaybackStream();
179 void closeRingtoneStream();
201 std::unique_ptr<AudioFrame> read(
unsigned frames);
226 std::string audioPlugin_;
228 bool is_capture_prepared_ {
false};
229 bool is_playback_running_ {
false};
230 bool is_capture_running_ {
false};
231 bool is_playback_open_ {
false};
232 bool is_capture_open_ {
false};
234 std::atomic_bool running_ {
false};
235 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 stopStream(AudioDeviceType stream=AudioDeviceType::ALL)
Stop the playback and capture streams.
virtual void startStream(AudioDeviceType stream)
Start the capture stream and prepare the playback stream.
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)