Mix sound sources in 32-bit buffer, then clip to 16-bit for output. Fixes overflow in some situations, eg MegaRace on SB16.
This commit is contained in:
parent
9a5ac02902
commit
d2b6ea7fa3
15 changed files with 60 additions and 37 deletions
|
|
@ -11,7 +11,7 @@ typedef struct adlib_t
|
|||
opl_t opl;
|
||||
} adlib_t;
|
||||
|
||||
static void adlib_get_buffer(int16_t *buffer, int len, void *p)
|
||||
static void adlib_get_buffer(int32_t *buffer, int len, void *p)
|
||||
{
|
||||
adlib_t *adlib = (adlib_t *)p;
|
||||
int c;
|
||||
|
|
@ -19,7 +19,7 @@ static void adlib_get_buffer(int16_t *buffer, int len, void *p)
|
|||
opl2_update2(&adlib->opl);
|
||||
|
||||
for (c = 0; c < len * 2; c++)
|
||||
buffer[c] += adlib->opl.buffer[c];
|
||||
buffer[c] += (int32_t)adlib->opl.buffer[c];
|
||||
|
||||
adlib->opl.pos = 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue