- Support -P option to specify the patch path.

- Distribute the missing patch files.
This commit is contained in:
Takashi Iwai 2004-06-30 14:05:57 +00:00
parent 0b5c1c4ef0
commit 40e94c77dc
2 changed files with 25 additions and 2 deletions

View file

@ -4,9 +4,14 @@ AUTOMAKE_OPTIONS = 1.3 foreign
bin_PROGRAMS = sbiload
#man_MANS = sbiload.1
AM_CFLAGS = -DPATCHDIR=\"$(datadir)/sounds/opl3\"
sbiload_SOURCES = sbiload.c
EXTRA_DIST = README COPYING depcomp
patchdir = $(datadir)/sounds/opl3
patch_DATA = std.o3 drums.o3 std.sb drums.sb
EXTRA_DIST = README COPYING depcomp std.o3 drums.o3 std.sb drums.sb
alsa-dist: distdir
@rm -rf ../../distdir/seq/sbiload

View file

@ -84,6 +84,7 @@ static struct option long_opts[] = {
{"port", HAS_ARG, NULL, 'p'},
{"opl3", 0, NULL, '4'},
{"list", 0, NULL, 'l'},
{"path", HAS_ARG, NULL, 'P'},
{"verbose", HAS_ARG, NULL, 'v'},
{"version", 0, NULL, 'V'},
{0, 0, 0, 0},
@ -112,6 +113,12 @@ int seq_port;
int seq_dest_client;
int seq_dest_port;
#ifndef PATCHDIR
#define PATCHDIR "/usr/share/sounds/opl3"
#endif
char *patchdir = PATCHDIR;
/* Function prototypes */
static void show_list ();
static void show_usage ();
@ -180,6 +187,7 @@ show_usage () {
" -p client:port - A alsa client and port number to send midi to",
" -4 - four operators file type (default = two ops)",
" -l - List possible output ports that could be used",
" -P path - Specify the patch path",
" -v level - Verbose level (default = 0)",
" -V - Show version",
};
@ -443,7 +451,14 @@ static int
load_file (int bank, char *filename) {
int fd;
fd = open (filename, O_RDONLY);
if (*filename == '/')
fd = open (filename, O_RDONLY);
else {
char path[1024];
snprintf(path, sizeof(path), "%s/%s", PATCHDIR, filename);
fd = open (path, O_RDONLY);
}
if (fd == -1) {
perror (filename);
return -1;
@ -622,6 +637,9 @@ main (int argc, char **argv) {
case 'l':
show_list ();
exit (0);
case 'P':
patchdir = optarg;
break;
case '?':
show_usage ();
exit (1);