Platform_Sound_SoundStream Class Reference
[Platform]
Platform independent abstraction of a soundstream.
More...

Public Member Functions | |
| virtual | ~Platform_Sound_SoundStream () |
| virtual int | GetChannels ()=0 |
| virtual int | GetFrequency ()=0 |
| virtual int | GetBitsPerSample ()=0 |
| virtual int | GetSize ()=0 |
| virtual void | Play ()=0 |
| virtual void | Stop ()=0 |
| virtual int | GetPosition ()=0 |
| virtual void | SetPosition (int position)=0 |
| virtual float | GetVolume ()=0 |
| virtual void | SetVolume (float level)=0 |
| virtual void | ClearBuffer (int bufferOffset, int bytesToClear)=0 |
| virtual void | CopySoundToBuffer (int bufferOffset, const void *soundData, int bytesToCopy)=0 |
Detailed Description
Platform independent abstraction of a soundstream.Implements a sound channel for streaming sound. The idea is that you create a soundstream, fill it with the first bit of data from your sound, and then start playing it. You then monitor its current position, and when it's gone past half the buffer size, you fill in the first half of the buffer with more sound data, keep monitoring the buffer, and when the position have wrapped around, you fill the second half with more data, and so on. This means you can use and reuse soundstreams, and play both short and long sounds, or even music, with any soundstream.
Definition at line 27 of file Platform_Sound_SoundStream.h.
Constructor & Destructor Documentation
| virtual Platform_Sound_SoundStream::~Platform_Sound_SoundStream | ( | ) | [virtual] |
Destructor
Definition at line 33 of file Platform_Sound_SoundStream.h.
Member Function Documentation
| virtual int Platform_Sound_SoundStream::GetChannels | ( | ) | [pure virtual] |
Retrieves the number of channels this sound stream was created with.
- Returns:
- The number of channels, 1=mono, 2=stereo
Implemented in Platform_NULL_Sound_SoundStream, Platform_Win32_Sound_SoundStream_DSound, Platform_Win32_Sound_SoundStream_NoSound, and Platform_Win32_Sound_SoundStream_WMM.
| virtual int Platform_Sound_SoundStream::GetFrequency | ( | ) | [pure virtual] |
Retrieves the frequency (samples per second) this sound stream was created with. Typical values for this is 11025 (11 kHz), 22050 (22 kHz) or 44100 (44 kHz, CD-quality).
- Returns:
- The number of samples per second
Implemented in Platform_NULL_Sound_SoundStream, Platform_Win32_Sound_SoundStream_DSound, Platform_Win32_Sound_SoundStream_NoSound, and Platform_Win32_Sound_SoundStream_WMM.
| virtual int Platform_Sound_SoundStream::GetBitsPerSample | ( | ) | [pure virtual] |
Retrieves the number of bits per sample which this sound stream was created with. This is typically 8 or 16 bits.
- Returns:
- The number of bits per sample (typically 8 or 16)
Implemented in Platform_NULL_Sound_SoundStream, Platform_Win32_Sound_SoundStream_DSound, Platform_Win32_Sound_SoundStream_NoSound, and Platform_Win32_Sound_SoundStream_WMM.
| virtual int Platform_Sound_SoundStream::GetSize | ( | ) | [pure virtual] |
Retrieves the number of bytes allocated for this sound streams buffer.
- Returns:
- The size of the sound stream buffer in bytes
Implemented in Platform_NULL_Sound_SoundStream, Platform_Win32_Sound_SoundStream_DSound, Platform_Win32_Sound_SoundStream_NoSound, and Platform_Win32_Sound_SoundStream_WMM.
| virtual void Platform_Sound_SoundStream::Play | ( | ) | [pure virtual] |
Starts playing the sound stream, from whatever position it is currently at. The stream will keep playing and loop when it's reached the end, until the Stop method is called. The GetPosition method can be called to monitor the current position in the stream, and if looping is not desired, Stop should be called when the position have reached the end of the stream buffer.
Implemented in Platform_NULL_Sound_SoundStream, Platform_Win32_Sound_SoundStream_DSound, Platform_Win32_Sound_SoundStream_NoSound, and Platform_Win32_Sound_SoundStream_WMM.
| virtual void Platform_Sound_SoundStream::Stop | ( | ) | [pure virtual] |
Pause the playback, and keeps the position so that the next call to Play will resume from the last point.
Implemented in Platform_NULL_Sound_SoundStream, Platform_Win32_Sound_SoundStream_DSound, Platform_Win32_Sound_SoundStream_NoSound, and Platform_Win32_Sound_SoundStream_WMM.
| virtual int Platform_Sound_SoundStream::GetPosition | ( | ) | [pure virtual] |
Retrieves the current position in the sound stream buffer of the playback.
- Returns:
- The current position
Implemented in Platform_NULL_Sound_SoundStream, Platform_Win32_Sound_SoundStream_DSound, Platform_Win32_Sound_SoundStream_NoSound, and Platform_Win32_Sound_SoundStream_WMM.
| virtual void Platform_Sound_SoundStream::SetPosition | ( | int | position | ) | [pure virtual] |
Sets the playback position. Must be in the range from 0 to the size of the sound stream buffer. There is no need to call Stop/Play for it to take effect.
- Parameters:
-
position The new position
Implemented in Platform_NULL_Sound_SoundStream, Platform_Win32_Sound_SoundStream_DSound, Platform_Win32_Sound_SoundStream_NoSound, and Platform_Win32_Sound_SoundStream_WMM.
| virtual float Platform_Sound_SoundStream::GetVolume | ( | ) | [pure virtual] |
Retrieves the current volume level, in the range 0 to 1. This is a linear volume level value, where 0 is silent and 1 is full volume.
- Returns:
- The current volume
Implemented in Platform_NULL_Sound_SoundStream, Platform_Win32_Sound_SoundStream_DSound, Platform_Win32_Sound_SoundStream_NoSound, and Platform_Win32_Sound_SoundStream_WMM.
| virtual void Platform_Sound_SoundStream::SetVolume | ( | float | level | ) | [pure virtual] |
Sets the current volume level, in the range 0 to 1. This is a linear volume level value, where 0 is silent and 1 is full volume.
Implemented in Platform_NULL_Sound_SoundStream, Platform_Win32_Sound_SoundStream_DSound, Platform_Win32_Sound_SoundStream_NoSound, and Platform_Win32_Sound_SoundStream_WMM.
| virtual void Platform_Sound_SoundStream::ClearBuffer | ( | int | bufferOffset, | |
| int | bytesToClear | |||
| ) | [pure virtual] |
Clears the specified part of the sound streams buffer. bufferOffset + bytesToClear should be less than the value returned by GetSize
- Parameters:
-
bufferOffset Where in the sound stream buffer to clearing bytesToClear Number of bytes to clear
Implemented in Platform_NULL_Sound_SoundStream, Platform_Win32_Sound_SoundStream_DSound, Platform_Win32_Sound_SoundStream_NoSound, and Platform_Win32_Sound_SoundStream_WMM.
| virtual void Platform_Sound_SoundStream::CopySoundToBuffer | ( | int | bufferOffset, | |
| const void * | soundData, | |||
| int | bytesToCopy | |||
| ) | [pure virtual] |
Copies raw sound data to the sound streams buffer, starting at bufferOffset. The data is copied from the soundData pointer, for a total of bytesToCopy number of bytes. bufferOffset + bytesToClear should be less than the value returned by GetSize. The format of the data is interleaved raw sound samples, as specified by the combination of channels, frequency and bits per sample.
- Parameters:
-
bufferOffset Where in the sound stream buffer to start copying data to soundData Sound data to copy into the sound stream buffer bytesToCopy Number of bytes to copy
Implemented in Platform_NULL_Sound_SoundStream, Platform_Win32_Sound_SoundStream_DSound, Platform_Win32_Sound_SoundStream_NoSound, and Platform_Win32_Sound_SoundStream_WMM.
Reproduction/republishing of any material on this site without permission is strictly prohibited.
