-
-
Notifications
You must be signed in to change notification settings - Fork 15
/
mdx_driver.h
68 lines (52 loc) · 1.64 KB
/
mdx_driver.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#ifndef MDX_DRIVER_H_
#define MDX_DRIVER_H_
#include <stdint.h>
#include "mdx.h"
#include "pdx.h"
#include "timer_driver.h"
#include "fm_driver.h"
#include "adpcm_driver.h"
struct mdx_driver_track {
uint8_t *data;
int len;
int pos;
int used;
// state
int ended, waiting, loop_num;
int ticks_remaining;
int volume, opm_volume; // cache computed OPM volume
uint8_t key_on_delay, key_on_delay_counter; // k
int staccato, staccato_counter; // q
int voice_num; // @
int note, pan, pitch;
int adpcm_freq_num;
int16_t detune;
int16_t portamento;
int skipNoteOff, skipNoteOn;
// MDX LFOs
int lfo_delay, lfo_delay_counter;
struct mdx_lfo pitch_lfo, amplitude_lfo;
// MH OPM LFO
uint8_t pms_ams, keysync, mhon;
};
struct mdx_driver {
struct mdx_file *mdx_file;
struct pdx_file *pdx_file;
struct timer_driver *timer_driver;
struct fm_driver *fm_driver;
struct adpcm_driver *adpcm_driver;
struct mdx_driver_track tracks[16];
int ended;
int fade_rate, fade_counter, fade_value;
int track_mask;
int cur_loop, max_loops;
void *data_ptr;
void (*set_tempo)(struct mdx_driver *, int track_num, void *data_ptr);
void (*unknown_command_cb)(struct mdx_driver *, int track_num, uint8_t cmd, void *data_ptr);
};
void mdx_driver_init(struct mdx_driver *driver, struct timer_driver *timer_driver, struct fm_driver *fm_driver, struct adpcm_driver *adpcm_driver);
void mdx_driver_deinit(struct mdx_driver *driver);
void mdx_driver_tick(struct mdx_driver *driver);
int mdx_driver_load(struct mdx_driver *driver, struct mdx_file *file, struct pdx_file *pfile);
int mdx_driver_start_fadeout(struct mdx_driver *driver, int fade_rate);
#endif /* MDX_DRIVER_H_ */