Fix issue causing noise channel to be prematurely short-circuited, fixes the silent sea breeze sound in the music selection screen of Outrun

This commit is contained in:
beirich 2011-03-01 02:57:31 +00:00
parent 209fd44442
commit d3e63df8db
2 changed files with 16 additions and 11 deletions

View File

@ -31,7 +31,7 @@ MML Demo - Echo channels are too loud (equal volume!)
Naxat Open - Crashes when you start new game
New Adventure Island - Minor gfx issues
Night Creatures - Some gfx glitches
Outrun - 'Sea Wind' sample when selecting music is not playing, raster issues, music slows when paused
Outrun - Raster issues, music slows when paused
Populous - Game freezes on starting new game - *** NEEDS BATTERY SAVERAM ***
Power Drift - Timing glitch... starting new game runs slower than it should
R-Type - Funky corruption after killing final boss in Stage 8

View File

@ -150,9 +150,22 @@ namespace BizHawk.Emulation.Sound
private void MixChannel(short[] samples, int start, int len, PSGChannel channel)
{
if (channel.Enabled == false) return;
if (channel.DDA == false && (channel.Frequency == 0 || channel.Volume == 0)) return;
if (channel.DDA == false && channel.Volume == 0) return;
short[] wave = channel.Wave;
int freq;
if (channel.NoiseChannel)
{
wave = Waves.NoiseWave;
freq = channel.NoiseFreq;
} else if (channel.DDA) {
freq = 0;
} else {
if (channel.Frequency == 0) return;
freq = PsgBase / (32 * ((int)channel.Frequency));
}
int freq = PsgBase / (32 * (channel.DDA ? 1 : (int)channel.Frequency));
int leftVol = channel.Panning >> 4;
int rightVol = channel.Panning & 15;
leftVol *= MainVolumeLeft;
@ -160,14 +173,6 @@ namespace BizHawk.Emulation.Sound
leftVol /= 16;
rightVol /= 16;
short[] wave = channel.Wave;
if (channel.NoiseChannel)
{
wave = Waves.NoiseWave;
freq = channel.NoiseFreq;
}
float adjustedWaveLengthInSamples = SampleRate / (channel.NoiseChannel ? freq/(float)(channel.Wave.Length*128) : freq);
float moveThroughWaveRate = wave.Length / adjustedWaveLengthInSamples;