diff --git a/shadermeh.c b/shadermeh.c index dccc65b..f85b3f1 100644 --- a/shadermeh.c +++ b/shadermeh.c @@ -71,11 +71,12 @@ static const struct option long_opts[] = { { "width", required_argument, NULL, 'w' }, { "height", required_argument, NULL, 'h' }, { "shader", required_argument, NULL, 's' }, + { "sampling-rate", required_argument, NULL, 'r' }, { "to-stdout", no_argument, NULL, 'S' }, { NULL, 0, NULL, 0 }, }; -static const char *short_opts = "w:h:s:S"; +static const char *short_opts = "w:h:s:S:r"; static const char *usage_str = "shadermeh OPTIONS...\n" @@ -90,6 +91,8 @@ static const char *usage_str = " --shader, -s \n" "\n"; +#define SND_BUFFER_SIZE 512 + int main(int argc, char **argv) { GLuint u_iResolution, u_iTime, u_iTimeDelta, u_iFrame; @@ -103,6 +106,9 @@ int main(int argc, char **argv) bool to_stdout = false; window *wnd; int i; + unsigned int sampling_rate = 0; + float in_samples[SND_BUFFER_SIZE]; /* Raw input floats from -1...1 */ + float norm_samples[SND_BUFFER_SIZE]; /* Normalized samples from 0...1 */ /******************** parse options ************************/ width = 800; @@ -123,6 +129,9 @@ int main(int argc, char **argv) case 's': shader_file = optarg; break; + case 'r': + sampling_rate = strtol(optarg, NULL, 10); + break; case 'S': to_stdout = true; break;