| 869 | } |
| 870 | |
| 871 | void MovementObject::Update(float timestep) { |
| 872 | // GridTest(position, scenegraph_->bullet_world_, 0.45f); |
| 873 | ThreadedSound* si = Engine::Instance()->GetSound(); |
| 874 | Online* online = Online::Instance(); |
| 875 | |
| 876 | while (message_queue.empty() == false) { |
| 877 | ReceiveMessage(message_queue.front()); |
| 878 | message_queue.pop(); |
| 879 | } |
| 880 | |
| 881 | std::list<VoiceQueue>::iterator iter; |
| 882 | for (iter = voice_queue.begin(); iter != voice_queue.end();) { |
| 883 | VoiceQueue& vq = (*iter); |
| 884 | vq.delay -= timestep; |
| 885 | if (vq.delay <= 0.0f) { |
| 886 | si->SetVolume(voice_sound, 0.0f); |
| 887 | // si->Stop(voice_sound); |
| 888 | // SoundGroupRef sgr = SoundGroups::Instance()->ReturnRef(vq.path); |
| 889 | SoundGroupRef sgr = Engine::Instance()->GetAssetManager()->LoadSync<SoundGroup>(vq.path); |
| 890 | std::string snd_path = sgr->GetSoundPath(); |
| 891 | // printf("%s\n",snd_path.c_str()); |
| 892 | std::string lpsnc_path = snd_path.substr(0, snd_path.size() - 4) + ".txt"; |
| 893 | // printf("%s\n",lpsnc_path.c_str()); |
| 894 | if (FileExists(lpsnc_path.c_str(), kDataPaths | kModPaths)) { |
| 895 | // LipSyncFileRef lsf_ref = LipSyncFiles::Instance()->ReturnRef(lpsnc_path.c_str()); |
| 896 | LipSyncFileRef lsf_ref = Engine::Instance()->GetAssetManager()->LoadSync<LipSyncFile>(lpsnc_path.c_str()); |
| 897 | rigged_object_->lipsync_reader.AttachTo(lsf_ref); |
| 898 | } |
| 899 | SoundGroupPlayInfo sgpi(*sgr, rigged_object_->GetAvgIKChainPos("head")); |
| 900 | sgpi.specific_path = snd_path; |
| 901 | sgpi.created_by_id = GetID(); |
| 902 | sgpi.pitch_shift = vq.pitch; |
| 903 | sgpi.priority = _sound_priority_high; |
| 904 | if (controlled) { |
| 905 | sgpi.priority = _sound_priority_very_high; |
| 906 | } |
| 907 | voice_sound = si->CreateHandle(__FUNCTION__); |
| 908 | si->PlayGroup(voice_sound, sgpi); |
| 909 | attached_sounds.push_back(voice_sound); |
| 910 | iter = voice_queue.erase(iter); |
| 911 | } else { |
| 912 | ++iter; |
| 913 | } |
| 914 | } |
| 915 | |
| 916 | for (int i = (int)attached_sounds.size() - 1; i >= 0; --i) { |
| 917 | if (!si->IsHandleValid(attached_sounds[i])) { |
| 918 | attached_sounds.erase(attached_sounds.begin() + i); |
| 919 | } |
| 920 | } |
| 921 | if (!rigged_object_->animated) { |
| 922 | velocity = rigged_object_->GetAvgVelocity(); |
| 923 | } |
| 924 | for (unsigned long& attached_sound : attached_sounds) { |
| 925 | si->SetOcclusionPosition(attached_sound, position); |
| 926 | si->TranslatePosition(attached_sound, velocity * timestep); |
| 927 | // DebugDraw::Instance()->AddWireSphere(si->GetPosition(attached_sounds[i]), 1.0f, vec4(1.0f), _delete_on_update); |
| 928 | } |
nothing calls this directly
no test coverage detected