Beispiel #1
0
FSTInfo *fst_get_info( char *dllpath ) {

    if( fst_info_file_is_valid( dllpath ) ) {
	FSTInfo *info;
	char *fstpath = fst_dllpath_to_infopath( dllpath );

	info = load_fst_info_file( fstpath );
	free( fstpath );
	return info;

    } else {

	FSTHandle *h;
	FST *fst;
	FSTInfo *info;
	char *fstpath;

	if( !(h = fst_load( dllpath )) ) {
		return NULL;
	}
	if( !(fst = fst_instantiate( h, simple_master_callback, NULL )) ) {
	    fst_unload( h );
	    fst_error( "instantiate failed\n" );
	    return NULL;
	}
	fstpath = fst_dllpath_to_infopath( dllpath );
	if( !fstpath ) {
	    fst_close( fst );
	    fst_unload( h );
	    fst_error( "get fst filename failed\n" );
	    return NULL;
	}
	info = fst_info_from_plugin( fst );
	save_fst_info_file( info, fstpath );

	free( fstpath );
	fst_close( fst );
	fst_unload( h );
	return info;
    }
}
Beispiel #2
0
void* VstSynth::instantiate()
      {
      ++_instances;
      QString n;
      n.setNum(_instances);
      QString instanceName = baseName() + "-" + n;
      doSetuid();
      QByteArray ba = info.filePath().toLatin1();
      const char* path = ba.constData();

      fstHandle = fst_load(path);
      if (fstHandle == 0) {
            printf("Synth::instantiate: cannot load vst plugin %s\n", path);
            undoSetuid();
            return 0;
            }
      FST* fst = fst_instantiate(fstHandle, vstHostCallback, 0);
      if (fst == 0) {
            printf("Synth::instantiate:: cannot instantiate plugin %s\n", path);
            undoSetuid();
            return 0;
            }
      AEffect* plugin = fst->plugin;
      plugin->dispatcher (plugin, effMainsChanged, 0, 1, 0, 0.0f);

      /* set program to zero */

      plugin->dispatcher (plugin, effSetProgram, 0, 0, NULL, 0.0f);

      if (fst_run_editor(fst)) {
            printf("Synth::instantiate: cannot create gui");
            undoSetuid();
            return 0;
            }

      undoSetuid();
      return fst;
      }