cgv
|
This class describes a sound source in the scene. More...
#include <al_context.h>
Public Member Functions | |
OALSource (const OALSource &)=delete | |
OALSource (OALSource &&)=default | |
OALSource & | operator= (const OALSource &)=delete |
OALSource & | operator= (OALSource &&)=default |
bool | init (OALContext &ctx, std::string sound_name="") |
This function links a source to a context. | |
void | clear () |
destruct source and restore uninitialized state | |
bool | append_sound (std::string sound_name) |
Append buffer of named sound to source's playback list. | |
void | set_position (cgv::math::fvec< float, 3 > pos) |
Sets the source position. | |
void | set_velocity (cgv::math::fvec< float, 3 > vel) |
Sets the source velocity. | |
void | set_pitch (float pitch) |
Sets the source pitch. | |
void | set_gain (float gain) |
Sets the source gain. | |
void | set_looping (bool should_loop) |
Sets the looping property of the source. | |
cgv::math::fvec< float, 3 > | get_position () const |
Gets the source position. | |
cgv::math::fvec< float, 3 > | get_velocity () const |
Gets the source velocity. | |
float | get_pitch () const |
Gets the source pitch. | |
float | get_gain () const |
Gets the source gain. | |
bool | is_looping () const |
Determines if the source has the looping property. | |
bool | is_playing () const |
Determines if the source is playing. | |
OALSourceState | get_state () const |
returns state of this source | |
void | play () |
Commences the playback of the sound buffer. | |
void | pause () |
Pauses the playback of the sound buffer without moving the playhead. | |
void | play_pause (bool should_play) |
Explicitly toggles between pausing and playing the sound buffer. | |
void | stop () |
Stops the playback of the sound buffer and moves the playhead to the beginning. | |
void | rewind () |
Moves the playhead to the beginning of the buffer. | |
Protected Member Functions | |
bool | append_sound_impl (std::string sound_name) |
This class describes a sound source in the scene.
Definition at line 254 of file al_context.h.
cgv::audio::OALSource::~OALSource | ( | ) |
Definition at line 247 of file al_context.cxx.
bool cgv::audio::OALSource::append_sound | ( | std::string | sound_name | ) |
Append buffer of named sound to source's playback list.
[in] | sound_name | The sounds symbolic name |
Definition at line 263 of file al_context.cxx.
References cgv::audio::OALContext::get_native_context().
|
protected |
Definition at line 269 of file al_context.cxx.
void cgv::audio::OALSource::clear | ( | ) |
destruct source and restore uninitialized state
Definition at line 237 of file al_context.cxx.
References get_state(), and stop().
float cgv::audio::OALSource::get_gain | ( | ) | const |
Gets the source gain.
Definition at line 319 of file al_context.cxx.
float cgv::audio::OALSource::get_pitch | ( | ) | const |
Gets the source pitch.
Definition at line 312 of file al_context.cxx.
cgv::math::fvec< float, 3 > cgv::audio::OALSource::get_position | ( | ) | const |
Gets the source position.
Definition at line 298 of file al_context.cxx.
References cgv::math::fvec< T, N >::data().
OALSourceState cgv::audio::OALSource::get_state | ( | ) | const |
cgv::math::fvec< float, 3 > cgv::audio::OALSource::get_velocity | ( | ) | const |
Gets the source velocity.
Definition at line 305 of file al_context.cxx.
References cgv::math::fvec< T, N >::data().
bool cgv::audio::OALSource::init | ( | OALContext & | ctx, |
std::string | sound_name = "" |
||
) |
This function links a source to a context.
ctx_ptr | The OpenAL context | |
[in] | sound_name | Optionally a named sound whose buffer to append |
Definition at line 252 of file al_context.cxx.
References cgv::audio::OALContext::get_native_context(), and cgv::audio::OALContext::is_no_error().
bool cgv::audio::OALSource::is_looping | ( | ) | const |
Determines if the source has the looping property.
Definition at line 326 of file al_context.cxx.
bool cgv::audio::OALSource::is_playing | ( | ) | const |
Determines if the source is playing.
Definition at line 333 of file al_context.cxx.
void cgv::audio::OALSource::pause | ( | ) |
Pauses the playback of the sound buffer without moving the playhead.
Definition at line 349 of file al_context.cxx.
Referenced by play_pause().
void cgv::audio::OALSource::play | ( | ) |
Commences the playback of the sound buffer.
Definition at line 347 of file al_context.cxx.
Referenced by play_pause().
void cgv::audio::OALSource::play_pause | ( | bool | should_play | ) |
Explicitly toggles between pausing and playing the sound buffer.
[in] | should_play | True if the source should play, False if it should be paused. |
Definition at line 351 of file al_context.cxx.
void cgv::audio::OALSource::rewind | ( | ) |
Moves the playhead to the beginning of the buffer.
Definition at line 363 of file al_context.cxx.
void cgv::audio::OALSource::set_gain | ( | float | gain | ) |
Sets the source gain.
[in] | gain | The new gain of the source |
Definition at line 291 of file al_context.cxx.
void cgv::audio::OALSource::set_looping | ( | bool | should_loop | ) |
Sets the looping property of the source.
[in] | should_loop | True if the source buffer should be looped, False otherwise. |
Definition at line 293 of file al_context.cxx.
void cgv::audio::OALSource::set_pitch | ( | float | pitch | ) |
Sets the source pitch.
[in] | pitch | The new pitch of the source |
Definition at line 289 of file al_context.cxx.
void cgv::audio::OALSource::set_position | ( | cgv::math::fvec< float, 3 > | pos | ) |
Sets the source position.
[in] | pos | The new position of the source |
Definition at line 285 of file al_context.cxx.
References cgv::math::fvec< T, N >::data().
void cgv::audio::OALSource::set_velocity | ( | cgv::math::fvec< float, 3 > | vel | ) |
Sets the source velocity.
[in] | vel | The new velocity of the source |
Definition at line 287 of file al_context.cxx.
References cgv::math::fvec< T, N >::data().
void cgv::audio::OALSource::stop | ( | ) |
Stops the playback of the sound buffer and moves the playhead to the beginning.
Definition at line 361 of file al_context.cxx.
Referenced by clear().