From 40e94c77dc670a7b290406ecfaee7ff06f9a8988 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Wed, 30 Jun 2004 14:05:57 +0000 Subject: [PATCH] - Support -P option to specify the patch path. - Distribute the missing patch files. --- seq/sbiload/Makefile.am | 7 ++++++- seq/sbiload/sbiload.c | 20 +++++++++++++++++++- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/seq/sbiload/Makefile.am b/seq/sbiload/Makefile.am index e982426..ba214ac 100644 --- a/seq/sbiload/Makefile.am +++ b/seq/sbiload/Makefile.am @@ -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 diff --git a/seq/sbiload/sbiload.c b/seq/sbiload/sbiload.c index 6b9cbbb..0e55ccf 100644 --- a/seq/sbiload/sbiload.c +++ b/seq/sbiload/sbiload.c @@ -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); -- 2.47.1