summaryrefslogtreecommitdiff
path: root/Source/Core/AudioCommon/Src/CoreAudioSoundStream.cpp
diff options
context:
space:
mode:
authorSoren Jorvang <soren.jorvang@gmail.com>2011-01-02 02:49:30 +0000
committerSoren Jorvang <soren.jorvang@gmail.com>2011-01-02 02:49:30 +0000
commitc729b86c0045779f0020c17393a95e9c84722083 (patch)
treed4f36162868671cb00b0676d214165f759c7c66f /Source/Core/AudioCommon/Src/CoreAudioSoundStream.cpp
parent26a3a9400b67b1e964a4de45e7042c577d0670d8 (diff)
Audio volume slider support for OS X.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6720 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core/AudioCommon/Src/CoreAudioSoundStream.cpp')
-rw-r--r--Source/Core/AudioCommon/Src/CoreAudioSoundStream.cpp24
1 files changed, 15 insertions, 9 deletions
diff --git a/Source/Core/AudioCommon/Src/CoreAudioSoundStream.cpp b/Source/Core/AudioCommon/Src/CoreAudioSoundStream.cpp
index 131330c675..57e2e448ea 100644
--- a/Source/Core/AudioCommon/Src/CoreAudioSoundStream.cpp
+++ b/Source/Core/AudioCommon/Src/CoreAudioSoundStream.cpp
@@ -112,6 +112,18 @@ bool CoreAudioSound::Start()
return true;
}
+void CoreAudioSound::SetVolume(int volume)
+{
+ OSStatus err;
+
+ err = AudioUnitSetParameter(audioUnit,
+ kHALOutputParam_Volume,
+ kAudioUnitParameterFlag_Output, 0,
+ volume / 100., 0);
+ if (err != noErr)
+ ERROR_LOG(AUDIO, "error setting volume");
+}
+
void CoreAudioSound::SoundLoop()
{
}
@@ -121,22 +133,16 @@ void CoreAudioSound::Stop()
OSStatus err;
err = AudioOutputUnitStop(audioUnit);
- if (err != noErr) {
+ if (err != noErr)
ERROR_LOG(AUDIO, "error stopping audiounit");
- return;
- }
err = AudioUnitUninitialize(audioUnit);
- if (err != noErr) {
+ if (err != noErr)
ERROR_LOG(AUDIO, "error uninitializing audiounit");
- return;
- }
err = CloseComponent(audioUnit);
- if (err != noErr) {
+ if (err != noErr)
ERROR_LOG(AUDIO, "error closing audio component");
- return;
- }
}
void CoreAudioSound::Update()