|
| static int | sound_makeList (void) |
| | Makes the list of available sounds.
|
| static void | sound_free (alSound *snd) |
| | Frees the sound.
|
| static int | sound_al_init (void) |
| | Initializes the sound subsystem.
|
| static const char * | vorbis_getErr (int err) |
| | Gets the vorbisfile error in human readable form..
|
| static int | al_enableEFX (void) |
| | Enables the OpenAL EFX extension.
|
| static int | al_playVoice (alVoice *v, alSound *s, ALfloat px, ALfloat py, ALfloat vx, ALfloat vy, ALint relative) |
| | Plays a voice.
|
| static int | al_load (alSound *snd, SDL_RWops *rw, const char *name) |
| | Loads the sound.
|
| static int | al_loadWav (ALuint *buf, SDL_RWops *rw) |
| | Loads a wav file from the rw if possible.
|
| static int | al_loadOgg (ALuint *buf, OggVorbis_File *vf) |
| | Loads an ogg file from a tested format if possible.
|
| static void | al_pausev (ALint n, ALuint *s) |
| | Acts like alSourcePausev but with proper checks.
|
| static void | al_resumev (ALint n, ALuint *s) |
| | Acts like alSourcePlayv but with proper checks to just resume.
|
| static alGroup_t * | al_getGroup (int group) |
| | Gets a group by ID.
|
| static alVoice * | voice_new (void) |
| | Gets a new voice ready to be used.
|
| static int | voice_add (alVoice *v) |
| | Adds a voice to the active voice stack.
|
| static alVoice * | voice_get (int id) |
| | Gets a voice by identifier.
|
| static void | al_updateVoice (alVoice *v) |
| | Updates the voice.
|
| static void | al_volumeUpdate (void) |
| | Internal volume update function.
|
| static size_t | ovpack_read (void *ptr, size_t size, size_t nmemb, void *datasource) |
| static int | ovpack_seek (void *datasource, ogg_int64_t offset, int whence) |
| static int | ovpack_close (void *datasource) |
| static int | ovpack_closeFake (void *datasource) |
| static long | ovpack_tell (void *datasource) |
| int | sound_init (void) |
| | Initializes the sound subsystem.
|
| void | sound_exit (void) |
| | Cleans up after the sound subsytem.
|
| int | sound_get (const char *name) |
| | Gets the buffer to sound of name.
|
| double | sound_getLength (int sound) |
| | Gets the length of the sound buffer.
|
| int | sound_play (int sound) |
| | Plays the sound in the first available channel.
|
| int | sound_playPos (int sound, double px, double py, double vx, double vy) |
| | Plays a sound based on position.
|
| int | sound_updatePos (int voice, double px, double py, double vx, double vy) |
| | Updates the position of a voice.
|
| int | sound_update (double dt) |
| | Updates the sounds removing obsolete ones and such.
|
| void | sound_pause (void) |
| | Pauses all the sounds.
|
| void | sound_resume (void) |
| | Resumes all the sounds.
|
| void | sound_stopAll (void) |
| | Stops all the playing voices.
|
| void | sound_stop (int voice) |
| | Stops a voice from playing.
|
| int | sound_updateListener (double dir, double px, double py, double vx, double vy) |
| | Updates the sound listener.
|
| void | sound_setSpeed (double s) |
| | Sets the speed to play the sound at.
|
| int | sound_volume (const double vol) |
| | Sets the volume.
|
| double | sound_getVolume (void) |
| | Gets the current sound volume (linear).
|
| double | sound_getVolumeLog (void) |
| | Gets the current sound volume (logarithmic).
|
| int | sound_createGroup (int size) |
| | Creates a sound group.
|
| int | sound_playGroup (int group, int sound, int once) |
| | Plays a sound in a group.
|
| void | sound_stopGroup (int group) |
| | Stops all the sounds in a group.
|
| void | sound_pauseGroup (int group) |
| | Pauses all the sounds in a group.
|
| void | sound_resumeGroup (int group) |
| | Resumes all the sounds in a group.
|
| static void | groupSpeedReset (alGroup_t *g) |
| void | sound_speedGroup (int group, int enable) |
| | Sets whether or not the speed affects a group.
|
| void | sound_volumeGroup (int group, double volume) |
| | Sets the volume of a group.
|
| void | sound_pitchGroup (int group, double pitch) |
| | Sets the pitch of a group.
|
| void | sound_setAbsorption (double value) |
| int | sound_env (SoundEnv_t env_type, double param) |
| | Sets up the sound environment.
|
| int | source_newRW (SDL_RWops *rw, const char *name, unsigned int flags) |
| | Loads a new sound source from a RWops.
|
| int | source_new (const char *filename, unsigned int flags) |
| | Loads a new source from a file.
|
| void | rg_filter (float **pcm, long channels, long samples, void *filter_param) |
| | This is the filter function for the decoded Ogg Vorbis stream.
|
| int | sound_al_buffer (ALuint *buf, SDL_RWops *rw, const char *name) |
| | Loads the sound.
|
| int | sound_al_updatePos (alVoice *v, double px, double py, double vx, double vy) |
| | Updates the position of the sound.
|
Handles all the sound details.
We use a priority virtual voice system with pre-allocated buffers.
Naming: buffer - sound sample source - openal object that plays sound voice - virtual object that wants to play sound
1) First we allocate all the buffers based on what we find inside the datafile. 2) Then we allocate all the possible sources (giving the music system what it needs). 3) Now we allow the user to dynamically create voices, these voices will always try to grab a source from the source pool. If they can't they will pretend to play the buffer. 4) Every so often we'll check to see if the important voices are being played and take away the sources from the lesser ones.
EFX
We use multiple effects, namely:
- Air absorption factor
- Reverb
Definition in file sound.c.