- [NEW] Minim makefile

- [NEW] Sound stops while debugging
- [CHG] Now all sound related code is in the zx_ula module
This commit is contained in:
2024-04-17 22:41:29 +02:00
parent 9f67286779
commit e80de06d2c
5 changed files with 46 additions and 28 deletions

View File

@@ -8,8 +8,6 @@
#include <SDL2/SDL.h>
#include <string.h>
SDL_AudioDeviceID sdlAudioDevice;
uint8_t memory[65536];
uint32_t t = 0;
uint16_t ts = 0;
@@ -17,20 +15,6 @@ uint8_t ft = 0;
uint32_t fps=0;
uint32_t fps_time=0;
uint8_t sound_buffer[1024];
uint16_t sound_pos;
void audioCallback(void * userdata, uint8_t * stream, int len)
{
uint16_t top = len;
if (sound_pos < len)
{
top = sound_pos;
//printf("buffer underrun!\n");
}
memcpy(stream, sound_buffer, top);
sound_pos=0;
}
uint8_t test = 0;
@@ -47,9 +31,7 @@ int main(int argc, char *argv[])
z80debug::show();
zxscreen::show();
SDL_AudioSpec audioSpec{11025, AUDIO_U8, 1, 0, 220, 0, 0, &audioCallback, NULL};
sdlAudioDevice = SDL_OpenAudioDevice(NULL, 0, &audioSpec, NULL, 0);
SDL_PauseAudioDevice(sdlAudioDevice, 0);
zx_ula::sound_init();
bool should_exit = false;
SDL_Event e;
@@ -112,13 +94,7 @@ int main(int argc, char *argv[])
ts += t_states;
if (ts>=400) {
ts-=400;
uint8_t ear = zx_ula::get_ear();
//if (ear)
sound_buffer[sound_pos++] = ear*128;
//SDL_QueueAudio(sdlAudioDevice, &beep[ear], 1);
//else
//SDL_ClearQueuedAudio(sdlAudioDevice);
zx_ula::sound_update();
}
if (t>=69888) {
ft++;