]> git.alsa-project.org Git - alsa-tools.git/commitdiff
- Support -P option to specify the patch path.
authorTakashi Iwai <tiwai@suse.de>
Wed, 30 Jun 2004 14:05:57 +0000 (14:05 +0000)
committerTakashi Iwai <tiwai@suse.de>
Wed, 30 Jun 2004 14:05:57 +0000 (14:05 +0000)
- Distribute the missing patch files.

seq/sbiload/Makefile.am
seq/sbiload/sbiload.c

index e9824266a4939748637ff78035ad77dcad250244..ba214acb211cc3b9cdc51cd2304e11a53682df3e 100644 (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
index 6b9cbbb2839068899128986b273352d84af1adc7..0e55ccfb89b19d42f561acdee50b170f42ce97b8 100644 (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);