mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-18 10:21:42 +00:00
- Applied VoidMage's OpenAL patch.
This commit is contained in:
parent
97d7b1e59e
commit
2142e857a9
2 changed files with 23 additions and 5 deletions
|
@ -1866,7 +1866,7 @@ float OpenALSoundRenderer::GetOutputRate()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SoundHandle OpenALSoundRenderer::LoadSoundRaw(BYTE *sfxdata, int length, int frequency, int channels, int bits, int loopstart)
|
SoundHandle OpenALSoundRenderer::LoadSoundRaw(BYTE *sfxdata, int length, int frequency, int channels, int bits, int loopstart, int loopend)
|
||||||
{
|
{
|
||||||
SoundHandle retval = { NULL };
|
SoundHandle retval = { NULL };
|
||||||
|
|
||||||
|
@ -1915,7 +1915,7 @@ SoundHandle OpenALSoundRenderer::LoadSoundRaw(BYTE *sfxdata, int length, int fre
|
||||||
{
|
{
|
||||||
ALint loops[2] = {
|
ALint loops[2] = {
|
||||||
loopstart,
|
loopstart,
|
||||||
length / (channels*bits/8)
|
loopend == -1 ? length / (channels*bits/8) : loopend
|
||||||
};
|
};
|
||||||
Printf("Setting loop points %d -> %d\n", loops[0], loops[1]);
|
Printf("Setting loop points %d -> %d\n", loops[0], loops[1]);
|
||||||
alBufferiv(buffer, AL_LOOP_POINTS, loops);
|
alBufferiv(buffer, AL_LOOP_POINTS, loops);
|
||||||
|
@ -2346,6 +2346,21 @@ void OpenALSoundRenderer::StopChannel(FISoundChannel *chan)
|
||||||
FreeSfx.push_back(source);
|
FreeSfx.push_back(source);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OpenALSoundRenderer::ChannelVolume(FISoundChannel *chan, float volume)
|
||||||
|
{
|
||||||
|
if (chan != NULL && chan->SysChannel != NULL)
|
||||||
|
{
|
||||||
|
ALuint source = *((ALuint*)chan->SysChannel);
|
||||||
|
|
||||||
|
alcSuspendContext(Context);
|
||||||
|
alSourcef(source, AL_MAX_GAIN, volume);
|
||||||
|
if(chan->ManualGain)
|
||||||
|
volume *= GetRolloff(&chan->Rolloff, sqrt(chan->DistanceSqr));
|
||||||
|
alSourcef(source, AL_GAIN, volume);
|
||||||
|
}
|
||||||
|
getALError();
|
||||||
|
}
|
||||||
|
|
||||||
unsigned int OpenALSoundRenderer::GetPosition(FISoundChannel *chan)
|
unsigned int OpenALSoundRenderer::GetPosition(FISoundChannel *chan)
|
||||||
{
|
{
|
||||||
if(chan == NULL || chan->SysChannel == NULL)
|
if(chan == NULL || chan->SysChannel == NULL)
|
||||||
|
@ -2384,7 +2399,7 @@ void OpenALSoundRenderer::SetSfxPaused(bool paused, int slot)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OpenALSoundRenderer::SetInactive(bool inactive)
|
void OpenALSoundRenderer::SetInactive(SoundRenderer::EInactiveState inactive)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -82,7 +82,7 @@ public:
|
||||||
virtual void SetSfxVolume(float volume);
|
virtual void SetSfxVolume(float volume);
|
||||||
virtual void SetMusicVolume(float volume);
|
virtual void SetMusicVolume(float volume);
|
||||||
virtual SoundHandle LoadSound(BYTE *sfxdata, int length);
|
virtual SoundHandle LoadSound(BYTE *sfxdata, int length);
|
||||||
virtual SoundHandle LoadSoundRaw(BYTE *sfxdata, int length, int frequency, int channels, int bits, int loopstart);
|
virtual SoundHandle LoadSoundRaw(BYTE *sfxdata, int length, int frequency, int channels, int bits, int loopstart, int loopend = -1);
|
||||||
virtual void UnloadSound(SoundHandle sfx);
|
virtual void UnloadSound(SoundHandle sfx);
|
||||||
virtual unsigned int GetMSLength(SoundHandle sfx);
|
virtual unsigned int GetMSLength(SoundHandle sfx);
|
||||||
virtual unsigned int GetSampleLength(SoundHandle sfx);
|
virtual unsigned int GetSampleLength(SoundHandle sfx);
|
||||||
|
@ -99,6 +99,9 @@ public:
|
||||||
// Stops a sound channel.
|
// Stops a sound channel.
|
||||||
virtual void StopChannel(FISoundChannel *chan);
|
virtual void StopChannel(FISoundChannel *chan);
|
||||||
|
|
||||||
|
// Changes a channel's volume.
|
||||||
|
void ChannelVolume (FISoundChannel *chan, float volume);
|
||||||
|
|
||||||
// Returns position of sound on this channel, in samples.
|
// Returns position of sound on this channel, in samples.
|
||||||
virtual unsigned int GetPosition(FISoundChannel *chan);
|
virtual unsigned int GetPosition(FISoundChannel *chan);
|
||||||
|
|
||||||
|
@ -109,7 +112,7 @@ public:
|
||||||
virtual void SetSfxPaused(bool paused, int slot);
|
virtual void SetSfxPaused(bool paused, int slot);
|
||||||
|
|
||||||
// Pauses or resumes *every* channel, including environmental reverb.
|
// Pauses or resumes *every* channel, including environmental reverb.
|
||||||
virtual void SetInactive(bool inactive);
|
virtual void SetInactive(SoundRenderer::EInactiveState inactive);
|
||||||
|
|
||||||
// Updates the volume, separation, and pitch of a sound channel.
|
// Updates the volume, separation, and pitch of a sound channel.
|
||||||
virtual void UpdateSoundParams3D(SoundListener *listener, FISoundChannel *chan, bool areasound, const FVector3 &pos, const FVector3 &vel);
|
virtual void UpdateSoundParams3D(SoundListener *listener, FISoundChannel *chan, bool areasound, const FVector3 &pos, const FVector3 &vel);
|
||||||
|
|
Loading…
Reference in a new issue