mirror of
https://github.com/scp-fs2open/fs2open.github.com.git
synced 2026-11-07 08:15:59 -10:00
Format changes with clang-format
This commit is contained in:
1 parent
ad54f588bb
commit
2ded9aa35d
36 files changed
+209
-207
No files matched your search
+6
-6
@@ -1420,7 +1420,7 @@ void hud_update_frame(float /*frametime*/)
|
||||
}
|
||||
|
||||
if (Player_ai->target_objnum == -1) {
|
||||
if ( Target_static_looping.isValid() ) {
|
||||
if (Target_static_looping.isValid()) {
|
||||
snd_stop(Target_static_looping);
|
||||
}
|
||||
return;
|
||||
@@ -1810,7 +1810,7 @@ void hud_render_gauges(int cockpit_display_num)
|
||||
*/
|
||||
void hud_stop_looped_engine_sounds()
|
||||
{
|
||||
if ( Player_engine_snd_loop.isValid() ) {
|
||||
if (Player_engine_snd_loop.isValid()) {
|
||||
snd_stop(Player_engine_snd_loop);
|
||||
Player_engine_snd_loop = sound_handle::invalid();
|
||||
}
|
||||
@@ -1831,7 +1831,7 @@ void update_throttle_sound()
|
||||
float percent_throttle;
|
||||
|
||||
if((Game_mode & GM_MULTIPLAYER) && (Net_player->flags & NETINFO_FLAG_OBSERVER)){
|
||||
if(Player_engine_snd_loop.isValid()){
|
||||
if (Player_engine_snd_loop.isValid()) {
|
||||
snd_stop(Player_engine_snd_loop);
|
||||
Player_engine_snd_loop = sound_handle::invalid();
|
||||
}
|
||||
@@ -1851,16 +1851,16 @@ void update_throttle_sound()
|
||||
percent_throttle = Player_obj->phys_info.fspeed / Ships[Player_obj->instance].current_max_speed;
|
||||
}
|
||||
|
||||
if ( percent_throttle != last_percent_throttle || !Player_engine_snd_loop.isValid() ) {
|
||||
if (percent_throttle != last_percent_throttle || !Player_engine_snd_loop.isValid()) {
|
||||
|
||||
if ( percent_throttle < ZERO_PERCENT ) {
|
||||
if ( Player_engine_snd_loop.isValid() ) {
|
||||
if (Player_engine_snd_loop.isValid()) {
|
||||
snd_stop(Player_engine_snd_loop); // Backslash - otherwise, long engine loops keep playing
|
||||
Player_engine_snd_loop = sound_handle::invalid();
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ( !Player_engine_snd_loop.isValid() ){
|
||||
if (!Player_engine_snd_loop.isValid()) {
|
||||
Player_engine_snd_loop = snd_play_looping( gamesnd_get_game_sound(ship_get_sound(Player_obj, GameSounds::ENGINE)), 0.0f , -1, -1, percent_throttle * ENGINE_MAX_VOL, FALSE);
|
||||
} else {
|
||||
// The sound may have been trashed at the low-level if sound channel overflow.
|
||||
|
||||
@@ -37,7 +37,7 @@ vec3d lock_world_pos;
|
||||
static float Lock_start_dist;
|
||||
|
||||
sound_handle Missile_track_loop = sound_handle::invalid();
|
||||
sound_handle Missile_lock_loop = sound_handle::invalid();
|
||||
sound_handle Missile_lock_loop = sound_handle::invalid();
|
||||
|
||||
int Lock_target_box_width[GR_NUM_RESOLUTIONS] = {
|
||||
19,
|
||||
@@ -606,7 +606,7 @@ void hud_do_lock_indicator(float frametime)
|
||||
return;
|
||||
|
||||
if (Player_ai->current_target_is_locked) {
|
||||
if ( Missile_track_loop.isValid() ) {
|
||||
if (Missile_track_loop.isValid()) {
|
||||
snd_stop(Missile_track_loop);
|
||||
Missile_track_loop = sound_handle::invalid();
|
||||
|
||||
@@ -622,7 +622,7 @@ void hud_do_lock_indicator(float frametime)
|
||||
}
|
||||
else {
|
||||
Player_ai->ai_flags.set(AI::AI_Flags::Seek_lock); // set this flag so multiplayer's properly track lock on other ships
|
||||
if ( Missile_lock_loop.isValid() && snd_is_playing(Missile_lock_loop) ) {
|
||||
if (Missile_lock_loop.isValid() && snd_is_playing(Missile_lock_loop)) {
|
||||
snd_stop(Missile_lock_loop);
|
||||
Missile_lock_loop = sound_handle::invalid();
|
||||
}
|
||||
@@ -840,7 +840,7 @@ void hud_calculate_lock_position(float frametime)
|
||||
accumulated_y_pixels -= int_portion;
|
||||
}
|
||||
|
||||
if ( !Missile_track_loop.isValid() ) {
|
||||
if (!Missile_track_loop.isValid()) {
|
||||
if (wip->hud_tracking_snd.isValid())
|
||||
{
|
||||
Missile_track_loop = snd_play_looping( gamesnd_get_game_sound(wip->hud_tracking_snd), 0.0f , -1, -1);
|
||||
@@ -863,7 +863,7 @@ void hud_calculate_lock_position(float frametime)
|
||||
|
||||
} else {
|
||||
|
||||
if ( Missile_track_loop.isValid() ) {
|
||||
if (Missile_track_loop.isValid()) {
|
||||
snd_stop(Missile_track_loop);
|
||||
Missile_track_loop = sound_handle::invalid();
|
||||
}
|
||||
@@ -977,7 +977,7 @@ void hud_calculate_lock_start_pos()
|
||||
// hud_stop_looped_locking_sounds() will terminate any hud related looping sounds that are playing
|
||||
void hud_stop_looped_locking_sounds()
|
||||
{
|
||||
if ( Missile_track_loop.isValid() ) {
|
||||
if (Missile_track_loop.isValid()) {
|
||||
snd_stop(Missile_track_loop);
|
||||
Missile_track_loop = sound_handle::invalid();
|
||||
}
|
||||
|
||||
@@ -438,7 +438,7 @@ weapon_flash Weapon_flash_info;
|
||||
// Data used for the proximity warning
|
||||
typedef struct homing_beep_info
|
||||
{
|
||||
sound_handle snd_handle; // sound handle for last played beep
|
||||
sound_handle snd_handle; // sound handle for last played beep
|
||||
fix last_time_played; // time beep was last played
|
||||
int min_cycle_time; // time (in ms) for fastest cycling of the sound
|
||||
int max_cycle_time; // time (in ms) for slowest cycling of the sound
|
||||
@@ -447,7 +447,7 @@ typedef struct homing_beep_info
|
||||
float precalced_interp; // a precalculated value used in a linear interpretation
|
||||
} homing_beep_info;
|
||||
|
||||
homing_beep_info Homing_beep = { sound_handle::invalid(), 0, 150, 1000, 30.0f, 1500.0f, 1.729412f };
|
||||
homing_beep_info Homing_beep = {sound_handle::invalid(), 0, 150, 1000, 30.0f, 1500.0f, 1.729412f};
|
||||
|
||||
// Set at the start of a mission, used to decide how to draw the separation for the warning missile indicators
|
||||
float Min_warning_missile_dist;
|
||||
@@ -1010,7 +1010,7 @@ void hud_weapons_init()
|
||||
// init data used to play the homing "proximity warning" sound
|
||||
void hud_init_homing_beep()
|
||||
{
|
||||
Homing_beep.snd_handle = sound_handle::invalid();
|
||||
Homing_beep.snd_handle = sound_handle::invalid();
|
||||
Homing_beep.last_time_played = 0;
|
||||
Homing_beep.precalced_interp = (Homing_beep.max_cycle_dist-Homing_beep.min_cycle_dist) / (Homing_beep.max_cycle_time - Homing_beep.min_cycle_time );
|
||||
}
|
||||
|
||||
@@ -2222,11 +2222,11 @@ void hud_update_target_static()
|
||||
}
|
||||
|
||||
if ( Target_static_playing ) {
|
||||
if ( !Target_static_looping.isValid() ) {
|
||||
if (!Target_static_looping.isValid()) {
|
||||
Target_static_looping = snd_play_looping(gamesnd_get_game_sound(GameSounds::STATIC));
|
||||
}
|
||||
} else {
|
||||
if ( Target_static_looping.isValid() ) {
|
||||
if (Target_static_looping.isValid()) {
|
||||
snd_stop(Target_static_looping);
|
||||
Target_static_looping = sound_handle::invalid();
|
||||
}
|
||||
|
||||
@@ -607,7 +607,7 @@ void main_hall_init(const SCP_string &main_hall_name)
|
||||
// initialize the random intercom sound stuff
|
||||
Main_hall_next_intercom_sound = 0;
|
||||
Main_hall_next_intercom_sound_stamp = -1;
|
||||
Main_hall_intercom_sound_handle = sound_handle::invalid();
|
||||
Main_hall_intercom_sound_handle = sound_handle::invalid();
|
||||
|
||||
// set the placement of the mouse cursor (start at the ready room)
|
||||
Main_hall_mouse_region = -1;
|
||||
@@ -1061,7 +1061,7 @@ void main_hall_close()
|
||||
|
||||
// stop any playing door sounds
|
||||
for (idx = 0; idx < Main_hall->num_door_animations-2; idx++) {
|
||||
if ( (Main_hall_door_sound_handles.at(idx).isValid()) && snd_is_playing(Main_hall_door_sound_handles.at(idx)) ) {
|
||||
if ((Main_hall_door_sound_handles.at(idx).isValid()) && snd_is_playing(Main_hall_door_sound_handles.at(idx))) {
|
||||
snd_stop(Main_hall_door_sound_handles.at(idx));
|
||||
Main_hall_door_sound_handles.at(idx) = sound_handle::invalid();
|
||||
}
|
||||
@@ -1508,7 +1508,7 @@ void main_hall_cull_door_sounds()
|
||||
// basically just set the handle of any finished sound to be -1, so that we know its free any where else in the code we may need it
|
||||
Assert(Main_hall_door_sound_handles.size() < INT_MAX);
|
||||
for (idx = 0; idx < (int)Main_hall_door_sound_handles.size(); idx++) {
|
||||
if ( (Main_hall_door_sound_handles.at(idx).isValid()) && !snd_is_playing(Main_hall_door_sound_handles.at(idx)) ) {
|
||||
if ((Main_hall_door_sound_handles.at(idx).isValid()) && !snd_is_playing(Main_hall_door_sound_handles.at(idx))) {
|
||||
Main_hall_door_sound_handles.at(idx) = sound_handle::invalid();
|
||||
}
|
||||
}
|
||||
@@ -1526,7 +1526,7 @@ void main_hall_handle_random_intercom_sounds()
|
||||
}
|
||||
|
||||
// if we have no timestamp for the next random sound, then set on
|
||||
if ( (Main_hall_next_intercom_sound_stamp == -1) && (!Main_hall_intercom_sound_handle.isValid()) ) {
|
||||
if ((Main_hall_next_intercom_sound_stamp == -1) && (!Main_hall_intercom_sound_handle.isValid())) {
|
||||
Main_hall_next_intercom_sound_stamp = timestamp((int)((rand() * RAND_MAX_1f) *
|
||||
(float)(Main_hall->intercom_delay.at(Main_hall_next_intercom_sound).at(1)
|
||||
- Main_hall->intercom_delay.at(Main_hall_next_intercom_sound).at(0))) );
|
||||
|
||||
@@ -467,7 +467,7 @@ void options_play_voice_clip()
|
||||
{
|
||||
if ( snd_is_playing(Voice_vol_handle) ) {
|
||||
snd_stop(Voice_vol_handle);
|
||||
Voice_vol_handle=sound_handle::invalid();
|
||||
Voice_vol_handle = sound_handle::invalid();
|
||||
}
|
||||
auto gs = gamesnd_get_interface_sound(InterfaceSounds::VOICE_SLIDER_CLIP);
|
||||
auto entry = gamesnd_choose_entry(gs);
|
||||
@@ -1045,7 +1045,7 @@ void options_menu_close()
|
||||
}
|
||||
}
|
||||
|
||||
if ( Voice_vol_handle.isValid() ) {
|
||||
if (Voice_vol_handle.isValid()) {
|
||||
snd_stop(Voice_vol_handle);
|
||||
Voice_vol_handle = sound_handle::invalid();
|
||||
}
|
||||
|
||||
@@ -1710,7 +1710,7 @@ void options_multi_disable_vox_controls()
|
||||
// unset the sound buffer size so we don't display any waveforms
|
||||
Om_vox_voice_buffer_size = -1;
|
||||
Om_vox_voice_comp_size = -1;
|
||||
Om_vox_playback_handle = sound_handle::invalid();
|
||||
Om_vox_playback_handle = sound_handle::invalid();
|
||||
Om_vox_test_status = OM_VOX_TEST_NONE;
|
||||
|
||||
// disable the player list select button
|
||||
@@ -1739,7 +1739,7 @@ void options_multi_enable_vox_controls()
|
||||
// unset the sound buffer size so we don't display any waveforms
|
||||
Om_vox_voice_buffer_size = -1;
|
||||
Om_vox_voice_comp_size = -1;
|
||||
Om_vox_playback_handle = sound_handle::invalid();
|
||||
Om_vox_playback_handle = sound_handle::invalid();
|
||||
Om_vox_test_status = OM_VOX_TEST_NONE;
|
||||
|
||||
// select the first player on the list
|
||||
@@ -1851,7 +1851,7 @@ void options_multi_vox_do()
|
||||
|
||||
case OM_VOX_TEST_PLAYBACK:
|
||||
// if we were playing a sound back, but now the sound is done
|
||||
if ( (Om_vox_playback_handle.isValid()) && !ds_is_channel_playing(ds_get_channel(Om_vox_playback_handle)) ) {
|
||||
if ((Om_vox_playback_handle.isValid()) && !ds_is_channel_playing(ds_get_channel(Om_vox_playback_handle))) {
|
||||
// flush all playing sounds safely
|
||||
rtvoice_stop_playback_all();
|
||||
|
||||
|
||||
@@ -198,7 +198,7 @@ static int Max_briefing_line_len;
|
||||
static int Voice_started_time;
|
||||
static int Voice_ended_time;
|
||||
|
||||
static sound_handle Brief_text_wipe_snd; // sound handle of sound effect for text wipe
|
||||
static sound_handle Brief_text_wipe_snd; // sound handle of sound effect for text wipe
|
||||
static int Play_brief_voice;
|
||||
|
||||
// animation stuff
|
||||
@@ -970,7 +970,7 @@ void brief_render_icon(int stage_num, int icon_num, float frametime, int selecte
|
||||
|
||||
hud_anim_render(ha, frametime, 1, 0, 1, 0, GR_RESIZE_MENU, mirror_icon);
|
||||
|
||||
if ( !Brief_stage_highlight_sound_handle.isValid() ) {
|
||||
if (!Brief_stage_highlight_sound_handle.isValid()) {
|
||||
if ( !Fred_running) {
|
||||
Brief_stage_highlight_sound_handle = snd_play(gamesnd_get_interface_sound(InterfaceSounds::ICON_HIGHLIGHT));
|
||||
}
|
||||
|
||||
@@ -720,7 +720,7 @@ void messages_init()
|
||||
Playing_messages[i].anim_data = NULL;
|
||||
Playing_messages[i].start_frame = -1;
|
||||
Playing_messages[i].play_anim = false;
|
||||
Playing_messages[i].wave = sound_handle::invalid();
|
||||
Playing_messages[i].wave = sound_handle::invalid();
|
||||
Playing_messages[i].id = -1;
|
||||
Playing_messages[i].priority = -1;
|
||||
Playing_messages[i].shipnum = -1;
|
||||
@@ -844,7 +844,7 @@ void message_kill_all( int kill_all )
|
||||
}
|
||||
|
||||
if ( kill_all ) {
|
||||
if ( (Playing_messages[i].wave.isValid() ) && snd_is_playing(Playing_messages[i].wave) ){
|
||||
if ((Playing_messages[i].wave.isValid()) && snd_is_playing(Playing_messages[i].wave)) {
|
||||
snd_stop( Playing_messages[i].wave );
|
||||
}
|
||||
|
||||
@@ -872,7 +872,7 @@ void message_kill_playing( int message_num )
|
||||
Playing_messages[message_num].play_anim = false;
|
||||
}
|
||||
|
||||
if ( (Playing_messages[message_num].wave.isValid() ) && snd_is_playing(Playing_messages[message_num].wave) )
|
||||
if ((Playing_messages[message_num].wave.isValid()) && snd_is_playing(Playing_messages[message_num].wave))
|
||||
snd_stop( Playing_messages[message_num].wave );
|
||||
|
||||
Playing_messages[message_num].shipnum = -1;
|
||||
@@ -1311,7 +1311,7 @@ void message_queue_process()
|
||||
wave_done = 1;
|
||||
|
||||
// if ( (Playing_messages[i].wave != -1) && snd_is_playing(Playing_messages[i].wave) )
|
||||
if ( (Playing_messages[i].wave.isValid()) && (snd_time_remaining(Playing_messages[i].wave) > 250) )
|
||||
if ((Playing_messages[i].wave.isValid()) && (snd_time_remaining(Playing_messages[i].wave) > 250))
|
||||
wave_done = 0;
|
||||
|
||||
// Goober5000
|
||||
@@ -1319,7 +1319,7 @@ void message_queue_process()
|
||||
wave_done = 0;
|
||||
|
||||
// AL 1-20-98: If voice message is done, kill the animation early
|
||||
if ( (Playing_messages[i].wave.isValid()) && wave_done ) {
|
||||
if ((Playing_messages[i].wave.isValid()) && wave_done) {
|
||||
/*if ( !ani_done ) {
|
||||
anim_stop_playing( Playing_messages[i].anim );
|
||||
}*/
|
||||
@@ -1358,7 +1358,9 @@ void message_queue_process()
|
||||
|
||||
// if both ani and wave are done, mark internal variable so we can do next message on queue, and
|
||||
// global variable to clear voice brackets on hud
|
||||
if ( wave_done && ani_done && ( timestamp_elapsed(Message_expire) || (Playing_messages[i].wave.isValid()) || (Playing_messages[i].shipnum == -1) ) ) {
|
||||
if (wave_done && ani_done &&
|
||||
(timestamp_elapsed(Message_expire) || (Playing_messages[i].wave.isValid()) ||
|
||||
(Playing_messages[i].shipnum == -1))) {
|
||||
nprintf(("messaging", "Message %d is done playing\n", i));
|
||||
Message_shipnum = -1;
|
||||
Num_messages_playing--;
|
||||
@@ -1520,7 +1522,7 @@ void message_queue_process()
|
||||
// set up module globals for this message
|
||||
m = &Messages[q->message_num];
|
||||
Playing_messages[Num_messages_playing].anim_data = NULL;
|
||||
Playing_messages[Num_messages_playing].wave = sound_handle::invalid();
|
||||
Playing_messages[Num_messages_playing].wave = sound_handle::invalid();
|
||||
Playing_messages[Num_messages_playing].id = q->message_num;
|
||||
Playing_messages[Num_messages_playing].priority = q->priority;
|
||||
Playing_messages[Num_messages_playing].shipnum = Message_shipnum;
|
||||
@@ -1567,7 +1569,7 @@ void message_queue_process()
|
||||
|
||||
#ifndef NDEBUG
|
||||
// debug only -- if the message is a builtin message, put in parens whether or not the voice played
|
||||
if ( Sound_enabled && !Playing_messages[Num_messages_playing].wave.isValid() ) {
|
||||
if (Sound_enabled && !Playing_messages[Num_messages_playing].wave.isValid()) {
|
||||
strcat_s( buf, NOX("..(no wavefile for voice)"));
|
||||
snd_play(gamesnd_get_game_sound(GameSounds::CUE_VOICE));
|
||||
}
|
||||
|
||||
@@ -150,7 +150,7 @@ typedef struct pmessage {
|
||||
generic_anim *anim_data; // animation data to be used by the talking head HUD gauge handler
|
||||
int start_frame; // the start frame needed to play the animation
|
||||
bool play_anim; // used to tell HUD gauges if they should be playing or not
|
||||
sound_handle wave; // handle of wave currently playing
|
||||
sound_handle wave; // handle of wave currently playing
|
||||
int id; // id of message currently playing
|
||||
int priority; // priority of message currently playing
|
||||
int shipnum; // shipnum of ship sending this message, -1 if from Terran command
|
||||
|
||||
@@ -125,7 +125,7 @@ typedef struct voice_stream {
|
||||
fix stream_last_heard; // last time we heard from this stream
|
||||
|
||||
fix stream_start_time; // time the stream started playing
|
||||
sound_handle stream_snd_handle; // sound playing instance handle
|
||||
sound_handle stream_snd_handle; // sound playing instance handle
|
||||
int stream_rtvoice_handle; // rtvoice buffer handle
|
||||
} voice_stream;
|
||||
voice_stream Multi_voice_stream[MULTI_VOICE_MAX_STREAMS]; // voice streams themselves
|
||||
@@ -337,7 +337,7 @@ void multi_voice_init()
|
||||
memset(Multi_voice_stream,0,sizeof(voice_stream) * MULTI_VOICE_MAX_STREAMS);
|
||||
for(idx=0;idx<MULTI_VOICE_MAX_STREAMS;idx++){
|
||||
Multi_voice_stream[idx].token_status = MULTI_VOICE_TOKEN_INDEX_FREE;
|
||||
Multi_voice_stream[idx].token_stamp = -1;
|
||||
Multi_voice_stream[idx].token_stamp = -1;
|
||||
Multi_voice_stream[idx].stream_snd_handle = sound_handle::invalid();
|
||||
|
||||
// get a playback buffer handle
|
||||
@@ -395,7 +395,7 @@ void multi_voice_close()
|
||||
if(Multi_voice_stream[idx].stream_rtvoice_handle != -1){
|
||||
rtvoice_free_playback_buffer(Multi_voice_stream[idx].stream_rtvoice_handle);
|
||||
Multi_voice_stream[idx].stream_rtvoice_handle = -1;
|
||||
Multi_voice_stream[idx].stream_snd_handle = sound_handle::invalid();
|
||||
Multi_voice_stream[idx].stream_snd_handle = sound_handle::invalid();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -463,7 +463,7 @@ void multi_voice_process()
|
||||
|
||||
// find any playing sound streams which have finished and unmark them
|
||||
for(idx=0;idx<MULTI_VOICE_MAX_STREAMS;idx++){
|
||||
if((Multi_voice_stream[idx].stream_snd_handle.isValid()) && !multi_voice_stream_playing(idx)){
|
||||
if ((Multi_voice_stream[idx].stream_snd_handle.isValid()) && !multi_voice_stream_playing(idx)) {
|
||||
Multi_voice_stream[idx].stream_snd_handle = sound_handle::invalid();
|
||||
}
|
||||
}
|
||||
@@ -522,7 +522,7 @@ int multi_voice_status()
|
||||
earliest_time = -1;
|
||||
for(idx=0;idx<MULTI_VOICE_MAX_STREAMS;idx++){
|
||||
// if we found a playing stream
|
||||
if(Multi_voice_stream[idx].stream_snd_handle.isValid()){
|
||||
if (Multi_voice_stream[idx].stream_snd_handle.isValid()) {
|
||||
if((earliest == -1) || (Multi_voice_stream[idx].stream_start_time < earliest_time)){
|
||||
earliest = idx;
|
||||
earliest_time = Multi_voice_stream[idx].stream_start_time;
|
||||
@@ -1919,7 +1919,7 @@ void multi_voice_alg_play_window(int stream_index)
|
||||
Assert(Multi_voice_stream[stream_index].stream_rtvoice_handle != -1);
|
||||
|
||||
// kill any previously playing sounds
|
||||
rtvoice_stop_playback(Multi_voice_stream[stream_index].stream_rtvoice_handle);
|
||||
rtvoice_stop_playback(Multi_voice_stream[stream_index].stream_rtvoice_handle);
|
||||
Multi_voice_stream[stream_index].stream_snd_handle = sound_handle::invalid();
|
||||
|
||||
// if we can play sound and we know who this is from, display it
|
||||
|
||||
@@ -951,10 +951,10 @@ int get_ship_quadrant_from_global(vec3d *global_pos, object *objp)
|
||||
|
||||
void collide_ship_ship_sounds_init()
|
||||
{
|
||||
Player_collide_sound = sound_handle::invalid();
|
||||
AI_collide_sound = sound_handle::invalid();
|
||||
Player_collide_sound = sound_handle::invalid();
|
||||
AI_collide_sound = sound_handle::invalid();
|
||||
Player_collide_shield_sound = sound_handle::invalid();
|
||||
AI_collide_shield_sound = sound_handle::invalid();
|
||||
AI_collide_shield_sound = sound_handle::invalid();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+10
-10
@@ -37,7 +37,7 @@ typedef struct _obj_snd {
|
||||
_obj_snd *next, *prev;
|
||||
int objnum; // object index of object that contains this sound
|
||||
gamesnd_id id; // Index into Snds[] array
|
||||
sound_handle instance; // handle of currently playing sound (a ds3d handle if USES_DS3D flag set)
|
||||
sound_handle instance; // handle of currently playing sound (a ds3d handle if USES_DS3D flag set)
|
||||
int next_update; // timestamp that marks next allowed vol/pan change
|
||||
float vol; // volume of sound (range: 0.0 -> 1.0)
|
||||
float pan; // pan of sound (range: -1.0 -> 1.0)
|
||||
@@ -118,7 +118,7 @@ DCF(objsnd, "Persistent sound stuff" )
|
||||
float distance;
|
||||
|
||||
Assert(osp != NULL);
|
||||
if ( !osp->instance.isValid() ) {
|
||||
if (!osp->instance.isValid()) {
|
||||
continue;
|
||||
//sprintf(buf1,"OFF");
|
||||
} else {
|
||||
@@ -245,7 +245,7 @@ void obj_snd_stop(object *objp, int index)
|
||||
|
||||
osp = &Objsnds[*iter];
|
||||
|
||||
if ( osp->instance.isValid() ) {
|
||||
if (osp->instance.isValid()) {
|
||||
snd_stop(osp->instance);
|
||||
osp->instance = sound_handle::invalid();
|
||||
switch(objp->type) {
|
||||
@@ -270,7 +270,7 @@ void obj_snd_stop(object *objp, int index)
|
||||
|
||||
osp = &Objsnds[objp->objsnd_num[index]];
|
||||
|
||||
if ( osp->instance.isValid() ) {
|
||||
if (osp->instance.isValid()) {
|
||||
snd_stop(osp->instance);
|
||||
osp->instance = sound_handle::invalid();
|
||||
switch(objp->type) {
|
||||
@@ -350,7 +350,7 @@ int obj_snd_stop_lowest_vol(float new_vol)
|
||||
Assert(osp->objnum != -1);
|
||||
objp = &Objects[osp->objnum];
|
||||
|
||||
if ( (osp->instance.isValid()) && (osp->vol < lowest_vol) ) {
|
||||
if ((osp->instance.isValid()) && (osp->vol < lowest_vol)) {
|
||||
lowest_vol = osp->vol;
|
||||
lowest_vol_osp = osp;
|
||||
}
|
||||
@@ -600,7 +600,7 @@ void obj_snd_do_frame()
|
||||
|
||||
go_ahead_flag = TRUE;
|
||||
float max_vol,new_vol;
|
||||
if ( !osp->instance.isValid() ) {
|
||||
if (!osp->instance.isValid()) {
|
||||
if ( distance < gs->max ) {
|
||||
max_vol = gs->volume_range.max();
|
||||
if ( distance <= gs->min ) {
|
||||
@@ -631,7 +631,7 @@ void obj_snd_do_frame()
|
||||
|
||||
if ( go_ahead_flag ) {
|
||||
osp->instance = snd_play_3d(gs, &source_pos, &View_position, add_distance, &objp->phys_info.vel, 1, 1.0f, SND_PRIORITY_TRIPLE_INSTANCE, NULL, 1.0f, 0, true);
|
||||
if ( osp->instance.isValid() ) {
|
||||
if (osp->instance.isValid()) {
|
||||
Num_obj_sounds_playing++;
|
||||
}
|
||||
}
|
||||
@@ -657,7 +657,7 @@ void obj_snd_do_frame()
|
||||
}
|
||||
}
|
||||
|
||||
if ( !osp->instance.isValid() )
|
||||
if (!osp->instance.isValid())
|
||||
continue;
|
||||
|
||||
sp = NULL;
|
||||
@@ -759,7 +759,7 @@ int obj_snd_assign(int objnum, gamesnd_id sndnum, vec3d *pos, int main, int flag
|
||||
|
||||
snd->id = sndnum;
|
||||
|
||||
snd->instance = sound_handle::invalid();
|
||||
snd->instance = sound_handle::invalid();
|
||||
snd->vol = 0.0f;
|
||||
snd->objnum = OBJ_INDEX(objp);
|
||||
snd->next_update = 1;
|
||||
@@ -881,7 +881,7 @@ void obj_snd_level_close()
|
||||
//
|
||||
int obj_snd_is_playing(int object, int index)
|
||||
{
|
||||
if ( !obj_snd_return_instance(object, index).isValid() )
|
||||
if (!obj_snd_return_instance(object, index).isValid())
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
|
||||
@@ -465,7 +465,7 @@ void player::reset()
|
||||
damage_this_burst = 0.0f;
|
||||
|
||||
repair_sound_loop = sound_handle::invalid();
|
||||
cargo_scan_loop = sound_handle::invalid();
|
||||
cargo_scan_loop = sound_handle::invalid();
|
||||
|
||||
praise_count = 0;
|
||||
allow_praise_timestamp = -1;
|
||||
|
||||
@@ -13,14 +13,14 @@
|
||||
#define _PLAYER_H
|
||||
|
||||
#include "globalincs/globals.h"
|
||||
#include "hud/hudtarget.h" // for targeting hotkey lists
|
||||
#include "io/keycontrol.h" // for button_info
|
||||
#include "hud/hudtarget.h" // for targeting hotkey lists
|
||||
#include "io/keycontrol.h" // for button_info
|
||||
#include "localization/localize.h"
|
||||
#include "network/multi_options.h"
|
||||
#include "parse/sexp.h"
|
||||
#include "physics/physics.h"
|
||||
#include "stats/scoring.h" // for scoring/stats
|
||||
#include "sound/sound.h"
|
||||
#include "stats/scoring.h" // for scoring/stats
|
||||
|
||||
struct campaign_info;
|
||||
|
||||
@@ -146,9 +146,9 @@ public:
|
||||
int warn_count; // number of attack warnings player has received this mission
|
||||
float damage_this_burst; // amount of damage done this frame to friendly craft
|
||||
|
||||
sound_handle repair_sound_loop; // Sound id for ship repair looping sound, this is in the player
|
||||
// file since the repair sound only plays when Player ship is getting repaired
|
||||
sound_handle cargo_scan_loop; // Sound id for scanning cargo looping sound
|
||||
sound_handle repair_sound_loop; // Sound id for ship repair looping sound, this is in the player
|
||||
// file since the repair sound only plays when Player ship is getting repaired
|
||||
sound_handle cargo_scan_loop; // Sound id for scanning cargo looping sound
|
||||
|
||||
int praise_count; // number of praises received this mission
|
||||
int allow_praise_timestamp; // timestamp marking time until next praise is allowed
|
||||
|
||||
@@ -1383,8 +1383,8 @@ void player_level_init()
|
||||
|
||||
Player->request_repair_timestamp = 1; // timestamp until next 'requesting repair sir' message can be played
|
||||
|
||||
Player->repair_sound_loop = sound_handle::invalid();
|
||||
Player->cargo_scan_loop = sound_handle::invalid();
|
||||
Player->repair_sound_loop = sound_handle::invalid();
|
||||
Player->cargo_scan_loop = sound_handle::invalid();
|
||||
Player->cargo_inspect_time = 0; // time that current target's cargo has been inspected for
|
||||
|
||||
Player->target_is_dying = -1; // The player target is dying, set to -1 if no target
|
||||
@@ -1424,11 +1424,11 @@ void player_init()
|
||||
void player_stop_looped_sounds()
|
||||
{
|
||||
Assert(Player);
|
||||
if ( Player->repair_sound_loop.isValid() ) {
|
||||
if (Player->repair_sound_loop.isValid()) {
|
||||
snd_stop(Player->repair_sound_loop);
|
||||
Player->repair_sound_loop = sound_handle::invalid();
|
||||
}
|
||||
if ( Player->cargo_scan_loop.isValid() ) {
|
||||
if (Player->cargo_scan_loop.isValid()) {
|
||||
snd_stop(Player->cargo_scan_loop);
|
||||
Player->cargo_scan_loop = sound_handle::invalid();
|
||||
}
|
||||
@@ -1441,7 +1441,7 @@ void player_stop_looped_sounds()
|
||||
void player_maybe_start_repair_sound()
|
||||
{
|
||||
Assert(Player);
|
||||
if ( !Player->repair_sound_loop.isValid() ) {
|
||||
if (!Player->repair_sound_loop.isValid()) {
|
||||
Player->repair_sound_loop = snd_play_looping( gamesnd_get_game_sound(GameSounds::SHIP_REPAIR) );
|
||||
}
|
||||
}
|
||||
@@ -1452,9 +1452,9 @@ void player_maybe_start_repair_sound()
|
||||
void player_stop_repair_sound()
|
||||
{
|
||||
Assert(Player);
|
||||
if ( Player->repair_sound_loop.isValid() ) {
|
||||
if (Player->repair_sound_loop.isValid()) {
|
||||
snd_stop(Player->repair_sound_loop);
|
||||
Player->repair_sound_loop = sound_handle::invalid();
|
||||
Player->repair_sound_loop = sound_handle::invalid();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1464,7 +1464,7 @@ void player_stop_repair_sound()
|
||||
void player_maybe_start_cargo_scan_sound()
|
||||
{
|
||||
Assert(Player);
|
||||
if ( !Player->cargo_scan_loop.isValid() ) {
|
||||
if (!Player->cargo_scan_loop.isValid()) {
|
||||
Player->cargo_scan_loop = snd_play_looping( gamesnd_get_game_sound(ship_get_sound(Player_obj, GameSounds::CARGO_SCAN)) );
|
||||
}
|
||||
}
|
||||
@@ -1475,9 +1475,9 @@ void player_maybe_start_cargo_scan_sound()
|
||||
void player_stop_cargo_scan_sound()
|
||||
{
|
||||
Assert(Player);
|
||||
if ( Player->cargo_scan_loop.isValid() ) {
|
||||
if (Player->cargo_scan_loop.isValid()) {
|
||||
snd_stop(Player->cargo_scan_loop);
|
||||
Player->cargo_scan_loop = sound_handle::invalid();
|
||||
Player->cargo_scan_loop = sound_handle::invalid();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -335,18 +335,18 @@ void HudGaugeRadarStd::render(float /*frametime*/)
|
||||
if ( ok_to_blit_radar ) {
|
||||
if ( Radar_static_playing ) {
|
||||
drawBlipsSorted(1); // passing 1 means to draw distorted
|
||||
if ( !Radar_static_looping.isValid() ) {
|
||||
if (!Radar_static_looping.isValid()) {
|
||||
Radar_static_looping = snd_play_looping(gamesnd_get_game_sound(GameSounds::STATIC));
|
||||
}
|
||||
} else {
|
||||
drawBlipsSorted(0);
|
||||
if ( Radar_static_looping.isValid() ) {
|
||||
if (Radar_static_looping.isValid()) {
|
||||
snd_stop(Radar_static_looping);
|
||||
Radar_static_looping = sound_handle::invalid();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ( Radar_static_looping.isValid() ) {
|
||||
if (Radar_static_looping.isValid()) {
|
||||
snd_stop(Radar_static_looping);
|
||||
Radar_static_looping = sound_handle::invalid();
|
||||
}
|
||||
|
||||
@@ -558,8 +558,7 @@ void HudGaugeRadarDradis::render(float /*frametime*/)
|
||||
{
|
||||
drawBlipsSorted(0);
|
||||
|
||||
if (Radar_static_looping.isValid())
|
||||
{
|
||||
if (Radar_static_looping.isValid()) {
|
||||
snd_stop(Radar_static_looping);
|
||||
Radar_static_looping = sound_handle::invalid();
|
||||
}
|
||||
@@ -567,8 +566,7 @@ void HudGaugeRadarDradis::render(float /*frametime*/)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Radar_static_looping.isValid())
|
||||
{
|
||||
if (Radar_static_looping.isValid()) {
|
||||
snd_stop(Radar_static_looping);
|
||||
Radar_static_looping = sound_handle::invalid();
|
||||
}
|
||||
@@ -598,14 +596,11 @@ void HudGaugeRadarDradis::doLoopSnd()
|
||||
|
||||
if (!this->shouldDoSounds())
|
||||
{
|
||||
if (loop_sound_handle.isValid() && snd_is_playing(loop_sound_handle))
|
||||
{
|
||||
if (loop_sound_handle.isValid() && snd_is_playing(loop_sound_handle)) {
|
||||
snd_stop(loop_sound_handle);
|
||||
loop_sound_handle = sound_handle::invalid();
|
||||
}
|
||||
}
|
||||
else if (!this->loop_sound_handle.isValid() || !snd_is_playing(this->loop_sound_handle))
|
||||
{
|
||||
} else if (!this->loop_sound_handle.isValid() || !snd_is_playing(this->loop_sound_handle)) {
|
||||
loop_sound_handle = snd_play(gamesnd_get_game_sound(m_loop_snd), 0.0f, loop_sound_volume);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -499,18 +499,18 @@ void HudGaugeRadarOrb::render(float /*frametime*/)
|
||||
if ( ok_to_blit_radar ) {
|
||||
if ( Radar_static_playing ) {
|
||||
drawBlipsSorted(1); // passing 1 means to draw distorted
|
||||
if ( !Radar_static_looping.isValid() ) {
|
||||
if (!Radar_static_looping.isValid()) {
|
||||
Radar_static_looping = snd_play_looping(gamesnd_get_game_sound(GameSounds::STATIC));
|
||||
}
|
||||
} else {
|
||||
drawBlipsSorted(0);
|
||||
if ( Radar_static_looping.isValid() ) {
|
||||
if (Radar_static_looping.isValid()) {
|
||||
snd_stop(Radar_static_looping);
|
||||
Radar_static_looping = sound_handle::invalid();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ( Radar_static_looping.isValid() ) {
|
||||
if (Radar_static_looping.isValid()) {
|
||||
snd_stop(Radar_static_looping);
|
||||
Radar_static_looping = sound_handle::invalid();
|
||||
}
|
||||
|
||||
@@ -80,8 +80,7 @@ ADE_FUNC(playSound, l_Audio, "soundentry", "Plays the specified sound entry hand
|
||||
|
||||
auto handle = snd_play(seh->Get());
|
||||
|
||||
if (!handle.isValid())
|
||||
{
|
||||
if (!handle.isValid()) {
|
||||
return ade_set_args(L, "o", l_Sound.Set(sound_h()));
|
||||
}
|
||||
else
|
||||
@@ -102,8 +101,7 @@ ADE_FUNC(playLoopingSound, l_Audio, "soundentry", "Plays the specified sound as
|
||||
|
||||
auto handle = snd_play_looping(seh->Get());
|
||||
|
||||
if (!handle.isValid())
|
||||
{
|
||||
if (!handle.isValid()) {
|
||||
return ade_set_args(L, "o", l_Sound.Set(sound_h()));
|
||||
}
|
||||
else
|
||||
@@ -126,8 +124,7 @@ ADE_FUNC(play3DSound, l_Audio, "soundentry[, vector source[, vector listener]]",
|
||||
|
||||
auto handle = snd_play_3d(seh->Get(), source, listener);
|
||||
|
||||
if (!handle.isValid())
|
||||
{
|
||||
if (!handle.isValid()) {
|
||||
return ade_set_args(L, "o", l_Sound3D.Set(sound_h()));
|
||||
}
|
||||
else
|
||||
@@ -158,7 +155,7 @@ ADE_FUNC(playGameSound, l_Audio, "Sound index, [Panning (-1.0 left to 1.0 right)
|
||||
auto gamesnd_idx = gamesnd_get_by_tbl_index(idx);
|
||||
|
||||
if (gamesnd_idx.isValid()) {
|
||||
auto sound_handle = snd_play(gamesnd_get_game_sound(gamesnd_idx), pan, vol*0.01f, pri, voice_msg);
|
||||
auto sound_handle = snd_play(gamesnd_get_game_sound(gamesnd_idx), pan, vol * 0.01f, pri, voice_msg);
|
||||
return ade_set_args(L, "b", sound_handle.isValid());
|
||||
} else {
|
||||
LuaError(L, "Invalid sound index %i (Snds[%i]) in playGameSound()", idx, gamesnd_idx.value());
|
||||
|
||||
@@ -119,16 +119,10 @@ ADE_FUNC(isValid, l_SoundEntry, NULL, "Detects whether handle is valid", "boolea
|
||||
return ade_set_args(L, "b", seh->IsValid());
|
||||
}
|
||||
|
||||
|
||||
sound_h::sound_h() :sound_entry_h()
|
||||
sound_h::sound_h() : sound_entry_h() { sig = sound_handle::invalid(); }
|
||||
sound_h::sound_h(gamesnd_id n_gs_idx, sound_handle n_sig) : sound_entry_h(n_gs_idx) { sig = n_sig; }
|
||||
sound_handle sound_h::getSignature()
|
||||
{
|
||||
sig=sound_handle::invalid();
|
||||
}
|
||||
sound_h::sound_h(gamesnd_id n_gs_idx, sound_handle n_sig) : sound_entry_h(n_gs_idx)
|
||||
{
|
||||
sig=n_sig;
|
||||
}
|
||||
sound_handle sound_h::getSignature() {
|
||||
if (!IsValid())
|
||||
return sound_handle::invalid();
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ----------------------------------------------------------
|
||||
// Global to file
|
||||
// ----------------------------------------------------------
|
||||
static sound_handle Player_afterburner_loop_id; // identifies the looping afterburner sound of the player ship
|
||||
static sound_handle Player_afterburner_loop_id; // identifies the looping afterburner sound of the player ship
|
||||
static int Player_afterburner_loop_delay; // timestamp used to time the start of the looping afterburner sound
|
||||
static int Player_disengage_timer;
|
||||
static float Player_afterburner_vol;
|
||||
@@ -54,7 +54,7 @@ void afterburner_level_init()
|
||||
{
|
||||
Player_disengage_timer = 1;
|
||||
Player_afterburner_vol = AFTERBURNER_DEFAULT_VOL;
|
||||
Player_afterburner_loop_id = sound_handle::invalid();
|
||||
Player_afterburner_loop_id = sound_handle::invalid();
|
||||
Player_afterburner_start_time = 0;
|
||||
}
|
||||
|
||||
@@ -251,7 +251,7 @@ void afterburners_update(object *objp, float fl_frametime)
|
||||
if ( timestamp_elapsed(Player_afterburner_loop_delay) ) {
|
||||
Player_afterburner_vol = AFTERBURNER_DEFAULT_VOL;
|
||||
Player_afterburner_loop_delay = 0;
|
||||
if ( !Player_afterburner_loop_id.isValid() ) {
|
||||
if (!Player_afterburner_loop_id.isValid()) {
|
||||
Player_afterburner_loop_id = snd_play_looping( gamesnd_get_game_sound(ship_get_sound(objp, GameSounds::ABURN_LOOP)), 0.0f , -1, -1);
|
||||
snd_set_volume(Player_afterburner_loop_id, Player_afterburner_vol);
|
||||
}
|
||||
@@ -317,7 +317,7 @@ void afterburners_stop(object *objp, int key_released)
|
||||
snd_play( gamesnd_get_game_sound(ship_get_sound(objp, GameSounds::ABURN_FAIL)) );
|
||||
}
|
||||
|
||||
if ( Player_afterburner_loop_id.isValid() ) {
|
||||
if (Player_afterburner_loop_id.isValid()) {
|
||||
Player_disengage_timer = timestamp(DISENGAGE_TIME);
|
||||
}
|
||||
|
||||
@@ -331,11 +331,11 @@ void afterburners_stop(object *objp, int key_released)
|
||||
*/
|
||||
void afterburner_stop_sounds()
|
||||
{
|
||||
if ( Player_afterburner_loop_id.isValid() ) {
|
||||
if (Player_afterburner_loop_id.isValid()) {
|
||||
snd_stop(Player_afterburner_loop_id);
|
||||
}
|
||||
|
||||
Player_afterburner_loop_id = sound_handle::invalid();
|
||||
Player_afterburner_loop_id = sound_handle::invalid();
|
||||
Player_disengage_timer = 1;
|
||||
Player_afterburner_loop_delay = 0;
|
||||
}
|
||||
+2
-2
@@ -5868,7 +5868,7 @@ void ship::clear()
|
||||
swarm_missile_bank = -1;
|
||||
|
||||
group = -1;
|
||||
death_roll_snd = sound_handle::invalid();
|
||||
death_roll_snd = sound_handle::invalid();
|
||||
ship_list_index = -1;
|
||||
|
||||
thruster_bitmap = -1;
|
||||
@@ -7988,7 +7988,7 @@ static void ship_dying_frame(object *objp, int ship_num)
|
||||
if (objp == Player_obj)
|
||||
joy_ff_explode();
|
||||
|
||||
if ( shipp->death_roll_snd.isValid() ) {
|
||||
if (shipp->death_roll_snd.isValid()) {
|
||||
snd_stop(shipp->death_roll_snd);
|
||||
shipp->death_roll_snd = sound_handle::invalid();
|
||||
}
|
||||
|
||||
+1
-2
@@ -563,7 +563,7 @@ public:
|
||||
int swarm_missile_bank; // The missilebank the swarm was originally launched from
|
||||
|
||||
int group; // group ship is in, or -1 if none. Fred thing
|
||||
sound_handle death_roll_snd; // id of death roll sound, may need to be stopped early
|
||||
sound_handle death_roll_snd; // id of death roll sound, may need to be stopped early
|
||||
int ship_list_index; // index of ship in Ship_objs[] array
|
||||
|
||||
int thruster_bitmap; // What frame the current thruster bitmap is at for this ship
|
||||
@@ -597,7 +597,6 @@ public:
|
||||
int large_ship_blowup_index; // -1 if not a large ship exploding, else this is an index used by the shipfx large ship exploding code.
|
||||
std::array<sound_handle, NUM_SUB_EXPL_HANDLES> sub_expl_sound_handle;
|
||||
|
||||
|
||||
// Stuff for showing electrical arcs on damaged ships
|
||||
vec3d arc_pts[MAX_SHIP_ARCS][2]; // The endpoints of each arc
|
||||
int arc_timestamp[MAX_SHIP_ARCS]; // When this times out, the spark goes away. -1 is not used
|
||||
|
||||
+23
-21
@@ -1654,14 +1654,15 @@ typedef struct clip_ship {
|
||||
} clip_ship;
|
||||
|
||||
typedef struct split_ship {
|
||||
int used = 0; // 0 if not used, 1 if used
|
||||
int used = 0; // 0 if not used, 1 if used
|
||||
clip_ship front_ship;
|
||||
clip_ship back_ship;
|
||||
int explosion_flash_timestamp = 0;
|
||||
int explosion_flash_started = 0;
|
||||
int explosion_flash_timestamp = 0;
|
||||
int explosion_flash_started = 0;
|
||||
std::array<sound_handle, NUM_SUB_EXPL_HANDLES> sound_handles;
|
||||
|
||||
split_ship() {
|
||||
split_ship()
|
||||
{
|
||||
memset(&front_ship, 0, sizeof(front_ship));
|
||||
memset(&back_ship, 0, sizeof(back_ship));
|
||||
sound_handles.fill(sound_handle::invalid());
|
||||
@@ -1805,7 +1806,7 @@ static void split_ship_init( ship* shipp, split_ship* split_shipp )
|
||||
split_shipp->front_ship.phys_info.vel = parent_ship_obj->phys_info.vel;
|
||||
split_shipp->back_ship.phys_info.vel = parent_ship_obj->phys_info.vel;
|
||||
maybe_fireball_wipe(&split_shipp->front_ship, split_shipp->sound_handles.data());
|
||||
maybe_fireball_wipe(&split_shipp->back_ship, split_shipp->sound_handles.data());
|
||||
maybe_fireball_wipe(&split_shipp->back_ship, split_shipp->sound_handles.data());
|
||||
vm_vec_scale_add2(&split_shipp->front_ship.phys_info.vel, &orient->vec.fvec, front_vel);
|
||||
vm_vec_scale_add2(&split_shipp->back_ship.phys_info.vel, &orient->vec.fvec, back_vel);
|
||||
|
||||
@@ -2108,20 +2109,24 @@ void do_sub_expl_sound(float radius, vec3d* sound_pos, sound_handle* handle_arra
|
||||
int handle_index = rand()%NUM_SUB_EXPL_HANDLES;
|
||||
|
||||
auto sound_index = GameSounds::SHIP_EXPLODE_1;
|
||||
auto handle = handle_array[handle_index];
|
||||
auto handle = handle_array[handle_index];
|
||||
|
||||
if (!handle.isValid()) {
|
||||
// if no handle, get one
|
||||
handle_array[handle_index] = snd_play_3d( gamesnd_get_game_sound(sound_index), sound_pos, &View_position, 0.0f, nullptr, 0, 0.6f, SND_PRIORITY_MUST_PLAY, nullptr, sound_range );
|
||||
handle_array[handle_index] = snd_play_3d(gamesnd_get_game_sound(sound_index), sound_pos, &View_position, 0.0f,
|
||||
nullptr, 0, 0.6f, SND_PRIORITY_MUST_PLAY, nullptr, sound_range);
|
||||
} else if (!snd_is_playing(handle)) {
|
||||
// if sound not playing and old, get new one
|
||||
// I don't think will happen with SND_PRIORITY_MUST_PLAY
|
||||
if (get_sound_time_played(snd_get_sound_id(handle), handle) > 400) {
|
||||
snd_stop(handle_array[handle_index]);
|
||||
handle_array[handle_index] = snd_play_3d( gamesnd_get_game_sound(sound_index), sound_pos, &View_position, 0.0f, nullptr, 0, 0.6f, SND_PRIORITY_MUST_PLAY, nullptr, sound_range );
|
||||
handle_array[handle_index] =
|
||||
snd_play_3d(gamesnd_get_game_sound(sound_index), sound_pos, &View_position, 0.0f, nullptr, 0, 0.6f,
|
||||
SND_PRIORITY_MUST_PLAY, nullptr, sound_range);
|
||||
}
|
||||
} else if (get_sound_time_played(snd_get_sound_id(handle), handle) > 750) {
|
||||
handle_array[handle_index] = snd_play_3d( gamesnd_get_game_sound(sound_index), sound_pos, &View_position, 0.0f, nullptr, 0, 0.6f, SND_PRIORITY_MUST_PLAY, nullptr, sound_range );
|
||||
handle_array[handle_index] = snd_play_3d(gamesnd_get_game_sound(sound_index), sound_pos, &View_position, 0.0f,
|
||||
nullptr, 0, 0.6f, SND_PRIORITY_MUST_PLAY, nullptr, sound_range);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2279,7 +2284,7 @@ int shipfx_large_blowup_do_frame(ship *shipp, float frametime)
|
||||
}
|
||||
|
||||
maybe_fireball_wipe(&the_split_ship->front_ship, the_split_ship->sound_handles.data());
|
||||
maybe_fireball_wipe(&the_split_ship->back_ship, the_split_ship->sound_handles.data());
|
||||
maybe_fireball_wipe(&the_split_ship->back_ship, the_split_ship->sound_handles.data());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -2996,17 +3001,14 @@ void engine_wash_ship_process(ship *shipp)
|
||||
/**
|
||||
* Engine wash level init
|
||||
*/
|
||||
void shipfx_engine_wash_level_init()
|
||||
{
|
||||
Player_engine_wash_loop = sound_handle::invalid();
|
||||
}
|
||||
void shipfx_engine_wash_level_init() { Player_engine_wash_loop = sound_handle::invalid(); }
|
||||
|
||||
/**
|
||||
* Pause engine wash sounds
|
||||
*/
|
||||
void shipfx_stop_engine_wash_sound()
|
||||
{
|
||||
if(Player_engine_wash_loop.isValid()){
|
||||
if (Player_engine_wash_loop.isValid()) {
|
||||
snd_stop(Player_engine_wash_loop);
|
||||
Player_engine_wash_loop = sound_handle::invalid();
|
||||
}
|
||||
@@ -3855,7 +3857,7 @@ int WE_BSG::warpStart()
|
||||
if(gs_end_index.isValid())
|
||||
{
|
||||
snd_end_gs = gamesnd_get_game_sound(gs_end_index);
|
||||
snd_end = sound_handle::invalid();
|
||||
snd_end = sound_handle::invalid();
|
||||
}
|
||||
|
||||
stage = 0;
|
||||
@@ -3912,7 +3914,7 @@ int WE_BSG::warpFrame(float /*frametime*/)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(snd_start.isValid())
|
||||
if (snd_start.isValid())
|
||||
snd_update_3d_pos(snd_start, snd_start_gs, &objp->pos, 0.0f, snd_range_factor);
|
||||
|
||||
return 1;
|
||||
@@ -3992,7 +3994,7 @@ int WE_BSG::warpShipRender()
|
||||
|
||||
int WE_BSG::warpEnd()
|
||||
{
|
||||
if(snd_start.isValid())
|
||||
if (snd_start.isValid())
|
||||
snd_stop(snd_start);
|
||||
if(snd_end_gs != NULL)
|
||||
snd_end = snd_play_3d(snd_end_gs, &objp->pos, &View_position, 0.0f, NULL, 0, 1.0f, SND_PRIORITY_SINGLE_INSTANCE, NULL, snd_range_factor);
|
||||
@@ -4097,7 +4099,7 @@ WE_Homeworld::WE_Homeworld(object *n_objp, int n_direction)
|
||||
height = 0.0f;
|
||||
|
||||
//Sound
|
||||
snd = sound_handle::invalid();
|
||||
snd = sound_handle::invalid();
|
||||
snd_gs = NULL;
|
||||
}
|
||||
|
||||
@@ -4223,7 +4225,7 @@ int WE_Homeworld::warpFrame(float /*frametime*/)
|
||||
}
|
||||
|
||||
//Update sound
|
||||
if(snd.isValid())
|
||||
if (snd.isValid())
|
||||
snd_update_3d_pos(snd, snd_gs, &pos, 0.0f, snd_range_factor);
|
||||
|
||||
return 1;
|
||||
@@ -4255,7 +4257,7 @@ int WE_Homeworld::warpShipRender()
|
||||
|
||||
int WE_Homeworld::warpEnd()
|
||||
{
|
||||
if(snd.isValid())
|
||||
if (snd.isValid())
|
||||
snd_stop(snd);
|
||||
return WarpEffect::warpEnd();
|
||||
}
|
||||
|
||||
+2
-2
@@ -558,7 +558,7 @@ void ds_close_channel(int i)
|
||||
|
||||
Channels[i].source_id = 0;
|
||||
Channels[i].sid = -1;
|
||||
Channels[i].sig = ds_sound_handle::invalid();
|
||||
Channels[i].sig = ds_sound_handle::invalid();
|
||||
Channels[i].snd_id = -1;
|
||||
}
|
||||
}
|
||||
@@ -582,7 +582,7 @@ void ds_close_channel_fast(int i)
|
||||
}
|
||||
|
||||
Channels[i].sid = -1;
|
||||
Channels[i].sig = ds_sound_handle::invalid();
|
||||
Channels[i].sig = ds_sound_handle::invalid();
|
||||
Channels[i].snd_id = -1;
|
||||
}
|
||||
}
|
||||
|
||||
+5
-2
@@ -58,7 +58,8 @@ int ds_init();
|
||||
void ds_close();
|
||||
int ds_load_buffer(int *sid, int flags, ffmpeg::WaveFile* file);
|
||||
void ds_unload_buffer(int sid);
|
||||
ds_sound_handle ds_play(int sid, int snd_id, int priority, const EnhancedSoundData * enhanced_sound_data, float volume, float pan, int looping, bool is_voice_msg = false);
|
||||
ds_sound_handle ds_play(int sid, int snd_id, int priority, const EnhancedSoundData* enhanced_sound_data, float volume,
|
||||
float pan, int looping, bool is_voice_msg = false);
|
||||
int ds_get_channel(ds_sound_handle sig);
|
||||
int ds_is_channel_playing(int channel);
|
||||
void ds_stop_channel(int channel);
|
||||
@@ -96,7 +97,9 @@ int ds_get_sound_index(int channel_id);
|
||||
// Returns the number of channels that are actually playing
|
||||
int ds_get_number_channels();
|
||||
|
||||
ds_sound_handle ds3d_play(int sid, int snd_id, vec3d *pos, vec3d *vel, float min, float max, int looping, float max_volume, float estimated_vol, const EnhancedSoundData * enhanced_sound_data, int priority = DS_MUST_PLAY, bool is_ambient = false);
|
||||
ds_sound_handle ds3d_play(int sid, int snd_id, vec3d* pos, vec3d* vel, float min, float max, int looping,
|
||||
float max_volume, float estimated_vol, const EnhancedSoundData* enhanced_sound_data,
|
||||
int priority = DS_MUST_PLAY, bool is_ambient = false);
|
||||
|
||||
void ds_do_frame();
|
||||
|
||||
|
||||
@@ -438,7 +438,7 @@ void rtvoice_free_playback_buffer(int index)
|
||||
// Play sound data
|
||||
// exit: >=0 => handle to playing sound
|
||||
// -1 => error, voice not played
|
||||
sound_handle rtvoice_play(int index, unsigned char *data, int size)
|
||||
sound_handle rtvoice_play(int index, unsigned char* data, int size)
|
||||
{
|
||||
int ds_handle;
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ void rtvoice_free_playback_buffer(int index);
|
||||
void rtvoice_uncompress(unsigned char *data_in, int size_in, double gain, unsigned char *data_out, int size_out);
|
||||
|
||||
// return a sound handle, _NOT_ a buffer handle
|
||||
sound_handle rtvoice_play(int handle, unsigned char *data, int size);
|
||||
sound_handle rtvoice_play(int handle, unsigned char* data, int size);
|
||||
|
||||
// pass in buffer handle returned from rtvoice_create_playback_buffer(), kills the _sound_ only
|
||||
void rtvoice_stop_playback(int handle);
|
||||
|
||||
+27
-24
@@ -62,10 +62,8 @@ struct LoopingSoundInfo {
|
||||
float m_defaultVolume; //!< The default volume of this sound (from game_snd)
|
||||
float m_dynamicVolume; //!< The dynamic volume before scripted volume adjustment is applied (is updated via snd_set_volume)
|
||||
|
||||
LoopingSoundInfo(sound_handle dsHandle, float defaultVolume, float dynamicVolume):
|
||||
m_dsHandle(dsHandle),
|
||||
m_defaultVolume(defaultVolume),
|
||||
m_dynamicVolume(dynamicVolume)
|
||||
LoopingSoundInfo(sound_handle dsHandle, float defaultVolume, float dynamicVolume)
|
||||
: m_dsHandle(dsHandle), m_defaultVolume(defaultVolume), m_dynamicVolume(dynamicVolume)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -525,7 +523,7 @@ MONITOR( NumSoundsLoaded )
|
||||
// returns: -1 => sound could not be played
|
||||
// n => handle for instance of sound
|
||||
//
|
||||
sound_handle snd_play( game_snd *gs, float pan, float vol_scale, int priority, bool is_voice_msg )
|
||||
sound_handle snd_play(game_snd* gs, float pan, float vol_scale, int priority, bool is_voice_msg)
|
||||
{
|
||||
float volume;
|
||||
sound *snd;
|
||||
@@ -572,7 +570,7 @@ sound_handle snd_play( game_snd *gs, float pan, float vol_scale, int priority, b
|
||||
sound_handle handle;
|
||||
if ( volume > MIN_SOUND_VOLUME ) {
|
||||
handle = ds_play( snd->sid, entry->id_sig, ds_priority(priority), &gs->enhanced_sound_data, volume, pan, 0, is_voice_msg);
|
||||
|
||||
|
||||
if (handle.isValid()) {
|
||||
snd_set_pitch(handle, gs->pitch_range.next());
|
||||
}
|
||||
@@ -607,7 +605,9 @@ MONITOR( Num3DSoundsLoaded )
|
||||
// returns: -1 => sound could not be played
|
||||
// n => handle for instance of sound
|
||||
//
|
||||
sound_handle snd_play_3d(game_snd *gs, vec3d *source_pos, vec3d *listen_pos, float radius, vec3d *source_vel, int looping, float vol_scale, int priority, vec3d * /*sound_fvec*/, float range_factor, int force, bool /*is_ambient*/ )
|
||||
sound_handle snd_play_3d(game_snd* gs, vec3d* source_pos, vec3d* listen_pos, float radius, vec3d* source_vel,
|
||||
int looping, float vol_scale, int priority, vec3d* /*sound_fvec*/, float range_factor,
|
||||
int force, bool /*is_ambient*/)
|
||||
{
|
||||
vec3d vector_to_sound;
|
||||
sound *snd;
|
||||
@@ -651,7 +651,7 @@ sound_handle snd_play_3d(game_snd *gs, vec3d *source_pos, vec3d *listen_pos, flo
|
||||
|
||||
if (!ds_initialized)
|
||||
return sound_handle::invalid();
|
||||
|
||||
|
||||
// DirectSound3D will not cut off sounds, no matter how quite they become.. so manually
|
||||
// prevent sounds from playing past the max distance.
|
||||
//IMPORTANT THIS IS NOT WORKING RIGHT OMG WTF
|
||||
@@ -711,7 +711,7 @@ sound_handle snd_play_3d(game_snd *gs, vec3d *source_pos, vec3d *listen_pos, flo
|
||||
}
|
||||
|
||||
// update the given 3d sound with a new position
|
||||
void snd_update_3d_pos(sound_handle soundnum, game_snd *gs, vec3d *new_pos, float radius, float range_factor)
|
||||
void snd_update_3d_pos(sound_handle soundnum, game_snd* gs, vec3d* new_pos, float radius, float range_factor)
|
||||
{
|
||||
if (Cmdline_no_3d_sound) {
|
||||
float vol, pan;
|
||||
@@ -816,7 +816,8 @@ int snd_get_3d_vol_and_pan(game_snd *gs, vec3d *pos, float* vol, float *pan, flo
|
||||
* @param scriptingUpdateVolume if true the looping sound value is updated default is TRUE
|
||||
* @return -1 on error, else the handle for this playing sound
|
||||
*/
|
||||
sound_handle snd_play_looping( game_snd *gs, float pan, int /*start_loop*/, int /*stop_loop*/, float vol_scale, int scriptingUpdateVolume)
|
||||
sound_handle snd_play_looping(game_snd* gs, float pan, int /*start_loop*/, int /*stop_loop*/, float vol_scale,
|
||||
int scriptingUpdateVolume)
|
||||
{
|
||||
float volume;
|
||||
sound *snd;
|
||||
@@ -858,7 +859,7 @@ sound_handle snd_play_looping( game_snd *gs, float pan, int /*start_loop*/, int
|
||||
if (volume > MIN_SOUND_VOLUME) {
|
||||
handle = ds_play( snd->sid, entry->id_sig, DS_MUST_PLAY, &gs->enhanced_sound_data, volume, pan, 1);
|
||||
|
||||
if(handle.isValid()) {
|
||||
if (handle.isValid()) {
|
||||
if (scriptingUpdateVolume) {
|
||||
currentlyLoopingSoundInfos.push_back(LoopingSoundInfo(handle, default_volume, vol_scale));
|
||||
}
|
||||
@@ -875,12 +876,13 @@ sound_handle snd_play_looping( game_snd *gs, float pan, int /*start_loop*/, int
|
||||
*
|
||||
* @param sig handle to sound, what is returned from snd_play()
|
||||
*/
|
||||
void snd_stop( sound_handle sig )
|
||||
void snd_stop(sound_handle sig)
|
||||
{
|
||||
int channel;
|
||||
|
||||
if (!ds_initialized) return;
|
||||
if ( !sig.isValid() ) return;
|
||||
if (!sig.isValid())
|
||||
return;
|
||||
|
||||
channel = ds_get_channel(sig);
|
||||
if ( channel == -1 )
|
||||
@@ -920,7 +922,7 @@ void snd_stop_all()
|
||||
* @param sig handle to sound, what is returned from snd_play()
|
||||
* @param volume volume of sound (range: 0.0 -> 1.0)
|
||||
*/
|
||||
void snd_set_volume( sound_handle sig, float volume )
|
||||
void snd_set_volume(sound_handle sig, float volume)
|
||||
{
|
||||
int channel;
|
||||
float new_volume;
|
||||
@@ -928,7 +930,7 @@ void snd_set_volume( sound_handle sig, float volume )
|
||||
if (!ds_initialized)
|
||||
return;
|
||||
|
||||
if ( !sig.isValid() )
|
||||
if (!sig.isValid())
|
||||
return;
|
||||
|
||||
channel = ds_get_channel(sig);
|
||||
@@ -964,14 +966,14 @@ void snd_set_volume( sound_handle sig, float volume )
|
||||
// parameters: sig => handle to sound, what is returned from snd_play()
|
||||
// pan => pan of sound (range: -1.0 -> 1.0)
|
||||
//
|
||||
void snd_set_pan( sound_handle sig, float pan )
|
||||
void snd_set_pan(sound_handle sig, float pan)
|
||||
{
|
||||
int channel;
|
||||
|
||||
if (!ds_initialized)
|
||||
return;
|
||||
|
||||
if ( !sig.isValid() )
|
||||
if (!sig.isValid())
|
||||
return;
|
||||
|
||||
channel = ds_get_channel(sig);
|
||||
@@ -999,7 +1001,7 @@ float snd_get_pitch(sound_handle sig)
|
||||
if (!ds_initialized)
|
||||
return -1;
|
||||
|
||||
if ( !sig.isValid() )
|
||||
if (!sig.isValid())
|
||||
return -1;
|
||||
|
||||
channel = ds_get_channel(sig);
|
||||
@@ -1019,12 +1021,13 @@ float snd_get_pitch(sound_handle sig)
|
||||
// parameters: sig => handle to sound, what is returned from snd_play()
|
||||
// pan => pitch of sound (must be greater than zero)
|
||||
//
|
||||
void snd_set_pitch( sound_handle sig, float pitch )
|
||||
void snd_set_pitch(sound_handle sig, float pitch)
|
||||
{
|
||||
int channel;
|
||||
|
||||
if (!ds_initialized) return;
|
||||
if ( !sig.isValid() ) return;
|
||||
if (!sig.isValid())
|
||||
return;
|
||||
|
||||
channel = ds_get_channel(sig);
|
||||
if ( channel == -1 ) {
|
||||
@@ -1045,14 +1048,14 @@ void snd_set_pitch( sound_handle sig, float pitch )
|
||||
//
|
||||
// parameters: sig => signature of sound, what is returned from snd_play()
|
||||
//
|
||||
int snd_is_playing( sound_handle sig )
|
||||
int snd_is_playing(sound_handle sig)
|
||||
{
|
||||
int channel, is_playing;
|
||||
|
||||
if (!ds_initialized)
|
||||
return 0;
|
||||
|
||||
if ( !sig.isValid() )
|
||||
if (!sig.isValid())
|
||||
return 0;
|
||||
|
||||
channel = ds_get_channel(sig);
|
||||
@@ -1177,7 +1180,7 @@ void snd_ffwd(sound_handle snd_handle, float seconds)
|
||||
}
|
||||
|
||||
// this could probably be optimized a bit
|
||||
void snd_set_pos(sound_handle snd_handle, float val,int as_pct)
|
||||
void snd_set_pos(sound_handle snd_handle, float val, int as_pct)
|
||||
{
|
||||
sound_info *snd;
|
||||
|
||||
@@ -1271,7 +1274,7 @@ int snd_time_remaining(sound_handle handle)
|
||||
if (!ds_initialized)
|
||||
return 0;
|
||||
|
||||
if ( !handle.isValid() )
|
||||
if (!handle.isValid())
|
||||
return 0;
|
||||
|
||||
channel = ds_get_channel(handle);
|
||||
|
||||
+24
-15
@@ -130,49 +130,56 @@ void snd_unload_all();
|
||||
// Plays a sound with volume between 0 and 1.0, where 0 is the
|
||||
// inaudible and 1.0 is the loudest sound in the game.
|
||||
// Pan goes from -1.0 all the way left to 0.0 in center to 1.0 all the way right.
|
||||
sound_handle snd_play( game_snd *gs, float pan=0.0f, float vol_scale=1.0f, int priority = SND_PRIORITY_SINGLE_INSTANCE, bool voice_message = false );
|
||||
sound_handle snd_play(game_snd* gs, float pan = 0.0f, float vol_scale = 1.0f,
|
||||
int priority = SND_PRIORITY_SINGLE_INSTANCE, bool voice_message = false);
|
||||
|
||||
// Play a sound directly from index returned from snd_load(). Bypasses
|
||||
// the sound management process of using game_snd.
|
||||
sound_handle snd_play_raw(sound_load_id soundnum, float pan, float vol_scale = 1.0f, int priority = SND_PRIORITY_MUST_PLAY);
|
||||
sound_handle snd_play_raw(sound_load_id soundnum, float pan, float vol_scale = 1.0f,
|
||||
int priority = SND_PRIORITY_MUST_PLAY);
|
||||
|
||||
// Plays a sound with volume between 0 and 1.0, where 0 is the
|
||||
// inaudible and 1.0 is the loudest sound in the game. It scales
|
||||
// the pan and volume relative to the current viewer's location.
|
||||
sound_handle snd_play_3d(game_snd *gs, vec3d *source_pos, vec3d *listen_pos, float radius=0.0f, vec3d *vel = nullptr, int looping = 0, float vol_scale=1.0f, int priority = SND_PRIORITY_SINGLE_INSTANCE, vec3d *sound_fvec = nullptr, float range_factor = 1.0f, int force = 0, bool is_ambient = false );
|
||||
sound_handle snd_play_3d(game_snd* gs, vec3d* source_pos, vec3d* listen_pos, float radius = 0.0f, vec3d* vel = nullptr,
|
||||
int looping = 0, float vol_scale = 1.0f, int priority = SND_PRIORITY_SINGLE_INSTANCE,
|
||||
vec3d* sound_fvec = nullptr, float range_factor = 1.0f, int force = 0,
|
||||
bool is_ambient = false);
|
||||
|
||||
// update the given 3d sound with a new position
|
||||
void snd_update_3d_pos(sound_handle soudnnum, game_snd *gs, vec3d *new_pos, float radius = 0.0f, float range_factor = 1.0f);
|
||||
void snd_update_3d_pos(sound_handle soudnnum, game_snd* gs, vec3d* new_pos, float radius = 0.0f,
|
||||
float range_factor = 1.0f);
|
||||
|
||||
// Use these for looping sounds.
|
||||
// Returns the handle of the sound. -1 if failed.
|
||||
// If startloop or stoploop are not -1, then then are used.
|
||||
sound_handle snd_play_looping( game_snd *gs, float pan=0.0f, int start_loop=-1, int stop_loop=-1, float vol_scale=1.0f, int scriptingUpdateVolume = 1);
|
||||
sound_handle snd_play_looping(game_snd* gs, float pan = 0.0f, int start_loop = -1, int stop_loop = -1,
|
||||
float vol_scale = 1.0f, int scriptingUpdateVolume = 1);
|
||||
|
||||
void snd_stop( sound_handle snd_handle );
|
||||
void snd_stop(sound_handle snd_handle);
|
||||
|
||||
// Sets the volume of a sound that is already playing.
|
||||
// The volume is between 0 and 1.0, where 0 is the
|
||||
// inaudible and 1.0 is the loudest sound in the game.
|
||||
void snd_set_volume( sound_handle snd_handle, float volume );
|
||||
void snd_set_volume(sound_handle snd_handle, float volume);
|
||||
|
||||
// Sets the panning location of a sound that is already playing.
|
||||
// Pan goes from -1.0 all the way left to 0.0 in center to 1.0 all the way right.
|
||||
void snd_set_pan( sound_handle snd_handle, float pan );
|
||||
void snd_set_pan(sound_handle snd_handle, float pan);
|
||||
|
||||
// Sets the pitch (frequency) of a sound that is already playing
|
||||
// Valid values for pitch are between 100 and 100000
|
||||
void snd_set_pitch( sound_handle snd_handle, float pitch );
|
||||
float snd_get_pitch( sound_handle snd_handle );
|
||||
void snd_set_pitch(sound_handle snd_handle, float pitch);
|
||||
float snd_get_pitch(sound_handle snd_handle);
|
||||
|
||||
// Stops all sounds from playing, even looping ones.
|
||||
void snd_stop_all();
|
||||
|
||||
// determines if the sound handle is still palying
|
||||
int snd_is_playing( sound_handle snd_handle );
|
||||
int snd_is_playing(sound_handle snd_handle);
|
||||
|
||||
// change the looping status of a sound that is playing
|
||||
void snd_chg_loop_status(sound_handle snd_handle, int loop);
|
||||
void snd_chg_loop_status(sound_handle snd_handle, int loop);
|
||||
|
||||
// return the time in ms for the duration of the sound
|
||||
int snd_get_duration(sound_load_id snd_id);
|
||||
@@ -201,9 +208,11 @@ void snd_do_frame();
|
||||
void snd_adjust_audio_volume(int type, float percent, int time);
|
||||
|
||||
// repositioning of the sound buffer pointer
|
||||
void snd_rewind(sound_handle snd_handle, float seconds); // rewind N seconds from the current position
|
||||
void snd_ffwd(sound_handle snd_handle, float seconds); // fast forward N seconds from the current position
|
||||
void snd_set_pos(sound_handle snd_handle, float val,int as_pct); // set the position val as either a percentage (if as_pct) or as a # of seconds into the sound
|
||||
void snd_rewind(sound_handle snd_handle, float seconds); // rewind N seconds from the current position
|
||||
void snd_ffwd(sound_handle snd_handle, float seconds); // fast forward N seconds from the current position
|
||||
void snd_set_pos(
|
||||
sound_handle snd_handle, float val,
|
||||
int as_pct); // set the position val as either a percentage (if as_pct) or as a # of seconds into the sound
|
||||
|
||||
void snd_get_format(sound_load_id handle, int* bits_per_sample, int* frequency);
|
||||
int snd_time_remaining(sound_handle handle);
|
||||
|
||||
+10
-10
@@ -357,7 +357,7 @@ int beam_fire(beam_fire_info *fire_info)
|
||||
new_item->target = fire_info->target;
|
||||
new_item->target_subsys = fire_info->target_subsys;
|
||||
new_item->target_sig = (fire_info->target != NULL) ? fire_info->target->signature : 0;
|
||||
new_item->beam_sound_loop = sound_handle::invalid();
|
||||
new_item->beam_sound_loop = sound_handle::invalid();
|
||||
new_item->type = wip->b_info.beam_type;
|
||||
new_item->targeting_laser_offset = fire_info->targeting_laser_offset;
|
||||
new_item->framecount = 0;
|
||||
@@ -542,8 +542,8 @@ int beam_fire_targeting(fighter_beam_fire_info *fire_info)
|
||||
new_item->f_collision_count = 0;
|
||||
new_item->target = NULL;
|
||||
new_item->target_subsys = NULL;
|
||||
new_item->target_sig = 0;
|
||||
new_item->beam_sound_loop = sound_handle::invalid();
|
||||
new_item->target_sig = 0;
|
||||
new_item->beam_sound_loop = sound_handle::invalid();
|
||||
new_item->type = BEAM_TYPE_C;
|
||||
new_item->targeting_laser_offset = fire_info->targeting_laser_offset;
|
||||
new_item->framecount = 0;
|
||||
@@ -694,7 +694,7 @@ void beam_pause_sounds()
|
||||
}
|
||||
while(moveup != END_OF_LIST(&Beam_used_list)){
|
||||
// set the volume to 0, if he has a looping beam sound
|
||||
if(moveup->beam_sound_loop.isValid()){
|
||||
if (moveup->beam_sound_loop.isValid()) {
|
||||
snd_set_volume(moveup->beam_sound_loop, 0.0f);
|
||||
}
|
||||
|
||||
@@ -1797,7 +1797,7 @@ void beam_delete(beam *b)
|
||||
b->objnum = -1;
|
||||
|
||||
// kill the beam looping sound
|
||||
if(b->beam_sound_loop.isValid()){
|
||||
if (b->beam_sound_loop.isValid()) {
|
||||
snd_stop(b->beam_sound_loop);
|
||||
b->beam_sound_loop = sound_handle::invalid();
|
||||
}
|
||||
@@ -1912,8 +1912,8 @@ int beam_start_firing(beam *b)
|
||||
return 1;
|
||||
}
|
||||
|
||||
// start the beam firing sound now, if we haven't already
|
||||
if((!b->beam_sound_loop.isValid()) && (Weapon_info[b->weapon_info_index].b_info.beam_loop_sound.isValid())){
|
||||
// start the beam firing sound now, if we haven't already
|
||||
if ((!b->beam_sound_loop.isValid()) && (Weapon_info[b->weapon_info_index].b_info.beam_loop_sound.isValid())) {
|
||||
b->beam_sound_loop = snd_play_3d(gamesnd_get_game_sound(Weapon_info[b->weapon_info_index].b_info.beam_loop_sound), &b->last_start, &View_position, 0.0f, NULL, 1, 1.0, SND_PRIORITY_SINGLE_INSTANCE, NULL, 1.0f, 1);
|
||||
|
||||
// "shot" sound
|
||||
@@ -1941,8 +1941,8 @@ void beam_start_warmdown(beam *b)
|
||||
snd_play_3d(gamesnd_get_game_sound(Weapon_info[b->weapon_info_index].b_info.beam_warmdown_sound), &b->last_start, &View_position);
|
||||
}
|
||||
|
||||
// kill the beam looping sound
|
||||
if(b->beam_sound_loop.isValid()){
|
||||
// kill the beam looping sound
|
||||
if (b->beam_sound_loop.isValid()) {
|
||||
snd_stop(b->beam_sound_loop);
|
||||
b->beam_sound_loop = sound_handle::invalid();
|
||||
}
|
||||
@@ -1961,7 +1961,7 @@ void beam_recalc_sounds(beam *b)
|
||||
bwi = &Weapon_info[b->weapon_info_index].b_info;
|
||||
|
||||
// update the sound position relative to the player
|
||||
if(b->beam_sound_loop.isValid()){
|
||||
if (b->beam_sound_loop.isValid()) {
|
||||
// get the point closest to the player's viewing position
|
||||
switch(vm_vec_dist_to_line(&View_position, &b->last_start, &b->last_shot, &pos, NULL)){
|
||||
// behind the beam, so use the start pos
|
||||
|
||||
+1
-1
@@ -157,7 +157,7 @@ typedef struct beam {
|
||||
int f_collision_count; // # of collisions we recorded this frame
|
||||
|
||||
// looping sound info, HANDLE
|
||||
sound_handle beam_sound_loop; // invalid if none
|
||||
sound_handle beam_sound_loop; // invalid if none
|
||||
|
||||
// team
|
||||
char team;
|
||||
|
||||
@@ -146,7 +146,7 @@ typedef struct weapon {
|
||||
|
||||
mc_info* collisionInfo; // The last collision of this weapon or NULL if it had none
|
||||
|
||||
sound_handle hud_in_flight_snd_sig; // Signature of the sound played while the weapon is in flight
|
||||
sound_handle hud_in_flight_snd_sig; // Signature of the sound played while the weapon is in flight
|
||||
|
||||
WeaponState weapon_state; // The current state of the weapon
|
||||
} weapon;
|
||||
|
||||
@@ -4911,8 +4911,7 @@ void weapon_process_post(object * obj, float frame_time)
|
||||
|
||||
if (play_sound)
|
||||
{
|
||||
if (!wp->hud_in_flight_snd_sig.isValid() || !snd_is_playing(wp->hud_in_flight_snd_sig))
|
||||
{
|
||||
if (!wp->hud_in_flight_snd_sig.isValid() || !snd_is_playing(wp->hud_in_flight_snd_sig)) {
|
||||
wp->hud_in_flight_snd_sig = snd_play_looping(gamesnd_get_game_sound(wip->hud_in_flight_snd));
|
||||
}
|
||||
}
|
||||
@@ -7273,8 +7272,7 @@ void pause_in_flight_sounds()
|
||||
{
|
||||
weapon* wp = &Weapons[i];
|
||||
|
||||
if (wp->hud_in_flight_snd_sig.isValid() && snd_is_playing(wp->hud_in_flight_snd_sig))
|
||||
{
|
||||
if (wp->hud_in_flight_snd_sig.isValid() && snd_is_playing(wp->hud_in_flight_snd_sig)) {
|
||||
// Stop sound, it will be restarted in the first frame after the game is unpaused
|
||||
snd_stop(wp->hud_in_flight_snd_sig);
|
||||
}
|
||||
|
||||
+11
-11
@@ -5079,10 +5079,10 @@ void game_process_event( int current_state, int event )
|
||||
Viewer_mode = Player->saved_viewer_mode;
|
||||
hud_subspace_notify_abort();
|
||||
mprintf(( "Player put back to normal mode.\n" ));
|
||||
if ( Warpout_sound.isValid() ) {
|
||||
snd_stop( Warpout_sound );
|
||||
Warpout_sound = sound_handle::invalid();
|
||||
}
|
||||
if (Warpout_sound.isValid()) {
|
||||
snd_stop( Warpout_sound );
|
||||
Warpout_sound = sound_handle::invalid();
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -5118,9 +5118,9 @@ void game_process_event( int current_state, int event )
|
||||
mprintf(( "Player warped out. Going to debriefing!\n" ));
|
||||
Player->control_mode = PCM_NORMAL;
|
||||
Viewer_mode = Player->saved_viewer_mode;
|
||||
Warpout_sound = sound_handle::invalid();
|
||||
Warpout_sound = sound_handle::invalid();
|
||||
|
||||
send_debrief_event();
|
||||
send_debrief_event();
|
||||
break;
|
||||
|
||||
case GS_EVENT_STANDALONE_POSTGAME:
|
||||
@@ -7435,29 +7435,29 @@ void get_version_string(char *str, int max_size)
|
||||
//
|
||||
// ----------------------------------------------------------------
|
||||
|
||||
static sound_handle Subspace_ambient_left_channel = sound_handle::invalid();
|
||||
static sound_handle Subspace_ambient_left_channel = sound_handle::invalid();
|
||||
static sound_handle Subspace_ambient_right_channel = sound_handle::invalid();
|
||||
|
||||
//
|
||||
void game_start_subspace_ambient_sound()
|
||||
{
|
||||
if ( !Subspace_ambient_left_channel.isValid() ) {
|
||||
if (!Subspace_ambient_left_channel.isValid()) {
|
||||
Subspace_ambient_left_channel = snd_play_looping(gamesnd_get_game_sound(GameSounds::SUBSPACE_LEFT_CHANNEL), -1.0f);
|
||||
}
|
||||
|
||||
if ( !Subspace_ambient_right_channel.isValid() ) {
|
||||
if (!Subspace_ambient_right_channel.isValid()) {
|
||||
Subspace_ambient_right_channel = snd_play_looping(gamesnd_get_game_sound(GameSounds::SUBSPACE_RIGHT_CHANNEL), 1.0f);
|
||||
}
|
||||
}
|
||||
|
||||
void game_stop_subspace_ambient_sound()
|
||||
{
|
||||
if ( Subspace_ambient_left_channel.isValid() ) {
|
||||
if (Subspace_ambient_left_channel.isValid()) {
|
||||
snd_stop(Subspace_ambient_left_channel);
|
||||
Subspace_ambient_left_channel = sound_handle::invalid();
|
||||
}
|
||||
|
||||
if ( Subspace_ambient_right_channel.isValid() ) {
|
||||
if (Subspace_ambient_right_channel.isValid()) {
|
||||
snd_stop(Subspace_ambient_right_channel);
|
||||
Subspace_ambient_right_channel = sound_handle::invalid();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user