mirror of
https://github.com/RaySollium99/libpicofe.git
synced 2025-09-05 06:47:45 -04:00
PCM sound, refactored code940
git-svn-id: file:///home/notaz/opt/svn/PicoDrive/platform@27 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
parent
98c9d8d9e7
commit
49fe50f04c
10 changed files with 150 additions and 168 deletions
|
@ -20,8 +20,6 @@
|
|||
static YM2612 ym2612;
|
||||
|
||||
YM2612 *ym2612_940 = &ym2612;
|
||||
int mix_buffer_[44100/50*2]; /* this is where the YM2612 samples will be mixed to */
|
||||
int *mix_buffer = mix_buffer_;
|
||||
|
||||
// static _940_data_t shared_data_;
|
||||
static _940_ctl_t shared_ctl_;
|
||||
|
@ -96,58 +94,6 @@ void YM2612ResetChip_940(void)
|
|||
}
|
||||
|
||||
|
||||
static void mix_samples(short *dest_buf, int *ym_buf, short *mp3_buf, int len, int stereo)
|
||||
{
|
||||
if (mp3_buf)
|
||||
{
|
||||
if (stereo)
|
||||
{
|
||||
for (; len > 0; len--)
|
||||
{
|
||||
int l, r;
|
||||
l = r = *dest_buf;
|
||||
l += *ym_buf++; r += *ym_buf++;
|
||||
l += *mp3_buf++; r += *mp3_buf++;
|
||||
Limit( l, MAXOUT, MINOUT );
|
||||
Limit( r, MAXOUT, MINOUT );
|
||||
*dest_buf++ = l; *dest_buf++ = r;
|
||||
}
|
||||
} else {
|
||||
for (; len > 0; len--)
|
||||
{
|
||||
int l = *ym_buf++;
|
||||
l += *dest_buf;
|
||||
l += *mp3_buf++;
|
||||
Limit( l, MAXOUT, MINOUT );
|
||||
*dest_buf++ = l;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (stereo)
|
||||
{
|
||||
for (; len > 0; len--)
|
||||
{
|
||||
int l, r;
|
||||
l = r = *dest_buf;
|
||||
l += *ym_buf++, r += *ym_buf++;
|
||||
Limit( l, MAXOUT, MINOUT );
|
||||
Limit( r, MAXOUT, MINOUT );
|
||||
*dest_buf++ = l; *dest_buf++ = r;
|
||||
}
|
||||
} else {
|
||||
for (; len > 0; len--)
|
||||
{
|
||||
int l = *ym_buf++;
|
||||
l += *dest_buf;
|
||||
Limit( l, MAXOUT, MINOUT );
|
||||
*dest_buf++ = l;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
static void local_decode(void)
|
||||
{
|
||||
|
@ -190,7 +136,7 @@ static void local_decode(void)
|
|||
|
||||
static FILE *loaded_mp3 = 0;
|
||||
|
||||
void YM2612UpdateOne_940(short *buffer, int length, int stereo)
|
||||
int YM2612UpdateOne_940(int *buffer, int length, int stereo, int is_buf_empty)
|
||||
{
|
||||
#if 0
|
||||
int cdda_on, *ym_buffer = mix_buffer;
|
||||
|
@ -233,9 +179,7 @@ void YM2612UpdateOne_940(short *buffer, int length, int stereo)
|
|||
mp3_samples_ready += 1152;
|
||||
}
|
||||
#else
|
||||
YM2612UpdateOne_(buffer, length, stereo); // really writes to mix_buffer
|
||||
|
||||
mix_samples(buffer, mix_buffer, 0, length, stereo);
|
||||
return YM2612UpdateOne_(buffer, length, stereo, is_buf_empty);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -31,9 +31,9 @@ OBJS += ../../Pico/Area.o ../../Pico/Cart.o ../../Pico/Utils.o ../../Pico/Memory
|
|||
# Pico - CD
|
||||
OBJS += ../../Pico/cd/Pico.o ../../Pico/cd/Memory.o ../../Pico/cd/Sek.o ../../Pico/cd/LC89510.o \
|
||||
../../Pico/cd/cd_sys.o ../../Pico/cd/cd_file.o ../../Pico/cd/gfx_cd.o \
|
||||
../../Pico/cd/Area.o ../../Pico/cd/Misc.o
|
||||
../../Pico/cd/Area.o ../../Pico/cd/Misc.o ../../Pico/cd/pcm.o
|
||||
# Pico - sound
|
||||
OBJS += ../../Pico/sound/sound.o ../../Pico/sound/sn76496.o ../../Pico/sound/ym2612.o
|
||||
OBJS += ../../Pico/sound/sound.o ../../Pico/sound/sn76496.o ../../Pico/sound/ym2612.o ../../Pico/sound/mix.o
|
||||
# zlib
|
||||
OBJS += ../../zlib/gzio.o ../../zlib/inffast.o ../../zlib/inflate.o ../../zlib/inftrees.o ../../zlib/trees.o \
|
||||
../../zlib/deflate.o ../../zlib/crc32.o ../../zlib/adler32.o ../../zlib/zutil.o ../../zlib/compress.o
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue