mirror of
https://github.com/ekeeke/Genesis-Plus-GX.git
synced 2024-12-27 03:31:49 +01:00
[Core/Sound] optimized Blip Buffer implementation for stereo streams (thanks to David Knight for original idea)
This commit is contained in:
parent
25626ea251
commit
cb2193583b
@ -167,45 +167,23 @@ int SN76489_GetContextSize(void)
|
||||
/* Updates tone amplitude in delta buffer. Call whenever amplitude might have changed. */
|
||||
INLINE void UpdateToneAmplitude(int i, int time)
|
||||
{
|
||||
int delta;
|
||||
|
||||
/* left output */
|
||||
delta = (SN76489.Channel[i][0] * SN76489.ToneFreqPos[i]) - SN76489.ChanOut[i][0];
|
||||
if (delta != 0)
|
||||
{
|
||||
SN76489.ChanOut[i][0] += delta;
|
||||
blip_add_delta(snd.blips[0][0], time, delta);
|
||||
}
|
||||
|
||||
/* right output */
|
||||
delta = (SN76489.Channel[i][1] * SN76489.ToneFreqPos[i]) - SN76489.ChanOut[i][1];
|
||||
if (delta != 0)
|
||||
{
|
||||
SN76489.ChanOut[i][1] += delta;
|
||||
blip_add_delta(snd.blips[0][1], time, delta);
|
||||
}
|
||||
/* left & right output */
|
||||
int delta_l = (SN76489.Channel[i][0] * SN76489.ToneFreqPos[i]) - SN76489.ChanOut[i][0];
|
||||
int delta_r = (SN76489.Channel[i][1] * SN76489.ToneFreqPos[i]) - SN76489.ChanOut[i][1];
|
||||
blip_add_delta(snd.blips[0], time, delta_l, delta_r);
|
||||
SN76489.ChanOut[i][0] += delta_l;
|
||||
SN76489.ChanOut[i][1] += delta_r;
|
||||
}
|
||||
|
||||
/* Updates noise amplitude in delta buffer. Call whenever amplitude might have changed. */
|
||||
INLINE void UpdateNoiseAmplitude(int time)
|
||||
{
|
||||
int delta;
|
||||
|
||||
/* left output */
|
||||
delta = (SN76489.Channel[3][0] * ( SN76489.NoiseShiftRegister & 0x1 )) - SN76489.ChanOut[3][0];
|
||||
if (delta != 0)
|
||||
{
|
||||
SN76489.ChanOut[3][0] += delta;
|
||||
blip_add_delta(snd.blips[0][0], time, delta);
|
||||
}
|
||||
|
||||
/* right output */
|
||||
delta = (SN76489.Channel[3][1] * ( SN76489.NoiseShiftRegister & 0x1 )) - SN76489.ChanOut[3][1];
|
||||
if (delta != 0)
|
||||
{
|
||||
SN76489.ChanOut[3][1] += delta;
|
||||
blip_add_delta(snd.blips[0][1], time, delta);
|
||||
}
|
||||
/* left & right output */
|
||||
int delta_l = (SN76489.Channel[3][0] * ( SN76489.NoiseShiftRegister & 0x1 )) - SN76489.ChanOut[3][0];
|
||||
int delta_r = (SN76489.Channel[3][1] * ( SN76489.NoiseShiftRegister & 0x1 )) - SN76489.ChanOut[3][1];
|
||||
blip_add_delta(snd.blips[0], time, delta_l, delta_r);
|
||||
SN76489.ChanOut[3][0] += delta_l;
|
||||
SN76489.ChanOut[3][1] += delta_r;
|
||||
}
|
||||
|
||||
/* Runs tone channel for clock_length clocks */
|
||||
|
Loading…
Reference in New Issue
Block a user