summaryrefslogtreecommitdiffstats
path: root/libao2
diff options
context:
space:
mode:
authornplourde <nplourde@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-11-28 23:05:45 +0000
committernplourde <nplourde@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-11-28 23:05:45 +0000
commit3058b1f8acdcfa2cdfa2f7744c6dd2b44228ce2f (patch)
tree6e7df59076b09a155ca2781e611797eb196aa0a0 /libao2
parent9fdb13fd53214359318f63942d00001d18ce3124 (diff)
downloadmpv-3058b1f8acdcfa2cdfa2f7744c6dd2b44228ce2f.tar.bz2
mpv-3058b1f8acdcfa2cdfa2f7744c6dd2b44228ce2f.tar.xz
adds support for AOCONTROL_GET_VOLUME/AOCONTROL_SET_VOLUME in ao_macosx, patcg by Crhis Roccati<roccati@pobox.com>
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@21368 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libao2')
-rw-r--r--libao2/ao_macosx.c29
1 files changed, 26 insertions, 3 deletions
diff --git a/libao2/ao_macosx.c b/libao2/ao_macosx.c
index 60244ecbf7..626bb16e91 100644
--- a/libao2/ao_macosx.c
+++ b/libao2/ao_macosx.c
@@ -171,13 +171,36 @@ int req=(inNumFrames)*ao->packetSize;
}
static int control(int cmd,void *arg){
+ao_control_vol_t *control_vol;
+OSStatus err;
+Float32 pan, vol;
switch (cmd) {
- case AOCONTROL_SET_DEVICE:
- case AOCONTROL_GET_DEVICE:
case AOCONTROL_GET_VOLUME:
+ control_vol = (ao_control_vol_t*)arg;
+ err = AudioUnitGetParameter(ao->theOutputUnit, kHALOutputParam_Volume, kAudioUnitScope_Global, 0, &vol);
+
+ if(err==0) {
+ // printf("GET VOL=%f\n", vol);
+ control_vol->left=control_vol->right=vol*100.0/4.0;
+ return CONTROL_TRUE;
+ }
+ else {
+ return CONTROL_FALSE;
+ }
+
case AOCONTROL_SET_VOLUME:
+ control_vol = (ao_control_vol_t*)arg;
+
+ vol=(control_vol->left+control_vol->right)*4.0/200.0;
+ err = AudioUnitSetParameter(ao->theOutputUnit, kHALOutputParam_Volume, kAudioUnitScope_Global, 0, vol, 0);
+ if(err==0) {
+ // printf("SET VOL=%f\n", vol);
+ return CONTROL_TRUE;
+ }
+ else {
+ return CONTROL_FALSE;
+ }
/* Everything is currently unimplemented */
- return CONTROL_FALSE;
default:
return CONTROL_FALSE;
}