summaryrefslogtreecommitdiff
path: root/src/audio_core/audio_renderer.cpp
diff options
context:
space:
mode:
authorGravatar Lioncash2019-11-26 16:29:34 -0500
committerGravatar Lioncash2019-11-26 21:55:39 -0500
commitb05bfc603689419dc515a656b9fc711d79994f13 (patch)
treebc0937d11bbe31458785a69478edbf11a720b0ae /src/audio_core/audio_renderer.cpp
parentcore/memory: Migrate over ZeroBlock() and CopyBlock() to the Memory class (diff)
downloadyuzu-b05bfc603689419dc515a656b9fc711d79994f13.tar.gz
yuzu-b05bfc603689419dc515a656b9fc711d79994f13.tar.xz
yuzu-b05bfc603689419dc515a656b9fc711d79994f13.zip
core/memory: Migrate over Read{8, 16, 32, 64, Block} to the Memory class
With all of the trivial parts of the memory interface moved over, we can get right into moving over the bits that are used. Note that this does require the use of GetInstance from the global system instance to be used within hle_ipc.cpp and the gdbstub. This is fine for the time being, as they both already rely on the global system instance in other functions. These will be removed in a change directed at both of these respectively. For now, it's sufficient, as it still accomplishes the goal of de-globalizing the memory code.
Diffstat (limited to 'src/audio_core/audio_renderer.cpp')
-rw-r--r--src/audio_core/audio_renderer.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/audio_core/audio_renderer.cpp b/src/audio_core/audio_renderer.cpp
index 12e2b7901..c187d8ac5 100644
--- a/src/audio_core/audio_renderer.cpp
+++ b/src/audio_core/audio_renderer.cpp
@@ -259,9 +259,10 @@ void AudioRenderer::VoiceState::UpdateState() {
259} 259}
260 260
261void AudioRenderer::VoiceState::RefreshBuffer(Memory::Memory& memory) { 261void AudioRenderer::VoiceState::RefreshBuffer(Memory::Memory& memory) {
262 std::vector<s16> new_samples(info.wave_buffer[wave_index].buffer_sz / sizeof(s16)); 262 const auto wave_buffer_address = info.wave_buffer[wave_index].buffer_addr;
263 Memory::ReadBlock(info.wave_buffer[wave_index].buffer_addr, new_samples.data(), 263 const auto wave_buffer_size = info.wave_buffer[wave_index].buffer_sz;
264 info.wave_buffer[wave_index].buffer_sz); 264 std::vector<s16> new_samples(wave_buffer_size / sizeof(s16));
265 memory.ReadBlock(wave_buffer_address, new_samples.data(), wave_buffer_size);
265 266
266 switch (static_cast<Codec::PcmFormat>(info.sample_format)) { 267 switch (static_cast<Codec::PcmFormat>(info.sample_format)) {
267 case Codec::PcmFormat::Int16: { 268 case Codec::PcmFormat::Int16: {
@@ -271,7 +272,7 @@ void AudioRenderer::VoiceState::RefreshBuffer(Memory::Memory& memory) {
271 case Codec::PcmFormat::Adpcm: { 272 case Codec::PcmFormat::Adpcm: {
272 // Decode ADPCM to PCM16 273 // Decode ADPCM to PCM16
273 Codec::ADPCM_Coeff coeffs; 274 Codec::ADPCM_Coeff coeffs;
274 Memory::ReadBlock(info.additional_params_addr, coeffs.data(), sizeof(Codec::ADPCM_Coeff)); 275 memory.ReadBlock(info.additional_params_addr, coeffs.data(), sizeof(Codec::ADPCM_Coeff));
275 new_samples = Codec::DecodeADPCM(reinterpret_cast<u8*>(new_samples.data()), 276 new_samples = Codec::DecodeADPCM(reinterpret_cast<u8*>(new_samples.data()),
276 new_samples.size() * sizeof(s16), coeffs, adpcm_state); 277 new_samples.size() * sizeof(s16), coeffs, adpcm_state);
277 break; 278 break;
@@ -314,13 +315,13 @@ void AudioRenderer::EffectState::UpdateState(Memory::Memory& memory) {
314 out_status.state = EffectStatus::New; 315 out_status.state = EffectStatus::New;
315 } else { 316 } else {
316 if (info.type == Effect::Aux) { 317 if (info.type == Effect::Aux) {
317 ASSERT_MSG(Memory::Read32(info.aux_info.return_buffer_info) == 0, 318 ASSERT_MSG(memory.Read32(info.aux_info.return_buffer_info) == 0,
318 "Aux buffers tried to update"); 319 "Aux buffers tried to update");
319 ASSERT_MSG(Memory::Read32(info.aux_info.send_buffer_info) == 0, 320 ASSERT_MSG(memory.Read32(info.aux_info.send_buffer_info) == 0,
320 "Aux buffers tried to update"); 321 "Aux buffers tried to update");
321 ASSERT_MSG(Memory::Read32(info.aux_info.return_buffer_base) == 0, 322 ASSERT_MSG(memory.Read32(info.aux_info.return_buffer_base) == 0,
322 "Aux buffers tried to update"); 323 "Aux buffers tried to update");
323 ASSERT_MSG(Memory::Read32(info.aux_info.send_buffer_base) == 0, 324 ASSERT_MSG(memory.Read32(info.aux_info.send_buffer_base) == 0,
324 "Aux buffers tried to update"); 325 "Aux buffers tried to update");
325 } 326 }
326 } 327 }