simplify osx_write_pre_select()
[paraslash.git] / osx_writer.c
index df41941..4b505f0 100644 (file)
@@ -113,9 +113,14 @@ static void fill_buffer(osx_buffer *b, short *source, long size)
                b->size = size;
        }
        dest = b->buffer;
-       while (size--)
+       while (size--) {
+               char *tmp = (char *)source;
+               char c = *tmp;
+               *tmp = *(tmp + 1);
+               *(tmp + 1) = c;
                /* *dest++ = ((*source++) + 32768) / 65536.0; */
                *dest++ = (*source++) / 32768.0;
+       }
        b->ptr = b->buffer;
        b->remaining = b->size;
 }
@@ -240,7 +245,7 @@ static int osx_writer_open(struct writer_node *wn)
                        kAudioUnitScope_Input, 0, &inputCallback,
                        sizeof(inputCallback)) < 0)
                goto e3;
-       return 0;
+       return 1;
 e3:
        destroy_buffers(powd);
 e2:
@@ -301,15 +306,8 @@ static int osx_write_post_select(__a_unused struct sched *s,
        return 1;
 }
 
-static int osx_write_pre_select(struct sched *s, struct writer_node *wn)
+static int osx_write_pre_select(struct sched *s, __a_unused struct writer_node *wn)
 {
-       struct writer_node_group *wng = wn->wng;
-       struct private_osx_writer_data *powd = wn->private_data;
-
-//     if (!*wng->loaded)
-//             return 1;
-//     if (powd->to->remaining) /* Non empty buffer, must still be playing */
-//             return 1;
        s->timeout.tv_sec = 0;
        s->timeout.tv_usec = 20;
        return 1;