FS2_Open
Open source remastering of the Freespace 2 engine
gamesnd.cpp File Reference
#include <sstream>
#include <limits.h>
#include "gamesnd/gamesnd.h"
#include "localization/localize.h"
#include "parse/parselo.h"
#include "sound/ds.h"
#include "species_defs/species_defs.h"

Go to the source code of this file.

Functions

void gamesnd_add_retail_default_enhanced_sound_data ()
 
void gamesnd_play_iface (int n)
 
int gamesnd_lookup_name (const char *name, const SCP_vector< game_snd > &sounds)
 
int gamesnd_get_by_name (const char *name)
 
int gamesnd_get_by_iface_name (const char *name)
 
int gamesnd_get_by_tbl_index (int index)
 
int gamesnd_get_by_iface_tbl_index (int index)
 
void parse_sound_core (const char *tag, int *idx_dest, const char *object_name, const char *buf, parse_sound_flags flags)
 
void parse_sound (const char *tag, int *idx_dest, const char *object_name, parse_sound_flags flags)
 
void parse_sound_list (const char *tag, SCP_vector< int > &destination, const char *object_name, parse_sound_flags flags)
 
void gamesnd_preload_common_sounds ()
 
void gamesnd_load_gameplay_sounds ()
 
void gamesnd_unload_gameplay_sounds ()
 
void gamesnd_load_interface_sounds ()
 
void gamesnd_unload_interface_sounds ()
 
void parse_gamesnd_old (game_snd *gs)
 
EnhancedSoundPriority convert_to_enhanced_priority (const char *priority_str)
 
bool required_string_no_create (const char *token, bool no_create)
 
void parse_gamesnd_new (game_snd *gs, bool no_create)
 
void gamesnd_parse_entry (game_snd *gs, bool no_create, SCP_vector< game_snd > *lookupVector)
 
bool gamesnd_parse_line (game_snd *gs, const char *tag, SCP_vector< game_snd > *lookupVector=NULL)
 
void parse_sound_environments ()
 
void parse_sound_table (const char *filename)
 
void gamesnd_parse_soundstbl ()
 
void gamesnd_close ()
 
void common_play_highlight_sound ()
 
void gamesnd_play_error_beep ()
 

Variables

SCP_vector< game_sndSnds
 
SCP_vector< game_sndSnds_iface
 
SCP_vector< intSnds_iface_handle
 

Function Documentation

void common_play_highlight_sound ( )

Callback function for the UI code to call when the mouse first goes over a button.

Definition at line 1151 of file gamesnd.cpp.

EnhancedSoundPriority convert_to_enhanced_priority ( const char *  priority_str)

Definition at line 659 of file gamesnd.cpp.

void gamesnd_add_retail_default_enhanced_sound_data ( )

Definition at line 228 of file gamesnd.cpp.

void gamesnd_close ( )

Close out gamesnd, ONLY CALL FROM game_shutdown()!!!!

Definition at line 1141 of file gamesnd.cpp.

int gamesnd_get_by_iface_name ( const char *  name)

Definition at line 334 of file gamesnd.cpp.

int gamesnd_get_by_iface_tbl_index ( int  index)

Definition at line 376 of file gamesnd.cpp.

int gamesnd_get_by_name ( const char *  name)

Definition at line 301 of file gamesnd.cpp.

int gamesnd_get_by_tbl_index ( int  index)

Definition at line 368 of file gamesnd.cpp.

void gamesnd_load_gameplay_sounds ( )

Load the ingame sounds into memory

Definition at line 529 of file gamesnd.cpp.

void gamesnd_load_interface_sounds ( )

Load the interface sounds into memory

Definition at line 562 of file gamesnd.cpp.

int gamesnd_lookup_name ( const char *  name,
const SCP_vector< game_snd > &  sounds 
)

Function to search for a given game_snd with the specified name in the passed vector

Parameters
nameName to search for
soundsVector to seach in

Definition at line 276 of file gamesnd.cpp.

void gamesnd_parse_entry ( game_snd gs,
bool  no_create,
SCP_vector< game_snd > *  lookupVector 
)

Definition at line 785 of file gamesnd.cpp.

bool gamesnd_parse_line ( game_snd gs,
const char *  tag,
SCP_vector< game_snd > *  lookupVector = NULL 
)

Parse a sound effect entry by requiring the given tag at the beginning.

Parameters
gsThe game_snd instance to fill in
tagThe tag that's required before an entry
lookupVectorIf non-NULL used to look up +nocreate entries
Returns
true when a new entry has been parsed and should be added to the list of known entries. false otherwise, for example in case of +nocreate

Definition at line 839 of file gamesnd.cpp.

void gamesnd_parse_soundstbl ( )

Parse the sounds.tbl file, and load the specified sounds.

Definition at line 1116 of file gamesnd.cpp.

void gamesnd_play_error_beep ( )

Callback function for the UI code to call when an error beep needed.

Definition at line 1159 of file gamesnd.cpp.

void gamesnd_play_iface ( int  n)

Definition at line 260 of file gamesnd.cpp.

void gamesnd_preload_common_sounds ( )

Load in sounds that we expect will get played

The method currently used is to load all those sounds that have the hardware flag set. This works well since we don't want to try and load hardware sounds in on the fly (too slow).

Definition at line 510 of file gamesnd.cpp.

void gamesnd_unload_gameplay_sounds ( )

Unload the ingame sounds from memory

Definition at line 548 of file gamesnd.cpp.

void gamesnd_unload_interface_sounds ( )

Unload the interface sounds from memory

Definition at line 578 of file gamesnd.cpp.

void parse_gamesnd_new ( game_snd gs,
bool  no_create 
)

Definition at line 705 of file gamesnd.cpp.

void parse_gamesnd_old ( game_snd gs)

Definition at line 590 of file gamesnd.cpp.

void parse_sound ( const char *  tag,
int idx_dest,
const char *  object_name,
parse_sound_flags  flags 
)

Parse a sound. When using this function for a table entry, required_string and optional_string aren't needed, as this function deals with that as its tag parameter, just make sure that the destination sound index can handle -1 if things don't work out.

Parameters
tagTag
idx_destSound index destination
object_nameObject name being parsed
flagsSee the parse_sound_flags enum

Definition at line 445 of file gamesnd.cpp.

void parse_sound_core ( const char *  tag,
int idx_dest,
const char *  object_name,
const char *  buf,
parse_sound_flags  flags 
)

Helper function for parse_sound and parse_sound_list. Do not use directly.

Parameters
tagTag
idx_destSound index destination
object_nameObject name being parsed
bufBuffer holding string to be parsed
flagsSee the parse_sound_flags enum

Definition at line 396 of file gamesnd.cpp.

void parse_sound_environments ( )

Definition at line 860 of file gamesnd.cpp.

void parse_sound_list ( const char *  tag,
SCP_vector< int > &  destination,
const char *  object_name,
parse_sound_flags  flags 
)

CommanderDJ - Parse a list of sounds. When using this function for a table entry, required_string and optional_string aren't needed, as this function deals with that as its tag parameter, just make sure that the destination sound index(es) can handle -1 if things don't work out.

Parameters
destinationVector where sound indexes are to be stored
tagTag
object_nameName of object being parsed
flagsSee the parse_sound_flags enum

Definition at line 468 of file gamesnd.cpp.

void parse_sound_table ( const char *  filename)

Definition at line 1030 of file gamesnd.cpp.

bool required_string_no_create ( const char *  token,
bool  no_create 
)

Definition at line 694 of file gamesnd.cpp.

Variable Documentation

Definition at line 19 of file gamesnd.cpp.

SCP_vector<game_snd> Snds_iface

Definition at line 20 of file gamesnd.cpp.

SCP_vector<int> Snds_iface_handle

Definition at line 21 of file gamesnd.cpp.