0
0

OS: Windows 7 (64bit)
Development Tool : Visual Studio 2010 SP1 (C++)
Application : DirectX9 32bit
API : FMOD Ex v4.44.12 (Stable)

Hi, I have a question.

I use MusicSystem for playing music queues now.
I use a sound bank that the bank type is ‘load into memory’.
I am trying to change a bank type to ‘Stream from disk’, because a size of fsb file becomes bigger.

I’ve changed to call ‘CreateStream()’ function instead of ‘CreateSound()’ function, and set streaminstance when call ‘PreLoadFSB()’ function for this try.

Then all functions return any errors (return FMOD_OK), but a music isn’t played.
I’ve tried to play a sound event, it is played well with a streaming sound bank.

The sound bank is compressed ‘MP2’ and format of source files are ‘OGG’.

Please advise to me about this problem.

  • You must to post comments
0
0

Can you post the code that calls PreLoadFSB?

  • You must to post comments
0
0

I must use my original packed file format that include .fsb files.
ex) sound.pack file have a.fsb, b.fsb, … etc.

A streaming is the same. I’ll open my pack file and stream .fsb files by callback function.

[code:1xshcrd6]s_eventInfo.wavebankinfo = s_waveBankInfo;
::FMOD_EventSystem_GetInfo(GetEventSystem(), &s_eventInfo);

for (int waveBankIndex = 0; waveBankIndex < s_eventInfo.maxwavebanks; waveBankIndex++) {
const FMOD_EVENT_WAVEBANKINFO& waveBankInfo = s_waveBankInfo[waveBankIndex];
std::string fsbFileName = waveBankInfo.name;
fsbFileName += ".fsb";
std::string fsbFilePath = s_soundDir + fsbFileName;

FMOD_CREATESOUNDEXINFO createSoundExInfo;
ZeroMemory(&amp;createSoundExInfo, sizeof(FMOD_CREATESOUNDEXINFO));
createSoundExInfo.cbsize = sizeof(FMOD_CREATESOUNDEXINFO);

FMOD_SOUND* pFSB = nullptr;
FMOD_MODE mode = FMOD_DEFAULT;
FMOD_RESULT result = FMOD_RESULT_FORCEINT;

// stream from disk
if (waveBankInfo.type == 0) {
    mode |= FMOD_CREATESTREAM;
    //createSoundExInfo.useropen = OpenStream;
    //createSoundExInfo.userclose = CloseStream;
    //createSoundExInfo.userread = ReadStream;
    //createSoundExInfo.userseek = SeekStream;

    for (int i = 0; i &lt; waveBankInfo.maxstreams; i++) {
        result = ::FMOD_System_CreateStream(GetFMODSystem(), fsbFilePath.c_str(), mode, 0, &amp;pFSB);
        if (result != FMOD_OK || !pFSB) {
            continue;
        }

        result = ::FMOD_EventSystem_PreloadFSB(GetEventSystem(), fsbFileName.c_str(), i, pFSB, false);
        if (result != FMOD_OK) {
            continue;
        }

        FSB_INFO fsbInfo;
        fsbInfo.fileName = fsbFileName;
        fsbInfo.pFSB = pFSB;
        fsbInfo.streamInstance = i;
        s_soundBankList.emplace_back(fsbInfo);
    }
}
else {
    // load into memory
    if (waveBankInfo.type == 1) {
        mode |= FMOD_CREATECOMPRESSEDSAMPLE | FMOD_OPENMEMORY;              
    }
    // decompress into memory
    else if (waveBankInfo.type == 2) {
        mode |= FMOD_CREATESAMPLE | FMOD_OPENMEMORY;
    }

    file::IFileMem* pFile = file::Load(fsbFilePath.c_str());
    if (!pFile) {
        continue;
    }

    createSoundExInfo.length = pFile-&gt;GetSize();
    result = ::FMOD_System_CreateSound(GetFMODSystem(), (const char*)pFile-&gt;GetData(), mode, &amp;createSoundExInfo, &amp;pFSB);
    file::Close(pFile);
    if (result != FMOD_OK || !pFSB) {
        continue;
    }

    result = ::FMOD_EventSystem_PreloadFSB(GetEventSystem(), fsbFileName.c_str(), 0, pFSB, false);
    if (result != FMOD_OK) {
        continue;
    }

    FSB_INFO fsbInfo;
    fsbInfo.fileName = fsbFileName;
    fsbInfo.pFSB = pFSB;
    fsbInfo.streamInstance = 0;
    s_soundBankList.emplace_back(fsbInfo);
}

}[/code:1xshcrd6]

  • You must to post comments
0
0

I couldn’t really understand what you were doing, but if you are using MusicSystem interface to play music, you are probably just not loading the sound data that you need properly. As far as I know, MusicSystem doesn’t have CreateStream in its interface (or rather, you shouldn’t need to call it). It is a bit hard to tell without seeing your code.

  • You must to post comments
0
0

Isn’t there anyone to tell me about this problem?

  • You must to post comments
Showing 4 results
Your Answer

Please first to submit.