mirror of https://github.com/snes9xgit/snes9x.git
Merge branch 'msu1' of github.com:snes9xgit/snes9x into msu1
This commit is contained in:
commit
8dd1ef0047
20
apu/apu.cpp
20
apu/apu.cpp
|
@ -338,8 +338,17 @@ bool8 S9xMixSamples (uint8 *buffer, int sample_count)
|
|||
{
|
||||
uint8 *msu_sample = new uint8[sample_count * 2];
|
||||
msu::resampler->read((short *)msu_sample, sample_count);
|
||||
for(uint32 i = 0; i < sample_count; ++i)
|
||||
dest[i] += msu_sample[i];
|
||||
for (uint32 i = 0; i < sample_count * 2; i += 2)
|
||||
{
|
||||
int16 s1, s2;
|
||||
((uint8 *)&s1)[0] = dest[i];
|
||||
((uint8 *)&s1)[1] = dest[i + 1];
|
||||
((uint8 *)&s2)[0] = msu_sample[i];
|
||||
((uint8 *)&s2)[1] = msu_sample[i + 1];
|
||||
s1 += s2;
|
||||
dest[i] = ((uint8 *)&s1)[0];
|
||||
dest[i+1] = ((uint8 *)&s1)[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -483,12 +492,7 @@ 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 */
|
||||
}
|
||||
msu::buffer_size = (buffer_ms * 44100 / 1000) << 2; // 16-bit, Stereo
|
||||
|
||||
printf("Sound buffer size: %d (%d samples)\n", spc::buffer_size, sample_count);
|
||||
|
||||
|
|
Loading…
Reference in New Issue