#include <sound.h>
#include <asm/state.h>
+enum {
+ SAMPLE_RATE = 22050,
+};
+
static struct sdl_info {
SDL_Surface *screen;
int width;
uint frequency;
uint audio_pos;
uint audio_size;
+ uint sample_rate;
uint8_t *audio_data;
bool audio_active;
bool inited;
return 0;
/* Set the audio format */
- wanted.freq = 22050;
+ wanted.freq = SAMPLE_RATE;
wanted.format = AUDIO_S16;
wanted.channels = 1; /* 1 = mono, 2 = stereo */
wanted.samples = 1024; /* Good low-latency value for callback */
goto err;
}
sdl.audio_active = true;
+ sdl.sample_rate = wanted.freq;
return 0;
if (!sdl.audio_active)
return -1;
sdl.frequency = frequency;
- sound_create_square_wave(22050, (unsigned short *)sdl.audio_data,
+ sound_create_square_wave(sdl.sample_rate,
+ (unsigned short *)sdl.audio_data,
sdl.audio_size, frequency);
sdl.audio_pos = 0;
SDL_PauseAudio(0);