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