#include #include #include #include #include #include #include #include #include #include #include // inlining zip #include "res/erik_gun_fx_1.zip.h" using namespace entt::literals; extern char* argv0; TEST(soloud_fs_loader, basic) { MM::Engine engine; // setup auto& sound = engine.addService(); ASSERT_TRUE(engine.enableService()); engine.addService(argv0, "soloud_filesystem_loader_test"); ASSERT_TRUE(engine.enableService()); auto& rm = MM::ResourceManager::ref(); ASSERT_TRUE(PHYSFS_mountMemory(erik_gun_fx_1_zip, erik_gun_fx_1_zip_len, NULL, "", NULL, 0)); sound.engine.setGlobalVolume(0.4f); ASSERT_FALSE(rm.contains("test"_hs)); rm.load("test", "does_not_exist.wav", engine); ASSERT_FALSE(rm.contains("test"_hs)); rm.load("test", "erik_gun_fx_1.flac", engine); ASSERT_TRUE(rm.contains("test"_hs)); auto wh = rm.get("test"_hs); std::cout << "wav length: " << wh->getLength() << "s" << std::endl; sound.engine.play(*wh); while (sound.engine.getActiveVoiceCount()) { using namespace std::chrono_literals; std::this_thread::sleep_for(5ms); } rm.clear(); }