diff --git a/src/lib/alsa/PeriodBuffer.hxx b/src/lib/alsa/PeriodBuffer.hxx index ee27fdedc..9b6a31304 100644 --- a/src/lib/alsa/PeriodBuffer.hxx +++ b/src/lib/alsa/PeriodBuffer.hxx @@ -42,7 +42,7 @@ namespace Alsa { class PeriodBuffer { size_t capacity, head, tail; - uint8_t *buffer; + std::byte *buffer; public: PeriodBuffer() = default; @@ -56,7 +56,7 @@ public: to be able to fill the buffer with silence, after moving an unfinished frame to the end */ - buffer = new uint8_t[capacity + frame_size - 1]; + buffer = new std::byte[capacity + frame_size - 1]; head = tail = 0; } @@ -95,7 +95,7 @@ public: * copied to the returned pointer, and call AppendBytes() to * commit the operation. */ - uint8_t *GetTail() noexcept { + std::byte *GetTail() noexcept { assert(!IsFull()); return buffer + tail; @@ -131,7 +131,7 @@ public: * * @param _silence one period worth of silence */ - void FillWithSilence(const uint8_t *_silence, + void FillWithSilence(const std::byte *_silence, const size_t frame_size) noexcept { assert(!IsFull()); @@ -153,7 +153,7 @@ public: * from the returned pointer, and call ConsumeBytes() to * commit the operation. */ - const uint8_t *GetHead() const noexcept { + const std::byte *GetHead() const noexcept { return buffer + head; } diff --git a/src/output/plugins/AlsaOutputPlugin.cxx b/src/output/plugins/AlsaOutputPlugin.cxx index 6e8d08967..db209416e 100644 --- a/src/output/plugins/AlsaOutputPlugin.cxx +++ b/src/output/plugins/AlsaOutputPlugin.cxx @@ -223,14 +223,14 @@ class AlsaOutput final * It contains silence samples, enough to fill one period (see * #period_frames). */ - uint8_t *silence; + std::byte *silence; AlsaNonBlockPcm non_block; /** * For copying data from OutputThread to IOThread. */ - boost::lockfree::spsc_queue *ring_buffer; + boost::lockfree::spsc_queue *ring_buffer; Alsa::PeriodBuffer period_buffer; @@ -585,7 +585,7 @@ AlsaOutput::Setup(AudioFormat &audio_format, in the ALSA-PCM buffer */ max_avail_frames = hw_result.buffer_size - hw_result.period_size; - silence = new uint8_t[snd_pcm_frames_to_bytes(pcm, alsa_period_size)]; + silence = new std::byte[snd_pcm_frames_to_bytes(pcm, alsa_period_size)]; snd_pcm_format_set_silence(hw_result.format, silence, alsa_period_size * audio_format.channels); @@ -874,7 +874,7 @@ AlsaOutput::Open(AudioFormat &audio_format) interrupted = false; size_t period_size = period_frames * out_frame_size; - ring_buffer = new boost::lockfree::spsc_queue(period_size * 4); + ring_buffer = new boost::lockfree::spsc_queue(period_size * 4); period_buffer.Allocate(period_frames, out_frame_size); @@ -1234,8 +1234,7 @@ AlsaOutput::Play(const void *chunk, size_t size) if (e.empty()) return size; - size_t bytes_written = ring_buffer->push((const uint8_t *)e.data(), - e.size()); + size_t bytes_written = ring_buffer->push(e.data(), e.size()); assert(bytes_written == e.size()); (void)bytes_written;