Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


A good sound library with C?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
8 replies to this topic

#1 Tolito   Members   -  Reputation: 256

Like
0Likes
Like

Posted 27 June 2012 - 09:14 PM

I need a good sound library that I can use with a commercial game and is cross-platform. I need it to be as simple as the following code.
sound testsound;
testsound=MP3_LOAD("sound.mp3");
while(1) {
    // Input and stuff.
    if(SOUND_PLAYING(testsound)==0) PLAY_SOUND(testsound);
}
I cannot work with SDL Mixer because it limits me to only so many channels, accepts only WAV files for sound effects, and even though the sound for a buzz that I want to constantly loop has no place in it without audio, it sometimes skips when looping (but sometimes does not; it repeats properly for a few repetitions and then there is a delay and then it repeats well again and it repeats).

Should I use OpenAL audio? Can I use it in a commercial game without having to pay the creators or anything? Does it limit me to only a fixed number of channels so I cannot make a (non-music) sound effect repeat if I so please? Can I use MP3 or another non-WAV format for sounds? Is it cross-platform? Will looping be smooth?

Thank you for your time.

Sponsor:

#2 Ashaman73   Crossbones+   -  Reputation: 8001

Like
2Likes
Like

Posted 27 June 2012 - 11:16 PM

Should I use OpenAL audio?

It is cross plattform, but I have not the best experiences with it. Have you looked at FMOD.

Can I use MP3 or another non-WAV format for sounds?

The file format is often not part of a sound API (like a image file format jpeg,png etc. is not part of a render API like OpenGL/DirectX). As alternative to mp3 you should take a look at ogg-vorbis.

Will looping be smooth?

Most APIs will enable you to do smooth looping, but often not out of the box (you need to implement some kind of streaming and manage the sound buffers yourself).

#3 Serapth   Crossbones+   -  Reputation: 5792

Like
4Likes
Like

Posted 28 June 2012 - 06:58 AM

Yeah, mp3 support is going to kill you, as to ship an MP3 library, they need to license the codec.

So, commercial products like FMOD obviously can get away with it, but for free packages ( that care about being legal ), it's a giant deal breaker. As ashaman said, look in to Ogg. If you need to convert, there is always audacity.

#4 Tolito   Members   -  Reputation: 256

Like
0Likes
Like

Posted 28 June 2012 - 08:27 AM

Thanks for the suggestions! I will definitely use the OGG format. You have both mentioned FMOD as if it is an audio library similar to SDL Mixer that I can just include by doing #include . Is it this? Is it free for commercial use?

#5 LongPointer   Members   -  Reputation: 128

Like
2Likes
Like

Posted 28 June 2012 - 02:12 PM

Is it free for commercial use?


FMOD is not free for commercial use, but it's not massively expensive.

OpenAL would be a decent choice, but I feel it's a bit more low level than FMOD. I see OpenAL as the audio equivalent of OpenGL while FMOD would be the equivalent of something like OGRE or Torque.

#6 Tolito   Members   -  Reputation: 256

Like
0Likes
Like

Posted 28 June 2012 - 04:40 PM

Do you know if OpenAL is free for commercial use? Does it limit me to a certain number of channels that I must poll to see if a sound is playing or can I just do something like in my example code in the first post? Is it cross-platform? Does it support OGG?

Thank you all so much for your time.

#7 Ashaman73   Crossbones+   -  Reputation: 8001

Like
1Likes
Like

Posted 28 June 2012 - 11:29 PM

I see OpenAL as the audio equivalent of OpenGL

There's one major difference: OpenGL is a widely supported lib, whereas OpenAL is an attempt of more or less creative to keep there line of sound cards alive. The result is bad driver support.

Sound APIs aren't that complex, start with XAudio2 (windows only), it is at least free and once you really need to support other plattforms, take a look at FMOD.

#8 Tolito   Members   -  Reputation: 256

Like
0Likes
Like

Posted 29 June 2012 - 01:55 PM

I am using Linux, so I cannot start with XAudio2, but I found a way to do what I wanted to do. Thanks for your help and advice, everyone!

#9 rakifsul   Members   -  Reputation: 100

Like
0Likes
Like

Posted 10 November 2012 - 06:33 PM

Try also MMAV (see http://chucklesoft.blogspot.com).




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS