+Version 1.5.0
+-------------
+ - SDL!!!
+ - trying to open already busy audio device does not block the game
-Release Version 1.3.5 [?? SEP 1999]
+Release Version 1.4.0 [27 OCT 1999]
-----------------------------------
- new Boulderdash elements for better game emulation
- new cool medium-sized crystal font
return;
}
- if ((sound_device = open(sound_device_name,O_WRONLY))<0)
+ if ((sound_device = OpenAudio(sound_device_name)) < 0)
{
Error(ERR_WARN, "cannot open sound device - no sounds");
sound_status = SOUND_OFF;
static void SoundServer_StopAllSounds();
#endif
+int OpenAudio(char *audio_device_name)
+{
+ int audio_fd;
+
+ /* try to open audio device in non-blocking mode */
+ if ((audio_fd = open(audio_device_name, O_WRONLY | O_NONBLOCK)) < 0)
+ return audio_fd;
+
+ /* re-open audio device in blocking mode */
+ close(audio_fd);
+ audio_fd = open(audio_device_name, O_WRONLY);
+
+ return audio_fd;
+}
+
void SoundServer()
{
int i;
int sample_rate = 22050;
#endif
- if (playing_sounds || (sound_device=open(sound_device_name,O_WRONLY))>=0)
+ if (playing_sounds ||
+ (sound_device = OpenAudio(sound_device_name)) >= 0)
{
if (!playing_sounds) /* we just opened the audio device */
{
int wait_percent = 90; /* wait 90% of the real playing time */
int i;
- if ((sound_device=open(sound_device_name,O_WRONLY))>=0)
+ if ((sound_device = OpenAudio(sound_device_name)) >= 0)
{
playing_sounds = 1;