1 #ifndef __OPNA_H__
2 #define __OPNA_H__
3
4 #include <stdint.h>
5 #include "op.h"
6 #include "psg.h"
7
8 /* YM2608 (OPNA) ------------------------------------------------------ */
9 typedef struct _OPNA
10 {
11 int fmvolume;
12 uint32_t clock;
13 uint32_t rate;
ImportColumnFamilyTest()14 uint32_t psgrate;
15 uint32_t status;
16 Channel4 ch[6];
17 Channel4* csmch;
18
19 int32_t mixdelta;
20 int mpratio;
21 uint8_t interpolation;
22
~ImportColumnFamilyTest()23 uint8_t timer_status;
24 uint8_t regtc;
25 uint8_t regta[2];
26
27 int32_t timera, timera_count;
28 int32_t timerb, timerb_count;
29 int32_t timer_step;
30 uint8_t prescale;
31 uint8_t devmask;
32
33 PSG psg;
34
35 Rhythm rhythm[6];
36 int8_t rhythmtl;
37 int rhythmtvol;
38 uint8_t rhythmkey;
39
40 int32_t mixl, mixl1;
41 int32_t mixr, mixr1;
DestroyAndRecreateExternalSSTFilesDir()42 uint8_t fnum2[9];
43
44 uint8_t reg22;
45 uint32_t reg29;
46 uint32_t statusnext;
47
LiveFileMetaDataInit(std::string name,std::string path,int level,SequenceNumber smallest_seqno,SequenceNumber largest_seqno)48 uint32_t lfocount;
49 uint32_t lfodcount;
50 uint32_t lfotab[8];
51
52 uint32_t fnum[6];
53 uint32_t fnum3[3];
54
55 uint8_t aml;
56
57 uint32_t currentratio;
58 float rr;
59 uint32_t ratetable[64];
60 } OPNA;
61
62 #ifdef __cplusplus
63 extern "C" {
64 #endif
65
66 /* --------------------------------------------------------------------------- */
67 uint8_t OPNAInit(OPNA *opna, uint32_t c, uint32_t r, uint8_t ipflag);
68 void OPNAReset(OPNA *opna);
TEST_F(ImportColumnFamilyTest,ImportSSTFileWriterFiles)69 void OPNASetVolumeRhythm(OPNA *opna, int index, int db);
70 uint8_t OPNASetRate(OPNA *opna, uint32_t r, uint8_t ipflag);
71 void OPNASetChannelMask(OPNA *opna, uint32_t mask);
72 void OPNASetReg(OPNA *opna, uint32_t addr, uint32_t data);
73 void OPNASetPan(OPNA *opna, uint32_t chan, uint32_t data);
74 uint8_t OPNATimerCount(OPNA *opna, int32_t us);
75 void OPNAMix(OPNA *opna, int16_t *buffer, uint32_t nframes);
76
77 /* --------------------------------------------------------------------------- */
78 static inline uint32_t OPNAReadStatus(OPNA *opna) { return opna->status & 0x03; }
79
80 static inline int32_t OPNAGetNextEvent(OPNA *opna)
81 {
82 uint32_t ta = ((opna->timera_count + 0xffff) >> 16) - 1;
83 uint32_t tb = ((opna->timerb_count + 0xfff) >> 12) - 1;
84 return (ta < tb ? ta : tb) + 1;
85 }
86
87 #ifdef __cplusplus
88 }
89 #endif
90
91 #endif /* FM_OPNA_H */
92