summaryrefslogtreecommitdiffstats
path: root/include/xas/bank.h
blob: be623f0b00949aa37bbec1f853595368619a6a43 (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
48
49
50
51
52
53
54
55
56
57
58
59
#ifndef _XAS_BANK_H
#define _XAS_BANK_H

#include <sys/types.h>

#include <xas/audio.h>

enum xas_bank_player_status {
   XAS_BANK_PLAYER_STOPPED,
   XAS_BANK_PLAYER_PLAYING,
};

typedef struct _xas_bank_entry {
    size_t duration;
} xas_bank_entry;

typedef struct _xas_bank {
    xas_audio_format format;

    size_t entry_size,
           entry_count;
} xas_bank;

typedef struct _xas_bank_player {
    xas_bank *bank;
    enum xas_bank_player_status status;

    float gain;

    size_t entry,
           index;
} xas_bank_player;

xas_bank *xas_bank_new(xas_audio_format format,
                           size_t entry_size,
                           size_t entry_count);

void xas_bank_destroy(xas_bank *bank);

ssize_t xas_bank_record(xas_bank *bank,
                          xas_audio_stream *input,
                          size_t entry_index,
                          size_t count);

xas_bank_player *xas_bank_player_new(xas_bank *bank);

void xas_bank_player_destroy(xas_bank_player *player);

int xas_bank_player_start(xas_bank_player *player,
                            size_t entry,
                            float gain);

int xas_bank_player_stop(xas_bank_player *player);

int xas_bank_player_playing(xas_bank_player *player);

xas_audio_stream *xas_bank_player_stream_new(xas_bank_player *player);

#endif /* _XAS_BANK_H */