v1.1.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Modules Pages
Public Types | Public Member Functions | Static Public Attributes | List of all members
Sifteo::AudioChannel Struct Reference

One mixer channel, capable of playing AudioAssets. More...

#include <sifteo/audio.h>

Public Types

enum  LoopMode { UNDEF_LOOP = _SYS_LOOP_UNDEF, ONCE = _SYS_LOOP_ONCE, REPEAT = _SYS_LOOP_REPEAT }
 Loop modes available for use in play() More...
 

Public Member Functions

 AudioChannel ()
 Default constructor. More...
 
 AudioChannel (AudioChannelID id)
 Initialize an AudioChannel with a concrete value. More...
 
void init (AudioChannelID id)
 Initialize a channel by assignging it an ID. More...
 
bool isPlaying () const
 Is this channel currently playing a sample?
 
void pause () const
 Pause the currently playing sample in this channel. More...
 
bool play (const AssetAudio &asset, LoopMode loopMode=UNDEF_LOOP) const
 Begin playback of a sample. More...
 
void resume () const
 Resume playback on this channel. More...
 
void setSpeed (unsigned hz) const
 Sets the speed of this channel, in samples per second. More...
 
void setVolume (int volume) const
 
void stop () const
 Stop playback of the current sample. More...
 
int volume () const
 Get the current volume for this channel.
 

Static Public Attributes

static const int32_t MAX_VOLUME = _SYS_AUDIO_MAX_VOLUME
 The maximum volume for an AudioChannel.
 
static const AudioChannelID NUM_CHANNELS = _SYS_AUDIO_MAX_CHANNELS
 The maximum number of supported AudioChannels in the system.
 
static const AudioChannelID UNDEFINED = _SYS_AUDIO_INVALID_CHANNEL_ID
 A reserved ID, used to mark undefined AudioChannels.
 

Detailed Description

One mixer channel, capable of playing AudioAssets.

Supported sample formats are ADPCM and standard PCM format. stir processes your audio samples as part of the application packaging process.

Constructor & Destructor Documentation

Sifteo::AudioChannel::AudioChannel ( )
inline

Default constructor.

By default, an AudioChannel is initialized to a special UNDEFINED value - initialize this value via init() before using the channel.

Sifteo::AudioChannel::AudioChannel ( AudioChannelID  id)
inline

Initialize an AudioChannel with a concrete value.

If you use this constructor, there is no need to call init().

Parameters
idmust be in the range 0 to NUM_CHANNELS - 1

Member Function Documentation

void Sifteo::AudioChannel::init ( AudioChannelID  id)
inline

Initialize a channel by assignging it an ID.

Parameters
idmust be in the range 0 to NUM_CHANNELS - 1
void Sifteo::AudioChannel::pause ( ) const
inline

Pause the currently playing sample in this channel.

Has no effect if a sample is not currently playing.

bool Sifteo::AudioChannel::play ( const AssetAudio asset,
LoopMode  loopMode = UNDEF_LOOP 
) const
inline

Begin playback of a sample.

Parameters
assetspecifies the audio asset to playback.
loopModespecifies
void Sifteo::AudioChannel::resume ( ) const
inline

Resume playback on this channel.

XXX: this may go away in favor of play()

void Sifteo::AudioChannel::setSpeed ( unsigned  hz) const
inline

Sets the speed of this channel, in samples per second.

To determine the default speed for an audio sample, you can use AssetAudio::speed().

void Sifteo::AudioChannel::setVolume ( int  volume) const
inline

Sets the volume for this channel. May be applied when the channel is either stopped or playing.

Parameters
volumefrom 0 to MAX_VOLUME
void Sifteo::AudioChannel::stop ( ) const
inline

Stop playback of the current sample.

Has no effect if a sample is not currently playing.


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