mirror of
https://github.com/GTAmodding/re3.git
synced 2024-12-25 06:55:42 +00:00
Merge branch 'master' of https://github.com/GTAmodding/re3
This commit is contained in:
commit
c5a61b3d3b
4 changed files with 22 additions and 16 deletions
|
@ -155,13 +155,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)
|
||||||
|
@ -247,13 +247,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)
|
||||||
|
@ -461,8 +461,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()
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
@ -1423,11 +1424,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);
|
||||||
|
|
|
@ -2556,12 +2556,17 @@ CStreaming::DeleteRwObjectsNotInFrustumInSectorList(CPtrList &list, size_t mem)
|
||||||
void
|
void
|
||||||
CStreaming::MakeSpaceFor(int32 size)
|
CStreaming::MakeSpaceFor(int32 size)
|
||||||
{
|
{
|
||||||
// BUG: ms_memoryAvailable can be uninitialized
|
#ifdef FIX_BUGS
|
||||||
// the code still happens to work in that case because ms_memoryAvailable is unsigned
|
#define MB (1024 * 1024)
|
||||||
// but it's not nice....
|
if(ms_memoryAvailable == 0) {
|
||||||
|
extern size_t _dwMemAvailPhys;
|
||||||
|
ms_memoryAvailable = (_dwMemAvailPhys - 10 * MB) / 2;
|
||||||
|
if(ms_memoryAvailable < 50 * MB) ms_memoryAvailable = 50 * MB;
|
||||||
|
}
|
||||||
|
#undef MB
|
||||||
|
#endif
|
||||||
while(ms_memoryUsed >= ms_memoryAvailable - size)
|
while(ms_memoryUsed >= ms_memoryAvailable - size)
|
||||||
if(!RemoveLeastUsedModel()){
|
if(!RemoveLeastUsedModel()) {
|
||||||
DeleteRwObjectsBehindCamera(ms_memoryAvailable - size);
|
DeleteRwObjectsBehindCamera(ms_memoryAvailable - size);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue