Skip to content

Commit cc2581a

Browse files
Properly wrap AudioBufferManager block writes (#2725)
The memcpy-version of the ABM::write updated the destination and count but neglected to move the source forward. If a block write crossed a frame boundary then the 2nd frame would repeat the data from the first half of the buffer. Fix by incrementing the source pointer by the same amount as was written.
1 parent bb682bb commit cc2581a

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

libraries/AudioBufferManager/src/AudioBufferManager.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ size_t AudioBufferManager::write(const uint32_t *v, size_t words, bool sync) {
209209
size_t availToWriteThisBuff = _wordsPerBuffer - _userOff;
210210
size_t toWrite = std::min(availToWriteThisBuff, words);
211211
memcpy(&((*p)->buff[_userOff]), v, toWrite * sizeof(uint32_t));
212+
v += toWrite;
212213
written += toWrite;
213214
_userOff += toWrite;
214215
words -= toWrite;

0 commit comments

Comments
 (0)