forked from goliath/shadermeh
Compare commits
No commits in common. "51f808d12f2ead5554ca7ff2832f60b7c51c6f52" and "be8f7d1716024894a67b10cc290b18c1a430e5ae" have entirely different histories.
51f808d12f
...
be8f7d1716
1 changed files with 2 additions and 11 deletions
13
shadermeh.c
13
shadermeh.c
|
@ -51,7 +51,7 @@ static int write_retry(int fd, const void *buffer, size_t size)
|
||||||
int ret = write(fd, buffer, size);
|
int ret = write(fd, buffer, size);
|
||||||
|
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
if (errno == EINTR)
|
if (errno == EINTR || errno == EAGAIN)
|
||||||
continue;
|
continue;
|
||||||
perror("write");
|
perror("write");
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -71,12 +71,11 @@ static const struct option long_opts[] = {
|
||||||
{ "width", required_argument, NULL, 'w' },
|
{ "width", required_argument, NULL, 'w' },
|
||||||
{ "height", required_argument, NULL, 'h' },
|
{ "height", required_argument, NULL, 'h' },
|
||||||
{ "shader", required_argument, NULL, 's' },
|
{ "shader", required_argument, NULL, 's' },
|
||||||
{ "sampling-rate", required_argument, NULL, 'r' },
|
|
||||||
{ "to-stdout", no_argument, NULL, 'S' },
|
{ "to-stdout", no_argument, NULL, 'S' },
|
||||||
{ NULL, 0, NULL, 0 },
|
{ NULL, 0, NULL, 0 },
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char *short_opts = "w:h:s:S:r";
|
static const char *short_opts = "w:h:s:S";
|
||||||
|
|
||||||
static const char *usage_str =
|
static const char *usage_str =
|
||||||
"shadermeh OPTIONS...\n"
|
"shadermeh OPTIONS...\n"
|
||||||
|
@ -91,8 +90,6 @@ static const char *usage_str =
|
||||||
" --shader, -s <shader file>\n"
|
" --shader, -s <shader file>\n"
|
||||||
"\n";
|
"\n";
|
||||||
|
|
||||||
#define SND_BUFFER_SIZE 512
|
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
GLuint u_iResolution, u_iTime, u_iTimeDelta, u_iFrame;
|
GLuint u_iResolution, u_iTime, u_iTimeDelta, u_iFrame;
|
||||||
|
@ -106,9 +103,6 @@ int main(int argc, char **argv)
|
||||||
bool to_stdout = false;
|
bool to_stdout = false;
|
||||||
window *wnd;
|
window *wnd;
|
||||||
int i;
|
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 ************************/
|
/******************** parse options ************************/
|
||||||
width = 800;
|
width = 800;
|
||||||
|
@ -129,9 +123,6 @@ int main(int argc, char **argv)
|
||||||
case 's':
|
case 's':
|
||||||
shader_file = optarg;
|
shader_file = optarg;
|
||||||
break;
|
break;
|
||||||
case 'r':
|
|
||||||
sampling_rate = strtol(optarg, NULL, 10);
|
|
||||||
break;
|
|
||||||
case 'S':
|
case 'S':
|
||||||
to_stdout = true;
|
to_stdout = true;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue