0
votes

I'd like to be able to play an MP3 file programmatically, using Lazarus on macOS.

Lazarus 2.0 (fpc 3.0.4) on macOS is working great for me, but one thing I cannot manage to do is to play an MP3 file programmatically.

I managed to compile and run the OALSoundManager demo project, but only WAV files can be played that way.

I spent several hours following various leads from the freepascal forum, but I still could not manage to do the basic play operations:

  1. Load an MP3 file
  2. Start playing it.
  3. Get the current playing position (e.g. during OnTimer).
  4. Be notified when it stops.

I'm OK with using any common library. Of course the less dependencies the better.

Once I can play the file I can figure out the rest, but it would be great if the example also showed:

  1. Start playing from a given time position
  2. Pause/Restart

Thank you very much for any help!

1

1 Answers

0
votes

You might be able to use Castle Engine and OpenAL.

You can install Castle Engine from with-in Lazarus. In the main menu under "Package" -> "Online Package Manager" you will be able to filter and install "castle".

Then you should be able to open the example project:

https://github.com/castle-engine/castle-engine/blob/master/examples/audio/alplay.lpr

Goodluck,