From ba0d74ff43b0a54b39c972f1e14e1cb792269725 Mon Sep 17 00:00:00 2001 From: st4rk Date: Tue, 23 Jan 2018 20:01:25 -0800 Subject: [PATCH] using an enum for audio_out_state as well as changing its initialize to member initializer list --- src/core/hle/service/audio/audout_u.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/core/hle/service/audio/audout_u.cpp b/src/core/hle/service/audio/audout_u.cpp index 2fc7f577fa..dbcda24967 100644 --- a/src/core/hle/service/audio/audout_u.cpp +++ b/src/core/hle/service/audio/audout_u.cpp @@ -22,7 +22,7 @@ constexpr u64 audio_ticks = static_cast(BASE_CLOCK_RATE / 500); class IAudioOut final : public ServiceFramework { public: - IAudioOut() : ServiceFramework("IAudioOut") { + IAudioOut() : ServiceFramework("IAudioOut"), audio_out_state(STOPPED) { static const FunctionInfo functions[] = { {0x0, nullptr, "GetAudioOutState"}, {0x1, &IAudioOut::StartAudioOut, "StartAudioOut"}, @@ -49,9 +49,6 @@ public: // Start the audio event CoreTiming::ScheduleEvent(audio_ticks, audio_event); - - // start with the audio stopped - audio_out_state = 1; } ~IAudioOut() = default; @@ -61,7 +58,7 @@ private: LOG_WARNING(Service, "(STUBBED) called"); // start audio - audio_out_state = 0x0; + audio_out_state = STARTED; IPC::RequestBuilder rb{ctx, 2, 0, 0, 0}; rb.Push(RESULT_SUCCESS); @@ -71,7 +68,7 @@ private: LOG_WARNING(Service, "(STUBBED) called"); // stop audio - audio_out_state = 0x1; + audio_out_state = STOPPED; queue_keys.clear(); @@ -134,6 +131,11 @@ private: } } + enum AUDIO_STATE { + STARTED, + STOPPED, + }; + // This is used to trigger the audio event callback that is going // to read the samples from the audio_buffer list and enqueue the samples // using the sink (audio_core). @@ -149,7 +151,7 @@ private: std::vector queue_keys; // current audio state: 0 is started and 1 is stopped - u32 audio_out_state; + AUDIO_STATE audio_out_state; }; void AudOutU::ListAudioOuts(Kernel::HLERequestContext& ctx) {