1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-22 16:53:52 +00:00

Added sound range function

This commit is contained in:
Nicolay Korslund 2010-08-14 18:50:42 +02:00
parent 49f0e4b75f
commit 3db61c8bdd
5 changed files with 19 additions and 0 deletions

View file

@ -25,6 +25,8 @@ namespace Mangle
{ client->setPos(x,y,z); }
void setPitch(float p) { client->setPitch(p); }
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); }
// The clone() function is not implemented here, as you will

View file

@ -51,6 +51,10 @@ class Sound
/// Set pitch (1.0 is normal speed)
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.
virtual void setPos(float x, float y, float z) = 0;

View file

@ -140,6 +140,13 @@ void OpenAL_Sound::setVolume(float 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)
{
alSource3f(inst, AL_POSITION, x, y, z);

View file

@ -41,6 +41,11 @@ class OpenAL_Sound : public Sound
void setStreaming(bool) {} // Not implemented yet
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
void setPan(float) {}
};

View file

@ -0,0 +1 @@
Please specify an MP3 file