diff options
| author | 2022-09-15 09:06:14 -0400 | |
|---|---|---|
| committer | 2022-09-15 09:06:17 -0400 | |
| commit | d55046c5e97d2dc0a55d175e1101122d646ad540 (patch) | |
| tree | e17f07f85ba29a883bbb126ca7f42a8801c97ada /src | |
| parent | audio_device: Make AudioDeviceName constructor constexpr (diff) | |
| download | yuzu-d55046c5e97d2dc0a55d175e1101122d646ad540.tar.gz yuzu-d55046c5e97d2dc0a55d175e1101122d646ad540.tar.xz yuzu-d55046c5e97d2dc0a55d175e1101122d646ad540.zip | |
audio_device: Mark member functions as const where applicable
These member functions don't modify any internal state.
Diffstat (limited to 'src')
| -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 | |||
| 37 | applet_resource_user_id{applet_resource_user_id_}, user_revision{revision} {} | 37 | applet_resource_user_id{applet_resource_user_id_}, user_revision{revision} {} |
| 38 | 38 | ||
| 39 | u32 AudioDevice::ListAudioDeviceName(std::vector<AudioDeviceName>& out_buffer, | 39 | u32 AudioDevice::ListAudioDeviceName(std::vector<AudioDeviceName>& out_buffer, |
| 40 | const size_t max_count) { | 40 | const size_t max_count) const { |
| 41 | std::span<const AudioDeviceName> names{}; | 41 | std::span<const AudioDeviceName> names{}; |
| 42 | 42 | ||
| 43 | if (CheckFeatureSupported(SupportTags::AudioUsbDeviceOutput, user_revision)) { | 43 | if (CheckFeatureSupported(SupportTags::AudioUsbDeviceOutput, user_revision)) { |
| @@ -46,7 +46,7 @@ u32 AudioDevice::ListAudioDeviceName(std::vector<AudioDeviceName>& out_buffer, | |||
| 46 | names = device_names; | 46 | names = device_names; |
| 47 | } | 47 | } |
| 48 | 48 | ||
| 49 | u32 out_count{static_cast<u32>(std::min(max_count, names.size()))}; | 49 | const u32 out_count{static_cast<u32>(std::min(max_count, names.size()))}; |
| 50 | for (u32 i = 0; i < out_count; i++) { | 50 | for (u32 i = 0; i < out_count; i++) { |
| 51 | out_buffer.push_back(names[i]); | 51 | out_buffer.push_back(names[i]); |
| 52 | } | 52 | } |
| @@ -54,8 +54,8 @@ u32 AudioDevice::ListAudioDeviceName(std::vector<AudioDeviceName>& out_buffer, | |||
| 54 | } | 54 | } |
| 55 | 55 | ||
| 56 | u32 AudioDevice::ListAudioOutputDeviceName(std::vector<AudioDeviceName>& out_buffer, | 56 | u32 AudioDevice::ListAudioOutputDeviceName(std::vector<AudioDeviceName>& out_buffer, |
| 57 | const size_t max_count) { | 57 | const size_t max_count) const { |
| 58 | u32 out_count{static_cast<u32>(std::min(max_count, output_device_names.size()))}; | 58 | const u32 out_count{static_cast<u32>(std::min(max_count, output_device_names.size()))}; |
| 59 | 59 | ||
| 60 | for (u32 i = 0; i < out_count; i++) { | 60 | for (u32 i = 0; i < out_count; i++) { |
| 61 | out_buffer.push_back(output_device_names[i]); | 61 | out_buffer.push_back(output_device_names[i]); |
| @@ -67,7 +67,7 @@ void AudioDevice::SetDeviceVolumes(const f32 volume) { | |||
| 67 | output_sink.SetDeviceVolume(volume); | 67 | output_sink.SetDeviceVolume(volume); |
| 68 | } | 68 | } |
| 69 | 69 | ||
| 70 | f32 AudioDevice::GetDeviceVolume([[maybe_unused]] std::string_view name) { | 70 | f32 AudioDevice::GetDeviceVolume([[maybe_unused]] std::string_view name) const { |
| 71 | return output_sink.GetDeviceVolume(); | 71 | return output_sink.GetDeviceVolume(); |
| 72 | } | 72 | } |
| 73 | 73 | ||
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: | |||
| 39 | * @param max_count - Maximum number of devices to write (count of out_buffer). | 39 | * @param max_count - Maximum number of devices to write (count of out_buffer). |
| 40 | * @return Number of device names written. | 40 | * @return Number of device names written. |
| 41 | */ | 41 | */ |
| 42 | u32 ListAudioDeviceName(std::vector<AudioDeviceName>& out_buffer, size_t max_count); | 42 | u32 ListAudioDeviceName(std::vector<AudioDeviceName>& out_buffer, size_t max_count) const; |
| 43 | 43 | ||
| 44 | /** | 44 | /** |
| 45 | * Get a list of the available output devices. | 45 | * Get a list of the available output devices. |
| @@ -49,7 +49,7 @@ public: | |||
| 49 | * @param max_count - Maximum number of devices to write (count of out_buffer). | 49 | * @param max_count - Maximum number of devices to write (count of out_buffer). |
| 50 | * @return Number of device names written. | 50 | * @return Number of device names written. |
| 51 | */ | 51 | */ |
| 52 | u32 ListAudioOutputDeviceName(std::vector<AudioDeviceName>& out_buffer, size_t max_count); | 52 | u32 ListAudioOutputDeviceName(std::vector<AudioDeviceName>& out_buffer, size_t max_count) const; |
| 53 | 53 | ||
| 54 | /** | 54 | /** |
| 55 | * Set the volume of all streams in the backend sink. | 55 | * Set the volume of all streams in the backend sink. |
| @@ -65,7 +65,7 @@ public: | |||
| 65 | * @param name - Name of the device to check. Unused. | 65 | * @param name - Name of the device to check. Unused. |
| 66 | * @return Volume of the device. | 66 | * @return Volume of the device. |
| 67 | */ | 67 | */ |
| 68 | f32 GetDeviceVolume(std::string_view name); | 68 | f32 GetDeviceVolume(std::string_view name) const; |
| 69 | 69 | ||
| 70 | private: | 70 | private: |
| 71 | /// Backend output sink for the device | 71 | /// 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: | |||
| 252 | 252 | ||
| 253 | std::vector<AudioDevice::AudioDeviceName> out_names{}; | 253 | std::vector<AudioDevice::AudioDeviceName> out_names{}; |
| 254 | 254 | ||
| 255 | u32 out_count = impl->ListAudioDeviceName(out_names, in_count); | 255 | const u32 out_count = impl->ListAudioDeviceName(out_names, in_count); |
| 256 | 256 | ||
| 257 | std::string out{}; | 257 | std::string out{}; |
| 258 | for (u32 i = 0; i < out_count; i++) { | 258 | for (u32 i = 0; i < out_count; i++) { |
| @@ -365,7 +365,7 @@ private: | |||
| 365 | 365 | ||
| 366 | std::vector<AudioDevice::AudioDeviceName> out_names{}; | 366 | std::vector<AudioDevice::AudioDeviceName> out_names{}; |
| 367 | 367 | ||
| 368 | u32 out_count = impl->ListAudioOutputDeviceName(out_names, in_count); | 368 | const u32 out_count = impl->ListAudioOutputDeviceName(out_names, in_count); |
| 369 | 369 | ||
| 370 | std::string out{}; | 370 | std::string out{}; |
| 371 | for (u32 i = 0; i < out_count; i++) { | 371 | for (u32 i = 0; i < out_count; i++) { |