Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
Loading...
Searching...
No Matches
Interface - kodi::audioengine

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

Topics

 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.
 

Functions

bool ATTR_DLL_LOCAL kodi::audioengine::GetCurrentSinkFormat (AudioEngineFormat &format)
 Get the current sink data format.
 

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:

...
kodi::audioengine::AudioEngineFormat format;
return false;
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);
const char unsigned int int int int int64_t int enum AudioEngineDataFormat * format
Definition addons/kodi-dev-kit/include/kodi/c-api/addon-instance/AudioDecoder.h:113
Definition kodi-dev-kit/include/kodi/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 ATTR_DLL_LOCAL GetCurrentSinkFormat(AudioEngineFormat &format)
Get the current sink data format.
Definition kodi-dev-kit/include/kodi/AudioEngine.h:606

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

Function Documentation

◆ GetCurrentSinkFormat()

bool ATTR_DLL_LOCAL 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:

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