[MPlayer-dev-eng] [PATCH] make ao_jack work with latest bio2jack version

Andre Kuehne andre.kuehne at gmx.net
Mon Aug 2 18:42:41 CEST 2004


Hi MPlayers,

this patch makes ao_jack work with the latest cvs version of bio2jack.
This is good because there is only cvs anyway :)
(see http://bio2jack.sf.net)
The changes are pretty minor, but i have no special audio knowledge
whatsoever, so anyone might take a look at it?

Greetings,

-- 
     _   _
_/\_| |_( )_
Andre Kuehne
-------------- next part --------------
? 2
Index: libao2/ao_jack.c
===================================================================
RCS file: /cvsroot/mplayer/main/libao2/ao_jack.c,v
retrieving revision 1.2
diff -u -B -r1.2 ao_jack.c
--- libao2/ao_jack.c	27 Jun 2004 13:18:06 -0000	1.2
+++ libao2/ao_jack.c	2 Aug 2004 16:19:20 -0000
@@ -34,8 +34,8 @@
 long JACK_Write(int deviceID, char *data, unsigned long bytes); /* returns the number of bytes written */
 long JACK_GetJackLatency(int deviceID); /* return the latency in milliseconds of jack */
 int  JACK_SetState(int deviceID, enum status_enum state); /* playing, paused, stopped */
-int  JACK_SetVolume(int deviceID, int left, int right); /* returns 0 on success */
-void JACK_GetVolume(int deviceID, int *left, int *right);
+int  JACK_SetVolumeForChannel(int deviceID, unsigned int channel, unsigned int volume);
+void JACK_GetVolumeForChannel(int deviceID, unsigned int channel, unsigned int *volume);
 //
 
 
@@ -57,9 +57,10 @@
 		case AOCONTROL_GET_VOLUME:	
 			{
 				ao_control_vol_t *vol = (ao_control_vol_t *)arg;
-				int l, r;
+				unsigned int l, r;
 				
-				JACK_GetVolume(driver, &l, &r);
+				JACK_GetVolumeForChannel(driver, 0, &l);
+				JACK_GetVolumeForChannel(driver, 1, &r);
 				vol->left = (float )l;
 				vol->right = (float )r;
 				
@@ -68,16 +69,21 @@
 		case AOCONTROL_SET_VOLUME:
 			{
 				ao_control_vol_t *vol = (ao_control_vol_t *)arg;
-				int l = (int )vol->left,
+				unsigned int l = (int )vol->left,
 					r = (int )vol->right,
 					err = 0;
 
-				if((err = JACK_SetVolume(driver, l, r))) {
+				if((err = JACK_SetVolumeForChannel(driver, 0, l))) {
 					mp_msg(MSGT_AO, MSGL_ERR, 
-							"AO: [Jack] Setting volume failed, error %d\n",err);
+						"AO: [Jack] Setting left volume failed, error %d\n",err);
 					return CONTROL_ERROR;
 				}
-				
+				if((err = JACK_SetVolumeForChannel(driver, 1, r))) {
+					mp_msg(MSGT_AO, MSGL_ERR, 
+						"AO: [Jack] Setting right volume failed, error %d\n",err);
+					return CONTROL_ERROR;
+				}
+
 				return CONTROL_OK;
 			}
 	}


More information about the MPlayer-dev-eng mailing list