FSBank Conversion of wav to fsb5 problem

I dont know how the FSBank API works
i have everything integrated already
i just want to know how i can convert a wav to fsb5

Open the “bin” folder in your FMOD Studio API installation folder and open the fsbank.exe file. Use this program to add the audio files you need and then click “Build” to build an .fsb file.

i can do that as well but i was writing my own way to do that so that i can wrap your code with C# and use it in Unity3d
Here is my progress so far

#include <FSB/fsbank.h>
#include <FSB/fsbank_errors.h>
#include <stdio.h>
#include <string>
using namespace std;

extern "C" _declspec(dllexport) void createSubsound();

void createSubsound()
{
	const char* cache = "G:/cache";
	FSBank_Init(FSBANK_FSBVERSION_FSB5, FSBANK_INIT_NORMAL, (unsigned int)2, cache);
	FSBANK_SUBSOUND subsound;
	const char* const msg = "G:/u.wav";
	subsound.fileNames = &msg;
	subsound.overrideFlags = FSBANK_BUILD_DISABLESYNCPOINTS;
	subsound.overrideQuality = 1;
	subsound.desiredSampleRate = 1;
	const FSBANK_SUBSOUND* newSubsound = &subsound;

	FSBank_Build(newSubsound, 1, FSBANK_FORMAT_VORBIS, FSBANK_BUILD_DEFAULT | FSBANK_BUILD_DONTLOOP, 100, NULL, "G:/test.fsb5");
}

But for some reason it doesnt seem to work

I consulted with our lead dev who mentions the following:

  • FSBANK_SUBSOUND subsound isn’t zero initialized so that will cause issues.
  • subsound.numFiles isn’t specified, it should be 1 for your case.
  • Set the desiredSampleRate to 0 for default.

Please make these changes and let me know if you’re still having issues.

1 Like

I tried your way of solving it
i also initialized the FSBank by replacing the library with the latest one

but still on build it doesnt work
Like it says everything worked fine but there is no output

getchar();
FSBANK_RESULT result = FSBank_Init(FSBANK_FSBVERSION_FSB5, FSBANK_INIT_NORMAL, 2, "G:/cache");
cout << "FSBank Initialized" << endl;
cout << "FSBank API Result:-  ";
std::cout << FSBank_Result_ToString(result) << std::endl;

FSBANK_SUBSOUND subsound = { NULL };
cout << "Subsound initialized zero/NULL" << endl;
const char* const msg = "G:/u.wav";
subsound.fileNames = &msg;
subsound.overrideFlags = FSBANK_BUILD_DISABLESYNCPOINTS;
subsound.overrideQuality = 1;
subsound.desiredSampleRate = 0;
subsound.numFiles = 1;
const FSBANK_SUBSOUND* newSubsound = &subsound;
cout << "subsound values assigned" << endl;

result = FSBank_Build(newSubsound, 1, FSBANK_FORMAT_VORBIS, FSBANK_BUILD_DEFAULT | FSBANK_BUILD_DONTLOOP, 100, NULL, "G:/Special.fsb5");
cout << "building........." << endl;
cout << "FSBank API Result for build:-   ";
std::cout << FSBank_Result_ToString(result) << std::endl;

}

the code should be working fine but there is an error i am facing whenever i try to run the build

if you know where I am mistaken then guide would be appreciated

That error means you are missing the dll required for building to the requested format, in this case Vorbis.
To solve this, you will need to copy the Vorbis dll from “api\fsbank\lib\x64\libfsbvorbis64.dll” into your executable directory.

1 Like

thanks
it worked
thanks a lot

1 Like