Archived

This topic is now archived and is closed to further replies.

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

This topic is 5166 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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 device
int 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 file

Mix_Music* music;

// load the music file

music = Mix_LoadMUS("filename.ogg");
// play music file on music channel (-1 is loop until stop)

Mix_PlayMusic(music, -1);


// fade out the music channel

Mix_FadeOutMusic(ms);

// stop the music channel

Mix_HaltMusic();
// free the music file

Mix_FreeMusic(music);


Here are all the functions you need to know for sound:

// you need this variable for the sound file

Mix_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 file

Mix_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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites