New FMOD SoundManager available in Wiki

A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.
User avatar
DrPain
Gnome
Posts: 349
Joined: Tue Jul 05, 2005 2:51 pm
Location: Connecticut, USA

Post by DrPain »

That's an odd error. It looks like soundInstanceVector is not created properly, and it gets created in SoundManager's constructor.
Are you sure you're creating a new instance of soundMgr before using it?

For instance:

bad:

Code: Select all

SoundManager *soundMgr;

soundMgr->Initialize();
soundMgr->CreateSound(...);
good:

Code: Select all

SoundManager *soundMgr;

soundMgr = new SoundManager;
soundMgr->Initialize();
soundMgr->CreateSound(...);
User avatar
Katzenjoghurt
Halfling
Posts: 52
Joined: Sat Jan 22, 2005 8:44 pm

Post by Katzenjoghurt »

arghhh.

[ ] good
[x] bad

Indeed I created one while testing .... but in the baaad way. :wink:

After this didn't work, I didn't create any soundMgr ... just like in the Wiki.

Adding this to the Wiki would make it more complete. :D

Anyway... Thanks!! No crash any more ... just ... I hear no sound yet... hmm.. *trying to setup the listener*

----

Sorry... either I'm deaf or dumb. I just hear no sound... :?:

As the SoundManager::FrameStarted() function needs a scene node instead of a camera, I attached mCamera to a new scene node named "cameraNode", when creating it.

I hope that's okay so.


Code: Select all

//OgreSimpleSurround.h

(...)
protected:

    bool frameStarted( const FrameEvent& evt);
	SoundManager *mySoundMgr; 
	Ogre::SceneNode *cameraNode;



	virtual void createCamera(void)
	{
	  cameraNode = mSceneMgr->getRootSceneNode()->createChildSceneNode("cameraNode");
      // Create the camera
      mCamera = mSceneMgr->createCamera("PlayerCam");


      mCamera->setPosition(Vector3(0,0,80));
      mCamera->lookAt(Vector3(0,0,-300));
      mCamera->setNearClipDistance(5);

	  
	  cameraNode->attachObject(mCamera);
	  
	}

private:    

	virtual void createScene(void)
	{
                (...)

	// Sound


	  SceneNode* Soundbox_node;	  
	  Entity* Soundbox = mSceneMgr->createEntity("Schrats_Soundbox", "Barrel.mesh");
	  Soundbox->setMaterialName("Examples/Chrome");
	  
	  
      Soundbox_node = mSceneMgr->getRootSceneNode()->createChildSceneNode();
      Soundbox_node->attachObject(Soundbox);
	  Soundbox_node->setPosition(0, 100, 330);

	  mCamera->setPosition(Vector3(0,100,360));
	  
	  

	  mySoundMgr = new SoundManager; 
	  mySoundMgr->Initialize(); 

	  int nightLoop;
	  nightLoop = mySoundMgr->CreateSound(String("loop1mono.wav"));
	   
	  int channelNightLoop;
	  mySoundMgr->PlaySound(nightLoop, Soundbox_node, &channelNightLoop);

Code: Select all

//OgreSimpleSurround.cpp

bool Ogre_simpleSurroundApp::frameStarted( const FrameEvent& evt)
{
    Ogre::Real dt = evt.timeSinceLastFrame;

    if(ExampleApplication::mWindow->isClosed())
    {
        return false;
    }

	mySoundMgr->FrameStarted(cameraNode, evt.timeSinceLastFrame);
	
    return true;
}
... what mistake did I make now? :?
Last edited by Katzenjoghurt on Fri Apr 14, 2006 9:44 pm, edited 4 times in total.
Better to reign in hell than serve in heaven
User avatar
DrPain
Gnome
Posts: 349
Joined: Tue Jul 05, 2005 2:51 pm
Location: Connecticut, USA

Post by DrPain »

Well, that's not a bad idea, creating a sample app.

Working on one now. It may be a day or two before it's ready; got a lot going on this weekend.
User avatar
DrPain
Gnome
Posts: 349
Joined: Tue Jul 05, 2005 2:51 pm
Location: Connecticut, USA

Post by DrPain »

Well, the first thing that comes to mind is that your camera is 30 units away from your object's node, and that may be far enough that the sound is inaudible.

Try putting the camera and the object's node in the same location exactly.
User avatar
Katzenjoghurt
Halfling
Posts: 52
Joined: Sat Jan 22, 2005 8:44 pm

Post by Katzenjoghurt »

Hm... :-/ Using your FrameStarted function I should hear something when moving manually to it ...

Anyway... I set the camera one point in front of the SoundBoxes center... no sound.

Was it right attaching mCamera to this scene node?
Do I need to set the path of the wav anywhere? (Didn't find anything to set this up though... therefore I copied it in the exe folder)
Better to reign in hell than serve in heaven
User avatar
DrPain
Gnome
Posts: 349
Joined: Tue Jul 05, 2005 2:51 pm
Location: Connecticut, USA

Post by DrPain »

1. You created a single-shot sound using CreateSound. If it ended before you manually approached the sound source, you would not hear it.
2. You gave the camera an offset within the SceneNode that contains it. So even if it looked like you were next to the sound source, the camera's SceneNode was still far away from it, so you would not hear the sound.
3. I don't know how you move your camera, but you should be moving the camera's sceneNode, not the camera itself.

So, to fix this, try using CreateLoopedSound to make a looping sound (repeats itself over and over).
And set the camera's location to (0,0,0) and move cameraNode rather than the camera itself (the camera will move with the node).

Hope that helps.
User avatar
Katzenjoghurt
Halfling
Posts: 52
Joined: Sat Jan 22, 2005 8:44 pm

Post by Katzenjoghurt »

Hi! First ... thx for your help!

1. the wav is pretty long - but as you recommended I switched to CreateLoopedSound()

2./3. To make absolutely sure, I set the positions of mCamera, it's scene node and the sound source to (0,0,0).

Still no beep, no meep ... no nothing :?

Code: Select all

	  SceneNode* Soundbox_node;	  
	  Entity* Soundbox = mSceneMgr->createEntity("Schrats_Soundbox", "Barrel.mesh");
	  Soundbox->setMaterialName("Examples/Chrome");
	  
	  
      Soundbox_node = mSceneMgr->getRootSceneNode()->createChildSceneNode();
      Soundbox_node->attachObject(Soundbox);
	  Soundbox_node->setPosition(0, 0, 0);

	  mCamera->setPosition(Vector3(0,0,0));
	  
	  

	  mySoundMgr = new SoundManager; 
	  mySoundMgr->Initialize(); 

	  int nightLoop;	  
	  nightLoop = mySoundMgr->CreateLoopedSound(String("loop1mono.wav"));
	  
	   
	  int channelNightLoop;
	  mySoundMgr->PlaySound(nightLoop, Soundbox_node, &channelNightLoop);



Code: Select all

bool Ogre_simpleSurroundApp::frameStarted( const FrameEvent& evt)
{
    Ogre::Real dt = evt.timeSinceLastFrame;

    if(ExampleApplication::mWindow->isClosed())
    {
        return false;
    }
	cameraNode->setPosition(0,0,0);
	mySoundMgr->FrameStarted(cameraNode, evt.timeSinceLastFrame);
	
   return true;
}
	
Better to reign in hell than serve in heaven
kucheg
Gnoblar
Posts: 8
Joined: Sun Apr 16, 2006 9:37 am

Having Problems

Post by kucheg »

Hi, I have tried using your SoundManager and it seems easy to use.

I get a problem creating the sound using

int soundId = soundMgr->CreateSound(Ogre::String("sound.wav"));

I get the soundId as 0, and in my Ogre.log I get

SoundManager::CreateSound could not load sound 'sound.wav' FMOD Error:An invalid object handle was used.

I have tried putting the sound.wav file in several places and it still hasn't worked. Currently it's in the resource folder which I register with the Ogre ResourceGroupManager.

I am using FMOD Ex 4.03.06 and
Ogre v1.0.7

Thank you in advance
kucheg
Gnoblar
Posts: 8
Joined: Sun Apr 16, 2006 9:37 am

Problem Solved

Post by kucheg »

Hi, I have figured out my problem, I didn't initialise the SoundManager when I created the object. :oops: :oops:

Now I get the same problem as Katzenjoghurt, I get no sound.

What I am doing is playing a sound when I press a key

if( m_input->isKeyDown( Ogre::KC_O ) )
{
int soundId;
soundId= soundMgr->CreateSound(Ogre::String("sound.wav"));

int channelId;
soundMgr->PlaySound(soundId, m_player->getPlayerNode(), &channelId);
}
When I update the SoundManager, I set the listener to the same position as the sound.

soundMgr->FrameStarted( m_player->getPlayerNode(), evt.timeSinceLastFrame );

I don't get any sound, and no errors in the log. :(

Thanks for the help in advance.
User avatar
Katzenjoghurt
Halfling
Posts: 52
Joined: Sat Jan 22, 2005 8:44 pm

Post by Katzenjoghurt »

kucheg, I love you, guy! :)

Having a look in the log I saw that the wav couldn't be loaded.
(I could have sworn(!!!) I checked that already....)

So, just copying the wav next to the exe won't work out.

After adding a sound path in the resource.cfg it .... works! :D :D
(which btw. solved the problems with an other sound manager as well)

---

Code: Select all

	  SceneNode* Soundbox_node;	  
	  Entity* Soundbox = mSceneMgr->createEntity("Schrats_Soundbox", "Barrel.mesh");
	  Soundbox->setMaterialName("Examples/Chrome");
	  
	  
      Soundbox_node = mSceneMgr->getRootSceneNode()->createChildSceneNode();
      Soundbox_node->attachObject(Soundbox);
	  Soundbox_node->setPosition(0, 0, 0);

	  mCamera->setPosition(Vector3(0,0,0));
	  
	  

	  mySoundMgr = new SoundManager; 
	  mySoundMgr->Initialize(); 

	  int nightLoop;	  
	  nightLoop = mySoundMgr->CreateLoopedSound(String("loop1mono.wav"));
	  
	   
	  int channelNightLoop=1;
	  mySoundMgr->PlaySound(nightLoop, Soundbox_node, &channelNightLoop);
This bit of code added in createScene was enough to make the wav play here... (no calling of frameStarted needed for testing ... maybe the listener is initiated with (0,0,0) as well )

Strangely I had to assign the channelId to 1 ... or the program crashed.


*dancing*

Katzenjoghurt
Better to reign in hell than serve in heaven
kucheg
Gnoblar
Posts: 8
Joined: Sun Apr 16, 2006 9:37 am

Post by kucheg »

Congratulations on your succsess.

Did you have to add another Group to the resources, or actually add the .wav file to it?

Can you please Post the changes to your resource.cfg file :D

I am eager to get some sound into my program!

P.S I am glad I was of some help :D
kucheg
Gnoblar
Posts: 8
Joined: Sun Apr 16, 2006 9:37 am

Post by kucheg »

Nevermind, I used your bit of code as an example, and got sound working :D:D

Thanks for the help mate!
User avatar
Katzenjoghurt
Halfling
Posts: 52
Joined: Sat Jan 22, 2005 8:44 pm

Post by Katzenjoghurt »

*handshake* :D

and one more thx to DrPain for the wrapper :P
Better to reign in hell than serve in heaven
User avatar
DrPain
Gnome
Posts: 349
Joined: Tue Jul 05, 2005 2:51 pm
Location: Connecticut, USA

Post by DrPain »

Glad both of you got it working. :)
User avatar
DrPain
Gnome
Posts: 349
Joined: Tue Jul 05, 2005 2:51 pm
Location: Connecticut, USA

Post by DrPain »

Added a sample application to the Wiki page.

Also added the function Set3DMinMaxDistance() to allow control over the sound min/max distances. Read the FMOD manual for details.

And finally, changed SOUND_TYPE_3D_SOUND to create a 3D sound in hardware (FMOD_3D | FMOD_HARDWARE).
Thanks to Isomorphic for pointing out this error. :)
kucheg
Gnoblar
Posts: 8
Joined: Sun Apr 16, 2006 9:37 am

Post by kucheg »

Hello, The sound manager is going well, just a small problem.

I am using the sound manager to play a 'tick' sound when the mouse rolls over a button, it works well, but after a while (after 13 clicks) the sound stops playing. Can't figure out why it's doing it, I went through with the debugger and a valid channel is being assigned...

Any Ideas?
User avatar
pjcast
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 2543
Joined: Fri Oct 24, 2003 2:53 am
Location: San Diego, Ca
x 2

Post by pjcast »

Are you loading other sounds too? Hardware has limit to the number of samples loaded into channels 16 to 32 typically IIRC, (and Fmod dynamically manages these), perhaps it bumped it out to make room for another sample?
Have a question about Input? Video? WGE? Come on over... http://www.wreckedgames.com/forum/
kucheg
Gnoblar
Posts: 8
Joined: Sun Apr 16, 2006 9:37 am

Post by kucheg »

No, It can't be because of too may samples, because I have only loaded two sounds, each are very short clips...

And now my other code for sound is not working... I think I should go to bed and start fresh tomorrow... :?
kucheg
Gnoblar
Posts: 8
Joined: Sun Apr 16, 2006 9:37 am

Post by kucheg »

Once Again I have fixed the problem 5 mins after posting.

The problem occured because I didn't call FrameStarted in the beginning of the game where the menu is active. All I have to do is call FrameStarted all the time and everything works.... :D
Isomorphic
Gnoblar
Posts: 14
Joined: Wed Mar 15, 2006 4:05 am

Post by Isomorphic »

Glad to see this sound manager is getting attention again. I've discovered a few more things about this, first the bugs, then the tweaks:

Bugs:

For some reason, 3D effects are working strangely for me. It seems that if the sceneNode for the source of a sound is stationary, there is no change in volume as the listenerNode moves around. If however that sourceNode moves just a little the 3D effects work as intended. It looks like the position of the sourceNode needs to changed in order for FMOD to reevaluate the distance between the listener and source.

The StopAllSounds() function seems to put my program into an infinite loop. Instead of stopping all sounds, they continue and my program stops responding. Your code looks fine (it's a pretty simple function) but it just isn't working for me.

Tweaks:

When you define the different types of sounds, you define all Streamed sounds as 2D. From what I have read, streamed just means that you don't load it all into memory in the beginning, you do it as you go. It may be easier to just give the user some options to pick from when they create their sounds instead of creating a function for each one because there are so many options.

Also, I find it cumbersome to work with ints for channel handles instead of string names. I set it up similarly to what Ogre does and make it so when you create a sound you give it a string name. Then whenever you reference that name it just looks up what string refers to what int(channel).

I would like to have a fade in/out option for background music and so far what i have planned is to have a floating sourceNode by the camera (i call it a jukebox) that will drift farther away to fade out, and vice/versa. It would be easier to just make it a 2D sound and adjust the volume on it. Since you know more about FMOD is there any easy way to do this that you know of?


*I should mention a couple things. I haven't used your updated code since my last posting because I modified it myself and didn't feel like remodifying. I read the changes you made and I don't think they would have changed the errors I was getting. Also I don't think my modifications would affect these things, but it's possible i'm wrong.
dr_amr
Halfling
Posts: 65
Joined: Wed Mar 02, 2005 2:22 am

Post by dr_amr »

I have a problem with the linking lib, I'm working on version 4.04.3

here's the result

Code: Select all

------ Build started: Project: MCG, Configuration: Debug Win32 ------
Compiling...
main.cpp
Linking...
main.obj : error LNK2019: unresolved external symbol "public: void __thiscall SoundManager::PlaySoundA(int,class Ogre::SceneNode *,int *)" (?PlaySoundA@SoundManager@@QAEXHPAVSceneNode@Ogre@@PAH@Z) referenced in function _main
SoundManager.obj : error LNK2019: unresolved external symbol _FMOD_System_Create referenced in function "enum FMOD_RESULT __cdecl FMOD::System_Create(class FMOD::System * *)" (?System_Create@FMOD@@YA?AW4FMOD_RESULT@@PAPAVSystem@1@@Z)
SoundManager.obj : error LNK2019: unresolved external symbol "public: enum FMOD_RESULT __thiscall FMOD::Channel::set3DAttributes(struct FMOD_VECTOR const *,struct FMOD_VECTOR const *)" (?set3DAttributes@Channel@FMOD@@QAE?AW4FMOD_RESULT@@PBUFMOD_VECTOR@@0@Z) referenced in function "public: void __thiscall SoundManager::FrameStarted(class Ogre::SceneNode *,float)" (?FrameStarted@SoundManager@@QAEXPAVSceneNode@Ogre@@M@Z)
SoundManager.obj : error LNK2019: unresolved external symbol "public: enum FMOD_RESULT __thiscall FMOD::System::getChannel(int,class FMOD::Channel * *)" (?getChannel@System@FMOD@@QAE?AW4FMOD_RESULT@@HPAPAVChannel@2@@Z) referenced in function "public: void __thiscall SoundManager::FrameStarted(class Ogre::SceneNode *,float)" (?FrameStarted@SoundManager@@QAEXPAVSceneNode@Ogre@@M@Z)
SoundManager.obj : error LNK2019: unresolved external symbol "public: enum FMOD_RESULT __thiscall FMOD::System::update(void)" (?update@System@FMOD@@QAE?AW4FMOD_RESULT@@XZ) referenced in function "public: void __thiscall SoundManager::FrameStarted(class Ogre::SceneNode *,float)" (?FrameStarted@SoundManager@@QAEXPAVSceneNode@Ogre@@M@Z)
SoundManager.obj : error LNK2019: unresolved external symbol "public: enum FMOD_RESULT __thiscall FMOD::System::set3DListenerAttributes(int,struct FMOD_VECTOR const *,struct FMOD_VECTOR const *,struct FMOD_VECTOR const *,struct FMOD_VECTOR const *)" (?set3DListenerAttributes@System@FMOD@@QAE?AW4FMOD_RESULT@@HPBUFMOD_VECTOR@@000@Z) referenced in function "public: void __thiscall SoundManager::FrameStarted(class Ogre::SceneNode *,float)" (?FrameStarted@SoundManager@@QAEXPAVSceneNode@Ogre@@M@Z)
SoundManager.obj : error LNK2019: unresolved external symbol "public: enum FMOD_RESULT __thiscall FMOD::Channel::set3DMinMaxDistance(float,float)" (?set3DMinMaxDistance@Channel@FMOD@@QAE?AW4FMOD_RESULT@@MM@Z) referenced in function "public: void __thiscall SoundManager::Set3DMinMaxDistance(int,float,float)" (?Set3DMinMaxDistance@SoundManager@@QAEXHMM@Z)
SoundManager.obj : error LNK2019: unresolved external symbol "public: enum FMOD_RESULT __thiscall FMOD::Channel::stop(void)" (?stop@Channel@FMOD@@QAE?AW4FMOD_RESULT@@XZ) referenced in function "public: void __thiscall SoundManager::StopAllSounds(void)" (?StopAllSounds@SoundManager@@QAEXXZ)
SoundManager.obj : error LNK2019: unresolved external symbol "public: enum FMOD_RESULT __thiscall FMOD::System::setFileSystem(enum FMOD_RESULT (__cdecl*)(char const *,int,unsigned int *,void * *,void * *),enum FMOD_RESULT (__cdecl*)(void *,void *),enum FMOD_RESULT (__cdecl*)(void *,void *,unsigned int,unsigned int *,void *),enum FMOD_RESULT (__cdecl*)(void *,unsigned int,void *),int)" (?setFileSystem@System@FMOD@@QAE?AW4FMOD_RESULT@@P6A?AW43@PBDHPAIPAPAX2@ZP6A?AW43@PAX4@ZP6A?AW43@44I14@ZP6A?AW43@4I4@ZH@Z) referenced in function "public: void __thiscall SoundManager::Initialize(void)" (?Initialize@SoundManager@@QAEXXZ)
SoundManager.obj : error LNK2019: unresolved external symbol "public: enum FMOD_RESULT __thiscall FMOD::System::set3DSettings(float,float,float)" (?set3DSettings@System@FMOD@@QAE?AW4FMOD_RESULT@@MMM@Z) referenced in function "public: void __thiscall SoundManager::Initialize(void)" (?Initialize@SoundManager@@QAEXXZ)
SoundManager.obj : error LNK2019: unresolved external symbol "public: enum FMOD_RESULT __thiscall FMOD::System::init(int,unsigned int,void *)" (?init@System@FMOD@@QAE?AW4FMOD_RESULT@@HIPAX@Z) referenced in function "public: void __thiscall SoundManager::Initialize(void)" (?Initialize@SoundManager@@QAEXXZ)
SoundManager.obj : error LNK2019: unresolved external symbol "public: enum FMOD_RESULT __thiscall FMOD::System::release(void)" (?release@System@FMOD@@QAE?AW4FMOD_RESULT@@XZ) referenced in function "public: virtual __thiscall SoundManager::~SoundManager(void)" (??1SoundManager@@UAE@XZ)
SoundManager.obj : error LNK2019: unresolved external symbol "public: enum FMOD_RESULT __thiscall FMOD::Channel::setPaused(bool)" (?setPaused@Channel@FMOD@@QAE?AW4FMOD_RESULT@@_N@Z) referenced in function "public: void __thiscall SoundManager::PlaySound(int,class Ogre::SceneNode *,int *)" (?PlaySound@SoundManager@@QAEXHPAVSceneNode@Ogre@@PAH@Z)
SoundManager.obj : error LNK2019: unresolved external symbol "public: enum FMOD_RESULT __thiscall FMOD::Channel::setVolume(float)" (?setVolume@Channel@FMOD@@QAE?AW4FMOD_RESULT@@M@Z) referenced in function "public: void __thiscall SoundManager::PlaySound(int,class Ogre::SceneNode *,int *)" (?PlaySound@SoundManager@@QAEXHPAVSceneNode@Ogre@@PAH@Z)
SoundManager.obj : error LNK2019: unresolved external symbol "public: enum FMOD_RESULT __thiscall FMOD::Channel::getIndex(int *)" (?getIndex@Channel@FMOD@@QAE?AW4FMOD_RESULT@@PAH@Z) referenced in function "public: void __thiscall SoundManager::PlaySound(int,class Ogre::SceneNode *,int *)" (?PlaySound@SoundManager@@QAEXHPAVSceneNode@Ogre@@PAH@Z)
SoundManager.obj : error LNK2019: unresolved external symbol "public: enum FMOD_RESULT __thiscall FMOD::System::playSound(enum FMOD_CHANNELINDEX,class FMOD::Sound *,bool,class FMOD::Channel * *)" (?playSound@System@FMOD@@QAE?AW4FMOD_RESULT@@W4FMOD_CHANNELINDEX@@PAVSound@2@_NPAPAVChannel@2@@Z) referenced in function "public: void __thiscall SoundManager::PlaySound(int,class Ogre::SceneNode *,int *)" (?PlaySound@SoundManager@@QAEXHPAVSceneNode@Ogre@@PAH@Z)
SoundManager.obj : error LNK2019: unresolved external symbol "public: enum FMOD_RESULT __thiscall FMOD::Channel::isPlaying(bool *)" (?isPlaying@Channel@FMOD@@QAE?AW4FMOD_RESULT@@PA_N@Z) referenced in function "public: void __thiscall SoundManager::PlaySound(int,class Ogre::SceneNode *,int *)" (?PlaySound@SoundManager@@QAEXHPAVSceneNode@Ogre@@PAH@Z)
SoundManager.obj : error LNK2019: unresolved external symbol "public: enum FMOD_RESULT __thiscall FMOD::Sound::getLength(unsigned int *,unsigned int)" (?getLength@Sound@FMOD@@QAE?AW4FMOD_RESULT@@PAII@Z) referenced in function "public: float __thiscall SoundManager::GetSoundLength(int)" (?GetSoundLength@SoundManager@@QAEMH@Z)
SoundManager.obj : error LNK2019: unresolved external symbol "public: enum FMOD_RESULT __thiscall FMOD::System::createStream(char const *,unsigned int,struct FMOD_CREATESOUNDEXINFO *,class FMOD::Sound * *)" (?createStream@System@FMOD@@QAE?AW4FMOD_RESULT@@PBDIPAUFMOD_CREATESOUNDEXINFO@@PAPAVSound@2@@Z) referenced in function "public: int __thiscall SoundManager::CreateSound(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &,enum SOUND_TYPE)" (?CreateSound@SoundManager@@QAEHAAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@W4SOUND_TYPE@@@Z)
SoundManager.obj : error LNK2019: unresolved external symbol "public: enum FMOD_RESULT __thiscall FMOD::System::createSound(char const *,unsigned int,struct FMOD_CREATESOUNDEXINFO *,class FMOD::Sound * *)" (?createSound@System@FMOD@@QAE?AW4FMOD_RESULT@@PBDIPAUFMOD_CREATESOUNDEXINFO@@PAPAVSound@2@@Z) referenced in function "public: int __thiscall SoundManager::CreateSound(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &,enum SOUND_TYPE)" (?CreateSound@SoundManager@@QAEHAAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@W4SOUND_TYPE@@@Z)
..\bin\Debug\MCG.exe : fatal error LNK1120: 20 unresolved externals
Build log was saved at "file://f:\playground\MCG\Debug\BuildLog.htm"
MCG - 21 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 1 up-to-date, 0 skipped ==========
and yea, believe it or not, I was linking to the correct fmodex_vc.lib
I love OGRE !
dr_amr
Halfling
Posts: 65
Joined: Wed Mar 02, 2005 2:22 am

Post by dr_amr »

that's a more readabl paste of the above listing

http://rafb.net/paste/results/GywQsS22.html
I love OGRE !
Operator
Gnoblar
Posts: 21
Joined: Sat Aug 19, 2006 6:29 pm

Post by Operator »

I've got the same problems with linking lib, my version of fmod is 4.06.1. Anyone can help? :x

EDIT: OK I've already found the solution:
http://www.ogre3d.org/phpBB2/viewtopic.php?t=20806 - the last post

Arrghh I've got another problem. When I call the soundMgr->FrameStarted function in my frameStarted function in my FrameListener everything is loading up good without any errors in log and I hear also the sound, but just after that my app crashes :cry: . When I remove calling of the soundMgr->FrameStarted function everything's working fine but there's no sound refreshing of course... As the first parameter of the function I give my camera node. Anyone could help?

EDIT: OK I fixed it, I was calling this function in a wrong way... :x
McNugget
Kobold
Posts: 36
Joined: Sat Jun 25, 2005 11:27 am

Post by McNugget »

Hi there,

a little hint: We modyfied the SoundManager so that one is able to compile it without a Microsoft compiler. I changed the Wiki entry for the SoundManager site, so others can download the modyfied code directly.

BUT: some explanation for a little bug we found within the code:
Did you write the code for first-person shooter like games? I meen camera movent with gimble lock? Because the calculation of the orientation between listener and scource seems to be wrong when rotating like an airplane or a spaceship i.e. without GimbleLock. It seems that two axis can overlap so that the calculation goes wrong and the sound gets played somewhere but not where one would expect.

The second problem is that a moving SceneNode which I passed as a pointer to the Soundmanagers PlaySound() function is not moving the sound scource. When the SceneNode changes its position the sound stays at the position where it was initialized.

The third problem maybe a compiler problem: the function PlaySound cannot be found. Compiling fails because the compiler is searching for a function called PlaySoundA() which is not declared (why should it).... but then we searched for the declaration of PlaySoundA() and found:
BOOL WINAPI PlaySoundA(LPCSTR,HMODULE,DWORD); defined within mmsystem.h.

So, we changed the name of PlaySound() to PlaySoundB() :wink: and after that everything works fine... except the OrientationProblem mentioned above...

Any ideas?

Greets,
Timo
Operator
Gnoblar
Posts: 21
Joined: Sat Aug 19, 2006 6:29 pm

Post by Operator »

Yeah, I have encountered the same problem with camera orientation and sound position delay. :? Is it possible to make a 2D sound to play music correctly while moving a camera?