summaryrefslogtreecommitdiffstats
path: root/src/audio_core
diff options
context:
space:
mode:
authorSubv <subv2112@gmail.com>2017-09-25 20:06:42 +0200
committerSubv <subv2112@gmail.com>2017-09-26 01:31:37 +0200
commitd7459354f58d1b71fc0c5ec48de9242e6a2fd00c (patch)
tree20aa98adee17b0a2886273806a62f333d1198ab4 /src/audio_core
parentMerge pull request #2952 from MerryMage/page-tables (diff)
downloadyuzu-d7459354f58d1b71fc0c5ec48de9242e6a2fd00c.tar
yuzu-d7459354f58d1b71fc0c5ec48de9242e6a2fd00c.tar.gz
yuzu-d7459354f58d1b71fc0c5ec48de9242e6a2fd00c.tar.bz2
yuzu-d7459354f58d1b71fc0c5ec48de9242e6a2fd00c.tar.lz
yuzu-d7459354f58d1b71fc0c5ec48de9242e6a2fd00c.tar.xz
yuzu-d7459354f58d1b71fc0c5ec48de9242e6a2fd00c.tar.zst
yuzu-d7459354f58d1b71fc0c5ec48de9242e6a2fd00c.zip
Diffstat (limited to '')
-rw-r--r--src/audio_core/codec.cpp4
-rw-r--r--src/audio_core/codec.h4
-rw-r--r--src/audio_core/hle/source.h2
-rw-r--r--src/audio_core/interpolate.cpp2
-rw-r--r--src/audio_core/interpolate.h4
5 files changed, 9 insertions, 7 deletions
diff --git a/src/audio_core/codec.cpp b/src/audio_core/codec.cpp
index 7a3bd7eb3..6fba9fdae 100644
--- a/src/audio_core/codec.cpp
+++ b/src/audio_core/codec.cpp
@@ -117,7 +117,9 @@ StereoBuffer16 DecodePCM16(const unsigned num_channels, const u8* const data,
ret[i].fill(sample);
}
} else {
- std::memcpy(ret.data(), data, sample_count * 2 * sizeof(u16));
+ for (size_t i = 0; i < sample_count; ++i) {
+ std::memcpy(&ret[i], data + i * sizeof(s16) * 2, 2 * sizeof(s16));
+ }
}
return ret;
diff --git a/src/audio_core/codec.h b/src/audio_core/codec.h
index 2b0c395e6..877b2202d 100644
--- a/src/audio_core/codec.h
+++ b/src/audio_core/codec.h
@@ -5,13 +5,13 @@
#pragma once
#include <array>
-#include <vector>
+#include <deque>
#include "common/common_types.h"
namespace Codec {
/// A variable length buffer of signed PCM16 stereo samples.
-using StereoBuffer16 = std::vector<std::array<s16, 2>>;
+using StereoBuffer16 = std::deque<std::array<s16, 2>>;
/// See: Codec::DecodeADPCM
struct ADPCMState {
diff --git a/src/audio_core/hle/source.h b/src/audio_core/hle/source.h
index ccb7f064f..c4d2debc2 100644
--- a/src/audio_core/hle/source.h
+++ b/src/audio_core/hle/source.h
@@ -108,7 +108,7 @@ private:
u32 current_sample_number = 0;
u32 next_sample_number = 0;
- std::vector<std::array<s16, 2>> current_buffer;
+ AudioInterp::StereoBuffer16 current_buffer;
// buffer_id state
diff --git a/src/audio_core/interpolate.cpp b/src/audio_core/interpolate.cpp
index 16e68bc5c..83573d772 100644
--- a/src/audio_core/interpolate.cpp
+++ b/src/audio_core/interpolate.cpp
@@ -47,7 +47,7 @@ static void StepOverSamples(State& state, StereoBuffer16& input, float rate,
state.xn1 = input[inputi + 1];
state.fposition = fposition - inputi * scale_factor;
- input.erase(input.begin(), input.begin() + inputi + 2);
+ input.erase(input.begin(), std::next(input.begin(), inputi + 2));
}
void None(State& state, StereoBuffer16& input, float rate, DSP::HLE::StereoFrame16& output,
diff --git a/src/audio_core/interpolate.h b/src/audio_core/interpolate.h
index 59f59bc14..8dff6111a 100644
--- a/src/audio_core/interpolate.h
+++ b/src/audio_core/interpolate.h
@@ -5,14 +5,14 @@
#pragma once
#include <array>
-#include <vector>
+#include <deque>
#include "audio_core/hle/common.h"
#include "common/common_types.h"
namespace AudioInterp {
/// A variable length buffer of signed PCM16 stereo samples.
-using StereoBuffer16 = std::vector<std::array<s16, 2>>;
+using StereoBuffer16 = std::deque<std::array<s16, 2>>;
struct State {
/// Two historical samples.