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

Method BeginSoundFrame

sndlib/hlsoundlib.cpp:638–820  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

636#include "findintersection.h"
637
638void hlsSystem::BeginSoundFrame(bool f_in_game) {
639 bool hwsound_support; // if this is true, sound_render_system is being used
640 int16_t *sound_room_list; // these values are only meant for sound render system
641 int i, n, counter = 0;
642 pos_state listener_pos;
643 const int num_samples_this_frame = (int)(Frametime * 22050);
644 if (!m_f_hls_system_init)
645 return;
646 // determine if we're using hardware for sound support.
647 m_ll_sound_ptr->SoundStartFrame();
648 // non game sound frame, this, just updates currently playing sounds.
649 // placed here to leave early and ensure any further processing involves game only.
650 if (!f_in_game) {
651 sound_room_list = NULL;
652 for (i = 0, counter = 0; i < MAX_SOUND_OBJECTS; i++) {
653 if (m_sound_objects[i].m_obj_type_flags && m_sound_objects[i].m_sound_uid != -1) {
654 counter++;
655 ASSERT(m_sound_objects[i].m_sound_uid > -1);
656 if (!m_ll_sound_ptr->IsSoundInstancePlaying(m_sound_objects[i].m_sound_uid)) {
657 StopSound(i); // stop any sounds playing.
658 }
659 }
660 }
661
662 goto end_beginsoundframe; // this will handle any remaining processing
663 }
664 // FROM HERE ON, WE ASSUME WE'RE IN GAME.
665 hwsound_support = (sound_render_start_frame());
666 // define current environment of the listener.
667 listener_pos.velocity = &Viewer_object->mtype.phys_info.velocity;
668 listener_pos.position = &Viewer_object->pos;
669 listener_pos.orient = &Viewer_object->orient;
670 listener_pos.roomnum = Viewer_object->roomnum;
671 m_ll_sound_ptr->SetListener(&listener_pos);
672 // do environmental audio int current room.
673 if (!OBJECT_OUTSIDE(Viewer_object)) {
674 n = Rooms[Viewer_object->roomnum].env_reverb;
675 if (n >= 0) {
676 if (m_cur_environment != n) {
677 ASSERT(n < N_ENVAUDIO_PRESETS);
678 m_ll_sound_ptr->SetGlobalReverbProperties(EnvAudio_Presets[n].volume, EnvAudio_Presets[n].damping,
679 EnvAudio_Presets[n].decay);
680 m_cur_environment = n;
681 }
682 }
683 } else {
684 if (m_cur_environment != ENVAUD_PRESET_MOUNTAINS) {
685 n = ENVAUD_PRESET_MOUNTAINS;
686 m_ll_sound_ptr->SetGlobalReverbProperties(EnvAudio_Presets[n].volume, EnvAudio_Presets[n].damping,
687 EnvAudio_Presets[n].decay);
688 m_cur_environment = n;
689 }
690 }
691 // render all rooms within a certain range from player (traverse rooms through portals)
692 sound_room_list = hwsound_support ? sound_render_audible_rooms(&listener_pos) : NULL;
693 // SoundQ_process();
694 // if sound object is outside listener's cone of audibility, emulate the sound.
695 // if sound is audible, then determine its playback properties.

Callers 15

OnDeleteSoundMethod · 0.80
OnPlaysoundMethod · 0.80
OnKillsoundsMethod · 0.80
OnInitDialogMethod · 0.80
OnPlaySoundButtonMethod · 0.80
GameFrameFunction · 0.80
PLResultsFrameFunction · 0.80
CtlConfigUICBFunction · 0.80
TelComMainMenuFunction · 0.80
TelcomCloseSoundsFunction · 0.80
TelComSingleShipSelectFunction · 0.80
DoUIFrameFunction · 0.80

Calls 11

sound_render_start_frameFunction · 0.85
ObjGetFunction · 0.85
fvi_FindIntersectionFunction · 0.85
SoundStartFrameMethod · 0.80
SetListenerMethod · 0.80
AdjustSoundMethod · 0.80
SoundPropertySupportMethod · 0.80
StopSoundMethod · 0.45

Tested by

no test coverage detected