Skip to content

Commit 36da7b4

Browse files
committed
Fixed incorrect sample count in ConverterNChannels
1 parent c141420 commit 36da7b4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/AudioTools/Filter.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ class ConverterNChannels : public BaseConverter<T> {
419419

420420
// convert all samples for each channel separately
421421
size_t convert(uint8_t *src, size_t size) {
422-
int count = size / channels;
422+
int count = size / channels / sizeof(T);
423423
T *sample = (T *)src;
424424
for (size_t j = 0; j < count; j++) {
425425
for (int channel = 0; channel < channels; channel++) {
@@ -437,4 +437,4 @@ class ConverterNChannels : public BaseConverter<T> {
437437
int channels;
438438
};
439439

440-
} // namespace audio_tools
440+
} // namespace audio_tools

0 commit comments

Comments
 (0)