summaryrefslogtreecommitdiff
path: root/library.h
blob: cbb8df6453d91b0830e86e8433ab8cb44019df70 (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
#ifndef library_h
#define library_h

#include "memory.h"

typedef struct {
	int track;
	char path[256];
	char name[64];
	char artist[64];
	char album[64];
} Song;

typedef struct {
	Song* songs;
	int* indices;
	int* filtered;
	int cap, cnt, fcnt;
} Library;

typedef struct {
	Song* song;
	void* f;
	int
		seek,
		samples,
		channels,
		play,
		has_art
	;
	unsigned long long cs, ms;
	unsigned cover[album_cover_w * album_cover_h];
} Player;

Song* find_song(Library* l, const char* path);
void build_library(
	Arena* a,
	Library* lib,
	const char* path
);
void filter_library(
	Library* l,
	const char* str
);

int get_song_meta(const char* path, Song* s);
int play_song(Player* p, Song* song);
void play_seek(Player* p, float v);
void init_player(Player* p);
void deinit_player(Player* p);

#endif