mirror of https://github.com/snes9xgit/snes9x.git
Fix MSU-1 sample buffer size
This commit is contained in:
parent
14633dec3f
commit
f13676cfd3
17
apu/apu.cpp
17
apu/apu.cpp
|
@ -336,10 +336,19 @@ bool8 S9xMixSamples (uint8 *buffer, int sample_count)
|
||||||
{
|
{
|
||||||
if (msu::resampler->avail() >= sample_count)
|
if (msu::resampler->avail() >= sample_count)
|
||||||
{
|
{
|
||||||
uint8 *msu_sample = new uint8[sizeof(dest)];
|
uint8 *msu_sample = new uint8[sample_count * 2];
|
||||||
msu::resampler->read((short *)msu_sample, sample_count);
|
msu::resampler->read((short *)msu_sample, sample_count);
|
||||||
for(uint32 i = 0; i < sizeof(dest); ++i)
|
for (uint32 i = 0; i < sample_count * 2; i += 2)
|
||||||
dest[i] += msu_sample[i];
|
{
|
||||||
|
int16 s1, s2;
|
||||||
|
((uint8 *)&s1)[0] = dest[i];
|
||||||
|
((uint8 *)&s1)[1] = dest[i + 1];
|
||||||
|
((uint8 *)&s2)[0] = dest[i];
|
||||||
|
((uint8 *)&s2)[1] = dest[i + 1];
|
||||||
|
s1 += s2;
|
||||||
|
dest[i] = ((uint8 *)&s1)[0];
|
||||||
|
dest[i+1] = ((uint8 *)&s1)[1];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -481,7 +490,7 @@ bool8 S9xInitSound (int buffer_ms, int lag_ms)
|
||||||
if (Settings.SixteenBitSound)
|
if (Settings.SixteenBitSound)
|
||||||
spc::buffer_size <<= 1;
|
spc::buffer_size <<= 1;
|
||||||
if (Settings.MSU1)
|
if (Settings.MSU1)
|
||||||
msu::buffer_size = buffer_ms * 44100 / 1000;
|
msu::buffer_size = (buffer_ms * 44100 / 1000) << 2; // 16-bit, Stereo
|
||||||
|
|
||||||
printf("Sound buffer size: %d (%d samples)\n", spc::buffer_size, sample_count);
|
printf("Sound buffer size: %d (%d samples)\n", spc::buffer_size, sample_count);
|
||||||
|
|
||||||
|
|
1
ppu.cpp
1
ppu.cpp
|
@ -1130,6 +1130,7 @@ uint8 S9xGetPPU (uint16 Address)
|
||||||
if ((Address & 0xffc0) == 0x2140) // APUIO0, APUIO1, APUIO2, APUIO3
|
if ((Address & 0xffc0) == 0x2140) // APUIO0, APUIO1, APUIO2, APUIO3
|
||||||
// read_port will run the APU until given APU time before reading value
|
// read_port will run the APU until given APU time before reading value
|
||||||
return (S9xAPUReadPort(Address & 3));
|
return (S9xAPUReadPort(Address & 3));
|
||||||
|
else
|
||||||
if (Address <= 0x2183)
|
if (Address <= 0x2183)
|
||||||
{
|
{
|
||||||
uint8 byte;
|
uint8 byte;
|
||||||
|
|
Loading…
Reference in New Issue