kodi
Classes | Public Member Functions | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Friends | List of all members
ActiveAE::CActiveAE Class Reference
Inheritance diagram for ActiveAE::CActiveAE:
Inheritance graph
[legend]
Collaboration diagram for ActiveAE::CActiveAE:
Collaboration graph
[legend]

Classes

struct  SoundState
 

Public Member Functions

void Start () override
 Initializes the AudioEngine, called by CFactory when it is time to initialize the audio engine. More...
 
void Shutdown () override
 Called when the application needs to terminate the engine.
 
bool Suspend () override
 Suspends output and de-initializes sink. More...
 
bool Resume () override
 Resumes output and re-initializes sink. More...
 
bool IsSuspended () override
 Get the current Suspend() state. More...
 
void OnSettingsChange ()
 
float GetVolume () override
 Returns the current master volume level of the AudioEngine. More...
 
void SetVolume (const float volume) override
 Sets the master volume level of the AudioEngine. More...
 
void SetMute (const bool enabled) override
 Set the mute state (does not affect volume level value) More...
 
bool IsMuted () override
 Get the current mute state. More...
 
IAE::StreamPtr MakeStream (AEAudioFormat &audioFormat, unsigned int options=0, IAEClockCallback *clock=NULL) override
 Creates and returns a new IAEStream in the format specified, this function should never fail. More...
 
IAE::SoundPtr MakeSound (const std::string &file) override
 load sound from an audio file and store original format register the sound in ActiveAE later when the engine is idle it will convert the sound to sink format
 
void EnumerateOutputDevices (AEDeviceList &devices, bool passthrough) override
 Enumerate the supported audio output devices. More...
 
bool SupportsRaw (AEAudioFormat &format) override
 Returns true if the AudioEngine supports AE_FMT_RAW streams for use with formats such as IEC61937. More...
 
bool SupportsSilenceTimeout () override
 Returns true if the AudioEngine supports drain mode which is not streaming silence when idle. More...
 
bool UsesDtsCoreFallback () override
 Returns true if the AudioEngine is currently configured to extract the DTS Core from DTS-HD streams. More...
 
bool HasStereoAudioChannelCount () override
 Returns true if the AudioEngine is currently configured for stereo audio. More...
 
bool HasHDAudioChannelCount () override
 Returns true if the AudioEngine is currently configured for HD audio (more than 5.1) More...
 
bool SupportsQualityLevel (enum AEQuality level) override
 Returns true if AudioEngine supports specified quality level. More...
 
bool IsSettingVisible (const std::string &settingId) override
 AE decides whether this settings should be displayed. More...
 
void KeepConfiguration (unsigned int millis) override
 Instruct AE to keep configuration for a specified time. More...
 
void DeviceChange () override
 Instruct AE to re-initialize, e.g. after ELD change event.
 
void DeviceCountChange (const std::string &driver) override
 Instruct AE to re-initialize, e.g. after ELD change event.
 
bool GetCurrentSinkFormat (AEAudioFormat &SinkFormat) override
 Get the current sink data format. More...
 
void RegisterAudioCallback (IAudioCallback *pCallback) override
 
void UnregisterAudioCallback (IAudioCallback *pCallback) override
 
void OnLostDisplay () override
 
void OnResetDisplay () override
 
void OnAppFocusChange (bool focus) override
 

Protected Types

enum  { MODE_RAW, MODE_TRANSCODE, MODE_PCM }
 

Protected Member Functions

void PlaySound (CActiveAESound *sound)
 
void GetDelay (AEDelayStatus &status, CActiveAEStream *stream)
 
void GetSyncInfo (CAESyncInfo &info, CActiveAEStream *stream)
 
float GetCacheTime (CActiveAEStream *stream)
 
float GetCacheTotal ()
 
float GetMaxDelay ()
 
void FlushStream (CActiveAEStream *stream)
 
void PauseStream (CActiveAEStream *stream, bool pause)
 
void StopSound (CActiveAESound *sound)
 
void SetStreamAmplification (CActiveAEStream *stream, float amplify)
 
void SetStreamReplaygain (CActiveAEStream *stream, float rgain)
 
void SetStreamVolume (CActiveAEStream *stream, float volume)
 
void SetStreamResampleRatio (CActiveAEStream *stream, double ratio)
 
void SetStreamResampleMode (CActiveAEStream *stream, int mode)
 
void SetStreamFFmpegInfo (CActiveAEStream *stream, int profile, enum AVMatrixEncoding matrix_encoding, enum AVAudioServiceType audio_service_type)
 
void SetStreamFade (CActiveAEStream *stream, float from, float target, unsigned int millis)
 
void Process () override
 
void StateMachine (int signal, Protocol *port, Message *msg)
 
bool InitSink ()
 
void DrainSink ()
 
void UnconfigureSink ()
 
void Dispose ()
 
void LoadSettings ()
 
void ValidateOutputDevices (bool saveChanges)
 
bool NeedReconfigureBuffers ()
 
bool NeedReconfigureSink ()
 
void ApplySettingsToFormat (AEAudioFormat &format, const AudioSettings &settings, int *mode=NULL)
 
void Configure (AEAudioFormat *desiredFmt=NULL)
 
AEAudioFormat GetInputFormat (AEAudioFormat *desiredFmt=NULL)
 
CActiveAEStreamCreateStream (MsgStreamNew *streamMsg)
 
void DiscardStream (CActiveAEStream *stream)
 
void SFlushStream (CActiveAEStream *stream)
 
void FlushEngine ()
 
void ClearDiscardedBuffers ()
 
void SStopSound (CActiveAESound *sound)
 
void DiscardSound (CActiveAESound *sound)
 
void ChangeResamplers ()
 
bool RunStages ()
 
bool HasWork ()
 
CSampleBufferSyncStream (CActiveAEStream *stream)
 
void ResampleSounds ()
 resample sounds to destination format for mixing destination format is either format of stream or default sink format when no stream is playing
 
bool ResampleSound (CActiveAESound *sound)
 
void MixSounds (CSoundPacket &dstSample)
 
void Deamplify (CSoundPacket &dstSample)
 
bool CompareFormat (const AEAudioFormat &lhs, const AEAudioFormat &rhs)
 

Static Protected Member Functions

static uint8_t ** AllocSoundSample (SampleConfig &config, int &samples, int &bytes_per_sample, int &planes, int &linesize)
 
static void FreeSoundSample (uint8_t **data)
 

Protected Attributes

CEvent m_inMsgEvent
 
CEvent m_outMsgEvent
 
CActiveAEControlProtocol m_controlPort
 
CActiveAEDataProtocol m_dataPort
 
int m_state
 
bool m_bStateMachineSelfTrigger
 
std::chrono::milliseconds m_extTimeout
 
bool m_extError
 
bool m_extDrain
 
XbmcThreads::EndTime m_extDrainTimer
 
std::chrono::milliseconds m_extKeepConfig
 
bool m_extDeferData
 
std::queue< time_t > m_extLastDeviceChange
 
bool m_extSuspended = false
 
bool m_isWinSysReg = false
 
enum ActiveAE::CActiveAE:: { ... }  m_mode
 
CActiveAESink m_sink
 
AEAudioFormat m_sinkFormat
 
AEAudioFormat m_sinkRequestFormat
 
AEAudioFormat m_encoderFormat
 
AEAudioFormat m_internalFormat
 
AEAudioFormat m_inputFormat
 
AudioSettings m_settings
 
CEngineStats m_stats
 
IAEEncoderm_encoder
 
std::string m_currDevice
 
std::unique_ptr< CActiveAESettingsm_settingsHandler
 
std::unique_ptr< CActiveAEBufferPoolResamplem_sinkBuffers
 
std::unique_ptr< CActiveAEBufferPoolResamplem_vizBuffers
 
std::unique_ptr< CActiveAEBufferPoolm_vizBuffersInput
 
std::unique_ptr< CActiveAEBufferPoolm_silenceBuffers
 
std::unique_ptr< CActiveAEBufferPoolm_encoderBuffers
 
std::list< CActiveAEStream * > m_streams
 
std::list< std::unique_ptr< CActiveAEBufferPool > > m_discardBufferPools
 
unsigned int m_streamIdGen
 
std::list< SoundStatem_sounds_playing
 
std::vector< CActiveAESound * > m_sounds
 
float m_volume
 
float m_volumeScaled
 
bool m_muted
 
bool m_sinkHasVolume
 
std::vector< IAudioCallback * > m_audioCallback
 
bool m_vizInitialized
 
CCriticalSection m_vizLock
 
float m_aeVolume
 
bool m_aeMuted
 
bool m_aeGUISoundForce
 

Friends

class CActiveAESound
 
class CActiveAEStream
 
class CSoundPacket
 
class CActiveAEBufferPoolResample
 

Additional Inherited Members

- Public Types inherited from IAE
using StreamPtr = std::unique_ptr< IAEStream, IAEStreamDeleter >
 
using SoundPtr = std::unique_ptr< IAESound, IAESoundDeleter >
 

Member Function Documentation

◆ Configure()

void CActiveAE::Configure ( AEAudioFormat desiredFmt = NULL)
protected
Todo:
implement
Todo:
adjust to decoder
Todo:
use cache of sync + water level

◆ EnumerateOutputDevices()

void CActiveAE::EnumerateOutputDevices ( AEDeviceList &  devices,
bool  passthrough 
)
overridevirtual

Enumerate the supported audio output devices.

Parameters
devicesThe device list to append supported devices to
passthroughTrue if only passthrough devices are wanted

Implements IAE.

◆ GetCurrentSinkFormat()

bool CActiveAE::GetCurrentSinkFormat ( AEAudioFormat SinkFormat)
overridevirtual

Get the current sink data format.

Parameters
Currentsink data format. For more details see AEAudioFormat.
Returns
Returns true on success, else false.

Reimplemented from IAE.

◆ GetVolume()

float CActiveAE::GetVolume ( )
overridevirtual

Returns the current master volume level of the AudioEngine.

Returns
The volume level between 0.0 and 1.0

Implements IAE.

◆ HasHDAudioChannelCount()

bool CActiveAE::HasHDAudioChannelCount ( )
overridevirtual

Returns true if the AudioEngine is currently configured for HD audio (more than 5.1)

Returns
true if the AudioEngine is currently configured for HD audio (more than 5.1)

Reimplemented from IAE.

◆ HasStereoAudioChannelCount()

bool CActiveAE::HasStereoAudioChannelCount ( )
overridevirtual

Returns true if the AudioEngine is currently configured for stereo audio.

Returns
true if the AudioEngine is currently configured for stereo audio

Reimplemented from IAE.

◆ IsMuted()

bool CActiveAE::IsMuted ( )
overridevirtual

Get the current mute state.

Returns
The current mute state

Implements IAE.

◆ IsSettingVisible()

bool CActiveAE::IsSettingVisible ( const std::string &  settingId)
overridevirtual

AE decides whether this settings should be displayed.

Returns
true if AudioEngine wants to display this setting

Reimplemented from IAE.

◆ IsSuspended()

bool CActiveAE::IsSuspended ( )
overridevirtual

Get the current Suspend() state.

Used by players to determine if audio is being processed Default is true so players drop audio or pause if engine unloaded

Returns
True if processing suspended

Reimplemented from IAE.

◆ KeepConfiguration()

void CActiveAE::KeepConfiguration ( unsigned int  millis)
overridevirtual

Instruct AE to keep configuration for a specified time.

Parameters
millistime for which old configuration should be kept

Reimplemented from IAE.

◆ MakeStream()

IAE::StreamPtr CActiveAE::MakeStream ( AEAudioFormat audioFormat,
unsigned int  options = 0,
IAEClockCallback clock = NULL 
)
overridevirtual

Creates and returns a new IAEStream in the format specified, this function should never fail.

The cleanup behaviour can be modified with the IAEStreamDeleter::setFinish method. Per default the behaviour is the same as calling FreeStream with true.

Parameters
audioFormat
optionsA bit field of stream options (see: enum AEStreamOptions)
Returns
a new IAEStream that will accept data in the requested format
Todo:
pass number of samples in audio packet

Implements IAE.

◆ PauseStream()

void CActiveAE::PauseStream ( CActiveAEStream stream,
bool  pause 
)
protected
Todo:
pause sink, needs api change

◆ ResampleSound()

bool CActiveAE::ResampleSound ( CActiveAESound sound)
protected

To become center clear on position test ??????

◆ Resume()

bool CActiveAE::Resume ( )
overridevirtual

Resumes output and re-initializes sink.

Used to resume output from Suspend() state above

Returns
True if successful

Implements IAE.

◆ RunStages()

bool CActiveAE::RunStages ( )
protected
Todo:
find better solution for this gapless bites audiophile

◆ SetMute()

void CActiveAE::SetMute ( const bool  enabled)
overridevirtual

Set the mute state (does not affect volume level value)

Parameters
enabledThe mute state

Implements IAE.

◆ SetVolume()

void CActiveAE::SetVolume ( const float  volume)
overridevirtual

Sets the master volume level of the AudioEngine.

Parameters
volumeThe new volume level between 0.0 and 1.0

Implements IAE.

◆ Start()

void CActiveAE::Start ( )
overridevirtual

Initializes the AudioEngine, called by CFactory when it is time to initialize the audio engine.

Do not call this directly, CApplication will call this when it is ready

Implements IAE.

◆ SupportsQualityLevel()

bool CActiveAE::SupportsQualityLevel ( enum AEQuality  level)
overridevirtual

Returns true if AudioEngine supports specified quality level.

Returns
true if specified quality level is supported, otherwise false

Reimplemented from IAE.

◆ SupportsRaw()

bool CActiveAE::SupportsRaw ( AEAudioFormat format)
overridevirtual

Returns true if the AudioEngine supports AE_FMT_RAW streams for use with formats such as IEC61937.

See also
CAEPackIEC61937::CAEPackIEC61937()
Returns
true if the AudioEngine is capable of RAW output

Reimplemented from IAE.

◆ SupportsSilenceTimeout()

bool CActiveAE::SupportsSilenceTimeout ( )
overridevirtual

Returns true if the AudioEngine supports drain mode which is not streaming silence when idle.

Returns
true if the AudioEngine is capable of drain mode

Reimplemented from IAE.

◆ Suspend()

bool CActiveAE::Suspend ( )
overridevirtual

Suspends output and de-initializes sink.

Used to avoid conflicts with external players or to reduce power consumption

Returns
True if successful

Implements IAE.

◆ UsesDtsCoreFallback()

bool CActiveAE::UsesDtsCoreFallback ( )
overridevirtual

Returns true if the AudioEngine is currently configured to extract the DTS Core from DTS-HD streams.

Returns
true if the AudioEngine is currently configured to extract the DTS Core from DTS-HD streams

Reimplemented from IAE.


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