mirror of
https://github.com/ekeeke/Genesis-Plus-GX.git
synced 2024-11-10 21:05:12 +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. */
|
/* Updates tone amplitude in delta buffer. Call whenever amplitude might have changed. */
|
||||||
INLINE void UpdateToneAmplitude(int i, int time)
|
INLINE void UpdateToneAmplitude(int i, int time)
|
||||||
{
|
{
|
||||||
int delta;
|
/* left & right output */
|
||||||
|
int delta_l = (SN76489.Channel[i][0] * SN76489.ToneFreqPos[i]) - SN76489.ChanOut[i][0];
|
||||||
/* left output */
|
int delta_r = (SN76489.Channel[i][1] * SN76489.ToneFreqPos[i]) - SN76489.ChanOut[i][1];
|
||||||
delta = (SN76489.Channel[i][0] * SN76489.ToneFreqPos[i]) - SN76489.ChanOut[i][0];
|
blip_add_delta(snd.blips[0], time, delta_l, delta_r);
|
||||||
if (delta != 0)
|
SN76489.ChanOut[i][0] += delta_l;
|
||||||
{
|
SN76489.ChanOut[i][1] += delta_r;
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Updates noise amplitude in delta buffer. Call whenever amplitude might have changed. */
|
/* Updates noise amplitude in delta buffer. Call whenever amplitude might have changed. */
|
||||||
INLINE void UpdateNoiseAmplitude(int time)
|
INLINE void UpdateNoiseAmplitude(int time)
|
||||||
{
|
{
|
||||||
int delta;
|
/* left & right output */
|
||||||
|
int delta_l = (SN76489.Channel[3][0] * ( SN76489.NoiseShiftRegister & 0x1 )) - SN76489.ChanOut[3][0];
|
||||||
/* left output */
|
int delta_r = (SN76489.Channel[3][1] * ( SN76489.NoiseShiftRegister & 0x1 )) - SN76489.ChanOut[3][1];
|
||||||
delta = (SN76489.Channel[3][0] * ( SN76489.NoiseShiftRegister & 0x1 )) - SN76489.ChanOut[3][0];
|
blip_add_delta(snd.blips[0], time, delta_l, delta_r);
|
||||||
if (delta != 0)
|
SN76489.ChanOut[3][0] += delta_l;
|
||||||
{
|
SN76489.ChanOut[3][1] += delta_r;
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Runs tone channel for clock_length clocks */
|
/* Runs tone channel for clock_length clocks */
|
||||||
|
Loading…
Reference in New Issue
Block a user