Minor sound updates. Small speedup for dac.

This commit is contained in:
iq_132 2012-08-17 04:27:51 +00:00
parent ce5e77940d
commit 4c03d8c704
2 changed files with 14 additions and 13 deletions

View File

@ -46,21 +46,22 @@ static void UpdateStream(INT32 chip, INT32 length)
if (length <= 0) return;
INT16 *lbuf = lBuffer + ptr->nCurrentPosition;
INT16 *rbuf = rBuffer + ptr->nCurrentPosition;
INT16 *rbuf = rBuffer + ptr->nCurrentPosition;
INT16 Out = ptr->Output;
INT16 lOut = ((ptr->OutputDir & BURN_SND_ROUTE_LEFT ) == BURN_SND_ROUTE_LEFT ) ? ptr->Output : 0;
INT16 rOut = ((ptr->OutputDir & BURN_SND_ROUTE_RIGHT) == BURN_SND_ROUTE_RIGHT) ? ptr->Output : 0;
ptr->nCurrentPosition += length;
if (Out) {
if (rOut && lOut) {
while (length--) {
if ((ptr->OutputDir & BURN_SND_ROUTE_LEFT) == BURN_SND_ROUTE_LEFT) {
*lbuf++ = *lbuf + Out;
}
if ((ptr->OutputDir & BURN_SND_ROUTE_RIGHT) == BURN_SND_ROUTE_RIGHT) {
*rbuf++ = *rbuf + Out;
}
*lbuf++ = *lbuf + lOut;
*rbuf++ = *rbuf + rOut;
}
} else if (lOut) {
while (length--) *lbuf++ = *lbuf + lOut;
} else if (rOut) {
while (length--) *rbuf++ = *rbuf + rOut;
}
}

View File

@ -34,17 +34,17 @@ static void make_raw(UINT8 *src, UINT32 len)
if (ptr[0] != 'R' || ptr[1] != 'I' || ptr[2] != 'F' || ptr[3] != 'F') return;
ptr += 4; // skip RIFF
UINT32 length = get_long(); ptr += 4; // total length of file
UINT32 length = get_long(); ptr += 4; // total length of file
if (len < length) length = len - 8; // first 8 bytes (RIFF + Len)
/* "WAVEfmt " */ ptr += 8; // WAVEfmt + 1 space
UINT32 length2 = get_long(); ptr += 4; // Wavefmt length
UINT32 length2 = get_long(); ptr += 4; // Wavefmt length
/* unsigned short format = get_short(); */ptr += 2; // format?
UINT16 channels = get_short(); ptr += 2; // channels
UINT16 channels = get_short(); ptr += 2; // channels
UINT32 sample_rate = get_long(); ptr += 4; // sample rate
/* unsigned int speed = get_long(); */ptr += 4; // speed - should equal (bits * channels * sample_rate)
/* unsigned short align = get_short(); */ptr += 2; // block align should be ((bits / 8) * channels)
UINT16 bits = get_short() / 8; ptr += 2; // bits per sample (0010)
UINT16 bits = get_short() / 8; ptr += 2; // bits per sample (0010)
ptr += length2 - 16; // get past the wave format chunk
// are we in the 'data' chunk? if not, skip this chunk.