Sophie

Sophie

distrib > Mandriva > 2010.2 > i586 > by-pkgid > ca47af0929f71898837223d239b217f7 > files > 1

freebirth-0.3.2-17mdv2010.1.src.rpm

--- freebirth-0.3.2.orig/freebirth.c
+++ freebirth-0.3.2/freebirth.c
@@ -248,15 +248,15 @@
   //bass_e    = env_new(1025,10000,(sample_producer *)osc_blender);
   sl = g_slist_append(sl, bass_e);
 
-  kick   = raw_wave_new("raw/kick.raw");
+  kick   = raw_wave_new("/usr/share/freebirth/raw/kick.raw");
   sl = g_slist_append(sl, kick);
-  snare  = raw_wave_new("raw/snare.raw");
+  snare  = raw_wave_new("/usr/share/freebirth/raw/snare.raw");
   sl = g_slist_append(sl, snare);
-  cl_hat = raw_wave_new("raw/cl_hat.raw");
+  cl_hat = raw_wave_new("/usr/share/freebirth/raw/cl_hat.raw");
   sl = g_slist_append(sl, cl_hat);
-  op_hat = raw_wave_new("raw/op_hat.raw");
+  op_hat = raw_wave_new("/usr/share/freebirth/raw/op_hat.raw");
   sl = g_slist_append(sl, op_hat);
-  samp_1 = raw_wave_new("raw/samp_1.raw");
+  samp_1 = raw_wave_new("/usr/share/freebirth/raw/samp_1.raw");
   sl = g_slist_append(sl, samp_1);
 
   sources = (sample_producer**)
--- freebirth-0.3.2.orig/raw_wave.c
+++ freebirth-0.3.2/raw_wave.c
@@ -28,11 +28,16 @@
   char *full_fn;
   char *fb_samples;
 
-  if (fn == NULL || fn[0] == '/') return fn;
   fb_samples = getenv("FB_SAMPLES");
   if (fb_samples == NULL) fb_samples = FB_SAMPLES;
-  sprintf(full_fn = (char *)malloc(strlen(fb_samples) + 1 + strlen(fn) + 1),
-	  "%s/%s", fb_samples, fn);
+  full_fn = (char *)malloc(strlen(fb_samples) + 1 + strlen(fn) + 1);
+   
+  if (fn == NULL || fn[0] == '/') { /* path is valid already */
+     sprintf(full_fn, "%s", fn); 
+  } else {
+     sprintf(full_fn, "%s/%s", fb_samples, fn); /* add path */
+  }
+   
   return full_fn;
 }
 
@@ -145,7 +150,7 @@
 void raw_wave_set_sample_file(raw_wave* this, char *filename)
 {
   FILE *in;
-  if (this->filename != 0) free(this->filename);
+  if (this->filename != NULL) free(this->filename);
   this->filename = get_full_path(filename);
   in = fopen(this->filename,"r");
   if( in==NULL )
@@ -243,7 +248,7 @@
   /* set table to zero here check if it is zero in */
   /* _fill_table */
   out->table = 0;
-  out->filename = 0;
+  out->filename = NULL;
   raw_wave_set_sample_file(out, filename);
 
   out->buffer   = (sample *)malloc(sizeof(sample) * TBASS_BUFF_SIZE);