diff options
| author | 2020-07-25 12:32:05 +1000 | |
|---|---|---|
| committer | 2020-07-25 12:39:37 +1000 | |
| commit | b924c71822225b6de396b687debb93c1af59e2d6 (patch) | |
| tree | 00a200376275423a7bd58204ec21fae6ae0da846 /src/audio_core/voice_context.cpp | |
| parent | Queue extra mix buffer (diff) | |
| download | yuzu-b924c71822225b6de396b687debb93c1af59e2d6.tar.gz yuzu-b924c71822225b6de396b687debb93c1af59e2d6.tar.xz yuzu-b924c71822225b6de396b687debb93c1af59e2d6.zip | |
Address issues
Diffstat (limited to 'src/audio_core/voice_context.cpp')
| -rw-r--r-- | src/audio_core/voice_context.cpp | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/src/audio_core/voice_context.cpp b/src/audio_core/voice_context.cpp index 038595ae0..1d8f69844 100644 --- a/src/audio_core/voice_context.cpp +++ b/src/audio_core/voice_context.cpp | |||
| @@ -29,12 +29,12 @@ void ServerVoiceChannelResource::Update(VoiceChannelResource::InParams& in_param | |||
| 29 | in_use = in_params.in_use; | 29 | in_use = in_params.in_use; |
| 30 | // Update our mix volumes only if it's in use | 30 | // Update our mix volumes only if it's in use |
| 31 | if (in_params.in_use) { | 31 | if (in_params.in_use) { |
| 32 | std::copy(in_params.mix_volume.begin(), in_params.mix_volume.end(), mix_volume.begin()); | 32 | mix_volume = in_params.mix_volume; |
| 33 | } | 33 | } |
| 34 | } | 34 | } |
| 35 | 35 | ||
| 36 | void ServerVoiceChannelResource::UpdateLastMixVolumes() { | 36 | void ServerVoiceChannelResource::UpdateLastMixVolumes() { |
| 37 | std::copy(mix_volume.begin(), mix_volume.end(), last_mix_volume.begin()); | 37 | last_mix_volume = mix_volume; |
| 38 | } | 38 | } |
| 39 | 39 | ||
| 40 | const std::array<float, AudioCommon::MAX_MIX_BUFFERS>& | 40 | const std::array<float, AudioCommon::MAX_MIX_BUFFERS>& |
| @@ -64,8 +64,7 @@ void ServerVoiceInfo::Initialize() { | |||
| 64 | in_params.pitch = 0.0f; | 64 | in_params.pitch = 0.0f; |
| 65 | in_params.volume = 0.0f; | 65 | in_params.volume = 0.0f; |
| 66 | in_params.last_volume = 0.0f; | 66 | in_params.last_volume = 0.0f; |
| 67 | std::memset(in_params.biquad_filter.data(), 0, | 67 | in_params.biquad_filter.fill({}); |
| 68 | sizeof(BiquadFilterParameter) * in_params.biquad_filter.size()); | ||
| 69 | in_params.wave_buffer_count = 0; | 68 | in_params.wave_buffer_count = 0; |
| 70 | in_params.wave_bufffer_head = 0; | 69 | in_params.wave_bufffer_head = 0; |
| 71 | in_params.mix_id = AudioCommon::NO_MIX; | 70 | in_params.mix_id = AudioCommon::NO_MIX; |
| @@ -78,8 +77,7 @@ void ServerVoiceInfo::Initialize() { | |||
| 78 | in_params.voice_drop_flag = false; | 77 | in_params.voice_drop_flag = false; |
| 79 | in_params.buffer_mapped = false; | 78 | in_params.buffer_mapped = false; |
| 80 | in_params.wave_buffer_flush_request_count = 0; | 79 | in_params.wave_buffer_flush_request_count = 0; |
| 81 | std::fill(in_params.was_biquad_filter_enabled.begin(), | 80 | in_params.was_biquad_filter_enabled.fill(false); |
| 82 | in_params.was_biquad_filter_enabled.end(), false); | ||
| 83 | 81 | ||
| 84 | for (auto& wave_buffer : in_params.wave_buffer) { | 82 | for (auto& wave_buffer : in_params.wave_buffer) { |
| 85 | wave_buffer.start_sample_offset = 0; | 83 | wave_buffer.start_sample_offset = 0; |
| @@ -126,8 +124,7 @@ void ServerVoiceInfo::UpdateParameters(const VoiceInfo::InParams& voice_in, | |||
| 126 | in_params.channel_count = voice_in.channel_count; | 124 | in_params.channel_count = voice_in.channel_count; |
| 127 | in_params.pitch = voice_in.pitch; | 125 | in_params.pitch = voice_in.pitch; |
| 128 | in_params.volume = voice_in.volume; | 126 | in_params.volume = voice_in.volume; |
| 129 | std::memcpy(in_params.biquad_filter.data(), voice_in.biquad_filter.data(), | 127 | in_params.biquad_filter = voice_in.biquad_filter; |
| 130 | sizeof(BiquadFilterParameter) * voice_in.biquad_filter.size()); | ||
| 131 | in_params.wave_buffer_count = voice_in.wave_buffer_count; | 128 | in_params.wave_buffer_count = voice_in.wave_buffer_count; |
| 132 | in_params.wave_bufffer_head = voice_in.wave_buffer_head; | 129 | in_params.wave_bufffer_head = voice_in.wave_buffer_head; |
| 133 | if (behavior_info.IsFlushVoiceWaveBuffersSupported()) { | 130 | if (behavior_info.IsFlushVoiceWaveBuffersSupported()) { |
| @@ -308,7 +305,7 @@ void ServerVoiceInfo::ResetResources(VoiceContext& voice_context) { | |||
| 308 | const auto channel_resource = in_params.voice_channel_resource_id[i]; | 305 | const auto channel_resource = in_params.voice_channel_resource_id[i]; |
| 309 | auto& dsp_state = | 306 | auto& dsp_state = |
| 310 | voice_context.GetDspSharedState(static_cast<std::size_t>(channel_resource)); | 307 | voice_context.GetDspSharedState(static_cast<std::size_t>(channel_resource)); |
| 311 | std::memset(&dsp_state, 0, sizeof(VoiceState)); | 308 | dsp_state = {}; |
| 312 | voice_context.GetChannelResource(static_cast<std::size_t>(channel_resource)) | 309 | voice_context.GetChannelResource(static_cast<std::size_t>(channel_resource)) |
| 313 | .UpdateLastMixVolumes(); | 310 | .UpdateLastMixVolumes(); |
| 314 | } | 311 | } |
| @@ -362,9 +359,8 @@ bool ServerVoiceInfo::UpdateParametersForCommandGeneration( | |||
| 362 | dsp_state->offset = 0; | 359 | dsp_state->offset = 0; |
| 363 | dsp_state->played_sample_count = 0; | 360 | dsp_state->played_sample_count = 0; |
| 364 | dsp_state->fraction = 0; | 361 | dsp_state->fraction = 0; |
| 365 | std::memset(dsp_state->sample_history.data(), 0, | 362 | dsp_state->sample_history.fill(0); |
| 366 | sizeof(s32) * dsp_state->sample_history.size()); | 363 | dsp_state->context = {}; |
| 367 | std::memset(&dsp_state->context, 0, sizeof(dsp_state->context)); | ||
| 368 | } | 364 | } |
| 369 | 365 | ||
| 370 | in_params.current_playstate = ServerPlayState::Stop; | 366 | in_params.current_playstate = ServerPlayState::Stop; |
| @@ -524,8 +520,7 @@ void VoiceContext::SortInfo() { | |||
| 524 | } | 520 | } |
| 525 | 521 | ||
| 526 | void VoiceContext::UpdateStateByDspShared() { | 522 | void VoiceContext::UpdateStateByDspShared() { |
| 527 | std::memcpy(voice_states.data(), dsp_voice_states.data(), | 523 | voice_states = dsp_voice_states; |
| 528 | sizeof(VoiceState) * dsp_voice_states.size()); | ||
| 529 | } | 524 | } |
| 530 | 525 | ||
| 531 | } // namespace AudioCore | 526 | } // namespace AudioCore |