diff options
author | Lioncash <mathew1800@gmail.com> | 2022-09-15 15:06:14 +0200 |
---|---|---|
committer | Lioncash <mathew1800@gmail.com> | 2022-09-15 15:06:17 +0200 |
commit | d55046c5e97d2dc0a55d175e1101122d646ad540 (patch) | |
tree | e17f07f85ba29a883bbb126ca7f42a8801c97ada | |
parent | audio_device: Make AudioDeviceName constructor constexpr (diff) | |
download | yuzu-d55046c5e97d2dc0a55d175e1101122d646ad540.tar yuzu-d55046c5e97d2dc0a55d175e1101122d646ad540.tar.gz yuzu-d55046c5e97d2dc0a55d175e1101122d646ad540.tar.bz2 yuzu-d55046c5e97d2dc0a55d175e1101122d646ad540.tar.lz yuzu-d55046c5e97d2dc0a55d175e1101122d646ad540.tar.xz yuzu-d55046c5e97d2dc0a55d175e1101122d646ad540.tar.zst yuzu-d55046c5e97d2dc0a55d175e1101122d646ad540.zip |
-rw-r--r-- | src/audio_core/renderer/audio_device.cpp | 10 | ||||
-rw-r--r-- | src/audio_core/renderer/audio_device.h | 6 | ||||
-rw-r--r-- | src/core/hle/service/audio/audren_u.cpp | 4 |
3 files changed, 10 insertions, 10 deletions
diff --git a/src/audio_core/renderer/audio_device.cpp b/src/audio_core/renderer/audio_device.cpp index a4696065e..0d9d8f6ce 100644 --- a/src/audio_core/renderer/audio_device.cpp +++ b/src/audio_core/renderer/audio_device.cpp @@ -37,7 +37,7 @@ AudioDevice::AudioDevice(Core::System& system, const u64 applet_resource_user_id applet_resource_user_id{applet_resource_user_id_}, user_revision{revision} {} u32 AudioDevice::ListAudioDeviceName(std::vector<AudioDeviceName>& out_buffer, - const size_t max_count) { + const size_t max_count) const { std::span<const AudioDeviceName> names{}; if (CheckFeatureSupported(SupportTags::AudioUsbDeviceOutput, user_revision)) { @@ -46,7 +46,7 @@ u32 AudioDevice::ListAudioDeviceName(std::vector<AudioDeviceName>& out_buffer, names = device_names; } - u32 out_count{static_cast<u32>(std::min(max_count, names.size()))}; + const u32 out_count{static_cast<u32>(std::min(max_count, names.size()))}; for (u32 i = 0; i < out_count; i++) { out_buffer.push_back(names[i]); } @@ -54,8 +54,8 @@ u32 AudioDevice::ListAudioDeviceName(std::vector<AudioDeviceName>& out_buffer, } u32 AudioDevice::ListAudioOutputDeviceName(std::vector<AudioDeviceName>& out_buffer, - const size_t max_count) { - u32 out_count{static_cast<u32>(std::min(max_count, output_device_names.size()))}; + const size_t max_count) const { + const u32 out_count{static_cast<u32>(std::min(max_count, output_device_names.size()))}; for (u32 i = 0; i < out_count; i++) { out_buffer.push_back(output_device_names[i]); @@ -67,7 +67,7 @@ void AudioDevice::SetDeviceVolumes(const f32 volume) { output_sink.SetDeviceVolume(volume); } -f32 AudioDevice::GetDeviceVolume([[maybe_unused]] std::string_view name) { +f32 AudioDevice::GetDeviceVolume([[maybe_unused]] std::string_view name) const { return output_sink.GetDeviceVolume(); } diff --git a/src/audio_core/renderer/audio_device.h b/src/audio_core/renderer/audio_device.h index ba1f4c748..dd6be70ee 100644 --- a/src/audio_core/renderer/audio_device.h +++ b/src/audio_core/renderer/audio_device.h @@ -39,7 +39,7 @@ public: * @param max_count - Maximum number of devices to write (count of out_buffer). * @return Number of device names written. */ - u32 ListAudioDeviceName(std::vector<AudioDeviceName>& out_buffer, size_t max_count); + u32 ListAudioDeviceName(std::vector<AudioDeviceName>& out_buffer, size_t max_count) const; /** * Get a list of the available output devices. @@ -49,7 +49,7 @@ public: * @param max_count - Maximum number of devices to write (count of out_buffer). * @return Number of device names written. */ - u32 ListAudioOutputDeviceName(std::vector<AudioDeviceName>& out_buffer, size_t max_count); + u32 ListAudioOutputDeviceName(std::vector<AudioDeviceName>& out_buffer, size_t max_count) const; /** * Set the volume of all streams in the backend sink. @@ -65,7 +65,7 @@ public: * @param name - Name of the device to check. Unused. * @return Volume of the device. */ - f32 GetDeviceVolume(std::string_view name); + f32 GetDeviceVolume(std::string_view name) const; private: /// Backend output sink for the device diff --git a/src/core/hle/service/audio/audren_u.cpp b/src/core/hle/service/audio/audren_u.cpp index bc69117c6..6fb07c37d 100644 --- a/src/core/hle/service/audio/audren_u.cpp +++ b/src/core/hle/service/audio/audren_u.cpp @@ -252,7 +252,7 @@ private: std::vector<AudioDevice::AudioDeviceName> out_names{}; - u32 out_count = impl->ListAudioDeviceName(out_names, in_count); + const u32 out_count = impl->ListAudioDeviceName(out_names, in_count); std::string out{}; for (u32 i = 0; i < out_count; i++) { @@ -365,7 +365,7 @@ private: std::vector<AudioDevice::AudioDeviceName> out_names{}; - u32 out_count = impl->ListAudioOutputDeviceName(out_names, in_count); + const u32 out_count = impl->ListAudioOutputDeviceName(out_names, in_count); std::string out{}; for (u32 i = 0; i < out_count; i++) { |