diff options
Diffstat (limited to 'src/ft_music.c')
-rw-r--r-- | src/ft_music.c | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/src/ft_music.c b/src/ft_music.c index 3050f44..2d97f99 100644 --- a/src/ft_music.c +++ b/src/ft_music.c @@ -12,17 +12,29 @@ #include <libft.h> #include <cub3d.h> +#include <stddef.h> #include <stdlib.h> void - ft_music(t_cub *cl) + *ft_music(void *vargp) { - /* char *cmd; */ - /* uint8_t len; */ + char *cmd; + uint8_t len; + t_cub *cl; - (void)cl; - /* if (FT_OS == 2) */ - /* ft_sprintf(cmd, "aplay -f cd -t wav %s", cl->mlist->music_path); */ - /* else {} */ - /* system(cmd); */ + cl = (t_cub *)vargp; + len = ft_strlen(cl->mlist->music_path); + if (FT_OS == 2) + len += 22; + else + len += 18; + if (!(cmd = (char *)malloc((len + 1) * sizeof(char)))) + return (NULL); + if (FT_OS == 2) + ft_sprintf(cmd, "aplay -f cd -t wav -q %s", cl->mlist->music_path); + else {} + ft_printf("%s\n", cmd); + system(cmd); + ft_memdel((void**)&cmd); + return (NULL); } |