History

Merge pull request #4708 from ctrlaltdavid/fix-audio-mouth

Fix audio-driven mouth viewed by others

Andrew Meadows committed 11 years ago

Commit e646ff62 parents bc8f670 d6eb04c1 file · +11 −11Browse files

Unified · Split

interface/src/avatar/Head.cpp+11−11
@@ -73,20 +73,20 @@ void Head::reset() { · 72 unmodified lines
7373 }
7474
7575 void Head::simulate(float deltaTime, bool isMine, bool billboard) {
76+ // Update audio trailing average for rendering facial animations
77+ const float AUDIO_AVERAGING_SECS = 0.05f;
78+ const float AUDIO_LONG_TERM_AVERAGING_SECS = 30.0f;
79+ _averageLoudness = glm::mix(_averageLoudness, _audioLoudness, glm::min(deltaTime / AUDIO_AVERAGING_SECS, 1.0f));
80+
81+ if (_longTermAverageLoudness == -1.0) {
82+ _longTermAverageLoudness = _averageLoudness;
83+ } else {
84+ _longTermAverageLoudness = glm::mix(_longTermAverageLoudness, _averageLoudness, glm::min(deltaTime / AUDIO_LONG_TERM_AVERAGING_SECS, 1.0f));
85+ }
86+
7687 if (isMine) {
7788 MyAvatar* myAvatar = static_cast<MyAvatar*>(_owningAvatar);
7889
79− // Update audio trailing average for rendering facial animations
80− const float AUDIO_AVERAGING_SECS = 0.05f;
81− const float AUDIO_LONG_TERM_AVERAGING_SECS = 30.0f;
82− _averageLoudness = glm::mix(_averageLoudness, _audioLoudness, glm::min(deltaTime / AUDIO_AVERAGING_SECS, 1.0f));
83−
84− if (_longTermAverageLoudness == -1.0) {
85− _longTermAverageLoudness = _averageLoudness;
86− } else {
87− _longTermAverageLoudness = glm::mix(_longTermAverageLoudness, _averageLoudness, glm::min(deltaTime / AUDIO_LONG_TERM_AVERAGING_SECS, 1.0f));
88− }
89−
9090 // Only use face trackers when not playing back a recording.
9191 if (!myAvatar->isPlaying()) {
9292 FaceTracker* faceTracker = Application::getInstance()->getActiveFaceTracker();