OpenAL sound source. More...
#include <source_al.h>
Inherits NLSOUND::ISource.
Public Member Functions | |
| CSourceAL (CSoundDriverAL *soundDriver) | |
| Constructor. | |
| virtual | ~CSourceAL () |
| Destructor. | |
| void | release () |
| Release called by the driver to release internal AL handles. | |
| ALuint | getSource () const |
| Return the OpenAL source name. | |
| void | setEffect (CEffectAL *effect) |
| (Internal) Set the effect send for this source, NULL to disable. | |
| void | setupDirectFilter () |
| (Internal) Setup the direct send filter. | |
| void | setupEffectFilter () |
| (Internal) Setup the effect send filter. | |
| void | updateManualRolloff () |
| (Internal) Update the manual rolloff, only called when using manual rolloff. | |
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 IBuffer * | getStaticBuffer () |
| 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::CVector & | getPos () 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. | |
Private Attributes | |
| CSoundDriverAL * | _SoundDriver |
| Sound driver. | |
| CBufferAL * | _Buffer |
| Assigned buffer object. | |
| std::queue< CBufferAL * > | _QueuedBuffers |
| ALuint | _Source |
| AL Handles. | |
| ALuint | _DirectFilter |
| ALuint | _EffectFilter |
| bool | _IsPlaying |
| Playing status. | |
| bool | _IsPaused |
| NLMISC::CVector | _Pos |
| float | _Gain |
| double | _Alpha |
| float | _MinDistance |
| Minimum distance of sound at max volume. | |
| float | _MaxDistance |
| Maximum distance of sound. | |
| CEffectAL * | _Effect |
| Send paths. | |
| bool | _Direct |
| float | _DirectGain |
| float | _EffectGain |
| TFilter | _DirectFilterType |
| Send filters. | |
| TFilter | _EffectFilterType |
| bool | _DirectFilterEnabled |
| bool | _EffectFilterEnabled |
| float | _DirectFilterPassGain |
| float | _EffectFilterPassGain |
OpenAL sound source.
Note: the creation/deletion of sources and the setting of their rolloff factor are done in CSoundDriverAL.
The EAX extensions are not available on all sound cards, and currently not at all on Linux.
For arguments as 3D vectors, use the NeL vector coordinate system (not OpenAL/OpenGL's one).
Definition at line 51 of file source_al.h.
| NLSOUND::CSourceAL::CSourceAL | ( | CSoundDriverAL * | soundDriver | ) |
Constructor.
Definition at line 41 of file source_al.cpp.
References _DirectFilter, _EffectFilter, _SoundDriver, _Source, AL_FILTER_LOWPASS, AL_FILTER_TYPE, AL_LOWPASS_GAIN, AL_LOWPASS_GAINHF, alFilterf, alFilteri, alGenFilters, alTestError, NLSOUND::CSoundDriverAL::getOption(), NLSOUND::CSoundDriverAL::getRolloffFactor(), NLSOUND_DEFAULT_DIRECT_GAIN, NLSOUND_DEFAULT_EFFECT_GAIN, NLSOUND_DEFAULT_FILTER_PASS_GAIN, NLSOUND::ISoundDriver::OptionEnvironmentEffects, and NLSOUND::ISoundDriver::OptionManualRolloff.
| NLSOUND::CSourceAL::~CSourceAL | ( | ) | [virtual] |
Destructor.
Definition at line 88 of file source_al.cpp.
References _SoundDriver, release(), and NLSOUND::CSoundDriverAL::removeSource().
| uint NLSOUND::CSourceAL::countStreamingBuffers | ( | ) | const [virtual] |
Return the amount of buffers in the queue (playing and waiting). 3 buffers is optimal.
Implements NLSOUND::ISource.
Definition at line 173 of file source_al.cpp.
References _QueuedBuffers, _Source, and alTestError.
| void NLSOUND::CSourceAL::enableDirectFilter | ( | bool | enable = true |
) | [virtual] |
Enable or disable the filter for the direct channel.
Implements NLSOUND::ISource.
Definition at line 569 of file source_al.cpp.
References _DirectFilterEnabled, and setupDirectFilter().
| void NLSOUND::CSourceAL::enableEffectFilter | ( | bool | enable = true |
) | [virtual] |
Enable or disable the filter for the effect channel.
Implements NLSOUND::ISource.
Definition at line 694 of file source_al.cpp.
References _EffectFilterEnabled, and setupEffectFilter().
| void NLSOUND::CSourceAL::getCone | ( | float & | innerAngle, | |
| float & | outerAngle, | |||
| float & | outerGain | |||
| ) | const [virtual] |
Get the cone angles (in radian).
Implements NLSOUND::ISource.
Definition at line 475 of file source_al.cpp.
References _Source, alTestError, and NLMISC::degToRad().
| bool NLSOUND::CSourceAL::getDirect | ( | ) | const [virtual] |
Return if the direct output is enabled.
Implements NLSOUND::ISource.
Definition at line 550 of file source_al.cpp.
References _Direct.
| void NLSOUND::CSourceAL::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 602 of file source_al.cpp.
References _DirectFilterPassGain, _DirectFilterType, NLSOUND_DEFAULT_FILTER_PASS_HF, and NLSOUND_DEFAULT_FILTER_PASS_LF.
| float NLSOUND::CSourceAL::getDirectFilterPassGain | ( | ) | const [virtual] |
Get the direct filter gain.
Implements NLSOUND::ISource.
Definition at line 618 of file source_al.cpp.
References _DirectFilterPassGain.
| float NLSOUND::CSourceAL::getDirectGain | ( | ) | const [virtual] |
Get the gain for the direct path.
Implements NLSOUND::ISource.
Definition at line 563 of file source_al.cpp.
References _DirectGain.
| void NLSOUND::CSourceAL::getDirection | ( | NLMISC::CVector & | dir | ) | const [virtual] |
Get the direction vector.
Implements NLSOUND::ISource.
Definition at line 378 of file source_al.cpp.
References _Source, alTestError, and NLMISC::CVector::set().
| IEffect * NLSOUND::CSourceAL::getEffect | ( | ) | const [virtual] |
Get the effect send for this source.
Implements NLSOUND::ISource.
Definition at line 674 of file source_al.cpp.
| void NLSOUND::CSourceAL::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 727 of file source_al.cpp.
References _EffectFilterPassGain, _EffectFilterType, NLSOUND_DEFAULT_FILTER_PASS_HF, and NLSOUND_DEFAULT_FILTER_PASS_LF.
| float NLSOUND::CSourceAL::getEffectFilterPassGain | ( | ) | const [virtual] |
Get the effect filter gain.
Implements NLSOUND::ISource.
Definition at line 743 of file source_al.cpp.
References _EffectFilterPassGain.
| float NLSOUND::CSourceAL::getEffectGain | ( | ) | const [virtual] |
Get the gain for the effect path.
Implements NLSOUND::ISource.
Definition at line 688 of file source_al.cpp.
References _EffectGain.
| float NLSOUND::CSourceAL::getGain | ( | void | ) | const [virtual] |
Get the gain.
Implements NLSOUND::ISource.
Definition at line 399 of file source_al.cpp.
References _Gain.
| bool NLSOUND::CSourceAL::getLooping | ( | ) | const [virtual] |
Return the looping state.
Implements NLSOUND::ISource.
Definition at line 202 of file source_al.cpp.
References _Source, and alTestError.
Get the min and max distances.
Implements NLSOUND::ISource.
Definition at line 455 of file source_al.cpp.
References _MaxDistance, and _MinDistance.
| float NLSOUND::CSourceAL::getPitch | ( | void | ) | const [virtual] |
Get the pitch.
Implements NLSOUND::ISource.
Definition at line 416 of file source_al.cpp.
References _Source, and alTestError.
| const NLMISC::CVector & NLSOUND::CSourceAL::getPos | ( | void | ) | const [virtual] |
Get the position vector.
See setPos() for details.
Implements NLSOUND::ISource.
Definition at line 346 of file source_al.cpp.
References _Pos.
| ALuint NLSOUND::CSourceAL::getSource | ( | ) | const [inline] |
| bool NLSOUND::CSourceAL::getSourceRelativeMode | ( | ) | const [virtual] |
Get the source relative mode.
Get the source relative mode (3D mode only).
Implements NLSOUND::ISource.
Definition at line 432 of file source_al.cpp.
References _Source, and alTestError.
| IBuffer * NLSOUND::CSourceAL::getStaticBuffer | ( | ) | [virtual] |
Return the buffer, or NULL if streaming is used. Not available for streaming.
Implements NLSOUND::ISource.
Definition at line 155 of file source_al.cpp.
References _Buffer.
| uint32 NLSOUND::CSourceAL::getTime | ( | void | ) | [virtual] |
Returns the number of milliseconds the source has been playing.
Implements NLSOUND::ISource.
Definition at line 330 of file source_al.cpp.
| void NLSOUND::CSourceAL::getVelocity | ( | NLMISC::CVector & | vel | ) | const [virtual] |
Get the velocity vector.
Implements NLSOUND::ISource.
Definition at line 360 of file source_al.cpp.
References _Source, alTestError, and NLMISC::CVector::set().
| bool NLSOUND::CSourceAL::isDirectFilterEnabled | ( | ) | const [virtual] |
Check if the filter on the direct channel is enabled.
Implements NLSOUND::ISource.
Definition at line 576 of file source_al.cpp.
References _DirectFilterEnabled.
| bool NLSOUND::CSourceAL::isEffectFilterEnabled | ( | ) | const [virtual] |
Check if the filter on the effect channel is enabled.
Implements NLSOUND::ISource.
Definition at line 701 of file source_al.cpp.
References _EffectFilterEnabled.
| bool NLSOUND::CSourceAL::isPaused | ( | ) | const [virtual] |
Return true if the playing source is paused.
Implements NLSOUND::ISource.
Definition at line 321 of file source_al.cpp.
References _Source, and alTestError.
| bool NLSOUND::CSourceAL::isPlaying | ( | void | ) | const [virtual] |
Return true if play() or pause(), false if stop().
Implements NLSOUND::ISource.
Definition at line 294 of file source_al.cpp.
References _Source, and alTestError.
| bool NLSOUND::CSourceAL::isStopped | ( | ) | const [virtual] |
Return true if playing is finished or stop() has been called.
Implements NLSOUND::ISource.
Definition at line 304 of file source_al.cpp.
References _Source, and alTestError.
Referenced by pause(), and setStreaming().
| void NLSOUND::CSourceAL::pause | ( | ) | [virtual] |
Pause. Call play() to resume.
Implements NLSOUND::ISource.
Definition at line 267 of file source_al.cpp.
References _Buffer, _IsPaused, _Source, alTestError, isStopped(), and nlwarning.
| bool NLSOUND::CSourceAL::play | ( | void | ) | [virtual] |
Play the static buffer (or stream in and play).
This method can return false if the sample for this sound is unloaded.
Implements NLSOUND::ISource.
Definition at line 211 of file source_al.cpp.
References _Buffer, _IsPaused, _IsPlaying, and _Source.
| void NLSOUND::CSourceAL::release | ( | void | ) |
Release called by the driver to release internal AL handles.
Definition at line 95 of file source_al.cpp.
References _DirectFilter, _EffectFilter, _SoundDriver, _Source, AL_FILTER_NULL, and alDeleteFilters.
Referenced by ~CSourceAL().
| void NLSOUND::CSourceAL::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 499 of file source_al.cpp.
References _Alpha.
Set the cone angles (in radian) and gain (in [0 , 1]) (default: 2PI, 2PI, 0).
Set the cone angles (in radian) and gain (in [0 , 1]) (3D mode only).
Implements NLSOUND::ISource.
Definition at line 465 of file source_al.cpp.
References _Source, alTestError, nlassert, and NLMISC::radToDeg().
| void NLSOUND::CSourceAL::setDirect | ( | bool | enable = true |
) | [virtual] |
Enable or disable direct output [true/false], default: true.
Implements NLSOUND::ISource.
Definition at line 543 of file source_al.cpp.
References _Direct, and setupDirectFilter().
| void NLSOUND::CSourceAL::setDirectFilter | ( | TFilter | filter, | |
| float | lowFrequency, | |||
| float | highFrequency, | |||
| float | passGain | |||
| ) | [virtual] |
Set the filter parameters for the direct channel.
Implements NLSOUND::ISource.
Definition at line 582 of file source_al.cpp.
References _DirectFilter, _DirectFilterPassGain, _DirectFilterType, AL_FILTER_BANDPASS, AL_FILTER_HIGHPASS, AL_FILTER_LOWPASS, AL_FILTER_TYPE, alFilteri, NLSOUND::ISource::FilterBandPass, NLSOUND::ISource::FilterHighPass, NLSOUND::ISource::FilterLowPass, and setupDirectFilter().
| void NLSOUND::CSourceAL::setDirectFilterPassGain | ( | float | passGain | ) | [virtual] |
Set the direct filter gain.
Implements NLSOUND::ISource.
Definition at line 611 of file source_al.cpp.
References _DirectFilterPassGain, min, NLSOUND_MAX_GAIN, NLSOUND_MIN_GAIN, and setupDirectFilter().
| void NLSOUND::CSourceAL::setDirectGain | ( | float | gain | ) | [virtual] |
Set the gain for the direct path.
Implements NLSOUND::ISource.
Definition at line 556 of file source_al.cpp.
References _DirectGain, min, NLSOUND_MAX_GAIN, NLSOUND_MIN_GAIN, and setupDirectFilter().
| void NLSOUND::CSourceAL::setDirection | ( | const NLMISC::CVector & | dir | ) | [virtual] |
Set the direction vector (3D mode only, ignored in stereo mode) (default: (0,0,0) as non-directional).
Set the direction vector (3D mode only).
Implements NLSOUND::ISource.
Definition at line 370 of file source_al.cpp.
References _Source, alTestError, NLMISC::CVector::x, NLMISC::CVector::y, and NLMISC::CVector::z.
| void NLSOUND::CSourceAL::setEffect | ( | IReverbEffect * | reverbEffect | ) | [virtual] |
Set the effect send for this source, NULL to disable. [IEffect], default: NULL.
Implements NLSOUND::ISource.
Definition at line 668 of file source_al.cpp.
References setEffect().
| void NLSOUND::CSourceAL::setEffect | ( | CEffectAL * | effect | ) |
(Internal) Set the effect send for this source, NULL to disable.
Set the effect send for this source, NULL to disable. [IEffect], default: NULL.
Definition at line 661 of file source_al.cpp.
References _Effect, and setupEffectFilter().
Referenced by setEffect().
| void NLSOUND::CSourceAL::setEffectFilter | ( | TFilter | filter, | |
| float | lowFrequency, | |||
| float | highFrequency, | |||
| float | passGain | |||
| ) | [virtual] |
Set the filter parameters for the effect channel.
Implements NLSOUND::ISource.
Definition at line 707 of file source_al.cpp.
References _EffectFilter, _EffectFilterPassGain, _EffectFilterType, AL_FILTER_BANDPASS, AL_FILTER_HIGHPASS, AL_FILTER_LOWPASS, AL_FILTER_TYPE, alFilteri, NLSOUND::ISource::FilterBandPass, NLSOUND::ISource::FilterHighPass, NLSOUND::ISource::FilterLowPass, and setupEffectFilter().
| void NLSOUND::CSourceAL::setEffectFilterPassGain | ( | float | passGain | ) | [virtual] |
Set the effect filter gain.
Implements NLSOUND::ISource.
Definition at line 736 of file source_al.cpp.
References _EffectFilterPassGain, min, NLSOUND_MAX_GAIN, NLSOUND_MIN_GAIN, and setupEffectFilter().
| void NLSOUND::CSourceAL::setEffectGain | ( | float | gain | ) | [virtual] |
Set the gain for the effect path.
Implements NLSOUND::ISource.
Definition at line 681 of file source_al.cpp.
References _EffectGain, min, NLSOUND_MAX_GAIN, NLSOUND_MIN_GAIN, and setupEffectFilter().
| void NLSOUND::CSourceAL::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 388 of file source_al.cpp.
References _Gain, _SoundDriver, _Source, alTestError, NLSOUND::CSoundDriverAL::getOption(), min, NLSOUND_MAX_GAIN, NLSOUND_MIN_GAIN, and NLSOUND::ISoundDriver::OptionManualRolloff.
| void NLSOUND::CSourceAL::setLooping | ( | bool | l | ) | [virtual] |
Set looping on/off for future playbacks (default: off), not available for streaming.
Set looping on/off for future playbacks (default: off).
Implements NLSOUND::ISource.
Definition at line 195 of file source_al.cpp.
References _Source, and alTestError.
| void NLSOUND::CSourceAL::setMinMaxDistances | ( | float | mindist, | |
| float | maxdist, | |||
| bool | deferred = true | |||
| ) | [virtual] |
Set the min and max distances (default: 1, MAX_FLOAT) (3D mode only).
Set the min and max distances (3D mode only).
Implements NLSOUND::ISource.
Definition at line 441 of file source_al.cpp.
References _MaxDistance, _MinDistance, _SoundDriver, _Source, alTestError, NLSOUND::CSoundDriverAL::getOption(), nlassert, and NLSOUND::ISoundDriver::OptionManualRolloff.
| void NLSOUND::CSourceAL::setPitch | ( | float | pitch | ) | [virtual] |
Shift the frequency.
Shift the frequency. 1.0f equals identity, each reduction of 50% equals a pitch shift.
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 409 of file source_al.cpp.
References _Source, alTestError, min, NLSOUND_MAX_PITCH, and NLSOUND_MIN_PITCH.
| void NLSOUND::CSourceAL::setPos | ( | const NLMISC::CVector & | pos, | |
| bool | deffered = true | |||
| ) | [virtual] |
Set the position vector (default: (0,0,0)).
Set the position vector.
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 337 of file source_al.cpp.
References _Pos, _Source, alTestError, NLMISC::CVector::x, NLMISC::CVector::y, and NLMISC::CVector::z.
| void NLSOUND::CSourceAL::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 425 of file source_al.cpp.
References _Source, and alTestError.
Referenced by setStaticBuffer().
| void NLSOUND::CSourceAL::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 128 of file source_al.cpp.
References _Buffer, _Source, alTestError, NLSOUND::CBufferAL::bufferName(), NLSOUND::CBufferAL::isStereo(), and setSourceRelativeMode().
| void NLSOUND::CSourceAL::setStreaming | ( | bool | streaming | ) | [virtual] |
Enable or disable streaming mode. Source must be stopped to call this.
Implements NLSOUND::ISource.
Definition at line 114 of file source_al.cpp.
References _Buffer, _Source, alTestError, isStopped(), and nlassert.
| void NLSOUND::CSourceAL::setupDirectFilter | ( | ) |
(Internal) Setup the direct send filter.
(Internal) Setup the effect send filter.
Definition at line 505 of file source_al.cpp.
References _Direct, _DirectFilter, _DirectFilterEnabled, _DirectFilterPassGain, _DirectFilterType, _DirectGain, _Source, AL_BANDPASS_GAIN, AL_BANDPASS_GAINHF, AL_BANDPASS_GAINLF, AL_DIRECT_FILTER, AL_FILTER_NULL, alFilterf, alTestError, and NLSOUND::ISource::FilterBandPass.
Referenced by enableDirectFilter(), setDirect(), setDirectFilter(), setDirectFilterPassGain(), and setDirectGain().
| void NLSOUND::CSourceAL::setupEffectFilter | ( | ) |
(Internal) Setup the effect send filter.
Definition at line 624 of file source_al.cpp.
References _Effect, _EffectFilter, _EffectFilterEnabled, _EffectFilterPassGain, _EffectFilterType, _EffectGain, _Source, AL_AUXILIARY_SEND_FILTER, AL_BANDPASS_GAIN, AL_BANDPASS_GAINHF, AL_BANDPASS_GAINLF, AL_EFFECTSLOT_NULL, AL_FILTER_NULL, alFilterf, alTestError, NLSOUND::ISource::FilterBandPass, and NLSOUND::CEffectAL::getAuxEffectSlot().
Referenced by enableEffectFilter(), setEffect(), setEffectFilter(), setEffectFilterPassGain(), and setEffectGain().
| void NLSOUND::CSourceAL::setVelocity | ( | const NLMISC::CVector & | vel, | |
| bool | deferred = true | |||
| ) | [virtual] |
Set the velocity vector (3D mode only, ignored in stereo mode) (default: (0,0,0)).
Set the velocity vector (3D mode only).
Implements NLSOUND::ISource.
Definition at line 352 of file source_al.cpp.
References _Source, alTestError, NLMISC::CVector::x, NLMISC::CVector::y, and NLMISC::CVector::z.
| void NLSOUND::CSourceAL::stop | ( | void | ) | [virtual] |
Stop playing.
Implements NLSOUND::ISource.
Definition at line 235 of file source_al.cpp.
References _Buffer, _IsPaused, _IsPlaying, _QueuedBuffers, _Source, and alTestError.
| void NLSOUND::CSourceAL::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 162 of file source_al.cpp.
References _QueuedBuffers, _Source, alTestError, NLSOUND::CBufferAL::bufferName(), and nlassert.
| void NLSOUND::CSourceAL::updateManualRolloff | ( | ) |
(Internal) Update the manual rolloff, only called when using manual rolloff.
(Internal) Update the 3d changes.
Definition at line 104 of file source_al.cpp.
References _Alpha, _Gain, _MaxDistance, _MinDistance, _Pos, _Source, alTestError, NLSOUND::ISource::computeManualRolloff(), NLMISC::CManualSingleton< CListenerAL >::getInstance(), NLSOUND::CListenerAL::getPos(), and NLMISC::CVector::sqrnorm().
double NLSOUND::CSourceAL::_Alpha [private] |
Definition at line 70 of file source_al.h.
Referenced by setAlpha(), and updateManualRolloff().
CBufferAL* NLSOUND::CSourceAL::_Buffer [private] |
Assigned buffer object.
Definition at line 58 of file source_al.h.
Referenced by getStaticBuffer(), pause(), play(), setStaticBuffer(), setStreaming(), and stop().
bool NLSOUND::CSourceAL::_Direct [private] |
Definition at line 78 of file source_al.h.
Referenced by getDirect(), setDirect(), and setupDirectFilter().
ALuint NLSOUND::CSourceAL::_DirectFilter [private] |
Definition at line 63 of file source_al.h.
Referenced by CSourceAL(), release(), setDirectFilter(), and setupDirectFilter().
bool NLSOUND::CSourceAL::_DirectFilterEnabled [private] |
Definition at line 83 of file source_al.h.
Referenced by enableDirectFilter(), isDirectFilterEnabled(), and setupDirectFilter().
Definition at line 84 of file source_al.h.
Referenced by getDirectFilter(), getDirectFilterPassGain(), setDirectFilter(), setDirectFilterPassGain(), and setupDirectFilter().
TFilter NLSOUND::CSourceAL::_DirectFilterType [private] |
Send filters.
Definition at line 82 of file source_al.h.
Referenced by getDirectFilter(), setDirectFilter(), and setupDirectFilter().
float NLSOUND::CSourceAL::_DirectGain [private] |
Definition at line 79 of file source_al.h.
Referenced by getDirectGain(), setDirectGain(), and setupDirectFilter().
CEffectAL* NLSOUND::CSourceAL::_Effect [private] |
Send paths.
Definition at line 77 of file source_al.h.
Referenced by setEffect(), and setupEffectFilter().
ALuint NLSOUND::CSourceAL::_EffectFilter [private] |
Definition at line 63 of file source_al.h.
Referenced by CSourceAL(), release(), setEffectFilter(), and setupEffectFilter().
bool NLSOUND::CSourceAL::_EffectFilterEnabled [private] |
Definition at line 83 of file source_al.h.
Referenced by enableEffectFilter(), isEffectFilterEnabled(), and setupEffectFilter().
Definition at line 84 of file source_al.h.
Referenced by getEffectFilter(), getEffectFilterPassGain(), setEffectFilter(), setEffectFilterPassGain(), and setupEffectFilter().
TFilter NLSOUND::CSourceAL::_EffectFilterType [private] |
Definition at line 82 of file source_al.h.
Referenced by getEffectFilter(), setEffectFilter(), and setupEffectFilter().
float NLSOUND::CSourceAL::_EffectGain [private] |
Definition at line 79 of file source_al.h.
Referenced by getEffectGain(), setEffectGain(), and setupEffectFilter().
float NLSOUND::CSourceAL::_Gain [private] |
Definition at line 69 of file source_al.h.
Referenced by getGain(), setGain(), and updateManualRolloff().
bool NLSOUND::CSourceAL::_IsPaused [private] |
Definition at line 67 of file source_al.h.
bool NLSOUND::CSourceAL::_IsPlaying [private] |
float NLSOUND::CSourceAL::_MaxDistance [private] |
Maximum distance of sound.
Definition at line 74 of file source_al.h.
Referenced by getMinMaxDistances(), setMinMaxDistances(), and updateManualRolloff().
float NLSOUND::CSourceAL::_MinDistance [private] |
Minimum distance of sound at max volume.
Definition at line 72 of file source_al.h.
Referenced by getMinMaxDistances(), setMinMaxDistances(), and updateManualRolloff().
NLMISC::CVector NLSOUND::CSourceAL::_Pos [private] |
Definition at line 68 of file source_al.h.
Referenced by getPos(), setPos(), and updateManualRolloff().
std::queue<CBufferAL *> NLSOUND::CSourceAL::_QueuedBuffers [private] |
Definition at line 59 of file source_al.h.
Referenced by countStreamingBuffers(), stop(), and submitStreamingBuffer().
CSoundDriverAL* NLSOUND::CSourceAL::_SoundDriver [private] |
Sound driver.
Definition at line 55 of file source_al.h.
Referenced by CSourceAL(), release(), setGain(), setMinMaxDistances(), and ~CSourceAL().
ALuint NLSOUND::CSourceAL::_Source [private] |
AL Handles.
Definition at line 62 of file source_al.h.
Referenced by countStreamingBuffers(), CSourceAL(), getCone(), getDirection(), getLooping(), getPitch(), getSource(), getSourceRelativeMode(), getVelocity(), isPaused(), isPlaying(), isStopped(), pause(), play(), release(), setCone(), setDirection(), setGain(), setLooping(), setMinMaxDistances(), setPitch(), setPos(), setSourceRelativeMode(), setStaticBuffer(), setStreaming(), setupDirectFilter(), setupEffectFilter(), setVelocity(), stop(), submitStreamingBuffer(), and updateManualRolloff().
1.6.1