Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. sound api to work in win98

sound api to work in win98

Scheduled Pinned Locked Moved Visual Basic
questionjsonloungeworkspace
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    pedagogy
    wrote on last edited by
    #1

    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

    D 1 Reply Last reply
    0
    • P 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

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups