0
0

I am working on optimizing loading times and I wanted to see if loading the FEV from memory would make it any faster. However I’m getting an FMOD_ERR_FILE_NOTFOUND error. Here’s my code:

[code:388wgyrk]
u8* myBuffer = NULL;
int mySize = 0;

    Hal::File *file = Hal::FileManager::Open(filename, Hal::FileManager::kReadable);
    if ( file )
    {
        mySize = file->Info().Size();
        myBuffer = MEM_NEW(Hal::Heap::DefaultHeap) u8[mySize];
        file->Read(myBuffer, mySize);
        Hal::FileManager::Close(file);
    }

    if ( myBuffer && mySize > 0 )
    {
        FMOD_EVENT_LOADINFO loadInfo;
        memset( &loadInfo, 0, sizeof(loadInfo));
        loadInfo.size = sizeof(loadInfo);
        loadInfo.loadfrommemory_length = mySize;

        res = SoundSystem::Instance().GetEventSystem()->load( (const char*)myBuffer, &loadInfo, &m_pMasterEventProject ));

        MEM_SAFE_DELETE_ARRAY(myBuffer);
    }
    else
    {
        res = SoundSystem::Instance().GetEventSystem()->load( filename, 0, &m_pMasterEventProject ));
    }

[/code:388wgyrk]

I put a breakpoint in my FileOpen callback that I set for fmod and noticed it was trying to open a filename of FEV1 (which is exactly the data that myBuffer points to). So it seems that its ignoring the loadInfo parameter and still trying to load a file. The else condition (loading from file) works fine.

I am using fmod version ps3 4.16.03. Thanks.

  • You must to post comments
0
0

I do it differently, by streaming the data from memory in the callbacks instead of disk, but thats because we use packaged data, and it is really old code now.

Since then they’ve added EventSystem::registerMemoryFSB, which maybe what you need?

  • You must to post comments
0
0

We would prefer to avoid implementing a system to trick the file IO callbacks to load from memory instead of a file, especially if there is already a clean API to do so.

My current problem is specific to loading the event data (.fev) files. But thanks for pointing out the registerMemoryFSB. I may look into that too to help improve load times.

  • You must to post comments
0
0

We’re streaming all resources as well and do it by tricking the fileIO callbacks. Why we do that is because there is no way to load eventgroups from memory and register/unregisterFSB doesn’t work for us since we want FMOD to include the registered FSBs in the mempool. It all works pretty nice at the cost of having to maintain which fsbs are connected to which eventgroup.

  • You must to post comments
0
0

Hey, loading fevs from memory works fine for me, I used filecallbacks first but now switched to the "official" way. Did you get it to work, jughead?

  • You must to post comments
0
0

I haven’t tried it again since. We changed fmod to NOT use a fixed memory pool and loading times increased (we’re still using an older version of fmod but the latest has fixed this problem)

  • You must to post comments
0
0

This is quite simple, if you’re loading from memory, you’re getting a memory pointer passed in.
Simply dont load from memory if you’re using callbacks, and if you must, just use a filename instead of a memory pointer in the call to load, and memcpy the data yourself.

  • You must to post comments
Showing 6 results
Your Answer

Please first to submit.