added airjump sound. added the option to choose sound device

This commit is contained in:
Magnus Auvinen 2007-12-15 14:30:22 +00:00
parent e02afe76dd
commit c4915c5bd9
5 changed files with 25 additions and 4 deletions

View file

@ -86,6 +86,12 @@ sounds {
"data/audio/foley_land-04.wv" "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 { player_jump {
"data/audio/foley_foot_left-01.wv" "data/audio/foley_foot_left-01.wv"
"data/audio/foley_foot_left-02.wv" "data/audio/foley_foot_left-02.wv"

View file

@ -208,7 +208,6 @@ static void mix(short *final_out, unsigned frames)
} }
} }
/* release the lock */ /* release the lock */
lock_release(sound_lock); lock_release(sound_lock);
@ -249,9 +248,24 @@ int snd_init()
mixing_rate = config.snd_rate; mixing_rate = config.snd_rate;
{
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(); params.device = Pa_GetDefaultOutputDevice();
if(params.device < 0) if(params.device < 0)
return 1; return 1;
dbg_msg("snd", "device = %d", params.device);
params.channelCount = 2; params.channelCount = 2;
params.sampleFormat = paInt16; params.sampleFormat = paInt16;
params.suggestedLatency = Pa_GetDeviceInfo(params.device)->defaultLowOutputLatency; params.suggestedLatency = Pa_GetDeviceInfo(params.device)->defaultLowOutputLatency;

View file

@ -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_rate, 48000, 0, 0)
MACRO_CONFIG_INT(snd_enable, 1, 0, 1) MACRO_CONFIG_INT(snd_enable, 1, 0, 1)
MACRO_CONFIG_INT(snd_volume, 100, 0, 100) 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_width, 800, 0, 0)
MACRO_CONFIG_INT(gfx_screen_height, 600, 0, 0) MACRO_CONFIG_INT(gfx_screen_height, 600, 0, 0)

View file

@ -802,7 +802,7 @@ extern "C" void modc_predict()
if(events&COREEVENT_AIR_JUMP) if(events&COREEVENT_AIR_JUMP)
{ {
create_air_jump_effect(pos); 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_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); if(events&COREEVENT_HOOK_ATTACH_PLAYER) snd_play_random(CHN_WORLD, SOUND_HOOK_ATTACH_PLAYER, 1.0f, pos);

View file

@ -1093,7 +1093,7 @@ void player::tick_defered()
if(events&COREEVENT_GROUND_JUMP) create_sound(pos, SOUND_PLAYER_JUMP, mask); if(events&COREEVENT_GROUND_JUMP) create_sound(pos, SOUND_PLAYER_JUMP, mask);
if(events&COREEVENT_AIR_JUMP) 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); ev_common *c = (ev_common *)::events.create(EVENT_AIR_JUMP, sizeof(ev_common), mask);
if(c) if(c)
{ {