-
- /* defaults */
- pad->samplerate = conf->samplerate_arg;
- pad->channels = conf->channels_arg;
-
- if (!conf->samplerate_given) { /* config option trumps btr_exec */
- /* ask parent btr nodes */
- ret = btr_exec_up(wn->btrn, "samplerate", &buf);
- if (ret >= 0) {
- int32_t rate;
- ret = para_atoi32(buf, &rate);
- if (ret < 0) /* should not happen */
- goto out;
- pad->samplerate = rate;
- }
- freep(&buf);
- }
-
- if (!conf->channels_given) {
- ret = btr_exec_up(wn->btrn, "channels", &buf);
- if (ret >= 0) {
- int32_t ch;
- ret = para_atoi32(buf, &ch);
- if (ret < 0)
- goto out;
- pad->channels = ch;
- }
- freep(&buf);
- }
- PARA_INFO_LOG("%d channel(s), %dHz\n", pad->channels, pad->samplerate);
- ret = 1;
-out:
- freep(&buf);
- if (ret < 0)
- free(pad);
- return ret;