aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_get_music.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ft_get_music.c')
-rw-r--r--src/ft_get_music.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/ft_get_music.c b/src/ft_get_music.c
index 86ec7d6..21c6331 100644
--- a/src/ft_get_music.c
+++ b/src/ft_get_music.c
@@ -12,8 +12,30 @@
#include <libft.h>
#include <cub3d.h>
+#include <stdlib.h>
#include <stdint.h>
+static void
+ ft_set_music_cmd(t_map *mlist)
+{
+ uint8_t len;
+
+ len = ft_strlen(mlist->music_path);
+ if (FT_OS == 2)
+ len += 22;
+ else
+ len += 18;
+ ft_memdel((void**)&mlist->music_cmd);
+ if (!(mlist->music_cmd = (char *)malloc((len + 1) * sizeof(char))))
+ return ;
+ if (FT_OS == 2)
+ {
+ ft_sprintf(mlist->music_cmd,
+ "aplay -f cd -t wav -q %s", mlist->music_path);
+ }
+ else {}
+}
+
int8_t
ft_get_music(char **words, t_cub *clist)
{
@@ -39,5 +61,6 @@ int8_t
return (-1);
}
clist->mlist->ismusic = 1;
+ ft_set_music_cmd(clist->mlist);
return (0);
}