28#include <condition_variable>
31struct SpeexEchoState_;
41#define AAUDIO_API_STR "aaudio"
42#define PULSEAUDIO_API_STR "pulseaudio"
43#define ALSA_API_STR "alsa"
44#define JACK_API_STR "jack"
45#define COREAUDIO_API_STR "coreaudio"
46#define PORTAUDIO_API_STR "portaudio"
48#define PCM_DEFAULT "default"
49#define PCM_DSNOOP "plug:dsnoop"
50#define PCM_DMIX_DSNOOP "dmix/dsnoop"
111 template<
class Rep,
class Period>
304 std::mutex audioProcessorMutex {};
305 std::unique_ptr<AudioProcessor> audioProcessor;
307 void createAudioProcessor();
308 void destroyAudioProcessor();
313 std::atomic_bool playIncomingCallBeep_ {
false};
317 std::chrono::system_clock::time_point lastNotificationTime_ {std::chrono::system_clock::time_point::min()};
bool isCaptureMuted_
True if capture is not to be used.
void mutePlayback(bool muted)
Mute playback.
std::shared_ptr< RingBuffer > mainRingBuffer_
Buffers for audio processing.
std::mutex mutex_
Lock for the entire audio layer.
std::unique_ptr< Resampler > resampler_
Manage sampling rate conversion.
virtual int getIndexRingtone() const =0
bool isRingtoneMuted() const
virtual int getIndexCapture() const =0
virtual void updatePreference(AudioPreference &pref, int index, AudioDeviceType type)=0
double getPlaybackGain() const
Get playback stream gain (speaker)
std::atomic< Status > status_
Whether or not the audio layer's playback stream is started.
std::shared_ptr< AudioFrame > getPlayback(AudioFormat format, size_t samples)
virtual std::vector< std::string > getPlaybackDeviceList() const =0
RingBuffer urgentRingBuffer_
Urgent ring buffer used for ringtones.
bool waitForStart(const std::chrono::duration< Rep, Period > &rel_time) const
void playbackChanged(bool started)
virtual void stopCaptureStream(const std::string &id)
Stop an ongoing capture stream on the given device.
void notifyIncomingCall()
Emit an audio notification (beep) on incoming calls.
virtual int getIndexPlayback() const =0
double getCaptureGain() const
Get capture stream gain (microphone)
void muteRingtone(bool muted)
void setHasNativeNS(bool hasNS)
bool isPlaybackMuted_
True if playback is not to be used.
virtual int getAudioDeviceIndex(const std::string &name, AudioDeviceType type) const =0
void hardwareFormatAvailable(AudioFormat playback, size_t bufSize=0)
Callback to be called by derived classes when the audio output is opened.
std::shared_ptr< AudioFrame > getToRing(AudioFormat format, size_t writableSamples)
bool isCaptureMuted() const
virtual void startCaptureStream(const std::string &id)
Start a capture stream on the given device (eg.
void flushUrgent()
Flush urgent buffer.
void hardwareInputFormatAvailable(AudioFormat capture)
Set the input format on necessary objects.
virtual void startStream(AudioDeviceType stream)=0
Start the capture stream and prepare the playback stream.
std::unique_ptr< AudioFrameResizer > playbackQueue_
void muteCapture(bool muted)
Mute capture (microphone)
double captureGain_
Gain applied to mic signal.
void playIncomingCallNotification(bool play)
Start/Stop playing the incoming call notification sound (beep) while playing back audio (typically du...
void setHasNativeAEC(bool hasEAC)
std::shared_ptr< AudioFrame > getToPlay(AudioFormat format, size_t writableSamples)
bool isPlaybackMuted() const
virtual std::string getAudioDeviceName(int index, AudioDeviceType type) const =0
virtual void stopStream(AudioDeviceType stream=AudioDeviceType::ALL)=0
Stop the playback and capture streams.
double playbackGain_
Gain applied to playback signal.
bool isRingtoneMuted_
True if ringtone should be muted.
void recordChanged(bool started)
AudioFormat audioFormat_
Sample Rate that should be sent to the sound card.
bool isStarted() const
Determine whether or not the audio layer is active (i.e.
void flushMain()
Flush main buffer.
unsigned int getSampleRate() const
Get the sample rate of the audio layer.
const AudioPreference & pref_
AudioFormat audioInputFormat_
Sample Rate for input.
std::condition_variable startedCv_
virtual std::vector< std::string > getCaptureDeviceList() const =0
void setCaptureGain(double gain)
Set capture stream gain (microphone) Range should be [-1.0, 1.0].
void putRecorded(std::shared_ptr< AudioFrame > &&frame)
void setPlaybackGain(double gain)
Set playback stream gain (speaker) Range should be [-1.0, 1.0].
AudioFormat getFormat() const
Get the audio format of the layer (sample rate & channel number).
void putUrgent(std::shared_ptr< AudioFrame > buffer)
Send a chunk of data to the hardware buffer to start the playback Copy data in the urgent buffer.
A ring buffer for mutichannel audio samples.
void emitSignal(Args... args)
Simple macro to hide class' copy constructor and assignment operator.
#define NON_COPYABLE(ClassName)
struct SpeexEchoState_ SpeexEchoState