summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar bunnei2018-09-27 17:05:03 -0400
committerGravatar GitHub2018-09-27 17:05:03 -0400
commitfc2419e441dbd2270460c8fe7a92e515c0789fa5 (patch)
treeb424962d98ee97013c5c67ef8913c4a2aaf9e0c2 /src
parentMerge pull request #1389 from PhiBabin/valgrind (diff)
parentstream: Preserve enum class type in GetState() (diff)
downloadyuzu-fc2419e441dbd2270460c8fe7a92e515c0789fa5.tar.gz
yuzu-fc2419e441dbd2270460c8fe7a92e515c0789fa5.tar.xz
yuzu-fc2419e441dbd2270460c8fe7a92e515c0789fa5.zip
Merge pull request #1394 from lioncash/stream
stream: Preserve enum class type in GetState()
Diffstat (limited to 'src')
-rw-r--r--src/audio_core/audio_renderer.cpp2
-rw-r--r--src/audio_core/audio_renderer.h2
-rw-r--r--src/audio_core/stream.cpp4
-rw-r--r--src/audio_core/stream.h14
-rw-r--r--src/core/hle/service/audio/audren_u.cpp2
5 files changed, 12 insertions, 12 deletions
diff --git a/src/audio_core/audio_renderer.cpp b/src/audio_core/audio_renderer.cpp
index 521b19ff7..6f0ff953a 100644
--- a/src/audio_core/audio_renderer.cpp
+++ b/src/audio_core/audio_renderer.cpp
@@ -79,7 +79,7 @@ u32 AudioRenderer::GetMixBufferCount() const {
79 return worker_params.mix_buffer_count; 79 return worker_params.mix_buffer_count;
80} 80}
81 81
82u32 AudioRenderer::GetState() const { 82Stream::State AudioRenderer::GetStreamState() const {
83 return stream->GetState(); 83 return stream->GetState();
84} 84}
85 85
diff --git a/src/audio_core/audio_renderer.h b/src/audio_core/audio_renderer.h
index be923ee65..dfef89e1d 100644
--- a/src/audio_core/audio_renderer.h
+++ b/src/audio_core/audio_renderer.h
@@ -170,7 +170,7 @@ public:
170 u32 GetSampleRate() const; 170 u32 GetSampleRate() const;
171 u32 GetSampleCount() const; 171 u32 GetSampleCount() const;
172 u32 GetMixBufferCount() const; 172 u32 GetMixBufferCount() const;
173 u32 GetState() const; 173 Stream::State GetStreamState() const;
174 174
175private: 175private:
176 class VoiceState; 176 class VoiceState;
diff --git a/src/audio_core/stream.cpp b/src/audio_core/stream.cpp
index ee4aa98af..742a5e0a0 100644
--- a/src/audio_core/stream.cpp
+++ b/src/audio_core/stream.cpp
@@ -53,8 +53,8 @@ void Stream::Stop() {
53 ASSERT_MSG(false, "Unimplemented"); 53 ASSERT_MSG(false, "Unimplemented");
54} 54}
55 55
56u32 Stream::GetState() const { 56Stream::State Stream::GetState() const {
57 return static_cast<u32>(state); 57 return state;
58} 58}
59 59
60s64 Stream::GetBufferReleaseCycles(const Buffer& buffer) const { 60s64 Stream::GetBufferReleaseCycles(const Buffer& buffer) const {
diff --git a/src/audio_core/stream.h b/src/audio_core/stream.h
index 43eca74e1..aebfeb51d 100644
--- a/src/audio_core/stream.h
+++ b/src/audio_core/stream.h
@@ -33,6 +33,12 @@ public:
33 Multi51Channel16, 33 Multi51Channel16,
34 }; 34 };
35 35
36 /// Current state of the stream
37 enum class State {
38 Stopped,
39 Playing,
40 };
41
36 /// Callback function type, used to change guest state on a buffer being released 42 /// Callback function type, used to change guest state on a buffer being released
37 using ReleaseCallback = std::function<void()>; 43 using ReleaseCallback = std::function<void()>;
38 44
@@ -73,15 +79,9 @@ public:
73 u32 GetNumChannels() const; 79 u32 GetNumChannels() const;
74 80
75 /// Get the state 81 /// Get the state
76 u32 GetState() const; 82 State GetState() const;
77 83
78private: 84private:
79 /// Current state of the stream
80 enum class State {
81 Stopped,
82 Playing,
83 };
84
85 /// Plays the next queued buffer in the audio stream, starting playback if necessary 85 /// Plays the next queued buffer in the audio stream, starting playback if necessary
86 void PlayNextBuffer(); 86 void PlayNextBuffer();
87 87
diff --git a/src/core/hle/service/audio/audren_u.cpp b/src/core/hle/service/audio/audren_u.cpp
index fa15712cf..6073f4ecd 100644
--- a/src/core/hle/service/audio/audren_u.cpp
+++ b/src/core/hle/service/audio/audren_u.cpp
@@ -66,7 +66,7 @@ private:
66 void GetAudioRendererState(Kernel::HLERequestContext& ctx) { 66 void GetAudioRendererState(Kernel::HLERequestContext& ctx) {
67 IPC::ResponseBuilder rb{ctx, 3}; 67 IPC::ResponseBuilder rb{ctx, 3};
68 rb.Push(RESULT_SUCCESS); 68 rb.Push(RESULT_SUCCESS);
69 rb.Push<u32>(renderer->GetState()); 69 rb.Push<u32>(static_cast<u32>(renderer->GetStreamState()));
70 LOG_DEBUG(Service_Audio, "called"); 70 LOG_DEBUG(Service_Audio, "called");
71 } 71 }
72 72