mirror of
https://github.com/GTAmodding/re3.git
synced 2024-12-25 16:15:40 +00:00
Fix quiet police scanner on OpenAL
This commit is contained in:
parent
3a7cb9c5ce
commit
0c41734c20
2 changed files with 19 additions and 1 deletions
|
@ -17,6 +17,8 @@ bool bChannelsCreated = false;
|
||||||
|
|
||||||
int32 CChannel::channelsThatNeedService = 0;
|
int32 CChannel::channelsThatNeedService = 0;
|
||||||
|
|
||||||
|
uint8 tempStereoBuffer[PED_BLOCKSIZE * 2];
|
||||||
|
|
||||||
void
|
void
|
||||||
CChannel::InitChannels()
|
CChannel::InitChannels()
|
||||||
{
|
{
|
||||||
|
@ -50,6 +52,7 @@ CChannel::CChannel()
|
||||||
{
|
{
|
||||||
Data = nil;
|
Data = nil;
|
||||||
DataSize = 0;
|
DataSize = 0;
|
||||||
|
bIs2D = false;
|
||||||
SetDefault();
|
SetDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,6 +93,7 @@ void CChannel::Init(uint32 _id, bool Is2D)
|
||||||
|
|
||||||
if ( Is2D )
|
if ( Is2D )
|
||||||
{
|
{
|
||||||
|
bIs2D = true;
|
||||||
alSource3f(alSources[id], AL_POSITION, 0.0f, 0.0f, 0.0f);
|
alSource3f(alSources[id], AL_POSITION, 0.0f, 0.0f, 0.0f);
|
||||||
alSourcef(alSources[id], AL_GAIN, 1.0f);
|
alSourcef(alSources[id], AL_GAIN, 1.0f);
|
||||||
}
|
}
|
||||||
|
@ -113,6 +117,19 @@ void CChannel::Start()
|
||||||
if ( !HasSource() ) return;
|
if ( !HasSource() ) return;
|
||||||
if ( !Data ) return;
|
if ( !Data ) return;
|
||||||
|
|
||||||
|
if ( bIs2D )
|
||||||
|
{
|
||||||
|
// convert mono data to stereo
|
||||||
|
int16 *monoData = (int16*)Data;
|
||||||
|
int16 *stereoData = (int16*)tempStereoBuffer;
|
||||||
|
for (size_t i = 0; i < DataSize / 2; i++)
|
||||||
|
{
|
||||||
|
*(stereoData++) = *monoData;
|
||||||
|
*(stereoData++) = *(monoData++);
|
||||||
|
}
|
||||||
|
alBufferData(alBuffers[id], AL_FORMAT_STEREO16, tempStereoBuffer, DataSize * 2, Frequency);
|
||||||
|
}
|
||||||
|
else
|
||||||
alBufferData(alBuffers[id], AL_FORMAT_MONO16, Data, DataSize, Frequency);
|
alBufferData(alBuffers[id], AL_FORMAT_MONO16, Data, DataSize, Frequency);
|
||||||
if ( LoopPoints[0] != 0 && LoopPoints[0] != -1 )
|
if ( LoopPoints[0] != 0 && LoopPoints[0] != -1 )
|
||||||
alBufferiv(alBuffers[id], AL_LOOP_POINTS_SOFT, LoopPoints);
|
alBufferiv(alBuffers[id], AL_LOOP_POINTS_SOFT, LoopPoints);
|
||||||
|
|
|
@ -20,6 +20,7 @@ class CChannel
|
||||||
int32 LoopCount;
|
int32 LoopCount;
|
||||||
ALint LoopPoints[2];
|
ALint LoopPoints[2];
|
||||||
ALint LastProcessedOffset;
|
ALint LastProcessedOffset;
|
||||||
|
bool bIs2D;
|
||||||
public:
|
public:
|
||||||
static int32 channelsThatNeedService;
|
static int32 channelsThatNeedService;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue