Merge pull request #1394 from lioncash/stream

stream: Preserve enum class type in GetState()
This commit is contained in:
bunnei 2018-09-27 17:05:03 -04:00 committed by GitHub
commit fc2419e441
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 12 additions and 12 deletions

View File

@ -79,7 +79,7 @@ u32 AudioRenderer::GetMixBufferCount() const {
return worker_params.mix_buffer_count; return worker_params.mix_buffer_count;
} }
u32 AudioRenderer::GetState() const { Stream::State AudioRenderer::GetStreamState() const {
return stream->GetState(); return stream->GetState();
} }

View File

@ -170,7 +170,7 @@ public:
u32 GetSampleRate() const; u32 GetSampleRate() const;
u32 GetSampleCount() const; u32 GetSampleCount() const;
u32 GetMixBufferCount() const; u32 GetMixBufferCount() const;
u32 GetState() const; Stream::State GetStreamState() const;
private: private:
class VoiceState; class VoiceState;

View File

@ -53,8 +53,8 @@ void Stream::Stop() {
ASSERT_MSG(false, "Unimplemented"); ASSERT_MSG(false, "Unimplemented");
} }
u32 Stream::GetState() const { Stream::State Stream::GetState() const {
return static_cast<u32>(state); return state;
} }
s64 Stream::GetBufferReleaseCycles(const Buffer& buffer) const { s64 Stream::GetBufferReleaseCycles(const Buffer& buffer) const {

View File

@ -33,6 +33,12 @@ public:
Multi51Channel16, Multi51Channel16,
}; };
/// Current state of the stream
enum class State {
Stopped,
Playing,
};
/// Callback function type, used to change guest state on a buffer being released /// Callback function type, used to change guest state on a buffer being released
using ReleaseCallback = std::function<void()>; using ReleaseCallback = std::function<void()>;
@ -73,15 +79,9 @@ public:
u32 GetNumChannels() const; u32 GetNumChannels() const;
/// Get the state /// Get the state
u32 GetState() const; State GetState() const;
private: private:
/// Current state of the stream
enum class State {
Stopped,
Playing,
};
/// Plays the next queued buffer in the audio stream, starting playback if necessary /// Plays the next queued buffer in the audio stream, starting playback if necessary
void PlayNextBuffer(); void PlayNextBuffer();

View File

@ -66,7 +66,7 @@ private:
void GetAudioRendererState(Kernel::HLERequestContext& ctx) { void GetAudioRendererState(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 3}; IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.Push<u32>(renderer->GetState()); rb.Push<u32>(static_cast<u32>(renderer->GetStreamState()));
LOG_DEBUG(Service_Audio, "called"); LOG_DEBUG(Service_Audio, "called");
} }