mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-02 08:15:52 +00:00
Added sound range function
This commit is contained in:
parent
49f0e4b75f
commit
3db61c8bdd
5 changed files with 19 additions and 0 deletions
|
@ -25,6 +25,8 @@ namespace Mangle
|
||||||
{ client->setPos(x,y,z); }
|
{ client->setPos(x,y,z); }
|
||||||
void setPitch(float p) { client->setPitch(p); }
|
void setPitch(float p) { client->setPitch(p); }
|
||||||
void setRepeat(bool b) { client->setRepeat(b); }
|
void setRepeat(bool b) { client->setRepeat(b); }
|
||||||
|
void setRange(float a, float b=0, float c=0)
|
||||||
|
{ client->setRange(a,b,c); }
|
||||||
void setStreaming(bool b) { client->setStreaming(b); }
|
void setStreaming(bool b) { client->setStreaming(b); }
|
||||||
|
|
||||||
// The clone() function is not implemented here, as you will
|
// The clone() function is not implemented here, as you will
|
||||||
|
|
|
@ -51,6 +51,10 @@ class Sound
|
||||||
/// Set pitch (1.0 is normal speed)
|
/// Set pitch (1.0 is normal speed)
|
||||||
virtual void setPitch(float) = 0;
|
virtual void setPitch(float) = 0;
|
||||||
|
|
||||||
|
/// Set range factors for 3D sounds. The meaning of the fields
|
||||||
|
/// depend on implementation.
|
||||||
|
virtual void setRange(float a, float b=0.0, float c=0.0) = 0;
|
||||||
|
|
||||||
/// Set the position. May not work with all backends.
|
/// Set the position. May not work with all backends.
|
||||||
virtual void setPos(float x, float y, float z) = 0;
|
virtual void setPos(float x, float y, float z) = 0;
|
||||||
|
|
||||||
|
|
|
@ -140,6 +140,13 @@ void OpenAL_Sound::setVolume(float volume)
|
||||||
checkALError("setting volume");
|
checkALError("setting volume");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OpenAL_Sound::setRange(float a, float b, float)
|
||||||
|
{
|
||||||
|
alSourcef(inst, AL_REFERENCE_DISTANCE, a);
|
||||||
|
alSourcef(inst, AL_MAX_DISTANCE, b);
|
||||||
|
checkALError("setting sound ranges");
|
||||||
|
}
|
||||||
|
|
||||||
void OpenAL_Sound::setPos(float x, float y, float z)
|
void OpenAL_Sound::setPos(float x, float y, float z)
|
||||||
{
|
{
|
||||||
alSource3f(inst, AL_POSITION, x, y, z);
|
alSource3f(inst, AL_POSITION, x, y, z);
|
||||||
|
|
|
@ -41,6 +41,11 @@ class OpenAL_Sound : public Sound
|
||||||
void setStreaming(bool) {} // Not implemented yet
|
void setStreaming(bool) {} // Not implemented yet
|
||||||
SoundPtr clone() const;
|
SoundPtr clone() const;
|
||||||
|
|
||||||
|
// a = AL_REFERENCE_DISTANCE
|
||||||
|
// b = AL_MAX_DISTANCE
|
||||||
|
// c = ignored
|
||||||
|
void setRange(float a, float b=0.0, float c=0.0);
|
||||||
|
|
||||||
/// Not implemented
|
/// Not implemented
|
||||||
void setPan(float) {}
|
void setPan(float) {}
|
||||||
};
|
};
|
||||||
|
|
1
sound/tests/output/openal_mpg123_test.out
Normal file
1
sound/tests/output/openal_mpg123_test.out
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Please specify an MP3 file
|
Loading…
Reference in a new issue