// restore AE's previous volume state
SetHardwareVolume(g_settings.m_fVolumeLevel);
- CAEFactory::AE->SetMute (g_settings.m_bMute);
- CAEFactory::AE->SetSoundMode(g_guiSettings.GetInt("audiooutput.guisoundmode"));
+ CAEFactory::SetMute (g_settings.m_bMute);
+ CAEFactory::SetSoundMode(g_guiSettings.GetInt("audiooutput.guisoundmode"));
// start-up Addons Framework
// currently bails out if either cpluff Dll is unavailable or system dir can not be scanned
g_Windowing.DestroyWindowSystem();
// shutdown the AudioEngine
- CAEFactory::AE->Shutdown();
+ CAEFactory::Shutdown();
CLog::Log(LOGNOTICE, "stopped");
}
if (!IsPlayingVideo())
CAddonInstaller::Get().UpdateRepos();
- CAEFactory::AE->GarbageCollect();
+ CAEFactory::GarbageCollect();
}
// Global Idle Time in Seconds
{
if (g_peripherals.IsMuted())
return true;
- return CAEFactory::AE->IsMuted();
+ return CAEFactory::IsMuted();
}
void CApplication::ToggleMute(void)
if (g_peripherals.Mute())
return;
- CAEFactory::AE->SetMute(true);
+ CAEFactory::SetMute(true);
g_settings.m_bMute = true;
}
if (g_peripherals.UnMute())
return;
- CAEFactory::AE->SetMute(false);
+ CAEFactory::SetMute(false);
g_settings.m_bMute = false;
}
if (value >= 0.99f)
value = 1.0f;
- CAEFactory::AE->SetVolume(value);
+ CAEFactory::SetVolume(value);
}
int CApplication::GetVolume() const
#endif
IAE* CAEFactory::AE = NULL;
+static float g_fVolume = 1.0f;
+static bool g_bMute = false;
bool CAEFactory::LoadEngine()
{
return AE != NULL;
}
+void CAEFactory::UnLoadEngine()
+{
+ if(AE)
+ {
+ AE->Shutdown();
+ delete AE;
+ AE = NULL;
+ }
+}
+
bool CAEFactory::StartEngine()
{
+#if defined(TARGET_RASPBERRY_PI)
+ return true;
+#endif
+
if (!AE)
return false;
AE = NULL;
return false;
}
+
+/* engine wrapping */
+IAESound *CAEFactory::MakeSound(const std::string &file)
+{
+ if(AE)
+ return AE->MakeSound(file);
+
+ return NULL;
+}
+
+void CAEFactory::FreeSound(IAESound *sound)
+{
+ if(AE)
+ AE->FreeSound(sound);
+}
+
+void CAEFactory::SetSoundMode(const int mode)
+{
+ if(AE)
+ AE->SetSoundMode(mode);
+}
+
+void CAEFactory::OnSettingsChange(std::string setting)
+{
+ if(AE)
+ AE->OnSettingsChange(setting);
+}
+
+void CAEFactory::EnumerateOutputDevices(AEDeviceList &devices, bool passthrough)
+{
+ if(AE)
+ AE->EnumerateOutputDevices(devices, passthrough);
+}
+
+std::string CAEFactory::GetDefaultDevice(bool passthrough)
+{
+ if(AE)
+ return AE->GetDefaultDevice(passthrough);
+
+ return "default";
+}
+
+bool CAEFactory::SupportsRaw()
+{
+ if(AE)
+ return AE->SupportsRaw();
+
+ return false;
+}
+
+void CAEFactory::SetMute(const bool enabled)
+{
+ if(AE)
+ AE->SetMute(enabled);
+
+ g_bMute = enabled;
+}
+
+bool CAEFactory::IsMuted()
+{
+ if(AE)
+ return AE->IsMuted();
+
+ return g_bMute || (g_fVolume == 0.0f);
+}
+
+float CAEFactory::GetVolume()
+{
+ if(AE)
+ return AE->GetVolume();
+
+ return g_fVolume;
+}
+
+void CAEFactory::SetVolume(const float volume)
+{
+ if(AE)
+ AE->SetVolume(volume);
+ else
+ g_fVolume = volume;
+}
+
+void CAEFactory::Shutdown()
+{
+ if(AE)
+ AE->Shutdown();
+}
+
+IAEStream *CAEFactory::MakeStream(enum AEDataFormat dataFormat, unsigned int sampleRate,
+ unsigned int encodedSampleRate, CAEChannelInfo channelLayout, unsigned int options)
+{
+ if(AE)
+ return AE->MakeStream(dataFormat, sampleRate, encodedSampleRate, channelLayout, options);
+
+ return NULL;
+}
+
+IAEStream *CAEFactory::FreeStream(IAEStream *stream)
+{
+ if(AE)
+ return AE->FreeStream(stream);
+
+ return NULL;
+}
+
+void CAEFactory::GarbageCollect()
+{
+ if(AE)
+ AE->GarbageCollect();
+}
public:
static IAE *AE;
static bool LoadEngine();
+ static void UnLoadEngine();
static bool StartEngine();
+ /* wrapp engine interface */
+ static IAESound *MakeSound(const std::string &file);
+ static void FreeSound(IAESound *sound);
+ static void SetSoundMode(const int mode);
+ static void OnSettingsChange(std::string setting);
+ static void EnumerateOutputDevices(AEDeviceList &devices, bool passthrough);
+ static std::string GetDefaultDevice(bool passthrough);
+ static bool SupportsRaw();
+ static void SetMute(const bool enabled);
+ static bool IsMuted();
+ static float GetVolume();
+ static void SetVolume(const float volume);
+ static void Shutdown();
+ static IAEStream *MakeStream(enum AEDataFormat dataFormat, unsigned int sampleRate,
+ unsigned int encodedSampleRate, CAEChannelInfo channelLayout, unsigned int options = 0);
+ static IAEStream *FreeStream(IAEStream *stream);
+ static void GarbageCollect();
private:
static bool LoadEngine(enum AEEngine engine);
};
{
CSingleLock lock (m_critSection);
if (m_pAudioStream)
- CAEFactory::AE->FreeStream(m_pAudioStream);
+ CAEFactory::FreeStream(m_pAudioStream);
free(m_pBuffer);
}
unsigned int options = needresampler && !audioframe.passthrough ? AESTREAM_FORCE_RESAMPLE : 0;
options |= AESTREAM_AUTOSTART;
- m_pAudioStream = CAEFactory::AE->MakeStream(
+ m_pAudioStream = CAEFactory::MakeStream(
audioframe.data_format,
audioframe.sample_rate,
audioframe.encoded_sample_rate,
CSingleLock lock (m_critSection);
if (m_pAudioStream)
- CAEFactory::AE->FreeStream(m_pAudioStream);
+ CAEFactory::FreeStream(m_pAudioStream);
free(m_pBuffer);
m_pBuffer = NULL;
bool CDVDAudioCodecPassthrough::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options)
{
/* dont open if AE doesnt support RAW */
- if (!CAEFactory::AE->SupportsRaw())
+ if (!CAEFactory::SupportsRaw())
return false;
bool bSupportsAC3Out = false;
if (si->m_stream)
{
- CAEFactory::AE->FreeStream(si->m_stream);
+ CAEFactory::FreeStream(si->m_stream);
si->m_stream = NULL;
}
if (si->m_stream)
{
- CAEFactory::AE->FreeStream(si->m_stream);
+ CAEFactory::FreeStream(si->m_stream);
si->m_stream = NULL;
}
return true;
/* get a paused stream */
- si->m_stream = CAEFactory::AE->MakeStream(
+ si->m_stream = CAEFactory::MakeStream(
si->m_dataFormat,
si->m_sampleRate,
si->m_encodedSampleRate,
if (si->m_stream->IsDrained())
{
itt = m_finishing.erase(itt);
- CAEFactory::AE->FreeStream(si->m_stream);
+ CAEFactory::FreeStream(si->m_stream);
delete si;
CLog::Log(LOGDEBUG, "PAPlayer::ProcessStreams - Stream Freed");
}
return it->second.sound;
}
- IAESound *sound = CAEFactory::AE->MakeSound(filename);
+ IAESound *sound = CAEFactory::MakeSound(filename);
if (!sound)
return NULL;
for(soundCache::iterator it = m_soundCache.begin(); it != m_soundCache.end(); ++it) {
if (it->second.sound == sound) {
if (--it->second.usage == 0) {
- CAEFactory::AE->FreeSound(sound);
+ CAEFactory::FreeSound(sound);
m_soundCache.erase(it);
}
return;
AddString(NULL, "audiooutput.passthroughdevice", 546, defaultDeviceName.c_str(), SPIN_CONTROL_TEXT);
#else
AddSeparator(ao, "audiooutput.sep1");
- AddString (ao, "audiooutput.audiodevice" , 545, CStdString(CAEFactory::AE->GetDefaultDevice(false)), SPIN_CONTROL_TEXT);
- AddString (ao, "audiooutput.passthroughdevice", 546, CStdString(CAEFactory::AE->GetDefaultDevice(true )), SPIN_CONTROL_TEXT);
+ AddString (ao, "audiooutput.audiodevice" , 545, CStdString(CAEFactory::GetDefaultDevice(false)), SPIN_CONTROL_TEXT);
+ AddString (ao, "audiooutput.passthroughdevice", 546, CStdString(CAEFactory::GetDefaultDevice(true )), SPIN_CONTROL_TEXT);
AddSeparator(ao, "audiooutput.sep2");
#endif
}
else if (strSetting.Equals("audiooutput.guisoundmode"))
{
- CAEFactory::AE->SetSoundMode(g_guiSettings.GetInt("audiooutput.guisoundmode"));
+ CAEFactory::SetSoundMode(g_guiSettings.GetInt("audiooutput.guisoundmode"));
}
else if (strSetting.Equals("musicplayer.crossfade"))
{
}
#endif
- CAEFactory::AE->OnSettingsChange(strSetting);
+ CAEFactory::OnSettingsChange(strSetting);
}
UpdateSettings();
int selectedValue = -1;
AEDeviceList sinkList;
- CAEFactory::AE->EnumerateOutputDevices(sinkList, Passthrough);
+ CAEFactory::EnumerateOutputDevices(sinkList, Passthrough);
#if !defined(TARGET_DARWIN)
if (sinkList.size()==0)
{