22#include <AudioToolbox/AudioToolbox.h>
24#define checkErr(err) \
26 OSStatus error = static_cast<OSStatus>(err); \
27 fprintf(stdout, "CoreAudio Error: %ld -> %s: %d\n", (long) error, __FILE__, __LINE__); \
41class CoreLayer :
public AudioLayer
100 void initAudioFormat();
156 UInt32 inChannelsPerFrame_;
158 UInt32 outChannelsPerFrame_;
160 std::vector<AudioDevice> getDeviceList(
bool getCapture)
const;
virtual int getAudioDeviceIndex(const std::string &name, AudioDeviceType type) const
void initAudioLayerIO(AudioDeviceType stream)
Configure the AudioUnit.
virtual std::vector< std::string > getCaptureDeviceList() const
Scan the sound card available on the system.
virtual std::vector< std::string > getPlaybackDeviceList() const
virtual int getIndexCapture() const
Get the index of the audio card for capture.
virtual std::string getAudioDeviceName(int index, AudioDeviceType type) const
virtual void stopStream(AudioDeviceType stream=AudioDeviceType::ALL)
Stop the playback and capture streams.
virtual int getIndexPlayback() const
Get the index of the audio card for playback.
virtual void startStream(AudioDeviceType stream=AudioDeviceType::ALL)
Start the capture stream and prepare the playback stream.
virtual int getIndexRingtone() const
Get the index of the audio card for ringtone (could be differnet from playback)
CoreLayer(const AudioPreference &pref)
void emitSignal(Args... args)
#define NON_COPYABLE(ClassName)