mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-08 15:54:57 +01:00
PulseAudio: set buffer attributes where they are used
Just moving code.
This commit is contained in:
parent
8e7ef0d42c
commit
584ee51ca8
1 changed files with 8 additions and 9 deletions
|
|
@ -211,19 +211,10 @@ int
|
||||||
PulseAudioBackend::init_pulse ()
|
PulseAudioBackend::init_pulse ()
|
||||||
{
|
{
|
||||||
pa_sample_spec ss;
|
pa_sample_spec ss;
|
||||||
pa_buffer_attr ba;
|
|
||||||
|
|
||||||
ss.channels = N_CHANNELS;
|
ss.channels = N_CHANNELS;
|
||||||
ss.rate = _samplerate;
|
ss.rate = _samplerate;
|
||||||
ss.format = PA_SAMPLE_FLOAT32LE;
|
ss.format = PA_SAMPLE_FLOAT32LE;
|
||||||
|
|
||||||
/* https://freedesktop.org/software/pulseaudio/doxygen/structpa__buffer__attr.html */
|
|
||||||
ba.minreq = _samples_per_period * N_CHANNELS * sizeof (float);
|
|
||||||
ba.maxlength = 2 * ba.minreq;
|
|
||||||
ba.prebuf = (uint32_t)-1;
|
|
||||||
ba.tlength = (uint32_t)-1;
|
|
||||||
ba.fragsize = 0; // capture only
|
|
||||||
|
|
||||||
if (!pa_sample_spec_valid (&ss)) {
|
if (!pa_sample_spec_valid (&ss)) {
|
||||||
PBD::error << _("PulseAudioBackend: Default sample spec not valid") << endmsg;
|
PBD::error << _("PulseAudioBackend: Default sample spec not valid") << endmsg;
|
||||||
return AudioDeviceInvalidError;
|
return AudioDeviceInvalidError;
|
||||||
|
|
@ -294,6 +285,14 @@ PulseAudioBackend::init_pulse ()
|
||||||
pa_stream_set_underflow_callback (p_stream, PulseAudioBackend::stream_xrun_cb, this);
|
pa_stream_set_underflow_callback (p_stream, PulseAudioBackend::stream_xrun_cb, this);
|
||||||
pa_stream_set_overflow_callback (p_stream, PulseAudioBackend::stream_xrun_cb, this);
|
pa_stream_set_overflow_callback (p_stream, PulseAudioBackend::stream_xrun_cb, this);
|
||||||
|
|
||||||
|
pa_buffer_attr ba;
|
||||||
|
/* https://freedesktop.org/software/pulseaudio/doxygen/structpa__buffer__attr.html */
|
||||||
|
ba.minreq = _samples_per_period * N_CHANNELS * sizeof (float);
|
||||||
|
ba.maxlength = 2 * ba.minreq;
|
||||||
|
ba.prebuf = (uint32_t)-1;
|
||||||
|
ba.tlength = (uint32_t)-1;
|
||||||
|
ba.fragsize = 0; // capture only
|
||||||
|
|
||||||
/* https://freedesktop.org/software/pulseaudio/doxygen/def_8h.html#a6966d809483170bc6d2e6c16188850fc */
|
/* https://freedesktop.org/software/pulseaudio/doxygen/def_8h.html#a6966d809483170bc6d2e6c16188850fc */
|
||||||
pa_stream_flags_t sf = (pa_stream_flags_t) (
|
pa_stream_flags_t sf = (pa_stream_flags_t) (
|
||||||
(int)PA_STREAM_START_CORKED
|
(int)PA_STREAM_START_CORKED
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue