Skip to content

Commit

Permalink
Merge pull request #161 from malloch/fix-oscsendfile
Browse files Browse the repository at this point in the history
Fix oscsendfile
  • Loading branch information
radarsat1 authored Nov 8, 2024
2 parents e5f6d07 + a723664 commit c7abaf3
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
*~
*.lo
*.la
*.DS_Store
.deps
.libs
/Makefile
Expand All @@ -10,6 +11,8 @@
/autom4te.cache/
/build/Makefile
/build/Makefile.in
/cmake/Makefile
/cmake/Makefile.in
/compile
/config.guess
/config.h
Expand Down Expand Up @@ -55,6 +58,7 @@
/src/tools/Makefile.in
/src/tools/oscdump
/src/tools/oscsend
/src/tools/oscsendfile
/stamp-h1
/test
/test-driver
Expand Down
18 changes: 14 additions & 4 deletions src/tools/oscsendfile.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
/*
* oscsend - Send OpenSound Control message.
* oscsendfile - Send OpenSound Control message.
*
* Copyright (C) 2016 Joseph Malloch <[email protected]>
*
* Adapted from oscsend:
* Copyright (C) 2008 Kentaro Fukuchi <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
Expand Down Expand Up @@ -45,8 +47,8 @@ void usage(void)
printf("oscsendfile version %s\n"
"Copyright (C) 2016 Joseph Malloch\n"
" adapted from oscsend.c (C) 2008 Kentaro Fukuchi\n\n"
"Usage: oscsend hostname port file <speed>\n"
"or oscsend url file <speed>\n"
"Usage: oscsendfile hostname port file <speed>\n"
"or oscsendfile url file <speed>\n"
"Send OpenSound Control messages from a file via UDP.\n\n"
"Description\n"
"hostname: specifies the remote host's name.\n"
Expand All @@ -55,7 +57,7 @@ void usage(void)
" e.g. UDP \"osc.udp://localhost:9000\"\n"
" Multicast \"osc.udp://224.0.1.9:9000\"\n"
" TCP \"osc.tcp://localhost:9000\"\n"
"speed : specifies a speed multiplier.\n",
"speed : specifies a speed multiplier (must be > 0).\n",
VERSION);
printf("Example\n"
"$ oscsendfile localhost 7777 myfile.txt 2.5\n");
Expand Down Expand Up @@ -219,15 +221,19 @@ lo_message create_message(char **argv)
}
case LO_TRUE:
lo_message_add_true(message);
++argi;
break;
case LO_FALSE:
lo_message_add_false(message);
++argi;
break;
case LO_NIL:
lo_message_add_nil(message);
++argi;
break;
case LO_INFINITUM:
lo_message_add_infinitum(message);
++argi;
break;
default:
fprintf(stderr, "Type '%c' is not supported or invalid.\n",
Expand Down Expand Up @@ -451,6 +457,10 @@ int main(int argc, char **argv)
if (argc > i+1) {
// optional speed argument
speed = atof(argv[i+1]);
if (speed <= 0.0) {
fprintf(stderr, "Negative speed multiplier is not supported.\n");
exit(1);
}
}
ret = send_file(target, speed);

Expand Down

0 comments on commit c7abaf3

Please sign in to comment.