0
0

I am adding FMOD to my project today, and I am following this tutorial to setup a SoundManager class. I went to compile and got the following error…

error C2660: ‘FMOD::System::setFileSystem’ : function does not take 5 arguments

So I went and took a look, and the code says..

result = mSystem->setFileSystem(&fmodFileOpenCallback, &fmodFileCloseCallback, &fmodFileReadCallback, &fmodFileSeekCallback, 2048);

My best guess is since this tutorial in a few years old, some changes have been made to the SetFileSystem() params. It seems I am missing FMOD_FILE_ASYNCREADCALLBACK and FMOD_FILE_ASYNCCANCELCALLBACK. Do I need to create some sort of override function for these as well? If so, is there some code laying around for these?

Here is what the other overrides look like in case its needed.

[code:1brm8sku]
FMOD_RESULT SoundManager::fmodFileOpenCallback(const char *fileName, int unicode, unsigned int *filesize, void **handle, void **userdata)
{
SoundInstance *soundInstance;

assert(fileName);

soundInstance = (SoundInstance *)fileName;
assert(soundInstance->fileArchive);

*handle = (void *)soundInstance;
*userdata = NULL;

soundInstance->streamPtr = soundInstance->fileArchive->open(soundInstance->fileName);

if (soundInstance->streamPtr.isNull())
{
    *filesize = 0;
    return FMOD_ERR_FILE_NOTFOUND;
}

*filesize = (unsigned int)soundInstance->streamPtr->size();

return FMOD_OK;

}

FMOD_RESULT SoundManager::fmodFileCloseCallback(void *handle, void *userdata)
{
return FMOD_OK;
}

FMOD_RESULT SoundManager::fmodFileReadCallback(void *handle, void *buffer, unsigned int sizeBytes, unsigned int *bytesRead, void *userData)
{
SoundInstance *soundInstance;

soundInstance = (SoundInstance *)handle;
*bytesRead = (unsigned int)soundInstance->streamPtr->read(buffer, (size_t)sizeBytes);

if (*bytesRead == 0)
    return FMOD_ERR_FILE_EOF;

return FMOD_OK;

}

FMOD_RESULT SoundManager::fmodFileSeekCallback(void *handle, unsigned int pos, void *userdata)
{
SoundInstance *soundInstance;

soundInstance = (SoundInstance *)handle;
soundInstance->streamPtr->seek((size_t)pos);

return FMOD_OK;

}
[/code:1brm8sku]

  • You must to post comments
0
0

I encountered the same when upgrading to 4.32.01 recently, and just set the two new parameters to NULL, with no problems (so far!).

  • You must to post comments
0
0

Yes that is correct, the two async file callbacks can be safely set to NULL.

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.