mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 17:40:27 +00:00
6b88e43b3b
https://github.com/google/oboe There are many ways to implement audio for Android, however this is the recommended way to do it.
36 lines
1.1 KiB
C++
36 lines
1.1 KiB
C++
/*
|
|
* Copyright (c) 2024, Olekoop <mlglol360xd@gmail.com>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AK/Error.h>
|
|
#include <AK/NonnullRefPtr.h>
|
|
#include <LibAudio/PlaybackStream.h>
|
|
|
|
namespace Audio {
|
|
|
|
class PlaybackStreamOboe final : public PlaybackStream {
|
|
public:
|
|
static ErrorOr<NonnullRefPtr<PlaybackStream>> create(OutputState initial_output_state, u32 sample_rate, u8 channels, u32 target_latency_ms, AudioDataRequestCallback&& data_request_callback);
|
|
|
|
virtual void set_underrun_callback(Function<void()>) override;
|
|
|
|
virtual NonnullRefPtr<Core::ThreadedPromise<Duration>> resume() override;
|
|
virtual NonnullRefPtr<Core::ThreadedPromise<void>> drain_buffer_and_suspend() override;
|
|
virtual NonnullRefPtr<Core::ThreadedPromise<void>> discard_buffer_and_suspend() override;
|
|
|
|
virtual ErrorOr<Duration> total_time_played() override;
|
|
|
|
virtual NonnullRefPtr<Core::ThreadedPromise<void>> set_volume(double) override;
|
|
|
|
private:
|
|
class Storage;
|
|
explicit PlaybackStreamOboe(NonnullRefPtr<Storage>);
|
|
~PlaybackStreamOboe();
|
|
RefPtr<Storage> m_storage;
|
|
};
|
|
|
|
}
|