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

SoundPlayer: Add 'mute' methods to Player

These methods allow us to mute/unmute the player without needing to
modify the volume level that it has.
This commit is contained in:
Elyse 2021-11-01 19:31:05 -06:00 committed by Brian Gianforcaro
parent fb109ab3b4
commit 8f2161c0ee
4 changed files with 32 additions and 0 deletions

View file

@ -99,6 +99,15 @@ void Player::set_volume(double volume)
volume_changed(m_volume);
}
void Player::set_mute(bool muted)
{
if (m_muted != muted) {
m_muted = muted;
m_audio_client_connection.set_self_muted(muted);
mute_changed(muted);
}
}
void Player::set_shuffle_mode(ShuffleMode mode)
{
if (m_shuffle_mode != mode) {
@ -132,6 +141,16 @@ void Player::stop()
set_play_state(PlayState::Stopped);
}
void Player::mute()
{
set_mute(true);
}
void Player::toggle_mute()
{
set_mute(!m_muted);
}
void Player::seek(int sample)
{
m_playback_manager.seek(sample);