mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2026-09-23 18:24:57 +00:00
@@ -1,4 +1,4 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
|
||||
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
|
||||
@@ -34,42 +34,37 @@ constexpr std::array output_device_names{
|
||||
AudioDevice::AudioDeviceName{"AudioExternalOutput"},
|
||||
};
|
||||
|
||||
AudioDevice::AudioDevice(Core::System& system, const u64 applet_resource_user_id_,
|
||||
const u32 revision)
|
||||
: output_sink{system.AudioCore().GetOutputSink()},
|
||||
applet_resource_user_id{applet_resource_user_id_}, user_revision{revision} {}
|
||||
AudioDevice::AudioDevice(Core::System& system, const u64 applet_resource_user_id_, const u32 revision)
|
||||
: applet_resource_user_id{applet_resource_user_id_}
|
||||
, user_revision{revision}
|
||||
{}
|
||||
|
||||
u32 AudioDevice::ListAudioDeviceName(std::span<AudioDeviceName> out_buffer) const {
|
||||
std::span<const AudioDeviceName> names{};
|
||||
|
||||
if (CheckFeatureSupported(SupportTags::AudioUsbDeviceOutput, user_revision)) {
|
||||
names = usb_device_names;
|
||||
} else {
|
||||
names = device_names;
|
||||
}
|
||||
|
||||
const u32 out_count{static_cast<u32>((std::min)(out_buffer.size(), names.size()))};
|
||||
for (u32 i = 0; i < out_count; i++) {
|
||||
const u32 out_count = u32((std::min)(out_buffer.size(), names.size()));
|
||||
for (u32 i = 0; i < out_count; i++)
|
||||
out_buffer[i] = names[i];
|
||||
}
|
||||
return out_count;
|
||||
}
|
||||
|
||||
u32 AudioDevice::ListAudioOutputDeviceName(std::span<AudioDeviceName> out_buffer) const {
|
||||
const u32 out_count{static_cast<u32>((std::min)(out_buffer.size(), output_device_names.size()))};
|
||||
|
||||
for (u32 i = 0; i < out_count; i++) {
|
||||
const u32 out_count = u32((std::min)(out_buffer.size(), output_device_names.size()));
|
||||
for (u32 i = 0; i < out_count; i++)
|
||||
out_buffer[i] = output_device_names[i];
|
||||
}
|
||||
return out_count;
|
||||
}
|
||||
|
||||
void AudioDevice::SetDeviceVolumes(const f32 volume) {
|
||||
output_sink.SetDeviceVolume(volume);
|
||||
void AudioDevice::SetDeviceVolumes(Core::System& system, const f32 volume) {
|
||||
system.AudioCore().GetOutputSink().SetDeviceVolume(volume);
|
||||
}
|
||||
|
||||
f32 AudioDevice::GetDeviceVolume([[maybe_unused]] std::string_view name) const {
|
||||
return output_sink.GetDeviceVolume();
|
||||
f32 AudioDevice::GetDeviceVolume(Core::System& system, [[maybe_unused]] std::string_view name) const {
|
||||
return system.AudioCore().GetOutputSink().GetDeviceVolume();
|
||||
}
|
||||
|
||||
} // namespace AudioCore::Renderer
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
@@ -54,7 +57,7 @@ public:
|
||||
*
|
||||
* @param volume - Volume to set.
|
||||
*/
|
||||
void SetDeviceVolumes(f32 volume);
|
||||
void SetDeviceVolumes(Core::System& system, f32 volume);
|
||||
|
||||
/**
|
||||
* Get the volume for a given device name.
|
||||
@@ -63,11 +66,9 @@ public:
|
||||
* @param name - Name of the device to check. Unused.
|
||||
* @return Volume of the device.
|
||||
*/
|
||||
f32 GetDeviceVolume(std::string_view name) const;
|
||||
f32 GetDeviceVolume(Core::System& system, std::string_view name) const;
|
||||
|
||||
private:
|
||||
/// Backend output sink for the device
|
||||
Sink::Sink& output_sink;
|
||||
/// Resource id this device is used for
|
||||
const u64 applet_resource_user_id;
|
||||
/// User audio renderer revision
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
namespace AudioCore::Renderer {
|
||||
|
||||
Renderer::Renderer(Core::System& system_, Manager& manager_, Kernel::KEvent* rendered_event)
|
||||
: system{system_}, manager{manager_}
|
||||
: manager{manager_}
|
||||
, audio_system{system_, rendered_event}
|
||||
{}
|
||||
|
||||
@@ -28,8 +28,6 @@ Result Renderer::Initialize(const AudioRendererParameterInternal& params, Kernel
|
||||
}
|
||||
system_registered = true;
|
||||
}
|
||||
|
||||
initialized = true;
|
||||
audio_system.Initialize(params, transfer_memory, transfer_memory_size, process_handle, applet_resource_user_id, session_id);
|
||||
return ResultSuccess;
|
||||
}
|
||||
|
||||
@@ -86,12 +86,8 @@ public:
|
||||
std::span<u8> output);
|
||||
|
||||
private:
|
||||
/// System core
|
||||
Core::System& system;
|
||||
/// Manager this renderer is registered with
|
||||
Manager& manager;
|
||||
/// Is the audio renderer initialized?
|
||||
bool initialized{};
|
||||
/// Is the system registered with the manager?
|
||||
bool system_registered{};
|
||||
/// Audio render system, main driver of audio rendering
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
|
||||
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
|
||||
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
|
||||
|
||||
@@ -97,7 +97,7 @@ Result IAudioDevice::SetAudioDeviceOutputVolumeAuto(
|
||||
LOG_DEBUG(Service_Audio, "called. name={}, volume={}", device_name, volume);
|
||||
|
||||
if (device_name == "AudioTvOutput") {
|
||||
impl->SetDeviceVolumes(volume);
|
||||
impl->SetDeviceVolumes(system, volume);
|
||||
}
|
||||
|
||||
R_SUCCEED();
|
||||
@@ -112,7 +112,7 @@ Result IAudioDevice::GetAudioDeviceOutputVolumeAuto(
|
||||
|
||||
*out_volume = 1.0f;
|
||||
if (device_name == "AudioTvOutput") {
|
||||
*out_volume = impl->GetDeviceVolume(device_name);
|
||||
*out_volume = impl->GetDeviceVolume(system, device_name);
|
||||
}
|
||||
|
||||
R_SUCCEED();
|
||||
|
||||
Reference in New Issue
Block a user