-
Notifications
You must be signed in to change notification settings - Fork 0
/
bnk_file.h
37 lines (30 loc) · 1.06 KB
/
bnk_file.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
#ifndef BNK_FILE_H_
#define BNK_FILE_H_
#include <stdint.h>
#include "fm_voice_bank.h"
struct bnk_file_operator {
uint8_t ksl, mul, fb, ar, sl, eg, dr, rr, tl, am, vib, ksr, con, wave_sel;
};
struct bnk_file_instrument {
uint8_t percussive, voice_num;
struct bnk_file_operator operators[2];
};
struct bnk_file_name {
uint16_t index;
uint8_t flags;
char name[9];
};
struct bnk_file {
uint8_t ver_major, ver_minor;
uint16_t num_used, num_instruments;
struct bnk_file_instrument *instruments;
struct bnk_file_name *names;
};
void bnk_file_init(struct bnk_file *f);
int bnk_file_load(struct bnk_file *f, uint8_t *data, size_t data_len);
int bnk_file_test(uint8_t *data, size_t data_len);
int bnk_file_save(struct bnk_file *f, int (*write_fn)(void *buf, size_t len, void *data_ptr), void *data_ptr);
void bnk_file_dump(struct bnk_file *f);
int bnk_file_append_to_fm_bank(struct bnk_file *f, struct fm_voice_bank *bank);
int bnk_file_load_from_fm_bank(struct fm_voice_bank *, int starting_voice_num, struct bnk_file *f, int *num_voices_written);
#endif /* BNK_FILE_H_ */