Commit ca88fc4e authored by Max Kellermann's avatar Max Kellermann

output/jack: cache AudioFormat::channels

parent b83a1d79
...@@ -643,15 +643,14 @@ mpd_jack_delay(AudioOutput *ao) ...@@ -643,15 +643,14 @@ mpd_jack_delay(AudioOutput *ao)
inline size_t inline size_t
JackOutput::WriteSamples(const float *src, size_t n_frames) JackOutput::WriteSamples(const float *src, size_t n_frames)
{ {
const unsigned n_channels = audio_format.channels;
const size_t result = n_frames; const size_t result = n_frames;
while (n_frames-- > 0) { while (n_frames-- > 0)
for (unsigned i = 0; i < audio_format.channels; ++i, ++src) { for (unsigned i = 0; i < n_channels; ++i, ++src)
jack_ringbuffer_write(ringbuffer[i], jack_ringbuffer_write(ringbuffer[i],
(const char *)src, (const char *)src,
sizeof(*src)); sizeof(*src));
}
}
return result; return result;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment