I always use NAS on my Solaris 2.7 box so I haven't noticed this
before[1].
Assume you're running NAS ok. Kill the NAS server. XEmacs will
gracefully revert to native sound. This used to work. However, now
play any sound out and it comes out way too fast. (If the NAS server
is restarted, XEmacs will start using the NAS server again.)
I traced this down to the fact that even if the device status matches
the file header, we need to set the device config (see init_device in
sunplay.c). This only needs to be done once.
A proposed patch is below. However, I wanted to know if it's kosher
(for dumping, etc.) to initialize a static variable
(initialized_device_p), as done in the patch.
If not, can someone tell me what needs to be done? Alternatively, we
can always set the device config from the file header instead of
skipping it as is currently done in the code. This might be the
easiest solution.
With this patch, xemacs will continue to play sounds out correctly
(the volume might be off) after the NAS server is killed.
Thanks,
Ray
Footnotes:
[1] Well, I recall sending out a message a long time ago about this,
but didn't do anything about it.
Patch to sunplay.c:
--- src/sunplay.c~ Wed Feb 16 06:16:22 2000
+++ src/sunplay.c Mon Apr 3 18:59:13 2000
@@ -57,6 +57,7 @@
#define audio_open() open ("/dev/audio", (O_WRONLY | O_NONBLOCK), 0)
+static int initialized_device_p = 0;
static int reset_volume_p, reset_device_p;
static double old_volume;
static Audio_hdr dev_hdr;
@@ -98,11 +99,12 @@
audio_flush_play (audio_fd);
- if (0 != audio_cmp_hdr (&dev_hdr, &file_hdr))
+ if (!initialized_device_p || (0 != audio_cmp_hdr (&dev_hdr, &file_hdr)))
{
Audio_hdr new_hdr;
new_hdr = file_hdr;
reset_device_p = 1;
+ initialized_device_p = 1;
if (AUDIO_SUCCESS != audio_set_play_config (audio_fd, &new_hdr))
{
char buf1 [100], buf2 [100], buf3 [250];