mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-26 09:35:28 +00:00
Merge remote branch 'chris/sound'
This commit is contained in:
commit
b7614dd0ce
@ -508,6 +508,8 @@ void OpenAL_Output::init(const std::string &devname)
|
|||||||
}
|
}
|
||||||
if(mFreeSources.empty())
|
if(mFreeSources.empty())
|
||||||
fail("Could not allocate any sources");
|
fail("Could not allocate any sources");
|
||||||
|
|
||||||
|
mInitialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OpenAL_Output::deinit()
|
void OpenAL_Output::deinit()
|
||||||
@ -535,6 +537,8 @@ void OpenAL_Output::deinit()
|
|||||||
if(mDevice)
|
if(mDevice)
|
||||||
alcCloseDevice(mDevice);
|
alcCloseDevice(mDevice);
|
||||||
mDevice = 0;
|
mDevice = 0;
|
||||||
|
|
||||||
|
mInitialized = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -35,15 +35,19 @@ namespace MWSound
|
|||||||
Sound_Output(const Sound_Output &rhs);
|
Sound_Output(const Sound_Output &rhs);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
bool mInitialized;
|
||||||
Ogre::Vector3 mPos;
|
Ogre::Vector3 mPos;
|
||||||
|
|
||||||
Sound_Output(SoundManager &mgr)
|
Sound_Output(SoundManager &mgr)
|
||||||
: mManager(mgr)
|
: mManager(mgr)
|
||||||
|
, mInitialized(false)
|
||||||
, mPos(0.0f, 0.0f, 0.0f)
|
, mPos(0.0f, 0.0f, 0.0f)
|
||||||
{ }
|
{ }
|
||||||
public:
|
public:
|
||||||
virtual ~Sound_Output() { }
|
virtual ~Sound_Output() { }
|
||||||
|
|
||||||
|
bool isInitialized() { return mInitialized; }
|
||||||
|
|
||||||
friend class OpenAL_Output;
|
friend class OpenAL_Output;
|
||||||
friend class SoundManager;
|
friend class SoundManager;
|
||||||
};
|
};
|
||||||
|
@ -136,6 +136,8 @@ namespace MWSound
|
|||||||
|
|
||||||
void SoundManager::streamMusicFull(const std::string& filename)
|
void SoundManager::streamMusicFull(const std::string& filename)
|
||||||
{
|
{
|
||||||
|
if(!mOutput->isInitialized())
|
||||||
|
return;
|
||||||
std::cout <<"Playing "<<filename<< std::endl;
|
std::cout <<"Playing "<<filename<< std::endl;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -180,6 +182,8 @@ namespace MWSound
|
|||||||
|
|
||||||
void SoundManager::say(MWWorld::Ptr ptr, const std::string& filename)
|
void SoundManager::say(MWWorld::Ptr ptr, const std::string& filename)
|
||||||
{
|
{
|
||||||
|
if(!mOutput->isInitialized())
|
||||||
|
return;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// The range values are not tested
|
// The range values are not tested
|
||||||
@ -210,6 +214,8 @@ namespace MWSound
|
|||||||
SoundPtr SoundManager::playSound(const std::string& soundId, float volume, float pitch, int mode)
|
SoundPtr SoundManager::playSound(const std::string& soundId, float volume, float pitch, int mode)
|
||||||
{
|
{
|
||||||
SoundPtr sound;
|
SoundPtr sound;
|
||||||
|
if(!mOutput->isInitialized())
|
||||||
|
return sound;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
float basevol = 1.0f; /* TODO: volume settings */
|
float basevol = 1.0f; /* TODO: volume settings */
|
||||||
@ -237,6 +243,8 @@ namespace MWSound
|
|||||||
float volume, float pitch, int mode)
|
float volume, float pitch, int mode)
|
||||||
{
|
{
|
||||||
SoundPtr sound;
|
SoundPtr sound;
|
||||||
|
if(!mOutput->isInitialized())
|
||||||
|
return sound;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Look up the sound in the ESM data
|
// Look up the sound in the ESM data
|
||||||
@ -450,6 +458,8 @@ namespace MWSound
|
|||||||
|
|
||||||
void SoundManager::update(float duration)
|
void SoundManager::update(float duration)
|
||||||
{
|
{
|
||||||
|
if(!mOutput->isInitialized())
|
||||||
|
return;
|
||||||
updateSounds(duration);
|
updateSounds(duration);
|
||||||
updateRegionSound(duration);
|
updateRegionSound(duration);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user