diff options
| author | jacqueline <me@jacqueline.id.au> | 2024-08-27 21:17:53 +1000 |
|---|---|---|
| committer | jacqueline <me@jacqueline.id.au> | 2024-08-28 09:45:19 +1000 |
| commit | f253d2ee7568b61ce2fab962f7328a50e2da6adf (patch) | |
| tree | 394969e7827134684493b499503d7a08918a8867 /src/drivers/include | |
| parent | ef227f8c518f2b6cfd5e55ca052a12e70515f2ef (diff) | |
| download | tangara-fw-f253d2ee7568b61ce2fab962f7328a50e2da6adf.tar.gz | |
Timeout when writing output samples throughout the audio pipeline
This allows the audio pipeline to remain responsive even when the drain
buffer has completely filled. This in turn means that you now see the
track info in the 'now playing' screen change if the current track
changes whilst you are paused.
Since I was fucking around a lot in the audio processor anyway, I also
added mono->stereo expansion so that playing mono tracks on Bluetooth no
longer destroys your ears.
Diffstat (limited to 'src/drivers/include')
| -rw-r--r-- | src/drivers/include/drivers/pcm_buffer.hpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/drivers/include/drivers/pcm_buffer.hpp b/src/drivers/include/drivers/pcm_buffer.hpp index 6630f720..8f53317e 100644 --- a/src/drivers/include/drivers/pcm_buffer.hpp +++ b/src/drivers/include/drivers/pcm_buffer.hpp @@ -28,8 +28,12 @@ class PcmBuffer { PcmBuffer(size_t size_in_samples); ~PcmBuffer(); - /* Adds samples to the buffer. */ - auto send(std::span<const int16_t>) -> void; + /* + * Adds samples to the buffer. Returns the number of samples that were added, + * which may be less than the number of samples given if this PcmBuffer is + * close to full. + */ + auto send(std::span<const int16_t>) -> size_t; /* * Fills the given span with samples. If enough samples are available in |
