1
0
Fork 0
mirror of https://git.rip/DMCA_FUCKER/re3.git synced 2024-12-23 19:40:00 +00:00

Merge branch 'miami' of https://github.com/GTAmodding/re3 into miami

This commit is contained in:
majestic 2020-10-05 04:44:02 -07:00
commit fd0602a9ac
4 changed files with 15 additions and 14 deletions

View file

@ -161,10 +161,10 @@ cMusicManager::SetStartingTrackPositions(uint8 isNewGameTimer)
if (i < STREAMED_SOUND_CITY_AMBIENT && isNewGameTimer) if (i < STREAMED_SOUND_CITY_AMBIENT && isNewGameTimer)
m_aTracks[i].m_nPosition = NewGameRadioTimers[i]; m_aTracks[i].m_nPosition = NewGameRadioTimers[i];
else if (i < STREAMED_SOUND_ANNOUNCE_BRIDGE_CLOSED) else if (i < STREAMED_SOUND_ANNOUNCE_BRIDGE_CLOSED)
m_aTracks[i].m_nPosition = pos * AudioManager.GetRandomNumber(i % 5) % m_aTracks[i].m_nLength; m_aTracks[i].m_nPosition = (pos * AudioManager.GetRandomNumber(i % 5)) % m_aTracks[i].m_nLength;
else else
m_aTracks[i].m_nPosition = 0; m_aTracks[i].m_nPosition = 0;
m_aTracks[i].m_nLastPosCheckTimer = CTimer::GetTimeInMillisecondsPauseMode(); m_aTracks[i].m_nLastPosCheckTimer = CTimer::GetTimeInMillisecondsPauseMode();
} }
} }
@ -1311,4 +1311,4 @@ cMusicManager::ChangeRadioChannel()
// these two are empty // these two are empty
void cMusicManager::Enable() {} void cMusicManager::Enable() {}
void cMusicManager::Disable() {} void cMusicManager::Disable() {}

View file

@ -162,13 +162,13 @@ public:
void Seek(uint32 milliseconds) void Seek(uint32 milliseconds)
{ {
if ( !IsOpened() ) return; if ( !IsOpened() ) return;
mpg123_seek(m_pMH, ms2samples(milliseconds)*GetSampleSize(), SEEK_SET); mpg123_seek(m_pMH, ms2samples(milliseconds), SEEK_SET);
} }
uint32 Tell() uint32 Tell()
{ {
if ( !IsOpened() ) return 0; if ( !IsOpened() ) return 0;
return samples2ms(mpg123_tell(m_pMH)/GetSampleSize()); return samples2ms(mpg123_tell(m_pMH));
} }
uint32 Decode(void *buffer) uint32 Decode(void *buffer)
@ -254,13 +254,13 @@ public:
void Seek(uint32 milliseconds) void Seek(uint32 milliseconds)
{ {
if ( !IsOpened() ) return; if ( !IsOpened() ) return;
op_pcm_seek(m_FileH, ms2samples(milliseconds) * GetSampleSize()); op_pcm_seek(m_FileH, ms2samples(milliseconds) / GetChannels());
} }
uint32 Tell() uint32 Tell()
{ {
if ( !IsOpened() ) return 0; if ( !IsOpened() ) return 0;
return samples2ms(op_pcm_tell(m_FileH)/GetSampleSize()); return samples2ms(op_pcm_tell(m_FileH) * GetChannels());
} }
uint32 Decode(void *buffer) uint32 Decode(void *buffer)
@ -515,8 +515,8 @@ uint32 CStream::GetPosMS()
alGetSourcei(m_alSource, AL_BYTE_OFFSET, &offset); alGetSourcei(m_alSource, AL_BYTE_OFFSET, &offset);
return m_pSoundFile->Tell() return m_pSoundFile->Tell()
- m_pSoundFile->samples2ms(m_pSoundFile->GetBufferSamples() * (NUM_STREAMBUFFERS-1)) - m_pSoundFile->samples2ms(m_pSoundFile->GetBufferSamples() * (NUM_STREAMBUFFERS-1)) / m_pSoundFile->GetChannels()
+ m_pSoundFile->samples2ms(offset/m_pSoundFile->GetSampleSize()); + m_pSoundFile->samples2ms(offset/m_pSoundFile->GetSampleSize()) / m_pSoundFile->GetChannels();
} }
uint32 CStream::GetLengthMS() uint32 CStream::GetLengthMS()

View file

@ -24,12 +24,12 @@ public:
uint32 ms2samples(uint32 ms) uint32 ms2samples(uint32 ms)
{ {
return float(ms) / 1000.0f * float(GetChannels()) * float(GetSampleRate()); return float(ms) / 1000.0f * float(GetSampleRate());
} }
uint32 samples2ms(uint32 sm) uint32 samples2ms(uint32 sm)
{ {
return float(sm) * 1000.0f / float(GetChannels()) / float(GetSampleRate()); return float(sm) * 1000.0f / float(GetSampleRate());
} }
uint32 GetBufferSamples() uint32 GetBufferSamples()
@ -108,4 +108,4 @@ public:
void ProviderTerm(); void ProviderTerm();
}; };
#endif #endif

View file

@ -27,6 +27,7 @@
#include "MusicManager.h" #include "MusicManager.h"
#include "Frontend.h" #include "Frontend.h"
#include "Timer.h" #include "Timer.h"
#include "crossplatform.h"
#ifdef AUDIO_OPUS #ifdef AUDIO_OPUS
#include <opusfile.h> #include <opusfile.h>
#endif #endif
@ -1462,11 +1463,11 @@ cSampleManager::InitialiseSampleBanks(void)
{ {
int32 nBank = SFX_BANK_0; int32 nBank = SFX_BANK_0;
fpSampleDescHandle = fopen(SampleBankDescFilename, "rb"); fpSampleDescHandle = fcaseopen(SampleBankDescFilename, "rb");
if ( fpSampleDescHandle == NULL ) if ( fpSampleDescHandle == NULL )
return false; return false;
#ifndef AUDIO_OPUS #ifndef AUDIO_OPUS
fpSampleDataHandle = fopen(SampleBankDataFilename, "rb"); fpSampleDataHandle = fcaseopen(SampleBankDataFilename, "rb");
if ( fpSampleDataHandle == NULL ) if ( fpSampleDataHandle == NULL )
{ {
fclose(fpSampleDescHandle); fclose(fpSampleDescHandle);