Skip to content
This repository has been archived by the owner on Jun 5, 2019. It is now read-only.

Commit

Permalink
Number of patches applied to fix multi-threaded issues identified by …
Browse files Browse the repository at this point in the history
…shenjoku (Potentially unstable)
  • Loading branch information
stickymango committed Jun 4, 2014
1 parent 0882adc commit 25c1b97
Show file tree
Hide file tree
Showing 27 changed files with 205 additions and 56 deletions.
9 changes: 9 additions & 0 deletions ChangeLog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
* version 1.26 (Potentially unstable multi-threaded version)

* Added patches to fix a number of multi-threaded issues discovered by shenjoku:
* http://www.ogre3d.org/addonforums/viewtopic.php?f=19&t=30239&p=102725#p102725
* http://www.ogre3d.org/addonforums/viewtopic.php?f=19&t=30243
* http://www.ogre3d.org/addonforums/viewtopic.php?f=19&t=30240
* http://www.ogre3d.org/addonforums/viewtopic.php?f=19&t=30246
* http://www.ogre3d.org/addonforums/viewtopic.php?f=19&t=30244

* version 1.25

* Added patches from shenjoku: http://www.ogre3d.org/addonforums/viewtopic.php?f=19&t=30226
Expand Down
Binary file modified OgreOggSoundLib_vc10.suo
Binary file not shown.
16 changes: 7 additions & 9 deletions include/OgreOggISound.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* @file OgreOggISound.h
* @author Ian Stangoe
* @version 1.24
* @version 1.26
*
* @section LICENSE
*
Expand Down Expand Up @@ -108,7 +108,8 @@ namespace OgreOggSound
SS_NONE,
SS_PLAYING,
SS_PAUSED,
SS_STOPPED
SS_STOPPED,
SS_DESTROYED
};

//!Structure describing an ogg stream
Expand All @@ -128,10 +129,7 @@ namespace OgreOggSound
{

public:

typedef std::vector<ALuint> BufferList; // A list of the IDs of all OpenAL buffers being used by a sound. This is a vector so that it can be passed around as an array to the various OpenAL functions.
typedef Ogre::SharedPtr<BufferList> BufferListPtr; // An Ogre::SharedPtr to the list of buffer IDs. This makes it easier to pass the values to multiple OgreOggISound instances without having


//! Listener callback
/** provides hooks into various sound states.
*/
Expand Down Expand Up @@ -526,10 +524,10 @@ namespace OgreOggSound
/** Sets properties of a shared resource.
@remarks
Sets a number of properties relating to audio of a shared resource.
@param s
OgreOggISound pointer of parent sound.
@param buffer
Pointer to the shared buffer to copy the properties from.
*/
void _setSharedProperties(OgreOggISound* s);
void _setSharedProperties(sharedAudioBuffer* buffer);

/** Gets properties of a shared resource.
@remarks
Expand Down
14 changes: 11 additions & 3 deletions include/OgreOggListener.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* @file OgreOggSoundListener.h
* @author Ian Stangoe
* @version v1.25
* @version v1.26
*
* @section LICENSE
*
Expand Down Expand Up @@ -81,7 +81,7 @@ namespace OgreOggSound
void setPosition(const Ogre::Vector3 &pos);
/** Gets the position of the listener.
*/
const Ogre::Vector3& getPosition() { return mPosition; }
Ogre::Vector3 getPosition() const;
/** Sets the orientation of the listener.
@remarks
Sets the 3D orientation of the listener. This is a manual method,
Expand All @@ -104,7 +104,7 @@ namespace OgreOggSound
void setOrientation(const Ogre::Quaternion &q);
/** Gets the orientation of the listener.
*/
Ogre::Vector3 getOrientation() { return Ogre::Vector3(mOrientation[0],mOrientation[1],mOrientation[2]); }
Ogre::Vector3 getOrientation() const;
/** Sets sounds velocity.
@param
vel 3D x/y/z velocity
Expand Down Expand Up @@ -169,6 +169,14 @@ namespace OgreOggSound

private:

#if OGGSOUND_THREADED
# if POCO_THREAD
static Poco::Mutex mMutex;
# else
static boost::recursive_mutex mMutex;
# endif
#endif

/**
* Positional variables
*/
Expand Down
2 changes: 1 addition & 1 deletion include/OgreOggSound.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* @file OgreOggSound.h
* @author Ian Stangoe
* @version v1.25
* @version v1.26
*
* @section LICENSE
*
Expand Down
2 changes: 1 addition & 1 deletion include/OgreOggSoundCallback.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* @file OgreOggSoundCallback.h
* @author Ian Stangoe
* @version v1.25
* @version v1.26
*
* @section LICENSE
*
Expand Down
2 changes: 1 addition & 1 deletion include/OgreOggSoundFactory.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* @file OgreOggSoundFactory.h
* @author Ian Stangoe
* @version v1.25
* @version v1.26
*
* @section LICENSE
*
Expand Down
7 changes: 6 additions & 1 deletion include/OgreOggSoundManager.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* @file OgreOggSoundManager.h
* @author Ian Stangoe
* @version v1.25
* @version v1.26
*
* @section LICENSE
*
Expand Down Expand Up @@ -627,6 +627,7 @@ namespace OgreOggSound
static Poco::Mutex mMutex;
# else
static boost::recursive_mutex mMutex;
static boost::recursive_mutex mSoundMutex;
# endif

/** Pushes a sound action request onto the queue
Expand Down Expand Up @@ -891,6 +892,10 @@ namespace OgreOggSound
*/
void _destroyListener();

/** Calculates the distance a sound is from the specified listener position.
*/
static Ogre::Real _calculateDistanceToListener(OgreOggISound * sound, const Ogre::Vector3 & listenerPos);

/**
* OpenAL device objects
*/
Expand Down
2 changes: 1 addition & 1 deletion include/OgreOggSoundPlugin.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* @file OgreOggSoundPlugin.h
* @author Ian Stangoe
* @version v1.25
* @version v1.26
*
* @section LICENSE
*
Expand Down
21 changes: 16 additions & 5 deletions include/OgreOggSoundPrereqs.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* @file OgreOggSoundPrereqs.h
* @author Ian Stangoe
* @version v1.25
* @version v1.26
*
* @section LICENSE
*
Expand Down Expand Up @@ -91,14 +91,25 @@

namespace OgreOggSound
{
class OgreOggISound;
typedef std::vector<ALuint> BufferList; // A list of the IDs of all OpenAL buffers being used by a sound. This is a vector so that it can be passed around as an array to the various OpenAL functions.
typedef Ogre::SharedPtr<BufferList> BufferListPtr; // An Ogre::SharedPtr to the list of buffer IDs. This makes it easier to pass the values to multiple OgreOggISound instances without having to manage memory.

//! Holds information about a static shared audio buffer.
struct sharedAudioBuffer
{
ALuint mAudioBuffer; /// OpenAL buffer
unsigned int mRefCount; /// Reference counter
OgreOggISound* mParent; /// Parent OgreOggISound ptr for shared properties
sharedAudioBuffer() :
mAudioBuffer(AL_NONE)
,mRefCount(0)
,mBuffers()
,mPlayTime(0.0)
,mFormat(AL_NONE)
{ }

ALuint mAudioBuffer; /// OpenAL buffer
unsigned int mRefCount; /// Reference counter
BufferListPtr mBuffers; /// The cached common buffers to use between all sounds using this shared audio buffer.
float mPlayTime; /// The cached play time of the audio buffer.
ALenum mFormat; /// The cached format of the audio buffer.
};

typedef std::map<std::string, sharedAudioBuffer*> SharedBufferList;
Expand Down
2 changes: 1 addition & 1 deletion include/OgreOggSoundRecord.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* @file OgreOggSoundRecord.h
* @author Ian Stangoe
* @version v1.25
* @version v1.26
*
* @section LICENSE
*
Expand Down
2 changes: 1 addition & 1 deletion include/OgreOggStaticSound.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* @file OgreOggStaticSound.h
* @author Ian Stangoe
* @version v1.25
* @version v1.26
*
* @section LICENSE
*
Expand Down
2 changes: 1 addition & 1 deletion include/OgreOggStaticWavSound.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* @file OgreOggStaticWavSound.h
* @author Ian Stangoe
* @version v1.25
* @version v1.26
*
* @section LICENSE
*
Expand Down
2 changes: 1 addition & 1 deletion include/OgreOggStreamSound.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* @file OgreOggStreamSound.h
* @author Ian Stangoe
* @version v1.25
* @version v1.26
*
* @section LICENSE
*
Expand Down
2 changes: 1 addition & 1 deletion include/OgreOggStreamWavSound.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* @file OgreOggStreamWavSound.h
* @author Ian Stangoe
* @version v1.25
* @version v1.26
*
* @section LICENSE
*
Expand Down
2 changes: 1 addition & 1 deletion include/apimainpage.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
condenses the functionality down to a clean and simple OGRE-fied interface.

Its current development status is stable and actively maintained. Current version
is 1.24 (Stable)
is 1.26

So, thanks for checking out the library and I hope it serves as a useful addition
to your development tool collection.
Expand Down
14 changes: 11 additions & 3 deletions src/OgreOggISound.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* @file OgreOggISound.cpp
* @author Ian Stangoe
* @version v1.25
* @version v1.26
*
* @section LICENSE
*
Expand Down Expand Up @@ -137,13 +137,17 @@ namespace OgreOggSound
format = mFormat;
}
/*/////////////////////////////////////////////////////////////////*/
void OgreOggISound::_setSharedProperties(OgreOggISound* s)
void OgreOggISound::_setSharedProperties(sharedAudioBuffer* buffer)
{
s->_getSharedProperties(mBuffers, mPlayTime, mFormat);
mBuffers = buffer->mBuffers;
mPlayTime = buffer->mPlayTime;
mFormat = buffer->mFormat;
}
/*/////////////////////////////////////////////////////////////////*/
void OgreOggISound::play(bool immediate)
{
assert(mState != SS_DESTROYED);

#if OGGSOUND_THREADED
SoundAction action;
action.mSound = mName;
Expand All @@ -158,6 +162,8 @@ namespace OgreOggSound
/*/////////////////////////////////////////////////////////////////*/
void OgreOggISound::stop(bool immediate)
{
assert(mState != SS_DESTROYED);

#if OGGSOUND_THREADED
SoundAction action;
action.mSound = mName;
Expand All @@ -172,6 +178,8 @@ namespace OgreOggSound
/*/////////////////////////////////////////////////////////////////*/
void OgreOggISound::pause(bool immediate)
{
assert(mState != SS_DESTROYED);

#if OGGSOUND_THREADED
SoundAction action;
action.mSound = mName;
Expand Down
Loading

0 comments on commit 25c1b97

Please sign in to comment.