MCPcopy Create free account
hub / github.com/defold/defold / Finalize

Function Finalize

engine/sound/src/sound_openal.cpp:531–582  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

529 }
530
531 Result Finalize()
532 {
533 SoundSystem* sound = g_SoundSystem;
534 if (!sound)
535 return RESULT_OK;
536
537 dmAtomicStore32(&sound->m_IsRunning, 0);
538
539 Result result;
540#if DM_SOUND_WASM_SUPPORT_THREADS
541 if (sound->m_Thread == 0) {
542 result = sound->FinalizeOpenal();
543 if (result != RESULT_OK) {
544 return result;
545 }
546 } else {
547 dmThread::Join(sound->m_Thread);
548 dmMutex::Delete(sound->m_Mutex);
549 dmConditionVariable::Delete(sound->m_CondVar);
550 result = (Result)dmAtomicGet32(&sound->m_Status);
551 }
552#else
553 result = sound->FinalizeOpenal();
554 if (result != RESULT_OK) {
555 return result;
556 }
557#endif
558
559 PlatformFinalize();
560
561 if (sound)
562 {
563 dmSoundCodec::Delete(sound->m_CodecContext);
564
565 for (uint32_t i = 0; i < sound->m_Instances.Size(); ++i)
566 {
567 SoundInstance* instance = &sound->m_Instances[i];
568 instance->m_Index = 0xffff;
569 instance->m_SoundDataIndex = 0xffff;
570 memset(instance, 0, sizeof(*instance));
571 }
572
573 free(sound->m_BufferData);
574
575 delete sound;
576 g_SoundSystem = 0;
577 }
578
579 checkForAlErrors("Finalize");
580
581 return result;
582 }
583
584 uint32_t GetMixRate()
585 {

Callers

nothing calls this directly

Calls 8

dmAtomicStore32Function · 0.85
dmAtomicGet32Function · 0.85
freeFunction · 0.85
FinalizeOpenalMethod · 0.80
DeleteFunction · 0.70
PlatformFinalizeFunction · 0.70
JoinFunction · 0.50
SizeMethod · 0.45

Tested by

no test coverage detected