Starting up the Engine
irrKlang is designed so that it is very easy to achieve everything, its interface should be very simple to use. The Quick Start Example shows how to play and mp3 file, and there is another example, Quick Start Example 2, showing some few more details.
To start up the sound engine, you simply need to call createIrrKlangDevice(). To shut it down, call IRefCounted::drop():
#include <irrKlang.h>
// ...
// start up the engine
irrklang::ISoundEngine* engine = irrklang::createIrrKlangDevice();
// ...
// after finished,
// close the engine again, similar as calling 'delete'
engine->drop();
The createIrrKlangDevice() function also accepts several parameters, so that you can specify which sound driver should be used, if plugins should be used, if irrKlang should run in multithreaded mode, and similar.
Playing Sounds
Once you have irrKlang running (like in Starting up the Engine), you can start playing sounds:
engine->play2D("someSoundFile.wav");
This works with all supported file types. You can replace "someSoundFile.wav" with "someSoundFile.mp3", or "someSoundFile.ogg", for example.
To play a sound looped, set the second parameter to 'true':
engine->play2D("myMusic.mp3", true);
To stop this looping sound again, use engine->stopAllSounds() to stop all sounds, or irrklang::ISound::stop() if you only want to stop that single sound. Influencing Sounds during Playback shows how to get to that ISound interface.