Increase buffer size. Don't use sizeof on heap buffer (returns pointer size).

This commit is contained in:
Brandon Wright 2016-11-03 14:45:20 -05:00
parent 3c0f6bfdee
commit add3a16f25
3 changed files with 14 additions and 3 deletions

View File

@ -336,9 +336,9 @@ bool8 S9xMixSamples (uint8 *buffer, int sample_count)
{
if (msu::resampler->avail() >= sample_count)
{
uint8 *msu_sample = new uint8[sizeof(dest)];
uint8 *msu_sample = new uint8[shrink_buffer_size];
msu::resampler->read((short *)msu_sample, sample_count);
for(uint32 i = 0; i < sizeof(dest); ++i)
for(uint32 i = 0; i < sample_count; ++i)
dest[i] += msu_sample[i];
}
}
@ -481,7 +481,12 @@ bool8 S9xInitSound (int buffer_ms, int lag_ms)
if (Settings.SixteenBitSound)
spc::buffer_size <<= 1;
if (Settings.MSU1)
{
/* MSU1 is 44.1KHz, 16-bit audio */
msu::buffer_size = buffer_ms * 44100 / 1000;
msu::buffer_size *= 2; /* Double byte-count for stereo */
msu::buffer_size *= 2; /* Double byte-count for 16-bit audio */
}
printf("Sound buffer size: %d (%d samples)\n", spc::buffer_size, sample_count);

View File

@ -136,6 +136,11 @@ snes9x_gtk_SOURCES += \
../apu/bapu/smp/smp.cpp \
../apu/bapu/smp/smp_state.cpp
# MSU1
snes9x_gtk_SOURCES += \
../msu1.cpp \
../msu1.h
# DSP
snes9x_gtk_SOURCES += \
../dsp.cpp \

View File

@ -201,6 +201,7 @@
#endif
#include <ctype.h>
#include <sys/stat.h>
#include "snes9x.h"
#include "memmap.h"
@ -1889,7 +1890,7 @@ bool8 CMemory::LoadMultiCartInt ()
memmove(ROM + Multi.cartOffsetA, ROM, Multi.cartSizeA + Multi.cartSizeB);
else if(Multi.cartOffsetB) // clear cart A so the bios can detect that it's not present
memset(ROM, 0, Multi.cartOffsetB);
FILE *fp;
size_t size;
char path[PATH_MAX + 1];