X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=linux%2F940ctl_ym2612.c;h=915ac0a513c2e67fc998a1088f7e1fb863a2dbc8;hb=49fe50f04c9e6aab1cce54302bd4990a0471df00;hp=b5263dc598008fe57a15c3417bde9fe048f9f28c;hpb=598e7c06cd865f9c4f82e3ebb9b08e8b064f00e8;p=libpicofe.git diff --git a/linux/940ctl_ym2612.c b/linux/940ctl_ym2612.c index b5263dc..915ac0a 100644 --- a/linux/940ctl_ym2612.c +++ b/linux/940ctl_ym2612.c @@ -20,12 +20,10 @@ 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_data_t shared_data_; static _940_ctl_t shared_ctl_; -static _940_data_t *shared_data = &shared_data_; +// static _940_data_t *shared_data = &shared_data_; static _940_ctl_t *shared_ctl = &shared_ctl_; unsigned char *mp3_mem = 0; @@ -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 } @@ -269,4 +213,8 @@ void mp3_start_play(FILE *f, int pos) // pos is 0-1023 } +int mp3_get_offset(void) +{ + return 0; +}