aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_music.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-03-02 00:56:03 +0100
committerJozanLeClerc <bousset.rudy@gmail.com>2020-03-02 00:56:03 +0100
commitd812df80d26f879d4d49ec45453866574e995839 (patch)
treed6c143d0356d72a4274dc125e354b4e51acf0f4b /src/ft_music.c
parentin progress (diff)
download42-cub3d-d812df80d26f879d4d49ec45453866574e995839.tar.gz
42-cub3d-d812df80d26f879d4d49ec45453866574e995839.tar.bz2
42-cub3d-d812df80d26f879d4d49ec45453866574e995839.tar.xz
42-cub3d-d812df80d26f879d4d49ec45453866574e995839.tar.zst
42-cub3d-d812df80d26f879d4d49ec45453866574e995839.zip
trying to thread
Diffstat (limited to '')
-rw-r--r--src/ft_music.c28
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);
}