mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 20:37:34 +00:00
LibAudio: Add a Serenity implementation of PlaybackStream
This implementation is very naive compared to the PulseAudio one. Instead of using a callback implemented by the audio server connection to push audio to the buffer, we have to poll on a timer to check when we need to push the audio buffers. Implementing cross-process condition variables into the audio queue class could allow us to avoid polling, which may prove beneficial to CPU usage. Audio timestamps will be accurate to the number of samples available, but will count in increments of about 100ms and run ahead of the actual audio being pushed to the device by the server. Buffer underruns are completely ignored for now as well, since the `AudioServer` has no way to know how many samples are actually written in a single audio buffer.
This commit is contained in:
parent
2caf68fd03
commit
bb156f8133
7 changed files with 185 additions and 3 deletions
|
@ -54,6 +54,8 @@ public:
|
|||
// How many buffers (i.e. short sample arrays) the server hasn't played yet.
|
||||
// Non-realtime code needn't worry about this.
|
||||
size_t remaining_buffers() const;
|
||||
// Whether there is room in the realtime audio queue for another sample buffer.
|
||||
bool can_enqueue() const;
|
||||
|
||||
void set_self_sample_rate(u32 sample_rate);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue