Results 1 to 28 of 28

Thread: [RESOLVED] VB6 Embed audio

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Apr 2005
    Posts
    248

    Resolved [RESOLVED] VB6 Embed audio

    Hi all,

    I've got a program that needs a sound file to play when a button is clicked. However, I want to embed it (the music file) into the program so that:

    A) I can distribute the program to other people and so that they don't need the music file to go alongside it, and

    B) So there isn't a delay when the program tries to load the sound file locally or from across the internet.

    I've tried using the Media Player control, and although I can get it to work, I can only seem to link to a sound file using the "url" command; If I remove or rename the sound file, it stops working. I did a search of VBforums and founf the Microsoft media controls, but I can't get it to play the song at all: I tried defining the audio file both in the MMC's properties (FileName), defining FileName in the program (in Form_load), and also using the
    Code:
    MMC1.Command = "C:\Filename.wav"
    format. I have also tried enabling the splay, and other buttons, and they appear enabled in the regular view of VB6, but when I click run to test the program, the play button is greyed out.

    Any ideas / syntax advice?
    Thanks!

  2. #2
    Frenzied Member
    Join Date
    Jan 2000
    Location
    Brooklyn NY USA
    Posts
    1,258

    Re: VB6 Embed audio

    Two issues here, First to add a file in the program add it as a resource.

    And then you play it as you would any sound file.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Apr 2005
    Posts
    248

    Re: VB6 Embed audio

    How do you add it as a resource?

  4. #4
    Frenzied Member
    Join Date
    Jan 2000
    Location
    Brooklyn NY USA
    Posts
    1,258

    Re: VB6 Embed audio

    With the Add-in resource manager.

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Apr 2005
    Posts
    248

    Re: VB6 Embed audio

    And where might I find that? Are you referring to "References" or "Components"? Sorry, but I'm pretty new to VB.

  6. #6
    Banned shmengy's Avatar
    Join Date
    Sep 2006
    Posts
    6

    Re: VB6 Embed audio

    If sound file is a wave file then here is a good method and you won't even have to ship the control.

    1) Embed your wave file into your ressource file.

    Call this code:

    Form Code:

    VB Code:
    1. Call PlaySound("NAME OF YOUR WAVE FILE", App.hInstance, SND_RESOURCE Or SND_NOWAIT Or SND_NODEFAULT Or SND_ASYNC)

    Declarations:

    VB Code:
    1. Public Const SND_ASYNC As Long = &H1         '  play asynchronously
    2. Public Const SND_FILENAME As Long = &H20000     '  name is a file name
    3. Public Const SND_NODEFAULT As Long = &H2         '  silence not default, if sound not found
    4. Public Const SND_NOWAIT As Long = &H2000      '  don't wait if the driver is busy
    5. Public Const SND_RESOURCE As Long = &H40004     '  name is a resource name or atom
    6.  
    7. Public Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long

  7. #7
    Frenzied Member TheBionicOrange's Avatar
    Join Date
    Apr 2001
    Location
    Cardiff, UK
    Posts
    1,818

    Re: VB6 Embed audio

    Quote Originally Posted by Arby
    And where might I find that? Are you referring to "References" or "Components"? Sorry, but I'm pretty new to VB.
    Go to Add-Ins/Add-In Manager, and look for VB 6 Resource Editor.
    Click it and then click the Loaded/Unloaded box to load it.
    Once thats donw you'll have a little green cube icon with a hand on it in your toolbar.
    Click that and you'll get a small window.
    Click the word "CUSTOM", then click the icon 2nd in from the right (next to the help icon) on the windows toolbar.
    Navigate to your .WAV file and add it in.
    Remember to click the resource editors save icon before closing it.
    Likewise ... if you make any changes to your WAV file for any reason then you need to go back in to the resource editor, delete the existing entry, then re-add it, as it doesn't automatically refresh.

    NOW you can reference it in your program. If you need help to do that then just shout

  8. #8

    Thread Starter
    Addicted Member
    Join Date
    Apr 2005
    Posts
    248

    Re: VB6 Embed audio

    Thanks TBO - I got the file embedded. I notice that it had to create a .RES file though, will I have to include that with the exe when it's compiled?

    scirocco - Where do I declare those declarations? I've tried as global declarations, in the public function, and as a seperate private function, and they all give the error:
    "Compile error: Constants, Fixed-length strings, arrays, and user-defined types are not allowed as public members of object modules"

    How can I call this file to play?

  9. #9
    Frenzied Member
    Join Date
    Jan 2000
    Location
    Brooklyn NY USA
    Posts
    1,258

    Re: VB6 Embed audio

    No the .res filed is compiled in to the EXE
    But remember that your exe gets bigger because the whole file is included.

  10. #10

    Thread Starter
    Addicted Member
    Join Date
    Apr 2005
    Posts
    248

    Re: VB6 Embed audio

    Ahh, I see, thanks

    So now, Just wondering how to call the file, and where to put those declarations? (See last post)

  11. #11
    Banned shmengy's Avatar
    Join Date
    Sep 2006
    Posts
    6

    Re: VB6 Embed audio

    Hello Arby,

    Either declare them private in your form, or declare them public in a module. Then it should work. However you can't declare them public in a form.

    Keep in mind you won't here the sounds until you compile the program and run the exe using the PlaySound function.

  12. #12
    Frenzied Member TheBionicOrange's Avatar
    Join Date
    Apr 2001
    Location
    Cardiff, UK
    Posts
    1,818

    Re: VB6 Embed audio

    To "get at" your file you need to do something like this :

    VB Code:
    1. Private Sub Form_Load()
    2.     Dim sbuffer As String, iFile As Byte
    3.        
    4.     sbuffer = StrConv(LoadResData("GREEN", "CUSTOM"), vbUnicode)
    5.     iFile = FreeFile
    6.     Open "C:\green.gif" For Output As iFile
    7.     Print #iFile, sbuffer
    8.     Close #iFile
    9.    
    10.     sbuffer = StrConv(LoadResData("AMBER", "CUSTOM"), vbUnicode)
    11.     iFile = FreeFile
    12.     Open "C:\amber.gif" For Output As iFile
    13.     Print #iFile, sbuffer
    14.     Close #iFile
    15.    
    16.     sbuffer = StrConv(LoadResData("RED", "CUSTOM"), vbUnicode)
    17.     iFile = FreeFile
    18.     Open "C:\red.gif" For Output As iFile
    19.     Print #iFile, sbuffer
    20.     Close #iFile
    21.  
    22.     imgTL(0).Picture = LoadPicture("c:\green.gif")
    23.     imgTL(1).Picture = LoadPicture("c:\amber.gif")
    24.     imgTL(2).Picture = LoadPicture("c:\red.gif")
    25.        
    26.  
    27. End Sub

    This doesn't use audio files but graphics files. As you can see I extract them from the resource file and then I can use them as I would if they were sat on my local drive.
    You would do a similar thing with your audio file (but obviously not use the LoadPicture function !).

  13. #13
    Frenzied Member TheBionicOrange's Avatar
    Join Date
    Apr 2001
    Location
    Cardiff, UK
    Posts
    1,818

    Re: VB6 Embed audio

    I forgot to mention ... "GREEN", "AMBER" and "RED" are what I call my files in the Resource file. By default they are given numbers strting at 101, but by right clicking and going to Properties you can assign your own more meaningful names.

  14. #14
    Fanatic Member schoolbusdriver's Avatar
    Join Date
    Jan 2006
    Location
    O'er yonder
    Posts
    1,020

    Re: VB6 Embed audio

    This may be a bit excessive for what you want, but you can also use the APIs mciSendString or mciExecute to play audio/video files. If you're playing simple WAV files then PlaySound or sndPlaySound will play them directly from a resource file in memory. If you're after playing mp3, midi files etc, you can store them in a resource file and create temporary files for playback. An example is in the codebank:- VB - mciSendString - audio/video playback / video splashscreen etc from resource file

  15. #15

    Thread Starter
    Addicted Member
    Join Date
    Apr 2005
    Posts
    248

    Re: VB6 Embed audio

    I have declared those declarations in a module, but when it comes to the line:
    Code:
    Call PlaySound("101", App.hInstance, SND_RESOURCE Or SND_NOWAIT Or SND_NODEFAULT Or SND_ASYNC)
    , It doesn't work. I have "101" there because that is it's ID in the resource editor. I've also tried using the filename ending in .wav. What is the name of the file? I have compiled the exe but it is still not playing the sound.

  16. #16

    Thread Starter
    Addicted Member
    Join Date
    Apr 2005
    Posts
    248

    Re: VB6 Embed audio

    DOes it need to reference the module in which the declarations are stored somehow?

  17. #17
    Fanatic Member schoolbusdriver's Avatar
    Join Date
    Jan 2006
    Location
    O'er yonder
    Posts
    1,020

    Re: VB6 Embed audio

    The "101" you have in the call should not be in quotation marks (ByVal lpszName As Long). There are also a couple of issues with PlaySound, one of which is that your app will have to be compiled before it will play sounds from a resource file. The following works without issues AFTER compilation:
    VB Code:
    1. Option Explicit
    2.  
    3. 'Form level code.
    4.  
    5. 'YOU MUST COMPILE TO AN EXECUTABLE TO MAKE IT WORK !!!
    6. '-----------------------------------------------------
    7.  
    8. Private Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" _
    9.    (ByVal lpszName As Long, ByVal hModule As Long, ByVal dwFlags As Long) As Long
    10.  
    11. 'Required constants.
    12. Const SND_ASYNC = &H1 'Play asynchronously.
    13. Const SND_RESOURCE = &H40004 'Name is a resource name or atom.
    14. Const SND_PURGE = &H40 'Release memory.
    15.  
    16. 'Toggle playing by clicking on the form.
    17. Dim OnOff As Boolean
    18.  
    19. Private Sub Form_Click()
    20. 'Alternate clicks on the form will start/stop playback.
    21.     Dim RetVal As Long
    22.    
    23.     If OnOff = True Then
    24.         OnOff = False
    25. 'Reference nothing and purge memory.
    26.         RetVal = PlaySound(0, App.hInstance, SND_PURGE)
    27.     ElseIf OnOff = False Then
    28.         OnOff = True
    29. 'Reference the res file (101)
    30.         RetVal = PlaySound(101, App.hInstance, SND_RESOURCE Or SND_ASYNC)
    31.     End If
    32.     Caption = OnOff
    33. End Sub
    Last edited by schoolbusdriver; Sep 24th, 2006 at 01:51 PM. Reason: Grammar !

  18. #18

    Thread Starter
    Addicted Member
    Join Date
    Apr 2005
    Posts
    248

    Re: VB6 Embed audio

    It still won't work >_<, I can't figure out what I'm doing wrong...

    http://www.arbital24.com/TheProgram/
    That's a link to a folder with my program forms, project file, compiled exe, resource file and sound file. Do you think you could possibly have a look and recommend what to put where, or edit it for me so that it works? (I won't actually have the sound execute on form_load, it will be when the button is clicked, but I just put it there to test it).

    Thanks!

  19. #19
    Fanatic Member schoolbusdriver's Avatar
    Join Date
    Jan 2006
    Location
    O'er yonder
    Posts
    1,020

    Re: VB6 Embed audio

    The wav file has to be identified as such in the resource file. Double-click on the 101 in the resource editor window and replace the Type "CUSTOM" with "SOUND". You should see something like this when you've done.
    Code:
    [-] C:\Temp\Project1.RES
       [-] "SOUND"
          [+] 101
    Compile and run the exe. There's a link to a very good tutorial on resource files in my signature.

  20. #20

    Thread Starter
    Addicted Member
    Join Date
    Apr 2005
    Posts
    248

    Re: VB6 Embed audio

    It works perfectly, Thank you very much! ^__^

  21. #21
    New Member
    Join Date
    Oct 2006
    Location
    Australia
    Posts
    5

    Re: VB6 Embed audio

    Quote Originally Posted by TheBionicOrange
    To "get at" your file you need to do something like this :

    VB Code:
    1. Private Sub Form_Load()
    2.     Dim sbuffer As String, iFile As Byte
    3.        
    4.     sbuffer = StrConv(LoadResData("GREEN", "CUSTOM"), vbUnicode)
    5.     iFile = FreeFile
    6.     Open "C:\green.gif" For Output As iFile
    7.     Print #iFile, sbuffer
    8.     Close #iFile
    9.    
    10.     sbuffer = StrConv(LoadResData("AMBER", "CUSTOM"), vbUnicode)
    11.     iFile = FreeFile
    12.     Open "C:\amber.gif" For Output As iFile
    13.     Print #iFile, sbuffer
    14.     Close #iFile
    15.    
    16.     sbuffer = StrConv(LoadResData("RED", "CUSTOM"), vbUnicode)
    17.     iFile = FreeFile
    18.     Open "C:\red.gif" For Output As iFile
    19.     Print #iFile, sbuffer
    20.     Close #iFile
    21.  
    22.     imgTL(0).Picture = LoadPicture("c:\green.gif")
    23.     imgTL(1).Picture = LoadPicture("c:\amber.gif")
    24.     imgTL(2).Picture = LoadPicture("c:\red.gif")
    25.        
    26.  
    27. End Sub

    This doesn't use audio files but graphics files. As you can see I extract them from the resource file and then I can use them as I would if they were sat on my local drive.
    You would do a similar thing with your audio file (but obviously not use the LoadPicture function !).


    I am new here and also new to VB.
    I have the same probelm embeding txt and mdb files. Does this method apply?

    Thanks.

    William

  22. #22
    Fanatic Member schoolbusdriver's Avatar
    Join Date
    Jan 2006
    Location
    O'er yonder
    Posts
    1,020

    Re: VB6 Embed audio

    Quote Originally Posted by williamTAN
    I am new here...
    Welcome to the forums

    Now that the pleasantries are over... - you should really start a new thread as this one has already been marked as resolved.

    Resource files have a limit of 64kb on individually stored files, so if your db is bigger than this you'd be better off using other methods. Text can easily be stored in the res file. If you need a tutorial, look at the link in my signature.

    The following may help...
    VB Code:
    1. Option Explicit
    2.  
    3. 'Add a CUSTOM resource, such as notepad.exe to a res file
    4. 'and recreate it at run-time.
    5.  
    6. Private Sub Form_Load()
    7.    MakeFile "101"
    8. End Sub
    9.  
    10. Private Sub MakeFile(intResourceID As Integer)
    11. 'Create a file from the data in the .res file.
    12.    Dim byteBinFile() As Byte     'For assembling a binary file from the resource file.
    13.    Dim intFileNum    As Integer  'File number.
    14.    
    15.    On Error GoTo BadResError
    16. 'Get a file handle.
    17.    intFileNum = FreeFile
    18. 'Get the data from the resource file.
    19.    byteBinFile = LoadResData(intResourceID, "CUSTOM") 'BadResError - file too big - out of memory.
    20.  
    21. 'Write the binary data to it.
    22.    Open "C:\Temp\MyNotepadTest.exe" For Binary As intFileNum
    23.       Put intFileNum, , byteBinFile
    24.    Close intFileNum
    25.  
    26.    Exit Sub
    27. BadResError:
    28.    If Err.Number = 7 Then
    29.       MsgBox "Insufficient memory. File too large."
    30.    Else
    31.       MsgBox "Unexpected error:- " & Err.Number
    32.    End If
    33. End Sub

  23. #23
    PowerPoster Keithuk's Avatar
    Join Date
    Jan 2004
    Location
    Staffordshire, England
    Posts
    2,236

    Re: [RESOLVED] VB6 Embed audio

    As you load all your wave files into the resource file as a Custom item, its a good idea to change the ID number(101) to the wave file name e.g. explode.wav to EXPLODE and change the Type to WAVE or SOUND. Now you don't need to extract the wave file to the HD to play it.
    VB Code:
    1. Const SND_ASYNC = &H1
    2. Const SND_NODEFAULT = &H2
    3. Const SND_MEMORY = &H4
    4.  
    5. Private Declare Function sndPlaySound Lib "winmm.dll" Alias _
    6. "sndPlaySoundA" (ByVal lpszSoundName As String, _
    7. ByVal uFlags As Long) As Long
    8.  
    9. Private Sub PlaySound(Soundname As String) 'ResData
    10.  
    11. Dim SoundBuffer As String
    12.  
    13. 'Soundname is the name of your wave file in the resource file
    14. '"WAVE" is the Type
    15. SoundBuffer = StrConv(LoadResData(Soundname, "WAVE"), vbUnicode)
    16. Call sndPlaySound(SoundBuffer, SND_MEMORY Or SND_ASYNC Or SND_NODEFAULT)
    17.  
    18. End Sub
    19.  
    20. Private Sub Command1_Click()
    21.  
    22. Call PlaySound("EXPLODE")
    23.  
    24. End Sub
    Last edited by Keithuk; Oct 26th, 2006 at 06:58 AM.
    Keith

    I've been programming with VB for 25 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning.

  24. #24
    PowerPoster Keithuk's Avatar
    Join Date
    Jan 2004
    Location
    Staffordshire, England
    Posts
    2,236

    Re: VB6 Embed audio

    Quote Originally Posted by schoolbusdriver
    The following works without issues AFTER compilation:

    'YOU MUST COMPILE TO AN EXECUTABLE TO MAKE IT WORK !!!
    Files you put in a resource file will be used in IDE you don't have to compile first.
    Keith

    I've been programming with VB for 25 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning.

  25. #25
    Addicted Member
    Join Date
    Aug 2006
    Posts
    208

    Re: [RESOLVED] VB6 Embed audio

    Why didt you just do this, put the music file in an OLE and do this code

    VB Code:
    1. Private Sub Command1_Click()
    2. OLE1.DoVerb 0
    3. End Sub

    Thats very simple.

  26. #26
    Fanatic Member schoolbusdriver's Avatar
    Join Date
    Jan 2006
    Location
    O'er yonder
    Posts
    1,020

    Re: VB6 Embed audio

    Quote Originally Posted by Keithuk
    Files you put in a resource file will be used in IDE you don't have to compile first.
    That's what I thought once, too. Try the following code. In the IDE, attempting to play the sounds stored in the res file fails, while the files on the HDD play OK. Different res/HDD file combinations give the same results.

    When compiled to an exe, they all play.

    The oddity here is "102-nudge.wav", which only plays ONCE from the res file, whether you use PlaySound or sndPlaySound. No such problem with "101-tada.wav". Wierd.

    Other files give varying results too.
    VB Code:
    1. Option Explicit
    2.  
    3. 'Put 4 command buttons on a form (NOT in an array).
    4.  
    5. 'Sound files used: Put in the project's folder, AND the resource file.
    6.  
    7. '"101-tada.wav"      Res ID 101  - formerly "C:\Windows\Media\tada.wav"
    8. '"102-nudge.wav"     Res ID 102  - formerly "C:\Program Files\MSN Messenger\nudge.wav"
    9. '"103-wmpaud1.wav"   Res ID 103  - formerly "C:\WINDOWS\Help\Tours\WindowsMediaPlayer\Audio\Wav\wmpaud1.wav"
    10. '"104-Mwiip.wav"     Res ID 104  - external source. Find your own :-)
    11.  
    12. 'Note the different ways you can call PlaySound & sndPlaySound, depending
    13. 'on whether you want to pass a number or string.
    14.  
    15. 'PlaySound.
    16. 'Pass a String reference to lpszName.
    17. Private Declare Function PlaySoundString Lib "winmm.dll" Alias "PlaySoundA" _
    18.    (ByVal lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long
    19.  
    20. 'Pass a Long Resource reference to lpszName.
    21. Private Declare Function PlaySoundResource Lib "winmm.dll" Alias "PlaySoundA" _
    22.    (ByVal lpszName As Long, ByVal hModule As Long, ByVal dwFlags As Long) As Long
    23.  
    24.  
    25. 'sndPlaySound.
    26. 'Pass a String reference to lpszSoundName.
    27. Private Declare Function sndPlaySoundString Lib "winmm.dll" Alias "sndPlaySoundA" _
    28.    (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
    29.  
    30. 'Pass a Long Resource reference to lpszSoundName.
    31. Private Declare Function sndPlaySoundLong Lib "winmm.dll" Alias "sndPlaySoundA" _
    32.    (ByVal lpszSoundName As Long, ByVal uFlags As Long) As Long
    33.  
    34. 'Required constants.
    35. Const SND_ASYNC = &H1            'Play asynchronously.
    36. Const SND_FILENAME = &H20000     'Name is a file name.
    37. Const SND_PURGE = &H40           'Release memory.
    38. Const SND_RESOURCE = &H40004     'Name is a resource name or atom.
    39.  
    40. Private Sub Form_Load()
    41. 'Add proper captions to the command buttons.
    42.    Command1.Caption = "PlaySound - Resource"
    43.    Command2.Caption = "PlaySound - HDD"
    44.    Command3.Caption = "sndPlaySound - Resource"
    45.    Command4.Caption = "sndPlaySound - HDD"
    46. End Sub
    47.  
    48. Private Sub Command1_Click()
    49. 'PlaySound. Resource file. 104-Mwiip.wav
    50.     Dim RetVal As Long
    51.  
    52. 'Reference nothing and purge memory.
    53.    RetVal = PlaySoundResource(0, App.hInstance, SND_PURGE)
    54. 'Reference the res file and ... Top Of The Pops ...
    55.    RetVal = PlaySoundResource(104, App.hInstance, SND_RESOURCE Or SND_ASYNC)
    56. End Sub
    57.  
    58. Private Sub Command2_Click()
    59. 'PlaySound. HDD file. 101-tada.wav
    60.     Dim RetVal As Long
    61.  
    62. 'Reference nothing and purge memory.
    63.      RetVal = PlaySoundString("", App.hInstance, SND_PURGE)
    64. 'Reference the res file and ... Top Of The Pops ...
    65.      RetVal = PlaySoundString(App.Path & "\101-tada.wav", App.hInstance, SND_FILENAME Or SND_ASYNC)
    66. End Sub
    67.  
    68. Private Sub Command3_Click()
    69. 'sndPlaySound. Resource file. 103-wmpaud1.wav
    70.    Dim RetVal As Long
    71.  
    72. 'Reference nothing and purge memory.
    73.    RetVal = sndPlaySoundLong(0, SND_PURGE)
    74. 'Reference the res file and ... Top Of The Pops ...
    75.    RetVal = sndPlaySoundLong(103, SND_RESOURCE Or SND_ASYNC)
    76. End Sub
    77.  
    78. Private Sub Command4_Click()
    79. 'sndPlaySound. HDD file. 102-nudge.wav
    80.    Dim RetVal As Long
    81.  
    82. 'Reference nothing and purge memory.
    83.    RetVal = sndPlaySoundString("", SND_PURGE)
    84. 'Reference the HDD file.
    85.    RetVal = sndPlaySoundString(App.Path & "\102-nudge.wav", SND_FILENAME Or SND_ASYNC)
    86. End Sub

  27. #27
    PowerPoster Keithuk's Avatar
    Join Date
    Jan 2004
    Location
    Staffordshire, England
    Posts
    2,236

    Re: [RESOLVED] VB6 Embed audio

    Ok I've pasted you code into an app and added the resources. Only Command buttons 2 and 4 play sounds. I compiled the exe and still the same only 2 and 4 play.

    Like I said before your previous code doesn't play sounds either.
    Last edited by Keithuk; Oct 26th, 2006 at 05:27 PM.
    Keith

    I've been programming with VB for 25 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning.

  28. #28
    Fanatic Member schoolbusdriver's Avatar
    Join Date
    Jan 2006
    Location
    O'er yonder
    Posts
    1,020

    Re: [RESOLVED] VB6 Embed audio

    Did a quick google to try and get more info and came across this almost immediately. The next to last post by MikeD is interesting. Besides the rant, he mentions having the resource type as "WAVE". I've used "SOUND" and "WAVE" with identical results (not tried B*LL*CKS - yet Edit: doesn't work ). Another little bit is the addition of "&" after "101" specifying a Long. Again identical results. (nudge.wav played from a res is still problematic) It seems that different Win OS's, wave files and setups give differing results . (eg. "...it works ok on MY pc...") I've posted the same PlaySound code here several times with positive results.

    Do you have a large, say 1MB, NON-MS .wav you could put in the res to try? It *seems* the bigger the file, the more reliable playback is.

    Other than this I can only suggest creating temporary files from the res and playing them from HDD. (Or just using wav files on the HDD). I don't know if it'll suit your purposes, but there's an app I put in the codebank "mciSendString - audio/video playback..." in my signature that does that. It's a tad more complex than the one liner "PlaySound", but could be stripped down/adapted to suit.
    Last edited by schoolbusdriver; Oct 27th, 2006 at 05:53 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width