Revert "Updated sound to use the newer SDLAudioDevice functions"
This reverts commit a24626e8c3
.
This commit is contained in:
parent
864e5dfe76
commit
d761ebb8e8
1 changed files with 10 additions and 11 deletions
|
@ -34,7 +34,7 @@ uae_u16* finish_cdbuff = cdaudio_buffer[0] + CDAUDIO_BUFFER_LEN * DEFAULT_SOUND_
|
||||||
bool cdaudio_active = false;
|
bool cdaudio_active = false;
|
||||||
static int cdwrcnt = 0;
|
static int cdwrcnt = 0;
|
||||||
static int cdrdcnt = 0;
|
static int cdrdcnt = 0;
|
||||||
SDL_AudioDeviceID dev;
|
|
||||||
|
|
||||||
static int have_sound = 0;
|
static int have_sound = 0;
|
||||||
|
|
||||||
|
@ -129,8 +129,8 @@ static int start_sound(int rate, int bits, int stereo)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|
||||||
SDL_AudioSpec as, have;
|
SDL_AudioSpec as;
|
||||||
SDL_memset(&as, 0, sizeof as);
|
memset(&as, 0, sizeof(as));
|
||||||
|
|
||||||
as.freq = rate;
|
as.freq = rate;
|
||||||
as.format = (bits == 8 ? AUDIO_S8 : AUDIO_S16);
|
as.format = (bits == 8 ? AUDIO_S8 : AUDIO_S16);
|
||||||
|
@ -138,8 +138,7 @@ static int start_sound(int rate, int bits, int stereo)
|
||||||
as.samples = SOUND_CONSUMER_BUFFER_LENGTH;
|
as.samples = SOUND_CONSUMER_BUFFER_LENGTH;
|
||||||
as.callback = sound_thread_mixer;
|
as.callback = sound_thread_mixer;
|
||||||
|
|
||||||
dev = SDL_OpenAudioDevice(NULL, 0, &as, &have, 0);
|
if (SDL_OpenAudio(&as, nullptr))
|
||||||
if (dev == 0)
|
|
||||||
write_log("Error when opening SDL audio !\n");
|
write_log("Error when opening SDL audio !\n");
|
||||||
|
|
||||||
s_oldrate = rate;
|
s_oldrate = rate;
|
||||||
|
@ -149,7 +148,7 @@ static int start_sound(int rate, int bits, int stereo)
|
||||||
clear_sound_buffers();
|
clear_sound_buffers();
|
||||||
clear_cdaudio_buffers();
|
clear_cdaudio_buffers();
|
||||||
|
|
||||||
SDL_PauseAudioDevice(dev, 0);
|
SDL_PauseAudio(0);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -159,9 +158,9 @@ void stop_sound()
|
||||||
{
|
{
|
||||||
if (sound_thread_exit == 0)
|
if (sound_thread_exit == 0)
|
||||||
{
|
{
|
||||||
SDL_PauseAudioDevice(dev, 1);
|
SDL_PauseAudio(1);
|
||||||
sound_thread_exit = 1;
|
sound_thread_exit = 1;
|
||||||
SDL_CloseAudioDevice(dev);
|
SDL_CloseAudio();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -270,12 +269,12 @@ int init_sound()
|
||||||
|
|
||||||
void pause_sound()
|
void pause_sound()
|
||||||
{
|
{
|
||||||
SDL_PauseAudioDevice(dev, 1);
|
SDL_PauseAudio(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void resume_sound()
|
void resume_sound()
|
||||||
{
|
{
|
||||||
SDL_PauseAudioDevice(dev, 0);
|
SDL_PauseAudio(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void reset_sound()
|
void reset_sound()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue