diff options
author | Morph <39850852+Morph1984@users.noreply.github.com> | 2022-09-16 16:18:58 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-16 16:18:58 +0200 |
commit | 60aa9422101267c175e8604adf0d5e6a1ce7bdcd (patch) | |
tree | 1568ae6f68c98d9e4d52744493bd4668f7695fde /src/audio_core/renderer/audio_device.h | |
parent | Merge pull request #8878 from Kelebek1/remove_pause (diff) | |
parent | audio_device: Mark member functions as const where applicable (diff) | |
download | yuzu-60aa9422101267c175e8604adf0d5e6a1ce7bdcd.tar yuzu-60aa9422101267c175e8604adf0d5e6a1ce7bdcd.tar.gz yuzu-60aa9422101267c175e8604adf0d5e6a1ce7bdcd.tar.bz2 yuzu-60aa9422101267c175e8604adf0d5e6a1ce7bdcd.tar.lz yuzu-60aa9422101267c175e8604adf0d5e6a1ce7bdcd.tar.xz yuzu-60aa9422101267c175e8604adf0d5e6a1ce7bdcd.tar.zst yuzu-60aa9422101267c175e8604adf0d5e6a1ce7bdcd.zip |
Diffstat (limited to 'src/audio_core/renderer/audio_device.h')
-rw-r--r-- | src/audio_core/renderer/audio_device.h | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/src/audio_core/renderer/audio_device.h b/src/audio_core/renderer/audio_device.h index 1f449f261..dd6be70ee 100644 --- a/src/audio_core/renderer/audio_device.h +++ b/src/audio_core/renderer/audio_device.h @@ -3,7 +3,7 @@ #pragma once -#include <span> +#include <string_view> #include "audio_core/audio_render_manager.h" @@ -23,21 +23,13 @@ namespace AudioRenderer { class AudioDevice { public: struct AudioDeviceName { - std::array<char, 0x100> name; + std::array<char, 0x100> name{}; - AudioDeviceName(const char* name_) { - std::strncpy(name.data(), name_, name.size()); + constexpr AudioDeviceName(std::string_view name_) { + name_.copy(name.data(), name.size() - 1); } }; - std::array<AudioDeviceName, 4> usb_device_names{"AudioStereoJackOutput", - "AudioBuiltInSpeakerOutput", "AudioTvOutput", - "AudioUsbDeviceOutput"}; - std::array<AudioDeviceName, 3> device_names{"AudioStereoJackOutput", - "AudioBuiltInSpeakerOutput", "AudioTvOutput"}; - std::array<AudioDeviceName, 3> output_device_names{"AudioBuiltInSpeakerOutput", "AudioTvOutput", - "AudioExternalOutput"}; - explicit AudioDevice(Core::System& system, u64 applet_resource_user_id, u32 revision); /** @@ -47,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. @@ -57,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. @@ -73,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 |