From c4bb6db90825829b57067c177bf1e4e98c638685 Mon Sep 17 00:00:00 2001 From: parking_turkeys Date: Fri, 14 Aug 2026 17:36:10 -0400 Subject: [PATCH] write description for modifyWave --- main.c | 10 +++++++++- modifywave.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ wavtool.h | 2 +- 3 files changed, 55 insertions(+), 2 deletions(-) create mode 100644 modifywave.c diff --git a/main.c b/main.c index b517264..9f3a7be 100644 --- a/main.c +++ b/main.c @@ -50,6 +50,7 @@ int main(int argc, char *argv[]) //not working?! //got the wrong argument... } + int errored = 0; if (input_wave != NULL) { errored = readWave(argv[2], input_wave); @@ -58,10 +59,17 @@ int main(int argc, char *argv[]) goto error; }; + if (errored != -1) { + errored = modifyWave(input_wave, input_wave_length, argc, argv); + } else { + error_msg = "error from readWave()"; + goto error; + }; + if (errored != -1) { errored = appendWave(input_wave, input_wave_length, argv[1]); } else { - error_msg = "[main()] error from readWave()"; + error_msg = "error from modifyWave()"; goto error; }; free(input_wave); diff --git a/modifywave.c b/modifywave.c new file mode 100644 index 0000000..ce81aa9 --- /dev/null +++ b/modifywave.c @@ -0,0 +1,45 @@ +#include "wavtool.h" + + +int modifyWave(int16_t w[], int w_B, int argc, char *argv[]) +{ + /* DESCRIPTION OF ARGUMENTS + * as to the arguments -- + * according to gh/delta-kimigatame/PyWavTool, these are the options: + * > p1 p2 + * > p1 p2 p3 v1 v2 v3 v4 + * > p1 p2 p3 v1 v2 v3 v4 ove + * > p1 p2 p3 v1 v2 v3 v4 ove p4 + * > p1 p2 p3 v1 v2 v3 v4 ove p4 p5 v5 + * > float: p1, p2, p3, p4, p5, ove + * > int: v1, v2, v3, v4, v5 + * very useful :D + * not sure what they should default to when not there tho... + * + * although this claims pn is a float, i cant set it to one... + * maybe it's a float but like .0 ?? who cares + * + * as to what i can guess these mean... + * theyre for the envelope i think + * + * when setting the envelope in UTAU, ... + * + * p1 - bottom left corner, x from left + * p2 - top left corner, x from left + * p3 - top right corner, x from right + * p4 - bottom right corner, x from right + * p5 - "extra" point, x from left + * + * NOTE: if p1 > p2, p2 remains at the lower value but is shown as + * being == to p1. It's the same if p4 > p3 + * + * v1 - bottom left corner, y from bottom (if > 0, a line connects this and 0,0) + * v2 - top left corner, y from bottom + * v3 - top right corner, y from bottom + * v4 - bottom right corner, y from bottom (similar to v1) + * v5 - "extra" point, y from bottom + * + * ove - overlap of the prior note?? not entirely sure tbh (ill do ts last :p) + * + * well that was long + */ diff --git a/wavtool.h b/wavtool.h index c87b9cb..9221dbc 100644 --- a/wavtool.h +++ b/wavtool.h @@ -26,7 +26,7 @@ int report_error(char *error_msg, char *portion, char *program); //in a function int readWave(char *filename, int16_t buffer[]); //then edit the wave based on argv (do this later!!) -//int modifyWave(int16_t wave[], int argc, char *argv[]); +int modifyWave(int16_t wave[], int wave_length_bytes, int argc, char *argv[]); //then append the new wave into the output file, creating it if it doesn't exist, and fixing the header! int appendWave(int16_t wave[], int wave_length_bytes, char *output_filename); -- 2.47.3