I’m trying to use musicsystem in my project but I come across some problems.
I only make some changes to the fmod designer example "musicsystem", here is the code i added:
void *buff = 0; int length = 0; FMOD_EVENT_LOADINFO loadinfo; FMOD_CREATESOUNDEXINFO exinfo; FMOD::Sound *pSound; ERRCHECK(result = eventsystem->init(64, FMOD_INIT_NORMAL, 0, FMOD_EVENT_INIT_NORMAL)); ERRCHECK(result = eventsystem->setMediaPath("..\\media\\")); LoadFileIntoMemory("../media/examples.fev", &buff, &length); memset(&loadinfo, 0, sizeof(FMOD_EVENT_LOADINFO)); loadinfo.size = sizeof(FMOD_EVENT_LOADINFO); loadinfo.loadfrommemory_length = length; ERRCHECK(result = eventsystem->load((const char *)buff, &loadinfo, &eventproject)); //ERRCHECK(result = eventsystem->load("examples.fev", 0, 0)); LoadFileIntoMemory("../media/tutorial_bank.fsb", &buff, &length); memset(&exinfo, 0, sizeof(FMOD_CREATESOUNDEXINFO)); exinfo.cbsize = sizeof(FMOD_CREATESOUNDEXINFO); exinfo.length = length; ERRCHECK(result = system->createSound((const char *)buff, FMOD_SOFTWARE | FMOD_OPENMEMORY, &exinfo,
ERRCHECK(result = eventsystem->preloadFSB("tutorial_bank.fsb", 0, pSound));
And when i trigger either of those musicprompts, which have several segments with samples to loop in them, to start, it becomes mute when some samples have been played only once! No same sample has been heared twice, and then no matter how many times i trigger the musicprompts to end or start, there is nothing playing.
This example works perfect if no changes have been made to it, so i think is there something wrong with my code which i cannot figure out? 😥
- rockoz asked 9 years ago
Another problem is that when triggering these musicprompt to end, a FMOD_ERR_PRELOADED is raised just after the next EventSystem::update, stating a specified sound is to be released without calling EventSystem::unloadFSB. The only sound I create is the one holding "fsb" file, and I never release it in my code. I wonder if it is FMOD trying to release it?
- rockoz answered 9 years ago
Please login first to submit.