[polypaudio-commits] r473 - /trunk/polyp/protocol-esound.c

svnmailer-noreply at 0pointer.de svnmailer-noreply at 0pointer.de
Fri Feb 3 05:33:22 PST 2006


Author: ossman
Date: Fri Feb  3 14:33:21 2006
New Revision: 473

URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=473&root=polypaudio&view=rev
Log:
Use defines and not hard coded values for volume levels. Caused incorrect
volume levels for all esound clients that changed the volume.

Modified:
    trunk/polyp/protocol-esound.c

Modified: trunk/polyp/protocol-esound.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/polyp/protocol-esound.c?rev=473&root=polypaudio&r1=472&r2=473&view=diff
==============================================================================
--- trunk/polyp/protocol-esound.c (original)
+++ trunk/polyp/protocol-esound.c Fri Feb  3 14:33:21 2006
@@ -474,7 +474,7 @@
     assert(k);
 
     for (conn = pa_idxset_first(c->protocol->connections, &idx); conn; conn = pa_idxset_next(c->protocol->connections, &idx)) {
-        int format = ESD_BITS16 | ESD_STEREO, rate = 44100, lvolume = 0xFF, rvolume = 0xFF;
+        int format = ESD_BITS16 | ESD_STEREO, rate = 44100, lvolume = ESD_VOLUME_BASE, rvolume = ESD_VOLUME_BASE;
 
         if (conn->state != ESD_STREAMING_DATA)
             continue;
@@ -483,8 +483,8 @@
         
         if (conn->sink_input) {
             rate = conn->sink_input->sample_spec.rate;
-            lvolume = (conn->sink_input->volume.values[0]*0xFF)/0x100;
-            rvolume = (conn->sink_input->volume.values[1]*0xFF)/0x100;
+            lvolume = (conn->sink_input->volume.values[0]*ESD_VOLUME_BASE)/PA_VOLUME_NORM;
+            rvolume = (conn->sink_input->volume.values[1]*ESD_VOLUME_BASE)/PA_VOLUME_NORM;
             format = format_native2esd(&conn->sink_input->sample_spec);
         }
         
@@ -544,11 +544,11 @@
             response += sizeof(int);
             
             /* left */
-            *((int*) response) = maybe_swap_endian_32(c->swap_byte_order, (ce->volume.values[0]*0xFF)/0x100);
+            *((int*) response) = maybe_swap_endian_32(c->swap_byte_order, (ce->volume.values[0]*ESD_VOLUME_BASE)/PA_VOLUME_NORM);
             response += sizeof(int);
             
             /*right*/
-            *((int*) response) = maybe_swap_endian_32(c->swap_byte_order, (ce->volume.values[0]*0xFF)/0x100);
+            *((int*) response) = maybe_swap_endian_32(c->swap_byte_order, (ce->volume.values[0]*ESD_VOLUME_BASE)/PA_VOLUME_NORM);
             response += sizeof(int);
             
             /*format*/
@@ -578,9 +578,9 @@
     
     idx = (uint32_t) maybe_swap_endian_32(c->swap_byte_order, *(const int*)data)-1;
     lvolume = (uint32_t) maybe_swap_endian_32(c->swap_byte_order, *((const int*)data + 1));
-    lvolume = (lvolume*0x100)/0xFF;
+    lvolume = (lvolume*PA_VOLUME_NORM)/ESD_VOLUME_BASE;
     rvolume = (uint32_t) maybe_swap_endian_32(c->swap_byte_order, *((const int*)data + 2));
-    rvolume = (rvolume*0x100)/0xFF;
+    rvolume = (rvolume*PA_VOLUME_NORM)/ESD_VOLUME_BASE;
 
     ok = connection_write(c, sizeof(int));
     assert(ok);




More information about the pulseaudio-commits mailing list