Ring Daemon 16.0.0
Loading...
Searching...
No Matches
jami::CoreLayer Class Reference

#include <corelayer.h>

Inheritance diagram for jami::CoreLayer:
Inheritance graph
Collaboration diagram for jami::CoreLayer:
Collaboration graph

Public Member Functions

void bindCallbacks ()
 
 CoreLayer (const AudioPreference &pref)
 
 CoreLayer (const AudioPreference &pref)
 
void destroyAudioLayer ()
 
void destroyAudioLayer ()
 
virtual int getAudioDeviceIndex (const std::string &name, AudioDeviceType type) const
 
virtual int getAudioDeviceIndex (const std::string &name, AudioDeviceType type) const
 
virtual std::string getAudioDeviceName (int index, AudioDeviceType type) const
 
virtual std::string getAudioDeviceName (int index, AudioDeviceType type) const
 
virtual std::vector< std::string > getCaptureDeviceList () const
 Scan the sound card available on the system.
 
virtual std::vector< std::string > getCaptureDeviceList () const
 Scan the sound card available on the system.
 
virtual int getIndexCapture () const
 Get the index of the audio card for capture.
 
virtual int getIndexCapture () const
 Get the index of the audio card for capture.
 
virtual int getIndexPlayback () const
 Get the index of the audio card for playback.
 
virtual int getIndexPlayback () const
 Get the index of the audio card for playback.
 
virtual int getIndexRingtone () const
 Get the index of the audio card for ringtone (could be differnet from playback)
 
virtual int getIndexRingtone () const
 Get the index of the audio card for ringtone (could be differnet from playback)
 
virtual std::vector< std::string > getPlaybackDeviceList () const
 
virtual std::vector< std::string > getPlaybackDeviceList () const
 
bool initAudioLayerIO (AudioDeviceType stream)
 Configure the AudioUnit.
 
void initAudioLayerIO (AudioDeviceType stream)
 Configure the AudioUnit.
 
int initAudioStreams (AudioUnit *audioUnit)
 
void setupInputBus ()
 
void setupOutputBus ()
 
virtual void startStream (AudioDeviceType stream=AudioDeviceType::ALL)
 Start the capture stream and prepare the playback stream.
 
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.
 
virtual void stopStream (AudioDeviceType stream=AudioDeviceType::ALL)
 Stop the playback and capture streams.
 
 ~CoreLayer ()
 
 ~CoreLayer ()
 
- Public Member Functions inherited from jami::AudioLayer
 AudioLayer (const AudioPreference &)
 
void flushMain ()
 Flush main buffer.
 
void flushUrgent ()
 Flush urgent buffer.
 
double getCaptureGain () const
 Get capture stream gain (microphone)
 
AudioFormat getFormat () const
 Get the audio format of the layer (sample rate & channel number).
 
double getPlaybackGain () const
 Get playback stream gain (speaker)
 
unsigned int getSampleRate () const
 Get the sample rate of the audio layer.
 
bool isCaptureMuted () const
 
bool isPlaybackMuted () const
 
bool isRingtoneMuted () const
 
bool isStarted () const
 Determine whether or not the audio layer is active (i.e.
 
void muteCapture (bool muted)
 Mute capture (microphone)
 
void mutePlayback (bool muted)
 Mute playback.
 
void muteRingtone (bool muted)
 
void notifyIncomingCall ()
 Emit an audio notification (beep) on incoming calls.
 
void playIncomingCallNotification (bool play)
 Start/Stop playing the incoming call notification sound (beep) while playing back audio (typically during an ongoing call).
 
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.
 
void setCaptureGain (double gain)
 Set capture stream gain (microphone) Range should be [-1.0, 1.0].
 
void setPlaybackGain (double gain)
 Set playback stream gain (speaker) Range should be [-1.0, 1.0].
 
template<class Rep , class Period >
bool waitForStart (const std::chrono::duration< Rep, Period > &rel_time) const
 
virtual ~AudioLayer ()
 

Additional Inherited Members

- Protected Types inherited from jami::AudioLayer
enum class  Status { Idle , Starting , Started }
 
- Protected Member Functions inherited from jami::AudioLayer
void devicesChanged ()
 
void flush ()
 
std::shared_ptr< AudioFramegetPlayback (AudioFormat format, size_t samples)
 
std::shared_ptr< AudioFramegetToPlay (AudioFormat format, size_t writableSamples)
 
std::shared_ptr< AudioFramegetToRing (AudioFormat format, size_t writableSamples)
 
void hardwareFormatAvailable (AudioFormat playback, size_t bufSize=0)
 Callback to be called by derived classes when the audio output is opened.
 
void hardwareInputFormatAvailable (AudioFormat capture)
 Set the input format on necessary objects.
 
void playbackChanged (bool started)
 
void putRecorded (std::shared_ptr< AudioFrame > &&frame)
 
void recordChanged (bool started)
 
void setHasNativeAEC (bool hasEAC)
 
void setHasNativeNS (bool hasNS)
 
- Protected Attributes inherited from jami::AudioLayer
AudioFormat audioFormat_
 Sample Rate that should be sent to the sound card.
 
AudioFormat audioInputFormat_
 Sample Rate for input.
 
double captureGain_
 Gain applied to mic signal.
 
bool hasNativeAEC_ {true}
 
bool hasNativeNS_ {false}
 
bool isCaptureMuted_
 True if capture is not to be used.
 
bool isPlaybackMuted_
 True if playback is not to be used.
 
bool isRingtoneMuted_ {false}
 True if ringtone should be muted.
 
std::shared_ptr< RingBuffermainRingBuffer_
 Buffers for audio processing.
 
std::mutex mutex_ {}
 Lock for the entire audio layer.
 
size_t nativeFrameSize_ {0}
 
double playbackGain_
 Gain applied to playback signal.
 
std::unique_ptr< AudioFrameResizerplaybackQueue_
 
bool playbackStarted_ {false}
 
const AudioPreferencepref_
 
bool recordStarted_ {false}
 
std::unique_ptr< Resamplerresampler_
 Manage sampling rate conversion.
 
std::condition_variable startedCv_
 
std::atomic< Statusstatus_ {Status::Idle}
 Whether or not the audio layer's playback stream is started.
 
RingBuffer urgentRingBuffer_
 Urgent ring buffer used for ringtones.
 

Detailed Description

Definition at line 38 of file ios/corelayer.h.

Constructor & Destructor Documentation

◆ CoreLayer() [1/2]

jami::CoreLayer::CoreLayer ( const AudioPreference pref)

◆ ~CoreLayer() [1/2]

jami::CoreLayer::~CoreLayer ( )

◆ CoreLayer() [2/2]

jami::CoreLayer::CoreLayer ( const AudioPreference pref)

◆ ~CoreLayer() [2/2]

jami::CoreLayer::~CoreLayer ( )

Member Function Documentation

◆ bindCallbacks()

void jami::CoreLayer::bindCallbacks ( )

◆ destroyAudioLayer() [1/2]

void jami::CoreLayer::destroyAudioLayer ( )

◆ destroyAudioLayer() [2/2]

void jami::CoreLayer::destroyAudioLayer ( )

◆ getAudioDeviceIndex() [1/2]

virtual int jami::CoreLayer::getAudioDeviceIndex ( const std::string &  name,
AudioDeviceType  type 
) const
virtual

Implements jami::AudioLayer.

◆ getAudioDeviceIndex() [2/2]

virtual int jami::CoreLayer::getAudioDeviceIndex ( const std::string &  name,
AudioDeviceType  type 
) const
virtual

Implements jami::AudioLayer.

◆ getAudioDeviceName() [1/2]

virtual std::string jami::CoreLayer::getAudioDeviceName ( int  index,
AudioDeviceType  type 
) const
virtual

Implements jami::AudioLayer.

◆ getAudioDeviceName() [2/2]

virtual std::string jami::CoreLayer::getAudioDeviceName ( int  index,
AudioDeviceType  type 
) const
virtual

Implements jami::AudioLayer.

◆ getCaptureDeviceList() [1/2]

virtual std::vector< std::string > jami::CoreLayer::getCaptureDeviceList ( ) const
virtual

Scan the sound card available on the system.

Returns
std::vector<std::string> The vector containing the string description of the card

Implements jami::AudioLayer.

◆ getCaptureDeviceList() [2/2]

virtual std::vector< std::string > jami::CoreLayer::getCaptureDeviceList ( ) const
virtual

Scan the sound card available on the system.

Returns
std::vector<std::string> The vector containing the string description of the card

Implements jami::AudioLayer.

◆ getIndexCapture() [1/2]

virtual int jami::CoreLayer::getIndexCapture ( ) const
inlinevirtual

Get the index of the audio card for capture.

Returns
int The index of the card used for capture

Implements jami::AudioLayer.

Definition at line 58 of file ios/corelayer.h.

◆ getIndexCapture() [2/2]

virtual int jami::CoreLayer::getIndexCapture ( ) const
inlinevirtual

Get the index of the audio card for capture.

Returns
int The index of the card used for capture

Implements jami::AudioLayer.

Definition at line 61 of file osx/corelayer.h.

◆ getIndexPlayback() [1/2]

virtual int jami::CoreLayer::getIndexPlayback ( ) const
inlinevirtual

Get the index of the audio card for playback.

Returns
int The index of the card used for playback

Implements jami::AudioLayer.

Definition at line 64 of file ios/corelayer.h.

◆ getIndexPlayback() [2/2]

virtual int jami::CoreLayer::getIndexPlayback ( ) const
inlinevirtual

Get the index of the audio card for playback.

Returns
int The index of the card used for playback

Implements jami::AudioLayer.

Definition at line 67 of file osx/corelayer.h.

◆ getIndexRingtone() [1/2]

virtual int jami::CoreLayer::getIndexRingtone ( ) const
inlinevirtual

Get the index of the audio card for ringtone (could be differnet from playback)

Returns
int The index of the card used for ringtone

Implements jami::AudioLayer.

Definition at line 70 of file ios/corelayer.h.

◆ getIndexRingtone() [2/2]

virtual int jami::CoreLayer::getIndexRingtone ( ) const
inlinevirtual

Get the index of the audio card for ringtone (could be differnet from playback)

Returns
int The index of the card used for ringtone

Implements jami::AudioLayer.

Definition at line 73 of file osx/corelayer.h.

◆ getPlaybackDeviceList() [1/2]

virtual std::vector< std::string > jami::CoreLayer::getPlaybackDeviceList ( ) const
virtual

Implements jami::AudioLayer.

◆ getPlaybackDeviceList() [2/2]

virtual std::vector< std::string > jami::CoreLayer::getPlaybackDeviceList ( ) const
virtual

Implements jami::AudioLayer.

◆ initAudioLayerIO() [1/2]

bool jami::CoreLayer::initAudioLayerIO ( AudioDeviceType  stream)

Configure the AudioUnit.

◆ initAudioLayerIO() [2/2]

void jami::CoreLayer::initAudioLayerIO ( AudioDeviceType  stream)

Configure the AudioUnit.

◆ initAudioStreams()

int jami::CoreLayer::initAudioStreams ( AudioUnit audioUnit)

◆ setupInputBus()

void jami::CoreLayer::setupInputBus ( )

◆ setupOutputBus()

void jami::CoreLayer::setupOutputBus ( )

◆ startStream() [1/2]

virtual void jami::CoreLayer::startStream ( AudioDeviceType  stream = AudioDeviceType::ALL)
virtual

Start the capture stream and prepare the playback stream.

The playback starts accordingly to its threshold CoreAudio Library API

Implements jami::AudioLayer.

◆ startStream() [2/2]

virtual void jami::CoreLayer::startStream ( AudioDeviceType  stream = AudioDeviceType::ALL)
virtual

Start the capture stream and prepare the playback stream.

The playback starts accordingly to its threshold CoreAudio Library API

Implements jami::AudioLayer.

◆ stopStream() [1/2]

virtual void jami::CoreLayer::stopStream ( AudioDeviceType  stream = AudioDeviceType::ALL)
virtual

Stop the playback and capture streams.

Drops the pending frames and put the capture and playback handles to PREPARED state CoreAudio Library API

Implements jami::AudioLayer.

◆ stopStream() [2/2]

virtual void jami::CoreLayer::stopStream ( AudioDeviceType  stream = AudioDeviceType::ALL)
virtual

Stop the playback and capture streams.

Drops the pending frames and put the capture and playback handles to PREPARED state CoreAudio Library API

Implements jami::AudioLayer.


The documentation for this class was generated from the following files: