Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

 
Advanced search

877566 Posts in 32868 Topics- by 24309 Members - Latest Member: Thomas Hiatt

May 19, 2013, 08:51:08 PM
TIGSource ForumsDeveloperTechnical (Moderators: Glaiel-Gamer, ThemsAllTook)Is SDL_mixer good enough for a medium sized game?
Pages: [1]
Print
Author Topic: Is SDL_mixer good enough for a medium sized game?  (Read 837 times)
Greg
Level 0
***


has a compass, lost my map


View Profile
« on: September 13, 2011, 08:03:33 AM »



Hey guys, Im writing a new game from the ground up and im using SDL_mixer for sound.  So far it seems perfectly fine.  I have my project compiling well simultaneously on Mac and Linux (haven't gotten to Windows yet, but soon!... I'm installing Mingw and msysgit today, so we'll see).

So I'm wondering what your experiences have been using SDL_mixer? -- Can it pull off the task of being a complete audio mixer solution for a game?  (Albeit, a small indie game, not super huge by any means).  And by that, I mean, always playing music, w/ fade-ins, fade-outs, and switching tracks, while simultaneously blasting dozens, if not hundreds of various pre-loaded SFX?  My concerns are basically latency.  I remember I hacked something up with it in about 2006 that was buggy, lagged and didn't entirely work right, (but that could've been SDL_sound too, which is another thing, not sure).

I'm not sure if it'll pull off a whole game.  I mean, it seems like it can, but I have my doubts, and I'd rather just know now so I can budget in the time for writing mixer code, or if I can just rely on it and focus on other things.  But at the same time, multi-system compatibility rates way high up on my list of desired features, so writing my own could prove to be... ughhh.

So...  What are your guys' experiences?
Logged

A day for firm decisions!!! Or is it?
Christian Knudsen
Level 10
*****



View Profile WWW Email
« Reply #1 on: September 13, 2011, 08:11:58 AM »

I've had only good experiences with SDL_mixer on Ascii Sector. There was a bug for a long time that would cause crackles in the music, but that was fixed. The only thing I miss is being able to crossfade between tracks.
Logged

Laserbrain Studios
Currently working on Hostile Takeover (TIGSource DevLog)
Greg
Level 0
***


has a compass, lost my map


View Profile
« Reply #2 on: September 13, 2011, 10:17:31 AM »

Holy crap!  I checked out Ascii Sector, and I luvvv it.  Ironically, (or maybe not), I'm also doing an Ascii game, and with slightly enlargened ascii characterset, to make game icons more the scale of actual game icons.  No friggen way.

but Yes, I remember some samples crackling.  There was also a loop issue with Ogg files, where the break in the loop where the track ended and starts over again, there'd be a little click that you couldn't get rid of.

I wouldn't be surprised if these are all issues that have been fixed in the past few years.

Thanks for your reply Christian.  I wouldn't be surprised if I put some serious time into playing Ascii Sector.

Here's a pic of my game to prove I'm not bullshitting (2-week build):
« Last Edit: September 13, 2011, 03:22:14 PM by Greg » Logged

A day for firm decisions!!! Or is it?
Greg
Level 0
***


has a compass, lost my map


View Profile
« Reply #3 on: September 13, 2011, 10:37:45 AM »

OMG, I. Love. Ascii Sector.  WC Privateer is one of my all-time biggest influences.
Logged

A day for firm decisions!!! Or is it?
eclectocrat
Level 5
*****


Most of your personality is unconscious.


View Profile WWW
« Reply #4 on: September 13, 2011, 06:15:37 PM »

I've had big problems building SDL_mixer with SDL 1.3 under mingw, but others have not. It seems to depend on your blood type or the constellation you were born under or something. Hope it works for you.

EDIT: Ascii Sector is great!
« Last Edit: September 13, 2011, 06:37:03 PM by eclectocrat » Logged

I am eclectocrat.
I make Mysterious Castle, a Tactics-Roguelike (TIGSource devlog).
justinfic
Level 0
***


justinfic
View Profile WWW
« Reply #5 on: September 13, 2011, 06:36:29 PM »

I've used SDL_Mixer in my stuff since late 2004, and I love it. I did have a project where one of my ogg files had a crackling part, but other than that it's been great. I know eventually I'd like to have more low-level control of the audio, and I'd also love to be able to crossfade between two music tracks. At that point I might consider something a little more heavy duty, but in the meantime, SDL_Mixer has worked beautifully for what I've needed it for.
Logged

Twitter | Current Project: Kung Fu Killforce
Evan Balster
Level 10
*****


dreaming close to metal


View Profile WWW Email
« Reply #6 on: September 13, 2011, 06:44:42 PM »

SDL's audio output (which SDL_mixer uses, natch) under Windows/cygwin has some massive latency issues, though under MSVC they improved dramatically.  I think it's "okay" under SDL_Mixer, but I'd do some testing with the granularity and latency of your sounds.  Hold a microphone up to your computer keyboard and measure the time between a keypress and a sound's output.  It might not be consistent.

I use portaudio, but I'm writing my own mixer engine and have rather specific needs in the way of audio control.
Logged

Infinite Blank, SoundSelf, Cave Story+, Wreath
voice, accordion, mandolin, (oboe, soon)
Game audio programming consultant.
<plaid/audio>: opensource audio framework
Greg
Level 0
***


has a compass, lost my map


View Profile
« Reply #7 on: September 13, 2011, 07:16:41 PM »

I just ran a test, looping 2 tracks: 1 .ogg, and another .wav.  I used the calls: Mix_LoadMUS() and Mix_PlayMusic().  The Ogg created an audible glitch each time the track started the loop again, whereas the wav did not. 

At this point it might be more efficient for me to figure out why this is and submit a patch to the SDL_mixer maintainer than it would to write a mixer from scratch.  We'll see........

Anyone know Ryan Gordon?

Logged

A day for firm decisions!!! Or is it?
Greg
Level 0
***


has a compass, lost my map


View Profile
« Reply #8 on: September 13, 2011, 07:25:23 PM »

The last (and only) mixer I wrote used the Quake3 mixer code (which accesses the sound buffer via directly DirectSound), and I stubbed in support for stb_vorbis.c and it totally worked.  I remember there was some buffer management and making sure that the pointers were at the right place at the right time.  But I am 100% certain that it worked, so it can't be that hard, right?...
« Last Edit: September 13, 2011, 07:37:29 PM by Greg » Logged

A day for firm decisions!!! Or is it?
eclectocrat
Level 5
*****


Most of your personality is unconscious.


View Profile WWW
« Reply #9 on: September 13, 2011, 09:00:01 PM »

I just ran a test, looping 2 tracks: 1 .ogg, and another .wav.  I used the calls: Mix_LoadMUS() and Mix_PlayMusic().  The Ogg created an audible glitch each time the track started the loop again, whereas the wav did not. 

At this point it might be more efficient for me to figure out why this is and submit a patch to the SDL_mixer maintainer than it would to write a mixer from scratch.  We'll see........

Anyone know Ryan Gordon?



Does the glitch occur if there is no looping? Sounds like a dirty buffer is being used somewhere in the ogg code. I remember having the same problem with another audio library (can't remember which), turns out I just needed to zero the buffer before copying audio data to it.
Logged

I am eclectocrat.
I make Mysterious Castle, a Tactics-Roguelike (TIGSource devlog).
Christian Knudsen
Level 10
*****



View Profile WWW Email
« Reply #10 on: September 14, 2011, 07:50:29 AM »

Thanks for all the kind words about Ascii Sector! Gentleman

I can't remember if I'm still getting that clicking at the looping of music tracks. If I am, I think I worked around it by not setting the track to loop automatically, but instead just checking in my game loop if music is playing -- if not, I just start it again with a new call to Mix_PlayMusic().
Logged

Laserbrain Studios
Currently working on Hostile Takeover (TIGSource DevLog)
Greg
Level 0
***


has a compass, lost my map


View Profile
« Reply #11 on: September 14, 2011, 09:38:08 AM »

I haven't reproduced the glitch on a Mac.  I don't have the same samples with me. (I'm at work, different computer.) Though the loops that I do have here, haven't glitched at all.  I would expect that it's mostly OK. and if there's any real problems, I'll report back.
Logged

A day for firm decisions!!! Or is it?
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic