Mail Archives: djgpp-workers/2000/10/06/20:56:45
A while back I posted a patch to c.o.m.d to fix a problem with the
sound() function on the NT platform.
The message received no responses. Has this patch been accepted or
does it require further work?
I did test the patch on NT to show that it does actually fix the
problem (although I don't pretend to know why). However I have not
done any substantive testing to show that the fix will not break any
existing code.
I could compile and test some app that makes heavy use of sound() if
you like, or someone could make a judgement looking at the simple
change to sound()...
This is from my previous post:
In an NT 'DOS box', the first call to sound() is ignored. Subsequent
calls to sound() are honoured. The effect persists for each DOS box
session, ie the second time a program is run, its first call to
sound() will work. If the DOS box is closed and another is opened,
then again the first call to sound() will be ignored.
Here is a patch that causes sound() to behave on NT:
--- src/libc/pc_hw/sound/sound.c.original Wed Sep 27 11:52:52 2000
+++ src/libc/pc_hw/sound/sound.c Wed Sep 27 11:55:34 2000
@@ -11,8 +11,11 @@
return;
}
scale = 1193046 / freq;
+
+ /* Enable PC-speaker; do this first to work around a NT bug */
+ outportb(0x61, inportb(0x61) | 3);
+
outportb(0x43, 0xb6);
outportb(0x42, scale & 0xff);
outportb(0x42, scale >> 8);
- outportb(0x61, inportb(0x61) | 3);
}
--
[please cc replies, thanks]
- Raw text -