summaryrefslogtreecommitdiffstats
path: root/player.h
blob: 9e4bb07c1904e32f8d5116f5358035e9a91e5eef (plain) (blame)
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
48
49
50
51
52
53
54
#pragma once

#include "util.h"

#include "sndfile.h"

#include <signal.h>

enum {
	PLAYER_NONE,
	PLAYER_PAUSE,
	PLAYER_PLAY,
	PLAYER_SKIP,
	PLAYER_PREV,
	PLAYER_STOP,
	PLAYER_LOAD,
	PLAYER_EXIT
};

enum {
	PLAYER_NOTSET,
	PLAYER_OK,
	PLAYER_FAIL
};

struct player {
	int action, resp;

	int reload;
	char *filepath;
	SNDFILE *file;
	SF_INFO info;

	int sample_index;

	int alive;
	pid_t pid;
};

struct player *player_thread(void);

void player_main(void);

int player_alive(void);

void player_loadfile(const char *path);
void player_action(int action);

int player_pause(void);
int player_play(void);
int player_prev(void);
int player_skip(void);

extern struct player *player;