mirror of
https://github.com/yuzu-emu/yuzu-android.git
synced 2025-06-12 06:58:17 -05:00
audio_device: Make AudioDeviceName constructor constexpr
These are used as read-only arrays, so we can make the data read-only and available at compile-time. Now constructing an AudioDevice no longer needs to initialize some tables
This commit is contained in:
@ -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);
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user