GDR Forum Index
Podcast Podcast
Dev Dev Logs
Search Search
RSS RSS
Register Register
Log in Log in
Reply to topic GDR Forum Index -> Game Developer's Refuge -> What are your audio/video libraries of choice?
View previous topic :: View next topic  
Author Message
carra
Member

Joined: 18 Jul 2008
Posts: 46

PostPosted: Mon Jul 25, 2011 3:04 pm    Post subject: What are your audio/video libraries of choice? Reply with quote

I've been some time in C/C++ programming already, and since the times of MS-DOS I got too used to "doing it all myself". In those days, I would write graphic routines in assembler, and that could actually be justified. But not anymore... Nowadays I'm trying to update a few of my old projects and use some already made audio/video libraries. I will probably still write some wrappers and the like, but I really don't want to reinvent the wheel more than necessary.

The thing is, there are so many C++ libraries out there and (from my perspective) all of them seem to have some major drawback:

AUDIO:
- DirectX is not multiplatform
- OpenAL seems to have been abandoned years ago
- SDL_Mixer is too limited
- Irrklang is not free for commercial use
- CLAM is GPL so no commercial apps either

VIDEO:
- DirectX is not multiplatform
- OpenGL and Irrlicht seem complicated for drawing 2D
- SDL is slow and limited
- Allegro is clunky and not just graphics

The options I am currently trying are OpenAL+Vorbis for audio, and OpenGL for video, having to write myself the code for 2D graphics (textured quads and orthographic projection). But if anyone has a better idea or more options, I will be listening.
View user's profile Send private message Visit poster's website
sonrisu
Moderator

Joined: 31 Aug 2005
Posts: 5014
Location: Silicon Valley!
PostPosted: Mon Jul 25, 2011 4:21 pm    Post subject: Reply with quote

I think your arpproach is fine. I use SDL myself with OpenGL backend with custom routines for 2D stuff. Once you have tue basics written, OpenGL isn't really too complicated just for doing 2D.

I also find SDL_Mixer does pretty much everything I may need for now. What kind of audio support are you going for?
_________________
loomsoft :]
View user's profile Send private message Visit poster's website
PoV
Moderator

Joined: 21 Aug 2005
Posts: 10974
Location: Canadia
PostPosted: Mon Jul 25, 2011 6:31 pm    Post subject: Reply with quote

AUDIO:
My solution was to support multiple, and even write my own.

Moving forward, I'll be relying on OpenAL and my Custom sound mixer.

OpenAL by itself doesn't do alot, just mixing. You still need to handle file loading and streaming yourself. On that note, mixing is very easy and cool to be able to do: Track1Sample+Track2Sample+Track3Sample=Output. Fun!

Explaining the custom sound mixer more, all platforms support a means of writing raw PCM data to a sound interface. And while I'll be abandoning SDL_mixer, SDL supports this standard PCM interface (SDL_mixer attaches to this).

I will continue using SDL on PC/Mac/Linux/webOS. For mobile (iOS/Android/other), I'll be moving away from entirely native code and relying on Marmalade (formerly Airplay SDK). I used it to do my Android and Symbian ports, loved it (No Objective C!! No Java!!). It's a bit pricey though at $500 a year. It lacks a sound mixer, but supports raw PCM output, so my custom Mixer shows up here.

I'm expecting to wrap OpenAL behind some general interface of mine, so consoles will likely use a variant of this same interface.
_________________
Mike Kasprzak
'eh whatever. I used to make AAA and Indie games | Ludum Dare | Blog | Tweetar
View user's profile Send private message
Sirocco
Moderator

Joined: 19 Aug 2005
Posts: 9470
Location: Not Finland
PostPosted: Mon Jul 25, 2011 6:39 pm    Post subject: Reply with quote

I still rely on Allegro 4, but it's more a matter of familiarity than anything else. I don't need to migrate to mobile platforms, and I've written enough routines to get past much of the lib's crufty bits.

I've done some work with DirectX, which I didn't really care for -- but that was DX7 or some nonsense; old. The newer versions are supposed to be much nicer. I've experimented with OpenGL for a few months, and while there is a bunch of overhead from learning how a state based renderer needs to be handled, it looks capable. I do miss having a buffer I can directly write to without jumping through hoops (pbuffer, FBOs sorta fix that).
View user's profile Send private message Visit poster's website
PoV
Moderator

Joined: 21 Aug 2005
Posts: 10974
Location: Canadia
PostPosted: Mon Jul 25, 2011 6:47 pm    Post subject: Reply with quote

VIDEO:
When I say SDL, I mean it as a hardware abstraction layer, and host for OpenGL. The latest SDL apparently lets you host a DirectX project too, which I may do (compatibility), but I don't see much point. OpenGL is great. AMD, NVidia and Intel have been doing perfectly fine keeping drivers OpenGL friendly of late. It's also just a step away from OpenGL ES, something I highly recommend every OpenGL coder take a serious look at. I think I only have 2 ifdef's in my Smiles codebase, things that are different in OpenGL ES and regular OpenGL (and it's just a suffix on a command). Writing OpenGL code to the OpenGL ES spec, HIGHLY RECOMMENDED!! If you want to sell stuff, mobile is FAR easier to do it reliable than on the PC. Steam makes the big bucks, but that's a curated store, they only let in things they like.

Compared to Irrlich or Ogre, yeah, I would recommend learning OpenGL/ES if your goal is 2D. Unlike Direct3D, GL has 2d versions of all calls, and learning it shows you exactly how your assets are living inside the GPU. You can make the most of performance this way. Understanding it will go a long way to getting most out of a mobile.

I'm not sure if your video topic included actual video playback, but video can be kind-of annoying. Video Codecs store data in non RGB encodings, which can throw-off many people unfamiliar with the notion of color spaces. Easy answer, just avoid video playback, unless you want to do some learnings. :D
_________________
Mike Kasprzak
'eh whatever. I used to make AAA and Indie games | Ludum Dare | Blog | Tweetar
View user's profile Send private message
carra
Member

Joined: 18 Jul 2008
Posts: 46

PostPosted: Mon Jul 25, 2011 11:19 pm    Post subject: Reply with quote

sonrisu wrote:
I also find SDL_Mixer does pretty much everything I may need for now. What kind of audio support are you going for?

I was using SDL_Mixer, until I wanted to do a smooth transition between 2 background musics (this effect is great in the game Knytt Stories), and didn't seem able to do it.

PoV wrote:
AUDIO:OpenAL by itself doesn't do alot, just mixing. You still need to handle file loading and streaming yourself. On that note, mixing is very easy and cool to be able to do: Track1Sample+Track2Sample+Track3Sample=Output. Fun!.

Yeah, seems pretty easy. Loading WAV files is a no brainer. And for music, there are good Vorbis samples and tutorials around. I have already compiled an OGG player, basically you use Vorbis and stream it to OpenAL buffers.

As for video, I think I'll pretty much do the same as you sonrisu: write some routines for 2D sprites with the basic rotozoom effects, the normal blending types, and some routines I already had for drawing thick primitives and curves (cubic splines). For text, FreeType or even the built-in functions in OpenGL should do the job.

Sirocco: If you are using Allegro, is there some reason why you are not using version 5? Seems to have lots of new features since 4...
View user's profile Send private message Visit poster's website
PoV
Moderator

Joined: 21 Aug 2005
Posts: 10974
Location: Canadia
PostPosted: Tue Jul 26, 2011 5:25 am    Post subject: Reply with quote

Yeah, you can't crossfade music w/ SDL mixer but you can cleanly fade out song 1 entirely and fade in song 2. Playing 2 songs simultaneously needs much more CPU power. Without custom stuff you can't do this on iPhone either, as music playing is handled 1 track at a time by the DSP. The custom isn't a good idea either as you would need to do strange things to resume a track not the primary on the DSP. Decoding on the DSP is far cheaper on battery life, which is how an iPhone plays 20+ hours of music yet 2-5 hours of an app.

I would discourage any "built in" text code of GL, as it doesn't exist on GL ES. GL ES is just triangles. Well, you can do whatever in the short term (even immediate mode GL, glBegin and glEnd), but long term one should use bitmap fonts rendered to a texture (generate a texture plus font metrics w/ BMFont or such). Best performance that way.

It sounds like you're past this point, but if you wanted a minimal effort OGG decoder, STB VORBIS from nothings.org is very nice (1 source file and public domain). Some of the nicest code just drops in o a project w/o silly library build steps.
_________________
Mike Kasprzak
'eh whatever. I used to make AAA and Indie games | Ludum Dare | Blog | Tweetar
View user's profile Send private message
mikedoty
Developer

Joined: 18 Mar 2006
Posts: 1788

PostPosted: Tue Jul 26, 2011 9:28 am    Post subject: Reply with quote

I hope you go with OpenGL. Works great once you have your wrappers set up. I've been looking for a 4th game to add to my linux games collection, too.
_________________
The end of the game, yes, is pretty much getting the weapon and killing off the population.
mashup games . com | Finally! - A Lode Runner Story
View user's profile Send private message Visit poster's website AIM Address
PoV
Moderator

Joined: 21 Aug 2005
Posts: 10974
Location: Canadia
PostPosted: Tue Jul 26, 2011 9:50 am    Post subject: Reply with quote

Well there's a new Humble Bundle on if you just need more games.
_________________
Mike Kasprzak
'eh whatever. I used to make AAA and Indie games | Ludum Dare | Blog | Tweetar
View user's profile Send private message
Sirocco
Moderator

Joined: 19 Aug 2005
Posts: 9470
Location: Not Finland
PostPosted: Tue Jul 26, 2011 2:33 pm    Post subject: Reply with quote

Quote:

Sirocco: If you are using Allegro, is there some reason why you are not using version 5? Seems to have lots of new features since 4...


Velocity, mostly. I've got a really decent framework at my disposal, and I'd like to make a few projects with it before before I start thinking about retooling. Game development isn't a chore at this point, so I'd like to keep it that way for a while.
View user's profile Send private message Visit poster's website
Reply to topic GDR Forum Index -> Game Developer's Refuge -> What are your audio/video libraries of choice?
Game Developer's Refuge
is proudly hosted by,

HostGator

All trademarks and copyrights on this page are owned by their respective owners. All comments owned by their respective posters.
phpBB code © 2001, 2005 phpBB Group. Other message board code © Kevin Reems.