mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-15 18:39:51 +00:00
Pass the mode flags to the sound output play methods
This commit is contained in:
parent
b2d7dca8c3
commit
575474ff69
@ -606,7 +606,7 @@ void OpenAL_Output::bufferFinished(ALuint buf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SoundPtr OpenAL_Output::playSound(const std::string &fname, float volume, float pitch, bool loop)
|
SoundPtr OpenAL_Output::playSound(const std::string &fname, float volume, float pitch, int flags)
|
||||||
{
|
{
|
||||||
boost::shared_ptr<OpenAL_Sound> sound;
|
boost::shared_ptr<OpenAL_Sound> sound;
|
||||||
ALuint src=0, buf=0;
|
ALuint src=0, buf=0;
|
||||||
@ -642,7 +642,7 @@ SoundPtr OpenAL_Output::playSound(const std::string &fname, float volume, float
|
|||||||
alSourcef(src, AL_PITCH, pitch);
|
alSourcef(src, AL_PITCH, pitch);
|
||||||
|
|
||||||
alSourcei(src, AL_SOURCE_RELATIVE, AL_TRUE);
|
alSourcei(src, AL_SOURCE_RELATIVE, AL_TRUE);
|
||||||
alSourcei(src, AL_LOOPING, (loop?AL_TRUE:AL_FALSE));
|
alSourcei(src, AL_LOOPING, (flags&Play_Loop) ? AL_TRUE : AL_FALSE);
|
||||||
throwALerror();
|
throwALerror();
|
||||||
|
|
||||||
alSourcei(src, AL_BUFFER, buf);
|
alSourcei(src, AL_BUFFER, buf);
|
||||||
@ -653,7 +653,7 @@ SoundPtr OpenAL_Output::playSound(const std::string &fname, float volume, float
|
|||||||
}
|
}
|
||||||
|
|
||||||
SoundPtr OpenAL_Output::playSound3D(const std::string &fname, const Ogre::Vector3 &pos, float volume, float pitch,
|
SoundPtr OpenAL_Output::playSound3D(const std::string &fname, const Ogre::Vector3 &pos, float volume, float pitch,
|
||||||
float min, float max, bool loop)
|
float min, float max, int flags)
|
||||||
{
|
{
|
||||||
boost::shared_ptr<OpenAL_Sound> sound;
|
boost::shared_ptr<OpenAL_Sound> sound;
|
||||||
ALuint src=0, buf=0;
|
ALuint src=0, buf=0;
|
||||||
@ -690,7 +690,7 @@ SoundPtr OpenAL_Output::playSound3D(const std::string &fname, const Ogre::Vector
|
|||||||
alSourcef(src, AL_PITCH, pitch);
|
alSourcef(src, AL_PITCH, pitch);
|
||||||
|
|
||||||
alSourcei(src, AL_SOURCE_RELATIVE, AL_FALSE);
|
alSourcei(src, AL_SOURCE_RELATIVE, AL_FALSE);
|
||||||
alSourcei(src, AL_LOOPING, (loop?AL_TRUE:AL_FALSE));
|
alSourcei(src, AL_LOOPING, (flags&Play_Loop) ? AL_TRUE : AL_FALSE);
|
||||||
throwALerror();
|
throwALerror();
|
||||||
|
|
||||||
alSourcei(src, AL_BUFFER, buf);
|
alSourcei(src, AL_BUFFER, buf);
|
||||||
|
@ -40,9 +40,9 @@ namespace MWSound
|
|||||||
virtual void init(const std::string &devname="");
|
virtual void init(const std::string &devname="");
|
||||||
virtual void deinit();
|
virtual void deinit();
|
||||||
|
|
||||||
virtual SoundPtr playSound(const std::string &fname, float volume, float pitch, bool loop);
|
virtual SoundPtr playSound(const std::string &fname, float volume, float pitch, int flags);
|
||||||
virtual SoundPtr playSound3D(const std::string &fname, const Ogre::Vector3 &pos,
|
virtual SoundPtr playSound3D(const std::string &fname, const Ogre::Vector3 &pos,
|
||||||
float volume, float pitch, float min, float max, bool loop);
|
float volume, float pitch, float min, float max, int flags);
|
||||||
virtual SoundPtr streamSound(const std::string &fname, float volume, float pitch);
|
virtual SoundPtr streamSound(const std::string &fname, float volume, float pitch);
|
||||||
|
|
||||||
virtual void updateListener(const Ogre::Vector3 &pos, const Ogre::Vector3 &atdir, const Ogre::Vector3 &updir);
|
virtual void updateListener(const Ogre::Vector3 &pos, const Ogre::Vector3 &atdir, const Ogre::Vector3 &updir);
|
||||||
|
@ -18,6 +18,7 @@ namespace MWSound
|
|||||||
float mBaseVolume;
|
float mBaseVolume;
|
||||||
float mMinDistance;
|
float mMinDistance;
|
||||||
float mMaxDistance;
|
float mMaxDistance;
|
||||||
|
int mFlags;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual void stop() = 0;
|
virtual void stop() = 0;
|
||||||
@ -30,6 +31,7 @@ namespace MWSound
|
|||||||
, mBaseVolume(1.0f)
|
, mBaseVolume(1.0f)
|
||||||
, mMinDistance(20.0f) /* 1 * min_range_scale */
|
, mMinDistance(20.0f) /* 1 * min_range_scale */
|
||||||
, mMaxDistance(12750.0f) /* 255 * max_range_scale */
|
, mMaxDistance(12750.0f) /* 255 * max_range_scale */
|
||||||
|
, mFlags(Play_Normal)
|
||||||
{ }
|
{ }
|
||||||
virtual ~Sound() { }
|
virtual ~Sound() { }
|
||||||
|
|
||||||
|
@ -24,9 +24,9 @@ namespace MWSound
|
|||||||
virtual void init(const std::string &devname="") = 0;
|
virtual void init(const std::string &devname="") = 0;
|
||||||
virtual void deinit() = 0;
|
virtual void deinit() = 0;
|
||||||
|
|
||||||
virtual SoundPtr playSound(const std::string &fname, float volume, float pitch, bool loop) = 0;
|
virtual SoundPtr playSound(const std::string &fname, float volume, float pitch, int flags) = 0;
|
||||||
virtual SoundPtr playSound3D(const std::string &fname, const Ogre::Vector3 &pos,
|
virtual SoundPtr playSound3D(const std::string &fname, const Ogre::Vector3 &pos,
|
||||||
float volume, float pitch, float min, float max, bool loop) = 0;
|
float volume, float pitch, float min, float max, int flags) = 0;
|
||||||
virtual SoundPtr streamSound(const std::string &fname, float volume, float pitch) = 0;
|
virtual SoundPtr streamSound(const std::string &fname, float volume, float pitch) = 0;
|
||||||
|
|
||||||
virtual void updateListener(const Ogre::Vector3 &pos, const Ogre::Vector3 &atdir, const Ogre::Vector3 &updir) = 0;
|
virtual void updateListener(const Ogre::Vector3 &pos, const Ogre::Vector3 &atdir, const Ogre::Vector3 &updir) = 0;
|
||||||
|
@ -185,7 +185,7 @@ namespace MWSound
|
|||||||
const Ogre::Vector3 objpos(pos.pos[0], pos.pos[1], pos.pos[2]);
|
const Ogre::Vector3 objpos(pos.pos[0], pos.pos[1], pos.pos[2]);
|
||||||
|
|
||||||
SoundPtr sound = mOutput->playSound3D(filePath, objpos, basevol, 1.0f,
|
SoundPtr sound = mOutput->playSound3D(filePath, objpos, basevol, 1.0f,
|
||||||
20.0f, 12750.0f, false);
|
20.0f, 12750.0f, Play_Normal);
|
||||||
sound->mPos = objpos;
|
sound->mPos = objpos;
|
||||||
sound->mBaseVolume = basevol;
|
sound->mBaseVolume = basevol;
|
||||||
|
|
||||||
@ -212,11 +212,12 @@ namespace MWSound
|
|||||||
float min, max;
|
float min, max;
|
||||||
std::string file = lookup(soundId, basevol, min, max);
|
std::string file = lookup(soundId, basevol, min, max);
|
||||||
|
|
||||||
sound = mOutput->playSound(file, volume*basevol, pitch, mode&Play_Loop);
|
sound = mOutput->playSound(file, volume*basevol, pitch, mode);
|
||||||
sound->mVolume = volume;
|
sound->mVolume = volume;
|
||||||
sound->mBaseVolume = basevol;
|
sound->mBaseVolume = basevol;
|
||||||
sound->mMinDistance = min;
|
sound->mMinDistance = min;
|
||||||
sound->mMaxDistance = max;
|
sound->mMaxDistance = max;
|
||||||
|
sound->mFlags = mode;
|
||||||
|
|
||||||
mActiveSounds[sound] = std::make_pair(MWWorld::Ptr(), soundId);
|
mActiveSounds[sound] = std::make_pair(MWWorld::Ptr(), soundId);
|
||||||
}
|
}
|
||||||
@ -240,12 +241,13 @@ namespace MWSound
|
|||||||
const ESM::Position &pos = ptr.getCellRef().pos;
|
const ESM::Position &pos = ptr.getCellRef().pos;
|
||||||
const Ogre::Vector3 objpos(pos.pos[0], pos.pos[1], pos.pos[2]);
|
const Ogre::Vector3 objpos(pos.pos[0], pos.pos[1], pos.pos[2]);
|
||||||
|
|
||||||
sound = mOutput->playSound3D(file, objpos, volume*basevol, pitch, min, max, mode&Play_Loop);
|
sound = mOutput->playSound3D(file, objpos, volume*basevol, pitch, min, max, mode);
|
||||||
sound->mPos = objpos;
|
sound->mPos = objpos;
|
||||||
sound->mVolume = volume;
|
sound->mVolume = volume;
|
||||||
sound->mBaseVolume = basevol;
|
sound->mBaseVolume = basevol;
|
||||||
sound->mMinDistance = min;
|
sound->mMinDistance = min;
|
||||||
sound->mMaxDistance = max;
|
sound->mMaxDistance = max;
|
||||||
|
sound->mFlags = mode;
|
||||||
|
|
||||||
if((mode&Play_NoTrack))
|
if((mode&Play_NoTrack))
|
||||||
mActiveSounds[sound] = std::make_pair(MWWorld::Ptr(), soundId);
|
mActiveSounds[sound] = std::make_pair(MWWorld::Ptr(), soundId);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user