summaryrefslogtreecommitdiff
path: root/libs/ardouralsautil
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2014-06-29 21:19:04 +0200
committerRobin Gareus <robin@gareus.org>2014-06-29 21:19:04 +0200
commitc1ae35242bc4964ccae1826296bb8637e9ccc2de (patch)
treead644baac87a6f6c6e9a6af0fadaff890871a555 /libs/ardouralsautil
parentcbdeaefa1cb9a50eebb2f33aadca2758f4e208aa (diff)
update ARD - allow to release it as standalone tool.
see https://github.com/x42/alsa_request_device
Diffstat (limited to 'libs/ardouralsautil')
-rw-r--r--libs/ardouralsautil/request_device.c26
-rw-r--r--libs/ardouralsautil/wscript2
2 files changed, 20 insertions, 8 deletions
diff --git a/libs/ardouralsautil/request_device.c b/libs/ardouralsautil/request_device.c
index 6bb68ac05a..4ba80ec624 100644
--- a/libs/ardouralsautil/request_device.c
+++ b/libs/ardouralsautil/request_device.c
@@ -31,6 +31,16 @@
#include "ardouralsautil/reserve.h"
+#ifndef ARD_PROG_NAME
+#define ARD_PROG_NAME "alsa_request_device"
+#endif
+#ifndef ARD_APPL_NAME
+#define ARD_APPL_NAME "ALSA User"
+#endif
+#ifndef VERSION
+#define VERSION "v0.3"
+#endif
+
static int run = 1;
static int release_wait_for_signal = 0;
static pid_t parent_pid = 0;
@@ -48,7 +58,7 @@ static int stdin_available(void) {
}
static void print_version(int status) {
- printf ("ardour-request-device 0.2\n\n");
+ printf (ARD_PROG_NAME " " VERSION "\n\n");
printf (
"Copyright (C) 2014 Robin Gareus <robin@gareus.org>\n"
"This is free software; see the source for copying conditions. There is NO\n"
@@ -58,8 +68,8 @@ static void print_version(int status) {
}
static void usage(int status) {
- printf ("ardour-request-device - DBus Audio Reservation Utility.\n");
- printf ("Usage: ardour-request-device [ OPTIONS ] <Audio-Device-ID>\n");
+ printf (ARD_PROG_NAME " - DBus Audio Reservation Utility.\n");
+ printf ("Usage: " ARD_PROG_NAME " [ OPTIONS ] <Audio-Device-ID>\n");
printf ("Options:\n\
-h, --help display this help and exit\n\
-p, --priority <int> reservation priority (default: int32_max)\n\
@@ -74,23 +84,23 @@ This tool issues a dbus request to reserve an ALSA Audio-device.\n\
If successful other users of the device (e.g. pulseaudio) will\n\
release the device.\n\
\n\
-ardour-request-device by default announces itself as \"Ardour ALSA Backend\"\n\
+" ARD_PROG_NAME " by default announces itself as \"" ARD_APPL_NAME "\"\n\
and uses the maximum possible priority for requesting the device.\n\
These settings can be overriden using the -n and -p options respectively.\n\
\n\
If a PID is given the tool will watch the process and if that is not running\n\
-release the device and exit. Otherwise ardour-request-device runs until\n\
+release the device and exit. Otherwise " ARD_PROG_NAME " runs until\n\
either stdin is closed, a SIGINT or SIGTERM is received or some other\n\
application requests the device with a higher priority.\n\
\n\
-Without the -w option, ardour-request-device yields the device after 500ms to\n\
+Without the -w option, " ARD_PROG_NAME " yields the device after 500ms to\n\
any higher-priority request. With the -w option this tool waits until it\n\
for SIGINT or SIGTERM - but at most 4 sec to acknowledge before releasing.\n\
\n\
The audio-device-id is a string e.g. 'Audio1'\n\
\n\
Examples:\n\
-ardour-request-device Audio0\n\
+" ARD_PROG_NAME " Audio0\n\
\n");
printf ("Report bugs to Robin Gareus <robin@gareus.org>\n");
@@ -140,7 +150,7 @@ int main(int argc, char **argv) {
int ret, c;
int32_t priority = INT32_MAX;
- char *name = strdup("Ardour ALSA Backend");
+ char *name = strdup(ARD_APPL_NAME);
while ((c = getopt_long (argc, argv,
"h" /* help */
diff --git a/libs/ardouralsautil/wscript b/libs/ardouralsautil/wscript
index 6aeadcd767..d32b2ab4c4 100644
--- a/libs/ardouralsautil/wscript
+++ b/libs/ardouralsautil/wscript
@@ -50,4 +50,6 @@ def build(bld):
obj.defines = [
'_POSIX_SOURCE',
'_XOPEN_SOURCE=500',
+ 'ARD_PROG_NAME="ardour-request-device"',
+ 'ARD_APPL_NAME="Ardour ALSA Backend"',
]