This commit is contained in:
2025-01-30 10:04:23 +01:00
parent 144c588012
commit 9d3204daba
3 changed files with 9 additions and 6 deletions

View File

@@ -1,6 +1,6 @@
#include "APU.h"
#include <SDL2/SDL.h>
#include "audio_viewer.h"
//#include "audio_viewer.h"
namespace APU
{
@@ -98,11 +98,11 @@ namespace APU
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);
resume();
//samples_time=SDL_GetTicks();
audio_viewer::init();
//audio_viewer::init();
}
void reset()
@@ -437,7 +437,7 @@ namespace APU
uint8_t sample = (sampleCH1+sampleCH2+sampleCH3+sampleCH4)&0xff;
sound_buffer[(sound_pos++)&(AUDIO_BUFFER_SIZE-1)] = sample;
audio_viewer::addsample(sample);
//audio_viewer::addsample(sample);
//if (ear) last_1 = sound_pos;
}
}

View File

@@ -9,3 +9,6 @@ debug: compile
debug1: compile
gdb -ex run gb
release:
g++ -O3 *.cpp -lSDL2 -o gb

View File

@@ -63,7 +63,7 @@ int main(int argc, char *argv[])
if (argc < 2) { printf("ABORTING: No rom specified.\n"); exit(1); }
const uint32_t clock = 4194304;
const uint32_t update_freq = clock / 10;
const uint32_t update_freq = clock >> 3;
SDL_Init(SDL_INIT_EVERYTHING);
@@ -204,7 +204,7 @@ int main(int argc, char *argv[])
if (t_states>=update_freq)
{
while (SDL_GetTicks()<time+100) {}
while (SDL_GetTicks()<(time+125)) {}
t_states -= update_freq;
time = SDL_GetTicks();
//z80analyze::refresh();