mirror of
https://github.com/0ldsk00l/nestopia.git
synced 2024-06-22 06:02:26 -04:00
Fix fast forward
This commit is contained in:
parent
d78381198a
commit
54e904b3ba
|
@ -46,6 +46,10 @@ static int framerate, channels, bufsize;
|
|||
|
||||
static bool paused = false;
|
||||
|
||||
void audio_set_speed(int speed) {
|
||||
bufsize = (channels * (conf.audio_sample_rate / framerate)) / speed;
|
||||
}
|
||||
|
||||
void audio_queue() {
|
||||
while ((bufsamples + bufsize) >= EBUFSIZE) { SDL_Delay(1); }
|
||||
|
||||
|
@ -81,13 +85,13 @@ void audio_deinit() {
|
|||
void audio_init_sdl() {
|
||||
spec.freq = conf.audio_sample_rate;
|
||||
spec.format = AUDIO_S16SYS;
|
||||
spec.channels = 1;
|
||||
spec.channels = channels;
|
||||
spec.silence = 0;
|
||||
spec.samples = 512;
|
||||
spec.userdata = 0;
|
||||
spec.callback = audio_cb;
|
||||
|
||||
bufsize = 1 * (conf.audio_sample_rate / framerate);
|
||||
bufsize = channels * (conf.audio_sample_rate / framerate);
|
||||
|
||||
dev = SDL_OpenAudioDevice(NULL, 0, &spec, &obtained, SDL_AUDIO_ALLOW_ANY_CHANGE);
|
||||
if (!dev) {
|
||||
|
@ -127,8 +131,7 @@ void audio_set_params(Sound::Output *soundoutput) {
|
|||
Sound sound(emulator);
|
||||
|
||||
sound.SetSampleBits(16);
|
||||
//sound.SetSampleRate(conf.audio_sample_rate);
|
||||
sound.SetSampleRate(48000);
|
||||
sound.SetSampleRate(conf.audio_sample_rate);
|
||||
|
||||
sound.SetSpeaker(conf.audio_stereo ? Sound::SPEAKER_STEREO : Sound::SPEAKER_MONO);
|
||||
sound.SetSpeed(Sound::DEFAULT_SPEED);
|
||||
|
|
|
@ -14,6 +14,7 @@ void audio_queue();
|
|||
void audio_pause();
|
||||
void audio_unpause();
|
||||
void audio_set_params(Sound::Output *soundoutput);
|
||||
void audio_set_speed(int speed);
|
||||
void audio_adj_volume();
|
||||
|
||||
#endif
|
||||
|
|
|
@ -118,7 +118,7 @@ static void NST_CALLBACK nst_cb_file(void *userData, User::File& file) {
|
|||
|
||||
switch (file.GetAction()) {
|
||||
case User::File::LOAD_ROM:
|
||||
// Nothing here for now
|
||||
// Nothing here for now
|
||||
break;
|
||||
|
||||
case User::File::LOAD_SAMPLE: break;
|
||||
|
@ -812,11 +812,13 @@ int nst_timing_runframes() {
|
|||
void nst_timing_set_ffspeed() {
|
||||
// Set the framerate to the fast-forward speed
|
||||
ffspeed = true;
|
||||
audio_set_speed(conf.timing_ffspeed);
|
||||
}
|
||||
|
||||
void nst_timing_set_default() {
|
||||
// Set the framerate to the default
|
||||
ffspeed = false;
|
||||
audio_set_speed(1);
|
||||
}
|
||||
|
||||
void nst_reset(bool hardreset) {
|
||||
|
|
Loading…
Reference in a new issue