]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - osx_write.c
Deduplicate --channels and --sample-rate.
[paraslash.git] / osx_write.c
index cde7fcea867ef4bb35b9799f2c0b59dce455085e..209721cfd2a9bd4475fdab2d1211be14b15e9d84 100644 (file)
@@ -172,7 +172,7 @@ static int osx_write_open(struct writer_node *wn)
        AudioStreamBasicDescription format;
        int ret;
        struct btr_node *btrn = wn->btrn;
-       struct osx_write_args_info *conf = wn->conf;
+       int32_t val;
 
        wn->private_data = powd;
        /* where did that default audio output go? */
@@ -193,18 +193,14 @@ static int osx_write_open(struct writer_node *wn)
        if (AudioUnitInitialize(powd->audio_unit))
                goto e1;
        powd->play = 0;
-       powd->sample_rate = conf->sample_rate_arg;
-       powd->channels = conf->channels_arg;
-       if (!conf->sample_rate_given) {
-               int32_t rate;
-               get_btr_sample_rate(btrn, &rate);
-               powd->sample_rate = rate;
-       }
-       if (!conf->channels_given) {
-               int32_t ch;
-               get_btr_channels(btrn, &ch);
-               powd->channels = ch;
-       }
+       ret = get_btr_sample_rate(btrn, &val);
+       if (ret < 0)
+               goto e1;
+       powd->sample_rate = val;
+       ret = get_btr_channels(btrn, &val);
+       if (ret < 0)
+               goto e1;
+       powd->channels = val;
        /*
         * Choose PCM format. We tell the Output Unit what format we're going
         * to supply data to it. This is necessary if you're providing data