Revert "Started implementing sound time tracking so we can have NPCs' mouths move as they talk."

This reverts commit b897080156.
deque
Kevin Poitra 11 years ago
parent 18314b1707
commit 8516b837ff

@ -100,9 +100,6 @@ namespace MWBase
virtual void stopSay(const MWWorld::Ptr &reference=MWWorld::Ptr()) = 0; virtual void stopSay(const MWWorld::Ptr &reference=MWWorld::Ptr()) = 0;
///< Stop an actor speaking ///< Stop an actor speaking
virtual float getSoundPlayingTime(const MWWorld::Ptr &reference=MWWorld::Ptr()) = 0;
///< Get the amount of time this sound has been playing.
virtual SoundPtr playTrack(const MWSound::DecoderPtr& decoder, PlayType type) = 0; virtual SoundPtr playTrack(const MWSound::DecoderPtr& decoder, PlayType type) = 0;
///< Play a 2D audio track, using a custom decoder ///< Play a 2D audio track, using a custom decoder

@ -244,7 +244,6 @@ namespace MWSound
MWBase::SoundPtr sound = mOutput->playSound3D(filePath, objpos, 1.0f, basevol, 1.0f, MWBase::SoundPtr sound = mOutput->playSound3D(filePath, objpos, 1.0f, basevol, 1.0f,
20.0f, 1500.0f, Play_Normal|Play_TypeVoice, 0); 20.0f, 1500.0f, Play_Normal|Play_TypeVoice, 0);
mActiveSounds[sound] = std::make_pair(ptr, std::string("_say_sound")); mActiveSounds[sound] = std::make_pair(ptr, std::string("_say_sound"));
mSoundPlayTime[sound] = std::make_pair(ptr, 0);
} }
catch(std::exception &e) catch(std::exception &e)
{ {
@ -262,9 +261,7 @@ namespace MWSound
std::string filePath = "Sound/"+filename; std::string filePath = "Sound/"+filename;
MWBase::SoundPtr sound = mOutput->playSound(filePath, 1.0f, basevol, 1.0f, Play_Normal|Play_TypeVoice, 0); MWBase::SoundPtr sound = mOutput->playSound(filePath, 1.0f, basevol, 1.0f, Play_Normal|Play_TypeVoice, 0);
MWWorld::Ptr ptr = MWWorld::Ptr(); mActiveSounds[sound] = std::make_pair(MWWorld::Ptr(), std::string("_say_sound"));
mActiveSounds[sound] = std::make_pair(ptr, std::string("_say_sound"));
mSoundPlayTime[sound] = std::make_pair(ptr, 0);
} }
catch(std::exception &e) catch(std::exception &e)
{ {
@ -291,18 +288,6 @@ namespace MWSound
++snditer; ++snditer;
} }
} }
float SoundManager::getSoundPlayingTime(const MWWorld::Ptr &ptr)
{
typedef SoundPlayingTimeMap::iterator iter_type;
for(iter_type iterator = mSoundPlayTime.begin(); iterator != mSoundPlayTime.end(); iterator++)
{
if (iterator->second.first == ptr)
return iterator->second.second;
}
return 0;
}
MWBase::SoundPtr SoundManager::playTrack(const DecoderPtr& decoder, PlayType type) MWBase::SoundPtr SoundManager::playTrack(const DecoderPtr& decoder, PlayType type)
@ -617,12 +602,8 @@ namespace MWSound
while(snditer != mActiveSounds.end()) while(snditer != mActiveSounds.end())
{ {
if(!snditer->first->isPlaying()) if(!snditer->first->isPlaying())
{ mActiveSounds.erase(snditer++);
mActiveSounds.erase(snditer); else
mSoundPlayTime.erase(snditer->first);
snditer++;
}
else
{ {
const MWWorld::Ptr &ptr = snditer->second.first; const MWWorld::Ptr &ptr = snditer->second.first;
if(!ptr.isEmpty()) if(!ptr.isEmpty())
@ -645,15 +626,6 @@ namespace MWSound
++snditer; ++snditer;
} }
} }
// Update the total playing time for all sounds.
// This is primarily used for detecting amplitude for NPC mouth animation.
typedef SoundPlayingTimeMap::iterator it_type;
for(it_type iterator = mSoundPlayTime.begin(); iterator != mSoundPlayTime.end(); iterator++)
{
iterator->second.second += duration;
}
} }
void SoundManager::update(float duration) void SoundManager::update(float duration)

@ -43,10 +43,6 @@ namespace MWSound
typedef std::pair<MWWorld::Ptr,std::string> PtrIDPair; typedef std::pair<MWWorld::Ptr,std::string> PtrIDPair;
typedef std::map<MWBase::SoundPtr,PtrIDPair> SoundMap; typedef std::map<MWBase::SoundPtr,PtrIDPair> SoundMap;
SoundMap mActiveSounds; SoundMap mActiveSounds;
typedef std::pair<MWWorld::Ptr, float> PtrFloatPair;
typedef std::map<MWBase::SoundPtr, PtrFloatPair> SoundPlayingTimeMap;
SoundPlayingTimeMap mSoundPlayTime;
MWBase::SoundPtr mUnderwaterSound; MWBase::SoundPtr mUnderwaterSound;
@ -108,9 +104,6 @@ namespace MWSound
virtual void stopSay(const MWWorld::Ptr &reference=MWWorld::Ptr()); virtual void stopSay(const MWWorld::Ptr &reference=MWWorld::Ptr());
///< Stop an actor speaking ///< Stop an actor speaking
virtual float getSoundPlayingTime(const MWWorld::Ptr &reference=MWWorld::Ptr());
///< Get the amount of time this sound has been playing.
virtual MWBase::SoundPtr playTrack(const DecoderPtr& decoder, PlayType type); virtual MWBase::SoundPtr playTrack(const DecoderPtr& decoder, PlayType type);
///< Play a 2D audio track, using a custom decoder ///< Play a 2D audio track, using a custom decoder

Loading…
Cancel
Save