mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-16 21:59:55 +00:00
Merge remote branch 'chris/sound'
This commit is contained in:
commit
b7614dd0ce
3 changed files with 18 additions and 0 deletions
|
@ -508,6 +508,8 @@ void OpenAL_Output::init(const std::string &devname)
|
|||
}
|
||||
if(mFreeSources.empty())
|
||||
fail("Could not allocate any sources");
|
||||
|
||||
mInitialized = true;
|
||||
}
|
||||
|
||||
void OpenAL_Output::deinit()
|
||||
|
@ -535,6 +537,8 @@ void OpenAL_Output::deinit()
|
|||
if(mDevice)
|
||||
alcCloseDevice(mDevice);
|
||||
mDevice = 0;
|
||||
|
||||
mInitialized = false;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -35,15 +35,19 @@ namespace MWSound
|
|||
Sound_Output(const Sound_Output &rhs);
|
||||
|
||||
protected:
|
||||
bool mInitialized;
|
||||
Ogre::Vector3 mPos;
|
||||
|
||||
Sound_Output(SoundManager &mgr)
|
||||
: mManager(mgr)
|
||||
, mInitialized(false)
|
||||
, mPos(0.0f, 0.0f, 0.0f)
|
||||
{ }
|
||||
public:
|
||||
virtual ~Sound_Output() { }
|
||||
|
||||
bool isInitialized() { return mInitialized; }
|
||||
|
||||
friend class OpenAL_Output;
|
||||
friend class SoundManager;
|
||||
};
|
||||
|
|
|
@ -136,6 +136,8 @@ namespace MWSound
|
|||
|
||||
void SoundManager::streamMusicFull(const std::string& filename)
|
||||
{
|
||||
if(!mOutput->isInitialized())
|
||||
return;
|
||||
std::cout <<"Playing "<<filename<< std::endl;
|
||||
try
|
||||
{
|
||||
|
@ -180,6 +182,8 @@ namespace MWSound
|
|||
|
||||
void SoundManager::say(MWWorld::Ptr ptr, const std::string& filename)
|
||||
{
|
||||
if(!mOutput->isInitialized())
|
||||
return;
|
||||
try
|
||||
{
|
||||
// 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 sound;
|
||||
if(!mOutput->isInitialized())
|
||||
return sound;
|
||||
try
|
||||
{
|
||||
float basevol = 1.0f; /* TODO: volume settings */
|
||||
|
@ -237,6 +243,8 @@ namespace MWSound
|
|||
float volume, float pitch, int mode)
|
||||
{
|
||||
SoundPtr sound;
|
||||
if(!mOutput->isInitialized())
|
||||
return sound;
|
||||
try
|
||||
{
|
||||
// Look up the sound in the ESM data
|
||||
|
@ -450,6 +458,8 @@ namespace MWSound
|
|||
|
||||
void SoundManager::update(float duration)
|
||||
{
|
||||
if(!mOutput->isInitialized())
|
||||
return;
|
||||
updateSounds(duration);
|
||||
updateRegionSound(duration);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue