| 1 |
#ifndef YMGLUE_H |
| 2 |
#define YMGLUE_H |
| 3 |
|
| 4 |
#ifdef __cplusplus |
| 5 |
extern "C" { |
| 6 |
#endif |
| 7 |
#include <stdint.h> |
| 8 |
#include <stdbool.h> |
| 9 |
|
| 10 |
uint8_t YM_read_status(void); |
| 11 |
void YM_Create(int clock); |
| 12 |
void YM_init(int sample_rate, int frame_rate); |
| 13 |
void YM_stream_update(uint16_t* output, uint32_t numsamples); |
| 14 |
void YM_write_reg(uint8_t reg, uint8_t val); |
| 15 |
bool YM_irq(void); |
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
#define YM_NUM_CHANNELS 8 |
| 23 |
#define YM_NUM_OPERATORS (YM_NUM_CHANNELS * 4) |
| 24 |
#define YM_NUM_REGS 0x100 |
| 25 |
|
| 26 |
|
| 27 |
enum ym_eg_state { |
| 28 |
YM_EG_ATTACK = 1, |
| 29 |
YM_EG_DECAY = 2, |
| 30 |
YM_EG_SUSTAIN = 3, |
| 31 |
YM_EG_RELEASE = 4, |
| 32 |
}; |
| 33 |
|
| 34 |
struct ym_debug_operator { |
| 35 |
uint8_t eg_state; |
| 36 |
uint16_t eg_attenuation; |
| 37 |
}; |
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
uint8_t YM_debug_get_reg(uint8_t reg); |
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
uint8_t YM_debug_get_keyon(int ch); |
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
bool YM_debug_get_operator(int op, struct ym_debug_operator *out); |
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
uint8_t YM_debug_get_status(void); |
| 60 |
bool YM_debug_is_busy(void); |
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
#define YM_SCOPE_SAMPLES 2048 |
| 69 |
#define YM_SCOPE_MIX_L YM_NUM_CHANNELS |
| 70 |
#define YM_SCOPE_MIX_R (YM_NUM_CHANNELS + 1) |
| 71 |
#define YM_SCOPE_STREAMS (YM_NUM_CHANNELS + 2) |
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
unsigned YM_debug_scope_read(int ch, int16_t* dest, unsigned max_samples); |
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
unsigned YM_debug_scope_predict(int16_t (*dest)[YM_SCOPE_SAMPLES], unsigned num_samples); |
| 90 |
|
| 91 |
#ifdef __cplusplus |
| 92 |
} |
| 93 |
#endif |
| 94 |
|
| 95 |
#endif |