mirror of
https://github.com/dborth/fceugx.git
synced 2024-10-31 22:45:05 +01:00
sound change
This commit is contained in:
parent
73c621355f
commit
0985c86608
@ -61,7 +61,7 @@ int GCMemROM()
|
||||
/*** Set internal sound information ***/
|
||||
FCEUI_Sound(SAMPLERATE);
|
||||
FCEUI_SetSoundVolume(100); // 0-100
|
||||
FCEUI_SetSoundQuality(1); // 0 - low, 1 - high
|
||||
FCEUI_SetSoundQuality(0); // 0 - low, 1 - high
|
||||
FCEUI_SetLowPass(0);
|
||||
|
||||
InitialisePads();
|
||||
|
@ -26,46 +26,47 @@ static int whichab = 0; /*** Which Audio Buffer is in use ***/
|
||||
static int isPlaying; /*** Is Playing ***/
|
||||
static void AudioSwitchBuffers()
|
||||
{
|
||||
if ( buffSize[whichab] ) {
|
||||
AUDIO_StopDMA();
|
||||
AUDIO_InitDMA((u32)audiobuffer[whichab], buffSize[whichab]);
|
||||
DCFlushRange(audiobuffer[whichab], buffSize[whichab]);
|
||||
AUDIO_StartDMA();
|
||||
isPlaying = 0;
|
||||
}
|
||||
if ( buffSize[whichab] )
|
||||
{
|
||||
AUDIO_StopDMA();
|
||||
AUDIO_InitDMA((u32)audiobuffer[whichab], buffSize[whichab]);
|
||||
DCFlushRange(audiobuffer[whichab], buffSize[whichab]);
|
||||
AUDIO_StartDMA();
|
||||
isPlaying = 0;
|
||||
}
|
||||
|
||||
whichab ^= 1;
|
||||
buffSize[whichab] = 0;
|
||||
whichab ^= 1;
|
||||
buffSize[whichab] = 0;
|
||||
}
|
||||
|
||||
void InitialiseSound()
|
||||
{
|
||||
AUDIO_Init(NULL); /*** Start audio subsystem ***/
|
||||
AUDIO_SetDSPSampleRate(AI_SAMPLERATE_48KHZ);
|
||||
AUDIO_RegisterDMACallback( AudioSwitchBuffers );
|
||||
AUDIO_Init(NULL); /*** Start audio subsystem ***/
|
||||
AUDIO_SetDSPSampleRate(AI_SAMPLERATE_48KHZ);
|
||||
AUDIO_RegisterDMACallback( AudioSwitchBuffers );
|
||||
|
||||
buffSize[0] = buffSize[1] = 0;
|
||||
buffSize[0] = buffSize[1] = 0;
|
||||
}
|
||||
|
||||
void StartAudio()
|
||||
{
|
||||
AUDIO_StartDMA();
|
||||
AUDIO_StartDMA();
|
||||
}
|
||||
|
||||
void StopAudio()
|
||||
{
|
||||
AUDIO_StopDMA();
|
||||
buffSize[0] = buffSize[1] = 0;
|
||||
AUDIO_StopDMA();
|
||||
buffSize[0] = buffSize[1] = 0;
|
||||
}
|
||||
|
||||
static inline unsigned short FLIP16(unsigned short b)
|
||||
{
|
||||
return((b<<8)|((b>>8)&0xFF));
|
||||
return((b<<8)|((b>>8)&0xFF));
|
||||
}
|
||||
|
||||
static inline u32 FLIP32(u32 b)
|
||||
{
|
||||
return( (b<<24) | ((b>>8)&0xFF00) | ((b<<8)&0xFF0000) | ((b>>24)&0xFF) );
|
||||
return( (b<<24) | ((b>>8)&0xFF00) | ((b<<8)&0xFF0000) | ((b>>24)&0xFF) );
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@ -79,37 +80,37 @@ static short MBuffer[ 8 * 96000 / 50 ];
|
||||
|
||||
void PlaySound( unsigned int *Buffer, int count )
|
||||
{
|
||||
int P;
|
||||
unsigned short *s = (unsigned short *)&MBuffer[0];
|
||||
unsigned int *d = (unsigned int *)&audiobuffer[whichab][buffSize[whichab]];
|
||||
unsigned int c;
|
||||
int ms;
|
||||
int P;
|
||||
unsigned short *s = (unsigned short *)&MBuffer[0];
|
||||
unsigned int *d = (unsigned int *)&audiobuffer[whichab][buffSize[whichab]];
|
||||
unsigned int c;
|
||||
int ms;
|
||||
|
||||
isWriting = 1;
|
||||
isWriting = 1;
|
||||
|
||||
for ( P = 0; P < count; P++ ) {
|
||||
MBuffer[P] = Buffer[P];
|
||||
}
|
||||
for ( P = 0; P < count; P++ )
|
||||
{
|
||||
MBuffer[P] = Buffer[P];
|
||||
}
|
||||
|
||||
/*** Now do Mono - Stereo Conversion ***/
|
||||
ms = count;
|
||||
do
|
||||
{
|
||||
c = 0xffff & *s++;
|
||||
*d++ = (c | (c<<16));
|
||||
} while(--ms);
|
||||
/*** Now do Mono - Stereo Conversion ***/
|
||||
ms = count;
|
||||
do
|
||||
{
|
||||
c = 0xffff & *s++;
|
||||
*d++ = (c | (c<<16));
|
||||
} while(--ms);
|
||||
|
||||
buffSize[whichab] += ( count << 2 );
|
||||
/*** This is the kicker for the entire audio loop ***/
|
||||
if ( isPlaying == 0 )
|
||||
{
|
||||
if ( buffSize[whichab] > AUDIOBUFFER )
|
||||
{
|
||||
isPlaying = 1;
|
||||
AudioSwitchBuffers();
|
||||
}
|
||||
}
|
||||
|
||||
isWriting = 0;
|
||||
buffSize[whichab] += ( count << 2 );
|
||||
/*** This is the kicker for the entire audio loop ***/
|
||||
if ( isPlaying == 0 )
|
||||
{
|
||||
if ( buffSize[whichab] > AUDIOBUFFER )
|
||||
{
|
||||
isPlaying = 1;
|
||||
AudioSwitchBuffers();
|
||||
}
|
||||
}
|
||||
|
||||
isWriting = 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user