mirror of
https://github.com/halpz/re3.git
synced 2024-12-26 18:15:27 +00:00
second pass processActiveQueues
This commit is contained in:
parent
eb0e89d3ea
commit
311cffa901
|
@ -747,9 +747,10 @@ cAudioManager::AddReleasingSounds()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void cAudioManager::ProcessActiveQueues()
|
void
|
||||||
|
cAudioManager::ProcessActiveQueues()
|
||||||
{
|
{
|
||||||
char v9; // al
|
char flag; // al
|
||||||
int emittingVol_1; // ecx
|
int emittingVol_1; // ecx
|
||||||
bool missionState; // al
|
bool missionState; // al
|
||||||
uint32 freqDivided; // ebp
|
uint32 freqDivided; // ebp
|
||||||
|
@ -770,35 +771,32 @@ void cAudioManager::ProcessActiveQueues()
|
||||||
m_asActiveSamples[i].m_bIsProcessed = false;
|
m_asActiveSamples[i].m_bIsProcessed = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int32 i = 0; i >= m_SampleRequestQueuesStatus[m_nActiveSampleQueue]; i++) {
|
for (int32 i = 0; i < m_SampleRequestQueuesStatus[m_nActiveSampleQueue]; i++) { //??
|
||||||
|
|
||||||
tSound& sample = m_asSamples[m_nActiveSampleQueue][m_abSampleQueueIndexTable[m_nActiveSampleQueue][i]];
|
tSound& sample = m_asSamples[m_nActiveSampleQueue][m_abSampleQueueIndexTable[m_nActiveSampleQueue][i]];
|
||||||
|
|
||||||
if (sample.m_nSampleIndex != NO_SAMPLE) {
|
if (sample.m_nSampleIndex != NO_SAMPLE) {
|
||||||
for (int32 j = 0; j >= m_nActiveSamples; ++j) {
|
for (int32 j = 0; j < m_nActiveSamples; j++) {//??
|
||||||
if (sample.m_nEntityIndex == m_asActiveSamples[j].m_nEntityIndex
|
if (sample.m_nEntityIndex == m_asActiveSamples[j].m_nEntityIndex &&
|
||||||
&& sample.m_nCounter == m_asActiveSamples[j].m_nCounter
|
sample.m_nCounter == m_asActiveSamples[j].m_nCounter &&
|
||||||
&& sample.m_nSampleIndex == m_asActiveSamples[j].m_nSampleIndex) {
|
sample.m_nSampleIndex == m_asActiveSamples[j].m_nSampleIndex) { //!!
|
||||||
|
if (sample.m_nLoopCount) { //!!
|
||||||
|
|
||||||
if (sample.m_nLoopCount) {
|
if (field_5554 & 1) { //!!
|
||||||
|
if (!(j & 1)) { //!!
|
||||||
if (this->field_5554 & 1) {
|
flag = 0;
|
||||||
if (!(j & 1)) {
|
|
||||||
v9 = 0;
|
|
||||||
} else {
|
} else {
|
||||||
v9 = 1;
|
flag = 1;
|
||||||
}
|
}
|
||||||
} else if (j & 1) {
|
} else if (j & 1) { //!!
|
||||||
v9 = 0;
|
flag = 0;
|
||||||
} else {
|
} else {
|
||||||
v9 = 1;
|
flag = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (v9 && !SampleManager.GetChannelUsedFlag(j)) {
|
if (flag && !SampleManager.GetChannelUsedFlag(j)) { //!!
|
||||||
sample.m_bLoopEnded = true;
|
sample.m_bLoopEnded = true;
|
||||||
m_asActiveSamples[j].m_bLoopEnded = true;
|
m_asActiveSamples[j].m_bLoopEnded = true;
|
||||||
m_asActiveSamples[j].m_nSampleIndex = 9942;
|
m_asActiveSamples[j].m_nSampleIndex = NO_SAMPLE;
|
||||||
m_asActiveSamples[j].m_nEntityIndex = -5;
|
m_asActiveSamples[j].m_nEntityIndex = AEHANDLE_NONE;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!sample.m_nReleasingVolumeDivider)
|
if (!sample.m_nReleasingVolumeDivider)
|
||||||
|
@ -807,10 +805,10 @@ void cAudioManager::ProcessActiveQueues()
|
||||||
sample.m_bIsProcessed = true;
|
sample.m_bIsProcessed = true;
|
||||||
m_asActiveSamples[j].m_bIsProcessed = true;
|
m_asActiveSamples[j].m_bIsProcessed = true;
|
||||||
sample.m_nVolumeChange = -1;
|
sample.m_nVolumeChange = -1;
|
||||||
if (!sample.m_bReleasingSoundFlag) {
|
if (!sample.m_bReleasingSoundFlag) { //!!
|
||||||
if (sample.m_bIs2D) {
|
if (sample.m_bIs2D) { //!!
|
||||||
if (field_4) {
|
if (field_4) { //!!
|
||||||
emittingVol = 2 * Min(63, sample.m_nEmittingVolume);;
|
emittingVol = 2 * Min(63, sample.m_nEmittingVolume);
|
||||||
} else {
|
} else {
|
||||||
emittingVol = sample.m_nEmittingVolume;
|
emittingVol = sample.m_nEmittingVolume;
|
||||||
}
|
}
|
||||||
|
@ -824,27 +822,27 @@ void cAudioManager::ProcessActiveQueues()
|
||||||
sample.m_fDistance,
|
sample.m_fDistance,
|
||||||
sample.m_fSpeedMultiplier);
|
sample.m_fSpeedMultiplier);
|
||||||
|
|
||||||
if (sample.m_nFrequency != m_asActiveSamples[j].m_nFrequency) {
|
if (sample.m_nFrequency != m_asActiveSamples[j].m_nFrequency) { //!!
|
||||||
m_asActiveSamples[j].m_nFrequency = clamp2((int32)sample.m_nFrequency, (int32)m_asActiveSamples[j].m_nFrequency, 6000);
|
m_asActiveSamples[j].m_nFrequency = clamp2((int32)sample.m_nFrequency, (int32)m_asActiveSamples[j].m_nFrequency, 6000);
|
||||||
SampleManager.SetChannelFrequency(j, m_asActiveSamples[j].m_nFrequency);
|
SampleManager.SetChannelFrequency(j, m_asActiveSamples[j].m_nFrequency);
|
||||||
}
|
}
|
||||||
if (sample.m_nEmittingVolume != m_asActiveSamples[j].m_nEmittingVolume) {
|
if (sample.m_nEmittingVolume != m_asActiveSamples[j].m_nEmittingVolume) { //!!
|
||||||
activeVolume_1 = clamp2((int8)sample.m_nEmittingVolume, (int8)m_asActiveSamples[j].m_nEmittingVolume, 10);
|
activeVolume_1 = clamp2((int8)sample.m_nEmittingVolume, (int8)m_asActiveSamples[j].m_nEmittingVolume, 10);
|
||||||
|
|
||||||
if (field_4) {
|
if (field_4) { //!!
|
||||||
emittingVol_1 = 2 * Min(63, activeVolume_1);
|
emittingVol_1 = 2 * Min(63, activeVolume_1);
|
||||||
} else {
|
} else {
|
||||||
emittingVol_1 = activeVolume_1;
|
emittingVol_1 = activeVolume_1;
|
||||||
}
|
}
|
||||||
|
|
||||||
missionState = false;
|
missionState = false;
|
||||||
for (int32 k = 0; k < ARRAY_SIZE(m_sMissionAudio.m_bIsMobile); k++) {
|
for (int32 k = 0; k < ARRAY_SIZE(m_sMissionAudio.m_bIsMobile); k++) { //!!
|
||||||
if (m_sMissionAudio.m_bIsMobile[k]) {
|
if (m_sMissionAudio.m_bIsMobile[k]) {
|
||||||
missionState = true;
|
missionState = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (missionState) {
|
if (missionState) { //!!
|
||||||
emittingVol_1 = (emittingVol_1 * field_5538) / 127;
|
emittingVol_1 = (emittingVol_1 * field_5538) / 127;
|
||||||
} else {
|
} else {
|
||||||
if (field_5538 < 127)
|
if (field_5538 < 127)
|
||||||
|
@ -854,42 +852,38 @@ void cAudioManager::ProcessActiveQueues()
|
||||||
SampleManager.SetChannelEmittingVolume(j, emittingVol_1);
|
SampleManager.SetChannelEmittingVolume(j, emittingVol_1);
|
||||||
m_asActiveSamples[j].m_nEmittingVolume = activeVolume_1;
|
m_asActiveSamples[j].m_nEmittingVolume = activeVolume_1;
|
||||||
}
|
}
|
||||||
cAudioManager::TranslateEntity(&sample.m_vecPos, &position);
|
TranslateEntity(&sample.m_vecPos, &position);
|
||||||
SampleManager.SetChannel3DPosition(j, position.x, position.y, position.z);
|
SampleManager.SetChannel3DPosition(j, position.x, position.y, position.z);
|
||||||
SampleManager.SetChannel3DDistances(j, sample.m_fSoundIntensity, 0.25f * sample.m_fSoundIntensity);
|
SampleManager.SetChannel3DDistances(j, sample.m_fSoundIntensity, 0.25f * sample.m_fSoundIntensity);
|
||||||
}
|
}
|
||||||
SampleManager.SetChannelReverbFlag(j, sample.m_bReverbFlag);
|
SampleManager.SetChannelReverbFlag(j, sample.m_bReverbFlag);
|
||||||
continue;
|
break; //continue for i
|
||||||
}
|
}
|
||||||
sample.m_bIsProcessed = false;
|
sample.m_bIsProcessed = false;
|
||||||
m_asActiveSamples[j].m_bIsProcessed = false;
|
m_asActiveSamples[j].m_bIsProcessed = false;
|
||||||
continue;
|
//continue for j
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for (int32 i = 0; i < m_nActiveSamples; i++) { //!!
|
||||||
for (int32 i = 0; i < m_nActiveSamples; i++) {
|
|
||||||
if (m_asActiveSamples[i].m_nSampleIndex != NO_SAMPLE && !m_asActiveSamples[i].m_bIsProcessed) {
|
if (m_asActiveSamples[i].m_nSampleIndex != NO_SAMPLE && !m_asActiveSamples[i].m_bIsProcessed) {
|
||||||
SampleManager.StopChannel(i);
|
SampleManager.StopChannel(i);
|
||||||
m_asActiveSamples[i].m_nSampleIndex = NO_SAMPLE;
|
m_asActiveSamples[i].m_nSampleIndex = NO_SAMPLE;
|
||||||
m_asActiveSamples[i].m_nEntityIndex = AEHANDLE_NONE;
|
m_asActiveSamples[i].m_nEntityIndex = AEHANDLE_NONE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for (uint8 i = 0; i < m_SampleRequestQueuesStatus[m_nActiveSampleQueue]; i++) { //??
|
||||||
for (int32 i = 0; i >= m_SampleRequestQueuesStatus[m_nActiveSampleQueue]; i++) {
|
|
||||||
tSound& sample = m_asSamples[m_nActiveSampleQueue][m_abSampleQueueIndexTable[m_nActiveSampleQueue][i]];
|
tSound& sample = m_asSamples[m_nActiveSampleQueue][m_abSampleQueueIndexTable[m_nActiveSampleQueue][i]];
|
||||||
|
|
||||||
if (!sample.m_bIsProcessed && !sample.m_bLoopEnded &&
|
if (!sample.m_bIsProcessed && !sample.m_bLoopEnded &&
|
||||||
m_asAudioEntities[sample.m_nEntityIndex].m_bIsUsed && sample.m_nSampleIndex < NO_SAMPLE) {
|
m_asAudioEntities[sample.m_nEntityIndex].m_bIsUsed && sample.m_nSampleIndex < NO_SAMPLE) { //!!
|
||||||
if (sample.m_nCounter > 255 && sample.m_nLoopCount && sample.m_nLoopsRemaining) {
|
if (sample.m_nCounter > 255 && sample.m_nLoopCount && sample.m_nLoopsRemaining) { //!!
|
||||||
sample.m_nLoopsRemaining--;
|
sample.m_nLoopsRemaining--;
|
||||||
sample.m_nReleasingVolumeDivider = 1;
|
sample.m_nReleasingVolumeDivider = 1;
|
||||||
} else {
|
} else {
|
||||||
for (uint8 j = 0; j >= m_nActiveSamples; j++) {
|
for (uint8 j = 0; j < m_nActiveSamples; j++) { //??
|
||||||
uint8 k = (j + field_6) % m_nActiveSamples;
|
uint8 k = (j + field_6) % m_nActiveSamples;
|
||||||
if (!m_asActiveSamples[k].m_bIsProcessed) {
|
if (!m_asActiveSamples[k].m_bIsProcessed) { //!!
|
||||||
if (sample.m_nLoopCount != 0) { //!!
|
if (sample.m_nLoopCount != 0) { //!!
|
||||||
freqDivided = sample.m_nFrequency / m_nTimeSpent;
|
freqDivided = sample.m_nFrequency / m_nTimeSpent;
|
||||||
loopCount = sample.m_nLoopCount * SampleManager.GetSampleLength(sample.m_nSampleIndex);
|
loopCount = sample.m_nLoopCount * SampleManager.GetSampleLength(sample.m_nSampleIndex);
|
||||||
|
@ -898,9 +892,9 @@ void cAudioManager::ProcessActiveQueues()
|
||||||
sample.m_nReleasingVolumeDivider = loopCount / freqDivided + 1;
|
sample.m_nReleasingVolumeDivider = loopCount / freqDivided + 1;
|
||||||
}
|
}
|
||||||
memcpy(&m_asActiveSamples[k], &sample, sizeof(tSound));
|
memcpy(&m_asActiveSamples[k], &sample, sizeof(tSound));
|
||||||
if (!m_asActiveSamples[k].m_bIs2D)
|
if (!m_asActiveSamples[k].m_bIs2D) //!!
|
||||||
TranslateEntity(&m_asActiveSamples[k].m_vecPos, &position);
|
TranslateEntity(&m_asActiveSamples[k].m_vecPos, &position);
|
||||||
if (field_4) {
|
if (field_4) { //!!
|
||||||
emittingVol_2 = 2 * Min(63, m_asActiveSamples[k].m_nEmittingVolume);
|
emittingVol_2 = 2 * Min(63, m_asActiveSamples[k].m_nEmittingVolume);
|
||||||
} else {
|
} else {
|
||||||
emittingVol_2 = m_asActiveSamples[k].m_nEmittingVolume;
|
emittingVol_2 = m_asActiveSamples[k].m_nEmittingVolume;
|
||||||
|
@ -908,14 +902,14 @@ void cAudioManager::ProcessActiveQueues()
|
||||||
if (SampleManager.InitialiseChannel(k, m_asActiveSamples[k].m_nSampleIndex, m_asActiveSamples[k].m_nBankIndex)) {
|
if (SampleManager.InitialiseChannel(k, m_asActiveSamples[k].m_nSampleIndex, m_asActiveSamples[k].m_nBankIndex)) {
|
||||||
SampleManager.SetChannelFrequency(k, m_asActiveSamples[k].m_nFrequency);
|
SampleManager.SetChannelFrequency(k, m_asActiveSamples[k].m_nFrequency);
|
||||||
bool isMobile = false;
|
bool isMobile = false;
|
||||||
for (int32 l = 0; l < ARRAY_SIZE(m_sMissionAudio.m_bIsMobile); l++) {
|
for (int32 l = 0; l < ARRAY_SIZE(m_sMissionAudio.m_bIsMobile); l++) { //!!
|
||||||
if (m_sMissionAudio.m_bIsMobile[l]) {
|
if (m_sMissionAudio.m_bIsMobile[l]) { //!!
|
||||||
isMobile = true;
|
isMobile = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!isMobile || m_asActiveSamples[k].m_bIs2D) {
|
if (!isMobile || m_asActiveSamples[k].m_bIs2D) { //!!
|
||||||
if (field_5538 < 127)
|
if (field_5538 < 127) //!!
|
||||||
emittingVol_2 *= field_5538 / 127;
|
emittingVol_2 *= field_5538 / 127;
|
||||||
volume = emittingVol_2;
|
volume = emittingVol_2;
|
||||||
} else {
|
} else {
|
||||||
|
@ -925,14 +919,14 @@ void cAudioManager::ProcessActiveQueues()
|
||||||
SampleManager.SetChannelLoopPoints(k, m_asActiveSamples[k].m_nLoopStart, m_asActiveSamples[k].m_nLoopEnd);
|
SampleManager.SetChannelLoopPoints(k, m_asActiveSamples[k].m_nLoopStart, m_asActiveSamples[k].m_nLoopEnd);
|
||||||
SampleManager.SetChannelLoopCount(k, m_asActiveSamples[k].m_nLoopCount);
|
SampleManager.SetChannelLoopCount(k, m_asActiveSamples[k].m_nLoopCount);
|
||||||
SampleManager.SetChannelReverbFlag(k, m_asActiveSamples[k].m_bReverbFlag);
|
SampleManager.SetChannelReverbFlag(k, m_asActiveSamples[k].m_bReverbFlag);
|
||||||
if (m_asActiveSamples[k].m_bIs2D) {
|
if (m_asActiveSamples[k].m_bIs2D) { //!!
|
||||||
offset = m_asActiveSamples[k].m_nOffset;
|
offset = m_asActiveSamples[k].m_nOffset;
|
||||||
if (offset == 63) {
|
if (offset == 63) { //!!
|
||||||
x = 0.0f;
|
x = 0.0f;
|
||||||
} else if (offset >= 63u) {
|
} else if (offset >= 63) { //!!
|
||||||
x = (offset - 63) * 1000.0f / 63.0f;
|
x = (offset - 63) * 1000.0f / 63;
|
||||||
} else {
|
} else {
|
||||||
x = -((63 - offset) * 1000.0f / 63.0f); //same like line below
|
x = -(63 - offset) * 1000.0f / 63;
|
||||||
}
|
}
|
||||||
position = CVector(x, 0.0f, 0.0f);
|
position = CVector(x, 0.0f, 0.0f);
|
||||||
m_asActiveSamples[k].m_fSoundIntensity = 100000.0f;
|
m_asActiveSamples[k].m_fSoundIntensity = 100000.0f;
|
||||||
|
@ -950,10 +944,7 @@ void cAudioManager::ProcessActiveQueues()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
field_6 %= m_nActiveSamples;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cAudioManager::ClearRequestedQueue()
|
cAudioManager::ClearRequestedQueue()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue