Skip to content

Commit

Permalink
Merge pull request #6 from Memphiz/ae_rebase
Browse files Browse the repository at this point in the history
Ae rebase
  • Loading branch information
jmarshallnz committed May 8, 2012
2 parents 5ab02fd + ed0fb8b commit f0489b4
Show file tree
Hide file tree
Showing 18 changed files with 195 additions and 163 deletions.
37 changes: 33 additions & 4 deletions language/English/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -1262,7 +1262,17 @@ msgstr ""
msgid "Boost volume level on downmix"
msgstr ""

#empty strings from id 347 to 349
#: id:347
msgid "- DTS-HD capable receiver"
msgstr ""

#: id:348
msgid "- Multichannel LPCM capable receiver"
msgstr ""

#: id:349
msgid "- TrueHD capable receiver"
msgstr ""

#: id:350
msgctxt "Auto context with id 350"
Expand Down Expand Up @@ -1504,7 +1514,7 @@ msgstr ""
msgid "Humidity"
msgstr ""

#empty strings from id 407 to 408
#empty strings from 407 to 408

#: id:409
msgid "Defaults"
Expand Down Expand Up @@ -9327,8 +9337,27 @@ msgstr ""
msgid "7.1"
msgstr ""

#34112-34200 reserved for future use
#empty strings from id 34111 to 34200
#34111-34119 reserved for future use
#empty strings from id 34111 to 34119

#: id:34120
msgid "Play GUI sounds"
msgstr ""

#: id:34121
msgid "Only when playback stopped"
msgstr ""

#: id:34122
msgid "Always"
msgstr ""

#: id:34123
msgid "Never"
msgstr ""

#34124-34200 reserved for future use
#empty strings from id 34124 to 34200

#: id:34201
msgid "Can't find a next item to play"
Expand Down
18 changes: 7 additions & 11 deletions xbmc/Application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -747,7 +747,8 @@ bool CApplication::Create()

// restore AE's previous volume state
SetHardwareVolume(g_settings.m_fVolumeLevel);
CAEFactory::AE->SetMute(g_settings.m_bMute);
CAEFactory::AE->SetMute (g_settings.m_bMute);
CAEFactory::AE->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
Expand Down Expand Up @@ -2320,8 +2321,7 @@ bool CApplication::OnKey(const CKey& key)
CLog::Log(LOGDEBUG, "%s: %s pressed, action is %s", __FUNCTION__, g_Keyboard.GetKeyName((int) key.GetButtonCode()).c_str(), action.GetName().c_str());

// Play a sound based on the action
if (!IsPlaying() || g_guiSettings.GetBool("audiooutput.guisoundwhileplayback"))
g_audioManager.PlayActionSound(action);
g_audioManager.PlayActionSound(action);

return OnAction(action);
}
Expand Down Expand Up @@ -2784,8 +2784,7 @@ bool CApplication::ProcessGamepad(float frameTime)
if (CButtonTranslator::GetInstance().TranslateJoystickString(iWin, g_Joystick.GetJoystick().c_str(), bid, JACTIVE_BUTTON, actionID, actionName, fullrange))
{
CAction action(actionID, 1.0f, 0.0f, actionName);
if (!IsPlaying() || g_guiSettings.GetBool("audiooutput.guisoundwhileplayback"))
g_audioManager.PlayActionSound(action);
g_audioManager.PlayActionSound(action);
g_Joystick.Reset();
g_Mouse.SetActive(false);
return OnAction(action);
Expand Down Expand Up @@ -2814,8 +2813,7 @@ bool CApplication::ProcessGamepad(float frameTime)
}

CAction action(actionID, fullrange ? (g_Joystick.GetAmount() + 1.0f)/2.0f : fabs(g_Joystick.GetAmount()), 0.0f, actionName);
if (!IsPlaying() || g_guiSettings.GetBool("audiooutput.guisoundwhileplayback"))
g_audioManager.PlayActionSound(action);
g_audioManager.PlayActionSound(action);
g_Joystick.Reset();
g_Mouse.SetActive(false);
return OnAction(action);
Expand Down Expand Up @@ -2847,8 +2845,7 @@ bool CApplication::ProcessGamepad(float frameTime)
if (CButtonTranslator::GetInstance().TranslateJoystickString(iWin, g_Joystick.GetJoystick().c_str(), bid, JACTIVE_HAT, actionID, actionName, fullrange))
{
CAction action(actionID, 1.0f, 0.0f, actionName);
if (!IsPlaying() || g_guiSettings.GetBool("audiooutput.guisoundwhileplayback"))
g_audioManager.PlayActionSound(action);
g_audioManager.PlayActionSound(action);
g_Joystick.Reset();
g_Mouse.SetActive(false);
return OnAction(action);
Expand Down Expand Up @@ -3148,8 +3145,7 @@ bool CApplication::ProcessJoystickEvent(const std::string& joystickName, int wKe
if (CButtonTranslator::GetInstance().TranslateJoystickString(iWin, joystickName.c_str(), wKeyID, isAxis ? JACTIVE_AXIS : JACTIVE_BUTTON, actionID, actionName, fullRange))
{
CAction action(actionID, fAmount, 0.0f, actionName, holdTime);
if (!IsPlaying() || g_guiSettings.GetBool("audiooutput.guisoundwhileplayback"))
g_audioManager.PlayActionSound(action);
g_audioManager.PlayActionSound(action);
return OnAction(action);
}
else
Expand Down
3 changes: 3 additions & 0 deletions xbmc/cores/AudioEngine/AEFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ bool CAEFactory::LoadEngine(enum AEEngine engine)
#if defined(HAS_PULSEAUDIO)
case AE_ENGINE_PULSE : AE = new CPulseAE(); break;
#endif

default:
return false;
}

return AE != NULL;
Expand Down
33 changes: 25 additions & 8 deletions xbmc/cores/AudioEngine/Engines/CoreAudioAE.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,15 @@
#define BUFFERSIZE 16416

CCoreAudioAE::CCoreAudioAE() :
m_Initialized (false ),
m_rawPassthrough (false ),
m_volume (1.0f ),
m_volumeBeforeMute (1.0f ),
m_muted (false ),
m_chLayoutCount (0 ),
m_callbackRunning (false )
m_Initialized (false ),
m_rawPassthrough (false ),
m_volume (1.0f ),
m_volumeBeforeMute (1.0f ),
m_muted (false ),
m_soundMode (AE_SOUND_OFF ),
m_streamsPlaying (false ),
m_chLayoutCount (0 ),
m_callbackRunning (false )
{
HAL = new CCoreAudioAEHAL;
}
Expand Down Expand Up @@ -382,6 +384,14 @@ bool CCoreAudioAE::IsMuted()
return m_muted;
}

void CCoreAudioAE::SetSoundMode(const int mode)
{
m_soundMode = mode;

/* stop all currently playing sounds if they are being turned off */
if (mode == AE_SOUND_OFF || (mode == AE_SOUND_IDLE && m_streamsPlaying))
StopAllSounds();
}

bool CCoreAudioAE::SupportsRaw()
{
Expand Down Expand Up @@ -432,6 +442,8 @@ IAEStream *CCoreAudioAE::MakeStream(enum AEDataFormat dataFormat,

Start();

m_streamsPlaying = true;

return stream;
}

Expand All @@ -458,6 +470,8 @@ IAEStream *CCoreAudioAE::FreeStream(IAEStream *stream)
}

}
m_streamsPlaying = !m_streams.empty();

streamLock.Leave();

// When we have been in passthrough mode, reinit the hardware to come back to anlog out
Expand All @@ -472,6 +486,9 @@ IAEStream *CCoreAudioAE::FreeStream(IAEStream *stream)

void CCoreAudioAE::PlaySound(IAESound *sound)
{
if (m_soundMode == AE_SOUND_OFF || (m_soundMode == AE_SOUND_IDLE && m_streamsPlaying))
return;

float *samples = ((CCoreAudioAESound*)sound)->GetSamples();
if (!samples && !m_Initialized)
return;
Expand Down Expand Up @@ -659,7 +676,7 @@ OSStatus CCoreAudioAE::OnRender(AudioUnitRenderActionFlags *actionFlags,
*/

// when not in passthrough output mix sounds
if (!m_rawPassthrough)
if (!m_rawPassthrough && m_soundMode != AE_SOUND_OFF)
{
MixSounds((float *)ioData->mBuffers[0].mData, rSamples);
ioData->mBuffers[0].mDataByteSize = size;
Expand Down
3 changes: 3 additions & 0 deletions xbmc/cores/AudioEngine/Engines/CoreAudioAE.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ class CCoreAudioAE : public IAE, public ICoreAudioSource
virtual void SetVolume(float volume);
virtual void SetMute(const bool enabled);
virtual bool IsMuted();
virtual void SetSoundMode(const int mode);


virtual bool SupportsRaw();
Expand Down Expand Up @@ -158,4 +159,6 @@ class CCoreAudioAE : public IAE, public ICoreAudioSource
float m_volume;
float m_volumeBeforeMute;
bool m_muted;
int m_soundMode;
bool m_streamsPlaying;
};
1 change: 0 additions & 1 deletion xbmc/cores/AudioEngine/Engines/PulseAESound.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
*
*/

#define __STDC_LIMIT_MACROS
#include "system.h"
#ifdef HAS_PULSEAUDIO

Expand Down
Loading

0 comments on commit f0489b4

Please sign in to comment.