Help with Implementing OgreOgg

CrimsonGT

12-11-2009 15:21:52

I finally am getting around to adding audio to my project, and decided to go with OgreOgg. Ran into a couple of problems though and hoping you guys can help...

1) First ones kind of silly, but frustrates me. I have all of my Plugins load in from .\dlls but when I place the OgreOgg plugin in there, it fails. I have to put it in the main directory which I dont understand why since its loaded from the Plugins.cfg


# Define plugin folder
PluginFolder=.\dlls

# Define plugins
Plugin=RenderSystem_Direct3D9
Plugin=RenderSystem_GL
#Plugin=Plugin_PCZSceneManager
Plugin=OgreOggSound


2) Will add this in a sec, going to try something

stickymango

12-11-2009 17:20:54

I'll investigate, otherwise just load the plugin within your app:
Root::loadPlugin("OgreOggSound[_d]");
Thats how I use it.

[Edit] Confirmed this issue, not sure how to sort it but have requested some help at present, shall keep you informed... [/Edit]

CrimsonGT

12-11-2009 19:59:33

Sounds great, I appreciate it. I am having a bit of trouble getting OgreOgg to work anyways, but I found another sample app that uses it, so im going over everything with a fine tooth comb to figure it out.

Also, the PCZSceneManager plugin does the same thing (doesnt load from the plugin folder) so its not just OgreOgg. I am extremely curious why this is, as I am an OCD freak and demand everything being organized in folders :P

Btw, I wanted to thank you for writing this. I have a lot of learning/work to do, but its nice to know theres an addon I can count on for sound.

stickymango

12-11-2009 20:49:16

No problem, glad you are trying it out, what issues are you having?

What platform are you working on?

CrimsonGT

13-11-2009 17:30:35

As of right now, I keep getting

fatal error LNK1104: cannot open file 'libboost_thread-vc90-mt-1_40.lib'

I know I can set it to 0 to make it not use boost, but doesnt seem like a good idea.

Im using MSVC9

stickymango

13-11-2009 17:32:55

Have you created BOOST_ROOT envrionment variable and pointed it to the correct directory?

CrimsonGT

13-11-2009 17:54:54

Yeah, I have $BOOST_ROOT pointed to c:\dev\BoostLib

My project includes...


"$(ProjectDir)Headers";
"$(SolutionDir)\Common\Headers";
"$(SolutionDir)\Dependencies\RakNet-3.611\Source";
"$(SolutionDir)\Dependencies\freetype\include";
"$(OGRE_HOME)\OgreMain\include";
"$(OGRE_HOME)\Samples\Common\include";
"$(OGRE_HOME)\Dependencies\include";
"$(OGRE_HOME)\PlugIns\PCZSceneManager\include";
"$(OGREOGG_SOUND)\include";
"$(OGRE_NEWT)\inc";
"$(NEWTON_SDK)\sdk";
"$(OPENAL_SDK)\include";
"$(BOOST_ROOT)"


Additional dependencies


OgreMain.lib OgreNewt.lib OgreOggSound.lib Plugin_PCZSceneManager.lib OIS.lib RakNetLibStatic.lib ws2_32.lib freetype235.lib


And Additional Library Directories


"$(OGRE_HOME)\lib";
"$(OGRE_HOME)\lib\opt";
"$(OGRE_HOME)\Dependencies\lib\$(ConfigurationName)";
"$(OGRE_NEWT)\lib";
"$(OGREOGG_SOUND)\Release";
"$(OPENAL_SDK)\lib";
"$(BOOST_ROOT)\lib";
"$(SolutionDir)\Dependencies\RakNet-3.611\lib";
"$(SolutionDir)\Dependencies\freetype\lib\Release"


*Edit*

Just to add on to this, what does the threading actually do? Im assuming since its enabled by default its recommended to use it, just wanted to understand what it is anyways.

stickymango

13-11-2009 21:02:02

Does the lib exist at the specified location, I don't use 1.40, I use 1.38 and my var points to D:\Boost_1_38.

The multithreading option eliminates a lot of blocking aspects of the lib for example when creating/loading sounds from memory, however the main purpose for it was to address the stalling issues for streamed sounds when the main application isn't capable of updating the buffers with fresh audio data periodically. You are free to turn this option off and may never require its usefulness, there isn't any other downside to not using the BOOST version.

CrimsonGT

14-11-2009 10:39:30

I thought the multithreaded stuff was my only issue (I just disabled it and it compiled) but ive been banging my face on it for the past 8 hours now. I was getting a crash in my app, couldnt figure out why so I compiled it for debug mode, and it wont even start. After recompiling every single dll/lib (took ages) with OgreOgg being the last one, I finally figured out it was OgreOgg causing the issue. So after recompiling OgreOgg the release version no longer crashes out when you exit, and I can actually start the debug version of the application. My question now, is since your project includes an older OpenAL lib than the one I have (im assuming mines newer since I just installed the SDK yesterday) I need to know if I should compile with the EFX-Util.lib from the EFX-Util_MT folder or the EFX-Util_MTDLL folder. I have no idea what the difference is between the two, and I used the one from MT.

Also, im just wondering how I should go about setting this up. I need to obviously attach the Manager to a SceneNode, and I was trying to do something like this, but I think its the result of my being overly tired (spent 8 hours trying to fix my app so Debug mode would run).

Code from GameSoundManager.cpp

void GameSoundManager::AttachSoundManagerToScene(Ogre::SceneManager *scene)
{
SceneNode *node = scene->getRootSceneNode()->createChildSceneNode("GameSoundManagerNode");
node->attachObject(mSoundManager->getListener());
}


Code from CreateScene() in WorldState.cpp

// SCENE MUSIC
gSoundManager->AttachSoundManagerToScene(gSceneManager);
soundsList = new GameSoundsListManager();
soundsList->createAndAddSound("background_music", "music.ogg", true, false);

SceneNode *temp = gSceneManager->getRootSceneNode()->createChildSceneNode("TempNode");

// Attach sound to the scene node
temp->attachObject(soundsList->getSound("background_music"));


I made that since when I create my GameSoundManager, I dont have a camera yet to attach it to. So I made that function, and I call it as you can see there. Im sure im just doing something stupid, but figured I would post here.

*Edit*

Now that I look at it, its probably the fact that im creating a local SceneNode pointer to attach it to inside of that function. Should I create one inside of my WorldState header, and do something like SceneNode *AttachSoundManagerToScene(gSceneManager) and just return it? Meh, I need sleep.

stickymango

14-11-2009 16:01:09

I'm not sure what your asking here?

I've just noticed that you were using VC9 to compile your app but the libs that ship with the download/SVN are compiled against VC8, so would have needed to recompile them to get them working. The BOOST issue is clearly a path problem but disabling that support should alleviate those probs.

As far as I'm aware there haven't been any updates to the OpenAL SDK since 1.1, have you downloaded OpenAL-soft? I don't see the mentioned lib folders you have as I have only the one EFX-Util.lib file in the /libs folder..

As for usage, you should attach the listener to your camera's parent scenenode, then you can create and attach scenenodes for spatialised sounds in your scene.

HTH

stickymango

15-11-2009 11:59:54

Got round to looking into this today, it seems BOOST 1.40 is source release so you'll need to build it first which should cure the missing lib error!

I did the following:

* Run bootstrap.bat
* Run bjam.exe
* Create 'lib' folder in boost_1_40_0
* Copied thread/data_time libs into 'lib' folder
* Build OgreOggSound.

Hope that helps get the multithreaded version working for you.

Alternatively, rollback to BOOST 1.38 prebuilt SDK ;)

CrimsonGT

15-11-2009 13:09:02

Ah awesome, I appreciate you looking into it for me. I can roll back since OgreNewt needs 1.40 but I will give this a try. I got to the step to copy thread/data_time, and im assuming this comes from that installer you linked to in another thread, but I cant get that downloader to work (always says something about failed to download mirror list, disabling content). I do have 4 date_time folders in my boost directory, but I dont have any libs in them to copy. Any thoughts on where I can get them without the installer?

On another note, after just writing a huge reply on my code from earlier that wasnt working, I was going to post a bunch of snippets and see if you could spot why it wasnt working. I would just like to say that code I linked to a couple days ago, I get to the last part of copy pasting it into ampaste to link, and I saw... if(!music) { music-play() } and I feel like a moron.Sound works great now :P Im not going to allow myself to code anymore when I am sleepy to avoid things like this lol.

stickymango

15-11-2009 13:33:57

Great news on getting sound to work! :D

If you follow the previous steps you should be able to stick with 1.40, after bjam.exe has finished the required libs will be inside the bin.v2 folder, the actual lib files are in folders 5/6 folders deep.