I understand from reading the code samples and the forum that calling system->update in your game render loop is important, but from reading the documentation I’m not 100% clear what the update function does.
I know that I am able to play sounds and streams without system->update, so I am curious if someone can summarize the principle utility of system->update for me. Thanks
- beek asked 6 years ago
Basically, FMOD’s "high level logic" happens inside the update(). The decision to make some channels virtual and others live, updating 3D postions, calculating doppler, fading events in and out, etc. are all examples of this sort of logic. As it turns out, some things happen on other threads (like streaming and mixing) but that’s an implementation detail that. Conceptually, you should think of FMOD as a traditional single threaded app that needs you to regularly pump it through the update() call.
- audiodev answered 6 years ago
From the help file it does look like it could be possible to do without as the documentation is very precise in what it does. It surely does not state it’s essential. But really you should call it.
Updates the FMOD system. This should be called once per ‘game’ tick, or once per frame in your application.
FMOD_RESULT FMOD_System_Update(FMOD_SYSTEM * system);
If the function succeeds then the return value is FMOD_OK.
If the function fails then the return value will be one of the values defined in the FMOD_RESULT enumeration.
This updates the following things.
3D Sound. System::update must be called to get 3D positioning.
Virtual voices. If more voices are played than there are real hardware/software voices, System::update must be called to handle the virtualization.
*_NRT output modes. System::update must be called to drive the output for these output modes.
FMOD_INIT_STREAM_FROM_UPDATE. System::update must be called to update the streamer if this flag has been used.
Callbacks. System::update must be called to fire callbacks if they are specified.
FMOD_NONBLOCKING. System::update must be called to make sounds opened with FMOD_NONBLOCKING flag to work properly.
FMOD_SYSTEM_CALLBACKTYPE_DEVICELISTCHANGED callback. System::update must be called for this callback to trigger.
If FMOD_OUTPUTTYPE_NOSOUND_NRT or FMOD_OUTPUTTYPE_WAVWRITER_NRT output modes are used, this function also drives the software / DSP engine, instead of it running asynchronously in a thread as is the default behaviour.
This can be used for faster than realtime updates to the decoding or DSP engine which might be useful if the output is the wav writer for example.
If FMOD_INIT_STREAM_FROM_UPDATE is used, this function will update the stream engine. Combining this with the non realtime output will mean smoother captured output.
Warning! Do not be tempted to call this function from a different thread to other FMOD commands! This is dangerous and will cause corruption/crashes. This function is not thread safe, and should be called from the same thread as the rest of the FMOD commands.
Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation 2, PlayStation Portable, PlayStation 3, Wii, Solaris, iPhone
- icuurd12b42 answered 6 years ago
Please login first to submit.