Sound Class Reference

#include <Sound.h>

Inheritance diagram for Sound:
ListenerObject

# Public Types

enum  SoundPlaybackTypes
enum  SoundState
typedef const SoundSpec SoundROMSpec

# Public Member Functions

void constructor (const SoundSpec *soundSpec, ListenerObject scope)
const SoundSpecgetSpec ()
void play (const Vector3D *position, uint32 playbackType)
void stop ()
 Stop the playback.
void pause ()
 Pause the playback.
void unpause ()
 Unpause the playback.
void suspend ()
 Suspend the output of sound.
void resume ()
 Resume the output of sound.
void mute ()
 Mute the sound.
void unmute ()
 Unmute the sound.
void rewind ()
 Rewind the playack.
void release ()
 Release this sound.
void lock ()
 Prevent other requests to get a sound to steal this sound's sources.
void unlock ()
 Allow other requests to get a sound to steal this sound's sources.
void autoReleaseOnFinish (bool autoReleaseOnFinish)
void setSpeed (fix7_9_ext speed)
fix7_9_ext getSpeed ()
void setVolumenScalePower (uint8 volumenScalePower)
void setFrequencyDelta (uint16 frequencyDelta)
uint16 getFrequencyDelta ()
 Retrieve the frequency delta added to the VSU's frequency registers.
bool isPlaying ()
bool isPaused ()
bool isFadingIn ()
bool isFadingOut ()
bool updatePlaybackState ()
void update (uint32 elapsedMicroseconds, uint32 targetPCMUpdates)
void print (int32 x, int32 y)
void printPlaybackTime (int32 x, int32 y)
void printPlaybackProgress (int32 x, int32 y)

# Static Public Member Functions

static void setMirror (Mirror mirror)

# Protected Attributes

const SoundSpecsoundSpec
 Pointer to the spec that defines how to initialize the sound.
const Vector3Dposition
 Pointer to vector for spatial positioning of the sound.
VirtualList soundTracks
 List of sound tracks.
SoundTrack mainSoundTrack
 Main sound track.
fix7_9_ext speed
 Playback speed.
uint32 state
 Sound's state.
fix7_9_ext targetTimerResolutionFactor
 Factor to apply to the tick step.
fix7_9_ext tickStep
 Tick step per timer interrupt.
uint32 previouslyElapsedTicks
 Elapsed ticks in the previous update.
uint32 totalPlaybackMilliseconds
 Total playback time.
uint16 pcmTargetPlaybackRefreshRate
 Target refresh rate for PCM playback.
uint16 frequencyDelta
 Delta added to the frequency registers.
uint16 volumeReductionMultiplier
 Multiplier used for fade effects.
int8 volumeReduction
 Volume reduction used for fade effects.
uint8 volumenScalePower
 2's power to divide to the final volume value
uint8 playbackType
 Type of playback to perform (SoundPlaybackTypes)
bool unmute
 If true, sound is not muted.
bool autoReleaseOnFinish
 If true, the sound is released when playback is complete.
bool locked
 If locked, it cannot be released by external calls.

# Additional Inherited Members

- Private Member Functions inherited from ListenerObject
void constructor ()
 Class' constructor.
void destructor ()
 Class' destructor.
void addEventListener (ListenerObject listener, uint16 eventCode)
void removeEventListener (ListenerObject listener, uint16 eventCode)
void removeEventListeners (uint16 eventCode)
void removeAllEventListeners ()
 Remove all listener objects.
bool hasActiveEventListeners ()
void fireEvent (uint16 eventCode)
void sendMessageTo (ListenerObject receiver, uint32 message, uint32 delay, uint32 randomDelay)
void sendMessageToSelf (uint32 message, uint32 delay, uint32 randomDelay)
void discardAllMessages ()
 Discard all messages, both to be sent and to be received.
void discardMessages (uint32 message)
virtual bool onEvent (ListenerObject eventFirer, uint16 eventCode)
virtual bool handleMessage (Telegram telegram)
- Private Attributes inherited from ListenerObject
VirtualList events
 List of registered events.
int8 eventFirings
 Counter that keeps track of the number of fired events to prevent race conditions in nested firings.

# Detailed Description

Class Sound

Inherits from ListenerObject

Implements sound playback.

Definition at line 83 of file Sound.h.

# Member Typedef Documentation

# SoundROMSpec

typedef const SoundSpec SoundROMSpec

A Sound spec that is stored in ROM

Definition at line 72 of file Sound.h.

# Member Enumeration Documentation

# SoundPlaybackTypes

Sound playback types

Definition at line 32 of file Sound.h.

# SoundState

enum SoundState

Sound state

Definition at line 43 of file Sound.h.

# Member Function Documentation

# autoReleaseOnFinish()

void Sound::autoReleaseOnFinish ( bool autoReleaseOnFinish)

Set the flag that allows the sound to auto release itself when playback is complete.

Parameters
autoReleaseOnFinishIf true, the sound is released when playaback is complete

# constructor()

void Sound::constructor ( const SoundSpec * soundSpec,
ListenerObject scope )

Class' constructor

Parameters
soundSpecSpecification that determines how to configure the sound
soundReleaseListenerCallback for when the sound is released
scopeObject that will be notified of sound events

Definition at line 72 of file Sound.c.

# getFrequencyDelta()

uint16 Sound::getFrequencyDelta ( )

Retrieve the frequency delta added to the VSU's frequency registers.

Definition at line 451 of file Sound.c.

# getSpec()

const SoundSpec * Sound::getSpec ( )

Retrieve the spec pointer that defined how to initialized the sound

Returns
Sound spec pointer

Definition at line 132 of file Sound.c.

# getSpeed()

fix7_9_ext Sound::getSpeed ( )

Retrieve the playback's speed.

Returns
Target playback speed

Definition at line 425 of file Sound.c.

# isFadingIn()

bool Sound::isFadingIn ( )

Check if the sound is fading in.

Returns
True if playback fading in

Definition at line 472 of file Sound.c.

# isFadingOut()

bool Sound::isFadingOut ( )

Check if the sound is fading out.

Returns
True if playback fading out

Definition at line 479 of file Sound.c.

# isPaused()

bool Sound::isPaused ( )

Check if the sound is paused.

Returns
True if playback is paused

Definition at line 465 of file Sound.c.

# isPlaying()

bool Sound::isPlaying ( )

Check if the sound is playing.

Returns
True if playback is going on

Definition at line 458 of file Sound.c.

# lock()

void Sound::lock ( )

Prevent other requests to get a sound to steal this sound's sources.

Definition at line 393 of file Sound.c.

# mute()

void Sound::mute ( )

Mute the sound.

Definition at line 337 of file Sound.c.

# pause()

void Sound::pause ( )

Pause the playback.

Definition at line 229 of file Sound.c.

# play()

void Sound::play ( const Vector3D * position,
uint32 playbackType )

Play the sound.

Parameters
positionPointer to the spatial position of the sound
playbackTypeSpecifies how the playback should start

Definition at line 139 of file Sound.c.

# print()

void Sound::print ( int32 x,
int32 y )

Print the sounds's properties.

Parameters
xScreen x coordinate where to print
yScreen y coordinate where to print

Definition at line 625 of file Sound.c.

# printPlaybackProgress()

void Sound::printPlaybackProgress ( int32 x,
int32 y )

Print the sounds's playback progress.

Parameters
xScreen x coordinate where to print
yScreen y coordinate where to print

Definition at line 694 of file Sound.c.

# printPlaybackTime()

void Sound::printPlaybackTime ( int32 x,
int32 y )

Print the sounds's playback time.

Parameters
xScreen x coordinate where to print
yScreen y coordinate where to print

Definition at line 666 of file Sound.c.

# release()

void Sound::release ( )

Release this sound.

Definition at line 378 of file Sound.c.

# resume()

void Sound::resume ( )

Resume the output of sound.

Definition at line 310 of file Sound.c.

# rewind()

void Sound::rewind ( )

Rewind the playack.

Definition at line 351 of file Sound.c.

# setFrequencyDelta()

void Sound::setFrequencyDelta ( uint16 frequencyDelta)

Set the frequency delta to be added to the VSU's frequency registers.

Parameters
frequencyDeltaDelta to be added to the frequency

Definition at line 444 of file Sound.c.

# setMirror()

static void Sound::setMirror ( Mirror mirror)
static

Mirror the spatial positioning of the sound.

Parameters
mirrorStruct with a flag for each axis to mirror

Definition at line 59 of file Sound.c.

# setSpeed()

void Sound::setSpeed ( fix7_9_ext speed)

Set the playback's speed.

Parameters
speedTarget playback speed

Definition at line 414 of file Sound.c.

# setVolumenScalePower()

void Sound::setVolumenScalePower ( uint8 volumenScalePower)

Set the factor (2's power) by which the final volume is reduced.

Parameters
volumenScalePowerFactor by which the final volume is reduced

Definition at line 432 of file Sound.c.

# stop()

void Sound::stop ( )

Stop the playback.

Definition at line 205 of file Sound.c.

# suspend()

void Sound::suspend ( )

Suspend the output of sound.

Definition at line 283 of file Sound.c.

# unlock()

void Sound::unlock ( )

Allow other requests to get a sound to steal this sound's sources.

Definition at line 400 of file Sound.c.

# unmute()

void Sound::unmute ( )

Unmute the sound.

# unpause()

void Sound::unpause ( )

Unpause the playback.

Definition at line 256 of file Sound.c.

# update()

void Sound::update ( uint32 elapsedMicroseconds,
uint32 targetPCMUpdates )

Advance the playback on the sound's native tracks.

Parameters
elapsedMicrosecondsElapsed time since the last call
targetPCMUpdatesIdeal Elapsed time since the last call

Definition at line 522 of file Sound.c.

# updatePlaybackState()

bool Sound::updatePlaybackState ( )

Update the sound playback state.

Returns
False if the sound has been released

Definition at line 486 of file Sound.c.

# Member Data Documentation

# autoReleaseOnFinish

void Sound::autoReleaseOnFinish
protected

If true, the sound is released when playback is complete.

Definition at line 139 of file Sound.h.

# frequencyDelta

uint16 Sound::frequencyDelta
protected

Delta added to the frequency registers.

Definition at line 121 of file Sound.h.

# locked

bool Sound::locked
protected

If locked, it cannot be released by external calls.

Definition at line 142 of file Sound.h.

# mainSoundTrack

SoundTrack Sound::mainSoundTrack
protected

Main sound track.

Definition at line 97 of file Sound.h.

# pcmTargetPlaybackRefreshRate

uint16 Sound::pcmTargetPlaybackRefreshRate
protected

Target refresh rate for PCM playback.

Definition at line 118 of file Sound.h.

# playbackType

uint8 Sound::playbackType
protected

Type of playback to perform (SoundPlaybackTypes)

Definition at line 133 of file Sound.h.

# position

const Vector3D* Sound::position
protected

Pointer to vector for spatial positioning of the sound.

Definition at line 91 of file Sound.h.

# previouslyElapsedTicks

uint32 Sound::previouslyElapsedTicks
protected

Elapsed ticks in the previous update.

Definition at line 112 of file Sound.h.

# soundSpec

const SoundSpec* Sound::soundSpec
protected

Pointer to the spec that defines how to initialize the sound.

Definition at line 88 of file Sound.h.

# soundTracks

VirtualList Sound::soundTracks
protected

List of sound tracks.

Definition at line 94 of file Sound.h.

# speed

fix7_9_ext Sound::speed
protected

Playback speed.

Definition at line 100 of file Sound.h.

# state

uint32 Sound::state
protected

Sound's state.

Definition at line 103 of file Sound.h.

# targetTimerResolutionFactor

fix7_9_ext Sound::targetTimerResolutionFactor
protected

Factor to apply to the tick step.

Definition at line 106 of file Sound.h.

# tickStep

fix7_9_ext Sound::tickStep
protected

Tick step per timer interrupt.

Definition at line 109 of file Sound.h.

# totalPlaybackMilliseconds

uint32 Sound::totalPlaybackMilliseconds
protected

Total playback time.

Definition at line 115 of file Sound.h.

# unmute

void Sound::unmute
protected

If true, sound is not muted.

Definition at line 136 of file Sound.h.

# volumenScalePower

uint8 Sound::volumenScalePower
protected

2's power to divide to the final volume value

Definition at line 130 of file Sound.h.

# volumeReduction

int8 Sound::volumeReduction
protected

Volume reduction used for fade effects.

Definition at line 127 of file Sound.h.

# volumeReductionMultiplier

uint16 Sound::volumeReductionMultiplier
protected

Multiplier used for fade effects.

Definition at line 124 of file Sound.h.


The documentation for this class was generated from the following files:
  • VUEngine-Core/source/Sound/Sound.h
  • VUEngine-Core/source/Sound/Sound.c