ADDED gbSoundSetDeclicking & gbSoundGetDeclicking [blargg]
This commit is contained in:
parent
ed1eae96a9
commit
a831e6f5ea
|
@ -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,9 +143,10 @@ 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
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue