static pthread_mutex_t alsa_mutex = PTHREAD_MUTEX_INITIALIZER;
static unsigned int desired_sample_rate;
-static snd_pcm_format_t sample_format;
+static enum sps_format_t sample_format;
static snd_pcm_t *alsa_handle = NULL;
static snd_pcm_hw_params_t *alsa_params = NULL;
case SPS_FORMAT_S32:
sf = SND_PCM_FORMAT_S32;
break;
+ default:
+ die("Unsupported output format at audio_alsa.c");
}
ret = snd_pcm_hw_params_set_format(alsa_handle, alsa_params, sf);
if (ret < 0) {
uint64_t ranarrayval() {
uint64_t v = ranarray[ranarraynext];
- ranarraynext = (ranarraynext++) % ranarraylength;
+ ranarraynext++;
+ ranarraynext = ranarraynext % ranarraylength;
+ return v;
}
void r64arrayinit() { ranarrayinit(); }
uint64_t ranarray64u() { return (ranarrayval()); }
-int64_t ranarray64i() { return (ranarrayval(&rx) >> 1); }
+int64_t ranarray64i() { return (ranarrayval() >> 1); }
case SPS_FORMAT_U8:
dither_mask = (int64_t)1 << (64 + 1 - 8);
break;
+ case SPS_FORMAT_UNKNOWN:
+ die("Unexpected SPS_FORMAT_UNKNOWN while calculating dither mask.");
}
dither_mask -= 1;
// int64_t r = r64i();
*op = hyper_sample;
result = 1;
break;
+ case SPS_FORMAT_UNKNOWN:
+ die("Unexpected SPS_FORMAT_UNKNOWN while outputting samples");
}
*outp += result;
// rate, multiply it by the frame ratio.
// but, on some occasions, more than one frame could be added
- conn->output_bytes_per_frame = 4;
switch (config.output_format) {
case SPS_FORMAT_S24_3LE:
case SPS_FORMAT_S24_3BE:
case SPS_FORMAT_S32:
conn->output_bytes_per_frame = 8;
break;
+ default:
+ conn->output_bytes_per_frame = 4;
}
debug(1, "Output frame bytes is %d.", conn->output_bytes_per_frame);
case SPS_FORMAT_S32:
output_bit_depth = 32;
break;
+ case SPS_FORMAT_UNKNOWN:
+ die("Unknown format choosing output bit depth");
}
debug(1, "Output bit depth is %d.", output_bit_depth);
case ST_right_only:
ls = rs;
break;
+ case ST_stereo:
+ break; // nothing extra to do
}
// here, replicate the samples if you're upsampling
stuff_buffer_basic_32((int32_t *)tbuf, inbuflength, config.output_format,
outbuf, amount_to_stuff, enable_dither, conn);
break;
-#ifdef HAVE_LIBSOXR
case ST_soxr:
+#ifdef HAVE_LIBSOXR
// if (amount_to_stuff) debug(1,"Soxr stuff...");
play_samples = stuff_buffer_soxr_32((int32_t *)tbuf, (int32_t *)sbuf, inbuflength,
config.output_format, outbuf, amount_to_stuff,
enable_dither,conn);
- break;
#endif
+ break;
}
/*