Having trouble playing MP3 files, although no issue playing a .WAV.
Here is my module code:
Private Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA"
( _
ByVal lpszSoundName As String, _
ByVal uFlags As Long) As Long
Private Const SND_APPLICATION = &H80 ' look for application
specific association
Private Const SND_ALIAS = &H10000 ' name is a WIN.INI
[sounds] entry
Private Const SND_ALIAS_ID = &H110000 ' name is a WIN.INI
[sounds] entry identifier
Private Const SND_ASYNC = &H1 ' play asynchronously
Private Const SND_FILENAME = &H20000 ' name is a file name
Private Const SND_LOOP = &H8 ' loop the sound until next
sndPlaySound
Private Const SND_MEMORY = &H4 ' lpszSoundName points to a
memory file
Private Const SND_NODEFAULT = &H2 ' silence not default, if
sound not found
Private Const SND_NOSTOP = &H10 ' don't stop any currently
playing sound
Private Const SND_NOWAIT = &H2000 ' don't wait if the driver
is busy
Private Const SND_PURGE = &H40 ' purge non-static events
for task
Private Const SND_RESOURCE = &H40004 ' name is a resource name
or atom
Private Const SND_SYNC = &H0 ' play synchronously
(default)
Public gSoundsOn As Integer
Public Sub PlayMP3(SoundFileName As String)
sndPlaySound SoundFileName, SND_ASYNC Or SND_NODEFAULT
End Sub
.. to play a sound, I simply do this
PlayMP3 "filename.mp3"
Well, if I pass a .wav file, it plays. If I pass an mp3, it does not.
Any help is appreciated. Thanks -