Sound how to?

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
sader
Posts: 28
Joined: Sat Sep 29, 2007 1:38 pm

Sound how to?

Post by sader »

Hi, I am working with irrlicht just few days I and now I have a problem :)
- can't find out how to laod sound into scene.
No tutorial, no example, no result on forum search, no ISoundSceneNode wtf? :) Maybe I am just blind :oops:

I know with IRRLichtEdit ther's no problem to add sound but for few reasons I don't use this editor so I have to add everything via code
Perceval
Posts: 158
Joined: Tue May 30, 2006 2:42 pm

Post by Perceval »

Irrlicht is just a graphic engine, so you can't play sounds with it : you'll have to use another library, like irrklang, audiere, openAL, ...
sader
Posts: 28
Joined: Sat Sep 29, 2007 1:38 pm

Post by sader »

oki I got it :) tnx
dejai
Posts: 522
Joined: Sat Apr 21, 2007 9:00 am

Post by dejai »

http://www.ambiera.com/irrklang/
Download this read the tutorial on importing it into your compiler

Then

Code: Select all

#include <iostream>
#include <irrKlang.h>
using namespace irr;
using namespace audio;

int main(int argc, const char** argv)
{
  // start the sound engine with default parameters
  ISoundEngine* engine = createIrrKlangDevice();

  if (!engine)
    return 0; // error starting up the engine
 
  // play some sound stream, looped
  engine->play2D("somefile.mp3", true);

  char i = 0;
  std::cin >> i; // wait for user to press some key

  engine->drop(); // delete engine
  return 0;
}
irrklang is the sound library and is a brother of irrlicht well sort of :D Used in the xbox 360 for sound.
Programming Blog: http://www.uberwolf.com
Post Reply