aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_music.c
blob: cc8d1ca31e863ad6e440f378421455ab5fd0b8ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   ft_music.c                                         :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: rbousset <marvin@42.fr>                    +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   Created: 2020/02/24 17:17:54 by rbousset          #+#    #+#             */
/*   Updated: 2020/02/24 17:17:56 by rbousset         ###   ########lyon.fr   */
/*                                                                            */
/* ************************************************************************** */

#include <libft.h>
#include <cub3d.h>
#include <stddef.h>
#include <stdlib.h>
#include <pthread.h>

void
	*ft_music_thread(void *vargp)
{
	char	*cmd;
	uint8_t	len;
	t_cub	*cl;

	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("\n\n========= QWEQWE =========\n%s\n", cmd);
	system(cmd);
	ft_memdel((void**)&cmd);
	pthread_exit(NULL);
	return (NULL);
}

/* void */
/* 	*ft_hooks_thread(void *vargp) */
/* { */
/* } */