Wow…I feel like a noob. I just can not get this to actually work. I can play non-event sounds all day, but I have been trying all day to write 5 lines of code to play an event that I created in fmod designer
The code actually runs without errors. Is there something special I have to do for the .fsb file?
I guess I don’t understand the preloadFSB Function also. I just wanna call events and I don’t understand why I have to use createSound to preload a .fsb file
Basically, Everything runs, but I can’t hear anything…
// — My Setup is
// the .fev and the .fsb are located in "./Assets/SFX"
// — My Update Function
// — Putting it first just to show I’m updating stuff
ERRCHECK( eventsystem->update() );
// … skipping the listener stuff
ERRCHECK( FMOD::EventSystem_Create(&eventsystem) );
ERRCHECK( eventsystem->init(32, FMOD_INIT_NORMAL | FMOD_INIT_3D_RIGHTHANDED, 0) );
ERRCHECK( eventsystem->getSystemObject( &fmod_system ) );
ERRCHECK( eventsystem->setMediaPath( "./Assets/SFX/" ) );
ERRCHECK( eventsystem->load( FEV_PATH, NULL, &eventproject ) );
ERRCHECK( eventproject->getGroup( "/Car", true, &root_group ) );
ERRCHECK( root_group->loadEventData() );
ERRCHECK( root_group->getEvent( "2D Engine", FMOD_EVENT_DEFAULT, &event1 ) );
ERRCHECK( event1->start() );
event1->setVolume( 100.0f );
- stringa asked 10 years ago
OMG…i got it all working….
preloadFSB() doesn’t make sense to me….
I did something like…
ERRCHECK( fmod_system->createStream( "floor_it_bank00.fsb", FMOD_2D, 0, &fsb ) );
ERRCHECK( eventsystem->preloadFSB( "floor_it_bank00", 10, fsb ) );
How does it know what to preload and that my .fev file needs that data?
It just doesn’t make sense to me.
[quote:1hwa479f]How does it know what to preload and that my .fev file needs that data?[/quote:1hwa479f]
Your sound data for the project is in the FSB file(s). When FMOD Designer generates the FEV and FSB, the FEV knows what FSB to look for. It doesn’t know ‘what to preload’ you can tell it using PreloadFSB. The Preload FSB command is to control the loading and unloading of sound data. You program should work perfectly without it. It will load the data according to the FEV and return an FMOD_ERR code if the fsb has been moved or deleted. The preloading is loading it before it is needed so that the program already has it in memory and doesn’t read from disk on demand.
Your code looks okay, there is a few strange things I noticed:
This is not needed, eventsystem->update() will call system->update() for you.
You don’t need a leading slash to get a group.
[quote:2ak2ckm4]event1->setVolume( 100.0f ); [/quote:2ak2ckm4]
The event should start at full volume. This is a value from 0 to 1 so 100.f isn’t a valid value.
Can you test if the "simple event" example works on your computer? If it does you can modify the code for that example to make it use your FEV and FSB files to check that they work properly.
[quote:2ak2ckm4]I guess I don’t understand the preloadFSB Function also.[/quote:2ak2ckm4]
Preload FSB is to give you more control over the loading and unloading of sounds to memory. When you play an event, the sound data for that event will be loaded into memory if it is not already. This on demand loading works well on a small scale but with many events it may be preferable to load (and unload) larger chunks.
Hope this helps.
I could not get that call to work…
define FSB_PATH "floor_it_bank00.fsb"
ERRCHECK( eventsystem->preloadFSB( FSB_PATH, 0, fsb ) );
I thought that SetMediaPath would direct it to the directory. I keep getting invalid parameter for this function.
Please login first to submit.