[MPlayer-cvslog] r21368 - trunk/libao2/ao_macosx.c
nplourde
subversion at mplayerhq.hu
Wed Nov 29 00:05:45 CET 2006
Author: nplourde
Date: Wed Nov 29 00:05:45 2006
New Revision: 21368
Modified:
trunk/libao2/ao_macosx.c
Log:
adds support for AOCONTROL_GET_VOLUME/AOCONTROL_SET_VOLUME in ao_macosx, patcg by Crhis Roccati<roccati at pobox.com>
Modified: trunk/libao2/ao_macosx.c
==============================================================================
--- trunk/libao2/ao_macosx.c (original)
+++ trunk/libao2/ao_macosx.c Wed Nov 29 00:05:45 2006
@@ -171,13 +171,36 @@
}
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;
}
More information about the MPlayer-cvslog
mailing list