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

Function GetDefaultFrameCount

engine/sound/src/sound.cpp:638–651  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

636 }
637
638 uint32_t GetDefaultFrameCount(uint32_t rate)
639 {
640 if (rate == 48000)
641 return 1024;
642
643 if (rate == 44100)
644 return 768;
645
646 // for generic devices, we try to calculate a conservative yet small number of frames
647 uint32_t frame_count = rate / 60; // use default count
648 float f_frame_count = frame_count / 32; // try to round it to some nice sample alignment (e.g. 16bits *2 channels)
649 float extra_percent = 1.05f;
650 return ceilf(f_frame_count * extra_percent) * 32;
651 }
652
653 static inline const char* GetSoundName(SoundSystem* sound, SoundInstance* instance)
654 {

Callers 2

InitializeFunction · 0.70
DeviceOpenSLOpenFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected