mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 04:47:35 +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:
parent
fb109ab3b4
commit
8f2161c0ee
4 changed files with 32 additions and 0 deletions
|
@ -50,11 +50,16 @@ public:
|
|||
double volume() const { return m_volume; }
|
||||
void set_volume(double value);
|
||||
|
||||
bool is_muted() const { return m_muted; }
|
||||
void set_mute(bool);
|
||||
|
||||
void play();
|
||||
void pause();
|
||||
void toggle_pause();
|
||||
void stop();
|
||||
void seek(int sample);
|
||||
void mute();
|
||||
void toggle_mute();
|
||||
|
||||
virtual void play_state_changed(PlayState) = 0;
|
||||
virtual void loop_mode_changed(LoopMode) = 0;
|
||||
|
@ -64,6 +69,7 @@ public:
|
|||
virtual void audio_load_error(StringView, StringView) = 0;
|
||||
virtual void shuffle_mode_changed(ShuffleMode) = 0;
|
||||
virtual void volume_changed(double) = 0;
|
||||
virtual void mute_changed(bool) = 0;
|
||||
virtual void total_samples_changed(int) = 0;
|
||||
virtual void sound_buffer_played(RefPtr<Audio::Buffer>, [[maybe_unused]] int sample_rate, [[maybe_unused]] int samples_played) = 0;
|
||||
|
||||
|
@ -74,6 +80,7 @@ protected:
|
|||
set_loop_mode(LoopMode::None);
|
||||
time_elapsed(0);
|
||||
set_volume(1.);
|
||||
set_mute(false);
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -87,4 +94,5 @@ private:
|
|||
|
||||
String m_loaded_filename;
|
||||
double m_volume { 0 };
|
||||
bool m_muted { false };
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue