From ed0485c5993cca8c544ca5a641357034519730a5 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 19 Jul 2019 03:22:57 -0400 Subject: service/audio: Remove global system accessors Trims out the lingering reliance on global state out of the audio code. --- src/core/hle/service/audio/audren_u.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/core/hle/service/audio/audren_u.h') diff --git a/src/core/hle/service/audio/audren_u.h b/src/core/hle/service/audio/audren_u.h index 49f2733cf..6e17489ce 100644 --- a/src/core/hle/service/audio/audren_u.h +++ b/src/core/hle/service/audio/audren_u.h @@ -6,6 +6,10 @@ #include "core/hle/service/service.h" +namespace Core { +class System; +} + namespace Kernel { class HLERequestContext; } @@ -14,7 +18,7 @@ namespace Service::Audio { class AudRenU final : public ServiceFramework { public: - explicit AudRenU(); + explicit AudRenU(Core::System& system_); ~AudRenU() override; private: @@ -33,7 +37,9 @@ private: }; bool IsFeatureSupported(AudioFeatures feature, u32_le revision) const; + std::size_t audren_instance_count = 0; + Core::System& system; }; } // namespace Service::Audio -- cgit v1.2.3 From b9ebab71beaf9afc74788368846086a9c4648f4b Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 19 Jul 2019 03:44:00 -0400 Subject: service/audren_u: Move revision testing code out of AudRenU The revision querying facilities are used by more than just audren. e.g. audio devices can use this to test whether or not USB audio output is supported. This will be used within the following change. --- src/core/hle/service/audio/audren_u.h | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'src/core/hle/service/audio/audren_u.h') diff --git a/src/core/hle/service/audio/audren_u.h b/src/core/hle/service/audio/audren_u.h index 6e17489ce..0f3aad501 100644 --- a/src/core/hle/service/audio/audren_u.h +++ b/src/core/hle/service/audio/audren_u.h @@ -30,16 +30,18 @@ private: void OpenAudioRendererImpl(Kernel::HLERequestContext& ctx); - enum class AudioFeatures : u32 { - Splitter, - PerformanceMetricsVersion2, - VariadicCommandBuffer, - }; - - bool IsFeatureSupported(AudioFeatures feature, u32_le revision) const; - std::size_t audren_instance_count = 0; Core::System& system; }; +// Describes a particular audio feature that may be supported in a particular revision. +enum class AudioFeatures : u32 { + Splitter, + PerformanceMetricsVersion2, + VariadicCommandBuffer, +}; + +// Tests if a particular audio feature is supported with a given audio revision. +bool IsFeatureSupported(AudioFeatures feature, u32_le revision); + } // namespace Service::Audio -- cgit v1.2.3 From 16730c4c4351133c9a27d0b34c5aeb54ac65e9a6 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 19 Jul 2019 03:56:21 -0400 Subject: service/audren_u: Handle audio USB output revision queries in ListAudioDeviceName() Audio devices use the supplied revision information in order to determine if USB audio output is able to be supported. In this case, we can only really handle using this revision information in ListAudioDeviceName(), where it checks if USB audio output is supported before supplying it as a device name. A few other scenarios exist where the revision info is checked, such as: - Early exiting from SetAudioDeviceOutputVolume if USB audio is attempted to be set when that device is unsupported. - Early exiting and returning 0.0f in GetAudioDeviceOutputVolume when USB output volume is queried and it's an unsupported device. - Falling back to AHUB headphones in GetActiveAudioDeviceName when the device type is USB output, but is unsupported based off the revision info. In order for these changes to also be implemented, a few other changes to the interface need to be made. Given we now properly handle everything about ListAudioDeviceName(), we no longer need to describe it as a stubbed function. --- src/core/hle/service/audio/audren_u.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/core/hle/service/audio/audren_u.h') diff --git a/src/core/hle/service/audio/audren_u.h b/src/core/hle/service/audio/audren_u.h index 0f3aad501..4e0ccc792 100644 --- a/src/core/hle/service/audio/audren_u.h +++ b/src/core/hle/service/audio/audren_u.h @@ -36,6 +36,7 @@ private: // Describes a particular audio feature that may be supported in a particular revision. enum class AudioFeatures : u32 { + AudioUSBDeviceOutput, Splitter, PerformanceMetricsVersion2, VariadicCommandBuffer, -- cgit v1.2.3