sound api to work in win98
-
Dear Ladies|Gentlemen: I developed a visual basic program in VB4 on Win3.11 (16 bit)incorporating an API call to produce a 'siren' effect. The executible worked fine in the 16 bit environment but upon running it under Win98 and Win98se the 'siren' effect doesn't work! There are no 'run time' errors... just no 'siren'! The API is defined in 'general declarations': Option Explicit 'api for sound.drv (called by subroutine 'racket') 'resides in module.bas Declare Function opensound% Lib "sound.drv" () Declare Function setvoicesound% Lib "sound.drv" (ByVal nsource%, ByVal freq&, ByVal nduration%) Declare Function startsound% Lib "sound.drv" () Declare Function closesound% Lib "sound.drv" () Declare Function waitsoundstate% Lib "sound.drv" (ByVal state%) 'The 'siren', named 'racket' is conditionally called from a subroutine: Public Sub racket() Dim t, n2, n3 Dim frequency As Long Dim duration As Integer t = opensound() 'start freq again: 'label to repeat for siren effect 'n3 = frequency; here set in a for-next loop 'n2 = duration in 1/10th sec; + _ set here; now = to .3 sec n2 = 8 'duration; duration = n2 For n3 = 500 To 1200 Step 50 'freq in a for next loop frequency = n3 * 65536 t = setvoicesound(1, frequency, duration) t = startsound() While (waitsoundstate(0) <> 0): Wend 't = closesound() stops frequency DoEvents Next n3 GoTo again End Sub How do I make this API work in windows 98 and 98se? Thank you, Ralph Thank you, Pedagogy
-
Dear Ladies|Gentlemen: I developed a visual basic program in VB4 on Win3.11 (16 bit)incorporating an API call to produce a 'siren' effect. The executible worked fine in the 16 bit environment but upon running it under Win98 and Win98se the 'siren' effect doesn't work! There are no 'run time' errors... just no 'siren'! The API is defined in 'general declarations': Option Explicit 'api for sound.drv (called by subroutine 'racket') 'resides in module.bas Declare Function opensound% Lib "sound.drv" () Declare Function setvoicesound% Lib "sound.drv" (ByVal nsource%, ByVal freq&, ByVal nduration%) Declare Function startsound% Lib "sound.drv" () Declare Function closesound% Lib "sound.drv" () Declare Function waitsoundstate% Lib "sound.drv" (ByVal state%) 'The 'siren', named 'racket' is conditionally called from a subroutine: Public Sub racket() Dim t, n2, n3 Dim frequency As Long Dim duration As Integer t = opensound() 'start freq again: 'label to repeat for siren effect 'n3 = frequency; here set in a for-next loop 'n2 = duration in 1/10th sec; + _ set here; now = to .3 sec n2 = 8 'duration; duration = n2 For n3 = 500 To 1200 Step 50 'freq in a for next loop frequency = n3 * 65536 t = setvoicesound(1, frequency, duration) t = startsound() While (waitsoundstate(0) <> 0): Wend 't = closesound() stops frequency DoEvents Next n3 GoTo again End Sub How do I make this API work in windows 98 and 98se? Thank you, Ralph Thank you, Pedagogy
You could replace all the above declarations with one to the Beep API.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/debug/base/beep.asp[^]
Don't know if it is going to produce the exact same results, but the parameters you are using are the same as Beep. RageInTheMachine9532