mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-29 14:57:41 -05:00
Merge pull request #1391 from ogniK5377/GetAudioRendererState
Added audren:u#GetAudioRendererState
This commit is contained in:
commit
d373a65d26
5 changed files with 21 additions and 1 deletions
|
@ -79,6 +79,10 @@ u32 AudioRenderer::GetMixBufferCount() const {
|
||||||
return worker_params.mix_buffer_count;
|
return worker_params.mix_buffer_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
u32 AudioRenderer::GetState() const {
|
||||||
|
return stream->GetState();
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<u8> AudioRenderer::UpdateAudioRenderer(const std::vector<u8>& input_params) {
|
std::vector<u8> AudioRenderer::UpdateAudioRenderer(const std::vector<u8>& input_params) {
|
||||||
// Copy UpdateDataHeader struct
|
// Copy UpdateDataHeader struct
|
||||||
UpdateDataHeader config{};
|
UpdateDataHeader config{};
|
||||||
|
|
|
@ -170,6 +170,7 @@ public:
|
||||||
u32 GetSampleRate() const;
|
u32 GetSampleRate() const;
|
||||||
u32 GetSampleCount() const;
|
u32 GetSampleCount() const;
|
||||||
u32 GetMixBufferCount() const;
|
u32 GetMixBufferCount() const;
|
||||||
|
u32 GetState() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
class VoiceState;
|
class VoiceState;
|
||||||
|
|
|
@ -49,9 +49,14 @@ void Stream::Play() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Stream::Stop() {
|
void Stream::Stop() {
|
||||||
|
state = State::Stopped;
|
||||||
ASSERT_MSG(false, "Unimplemented");
|
ASSERT_MSG(false, "Unimplemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
u32 Stream::GetState() const {
|
||||||
|
return static_cast<u32>(state);
|
||||||
|
}
|
||||||
|
|
||||||
s64 Stream::GetBufferReleaseCycles(const Buffer& buffer) const {
|
s64 Stream::GetBufferReleaseCycles(const Buffer& buffer) const {
|
||||||
const std::size_t num_samples{buffer.GetSamples().size() / GetNumChannels()};
|
const std::size_t num_samples{buffer.GetSamples().size() / GetNumChannels()};
|
||||||
return CoreTiming::usToCycles((static_cast<u64>(num_samples) * 1000000) / sample_rate);
|
return CoreTiming::usToCycles((static_cast<u64>(num_samples) * 1000000) / sample_rate);
|
||||||
|
|
|
@ -72,6 +72,9 @@ public:
|
||||||
/// Gets the number of channels
|
/// Gets the number of channels
|
||||||
u32 GetNumChannels() const;
|
u32 GetNumChannels() const;
|
||||||
|
|
||||||
|
/// Get the state
|
||||||
|
u32 GetState() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// Current state of the stream
|
/// Current state of the stream
|
||||||
enum class State {
|
enum class State {
|
||||||
|
|
|
@ -25,7 +25,7 @@ public:
|
||||||
{0, &IAudioRenderer::GetAudioRendererSampleRate, "GetAudioRendererSampleRate"},
|
{0, &IAudioRenderer::GetAudioRendererSampleRate, "GetAudioRendererSampleRate"},
|
||||||
{1, &IAudioRenderer::GetAudioRendererSampleCount, "GetAudioRendererSampleCount"},
|
{1, &IAudioRenderer::GetAudioRendererSampleCount, "GetAudioRendererSampleCount"},
|
||||||
{2, &IAudioRenderer::GetAudioRendererMixBufferCount, "GetAudioRendererMixBufferCount"},
|
{2, &IAudioRenderer::GetAudioRendererMixBufferCount, "GetAudioRendererMixBufferCount"},
|
||||||
{3, nullptr, "GetAudioRendererState"},
|
{3, &IAudioRenderer::GetAudioRendererState, "GetAudioRendererState"},
|
||||||
{4, &IAudioRenderer::RequestUpdateAudioRenderer, "RequestUpdateAudioRenderer"},
|
{4, &IAudioRenderer::RequestUpdateAudioRenderer, "RequestUpdateAudioRenderer"},
|
||||||
{5, &IAudioRenderer::StartAudioRenderer, "StartAudioRenderer"},
|
{5, &IAudioRenderer::StartAudioRenderer, "StartAudioRenderer"},
|
||||||
{6, &IAudioRenderer::StopAudioRenderer, "StopAudioRenderer"},
|
{6, &IAudioRenderer::StopAudioRenderer, "StopAudioRenderer"},
|
||||||
|
@ -62,6 +62,13 @@ private:
|
||||||
LOG_DEBUG(Service_Audio, "called");
|
LOG_DEBUG(Service_Audio, "called");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GetAudioRendererState(Kernel::HLERequestContext& ctx) {
|
||||||
|
IPC::ResponseBuilder rb{ctx, 3};
|
||||||
|
rb.Push(RESULT_SUCCESS);
|
||||||
|
rb.Push<u32>(renderer->GetState());
|
||||||
|
LOG_DEBUG(Service_Audio, "called");
|
||||||
|
}
|
||||||
|
|
||||||
void GetAudioRendererMixBufferCount(Kernel::HLERequestContext& ctx) {
|
void GetAudioRendererMixBufferCount(Kernel::HLERequestContext& ctx) {
|
||||||
IPC::ResponseBuilder rb{ctx, 3};
|
IPC::ResponseBuilder rb{ctx, 3};
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
|
|
Loading…
Reference in a new issue