1
0
Fork 0
forked from suyu/suyu

Added audren:u#GetAudioRendererState

This commit is contained in:
David Marcec 2018-09-23 22:32:01 +10:00
parent 93fea4e179
commit c461188f51
5 changed files with 21 additions and 1 deletions

View file

@ -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{};

View file

@ -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;

View file

@ -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);

View file

@ -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 {

View file

@ -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);