Torque 3D 3.7
SFXInternal Namespace

@file Mostly internal definitions for sound stream handling. The code here is used by SFXBuffer for asynchronously loading sample data from sound files, both for streaming buffers as well as for "normal" buffers. 

This is all pretty low-level code here.

The following table lists classes in this documentation. 
The following table lists functions in this documentation. 
The following table lists types in this documentation. 
The following table lists variables in this documentation. 
An async stream queue that writes sound packets to SFXBuffers in sync to the playback of an SFXVoice.
Sound packet queues use sample counts as tick counts. 
Asynchronous sound data stream that delivers sound data in discrete packets. 
Sound stream packets are raw byte buffers containing PCM sample data
Thread pool for sound I/O.
We are using a separate pool for sound packets in order to be able to submit packet items from different threads. This would violate the invariant of the global thread pool that only the main thread is feeding the queues.
Note that this also means that only at certain very well-defined points is it possible to safely flush the work item queue on this pool.
@note Don't use this directly but rather use THREAD_POOL() instead. This way, the sound code may be easily switched to using a common pool later on. 
Wrapper around SFXVoice that yields the raw underlying sample position rather than the virtualized position returned by SFXVoice::getPosition(). 
Buffer that uses wrap-around packet buffering.
This class automatically coordinates retrieval and submitting of sound packets and also protects against play cursors running beyond the last packet by making sure some silence is submitted after the last packet (does not count towards playback time).
@note Note that the reaction times of this class depend on the SFXDevice triggering timely SFXBuffer:update() calls. 
Delete all buffers currently on the dead buffer list. 
This is type SFXInternal::SFXBufferProcessList. 
This is type SFXInternal::SFXUpdateThread. 
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. 
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... more 
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
Copyright (c) 2015. All rights reserved.
What do you think about this topic? Send feedback!