SAL
A C++ library for spatial audio.
|
#include <microphone.h>
Public Member Functions | |
Microphone (mcl::Point position, mcl::Quaternion orientation=mcl::Quaternion::Identity()) | |
mcl::Point | position () const noexcept |
virtual void | SetPosition (const mcl::Point &position) noexcept |
mcl::Quaternion | orientation () const noexcept |
virtual void | SetOrientation (const mcl::Quaternion &orientation) noexcept |
void | SetHandedness (const mcl::Handedness handedness) noexcept |
void | AddPlaneWave (const MonoBuffer &signal, const mcl::Point &point, Buffer &output_buffer) noexcept |
void | AddPlaneWave (const Sample *input_data, const Int num_samples, const mcl::Point &point, Buffer &output_buffer) noexcept |
void | AddPlaneWave (const Sample input_sample, const mcl::Point &point, Buffer &output_buffer) noexcept |
void | AddPlaneWave (const MonoBuffer &input_buffer, const mcl::Point &point, const Int wave_id, Buffer &output_buffer) noexcept |
void | AddPlaneWave (const Sample input_sample, const mcl::Point &point, const Int wave_id, Buffer &output_buffer) noexcept |
virtual void | AddPlaneWave (const Sample *input_data, const Int num_samples, const mcl::Point &point, const Int wave_id, Buffer &output_buffer) noexcept |
virtual bool | IsCoincident () const noexcept=0 |
virtual Int | num_channels () const noexcept=0 |
virtual bool | IsOmni () const noexcept |
mcl::Point | GetRelativePoint (const mcl::Point &point) const noexcept |
virtual void | Reset () noexcept |
virtual | ~Microphone () |
virtual void | AddPlaneWaveRelative (const MonoBuffer &signal, const mcl::Point &point, const Int wave_id, Buffer &output_buffer) noexcept |
virtual void | AddPlaneWaveRelative (const Sample *input_data, const Int num_samples, const mcl::Point &point, const Int wave_id, Buffer &output_buffer) noexcept=0 |
Static Public Member Functions | |
static bool | Test () |
Protected Attributes | |
mcl::Handedness | handedness_ |
Friends | |
class | MicrophoneArray |
sal::Microphone::Microphone | ( | mcl::Point | position, |
mcl::Quaternion | orientation = mcl::Quaternion::Identity() |
||
) |
position
is the position of the microphone, and orientation is a quaternion describing the microphone rotation. A microphone generally has its acoustical axis on the x-axis. We are using a spherical coordinate system with the convention that theta is the angle formed with the z-axis, and phi is the angle formed on the projection on the x-y plane with the x-axis. The x-axis corresponds to (r, theta, phi) = (r, pi/2, 0).
An example on the use of this function is as follow: if you don't want to change its orientation, then you should use a Quaternion::Identical(). Otherwise, if you want to rotate it around the z-axis (i.e. a rotation on the horizontal plane), then you should use mcl::AxAng2Quat(0,0,1,angle) with angle in radians.
Methods with wave_id as a parameter imply that the user should explicitly tell the mic to Tick
, i.e. to inform it that we are working on a new sample. Methods without wave_id (i.e. assuming there is a single plane wave incoming) do this automatically.
|
inlinevirtual |
|
noexcept |
We do not implement directly the case of a single plane wave because in most situations the microphone is recording many plane waves at the same time. This method should only be called in case of a single plane wave impinging on the microphone. For multiple plane waves, you need to explicitly specify the wave_id.
|
noexcept |
|
noexcept |
|
noexcept |
We need to keep track of the wave_id because some microphones (e.g. kemar) need to do some filtering on the signal longer than one sample. The function Tick tells the microphone to advance in time. The microphone objects need to keep track of each plane wave. Hence, the first time it sees a new wave_id, it will allocate a new filter for it.
|
noexcept |
|
virtualnoexcept |
Reimplemented in sal::MicrophoneArray.
|
virtualnoexcept |
|
pure virtualnoexcept |
This is implemented by the specific type of microphones. mcl::Point
in this case is relative to the microphone reference system. This is the most important function of this object. This filters the sample sample
as a function of the position from where the sound is incoming point
. Info for developer: the directivity should preferably have a maximum in the direction of the x-axis For anthropomorphic directivities, the facing direction is the x-axis. An arrow going from the jaw trough the skull and up should preferrably be in the direction of plus-z-axis. Other choices could be made, as long as the conventions are kept at higher levels.
Implemented in sal::MicrophoneArray, sal::MemorylessMonoMic, sal::AmbisonicsMic, and sal::BinauralMic.
|
noexcept |
This method translates point
in the reference system of the mic.
|
pure virtualnoexcept |
Implemented in sal::MicrophoneArray, sal::AmbisonicsMic, sal::BinauralMic, and sal::MonoMic.
|
inlinevirtualnoexcept |
Reimplemented in sal::GainMic.
|
pure virtualnoexcept |
Implemented in sal::MicrophoneArray, sal::AmbisonicsMic, sal::BinauralMic, and sal::MonoMic.
|
noexcept |
Returns current orientation of the microphone
|
noexcept |
Returns current position of the microphone
|
inlinevirtualnoexcept |
Resets the state of the microphone (if any).
Reimplemented in sal::BinauralMic.
|
noexcept |
Set handedness of reference system
|
virtualnoexcept |
Set microphone orientation
Reimplemented in sal::CircularArray< T >, and sal::MicrophoneArray.
|
virtualnoexcept |
Set microphone position
Reimplemented in sal::MicrophoneArray.
|
static |
|
friend |
|
protected |