## Public API Reference

- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# iSndSysStream Struct Reference
[Sound system, Sound system]

@@ Document me! More...

`#include <isndsys/ss_stream.h>`

Inheritance diagram for iSndSysStream:

[legend]
List of all members.

## Public Member Functions

virtual void | AdvancePosition (csTicks current_time)=0
| NOT AN APPLICATION CALLABLE FUNCTION! This function advances the stream position based on the provided time value which is considered as a "current time".
virtual int | Get3dMode ()=0
| Retrieve the 3D Mode the sound stream was created for.
virtual bool | GetAutoUnregister ()=0
| If AutoUnregister is set, when the stream is paused it, and all sources attached to it are removed from the sound engine.
virtual bool | GetAutoUnregisterRequested ()=0
| Used by the sound renderer to determine if this stream needs to be unregistered.
virtual void | GetDataPointers (size_t *position_marker, size_t max_requested_length, void **buffer1, size_t *buffer1_length, void **buffer2, size_t *buffer2_length)=0
| Used to retrieve pointers to properly formatted sound data.
virtual int | GetLoopState ()=0
| Retrieves the loop state of the stream.
virtual int | GetPauseState ()=0

Returns the PAUSE state of the stream:

- CS_SNDSYS_STREAM_PAUSED - The stream is paused.

virtual int | GetPlayRatePercent ()=0
| Retrieves the playback rate adjustment factor in percent.
virtual size_t | GetPosition ()=0
| Returns the current position of this sound in rendered samples.
virtual iSndSysStream * | GetPtr ()=0
| Retrieve a direct pointer to this object.
virtual const csSndSysSoundFormat * | GetRenderedFormat ()=0
| Get the format of the rendered sound data.
virtual size_t | GetSampleCount ()=0
| Get length of this stream in rendered samples.
virtual void | InitializeSourcePositionMarker (size_t *position_marker)=0
| Fill a long value that will be used to track a Source's position through calls to GetDataPointers().
virtual bool | Pause ()=0
| Pauses the stream at the current position.
virtual bool | ResetPosition ()=0
| Resets the position of the stream to the begining if possible.
virtual void | SetAutoUnregister (bool autounreg)=0
| If AutoUnregister is set, when the stream is paused it, and all sources attached to it are removed from the sound engine.
virtual bool | SetLoopState (int loopstate)=0
| Sets the loop state of the stream.
virtual void | SetPlayRatePercent (int percent)=0
| Set the playback rate adjustment factor in percent.
virtual bool | SetPosition (size_t newposition)=0
| Sets the position of the stream to a particular sample.
virtual bool | Unpause ()=0
| Unpauses the stream and resumes providing data at the current position.

## Detailed Description

@@ Document me!

Definition at line 59 of file ss_stream.h.

## Member Function Documentation

virtual void iSndSysStream::AdvancePosition | ( | csTicks | current_time | ) | `[pure virtual]`

NOT AN APPLICATION CALLABLE FUNCTION! This function advances the stream position based on the provided time value which is considered as a "current time".

A Sound Element will usually store the last advance time internally. When this function is called it will compare the last time with the time presented and retrieve more data from the associated iSound2Data container as needed. It will then update its internal last advance time value.

This function is not necessarily thread safe and must be called ONLY from the Sound System's main processing thread.

virtual int iSndSysStream::Get3dMode | ( |  | ) | `[pure virtual]`

| Retrieve the 3D Mode the sound stream was created for.

virtual bool iSndSysStream::GetAutoUnregister | ( |  | ) | `[pure virtual]`

| If AutoUnregister is set, when the stream is paused it, and all sources attached to it are removed from the sound engine.

virtual bool iSndSysStream::GetAutoUnregisterRequested | ( |  | ) | `[pure virtual]`

| Used by the sound renderer to determine if this stream needs to be unregistered.

virtual void iSndSysStream::GetDataPointers | ( | size_t * | position_marker,
|  | size_t | max_requested_length,
|  | void ** | buffer1,
|  | size_t * | buffer1_length,
|  | void ** | buffer2,
|  | size_t * | buffer2_length
| ) | `[pure virtual]`

Used to retrieve pointers to properly formatted sound data.

Since a Stream may be attached to multiple Sources, it will be most optimal to perform any decoded-data buffering at the stream level. The parameters passed to GetDataPointers() should allow for proper interface to a cyclic buffering method to store this decoded-data.

Since the data in the Stream buffer(s) and data related to how the buffers are accessed may change when AdvancePosition() is called, this function is not safe to call while AdvancePosition() is in operation. For this reason it is only safe to be called from the same thread that calls AdvancePosition() - specifically the Sound System main processing thread.

Parameters:

  | position_marker | Should point to a long initially filled by the Sound System internally when a Source is created - through a call to InitializeSourcePositionMarker().
  | max_requested_length | Should contain the maximum number of bytes the calling source is interested in receiving. On return, *buffer1_length + *buffer2_length must not exceed this value.
  | buffer1 | should point to a (void *) that will be filled with a pointer to the first chunk of data on return or NULL (0) if no data is available
  | buffer1_length | should point to a long that will be filled with the length of valid data in the buffer pointed to by *buffer1 on return.
  | buffer2 | should point to a (void *) that will be filled with a pointer to the second chunk of data on return, or NULL (0) if no second chunk is needed.
  | buffer2_length | should point to a long that will be filled with the length of valid data in the buffer pointed to by *buffer1 on return.

Remarks:
  Not intended to be called by an application.

virtual int iSndSysStream::GetLoopState | ( |  | ) | `[pure virtual]`

| Retrieves the loop state of the stream. Current possible returns are CS_SNDSYS_STREAM_DONTLOOP and CS_SNDSYS_STREAM_LOOP.

virtual int iSndSysStream::GetPauseState | ( |  | ) | `[pure virtual]`

Returns the PAUSE state of the stream:

- CS_SNDSYS_STREAM_PAUSED - The stream is paused.

- CS_SNDSYS_STREAM_UNPAUSED - The stream is not paused. AdvancePosition is moving the stream position.

virtual int iSndSysStream::GetPlayRatePercent | ( |  | ) | `[pure virtual]`

| Retrieves the playback rate adjustment factor in percent. 100 = 100% (normal speed)

virtual size_t iSndSysStream::GetPosition | ( |  | ) | `[pure virtual]`

Returns the current position of this sound in rendered samples.

This should return a valid value even if GetSampleCount() returns CS_SNDSYS_STREAM_UNKNOWN_LENGTH since an object implementing this interface should know its position relative to the begining of the data. In the case where the begining may be ambiguous it should be considered to be at the point where the stream first started. In other words, where there is doubt, the position should start at 0 and advance as the position advances.

virtual iSndSysStream* iSndSysStream::GetPtr | ( |  | ) | `[pure virtual]`

| Retrieve a direct pointer to this object.

virtual const csSndSysSoundFormat* iSndSysStream::GetRenderedFormat | ( |  | ) | `[pure virtual]`

| Get the format of the rendered sound data. This is for informational purposes only.

virtual size_t iSndSysStream::GetSampleCount | ( |  | ) | `[pure virtual]`

| Get length of this stream in rendered samples. May return CS_SNDSYS_STREAM_UNKNOWN_LENGTH if the stream is of unknown length. For example, sound data being streamed from a remote host may not have a pre-determinable length.

virtual void iSndSysStream::InitializeSourcePositionMarker | ( | size_t * | position_marker | ) | `[pure virtual]`

Fill a long value that will be used to track a Source's position through calls to GetDataPointers().

Remarks:
  Not intended to be called by an application.

virtual bool iSndSysStream::Pause | ( |  | ) | `[pure virtual]`

Pauses the stream at the current position.

Data will not be provided through the GetData() call beyond the point of pausing. AdvancePosition() will NOT adjust the position of the stream.

If either of the above conditions cannot be met, this call fails and returns FALSE. The sound element should continue operation as though this call were not made. For example, a stream coming from a remote host may not be able to be stopped or advance-buffered properly, in this case pausing the stream is not possible, and this function should return FALSE.

virtual bool iSndSysStream::ResetPosition | ( |  | ) | `[pure virtual]`

| Resets the position of the stream to the begining if possible. FALSE may be returned if a reset operation is not permitted or not possible.

virtual void iSndSysStream::SetAutoUnregister | ( | bool | autounreg | ) | `[pure virtual]`

| If AutoUnregister is set, when the stream is paused it, and all sources attached to it are removed from the sound engine.

virtual bool iSndSysStream::SetLoopState | ( | int | loopstate | ) | `[pure virtual]`

| Sets the loop state of the stream. Current acceptable values are CS_SNDSYS_STREAM_DONTLOOP and CS_SNDSYS_STREAM_LOOP May return FALSE if looping is not supported

virtual void iSndSysStream::SetPlayRatePercent | ( | int | percent | ) | `[pure virtual]`

| Set the playback rate adjustment factor in percent. 100 = 100% (normal speed)

virtual bool iSndSysStream::SetPosition | ( | size_t | newposition | ) | `[pure virtual]`

| Sets the position of the stream to a particular sample. FALSE may be returned if a set position operation is not permitted or not possible.

virtual bool iSndSysStream::Unpause | ( |  | ) | `[pure virtual]`

| Unpauses the stream and resumes providing data at the current position. If the stream is not currently paused this function returns FALSE.

The documentation for this struct was generated from the following file:

- isndsys/ss_stream.h