diff options
| author | tlatorre <tlatorre@uchicago.edu> | 2022-11-06 03:14:04 -0600 | 
|---|---|---|
| committer | tlatorre <tlatorre@uchicago.edu> | 2022-11-06 03:14:04 -0600 | 
| commit | 0a4b2d0dd49c7b4c18bdbaa8aa044397f6414d57 (patch) | |
| tree | 13f773ad8b28f86c56c4cc979bb2e574cf4e4b70 /vito.c | |
| parent | bb3d700a6c96efb2728c2815062118e9aad326b6 (diff) | |
| download | moji-0a4b2d0dd49c7b4c18bdbaa8aa044397f6414d57.tar.gz moji-0a4b2d0dd49c7b4c18bdbaa8aa044397f6414d57.tar.bz2 moji-0a4b2d0dd49c7b4c18bdbaa8aa044397f6414d57.zip  | |
add text to speech and change beer symbol to water symbol
Diffstat (limited to 'vito.c')
| -rw-r--r-- | vito.c | 15 | 
1 files changed, 13 insertions, 2 deletions
@@ -1,5 +1,6 @@  #include <gtk/gtk.h>  #include <sys/time.h> +#include <stdlib.h>  #define LEN(x) ((sizeof(x)/sizeof(0[x])) / ((size_t)(!(sizeof(x) % sizeof(0[x]))))) @@ -19,7 +20,8 @@ GtkTextTag *tag;  #define LEFT_ARROW "\xe2\x86\x90"  #define CLEAR_SCREEN "\xe2\x8e\x9a" -#define DRINK "\xf0\x9f\x8d\xba" +#define SOUND "\xf0\x9f\x94\x8a" +#define DRINK "\xf0\x9f\x9a\xb0"  #define FOOD "\xf0\x9f\x8d\xb2"  #define TIRED "\xf0\x9f\x98\xab"  #define HAPPY "\xf0\x9f\x98\x80" @@ -60,6 +62,7 @@ const char *alphabet[] = {      "z",      LEFT_ARROW,      CLEAR_SCREEN, +    SOUND,      "_",      NEWLINE,      "!", @@ -67,7 +70,7 @@ const char *alphabet[] = {      "."  }; -char buf[1000000]; +char buf[100000];  /* The current alphabetical letter. */  int current_letter = 0; @@ -132,6 +135,14 @@ static int released(GtkWidget *widget, gpointer   data)          } else if (!strcmp(current_char,CLEAR_SCREEN)) {              current_position = 0;              current_letter = 0; +        } else if (!strcmp(current_char,SOUND)) { +            char cmd[1000000]; +            buf[current_position] = '\0'; +            sprintf(cmd, "gtts-cli \"%s\" --output vito.mp3", buf); +            if (!system(cmd)) { +                system("mpg123 vito.mp3"); +                system("rm vito.mp3"); +            }          } else if (!strcmp(current_char,"_")) {              sprintf(buf+current_position," ");              current_position += strlen(current_char);  | 
