I am using fmod file callbacks to do I/O, and I have run into a problem. If there is an error during FMOD_FILE_READCALLBACK or FMOD_FILE_SEEKCALLBACK, my application does not know what resources to free. Since the only information passed to these callbacks is the filename, and I may have multiple sounds playing for the same filename, I cannot determine which channel needs have resources freed.
If there was a callback I could register via Channel::setCallback() that would be called when there was an I/O problem, I would get the channel information and be able to free my resources.
I am using FModEx 4.00.34, btw.
- Timmy BigHands asked 12 years ago
Hmm, not the most elegant solution, but it will work as long as the filename I pass into createSound() is never ever used by FMod for anything else.
My problem still raises the issue of how FMOD responds to errors while loading a sound. If I was not using file I/O callbacks and instead relying on FMOD’s own file routines , how would I know if a sound failed to load? My FMOD_CHANNEL_CALLBACKTYPE_END callback is not called, so I would never get any feedback after calling playSound()?
I still think a FMOD_CHANNEL_CALLBACKTYPE_IO_ERROR callback would be nice.
Sorry to be obtuse, but my real question is this. For sake of argument, say I am NOT using file callbacks (so FMOD is reading files using its internal file system). If I call playSound() on a streaming sound, and the sound begins playing, and suddenly an error occurs reading the stream, how does this error get reported back to my app?
The problem is not that I cannot return additional information with the file handle. The problem is that the only information passed into these functions by FMod is the filename, and that is not enough information for me to uniquely identify my resources, which are associated with a channel, not a filename.
In other words, the only data that I get in the open, read, seek and close callbacks is the filename. What I need is either the associated channel to be passed in as well, or even better, a callback similar to the type FMOD_CHANNEL_CALLBACKTYPE_END that gets called when the file callbacks fail. Those channel callbacks contain channel information, which I can use to free the resources associated with the channel.
I hope this makes sense.
Please login first to submit.