diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-07-29 19:06:58 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-07-29 19:06:58 +0200 |
commit | 15afc88ffefa5b9641107834c87b8674c7fa3fa9 (patch) | |
tree | 776ccd065e303ed831231568ccca4df4556a6b42 /Libraries/LibAudio/ABuffer.h | |
parent | 2feddc58bbecd8da5cfb175082cc3dd1b72ef455 (diff) | |
download | serenity-15afc88ffefa5b9641107834c87b8674c7fa3fa9.zip |
AudioServer: Add a "main mix volume" and a simple program to get/set it
Give the mixer a main volume value (percent) that we scale all the
outgoing samples by (before clipping.)
Also add a simple "avol" program for querying and setting the volume:
- "avol" prints the current volume.
- "avol 200" sets the main mix volume to 200%
Diffstat (limited to 'Libraries/LibAudio/ABuffer.h')
-rw-r--r-- | Libraries/LibAudio/ABuffer.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Libraries/LibAudio/ABuffer.h b/Libraries/LibAudio/ABuffer.h index a8a7d2a580..287c0a738f 100644 --- a/Libraries/LibAudio/ABuffer.h +++ b/Libraries/LibAudio/ABuffer.h @@ -39,6 +39,13 @@ struct ASample { right = -1; } + void scale(int percent) + { + float pct = (float)percent / 100.0; + left *= pct; + right *= pct; + } + ASample& operator+=(const ASample& other) { left += other.left; |