FSLManager, easy sound implementation in OGRE
- yuriythebest
- Orc
- Posts: 468
- Joined: Sun Jul 10, 2005 11:44 am
- Location: Kiev, Ukraine
- Contact:
- yuriythebest
- Orc
- Posts: 468
- Joined: Sun Jul 10, 2005 11:44 am
- Location: Kiev, Ukraine
- Contact:
ok- so I've placed the framestarted code in the baseApplications framestarted, and declared
it gives this error:
in baseApplication.h like so:SoundListener *mSoundListener;
FSLSoundManager* soundManager;
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
- yuriythebest
- Orc
- Posts: 468
- Joined: Sun Jul 10, 2005 11:44 am
- Location: Kiev, Ukraine
- Contact:
my bad- I thought that simply adding them to my project was enough.
I've added
fslogreframework.h and complains that the framelistener base class is undefined. I believe it's talking about
I've added
to my baseAppliation, how however the error output takes me to#include "FSLAmbientSound.h"
#include "FSLListener.h"
#include "FSLOgreFramework.h"
#include "FSLSoundEntity.h"
#include "FSLSoundManager.h"
#include "FSLSoundObject.h"
fslogreframework.h and complains that the framelistener base class is undefined. I believe it's talking about
I've addedvoid createFrameListener(void){
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
mSoundListener = new SoundListener( soundManager ); //Create sound listener
mRoot->addFrameListener(mSoundListener); //Add sound listener so it will update every frame
ExampleApplication::createFrameListener();
public:
PruebaSL1() : ExampleApplication(){
mSoundListener = 0;
}
~PruebaSL1()
{ if (mSoundListener)
delete mSoundListener;
if (soundManager)
delete soundManager;
}
- yuriythebest
- Orc
- Posts: 468
- Joined: Sun Jul 10, 2005 11:44 am
- Location: Kiev, Ukraine
- Contact:
- yuriythebest
- Orc
- Posts: 468
- Joined: Sun Jul 10, 2005 11:44 am
- Location: Kiev, Ukraine
- Contact:
the error output:
and when I click on the first error it takes me to
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
of fslogreframework.hclass SoundListener : public FrameListener{
- jacmoe
- OGRE Retired Moderator
- Posts: 20570
- Joined: Thu Jan 22, 2004 10:13 am
- Location: Denmark
- x 179
- Contact:
Those are in ogrenew|OgreSDK/samples/include.
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
- yuriythebest
- Orc
- Posts: 468
- Joined: Sun Jul 10, 2005 11:44 am
- Location: Kiev, Ukraine
- Contact:
ok, I've added the exampleFrameListener.h to fslOgreFramework.h, now I get this error:
which is strange because I've included FSLSoundManager in fslogreframework.h, baseapplication.cpp&h1>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
- yuriythebest
- Orc
- Posts: 468
- Joined: Sun Jul 10, 2005 11:44 am
- Location: Kiev, Ukraine
- Contact:
Re: .
thanks- Now it compiles, however when I try to use the exe it crashes because of leaks.wooohoh wrote:try to include all FSL*.cpp in the project also.
My baseApplication.h has
and baseApplication.cpp 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"
#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
- yuriythebest
- Orc
- Posts: 468
- Joined: Sun Jul 10, 2005 11:44 am
- Location: Kiev, Ukraine
- Contact:
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.
-
- Gnome
- Posts: 318
- Joined: Wed Jan 18, 2006 7:22 pm
- Location: Montreal, Canada
- yuriythebest
- Orc
- Posts: 468
- Joined: Sun Jul 10, 2005 11:44 am
- Location: Kiev, Ukraine
- Contact:
- jacmoe
- OGRE Retired Moderator
- Posts: 20570
- Joined: Thu Jan 22, 2004 10:13 am
- Location: Denmark
- x 179
- Contact:
Not a single clue..yuriythebest wrote:any ideas?
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..
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
-
- Gnoblar
- Posts: 20
- Joined: Wed Sep 20, 2006 9:00 am
a bug with FSLManager::removeSound()??
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.
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.
-
- Gnoblar
- Posts: 7
- Joined: Wed Nov 08, 2006 9:09 am
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
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.
- jomunoz
- Goblin
- Posts: 228
- Joined: Wed Apr 13, 2005 5:07 pm
- Location: Medellin - Colombia
I will check those outWillF 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.log21: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.
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).
- jomunoz
- Goblin
- Posts: 228
- Joined: Wed Apr 13, 2005 5:07 pm
- Location: Medellin - Colombia
- jacmoe
- OGRE Retired Moderator
- Posts: 20570
- Joined: Thu Jan 22, 2004 10:13 am
- Location: Denmark
- x 179
- Contact:
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).
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.
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.