Advertisement

what is fastest easiest sound technology to use with a OpenGL and C++ game

Started by October 12, 2003 05:58 PM
8 comments, last by pearse 21 years, 1 month ago
hi a newby here wondering if if i could ask your advice . i have a short time frame for the development of my game i need to find the easiest to learn and implement sound technology to use with a game developed using OpenGL and C++. p.s im not being lazy just dont have any experience in this field thanks a million Pearse
Use FMOD (www.fmod.org)

It''s as easy as it gets, and it''s just a great library overall- fast, cross-platform, support for many different formats...
Advertisement
depends, is this a non-profit project? The FMOD is good.
If you''re looking to do anything on a commercial level, you''d need to liscense FMOD, which can be pricy. A popular alternative is VORBIS OGG format. Its open source and free to use, even commercially
quote: Original post by D2
depends, is this a non-profit project? The FMOD is good.
If you''re looking to do anything on a commercial level, you''d need to liscense FMOD, which can be pricy. A popular alternative is VORBIS OGG format. Its open source and free to use, even commercially


Uhmn... Ogg Vorbis (*ahem*), is a format, not a sound libary. MP3 (another format) is probably what you are thinking of (don''t use MP3, it''s licencing stuff is rediculious, and expensive).

FMOD is easy and good, but unless it is a free project, it will cost you.

I''d suggest using SDL and SDL_mixer (just google for them). SDL_mixer supports Ogg Vorbis, as well as other formats (wave, MOD, etc).

Just to get you going, here is some code:

these are the include files you need:

#include "sdl.h"#include "sdl_mixer.h" 


To startup SDL_mixer:

// Load SDL for Audio (loads the sdl.dll)if ( SDL_Init(SDL_INIT_AUDIO) < 0 ){	SDL_Quit();	return;}// Setup audio deviceint audio_rate = 44100;Uint16 audio_format = AUDIO_S16; /* 16-bit stereo */int audio_channels = 2;int audio_buffers = 4096;    if(Mix_OpenAudio(audio_rate, audio_format, audio_channels, audio_buffers)){	SDL_Quit();	Mix_CloseAudio();	return;} 


And to shut it down:

Mix_CloseAudio();SDL_Quit(); 




Here are all the functions you need to know for music
// you need this variable for the music fileMix_Music* music;// load the music filemusic = Mix_LoadMUS("filename.ogg");// play music file on music channel (-1 is loop until stop)Mix_PlayMusic(music, -1);// fade out the music channelMix_FadeOutMusic(ms);// stop the music channelMix_HaltMusic();// free the music fileMix_FreeMusic(music);


Here are all the functions you need to know for sound:
// you need this variable for the sound fileMix_Chunk* sound;// load the sound like so:sound = Mix_LoadWAV("filename.wav");// Play the sound once on an available channel (0 is play once, -1 is "next available channel" - can be replaced with a channel number)Mix_PlayChannel(-1, sound, 0);// unload the fileMix_FreeChunk(sound);



There are a few other functions and such (for instance, there is a function to stop sound, but I don''t use it (all that was copied from my code), but that should get you going . Enjoy.



Free Game: Yet Another Falling Block Game
LOL my bad Andrew.. I read the original post too fast =)
FMOD is the way to go
Advertisement
FMOD is *only* $100 for a hobbyist commercial license. If you want to make money but are a hobbyist this is a great licensing scheme. FMOD supports tons of formats (including .MP3 and .OGG and various module formats: IT,XM,S3M,MOD and XM with OGG samples) If you''re a big-time game developer, you will pay $2000-$4000 for it (depending on the platform). But the real advantage of FMOD is that you can use it free all the way until you want to release the ''commercial product'' and then only pay for it. In this way, FMOD is risk free until you''re ready to release your program, cool huh? You can get all this information on the FMOD website that RajanSky mentioned.

Avoid .MP3, although you only need a license to use .MP3 if you''re planning on distributing more than 50000 copies of your program (According to the Fraunhofer license that is(
OGG is a free alternative, although will lose quite a bit of fidelity with various types of sounds (according to the .OGG authors own comments), but now I digress... :D
do unto others... and then run like hell.
Unless something has changed, ogg files tend to have better quality with similar file sizes, or the same quality at smaller file sizes. At least that''s what I remember reading.

karg
I have used fmod but I prefer gAudio.
What about OpenAL?
Sometimes movement is a result of a kick in the ass!

This topic is closed to new replies.

Advertisement