Playing MP3s - the quick and easy way
Play, stop, and pause MP3's with these simple functions!
AI
AI Summary: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.
Source Code
While browsing PSC to figure out how to make an MP3 player, all I saw were big huge ZIP files with skins and stuff. After sifting through that code, I made a library to simplify the playing/pausing/stopping of MP3s. Put all this in a module called MP3Player:<br> ==========================================<br> <pre> Private Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" (ByVal lpstrCommand As String, ByVal lpstrReturnString As String, ByVal uReturnLength As Long, ByVal hwndCallback As Long) As Long Public Sub PlayMP3(filename As String) mciSendString "Open " & filename & " Alias MM", 0, 0, 0 mciSendString "Play MM", 0, 0, 0 End Sub Public Sub PauseMP3() mciSendString "Stop MM", 0, 0, 0 End Sub Public Sub StopMP3() mciSendString "Stop MM", 0, 0, 0 mciSendString "Close MM", 0, 0, 0 End Sub</pre><br> ==========================================<br> When playing a file, if it has spaces in the name, be sure to surround it with Chr(34)! If you can't figure out how to use those, then you obviously aren't worthy of using them :)
Original Comments (3)
Recovered from Wayback Machine