Merge branch 'master' into my-osx
[paraslash.git] / osx_writer.c
index c07bbd51e6577152408eda231f5a0e1697b1bbd5..df4194122f50818270c904da533fc4a113d81c93 100644 (file)
@@ -99,9 +99,9 @@ static void fill_buffer(osx_buffer *b, short *source, long size)
 {
        float *dest;
 
 {
        float *dest;
 
-       PARA_INFO_LOG("%ld\n", size);
        if (b->remaining) /* Non empty buffer, must still be playing */
                return;
        if (b->remaining) /* Non empty buffer, must still be playing */
                return;
+       PARA_INFO_LOG("%ld\n", size);
        if (b->size != size) {
                /*
                 * Hey! What's that? Coudn't this buffer size be fixed
        if (b->size != size) {
                /*
                 * Hey! What's that? Coudn't this buffer size be fixed
@@ -144,6 +144,7 @@ static OSStatus osx_callback(void * inClientData,
                                        /* wait for the results */
                                        usleep(2000);
                        }
                                        /* wait for the results */
                                        usleep(2000);
                        }
+                       PARA_INFO_LOG("buf %p: n = %ld, m= %ld\n", powd->from->buffer, n, m);
                        /*
                         * we dump what we can. In fact, just the necessary
                         * should be sufficient
                        /*
                         * we dump what we can. In fact, just the necessary
                         * should be sufficient
@@ -208,8 +209,8 @@ static int osx_writer_open(struct writer_node *wn)
        format.mFormatID = kAudioFormatLinearPCM;
        /* flags specific to each format */
        format.mFormatFlags = kLinearPCMFormatFlagIsFloat
        format.mFormatID = kAudioFormatLinearPCM;
        /* flags specific to each format */
        format.mFormatFlags = kLinearPCMFormatFlagIsFloat
-               | kLinearPCMFormatFlagIsPacked;
-       //      | kLinearPCMFormatFlagIsBigEndian;
+               | kLinearPCMFormatFlagIsPacked
+               | kLinearPCMFormatFlagIsBigEndian;
        /*
         * We produce 2-channel audio. Now if we have a mega-super-hyper card for our
         * audio, it is its problem to convert it to 8-, 16-, 32- or 1024-channel data.
        /*
         * We produce 2-channel audio. Now if we have a mega-super-hyper card for our
         * audio, it is its problem to convert it to 8-, 16-, 32- or 1024-channel data.
@@ -285,7 +286,7 @@ static int osx_write_post_select(__a_unused struct sched *s,
        struct writer_node_group *wng = wn->wng;
        short *data = (short*)wng->buf + wn->written;
 
        struct writer_node_group *wng = wn->wng;
        short *data = (short*)wng->buf + wn->written;
 
-       if (!*wng->loaded)
+       if (*wng->loaded <= wn->written)
                return 1;
        if (powd->to->remaining) /* Non empty buffer, must still be playing */
                return 1;
                return 1;
        if (powd->to->remaining) /* Non empty buffer, must still be playing */
                return 1;