Manage a collection of SGSampleGroup instances. More...
#include <soundmgr_openal.hxx>
Public Member Functions | |
void | bind () |
Acquire the subsystem's property bindings. | |
void | unbind () |
Release the subsystem's property bindings. | |
void | update (double dt) |
Update the subsystem. | |
void | suspend () |
Suspend operation of this subsystem. | |
void | resume () |
Resume operation of this subsystem. | |
void | reinit () |
Reinitialize the subsystem. | |
bool | is_working () const |
Test is the sound manager is in a working condition. | |
void | activate () |
Set the sound manager to a working condition. | |
bool | is_active () const |
Test is the sound manager is in an active and working condition. | |
bool | add (SGSampleGroup *sgrp, const string &refname) |
Register a sample group to the sound manager. | |
bool | remove (const string &refname) |
Remove a sample group from the sound manager. | |
bool | exists (const string &refname) |
Test if a specified sample group is registered at the sound manager. | |
SGSampleGroup * | find (const string &refname, bool create=false) |
Find a specified sample group in the sound manager. | |
void | set_position (const SGVec3d &pos, const SGGeod &pos_geod) |
Set the Cartesian position of the sound manager. | |
SGVec3d & | get_position () |
Get the position of the sound manager. | |
void | set_velocity (const SGVec3d &vel) |
Set the velocity vector (in meters per second) of the sound manager This is the horizontal local frame; x=north, y=east, z=down. | |
SGVec3f | get_velocity () |
Get the velocity vector of the sound manager This is in the same coordinate system as OpenGL; y=up, z=back, x=right. | |
void | set_orientation (const SGQuatd &ori) |
Set the orientation of the sound manager. | |
const SGQuatd & | get_orientation () |
Get the orientation of the sound manager. | |
SGVec3f | get_direction () |
Get the direction vector of the sound manager This is in the same coordinate system as OpenGL; y=up, z=back, x=right. | |
void | set_volume (float vol) |
Set the master volume. | |
float | get_volume () |
Get the master volume. | |
unsigned int | request_source () |
Get a free OpenAL source-id. | |
void | release_source (unsigned int source) |
Free an OpenAL source-id for future use. | |
unsigned int | request_buffer (SGSoundSample *sample) |
Get a free OpenAL buffer-id The buffer-id will be asigned to the sample by calling this function. | |
void | release_buffer (SGSoundSample *sample) |
Free an OpenAL buffer-id for this sample. | |
bool | has_changed () |
Test if the position of the sound manager has changed. | |
bool | bad_doppler_effect () |
Some implementations seem to need the velocity miltyplied by a factor of 100 to make them distinct. | |
bool | load (string &samplepath, void **data, int *format, size_t *size, int *freq) |
Load a sample file and return it's configuration and data. | |
vector< const char * > | get_available_devices () |
Get a list of available playback devices. | |
const string & | get_vendor () |
Get the current OpenAL vendor or rendering backend. | |
void | init () |
(re) initialize the sound manager. | |
void | bind () |
Bind properties for the sound manager. | |
void | unbind () |
Unbind properties for the sound manager. | |
void | update (double dt) |
Run the audio scheduler. | |
void | pause () |
Pause all sounds. | |
void | resume () |
Resume all sounds. | |
bool | is_working () const |
is audio working? | |
void | reinit () |
reinitialize the sound manager | |
bool | add (SGSoundSample *sound, const string &refname) |
add a sound effect, return true if successful | |
SGSoundSample * | add (const string &refname, const char *path, const char *file=NULL) |
Add a sound file to the sound manager. | |
bool | remove (const string &refname) |
remove a sound effect, return true if successful | |
bool | exists (const string &refname) |
return true of the specified sound exists in the sound manager system | |
SGSoundSample * | find (const string &refname) |
return a pointer to the SGSoundSample if the specified sound exists in the sound manager system, otherwise return NULL | |
bool | play_looped (const string &refname) |
tell the scheduler to play the indexed sample in a continuous loop | |
bool | play_once (const string &refname) |
tell the scheduler to play the indexed sample once | |
bool | is_playing (const string &refname) |
return true of the specified sound is currently being played | |
bool | stop (const string &refname) |
immediate stop playing the sound | |
slScheduler * | get_scheduler () |
return the audio scheduler |
Manage a collection of SGSampleGroup instances.
Manage a collection of SGSoundSample instances.
Definition at line 95 of file soundmgr_openal.hxx.
SGSoundSample * SGSoundMgr::add | ( | const string & | refname, | |
const char * | path, | |||
const char * | file = NULL | |||
) |
Add a sound file to the sound manager.
The advantage of using this function over the previous one is that it doesn't load a sample if it already is in memory, but instead it uses the already loaded sample data.
refname | A refference name to make a distincion between samples. | |
path | The path or full filename of the sample to load. | |
file | An optional filename which will be appended to the path. |
Definition at line 204 of file soundmgr_plib.cxx.
bool SGSoundMgr::add | ( | SGSampleGroup * | sgrp, | |
const string & | refname | |||
) |
Register a sample group to the sound manager.
sgrp Pointer to a sample group to add
refname | Reference name of the sample group |
Definition at line 327 of file soundmgr_openal.cxx.
bool SGSoundMgr::bad_doppler_effect | ( | ) | [inline] |
Some implementations seem to need the velocity miltyplied by a factor of 100 to make them distinct.
I've not found if this is a problem in the implementation or in out code. Until then this function is used to detect the problematic implementations.
Definition at line 273 of file soundmgr_openal.hxx.
void SGSoundMgr::bind | ( | ) | [virtual] |
Acquire the subsystem's property bindings.
This method should bind all properties that the subsystem publishes. It will be invoked after init, but before any invocations of update.
Reimplemented from SGSubsystem.
Definition at line 257 of file soundmgr_openal.cxx.
bool SGSoundMgr::exists | ( | const string & | refname | ) |
Test if a specified sample group is registered at the sound manager.
refname | Reference name of the sample group test for |
Definition at line 358 of file soundmgr_openal.cxx.
SGSampleGroup * SGSoundMgr::find | ( | const string & | refname, | |
bool | create = false | |||
) |
Find a specified sample group in the sound manager.
refname | Reference name of the sample group to find |
Definition at line 371 of file soundmgr_openal.cxx.
SGVec3f SGSoundMgr::get_direction | ( | ) | [inline] |
Get the direction vector of the sound manager This is in the same coordinate system as OpenGL; y=up, z=back, x=right.
Definition at line 213 of file soundmgr_openal.hxx.
const SGQuatd& SGSoundMgr::get_orientation | ( | ) | [inline] |
Get the orientation of the sound manager.
Definition at line 206 of file soundmgr_openal.hxx.
SGVec3d& SGSoundMgr::get_position | ( | ) | [inline] |
Get the position of the sound manager.
This is in the same coordinate system as OpenGL; y=up, z=back, x=right
Definition at line 176 of file soundmgr_openal.hxx.
SGVec3f SGSoundMgr::get_velocity | ( | ) | [inline] |
Get the velocity vector of the sound manager This is in the same coordinate system as OpenGL; y=up, z=back, x=right.
Definition at line 192 of file soundmgr_openal.hxx.
float SGSoundMgr::get_volume | ( | ) | [inline] |
Get the master volume.
Definition at line 232 of file soundmgr_openal.hxx.
bool SGSoundMgr::has_changed | ( | ) | [inline] |
Test if the position of the sound manager has changed.
The value will be set to false upon the next call to update_late()
Definition at line 265 of file soundmgr_openal.hxx.
bool SGSoundMgr::is_active | ( | ) | const [inline] |
Test is the sound manager is in an active and working condition.
Definition at line 128 of file soundmgr_openal.hxx.
bool SGSoundMgr::is_working | ( | ) | const [inline] |
Test is the sound manager is in a working condition.
Definition at line 117 of file soundmgr_openal.hxx.
bool SGSoundMgr::load | ( | string & | samplepath, | |
void ** | data, | |||
int * | format, | |||
size_t * | size, | |||
int * | freq | |||
) |
Load a sample file and return it's configuration and data.
samplepath | Path to the file to load | |
data | Pointer to a variable that points to the allocated data | |
format | Pointer to a vairable that gets the OpenAL format | |
size | Pointer to a vairable that gets the sample size in bytes | |
freq | Pointer to a vairable that gets the sample frequency in Herz |
Definition at line 545 of file soundmgr_openal.cxx.
void SGSoundMgr::reinit | ( | ) | [inline, virtual] |
Reinitialize the subsystem.
This method should cause the subsystem to reinitialize itself, and (normally) to reload any configuration files.
Reimplemented from SGSubsystem.
Definition at line 111 of file soundmgr_openal.hxx.
void SGSoundMgr::release_buffer | ( | SGSoundSample * | sample | ) |
Free an OpenAL buffer-id for this sample.
sample | Pointer to an audio sample for which to free the buffer |
Definition at line 499 of file soundmgr_openal.cxx.
void SGSoundMgr::release_source | ( | unsigned int | source | ) |
Free an OpenAL source-id for future use.
source | OpenAL source-id to free |
Definition at line 421 of file soundmgr_openal.cxx.
bool SGSoundMgr::remove | ( | const string & | refname | ) |
Remove a sample group from the sound manager.
refname | Reference name of the sample group to remove |
Definition at line 343 of file soundmgr_openal.cxx.
unsigned int SGSoundMgr::request_buffer | ( | SGSoundSample * | sample | ) |
Get a free OpenAL buffer-id The buffer-id will be asigned to the sample by calling this function.
sample | Pointer to an audio sample to assign the buffer-id to |
Definition at line 440 of file soundmgr_openal.cxx.
unsigned int SGSoundMgr::request_source | ( | ) |
Get a free OpenAL source-id.
Definition at line 405 of file soundmgr_openal.cxx.
void SGSoundMgr::resume | ( | ) | [virtual] |
Resume operation of this subsystem.
This method instructs the subsystem to resume sim-time-depended operations. It is not an error for the resume method to be invoked when the subsystem is not suspended; the invocation should simply be ignored.
Reimplemented from SGSubsystem.
Definition at line 245 of file soundmgr_openal.cxx.
void SGSoundMgr::set_orientation | ( | const SGQuatd & | ori | ) | [inline] |
Set the orientation of the sound manager.
ori | Quaternation containing the orientation information |
Definition at line 198 of file soundmgr_openal.hxx.
Set the Cartesian position of the sound manager.
pos | OpenAL listener position |
Definition at line 163 of file soundmgr_openal.hxx.
void SGSoundMgr::set_velocity | ( | const SGVec3d & | vel | ) | [inline] |
Set the velocity vector (in meters per second) of the sound manager This is the horizontal local frame; x=north, y=east, z=down.
Velocity | vector |
Definition at line 183 of file soundmgr_openal.hxx.
void SGSoundMgr::set_volume | ( | float | vol | ) |
Set the master volume.
vol | Volume (must be between 0.0 and 1.0) |
Definition at line 388 of file soundmgr_openal.cxx.
void SGSoundMgr::suspend | ( | ) | [virtual] |
Suspend operation of this subsystem.
This method instructs the subsystem to suspend sim-time-dependent operations until asked to resume. The update method will still be invoked so that the subsystem can take any non-time-dependent actions, such as updating the display.
It is not an error for the suspend method to be invoked when the subsystem is already suspended; the invocation should simply be ignored.
Reimplemented from SGSubsystem.
Definition at line 233 of file soundmgr_openal.cxx.
void SGSoundMgr::unbind | ( | ) | [virtual] |
Release the subsystem's property bindings.
This method should release all properties that the subsystem publishes. It will be invoked by FlightGear (not the destructor) just before the subsystem is removed.
Reimplemented from SGSubsystem.
Definition at line 266 of file soundmgr_openal.cxx.
void SGSoundMgr::update | ( | double | delta_time_sec | ) | [virtual] |
Update the subsystem.
FlightGear invokes this method every time the subsystem should update its state.
delta_time_sec | The delta time, in seconds, since the last update. On first update, delta time will be 0. |
Implements SGSubsystem.
Definition at line 281 of file soundmgr_openal.cxx.