config.audio_backend_buffer_desired_length = dvalue;
}
}
-
+
/* Get the minumum buffer size for fancy interpolation setting in seconds. */
- if (config_lookup_float(config.cfg, "general.audio_backend_buffer_interpolation_threshold_in_seconds",
+ if (config_lookup_float(config.cfg,
+ "general.audio_backend_buffer_interpolation_threshold_in_seconds",
&dvalue)) {
if ((dvalue < 0) || (dvalue > config.audio_backend_buffer_desired_length)) {
die("Invalid audio_backend_buffer_interpolation_threshold_in_seconds value: \"%f\". It "
"should be between 0 and "
"audio_backend_buffer_desired_length_in_seconds of %.3f, default is %.3f seconds",
- dvalue, config.audio_backend_buffer_desired_length,config.audio_backend_buffer_interpolation_threshold_in_seconds);
+ dvalue, config.audio_backend_buffer_desired_length,
+ config.audio_backend_buffer_interpolation_threshold_in_seconds);
} else {
config.audio_backend_buffer_interpolation_threshold_in_seconds = dvalue;
}
config.audio_backend_latency_offset = 0;
config.audio_backend_buffer_desired_length = 0.15;
- config.audio_backend_buffer_interpolation_threshold_in_seconds = 0.050; // below this, basic interpolation will be used to save time.
+ config.audio_backend_buffer_interpolation_threshold_in_seconds =
+ 0.050; // below this, basic interpolation will be used to save time.
config.alsa_maximum_stall_time = 0.200; // 200 milliseconds -- if it takes longer, it's a problem
// get settings from settings file first, allow them to be overridden by
if (ret == 0) { // will be non-zero if an error or a stall
if ((samples != 0) && (buf != NULL)) {
-
+
// jut check the state of the DAC
-
- if ((state != SND_PCM_STATE_PREPARED) && (state != SND_PCM_STATE_RUNNING) && (state != SND_PCM_STATE_XRUN)) {
- debug(1,"alsa: DAC in odd SND_PCM_STATE_* %d prior to writing.",state);
+
+ if ((state != SND_PCM_STATE_PREPARED) && (state != SND_PCM_STATE_RUNNING) &&
+ (state != SND_PCM_STATE_XRUN)) {
+ debug(1, "alsa: DAC in odd SND_PCM_STATE_* %d prior to writing.", state);
}
// debug(3, "write %d frames.", samples);
if (ret == -EPIPE) { /* underrun */
ret = snd_pcm_recover(alsa_handle, ret, debuglev > 0 ? 1 : 0);
if (ret < 0) {
- debug(1, "alsa: failed to recover from SND_PCM_STATE_XRUN with snd_pcm_recover(); trying snd_pcm_prepare().");
+ debug(1, "alsa: failed to recover from SND_PCM_STATE_XRUN with snd_pcm_recover(); "
+ "trying snd_pcm_prepare().");
ret = snd_pcm_prepare(alsa_handle);
if (ret < 0)
warn("alsa: can't recover from SND_PCM_STATE_XRUN, snd_pcm_recover() and "
snd_strerror(ret));
}
} else if (ret == -ESTRPIPE) { /* suspended */
- while ((ret = snd_pcm_resume(alsa_handle)) == -EAGAIN) {
- sleep(1); /* wait until the suspend flag is released */
+ while ((ret = snd_pcm_resume(alsa_handle)) == -EAGAIN) {
+ sleep(1); /* wait until the suspend flag is released */
if (ret < 0) {
ret = snd_pcm_prepare(alsa_handle);
if (ret < 0)
}
}
}
- } else {
+ } else {
debug(1, "alsa: device status %d faulty for play.", state);
frame_index = 0;
measurement_data_is_valid = 0;
int jack_init(__attribute__((unused)) int argc, __attribute__((unused)) char **argv) {
config.audio_backend_latency_offset = 0;
config.audio_backend_buffer_desired_length = 0.500;
- config.audio_backend_buffer_interpolation_threshold_in_seconds = 0.25; // below this, soxr interpolation will not occur -- it'll be basic interpolation instead.
+ config.audio_backend_buffer_interpolation_threshold_in_seconds =
+ 0.25; // below this, soxr interpolation will not occur -- it'll be basic interpolation
+ // instead.
config.jack_auto_client_open_interval = 1; // check every second
// get settings from settings file first, allow them to be overridden by
// set up default values first
config.audio_backend_buffer_desired_length = 0.35;
- config.audio_backend_buffer_interpolation_threshold_in_seconds = 0.02; // below this, soxr interpolation will not occur -- it'll be basic interpolation instead.
+ config.audio_backend_buffer_interpolation_threshold_in_seconds =
+ 0.02; // below this, soxr interpolation will not occur -- it'll be basic interpolation
+ // instead.
config.audio_backend_latency_offset = 0;
devname = SIO_DEVANY;
config.audio_backend_buffer_desired_length = 1.0;
- config.audio_backend_buffer_interpolation_threshold_in_seconds = 0.25; // below this, soxr interpolation will not occur -- it'll be basic interpolation instead.
+ config.audio_backend_buffer_interpolation_threshold_in_seconds =
+ 0.25; // below this, soxr interpolation will not occur -- it'll be basic interpolation
+ // instead.
config.audio_backend_latency_offset = 0;
// get settings from settings file
int interface_index; // only valid if the interface string is non-NULL
double audio_backend_buffer_desired_length; // this will be the length in seconds of the
// audio backend buffer -- the DAC buffer for ALSA
- double audio_backend_buffer_interpolation_threshold_in_seconds; // below this, soxr interpolation will not occur -- it'll be basic interpolation instead.
+ double audio_backend_buffer_interpolation_threshold_in_seconds; // below this, soxr interpolation
+ // will not occur -- it'll be
+ // basic interpolation instead.
double audio_backend_latency_offset; // this will be the offset in seconds to compensate for any
// fixed latency there might be in the audio path
double audio_backend_silent_lead_in_time; // the length of the silence that should precede a play.
conn->first_packet_timestamp = 0;
conn->flush_requested = 0;
conn->fix_volume = 0x10000;
-
+
if (conn->latency == 0) {
debug(3, "No latency has (yet) been specified. Setting 88,200 (2 seconds) frames "
"as a default.");
debug(3, "Output frame bytes is %d.", conn->output_bytes_per_frame);
- conn->dac_buffer_queue_minimum_length = (int64_t)(config.audio_backend_buffer_interpolation_threshold_in_seconds *
- config.output_rate);
- debug(1,"dac_buffer_queue_minimum_length is %" PRId64 " frames.", conn->dac_buffer_queue_minimum_length);
+ conn->dac_buffer_queue_minimum_length = (int64_t)(
+ config.audio_backend_buffer_interpolation_threshold_in_seconds * config.output_rate);
+ debug(1, "dac_buffer_queue_minimum_length is %" PRId64 " frames.",
+ conn->dac_buffer_queue_minimum_length);
conn->session_corrections = 0;
// conn->play_segment_reference_frame = 0; // zero signals that we are not in a play segment
return -1;
}
}
-