#include <SpatialSource.h>
Public Member Functions | |
SpatialSource () | |
constructors | |
SpatialSource (UnitGenerator &input, float azi=0.0, float ele=0.0, float dist=1.0) | |
virtual | ~SpatialSource () |
virtual void | setPosition (CPoint pos) |
Set the sound source position in cartesian coordinates. | |
virtual void | setPosition (float x=0., float y=0., float z=0.) |
virtual void | setPosition (double x=0., double y=0., double z=0.) |
virtual void | setPosition (char s, float azi=0, float ele=0, float dist=1.0) |
Set the sound source position in spherical coordinates (degrees). | |
virtual void | setPosition (char s, double azi=0, double ele=0, double dist=1.0) |
CPoint & | getPosition () |
void | setAzimuth (float val) |
void | setElevation (float val) |
Sets the horizontal angle. | |
void | setDistance (float val) |
Sets the angle of elevation. | |
float | azimuth () |
Sets the distance from the center. | |
float | elevation () |
Returns the horizontal angle. | |
float | distance () |
Returns the angle of elevation. | |
CPoint * | position (unsigned channelNum=0) |
Returns the distance from the center. | |
virtual bool | positionChanged () |
Returns whether the sound source position changed since last block call. | |
virtual void | nextBuffer (Buffer &outputBuffer, unsigned outBufNum) throw (CException) |
virtual void | nextBuffer (Buffer &outputBuffer) throw (CException) |
void | dump () |
pretty-print the receiver | |
Protected Attributes | |
CPoint * | mPosition |
source position | |
bool | mPositionChanged |
true if this source's position has changed recently |
SpatialSource::SpatialSource | ( | ) |
constructors
SpatialSource::SpatialSource | ( | UnitGenerator & | input, | |
float | azi = 0.0 , |
|||
float | ele = 0.0 , |
|||
float | dist = 1.0 | |||
) |
References csl::Controllable::addInput(), CSL_INPUT, CSL_PI, kPolar, csl::logMsg(), and mPosition.
SpatialSource::~SpatialSource | ( | ) | [virtual] |
References mPosition.
void SpatialSource::setPosition | ( | CPoint | pos | ) | [virtual] |
Set the sound source position in cartesian coordinates.
References mPosition.
Referenced by main(), PMESource::set_position(), and PMESource::update_position().
void SpatialSource::setPosition | ( | float | x = 0. , |
|
float | y = 0. , |
|||
float | z = 0. | |||
) | [virtual] |
References mPosition, mPositionChanged, and csl::CPoint::set().
void SpatialSource::setPosition | ( | double | x = 0. , |
|
double | y = 0. , |
|||
double | z = 0. | |||
) | [virtual] |
References mPosition, mPositionChanged, and csl::CPoint::set().
void SpatialSource::setPosition | ( | char | s, | |
float | azi = 0 , |
|||
float | ele = 0 , |
|||
float | dist = 1.0 | |||
) | [virtual] |
Set the sound source position in spherical coordinates (degrees).
References CSL_PI, kPolar, mPosition, mPositionChanged, and csl::CPoint::set().
void SpatialSource::setPosition | ( | char | s, | |
double | azi = 0 , |
|||
double | ele = 0 , |
|||
double | dist = 1.0 | |||
) | [virtual] |
References CSL_PI, kPolar, mPosition, mPositionChanged, and csl::CPoint::set().
CPoint& csl::SpatialSource::getPosition | ( | ) | [inline] |
void csl::SpatialSource::setAzimuth | ( | float | val | ) | [inline] |
void csl::SpatialSource::setElevation | ( | float | val | ) | [inline] |
Sets the horizontal angle.
References mPosition, and csl::CPoint::setElevation().
Referenced by main().
void csl::SpatialSource::setDistance | ( | float | val | ) | [inline] |
float csl::SpatialSource::azimuth | ( | ) | [inline] |
Sets the distance from the center.
References mPosition, and csl::CPoint::theta().
Referenced by dump(), main(), and csl::AmbisonicEncoder::nextBuffer().
float csl::SpatialSource::elevation | ( | ) | [inline] |
Returns the horizontal angle.
References csl::CPoint::ele(), and mPosition.
Referenced by dump(), main(), and csl::AmbisonicEncoder::nextBuffer().
float csl::SpatialSource::distance | ( | ) | [inline] |
CPoint * SpatialSource::position | ( | unsigned | channelNum = 0 |
) |
Returns the distance from the center.
References mPosition.
Referenced by csl::DistanceSimulator::DistanceSimulator(), csl::VBAP::nextBuffer(), and csl::BinauralPanner::nextBuffer().
virtual bool csl::SpatialSource::positionChanged | ( | ) | [inline, virtual] |
Returns whether the sound source position changed since last block call.
Reimplemented in csl::DistanceSimulator.
References mPositionChanged.
Referenced by csl::VBAP::nextBuffer(), and csl::BinauralPanner::nextBuffer().
void SpatialSource::nextBuffer | ( | Buffer & | outputBuffer, | |
unsigned | outBufNum | |||
) | throw (CException) [virtual] |
really compute the next buffer given an offset base channel; this is called by nextBuffer, possibly multiple times
Reimplemented from csl::UnitGenerator.
Reimplemented in csl::DistanceSimulator.
References CSL_INPUT, csl::Port::mUGen, and csl::UnitGenerator::nextBuffer().
Referenced by csl::VBAP::nextBuffer(), and csl::BinauralPanner::nextBuffer().
void SpatialSource::nextBuffer | ( | Buffer & | outputBuffer | ) | throw (CException) [virtual] |
get a buffer of Frames -- this is the core CSL "pull" function; the given buffer can be written into, and a changed() message is sent.
Reimplemented from csl::UnitGenerator.
References csl::logMsg().
void SpatialSource::dump | ( | void | ) | [virtual] |
pretty-print the receiver
Reimplemented from csl::UnitGenerator.
References azimuth(), CSL_DEGS_PER_RAD, distance(), and elevation().
CPoint* csl::SpatialSource::mPosition [protected] |
source position
Referenced by azimuth(), distance(), csl::DistanceSimulator::DistanceSimulator(), elevation(), getPosition(), position(), setAzimuth(), setDistance(), setElevation(), setPosition(), SpatialSource(), and ~SpatialSource().
bool csl::SpatialSource::mPositionChanged [protected] |
true if this source's position has changed recently
Referenced by positionChanged(), and setPosition().