reverted FM buffer to use "short int" instead "long int" since it broke sound when High-Quality FM was disabled

This commit is contained in:
ekeeke31 2010-04-19 12:21:40 +00:00
parent 9d430a0851
commit 2dc6874e33
7 changed files with 11 additions and 11 deletions

View File

@ -4,7 +4,7 @@
#include "Fir_Resampler.h"
#include <assert.h>
//#include <assert.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
@ -229,7 +229,7 @@ int Fir_Resampler_written( void )
void Fir_Resampler_write( long count )
{
write_pos += count;
assert( write_pos <= ( buffer + buffer_size ) );
// assert( write_pos <= ( buffer + buffer_size ) );
}
int Fir_Resampler_read( sample_t* out, long count )

View File

@ -10,7 +10,7 @@
#define WRITE_OFFSET (WIDTH * STEREO) - STEREO
#define GAIN 1.0
typedef long int sample_t;
typedef short 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 */
int32 *buffer = Fir_Resampler_buffer();
int16 *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(long int *buffer, int length)
void YM2612Update(short int *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(long int *buffer, int length);
extern void YM2612Update(short int *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;
int32 *fm = snd.fm.buffer;
int16 *fm = snd.fm.buffer;
int16 *psg = snd.psg.buffer;
#ifdef NGC
@ -196,7 +196,7 @@ int audio_init (int samplerate, float framerate)
return (-1);
/* YM2612 stream buffers */
snd.fm.buffer = (int32 *) malloc(snd.buffer_size * sizeof(int32) * 2);
snd.fm.buffer = (int32 *) malloc(snd.buffer_size * sizeof(int16) * 2);
if (!snd.fm.buffer)
return (-1);
@ -241,7 +241,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(int32) * 2);
memset (snd.fm.buffer, 0, snd.buffer_size * sizeof(int16) * 2);
}
/****************************************************************

View File

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