Audaspace 1.5.0
A high level audio library.
Loading...
Searching...
No Matches
Public Member Functions | List of all members
IDevice Interface Referenceabstract

The IDevice interface represents an output device for sound sources. More...

#include <IDevice.h>

Inheritance diagram for IDevice:
Inheritance graph
[legend]

Public Member Functions

virtual ~IDevice ()
 Destroys the device.
 
virtual DeviceSpecs getSpecs () const =0
 Returns the specification of the device.
 
virtual std::shared_ptr< IHandleplay (std::shared_ptr< IReader > reader, bool keep=false)=0
 Plays a sound source.
 
virtual std::shared_ptr< IHandleplay (std::shared_ptr< ISound > sound, bool keep=false)=0
 Plays a sound source.
 
virtual void stopAll ()=0
 Stops all playing sounds.
 
virtual void lock ()=0
 Locks the device.
 
virtual void unlock ()=0
 Unlocks the previously locked device.
 
virtual float getVolume () const =0
 Retrieves the overall device volume.
 
virtual void setVolume (float volume)=0
 Sets the overall device volume.
 
virtual ISynchronizergetSynchronizer ()=0
 Retrieves the synchronizer for this device, which enables accurate synchronization between audio playback and video playback for example.
 

Detailed Description

The IDevice interface represents an output device for sound sources.

Output devices may be several backends such as platform independand like SDL or OpenAL or platform specific like ALSA, but they may also be files, RAM buffers or other types of streams.

Warning
Thread safety must be insured so that no reader is being called twice at the same time.

Member Function Documentation

◆ getSpecs()

virtual DeviceSpecs IDevice::getSpecs ( ) const
pure virtual

Returns the specification of the device.

Implemented in NULLDevice, SoftwareDevice, and OpenALDevice.

◆ getSynchronizer()

virtual ISynchronizer * IDevice::getSynchronizer ( )
pure virtual

Retrieves the synchronizer for this device, which enables accurate synchronization between audio playback and video playback for example.

Returns
The synchronizer which will be the DefaultSynchronizer if synchonization is not supported.

Implemented in NULLDevice, SoftwareDevice, CoreAudioDevice, JackDevice, OpenALDevice, and PulseAudioDevice.

◆ getVolume()

virtual float IDevice::getVolume ( ) const
pure virtual

Retrieves the overall device volume.

Returns
The overall device volume.

Implemented in NULLDevice, SoftwareDevice, and OpenALDevice.

◆ lock()

virtual void IDevice::lock ( )
pure 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 ILockable.

Implemented in NULLDevice, SoftwareDevice, and OpenALDevice.

◆ play() [1/2]

virtual std::shared_ptr< IHandle > IDevice::play ( std::shared_ptr< IReader > reader,
bool keep = false )
pure 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 nullptr if the sound couldn't be played back.
Exceptions
ExceptionThrown if there's an unexpected (from the device side) error during creation of the reader.

Implemented in NULLDevice, SoftwareDevice, and OpenALDevice.

◆ play() [2/2]

virtual std::shared_ptr< IHandle > IDevice::play ( std::shared_ptr< ISound > sound,
bool keep = false )
pure virtual

Plays a sound source.

Parameters
soundThe sound 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 nullptr if the sound couldn't be played back.
Exceptions
ExceptionThrown if there's an unexpected (from the device side) error during creation of the reader.

Implemented in NULLDevice, SoftwareDevice, and OpenALDevice.

◆ setVolume()

virtual void IDevice::setVolume ( float volume)
pure virtual

Sets the overall device volume.

Parameters
volumeThe overall device volume.

Implemented in NULLDevice, SoftwareDevice, and OpenALDevice.

◆ stopAll()

virtual void IDevice::stopAll ( )
pure virtual

Stops all playing sounds.

Implemented in NULLDevice, SoftwareDevice, and OpenALDevice.

◆ unlock()

virtual void IDevice::unlock ( )
pure virtual

Unlocks the previously locked device.

Implements ILockable.

Implemented in NULLDevice, SoftwareDevice, and OpenALDevice.


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