diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-03-06 21:47:09 +0100 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-03-06 21:47:09 +0100 |
commit | 3048aae5d3f50359f19e0d440376ae422a16a7b7 (patch) | |
tree | 056ef0bcf64a304759e2fe29bf3a0ccdacd3786f /src/ft_music.c | |
parent | boy (diff) | |
download | 42-cub3d-3048aae5d3f50359f19e0d440376ae422a16a7b7.tar.gz 42-cub3d-3048aae5d3f50359f19e0d440376ae422a16a7b7.tar.bz2 42-cub3d-3048aae5d3f50359f19e0d440376ae422a16a7b7.tar.xz 42-cub3d-3048aae5d3f50359f19e0d440376ae422a16a7b7.tar.zst 42-cub3d-3048aae5d3f50359f19e0d440376ae422a16a7b7.zip |
Good enough
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); + } } |