summaryrefslogtreecommitdiffstats
path: root/src/audio_core/renderer
diff options
context:
space:
mode:
Diffstat (limited to 'src/audio_core/renderer')
-rw-r--r--src/audio_core/renderer/audio_renderer.cpp2
-rw-r--r--src/audio_core/renderer/behavior/info_updater.cpp38
-rw-r--r--src/audio_core/renderer/memory/pool_mapper.cpp2
-rw-r--r--src/audio_core/renderer/system.cpp50
-rw-r--r--src/audio_core/renderer/voice/voice_info.cpp8
5 files changed, 50 insertions, 50 deletions
diff --git a/src/audio_core/renderer/audio_renderer.cpp b/src/audio_core/renderer/audio_renderer.cpp
index 51aa17599..a8257eb2e 100644
--- a/src/audio_core/renderer/audio_renderer.cpp
+++ b/src/audio_core/renderer/audio_renderer.cpp
@@ -22,7 +22,7 @@ Result Renderer::Initialize(const AudioRendererParameterInternal& params,
if (!manager.AddSystem(system)) {
LOG_ERROR(Service_Audio,
"Both Audio Render sessions are in use, cannot create any more");
- return Service::Audio::ERR_MAXIMUM_SESSIONS_REACHED;
+ return Service::Audio::ResultOutOfSessions;
}
system_registered = true;
}
diff --git a/src/audio_core/renderer/behavior/info_updater.cpp b/src/audio_core/renderer/behavior/info_updater.cpp
index 574cf0982..e312eb166 100644
--- a/src/audio_core/renderer/behavior/info_updater.cpp
+++ b/src/audio_core/renderer/behavior/info_updater.cpp
@@ -48,7 +48,7 @@ Result InfoUpdater::UpdateVoiceChannelResources(VoiceContext& voice_context) {
LOG_ERROR(Service_Audio,
"Consumed an incorrect voice resource size, header size={}, consumed={}",
in_header->voice_resources_size, consumed_input_size);
- return Service::Audio::ERR_INVALID_UPDATE_DATA;
+ return Service::Audio::ResultInvalidUpdateInfo;
}
input += consumed_input_size;
@@ -123,7 +123,7 @@ Result InfoUpdater::UpdateVoices(VoiceContext& voice_context,
if (consumed_input_size != in_header->voices_size) {
LOG_ERROR(Service_Audio, "Consumed an incorrect voices size, header size={}, consumed={}",
in_header->voices_size, consumed_input_size);
- return Service::Audio::ERR_INVALID_UPDATE_DATA;
+ return Service::Audio::ResultInvalidUpdateInfo;
}
out_header->voices_size = consumed_output_size;
@@ -184,7 +184,7 @@ Result InfoUpdater::UpdateEffectsVersion1(EffectContext& effect_context, const b
if (consumed_input_size != in_header->effects_size) {
LOG_ERROR(Service_Audio, "Consumed an incorrect effects size, header size={}, consumed={}",
in_header->effects_size, consumed_input_size);
- return Service::Audio::ERR_INVALID_UPDATE_DATA;
+ return Service::Audio::ResultInvalidUpdateInfo;
}
out_header->effects_size = consumed_output_size;
@@ -239,7 +239,7 @@ Result InfoUpdater::UpdateEffectsVersion2(EffectContext& effect_context, const b
if (consumed_input_size != in_header->effects_size) {
LOG_ERROR(Service_Audio, "Consumed an incorrect effects size, header size={}, consumed={}",
in_header->effects_size, consumed_input_size);
- return Service::Audio::ERR_INVALID_UPDATE_DATA;
+ return Service::Audio::ResultInvalidUpdateInfo;
}
out_header->effects_size = consumed_output_size;
@@ -267,7 +267,7 @@ Result InfoUpdater::UpdateMixes(MixContext& mix_context, const u32 mix_buffer_co
}
if (mix_buffer_count == 0) {
- return Service::Audio::ERR_INVALID_UPDATE_DATA;
+ return Service::Audio::ResultInvalidUpdateInfo;
}
std::span<const MixInfo::InParameter> in_params{
@@ -281,13 +281,13 @@ Result InfoUpdater::UpdateMixes(MixContext& mix_context, const u32 mix_buffer_co
total_buffer_count += params.buffer_count;
if (params.dest_mix_id > static_cast<s32>(mix_context.GetCount()) &&
params.dest_mix_id != UnusedMixId && params.mix_id != FinalMixId) {
- return Service::Audio::ERR_INVALID_UPDATE_DATA;
+ return Service::Audio::ResultInvalidUpdateInfo;
}
}
}
if (total_buffer_count > mix_buffer_count) {
- return Service::Audio::ERR_INVALID_UPDATE_DATA;
+ return Service::Audio::ResultInvalidUpdateInfo;
}
bool mix_dirty{false};
@@ -317,7 +317,7 @@ Result InfoUpdater::UpdateMixes(MixContext& mix_context, const u32 mix_buffer_co
if (mix_dirty) {
if (behaviour.IsSplitterSupported() && splitter_context.UsingSplitter()) {
if (!mix_context.TSortInfo(splitter_context)) {
- return Service::Audio::ERR_INVALID_UPDATE_DATA;
+ return Service::Audio::ResultInvalidUpdateInfo;
}
} else {
mix_context.SortInfo();
@@ -327,7 +327,7 @@ Result InfoUpdater::UpdateMixes(MixContext& mix_context, const u32 mix_buffer_co
if (consumed_input_size != in_header->mix_size) {
LOG_ERROR(Service_Audio, "Consumed an incorrect mixes size, header size={}, consumed={}",
in_header->mix_size, consumed_input_size);
- return Service::Audio::ERR_INVALID_UPDATE_DATA;
+ return Service::Audio::ResultInvalidUpdateInfo;
}
input += mix_count * sizeof(MixInfo::InParameter);
@@ -384,7 +384,7 @@ Result InfoUpdater::UpdateSinks(SinkContext& sink_context, std::span<MemoryPoolI
if (consumed_input_size != in_header->sinks_size) {
LOG_ERROR(Service_Audio, "Consumed an incorrect sinks size, header size={}, consumed={}",
in_header->sinks_size, consumed_input_size);
- return Service::Audio::ERR_INVALID_UPDATE_DATA;
+ return Service::Audio::ResultInvalidUpdateInfo;
}
input += consumed_input_size;
@@ -411,7 +411,7 @@ Result InfoUpdater::UpdateMemoryPools(std::span<MemoryPoolInfo> memory_pools,
state != MemoryPoolInfo::ResultState::MapFailed &&
state != MemoryPoolInfo::ResultState::InUse) {
LOG_WARNING(Service_Audio, "Invalid ResultState from updating memory pools");
- return Service::Audio::ERR_INVALID_UPDATE_DATA;
+ return Service::Audio::ResultInvalidUpdateInfo;
}
}
@@ -423,7 +423,7 @@ Result InfoUpdater::UpdateMemoryPools(std::span<MemoryPoolInfo> memory_pools,
LOG_ERROR(Service_Audio,
"Consumed an incorrect memory pool size, header size={}, consumed={}",
in_header->memory_pool_size, consumed_input_size);
- return Service::Audio::ERR_INVALID_UPDATE_DATA;
+ return Service::Audio::ResultInvalidUpdateInfo;
}
input += consumed_input_size;
@@ -453,7 +453,7 @@ Result InfoUpdater::UpdatePerformanceBuffer(std::span<u8> performance_output,
LOG_ERROR(Service_Audio,
"Consumed an incorrect performance size, header size={}, consumed={}",
in_header->performance_buffer_size, consumed_input_size);
- return Service::Audio::ERR_INVALID_UPDATE_DATA;
+ return Service::Audio::ResultInvalidUpdateInfo;
}
input += consumed_input_size;
@@ -467,18 +467,18 @@ Result InfoUpdater::UpdateBehaviorInfo(BehaviorInfo& behaviour_) {
const auto in_params{reinterpret_cast<const BehaviorInfo::InParameter*>(input)};
if (!CheckValidRevision(in_params->revision)) {
- return Service::Audio::ERR_INVALID_UPDATE_DATA;
+ return Service::Audio::ResultInvalidUpdateInfo;
}
if (in_params->revision != behaviour_.GetUserRevision()) {
- return Service::Audio::ERR_INVALID_UPDATE_DATA;
+ return Service::Audio::ResultInvalidUpdateInfo;
}
behaviour_.ClearError();
behaviour_.UpdateFlags(in_params->flags);
if (in_header->behaviour_size != sizeof(BehaviorInfo::InParameter)) {
- return Service::Audio::ERR_INVALID_UPDATE_DATA;
+ return Service::Audio::ResultInvalidUpdateInfo;
}
input += sizeof(BehaviorInfo::InParameter);
@@ -500,7 +500,7 @@ Result InfoUpdater::UpdateErrorInfo(const BehaviorInfo& behaviour_) {
Result InfoUpdater::UpdateSplitterInfo(SplitterContext& splitter_context) {
u32 consumed_size{0};
if (!splitter_context.Update(input, consumed_size)) {
- return Service::Audio::ERR_INVALID_UPDATE_DATA;
+ return Service::Audio::ResultInvalidUpdateInfo;
}
input += consumed_size;
@@ -529,9 +529,9 @@ Result InfoUpdater::UpdateRendererInfo(const u64 elapsed_frames) {
Result InfoUpdater::CheckConsumedSize() {
if (CpuAddr(input) - CpuAddr(input_origin.data()) != expected_input_size) {
- return Service::Audio::ERR_INVALID_UPDATE_DATA;
+ return Service::Audio::ResultInvalidUpdateInfo;
} else if (CpuAddr(output) - CpuAddr(output_origin.data()) != expected_output_size) {
- return Service::Audio::ERR_INVALID_UPDATE_DATA;
+ return Service::Audio::ResultInvalidUpdateInfo;
}
return ResultSuccess;
}
diff --git a/src/audio_core/renderer/memory/pool_mapper.cpp b/src/audio_core/renderer/memory/pool_mapper.cpp
index 2baf2ce08..7fd2b5f47 100644
--- a/src/audio_core/renderer/memory/pool_mapper.cpp
+++ b/src/audio_core/renderer/memory/pool_mapper.cpp
@@ -92,7 +92,7 @@ bool PoolMapper::TryAttachBuffer(BehaviorInfo::ErrorInfo& error_info, AddressInf
address_info.Setup(address, size);
if (!FillDspAddr(address_info)) {
- error_info.error_code = Service::Audio::ERR_POOL_MAPPING_FAILED;
+ error_info.error_code = Service::Audio::ResultInvalidAddressInfo;
error_info.address = address;
return force_map;
}
diff --git a/src/audio_core/renderer/system.cpp b/src/audio_core/renderer/system.cpp
index 31cbee282..28f063641 100644
--- a/src/audio_core/renderer/system.cpp
+++ b/src/audio_core/renderer/system.cpp
@@ -101,15 +101,15 @@ Result System::Initialize(const AudioRendererParameterInternal& params,
Kernel::KTransferMemory* transfer_memory, u64 transfer_memory_size,
u32 process_handle_, u64 applet_resource_user_id_, s32 session_id_) {
if (!CheckValidRevision(params.revision)) {
- return Service::Audio::ERR_INVALID_REVISION;
+ return Service::Audio::ResultInvalidRevision;
}
if (GetWorkBufferSize(params) > transfer_memory_size) {
- return Service::Audio::ERR_INSUFFICIENT_BUFFER_SIZE;
+ return Service::Audio::ResultInsufficientBuffer;
}
if (process_handle_ == 0) {
- return Service::Audio::ERR_INVALID_PROCESS_HANDLE;
+ return Service::Audio::ResultInvalidHandle;
}
behavior.SetUserLibRevision(params.revision);
@@ -143,19 +143,19 @@ Result System::Initialize(const AudioRendererParameterInternal& params,
samples_workbuffer =
allocator.Allocate<s32>((voice_channels + mix_buffer_count) * sample_count, 0x10);
if (samples_workbuffer.empty()) {
- return Service::Audio::ERR_INSUFFICIENT_BUFFER_SIZE;
+ return Service::Audio::ResultInsufficientBuffer;
}
auto upsampler_workbuffer{allocator.Allocate<s32>(
(voice_channels + mix_buffer_count) * TargetSampleCount * upsampler_count, 0x10)};
if (upsampler_workbuffer.empty()) {
- return Service::Audio::ERR_INSUFFICIENT_BUFFER_SIZE;
+ return Service::Audio::ResultInsufficientBuffer;
}
depop_buffer =
allocator.Allocate<s32>(Common::AlignUp(static_cast<u32>(mix_buffer_count), 0x40), 0x40);
if (depop_buffer.empty()) {
- return Service::Audio::ERR_INSUFFICIENT_BUFFER_SIZE;
+ return Service::Audio::ResultInsufficientBuffer;
}
// invalidate samples_workbuffer DSP cache
@@ -166,12 +166,12 @@ Result System::Initialize(const AudioRendererParameterInternal& params,
}
if (voice_infos.empty()) {
- return Service::Audio::ERR_INSUFFICIENT_BUFFER_SIZE;
+ return Service::Audio::ResultInsufficientBuffer;
}
auto sorted_voice_infos{allocator.Allocate<VoiceInfo*>(params.voices, 0x10)};
if (sorted_voice_infos.empty()) {
- return Service::Audio::ERR_INSUFFICIENT_BUFFER_SIZE;
+ return Service::Audio::ResultInsufficientBuffer;
}
std::memset(sorted_voice_infos.data(), 0, sorted_voice_infos.size_bytes());
@@ -183,12 +183,12 @@ Result System::Initialize(const AudioRendererParameterInternal& params,
}
if (voice_channel_resources.empty()) {
- return Service::Audio::ERR_INSUFFICIENT_BUFFER_SIZE;
+ return Service::Audio::ResultInsufficientBuffer;
}
auto voice_cpu_states{allocator.Allocate<VoiceState>(params.voices, 0x10)};
if (voice_cpu_states.empty()) {
- return Service::Audio::ERR_INSUFFICIENT_BUFFER_SIZE;
+ return Service::Audio::ResultInsufficientBuffer;
}
for (auto& voice_state : voice_cpu_states) {
@@ -198,7 +198,7 @@ Result System::Initialize(const AudioRendererParameterInternal& params,
auto mix_infos{allocator.Allocate<MixInfo>(params.sub_mixes + 1, 0x10)};
if (mix_infos.empty()) {
- return Service::Audio::ERR_INSUFFICIENT_BUFFER_SIZE;
+ return Service::Audio::ResultInsufficientBuffer;
}
u32 effect_process_order_count{0};
@@ -208,7 +208,7 @@ Result System::Initialize(const AudioRendererParameterInternal& params,
effect_process_order_count = params.effects * (params.sub_mixes + 1);
effect_process_order_buffer = allocator.Allocate<s32>(effect_process_order_count, 0x10);
if (effect_process_order_buffer.empty()) {
- return Service::Audio::ERR_INSUFFICIENT_BUFFER_SIZE;
+ return Service::Audio::ResultInsufficientBuffer;
}
}
@@ -222,7 +222,7 @@ Result System::Initialize(const AudioRendererParameterInternal& params,
auto sorted_mix_infos{allocator.Allocate<MixInfo*>(params.sub_mixes + 1, 0x10)};
if (sorted_mix_infos.empty()) {
- return Service::Audio::ERR_INSUFFICIENT_BUFFER_SIZE;
+ return Service::Audio::ResultInsufficientBuffer;
}
std::memset(sorted_mix_infos.data(), 0, sorted_mix_infos.size_bytes());
@@ -235,7 +235,7 @@ Result System::Initialize(const AudioRendererParameterInternal& params,
auto edge_matrix_workbuffer{allocator.Allocate<u8>(edge_matrix_size, 1)};
if (node_states_workbuffer.empty() || edge_matrix_workbuffer.size() == 0) {
- return Service::Audio::ERR_INSUFFICIENT_BUFFER_SIZE;
+ return Service::Audio::ResultInsufficientBuffer;
}
mix_context.Initialize(sorted_mix_infos, mix_infos, params.sub_mixes + 1,
@@ -250,7 +250,7 @@ Result System::Initialize(const AudioRendererParameterInternal& params,
upsampler_manager = allocator.Allocate<UpsamplerManager>(1, 0x10).data();
if (upsampler_manager == nullptr) {
- return Service::Audio::ERR_INSUFFICIENT_BUFFER_SIZE;
+ return Service::Audio::ResultInsufficientBuffer;
}
memory_pool_workbuffer = allocator.Allocate<MemoryPoolInfo>(memory_pool_count, 0x10);
@@ -259,18 +259,18 @@ Result System::Initialize(const AudioRendererParameterInternal& params,
}
if (memory_pool_workbuffer.empty() && memory_pool_count > 0) {
- return Service::Audio::ERR_INSUFFICIENT_BUFFER_SIZE;
+ return Service::Audio::ResultInsufficientBuffer;
}
if (!splitter_context.Initialize(behavior, params, allocator)) {
- return Service::Audio::ERR_INSUFFICIENT_BUFFER_SIZE;
+ return Service::Audio::ResultInsufficientBuffer;
}
std::span<EffectResultState> effect_result_states_cpu{};
if (behavior.IsEffectInfoVersion2Supported() && params.effects > 0) {
effect_result_states_cpu = allocator.Allocate<EffectResultState>(params.effects, 0x10);
if (effect_result_states_cpu.empty()) {
- return Service::Audio::ERR_INSUFFICIENT_BUFFER_SIZE;
+ return Service::Audio::ResultInsufficientBuffer;
}
std::memset(effect_result_states_cpu.data(), 0, effect_result_states_cpu.size_bytes());
}
@@ -289,7 +289,7 @@ Result System::Initialize(const AudioRendererParameterInternal& params,
upsampler_workbuffer);
if (upsampler_infos.empty()) {
- return Service::Audio::ERR_INSUFFICIENT_BUFFER_SIZE;
+ return Service::Audio::ResultInsufficientBuffer;
}
auto effect_infos{allocator.Allocate<EffectInfoBase>(params.effects, 0x40)};
@@ -298,14 +298,14 @@ Result System::Initialize(const AudioRendererParameterInternal& params,
}
if (effect_infos.empty() && params.effects > 0) {
- return Service::Audio::ERR_INSUFFICIENT_BUFFER_SIZE;
+ return Service::Audio::ResultInsufficientBuffer;
}
std::span<EffectResultState> effect_result_states_dsp{};
if (behavior.IsEffectInfoVersion2Supported() && params.effects > 0) {
effect_result_states_dsp = allocator.Allocate<EffectResultState>(params.effects, 0x40);
if (effect_result_states_dsp.empty()) {
- return Service::Audio::ERR_INSUFFICIENT_BUFFER_SIZE;
+ return Service::Audio::ResultInsufficientBuffer;
}
std::memset(effect_result_states_dsp.data(), 0, effect_result_states_dsp.size_bytes());
}
@@ -319,14 +319,14 @@ Result System::Initialize(const AudioRendererParameterInternal& params,
}
if (sinks.empty()) {
- return Service::Audio::ERR_INSUFFICIENT_BUFFER_SIZE;
+ return Service::Audio::ResultInsufficientBuffer;
}
sink_context.Initialize(sinks, params.sinks);
auto voice_dsp_states{allocator.Allocate<VoiceState>(params.voices, 0x40)};
if (voice_dsp_states.empty()) {
- return Service::Audio::ERR_INSUFFICIENT_BUFFER_SIZE;
+ return Service::Audio::ResultInsufficientBuffer;
}
for (auto& voice_state : voice_dsp_states) {
@@ -344,7 +344,7 @@ Result System::Initialize(const AudioRendererParameterInternal& params,
0xC};
performance_workbuffer = allocator.Allocate<u8>(perf_workbuffer_size, 0x40);
if (performance_workbuffer.empty()) {
- return Service::Audio::ERR_INSUFFICIENT_BUFFER_SIZE;
+ return Service::Audio::ResultInsufficientBuffer;
}
std::memset(performance_workbuffer.data(), 0, performance_workbuffer.size_bytes());
performance_manager.Initialize(performance_workbuffer, performance_workbuffer.size_bytes(),
@@ -360,7 +360,7 @@ Result System::Initialize(const AudioRendererParameterInternal& params,
command_workbuffer_size = allocator.GetRemainingSize();
command_workbuffer = allocator.Allocate<u8>(command_workbuffer_size, 0x40);
if (command_workbuffer.empty()) {
- return Service::Audio::ERR_INSUFFICIENT_BUFFER_SIZE;
+ return Service::Audio::ResultInsufficientBuffer;
}
command_buffer_size = 0;
diff --git a/src/audio_core/renderer/voice/voice_info.cpp b/src/audio_core/renderer/voice/voice_info.cpp
index 1849eeb57..c0bfb23fc 100644
--- a/src/audio_core/renderer/voice/voice_info.cpp
+++ b/src/audio_core/renderer/voice/voice_info.cpp
@@ -181,7 +181,7 @@ void VoiceInfo::UpdateWaveBuffer(std::span<BehaviorInfo::ErrorInfo> error_info,
if (wave_buffer_internal.start_offset * byte_size > wave_buffer_internal.size ||
wave_buffer_internal.end_offset * byte_size > wave_buffer_internal.size) {
LOG_ERROR(Service_Audio, "Invalid PCM16 start/end wavebuffer sizes!");
- error_info[0].error_code = Service::Audio::ERR_INVALID_UPDATE_DATA;
+ error_info[0].error_code = Service::Audio::ResultInvalidUpdateInfo;
error_info[0].address = wave_buffer_internal.address;
return;
}
@@ -192,7 +192,7 @@ void VoiceInfo::UpdateWaveBuffer(std::span<BehaviorInfo::ErrorInfo> error_info,
if (wave_buffer_internal.start_offset * byte_size > wave_buffer_internal.size ||
wave_buffer_internal.end_offset * byte_size > wave_buffer_internal.size) {
LOG_ERROR(Service_Audio, "Invalid PCMFloat start/end wavebuffer sizes!");
- error_info[0].error_code = Service::Audio::ERR_INVALID_UPDATE_DATA;
+ error_info[0].error_code = Service::Audio::ResultInvalidUpdateInfo;
error_info[0].address = wave_buffer_internal.address;
return;
}
@@ -216,7 +216,7 @@ void VoiceInfo::UpdateWaveBuffer(std::span<BehaviorInfo::ErrorInfo> error_info,
if (start > static_cast<s64>(wave_buffer_internal.size) ||
end > static_cast<s64>(wave_buffer_internal.size)) {
LOG_ERROR(Service_Audio, "Invalid ADPCM start/end wavebuffer sizes!");
- error_info[0].error_code = Service::Audio::ERR_INVALID_UPDATE_DATA;
+ error_info[0].error_code = Service::Audio::ResultInvalidUpdateInfo;
error_info[0].address = wave_buffer_internal.address;
return;
}
@@ -228,7 +228,7 @@ void VoiceInfo::UpdateWaveBuffer(std::span<BehaviorInfo::ErrorInfo> error_info,
if (wave_buffer_internal.start_offset < 0 || wave_buffer_internal.end_offset < 0) {
LOG_ERROR(Service_Audio, "Invalid input start/end wavebuffer sizes!");
- error_info[0].error_code = Service::Audio::ERR_INVALID_UPDATE_DATA;
+ error_info[0].error_code = Service::Audio::ResultInvalidUpdateInfo;
error_info[0].address = wave_buffer_internal.address;
return;
}