+#if API_ALSA
+static void log_params(snd_pcm_hw_params_t *hwparams,
+ snd_pcm_sw_params_t *swparams) {
+ snd_pcm_uframes_t f;
+ unsigned u;
+
+ return; /* too verbose */
+ if(hwparams) {
+ /* TODO */
+ }
+ if(swparams) {
+ snd_pcm_sw_params_get_silence_size(swparams, &f);
+ info("sw silence_size=%lu", (unsigned long)f);
+ snd_pcm_sw_params_get_silence_threshold(swparams, &f);
+ info("sw silence_threshold=%lu", (unsigned long)f);
+ snd_pcm_sw_params_get_sleep_min(swparams, &u);
+ info("sw sleep_min=%lu", (unsigned long)u);
+ snd_pcm_sw_params_get_start_threshold(swparams, &f);
+ info("sw start_threshold=%lu", (unsigned long)f);
+ snd_pcm_sw_params_get_stop_threshold(swparams, &f);
+ info("sw stop_threshold=%lu", (unsigned long)f);
+ snd_pcm_sw_params_get_xfer_align(swparams, &f);
+ info("sw xfer_align=%lu", (unsigned long)f);
+ }
+}
+#endif
+
+static void soxargs(const char ***pp, char **qq, ao_sample_format *ao) {
+ int n;
+
+ *(*pp)++ = "-t.raw";
+ *(*pp)++ = "-s";
+ *(*pp)++ = *qq; n = sprintf(*qq, "-r%d", ao->rate); *qq += n + 1;
+ *(*pp)++ = *qq; n = sprintf(*qq, "-c%d", ao->channels); *qq += n + 1;
+ /* sox 12.17.9 insists on -b etc; CVS sox insists on -<n> etc; both are
+ * deployed! */
+ switch(config->sox_generation) {
+ case 0:
+ if(ao->bits != 8
+ && ao->byte_format != AO_FMT_NATIVE
+ && ao->byte_format != MACHINE_AO_FMT) {
+ *(*pp)++ = "-x";
+ }
+ switch(ao->bits) {
+ case 8: *(*pp)++ = "-b"; break;
+ case 16: *(*pp)++ = "-w"; break;
+ case 32: *(*pp)++ = "-l"; break;
+ case 64: *(*pp)++ = "-d"; break;
+ default: fatal(0, "cannot handle sample size %d", (int)ao->bits);
+ }
+ break;
+ case 1:
+ switch(ao->byte_format) {
+ case AO_FMT_NATIVE: break;
+ case AO_FMT_BIG: *(*pp)++ = "-B"; break;
+ case AO_FMT_LITTLE: *(*pp)++ = "-L"; break;
+ }
+ *(*pp)++ = *qq; n = sprintf(*qq, "-%d", ao->bits/8); *qq += n + 1;
+ break;
+ }
+}
+