playing audio files in c++

hi ,
i am making a very basic game , using opengl library in c++. i need to play some audio files for my charachters in the game .The audio files need to played quickly enough so that the voice seems to come in responce to the actions in the game . How to do that???
(I am a begginer so please reply in detail )
Thanks in advance for help .
You probably should be using a game lib like SFML.

With it, it's as simple as this:

1
2
3
4
5
6
7
8
// to load
sf::SoundBuffer snd_buffer;
snd_buffer.LoadFromFile( "mysound.ogg" );

sf::Sound snd(snd_buffer);

// to play
snd.Play();


http://www.sfml-dev.org
Topic archived. No new replies allowed.