- [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:
16
APU.cpp
16
APU.cpp
@@ -79,11 +79,21 @@ namespace APU
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void silence()
|
||||||
|
{
|
||||||
|
SDL_PauseAudioDevice(sdlAudioDevice, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void resume()
|
||||||
|
{
|
||||||
|
SDL_PauseAudioDevice(sdlAudioDevice, 0);
|
||||||
|
}
|
||||||
|
|
||||||
void init()
|
void init()
|
||||||
{
|
{
|
||||||
SDL_AudioSpec audioSpec{11025, AUDIO_U8, 1, 0, AUDIO_BUFFER_SIZE>>2, 0, 0, &audioCallback, NULL};
|
SDL_AudioSpec audioSpec{11025, AUDIO_U8, 1, 0, AUDIO_BUFFER_SIZE>>2, 0, 0, &audioCallback, NULL};
|
||||||
sdlAudioDevice = SDL_OpenAudioDevice(NULL, 0, &audioSpec, NULL, 0);
|
sdlAudioDevice = SDL_OpenAudioDevice(NULL, 0, &audioSpec, NULL, 0);
|
||||||
SDL_PauseAudioDevice(sdlAudioDevice, 0);
|
resume();
|
||||||
//samples_time=SDL_GetTicks();
|
//samples_time=SDL_GetTicks();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -183,11 +193,11 @@ namespace APU
|
|||||||
DIVAPU_envelope_sweep++;
|
DIVAPU_envelope_sweep++;
|
||||||
if (DIVAPU_envelope_sweep==8) {
|
if (DIVAPU_envelope_sweep==8) {
|
||||||
DIVAPU_envelope_sweep=0;
|
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++;
|
CH1.envelope_sweep_timer++;
|
||||||
if ( CH1.envelope_sweep_timer == (NR12&0x07) ) { // if timer == envelope sweep, increase or decrease volume
|
if ( CH1.envelope_sweep_timer == (NR12&0x07) ) { // if timer == envelope sweep, increase or decrease volume
|
||||||
CH1.envelope_sweep_timer=0;
|
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++;
|
if (CH1.volume<0x0f) CH1.volume++;
|
||||||
} else {
|
} else {
|
||||||
if (CH1.volume>0) CH1.volume--;
|
if (CH1.volume>0) CH1.volume--;
|
||||||
|
|||||||
2
APU.h
2
APU.h
@@ -8,6 +8,8 @@ namespace APU
|
|||||||
|
|
||||||
void init();
|
void init();
|
||||||
void reset();
|
void reset();
|
||||||
|
void silence();
|
||||||
|
void resume();
|
||||||
void incDIVAPU();
|
void incDIVAPU();
|
||||||
void update(uint32_t dt);
|
void update(uint32_t dt);
|
||||||
}
|
}
|
||||||
|
|||||||
4
Makefile
4
Makefile
@@ -2,10 +2,10 @@ compile:
|
|||||||
g++ -g *.cpp -lSDL2 -o gb
|
g++ -g *.cpp -lSDL2 -o gb
|
||||||
|
|
||||||
run: compile
|
run: compile
|
||||||
./gb
|
./gb tetris.gb
|
||||||
|
|
||||||
debug: compile
|
debug: compile
|
||||||
gdb --args gb supermarioland.gb
|
gdb --args gb tetris.gb
|
||||||
|
|
||||||
debug1: compile
|
debug1: compile
|
||||||
gdb -ex run gb
|
gdb -ex run gb
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
#include "sm83.h"
|
#include "sm83.h"
|
||||||
#include "sm83dis.h"
|
#include "sm83dis.h"
|
||||||
#include "mem.h"
|
#include "mem.h"
|
||||||
|
#include "APU.h"
|
||||||
//#include "z80analyze.h"
|
//#include "z80analyze.h"
|
||||||
#include "ui.h"
|
#include "ui.h"
|
||||||
#include "ui_window.h"
|
#include "ui_window.h"
|
||||||
@@ -348,7 +349,7 @@ namespace debug
|
|||||||
|
|
||||||
void pause()
|
void pause()
|
||||||
{
|
{
|
||||||
//zx_ula::sound_disable();
|
APU::silence();
|
||||||
is_paused = true;
|
is_paused = true;
|
||||||
breakpoints[sm83::getPC()] &= ~8;
|
breakpoints[sm83::getPC()] &= ~8;
|
||||||
}
|
}
|
||||||
@@ -369,7 +370,7 @@ namespace debug
|
|||||||
is_debugging = is_paused = false;
|
is_debugging = is_paused = false;
|
||||||
refresh();
|
refresh();
|
||||||
gbscreen::focus();
|
gbscreen::focus();
|
||||||
//zx_ula::sound_enable();
|
APU::resume();
|
||||||
}
|
}
|
||||||
|
|
||||||
const bool debugging() { return is_debugging; }
|
const bool debugging() { return is_debugging; }
|
||||||
|
|||||||
Reference in New Issue
Block a user