| 1 |
#ifndef __SUPERVISION_SOUND_H__ |
| 2 |
#define __SUPERVISION_SOUND_H__ |
| 3 |
|
| 4 |
#ifdef __cplusplus |
| 5 |
extern "C" |
| 6 |
{ |
| 7 |
#endif |
| 8 |
|
| 9 |
#include <stdint.h> |
| 10 |
|
| 11 |
typedef uint8_t uint8; |
| 12 |
typedef uint16_t uint16; |
| 13 |
typedef uint32_t uint32; |
| 14 |
typedef float real; |
| 15 |
typedef uint8_t BOOL; |
| 16 |
|
| 17 |
|
| 18 |
typedef struct { |
| 19 |
uint8 reg[4]; |
| 20 |
int on; |
| 21 |
uint8 waveform, volume; |
| 22 |
uint16 pos, size; |
| 23 |
uint16 count; |
| 24 |
} SVISION_CHANNEL; |
| 25 |
|
| 26 |
typedef struct { |
| 27 |
uint8 reg[3]; |
| 28 |
int on, right, left, play; |
| 29 |
uint8 type; // 6 - 7-Bit, 14 - 15-Bit |
| 30 |
uint16 state; |
| 31 |
uint8 value, volume; |
| 32 |
uint16 count; |
| 33 |
real pos, step; |
| 34 |
} SVISION_NOISE; |
| 35 |
|
| 36 |
typedef struct { |
| 37 |
uint8 reg[5]; |
| 38 |
int on, right, left; |
| 39 |
uint32 ca14to16; |
| 40 |
uint16 start; |
| 41 |
uint16 size; |
| 42 |
real pos, step; |
| 43 |
} SVISION_DMA; |
| 44 |
|
| 45 |
struct svision_t { |
| 46 |
SVISION_CHANNEL m_channel[2]; |
| 47 |
// For clear sound (no grating), sync with m_channel |
| 48 |
SVISION_CHANNEL ch[2]; |
| 49 |
SVISION_NOISE m_noise; |
| 50 |
SVISION_DMA m_dma; |
| 51 |
uint8 supervision_dma_mem[65536]; |
| 52 |
uint32 decrement_tick; |
| 53 |
uint32 UNSCALED_CLOCK; |
| 54 |
uint8 ch_mask, flags; |
| 55 |
}; |
| 56 |
|
| 57 |
void supervision_sound_reset(struct svision_t *svision); |
| 58 |
void supervision_sound_set_clock(struct svision_t *svision, uint32 clock); |
| 59 |
void supervision_sound_stream_update(struct svision_t *svision, uint8 *stream, uint32 len); |
| 60 |
void supervision_sound_decrement(struct svision_t *svision); |
| 61 |
void supervision_sound_wave_write(struct svision_t *svision, int which, int offset, uint8 data); |
| 62 |
void supervision_sound_dma_write(struct svision_t *svision,int offset, uint8 data); |
| 63 |
void supervision_sound_noise_write(struct svision_t *svision, int offset, uint8 data); |
| 64 |
void supervision_sound_noise_write(struct svision_t *svision, int offset, uint8 data); |
| 65 |
void supervision_memorymap_registers_write(struct svision_t *svision, uint32 Addr, uint8 Value); |
| 66 |
// 12SN |
| 67 |
void supervision_set_mute_mask(struct svision_t *svision, uint8 mask); |
| 68 |
void supervision_sound_set_flags(struct svision_t *svision, uint8 flags_set); |
| 69 |
|
| 70 |
|
| 71 |
#ifdef __cplusplus |
| 72 |
} // extern "C" |
| 73 |
#endif |
| 74 |
|
| 75 |
#endif |
| 76 |
|