blob: 64c174b3e32ba1e5cf59faec82cf7c13531695e8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
//
// Generated by dtk
// Translation Unit: JAIZelSound.cpp
//
#include "JAZelAudio/JAIZelSound.h"
#include "JSystem/JAudio/JAIGlobalParameter.h"
/* 802AEF64-802AEFA0 .text __ct__11JAIZelSoundFv */
JAIZelSound::JAIZelSound() {}
/* 802AEFA0-802AF19C .text setDistanceVolumeCommon__11JAIZelSoundFfUc */
f32 JAIZelSound::setDistanceVolumeCommon(f32 f30, u8 r31) {
f32 f31;
if (field_0x8 != 4) {
f31 = mPositionInfo[field_0x8].field_0x18;
} else {
f31 = mPositionInfo[0].field_0x18;
for (u8 i = 1; i < JAIGlobalParameter::getParamAudioCameraMax(); i++) {
if (mPositionInfo[i].field_0x18 < f31) {
f31 = mPositionInfo[i].field_0x18;
}
}
}
if (f31 < JAIGlobalParameter::getParamMaxVolumeDistance()) {
return 1.0f;
}
f31 -= JAIGlobalParameter::getParamMaxVolumeDistance();
f30 -= JAIGlobalParameter::getParamMaxVolumeDistance();
if (r31 > 7) {
f30 *= (1 << (r31 - 4));
} else if (r31 > 3) {
f30 /= (1 << ((r31 & 3) + 1));
} else if (r31 != 0) {
f30 *= (1 << (r31 & 3));
}
if (f31 < f30) {
if (r31 > 3 && r31 <= 7) {
return 1.0f - (f31 / f30);
}
return (
JAIGlobalParameter::getParamMinDistanceVolume() +
(1.0f - (f31 / f30)) *
(1.0f - JAIGlobalParameter::getParamMinDistanceVolume())
);
}
if (r31 > 3 && r31 <= 7) {
return 0.0f;
}
return JAIGlobalParameter::getParamMinDistanceVolume();
}
/* 802AF19C-802AF2A0 .text setSeDistanceVolume__11JAIZelSoundFUc */
void JAIZelSound::setSeDistanceVolume(u8 r30) {
if ((getSwBit() & 0x00400000) && field_0x18 > 1) {
return;
}
f32 f31;
if ((getSwBit() & 0x00000002) == 0) {
u8 r31;
if ((getSwBit() & 0x00300000)) {
r31 = ((getSwBit() >> 20) & 3) + 7;
} else {
r31 = ((getSwBit() >> 16) & 7);
}
f31 = setDistanceVolumeCommon(JAIGlobalParameter::getParamDistanceMax(), r31);
if ((getSwBit() & 0x01000000) && f31 <= 0.3333f) {
f31 = 0.3333f;
}
} else {
f31 = 1.0f;
}
setSeInterVolume(SOUNDPARAM_Distance, f31, r30, 0);
}
/* 802AF2A0-802AF314 .text setSeDistancePan__11JAIZelSoundFUc */
void JAIZelSound::setSeDistancePan(u8 r31) {
if ((getSwBit() & 0x00800000) && field_0x18 > 1) {
return;
}
setSeInterPan(SOUNDPARAM_Distance, setDistancePanCommon(), r31, 0);
}
/* 802AF314-802AF458 .text setSeDistanceDolby__11JAIZelSoundFUc */
void JAIZelSound::setSeDistanceDolby(u8 r30) {
if ((getSwBit() & 0x00800000) && field_0x18 > 1) {
return;
}
PositionInfo_t* posInf = &mPositionInfo[0];
f32 f0;
if (field_0x28 == 0 || posInf->field_0x8 < JAIGlobalParameter::getParamSeDolbyFrontDistanceMax()) {
f0 = 0.0f;
} else if (posInf->field_0x8 < 0.0f) {
f0 = (
JAIGlobalParameter::getParamSeDolbyCenterValue() *
(JAIGlobalParameter::getParamSeDolbyFrontDistanceMax() - posInf->field_0x8)
) / JAIGlobalParameter::getParamSeDolbyFrontDistanceMax();
} else if (posInf->field_0x8 < JAIGlobalParameter::getParamSeDolbyBehindDistanceMax()) {
f0 = JAIGlobalParameter::getParamSeDolbyCenterValue() + (
(127.0f - JAIGlobalParameter::getParamSeDolbyCenterValue()) *
(posInf->field_0x8 / JAIGlobalParameter::getParamSeDolbyBehindDistanceMax())
);
} else {
f0 = 127.0f;
}
setSeInterDolby(SOUNDPARAM_Distance, (u8)f0 / 127.0f, r30, 0);
}
|