mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-04 23:07:46 -04:00
pico, fix psg sound and fast forward
This commit is contained in:
parent
c9d5f41b0a
commit
e44c606f39
2 changed files with 22 additions and 20 deletions
|
@ -77,18 +77,20 @@ PICO_INTERNAL void PicoPicoPCMUpdate(short *buffer, int length, int stereo)
|
|||
srcval = *src >> 4;
|
||||
do_sample();
|
||||
|
||||
for (needsamples += stepsamples; needsamples > (1<<10) && length > 0; needsamples -= (1<<10), length--) {
|
||||
*buffer++ += sample;
|
||||
if (stereo) { buffer[0] = buffer[-1]; buffer++; }
|
||||
}
|
||||
if (buffer)
|
||||
for (needsamples += stepsamples; needsamples > (1<<10) && length > 0; needsamples -= (1<<10), length--) {
|
||||
*buffer++ += sample;
|
||||
if (stereo) { buffer[0] = buffer[-1]; buffer++; }
|
||||
}
|
||||
|
||||
srcval = *src & 0xf;
|
||||
do_sample();
|
||||
|
||||
for (needsamples += stepsamples; needsamples > (1<<10) && length > 0; needsamples -= (1<<10), length--) {
|
||||
*buffer++ += sample;
|
||||
if (stereo) { buffer[0] = buffer[-1]; buffer++; }
|
||||
}
|
||||
if (buffer)
|
||||
for (needsamples += stepsamples; needsamples > (1<<10) && length > 0; needsamples -= (1<<10), length--) {
|
||||
*buffer++ += sample;
|
||||
if (stereo) { buffer[0] = buffer[-1]; buffer++; }
|
||||
}
|
||||
|
||||
// lame normalization stuff, needed due to wrong adpcm algo
|
||||
sgn += (sample < 0) ? -1 : 1;
|
||||
|
@ -109,7 +111,7 @@ PICO_INTERNAL void PicoPicoPCMUpdate(short *buffer, int length, int stereo)
|
|||
PicoPicohw.xpcm_ptr = PicoPicohw.xpcm_buffer;
|
||||
|
||||
end:
|
||||
if (stereo)
|
||||
if (buffer && stereo)
|
||||
// still must expand SN76496 to stereo
|
||||
for (; length > 0; buffer+=2, length--)
|
||||
buffer[1] = buffer[0];
|
||||
|
|
|
@ -430,10 +430,18 @@ static int PsndRender(int offset, int length)
|
|||
|
||||
pprof_start(sound);
|
||||
|
||||
// Add in parts of the PSG output not yet done
|
||||
if (length-psglen > 0 && PicoIn.sndOut) {
|
||||
s16 *psgbuf = PicoIn.sndOut + (psglen << stereo);
|
||||
Pico.snd.psg_pos += (length-psglen) << 20;
|
||||
if (PicoIn.opt & POPT_EN_PSG)
|
||||
SN76496Update(psgbuf, length-psglen, stereo);
|
||||
}
|
||||
|
||||
if (PicoIn.AHW & PAHW_PICO) {
|
||||
// XXX ugly hack, need to render sound for interrupts
|
||||
s16 *buf16 = PicoIn.sndOut ? PicoIn.sndOut : (s16 *)PsndBuffer;
|
||||
PicoPicoPCMUpdate(buf16+(offset<<stereo), length-offset, stereo);
|
||||
// always need to render sound for interrupts
|
||||
s16 *buf16 = PicoIn.sndOut ? PicoIn.sndOut + (offset<<stereo) : NULL;
|
||||
PicoPicoPCMUpdate(buf16, length-offset, stereo);
|
||||
return length;
|
||||
}
|
||||
|
||||
|
@ -450,14 +458,6 @@ static int PsndRender(int offset, int length)
|
|||
Pico.snd.dac_val2 = Pico.snd.dac_val;
|
||||
}
|
||||
|
||||
// Add in parts of the PSG output not yet done
|
||||
if (length-psglen > 0 && PicoIn.sndOut) {
|
||||
s16 *psgbuf = PicoIn.sndOut + (psglen << stereo);
|
||||
Pico.snd.psg_pos += (length-psglen) << 20;
|
||||
if (PicoIn.opt & POPT_EN_PSG)
|
||||
SN76496Update(psgbuf, length-psglen, stereo);
|
||||
}
|
||||
|
||||
// Add in parts of the FM buffer not yet done
|
||||
if (length-fmlen > 0 && PicoIn.sndOut) {
|
||||
s32 *fmbuf = buf32 + ((fmlen-offset) << stereo);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue