"L. Spiro Engine"
Classes | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes

lss::CStreamingSoundSource Class Reference

A source used with streaming audio data. More...

#include <LSSStreamingSoundSource.h>

List of all members.

Classes

struct  LSS_STREAMING_BUFFER

Public Member Functions

LSE_CALLCTOR CStreamingSoundSource (LSUINT32 _ui32Id)
virtual LSS_SOUND_SOURCE LSE_CALL GetType () const
virtual LSBOOL LSE_CALL Static () const
virtual LSVOID LSE_CALL SetBuffer (const CSoundBuffer *_psbBuffer)
LSBOOL LSE_CALL CreateStream (const IStreamingSoundSourceStreamer *_pssssSource, CAllocator *_paAllocator)
LSVOID LSE_CALL Reset ()
virtual LSVOID LSE_CALL Tick (LSUINT64 _ui64TimeSinceLastUpdate)
virtual LSBOOL LSE_CALL Play (LSUINT32 _ui32LoopCount)
const
IStreamingSoundSourceStreamer
*LSE_CALL 
GetStreamer () const
virtual LSBOOL LSE_CALL CanSoftReset () const

Protected Types

typedef struct
lss::CStreamingSoundSource::LSS_STREAMING_BUFFER
LPLSS_STREAMING_BUFFER
typedef struct
lss::CStreamingSoundSource::LSS_STREAMING_BUFFER 
LPCLSS_STREAMING_BUFFER
typedef CVectorPoD
< LSS_STREAMING_BUFFER
LSS_STREAMING_BUFFER_LIST
typedef CVectorPoD
< LSS_STREAMING_BUFFER > * 
LPLSS_STREAMING_BUFFER_LIST
typedef CVectorPoD
< LSS_STREAMING_BUFFER >
*const 
LPCLSS_STREAMING_BUFFER_LIST

Protected Member Functions

LSVOID LSE_CALL SetSource (const IStreamingSoundSourceStreamer *_pssssSource)
LSVOID LSE_CALL CheckQueue ()
LSVOID LSE_CALL CheckUnqueue ()
LSUINT32 LSE_CALL GetOldestBufferIndex () const
LSUINT32 LSE_CALL GetFreeBuffer () const
LSBOOL LSE_CALL Buffer (LSUINT64 _ui64From, LSUINT64 _ui64Length)
LSVOID LSE_CALL UnBuffer (LSUINT32 _ui32Index)
virtual LSBOOL LSE_CALL DeviceActivated ()
virtual LSVOID LSE_CALL DeviceWillClose ()

Protected Attributes

LSS_STREAMING_BUFFER_LIST m_sblBuffers
CAllocator * m_paAllocator
const
IStreamingSoundSourceStreamer
m_pssssSource
LSUINT64 m_ui64BufferSize
LSUINT64 m_ui64Queued
LSBOOL m_bHaveDevice

Detailed Description

A source used with streaming audio data.

Class CStreamingSoundSource Description: A source used for streaming. Provides an interface for continuous loading of buffer data in order to keep the sound playing. By default, streaming sounds ignore soft resets.


Member Typedef Documentation

The buffers used by CStreamingSoundSource.

A list of LSS_STREAMING_BUFFER objects.


Member Function Documentation

LSBOOL LSE_CALL lss::CStreamingSoundSource::Buffer ( LSUINT64  _ui64From,
LSUINT64  _ui64Length 
) [protected]

Buffer a given amount of time in the sound. This function finds the first available buffer and attempts to buffer the requested data into it.

Parameters:
_ui64FromTime at the beginning of the buffer, in microseconds.
_ui64LengthLength to buffer, in microseconds.
Returns:
If buffering failed or there are no available buffers, returns false.
virtual LSBOOL LSE_CALL lss::CStreamingSoundSource::CanSoftReset ( ) const [virtual]

Set the value indicating whether this source should resist soft resets or not. A soft reset is a reset that stops sources that do not resist soft resets, then releases all unreferenced data (sources/buffers). This is not the same as a soft unload, which can happen at any time just to save RAM and works only on expired data. A soft reset will stop sources that do not resist the stopping action by returning true via this function.

Returns:
Returns false. Override this class to return any other value.
LSVOID LSE_CALL lss::CStreamingSoundSource::CheckQueue ( ) [protected]

Check to see if we need to queue any buffers. If so, buffers are automatically queued.

LSVOID LSE_CALL lss::CStreamingSoundSource::CheckUnqueue ( ) [protected]

Check for buffers that need to be unqueued. If any are found, they are unqueued.

LSBOOL LSE_CALL lss::CStreamingSoundSource::CreateStream ( const IStreamingSoundSourceStreamer _pssssSource,
CAllocator *  _paAllocator 
)

Create a stream of audio using the provided IStreamingSoundSourceStreamer interface.

Parameters:
_pssssSourceThe interface that provides this class with the data it needs to stream audio.
_paAllocatorThe allocator to be used for all allocations made by this class. Must not be NULL.
Returns:
Returns true if the creation of the sound stream succeeded.
virtual LSBOOL LSE_CALL lss::CStreamingSoundSource::DeviceActivated ( ) [protected, virtual]

A device has been created. We can register with the hardware. The sound manager notifies us of this event after the device has been changed. If there is a device already when we are created, we are notified via this function immediately after being created.

Returns:
Returns false if there is an error uploading our sound data to the hardware.
virtual LSVOID LSE_CALL lss::CStreamingSoundSource::DeviceWillClose ( ) [protected, virtual]

Notifies us that the device is about to be lost (changed). We need to sever our connections to it, although we may retain our data/ settings.

LSUINT32 LSE_CALL lss::CStreamingSoundSource::GetFreeBuffer ( ) const [protected]

Find the first free buffer.

Returns:
Returns the first free buffer.
LSUINT32 LSE_CALL lss::CStreamingSoundSource::GetOldestBufferIndex ( ) const [protected]

Get the oldest buffer still active.

Returns:
Returns the index of the running buffer with the lowest time stamp. If no buffers are living, ~0UL is returned.
const IStreamingSoundSourceStreamer* LSE_CALL lss::CStreamingSoundSource::GetStreamer ( ) const

Get the streamer associated with this sound stream.

Returns:
Returns the streamer used by this source, which may be NULL.
virtual LSS_SOUND_SOURCE LSE_CALL lss::CStreamingSoundSource::GetType ( ) const [virtual]

Get the type of this source.

Returns:
Returns one of the LSS_SOUND_SOURCE values.
virtual LSBOOL LSE_CALL lss::CStreamingSoundSource::Play ( LSUINT32  _ui32LoopCount) [virtual]

Begin playing the sound. If there is no data source, returns false. The sound plays regardless of whether or not there is a sound device. If there is no sound device, the sound will begin playing at the correct position when a device becomes active. The sound begins playing on the next tick event.

Parameters:
_ui32LoopCountNumber of times to loop the sound.
Returns:
Returns true if the play was successful. A return of false indicates that no data source was applied to this source.
LSVOID LSE_CALL lss::CStreamingSoundSource::Reset ( )

Reset the stream. Deallocates everything.

virtual LSVOID LSE_CALL lss::CStreamingSoundSource::SetBuffer ( const CSoundBuffer _psbBuffer) [virtual]

This class uses its own private buffers internally. We override this function to make it a do-nothing function.

Parameters:
_psbBufferNot used.
LSVOID LSE_CALL lss::CStreamingSoundSource::SetSource ( const IStreamingSoundSourceStreamer _pssssSource) [protected]

Set the source source.

Parameters:
_pssssSourceThe source to use for the data we need to operate as a streaming sound source.
virtual LSBOOL LSE_CALL lss::CStreamingSoundSource::Static ( ) const [virtual]

Is this source static (non-streaming)?

Returns:
Returns true if the source is static, false if streaming.
virtual LSVOID LSE_CALL lss::CStreamingSoundSource::Tick ( LSUINT64  _ui64TimeSinceLastUpdate) [virtual]

Update the source. This usually entails checking the dirty flag and updating the hardware accordingly. Time is given in microseconds.

Parameters:
_ui64TimeSinceLastUpdateMicroseconds by which to update.
LSVOID LSE_CALL lss::CStreamingSoundSource::UnBuffer ( LSUINT32  _ui32Index) [protected]

Unbuffer an a buffer.

Parameters:
_ui32IndexThe index of the buffer to remove.

Member Data Documentation

Allocator we use. May not be NULL.

The 4 buffers we used for streaming.


The documentation for this class was generated from the following file:
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator