I don't suggest you to use quickbms for these things.
The error you get is caused by the necessity of using some external library because tcc is fantastic but requires to load some libraries (even the basic libc) from file... something that is not good with quickbms where you have no dependencies. Honestly I didn't know tcc had dependencies even for using floats, this was a "bad" surprise
So my advice is to NOT use quickbms for that thing, use a programming language.
If you want to continue with quickbms you have 2 other choices: using a dll or using just a pre-compiled function.
The dll is very easy but it will make your code big while for the pre-compiled function use the following:
Code: Select all
set MEMORY_FILE10 binary "\x55\x89\xe5\x83\xec\x20\xdb\x45\x08\xdb\x45\x0c\xdd\x05\xc8\xb0\x40\x00\xde\xf9\xde\xf9\xdb\x45\x10\xde\xf9\xdb\x45\x14\xde\xf9\xd9\x5d\xfc\xd9\x45\xfc\xdd\x05\xd0\xb0\x40\x00\xde\xe9\xd9\x5d\xfc\xdb\x45\x14\xd8\x4d\xfc\xdb\x45\x10\xde\xc9\xdb\x45\x0c\xdd\x05\xc8\xb0\x40\x00\xde\xf9\xde\xc9\xd9\x7d\xea\x0f\xb7\x45\xea\xb4\x0c\x66\x89\x45\xe8\xd9\x6d\xe8\xdb\x5d\xe4\xd9\x6d\xea\x8b\x45\xe4\xc9\xc3"
calldll MEMORY_FILE10 0 "cdecl" subchunk2Size subchunk2Size bitsPerSample numChannels sampleRate
Yes, subchunk2Size is going to take the return value.
Original C code used to compile that data:
Code: Select all
int fSubchunk2Size (int subchunk2Size2, int bitsPerSample2, int numChannels2, int sampleRate2) {
float sndTime;
sndTime = 1.0 * subchunk2Size2 / (bitsPerSample2 / 8.0) / numChannels2 / sampleRate2;
sndTime -= 0.100;
return sndTime * sampleRate2 * numChannels2 * (bitsPerSample2 / 8.0);
}