+#if defined(PLATFORM_UNIX)
+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;
+}
+
+int CheckAudio(char *audio_device_name)
+{
+ int audio_fd;
+
+ if (access(audio_device_name, W_OK) != 0)
+ {
+ Error(ERR_WARN, "cannot access audio device - no sound");
+ return SOUND_OFF;
+ }
+
+ if ((audio_fd = OpenAudio(sound_device_name)) < 0)
+ {
+ Error(ERR_WARN, "cannot open audio device - no sound");
+ return SOUND_OFF;
+ }
+
+ close(audio_fd);
+
+ return SOUND_AVAILABLE;
+}
+
+boolean UnixInitAudio(void)
+{
+ return TRUE;
+}
+#endif /* PLATFORM_UNIX */
+