mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 04:27:44 +00:00
SoundPlayer: Add start_new_file() to VisualizationWidget's API
This adds a new start_new_file() function to VisualizationWidget which is called when the player starts a new file, passing the filename of the file. This allows VisualizationWidget subclasses to do any setup needed when a new file is started.
This commit is contained in:
parent
064cfd6cb7
commit
2e1c017bce
3 changed files with 4 additions and 0 deletions
|
@ -206,6 +206,7 @@ void SoundPlayerWidgetAdvancedView::time_elapsed(int seconds)
|
|||
|
||||
void SoundPlayerWidgetAdvancedView::file_name_changed(StringView name)
|
||||
{
|
||||
m_visualization->start_new_file(name);
|
||||
m_window.set_title(String::formatted("{} - Sound Player", name));
|
||||
}
|
||||
|
||||
|
|
|
@ -32,6 +32,8 @@ public:
|
|||
auto new_visualization = T::construct();
|
||||
m_player_view->insert_child_before(new_visualization, *static_cast<Core::Object*>(m_playback_progress_slider.ptr()));
|
||||
m_visualization = new_visualization;
|
||||
if (!loaded_filename().is_empty())
|
||||
m_visualization->start_new_file(loaded_filename());
|
||||
}
|
||||
|
||||
virtual void play_state_changed(PlayState) override;
|
||||
|
|
|
@ -15,6 +15,7 @@ class VisualizationWidget : public GUI::Frame {
|
|||
public:
|
||||
virtual void set_buffer(RefPtr<Audio::Buffer> buffer) = 0;
|
||||
virtual void set_samplerate(int) { }
|
||||
virtual void start_new_file(StringView) { }
|
||||
|
||||
protected:
|
||||
VisualizationWidget() = default;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue