Currently, device must always be
NULL to indicate that the default
playback device should be used.
| Class Overview |
BStreamingGameSound(size_t inBufferFrameCount,
const gs_audio_format* format,
size_t inBufferCount = 2,
BGameSoundDevice* device = NULL);
protected BStreamingGameSound(BGameSoundDevice device);
Prepares the object to play streamed audio.
inBufferFrameCount specifies the number of frames
each audio buffer should be able to hold. format
indicates the audio format that will be streamed.
inBufferCount specifies the number of buffers to
use, and, as always, device is the sound device to
use for playback.
By default, two audio buffers are used.
Currently, device must always be
NULL to indicate that the default
playback device should be used.
virtual void FillBuffer(void* inBuffer,
size_t byteCount);
Fills the buffer specified by inBuffer with byteCount bytes of audio data.
In the BStreamingGameSound implemenation, this function calls the stream
hook, if one exists.
See also: SetStreamHook()
status_t InitCheck() const;Returns a status_t indicating whether or not the object was successfully instantiated.
| Return Code | Description |
|---|---|
| The sound was successfully initialized. |
| Unable to create a sound player. |
Other errors. | The sound player may return errors. |
See also: the BStreamingGameSound
constructor
bool Lock();void Unlock();
Lock() locks the BStreamingGameSound to prevent unpleasant collisions in
the land of multithreadedness; it returns true if it was able to lock the
object, otherwise false is returned. Unlock() releases the lock.
virtual status_t SetAttributes(gs_attribute* inAttributes,
size_t inAttributeCount);
SetAttributes() is implemented to disallow the B_GS_LOOPING attribute,
since streamed sounds can't loop.
See also:
BGameSound::SetAttributes()
virtual status_t SetParameters(size_t inBufferFrameCount,
const gs_audio_format* fmt,
size_t inBufferCount);
Changes the BStreamingGameSound object's parameters. This lets you change
the buffer size, audio format, and number of buffers after the object has
been instantiated.
| Return Code | Description |
|---|---|
| No error. |
| Couldn't change the parameters. |
virtual status_t SetStreamHook(void (*hook)(void * cookie, void* inBuffer, size_t byteCount, BStreamingGameSound* object),
void* cookie);Specfies the hook function to be called to fill buffers with audio data.
The inputs to the hook function are:
| Parameter | Description |
|---|---|
| A user-defined value. Indicates the cookie pointer that will be passed to the hook function. |
| A pointer to the buffer to be filled with audio data. |
| The size of the buffer in bytes. |
| A pointer to the |
And returns...
| Return Code | Description |
|---|---|
| The hook function was set without error. |