SFXInternal

Engine/source/sfx/sfxBuffer.h

More...

Classes:

class

An async stream queue that writes sound packets to SFXBuffers in sync to the playback of an SFXVoice.

class

Asynchronous sound data stream that delivers sound data in discrete packets.

class

Sound stream packets are raw byte buffers containing PCM sample data.

class
class

Wrapper around SFXVoice that yields the raw underlying sample position rather than the virtualized position returned by SFXVoice::getPosition().

class

Buffer that uses wrap-around packet buffering.

Public Enumerations

enum
_Anonymous_ {
  MAIN_THREAD_PROCESS_TIMEOUT = 512
  DEFAULT_UPDATE_INTERVAL = 512
}

Public Typedefs

SFXBufferProcessList 
SFXUpdateThread 

Public Variables

List of buffers that need updating.

List of buffers that are pending deletion.

Dedicated thread that does sound buffer updates.

Public Functions

bool

Return true if the current thread is the one responsible for doing SFX updates.

Delete all buffers currently on the dead buffer list.

Return the thread pool used for SFX work.

bool

Trigger an SFX update.

Return the processing list for SFXBuffers that need updating.

Return the dedicated SFX update thread; NULL if updating on the main thread.

Detailed Description

Public Enumerations

@168

Enumerator

MAIN_THREAD_PROCESS_TIMEOUT = 512

Soft limit on milliseconds to spend on updating sound buffers when doing buffer updates on the main thread.

DEFAULT_UPDATE_INTERVAL = 512

Default time interval between periodic sound updates in milliseconds.

Only relevant for devices that perform periodic updates.

Public Typedefs

typedef AsyncUpdateList SFXBufferProcessList 
typedef AsyncUpdateThread SFXUpdateThread 

Public Variables

ThreadSafeRef< SFXBufferProcessList > gBufferUpdateList 

List of buffers that need updating.

It depends on the actual device whether this list is processed on a stream update thread or on the main thread.

ThreadSafeDeque< SFXBuffer * > gDeadBufferList 

List of buffers that are pending deletion.

This is a messy issue. Buffers with live async states cannot be instantly deleted since they may still be running concurrent updates. However, they also cannot be deleted on the update thread since the StrongRefBase stuff isn't thread-safe (i.e weak references kept by client code would cause trouble).

So, what we do is mark buffers for deletion, wait till they surface on the process list and then ping them back to this list to have them deleted by the SFXDevice itself on the main thread. A bit of overhead but only a fraction of the buffers will ever undergo this procedure.

ThreadSafeRef< SFXUpdateThread > gUpdateThread 

Dedicated thread that does sound buffer updates.

May be NULL if sound API used does not do asynchronous buffer updates but rather uses per-frame polling.

note:

SFXDevice automatically polls if this is NULL.

Public Functions

isSFXThread()

Return true if the current thread is the one responsible for doing SFX updates.

PurgeDeadBuffers()

Delete all buffers currently on the dead buffer list.

THREAD_POOL()

Return the thread pool used for SFX work.

TriggerUpdate()

Trigger an SFX update.

UPDATE_LIST()

Return the processing list for SFXBuffers that need updating.

UPDATE_THREAD()

Return the dedicated SFX update thread; NULL if updating on the main thread.