mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Audio: Cleanup buffer wrap code.
This is a bit more straight-forward.
This commit is contained in:
parent
14bf5de83c
commit
01b99eff98
1 changed files with 7 additions and 5 deletions
|
@ -118,7 +118,8 @@ inline void ClampBufferToS16(s16 *out, const s32 *in, size_t size, s8 volShift)
|
|||
size -= 8;
|
||||
}
|
||||
#elif PPSSPP_ARCH(ARM_NEON)
|
||||
int16x4_t signedVolShift = vdup_n_s16 (-volShift); // Can only dynamic-shift right, but by a signed integer
|
||||
// Dynamic shifts can only be left, but it's signed - negate to shift right.
|
||||
int16x4_t signedVolShift = vdup_n_s16(-volShift);
|
||||
while (size >= 8) {
|
||||
int32x4_t in1 = vld1q_s32(in);
|
||||
int32x4_t in2 = vld1q_s32(in + 4);
|
||||
|
@ -281,10 +282,11 @@ void StereoResampler::PushSamples(const s32 *samples, unsigned int numSamples) {
|
|||
return;
|
||||
}
|
||||
|
||||
int over_bytes = numSamples * 4 - (m_maxBufsize * 2 - (indexW & INDEX_MASK)) * sizeof(short);
|
||||
if (over_bytes > 0) {
|
||||
ClampBufferToS16WithVolume(&m_buffer[indexW & INDEX_MASK], samples, (numSamples * 4 - over_bytes) / 2);
|
||||
ClampBufferToS16WithVolume(&m_buffer[0], samples + (numSamples * 4 - over_bytes) / sizeof(short), over_bytes / 2);
|
||||
// Check if we need to roll over to the start of the buffer during the copy.
|
||||
int indexW_left_samples = m_maxBufsize * 2 - (indexW & INDEX_MASK);
|
||||
if (numSamples * 2 > indexW_left_samples) {
|
||||
ClampBufferToS16WithVolume(&m_buffer[indexW & INDEX_MASK], samples, indexW_left_samples);
|
||||
ClampBufferToS16WithVolume(&m_buffer[0], samples + indexW_left_samples, numSamples * 2 - indexW_left_samples);
|
||||
} else {
|
||||
ClampBufferToS16WithVolume(&m_buffer[indexW & INDEX_MASK], samples, numSamples * 2);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue