diff decoders/timidity/instrum.c @ 455:cbc2a4ffeeec

* Added support for loading DLS format instruments: Timidity_LoadDLS(), Timidity_FreeDLS(), Timidity_LoadDLSSong() * Added Timidity_Init_NoConfig()
author hercules
date Fri, 26 Sep 2003 20:51:58 +0000
parents c98a34c00069
children
line wrap: on
line diff
--- a/decoders/timidity/instrum.c	Sat Sep 13 20:46:09 2003 +0000
+++ b/decoders/timidity/instrum.c	Fri Sep 26 20:51:58 2003 +0000
@@ -40,6 +40,7 @@
 #include "options.h"
 #include "common.h"
 #include "instrum.h"
+#include "instrum_dls.h"
 #include "resample.h"
 #include "tables.h"
 
@@ -178,7 +179,7 @@
   if (!name) return 0;
   
   /* Open patch file */
-  if (!(rw=open_file(name)))
+  if ((rw=open_file(name)) == NULL)
     {
       noluck=1;
       /* Try with various extensions */
@@ -188,7 +189,7 @@
 	    {
 	      strcpy(tmp, name);
 	      strcat(tmp, patch_ext[i]);
-	      if ((rw=open_file(tmp)))
+	      if ((rw=open_file(tmp)) != NULL)
 		{
 		  noluck=0;
 		  break;
@@ -273,6 +274,8 @@
       READ_LONG(sp->low_freq);
       READ_LONG(sp->high_freq);
       READ_LONG(sp->root_freq);
+      sp->low_vel = 0;
+      sp->high_vel = 127;
       SDL_RWseek(rw, 2, SEEK_CUR); /* Why have a "root frequency" and then
 				    * "tuning"?? */
       
@@ -527,6 +530,11 @@
     {
       if (bank->instrument[i]==MAGIC_LOAD_INSTRUMENT)
 	{
+          bank->instrument[i]=load_instrument_dls(song, dr, b, i);
+          if (bank->instrument[i])
+            {
+              continue;
+            }
 	  if (!(bank->tone[i].name))
 	    {
 	      SNDDBG(("No instrument mapped to %s %d, program %d%s\n",