//Prepares a BGM for loading. This means we call UpdateLoop() repeatedly until the loading of the music is complete. Names are found in bgm.txt configuration file.
// set whether audio will continue playing when the app has lost focus
voidSetBackgroundPlay(boolstate);
public:// LOADING ROUTINES
constsize_tLoadSound(conststd::string&path);
public:// LOADING ROUTINES
enumSoundEffectFlag{
SFX,
BGM,
};
constsize_tLoadSound(conststd::string&path,constSoundEffectFlagsoundType=BGM);//Setting sound effect to true avoids loading it from a resource pack.
constsize_tLoadResource(conststd::string&path);
voidUnloadSound(constintid);
public:// PLAYBACK CONTROLS
@ -153,6 +158,15 @@ namespace olc
// this is where the sounds are kept
std::vector<ma_sound*>vecSounds;
std::vector<ma_sound*>vecOneOffSounds;
structResourceData{
ma_engine*engine;
ResourceBufferdata;
std::stringpathName;
~ResourceData(){
if(ma_resource_manager_unregister_data(ma_engine_get_resource_manager(engine),pathName.data())!=MA_SUCCESS)ERR(std::format("WARNING! Could not clear resources for {}!",pathName));
if(ma_resource_manager_register_encoded_data(ma_engine_get_resource_manager(&engine),path.data(),vecResourceData[id].data.vMemory.data(),vecResourceData[id].data.vMemory.size())!=MA_SUCCESS)ERR(std::format("WARNING! Could not load resources for {}!",path));