- [FIX] el só para durant el debug [però new BUG: al tornar està desincronitzat]
- [FIX] si el canal està desactivat, no fer el envelope sweep - [FIX] Se miraba el bit incorrecte per a determinar si el envelope sweep anava amunt o avall
This commit is contained in:
18
APU.cpp
18
APU.cpp
@@ -79,11 +79,21 @@ namespace APU
|
||||
}
|
||||
}
|
||||
|
||||
void init()
|
||||
void silence()
|
||||
{
|
||||
SDL_PauseAudioDevice(sdlAudioDevice, 1);
|
||||
}
|
||||
|
||||
void resume()
|
||||
{
|
||||
SDL_PauseAudioDevice(sdlAudioDevice, 0);
|
||||
}
|
||||
|
||||
void init()
|
||||
{
|
||||
SDL_AudioSpec audioSpec{11025, AUDIO_U8, 1, 0, AUDIO_BUFFER_SIZE>>2, 0, 0, &audioCallback, NULL};
|
||||
sdlAudioDevice = SDL_OpenAudioDevice(NULL, 0, &audioSpec, NULL, 0);
|
||||
SDL_PauseAudioDevice(sdlAudioDevice, 0);
|
||||
resume();
|
||||
//samples_time=SDL_GetTicks();
|
||||
}
|
||||
|
||||
@@ -183,11 +193,11 @@ namespace APU
|
||||
DIVAPU_envelope_sweep++;
|
||||
if (DIVAPU_envelope_sweep==8) {
|
||||
DIVAPU_envelope_sweep=0;
|
||||
if ( NR12&0x7 ) { // If sweep pace != 0, envelope sweep is enabled
|
||||
if ( CH1.enabled && (NR12&0x7) ) { // If sweep pace != 0, envelope sweep is enabled
|
||||
CH1.envelope_sweep_timer++;
|
||||
if ( CH1.envelope_sweep_timer == (NR12&0x07) ) { // if timer == envelope sweep, increase or decrease volume
|
||||
CH1.envelope_sweep_timer=0;
|
||||
if (NR12&0x80) { // bit set increases, reset decreases
|
||||
if (NR12&0x8) { // bit set increases, reset decreases
|
||||
if (CH1.volume<0x0f) CH1.volume++;
|
||||
} else {
|
||||
if (CH1.volume>0) CH1.volume--;
|
||||
|
||||
Reference in New Issue
Block a user