PixelLightAPI  .
Public Types | Public Member Functions | Protected Member Functions
PLSound::Source Class Reference

Abstract sound source resource. More...

#include <Source.h>

Inheritance diagram for PLSound::Source:
Inheritance graph
[legend]

List of all members.

Public Types

enum  EFlags { NoMasterPitch = 1<<0 }
 Sound source flags. More...
enum  EAttributes { Position = 0, Velocity = 1, NumOfAttributes = 2 }
 Source attributes. More...

Public Member Functions

virtual PLSOUND_API ~Source ()
 Destructor.
PLSOUND_API BufferGetBuffer () const
 Returns the buffer the source is using.
PLSOUND_API PLCore::uint32 GetFlags () const
 Returns the source flags.
PLSOUND_API void SetFlags (PLCore::uint32 nFlags=0)
 Sets the source flags.
virtual PLSOUND_API bool Load (Buffer *pBuffer=nullptr)
 Loads the sound source with the given sound buffer.
virtual PLSOUND_API void Unload ()
 Unload the source.
virtual bool Play (bool bRestart=false)=0
 Plays the source.
virtual bool IsPlaying () const =0
 Checks whether the source is currently playing or not.
virtual void Pause ()=0
 Pauses the source playback.
virtual bool IsPaused () const =0
 Checks whether the source is currently paused or not.
virtual void Stop ()=0
 Stops the source playback.
virtual float GetVolume () const =0
 Returns the volume.
virtual void SetVolume (float fVolume=1.0f)=0
 Sets the volume.
virtual bool Is2D () const =0
 Returns whether the source is 2D or not.
virtual void Set2D (bool b2D=false)=0
 Sets whether the source is 2D or not.
virtual bool IsLooping () const =0
 Returns whether the source is looping or not.
virtual void SetLooping (bool bLooping=false)=0
 Sets whether the source is looping or not.
virtual float GetPitch () const =0
 Returns the pitch multiplier.
virtual void SetPitch (float fPitch=1.0f)=0
 Sets the pitch multiplier.
virtual float GetReferenceDistance () const =0
 Returns the reference distance.
virtual void SetReferenceDistance (float fReferenceDistance=1.0f)=0
 Sets the reference distance.
virtual float GetMaxDistance () const =0
 Returns the maximum distance.
virtual void SetMaxDistance (float fMaxDistance=10000.0f)=0
 Sets the maximum distance.
virtual float GetRolloffFactor () const =0
 Returns the roll off factor.
virtual void SetRolloffFactor (float fRolloffFactor=1.0f)=0
 Sets the roll off factor.
virtual PLMath::Vector3 GetAttribute (EAttributes nAttribute) const =0
 Gets a source attribute value.
virtual bool SetAttribute (EAttributes nAttribute, const PLMath::Vector3 &vV)=0
 Sets a source attribute value.

Protected Member Functions

PLSOUND_API Source (SoundManager &cSoundManager)
 Constructor.

Detailed Description

Abstract sound source resource.

Note:
  • For sources with 3D spatialization, do only use one channel buffers because not each sound backend may be capable to use 3D spatialization for buffers with multiple channels

Member Enumeration Documentation

Sound source flags.

Enumerator:
NoMasterPitch 

The master pitch has no influence on this source

Source attributes.

Enumerator:
Position 

Position (float3, x/y/z)

Velocity 

Velocity in meters per second (float3, x/y/z)

NumOfAttributes 

Number of source attributes


Constructor & Destructor Documentation

virtual PLSOUND_API PLSound::Source::~Source ( ) [virtual]

Destructor.

PLSOUND_API PLSound::Source::Source ( SoundManager cSoundManager) [protected]

Constructor.

Parameters:
[in]cSoundManagerOwner sound manager

Member Function Documentation

PLSOUND_API Buffer* PLSound::Source::GetBuffer ( ) const

Returns the buffer the source is using.

Returns:
The used sound buffer, a null pointer on error
PLSOUND_API PLCore::uint32 PLSound::Source::GetFlags ( ) const

Returns the source flags.

Returns:
Source flags (see EFlags)
PLSOUND_API void PLSound::Source::SetFlags ( PLCore::uint32  nFlags = 0)

Sets the source flags.

Parameters:
[in]nFlagsSource flags (see EFlags)
virtual PLSOUND_API bool PLSound::Source::Load ( Buffer pBuffer = nullptr) [virtual]

Loads the sound source with the given sound buffer.

Parameters:
[in]pBufferSound buffer the source should load, can be a null pointer (in this case just the same as Unload())
Returns:
'true' if all went fine, else 'false'
virtual PLSOUND_API void PLSound::Source::Unload ( ) [virtual]

Unload the source.

virtual bool PLSound::Source::Play ( bool  bRestart = false) [pure virtual]

Plays the source.

Parameters:
[in]bRestartRestart source if it is already playing?
Returns:
'true' if all went fine, else 'false' (maybe no buffer is loaded)
virtual bool PLSound::Source::IsPlaying ( ) const [pure virtual]

Checks whether the source is currently playing or not.

Returns:
'true' if the source is playing at the moment, else 'false'
Note:
  • If the source is paused this function will return 'true' because the source is played at the moment - but paused :)
virtual void PLSound::Source::Pause ( ) [pure virtual]

Pauses the source playback.

Note:
  • Use Play() to continue the playback
virtual bool PLSound::Source::IsPaused ( ) const [pure virtual]

Checks whether the source is currently paused or not.

Returns:
'true' if the source is paused at the moment, else 'false'
virtual void PLSound::Source::Stop ( ) [pure virtual]

Stops the source playback.

virtual float PLSound::Source::GetVolume ( ) const [pure virtual]

Returns the volume.

Returns:
Volume (value from 0.0-1.0 -> 0.0 = silence, 1.0 = full volume)
virtual void PLSound::Source::SetVolume ( float  fVolume = 1.0f) [pure virtual]

Sets the volume.

Parameters:
[in]fVolumeVolume (value from 0.0-1.0 -> 0.0 = silence, 1.0 = full volume)
virtual bool PLSound::Source::Is2D ( ) const [pure virtual]

Returns whether the source is 2D or not.

Returns:
'true' if source is 2D, else 'false'
virtual void PLSound::Source::Set2D ( bool  b2D = false) [pure virtual]

Sets whether the source is 2D or not.

Parameters:
[in]b2DIf 'true' the source is 2D, else 'false'
virtual bool PLSound::Source::IsLooping ( ) const [pure virtual]

Returns whether the source is looping or not.

Returns:
'true' if source is looping, else 'false'
virtual void PLSound::Source::SetLooping ( bool  bLooping = false) [pure virtual]

Sets whether the source is looping or not.

Parameters:
[in]bLoopingIf 'true' the source is looping, else 'false'
virtual float PLSound::Source::GetPitch ( ) const [pure virtual]

Returns the pitch multiplier.

Returns:
Pitch multiplier
Remarks:
pitch < 1.0 = slower
pitch = 1.0 = normal
pitch > 1.0 = faster
virtual void PLSound::Source::SetPitch ( float  fPitch = 1.0f) [pure virtual]

Sets the pitch multiplier.

Parameters:
[in]fPitchPitch multiplier
See also:
virtual float PLSound::Source::GetReferenceDistance ( ) const [pure virtual]

Returns the reference distance.

Returns:
Reference distance
Remarks:
Used to increase or decrease the range of a source by decreasing or increasing the attenuation, respectively.
virtual void PLSound::Source::SetReferenceDistance ( float  fReferenceDistance = 1.0f) [pure virtual]

Sets the reference distance.

Parameters:
[in]fReferenceDistanceReference distance
Note:
virtual float PLSound::Source::GetMaxDistance ( ) const [pure virtual]

Returns the maximum distance.

Returns:
Maximum distance
Remarks:
Defines a distance beyond which the source will not be further attenuated by distance.
virtual void PLSound::Source::SetMaxDistance ( float  fMaxDistance = 10000.0f) [pure virtual]

Sets the maximum distance.

Parameters:
[in]fMaxDistanceMaximum distance
See also:
virtual float PLSound::Source::GetRolloffFactor ( ) const [pure virtual]

Returns the roll off factor.

Returns:
Roll off factor
Remarks:
This will scale the distance attenuation over the applicable range.
virtual void PLSound::Source::SetRolloffFactor ( float  fRolloffFactor = 1.0f) [pure virtual]

Sets the roll off factor.

Parameters:
[in]fRolloffFactorRoll off factor
See also:
virtual PLMath::Vector3 PLSound::Source::GetAttribute ( EAttributes  nAttribute) const [pure virtual]

Gets a source attribute value.

Parameters:
[in]nAttributeSource attribute to return
Returns:
Requested source attribute value
virtual bool PLSound::Source::SetAttribute ( EAttributes  nAttribute,
const PLMath::Vector3 vV 
) [pure virtual]

Sets a source attribute value.

Parameters:
[in]nAttributeSource attribute to set
[in]vVNew source attribute value
Returns:
'true' if all went fine, else 'false'

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


PixelLight PixelLight 0.9.10-R1
Copyright (C) 2002-2011 by The PixelLight Team
Last modified Fri Dec 23 2011 15:51:26
The content of this PixelLight document is published under the
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported