diff options
Diffstat (limited to 'apps/codecs/libgme/ymdeltat.h')
-rw-r--r-- | apps/codecs/libgme/ymdeltat.h | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/apps/codecs/libgme/ymdeltat.h b/apps/codecs/libgme/ymdeltat.h new file mode 100644 index 0000000000..01af4998a0 --- /dev/null +++ b/apps/codecs/libgme/ymdeltat.h | |||
@@ -0,0 +1,100 @@ | |||
1 | #pragma once | ||
2 | |||
3 | #ifndef __YMDELTAT_H__ | ||
4 | #define __YMDELTAT_H__ | ||
5 | |||
6 | #include "blargg_common.h" | ||
7 | |||
8 | /* compiler dependence */ | ||
9 | #ifndef __OSDCOMM_H__ | ||
10 | #define __OSDCOMM_H__ | ||
11 | typedef unsigned char UINT8; /* unsigned 8bit */ | ||
12 | typedef unsigned short UINT16; /* unsigned 16bit */ | ||
13 | typedef unsigned int UINT32; /* unsigned 32bit */ | ||
14 | typedef signed char INT8; /* signed 8bit */ | ||
15 | typedef signed short INT16; /* signed 16bit */ | ||
16 | typedef signed int INT32; /* signed 32bit */ | ||
17 | |||
18 | typedef INT32 stream_sample_t; | ||
19 | |||
20 | #endif /* __OSDCOMM_H__ */ | ||
21 | |||
22 | #define YM_DELTAT_SHIFT (16) | ||
23 | |||
24 | #define YM_DELTAT_EMULATION_MODE_NORMAL 0 | ||
25 | #define YM_DELTAT_EMULATION_MODE_YM2610 1 | ||
26 | |||
27 | |||
28 | typedef void (*STATUS_CHANGE_HANDLER)(void *chip, UINT8 status_bits); | ||
29 | |||
30 | |||
31 | /* DELTA-T (adpcm type B) struct */ | ||
32 | typedef struct deltat_adpcm_state { /* AT: rearranged and tigntened structure */ | ||
33 | UINT8 *memory; | ||
34 | INT32 *output_pointer;/* pointer of output pointers */ | ||
35 | INT32 *pan; /* pan : &output_pointer[pan] */ | ||
36 | double freqbase; | ||
37 | #if 0 | ||
38 | double write_time; /* Y8950: 10 cycles of main clock; YM2608: 20 cycles of main clock */ | ||
39 | double read_time; /* Y8950: 8 cycles of main clock; YM2608: 18 cycles of main clock */ | ||
40 | #endif | ||
41 | UINT32 memory_size; | ||
42 | int output_range; | ||
43 | UINT32 now_addr; /* current address */ | ||
44 | UINT32 now_step; /* currect step */ | ||
45 | UINT32 step; /* step */ | ||
46 | UINT32 start; /* start address */ | ||
47 | UINT32 limit; /* limit address */ | ||
48 | UINT32 end; /* end address */ | ||
49 | UINT32 delta; /* delta scale */ | ||
50 | INT32 volume; /* current volume */ | ||
51 | INT32 acc; /* shift Measurement value*/ | ||
52 | INT32 adpcmd; /* next Forecast */ | ||
53 | INT32 adpcml; /* current value */ | ||
54 | INT32 prev_acc; /* leveling value */ | ||
55 | UINT8 now_data; /* current rom data */ | ||
56 | UINT8 CPU_data; /* current data from reg 08 */ | ||
57 | UINT8 portstate; /* port status */ | ||
58 | UINT8 control2; /* control reg: SAMPLE, DA/AD, RAM TYPE (x8bit / x1bit), ROM/RAM */ | ||
59 | UINT8 portshift; /* address bits shift-left: | ||
60 | ** 8 for YM2610, | ||
61 | ** 5 for Y8950 and YM2608 */ | ||
62 | |||
63 | UINT8 DRAMportshift; /* address bits shift-right: | ||
64 | ** 0 for ROM and x8bit DRAMs, | ||
65 | ** 3 for x1 DRAMs */ | ||
66 | |||
67 | UINT8 memread; /* needed for reading/writing external memory */ | ||
68 | |||
69 | /* handlers and parameters for the status flags support */ | ||
70 | STATUS_CHANGE_HANDLER status_set_handler; | ||
71 | STATUS_CHANGE_HANDLER status_reset_handler; | ||
72 | |||
73 | /* note that different chips have these flags on different | ||
74 | ** bits of the status register | ||
75 | */ | ||
76 | void * status_change_which_chip; /* this chip id */ | ||
77 | UINT8 status_change_EOS_bit; /* 1 on End Of Sample (record/playback/cycle time of AD/DA converting has passed)*/ | ||
78 | UINT8 status_change_BRDY_bit; /* 1 after recording 2 datas (2x4bits) or after reading/writing 1 data */ | ||
79 | UINT8 status_change_ZERO_bit; /* 1 if silence lasts for more than 290 miliseconds on ADPCM recording */ | ||
80 | |||
81 | /* neither Y8950 nor YM2608 can generate IRQ when PCMBSY bit changes, so instead of above, | ||
82 | ** the statusflag gets ORed with PCM_BSY (below) (on each read of statusflag of Y8950 and YM2608) | ||
83 | */ | ||
84 | UINT8 PCM_BSY; /* 1 when ADPCM is playing; Y8950/YM2608 only */ | ||
85 | |||
86 | UINT8 reg[16]; /* adpcm registers */ | ||
87 | UINT8 emulation_mode; /* which chip we're emulating */ | ||
88 | }YM_DELTAT; | ||
89 | |||
90 | /*void YM_DELTAT_BRDY_callback(YM_DELTAT *DELTAT);*/ | ||
91 | |||
92 | UINT8 YM_DELTAT_ADPCM_Read(YM_DELTAT *DELTAT) ICODE_ATTR; | ||
93 | void YM_DELTAT_ADPCM_Write(YM_DELTAT *DELTAT,int r,int v) ICODE_ATTR; | ||
94 | void YM_DELTAT_ADPCM_Reset(YM_DELTAT *DELTAT,int pan,int emulation_mode); | ||
95 | void YM_DELTAT_ADPCM_CALC(YM_DELTAT *DELTAT) ICODE_ATTR; | ||
96 | |||
97 | /*void YM_DELTAT_postload(YM_DELTAT *DELTAT,UINT8 *regs); | ||
98 | void YM_DELTAT_savestate(const device_config *device,YM_DELTAT *DELTAT);*/ | ||
99 | |||
100 | #endif /* __YMDELTAT_H__ */ | ||