|
0 A.D. | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Field Summary | |
static uint |
active_streams
See snd_mgr.cpp |
static int |
al_bufs_outstanding
See snd_mgr.cpp |
static bool |
al_initialized
========================================================================= File : snd_mgr. |
static float |
al_listener_gain
See snd_mgr.cpp |
static float[ 6 ] |
al_listener_orientation
See snd_mgr.cpp |
static float[ 3 ] |
al_listener_pos
See snd_mgr.cpp |
static uint |
al_src_allocated
See snd_mgr.cpp |
static uint |
al_src_cap
See snd_mgr.cpp |
static const uint |
AL_SRC_MAX
See snd_mgr.cpp |
static uint |
al_src_used
See snd_mgr.cpp |
static ALuint[ AL_SRC_MAX ] |
al_srcs
See snd_mgr.cpp |
static ALCcontext* |
alc_ctx
See snd_mgr.cpp |
static ALCdevice* |
alc_dev
See snd_mgr.cpp |
static const char* |
alc_dev_name
See snd_mgr.cpp |
static const char* |
devs
See snd_mgr.cpp |
static Handles |
hsd_list
See snd_mgr.cpp |
static void* |
io_buf_freelist
See snd_mgr.cpp |
static void* |
io_bufs
See snd_mgr.cpp |
static const uint |
MAX_IOS
See snd_mgr.cpp |
static const uint |
MAX_STREAMS
See snd_mgr.cpp |
static bool |
snd_disabled
See snd_mgr.cpp |
static double |
snd_update_time
See snd_mgr.cpp |
static const size_t |
STREAM_BUF_SIZE
See snd_mgr.cpp |
static const size_t |
TOTAL_BUF_SIZE
See snd_mgr.cpp |
static const int |
TOTAL_IOS
See snd_mgr.cpp |
static VSrcs |
vsrcs
See snd_mgr.cpp |
Method Summary | |
static ALuint |
al_buf_alloc( ALvoid* data, ALsizei size, ALenum al_fmt, ALsizei al_freq )
allocate a new buffer, and fill it with the specified data. |
static void |
al_buf_free( ALuint al_buf )
free the buffer and its contained sound data. |
static void |
al_buf_shutdown()
make sure all buffers have been returned to us via al_buf_free. |
static void |
al_check( const char* caller = "(unknown)" )
check if OpenAL indicates an error has occurred. |
static LibError |
al_init()
master OpenAL init; makes sure all subsystems are ready for use. |
static float |
al_listener_dist_2( const float point[ 3] )
get distance between listener and point. |
static void |
al_listener_latch()
send the current listener properties to OpenAL. |
static void |
al_listener_set_pos( const float pos[ 3], const float dir[ 3], const float up[ 3] )
set position of the listener (corresponds to camera in graphics). |
static LibError |
al_reinit()
re-initialize OpenAL. |
static void |
al_shutdown()
shut down all module subsystems. |
static ALuint |
al_src_alloc()
try to allocate a source. |
static void |
al_src_free( ALuint al_src )
mark a source as free and available for reuse. |
static void |
al_src_init()
grab as many sources as possible up to the limit. |
static void |
al_src_shutdown()
release all sources on freelist (currently stack). |
static LibError |
alc_init()
Ready OpenAL for use by setting up a device and context. |
static void |
alc_shutdown()
free the OpenAL context and device. |
static void |
calc_cur_pri( VSrc* vs )
determine new priority of the VSrc based on distance to listener and static priority. |
int |
close_func( void* UNUSED( datasource ) )
See ogghack.cpp |
static FadeRet |
fade( FadeInfo& fi, double cur_time, float& out_val )
Carry out the requested fade operation. |
static float |
fade_factor_exponential( float t )
See snd_mgr.cpp |
static float |
fade_factor_linear( float t )
See snd_mgr.cpp |
static float |
fade_factor_s_curve( float t )
See snd_mgr.cpp |
static bool |
fade_is_active( FadeInfo& fi )
Is the fade operation currently active? |
static void |
grant( VSrc* vs )
See snd_mgr.cpp |
|
H_TYPE_DEFINE( SndData )
See snd_mgr.cpp |
|
H_TYPE_DEFINE( VSrc )
See snd_mgr.cpp |
static void |
hsd_list_add( Handle hsd )
Add hsd to the list. |
static void |
hsd_list_free_all()
Free all sounds on list. |
static void* |
io_buf_alloc()
Allocate a fixed-size IO buffer. |
static void |
io_buf_free( void* p )
Free an IO buffer. |
static void |
io_buf_init()
Allocate a memory pool for all IO buffers. |
static void |
io_buf_shutdown()
Free memory pool holding all IO buffers. |
static bool |
is_greater( const VSrc* vs1, const VSrc* vs2 )
sort list by decreasing 'priority' (most important first) |
static bool |
is_null( VSrc* vs )
See snd_mgr.cpp |
bool |
is_playing( Handle hvs )
length of vector squared (avoids costly sqrt) |
static void |
list_add( VSrc* vs )
See snd_mgr.cpp |
static void |
list_foreach( void ( * cb )( VSrc* ), uint skip = 0, uint end_idx = 0 )
call back for each VSrc entry in the list. |
static LibError |
list_free_all()
See snd_mgr.cpp |
static void |
list_prune_removed()
remove entries that were set to 0 by list_remove, so that code below can grant the first al_src_cap entries a soure. |
static void |
list_remove( VSrc* vs )
scan list and remove the given VSrc (by setting it to 0; list will be pruned later (see rationale below). O(N)! |
static void |
list_sort()
See snd_mgr.cpp |
static float |
magnitude_2( const float v[ 3] )
See snd_mgr.cpp |
void* |
ogg_create()
See ogghack.cpp |
void |
ogg_give_raw( void* _o, void* p, size_t size )
See ogghack.cpp |
void |
ogg_open( void* _o, ALenum& fmt, ALsizei& freq )
See ogghack.cpp |
size_t |
ogg_read( void* _o, void* buf, size_t max_size )
See ogghack.cpp |
void |
ogg_release( void* _o )
See ogghack.cpp |
size_t |
read_func( void* ptr, size_t elements, size_t el_size, void* datasource )
See ogghack.cpp |
static void |
reclaim( VSrc* vs )
thunk that allows calling via list_foreach (return types differ) |
int |
seek_func( void* UNUSED( datasource ), ogg_int64_t UNUSED( offset ), int UNUSED( whence ) )
See ogghack.cpp |
static LibError |
snd_data_buf_free( Handle hsd, ALuint al_buf )
Indicate the sound's buffer is no longer needed. |
static LibError |
snd_data_buf_get( Handle hsd, ALuint& al_buf )
Get the sound's AL buffer (typically to play it) |
static LibError |
snd_data_free( Handle& hsd )
Free the sound. |
static Handle |
snd_data_load( const char* fn, bool is_stream )
open and return a handle to a sound file's data. |
const char* |
snd_dev_next()
Get next device name. |
LibError |
snd_dev_prepare_enum()
Prepare to enumerate all device names (this resets the list returned by snd_dev_next). |
LibError |
snd_dev_set( const char* alc_new_dev_name )
tell OpenAL to use the specified device in future. |
LibError |
snd_disable( bool disabled )
(temporarily) disable all sound output. |
LibError |
snd_fade( Handle hvs, float initial_gain, float final_gain, float length, FadeType type )
Fade the sound source in or out over time. |
LibError |
snd_free( Handle& hvs )
Free the sound; if it was playing, it will be stopped. |
static LibError |
snd_init()
extra layer on top of al_init that allows 'disabling' sound. |
Handle |
snd_open( const char* snd_fn, bool is_stream )
open and return a handle to a sound instance. |
LibError |
snd_play( Handle hvs, float static_pri )
Request the sound be played. |
LibError |
snd_set_cone( Handle hvs, const float cone_inner, const float cone_outer, const float cone_gain )
set sound cone information cone_inner and cone_outer should be in the range 0.0 - 360.0, cone_gain (which is the outer cone gain) should range from 0.0 - 1.0 |
LibError |
snd_set_gain( Handle hvs, float gain )
Change gain (amplitude modifier) of the sound source. |
LibError |
snd_set_loop( Handle hvs, bool loop )
Enable/disable looping on the sound source. |
LibError |
snd_set_master_gain( float gain )
set amplitude modifier, which is effectively applied to all sounds. |
LibError |
snd_set_max_voices( uint limit )
set maximum number of voices to play simultaneously, to reduce mixing cost on low-end systems. |
LibError |
snd_set_pitch( Handle hvs, float pitch )
Change pitch shift of the sound source. |
LibError |
snd_set_pos( Handle hvs, float x, float y, float z, bool relative )
Change 3d position of the sound source. |
void |
snd_shutdown()
free all resources and shut down the sound system. |
LibError |
snd_update( const float* pos, const float* dir, const float* up )
perform housekeeping (e.g. streaming); call once a frame. |
static void |
SndData_dtor( SndData* sd )
See snd_mgr.cpp |
static void |
SndData_init( SndData* sd, va_list args )
See snd_mgr.cpp |
static LibError |
SndData_reload( SndData* sd, const char* fn, Handle hsd )
See snd_mgr.cpp |
static LibError |
SndData_to_string( const SndData* sd, char* buf )
See snd_mgr.cpp |
static LibError |
SndData_validate( const SndData* sd )
See snd_mgr.cpp |
static LibError |
stream_buf_discard( Stream* s )
Free the buffer that was last returned by stream_buf_get, and remove its IO slot from our queue. |
static LibError |
stream_buf_get( Stream* s, void*& data, size_t& size )
Access the data most recently streamed in. |
static LibError |
stream_close( Stream* s )
close a stream, which may currently be active. |
static LibError |
stream_issue( Stream* s )
Begin reading the next segment (asynchronously). |
static LibError |
stream_open( Stream* s, const char* fn )
open a stream and begin reading from disk. |
static LibError |
stream_validate( const Stream* s )
Make sure the given Stream is valid/self-consistent. |
static LibError |
vm_update()
update voice management, i. |
static int |
vsrc_deque_finished_bufs( VSrc* vs )
Dequeue any of the VSrc's sound buffers that are finished playing. |
static void |
VSrc_dtor( VSrc* vs )
See snd_mgr.cpp |
static void |
vsrc_free( VSrc* vs )
See snd_mgr.cpp |
static LibError |
vsrc_grant( VSrc* vs )
Try to give the VSrc an AL source so that it can (re)start playing. |
static void |
VSrc_init( VSrc* vs, va_list args )
See snd_mgr.cpp |
static void |
vsrc_latch( VSrc* vs )
Send the VSrc properties to OpenAL (when we actually have a source). |
static LibError |
vsrc_reclaim( VSrc* vs )
stop playback, and reclaim the OpenAL source. |
static LibError |
VSrc_reload( VSrc* vs, const char* fn, Handle hvs )
See snd_mgr.cpp |
static void |
vsrc_set_initial( VSrc* vs )
one-time init of parameters we will not later change. |
static LibError |
VSrc_to_string( const VSrc* vs, char* buf )
See snd_mgr.cpp |
static LibError |
vsrc_update( VSrc* vs )
Update the VSrc - perform fade (if active), queue/unqueue buffers. |
static LibError |
VSrc_validate( const VSrc* vs )
See snd_mgr.cpp |
Symbol Summary | |
#define |
AL_CHECK al_check(__func__)
See snd_mgr.cpp |
#define |
INCLUDED_SND_MGR
See snd_mgr.h |
#define |
OGG_HACK
See snd_mgr.cpp |
#define |
WIN_LOADLIBRARY_HACK 0
See snd_mgr.cpp |
Field Detail |
static uint active_streams;
static int al_bufs_outstanding;
static bool al_initialized;
static float al_listener_gain;
static float al_listener_orientation[ 6 ];
static float al_listener_pos[ 3 ];
static uint al_src_allocated;
static uint al_src_cap;
static const uint AL_SRC_MAX;
static uint al_src_used;
static ALuint al_srcs[ AL_SRC_MAX ];
static ALCcontext* alc_ctx;
static ALCdevice* alc_dev;
static const char* alc_dev_name;
static const char* devs;
static Handles hsd_list;
static void* io_buf_freelist;
static void* io_bufs;
static const uint MAX_IOS;
static const uint MAX_STREAMS;
static bool snd_disabled;
static double snd_update_time;
static const size_t STREAM_BUF_SIZE;
static const size_t TOTAL_BUF_SIZE;
static const int TOTAL_IOS;
static VSrcs vsrcs;
Method Detail |
static ALuint al_buf_alloc( ALvoid* data, ALsizei size, ALenum al_fmt, ALsizei al_freq );
data
- raw sound data buffer
size
- size of buffer in bytes
al_fmt
- AL_FORMAT_ * describing the sound data
al_freq
- sampling frequency (typically 22050 Hz)static void al_buf_free( ALuint al_buf );
al_buf
- buffer name
static void al_buf_shutdown();
static void al_check( const char* caller = "(unknown)" );
caller
- Name of calling function (typically passed via __func__)
static LibError al_init();
static float al_listener_dist_2( const float point[ 3] );
point
- position support vectorstatic void al_listener_latch();
static void al_listener_set_pos( const float pos[ 3], const float dir[ 3], const float up[ 3] );
pos
- position support vector
dir
- view direction
up
- up vector
static LibError al_reinit();
static void al_shutdown();
static ALuint al_src_alloc();
static void al_src_free( ALuint al_src );
al_src
- source name
static void al_src_init();
static void al_src_shutdown();
static LibError alc_init();
static void alc_shutdown();
static void calc_cur_pri( VSrc* vs );
VSrc
- int close_func( void* UNUSED( datasource ) );
static FadeRet fade( FadeInfo& fi, double cur_time, float& out_val );
fi
- Describes the fade operation
cur_time
- typically returned via get_time()
out_val
- Output gain value, i.e. the current result of the fade.static float fade_factor_exponential( float t );
static float fade_factor_linear( float t );
static float fade_factor_s_curve( float t );
static bool fade_is_active( FadeInfo& fi );
FadeInfo
static void grant( VSrc* vs );
H_TYPE_DEFINE( SndData );
H_TYPE_DEFINE( VSrc );
static void hsd_list_add( Handle hsd );
hsd
- Handle to SndData
static void hsd_list_free_all();
static void* io_buf_alloc();
static void io_buf_free( void* p );
void*
- IO buffer
static void io_buf_init();
static void io_buf_shutdown();
static bool is_greater( const VSrc* vs1, const VSrc* vs2 );
static bool is_null( VSrc* vs );
bool is_playing( Handle hvs );
static void list_add( VSrc* vs );
static void list_foreach( void ( * cb )( VSrc* ), uint skip = 0, uint end_idx = 0 );
cb
- Callback function
skip
- number of entries to skip (default 0)
end_idx
- if not the default value of 0, stop before that entry.
static LibError list_free_all();
static void list_prune_removed();
static void list_remove( VSrc* vs );
vs
- VSrc to remove.
static void list_sort();
static float magnitude_2( const float v[ 3] );
void* ogg_create();
void ogg_give_raw( void* _o, void* p, size_t size );
void ogg_open( void* _o, ALenum& fmt, ALsizei& freq );
size_t ogg_read( void* _o, void* buf, size_t max_size );
void ogg_release( void* _o );
size_t read_func( void* ptr, size_t elements, size_t el_size, void* datasource );
static void reclaim( VSrc* vs );
int seek_func( void* UNUSED( datasource ), ogg_int64_t UNUSED( offset ), int UNUSED( whence ) );
static LibError snd_data_buf_free( Handle hsd, ALuint al_buf );
hsd
- Handle to SndData.
al_buf
- buffer namestatic LibError snd_data_buf_get( Handle hsd, ALuint& al_buf );
hsd
- Handle to SndData.
al_buf
- buffer name.static LibError snd_data_free( Handle& hsd );
hsd
- Handle to SndData; set to 0 afterwards.static Handle snd_data_load( const char* fn, bool is_stream );
fn
- VFS filename
is_stream
- (default false) indicates whether this file should be
streamed in (opening is faster, it won't be kept in memory, but
only one instance can be open at a time; makes sense for large music files)
or loaded immediately.const char* snd_dev_next();
LibError snd_dev_prepare_enum();
LibError snd_dev_set( const char* alc_new_dev_name );
alc_new_dev_name
- Device name.LibError snd_disable( bool disabled );
bool
- disabledLibError snd_fade( Handle hvs, float initial_gain, float final_gain, float length, FadeType type );
hvs
- Handle to VSrc
initial_gain
- gain. if < 0 (an otherwise illegal value), the sound's
current gain is used as the start value (useful for fading out).
final_gain
- gain. if 0, the sound is freed when the fade completes or
is aborted, thus allowing fire-and-forget fadeouts. no cases are
foreseen where this is undesirable, and it is easier to implement
than an extra set-free-after-fade-flag function.
length
- duration of fade [s]
type
- determines the fade curve: linear, exponential or S-curve.
for guidance on which to use, see
http://www.transom.org/tools/editing_mixing/200309.stupidfadetricks.html
you can also pass FT_ABORT to stop fading (if in progress) and
set gain to the final_gain parameter passed here.LibError snd_free( Handle& hvs );
hvs
- Handle to VSrc. will be set to 0 afterwards.static LibError snd_init();
Handle snd_open( const char* snd_fn, bool is_stream );
snd_fn
- VFS filename. if a text file (extension ".txt"),
it is assumed to be a definition file containing the
sound file name and its gain (0.0 .. 1.0).
otherwise, it is taken to be the sound file name and
gain is set to the default of 1.0 (no attenuation).
is_stream
- (default false) indicates whether this file should be
streamed in (opening is faster, it won't be kept in memory, but
only one instance can be open at a time; makes sense for large music files)
or loaded immediately.LibError snd_play( Handle hvs, float static_pri );
hvs
- Handle to VSrc
static_pri
- (min 0 .. max 1, default 0) indicates which sounds are
considered more important; this is attenuated by distance to the
listener (see snd_update).LibError snd_set_cone( Handle hvs, const float cone_inner, const float cone_outer, const float cone_gain );
cone_inner
- inner angle of sound cone
cone_outer
- outer angle of sound cone
cone_gain
- outer cone gainLibError snd_set_gain( Handle hvs, float gain );
hvs
- Handle to VSrc
gain
- modifier; must be non-negative;
1 -> unattenuated, 0.5 -> -6 dB, 0 -> silence.LibError snd_set_loop( Handle hvs, bool loop );
hvs
- Handle to VSrc
bool
- loopLibError snd_set_master_gain( float gain );
gain
- Modifier: must be non-negative;
1 -> unattenuated, 0.5 -> -6 dB, 0 -> silence.LibError snd_set_max_voices( uint limit );
limit
- max. number of sourcesLibError snd_set_pitch( Handle hvs, float pitch );
hvs
- Handle to VSrc
pitch
- shift: 1.0 means no change; each doubling/halving equals a
pitch shift of +/-12 semitones (one octave). zero is invalid.LibError snd_set_pos( Handle hvs, float x, float y, float z, bool relative );
hvs
- Handle to VSrc
x,y,z
- coordinates (interpretation: see below)
relative
- if true, (x,y,z) is treated as relative to the listener;
otherwise, it is the position in world coordinates (default).void snd_shutdown();
LibError snd_update( const float* pos, const float* dir, const float* up );
pos
- position support vector. if NULL, all parameters are
ignored and listener position unchanged; this is useful in case the
world isn't initialized yet.
dir
- view direction
up
- up vectorstatic void SndData_dtor( SndData* sd );
static void SndData_init( SndData* sd, va_list args );
static LibError SndData_reload( SndData* sd, const char* fn, Handle hsd );
static LibError SndData_to_string( const SndData* sd, char* buf );
static LibError SndData_validate( const SndData* sd );
static LibError stream_buf_discard( Stream* s );
Stream
static LibError stream_buf_get( Stream* s, void*& data, size_t& size );
Stream
data
- pointer to buffer
size
- [bytes]static LibError stream_close( Stream* s );
Stream
static LibError stream_issue( Stream* s );
Stream
static LibError stream_open( Stream* s, const char* fn );
Stream
fn
- VFS filename.static LibError stream_validate( const Stream* s );
const
- Streamstatic LibError vm_update();
static int vsrc_deque_finished_bufs( VSrc* vs );
VSrc
static void VSrc_dtor( VSrc* vs );
static void vsrc_free( VSrc* vs );
static LibError vsrc_grant( VSrc* vs );
VSrc
static void VSrc_init( VSrc* vs, va_list args );
static void vsrc_latch( VSrc* vs );
VSrc
- static LibError vsrc_reclaim( VSrc* vs );
VSrc
static LibError VSrc_reload( VSrc* vs, const char* fn, Handle hvs );
static void vsrc_set_initial( VSrc* vs );
VSrc
- static LibError VSrc_to_string( const VSrc* vs, char* buf );
static LibError vsrc_update( VSrc* vs );
VSrc
static LibError VSrc_validate( const VSrc* vs );
Symbol Detail |
#define AL_CHECK al_check(__func__)
#define INCLUDED_SND_MGR
#define OGG_HACK
#define WIN_LOADLIBRARY_HACK 0
|
0 A.D.
Generated on September 04, 2007 at 18:13 CppDoc v2.4.0 |
|||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |