move around apu reset a bit, doesn't seem to have broken anything

doesn't seem to have fixed anything either.
This commit is contained in:
squall-leonhart 2013-03-31 11:20:41 +00:00
parent f19a0529ca
commit b36bd990aa
2 changed files with 18 additions and 15 deletions

View File

@ -121,6 +121,13 @@ static void reset_apu()
static void remake_stereo_buffer()
{
// APU
if ( !gb_apu )
{
gb_apu = new Gb_Apu; // TODO: handle errors
reset_apu();
}
// Stereo_Buffer
delete stereo_buffer;
stereo_buffer = 0;
@ -128,20 +135,15 @@ static void remake_stereo_buffer()
stereo_buffer = new Simple_Effects_Buffer; // TODO: handle out of memory
if ( stereo_buffer->set_sample_rate( soundSampleRate ) ) { } // TODO: handle out of memory
stereo_buffer->clock_rate( gb_apu->clock_rate );
// APU
// Multi_Buffer
static int const chan_types [chan_count] = {
Multi_Buffer::wave_type+1, Multi_Buffer::wave_type+2,
Multi_Buffer::wave_type+3, Multi_Buffer::mixed_type+1
};
if ( stereo_buffer->set_channel_count( chan_count, chan_types ) ) { } // TODO: handle errors
if ( !gb_apu )
{
gb_apu = new Gb_Apu; // TODO: handle errors
reset_apu();
}
// Volume Level
apply_effects();
apply_volume();
}

View File

@ -446,6 +446,13 @@ static void remake_stereo_buffer()
pcm [0].pcm.init();
pcm [1].pcm.init();
// APU
if ( !gb_apu )
{
gb_apu = new Gb_Apu; // TODO: handle out of memory
reset_apu();
}
// Stereo_Buffer
delete stereo_buffer;
stereo_buffer = 0;
@ -459,13 +466,7 @@ static void remake_stereo_buffer()
pcm [1].which = 1;
apply_filtering();
// APU
if ( !gb_apu )
{
gb_apu = new Gb_Apu; // TODO: handle out of memory
reset_apu();
}
// Volume Level
apply_muting();
apply_volume();
}