cli: tweaks for emscripten

This commit is contained in:
bnnm 2021-09-26 19:31:43 +02:00
parent 8e4d481fad
commit e9bfcd29c8

View File

@ -32,9 +32,15 @@
#define APP_INFO APP_NAME " (" __DATE__ ")" #define APP_INFO APP_NAME " (" __DATE__ ")"
/* low values are ok as there is very little performance difference, but higher /* Low values are ok as there is very little performance difference, but higher
* may improve write I/O in some systems as this*channels doubles as output buffer */ * may improve write I/O in some systems as this*channels doubles as output buffer
#define SAMPLE_BUFFER_SIZE 32768 * For systems with less memory (like wasm without -s ALLOW_MEMORY_GROWTH) lower helps a bit. */
//TODO: make it selectable with -n? in the future may just use internal bufs for min memory
#ifdef __EMSCRIPTEN__
#define SAMPLE_BUFFER_SIZE 1024
#else
#define SAMPLE_BUFFER_SIZE 32768
#endif
/* getopt globals from .h, for reference (the horror...) */ /* getopt globals from .h, for reference (the horror...) */
//extern char* optarg; //extern char* optarg;
@ -150,8 +156,8 @@ static int parse_config(cli_config* cfg, int argc, char** argv) {
cfg->seek_samples1 = -1; cfg->seek_samples1 = -1;
cfg->seek_samples2 = -1; cfg->seek_samples2 = -1;
/* don't let getopt print errors to stdout automatically */ opterr = 0; /* don't let getopt print errors to stdout automatically */
opterr = 0; optind = 1; /* reset getopt's ugly globals (needed in wasm that may call same main() multiple times) */
/* read config */ /* read config */
while ((opt = getopt(argc, argv, "o:l:f:d:ipPcmxeLEFrgb2:s:t:Tk:K:hOvD:S:" while ((opt = getopt(argc, argv, "o:l:f:d:ipPcmxeLEFrgb2:s:t:Tk:K:hOvD:S:"