]> git.tue.mpg.de Git - paraslash.git/commitdiff
osx_write: fix mono streams
authorAndre Noll <maan@congo.fml.local>
Sun, 20 Aug 2006 13:55:28 +0000 (15:55 +0200)
committerAndre Noll <maan@congo.fml.local>
Sun, 20 Aug 2006 13:55:28 +0000 (15:55 +0200)
The old code had a hardcoded channels count of two. Use the value from the
command line or the writer node group information instead.

osx_writer.c

index c4a97e4b5ae9c0f2575f8239bb79c43dab45a8f7..54a1acd1e98e3c3ce597982cf7f05d56842e698b 100644 (file)
@@ -51,6 +51,7 @@ struct private_osx_writer_data {
        osx_buffer *from; /* Current buffers */
        osx_buffer *to;
        unsigned samplerate;
+       unsigned channels;
 };
 
 
@@ -223,12 +224,12 @@ static int osx_writer_open(struct writer_node *wn)
        format.mFormatFlags = kLinearPCMFormatFlagIsFloat
                | 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.
-        */
+       if (!conf->channels_given && wng->channels)
+               powd->channels = *wng->channels;
+       else
+               powd->channels = conf->channels_arg;
+       format.mChannelsPerFrame = powd->channels;
        format.mFramesPerPacket = 1;
-       format.mChannelsPerFrame = 2;
        format.mBytesPerPacket = format.mChannelsPerFrame * sizeof(float);
        format.mBytesPerFrame = format.mFramesPerPacket * format.mBytesPerPacket;
        /* one of the most constant constants of the whole computer history */