blob: 726099523cc7ae4b87a7e18f0cdc8bf283fcae9b (
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
60
|
#ifndef LIBOPNA_OPNADRUM_H_INCLUDED
#define LIBOPNA_OPNADRUM_H_INCLUDED
#include <stdint.h>
#include <stdbool.h>
#include "leveldata/leveldata.h"
#ifdef __cplusplus
extern "C" {
#endif
#define OPNA_ROM_BD_START 0x0000
#define OPNA_ROM_SD_START 0x01c0
#define OPNA_ROM_TOP_START 0x0440
#define OPNA_ROM_HH_START 0x1b80
#define OPNA_ROM_TOM_START 0x1d00
#define OPNA_ROM_RIM_START 0x1f80
#define OPNA_ROM_SIZE 0x2000
#define OPNA_ROM_BD_SIZE ((OPNA_ROM_SD_START-OPNA_ROM_BD_START)*2*3)
#define OPNA_ROM_SD_SIZE ((OPNA_ROM_TOP_START-OPNA_ROM_SD_START)*2*3)
#define OPNA_ROM_TOP_SIZE ((OPNA_ROM_HH_START-OPNA_ROM_TOP_START)*2*3)
#define OPNA_ROM_HH_SIZE ((OPNA_ROM_TOM_START-OPNA_ROM_HH_START)*2*3)
#define OPNA_ROM_TOM_SIZE ((OPNA_ROM_RIM_START-OPNA_ROM_TOM_START)*2*6)
#define OPNA_ROM_RIM_SIZE ((OPNA_ROM_SIZE-OPNA_ROM_RIM_START)*2*6)
struct opna_drum {
struct {
int16_t *data;
bool playing;
unsigned index;
unsigned len;
unsigned level;
bool left;
bool right;
struct leveldata leveldata;
} drums[6];
unsigned total_level;
int16_t rom_bd[OPNA_ROM_BD_SIZE];
int16_t rom_sd[OPNA_ROM_SD_SIZE];
int16_t rom_top[OPNA_ROM_TOP_SIZE];
int16_t rom_hh[OPNA_ROM_HH_SIZE];
int16_t rom_tom[OPNA_ROM_TOM_SIZE];
int16_t rom_rim[OPNA_ROM_RIM_SIZE];
unsigned mask;
};
void opna_drum_reset(struct opna_drum *drum);
// set rom data, size: 0x2000 (8192) bytes
void opna_drum_set_rom(struct opna_drum *drum, void *rom);
void opna_drum_mix(struct opna_drum *drum, int16_t *buf, int samples);
void opna_drum_writereg(struct opna_drum *drum, unsigned reg, unsigned val);
#ifdef __cplusplus
}
#endif
#endif // LIBOPNA_OPNADRUM_H_INCLUDED
|