PDA

View Full Version : MP3 playback for Prometheus



code_glitch
09-10-2010, 11:27 AM
I know that this is a bit off topic, but Andru, what do you use for playing audio? I'm wondering since I can't find a true cross-platform library capable of playing .mp3 files for the Prometheus_Audio unit. I got sdl_mixer working, but it uses around 46mb of ram top play a 3 minute .ogg file, and refuse to play an mp3 through a channel and inists it must be via the bgmusic (which isnt much use as I want support for pllaying multiple files at once...)

Sorry for the off topic post, but I just felt this was the fastest way to ask.

cheers,
code_glitch

ps. If any admins feel this is out of place, please say so and I will move this post to a separate thread.

Andru
09-10-2010, 01:17 PM
code_glitch

what do you use for playing audio?
OpenAL and ogg libraries. Also I use DirectSound for Windows. All source source code of my library you can grab from svn here (http://code.google.com/p/zengl/source/checkout) and try to understand how my sound subsystem works :) If you want, I can try to add mp3 support through libmad.

code_glitch
10-10-2010, 11:07 AM
Thats ok. I've dug up the Bass library, which can be compiled on linux, mac and windows, so its got the bases covered. Also its small and handles just about any file format you throw at it. But dont get me wrong, I still have an interest in any library that is cross platform, GPL and play's mp3 files. (the mp3 part there for compatibility's sake)

cheers,
code_glitch.

arthurprs
10-10-2010, 10:56 PM
You can try mpg123 as the decoder, i have converted the headers for the dll some time ago.
But i think you should stick with BASS or something free like OGG + OpenAL

WILL
10-10-2010, 11:45 PM
I'm more so for completely free options than Bass myself. Bass is great for freeware games, which any beginner would be doing, however as development gets more serious and beginners become novices, this choice in mp3 playback may scare away potential continuing usage of the game library once all the basics have been learned.

Even as beginners, us independent developers let our heads get big at the start. We all want to be able to release the next big thing and small things like shareware license fees can seem like large limitations so we will seek out newer alternatives. That's kind of what it was like in the days of DelphiX before 3D hardware acceleration was put in. Other game libraries were first spawned because of this missing feature.

arthurprs
11-10-2010, 03:07 AM
Also, there is a LGPL alternative for BASS http://audiere.sourceforge.net/

code_glitch
11-10-2010, 05:37 AM
could anyone suggest a good tutorial.example of how to use mpg123 or OpenAl?

chronozphere
11-10-2010, 07:13 AM
I believe Noeska had a tutorial, but I can't find it anymore. :(

Edit: Maybe you'll find this interesting: http://www.pascalgamedevelopment.com/showthread.php?4833-Play-a-piece-of-a-mp3-stream-with-mmsystem-or-directsound/page4&highlight=mpg123

code_glitch
11-10-2010, 02:50 PM
In terms of help, I much appreciate the above. I've thought it over and I think I am going to go with the support ogg and wav and all formats that are GPL-Happy and include a tool to convert .mp3 and other proprietary formats. Thanks for all the help, I think I have plenty more work to do on the Audio unit until the next release.

cheers,
code_glitch

paul_nicholls
11-10-2010, 09:45 PM
I believe Noeska had a tutorial, but I can't find it anymore. :(

Just go here:
http://www.noeska.com/doal/

and follow the tutorial links...

cheers,
Paul

chronozphere
12-10-2010, 12:48 PM
I know where to find Noeska's tutorials. I just recall that there was one covering MP3 playback, but I can't find that one. ;)

code_glitch
12-10-2010, 03:04 PM
'Noeska's tutorials' - I'm getting a lot of these as responses. However, there is one thing I inherently dislike: I've never, like ever, worked with lazarus or delphi... This is rather quite problematic when trying to understand a concept I don't understand at all. Even with the comments and etc. It's making life veeeery difficult. Especially when my only experience with that sort of application development is with Visual Basic.Net 2010 Beta (which I hate and dont use any more)... Apart from that, the new Prometheus_Audio based on (oh hell) OpenAl is now only capable of playing WAV. Lets hope you don't need better compression on audio files.

Anyway, until I figure this mess of Delphi, Lazarus, C and C++ code along with the vorbis and ogg stuff, prometheus is a bit dead in the water. But hey, I might've seen worse.

cheers,
code_glitch

WILL
12-10-2010, 06:39 PM
So you've only ever used Free Pascal standalone? Man, that's hardcore. ;)

Well only playing in WAVE format doesn't kill the library, it just means that only part of it is implemented so far. Most people may want to use the compressed formats for music or voice files that are much longer and obviously take up more space, however simple sound effects can be stored with only PCM compression without it really hurting the size much.

Actually I found Noeska's MP3 example post by searching Google, and guess what? Google found it here on PGD. :P http://www.pascalgamedevelopment.com/showthread.php?4833-Play-a-piece-of-a-mp3-stream-with-mmsystem-or-directsound&p=40178&viewfull=1#post40178 Download still works so give it a try if you want to include MP3 support. Or just use it to include in your converter tool.

code_glitch
12-10-2010, 07:57 PM
Cheers for that. Will definitely include it once I have time. And yes, I have only every used fpc 2.2.4 (i tried 2.4.0 but hated it because of the new error messages). Just wondering, is there an Mp3 example but for ogg too? That would be soo great. All tutorials I found used a plugin finder function with AL_EXT_vorbis in it which apparently is not used in modern revisions making my openal ogg code useless..

cheers for that find, puts me waaay ahead,
code_glitch

PS: A real treat demo for all prometheus units so far: guitar hero PC (or at least its a bit like it). Now faithful keyboard users can beat yer highscores too. hell yea, teen rockers who look down on us cuz we cant use those weird guitar hero controllers.

Edit: one more thing: I've just noticed, when you make a program it makes it easier if you write some stuff down... I admit to never having done that. Maybe thats a reasons many of my programs end up unfinished? Dont know if you guiys write stuff down.... Maybe its only c/c++ and .net people?

Bpascal
13-10-2010, 08:11 PM
how about audiere?

http://audiere.sourceforge.net/

mp3 and ogg along with old fashioned midi, mod, stm3 etc, looks nice, i had some pascal wrappers somwhere...

code_glitch
14-10-2010, 06:22 AM
Would be interested but cant find the wrappers. Although OpenAl would be preferable if I could find an updated way of playing ogg.

Bpascal
14-10-2010, 06:52 PM
Would be interested but cant find the wrappers


Look down in this link:
http://www.casteng.com/whypascal.shtml




Although OpenAl would be preferable if I could find an updated way of playing ogg.


Well, i have a Ogg player in Pascal using Openal, however it is done same as is done with mp3s, you need a different unit to open and decode ogg streamed data into normal uncompressed chunks sound data to then be passed to OpenAL.

So for that you will need to get Pascal Vorbis libs.

http://jedi.grizzlydev.com/www/apilibrary.html

You will need to downloaded updated DLLs from Vorbis projects i think.



'Noeska's tutorials' I'm getting a lot of these as responses. However, there is one thing I inherently dislike: I've never, like ever, worked with lazarus or delphi... This is rather quite problematic when trying to understand a concept I don't understand at all.


Noeska tutorials are not delphi-specific, and delphi is just the VCL or group of classes included to build windows GUI apps; But the language examples are in OO Pascal so you should be fine reading that.