ADDED gbSoundSetDeclicking & gbSoundGetDeclicking [blargg]

This commit is contained in:
spacy51 2008-08-31 19:29:58 +00:00
parent ed1eae96a9
commit a831e6f5ea
2 changed files with 31 additions and 2 deletions

View File

@ -38,6 +38,7 @@ static Gb_Apu* gb_apu;
static float soundVolume_ = -1;
static int prevSoundEnable = -1;
static bool declicking = false;
int const chan_count = 4;
int const ticks_to_time = 2 * GB_APU_OVERCLOCK;
@ -142,10 +143,11 @@ static void reset_apu()
Gb_Apu::mode_t mode = Gb_Apu::mode_dmg;
if ( gbHardware & 2 )
mode = Gb_Apu::mode_cgb;
if ( gbHardware & 8 )
if ( gbHardware & 8 || declicking )
mode = Gb_Apu::mode_agb;
gb_apu->reset( mode );
gb_apu->reduce_clicks( declicking );
if ( stereo_buffer )
stereo_buffer->clear();
@ -179,6 +181,28 @@ static void remake_stereo_buffer()
apply_volume();
}
void gbSoundSetDeclicking( bool enable )
{
if ( declicking != enable )
{
declicking = enable;
if ( gb_apu )
{
// Can't change sound hardware mode without resetting APU, so save/load
// state around mode change
gb_apu_state_t state;
gb_apu->save_state( &state );
reset_apu();
if ( gb_apu->load_state( state ) ) { } // ignore error
}
}
}
bool gbSoundGetDeclicking()
{
return declicking;
}
void gbSoundReset()
{
SOUND_CLOCK_TICKS = 20000; // 1/100 second

View File

@ -11,6 +11,11 @@
void gbSoundSetQuality( int quality );
extern int soundQuality; // current sound quality
// Manages declicking mode. When enabled, clicks are reduced. Note that clicks
// are normal for GB and GBC sound hardware.
void gbSoundSetDeclicking( bool enable );
bool gbSoundGetDeclicking();
// Effects configuration
struct gb_effects_config_t
{