Beispiel #1
0
void X11_MIDI_PP_Update_doit(struct Instruments *instrument,struct Patch *patch){
  NInt patchnum;

  if(patch==NULL){
    patchnum=-1;
  }else{
    patchnum=patch->l.num;
  }
  
  currpatch=patch;
  
  if(currpatch==NULL){
    PyRun_SimpleString("X11_MidiProperties.UpdateEmptyPatch()");
  }else{
    NInt num_patches;
    struct PatchData *patchdata;
    struct MidiPort *midi_port;
    int lokke;
    int num_ports;
    char **ports;
    char temp[5000];

    num_patches=ListFindNumElements1(&instrument->patches->l);
    patchdata=(struct PatchData *)patch->patchdata;
    midi_port=patchdata->midi_port;

    sprintf(temp,"X11_MidiProperties.UpdatePatch([\"%s\"",instrument->patches->name);

    patch=NextPatch(instrument->patches);
    while(patch!=NULL){
      sprintf(temp,"%s,\"%s\"",temp,patch->name);
      patch=NextPatch(patch);
    }

    sprintf(temp,"%s],%d,[",temp,patchnum);
    printf("patchnum: %d\n",patchnum);

    ports=MIDI_getPortNames(&num_ports);
    for(lokke=0;lokke<num_ports;lokke++){
      sprintf(temp,"%s\"%s\"%s",temp,ports[lokke],lokke==num_ports-1?"":",");
    }


    sprintf(temp,"%s],\"%s\",%d,%d,%d,%d,%d,%d,%d,%d,%d,",
	    temp,
	    midi_port==NULL ? "<not set>" : midi_port->name,
	    patchdata->channel+1,
	    patchdata->MSB,
	    patchdata->LSB,
	    patchdata->preset+1,
	    patchdata->panonoff==true?1:0,
	    patchdata->pan,
	    patchdata->volumeonoff==true?1:0,
	    patchdata->volume,
	    currpatch->standardvel
	    );

    sprintf(temp,"%s[",temp);
    for(lokke=0;lokke<8;lokke++){
      sprintf(temp,"%s%d%s",temp,patchdata->ccsonoff[lokke]==true?1:0,lokke<7?",":"");
    }

    sprintf(temp,"%s],[",temp);

    for(lokke=0;lokke<8;lokke++){
      sprintf(temp,"%s\"%s\"%s",temp,patchdata->ccnames[lokke],lokke<7?",":"");
    }
    
    sprintf(temp,"%s],[",temp);

    for(lokke=0;lokke<8;lokke++){
      sprintf(temp,"%s%d%s",temp,patchdata->standardccs[lokke],lokke<7?",":"");
    }

    sprintf(temp,"%s],[",temp);

    for(lokke=0;lokke<8;lokke++){
      sprintf(temp,"%s%d%s",temp,patchdata->ccvalues[lokke],lokke<7?",":"");
    }

    sprintf(temp,"%s])",temp);

    PyRun_SimpleString(temp);
  }
}
Beispiel #2
0
int getNumUsedFX(struct Tracks *track){
	int ret;
	ret=ListFindNumElements1(&track->fxs->l);

	return ret;
}
Beispiel #3
0
NInt ListFindNumElements3(
	struct ListHeader3 *list
){
	return ListFindNumElements1((struct ListHeader1 *)list);
}