int set_default_instrument(char *name)
{
	Instrument *ip;
	if (!(ip=load_instrument(name, 0, -1, -1, -1, 0, 0, 0)))
		return -1;
	if (default_instrument)
		free_instrument(default_instrument);
	default_instrument=ip;
	default_program=SPECIAL_PROGRAM;
	return 0;
}
Exemplo n.º 2
0
static void free_bank(int dr, int b)
{
  int i;
  ToneBank *bank=((dr) ? drumset[b] : tonebank[b]);
  for (i=0; i<128; i++)
    if (bank->tone[i].instrument)
      {
	/* Not that this could ever happen, of course */
	if (bank->tone[i].instrument != MAGIC_LOAD_INSTRUMENT)
	  free_instrument(bank->tone[i].instrument);
	bank->tone[i].instrument=0;
      }
}
Exemplo n.º 3
0
static void free_layer(InstrumentLayer *lp)
{
  InstrumentLayer *next;

  current_patch_memory -= lp->size;

  for (; lp; lp = next)
   {
     next = lp->next;
     free_instrument(lp->instrument);
     free(lp);
   }
}
Exemplo n.º 4
0
/* This is only used for tracks that don't specify a program */
int default_program=DEFAULT_PROGRAM;

int antialiasing_allowed=0;

#ifdef FAST_DECAY
int fast_decay=1;
#else
int fast_decay=0;
#endif

static void free_instrument(Instrument *ip)
{
  Sample *sp;
  int i;
  if (!ip) return;
  for (i=0; i<ip->samples; i++)
    {
      sp=&(ip->sample[i]);
      free(sp->data);
    }
  free(ip->sample);
  for (i=0; i<ip->right_samples; i++)
    {
      sp=&(ip->right_sample[i]);
      free(sp->data);
    }
  if (ip->right_sample)
    free(ip->right_sample);
  free(ip);
}

#ifndef ADAGIO
static void free_bank(int dr, int b)
#else /* ADAGIO */
static void free_bank(int b)
#endif /* ADAGIO */
{
  int i;
#ifndef ADAGIO
  ToneBank *bank=((dr) ? drumset[b] : tonebank[b]);
  for (i=0; i<MAXPROG; i++)
#else /* ADAGIO */
  ToneBank *bank= tonebank[b];
  for (i=0; i<MAX_TONE_VOICES; i++)
#endif /* ADAGIO */
    if (bank->tone[i].instrument)
      {
	/* Not that this could ever happen, of course */
	if (bank->tone[i].instrument != MAGIC_LOAD_INSTRUMENT)
	  free_instrument(bank->tone[i].instrument);
	bank->tone[i].instrument=0;
      }
}