mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 17:10:23 +00:00
107011f119
This patch adds muting to ASMixer, which works by substituting what we would normally send to the sound card with zero-filled memory instead. We do it this way to ensure that the queued sample buffers keep getting played (silently.) This is obviously not the perfect way of doing this, and in the future we should improve on this, and also find a way to utilize any hardware mixing functions in the sound card.
30 lines
757 B
C++
30 lines
757 B
C++
#include <LibAudio/ABuffer.h>
|
|
#include <LibAudio/AClientConnection.h>
|
|
#include <stdio.h>
|
|
|
|
int main(int argc, char** argv)
|
|
{
|
|
CEventLoop loop;
|
|
auto audio_client = AClientConnection::construct();
|
|
audio_client->handshake();
|
|
|
|
if (argc > 1) {
|
|
if (String(argv[1]) == "-m") {
|
|
audio_client->set_muted(true);
|
|
printf("Muted.\n");
|
|
return 0;
|
|
}
|
|
if (String(argv[1]) == "-M") {
|
|
audio_client->set_muted(false);
|
|
printf("Unmuted.\n");
|
|
return 0;
|
|
}
|
|
|
|
int new_volume = atoi(argv[1]);
|
|
audio_client->set_main_mix_volume(new_volume);
|
|
}
|
|
|
|
int volume = audio_client->get_main_mix_volume();
|
|
printf("Volume: %d\n", volume);
|
|
return 0;
|
|
}
|