From 5a2b45a9c6d8235f5027a22132920fc28f2602c8 Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Sun, 15 Mar 2020 16:06:39 +0100 Subject: Edited sounds, bug fix --- media/sound/sfx/death_screen.wav | Bin 1459980 -> 1255372 bytes media/sound/sfx/footstep_one.wav | Bin 44892 -> 24298 bytes media/sound/sfx/footstep_two.wav | Bin 42954 -> 25562 bytes media/sound/sfx/next_lvl.wav | Bin 792004 -> 547516 bytes media/sound/sfx/scream_one.wav | Bin 26392 -> 24112 bytes media/sound/sfx/scream_two.wav | Bin 34140 -> 28996 bytes media/sound/sfx/trap.wav | Bin 108532 -> 60508 bytes src/ft_sfx_pain.c | 19 ++++++++++--------- 8 files changed, 10 insertions(+), 9 deletions(-) diff --git a/media/sound/sfx/death_screen.wav b/media/sound/sfx/death_screen.wav index 61cf33d..5ee6f4d 100644 Binary files a/media/sound/sfx/death_screen.wav and b/media/sound/sfx/death_screen.wav differ diff --git a/media/sound/sfx/footstep_one.wav b/media/sound/sfx/footstep_one.wav index f8f4577..898363e 100644 Binary files a/media/sound/sfx/footstep_one.wav and b/media/sound/sfx/footstep_one.wav differ diff --git a/media/sound/sfx/footstep_two.wav b/media/sound/sfx/footstep_two.wav index 4186e35..01781e1 100644 Binary files a/media/sound/sfx/footstep_two.wav and b/media/sound/sfx/footstep_two.wav differ diff --git a/media/sound/sfx/next_lvl.wav b/media/sound/sfx/next_lvl.wav index 64cbc31..2b73389 100644 Binary files a/media/sound/sfx/next_lvl.wav and b/media/sound/sfx/next_lvl.wav differ diff --git a/media/sound/sfx/scream_one.wav b/media/sound/sfx/scream_one.wav index df9fc78..0bdab05 100644 Binary files a/media/sound/sfx/scream_one.wav and b/media/sound/sfx/scream_one.wav differ diff --git a/media/sound/sfx/scream_two.wav b/media/sound/sfx/scream_two.wav index 1d4ff78..3ccb161 100644 Binary files a/media/sound/sfx/scream_two.wav and b/media/sound/sfx/scream_two.wav differ diff --git a/media/sound/sfx/trap.wav b/media/sound/sfx/trap.wav index 7d237e5..ae41e07 100644 Binary files a/media/sound/sfx/trap.wav and b/media/sound/sfx/trap.wav differ diff --git a/src/ft_sfx_pain.c b/src/ft_sfx_pain.c index 28bc95d..cb68108 100644 --- a/src/ft_sfx_pain.c +++ b/src/ft_sfx_pain.c @@ -28,15 +28,12 @@ void pthread_mutex_lock(&sfx->pain_mutex); while (1) { + pthread_mutex_lock(&sfx->pain_mutex); ref = (ref > 201) ? (0) : (ref + 1); - if (ref % 2) - { - pthread_mutex_lock(&sfx->pain_mutex); - if (ref % 3) - system(sfx->pain_one); - else - system(sfx->pain_two); - } + if (ref % 3) + system(sfx->pain_one); + else + system(sfx->pain_two); } return (NULL); } @@ -44,5 +41,9 @@ void void ft_sfx_pain(t_cub *cl) { - pthread_mutex_unlock(&cl->sfx.pain_mutex); + static uint8_t ref = 0; + + ref = (ref > 201) ? (0) : (ref + 1); + if (ref % 2) + pthread_mutex_unlock(&cl->sfx.pain_mutex); } -- cgit v1.2.3