chiark
/
gitweb
/
~mdw
/
jog
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
New audio subsystem.
[jog]
/
main.c
diff --git
a/main.c
b/main.c
index b30b7ec28bf5ddde6db07628a86a33530da818cd..19f40fa41de40351b94796d7df53d3ada2b16dec 100644
(file)
--- a/
main.c
+++ b/
main.c
@@
-1,6
+1,6
@@
/* -*-c-*-
*
/* -*-c-*-
*
- * $Id: main.c,v 1.
2 2002/01/30 09:27:55
mdw Exp $
+ * $Id: main.c,v 1.
3 2002/02/02 19:21:53
mdw Exp $
*
* Main program
*
*
* Main program
*
@@
-29,6
+29,9
@@
/*----- Revision history --------------------------------------------------*
*
* $Log: main.c,v $
/*----- Revision history --------------------------------------------------*
*
* $Log: main.c,v $
+ * Revision 1.3 2002/02/02 19:21:53 mdw
+ * New audio subsystem.
+ *
* Revision 1.2 2002/01/30 09:27:55 mdw
* Parse tracing options on the command-line.
*
* Revision 1.2 2002/01/30 09:27:55 mdw
* Parse tracing options on the command-line.
*
@@
-39,6
+42,10
@@
/*----- Header files ------------------------------------------------------*/
/*----- Header files ------------------------------------------------------*/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
@@
-54,6
+61,7
@@
#include <mLib/report.h>
#include <mLib/trace.h>
#include <mLib/report.h>
#include <mLib/trace.h>
+#include "au.h"
#include "err.h"
#include "jog.h"
#include "rxglue.h"
#include "err.h"
#include "jog.h"
#include "rxglue.h"
@@
-67,6
+75,7
@@
static int sigtab[] = { SIGINT, SIGQUIT, SIGTERM, SIGHUP, -1 };
static void tidy(void)
{
txsu_shutdown();
static void tidy(void)
{
txsu_shutdown();
+ au_shutdown();
}
static void sigtidy(int sig)
}
static void sigtidy(int sig)
@@
-81,7
+90,8
@@
static void sigtidy(int sig)
static void usage(FILE *fp)
{
pquis(fp, "\
static void usage(FILE *fp)
{
pquis(fp, "\
-Usage: $ [-t TRANSPORT] [-f FILE] [-c CONFIG] SCRIPT ARG...\n\
+Usage: $ [-t TRANSPORT] [-f FILE] [-c CONFIG] [-a AUDIR] [-x SIZE]\n\
+ SCRIPT ARG...\n\
");
}
");
}
@@
-105,6
+115,9
@@
Options provided:\n\
-t, --transport=NAME Use transport type NAME.\n\
-f, --tx-file=FILE Communicate using the named FILE.\n\
-c, --tx-config=CONFIG Use CONFIG as transport configuration.\n\
-t, --transport=NAME Use transport type NAME.\n\
-f, --tx-file=FILE Communicate using the named FILE.\n\
-c, --tx-config=CONFIG Use CONFIG as transport configuration.\n\
+\n\
+-a, --audio=DIR Set directory containing audio samples.\n\
+-x, --cache-max=SIZE Maximum size for audio sample cache.\n\
",
fp);
}
",
fp);
}
@@
-116,6
+129,8
@@
int main(int argc, char *argv[])
unsigned f = 0;
int rc = 0;
int i;
unsigned f = 0;
int rc = 0;
int i;
+ const char *audir = 0;
+ size_t aumax = AU_CACHEMAX;
#define f_bogus 1u
#define f_bogus 1u
@@
-155,6
+170,15
@@
int main(int argc, char *argv[])
{ "txfile", OPTF_ARGREQ, 0, 'f' },
{ "file", OPTF_ARGREQ, 0, 'f' },
{ "txfile", OPTF_ARGREQ, 0, 'f' },
{ "file", OPTF_ARGREQ, 0, 'f' },
+ /* --- Audio configuration stuff --- */
+
+ { "audio-directory",
+ OPTF_ARGREQ, 0, 'a' },
+ { "audio-cache-max",
+ OPTF_ARGREQ, 0, 'x' },
+ { "cache-max",
+ OPTF_ARGREQ, 0, 'x' },
+
/* --- Debugging stuff --- */
#ifndef NTRACE
/* --- Debugging stuff --- */
#ifndef NTRACE
@@
-170,12
+194,14
@@
int main(int argc, char *argv[])
static const trace_opt tropt[] = {
{ 'x', T_TX, "transport layer" },
{ 's', T_TXSYS, "low-level transport" },
static const trace_opt tropt[] = {
{ 'x', T_TX, "transport layer" },
{ 's', T_TXSYS, "low-level transport" },
+ { 'a', T_AU, "audio subsystem" },
+ { 'y', T_AUSYS, "system-specific audio" },
{ 'A', T_ALL, "all of the above" },
{ 0, 0, 0 }
};
#endif
{ 'A', T_ALL, "all of the above" },
{ 0, 0, 0 }
};
#endif
- i = mdwopt(argc, argv, "hvu" "t:c:f:" T("T:"), opt, 0, 0, 0);
+ i = mdwopt(argc, argv, "hvu" "t:c:f:"
"a:x:"
T("T:"), opt, 0, 0, 0);
if (i < 0)
break;
if (i < 0)
break;
@@
-205,6
+231,15
@@
int main(int argc, char *argv[])
txfile = optarg;
break;
txfile = optarg;
break;
+ /* --- Audio configuration stuff --- */
+
+ case 'a':
+ audir = optarg;
+ break;
+ case 'x':
+ aumax = strtoul(optarg, 0, 0);
+ break;
+
/* --- Tracing --- */
#ifndef NTRACE
/* --- Tracing --- */
#ifndef NTRACE
@@
-226,6
+261,7
@@
int main(int argc, char *argv[])
exit(EXIT_FAILURE);
}
exit(EXIT_FAILURE);
}
+ au_init(audir, aumax);
rc = rx_runfile(argv[optind],
argc - optind - 1, (const char *const *)argv + optind + 1);
return (rc ? EXIT_FAILURE : 0);
rc = rx_runfile(argv[optind],
argc - optind - 1, (const char *const *)argv + optind + 1);
return (rc ? EXIT_FAILURE : 0);