-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplayer.h
47 lines (39 loc) · 842 Bytes
/
player.h
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
#ifndef SONG_PLAYER_H_
#define SONG_PLAYER_H_
#include <stdbool.h>
#include "music_theory.h"
typedef struct {
float time;
/* 0 means pause. */
int note;
int octave;
float volume;
} SongUnit;
typedef struct {
SongUnit *units;
int size;
int capacity;
/* Please don't change the array when you begin to use this. And set it to 0
* after. */
int iterator;
} SongUnitArray;
#define SONG_ARRAY_SIZE (4096 / sizeof(SongUnitArray))
typedef struct {
float tune;
Note key;
float align;
Scale scale;
SongUnitArray sinNotes;
SongUnitArray pulseNotes;
char *songName;
} Player;
/*
* Returns and sets errno in failure, 0 otherwise.
*/
int initPlayer(Player *player, const char *file);
void deletePlayer(Player *player);
/*
* Returns false when done.
*/
bool update(Player *player);
#endif // SONG_PLAYER_H_