]> _ Git - colon3utau.git/commitdiff
theres a bad bug BUT almost every like warning is gone and i turned on -Wall... uhh...
authorparking_turkeys <roya1060wien@gmail.com>
Thu, 29 Oct 2026 16:51:37 +0000 (12:51 -0400)
committerparking_turkeys <roya1060wien@gmail.com>
Thu, 29 Oct 2026 16:51:37 +0000 (12:51 -0400)
base64.c
main.c
render/render.c
render/render.h
render/tools.c
render/ust_process.c
useful.c
utau.h

index 4a5433d..65954eb 100644 (file)
--- a/base64.c
+++ b/base64.c
@@ -43,7 +43,6 @@ int encode_pitch_array_base_64(char buffer[],int data[], int data_length) //from
                buffer[str_i] = '\0';
        } else {
                for (int i = 0; i < data_length; i++) {
-                       char *d = encode_int_to_base64(data[i]); //char[3], 3 == '\0'
                        
                        if (last == data[i]) {
                                dups++;
diff --git a/main.c b/main.c
index a29be1b..cb89011 100644 (file)
--- a/main.c
+++ b/main.c
@@ -2,29 +2,20 @@
 
 //the main file UwU
 
-int main(int argc, char *argv[])
+int main(int argc, char **argv)
 {
        //colon3utau [render|--version|] [arguments]
 
-       if (argc == 1) {
-               //print_Help();
-               return 0;
-       };
-
        //printf(argv[1]);
-       
-       if (strcmp(argv[1], "render") == 0) {
-               //render
-               Render(argc, argv);
-       } else if (strcmp(argv[1], "cheese") == 0) {
-               //cheese
-               printf("I want to cheese.");
-       } else if (strcmp(argv[1], "--version")) {
-               //version
-               printf("version 0.1, parking_turkeys");
-       } else {
-               printf("Command not recognized.");
-       };
+       if (argc == 1) printf("colon3utau version 0.1\n"
+               "(c) parking_turkeys, 2026\n"
+               "licensed under the GPL version 3.0 or any later version\n"
+               );
+       else if (ö(argv[1], "render")) Render(argc, argv);
+       else if (ö(argv[1], "Render")) Render(argc, argv);
+       else if (ö(argv[1], "cheese")) printf("I want to cheese.\n");
+       else if (ö(argv[1], "--version")) printf("version 0.1, parking_turkeys\n");
+       else printf("Command not recognized.");
 
        return 0;
 
index 85df187..0bb3f34 100644 (file)
@@ -9,19 +9,27 @@ int Render(int argc, char *argv[])
 {
        /* colon3utau render <ust> [options] */
        /* options:
-        * --ask (default): ask for filepaths
+        * --ask : ask for filepaths
         * (nothing else is implemented LOL)
         * (config files soon[tm])
         *
         */
-
+       ä("renering\n", "Render()");
+       if (argc < 3) { ä("Not enough arguments", "Render()"); return 0;};
        char *USTpath = argv[2];
+       char *wavtool_path, *resampler_path, *voicebank_path;
+       if (NULL) goto ask_for_paths;
+
+default_paths:
+       wavtool_path = DEFAULT_WAVTOOL;
+       resampler_path = DEFAULT_RESAMPLER;
+       voicebank_path = DEFAULT_VOICEBANK;
+       goto process_ust;
        
-       
-       //this is the --ask part
-       char *wavtool_path = malloc(MAX_TOOL_PATH);
-       char *resampler_path = malloc(MAX_TOOL_PATH);
-       char *voicebank_path = malloc(MAX_TOOL_PATH);
+ask_for_paths:
+       wavtool_path = malloc(MAX_TOOL_PATH);
+       resampler_path = malloc(MAX_TOOL_PATH);
+       voicebank_path = malloc(MAX_TOOL_PATH);
 
        printf("Default wavtool path: %s\n", DEFAULT_WAVTOOL);
        ask_for_input("Enter path to wavtool:", wavtool_path, MAX_TOOL_PATH);
@@ -33,8 +41,8 @@ int Render(int argc, char *argv[])
        ask_for_input("Enter path to voicebank:", voicebank_path, MAX_TOOL_PATH);
 
 
-       //next, process the UST
-       
+process_ust:
+       process_ust(wavtool_path, resampler_path, voicebank_path, USTpath);
        
        return 1;
 };
index 47ffcf6..cc22060 100644 (file)
@@ -6,9 +6,17 @@
 
 //default paths--these should never be used in prod lol
 //voicebank should be the folder containing character.txt
+#ifdef WINDOWS
 #define DEFAULT_WAVTOOL   "D:\\applications\\utau\\wavtool.exe"
 #define DEFAULT_RESAMPLER "D:\\applications\\utau\\resampler.exe"
 #define DEFAULT_VOICEBANK "D:\\applications\\utau\\voice\\uta"
+#endif /* WINDOWS */
+
+#ifdef LINUX
+#define DEFAULT_WAVTOOL "./test/colon3wavtool"
+#define DEFAULT_RESAMPLER "./test/colon3sampler"
+#define DEFAULT_VOICEBANK "/home/p-t/voice/teto/cv"
+#endif /* LINUX */
 
 
 
index 37912ce..29dd34f 100644 (file)
@@ -23,7 +23,31 @@ int call_resampler(USTinfo *s, USTnote *n, struct oto_line *o)
        //<oto[2]> <oto[3]> <volume> <modulation> <!tempo> <pitchbend>
        sprintf(curr_note_file, "n%04d.wav", notes_done);
        notes_done++;
-       char *infile = "";
+       char *resampler = s->resampler;
+       char *infile = o->filename;
+       char *outfile = "out.wav";
+       char *midi = midi_int_to_text(n->midinote);
+       float vel = n->velocity;
+       char *flags = n->flags;
+       float oto1 = o->offset;
+       int len = n->length;
+       float oto2 = o->consonant;
+       float oto3 = o->cutoff;
+       int volume = n->intensity;
+       float modu = n->modulation;
+       float tempo = s->tempo;
+       /* Do pitchbend later */
+       int len_req = snprintf( NULL, 0, 
+               "\"%s\" \"%s\" \"%s\" %s %f \"%s\" %f %d %f %f %d %f %f",
+               resampler, infile, outfile, midi, vel, flags, oto1, len,
+               oto2, oto3, volume, modu, tempo);
+
+       char *call_string  = malloc(len_req + 3);
+       snprintf(call_string, len_req + 1,
+               "\"%s\" \"%s\" \"%s\" %s %f \"%s\" %f %d %f %f %d %f %f",
+               resampler, infile, outfile, midi, vel, flags, oto1, len,
+               oto2, oto3, volume, modu, tempo);
+       system(call_string);
 };
 
 int call_wavtool  (struct USTinfo *s, struct USTnote *n, struct oto_line *o)
@@ -32,8 +56,8 @@ int call_wavtool  (struct USTinfo *s, struct USTnote *n, struct oto_line *o)
        
        //1. get all the parts :D
        char *wavtool_path = s->wavtool;
-       char *outfile_path = "out.wav";
-       char *infile_path = o->filename;
+       char *outfile_path = "temp.wav";
+       char *infile_path = "out.wav";
        float offset = o->offset;
        int length = n->length;
        float *e = n->envelope; 
@@ -89,6 +113,8 @@ struct oto_line *find_oto_line(char *oto_dir, char *lyric)
                                if (p == 1) {
                                        alias[i] = '\0';
                                        if (same(alias, lyric)) f = 1;
+                               } else if (p > 1) {
+                                       parts[p-2][i] = '\0';
                                };
                                p++; i = 0;
                                break;
@@ -113,8 +139,16 @@ struct oto_line *find_oto_line(char *oto_dir, char *lyric)
 
        return NULL;
 
-       found:
-               return &line;
+found:
+       line.filename = filename;
+       line.alias = alias;
+       line.offset = ß(parts[0]);
+       line.consonant = ß(parts[1]);
+       line.cutoff = ß(parts[2]);
+       line.preutterance = ß(parts[3]);
+       line.overlap = ß(parts[4]);
+
+       return &line;
 };
 
 
index 8f84b4e..27d36d1 100644 (file)
@@ -23,11 +23,13 @@ int process_ust(char *wavtool, char *resampler, char *voice, char *UST)
 {
        FILE *fp;
        fp = fopen(UST, "r");
+       if (fp == NULL) goto error;
+       printf("got UST");
 
        char c;
        int i = 0;
        char buffer[256];
-       struct USTnote *curr_note;
+       struct USTnote *curr_note = {0};
        *curr_note = (struct USTnote) {
                0,
                NULL,
@@ -52,7 +54,7 @@ int process_ust(char *wavtool, char *resampler, char *voice, char *UST)
 
        };
 
-       struct USTinfo *settings;
+       struct USTinfo *settings = {0};
        *settings = (struct USTinfo){
                120.0,
                1,
@@ -67,64 +69,68 @@ int process_ust(char *wavtool, char *resampler, char *voice, char *UST)
        while ((true) && ((c = getc(fp)) != EOF)) {
                
                switch (mode) {
-                       case MODE_NEW_LINE:
-                               switch (c) {
-                                       case '[':
-                                               mode = MODE_HEADING;
-                                               break;
-                                       case '\n':
-                                               break;
-                                       default:
-                                               fseek(fp, -1, SEEK_CUR);
-                                               switch (curr_heading) {
-                                                       case HEADING_VERSION:
-                                                               break;
-                                                       case HEADING_SETTINGS:
-                                                               add_ust_setting(fp, settings);
-                                                               break;
-                                                       case HEADING_NOTE:
-                                                               add_note_setting(fp, curr_note);
-                                                               break;
-                                                       default:
-                                                               break;
-                                               };
-                                               break;
-                               };
+               case MODE_NEW_LINE:
+               switch (c) {
+                       case '[':
+                               printf("new heading!!");
+                               mode = MODE_HEADING;
                                break;
-                       case MODE_HEADING:
-                               switch (c) {
-                                       case '#':
+                       case '\n':
+                               break;
+                       default:
+                               fseek(fp, -1, SEEK_CUR);
+                               switch (curr_heading) {
+                                       case HEADING_VERSION:
                                                break;
-                                       case '\n':
-                                               mode = MODE_NEW_LINE;
+                                       case HEADING_SETTINGS:
+                                               add_ust_setting(fp, settings);
                                                break;
-                                       case ']':
-                                               buffer[i] = '\0';
-                                               if (strcmp(buffer, "VERSION") == 0) {
-                                                       curr_heading = HEADING_VERSION;
-                                               } else if (strcmp(buffer, "SETTING") == 0) {
-                                                       curr_heading = HEADING_SETTINGS;
-                                               } else if (strcmp(buffer, "TRACKEND") == 0) {
-                                                       //do nothing
-                                               } else {
-                                                       curr_heading = HEADING_NOTE;
-                                                       if (curr_note) {
-                                                               process_note(settings, curr_note);
-                                                       };
-                                               };
+                                       case HEADING_NOTE:
+                                               add_note_setting(fp, curr_note);
                                                break;
                                        default:
-                                               buffer[i++] = c;
                                                break;
+                                       };
+                               break;
+               };
+               break;
+               case MODE_HEADING:
+               switch (c) {
+                       case '#':
+                               break;
+                       case '\n':
+                               mode = MODE_NEW_LINE;
+                               break;
+                       case ']':
+                               buffer[i] = '\0';
+                               if (strcmp(buffer, "VERSION") == 0) {
+                                       curr_heading = HEADING_VERSION;
+                               } else if (strcmp(buffer, "SETTING") == 0) {
+                                       curr_heading = HEADING_SETTINGS;
+                               } else if (strcmp(buffer, "TRACKEND") == 0) {
+                                       //do nothing
+                               } else {
+                                       curr_heading = HEADING_NOTE;
+                                       if (curr_note) {
+                                               printf("time to process a note!!");
+                                               process_note(settings, curr_note);
+                                       };
                                };
                                break;
                        default:
-                               printf("v strange error, why is mode not what it should be?? (ust_process.c)");
+                               buffer[i++] = c;
                                break;
-                       };
+               };
+               break;
+               default:
+                       printf("v strange error, why is mode not what it should be?? (ust_process.c)");
+                       break;
+               };
        };
 
        return 1;
+error:
+       printf("ERror!! in process_ust!!");
 };
 
 static int process_keyval(FILE *fp, char *key, char *value);
@@ -232,7 +238,7 @@ int add_note_setting(FILE *fp, USTnote *n)
                process_pitch_list_float(VBR, value);
                n->VBR = VBR;
        } else if (same(key, "PreUtterance")) {
-               if (value != "") {
+               if (!ö(value, "")) {
                        n->preutterance = arg_to_float(value);
                } else {
                        n->preutterance = 0;
index 3578a06..372ef40 100644 (file)
--- a/useful.c
+++ b/useful.c
@@ -111,6 +111,10 @@ float arg_to_float(char *arg)
 
 int report_error(char *msg, char *portion, char *program)
 {
+       /* I should probably stop using this for logging non-errors...
+        * but stderr is unbuffered so it's useful since a segmentation fault
+        * will quit the program, so i can see exactly when it breaks!
+        */
        fprintf(stderr, "%s: [%s] %s\n", program, portion, msg);
        return 1;       
 };
@@ -142,7 +146,7 @@ int ask_for_input(char *prompt, char *buffer, int INPUT_MAX) //intended for path
 int same(char *a, char *b)
 {
        char ac, bc;
-       int i;
+       int i = 0;
        while (((ac = a[i]) != '\0') && ((bc = b[i]) != '\0')) {
                if (ac != bc) {
                        return 0;
diff --git a/utau.h b/utau.h
index 867390e..7083112 100644 (file)
--- a/utau.h
+++ b/utau.h
@@ -12,6 +12,8 @@
 #include <stdbool.h>
 
 #define ß(a) arg_to_float(a)
+#define ö(a, b) same(a, b)
+#define ä(a, b) report_error(a, b, "colon3utau");
 
 /* FUNCTIONS */
 /* functions noted with "malloc()" require the returned value to be free()d */