|
Blender
V2.59
|
#include <AUD_SoftwareDevice.h>

Public Member Functions | |
| virtual AUD_DeviceSpecs | getSpecs () const |
| virtual AUD_Handle * | play (AUD_IReader *reader, bool keep=false) |
| virtual AUD_Handle * | play (AUD_IFactory *factory, bool keep=false) |
| virtual bool | pause (AUD_Handle *handle) |
| virtual bool | resume (AUD_Handle *handle) |
| virtual bool | stop (AUD_Handle *handle) |
| virtual bool | getKeep (AUD_Handle *handle) |
| virtual bool | setKeep (AUD_Handle *handle, bool keep) |
| virtual bool | seek (AUD_Handle *handle, float position) |
| virtual float | getPosition (AUD_Handle *handle) |
| virtual AUD_Status | getStatus (AUD_Handle *handle) |
| virtual void | lock () |
| virtual void | unlock () |
| virtual float | getVolume () const |
| virtual void | setVolume (float volume) |
| virtual float | getVolume (AUD_Handle *handle) |
| virtual bool | setVolume (AUD_Handle *handle, float volume) |
| virtual float | getPitch (AUD_Handle *handle) |
| virtual bool | setPitch (AUD_Handle *handle, float pitch) |
| virtual int | getLoopCount (AUD_Handle *handle) |
| virtual bool | setLoopCount (AUD_Handle *handle, int count) |
| virtual bool | setStopCallback (AUD_Handle *handle, stopCallback callback=NULL, void *data=NULL) |
Protected Member Functions | |
| void | create () |
| void | destroy () |
| void | mix (data_t *buffer, int length) |
| virtual void | playing (bool playing)=0 |
Protected Attributes | |
| AUD_DeviceSpecs | m_specs |
| AUD_Mixer * | m_mixer |
This device plays is a generic device with software mixing. Classes implementing this have to:
Definition at line 51 of file AUD_SoftwareDevice.h.
| void AUD_SoftwareDevice::create | ( | ) | [protected] |
Initializes member variables.
Definition at line 64 of file AUD_SoftwareDevice.cpp.
References m_mixer, and m_specs.
Referenced by AUD_JackDevice::AUD_JackDevice(), AUD_ReadDevice::AUD_ReadDevice(), and AUD_SDLDevice::AUD_SDLDevice().
| void AUD_SoftwareDevice::destroy | ( | ) | [protected] |
Uninitializes member variables.
Definition at line 79 of file AUD_SoftwareDevice.cpp.
References m_mixer, playing(), and AUD_SoftwareHandle::reader.
Referenced by AUD_JackDevice::AUD_JackDevice(), AUD_JackDevice::~AUD_JackDevice(), AUD_ReadDevice::~AUD_ReadDevice(), and AUD_SDLDevice::~AUD_SDLDevice().
| bool AUD_SoftwareDevice::getKeep | ( | AUD_Handle * | handle | ) | [virtual] |
Gets the behaviour of the device for a played back sound when the sound doesn't return any more samples.
| handle | The handle returned by the play function. |
Implements AUD_IDevice.
Definition at line 340 of file AUD_SoftwareDevice.cpp.
| int AUD_SoftwareDevice::getLoopCount | ( | AUD_Handle * | handle | ) | [virtual] |
Retrieves the loop count of a playing sound. A negative value indicates infinity.
Implements AUD_IDevice.
Definition at line 489 of file AUD_SoftwareDevice.cpp.
| float AUD_SoftwareDevice::getPitch | ( | AUD_Handle * | handle | ) | [virtual] |
Retrieves the pitch of a playing sound.
Implements AUD_IDevice.
Definition at line 479 of file AUD_SoftwareDevice.cpp.
| float AUD_SoftwareDevice::getPosition | ( | AUD_Handle * | handle | ) | [virtual] |
Retrieves the current playback position of a sound.
| handle | The handle returned by the play function. |
Implements AUD_IDevice.
Definition at line 389 of file AUD_SoftwareDevice.cpp.
References AUD_IReader::getPosition(), lock(), m_specs, AUD_DeviceSpecs::rate, AUD_SoftwareHandle::reader, and unlock().
| AUD_DeviceSpecs AUD_SoftwareDevice::getSpecs | ( | ) | const [virtual] |
Returns the specification of the device.
Implements AUD_IDevice.
Definition at line 211 of file AUD_SoftwareDevice.cpp.
References m_specs.
| AUD_Status AUD_SoftwareDevice::getStatus | ( | AUD_Handle * | handle | ) | [virtual] |
Returns the status of a played back sound.
| handle | The handle returned by the play function. |
Implements AUD_IDevice.
Definition at line 406 of file AUD_SoftwareDevice.cpp.
References AUD_STATUS_INVALID, AUD_STATUS_PAUSED, AUD_STATUS_PLAYING, i, lock(), and unlock().
| float AUD_SoftwareDevice::getVolume | ( | ) | const [virtual] |
Retrieves the overall device volume.
Implements AUD_IDevice.
Definition at line 449 of file AUD_SoftwareDevice.cpp.
| float AUD_SoftwareDevice::getVolume | ( | AUD_Handle * | handle | ) | [virtual] |
Retrieves the volume of a playing sound.
| handle | The sound handle. |
Implements AUD_IDevice.
Definition at line 459 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.
Implements AUD_IDevice.
Definition at line 439 of file AUD_SoftwareDevice.cpp.
Referenced by getKeep(), getLoopCount(), getPosition(), getStatus(), getVolume(), mix(), pause(), play(), resume(), seek(), setKeep(), setLoopCount(), setStopCallback(), setVolume(), stop(), and AUD_SDLDevice::~AUD_SDLDevice().
| void AUD_SoftwareDevice::mix | ( | data_t * | buffer, |
| int | length | ||
| ) | [protected] |
Mixes the next samples into the buffer.
| buffer | The target buffer. |
| length | The length in samples to be filled. |
Definition at line 109 of file AUD_SoftwareDevice.cpp.
References AUD_Mixer::add(), AUD_SAMPLE_SIZE, AUD_Buffer::getBuffer(), AUD_SoftwareHandle::keep, length(), lock(), AUD_SoftwareHandle::loopcount, m_mixer, m_specs, pause(), AUD_IReader::read(), AUD_SoftwareHandle::reader, AUD_IReader::seek(), AUD_SoftwareHandle::stop, stop(), AUD_SoftwareHandle::stop_data, AUD_Mixer::superpose(), unlock(), and AUD_SoftwareHandle::volume.
Referenced by AUD_ReadDevice::read().
| bool AUD_SoftwareDevice::pause | ( | AUD_Handle * | handle | ) | [virtual] |
Pauses a played back sound.
| handle | The handle returned by the play function. |
Implements AUD_IDevice.
Definition at line 247 of file AUD_SoftwareDevice.cpp.
References i, lock(), playing(), and unlock().
Referenced by mix().
| AUD_Handle * AUD_SoftwareDevice::play | ( | AUD_IReader * | reader, |
| bool | keep = false |
||
| ) | [virtual] |
Plays a sound source.
| reader | The reader to play. |
| keep | When keep is true the sound source will not be deleted but set to paused when its end has been reached. |
| AUD_Exception | Thrown if there's an unexpected (from the device side) error during creation of the reader. |
Implements AUD_IDevice.
Definition at line 216 of file AUD_SoftwareDevice.cpp.
References AUD_SoftwareHandle::keep, lock(), AUD_SoftwareHandle::loopcount, m_mixer, NULL, playing(), AUD_Mixer::prepare(), AUD_SoftwareHandle::reader, AUD_SoftwareHandle::stop, AUD_SoftwareHandle::stop_data, unlock(), and AUD_SoftwareHandle::volume.
Referenced by AUD_playDevice(), and play().
| AUD_Handle * AUD_SoftwareDevice::play | ( | AUD_IFactory * | factory, |
| bool | keep = false |
||
| ) | [virtual] |
Plays a sound source.
| factory | The factory to create the reader for the sound source. |
| keep | When keep is true the sound source will not be deleted but set to paused when its end has been reached. |
| AUD_Exception | Thrown if there's an unexpected (from the device side) error during creation of the reader. |
Implements AUD_IDevice.
Definition at line 242 of file AUD_SoftwareDevice.cpp.
References AUD_IFactory::createReader(), and play().
| virtual void AUD_SoftwareDevice::playing | ( | bool | playing | ) | [protected, pure virtual] |
This function tells the device, to start or pause playback.
| playing | True if device should playback. |
Implemented in AUD_JackDevice, AUD_SDLDevice, and AUD_ReadDevice.
Referenced by destroy(), pause(), play(), resume(), and stop().
| bool AUD_SoftwareDevice::resume | ( | AUD_Handle * | handle | ) | [virtual] |
Resumes a paused sound.
| handle | The handle returned by the play function. |
Implements AUD_IDevice.
Definition at line 273 of file AUD_SoftwareDevice.cpp.
| bool AUD_SoftwareDevice::seek | ( | AUD_Handle * | handle, |
| float | position | ||
| ) | [virtual] |
Seeks in a played back sound.
| handle | The handle returned by the play function. |
| position | The new position from where to play back, in seconds. |
Implements AUD_IDevice.
Definition at line 371 of file AUD_SoftwareDevice.cpp.
References AUD_IReader::getSpecs(), lock(), AUD_Specs::rate, AUD_IReader::seek(), and unlock().
Referenced by AUD_playDevice().
| bool AUD_SoftwareDevice::setKeep | ( | AUD_Handle * | handle, |
| bool | keep | ||
| ) | [virtual] |
Sets the behaviour of the device for a played back sound when the sound doesn't return any more samples.
| handle | The handle returned by the play function. |
| keep | True when the source should be paused and not deleted. |
Implements AUD_IDevice.
Definition at line 354 of file AUD_SoftwareDevice.cpp.
| bool AUD_SoftwareDevice::setLoopCount | ( | AUD_Handle * | handle, |
| int | count | ||
| ) | [virtual] |
Sets the loop count of a playing sound. A negative value indicates infinity.
| handle | The sound handle. |
| count | The new loop count. |
Implements AUD_IDevice.
Definition at line 499 of file AUD_SoftwareDevice.cpp.
| bool AUD_SoftwareDevice::setPitch | ( | AUD_Handle * | handle, |
| float | pitch | ||
| ) | [virtual] |
Sets the pitch of a playing sound.
| handle | The sound handle. |
| pitch | The pitch. |
Implements AUD_IDevice.
Definition at line 484 of file AUD_SoftwareDevice.cpp.
| bool AUD_SoftwareDevice::setStopCallback | ( | AUD_Handle * | handle, |
| stopCallback | callback = NULL, |
||
| void * | data = NULL |
||
| ) | [virtual] |
Sets the callback function that's called when the end of a playing sound is reached.
| handle | The sound handle. |
| callback | The callback function. |
| data | The data that should be passed to the callback function. |
Implements AUD_IDevice.
Definition at line 509 of file AUD_SoftwareDevice.cpp.
References lock(), AUD_SoftwareHandle::stop, AUD_SoftwareHandle::stop_data, and unlock().
| void AUD_SoftwareDevice::setVolume | ( | float | volume | ) | [virtual] |
Sets the overall device volume.
| handle | The sound handle. |
| volume | The overall device volume. |
Implements AUD_IDevice.
Definition at line 454 of file AUD_SoftwareDevice.cpp.
Referenced by AUD_setDeviceSoundVolume(), and AUD_setDeviceVolume().
| bool AUD_SoftwareDevice::setVolume | ( | AUD_Handle * | handle, |
| float | volume | ||
| ) | [virtual] |
Sets the volume of a playing sound.
| handle | The sound handle. |
| volume | The volume. |
Implements AUD_IDevice.
Definition at line 469 of file AUD_SoftwareDevice.cpp.
| bool AUD_SoftwareDevice::stop | ( | AUD_Handle * | handle | ) | [virtual] |
Stops a played back or paused sound. The handle is definitely invalid afterwards.
| handle | The handle returned by the play function. |
Implements AUD_IDevice.
Definition at line 299 of file AUD_SoftwareDevice.cpp.
References i, lock(), playing(), and unlock().
Referenced by mix().
| void AUD_SoftwareDevice::unlock | ( | ) | [virtual] |
Unlocks the previously locked device.
Implements AUD_IDevice.
Definition at line 444 of file AUD_SoftwareDevice.cpp.
Referenced by getKeep(), getLoopCount(), getPosition(), getStatus(), getVolume(), mix(), pause(), play(), resume(), seek(), setKeep(), setLoopCount(), setStopCallback(), setVolume(), stop(), and AUD_SDLDevice::~AUD_SDLDevice().
AUD_Mixer* AUD_SoftwareDevice::m_mixer [protected] |
AUD_DeviceSpecs AUD_SoftwareDevice::m_specs [protected] |
The specification of the device.
Definition at line 57 of file AUD_SoftwareDevice.h.
Referenced by AUD_JackDevice::AUD_JackDevice(), AUD_ReadDevice::AUD_ReadDevice(), AUD_SDLDevice::AUD_SDLDevice(), create(), AUD_JackDevice::getPlaybackPosition(), getPosition(), getSpecs(), mix(), AUD_ReadDevice::read(), AUD_JackDevice::seekPlayback(), and AUD_JackDevice::~AUD_JackDevice().