reverted back to signed long (32-bits) FM samples [fixed]

This commit is contained in:
ekeeke31 2010-04-21 12:50:29 +00:00
parent 2dc6874e33
commit 2917f63aa2
6 changed files with 18 additions and 10 deletions

View File

@ -10,7 +10,7 @@
#define WRITE_OFFSET (WIDTH * STEREO) - STEREO
#define GAIN 1.0
typedef short int sample_t;
typedef signed long int sample_t;
extern int Fir_Resampler_initialize( int new_size );
extern void Fir_Resampler_shutdown( void );

View File

@ -54,7 +54,7 @@ static inline void fm_update(unsigned int cycles)
}
/* select input sample buffer */
int16 *buffer = Fir_Resampler_buffer();
int32 *buffer = Fir_Resampler_buffer();
if (buffer)
{
Fir_Resampler_write(cnt << 1);

View File

@ -2028,7 +2028,7 @@ unsigned int YM2612Read(void)
}
/* Generate 16 bits samples for ym2612 */
void YM2612Update(short int *buffer, int length)
void YM2612Update(INT32 *buffer, int length)
{
int i;
long int lt,rt;

View File

@ -21,7 +21,7 @@
extern int YM2612Init(float clock, int rate);
extern int YM2612ResetChip(void);
extern void YM2612Update(short int *buffer, int length);
extern void YM2612Update(INT32 *buffer, int length);
extern void YM2612Write(unsigned int a, unsigned int v);
extern unsigned int YM2612Read(void);
extern unsigned char *YM2612GetContextPtr(void);

View File

@ -64,7 +64,7 @@ int audio_update (void)
uint32 factora = (config.lp_range << 16) / 100;
uint32 factorb = 0x10000 - factora;
int16 *fm = snd.fm.buffer;
int32 *fm = snd.fm.buffer;
int16 *psg = snd.psg.buffer;
#ifdef NGC
@ -154,7 +154,7 @@ int audio_update (void)
rrp = rr;
/* keep remaining samples for next frame */
memcpy(snd.fm.buffer, fm, (snd.fm.pos - snd.fm.buffer) << 1);
memcpy(snd.fm.buffer, fm, (snd.fm.pos - snd.fm.buffer) << 2);
memcpy(snd.psg.buffer, psg, (snd.psg.pos - snd.psg.buffer) << 1);
#ifdef LOGSOUND
@ -191,12 +191,20 @@ int audio_init (int samplerate, float framerate)
#endif
/* SN76489 stream buffers */
#ifndef NGC
snd.psg.buffer = (int16 *) malloc(snd.buffer_size * sizeof(int16));
#else
snd.psg.buffer = (int16 *) memalign(32, snd.buffer_size * sizeof(int16));
#endif
if (!snd.psg.buffer)
return (-1);
/* YM2612 stream buffers */
snd.fm.buffer = (int32 *) malloc(snd.buffer_size * sizeof(int16) * 2);
#ifndef NGC
snd.fm.buffer = (int32 *) malloc(snd.buffer_size * sizeof(int32) * 2);
#else
snd.fm.buffer = (int32 *) memalign(32,snd.buffer_size * sizeof(int32) * 2);
#endif
if (!snd.fm.buffer)
return (-1);
@ -241,7 +249,7 @@ void audio_reset(void)
if (snd.psg.buffer)
memset (snd.psg.buffer, 0, snd.buffer_size * sizeof(int16));
if (snd.fm.buffer)
memset (snd.fm.buffer, 0, snd.buffer_size * sizeof(int16) * 2);
memset (snd.fm.buffer, 0, snd.buffer_size * sizeof(int32) * 2);
}
/****************************************************************

View File

@ -61,8 +61,8 @@ typedef struct
int16 *buffer[2]; /* Signed 16-bit stereo sound data */
struct
{
int16 *pos;
int16 *buffer;
int32 *pos;
int32 *buffer;
} fm;
struct
{