Page 1 of 1

Playing an MP3

Posted: Wed Dec 09, 2009 12:30 pm
by humph
Hi,

I'm trying to build a simple MP3 player in JADE using the multimedia control and can't seem to do some simple things. Does anyone have some quick advice or sample code about how to do this? Many thanks.

Humphrey

Re: Playing an MP3

Posted: Wed Dec 09, 2009 12:38 pm
by Jade Support
Hi Humphrey,

Can you please elaborate on the problem you're having and what simple things you're trying to achieve?

I performed a quick test (in JADE 6.3.05) by painting a MultiMedia control onto a form with a Button and coded the following in the Button::click() event method:

Code: Select all

button1_click(btn: Button input) updating; begin multiMedia1.mediaName := "C:\Temp\demo.mp3"; multiMedia1.play(); end;
This plays the audio file.

If you're having difficulty perhaps you could post a sample of the JADE logic?

Regards, Aaron.

Re: Playing an MP3

Posted: Wed Dec 09, 2009 12:42 pm
by Dino
You can play audio files quite easily with the Multimedia control with a couple of lines of code:

Code: Select all

mmcontrol.mediaName := "c:\mysong.mp3"; mmcontrol.play;
See "MultiMedia Class" in the EncycloWin.pdf document, available here:

http://www.jadeworld.com/jade/doc.htm

However, behind the scenes, the Multimedia control is using older Windows functionality that can struggle to play MP3s recorded at more than 128kbps. If you want to play higher-bit-rate MP3s, it's better to use a third-party control.

Attached is a JADE 6.2.17 schema (AudioPlayerSchema) that imports the Windows Media Player control and uses it on a JADE form. It works ok in JADE 6.3 as well.
AudioPlayerSchema.zip
Zip of AudioPlayerSchema scm and ddb files
(132.37 KiB) Downloaded 352 times
If you load the schema and run the AudioPlayerSchema app (there is only one app in the schema), you can use the File menu items to play/stop an MP3 (or any other audio file) and the View menu items to control the look of the player. Have a look at the form's load method and the code in the menu item click events to see how it works.

Dean.

Re: Playing an MP3

Posted: Wed Dec 09, 2009 5:10 pm
by humph
Thanks a lot for your quick replies, this has got me going.