From 7aa52978359c721cb283bab786a36943dc5b3e20 Mon Sep 17 00:00:00 2001 From: Cesar Torres Date: Sun, 21 Mar 2021 13:01:33 +0100 Subject: SoundPlayer: Update the SoundPlayer interface Also fix rebase conflict --- .../Applications/SoundPlayer/SoundPlayerWidget.h | 45 ++++++---------------- 1 file changed, 12 insertions(+), 33 deletions(-) (limited to 'Userland/Applications/SoundPlayer/SoundPlayerWidget.h') diff --git a/Userland/Applications/SoundPlayer/SoundPlayerWidget.h b/Userland/Applications/SoundPlayer/SoundPlayerWidget.h index ab7bc60aea..9f01a552ee 100644 --- a/Userland/Applications/SoundPlayer/SoundPlayerWidget.h +++ b/Userland/Applications/SoundPlayer/SoundPlayerWidget.h @@ -26,24 +26,28 @@ #pragma once +#include "Common.h" #include "PlaybackManager.h" +#include "Player.h" #include "SampleWidget.h" +#include #include #include -#include #include #include -class SoundPlayerWidget final : public GUI::Widget { +class SoundPlayerWidget final : public GUI::Widget + , public Player { C_OBJECT(SoundPlayerWidget) public: virtual ~SoundPlayerWidget() override; - void open_file(String path); + void open_file(StringView path) override; void hide_scope(bool); - PlaybackManager& manager() { return m_manager; } + Audio::ClientConnection& client_connection() override { return m_connection; } + PlaybackManager& playback_manager() override { return m_manager; } private: - explicit SoundPlayerWidget(GUI::Window&, NonnullRefPtr); + explicit SoundPlayerWidget(GUI::Window& window, Audio::ClientConnection& connection, PlaybackManager& manager); virtual void drop_event(GUI::DropEvent&) override; @@ -52,35 +56,10 @@ private: int normalize_rate(int) const; int denormalize_rate(int) const; - class Slider final : public GUI::Slider { - C_OBJECT(Slider) - public: - virtual ~Slider() override; - Function on_knob_released; - void set_value(int value) - { - if (!knob_dragging()) - GUI::Slider::set_value(value); - } - - protected: - Slider(Orientation orientation) - : GUI::Slider(orientation) - { - } - - virtual void mouseup_event(GUI::MouseEvent& event) override - { - if (on_knob_released && is_enabled()) - on_knob_released(value()); - - GUI::Slider::mouseup_event(event); - } - }; - GUI::Window& m_window; - NonnullRefPtr m_connection; - PlaybackManager m_manager; + Audio::ClientConnection& m_connection; + PlaybackManager& m_manager; + float m_sample_ratio { 1.0 }; RefPtr m_status; RefPtr m_elapsed; -- cgit v1.2.3