OgreOggSound  1.26
OgreOggSound::OgreOggStreamWavSound Class Reference

A single streaming sound (WAV) More...

#include <OgreOggStreamWavSound.h>

Inheritance diagram for OgreOggSound::OgreOggStreamWavSound:

Protected Member Functions

 OgreOggStreamWavSound (const Ogre::String &name, Ogre::SceneManager *scnMgr)
 
 ~OgreOggStreamWavSound ()
 
void release ()
 
void _openImpl (Ogre::DataStreamPtr &fileStream)
 
void _stopImpl ()
 
void _pauseImpl ()
 
void _playImpl ()
 
bool _stream (ALuint buffer)
 
void _updateAudioBuffers ()
 
void _dequeue ()
 
void _prebuffer ()
 
bool _queryBufferInfo ()
 
void _updatePlayPosition ()
 
void _release ()
 
- Protected Member Functions inherited from OgreOggSound::OgreOggISound
 OgreOggISound (const Ogre::String &name, Ogre::SceneManager *scnMgr)
 
virtual ~OgreOggISound ()
 
virtual void _openImpl (const Ogre::String &fName, sharedAudioBuffer *buffer=0)
 
virtual void _updateRenderQueue (Ogre::RenderQueue *queue)
 
virtual void _notifyAttached (Ogre::Node *node)
 
virtual void _updateRenderQueue (Ogre::RenderQueue *queue, Ogre::Camera *camera, const Ogre::Camera *lodCamera)
 
virtual void visitRenderables (Ogre::Renderable::Visitor *visitor, bool debugRenderables)
 
void _initSource ()
 
void _markPlayPosition ()
 
void _recoverPlayPosition ()
 
void _updateFade (float fTime=0.f)
 

Protected Attributes

bool mStreamEOF
 
WavFormatData mFormatData
 
unsigned int mLoopOffsetBytes
 
float mLastOffset
 
- Protected Attributes inherited from OgreOggSound::OgreOggISound
float mFadeTimer
 
float mFadeTime
 
float mFadeInitVol
 
float mFadeEndVol
 
bool mFade
 
FadeControl mFadeEndAction
 
Ogre::DataStreamPtr mAudioStream
 
ov_callbacks mOggCallbacks
 
SoundListenermSoundListener
 
size_t mBufferSize
 
ALuint mSource
 
Ogre::SceneManagermScnMan
 
Ogre::uint8 mPriority
 
Ogre::Vector3 mPosition
 
Ogre::Vector3 mDirection
 
Ogre::Vector3 mVelocity
 
float mGain
 
float mMaxGain
 
float mMinGain
 
float mMaxDistance
 
float mRolloffFactor
 
float mReferenceDistance
 
float mPitch
 
float mOuterConeGain
 
float mInnerConeAngle
 
float mOuterConeAngle
 
float mPlayTime
 
Ogre::String mName
 
SoundState mState
 
bool mLoop
 
bool mDisable3D
 
bool mGiveUpSource
 
bool mStream
 
bool mSourceRelative
 
bool mPlayPosChanged
 
bool mSeekable
 
bool mTemporary
 
bool mInitialised
 
Ogre::uint8 mAwaitingDestruction
 
BufferListPtr mBuffers
 
ALenum mFormat
 
unsigned long mAudioOffset
 
unsigned long mAudioEnd
 
float mLoopOffset
 
float mLoopStart
 
ALfloat mPlayPos
 
std::deque< float > mCuePoints
 

Private Member Functions

void setPlayPosition (float seconds)
 
float getPlayPosition () const
 
void setSource (ALuint &src)
 
void setLoopOffset (float startTime)
 
bool isMono ()
 

Friends

class OgreOggSoundManager
 

Additional Inherited Members

- Public Types inherited from Ogre::MovableObject
typedef vector< ShadowRenderable * >::type ShadowRenderableList
 
typedef VectorIterator< ShadowRenderableListShadowRenderableListIterator
 
- Public Types inherited from Ogre::ShadowCaster
typedef vector< ShadowRenderable * >::type ShadowRenderableList
 
typedef VectorIterator< ShadowRenderableListShadowRenderableListIterator
 
- Public Member Functions inherited from OgreOggSound::OgreOggISound
void play (bool immediate=false)
 
void pause (bool immediate=false)
 
void stop (bool immediate=false)
 
void loop (bool loop)
 
float getLoopOffset ()
 
void startFade (bool dir, float fadeTime, FadeControl actionOnCompletion=OgreOggSound::FC_NONE)
 
bool isTemporary () const
 
void markTemporary ()
 
void disable3D (bool disable)
 
SoundState getState () const
 
bool isPlaying () const
 
bool isPaused () const
 
bool isStopped () const
 
bool isRelativeToListener () const
 
void setGiveUpSourceOnStop (bool giveup=false)
 
void setPosition (float posx, float posy, float posz)
 
void setPosition (const Ogre::Vector3 &pos)
 
void setDirection (float dirx, float diry, float dirz)
 
void setDirection (const Ogre::Vector3 &dir)
 
void setVelocity (float velx, float vely, float velz)
 
void setVelocity (const Ogre::Vector3 &vel)
 
void setVolume (float gain)
 
float getVolume () const
 
void setMaxVolume (float maxGain)
 
void setMinVolume (float minGain)
 
void setConeAngles (float insideAngle=360.f, float outsideAngle=360.f)
 
void setOuterConeVolume (float gain=0.f)
 
void setMaxDistance (float maxDistance)
 
const float getMaxDistance () const
 
void setRolloffFactor (float rolloffFactor)
 
const float getRolloffFactor () const
 
void setReferenceDistance (float referenceDistance)
 
const float getReferenceDistance () const
 
void setPitch (float pitch)
 
const float getPitch () const
 
void setRelativeToListener (bool relative)
 
const Ogre::Vector3getPosition () const
 
const Ogre::Vector3getDirection () const
 
bool isFading () const
 
virtual void update (float fTime)
 
ALuint getSource () const
 
const Ogre::StringgetName (void) const
 
virtual const Ogre::StringgetFileName (void) const
 
Ogre::uint8 getPriority () const
 
void setPriority (Ogre::uint8 priority)
 
bool addCuePoint (float seconds)
 
void removeCuePoint (unsigned short index)
 
void clearCuePoints ()
 
void setCuePoint (unsigned short index)
 
float getCuePoint (unsigned short index)
 
unsigned int getNumCuePoints ()
 
float getAudioLength () const
 
virtual const Ogre::StringgetMovableType (void) const
 
virtual const Ogre::AxisAlignedBoxgetBoundingBox (void) const
 
virtual float getBoundingRadius (void) const
 
Ogre::SceneManagergetSceneManager () const
 
void setListener (SoundListener *l)
 
void _setSharedProperties (sharedAudioBuffer *buffer)
 
void _getSharedProperties (BufferListPtr &buffers, float &length, ALenum &format)
 
- Public Member Functions inherited from Ogre::MovableObject
 MovableObject ()
 
 MovableObject (const String &name)
 
virtual ~MovableObject ()
 
MovableObjectFactory_getCreator (void) const
 
LightList_getLightList ()
 
SceneManager_getManager (void) const
 
virtual const Matrix4_getParentNodeFullTransform (void) const
 
virtual void _notifyAttached (Node *parent, bool isTagPoint=false)
 
virtual void _notifyCreator (MovableObjectFactory *fact)
 
virtual void _notifyCurrentCamera (Camera *cam)
 
virtual void _notifyManager (SceneManager *man)
 
virtual void _notifyMoved (void)
 
virtual void _releaseManualHardwareResources ()
 
virtual void _restoreManualHardwareResources ()
 
void addQueryFlags (uint32 flags)
 
void addVisibilityFlags (uint32 flags)
 
virtual AnimableValuePtr createAnimableValue (const String &valueName)
 
void detachFromParent (void)
 
const StringVectorgetAnimableValueNames (void) const
 
bool getCastShadows (void) const
 
const AxisAlignedBoxgetDarkCapBounds (const Light &light, Real dirLightExtrusionDist) const
 
EdgeDatagetEdgeList (void)
 
const AxisAlignedBoxgetLightCapBounds (void) const
 
uint32 getLightMask () const
 
ListenergetListener (void) const
 
const StringgetName (void) const
 
NodegetParentNode (void) const
 
SceneNodegetParentSceneNode (void) const
 
Real getPointExtrusionDistance (const Light *l) const
 
uint32 getQueryFlags (void) const
 
bool getReceivesShadows ()
 
Real getRenderingDistance (void) const
 
Real getRenderingMinPixelSize () const
 
uint8 getRenderQueueGroup (void) const
 
ShadowRenderableListIterator getShadowVolumeRenderableIterator (ShadowTechnique shadowTechnique, const Light *light, HardwareIndexBufferSharedPtr *indexBuffer, size_t *indexBufferUsedSize, bool extrudeVertices, Real extrusionDist, unsigned long flags=0)
 
virtual uint32 getTypeFlags (void) const
 
const AnygetUserAny (void) const
 
UserObjectBindingsgetUserObjectBindings ()
 
const UserObjectBindingsgetUserObjectBindings () const
 
uint32 getVisibilityFlags (void) const
 
bool getVisible (void) const
 
virtual const AxisAlignedBoxgetWorldBoundingBox (bool derive=false) const
 
virtual const SpheregetWorldBoundingSphere (bool derive=false) const
 
bool hasEdgeList (void)
 
bool isAttached (void) const
 
bool isDebugDisplayEnabled (void) const
 
virtual bool isInScene (void) const
 
bool isParentTagPoint () const
 
virtual bool isVisible (void) const
 
const LightListqueryLights (void) const
 
void removeQueryFlags (uint32 flags)
 
void removeVisibilityFlags (uint32 flags)
 
void setCastShadows (bool enabled)
 
void setDebugDisplayEnabled (bool enabled)
 
void setLightMask (uint32 lightMask)
 
void setListener (Listener *listener)
 
void setQueryFlags (uint32 flags)
 
void setRenderingDistance (Real dist)
 
void setRenderingMinPixelSize (Real pixelSize)
 
virtual void setRenderQueueGroup (uint8 queueID)
 
virtual void setRenderQueueGroupAndPriority (uint8 queueID, ushort priority)
 
void setUserAny (const Any &anything)
 
void setVisibilityFlags (uint32 flags)
 
void setVisible (bool visible)
 
- Public Member Functions inherited from Ogre::ShadowCaster
virtual ~ShadowCaster ()
 
- Public Member Functions inherited from Ogre::AnimableObject
 AnimableObject ()
 
virtual ~AnimableObject ()
 
const StringVectorgetAnimableValueNames (void) const
 
- Static Public Member Functions inherited from Ogre::MovableObject
static void clearShadowRenderableList (ShadowRenderableList &shadowRenderables)
 
static void extrudeVertices (const HardwareVertexBufferSharedPtr &vertexBuffer, size_t originalVertexCount, const Vector4 &lightPos, Real extrudeDist)
 
static uint32 getDefaultQueryFlags ()
 
static uint32 getDefaultVisibilityFlags ()
 
static void setDefaultQueryFlags (uint32 flags)
 
static void setDefaultVisibilityFlags (uint32 flags)
 
- Static Public Member Functions inherited from Ogre::ShadowCaster
static void clearShadowRenderableList (ShadowRenderableList &shadowRenderables)
 
static void extrudeVertices (const HardwareVertexBufferSharedPtr &vertexBuffer, size_t originalVertexCount, const Vector4 &lightPos, Real extrudeDist)
 

Detailed Description

A single streaming sound (WAV)

Handles playing a sound from a wav stream.

Constructor & Destructor Documentation

OgreOggSound::OgreOggStreamWavSound::OgreOggStreamWavSound ( const Ogre::String name,
Ogre::SceneManager scnMgr 
)
protected

Constructor

Remarks
Creates a streamed sound object for playing audio directly from a file stream.
Parameters
nameUnique name for sound.
OgreOggSound::OgreOggStreamWavSound::~OgreOggStreamWavSound ( )
protected

Destructor

Member Function Documentation

void OgreOggSound::OgreOggStreamWavSound::_dequeue ( )
protected

Unqueues buffers from the source.

Remarks
Unqueues all data buffers currently queued on the associated source object.
void OgreOggSound::OgreOggStreamWavSound::_openImpl ( Ogre::DataStreamPtr fileStream)
protectedvirtual

Opens audio file.

Remarks
Opens a specified file and checks validity. Reads first chunks of audio data into buffers.
Parameters
filepath string

Implements OgreOggSound::OgreOggISound.

void OgreOggSound::OgreOggStreamWavSound::_pauseImpl ( )
protectedvirtual

Pauses sound.

Remarks
Pauses playback on the source.

Implements OgreOggSound::OgreOggISound.

void OgreOggSound::OgreOggStreamWavSound::_playImpl ( )
protectedvirtual

Plays the sound.

Remarks
Begins playback of all buffers queued on the source. If a source hasn't been setup yet it is requested and initialised within this call.

Implements OgreOggSound::OgreOggISound.

void OgreOggSound::OgreOggStreamWavSound::_prebuffer ( )
protectedvirtual

Prefills buffers with audio data.

Remarks
Loads audio data from the stream into the predefined data buffers and queues them onto the source ready for playback.

Implements OgreOggSound::OgreOggISound.

bool OgreOggSound::OgreOggStreamWavSound::_queryBufferInfo ( )
protectedvirtual

Calculates buffer size and format.

Remarks
Calculates a block aligned buffer size of 250ms using sound properties.

Implements OgreOggSound::OgreOggISound.

void OgreOggSound::OgreOggStreamWavSound::_release ( )
protectedvirtual

Releases buffers and OpenAL objects.

Remarks
Cleans up this sounds OpenAL objects, including buffers and file pointers ready for destruction.

Implements OgreOggSound::OgreOggISound.

void OgreOggSound::OgreOggStreamWavSound::_stopImpl ( )
protectedvirtual

Stops playing sound.

Remarks
Stops playing audio immediately and resets playback. If specified to do so its source will be released also.

Implements OgreOggSound::OgreOggISound.

bool OgreOggSound::OgreOggStreamWavSound::_stream ( ALuint  buffer)
protected

Loads data from the stream into a buffer.

Remarks
Reads a specified chunk of data from the file stream into a designated buffer object.
Parameters
bufferid to load data into.
void OgreOggSound::OgreOggStreamWavSound::_updateAudioBuffers ( )
protectedvirtual

Updates the data buffers with sound information.

Remarks
This function refills processed buffers with audio data from the stream, it automatically handles looping if set.

Implements OgreOggSound::OgreOggISound.

void OgreOggSound::OgreOggStreamWavSound::_updatePlayPosition ( )
protected

handles a request to set the playback position within the stream

Remarks
To ensure thread safety this function performs the request within the thread locked update function instead of 'immediate mode' for static sounds.
float OgreOggSound::OgreOggStreamWavSound::getPlayPosition ( ) const
privatevirtual

Gets the position of the playback cursor in seconds

Reimplemented from OgreOggSound::OgreOggISound.

bool OgreOggSound::OgreOggStreamWavSound::isMono ( )
privatevirtual

Returns whether sound is mono

Implements OgreOggSound::OgreOggISound.

void OgreOggSound::OgreOggStreamWavSound::release ( )
protected

Releases buffers.

Remarks
Cleans up and releases OpenAL buffer objects.
void OgreOggSound::OgreOggStreamWavSound::setLoopOffset ( float  startTime)
privatevirtual

Sets the start point of a loopable section of audio.

Remarks
Allows user to define any start point for a loopable sound, by default this would be 0, or the entire audio data, but this function can be used to offset the start of the loop. NOTE:- the sound will start playback from the beginning of the audio data but upon looping, if set, it will loop back to the new offset position.
Parameters
startTimePosition in seconds to offset the loop point.

Reimplemented from OgreOggSound::OgreOggISound.

void OgreOggSound::OgreOggStreamWavSound::setPlayPosition ( float  seconds)
privatevirtual

Sets the position of the playback cursor in seconds

Parameters
secondsPlay position in seconds

Reimplemented from OgreOggSound::OgreOggISound.

void OgreOggSound::OgreOggStreamWavSound::setSource ( ALuint &  src)
privatevirtual

Sets the source to use for playback.

Remarks
Sets the source object this sound will use to queue buffers onto for playback. Also handles refilling buffers and queuing up.
Parameters
srcSource id.

Implements OgreOggSound::OgreOggISound.

Friends And Related Function Documentation

friend class OgreOggSoundManager
friend

Member Data Documentation

WavFormatData OgreOggSound::OgreOggStreamWavSound::mFormatData
protected
float OgreOggSound::OgreOggStreamWavSound::mLastOffset
protected
unsigned int OgreOggSound::OgreOggStreamWavSound::mLoopOffsetBytes
protected
bool OgreOggSound::OgreOggStreamWavSound::mStreamEOF
protected

Ogg file variables


The documentation for this class was generated from the following file: