Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix oscsendfile #161

Merged
merged 2 commits into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading