LibWeb: Expose volume controls through the platform audio plugin

This commit is contained in:
Timothy Flynn 2023-06-14 12:59:22 -04:00 committed by Andreas Kling
parent d364d99cb8
commit d3b8d88598
Notes: sideshowbarker 2024-07-16 22:18:54 +09:00
5 changed files with 16 additions and 0 deletions

View file

@ -86,4 +86,9 @@ void AudioCodecPluginLadybird::playback_ended()
m_audio_output->suspend(); m_audio_output->suspend();
} }
void AudioCodecPluginLadybird::set_volume(double volume)
{
m_audio_output->setVolume(volume);
}
} }

View file

@ -31,6 +31,8 @@ public:
virtual void pause_playback() override; virtual void pause_playback() override;
virtual void playback_ended() override; virtual void playback_ended() override;
virtual void set_volume(double) override;
private: private:
AudioCodecPluginLadybird(NonnullOwnPtr<QMediaDevices>, NonnullOwnPtr<QAudioSink>); AudioCodecPluginLadybird(NonnullOwnPtr<QMediaDevices>, NonnullOwnPtr<QAudioSink>);

View file

@ -30,6 +30,8 @@ public:
virtual void pause_playback() = 0; virtual void pause_playback() = 0;
virtual void playback_ended() = 0; virtual void playback_ended() = 0;
virtual void set_volume(double) = 0;
protected: protected:
AudioCodecPlugin(); AudioCodecPlugin();
}; };

View file

@ -56,4 +56,9 @@ void AudioCodecPluginSerenity::playback_ended()
m_connection->async_clear_buffer(); m_connection->async_clear_buffer();
} }
void AudioCodecPluginSerenity::set_volume(double volume)
{
m_connection->async_set_self_volume(volume);
}
} }

View file

@ -28,6 +28,8 @@ public:
virtual void pause_playback() override; virtual void pause_playback() override;
virtual void playback_ended() override; virtual void playback_ended() override;
virtual void set_volume(double) override;
private: private:
explicit AudioCodecPluginSerenity(NonnullRefPtr<Audio::ConnectionToServer>); explicit AudioCodecPluginSerenity(NonnullRefPtr<Audio::ConnectionToServer>);