diff options
Diffstat (limited to '')
-rw-r--r-- | src/ft_music.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/src/ft_music.c b/src/ft_music.c index a3e2120..0667ecb 100644 --- a/src/ft_music.c +++ b/src/ft_music.c @@ -10,20 +10,25 @@ /* */ /* ************************************************************************** */ -#include <libft.h> -#include <stddef.h> -#include <stdlib.h> +#include <cub3d.h> #include <unistd.h> void ft_music_fork(char **mcmd_words, char *const envp[]) { - /* execve(2) here */ - char *arg[3]; + if (FT_OS == 1) + execve("/usr/bin/afplay", mcmd_words, envp); + else + execve("/usr/bin/aplay", mcmd_words, envp); +} - arg[0] = "/usr/bin/aplay"; - arg[1] = "./media/sound/DEVANT-LES-KAISSONS.wav"; - arg[2] = NULL; - (void)mcmd_words; - execve("/usr/bin/aplay", &arg[0], envp); +void + ft_enable_music(t_cub *cl) +{ + cl->isoldmus = 1; + cl->mpid = fork(); + if (cl->mpid == 0) + { + ft_music_fork(cl->mlist.mcmd_words, cl->envp); + } } |