mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 19:38:12 +00:00
LibAudio: Put all classes in the Audio namespace and remove leading A
This commit is contained in:
parent
0bce5f7403
commit
92f77864de
20 changed files with 127 additions and 103 deletions
|
@ -26,7 +26,7 @@
|
|||
|
||||
#include "PlaybackManager.h"
|
||||
|
||||
PlaybackManager::PlaybackManager(NonnullRefPtr<AClientConnection> connection)
|
||||
PlaybackManager::PlaybackManager(NonnullRefPtr<Audio::ClientConnection> connection)
|
||||
: m_connection(connection)
|
||||
{
|
||||
m_timer = Core::Timer::construct(100, [&]() {
|
||||
|
@ -41,7 +41,7 @@ PlaybackManager::~PlaybackManager()
|
|||
{
|
||||
}
|
||||
|
||||
void PlaybackManager::set_loader(OwnPtr<AWavLoader>&& loader)
|
||||
void PlaybackManager::set_loader(OwnPtr<Audio::WavLoader>&& loader)
|
||||
{
|
||||
stop();
|
||||
m_loader = move(loader);
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
|
||||
class PlaybackManager final {
|
||||
public:
|
||||
PlaybackManager(NonnullRefPtr<AClientConnection>);
|
||||
PlaybackManager(NonnullRefPtr<Audio::ClientConnection>);
|
||||
~PlaybackManager();
|
||||
|
||||
void play();
|
||||
|
@ -44,14 +44,14 @@ public:
|
|||
void pause();
|
||||
void seek(const int position);
|
||||
bool toggle_pause();
|
||||
void set_loader(OwnPtr<AWavLoader>&&);
|
||||
void set_loader(OwnPtr<Audio::WavLoader>&&);
|
||||
|
||||
int last_seek() const { return m_last_seek; }
|
||||
bool is_paused() const { return m_paused; }
|
||||
float total_length() const { return m_total_length; }
|
||||
RefPtr<ABuffer> current_buffer() const { return m_current_buffer; }
|
||||
RefPtr<Audio::Buffer> current_buffer() const { return m_current_buffer; }
|
||||
|
||||
NonnullRefPtr<AClientConnection> connection() const { return m_connection; }
|
||||
NonnullRefPtr<Audio::ClientConnection> connection() const { return m_connection; }
|
||||
|
||||
Function<void()> on_update;
|
||||
|
||||
|
@ -65,10 +65,10 @@ private:
|
|||
int m_next_ptr { 0 };
|
||||
int m_last_seek { 0 };
|
||||
float m_total_length { 0 };
|
||||
OwnPtr<AWavLoader> m_loader { nullptr };
|
||||
NonnullRefPtr<AClientConnection> m_connection;
|
||||
RefPtr<ABuffer> m_next_buffer;
|
||||
RefPtr<ABuffer> m_current_buffer;
|
||||
Vector<RefPtr<ABuffer>> m_buffers;
|
||||
OwnPtr<Audio::WavLoader> m_loader { nullptr };
|
||||
NonnullRefPtr<Audio::ClientConnection> m_connection;
|
||||
RefPtr<Audio::Buffer> m_next_buffer;
|
||||
RefPtr<Audio::Buffer> m_current_buffer;
|
||||
Vector<RefPtr<Audio::Buffer>> m_buffers;
|
||||
RefPtr<Core::Timer> m_timer;
|
||||
};
|
||||
|
|
|
@ -77,7 +77,7 @@ void SampleWidget::paint_event(GUI::PaintEvent& event)
|
|||
}
|
||||
}
|
||||
|
||||
void SampleWidget::set_buffer(ABuffer* buffer)
|
||||
void SampleWidget::set_buffer(Audio::Buffer* buffer)
|
||||
{
|
||||
if (m_buffer == buffer)
|
||||
return;
|
||||
|
|
|
@ -28,17 +28,19 @@
|
|||
|
||||
#include <LibGUI/GFrame.h>
|
||||
|
||||
class ABuffer;
|
||||
namespace Audio {
|
||||
class Buffer;
|
||||
}
|
||||
|
||||
class SampleWidget final : public GUI::Frame {
|
||||
C_OBJECT(SampleWidget)
|
||||
public:
|
||||
virtual ~SampleWidget() override;
|
||||
|
||||
void set_buffer(ABuffer*);
|
||||
void set_buffer(Audio::Buffer*);
|
||||
private:
|
||||
explicit SampleWidget(GUI::Widget* parent);
|
||||
virtual void paint_event(GUI::PaintEvent&) override;
|
||||
|
||||
RefPtr<ABuffer> m_buffer;
|
||||
RefPtr<Audio::Buffer> m_buffer;
|
||||
};
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
#include <LibGUI/GMessageBox.h>
|
||||
#include <LibM/math.h>
|
||||
|
||||
SoundPlayerWidget::SoundPlayerWidget(GUI::Window& window, NonnullRefPtr<AClientConnection> connection)
|
||||
SoundPlayerWidget::SoundPlayerWidget(GUI::Window& window, NonnullRefPtr<Audio::ClientConnection> connection)
|
||||
: m_window(window)
|
||||
, m_connection(connection)
|
||||
, m_manager(connection)
|
||||
|
@ -124,7 +124,7 @@ void SoundPlayerWidget::open_file(String path)
|
|||
return;
|
||||
}
|
||||
|
||||
OwnPtr<AWavLoader> loader = make<AWavLoader>(path);
|
||||
OwnPtr<Audio::WavLoader> loader = make<Audio::WavLoader>(path);
|
||||
if (loader->has_error()) {
|
||||
GUI::MessageBox::show(
|
||||
String::format(
|
||||
|
|
|
@ -43,7 +43,7 @@ public:
|
|||
PlaybackManager& manager() { return m_manager; }
|
||||
|
||||
private:
|
||||
explicit SoundPlayerWidget(GUI::Window&, NonnullRefPtr<AClientConnection>);
|
||||
explicit SoundPlayerWidget(GUI::Window&, NonnullRefPtr<Audio::ClientConnection>);
|
||||
|
||||
void update_position(const int position);
|
||||
void update_ui();
|
||||
|
@ -77,7 +77,7 @@ private:
|
|||
};
|
||||
|
||||
GUI::Window& m_window;
|
||||
NonnullRefPtr<AClientConnection> m_connection;
|
||||
NonnullRefPtr<Audio::ClientConnection> m_connection;
|
||||
PlaybackManager m_manager;
|
||||
float m_sample_ratio;
|
||||
RefPtr<GUI::Label> m_status;
|
||||
|
|
|
@ -50,7 +50,7 @@ int main(int argc, char** argv)
|
|||
return 1;
|
||||
}
|
||||
|
||||
auto audio_client = AClientConnection::construct();
|
||||
auto audio_client = Audio::ClientConnection::construct();
|
||||
audio_client->handshake();
|
||||
|
||||
if (pledge("stdio shared_buffer accept rpath", nullptr) < 0) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue