Blender V2.61 - r43446
Classes | Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes

AUD_SoftwareDevice Class Reference

#include <AUD_SoftwareDevice.h>

Inheritance diagram for AUD_SoftwareDevice:
Inheritance graph
[legend]

List of all members.

Classes

class  AUD_SoftwareHandle
 Saves the data for playback. More...

Public Member Functions

void setQuality (bool quality)
virtual AUD_DeviceSpecs getSpecs () const
virtual AUD_Reference
< AUD_IHandle
play (AUD_Reference< AUD_IReader > reader, bool keep=false)
virtual AUD_Reference
< AUD_IHandle
play (AUD_Reference< AUD_IFactory > factory, bool keep=false)
virtual void stopAll ()
virtual void lock ()
virtual void unlock ()
virtual float getVolume () const
virtual void setVolume (float volume)
virtual AUD_Vector3 getListenerLocation () const
virtual void setListenerLocation (const AUD_Vector3 &location)
virtual AUD_Vector3 getListenerVelocity () const
virtual void setListenerVelocity (const AUD_Vector3 &velocity)
virtual AUD_Quaternion getListenerOrientation () const
virtual void setListenerOrientation (const AUD_Quaternion &orientation)
virtual float getSpeedOfSound () const
virtual void setSpeedOfSound (float speed)
virtual float getDopplerFactor () const
virtual void setDopplerFactor (float factor)
virtual AUD_DistanceModel getDistanceModel () const
virtual void setDistanceModel (AUD_DistanceModel model)

Static Public Member Functions

static void setPanning (AUD_IHandle *handle, float pan)

Protected Types

typedef std::list
< AUD_Reference
< AUD_SoftwareHandle >
>::iterator 
AUD_HandleIterator

Protected Member Functions

void create ()
void destroy ()
void mix (data_t *buffer, int length)
virtual void playing (bool playing)=0
void setSpecs (AUD_Specs specs)

Protected Attributes

AUD_DeviceSpecs m_specs
AUD_Reference< AUD_Mixerm_mixer
bool m_quality

Detailed Description

This device plays is a generic device with software mixing. Classes implementing this have to:

Definition at line 54 of file AUD_SoftwareDevice.h.


Member Typedef Documentation

typedef std::list<AUD_Reference<AUD_SoftwareHandle> >::iterator AUD_SoftwareDevice::AUD_HandleIterator [protected]

Definition at line 209 of file AUD_SoftwareDevice.h.


Member Function Documentation

void AUD_SoftwareDevice::create ( ) [protected]
void AUD_SoftwareDevice::destroy ( ) [protected]
AUD_DistanceModel AUD_SoftwareDevice::getDistanceModel ( ) const [virtual]

Retrieves the distance model.

Returns:
The distance model.

Implements AUD_I3DDevice.

Definition at line 942 of file AUD_SoftwareDevice.cpp.

float AUD_SoftwareDevice::getDopplerFactor ( ) const [virtual]

Retrieves the doppler factor. This value is a scaling factor for the velocity vectors of sources and listener which is used while calculating the doppler effect.

Returns:
The doppler factor.

Implements AUD_I3DDevice.

Definition at line 928 of file AUD_SoftwareDevice.cpp.

AUD_Vector3 AUD_SoftwareDevice::getListenerLocation ( ) const [virtual]

Retrieves the listener location.

Returns:
The listener location.

Implements AUD_I3DDevice.

Definition at line 888 of file AUD_SoftwareDevice.cpp.

AUD_Quaternion AUD_SoftwareDevice::getListenerOrientation ( ) const [virtual]

Retrieves the listener orientation.

Returns:
The listener orientation as quaternion.

Implements AUD_I3DDevice.

Definition at line 908 of file AUD_SoftwareDevice.cpp.

AUD_Vector3 AUD_SoftwareDevice::getListenerVelocity ( ) const [virtual]

Retrieves the listener velocity.

Returns:
The listener velocity.

Implements AUD_I3DDevice.

Definition at line 898 of file AUD_SoftwareDevice.cpp.

AUD_DeviceSpecs AUD_SoftwareDevice::getSpecs ( ) const [virtual]

Returns the specification of the device.

Implements AUD_IDevice.

Definition at line 804 of file AUD_SoftwareDevice.cpp.

References m_specs.

float AUD_SoftwareDevice::getSpeedOfSound ( ) const [virtual]

Retrieves the speed of sound. This value is needed for doppler effect calculation.

Returns:
The speed of sound.

Implements AUD_I3DDevice.

Definition at line 918 of file AUD_SoftwareDevice.cpp.

float AUD_SoftwareDevice::getVolume ( ) const [virtual]

Retrieves the overall device volume.

Returns:
The overall device volume.

Implements AUD_IDevice.

Definition at line 874 of file AUD_SoftwareDevice.cpp.

void AUD_SoftwareDevice::lock ( ) [virtual]

Locks the device. Used to make sure that between lock and unlock, no buffers are read, so that it is possible to start, resume, pause, stop or seek several playback handles simultaneously.

Warning:
Make sure the locking time is as small as possible to avoid playback delays that result in unexpected noise and cracks.

Implements AUD_IDevice.

Definition at line 864 of file AUD_SoftwareDevice.cpp.

Referenced by mix(), play(), stopAll(), and AUD_SDLDevice::~AUD_SDLDevice().

void AUD_SoftwareDevice::mix ( data_t buffer,
int  length 
) [protected]

Mixes the next samples into the buffer.

Parameters:
bufferThe target buffer.
lengthThe length in samples to be filled.

Definition at line 690 of file AUD_SoftwareDevice.cpp.

References AUD_Buffer::assureSize(), AUD_SAMPLE_SIZE, AUD_Buffer::getBuffer(), len(), length(), lock(), m_mixer, m_specs, and unlock().

Referenced by AUD_ReadDevice::read().

AUD_Reference< AUD_IHandle > AUD_SoftwareDevice::play ( AUD_Reference< AUD_IReader reader,
bool  keep = false 
) [virtual]

Plays a sound source.

Parameters:
readerThe reader to play.
keepWhen keep is true the sound source will not be deleted but set to paused when its end has been reached.
Returns:
Returns a handle with which the playback can be controlled. This is NULL if the sound couldn't be played back.
Exceptions:
AUD_ExceptionThrown if there's an unexpected (from the device side) error during creation of the reader.

Implements AUD_IDevice.

Definition at line 809 of file AUD_SoftwareDevice.cpp.

References AUD_DeviceSpecs::channels, AUD_Reference< T >::isNull(), lock(), m_quality, m_specs, playing(), AUD_DeviceSpecs::specs, and unlock().

Referenced by AUD_openMixdownDevice(), AUD_SequencerHandle::AUD_SequencerHandle(), play(), and AUD_SequencerHandle::update().

AUD_Reference< AUD_IHandle > AUD_SoftwareDevice::play ( AUD_Reference< AUD_IFactory factory,
bool  keep = false 
) [virtual]

Plays a sound source.

Parameters:
factoryThe factory to create the reader for the sound source.
keepWhen keep is true the sound source will not be deleted but set to paused when its end has been reached.
Returns:
Returns a handle with which the playback can be controlled. This is NULL if the sound couldn't be played back.
Exceptions:
AUD_ExceptionThrown if there's an unexpected (from the device side) error during creation of the reader.

Implements AUD_IDevice.

Definition at line 846 of file AUD_SoftwareDevice.cpp.

References play().

virtual void AUD_SoftwareDevice::playing ( bool  playing) [protected, pure virtual]

This function tells the device, to start or pause playback.

Parameters:
playingTrue if device should playback.

Implemented in AUD_ReadDevice, AUD_JackDevice, and AUD_SDLDevice.

Referenced by destroy(), and play().

void AUD_SoftwareDevice::setDistanceModel ( AUD_DistanceModel  model) [virtual]

Sets the distance model.

Parameters:
modeldistance model.

Implements AUD_I3DDevice.

Definition at line 947 of file AUD_SoftwareDevice.cpp.

References AUD_DISTANCE_MODEL_INVALID, and AUD_RENDER_DISTANCE.

Referenced by AUD_SequencerReader::read().

void AUD_SoftwareDevice::setDopplerFactor ( float  factor) [virtual]

Sets the doppler factor. This value is a scaling factor for the velocity vectors of sources and listener which is used while calculating the doppler effect.

Parameters:
factorThe new doppler factor.

Implements AUD_I3DDevice.

Definition at line 933 of file AUD_SoftwareDevice.cpp.

References AUD_RENDER_DOPPLER.

Referenced by AUD_SequencerReader::read().

void AUD_SoftwareDevice::setListenerLocation ( const AUD_Vector3 location) [virtual]

Sets the listener location.

Parameters:
locationThe new location.

Implements AUD_I3DDevice.

Definition at line 893 of file AUD_SoftwareDevice.cpp.

Referenced by AUD_SequencerReader::read().

void AUD_SoftwareDevice::setListenerOrientation ( const AUD_Quaternion orientation) [virtual]

Sets the listener orientation.

Parameters:
orientationThe new orientation as quaternion.

Implements AUD_I3DDevice.

Definition at line 913 of file AUD_SoftwareDevice.cpp.

Referenced by AUD_SequencerReader::read().

void AUD_SoftwareDevice::setListenerVelocity ( const AUD_Vector3 velocity) [virtual]

Sets the listener velocity.

Parameters:
velocityThe new velocity.

Implements AUD_I3DDevice.

Definition at line 903 of file AUD_SoftwareDevice.cpp.

Referenced by AUD_SequencerReader::read().

void AUD_SoftwareDevice::setPanning ( AUD_IHandle handle,
float  pan 
) [static]

Sets the panning of a specific handle.

Parameters:
handleThe handle to set the panning from.
panThe new panning value, should be in the range [-2, 2].

Definition at line 782 of file AUD_SoftwareDevice.cpp.

References AUD_SoftwareDevice::AUD_SoftwareHandle::m_user_pan.

Referenced by AUD_SequencerHandle::update().

void AUD_SoftwareDevice::setQuality ( bool  quality)

Sets the resampling quality.

Parameters:
qualityLow (false) or high (true) quality.

Definition at line 788 of file AUD_SoftwareDevice.cpp.

References m_quality.

Referenced by AUD_openMixdownDevice(), and AUD_SequencerReader::AUD_SequencerReader().

void AUD_SoftwareDevice::setSpecs ( AUD_Specs  specs) [protected]

Sets the audio output specification of the device.

Parameters:
sepcsThe output specification.

Definition at line 793 of file AUD_SoftwareDevice.cpp.

References m_mixer, m_specs, and AUD_DeviceSpecs::specs.

Referenced by AUD_ReadDevice::changeSpecs().

void AUD_SoftwareDevice::setSpeedOfSound ( float  speed) [virtual]

Sets the speed of sound. This value is needed for doppler effect calculation.

Parameters:
speedThe new speed of sound.

Implements AUD_I3DDevice.

Definition at line 923 of file AUD_SoftwareDevice.cpp.

Referenced by AUD_SequencerReader::read().

void AUD_SoftwareDevice::setVolume ( float  volume) [virtual]

Sets the overall device volume.

Parameters:
handleThe sound handle.
volumeThe overall device volume.

Implements AUD_IDevice.

Definition at line 879 of file AUD_SoftwareDevice.cpp.

Referenced by AUD_openMixdownDevice(), and AUD_SequencerReader::read().

void AUD_SoftwareDevice::stopAll ( ) [virtual]

Stops all playing sounds.

Implements AUD_IDevice.

Definition at line 851 of file AUD_SoftwareDevice.cpp.

References lock(), and unlock().

void AUD_SoftwareDevice::unlock ( ) [virtual]

Unlocks the previously locked device.

Implements AUD_IDevice.

Definition at line 869 of file AUD_SoftwareDevice.cpp.

Referenced by mix(), play(), stopAll(), and AUD_SDLDevice::~AUD_SDLDevice().


Member Data Documentation

The mixer.

Definition at line 219 of file AUD_SoftwareDevice.h.

Referenced by create(), mix(), and setSpecs().

Whether to do high or low quality resampling.

Definition at line 224 of file AUD_SoftwareDevice.h.

Referenced by create(), play(), and setQuality().


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