Playing an MP3

Forums for specific tips, techniques and example code
humph
Posts: 3
Joined: Wed Dec 09, 2009 7:26 am
Location: New Zealand

Playing an MP3

Postby humph » Wed Dec 09, 2009 12:30 pm

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

User avatar
Jade Support
Posts: 103
Joined: Mon Aug 17, 2009 10:27 am
Location: Jade Software Corporation, Christchurch

Re: Playing an MP3

Postby Jade Support » Wed Dec 09, 2009 12:38 pm

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.
Jade Support
Jade Software Corporation Ltd

Email: jadesupport@jadeworld.com
Web: http://www.jadeworld.com

Jade Software – complex business problems solved beautifully.

User avatar
Dino
Posts: 49
Joined: Wed Jun 24, 2009 6:55 am
Location: London
Contact:

Re: Playing an MP3

Postby Dino » Wed Dec 09, 2009 12:42 pm

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 369 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.

humph
Posts: 3
Joined: Wed Dec 09, 2009 7:26 am
Location: New Zealand

Re: Playing an MP3

Postby humph » Wed Dec 09, 2009 5:10 pm

Thanks a lot for your quick replies, this has got me going.


Return to “Tips and Techniques”

Who is online

Users browsing this forum: No registered users and 10 guests

cron