Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Wave File not Waving
Message
From
08/12/2016 16:59:19
 
 
To
07/12/2016 15:06:42
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 10
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01644671
Message ID:
01644746
Views:
51
to complete my previous reply,this is another APIs to play sounds:

MessageBeep API :https://msdn.microsoft.com/en-us/library/windows/desktop/ms680356(v=vs.85).aspx
Plays a waveform sound. The waveform sound for each sound type is identified by an entry in the registry.it used by the sounds sent by messagebox function.
declare integer MessageBeep in user32 integer
messagebeep(16)
beep APi:https://msdn.microsoft.com/en-us/library/windows/desktop/ms679277(v=vs.85).aspx
Beep Api generates simple tones on the PC speaker. The function is synchronous. it performs an alertable wait and does not return control to its caller until the sound finishes.
it uses 2 parameters :the frequency (37 through 32,767 ) and duration (milliseconds)
declare integer Beep in kernel32 integer,integer   &&can use win32api library if exact dll not known
Beep( 1000, 500 )
with this in principe can play any music composition !
declare integer Beep in kernel32 integer,integer 
 For i = 0 To 4000 Step 50
        *play a tone of i hertz, duration 50 milliseconds
        Beep( i, 20)
    inke(0.1)
    endfor
for fun, this a beginer composition sample ;
declare integer Beep in kernel32 integer,integer
create cursor ycurs( tone i,duration i)

text to m.myvar noshow
 659, 120  
 0 ,120
 622, 120  
 0 ,120
 659, 120  
 0 ,120
 622, 120  
 0 ,120
 659, 120  
 0 ,120
 494, 120  
 0 ,120
 587, 120  
 0 ,120
 523, 120 
 0 ,120
 440, 120  
 0 ,140
 262, 120 
 0 ,120
 330, 120  
 0 ,120
 440, 120  
 0 ,120
 494, 120  
 0 ,140
 330, 120  
 0 ,120
 415, 120 
 0 ,120
 494, 120  
 0 ,120
 523, 120  
 0 ,140
 330, 120  
 0 ,120
 659, 120  
 0 ,120
 622, 120  
 0 ,120
 659, 120  
 0 ,120
 622, 120  
 0 ,120
 659, 120 
 0 ,120
 494, 120  
 0 ,120
 587, 120  
 0 ,120
 523, 120  
 0 ,120
 440, 120  
 0 ,140
 262, 120 
 0 ,120
 330, 120  
 0 ,120
 440, 120  
 0 ,120
 494, 120  
 0 ,140
 330, 120  
 0 ,120
 523, 120  
 0 ,120
 494, 120  
 0 ,140
 440, 120  
endtext

local x1,x2
for i=1 to memlines(m.myvar)
x1=int(val(getwordnum(mline(m.myvar,i),1,',')))
x2=int(val(getwordnum(mline(m.myvar,i),2,',')))
insert into ycurs values(x1,x2)
endfor
*brow

scan
beep(tone,duration)
endscan
*update
in principe SAPI.SpVoice is shipped with windows OS.you can use this code for any sound file (or even for a litteral text)
local objVoice,objFile
try  &&in principe activeX installed with windows 
objVoice = CreateObject("SAPI.SpVoice")
objFile = CreateObject("SAPI.SpFileStream.1")
objFile.Open (getfile("wav"))   &&c:\windows\media\notify.wav
objVoice.Speakstream(objFile)
objFile=null
objVoice=null
catch
endtry
Previous
Reply
Map
View

Click here to load this message in the networking platform