diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/audio_core/command_generator.cpp | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/src/audio_core/command_generator.cpp b/src/audio_core/command_generator.cpp index 7f65511ff..8f7da49e6 100644 --- a/src/audio_core/command_generator.cpp +++ b/src/audio_core/command_generator.cpp | |||
| @@ -196,7 +196,7 @@ void CommandGenerator::PreCommand() { | |||
| 196 | for (std::size_t i = 0; i < splitter_context.GetInfoCount(); i++) { | 196 | for (std::size_t i = 0; i < splitter_context.GetInfoCount(); i++) { |
| 197 | const auto& base = splitter_context.GetInfo(i); | 197 | const auto& base = splitter_context.GetInfo(i); |
| 198 | std::string graph = fmt::format("b[{}]", i); | 198 | std::string graph = fmt::format("b[{}]", i); |
| 199 | auto* head = base.GetHead(); | 199 | const auto* head = base.GetHead(); |
| 200 | while (head != nullptr) { | 200 | while (head != nullptr) { |
| 201 | graph += fmt::format("->{}", head->GetMixId()); | 201 | graph += fmt::format("->{}", head->GetMixId()); |
| 202 | head = head->GetNextDestination(); | 202 | head = head->GetNextDestination(); |
| @@ -214,7 +214,7 @@ void CommandGenerator::PostCommand() { | |||
| 214 | 214 | ||
| 215 | void CommandGenerator::GenerateDataSourceCommand(ServerVoiceInfo& voice_info, VoiceState& dsp_state, | 215 | void CommandGenerator::GenerateDataSourceCommand(ServerVoiceInfo& voice_info, VoiceState& dsp_state, |
| 216 | s32 channel) { | 216 | s32 channel) { |
| 217 | auto& in_params = voice_info.GetInParams(); | 217 | const auto& in_params = voice_info.GetInParams(); |
| 218 | const auto depop = in_params.should_depop; | 218 | const auto depop = in_params.should_depop; |
| 219 | 219 | ||
| 220 | if (depop) { | 220 | if (depop) { |
| @@ -405,7 +405,7 @@ void CommandGenerator::GenerateBiquadFilterEffectCommand(s32 mix_buffer_offset, | |||
| 405 | } | 405 | } |
| 406 | 406 | ||
| 407 | void CommandGenerator::GenerateAuxCommand(s32 mix_buffer_offset, EffectBase* info, bool enabled) { | 407 | void CommandGenerator::GenerateAuxCommand(s32 mix_buffer_offset, EffectBase* info, bool enabled) { |
| 408 | auto aux = dynamic_cast<EffectAuxInfo*>(info); | 408 | auto* aux = dynamic_cast<EffectAuxInfo*>(info); |
| 409 | const auto& params = aux->GetParams(); | 409 | const auto& params = aux->GetParams(); |
| 410 | if (aux->GetSendBuffer() != 0 && aux->GetRecvBuffer() != 0) { | 410 | if (aux->GetSendBuffer() != 0 && aux->GetRecvBuffer() != 0) { |
| 411 | const auto max_channels = params.count; | 411 | const auto max_channels = params.count; |
| @@ -571,7 +571,7 @@ void CommandGenerator::GenerateSubMixCommand(ServerMixInfo& mix_info) { | |||
| 571 | if (dumping_frame) { | 571 | if (dumping_frame) { |
| 572 | LOG_DEBUG(Audio, "(DSP_TRACE) GenerateSubMixCommand"); | 572 | LOG_DEBUG(Audio, "(DSP_TRACE) GenerateSubMixCommand"); |
| 573 | } | 573 | } |
| 574 | auto& in_params = mix_info.GetInParams(); | 574 | const auto& in_params = mix_info.GetInParams(); |
| 575 | GenerateDepopForMixBuffersCommand(in_params.buffer_count, in_params.buffer_offset, | 575 | GenerateDepopForMixBuffersCommand(in_params.buffer_count, in_params.buffer_offset, |
| 576 | in_params.sample_rate); | 576 | in_params.sample_rate); |
| 577 | 577 | ||
| @@ -674,7 +674,7 @@ void CommandGenerator::GenerateFinalMixCommand() { | |||
| 674 | 674 | ||
| 675 | s32 CommandGenerator::DecodePcm16(ServerVoiceInfo& voice_info, VoiceState& dsp_state, | 675 | s32 CommandGenerator::DecodePcm16(ServerVoiceInfo& voice_info, VoiceState& dsp_state, |
| 676 | s32 sample_count, s32 channel, std::size_t mix_offset) { | 676 | s32 sample_count, s32 channel, std::size_t mix_offset) { |
| 677 | auto& in_params = voice_info.GetInParams(); | 677 | const auto& in_params = voice_info.GetInParams(); |
| 678 | const auto& wave_buffer = in_params.wave_buffer[dsp_state.wave_buffer_index]; | 678 | const auto& wave_buffer = in_params.wave_buffer[dsp_state.wave_buffer_index]; |
| 679 | if (wave_buffer.buffer_address == 0) { | 679 | if (wave_buffer.buffer_address == 0) { |
| 680 | return 0; | 680 | return 0; |
| @@ -714,7 +714,7 @@ s32 CommandGenerator::DecodePcm16(ServerVoiceInfo& voice_info, VoiceState& dsp_s | |||
| 714 | 714 | ||
| 715 | s32 CommandGenerator::DecodeAdpcm(ServerVoiceInfo& voice_info, VoiceState& dsp_state, | 715 | s32 CommandGenerator::DecodeAdpcm(ServerVoiceInfo& voice_info, VoiceState& dsp_state, |
| 716 | s32 sample_count, s32 channel, std::size_t mix_offset) { | 716 | s32 sample_count, s32 channel, std::size_t mix_offset) { |
| 717 | auto& in_params = voice_info.GetInParams(); | 717 | const auto& in_params = voice_info.GetInParams(); |
| 718 | const auto& wave_buffer = in_params.wave_buffer[dsp_state.wave_buffer_index]; | 718 | const auto& wave_buffer = in_params.wave_buffer[dsp_state.wave_buffer_index]; |
| 719 | if (wave_buffer.buffer_address == 0) { | 719 | if (wave_buffer.buffer_address == 0) { |
| 720 | return 0; | 720 | return 0; |
| @@ -766,8 +766,8 @@ s32 CommandGenerator::DecodeAdpcm(ServerVoiceInfo& voice_info, VoiceState& dsp_s | |||
| 766 | val = std::clamp<s32>(val, -32768, 32767); | 766 | val = std::clamp<s32>(val, -32768, 32767); |
| 767 | // Advance output feedback. | 767 | // Advance output feedback. |
| 768 | yn2 = yn1; | 768 | yn2 = yn1; |
| 769 | yn1 = val; | 769 | yn1 = static_cast<s16>(val); |
| 770 | return static_cast<s16>(val); | 770 | return yn1; |
| 771 | }; | 771 | }; |
| 772 | 772 | ||
| 773 | std::size_t buffer_offset{}; | 773 | std::size_t buffer_offset{}; |
| @@ -853,7 +853,7 @@ void CommandGenerator::DecodeFromWaveBuffers(ServerVoiceInfo& voice_info, s32* o | |||
| 853 | VoiceState& dsp_state, s32 channel, | 853 | VoiceState& dsp_state, s32 channel, |
| 854 | s32 target_sample_rate, s32 sample_count, | 854 | s32 target_sample_rate, s32 sample_count, |
| 855 | s32 node_id) { | 855 | s32 node_id) { |
| 856 | auto& in_params = voice_info.GetInParams(); | 856 | const auto& in_params = voice_info.GetInParams(); |
| 857 | if (dumping_frame) { | 857 | if (dumping_frame) { |
| 858 | LOG_DEBUG(Audio, | 858 | LOG_DEBUG(Audio, |
| 859 | "(DSP_TRACE) DecodeFromWaveBuffers, node_id={}, channel={}, " | 859 | "(DSP_TRACE) DecodeFromWaveBuffers, node_id={}, channel={}, " |
| @@ -867,7 +867,8 @@ void CommandGenerator::DecodeFromWaveBuffers(ServerVoiceInfo& voice_info, s32* o | |||
| 867 | static_cast<float>(in_params.sample_rate) / static_cast<float>(target_sample_rate) * | 867 | static_cast<float>(in_params.sample_rate) / static_cast<float>(target_sample_rate) * |
| 868 | static_cast<float>(static_cast<s32>(in_params.pitch * 32768.0f))); | 868 | static_cast<float>(static_cast<s32>(in_params.pitch * 32768.0f))); |
| 869 | auto* output_base = output; | 869 | auto* output_base = output; |
| 870 | if ((dsp_state.fraction + sample_count * resample_rate) > (SCALED_MIX_BUFFER_SIZE - 4ULL)) { | 870 | if (dsp_state.fraction + sample_count * resample_rate > |
| 871 | static_cast<s32>(SCALED_MIX_BUFFER_SIZE - 4ULL)) { | ||
| 871 | return; | 872 | return; |
| 872 | } | 873 | } |
| 873 | 874 | ||