_SsSndSetVabAttr (#1080)

This commit is contained in:
sozud 2024-02-24 12:21:35 -08:00 committed by GitHub
parent d3cdc10ba6
commit e137da0768
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 146 additions and 3 deletions

View File

@ -317,7 +317,9 @@ short SsUtGetVagAtr(
short SsUtSetVagAtr(
short vabId, short progNum, short toneNum, VagAtr* vagatrptr);
s16 SsVabTransBodyPartly(u8* addr, u32 bufsize, s16 vabid);
short SsVabTransBodyPartly(
unsigned char* addr, unsigned long bufsize, short vabid);
u32 SpuWritePartly(u8*, u32);
struct SndSeqTickEnv {
@ -350,4 +352,6 @@ extern unsigned short _svm_okon2;
extern unsigned short _svm_okof1;
extern unsigned short _svm_okof2;
void SsUtSetReverbDepth(short, short);
#endif

View File

@ -388,7 +388,145 @@ void _SsContRpn2(s16 arg0, s16 arg1, u8 arg2) {
INCLUDE_ASM("main/nonmatchings/psxsdk/libsnd/seqread", _SsContDataEntry);
INCLUDE_ASM("main/nonmatchings/psxsdk/libsnd/seqread", _SsSndSetVabAttr);
#define DE_PRIORITY 0
#define DE_MODE 1
#define DE_LIMITL 2
#define DE_LIMITH 3
#define DE_ADSR_AR_L 4
#define DE_ADSR_AR_E 5
#define DE_ADSR_DR 6
#define DE_ADSR_SL 7
#define DE_ADSR_SR_L 8
#define DE_ADSR_SR_E 9
#define DE_ADSR_RR_L 10
#define DE_ADSR_RR_E 11
#define DE_ADSR_SR 12
#define DE_VIB_TIME 13
#define DE_PORTA_DEPTH 14
#define DE_REV_TYPE 15
#define DE_REV_DEPTH 16
#define DE_ECHO_FB 17
#define DE_ECHO_DELAY 18
#define DE_DELAY 19
void _SsSndSetVabAttr(s16 vabId, s16 progNum, s16 toneNum, VagAtr vagAtr,
struct Unk adsrBuffer, short idx, unsigned char attr) {
s16 temp;
SsUtGetVagAtr(vabId, progNum, toneNum, &vagAtr);
switch ((s16)idx) {
case DE_PRIORITY:
vagAtr.prior = attr;
SsUtSetVagAtr(vabId, progNum, toneNum, &vagAtr);
return;
case DE_MODE:
vagAtr.mode = attr;
SsUtSetVagAtr(vabId, progNum, toneNum, &vagAtr);
if (attr == 0) {
SsUtReverbOff();
return;
} else if (attr == 1) {
return;
} else if (attr == 2) {
return;
} else if (attr == 3) {
return;
} else if (attr == 4) {
SsUtReverbOn();
return;
}
break;
case DE_LIMITL:
vagAtr.min = attr;
SsUtSetVagAtr(vabId, progNum, toneNum, &vagAtr);
return;
case DE_LIMITH:
vagAtr.max = attr;
SsUtSetVagAtr(vabId, progNum, toneNum, &vagAtr);
return;
case DE_ADSR_AR_L:
case DE_ADSR_AR_E:
case DE_ADSR_DR:
case DE_ADSR_SL:
case DE_ADSR_SR_L:
case DE_ADSR_SR_E:
case DE_ADSR_RR_L:
case DE_ADSR_RR_E:
case DE_ADSR_SR:
case DE_VIB_TIME:
case DE_PORTA_DEPTH:
temp = idx - 4;
_SsUtResolveADSR(vagAtr.adsr1, vagAtr.adsr2, &adsrBuffer);
switch (temp) {
case 0:
adsrBuffer.unkA = 0;
adsrBuffer.unk0 = attr;
break;
case 1:
adsrBuffer.unkA = 1;
adsrBuffer.unk0 = attr;
break;
case 2:
adsrBuffer.unk2 = attr;
break;
case 3:
adsrBuffer.unk4 = attr;
break;
case 4:
adsrBuffer.unkC = 0;
adsrBuffer.unk6 = attr;
break;
case 5:
adsrBuffer.unkC = 1;
adsrBuffer.unk6 = attr;
break;
case 6:
adsrBuffer.unkE = 0;
adsrBuffer.unk8 = attr;
break;
case 7:
adsrBuffer.unkE = 1;
adsrBuffer.unk8 = attr;
break;
case 8:
if (attr != 0 && attr < 64) {
adsrBuffer.unk10 = 0;
break;
}
if ((attr - 64) < 64U) {
adsrBuffer.unk10 = 1;
}
break;
case 9:
vagAtr.vibT = attr;
break;
case 10:
vagAtr.porW = attr;
break;
}
_SsUtBuildADSR(&adsrBuffer, &vagAtr.adsr1, &vagAtr.adsr2);
SsUtSetVagAtr(vabId, progNum, toneNum, &vagAtr);
return;
case DE_REV_TYPE:
SsUtSetReverbType(attr);
return;
case DE_REV_DEPTH:
SsUtSetReverbDepth(attr, attr);
return;
case DE_ECHO_FB:
SsUtSetReverbFeedback(attr);
return;
case DE_ECHO_DELAY:
case DE_DELAY:
SsUtSetReverbDelay(attr);
break;
case 20:
case 21:
case 22:
break;
}
}
void SpuVmPitchBend(s32, s16, u8, u8);
s32 _SsReadDeltaValue(s16, s16);

View File

@ -4,7 +4,8 @@
static s32 D_80032F08 = 0;
static s16 D_80032F0C = 0xffff;
s16 SsVabTransBodyPartly(u8* addr, u32 bufsize, s16 vabid) {
short SsVabTransBodyPartly(
unsigned char* addr, unsigned long bufsize, short vabid) {
s16 new_vabid;
s32 buff_diff;
u32 new_bufsize;