Jump to content
  • Advertisement
Sign in to follow this  
bballmitch

Add sound

This topic is 4452 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

Could someone point me to the absolute SIMPLIST way to add some sound to my OpenGL game? Right now, my game is just simple OpenGL. All I want is to be able to play some background music. VERY simple. Can someone point me to that?

Share this post


Link to post
Share on other sites
Advertisement
Hey bballmitch,

take a look at my Engine (3caste.chaubold.de),
there I used the BassAudioLibrary because it's so easy to use.
Look for the "cbass.h" in the /framework/ folder...

Or you download the library and add those functions to your source:


HSTREAM soundStream;

void initSound(){
BASS_Init(-1,44100,0,GetForegroundWindow());
}

void playSound(char *file,int vol=75){
log_txt("Bass Sound loading and playing: %s",file);
soundStream=BASS_StreamCreateFile(FALSE,file,0,0,0);
BASS_Start();
BASS_StreamPlay(soundStream,FALSE,BASS_SAMPLE_LOOP);
BASS_ChannelSetAttributes(soundStream,-1,vol,-101);
}

Where "file" is an wav or mp3 song, it'll be played as background music until you call:
BASS_Stop();

Share this post


Link to post
Share on other sites
Quote:
Original post by Caste
Hey bballmitch,

take a look at my Engine (3caste.chaubold.de),
there I used the BassAudioLibrary because it's so easy to use.
Look for the "cbass.h" in the /framework/ folder...

Or you download the library and add those functions to your source:


HSTREAM soundStream;

void initSound(){
BASS_Init(-1,44100,0,GetForegroundWindow());
}

void playSound(char *file,int vol=75){
log_txt("Bass Sound loading and playing: %s",file);
soundStream=BASS_StreamCreateFile(FALSE,file,0,0,0);
BASS_Start();
BASS_StreamPlay(soundStream,FALSE,BASS_SAMPLE_LOOP);
BASS_ChannelSetAttributes(soundStream,-1,vol,-101);
}

Where "file" is an wav or mp3 song, it'll be played as background music until you call:
BASS_Stop();




Looks great, but that link doesn't work. It says that I don't have access to it. Maybe you could email me cbass.h ?

Share this post


Link to post
Share on other sites
Sure I can e-Mail it to you, I only need your E-Mail address...

But what link didn't work? Did you mean the first two demos in my download section? Sorry for that, just fixed it..

Share this post


Link to post
Share on other sites
PlaySound is probably the easiest way to implement the use of sounds in your OpenGL Windows application, but if you want something a bit nicer to use, you should look towards something like FMOD.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!