music not playing(SOLVED!!!!!!)thanks tropper,vitek,Acki,Mon

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.
a_haouchar
Posts: 97
Joined: Sat Oct 14, 2006 10:51 am
Location: Australia,melbourne

music not playing(SOLVED!!!!!!)thanks tropper,vitek,Acki,Mon

Post by a_haouchar »

With the mixed smooth first and third person camera i added music into irrcameraRPG.cpp and i usually have problems but this time it worked! but no music is playing!

code:(omg the code button wont work,sorry!!)

#ifdef USE_AUDIERE
void CDemo::startAudiere()
{
audiereDevice = OpenDevice();
if (!audiereDevice)
return;

stream = OpenSound(audiereDevice.get(), "Intro.mp3", true);
if (!stream)
{
stream = OpenSound(audiereDevice.get(), "C:/Documents and Settings/Haouchars/Desktop/3d/media/Intro.mp3", true);
if (!stream)
return;
}

ballSound = OpenSound(audiereDevice.get(), "ball.wav", false);
if (!ballSound)
{
ballSound = OpenSound(audiereDevice.get(), "../../media/ball.wav", false);
}

impactSound = OpenSound(audiereDevice.get(), "impact.wav", false);
if (!impactSound)
{
impactSound = OpenSound(audiereDevice.get(), "../../media/impact.wav", false);
}

stream->setRepeat(true);
//stream->setVolume(0.5f); // 100% volume
stream->play();
}
#endif

#ifdef USE_SDL_MIXER
void CDemo::startSound()
{
stream = NULL;
ballSound = NULL;
impactSound = NULL;

SDL_Init(SDL_INIT_AUDIO);

if (Mix_OpenAudio(22050, AUDIO_S16, 2, 128))
return;

stream = Mix_LoadMUS("C:/Documents and Settings/Haouchars/Desktop/3d/media/Intro.mp3");
if (stream)
Mix_PlayMusic(stream, -1);

ballSound = Mix_LoadWAV("../../media/ball.wav");
impactSound = Mix_LoadWAV("../../media/impact.wav");
}

void CDemo::playSound(Mix_Chunk *sample)
{
if (sample)
Mix_PlayChannel(-1, sample, 0);
}

void CDemo::pollSound(void)
{
SDL_Event event;

while (SDL_PollEvent(&event))
;
}
#endif

This is from the irrlicht demo,i just copied it and changed 1 line of code to get my music. Whats with the NULL,it looks disabled?[/code]
Last edited by a_haouchar on Thu Dec 28, 2006 12:23 am, edited 2 times in total.
a_haouchar
Posts: 97
Joined: Sat Oct 14, 2006 10:51 am
Location: Australia,melbourne

Post by a_haouchar »

sorry about double post, its just that post needs to be seperate from this post to look neater. anyway i have another problem, im trying to add a skybox in the engine aswell but i keep getting errors.

Code: Select all

	// create sky box

	//driver->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, false);
	scene::ISceneNode* skyboxNode;
	skyboxNode = sm->addSkyBoxSceneNode(
		driver->getTexture("../../media/irrlicht2_up.jpg"),
		driver->getTexture("../../media/irrlicht2_dn.jpg"),
		driver->getTexture("../../media/irrlicht2_lf.jpg"),
		driver->getTexture("../../media/irrlicht2_rt.jpg"),
		driver->getTexture("../../media/irrlicht2_ft.jpg"),
		driver->getTexture("../../media/irrlicht2_bk.jpg"));

	// load music
arrg the code button works now.
trooper
Posts: 85
Joined: Fri Nov 03, 2006 7:34 pm
Location: Maryland, USA
Contact:

Post by trooper »

hi :wink:

What errors are you getting with the SkyBox ??
You scratch my back, I'll scratch yours.
a_haouchar
Posts: 97
Joined: Sat Oct 14, 2006 10:51 am
Location: Australia,melbourne

Post by a_haouchar »

here

Code: Select all

c:\documents and settings\haouchars\desktop\3d\irrcamerarpg\irrcamerarpg\irrcamerarpg.cpp(73) : error C2065: 'sm' : undeclared identifier
c:\documents and settings\haouchars\desktop\3d\irrcamerarpg\irrcamerarpg\irrcamerarpg.cpp(73) : error C2227: left of '->addSkyBoxSceneNode' must point to class/struct/union/generic type
        type is ''unknown-type''
so anybody can help with audio? tropper can you please send me a audio code so i can put it into the engine:)
trooper
Posts: 85
Joined: Fri Nov 03, 2006 7:34 pm
Location: Maryland, USA
Contact:

Post by trooper »

Hey good fella,
a_haouchar wrote: c:\documents and settings\haouchars\desktop\3d\irrcamerarpg\irrcamerarpg\irrcamerarpg.cpp(73) : error C2065: 'sm' : undeclared identifier
I would guess that "sm" should be "smgr" - assuming thats what your Scene Manager is, if you have kept the standard from through out the tutorials.

Code: Select all

scene::ISceneNode* skyboxNode; 
   skyboxNode = smgr->addSkyBoxSceneNode( 
      driver->getTexture("../../media/irrlicht2_up.jpg"), 
      driver->getTexture("../../media/irrlicht2_dn.jpg"), 
      driver->getTexture("../../media/irrlicht2_lf.jpg"), 
      driver->getTexture("../../media/irrlicht2_rt.jpg"), 
      driver->getTexture("../../media/irrlicht2_ft.jpg"), 
      driver->getTexture("../../media/irrlicht2_bk.jpg")); 
Happy Holiday :wink:
You scratch my back, I'll scratch yours.
a_haouchar
Posts: 97
Joined: Sat Oct 14, 2006 10:51 am
Location: Australia,melbourne

Post by a_haouchar »

edit: thanks trooper ALOT:)

still got audio problems,its just not playing:( the code is their and working but i think i need to trigger the audio becuase i borrowed the codes from the irrlicht demo v1.1.

just need a audio code that is simple:)
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

Do you define USE_AUDIERE somewhere?
a_haouchar
Posts: 97
Joined: Sat Oct 14, 2006 10:51 am
Location: Australia,melbourne

Post by a_haouchar »

yes

Code: Select all

#ifdef USE_AUDIERE
void CDemo::startAudiere() 
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

That checks to see if USE_AUDIERE is defined, but it does not define it. You might try #define USE_AUDIERE on the line before that.
a_haouchar
Posts: 97
Joined: Sat Oct 14, 2006 10:51 am
Location: Australia,melbourne

Post by a_haouchar »

wooow gave me a bunch of errors!

is their a basic audio code that it just play!

just like adding a skybox! that was easy
trooper
Posts: 85
Joined: Fri Nov 03, 2006 7:34 pm
Location: Maryland, USA
Contact:

Post by trooper »

Hey a_haouchar,

This is pretty much all you need to play audio with Audiere.

Code: Select all

#include "audiere.h" 

using namespace audiere; 

//in main 

//initialize audio 

   AudioDevicePtr audiereDevice; 
    OutputStreamPtr stream; 

    audiereDevice = OpenDevice(); 
    if (!audiereDevice) 
     return 1; 

    stream = OpenSound(audiereDevice.get(), "YOURSOUNDFILE.wav", true); 
      
    if (!stream) 
     return 2; 

    stream->setRepeat(true); 
    stream->setVolume(0.15f); // 15% volume 
    stream->play(); 
You just have to link to the lib and include, and place the audiere.dll in with your exe file.

Hope it helps :wink:
You scratch my back, I'll scratch yours.
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

You probably got those compile errors because you don't have audiere headers/libs installed or you don't have your compiler set to access them.
a_haouchar
Posts: 97
Joined: Sat Oct 14, 2006 10:51 am
Location: Australia,melbourne

Post by a_haouchar »

i do not have the audeire files:( i checked in irrlicht.1.1 include files and not their.

were can i find them?
monkeycracks
Posts: 1029
Joined: Thu Apr 06, 2006 12:45 am
Location: Tennesee, USA
Contact:

Post by monkeycracks »

Audiere isn't part of Irrlicht, you'll just have to google it, find their site, and download the stuff.
a_haouchar
Posts: 97
Joined: Sat Oct 14, 2006 10:51 am
Location: Australia,melbourne

Post by a_haouchar »

thanks for the quick response:)
Post Reply