fluid-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [fluid-dev] invalid instrument/drum selection


From: jimmy
Subject: Re: [fluid-dev] invalid instrument/drum selection
Date: Fri, 6 Feb 2009 11:24:54 -0800 (PST)

> Date: Sat, 31 Jan 2009 20:20:45 -0800
> From: Josh Green <address@hidden>
> On Fri, 2009-01-30 at 10:14 -0600, S. Christian Collins
> wrote:
> > I'm used to the following behavior when using MIDI
> on a Creative card:
> > when I select an instrument not present, such as bank
> 8 program 20,
> > the MIDI track will sound using bank 0 program 20
> instead.  This seems
> > like a simple and logical way to deal with missing
> patches, and is
> > what I've come to expect when working with MIDI.
> > 
> > -~Chris
> 
> Easy enough.  I'll add something to this effect.
>       Josh



Hi Josh,

I haven't tried to see how I could get to invoke , or try

   fluid_ramsfont.c : fluid_ramsfont_get_preset()

Anyway, here's what I tried for 

   fluid_defsfont.c : fluid_defsfont_get_preset()

>>>>>

fluid_defpreset_t* fluid_defsfont_get_preset(fluid_defsfont_t* sfont, unsigned 
int bank, unsigned int num)
{
  fluid_defpreset_t* preset = sfont->preset;
  fluid_defpreset_t* fallback_preset = NULL;
  while (preset != NULL) {

    if ((preset->num == num)) {
      if ((preset->bank == bank)) {
        return preset;
      }
      if ((preset->bank == 0)) {
        fallback_preset = preset;
      }
    }
    preset = preset->next;
  }

  if (( fallback_preset != NULL )) {
    return fallback_preset;
  }

  return NULL;
}

<<<<<

That would use a fallback_preset, still return NULL if no prog_number is found. 
 Of course it is just my hack at the code.  It may or may not be the 
appropriate place, but is the most efficient from the little that I could 
understand.  If it looks OK, you may want to put in the changes as appropriate, 
and similar change for 

   fluid_ramsfont.c : fluid_ramsfont_get_preset()

Best regards,

Jimmy



      




reply via email to

[Prev in Thread] Current Thread [Next in Thread]