diff --git a/oggsound/include/OgreOggISound.h b/oggsound/include/OgreOggISound.h index 6f105e4..0a71a19 100644 --- a/oggsound/include/OgreOggISound.h +++ b/oggsound/include/OgreOggISound.h @@ -428,7 +428,7 @@ namespace OgreOggSound inline ALuint getSource() const { return mSource; } /** Gets the sounds file name */ - virtual const Ogre::String& getFileName( void ) const { return mAudioStream ? Ogre::BLANKSTRING : mAudioStream->getName(); } + virtual const Ogre::String& getFileName( void ) const { return mAudioStream ? mAudioStream->getName() : Ogre::BLANKSTRING; } /** Gets the sounds priority */ inline Ogre::uint8 getPriority() const { return mPriority; } diff --git a/oggsound/include/OgreOggListener.h b/oggsound/include/OgreOggListener.h index 6c088e6..25ba64e 100644 --- a/oggsound/include/OgreOggListener.h +++ b/oggsound/include/OgreOggListener.h @@ -94,19 +94,19 @@ namespace OgreOggSound Overridden function from MovableObject, returns a Sound object string for identification. */ - virtual const Ogre::String& getMovableType(void) const; + const Ogre::String& getMovableType(void) const override; /** Gets the bounding box of this object. @remarks Overridden function from MovableObject, provides a bounding box for this object. */ - virtual const Ogre::AxisAlignedBox& getBoundingBox(void) const; + const Ogre::AxisAlignedBox& getBoundingBox(void) const override; /** Gets the bounding radius of this object. @remarks Overridden function from MovableObject, provides the bounding radius for this object. */ - virtual float getBoundingRadius(void) const; + float getBoundingRadius(void) const override; #if !AV_OGRE_NEXT_VERSION void _updateRenderQueue(Ogre::RenderQueue *queue) override {} void visitRenderables(Ogre::Renderable::Visitor* visitor, bool debugRenderables) override {} @@ -117,22 +117,22 @@ namespace OgreOggSound @remarks Overridden function from MovableObject. */ - virtual void _notifyAttached( + void _notifyAttached( Ogre::Node* node #if !AV_OGRE_NEXT_VERSION , bool isTagPoint = false #endif - ); + ) override; #if !AV_OGRE_NEXT_VERSION /** Moved callback @remarks Overridden function from MovableObject. */ - virtual void _notifyMoved(void); + void _notifyMoved(void) override; #else /** Does nothing but is need for being derived from MovableObject */ - virtual void _updateRenderQueue(Ogre::RenderQueue *queue, Ogre::Camera *camera, const Ogre::Camera *lodCamera) {} + void _updateRenderQueue(Ogre::RenderQueue *queue, Ogre::Camera *camera, const Ogre::Camera *lodCamera) override {} #endif /** Returns scenemanager which created this listener. */ diff --git a/oggsound/include/OgreOggSoundFactory.h b/oggsound/include/OgreOggSoundFactory.h index b7d3cc6..0ef0a07 100644 --- a/oggsound/include/OgreOggSoundFactory.h +++ b/oggsound/include/OgreOggSoundFactory.h @@ -51,7 +51,7 @@ namespace OgreOggSound OgreOggSoundFactory() {} ~OgreOggSoundFactory() {} - static Ogre::String FACTORY_TYPE_NAME; + static const Ogre::String FACTORY_TYPE_NAME; const Ogre::String& getType(void) const; diff --git a/oggsound/src/OgreOggSoundFactory.cpp b/oggsound/src/OgreOggSoundFactory.cpp index b39b1fe..d5dacfa 100644 --- a/oggsound/src/OgreOggSoundFactory.cpp +++ b/oggsound/src/OgreOggSoundFactory.cpp @@ -35,7 +35,7 @@ namespace OgreOggSound { - Ogre::String OgreOggSoundFactory::FACTORY_TYPE_NAME = "OgreOggISound"; + const Ogre::String OgreOggSoundFactory::FACTORY_TYPE_NAME = "OgreOggISound"; //----------------------------------------------------------------------- const Ogre::String& OgreOggSoundFactory::getType(void) const diff --git a/oggsound/src/OgreOggSoundManager.cpp b/oggsound/src/OgreOggSoundManager.cpp index b92c72f..2a1b7f7 100644 --- a/oggsound/src/OgreOggSoundManager.cpp +++ b/oggsound/src/OgreOggSoundManager.cpp @@ -215,7 +215,7 @@ namespace OgreOggSound #endif { Ogre::SceneManager* s = mListener->getSceneManager(); - s->destroyAllMovableObjectsByType("OgreOggISound"); + s->destroyAllMovableObjectsByType(OgreOggSoundFactory::FACTORY_TYPE_NAME); } _destroyListener(); } @@ -242,20 +242,29 @@ namespace OgreOggSound int minorVersion; // Version Info - alcGetIntegerv(NULL, ALC_MINOR_VERSION, sizeof(minorVersion), &minorVersion); - ALCenum error = alcGetError(NULL); + ALCdevice* device; +#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32 + device = NULL; +#else + device = alcOpenDevice(NULL); +#endif + alcGetIntegerv(device, ALC_MINOR_VERSION, sizeof(minorVersion), &minorVersion); + ALCenum error = alcGetError(device); if (error != ALC_NO_ERROR) { OGRE_LOG_ERROR("Unable to get OpenAL Minor Version number"); return false; } - alcGetIntegerv(NULL, ALC_MAJOR_VERSION, sizeof(majorVersion), &majorVersion); - error = alcGetError(NULL); + alcGetIntegerv(device, ALC_MAJOR_VERSION, sizeof(majorVersion), &majorVersion); + error = alcGetError(device); if (error != ALC_NO_ERROR) { OGRE_LOG_ERROR("Unable to get OpenAL Major Version number"); return false; } +#if OGRE_PLATFORM != OGRE_PLATFORM_WIN32 + alcCloseDevice(device); +#endif /* ** OpenAL versions prior to 1.0 DO NOT support device enumeration, so we @@ -583,7 +592,7 @@ namespace OgreOggSound return sound; } - else if ( file.find(".ogg") != file.npos || file.find(".OGG") != file.npos ) + else if ( Ogre::StringUtil::endsWith(file, ".ogg", true) ) { if(stream) sound = OGRE_NEW_T(OgreOggStreamSound, Ogre::MEMCATEGORY_GENERAL)( @@ -633,7 +642,7 @@ namespace OgreOggSound #endif return sound; } - else if ( file.find(".wav") != file.npos || file.find(".WAV") != file.npos ) + else if ( Ogre::StringUtil::endsWith(file, ".wav", true) ) { if(stream) sound = OGRE_NEW_T(OgreOggStreamWavSound, Ogre::MEMCATEGORY_GENERAL)( @@ -1062,7 +1071,7 @@ namespace OgreOggSound // All sources in use // Re-use an active source // Use either a non-playing source or a lower priority source - else + else if (!mActiveSounds.empty()) { // Get iterator for list ActiveList::iterator iter = mActiveSounds.begin();