Kodi Development  20.0
for Binary and Script based Add-Ons
Interface - kodi::audioengine

Detailed Description

Audio engine functions
This interface contains auxiliary functions and classes which allow an addon to play their own individual audio stream in Kodi.

Using kodi::audioengine::CAEStream, a class can be created in this regard, about which the necessary stream data and information are given to Kodi.

Via kodi::audioengine::GetCurrentSinkFormat(), the audio formats currently processed in Kodi can be called up beforehand in order to adapt your own stream to them.

However, the created stream can also differ from this because Kodi changes it to suit it.


Example:

#include <kodi/AudioEngine.h>
...
kodi::audioengine::AudioEngineFormat format;
return false;
format.SetDataFormat(AUDIOENGINE_FMT_FLOATP);
format.SetChannelLayout(std::vector<AudioEngineChannel>(AUDIOENGINE_CH_FL, AUDIOENGINE_CH_FR));
unsigned int myUsedSampleRate = format.GetSampleRate();
...
kodi::audioengine::CAEStream* stream = new kodi::audioengine::CAEStream(format, AUDIO_STREAM_AUTOSTART);
Definition: AudioEngine.h:258
@ AUDIOENGINE_CH_FR
Front right.
Definition: audio_engine.h:78
@ AUDIOENGINE_CH_FL
Front left.
Definition: audio_engine.h:76
@ AUDIOENGINE_FMT_FLOATP
Definition: audio_engine.h:217
@ AUDIO_STREAM_AUTOSTART
autostart the stream when enough data is buffered
Definition: audio_engine.h:48
bool ATTRIBUTE_HIDDEN GetCurrentSinkFormat(AudioEngineFormat &format)
Get the current sink data format.
Definition: AudioEngine.h:606

It has the header #include <kodi/AudioEngine.h> be included to enjoy it.

Modules

 Definitions, structures and enumerators
 Library definition values
All audio engine functions associated data structures.
 
 class CAEStream
 Audio Engine Stream Class
Class that can be created by the addon in order to be able to transfer audiostream data processed on the addon to Kodi and output it audibly.
 

Function Documentation

◆ GetCurrentSinkFormat()

bool ATTRIBUTE_HIDDEN kodi::audioengine::GetCurrentSinkFormat ( AudioEngineFormat format)
inline

Get the current sink data format.

Parameters
[in]formatCurrent sink data format. For more details see AudioEngineFormat.
Returns
Returns true on success, else false.

Example:

#include <kodi/AudioEngine.h>
...
kodi::audioengine::AudioEngineFormat format;
return false;
std::vector<AudioEngineChannel> layout = format.GetChannelLayout();
...
return true;