FMExStreamSentence Class
This class is used to "stitch" multiple FMExStream instances into one continuous and gapless stream. The FMExStream objects used as sentence fragments are actually clones, so the original streams can still be used independently if needed. Sentence fragments can also be replaced at any time, enabling a ring-buffer-stream capable of endless gapless playback, making this class ideal for dynamic and context sensitive music or narration.
Important: Use the FMEx.CreateStreamSentence method to create FMExStreamSentence instances, passing a list or array of FMExStream objects to be stitched. This class cannot be constructed using the New keyword.
Important: All the FMExStream objects used as sentence fragments must be non-nil and valid, and have the same frequency, bit depth, and number of channels. I.e. If the first stream fragment is 44.1KHz/16bit Mono format, the rest must also be 44.1KHz/16bit Mono format. It is also illegal to use FMExStreamSentence instances as fragments. Be sure to monitor FMOD Ex's error output should you encounter playback problems.
Important: You must successfully initialize FMOD Ex via the FMEx.StartUp method before creating FMExStreamSentence objects. Also note that all existing FMExStreamSentence instances become invalidated after calling FMEx.ShutDown. Please see the Restarting FMOD Ex section for details on how to properly restart FMOD Ex should the need arise.
Properties
-
CurrentFragmentIndex As Integer
Returns the currently buffered Fragment index. This property can be polled to determine when it's safe to replace a fragment without interrupting playback. Note that the buffered fragment may not necessarily be the currently audible stream.
Tip: To create a sentence of indefinite length, create an FMExStreamSentence containing two fragments and begin looping the playback. This property can then be polled to determine when to swap each fragment as the other plays. -
Fragment ( n ) As FMExStream
A write-only array of sentence fragments available for playback. The members of this array are initialized when the stream-sentence is created, and this array is fixed-size for the lifetime of the sentence object. Valid Fragment indexes range from zero to FragmentCount-1.
Note: Although you can freely replace members of this array with other streams, you can not read them back, or assign Nil to any member, nor can you assign an FMExStreamSentence instance to any member. Some of these limitations may be addressed in future releases. -
FragmentCount As Integer
Returns the number of stream fragments allocated in the Fragment array.
Methods
-
FragmentPlaybackOrder ( order( ) As Integer )
This method basically defines a "playlist", accepting an array or loose list (ParamArray) of Fragment array indexes that define the order in which the fragment streams are stitched for playback. The index array or list can be any size, and individual fragments can be referenced multiple times, or not at all in this playlist. Valid Fragment indexes range from zero to FragmentCount-1.