From: parking_turkeys Date: Fri, 14 Aug 2026 21:08:51 +0000 (-0400) Subject: fixed rests :/ X-Git-Tag: horizons~5 X-Git-Url: http://git.p-t.hackclub.app/?a=commitdiff_plain;h=799eb6a1ff1bd54177c7a52db4a1acda6ea2687b;p=colon3wavtool.git fixed rests :/ --- diff --git a/main.c b/main.c index 9637591..b517264 100644 --- a/main.c +++ b/main.c @@ -40,7 +40,7 @@ int main(int argc, char *argv[]) */ //MessageBox(NULL, argv[4], "rest length", MB_OK); input_wave_length = ceil(44100.0 * length_arg_to_float(argv[4])) * 2; //first the amount of samples, then how many bytes that is :3 - printf("%d", input_wave_length); + printf("the length %s becomes %f\n", argv[4], length_arg_to_float(argv[4])); input_wave = malloc(input_wave_length); for (int index = 0; index < input_wave_length/2; index++) { diff --git a/useful.c b/useful.c index 7f9b6e1..5f2d949 100644 --- a/useful.c +++ b/useful.c @@ -22,6 +22,10 @@ float length_arg_to_float(char *arg) //and just adding the second part in i guess... shouldnt it be minused?? //actually no idea why the second part exists so im skipping it for now lmao //tyty yawu code author. otherwise i would be COOKED + + //OK NEW THING FIGURED OUT + //IF "calculate legnth on ui" is checked then uh + // the length thing is in MILLISECONDS. Yeah int i = 0; char c = 'x'; char buffer[50] = {'\0'}; //who is making smth with a longer number tbh @@ -65,7 +69,12 @@ float length_arg_to_float(char *arg) }; z = sign * arg_to_float(buffer); - return x/y/8 + z/1000; + float result = x/y/8 + z/1000; + if (x == 0 || y == 0) { + //length calculated on UI + result = z/1000; + }; + return result; }; float arg_to_float(char *arg)