mirror of
https://github.com/GTAmodding/re3.git
synced 2024-11-25 19:23:43 +00:00
Audio: separate buffers for mission audio
This commit is contained in:
parent
29383a6a11
commit
232a45c9ac
4 changed files with 110 additions and 47 deletions
|
@ -8307,7 +8307,6 @@ cPedComments::Process()
|
||||||
goto PedCommentAlreadyAdded;
|
goto PedCommentAlreadyAdded;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if defined(GTA_PS2) || defined(FIX_BUGS)
|
|
||||||
bool8 IsLoadedResult;
|
bool8 IsLoadedResult;
|
||||||
sampleIndex = m_aPedCommentQueue[m_nActiveQueue][m_aPedCommentOrderList[m_nActiveQueue][0]].m_nSampleIndex;
|
sampleIndex = m_aPedCommentQueue[m_nActiveQueue][m_aPedCommentOrderList[m_nActiveQueue][0]].m_nSampleIndex;
|
||||||
if (sampleIndex >= PLAYER_COMMENTS_START && sampleIndex <= PLAYER_COMMENTS_END) {
|
if (sampleIndex >= PLAYER_COMMENTS_START && sampleIndex <= PLAYER_COMMENTS_END) {
|
||||||
|
@ -8318,18 +8317,13 @@ cPedComments::Process()
|
||||||
bIsPlayerComment = FALSE;
|
bIsPlayerComment = FALSE;
|
||||||
}
|
}
|
||||||
switch(IsLoadedResult) { // yes, this was a switch
|
switch(IsLoadedResult) { // yes, this was a switch
|
||||||
#else
|
|
||||||
switch(SampleManager.IsPedCommentLoaded(sampleIndex)) { // yes, this was a switch
|
|
||||||
#endif
|
|
||||||
case FALSE:
|
case FALSE:
|
||||||
#if defined(GTA_PC) && !defined(FIX_BUGS)
|
#if defined(GTA_PC) && !defined(FIX_BUGS)
|
||||||
if(!m_bDelay)
|
if(!m_bDelay)
|
||||||
#endif
|
#endif
|
||||||
#if defined(GTA_PS2) || defined(FIX_BUGS)
|
|
||||||
if (bIsPlayerComment)
|
if (bIsPlayerComment)
|
||||||
SampleManager.LoadMissionAudio(MISSION_AUDIO_PLAYER_COMMENT, sampleIndex);
|
SampleManager.LoadMissionAudio(MISSION_AUDIO_PLAYER_COMMENT, sampleIndex);
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
SampleManager.LoadPedComment(sampleIndex);
|
SampleManager.LoadPedComment(sampleIndex);
|
||||||
break;
|
break;
|
||||||
case TRUE:
|
case TRUE:
|
||||||
|
@ -11863,8 +11857,8 @@ cAudioManager::ProcessMissionAudioSlot(uint8 slot)
|
||||||
if (m_nMissionAudioSampleIndex[slot] != NO_SAMPLE) {
|
if (m_nMissionAudioSampleIndex[slot] != NO_SAMPLE) {
|
||||||
switch (m_nMissionAudioLoadingStatus[slot]) {
|
switch (m_nMissionAudioLoadingStatus[slot]) {
|
||||||
case LOADING_STATUS_NOT_LOADED:
|
case LOADING_STATUS_NOT_LOADED:
|
||||||
// TODO: LoadMissionAudio
|
if (!SampleManager.IsMissionAudioLoaded(slot, m_nMissionAudioSampleIndex[slot]))
|
||||||
SampleManager.LoadPedComment(m_nMissionAudioSampleIndex[slot]);
|
SampleManager.LoadMissionAudio(slot, m_nMissionAudioSampleIndex[slot]);
|
||||||
SampleManager.SetChannelFrequency(slot + CHANNEL_MISSION_AUDIO_1, SampleManager.GetSampleBaseFrequency(m_nMissionAudioSampleIndex[slot]));
|
SampleManager.SetChannelFrequency(slot + CHANNEL_MISSION_AUDIO_1, SampleManager.GetSampleBaseFrequency(m_nMissionAudioSampleIndex[slot]));
|
||||||
m_nMissionAudioLoadingStatus[slot] = LOADING_STATUS_LOADED;
|
m_nMissionAudioLoadingStatus[slot] = LOADING_STATUS_LOADED;
|
||||||
nFramesUntilFailedLoad[slot] = 0;
|
nFramesUntilFailedLoad[slot] = 0;
|
||||||
|
|
|
@ -112,7 +112,8 @@ enum
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
#define MAX_PEDSFX 7
|
#define MAX_PEDSFX 7
|
||||||
#define PED_BLOCKSIZE 160000
|
#define PED_BLOCKSIZE 79000
|
||||||
|
#define MISSION_AUDIO_BLOCKSIZE 160000
|
||||||
|
|
||||||
#define MAXPROVIDERS 64
|
#define MAXPROVIDERS 64
|
||||||
|
|
||||||
|
@ -207,10 +208,8 @@ public:
|
||||||
void UnloadSampleBank (uint8 nBank);
|
void UnloadSampleBank (uint8 nBank);
|
||||||
bool8 IsSampleBankLoaded(uint8 nBank);
|
bool8 IsSampleBankLoaded(uint8 nBank);
|
||||||
|
|
||||||
#if defined (GTA_PS2) || defined (FIX_BUGS)
|
|
||||||
bool8 IsMissionAudioLoaded(uint8 nSlot, uint32 nSample);
|
bool8 IsMissionAudioLoaded(uint8 nSlot, uint32 nSample);
|
||||||
bool8 LoadMissionAudio (uint8 nSlot, uint32 nSample);
|
bool8 LoadMissionAudio (uint8 nSlot, uint32 nSample);
|
||||||
#endif
|
|
||||||
|
|
||||||
bool8 IsPedCommentLoaded(uint32 nComment);
|
bool8 IsPedCommentLoaded(uint32 nComment);
|
||||||
bool8 LoadPedComment (uint32 nComment);
|
bool8 LoadPedComment (uint32 nComment);
|
||||||
|
|
|
@ -39,10 +39,11 @@ int32 nPedSlotSfx [MAX_PEDSFX];
|
||||||
int32 nPedSlotSfxAddr[MAX_PEDSFX];
|
int32 nPedSlotSfxAddr[MAX_PEDSFX];
|
||||||
uint8 nCurrentPedSlot;
|
uint8 nCurrentPedSlot;
|
||||||
|
|
||||||
#ifdef FIX_BUGS
|
uint32 nMissionSlotSfx[MISSION_AUDIO_SLOTS] = { UINT32_MAX, UINT32_MAX };
|
||||||
|
uintptr nMissionSlotSfxStartAddress;
|
||||||
|
|
||||||
uint32 gPlayerTalkSfx = UINT32_MAX;
|
uint32 gPlayerTalkSfx = UINT32_MAX;
|
||||||
void *gPlayerTalkData = 0;
|
void *gPlayerTalkData = 0;
|
||||||
#endif
|
|
||||||
|
|
||||||
uint8 nChannelVolume[MAXCHANNELS+MAX2DCHANNELS];
|
uint8 nChannelVolume[MAXCHANNELS+MAX2DCHANNELS];
|
||||||
|
|
||||||
|
@ -1323,7 +1324,13 @@ cSampleManager::Initialise(void)
|
||||||
|
|
||||||
nSampleBankMemoryStartAddress[SFX_BANK_PED_COMMENTS] = (int32)AIL_mem_alloc_lock(PED_BLOCKSIZE*MAX_PEDSFX);
|
nSampleBankMemoryStartAddress[SFX_BANK_PED_COMMENTS] = (int32)AIL_mem_alloc_lock(PED_BLOCKSIZE*MAX_PEDSFX);
|
||||||
|
|
||||||
#ifdef FIX_BUGS
|
nMissionSlotSfxStartAddress = (uintptr)AIL_mem_alloc_lock(PED_BLOCKSIZE*MAX_PEDSFX);
|
||||||
|
if ( !nMissionSlotSfxStartAddress )
|
||||||
|
{
|
||||||
|
Terminate();
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
// Find biggest player comment
|
// Find biggest player comment
|
||||||
uint32 nMaxPedSize = 0;
|
uint32 nMaxPedSize = 0;
|
||||||
for (uint32 i = PLAYER_COMMENTS_START; i <= PLAYER_COMMENTS_END; i++)
|
for (uint32 i = PLAYER_COMMENTS_START; i <= PLAYER_COMMENTS_END; i++)
|
||||||
|
@ -1335,7 +1342,6 @@ cSampleManager::Initialise(void)
|
||||||
Terminate();
|
Terminate();
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
LoadSampleBank(SFX_BANK_0);
|
LoadSampleBank(SFX_BANK_0);
|
||||||
|
|
||||||
|
@ -1491,13 +1497,20 @@ cSampleManager::Terminate(void)
|
||||||
nSampleBankMemoryStartAddress[SFX_BANK_PED_COMMENTS] = 0;
|
nSampleBankMemoryStartAddress[SFX_BANK_PED_COMMENTS] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FIX_BUGS
|
if ( nMissionSlotSfxStartAddress != 0 )
|
||||||
|
{
|
||||||
|
AIL_mem_free_lock((void *)nMissionSlotSfxStartAddress);
|
||||||
|
nMissionSlotSfxStartAddress = 0;
|
||||||
|
|
||||||
|
for ( uint32 i = 0; i < MISSION_AUDIO_SLOTS; i++ )
|
||||||
|
nMissionSlotSfx[i] = UINT32_MAX;
|
||||||
|
}
|
||||||
|
|
||||||
if ( gPlayerTalkData != 0)
|
if ( gPlayerTalkData != 0)
|
||||||
{
|
{
|
||||||
AIL_mem_free_lock(gPlayerTalkData);
|
AIL_mem_free_lock(gPlayerTalkData);
|
||||||
gPlayerTalkData = 0;
|
gPlayerTalkData = 0;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
if ( DIG )
|
if ( DIG )
|
||||||
{
|
{
|
||||||
|
@ -1663,32 +1676,50 @@ cSampleManager::IsSampleBankLoaded(uint8 nBank)
|
||||||
return bSampleBankLoaded[nBank];
|
return bSampleBankLoaded[nBank];
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FIX_BUGS
|
|
||||||
bool8
|
bool8
|
||||||
cSampleManager::IsMissionAudioLoaded(uint8 nSlot, uint32 nSample)
|
cSampleManager::IsMissionAudioLoaded(uint8 nSlot, uint32 nSample)
|
||||||
{
|
{
|
||||||
ASSERT(nSlot == MISSION_AUDIO_PLAYER_COMMENT); // only MISSION_AUDIO_PLAYER_COMMENT is supported on PC
|
ASSERT(nSlot != MISSION_AUDIO_POLRADIO_CRIME_OR_COLOR && nSlot != MISSION_AUDIO_POLRADIO_AREA_OR_CAR); // these are not used in LCS
|
||||||
|
|
||||||
|
switch (nSlot)
|
||||||
|
{
|
||||||
|
case MISSION_AUDIO_SLOT_1:
|
||||||
|
case MISSION_AUDIO_SLOT_2:
|
||||||
|
return nMissionSlotSfx[nSlot] == nSample;
|
||||||
|
case MISSION_AUDIO_PLAYER_COMMENT:
|
||||||
return nSample == gPlayerTalkSfx;
|
return nSample == gPlayerTalkSfx;
|
||||||
}
|
}
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
bool8
|
bool8
|
||||||
cSampleManager::LoadMissionAudio(uint8 nSlot, uint32 nSample)
|
cSampleManager::LoadMissionAudio(uint8 nSlot, uint32 nSample)
|
||||||
{
|
{
|
||||||
ASSERT(nSlot == MISSION_AUDIO_PLAYER_COMMENT); // only MISSION_AUDIO_PLAYER_COMMENT is supported on PC
|
ASSERT(nSlot != MISSION_AUDIO_POLRADIO_CRIME_OR_COLOR && nSlot != MISSION_AUDIO_POLRADIO_AREA_OR_CAR); // these are not used in LCS
|
||||||
ASSERT(nSample < TOTAL_AUDIO_SAMPLES);
|
ASSERT(nSample < TOTAL_AUDIO_SAMPLES);
|
||||||
|
|
||||||
if (fseek(fpSampleDataHandle, m_aSamples[nSample].nOffset, SEEK_SET) != 0)
|
if (fseek(fpSampleDataHandle, m_aSamples[nSample].nOffset, SEEK_SET) != 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
switch (nSlot)
|
||||||
|
{
|
||||||
|
case MISSION_AUDIO_SLOT_1:
|
||||||
|
case MISSION_AUDIO_SLOT_2:
|
||||||
|
if (fread((void*)(nMissionSlotSfxStartAddress + nSlot*MISSION_AUDIO_BLOCKSIZE), 1, m_aSamples[nSample].nSize, fpSampleDataHandle) != m_aSamples[nSample].nSize)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
nMissionSlotSfx[nSlot] = nSample;
|
||||||
|
break;
|
||||||
|
case MISSION_AUDIO_PLAYER_COMMENT:
|
||||||
if (fread(gPlayerTalkData, 1, m_aSamples[nSample].nSize, fpSampleDataHandle) != m_aSamples[nSample].nSize)
|
if (fread(gPlayerTalkData, 1, m_aSamples[nSample].nSize, fpSampleDataHandle) != m_aSamples[nSample].nSize)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
gPlayerTalkSfx = nSample;
|
gPlayerTalkSfx = nSample;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
bool8
|
bool8
|
||||||
cSampleManager::IsPedCommentLoaded(uint32 nComment)
|
cSampleManager::IsPedCommentLoaded(uint32 nComment)
|
||||||
|
@ -1917,7 +1948,6 @@ cSampleManager::InitialiseChannel(uint32 nChannel, uint32 nSfx, uint8 nBank)
|
||||||
|
|
||||||
addr = nSampleBankMemoryStartAddress[nBank] + m_aSamples[nSfx].nOffset - m_aSamples[BankStartOffset[nBank]].nOffset;
|
addr = nSampleBankMemoryStartAddress[nBank] + m_aSamples[nSfx].nOffset - m_aSamples[BankStartOffset[nBank]].nOffset;
|
||||||
}
|
}
|
||||||
#ifdef FIX_BUGS
|
|
||||||
else if ( nSfx >= PLAYER_COMMENTS_START && nSfx <= PLAYER_COMMENTS_END )
|
else if ( nSfx >= PLAYER_COMMENTS_START && nSfx <= PLAYER_COMMENTS_END )
|
||||||
{
|
{
|
||||||
if ( !IsMissionAudioLoaded(MISSION_AUDIO_PLAYER_COMMENT, nSfx) )
|
if ( !IsMissionAudioLoaded(MISSION_AUDIO_PLAYER_COMMENT, nSfx) )
|
||||||
|
@ -1925,9 +1955,15 @@ cSampleManager::InitialiseChannel(uint32 nChannel, uint32 nSfx, uint8 nBank)
|
||||||
|
|
||||||
addr = (uintptr)gPlayerTalkData;
|
addr = (uintptr)gPlayerTalkData;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
for ( uint32 i = 0; i < MISSION_AUDIO_SLOTS; i++ ) {
|
||||||
|
if ( IsMissionAudioLoaded(i, nSfx) ) {
|
||||||
|
addr = nMissionSlotSfxStartAddress + i * MISSION_AUDIO_BLOCKSIZE;
|
||||||
|
goto MissionAudioFound;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ( !IsPedCommentLoaded(nSfx) )
|
if ( !IsPedCommentLoaded(nSfx) )
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
@ -1936,6 +1972,7 @@ cSampleManager::InitialiseChannel(uint32 nChannel, uint32 nSfx, uint8 nBank)
|
||||||
addr = nPedSlotSfxAddr[slot];
|
addr = nPedSlotSfxAddr[slot];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MissionAudioFound:
|
||||||
#ifdef EXTERNAL_3D_SOUND
|
#ifdef EXTERNAL_3D_SOUND
|
||||||
if ( b2d )
|
if ( b2d )
|
||||||
{
|
{
|
||||||
|
|
|
@ -102,10 +102,11 @@ int32 nPedSlotSfx [MAX_PEDSFX];
|
||||||
int32 nPedSlotSfxAddr[MAX_PEDSFX];
|
int32 nPedSlotSfxAddr[MAX_PEDSFX];
|
||||||
uint8 nCurrentPedSlot;
|
uint8 nCurrentPedSlot;
|
||||||
|
|
||||||
#ifdef FIX_BUGS
|
uint32 nMissionSlotSfx[MISSION_AUDIO_SLOTS] = { UINT32_MAX, UINT32_MAX };
|
||||||
|
uintptr nMissionSlotSfxStartAddress;
|
||||||
|
|
||||||
uint32 gPlayerTalkSfx = UINT32_MAX;
|
uint32 gPlayerTalkSfx = UINT32_MAX;
|
||||||
void *gPlayerTalkData = 0;
|
void *gPlayerTalkData = 0;
|
||||||
#endif
|
|
||||||
|
|
||||||
CChannel aChannel[NUM_CHANNELS];
|
CChannel aChannel[NUM_CHANNELS];
|
||||||
uint8 nChannelVolume[NUM_CHANNELS];
|
uint8 nChannelVolume[NUM_CHANNELS];
|
||||||
|
@ -1053,7 +1054,9 @@ cSampleManager::Initialise(void)
|
||||||
nSampleBankMemoryStartAddress[SFX_BANK_PED_COMMENTS] = (uintptr)malloc(PED_BLOCKSIZE*MAX_PEDSFX);
|
nSampleBankMemoryStartAddress[SFX_BANK_PED_COMMENTS] = (uintptr)malloc(PED_BLOCKSIZE*MAX_PEDSFX);
|
||||||
ASSERT(nSampleBankMemoryStartAddress[SFX_BANK_PED_COMMENTS] != 0);
|
ASSERT(nSampleBankMemoryStartAddress[SFX_BANK_PED_COMMENTS] != 0);
|
||||||
|
|
||||||
#ifdef FIX_BUGS
|
nMissionSlotSfxStartAddress = (uintptr)malloc(MISSION_AUDIO_BLOCKSIZE*MISSION_AUDIO_SLOTS);
|
||||||
|
ASSERT(nMissionSlotSfxStartAddress != 0);
|
||||||
|
|
||||||
// Find biggest player comment
|
// Find biggest player comment
|
||||||
uint32 nMaxPedSize = 0;
|
uint32 nMaxPedSize = 0;
|
||||||
for (uint32 i = PLAYER_COMMENTS_START; i <= PLAYER_COMMENTS_END; i++)
|
for (uint32 i = PLAYER_COMMENTS_START; i <= PLAYER_COMMENTS_END; i++)
|
||||||
|
@ -1061,7 +1064,6 @@ cSampleManager::Initialise(void)
|
||||||
|
|
||||||
gPlayerTalkData = malloc(nMaxPedSize);
|
gPlayerTalkData = malloc(nMaxPedSize);
|
||||||
ASSERT(gPlayerTalkData != 0);
|
ASSERT(gPlayerTalkData != 0);
|
||||||
#endif
|
|
||||||
|
|
||||||
LoadSampleBank(SFX_BANK_0);
|
LoadSampleBank(SFX_BANK_0);
|
||||||
}
|
}
|
||||||
|
@ -1223,13 +1225,20 @@ cSampleManager::Terminate(void)
|
||||||
nSampleBankMemoryStartAddress[SFX_BANK_PED_COMMENTS] = 0;
|
nSampleBankMemoryStartAddress[SFX_BANK_PED_COMMENTS] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FIX_BUGS
|
if ( nMissionSlotSfxStartAddress != 0 )
|
||||||
|
{
|
||||||
|
free((void*)nMissionSlotSfxStartAddress);
|
||||||
|
nMissionSlotSfxStartAddress = 0;
|
||||||
|
|
||||||
|
for ( uint32 i = 0; i < MISSION_AUDIO_SLOTS; i++ )
|
||||||
|
nMissionSlotSfx[i] = UINT32_MAX;
|
||||||
|
}
|
||||||
|
|
||||||
if ( gPlayerTalkData != 0 )
|
if ( gPlayerTalkData != 0 )
|
||||||
{
|
{
|
||||||
free(gPlayerTalkData);
|
free(gPlayerTalkData);
|
||||||
gPlayerTalkData = 0;
|
gPlayerTalkData = 0;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
_bSampmanInitialised = FALSE;
|
_bSampmanInitialised = FALSE;
|
||||||
}
|
}
|
||||||
|
@ -1355,32 +1364,50 @@ cSampleManager::IsSampleBankLoaded(uint8 nBank)
|
||||||
return bSampleBankLoaded[nBank];
|
return bSampleBankLoaded[nBank];
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FIX_BUGS
|
|
||||||
bool8
|
bool8
|
||||||
cSampleManager::IsMissionAudioLoaded(uint8 nSlot, uint32 nSample)
|
cSampleManager::IsMissionAudioLoaded(uint8 nSlot, uint32 nSample)
|
||||||
{
|
{
|
||||||
ASSERT(nSlot == MISSION_AUDIO_PLAYER_COMMENT); // only MISSION_AUDIO_PLAYER_COMMENT is supported on PC
|
ASSERT(nSlot != MISSION_AUDIO_POLRADIO_CRIME_OR_COLOR && nSlot != MISSION_AUDIO_POLRADIO_AREA_OR_CAR); // these are not used in LCS
|
||||||
|
|
||||||
|
switch (nSlot)
|
||||||
|
{
|
||||||
|
case MISSION_AUDIO_SLOT_1:
|
||||||
|
case MISSION_AUDIO_SLOT_2:
|
||||||
|
return nMissionSlotSfx[nSlot] == nSample;
|
||||||
|
case MISSION_AUDIO_PLAYER_COMMENT:
|
||||||
return nSample == gPlayerTalkSfx;
|
return nSample == gPlayerTalkSfx;
|
||||||
}
|
}
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
bool8
|
bool8
|
||||||
cSampleManager::LoadMissionAudio(uint8 nSlot, uint32 nSample)
|
cSampleManager::LoadMissionAudio(uint8 nSlot, uint32 nSample)
|
||||||
{
|
{
|
||||||
ASSERT(nSlot == MISSION_AUDIO_PLAYER_COMMENT); // only MISSION_AUDIO_PLAYER_COMMENT is supported on PC
|
ASSERT(nSlot != MISSION_AUDIO_POLRADIO_CRIME_OR_COLOR && nSlot != MISSION_AUDIO_POLRADIO_AREA_OR_CAR); // these are not used in LCS
|
||||||
ASSERT(nSample < TOTAL_AUDIO_SAMPLES);
|
ASSERT(nSample < TOTAL_AUDIO_SAMPLES);
|
||||||
|
|
||||||
if (fseek(fpSampleDataHandle, m_aSamples[nSample].nOffset, SEEK_SET) != 0)
|
if (fseek(fpSampleDataHandle, m_aSamples[nSample].nOffset, SEEK_SET) != 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
switch (nSlot)
|
||||||
|
{
|
||||||
|
case MISSION_AUDIO_SLOT_1:
|
||||||
|
case MISSION_AUDIO_SLOT_2:
|
||||||
|
if (fread((void*)(nMissionSlotSfxStartAddress + nSlot*MISSION_AUDIO_BLOCKSIZE), 1, m_aSamples[nSample].nSize, fpSampleDataHandle) != m_aSamples[nSample].nSize)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
nMissionSlotSfx[nSlot] = nSample;
|
||||||
|
break;
|
||||||
|
case MISSION_AUDIO_PLAYER_COMMENT:
|
||||||
if (fread(gPlayerTalkData, 1, m_aSamples[nSample].nSize, fpSampleDataHandle) != m_aSamples[nSample].nSize)
|
if (fread(gPlayerTalkData, 1, m_aSamples[nSample].nSize, fpSampleDataHandle) != m_aSamples[nSample].nSize)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
gPlayerTalkSfx = nSample;
|
gPlayerTalkSfx = nSample;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
bool8
|
bool8
|
||||||
cSampleManager::IsPedCommentLoaded(uint32 nComment)
|
cSampleManager::IsPedCommentLoaded(uint32 nComment)
|
||||||
|
@ -1616,7 +1643,6 @@ cSampleManager::InitialiseChannel(uint32 nChannel, uint32 nSfx, uint8 nBank)
|
||||||
|
|
||||||
addr = nSampleBankMemoryStartAddress[nBank] + m_aSamples[nSfx].nOffset - m_aSamples[BankStartOffset[nBank]].nOffset;
|
addr = nSampleBankMemoryStartAddress[nBank] + m_aSamples[nSfx].nOffset - m_aSamples[BankStartOffset[nBank]].nOffset;
|
||||||
}
|
}
|
||||||
#ifdef FIX_BUGS
|
|
||||||
else if ( nSfx >= PLAYER_COMMENTS_START && nSfx <= PLAYER_COMMENTS_END )
|
else if ( nSfx >= PLAYER_COMMENTS_START && nSfx <= PLAYER_COMMENTS_END )
|
||||||
{
|
{
|
||||||
if ( !IsMissionAudioLoaded(MISSION_AUDIO_PLAYER_COMMENT, nSfx) )
|
if ( !IsMissionAudioLoaded(MISSION_AUDIO_PLAYER_COMMENT, nSfx) )
|
||||||
|
@ -1624,9 +1650,15 @@ cSampleManager::InitialiseChannel(uint32 nChannel, uint32 nSfx, uint8 nBank)
|
||||||
|
|
||||||
addr = (uintptr)gPlayerTalkData;
|
addr = (uintptr)gPlayerTalkData;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
for ( uint32 i = 0; i < MISSION_AUDIO_SLOTS; i++ ) {
|
||||||
|
if ( IsMissionAudioLoaded(i, nSfx) ) {
|
||||||
|
addr = nMissionSlotSfxStartAddress + i * MISSION_AUDIO_BLOCKSIZE;
|
||||||
|
goto MissionAudioFound;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ( !IsPedCommentLoaded(nSfx) )
|
if ( !IsPedCommentLoaded(nSfx) )
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
@ -1634,6 +1666,7 @@ cSampleManager::InitialiseChannel(uint32 nChannel, uint32 nSfx, uint8 nBank)
|
||||||
addr = (nSampleBankMemoryStartAddress[SFX_BANK_PED_COMMENTS] + PED_BLOCKSIZE * slot);
|
addr = (nSampleBankMemoryStartAddress[SFX_BANK_PED_COMMENTS] + PED_BLOCKSIZE * slot);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MissionAudioFound:
|
||||||
if ( GetChannelUsedFlag(nChannel) )
|
if ( GetChannelUsedFlag(nChannel) )
|
||||||
{
|
{
|
||||||
TRACE("Stopping channel %d - really!!!", nChannel);
|
TRACE("Stopping channel %d - really!!!", nChannel);
|
||||||
|
|
Loading…
Reference in a new issue