MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / Emulate3dSound

Method Emulate3dSound

sndlib/hlsoundlib.cpp:994–1017  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

992 return true;
993}
994bool hlsSystem::Emulate3dSound(int sound_obj_index) {
995 bool f_audible;
996 vector virtual_pos;
997 vector virtual_vel;
998 float adjusted_volume;
999 f_audible = ComputePlayInfo(sound_obj_index, &virtual_pos, &virtual_vel, &adjusted_volume);
1000
1001 if (f_audible) {
1002 pos_state cur_pos;
1003 matrix orient = Identity_matrix;
1004 cur_pos.velocity = &virtual_vel;
1005 cur_pos.position = &virtual_pos;
1006 cur_pos.orient = &orient;
1007 m_sound_objects[sound_obj_index].m_sound_uid = m_ll_sound_ptr->PlaySound3d(
1008 &m_sound_objects[sound_obj_index].play_info, m_sound_objects[sound_obj_index].m_sound_index, &cur_pos,
1009 adjusted_volume, (m_sound_objects[sound_obj_index].m_obj_type_flags & SIF_LOOPING) != 0);
1010 if (m_sound_objects[sound_obj_index].m_sound_uid == -1)
1011 f_audible = false;
1012 } else {
1013 m_sound_objects[sound_obj_index].m_sound_uid =
1014 0; // This is a dummy value -- it just cannot be -1 (that would mean that the low level sound system is full)
1015 }
1016 return f_audible;
1017}
1018// Functions that play a 3d sound -- includes the 2d emulation of 3d sound
1019int hlsSystem::Play3dSound(int sound_index, pos_state *cur_pos, float volume, int flags, float offset) {
1020 return Play3dSound(sound_index, SND_PRIORITY_NORMAL, cur_pos, volume, flags, offset);

Callers

nothing calls this directly

Calls 1

PlaySound3dMethod · 0.80

Tested by

no test coverage detected