MCPcopy Create free account
hub / github.com/Panzerschrek/Chasm-Reverse / UpdateObjectSoundState

Method UpdateObjectSoundState

PanzerChasm/sound/sound_engine.cpp:405–443  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

403}
404
405void SoundEngine::UpdateObjectSoundState()
406{
407 const unsigned int sound_number= c_first_map_ambient_sound + objects_sounds_processor_.GetCurrentSoundNumber();
408 if( sound_number == c_first_map_ambient_sound )
409 {
410 if( object_sound_source_ != nullptr )
411 {
412 object_sound_source_->is_free= true;
413 object_sound_source_= nullptr;
414 }
415 }
416 else
417 {
418 if( object_sound_source_ == nullptr )
419 {
420 object_sound_source_= GetFreeSource();
421 if( object_sound_source_ != nullptr )
422 {
423 object_sound_source_->is_free= false;
424
425 object_sound_source_->looped= true;
426 object_sound_source_->is_head_relative= false;
427 object_sound_source_->pos_samples= 0u;
428 object_sound_source_->pos= objects_sounds_processor_.GetCurrentSoundPosition();
429 object_sound_source_->sound_id= sound_number;
430 object_sound_source_->monster_id= 0u;
431 }
432 }
433 else
434 {
435 if( object_sound_source_->sound_id != sound_number )
436 {
437 object_sound_source_->sound_id= sound_number;
438 object_sound_source_->pos_samples= 0u;
439 }
440 object_sound_source_->pos= objects_sounds_processor_.GetCurrentSoundPosition();
441 }
442 }
443}
444
445void SoundEngine::UpdateOneTimeSoundSource()
446{

Callers

nothing calls this directly

Calls 1

GetCurrentSoundNumberMethod · 0.45

Tested by

no test coverage detected