Play MP3 without WINAMP using Lotus Script

October 23, 2005 – 6:17 pm

Do you remember “MP3 PlayMate ” for Lotus Notes written by Allan Reinhold Kildeby ?

Well, it is a very nice tool, but you need Winamp to play the mp3 files.
Today it is one of these boring sundays and I thougth to myself: “Wouldn’t it be nice to play the mp3s directly thru some nice API code ? “.

By using MCI, you can play most media files. but normaly, it doesn’t work for MP3. This is because mp3-data needs to be rendered specially. After a beer or two i had an idea while looking at the code using DirectShow: why not play the mp3-files as VIDEO? OK, here’s how it works:

(1.) Declare the Function

1
2
3
4
5
Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA"_
(Byval lpszCommand As String,_
Byval lpszReturnString As String,_
Byval cchReturnLength As Long,_
Byval hwndCallback As Long) As Long

(2.) Use “mciSendString” to invoke the commands:

Syntax: mciSendString(sCommand, 0, 0, 0)

where sCommand is:

Load the mp3 file:=  “open ” & sMp3FileLocation & ” type MPEGVideo alias Mp3File”
Play the mp3 file (Now you can use the Alias):= “play Mp3File” from 0″
Pause:= “pause Mp3File”"
Stop:= “stop Mp3File”
and unload from mem, unlock file:= “close Mp3File”

(3.) put the commands into a button for testing purpose

1
2
3
4
5
6
7
8
9
10
11
12
13
14
Sub Click(Source As Button)
	Dim sCommand As String
	Dim sMP3FileLocation As String
	sMP3FileLocation = "whateverMP3youlike.mp3"
	sCommand = "Open " & sMP3FileLocation & "  type MPEGVideo alias MP3File"
	Call mciSendString(sCommand, 0, 0, 0)
	scommand = "play MP3File from 0"
	Call mciSendString(sCommand, 0, 0, 0)
	Msgbox "OK"
	scommand = "stop MP3File"
	Call mciSendString(sCommand, 0, 0, 0)
	scommand ="close MP3File"
	Call mciSendString(sCommand, 0, 0, 0)
End Sub

(4.) tweak PlayMate
(5.) Have fun !!

Related posts:

  1. SnTT: Is database design hidden (Notes API Solution)
  2. IBM Blog Template – Syntax Highlighter for Lotus Script
  3. @Command([ToolsUserLogoff]) in Lotus Script
  4. Enumerating Local And Network Drives
  5. PING in LotusScript

  1. One Response to “Play MP3 without WINAMP using Lotus Script”

  2. very good

    By donniewang on Feb 17, 2006

Sorry, comments for this entry are closed at this time.