From c4915c5bd99fb82c338d0ba4a3cbe136e5c305d1 Mon Sep 17 00:00:00 2001 From: Magnus Auvinen Date: Sat, 15 Dec 2007 14:30:22 +0000 Subject: [PATCH] added airjump sound. added the option to choose sound device --- datasrc/teewars.ds | 6 ++++++ src/engine/client/ec_snd.c | 18 ++++++++++++++++-- src/engine/e_config_variables.h | 1 + src/game/client/gc_client.cpp | 2 +- src/game/server/gs_server.cpp | 2 +- 5 files changed, 25 insertions(+), 4 deletions(-) diff --git a/datasrc/teewars.ds b/datasrc/teewars.ds index 65a426c40..45f1bef11 100644 --- a/datasrc/teewars.ds +++ b/datasrc/teewars.ds @@ -86,6 +86,12 @@ sounds { "data/audio/foley_land-04.wv" } + player_airjump { + "data/audio/foley_dbljump-01.wv" + "data/audio/foley_dbljump-02.wv" + "data/audio/foley_dbljump-03.wv" + } + player_jump { "data/audio/foley_foot_left-01.wv" "data/audio/foley_foot_left-02.wv" diff --git a/src/engine/client/ec_snd.c b/src/engine/client/ec_snd.c index 89e18cb83..152eac53e 100644 --- a/src/engine/client/ec_snd.c +++ b/src/engine/client/ec_snd.c @@ -208,7 +208,6 @@ static void mix(short *final_out, unsigned frames) } } - /* release the lock */ lock_release(sound_lock); @@ -249,9 +248,24 @@ int snd_init() mixing_rate = config.snd_rate; - params.device = Pa_GetDefaultOutputDevice(); + { + int num = Pa_GetDeviceCount(); + int i; + const PaDeviceInfo *info; + + for(i = 0; i < num; i++) + { + info = Pa_GetDeviceInfo(i); + dbg_msg("snd", "device #%d name='%s'", i, info->name); + } + } + + params.device = config.snd_device; + if(params.device == -1) + params.device = Pa_GetDefaultOutputDevice(); if(params.device < 0) return 1; + dbg_msg("snd", "device = %d", params.device); params.channelCount = 2; params.sampleFormat = paInt16; params.suggestedLatency = Pa_GetDeviceInfo(params.device)->defaultLowOutputLatency; diff --git a/src/engine/e_config_variables.h b/src/engine/e_config_variables.h index 51ee73762..1aa6b7991 100644 --- a/src/engine/e_config_variables.h +++ b/src/engine/e_config_variables.h @@ -22,6 +22,7 @@ MACRO_CONFIG_INT(b_max_requests, 10, 0, 1000) MACRO_CONFIG_INT(snd_rate, 48000, 0, 0) MACRO_CONFIG_INT(snd_enable, 1, 0, 1) MACRO_CONFIG_INT(snd_volume, 100, 0, 100) +MACRO_CONFIG_INT(snd_device, -1, 0, 0) MACRO_CONFIG_INT(gfx_screen_width, 800, 0, 0) MACRO_CONFIG_INT(gfx_screen_height, 600, 0, 0) diff --git a/src/game/client/gc_client.cpp b/src/game/client/gc_client.cpp index 950da6820..95f322a15 100644 --- a/src/game/client/gc_client.cpp +++ b/src/game/client/gc_client.cpp @@ -802,7 +802,7 @@ extern "C" void modc_predict() if(events&COREEVENT_AIR_JUMP) { create_air_jump_effect(pos); - snd_play_random(CHN_WORLD, SOUND_PLAYER_JUMP, 1.0f, pos); + snd_play_random(CHN_WORLD, SOUND_PLAYER_AIRJUMP, 1.0f, pos); } //if(events&COREEVENT_HOOK_LAUNCH) snd_play_random(CHN_WORLD, SOUND_HOOK_LOOP, 1.0f, pos); if(events&COREEVENT_HOOK_ATTACH_PLAYER) snd_play_random(CHN_WORLD, SOUND_HOOK_ATTACH_PLAYER, 1.0f, pos); diff --git a/src/game/server/gs_server.cpp b/src/game/server/gs_server.cpp index f7c2f0054..47f5d0e54 100644 --- a/src/game/server/gs_server.cpp +++ b/src/game/server/gs_server.cpp @@ -1093,7 +1093,7 @@ void player::tick_defered() if(events&COREEVENT_GROUND_JUMP) create_sound(pos, SOUND_PLAYER_JUMP, mask); if(events&COREEVENT_AIR_JUMP) { - create_sound(pos, SOUND_PLAYER_JUMP, mask); + create_sound(pos, SOUND_PLAYER_AIRJUMP, mask); ev_common *c = (ev_common *)::events.create(EVENT_AIR_JUMP, sizeof(ev_common), mask); if(c) {