Refactored sound code - slight speedup.
This commit is contained in:
parent
0b6be244ac
commit
3a57341837
33 changed files with 706 additions and 535 deletions
|
|
@ -283,6 +283,7 @@ void sb_exec_command(sb_dsp_t *dsp)
|
|||
sb_add_data(dsp, 0);
|
||||
break;
|
||||
case 0x10: /*8-bit direct mode*/
|
||||
sb_dsp_update(dsp);
|
||||
dsp->sbdat = dsp->sbdatl = dsp->sbdatr = (dsp->sb_data[0] ^ 0x80) << 8;
|
||||
break;
|
||||
case 0x14: /*8-bit single cycle DMA output*/
|
||||
|
|
@ -631,6 +632,8 @@ void pollsb(void *p)
|
|||
if (dsp->sb_8_enable && !dsp->sb_8_pause && dsp->sb_pausetime < 0 && dsp->sb_8_output)
|
||||
{
|
||||
int data[2];
|
||||
|
||||
sb_dsp_update(dsp);
|
||||
// pclog("Dopoll %i %02X %i\n", sb_8_length, sb_8_format, sblatcho);
|
||||
switch (dsp->sb_8_format)
|
||||
{
|
||||
|
|
@ -795,6 +798,8 @@ void pollsb(void *p)
|
|||
}
|
||||
if (dsp->sb_16_enable && !dsp->sb_16_pause && dsp->sb_pausetime < 0 && dsp->sb_16_output)
|
||||
{
|
||||
sb_dsp_update(dsp);
|
||||
|
||||
switch (dsp->sb_16_format)
|
||||
{
|
||||
case 0x00: /*Mono unsigned*/
|
||||
|
|
@ -918,10 +923,13 @@ void sb_poll_i(void *p)
|
|||
}
|
||||
}
|
||||
|
||||
void sb_dsp_poll(sb_dsp_t *dsp, int16_t *l, int16_t *r)
|
||||
void sb_dsp_update(sb_dsp_t *dsp)
|
||||
{
|
||||
*l = dsp->sbdatl;
|
||||
*r = dsp->sbdatr;
|
||||
for (; dsp->pos < sound_pos_global; dsp->pos++)
|
||||
{
|
||||
dsp->buffer[dsp->pos*2] = dsp->sbdatl;
|
||||
dsp->buffer[dsp->pos*2 + 1] = dsp->sbdatr;
|
||||
}
|
||||
}
|
||||
|
||||
void sb_dsp_add_status_info(char *s, int max_len, sb_dsp_t *dsp)
|
||||
|
|
|
|||
Loading…
Reference in a new issue