@@ -83,26 +83,43 @@ class impl final : public SPUInterface {
83
83
void waitForGoal (uint32_t goal) override { m_audioOut.waitForGoal (goal); }
84
84
85
85
private:
86
+ struct ADSRFlags {
87
+ enum : uint16_t {
88
+ AttackMode = 1 << 15 , // 15 0=Linear, 1=Exponential
89
+ AttackShiftMask = 0x7c00 , // 14-10 0..1Fh = Fast..Slow
90
+ AttackStepMask = 0x300 , // 9-8 0..3 = "+7,+6,+5,+4"
91
+ DecayShiftMask = 0xf0 , // 7-4 0..0Fh = Fast..Slow
92
+ SustainLevelMask = 0xf , // 3-0 0..0Fh ;Level=(N+1)*800h
93
+ // Flags for upper 16-bits of reg, shifted right 16-bits
94
+ SustainMode = 1 << 15 , // 31 0=Linear, 1=Exponential
95
+ SustainDirection = 1 << 14 , // 30 0=Increase, 1=Decrease (until Key OFF flag)
96
+ SustainShiftMask = 0x1f00 , // 28-24 0..1Fh = Fast..Slow
97
+ SustainStepMask = 0xc0 , // 23-22 0..3 = "+7,+6,+5,+4" or "-8,-7,-6,-5") (inc/dec)
98
+ ReleaseMode = 1 << 5 , // 21 0=Linear, 1=Exponential
99
+ ReleaseShiftMask = 0x1f // 20-16 0..1Fh = Fast..Slow
100
+ };
101
+ };
102
+
86
103
struct ControlFlags {
87
104
enum : uint16_t {
88
- CDAudioEnable = 1 << 0 , // 0 0x0001 ( 0=Off, 1=On) (for CD-DA and XA-ADPCM)
89
- ExternalAudioEnable = 1 << 1 , // 1 0x0002 ( 0=Off, 1=On)
90
- CDReverbEnable = 1 << 2 , // 2 0x0004 (0 =Off, 1=On) (for CD-DA and XA-ADPCM)
91
- ExternalReverbEnable = 1 << 3 , // 3 0x0008 ( 0=Off, 1=On)
92
- RAMTransferMode = 0x0030 , // 5-4 0x0030 RAM Transfer Mode ( 0=Stop, 1=ManualWrite, 2=DMAwrite, 3=DMAread)
93
- IRQEnable = 1 << 6 , // 6 0x0040 ( 0=Disabled/Acknowledge, 1=Enabled; only when Bit15=1)
94
- ReverbMasterEnable = 1 << 7 , // 7 0x0080 ( 0=Disabled, 1=Enabled)
95
- NoiseStep = 0x0300 , // 9-8 0x0300 Noise Frequency Step ( 0..03h = Step "4,5,6,7")
96
- NoiseShift = 0x3c00 , // 13-10 0x3c00 Noise Frequency Shift ( 0..0Fh = Low .. High Frequency)
97
- Mute = 1 << 14 , // 14 0x4000 ( 0=Mute, 1=Unmute)
98
- Enable = 1 << 15 // 15 0x8000 ( 0=Off, 1=On)
105
+ CDAudioEnable = 1 << 0 , // 0 0=Off, 1=On (for CD-DA and XA-ADPCM)
106
+ ExternalAudioEnable = 1 << 1 , // 1 0=Off, 1=On
107
+ CDReverbEnable = 1 << 2 , // 20 =Off, 1=On (for CD-DA and XA-ADPCM)
108
+ ExternalReverbEnable = 1 << 3 , // 3 0=Off, 1=On
109
+ RAMTransferModeMask = 0x0030 , // 5-4 0=Stop, 1=ManualWrite, 2=DMAwrite, 3=DMAread
110
+ IRQEnable = 1 << 6 , // 6 0=Disabled/Acknowledge, 1=Enabled; only when Bit15=1
111
+ ReverbMasterEnable = 1 << 7 , // 7 0=Disabled, 1=Enabled
112
+ NoiseStepMask = 0x0300 , // 9-8 0..03h = Step "4,5,6,7"
113
+ NoiseShiftMask = 0x3c00 , // 13-10 0..0Fh = Low .. High Frequency
114
+ Mute = 1 << 14 , // 14 0=Mute, 1=Unmute
115
+ Enable = 1 << 15 // 15 0=Off, 1=On
99
116
};
100
117
};
101
118
102
119
struct StatusFlags {
103
120
enum : uint16_t {
104
- SPUMode = 0x3f , // 5-0 Current SPU Mode(same as SPUCNT.Bit5 - 0, but, applied a bit delayed)
105
- IRQFlag = 1 << 6 , // 6 0x0040 IRQ9 Flag (0=No, 1=Interrupt Request)
121
+ SPUModeMask = 0x3f , // 5-0 Current SPU Mode(same as SPUCNT.Bit5 - 0, but, applied a bit delayed)
122
+ IRQFlag = 1 << 6 , // 6 IRQ9 Flag (0=No, 1=Interrupt Request)
106
123
DMARWRequest = 1 << 7 , // 7 Data Transfer DMA Read/Write Request seems to be same as SPUCNT.Bit5
107
124
DMAWriteRequest = 1 << 8 , // 8 Data Transfer DMA Write Request (0=No, 1=Yes)
108
125
DMAReadRequest = 1 << 9 , // 9 Data Transfer DMA Read Request (0=No, 1=Yes)
@@ -119,8 +136,8 @@ class impl final : public SPUInterface {
119
136
SweepDirection = 1 << 13 , // 13 0=Increase, 1=Decrease
120
137
SweepPhase = 1 << 12 , // 12 0=Positive, 1=Negative
121
138
Unknown = 0xf80 , // 7-11 Not used? (should be zero)
122
- SweepShift = 0x7c , // 6-2 0..1Fh = Fast..Slow
123
- SweepStep = 0x3 // 1-0 0..3 = "+7,+6,+5,+4" or "-8,-7,-6,-5") (inc/dec)
139
+ SweepShiftMask = 0x7c , // 6-2 0..1Fh = Fast..Slow
140
+ SweepStepMask = 0x3 // 1-0 0..3 = "+7,+6,+5,+4" or "-8,-7,-6,-5") (inc/dec)
124
141
125
142
};
126
143
};
0 commit comments