mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 01:47:34 +00:00
SoundPlayer: Add playlist supprt
And a M3U(8) parser
This commit is contained in:
parent
e4d6a56a28
commit
2e28b8ebcc
10 changed files with 586 additions and 57 deletions
|
@ -27,6 +27,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "PlaybackManager.h"
|
||||
#include "PlaylistWidget.h"
|
||||
#include "VisualizationBase.h"
|
||||
#include <AK/RefPtr.h>
|
||||
|
||||
|
@ -34,11 +35,13 @@ struct PlayerState {
|
|||
bool is_paused;
|
||||
bool is_stopped;
|
||||
bool has_loaded_file;
|
||||
bool is_looping;
|
||||
bool is_looping_file;
|
||||
bool is_looping_playlist;
|
||||
int loaded_file_samplerate;
|
||||
double volume;
|
||||
Audio::ClientConnection& connection;
|
||||
PlaybackManager& manager;
|
||||
StringView loaded_filename;
|
||||
String loaded_filename;
|
||||
};
|
||||
|
||||
class Player {
|
||||
|
@ -53,17 +56,27 @@ public:
|
|||
bool is_paused() const { return m_player_state.is_paused; }
|
||||
bool has_loaded_file() const { return m_player_state.has_loaded_file; }
|
||||
double volume() const { return m_player_state.volume; }
|
||||
bool looping() const { return m_player_state.is_looping; }
|
||||
StringView& loaded_filename() { return m_player_state.loaded_filename; }
|
||||
bool looping() const { return m_player_state.is_looping_file; }
|
||||
bool looping_playlist() const { return m_player_state.is_looping_playlist; }
|
||||
const String& loaded_filename() { return m_player_state.loaded_filename; }
|
||||
int loaded_file_samplerate() { return m_player_state.loaded_file_samplerate; }
|
||||
|
||||
virtual void set_stopped(bool stopped) { m_player_state.is_stopped = stopped; }
|
||||
virtual void set_paused(bool paused) { m_player_state.is_paused = paused; }
|
||||
virtual void set_has_loaded_file(bool loaded) { m_player_state.has_loaded_file = loaded; }
|
||||
virtual void set_volume(double volume) { m_player_state.volume = volume; }
|
||||
virtual void set_looping(bool loop)
|
||||
virtual void set_volume(double volume)
|
||||
{
|
||||
m_player_state.is_looping = loop;
|
||||
manager().loop(loop);
|
||||
m_player_state.volume = volume;
|
||||
client_connection().set_main_mix_volume((double)(volume * 100));
|
||||
}
|
||||
virtual void set_loaded_file_samplerate(int samplerate) { m_player_state.loaded_file_samplerate = samplerate; }
|
||||
virtual void set_looping_file(bool loop)
|
||||
{
|
||||
m_player_state.is_looping_file = loop;
|
||||
}
|
||||
virtual void set_looping_playlist(bool loop)
|
||||
{
|
||||
m_player_state.is_looping_playlist = loop;
|
||||
}
|
||||
virtual void set_loaded_filename(StringView& filename) { m_player_state.loaded_filename = filename; }
|
||||
|
||||
|
@ -72,4 +85,5 @@ public:
|
|||
|
||||
protected:
|
||||
PlayerState m_player_state;
|
||||
RefPtr<PlaylistModel> m_playlist_model;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue