1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 23:07:35 +00:00

Piano: Use AudioServer instead of /dev/audio for audio

Piano is an old application that predates AudioServer. For this reason,
it was architected to directly talk to the soundcard via the /dev/audio
device. This caused multiple problems including simultaneous playback
issues, no ability to change volume/mute for Piano and more.

This change moves Piano to use AudioServer like any well-behaved audio
application :^) The track processing and IPC communication is moved to
the main thread because IPC doesn't like multi-threading. For this, the
new AudioPlayerLoop class is utilized that should evolve into the
DSP->AudioServer interface in the future.

Because Piano's CPU utilization has gotten so low (about 3-6%), the UI
update loop is switched back to render at exactly 60fps.

This is an important commit on the road to #6528.
This commit is contained in:
kleines Filmröllchen 2021-07-05 14:48:59 +02:00 committed by Andreas Kling
parent 9d00db618d
commit 9f1f3c6f37
2 changed files with 67 additions and 33 deletions

View file

@ -23,7 +23,7 @@ struct Sample {
i16 right;
};
constexpr int sample_count = 1024;
constexpr int sample_count = 1 << 9;
constexpr int buffer_size = sample_count * sizeof(Sample);