FSLManager, easy sound implementation in OGRE

A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.
User avatar
yuriythebest
Orc
Posts: 468
Joined: Sun Jul 10, 2005 11:44 am
Location: Kiev, Ukraine
Contact:

Post by yuriythebest »

please provide some advice
asteroidWars - an OGRE game
NOOB MAKE MMORPG- the flash movie
User avatar
jomunoz
Goblin
Posts: 228
Joined: Wed Apr 13, 2005 5:07 pm
Location: Medellin - Colombia

Post by jomunoz »

by "didn't get digested" you mean ....? If it print some error please tell us about it.
User avatar
yuriythebest
Orc
Posts: 468
Joined: Sun Jul 10, 2005 11:44 am
Location: Kiev, Ukraine
Contact:

Post by yuriythebest »

ok- so I've placed the framestarted code in the baseApplications framestarted, and declared
SoundListener *mSoundListener;
FSLSoundManager* soundManager;
in baseApplication.h like so:
class BaseApplication : public Ogre::Singleton<BaseApplication>, public FrameListener, public KeyListener
{
public:
BaseApplication(void);
virtual ~BaseApplication(void);

virtual void go(void);

protected:


virtual bool setup();
virtual bool configure(void);
virtual void chooseSceneManager(void);
virtual void createCamera(void);
virtual void createFrameListener(void);
virtual void createScene(void) = 0; // Override me!
virtual void destroyScene(void);
virtual void createViewports(void);
virtual void setupResources(void);
virtual void createResourceListener(void);
virtual void loadResources(void);
virtual void updateStats(void);
virtual bool processUnbufferedKeyInput(const FrameEvent& evt);
virtual bool processUnbufferedMouseInput(const FrameEvent& evt);
virtual void moveCamera();
virtual bool frameStarted(const FrameEvent& evt);
virtual bool frameEnded(const FrameEvent& evt);

void showDebugOverlay(bool show);
void switchMouseMode();
void switchKeyMode();
void keyClicked(KeyEvent* e);
void keyPressed(KeyEvent* e);
void keyReleased(KeyEvent* e);

Root *mRoot;
Camera* mCamera;
SceneManager* mSceneMgr;
RenderWindow* mWindow;
int mSceneDetailIndex ;
Real mMoveSpeed;
Degree mRotateSpeed;
Overlay* mDebugOverlay;
EventProcessor* mEventProcessor;
InputReader* mInputDevice;
Vector3 mTranslateVector;
bool mStatsOn;
bool mUseBufferedInputKeys, mUseBufferedInputMouse, mInputTypeSwitchingOn;
unsigned int mNumScreenShots;
float mMoveScale;
Degree mRotScale;
Real mTimeUntilNextToggle; // just to stop toggles flipping too fast
Radian mRotX, mRotY;
TextureFilterOptions mFiltering;
int mAniso;

SoundListener *mSoundListener;
FSLSoundManager* soundManager;






};

it gives this error:
1>Compiling...
1>BaseApplication.cpp
1>d:\ogresdk\ogresoundtest3\ogresoundtest3\include\baseapplication.h(44) : error C2143: syntax error : missing ';' before '*'
1>d:\ogresdk\ogresoundtest3\ogresoundtest3\include\baseapplication.h(44) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>d:\ogresdk\ogresoundtest3\ogresoundtest3\include\baseapplication.h(44) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>d:\ogresdk\ogresoundtest3\ogresoundtest3\include\baseapplication.h(45) : error C2143: syntax error : missing ';' before '*'
1>d:\ogresdk\ogresoundtest3\ogresoundtest3\include\baseapplication.h(45) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>d:\ogresdk\ogresoundtest3\ogresoundtest3\include\baseapplication.h(45) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>d:\ogresdk\ogresoundtest3\ogresoundtest3\src\baseapplication.cpp(69) : error C2065: 'mSoundListener' : undeclared identifier
1>d:\ogresdk\ogresoundtest3\ogresoundtest3\src\baseapplication.cpp(69) : error C2061: syntax error : identifier 'SoundListener'
1>d:\ogresdk\ogresoundtest3\ogresoundtest3\src\baseapplication.cpp(71) : error C2653: 'ExampleApplication' : is not a class or namespace name
1>ogreSoundTest3.cpp
1>d:\ogresdk\ogresoundtest3\ogresoundtest3\include\baseapplication.h(44) : error C2143: syntax error : missing ';' before '*'
1>d:\ogresdk\ogresoundtest3\ogresoundtest3\include\baseapplication.h(44) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>d:\ogresdk\ogresoundtest3\ogresoundtest3\include\baseapplication.h(44) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>d:\ogresdk\ogresoundtest3\ogresoundtest3\include\baseapplication.h(45) : error C2143: syntax error : missing ';' before '*'
1>d:\ogresdk\ogresoundtest3\ogresoundtest3\include\baseapplication.h(45) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>d:\ogresdk\ogresoundtest3\ogresoundtest3\include\baseapplication.h(45) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
asteroidWars - an OGRE game
NOOB MAKE MMORPG- the flash movie
User avatar
jomunoz
Goblin
Posts: 228
Joined: Wed Apr 13, 2005 5:07 pm
Location: Medellin - Colombia

Post by jomunoz »

It looks like your not including the header files of FSLManager.
User avatar
yuriythebest
Orc
Posts: 468
Joined: Sun Jul 10, 2005 11:44 am
Location: Kiev, Ukraine
Contact:

Post by yuriythebest »

my bad- I thought that simply adding them to my project was enough.
I've added
#include "FSLAmbientSound.h"
#include "FSLListener.h"
#include "FSLOgreFramework.h"
#include "FSLSoundEntity.h"
#include "FSLSoundManager.h"
#include "FSLSoundObject.h"
to my baseAppliation, how however the error output takes me to
fslogreframework.h and complains that the framelistener base class is undefined. I believe it's talking about
void createFrameListener(void){
mSoundListener = new SoundListener( soundManager ); //Create sound listener
mRoot->addFrameListener(mSoundListener); //Add sound listener so it will update every frame
ExampleApplication::createFrameListener();
}
I've added

mSoundListener = new SoundListener( soundManager ); //Create sound listener
mRoot->addFrameListener(mSoundListener); //Add sound listener so it will update every frame
ExampleApplication::createFrameListener();
to my baseApplications createframelistener but that didn't help, also where do I add
public:
PruebaSL1() : ExampleApplication(){
mSoundListener = 0;
}

~PruebaSL1()
{ if (mSoundListener)
delete mSoundListener;
if (soundManager)
delete soundManager;
}
asteroidWars - an OGRE game
NOOB MAKE MMORPG- the flash movie
User avatar
yuriythebest
Orc
Posts: 468
Joined: Sun Jul 10, 2005 11:44 am
Location: Kiev, Ukraine
Contact:

Post by yuriythebest »

please help
asteroidWars - an OGRE game
NOOB MAKE MMORPG- the flash movie
User avatar
jomunoz
Goblin
Posts: 228
Joined: Wed Apr 13, 2005 5:07 pm
Location: Medellin - Colombia

Post by jomunoz »

Show the output of the compiler for this second error.
User avatar
yuriythebest
Orc
Posts: 468
Joined: Sun Jul 10, 2005 11:44 am
Location: Kiev, Ukraine
Contact:

Post by yuriythebest »

the error output:
1>d:\ogresdk\ogresoundtest3\ogresoundtest3\src\ogrefsl\fslogreframework.h(13) : error C2504: 'FrameListener' : base class undefined
1>d:\ogresdk\ogresoundtest3\ogresoundtest3\src\ogrefsl\fslogreframework.h(27) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>d:\ogresdk\ogresoundtest3\ogresoundtest3\src\ogrefsl\fslogreframework.h(27) : error C2143: syntax error : missing ',' before '&'
1>d:\ogresdk\ogresoundtest3\ogresoundtest3\src\baseapplication.cpp(75) : error C2664: 'Ogre::Root::addFrameListener' : cannot convert parameter 1 from 'SoundListener *' to 'Ogre::FrameListener *'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>d:\ogresdk\ogresoundtest3\ogresoundtest3\src\baseapplication.cpp(76) : error C2653: 'ExampleApplication' : is not a class or namespace name
1>ogreSoundTest3.cpp
1>d:\ogresdk\ogresoundtest3\ogresoundtest3\src\ogrefsl\fslogreframework.h(13) : error C2504: 'FrameListener' : base class undefined
1>d:\ogresdk\ogresoundtest3\ogresoundtest3\src\ogrefsl\fslogreframework.h(27) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>d:\ogresdk\ogresoundtest3\ogresoundtest3\src\ogrefsl\fslogreframework.h(27) : error C2143: syntax error : missing ',' before '&'

and when I click on the first error it takes me to
class SoundListener : public FrameListener{
of fslogreframework.h
asteroidWars - an OGRE game
NOOB MAKE MMORPG- the flash movie
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Post by jacmoe »

Those are in ogrenew|OgreSDK/samples/include. :wink:
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
User avatar
yuriythebest
Orc
Posts: 468
Joined: Sun Jul 10, 2005 11:44 am
Location: Kiev, Ukraine
Contact:

Post by yuriythebest »

ok, I've added the exampleFrameListener.h to fslOgreFramework.h, now I get this error:
1>BaseApplication.obj : error LNK2019: unresolved external symbol "public: void __thiscall FSLSoundManager::updateSoundObjects(void)" (?updateSoundObjects@FSLSoundManager@@QAEXXZ) referenced in function "public: virtual bool __thiscall SoundListener::frameStarted(struct Ogre::FrameEvent const &)" (?frameStarted@SoundListener@@UAE_NABUFrameEvent@Ogre@@@Z)
1>bin\Debug\ogreSoundTest3.exe : fatal error LNK1120: 1 unresolved externals
which is strange because I've included FSLSoundManager in fslogreframework.h, baseapplication.cpp&h
asteroidWars - an OGRE game
NOOB MAKE MMORPG- the flash movie
wooohoh
Gnoblar
Posts: 20
Joined: Wed Sep 20, 2006 9:00 am

.

Post by wooohoh »

try to include all FSL*.cpp in the project also.

i had external symbol problems, and that solved all my problems. 8)


anyway, great thanks to jomunoz :D
User avatar
yuriythebest
Orc
Posts: 468
Joined: Sun Jul 10, 2005 11:44 am
Location: Kiev, Ukraine
Contact:

Re: .

Post by yuriythebest »

wooohoh wrote:try to include all FSL*.cpp in the project also.
thanks- Now it compiles, however when I try to use the exe it crashes because of leaks.
My baseApplication.h has
#include "ogreFSL/FSLAmbientSound.h"
#include "ogreFSL/FSLListener.h"
#include "ogreFSL/FSLOgreFramework.h"
#include "ogreFSL/FSLSoundEntity.h"
#include "ogreFSL/FSLSoundManager.h"
#include "ogreFSL/FSLSoundObject.h"
and baseApplication.cpp has

#include "ogreFSL/FSLAmbientSound.cpp"
#include "ogreFSL/FSLListener.cpp"
#include "ogreFSL/FSLSoundEntity.cpp"
#include "ogreFSL/FSLSoundManager.cpp"
#include "ogreFSL/FSLSoundObject.cpp"

I think I know the cause of the leaks- don't shoot me now. You see, FSLogreFramwork.h also demanded the FSL headers, but If I gave it the same path as I did to the baseAppliaction (ogrefsl/****) it still couldn't find em, so I just copied all the FSL files to the src dir and it could nor find em.

so now I have 2 sets of FSL files- one in ogreDir/src and one in ogreDir/src/ogreFSL.

in FSLogreframework the dirs are listed like so:
#include "FreeSL.h"
#include "FSLSoundEntity.h"
#include "FSLAmbientSound.h"
#include "FSLListener.h"
#include "FSLSoundManager.h"
#include "ExampleFrameListener.h"

please explain how I can make FSLOgreFrameWork see the FSL files in ogreDir/src/ogreFSL
asteroidWars - an OGRE game
NOOB MAKE MMORPG- the flash movie
User avatar
jomunoz
Goblin
Posts: 228
Joined: Wed Apr 13, 2005 5:07 pm
Location: Medellin - Colombia

Post by jomunoz »

Make sure that the .exe of your application can have access to the follow .dll's:

alut.dll
FreeSL.dll
ogg.dll
OpenAL32.dll
wrap_oal.dll
vorbis.dll
User avatar
yuriythebest
Orc
Posts: 468
Joined: Sun Jul 10, 2005 11:44 am
Location: Kiev, Ukraine
Contact:

Post by yuriythebest »

Yes, some dlls were missing. I added them but it still crashed due to leaks.
Last edited by yuriythebest on Mon Nov 13, 2006 8:51 pm, edited 2 times in total.
asteroidWars - an OGRE game
NOOB MAKE MMORPG- the flash movie
grizzley90
Gnome
Posts: 318
Joined: Wed Jan 18, 2006 7:22 pm
Location: Montreal, Canada

Post by grizzley90 »

Whats the license on OgreFSL? I need to know... :? I got it working with mogre in c#...
User avatar
yuriythebest
Orc
Posts: 468
Joined: Sun Jul 10, 2005 11:44 am
Location: Kiev, Ukraine
Contact:

Post by yuriythebest »

yuriythebest wrote:Yes, some dlls were missing. I added them but it still crashed due to leaks.
any ideas?
asteroidWars - an OGRE game
NOOB MAKE MMORPG- the flash movie
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Post by jacmoe »

yuriythebest wrote:any ideas?
Not a single clue..

Look. Life will be much easier to manage if you learned how to use your debugger.

Then you won't have to wait for psycic people to know what's wrong.. :P
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
wooohoh
Gnoblar
Posts: 20
Joined: Wed Sep 20, 2006 9:00 am

a bug with FSLManager::removeSound()??

Post by wooohoh »

It seems to me that FSLManager has a bug with removeSound() function.

in addSound(), it adds FSLSoundObject into _soundObjectVector.

However, in removeSound(), it deletes the FSLSoundObject, but it does not remove it from the vector

The problem arises in updateSoundObjects() which iterates through the vector, and calls update function for each FSLSoundObject.

If you add a sound( by createXXXXX), then remove it,
updateSoundObjects() will look up already-deleted-object..

To fix this, just chnage removeSound() so that it removes FSLSoundObject propely from the vector..

anyone with fair knowlege of STL can fix this.
WillF
Gnoblar
Posts: 7
Joined: Wed Nov 08, 2006 9:09 am

Post by WillF »

Very nice project.

There's one little mistake in the Suzanne.material file of the sample app:

The line "texture suzanne.png" should be "texture suzanne2.png" (or you could just rename the suzanne2.png (in the media/materials/textures directory) file to suzanne.png


I also get the following in the Ogre.log
21:46:36: Parsing script Example.material
21:46:36: Error in material Examples/MorningSkyBox at line 211 of Example.material: Invalid vertex_program_ref entry - vertex program Ogre/BasicVertexPrograms/AmbientOneTexture has not been defined.
21:46:36: Error in material Examples/Robot at line 697 of Example.material: Invalid vertex_program_ref entry - vertex program Ogre/HardwareSkinningOneWeight has not been defined.
21:46:36: Error in material Examples/Robot at line 709 of Example.material: Invalid shadow_caster_vertex_program_ref entry - vertex program Ogre/HardwareSkinningOneWeightShadowCaster has not been defined.
21:46:36: Error in material Examples/HardwareMorphAnimation at line 844 of Example.material: Invalid vertex_program_ref entry - vertex program Ogre/HardwareMorphAnimation has not been defined.
21:46:36: Error in material Examples/HardwarePoseAnimation at line 879 of Example.material: Invalid vertex_program_ref entry - vertex program Ogre/HardwarePoseAnimation has not been defined.
21:46:36: Error in material jaiqua at line 987 of Example.material: Invalid vertex_program_ref entry - vertex program Ogre/HardwareSkinningTwoWeights has not been defined.
21:46:36: Error in material jaiqua at line 999 of Example.material: Invalid shadow_caster_vertex_program_ref entry - vertex program Ogre/HardwareSkinningTwoWeightsShadowCaster has not been defined.
User avatar
jomunoz
Goblin
Posts: 228
Joined: Wed Apr 13, 2005 5:07 pm
Location: Medellin - Colombia

Post by jomunoz »

WillF wrote:Very nice project.

There's one little mistake in the Suzanne.material file of the sample app:

The line "texture suzanne.png" should be "texture suzanne2.png" (or you could just rename the suzanne2.png (in the media/materials/textures directory) file to suzanne.png


I also get the following in the Ogre.log
21:46:36: Parsing script Example.material
21:46:36: Error in material Examples/MorningSkyBox at line 211 of Example.material: Invalid vertex_program_ref entry - vertex program Ogre/BasicVertexPrograms/AmbientOneTexture has not been defined.
21:46:36: Error in material Examples/Robot at line 697 of Example.material: Invalid vertex_program_ref entry - vertex program Ogre/HardwareSkinningOneWeight has not been defined.
21:46:36: Error in material Examples/Robot at line 709 of Example.material: Invalid shadow_caster_vertex_program_ref entry - vertex program Ogre/HardwareSkinningOneWeightShadowCaster has not been defined.
21:46:36: Error in material Examples/HardwareMorphAnimation at line 844 of Example.material: Invalid vertex_program_ref entry - vertex program Ogre/HardwareMorphAnimation has not been defined.
21:46:36: Error in material Examples/HardwarePoseAnimation at line 879 of Example.material: Invalid vertex_program_ref entry - vertex program Ogre/HardwarePoseAnimation has not been defined.
21:46:36: Error in material jaiqua at line 987 of Example.material: Invalid vertex_program_ref entry - vertex program Ogre/HardwareSkinningTwoWeights has not been defined.
21:46:36: Error in material jaiqua at line 999 of Example.material: Invalid shadow_caster_vertex_program_ref entry - vertex program Ogre/HardwareSkinningTwoWeightsShadowCaster has not been defined.
I will check those out :)

The material errors are because i cut down the file in the material folder so the file size would be smaller and could be uploaded faster (at that time i didn't have broadband).
User avatar
syedhs
Silver Sponsor
Silver Sponsor
Posts: 2703
Joined: Mon Aug 29, 2005 3:24 pm
Location: Kuala Lumpur, Malaysia
x 51

Post by syedhs »

Sorry for digging up old threads, but all the download links are bad. Mind pointing to good one(s)? :)
User avatar
smernesto
Halfling
Posts: 78
Joined: Wed Jan 03, 2007 12:49 am
Location: Bogota, Colombia

Post by smernesto »

Hi.

What is the license for this wrapper?

Thanks.

Ernesto
User avatar
jomunoz
Goblin
Posts: 228
Joined: Wed Apr 13, 2005 5:07 pm
Location: Medellin - Colombia

Post by jomunoz »

smernesto wrote:Hi.

What is the license for this wrapper?

Thanks.

Ernesto

It is public domain, so you can do what you want with it. Rigth now i don't have intentions on continue the work on it.

I suggest the use of OgreAL, i'm using it rigth now. :wink:
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Post by jacmoe »

Since EAX is gone in Vista, FreeSL will only work in software emu mode, until the author updates it.
OpenAL works around this issue, and has full hardware accelleration, even on Vista (without EAX).
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
User avatar
syedhs
Silver Sponsor
Silver Sponsor
Posts: 2703
Joined: Mon Aug 29, 2005 3:24 pm
Location: Kuala Lumpur, Malaysia
x 51

Post by syedhs »

Hmm but FreeSL is a wrapper for OpenAL isn't it?
Post Reply