[polypaudio-commits] r962 - /trunk/src/utils/padsp.c

svnmailer-noreply at 0pointer.de svnmailer-noreply at 0pointer.de
Wed May 24 17:25:04 PDT 2006


Author: lennart
Date: Thu May 25 02:25:03 2006
New Revision: 962

URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=962&root=polypaudio&view=rev
Log:
* issue volume updates syncrhonously
* correct channel order of OSS volumes (swap left,right)

Modified:
    trunk/src/utils/padsp.c

Modified: trunk/src/utils/padsp.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/utils/padsp.c?rev=962&root=polypaudio&r1=961&r2=962&view=diff
==============================================================================
--- trunk/src/utils/padsp.c (original)
+++ trunk/src/utils/padsp.c Thu May 25 02:25:03 2006
@@ -1074,8 +1074,8 @@
             pa_threaded_mainloop_lock(i->mainloop);
 
             *(int*) argp =
-                ((i->volume.values[0]*100/PA_VOLUME_NORM) << 8) |
-                ((i->volume.values[i->volume.channels > 1 ? 1 : 0]*100/PA_VOLUME_NORM));
+                ((i->volume.values[0]*100/PA_VOLUME_NORM)) |
+                ((i->volume.values[i->volume.channels > 1 ? 1 : 0]*100/PA_VOLUME_NORM)  << 8);
             
             pa_threaded_mainloop_unlock(i->mainloop);
             
@@ -1090,16 +1090,29 @@
 
             v = i->volume;
             
-            i->volume.values[0] = ((*(int*) argp >> 8)*PA_VOLUME_NORM)/100;
-            i->volume.values[1] = ((*(int*) argp & 0xFF)*PA_VOLUME_NORM)/100;
+            i->volume.values[0] = ((*(int*) argp & 0xFF)*PA_VOLUME_NORM)/100;
+            i->volume.values[1] = ((*(int*) argp >> 8)*PA_VOLUME_NORM)/100;
 
             if (!pa_cvolume_equal(&i->volume, &v)) {
                 pa_operation *o;
                 
                 if (!(o = pa_context_set_sink_volume_by_index(i->context, i->sink_index, &i->volume, NULL, NULL)))
                     debug(__FILE__":Failed set volume: %s", pa_strerror(pa_context_errno(i->context)));
-                else
+                else {
+
+                    i->operation_success = 0;
+                    while (pa_operation_get_state(o) != PA_OPERATION_DONE) {
+                        CONTEXT_CHECK_DEAD_GOTO(i, exit_loop);
+                        
+                        pa_threaded_mainloop_wait(i->mainloop);
+                    }
+                exit_loop:
+                    
+                    if (!i->operation_success)
+                        debug(__FILE__": Failed to set volume: %s\n", pa_strerror(pa_context_errno(i->context)));
+
                     pa_operation_unref(o);
+                }
                 
                 /* We don't wait for completion here */
                 i->volume_modify_count++;




More information about the pulseaudio-commits mailing list