NLSOUND::CSourceDSound Class Reference

Keep trace of following states of the DirectSound buffer:

More...

#include <source_dsound.h>

Inherits NLSOUND::ISource.

List of all members.

Classes

struct  TCursors
 The play and write cursors. More...
struct  TLockedBufferInfo
 A locked buffer info. More...

Public Member Functions

 CSourceDSound (uint sourcename=0)
 Constructor.
virtual ~CSourceDSound ()
 Destructor.
void init (LPDIRECTSOUND directSound, bool useEax)
 Initialize the DirectSound buffers. Called by the sound driver only.
uint sourceName ()
 Return the OpenAL source name.
IBuffergetBuffer ()
 Returns the buffer associated with this source.
void reset ()
 Reset the source before reuse.
bool update ()
 Update the source (e.g. continue to stream the data in).
void updateVolume (const NLMISC::CVector &listener)
 Update the source's volume according to its distance and fade out curve.
Initialization



virtual void setStreaming (bool streaming)
 Enable or disable streaming mode. Source must be stopped to call this.
virtual void setStaticBuffer (IBuffer *buffer)
 Set the buffer that will be played (no streaming) If the buffer is stereo, the source mode becomes stereo and the source relative mode is on, otherwise the source is considered as a 3D source.
virtual IBuffergetStaticBuffer ()
 Return the buffer, or NULL if streaming is used. Not available for streaming.
virtual void submitStreamingBuffer (IBuffer *buffer)
 Add a buffer to the streaming queue.
virtual uint countStreamingBuffers () const
 Return the amount of buffers in the queue (playing and waiting). 3 buffers is optimal.
Playback control



virtual void setLooping (bool l)
 Set looping on/off for future playbacks (default: off), not available for streaming.
virtual bool getLooping () const
 Return the looping state.
virtual bool play ()
 Play the static buffer (or stream in and play).
virtual void stop ()
 Stop playing.
virtual void pause ()
 Pause. Call play() to resume.
virtual bool isPlaying () const
 Return true if play() or pause(), false if stop().
virtual bool isStopped () const
 Return true if playing is finished or stop() has been called.
virtual bool isPaused () const
 Return true if the playing source is paused.
virtual uint32 getTime ()
 Returns the number of milliseconds the source has been playing.
Source properties



virtual void setPos (const NLMISC::CVector &pos, bool deffered=true)
 Set the position vector (default: (0,0,0)).
virtual const NLMISC::CVectorgetPos () const
 Get the position vector.
virtual void setVelocity (const NLMISC::CVector &vel, bool deferred=true)
 Set the velocity vector (3D mode only, ignored in stereo mode) (default: (0,0,0)).
virtual void getVelocity (NLMISC::CVector &vel) const
 Get the velocity vector.
virtual void setDirection (const NLMISC::CVector &dir)
 Set the direction vector (3D mode only, ignored in stereo mode) (default: (0,0,0) as non-directional).
virtual void getDirection (NLMISC::CVector &dir) const
 Get the direction vector.
virtual void setGain (float gain)
 Set the gain (volume value inside [0 , 1]).
virtual float getGain () const
 Get the gain.
virtual void setPitch (float pitch)
 Shift the frequency.
virtual float getPitch () const
 Get the pitch.
virtual void setSourceRelativeMode (bool mode)
 Set the source relative mode. If true, positions are interpreted relative to the listener position.
virtual bool getSourceRelativeMode () const
 Get the source relative mode.
virtual void setMinMaxDistances (float mindist, float maxdist, bool deferred=true)
 Set the min and max distances (default: 1, MAX_FLOAT) (3D mode only).
virtual void getMinMaxDistances (float &mindist, float &maxdist) const
 Get the min and max distances.
virtual void setCone (float innerAngle, float outerAngle, float outerGain)
 Set the cone angles (in radian) and gain (in [0 , 1]) (default: 2PI, 2PI, 0).
virtual void getCone (float &innerAngle, float &outerAngle, float &outerGain) const
 Get the cone angles (in radian).
virtual void setAlpha (double a)
 Set the alpha value for the volume-distance curve.
Direct output



virtual void setDirect (bool enable=true)
 Enable or disable direct output [true/false], default: true.
virtual bool getDirect () const
 Return if the direct output is enabled.
virtual void setDirectGain (float gain)
 Set the gain for the direct path.
virtual float getDirectGain () const
 Get the gain for the direct path.
virtual void enableDirectFilter (bool enable=true)
 Enable or disable the filter for the direct channel.
virtual bool isDirectFilterEnabled () const
 Check if the filter on the direct channel is enabled.
virtual void setDirectFilter (TFilter filter, float lowFrequency, float highFrequency, float passGain)
 Set the filter parameters for the direct channel.
virtual void getDirectFilter (TFilter &filterType, float &lowFrequency, float &highFrequency, float &passGain) const
 Get the filter parameters for the direct channel.
virtual void setDirectFilterPassGain (float passGain)
 Set the direct filter gain.
virtual float getDirectFilterPassGain () const
 Get the direct filter gain.
Effect output



virtual void setEffect (IReverbEffect *reverbEffect)
 Set the effect send for this source, NULL to disable. [IEffect], default: NULL.
virtual IEffect * getEffect () const
 Get the effect send for this source.
virtual void setEffectGain (float gain)
 Set the gain for the effect path.
virtual float getEffectGain () const
 Get the gain for the effect path.
virtual void enableEffectFilter (bool enable=true)
 Enable or disable the filter for the effect channel.
virtual bool isEffectFilterEnabled () const
 Check if the filter on the effect channel is enabled.
virtual void setEffectFilter (TFilter filter, float lowFrequency, float highFrequency, float passGain)
 Set the filter parameters for the effect channel.
virtual void getEffectFilter (TFilter &filterType, float &lowFrequency, float &highFrequency, float &passGain) const
 Get the filter parameters for the effect channel.
virtual void setEffectFilterPassGain (float passGain)
 Set the effect filter gain.
virtual float getEffectFilterPassGain () const
 Get the effect filter gain.

Static Public Member Functions

static double getTestLast ()
static double getTestMax ()
static double getTestMin ()
static double getTestAverage ()
static double getAveragePosTime ()
static double getAverageLockTime ()
static double getAverageCopyTime ()
static double getAverageUnlockTime ()
static double getAverageCumulTime ()
static uint getAverageUpdateSize ()
static double getMaxUpdateTime ()
static double getMinUpdateTime ()
static double getAverageUpdateTime ()
static double getTotalUpdateTime ()
static double getUpdateBytesPerMsec ()

Static Public Attributes

static double _LastSwapTime
static double _TotalSwapTime
static double _MaxSwapTime
static double _MinSwapTime
static uint32 _SwapCount
static double _TotalUpdateTime
static double _MaxUpdateTime
static double _MinUpdateTime
static uint32 _UpdateCount
static uint32 _TotalUpdateSize
static double _PosTime
static double _LockTime
static double _CopyTime
static double _UnlockTime
static uint32 _CopyCount

Private Types

enum  TSourceState { source_stoped, source_playing, source_silencing, source_swap_pending }

Private Member Functions

void copySampleTo16BitsTrack (void *dst, void *src, uint nbSample, TSampleFormat sourceFormat)
void release ()
 Release all DirectSound resources.
bool lock (uint32 writePos, uint32 size, TLockedBufferInfo &lockedInfo)
bool unlock (const TLockedBufferInfo &lockedInfo)
void getCursors (TCursors &cursors)
uint32 checkFillCursor ()
void fillData (const TLockedBufferInfo &lbi, int nbSample)
void fillData (sint16 *dst, uint nbSample)
void fillSilence (const TLockedBufferInfo &lbi, int nbSample)
void xfade (const TLockedBufferInfo &lbi, sint16 *src)
void fadeOut (const TLockedBufferInfo &lbi)
void fadeIn (const TLockedBufferInfo &lbi)
void advanceFill (TLockedBufferInfo &lbi, uint nbSample)
void swap ()
bool fill ()
bool silence ()
void crossFade ()
void fadeOut ()
void fadeIn ()
bool needsUpdate ()
 Check whether the play position has advanced enough to require an update.

Private Attributes

uint _SourceName
TSourceState _State
IBuffer_Sample
uint _SampleSize
uint _SampleOffset
uint32 _PlayOffset
TSampleFormat _Format
uint _SampleFreq
float _Freq
uint32 _SampleRate
IBuffer_NextSample
uint32 _LastPlayPos
uint32 _FillOffset
uint32 _SilenceWriten
bool _Loop
LPDIRECTSOUNDBUFFER _SecondaryBuffer
LPDIRECTSOUND3DBUFFER _3DBuffer
CRITICAL_SECTION _CriticalSection
IBuffer::TADPCMState _ADPCMState
sint32 _Volume
float _Gain
double _Alpha
NLMISC::CVector _Pos
bool _PosRelative
LPKSPROPERTYSET _EAXSource

Static Private Attributes

static const uint32 _UpdateCopySize = 0x4000
static const uint32 _SwapCopySize = 0x8000
static const uint _DefaultChannels = 1
static const uint _DefaultSampleRate = 22050
static const uint _DefaultSampleSize = 16
static const uint32 _XFadeSize = 64
static const uint32 _SecondaryBufferSize = 0x10000
static const uint32 _SizeMask = 0xffff

Friends

class CSoundDriverDSound

Detailed Description

Keep trace of following states of the DirectSound buffer:

To figger out whether the sound device has played all the samples in the buffer, the position of the play cursor is traced relatively to the position of the last sample in the buffer. DirectSound sound source For arguments as 3D vectors, use the NeL vector coordinate system

Author:
Peter Hanappe
Nevrax France
Date:
2002

Definition at line 89 of file source_dsound.h.


Member Enumeration Documentation

Enumerator:
source_stoped 
source_playing 
source_silencing 
source_swap_pending 

Definition at line 277 of file source_dsound.h.


Constructor & Destructor Documentation

NLSOUND::CSourceDSound::CSourceDSound ( uint  sourcename = 0  ) 
NLSOUND::CSourceDSound::~CSourceDSound (  )  [virtual]

Member Function Documentation

void NLSOUND::CSourceDSound::advanceFill ( TLockedBufferInfo lbi,
uint  nbSample 
) [private]
uint32 NLSOUND::CSourceDSound::checkFillCursor (  )  [private]
void NLSOUND::CSourceDSound::copySampleTo16BitsTrack ( void *  dst,
void *  src,
uint  nbSample,
TSampleFormat  sourceFormat 
) [private]
uint NLSOUND::CSourceDSound::countStreamingBuffers (  )  const [virtual]

Return the amount of buffers in the queue (playing and waiting). 3 buffers is optimal.

Implements NLSOUND::ISource.

Definition at line 426 of file source_dsound.cpp.

void NLSOUND::CSourceDSound::crossFade (  )  [private]
void NLSOUND::CSourceDSound::enableDirectFilter ( bool  enable = true  )  [virtual]

Enable or disable the filter for the direct channel.

Implements NLSOUND::ISource.

Definition at line 1804 of file source_dsound.cpp.

void NLSOUND::CSourceDSound::enableEffectFilter ( bool  enable = true  )  [virtual]

Enable or disable the filter for the effect channel.

Implements NLSOUND::ISource.

Definition at line 1867 of file source_dsound.cpp.

void NLSOUND::CSourceDSound::fadeIn (  )  [private]

Referenced by play().

void NLSOUND::CSourceDSound::fadeIn ( const TLockedBufferInfo lbi  )  [private]
void NLSOUND::CSourceDSound::fadeOut (  )  [private]

Referenced by stop(), and update().

void NLSOUND::CSourceDSound::fadeOut ( const TLockedBufferInfo lbi  )  [private]
bool NLSOUND::CSourceDSound::fill (  )  [private]
void NLSOUND::CSourceDSound::fillData ( sint16 dst,
uint  nbSample 
) [private]
void NLSOUND::CSourceDSound::fillData ( const TLockedBufferInfo lbi,
int  nbSample 
) [private]
void NLSOUND::CSourceDSound::fillSilence ( const TLockedBufferInfo lbi,
int  nbSample 
) [private]
static double NLSOUND::CSourceDSound::getAverageCopyTime (  )  [inline, static]

Definition at line 504 of file source_dsound.h.

References _CopyCount, and _CopyTime.

Referenced by NLSOUND::CSoundDriverDSound::writeProfile().

static double NLSOUND::CSourceDSound::getAverageCumulTime (  )  [inline, static]

Definition at line 506 of file source_dsound.h.

References _CopyCount, _CopyTime, _LockTime, _PosTime, and _UnlockTime.

Referenced by NLSOUND::CSoundDriverDSound::writeProfile().

static double NLSOUND::CSourceDSound::getAverageLockTime (  )  [inline, static]

Definition at line 503 of file source_dsound.h.

References _CopyCount, and _LockTime.

Referenced by NLSOUND::CSoundDriverDSound::writeProfile().

static double NLSOUND::CSourceDSound::getAveragePosTime (  )  [inline, static]

Definition at line 502 of file source_dsound.h.

References _CopyCount, and _PosTime.

Referenced by NLSOUND::CSoundDriverDSound::writeProfile().

static double NLSOUND::CSourceDSound::getAverageUnlockTime (  )  [inline, static]

Definition at line 505 of file source_dsound.h.

References _CopyCount, and _UnlockTime.

Referenced by NLSOUND::CSoundDriverDSound::writeProfile().

static uint NLSOUND::CSourceDSound::getAverageUpdateSize (  )  [inline, static]

Definition at line 507 of file source_dsound.h.

References _CopyCount, and _TotalUpdateSize.

Referenced by NLSOUND::CSoundDriverDSound::writeProfile().

static double NLSOUND::CSourceDSound::getAverageUpdateTime (  )  [inline, static]

Definition at line 511 of file source_dsound.h.

References _TotalUpdateTime, and _UpdateCount.

Referenced by NLSOUND::CSoundDriverDSound::writeProfile().

IBuffer * NLSOUND::CSourceDSound::getBuffer (  ) 

Returns the buffer associated with this source.

Definition at line 1907 of file source_dsound.cpp.

References _Sample.

void NLSOUND::CSourceDSound::getCone ( float innerAngle,
float outerAngle,
float outerGain 
) const [virtual]

Get the cone angles (in radian).

Implements NLSOUND::ISource.

Definition at line 1706 of file source_dsound.cpp.

References _3DBuffer, nlwarning, and NLMISC::Pi.

void NLSOUND::CSourceDSound::getCursors ( TCursors cursors  )  [private]
bool NLSOUND::CSourceDSound::getDirect (  )  const [virtual]

Return if the direct output is enabled.

Implements NLSOUND::ISource.

Definition at line 1786 of file source_dsound.cpp.

void NLSOUND::CSourceDSound::getDirectFilter ( TFilter filterType,
float lowFrequency,
float highFrequency,
float passGain 
) const [virtual]

Get the filter parameters for the direct channel.

Implements NLSOUND::ISource.

Definition at line 1822 of file source_dsound.cpp.

References NLSOUND::ISource::FilterLowPass, NLSOUND_DEFAULT_FILTER_PASS_GAIN, NLSOUND_DEFAULT_FILTER_PASS_HF, and NLSOUND_DEFAULT_FILTER_PASS_LF.

float NLSOUND::CSourceDSound::getDirectFilterPassGain (  )  const [virtual]

Get the direct filter gain.

Implements NLSOUND::ISource.

Definition at line 1837 of file source_dsound.cpp.

float NLSOUND::CSourceDSound::getDirectGain (  )  const [virtual]

Get the gain for the direct path.

Implements NLSOUND::ISource.

Definition at line 1798 of file source_dsound.cpp.

References NLSOUND_DEFAULT_DIRECT_GAIN.

void NLSOUND::CSourceDSound::getDirection ( NLMISC::CVector dir  )  const [virtual]

Get the direction vector.

Implements NLSOUND::ISource.

Definition at line 1410 of file source_dsound.cpp.

References _3DBuffer, nlwarning, and NLMISC::CVector::set().

IEffect * NLSOUND::CSourceDSound::getEffect (  )  const [virtual]

Get the effect send for this source.

Implements NLSOUND::ISource.

Definition at line 1849 of file source_dsound.cpp.

void NLSOUND::CSourceDSound::getEffectFilter ( TFilter filterType,
float lowFrequency,
float highFrequency,
float passGain 
) const [virtual]

Get the filter parameters for the effect channel.

Implements NLSOUND::ISource.

Definition at line 1885 of file source_dsound.cpp.

References NLSOUND::ISource::FilterLowPass, NLSOUND_DEFAULT_FILTER_PASS_GAIN, NLSOUND_DEFAULT_FILTER_PASS_HF, and NLSOUND_DEFAULT_FILTER_PASS_LF.

float NLSOUND::CSourceDSound::getEffectFilterPassGain (  )  const [virtual]

Get the effect filter gain.

Implements NLSOUND::ISource.

Definition at line 1900 of file source_dsound.cpp.

float NLSOUND::CSourceDSound::getEffectGain (  )  const [virtual]

Get the gain for the effect path.

Implements NLSOUND::ISource.

Definition at line 1861 of file source_dsound.cpp.

References NLSOUND_DEFAULT_EFFECT_GAIN.

float NLSOUND::CSourceDSound::getGain ( void   )  const [virtual]

Get the gain.

Implements NLSOUND::ISource.

Definition at line 1458 of file source_dsound.cpp.

References _Gain.

bool NLSOUND::CSourceDSound::getLooping (  )  const [virtual]

Return the looping state.

Implements NLSOUND::ISource.

Definition at line 886 of file source_dsound.cpp.

References _Loop.

static double NLSOUND::CSourceDSound::getMaxUpdateTime (  )  [inline, static]

Definition at line 509 of file source_dsound.h.

References _MaxUpdateTime.

void NLSOUND::CSourceDSound::getMinMaxDistances ( float mindist,
float maxdist 
) const [virtual]

Get the min and max distances.

Implements NLSOUND::ISource.

Definition at line 1576 of file source_dsound.cpp.

References _3DBuffer, min, and nlwarning.

Referenced by updateVolume().

static double NLSOUND::CSourceDSound::getMinUpdateTime (  )  [inline, static]

Definition at line 510 of file source_dsound.h.

References _MinUpdateTime.

float NLSOUND::CSourceDSound::getPitch ( void   )  const [virtual]

Get the pitch.

Implements NLSOUND::ISource.

Definition at line 1492 of file source_dsound.cpp.

References _Sample, _SecondaryBuffer, NLSOUND::IBuffer::getFormat(), and nlwarning.

const NLMISC::CVector & NLSOUND::CSourceDSound::getPos ( void   )  const [virtual]

Get the position vector.

See setPos() for details.

Implements NLSOUND::ISource.

Definition at line 1345 of file source_dsound.cpp.

References _Pos.

Referenced by updateVolume().

bool NLSOUND::CSourceDSound::getSourceRelativeMode (  )  const [virtual]

Get the source relative mode.

Implements NLSOUND::ISource.

Definition at line 1547 of file source_dsound.cpp.

References _PosRelative.

IBuffer * NLSOUND::CSourceDSound::getStaticBuffer (  )  [virtual]

Return the buffer, or NULL if streaming is used. Not available for streaming.

Implements NLSOUND::ISource.

Definition at line 409 of file source_dsound.cpp.

References _NextSample, _Sample, _State, and source_swap_pending.

static double NLSOUND::CSourceDSound::getTestAverage (  )  [inline, static]

Definition at line 500 of file source_dsound.h.

References _SwapCount, and _TotalSwapTime.

Referenced by NLSOUND::CSoundDriverDSound::writeProfile().

static double NLSOUND::CSourceDSound::getTestLast (  )  [inline, static]

Definition at line 497 of file source_dsound.h.

References _LastSwapTime.

static double NLSOUND::CSourceDSound::getTestMax (  )  [inline, static]

Definition at line 498 of file source_dsound.h.

References _MaxSwapTime.

static double NLSOUND::CSourceDSound::getTestMin (  )  [inline, static]

Definition at line 499 of file source_dsound.h.

References _MinSwapTime.

uint32 NLSOUND::CSourceDSound::getTime ( void   )  [virtual]

Returns the number of milliseconds the source has been playing.

Implements NLSOUND::ISource.

Definition at line 196 of file source_dsound.cpp.

References _PlayOffset, _Sample, and NLSOUND::IBuffer::getFormat().

static double NLSOUND::CSourceDSound::getTotalUpdateTime (  )  [inline, static]

Definition at line 513 of file source_dsound.h.

References _TotalUpdateTime.

static double NLSOUND::CSourceDSound::getUpdateBytesPerMsec (  )  [inline, static]

Definition at line 514 of file source_dsound.h.

References _TotalUpdateSize, _TotalUpdateTime, and _UpdateCount.

void NLSOUND::CSourceDSound::getVelocity ( NLMISC::CVector vel  )  const [virtual]

Get the velocity vector.

Implements NLSOUND::ISource.

Definition at line 1367 of file source_dsound.cpp.

References _3DBuffer, nlwarning, and NLMISC::CVector::set().

void NLSOUND::CSourceDSound::init ( LPDIRECTSOUND  directSound,
bool  useEax 
)
bool NLSOUND::CSourceDSound::isDirectFilterEnabled (  )  const [virtual]

Check if the filter on the direct channel is enabled.

Implements NLSOUND::ISource.

Definition at line 1810 of file source_dsound.cpp.

bool NLSOUND::CSourceDSound::isEffectFilterEnabled (  )  const [virtual]

Check if the filter on the effect channel is enabled.

Implements NLSOUND::ISource.

Definition at line 1873 of file source_dsound.cpp.

bool NLSOUND::CSourceDSound::isPaused (  )  const [virtual]

Return true if the playing source is paused.

Implements NLSOUND::ISource.

Definition at line 1042 of file source_dsound.cpp.

References nlassert.

bool NLSOUND::CSourceDSound::isPlaying ( void   )  const [virtual]

Return true if play() or pause(), false if stop().

Implements NLSOUND::ISource.

Definition at line 1033 of file source_dsound.cpp.

References _State, source_playing, and source_swap_pending.

bool NLSOUND::CSourceDSound::isStopped (  )  const [virtual]

Return true if playing is finished or stop() has been called.

Implements NLSOUND::ISource.

Definition at line 1053 of file source_dsound.cpp.

References _State, source_silencing, and source_stoped.

bool NLSOUND::CSourceDSound::lock ( uint32  writePos,
uint32  size,
TLockedBufferInfo lockedInfo 
) [private]
bool NLSOUND::CSourceDSound::needsUpdate (  )  [private]

Check whether the play position has advanced enough to require an update.

Definition at line 1062 of file source_dsound.cpp.

References _State, source_playing, source_silencing, and source_swap_pending.

void NLSOUND::CSourceDSound::pause (  )  [virtual]

Pause. Call play() to resume.

Implements NLSOUND::ISource.

Definition at line 1009 of file source_dsound.cpp.

References nlassert.

bool NLSOUND::CSourceDSound::play ( void   )  [virtual]
void NLSOUND::CSourceDSound::release ( void   )  [private]

Release all DirectSound resources.

Definition at line 164 of file source_dsound.cpp.

References _3DBuffer, _EAXSource, and _SecondaryBuffer.

Referenced by ~CSourceDSound().

void NLSOUND::CSourceDSound::reset (  ) 

Reset the source before reuse.

Definition at line 327 of file source_dsound.cpp.

References setGain(), setLooping(), and setPitch().

void NLSOUND::CSourceDSound::setAlpha ( double  a  )  [virtual]

Set the alpha value for the volume-distance curve.

Useful only with OptionManualRolloff. value from -1 to 1 (default 0)

alpha.0: the volume will decrease linearly between 0dB and -100 dB alpha = 1.0: the volume will decrease linearly between 1.0 and 0.0 (linear scale) alpha = -1.0: the volume will decrease inversely with the distance (1/dist). This is the default used by DirectSound/OpenAL

For any other value of alpha, an interpolation is be done between the two adjacent curves. For example, if alpha equals 0.5, the volume will be halfway between the linear dB curve and the linear amplitude curve.

Implements NLSOUND::ISource.

Definition at line 1774 of file source_dsound.cpp.

References _Alpha.

void NLSOUND::CSourceDSound::setCone ( float  innerAngle,
float  outerAngle,
float  outerGain 
) [virtual]

Set the cone angles (in radian) and gain (in [0 , 1]) (default: 2PI, 2PI, 0).

Implements NLSOUND::ISource.

Definition at line 1632 of file source_dsound.cpp.

References _3DBuffer, nlwarning, and NLMISC::Pi.

void NLSOUND::CSourceDSound::setDirect ( bool  enable = true  )  [virtual]

Enable or disable direct output [true/false], default: true.

Implements NLSOUND::ISource.

Definition at line 1780 of file source_dsound.cpp.

void NLSOUND::CSourceDSound::setDirectFilter ( TFilter  filter,
float  lowFrequency,
float  highFrequency,
float  passGain 
) [virtual]

Set the filter parameters for the direct channel.

Implements NLSOUND::ISource.

Definition at line 1816 of file source_dsound.cpp.

void NLSOUND::CSourceDSound::setDirectFilterPassGain ( float  passGain  )  [virtual]

Set the direct filter gain.

Implements NLSOUND::ISource.

Definition at line 1831 of file source_dsound.cpp.

void NLSOUND::CSourceDSound::setDirectGain ( float  gain  )  [virtual]

Set the gain for the direct path.

Implements NLSOUND::ISource.

Definition at line 1792 of file source_dsound.cpp.

void NLSOUND::CSourceDSound::setDirection ( const NLMISC::CVector dir  )  [virtual]

Set the direction vector (3D mode only, ignored in stereo mode) (default: (0,0,0) as non-directional).

Implements NLSOUND::ISource.

Definition at line 1392 of file source_dsound.cpp.

References _3DBuffer, nlwarning, NLMISC::CVector::x, NLMISC::CVector::y, and NLMISC::CVector::z.

void NLSOUND::CSourceDSound::setEffect ( IReverbEffect reverbEffect  )  [virtual]

Set the effect send for this source, NULL to disable. [IEffect], default: NULL.

Implements NLSOUND::ISource.

Definition at line 1843 of file source_dsound.cpp.

void NLSOUND::CSourceDSound::setEffectFilter ( TFilter  filter,
float  lowFrequency,
float  highFrequency,
float  passGain 
) [virtual]

Set the filter parameters for the effect channel.

Implements NLSOUND::ISource.

Definition at line 1879 of file source_dsound.cpp.

void NLSOUND::CSourceDSound::setEffectFilterPassGain ( float  passGain  )  [virtual]

Set the effect filter gain.

Implements NLSOUND::ISource.

Definition at line 1894 of file source_dsound.cpp.

void NLSOUND::CSourceDSound::setEffectGain ( float  gain  )  [virtual]

Set the gain for the effect path.

Implements NLSOUND::ISource.

Definition at line 1855 of file source_dsound.cpp.

void NLSOUND::CSourceDSound::setGain ( float  gain  )  [virtual]

Set the gain (volume value inside [0 , 1]).

(default: 1) 0.0 -> silence 0.5 -> -6dB 1.0 -> no attenuation values > 1 (amplification) not supported by most drivers

Implements NLSOUND::ISource.

Definition at line 1435 of file source_dsound.cpp.

References _Gain, _Volume, and NLMISC::clamp().

Referenced by reset().

void NLSOUND::CSourceDSound::setLooping ( bool  l  )  [virtual]

Set looping on/off for future playbacks (default: off), not available for streaming.

Implements NLSOUND::ISource.

Definition at line 878 of file source_dsound.cpp.

References _Loop.

Referenced by reset().

void NLSOUND::CSourceDSound::setMinMaxDistances ( float  mindist,
float  maxdist,
bool  deferred = true 
) [virtual]

Set the min and max distances (default: 1, MAX_FLOAT) (3D mode only).

Implements NLSOUND::ISource.

Definition at line 1554 of file source_dsound.cpp.

References _3DBuffer, min, and nlwarning.

void NLSOUND::CSourceDSound::setPitch ( float  pitch  )  [virtual]

Shift the frequency.

1.0f equals identity, each reduction of 50% equals a pitch shift of one octave. 0 is not a legal value.

Implements NLSOUND::ISource.

Definition at line 1466 of file source_dsound.cpp.

References _Sample, _SampleRate, _SecondaryBuffer, NLSOUND::IBuffer::getFormat(), and nlwarning.

Referenced by reset().

void NLSOUND::CSourceDSound::setPos ( const NLMISC::CVector pos,
bool  deffered = true 
) [virtual]

Set the position vector (default: (0,0,0)).

3D mode -> 3D position st mode -> x is the pan value (from left (-1) to right (1)), set y and z to 0

Implements NLSOUND::ISource.

Definition at line 1325 of file source_dsound.cpp.

References _3DBuffer, _Pos, nlwarning, NLMISC::CVector::x, NLMISC::CVector::y, and NLMISC::CVector::z.

void NLSOUND::CSourceDSound::setSourceRelativeMode ( bool  mode  )  [virtual]

Set the source relative mode. If true, positions are interpreted relative to the listener position.

Implements NLSOUND::ISource.

Definition at line 1517 of file source_dsound.cpp.

References _3DBuffer, _PosRelative, and nlwarning.

void NLSOUND::CSourceDSound::setStaticBuffer ( IBuffer buffer  )  [virtual]

Set the buffer that will be played (no streaming) If the buffer is stereo, the source mode becomes stereo and the source relative mode is on, otherwise the source is considered as a 3D source.

Use submitStreamingBuffer for streaming.

Implements NLSOUND::ISource.

Definition at line 342 of file source_dsound.cpp.

References _ADPCMState, _CriticalSection, _Format, _NextSample, _PlayOffset, _Sample, _SampleFreq, _SampleOffset, _SampleSize, _State, NLSOUND::IBuffer::getFormat(), NLSOUND::IBuffer::getSize(), NLSOUND::Mono16, NLSOUND::Mono16ADPCM, NLSOUND::Mono8, NLSOUND::IBuffer::TADPCMState::PreviousSample, source_playing, source_swap_pending, NLSOUND::IBuffer::TADPCMState::StepIndex, NLSOUND::Stereo16, and NLSOUND::Stereo8.

void NLSOUND::CSourceDSound::setStreaming ( bool  streaming  )  [virtual]

Enable or disable streaming mode. Source must be stopped to call this.

Implements NLSOUND::ISource.

Definition at line 335 of file source_dsound.cpp.

void NLSOUND::CSourceDSound::setVelocity ( const NLMISC::CVector vel,
bool  deferred = true 
) [virtual]

Set the velocity vector (3D mode only, ignored in stereo mode) (default: (0,0,0)).

Implements NLSOUND::ISource.

Definition at line 1353 of file source_dsound.cpp.

References _3DBuffer, nlwarning, NLMISC::CVector::x, NLMISC::CVector::y, and NLMISC::CVector::z.

bool NLSOUND::CSourceDSound::silence (  )  [private]
uint NLSOUND::CSourceDSound::sourceName (  )  [inline]

Return the OpenAL source name.

Definition at line 258 of file source_dsound.h.

References _SourceName.

void NLSOUND::CSourceDSound::stop ( void   )  [virtual]
void NLSOUND::CSourceDSound::submitStreamingBuffer ( IBuffer buffer  )  [virtual]

Add a buffer to the streaming queue.

A buffer of 100ms length is optimal for streaming. Should be called by a thread which checks countStreamingBuffers every 100ms.

Implements NLSOUND::ISource.

Definition at line 420 of file source_dsound.cpp.

void NLSOUND::CSourceDSound::swap (  )  [private]
bool NLSOUND::CSourceDSound::unlock ( const TLockedBufferInfo lockedInfo  )  [private]
bool NLSOUND::CSourceDSound::update (  ) 
void NLSOUND::CSourceDSound::updateVolume ( const NLMISC::CVector listener  ) 

Update the source's volume according to its distance and fade out curve.

It takes the current position of the listener as argument.

Definition at line 1604 of file source_dsound.cpp.

References _Alpha, _PosRelative, _SecondaryBuffer, _Volume, NLSOUND::ISource::computeManualRollOff(), getMinMaxDistances(), getPos(), NLSOUND::CSoundDriverDSound::instance(), NLSOUND::ISoundDriver::OptionManualRolloff, and NLMISC::CVector::sqrnorm().

Referenced by play().

void NLSOUND::CSourceDSound::xfade ( const TLockedBufferInfo lbi,
sint16 src 
) [private]

Friends And Related Function Documentation

friend class CSoundDriverDSound [friend]

Definition at line 91 of file source_dsound.h.


Member Data Documentation

LPDIRECTSOUND3DBUFFER NLSOUND::CSourceDSound::_3DBuffer [private]

Definition at line 424 of file source_dsound.h.

Referenced by fillData(), play(), setStaticBuffer(), and update().

Definition at line 464 of file source_dsound.h.

Referenced by CSourceDSound(), setAlpha(), and updateVolume().

Definition at line 491 of file source_dsound.h.

Referenced by getAverageCopyTime(), and getAverageCumulTime().

CRITICAL_SECTION NLSOUND::CSourceDSound::_CriticalSection [private]

Definition at line 421 of file source_dsound.h.

Referenced by CSourceDSound(), play(), setStaticBuffer(), stop(), update(), and ~CSourceDSound().

const uint NLSOUND::CSourceDSound::_DefaultChannels = 1 [static, private]

Definition at line 294 of file source_dsound.h.

Referenced by init().

const uint NLSOUND::CSourceDSound::_DefaultSampleRate = 22050 [static, private]

Definition at line 296 of file source_dsound.h.

Referenced by CSourceDSound(), and init().

const uint NLSOUND::CSourceDSound::_DefaultSampleSize = 16 [static, private]

Definition at line 298 of file source_dsound.h.

Referenced by init().

LPKSPROPERTYSET NLSOUND::CSourceDSound::_EAXSource [private]

Definition at line 469 of file source_dsound.h.

Referenced by CSourceDSound(), and release().

Definition at line 400 of file source_dsound.h.

Referenced by advanceFill(), CSourceDSound(), play(), stop(), and update().

Definition at line 387 of file source_dsound.h.

Referenced by CSourceDSound(), fillData(), play(), and setStaticBuffer().

Definition at line 392 of file source_dsound.h.

Referenced by CSourceDSound().

Definition at line 463 of file source_dsound.h.

Referenced by CSourceDSound(), getGain(), and setGain().

Definition at line 399 of file source_dsound.h.

Referenced by CSourceDSound(), play(), and update().

Definition at line 477 of file source_dsound.h.

Referenced by getTestLast().

Definition at line 490 of file source_dsound.h.

Referenced by getAverageCumulTime(), and getAverageLockTime().

Definition at line 407 of file source_dsound.h.

Referenced by CSourceDSound(), getLooping(), play(), setLooping(), and update().

Definition at line 479 of file source_dsound.h.

Referenced by getTestMax().

Definition at line 484 of file source_dsound.h.

Referenced by getMaxUpdateTime().

Definition at line 480 of file source_dsound.h.

Referenced by getTestMin().

Definition at line 485 of file source_dsound.h.

Referenced by getMinUpdateTime().

Definition at line 397 of file source_dsound.h.

Referenced by getStaticBuffer(), play(), and setStaticBuffer().

Definition at line 386 of file source_dsound.h.

Referenced by CSourceDSound(), getTime(), play(), setStaticBuffer(), and update().

Definition at line 465 of file source_dsound.h.

Referenced by getPos(), and setPos().

Definition at line 489 of file source_dsound.h.

Referenced by getAverageCumulTime(), and getAveragePosTime().

Definition at line 388 of file source_dsound.h.

Referenced by CSourceDSound(), play(), and setStaticBuffer().

Definition at line 384 of file source_dsound.h.

Referenced by CSourceDSound(), fillData(), play(), setStaticBuffer(), and update().

Definition at line 394 of file source_dsound.h.

Referenced by CSourceDSound(), and setPitch().

Definition at line 382 of file source_dsound.h.

Referenced by CSourceDSound(), fillData(), play(), setStaticBuffer(), and update().

LPDIRECTSOUNDBUFFER NLSOUND::CSourceDSound::_SecondaryBuffer [private]
const uint32 NLSOUND::CSourceDSound::_SecondaryBufferSize = 0x10000 [static, private]

Definition at line 401 of file source_dsound.h.

Referenced by play(), stop(), and update().

const uint32 NLSOUND::CSourceDSound::_SizeMask = 0xffff [static, private]

Definition at line 417 of file source_dsound.h.

Referenced by advanceFill(), getCursors(), and update().

Definition at line 371 of file source_dsound.h.

Referenced by sourceName().

const uint32 NLSOUND::CSourceDSound::_SwapCopySize = 0x8000 [static, private]

Definition at line 292 of file source_dsound.h.

Referenced by NLSOUND::CSoundDriverDSound::writeProfile().

Definition at line 481 of file source_dsound.h.

Referenced by getTestAverage().

Definition at line 478 of file source_dsound.h.

Referenced by getTestAverage().

Definition at line 487 of file source_dsound.h.

Referenced by getAverageUpdateSize(), and getUpdateBytesPerMsec().

Definition at line 492 of file source_dsound.h.

Referenced by getAverageCumulTime(), and getAverageUnlockTime().

const uint32 NLSOUND::CSourceDSound::_UpdateCopySize = 0x4000 [static, private]

Definition at line 290 of file source_dsound.h.

Referenced by getCursors(), update(), and NLSOUND::CSoundDriverDSound::writeProfile().

Definition at line 486 of file source_dsound.h.

Referenced by getAverageUpdateTime(), and getUpdateBytesPerMsec().

Definition at line 462 of file source_dsound.h.

Referenced by CSourceDSound(), setGain(), and updateVolume().

const uint32 NLSOUND::CSourceDSound::_XFadeSize = 64 [static, private]

Definition at line 300 of file source_dsound.h.

Referenced by fadeIn(), fadeOut(), play(), stop(), update(), and xfade().


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

Generated on Thu Jan 7 08:30:22 2010 for NeL by  doxygen 1.6.1