trouble playing a music file...
so a friend helped me out with this bit of code
Private Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
Const SND_SYNC = &H0 ' play synchronously (default)
Const SND_NODEFAULT = &H2
Private Sub Image1_Click()
Dim sound1 As Long
sound1 = sndPlaySound("insert music file path here", SND_NODEFAULT)
End Sub
so it works when i enter a MP3 file of a guitar string...but when i try and put a MP3 music file in the pathname nothing happens...anyone have any idea what up?
Re: trouble playing a music file...
so, it played an MP3 file? That's news to me, I didn't know that API can play MP3s. Jump to the last 2 posts in this link and try using mciSendString instead. Adjust the posted code to suit your needs. You can also do a forum search for MP3 and get even more examples.
Re: trouble playing a music file...
alright the code seems simple enough, i'm just unsure what i'm supposed to pass Play_MM
Re: trouble playing a music file...
From that example? Nothing, just do as it says: "Play MM". MM is a string "name" given to that instance of mciSendString so that you can query later if needed, to see if it is still playing or other more advanced attributes. MM in that example is just a name, you can call it anything, like "MyMusicFile" for example, then change the call to: "Play MyMusicFile"
Re: trouble playing a music file...
ok i'm a real noob at programing(took a class last year in highschool but the second half we programed in c++) so from what i see, when i click the play button i call mciSendString....but i dont see where i tell it the path name of the file i want to play...
Re: trouble playing a music file...
If you are using that code, pass the full path & file name to the function.
Example: Play_MM "C:\Guitar.mp3"
P.S. I misunderstood the previous posting, I though you were refering to the "Play MM" in the mciSendString call, not the function. Sorry about that.