- Coses
This commit is contained in:
8
APU.cpp
8
APU.cpp
@@ -1,6 +1,6 @@
|
|||||||
#include "APU.h"
|
#include "APU.h"
|
||||||
#include <SDL2/SDL.h>
|
#include <SDL2/SDL.h>
|
||||||
#include "audio_viewer.h"
|
//#include "audio_viewer.h"
|
||||||
|
|
||||||
namespace APU
|
namespace APU
|
||||||
{
|
{
|
||||||
@@ -98,11 +98,11 @@ namespace APU
|
|||||||
|
|
||||||
void init()
|
void init()
|
||||||
{
|
{
|
||||||
SDL_AudioSpec audioSpec{SAMPLING_FREQ, AUDIO_U8, 1, 0, AUDIO_BUFFER_SIZE>>2, 0, 0, &audioCallback, NULL};
|
SDL_AudioSpec audioSpec{SAMPLING_FREQ, AUDIO_U8, 1, 0, AUDIO_BUFFER_SIZE>>1, 0, 0, &audioCallback, NULL};
|
||||||
sdlAudioDevice = SDL_OpenAudioDevice(NULL, 0, &audioSpec, NULL, 0);
|
sdlAudioDevice = SDL_OpenAudioDevice(NULL, 0, &audioSpec, NULL, 0);
|
||||||
resume();
|
resume();
|
||||||
//samples_time=SDL_GetTicks();
|
//samples_time=SDL_GetTicks();
|
||||||
audio_viewer::init();
|
//audio_viewer::init();
|
||||||
}
|
}
|
||||||
|
|
||||||
void reset()
|
void reset()
|
||||||
@@ -437,7 +437,7 @@ namespace APU
|
|||||||
uint8_t sample = (sampleCH1+sampleCH2+sampleCH3+sampleCH4)&0xff;
|
uint8_t sample = (sampleCH1+sampleCH2+sampleCH3+sampleCH4)&0xff;
|
||||||
|
|
||||||
sound_buffer[(sound_pos++)&(AUDIO_BUFFER_SIZE-1)] = sample;
|
sound_buffer[(sound_pos++)&(AUDIO_BUFFER_SIZE-1)] = sample;
|
||||||
audio_viewer::addsample(sample);
|
//audio_viewer::addsample(sample);
|
||||||
//if (ear) last_1 = sound_pos;
|
//if (ear) last_1 = sound_pos;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
3
Makefile
3
Makefile
@@ -9,3 +9,6 @@ debug: compile
|
|||||||
|
|
||||||
debug1: compile
|
debug1: compile
|
||||||
gdb -ex run gb
|
gdb -ex run gb
|
||||||
|
|
||||||
|
release:
|
||||||
|
g++ -O3 *.cpp -lSDL2 -o gb
|
||||||
|
|||||||
4
main.cpp
4
main.cpp
@@ -63,7 +63,7 @@ int main(int argc, char *argv[])
|
|||||||
if (argc < 2) { printf("ABORTING: No rom specified.\n"); exit(1); }
|
if (argc < 2) { printf("ABORTING: No rom specified.\n"); exit(1); }
|
||||||
|
|
||||||
const uint32_t clock = 4194304;
|
const uint32_t clock = 4194304;
|
||||||
const uint32_t update_freq = clock / 10;
|
const uint32_t update_freq = clock >> 3;
|
||||||
|
|
||||||
SDL_Init(SDL_INIT_EVERYTHING);
|
SDL_Init(SDL_INIT_EVERYTHING);
|
||||||
|
|
||||||
@@ -204,7 +204,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (t_states>=update_freq)
|
if (t_states>=update_freq)
|
||||||
{
|
{
|
||||||
while (SDL_GetTicks()<time+100) {}
|
while (SDL_GetTicks()<(time+125)) {}
|
||||||
t_states -= update_freq;
|
t_states -= update_freq;
|
||||||
time = SDL_GetTicks();
|
time = SDL_GetTicks();
|
||||||
//z80analyze::refresh();
|
//z80analyze::refresh();
|
||||||
|
|||||||
Reference in New Issue
Block a user