[Solved]How to make the OgreOggSound work Topic is solved

Problems building or running the engine, queries about how to use features etc.
Post Reply
niubaty
Kobold
Posts: 27
Joined: Thu Jan 10, 2019 2:19 pm
x 1

[Solved]How to make the OgreOggSound work

Post by niubaty » Sat Mar 09, 2019 12:51 pm

I compiled the plugin of OgreOggSound( https://github.com/OGRECave/ogre-oggsound.git).

According to the https://www.ogre3d.org/addonforums/19/t ... =19&t=8478
This part was added to the Setup() and my application failed in the line "mSoundMgr->init();"

Code: Select all

		mSoundMgr = OgreOggSound::OgreOggSoundManager::getSingletonPtr();
		if (!mSoundMgr)mSoundMgr = new OgreOggSound::OgreOggSoundManager();
		mSoundMgr->setSceneManager(scnMgr);
		mSoundMgr->init();
		mSoundMgr->createSound(std::string("sound1"), std::string("030.wav"));
This is the call stack:

Code: Select all

 	OgreMain_d.dll!Ogre::ExceptionFactory::_throwException(Ogre::Exception::ExceptionCodes code, int number, const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & desc, const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & src, const char * file, long line) line 267	C++
 	OgreMain_d.dll!Ogre::ExceptionFactory::throwException(Ogre::Exception::ExceptionCodes code, const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & desc, const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & src, const char * file, long line) line 282	C++
>	OgreMain_d.dll!Ogre::Root::getMovableObjectFactory(const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & typeName) line 1399	C++
 	OgreMain_d.dll!Ogre::SceneManager::createMovableObject(const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & name, const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & typeName, const std::map<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::allocator<std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char> > const ,std::basic_string<char,std::char_traits<char>,std::allocator<char> > > > > * params) line 4097	C++
 	Plugin_OggSound.dll!OgreOggSound::OgreOggSoundManager::createListener() line 485	C++
 	Plugin_OggSound.dll!OgreOggSound::OgreOggSoundManager::init(const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & deviceName, unsigned int maxSources, unsigned int queueListSize, Ogre::SceneManager * scnMgr) line 375	C++
 	guit.exe!ImguiExample::setup() line 88	C++

It seems the typeName of "OgreOggISound" can not be found .

Code: Select all

    MovableObjectFactory* Root::getMovableObjectFactory(const String& typeName)
    {
        MovableObjectFactoryMap::iterator i =
            mMovableObjectFactoryMap.find(typeName);
        if (i == mMovableObjectFactoryMap.end())
        {
            OGRE_EXCEPT(Exception::ERR_ITEM_NOT_FOUND,
                "MovableObjectFactory of type " + typeName + " does not exist",
                "Root::getMovableObjectFactory");
        }
        return i->second;
    }
How to make this plugin work?








By the way, it seems the definition of _queryBufferInfo() in OgreOggStreamBufferSound.h is missing.

Code: Select all

$ git diff include/OgreOggStreamBufferSound.h
diff --git a/include/OgreOggStreamBufferSound.h b/include/OgreOggStreamBufferSound.h
index 0e96c0c..27d32fd 100644
--- a/include/OgreOggStreamBufferSound.h
+++ b/include/OgreOggStreamBufferSound.h
@@ -136,7 +136,7 @@ namespace OgreOggSound
                        Calculates a block aligned buffer size of 250ms using
                        sounds properties
                 */
-               bool _queryBufferInfo() {}
+               bool _queryBufferInfo() { return true; }^M
                /** Releases buffers and OpenAL objects.
                @remarks
                        Cleans up this sounds OpenAL objects, including buffers

Last edited by niubaty on Sat Mar 09, 2019 1:59 pm, edited 1 time in total.
0 x

paroj
OGRE Team Member
OGRE Team Member
Posts: 774
Joined: Sun Mar 30, 2014 2:51 pm
x 120
Contact:

Re: How to make the OgreOggSound work

Post by paroj » Sat Mar 09, 2019 1:42 pm

yeah that plugin is in severe need of an example. The latest code that is supposed to work with it is:
https://github.com/rpaciorek/ogre-video ... nterface.h

please consider create a PR against OgreOggSound once you figure out the correct initialisation.
0 x

niubaty
Kobold
Posts: 27
Joined: Thu Jan 10, 2019 2:19 pm
x 1

Re: How to make the OgreOggSound work

Post by niubaty » Sat Mar 09, 2019 1:58 pm

Add a factory(OgreOggSoundFactory) to the root

Code: Select all

		OgreOggSound::OgreOggSoundFactory* factory=new OgreOggSound::OgreOggSoundFactory();
		root->addMovableObjectFactory(factory);
The whole code looks like:

Code: Select all

		mSoundMgr = OgreOggSound::OgreOggSoundManager::getSingletonPtr();
		if (!mSoundMgr)mSoundMgr = new OgreOggSound::OgreOggSoundManager();
		mSoundMgr->setSceneManager(scnMgr);
		OgreOggSound::OgreOggSoundFactory* factory=new OgreOggSound::OgreOggSoundFactory();
		root->addMovableObjectFactory(factory);
		mSoundMgr->init();
		mSoundMgr->createSound(std::string("sound1"), std::string("013.wav"));
		OgreOggSound::OgreOggISound * snd= mSoundMgr->getSound(std::string("sound1"));
		snd->play(true);
It works.

I would create a PR when I figure out how to use this plugin.
0 x

Post Reply