28#include <condition_variable>
32struct SpeexEchoState_;
42#define OPENSL_API_STR "opensl"
43#define PULSEAUDIO_API_STR "pulseaudio"
44#define ALSA_API_STR "alsa"
45#define JACK_API_STR "jack"
46#define COREAUDIO_API_STR "coreaudio"
47#define PORTAUDIO_API_STR "portaudio"
49#define PCM_DEFAULT "default"
50#define PCM_DSNOOP "plug:dsnoop"
51#define PCM_DMIX_DSNOOP "dmix/dsnoop"
98 template<
class Rep,
class Period>
291 std::mutex audioProcessorMutex {};
292 std::unique_ptr<AudioProcessor> audioProcessor;
294 void createAudioProcessor();
295 void destroyAudioProcessor();
300 std::atomic_bool playIncomingCallBeep_ {
false};
304 std::chrono::system_clock::time_point lastNotificationTime_ {
305 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)
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)
virtual void startStream(AudioDeviceType stream=AudioDeviceType::ALL)=0
Start the capture stream and prepare the playback stream.
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
void flushUrgent()
Flush urgent buffer.
void hardwareInputFormatAvailable(AudioFormat capture)
Set the input format on necessary objects.
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