diff options
author | Memphiz <memphis@machzwo.de> | 2012-02-16 21:16:25 +0100 |
---|---|---|
committer | Memphiz <memphis@machzwo.de> | 2012-02-16 22:32:14 +0100 |
commit | 0fa51ffd2d4c5258ee5a1d1e6aa43b3f502b23a2 (patch) | |
tree | 778f52e9f34918907c6fcef94cf3b8e826c42b7a | |
parent | c6c9ab3e99d6a2da4be89b94c4ef4f77a8cd0c11 (diff) |
[ios] - when advancedsetting iosvoumecontrol is set - don't allways do passthrough - but give the passthroughflag to the hardwarelayer and let it do volume control when appropriate
m--------- | addons/skin.touched | 0 | ||||
-rw-r--r-- | xbmc/cores/AudioRenderers/IOSAudioRenderer.cpp | 21 |
2 files changed, 17 insertions, 4 deletions
diff --git a/addons/skin.touched b/addons/skin.touched -Subproject 9b6fcdbb095bc84cdf84c1fd01ff719e972cbaa +Subproject 1d03746646111f97e28b807a290bd762c7db547 diff --git a/xbmc/cores/AudioRenderers/IOSAudioRenderer.cpp b/xbmc/cores/AudioRenderers/IOSAudioRenderer.cpp index cb72e67c5e..5a7ce24728 100644 --- a/xbmc/cores/AudioRenderers/IOSAudioRenderer.cpp +++ b/xbmc/cores/AudioRenderers/IOSAudioRenderer.cpp @@ -24,6 +24,7 @@ #include "IOSAudioRingBuffer.h" #include "AudioContext.h" #include "GUISettings.h" +#include "Settings/AdvancedSettings.h" #include "Settings.h" #include "utils/log.h" @@ -112,6 +113,12 @@ bool CIOSAudioRenderer::Initialize(IAudioCallback* pCallback, const CStdString& m_Channels = iChannels; + bool passthroughForHardware = true; + + if(g_advancedSettings.m_audioIosAllowVolumeControl) + { + passthroughForHardware = m_Passthrough; + } // Set the input stream format for the AudioUnit // We use the default DefaultOuput AudioUnit, so we only can set the input stream format. // The autput format is automaticaly set to the input format. @@ -128,7 +135,7 @@ bool CIOSAudioRenderer::Initialize(IAudioCallback* pCallback, const CStdString& audioFormat.mReserved = 0; // Attach our output object to the device - if(!m_AudioDevice.Init(/*m_Passthrough*/ true, &audioFormat, RenderCallback, this)) + if(!m_AudioDevice.Init(passthroughForHardware, &audioFormat, RenderCallback, this)) { CLog::Log(LOGDEBUG, "CIOSAudioRenderer::Init failed"); return false; @@ -255,7 +262,7 @@ bool CIOSAudioRenderer::Stop() //*********************************************************************************************** LONG CIOSAudioRenderer::GetCurrentVolume() const { - return m_CurrentVolume; + return m_AudioDevice.GetCurrentVolume(); } void CIOSAudioRenderer::Mute(bool bMute) @@ -264,7 +271,8 @@ void CIOSAudioRenderer::Mute(bool bMute) bool CIOSAudioRenderer::SetCurrentVolume(LONG nVolume) { - return true; + m_CurrentVolume = nVolume; + return m_AudioDevice.SetCurrentVolume(nVolume); } //*********************************************************************************************** @@ -399,8 +407,12 @@ OSStatus CIOSAudioRenderer::OnRender(AudioUnitRenderActionFlags *ioActionFlags, m_Buffer->Read((unsigned char *)ioData->mBuffers[m_OutputBufferIndex].mData, bytesRequested); - if (!m_EnableVolumeControl && m_CurrentVolume <= VOLUME_MINIMUM) + if (m_EnableVolumeControl && m_CurrentVolume <= VOLUME_MINIMUM) + { ioData->mBuffers[m_OutputBufferIndex].mDataByteSize = 0; + if (ioActionFlags) + *ioActionFlags |= kAudioUnitRenderAction_OutputIsSilence; + } else ioData->mBuffers[m_OutputBufferIndex].mDataByteSize = bytesRequested; @@ -424,3 +436,4 @@ void CIOSAudioRenderer::PropertyChangeCallback(void* inClientData, AudioSession } #endif + |