pouët.net

Bug in 4klang (fix included): using Load unit produces non-working song

category: code [glöplog]
 
I think I found a bug in 4klang 3.0.1. I made a tune that happened to use the Load unit (which just loads its parameter number as a value to the signal stack), the .obj file crashes. Again, I resorted to using the YASM assembler and quickly found out that the code output by the VST plugin doesn't even compile, even though the supplied NASM version somehow manages to compile it.

In Go4kVSTiCore.cpp, line 2260, there's just %1 in the printf() string, which produces a non-working definition for the GO4K_FLD macro in 4klang.inc. It should probably be %%1.

Code: ... fprintf(file, "%%ifdef GO4K_USE_FLD\n"); fprintf(file, "GO4K_FLD_ID equ 11\n"); fprintf(file, "%%macro GO4K_FLD 1\n"); fprintf(file, " db %1\n"); fprintf(file, "%%endmacro\n"); ...


It should probably be like this:
Code: ... fprintf(file, "%%ifdef GO4K_USE_FLD\n"); fprintf(file, "GO4K_FLD_ID equ 11\n"); fprintf(file, "%%macro GO4K_FLD 1\n"); fprintf(file, " db %%1\n"); fprintf(file, "%%endmacro\n"); ...


I didn't actually recompile the VST plugin with this fix, I just hand-fixed the 4klang.inc file to get my song to work (which I'm trying to make for an Outline intro and I still don't even have any visuals done whatsoever yet).

By the way, these two definitions in 4klang.h don't seem to do anything. I guess they could be dropped:
Code: #define INTEGER_16BIT #define FLOAT_32BIT
added on the 2014-05-24 12:52:57 by yzi yzi
A fix would be great!
I had the same issue once. Had to leave out the load operation :(
added on the 2014-05-24 18:07:53 by Virgill Virgill
You can fix it yourself without compiling the VST plugin. In the 4klang.inc file you'll find a definition for the GO4K_FLD macro, and then there's a line with just "db" on it. Add " %1" at the end of the line. So the lines

Code: %macro GO4K_FLD 1 db


should actually be

Code: %macro GO4K_FLD 1 db %1


Then it works. You just have to do this each time you re-record the song to generate the .h and .inc files. If you fix the VST plugin like I suggested above, and re-compile the plugin DLL, then it will produce working files without manual editing.
added on the 2014-05-24 19:36:10 by yzi yzi
Just to inform you, gopher just went into holidays. So maybe he won´t read this or post here anytime soon...but i´ll forward this thread to him now via FB and so he´ll atleast be aware of the bug! ;)

P.S.: click my link above and have a look at gophers glöp-count! ;) Evil man is evil!
This is really not something that requires disturbing anyone's vacation. :) The workaround is easy, if you just know which line to edit in the .inc file before compiling the .obj file. (see my post above)
added on the 2014-05-24 20:40:11 by yzi yzi
Aaaaargh. I hit this bug AGAIN, having completely forgotten the whole thing. I made a song and it just crashed every time, and then I noticed that the parameter for the GO4K_FLD macro is unused and there's and empty db statement... Google for GO4K_FLD and yeah there's a Pouet thread about this! Great. Who's the op here... me?!! Doh.

Gopher, do you think you could release a 3.0.2 version of the regular 4k variety with this one more fix?
added on the 2017-05-31 22:46:08 by yzi yzi
Just to inform you, gopher just went into holidays, again. So maybe he won't read this post here anytime soon... but i'll forward this thread to him now via our Alcatraz slack group and so he'll at least be aware of the bug! ;)
added on the 2017-05-31 23:43:22 by xTr1m xTr1m
Is 3.1 not an option? I had this very same problem with Absolute Territory and just resorted to upgrading. Didn't notice any size increase, I don't think.
added on the 2017-05-31 23:48:35 by noby noby
Thanks again. I think I'll try detecting and fixing the broken .inc file line automatically, so this thing I'm working on can be used even with 4klang 3.0.1.
added on the 2017-05-31 23:53:18 by yzi yzi

login