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

Function SetupStreamingResourceTypes

engine/engine/src/engine.cpp:782–805  ·  view source on GitHub ↗

TODO: Can this be moved from engine.cpp to res_sound_data.cpp? Probably need to allow access to HConfigFile first

Source from the content-addressed store, hash-verified

780 // TODO: Can this be moved from engine.cpp to res_sound_data.cpp?
781 // Probably need to allow access to HConfigFile first
782 static void SetupStreamingResourceTypes(HEngine engine)
783 {
784 // Setup streaming if wanted
785 int32_t sound_streaming_enabled = dmConfigFile::GetInt(engine->m_Config, "sound.stream_enabled", 0);
786 if (sound_streaming_enabled)
787 {
788 // We currently use size (as opposed to time), as that doesn't require us to know anything about the sound file itself
789 int32_t sound_streaming_preload_size = dmConfigFile::GetInt(engine->m_Config, "sound.stream_preload_size", 0);
790
791 const char* extensions[] = {"oggc", "wavc"};
792 for (int i = 0; i < DM_ARRAY_SIZE(extensions); ++i)
793 {
794 dmResource::HResourceType type;
795 dmResource::Result result = dmResource::GetTypeFromExtension(engine->m_Factory, extensions[i], &type);
796 if (dmResource::RESULT_OK != result)
797 {
798 dmLogWarning("Failed to find resource type %s, couldn't enable for streaming", extensions[i]);
799 continue;
800 }
801
802 ResourceTypeSetStreaming(type, sound_streaming_preload_size);
803 }
804 }
805 }
806
807 static void SetupPhysicsContextParams(dmGameSystem::PhysicsContext* physics, dmConfigFile::HConfig config)
808 {

Callers 1

engine.cppFile · 0.85

Calls 3

GetTypeFromExtensionFunction · 0.85
ResourceTypeSetStreamingFunction · 0.85
GetIntFunction · 0.50

Tested by

no test coverage detected