X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Ffst%2Ffstinfofile.c;h=c7061cd6b8d6615d8d7452434509176fb6b2a6ed;hb=b00bb4d5ff32c78dea212bc2ad71a1f87db9d2fc;hp=7b0c69d01576eff30298f32e34930defffdb6645;hpb=449aab3c465bbbf66d221fac3d7ea559f1720357;p=ardour.git diff --git a/libs/fst/fstinfofile.c b/libs/fst/fstinfofile.c index 7b0c69d015..c7061cd6b8 100644 --- a/libs/fst/fstinfofile.c +++ b/libs/fst/fstinfofile.c @@ -1,21 +1,21 @@ - #include "fst.h" -#include "vst/aeffectx.h" #include #include #include +#include #include #include #include -#include #define MAX_STRING_LEN 256 #define FALSE 0 #define TRUE !FALSE +extern char * strdup (const char *); + static char *read_string( FILE *fp ) { char buf[MAX_STRING_LEN]; @@ -49,6 +49,7 @@ static FSTInfo *load_fst_info_file( char *filename ) { } if( (info->name = read_string( fp )) == NULL ) goto error; + if( (info->creator = read_string( fp )) == NULL ) goto error; if( 1 != fscanf( fp, "%d\n", &info->UniqueID ) ) goto error; if( (info->Category = read_string( fp )) == NULL ) goto error; if( 1 != fscanf( fp, "%d\n", &info->numInputs ) ) goto error; @@ -96,6 +97,7 @@ static int save_fst_info_file( FSTInfo *info, char *filename ) { } fprintf( fp, "%s\n", info->name ); + fprintf( fp, "%s\n", info->creator ); fprintf( fp, "%d\n", info->UniqueID ); fprintf( fp, "%s\n", info->Category ); fprintf( fp, "%d\n", info->numInputs ); @@ -123,7 +125,7 @@ static char *fst_dllpath_to_infopath( char *dllpath ) { if( strstr( dllpath, ".dll" ) == NULL ) return NULL; retval = strdup( dllpath ); - sprintf( retval + strlen(retval) - 4, ".fst" ); + sprintf( retval + strlen(retval) - 4, ".fsi" ); return retval; } @@ -144,7 +146,7 @@ static int fst_info_file_is_valid( char *dllpath ) { } static int fst_can_midi( FST *fst ) { - AEffect *plugin = fst->plugin; + struct AEffect *plugin = fst->plugin; int vst_version = plugin->dispatcher (plugin, effGetVstVersion, 0, 0, NULL, 0.0f); if (vst_version >= 2) { @@ -160,8 +162,9 @@ static int fst_can_midi( FST *fst ) { } static FSTInfo *fst_info_from_plugin( FST *fst ) { FSTInfo *info = (FSTInfo *) malloc( sizeof( FSTInfo ) ); - AEffect *plugin; + struct AEffect *plugin; int i; + char creator[65]; if( ! fst ) { fst_error( "fst is NULL\n" ); @@ -174,7 +177,19 @@ static FSTInfo *fst_info_from_plugin( FST *fst ) { info->name = strdup(fst->handle->name ); + plugin->dispatcher (plugin, 47 /* effGetVendorString */, 0, 0, creator, 0); + if (strlen (creator) == 0) { + info->creator = strdup ("Unknown"); + } else { + info->creator = strdup (creator); + } + +#ifdef VESTIGE_HEADER + info->UniqueID = *((int32_t *) &plugin->unused_id); +#else info->UniqueID = plugin->uniqueID; +#endif + info->Category = strdup( "None" ); // FIXME: info->numInputs = plugin->numInputs; info->numOutputs = plugin->numOutputs; @@ -188,22 +203,20 @@ static FSTInfo *fst_info_from_plugin( FST *fst ) { for( i=0; inumParams; i++ ) { char name[20]; char label[9]; - plugin->dispatcher (plugin, - effGetParamName, - i, 0, name, 0); - - plugin->dispatcher (plugin, - effGetParamLabel, - i, 0, label, 0); - + plugin->dispatcher (plugin, + effGetParamName, + i, 0, name, 0); info->ParamNames[i] = strdup( name ); + plugin->dispatcher (plugin, + 6 /* effGetParamLabel */, + i, 0, label, 0); info->ParamLabels[i] = strdup( label ); } return info; } // most simple one :) could be sufficient.... -static long simple_master_callback( AEffect *fx, long opcode, long index, long value, void *ptr, float opt ) { +static long simple_master_callback( struct AEffect *fx, long opcode, long index, long value, void *ptr, float opt ) { if( opcode == audioMasterVersion ) return 2; else @@ -227,9 +240,7 @@ FSTInfo *fst_get_info( char *dllpath ) { FSTInfo *info; char *fstpath; - if( !(h = fst_load( dllpath )) ) { - return NULL; - } + if( !(h = fst_load( dllpath )) ) return NULL; if( !(fst = fst_instantiate( h, simple_master_callback, NULL )) ) { fst_unload( h ); fst_error( "instantiate failed\n" ); @@ -261,6 +272,7 @@ void fst_free_info( FSTInfo *info ) { free( info->ParamLabels[i] ); } free( info->name ); + free( info->creator ); free( info->Category ); free( info ); }