Click to See Complete Forum and Search --> : Playing WAVs RES files
How do you play a wav sound that is embeded in a resource file? (And how do you stop it playing!!)
I'd rather not have to save it to disk first, if at all possible.
------------------
Matthew Ralston
E-Mail: m.ralston@mediavault.co.uk
ICQ:31422892 (http://www.thebluelink.cjb.net/icq.html)
Web Sites:The Blue Link (http://www.thebluelink.cjb.net) My Home Page (http://mralston.cjb.net) (Not up at the moment!)
Doesn't matter, I've figured it out myself...
------------------
Matthew Ralston
E-Mail: m.ralston@mediavault.co.uk
ICQ:31422892 (http://www.thebluelink.cjb.net/icq.html)
Web Sites:The Blue Link (http://www.thebluelink.cjb.net) My Home Page (http://mralston.cjb.net) (Not up at the moment!)
Mark Sreeves
Jan 6th, 2000, 07:52 PM
let us in on the secret then! :)
Mark Sreeves Analyst Programer Softlab A BMW Group Company not know this?
Is your job title as cool as it sounds? Or is it just a great name for a boring overated job?
Nuf chat...
Resource file compiled with vb app, wave sound to play has a resource id string of 101...
Private Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
Private Const SND_ASYNC = &H1
Private Const SND_NODEFAULT = &H2
Private Const FLAGS = SND_ASYNC And SND_NODEFAULT
Public Sub PlayWavResource(pintResourceID As Integer)
Dim bytArr() As Byte
Dim intFFN As Integer
Dim strPath As String
bytArr = LoadResData(pintResourceID, "CUSTOM")
strPath = App.Path & IIf(Right(App.Path, 1) = "\", "~tempwav.wav", "\~tempwav.wav")
intFFN = FreeFile
Open strPath For Binary As intFFN
Put #intFFN, , bytArr
Close #intFFN
Call sndPlaySound(strPath, FLAGS)
Kill strPath
End Sub
Unfortuantely it does copy the wave to a temp file first, we'll just have to put up with it... :(
------------------
Matthew Ralston
E-Mail: m.ralston@mediavault.co.uk
ICQ:31422892 (http://www.thebluelink.cjb.net/icq.html)
Web Sites:The Blue Link (http://www.thebluelink.cjb.net) My Home Page (http://mralston.cjb.net) (Not up at the moment!)
[This message has been edited by matthewralston (edited 01-07-2000).]
Serge
Jan 7th, 2000, 11:42 AM
Not exactly:
Private Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
Private Const SND_ASYNC = &H1
Private Const SND_NODEFAULT = &H2
Private Const FLAGS = SND_ASYNC And SND_NODEFAULT
Public Sub PlayWavResource(pintResourceID As Integer)
Dim bytArr() As Byte
Dim intFFN As Integer
Dim strPath As String
bytArr = LoadResData(pintResourceID, "CUSTOM")
Call sndPlaySound(StrConv(bytArr, vbUnicode), FLAGS)
End Sub
------------------
Serge
Software Developer
Access8484@aol.com
ICQ#: 51055819 (http://www.icq.com/51055819)
Cool!
------------------
Matthew Ralston
E-Mail: m.ralston@mediavault.co.uk
ICQ:31422892 (http://www.thebluelink.cjb.net/icq.html)
Web Sites:The Blue Link (http://www.thebluelink.cjb.net) My Home Page (http://mralston.cjb.net) (Not up at the moment!)
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.