Audaspace 1.5.0
A high level audio library.
Loading...
Searching...
No Matches
Public Member Functions | List of all members
BinauralSound Class Reference

This class represents a sound that can sound different depending on its realtive position with the listener. More...

#include <BinauralSound.h>

Inheritance diagram for BinauralSound:
Inheritance graph
[legend]

Public Member Functions

 BinauralSound (std::shared_ptr< ISound > sound, std::shared_ptr< HRTF > hrtfs, std::shared_ptr< Source > source, std::shared_ptr< ThreadPool > threadPool, std::shared_ptr< FFTPlan > plan)
 Creates a new ConvolverSound.
 
 BinauralSound (std::shared_ptr< ISound > sound, std::shared_ptr< HRTF > hrtfs, std::shared_ptr< Source > source, std::shared_ptr< ThreadPool > threadPool)
 Creates a new BinauralSound.
 
virtual std::shared_ptr< IReadercreateReader ()
 Creates a reader for playback of the sound source.
 
std::shared_ptr< HRTFgetHRTFs ()
 Retrieves the HRTF set being used.
 
void setHRTFs (std::shared_ptr< HRTF > hrtfs)
 Changes the set of HRTFs used for convolution, it'll only affect newly created readers.
 
std::shared_ptr< SourcegetSource ()
 Retrieves the Source object being used.
 
void setSource (std::shared_ptr< Source > source)
 Changes the Source object used to change the source position of the sound.
 
- Public Member Functions inherited from ISound
virtual ~ISound ()
 Destroys the sound.
 

Detailed Description

This class represents a sound that can sound different depending on its realtive position with the listener.

Constructor & Destructor Documentation

◆ BinauralSound() [1/2]

BinauralSound::BinauralSound ( std::shared_ptr< ISound > sound,
std::shared_ptr< HRTF > hrtfs,
std::shared_ptr< Source > source,
std::shared_ptr< ThreadPool > threadPool,
std::shared_ptr< FFTPlan > plan )

Creates a new ConvolverSound.

Parameters
soundThe sound that will be convolved. It must have only one channel.
hrtfsThe HRTF set that will be used.
sourceA shared pointer to a Source object that contains the source of the sound.
threadPoolA shared pointer to a ThreadPool object with 1 or more threads.
planA shared pointer to a FFTPlan object that will be used for convolution.
Warning
The same FFTPlan object must be used to construct both this and the HRTF object provided.

◆ BinauralSound() [2/2]

BinauralSound::BinauralSound ( std::shared_ptr< ISound > sound,
std::shared_ptr< HRTF > hrtfs,
std::shared_ptr< Source > source,
std::shared_ptr< ThreadPool > threadPool )

Creates a new BinauralSound.

A default FFT plan will be created.

Parameters
soundThe sound that will be convolved. Must have only one channel.
hrtfsThe HRTF set that will be used.
sourceA shared pointer to a Source object that contains the source of the sound.
threadPoolA shared pointer to a ThreadPool object with 1 or more threads.
Warning
To use this constructor no FFTPlan object must have been provided to the hrtfs.

Member Function Documentation

◆ createReader()

virtual std::shared_ptr< IReader > BinauralSound::createReader ( )
virtual

Creates a reader for playback of the sound source.

Returns
A pointer to an IReader object or nullptr if there has been an error.
Exceptions
ExceptionAn exception may be thrown if there has been a more unexpected error during reader creation.

Implements ISound.

◆ getHRTFs()

std::shared_ptr< HRTF > BinauralSound::getHRTFs ( )

Retrieves the HRTF set being used.

Returns
A shared pointer to the current HRTF object being used.

◆ getSource()

std::shared_ptr< Source > BinauralSound::getSource ( )

Retrieves the Source object being used.

Returns
A shared pointer to the current Source object being used.

◆ setHRTFs()

void BinauralSound::setHRTFs ( std::shared_ptr< HRTF > hrtfs)

Changes the set of HRTFs used for convolution, it'll only affect newly created readers.

Parameters
hrtfsA shared pointer to the new HRTF object.

◆ setSource()

void BinauralSound::setSource ( std::shared_ptr< Source > source)

Changes the Source object used to change the source position of the sound.

Parameters
sourceA shared pointer to the new Source object.

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