1 #ifndef _HES_H_ 2 #define _HES_H_ 3 4 /* PSG structure */ 5 typedef struct { 6 uint32 counter; 7 uint16 frequency; /* Channel frequency */ 8 uint8 control; /* Channel enable, DDA, volume */ 9 uint8 balance; /* Channel balance */ 10 uint8 waveform[32]; /* Waveform data */ 11 uint8 waveform_index; /* Waveform data index */ 12 uint8 dda; /* Recent data written to waveform buffer */ 13 uint8 noisectrl; /* Noise enable/ctrl (channels 4,5 only) */ 14 uint32 noisecount; 15 uint32 lfsr; 16 int32 dda_cache[2]; 17 } psg_channel; 18 19 typedef struct { 20 uint8 select; /* Selected channel (0-5) */ 21 uint8 globalbalance; /* Global sound balance */ 22 uint8 lfofreq; /* LFO frequency */ 23 uint8 lfoctrl; /* LFO control */ 24 psg_channel channel[8]; // Really just 6... 25 26 // 1789772.727272 / 60 ~= 29829 27 int32 WaveHi[2][32768] __attribute__ ((aligned (16))); 28 int16 WaveHi16[2][32768] __attribute__ ((aligned (16))); 29 float *WaveFinal[2]; 30 float *WaveIL; 31 uint32 WaveFinalLen; 32 uint32 lastts; 33 34 int32 inbuf; 35 uint32 lastpoo; 36 37 void *ff[2]; 38 int disabled; /* User-disabled channels. */ 39 }t_psg; 40 41 typedef struct 42 { 43 uint8 IBP[0x2000]; /* Itty-bitty player thing. */ 44 45 uint8 ram[0x8000]; /* Work RAM */ 46 uint8 rom[0x100000]; /* HuCard ROM */ 47 48 49 uint8 dummy_read[0x2000]; /* For unmapped reads */ 50 uint8 dummy_write[0x2000]; /* For unmapped writes */ 51 uint8 *read_ptr[8]; /* Read pointers in logical address space */ 52 uint8 *write_ptr[8]; /* Write pointers in logical address space */ 53 54 uint8 mpr_start[8]; 55 56 /* I/O port data */ 57 struct { 58 uint8 sel; /* Status of SEL line */ 59 uint8 clr; /* Status of CLR line */ 60 }ctrl; 61 62 struct { 63 uint8 *read; /* Read pointers in physical address space */ 64 uint8 *write; /* Write pointers in physical address space */ 65 } bank_map[0x100]; 66 67 68 /* VDC */ 69 uint16 reg[0x20]; /* VDC registers */ 70 uint8 latch; /* VDC register latch */ 71 uint8 status; /* Status flag */ 72 73 t_psg psg; 74 75 void *h6280; 76 } FESTALON_HES; 77 78 79 float *FESTAHES_Emulate(FESTALON_HES *, int *Count); 80 void FESTAHES_SongControl(FESTALON_HES *, int which); 81 void FESTAHES_Close(FESTALON_HES *); 82 FESTALON_HES *FESTAHES_Load(FESTALON *, uint8 *buf, uint32 size); 83 void FESTAHES_FreeFileInfo(FESTALON_HES *); 84 FESTALON_HES *FESTAHES_GetFileInfo(FESTALON *, uint8 *buf, uint32 size, int type); 85 void FESTAHES_Disable(FESTALON_HES *, int t); 86 void FESTAHES_SetVolume(FESTALON_HES *, uint32 volume); 87 int FESTAHES_SetSound(FESTALON_HES *, uint32 rate, int quality); 88 int FESTAHES_SetLowpass(FESTALON_HES *, int on, uint32 corner, uint32 order); 89 #endif 90