|
|
@@ -16,7 +16,32 @@ |
|
|
|
#define nullptr (0) |
|
|
|
#endif |
|
|
|
|
|
|
|
// Replicating some of the LV2 header here so that we don't have to set up any |
|
|
|
// custom include paths for this file. |
|
|
|
// Normally this would be a bad idea, but the LV2 API has to keep these definitions |
|
|
|
// in order to remain backwards-compatible. |
|
|
|
|
|
|
|
extern "C" { |
|
|
|
|
|
|
|
typedef struct LV2_Descriptor { |
|
|
|
const void* a; |
|
|
|
const void* b; |
|
|
|
const void* c; |
|
|
|
const void* d; |
|
|
|
const void* e; |
|
|
|
const void* f; |
|
|
|
const void* g; |
|
|
|
const void* (*extension_data)(const char* uri); |
|
|
|
} LV2_Descriptor; |
|
|
|
|
|
|
|
typedef struct RecallFeature { |
|
|
|
int (*doRecall)(const char*); |
|
|
|
} RecallFeature; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
typedef void (*TTL_Generator_Function)(const char* basename); |
|
|
|
typedef const LV2_Descriptor* (*LV2_Descriptor_Function)(unsigned index); |
|
|
|
|
|
|
|
int main(int argc, char* argv[]) |
|
|
|
{ |
|
|
@@ -44,8 +69,10 @@ int main(int argc, char* argv[]) |
|
|
|
|
|
|
|
#ifdef TTL_GENERATOR_WINDOWS |
|
|
|
const TTL_Generator_Function ttlFn = (TTL_Generator_Function)GetProcAddress(handle, "lv2_generate_ttl"); |
|
|
|
const LV2_Descriptor_Function lv2Fn = (LV2_Descriptor_Function)GetProcAddress(handle, "lv2_descriptor"); |
|
|
|
#else |
|
|
|
const TTL_Generator_Function ttlFn = (TTL_Generator_Function)dlsym(handle, "lv2_generate_ttl"); |
|
|
|
const LV2_Descriptor_Function lv2Fn = (LV2_Descriptor_Function)dlsym(handle, "lv2_descriptor"); |
|
|
|
#endif |
|
|
|
|
|
|
|
if (ttlFn != NULL) |
|
|
@@ -81,8 +108,16 @@ int main(int argc, char* argv[]) |
|
|
|
|
|
|
|
ttlFn(basename); |
|
|
|
} |
|
|
|
else if (lv2Fn != nullptr) |
|
|
|
{ |
|
|
|
if (const LV2_Descriptor* const descriptor = lv2Fn(0)) |
|
|
|
if (const RecallFeature* const recallFeature = (const RecallFeature*)descriptor->extension_data("https://lv2-extensions.juce.com/turtle_recall")) |
|
|
|
recallFeature->doRecall(argv[1]); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
printf("Failed to find 'lv2_generate_ttl' function\n"); |
|
|
|
} |
|
|
|
|
|
|
|
#ifdef TTL_GENERATOR_WINDOWS |
|
|
|
FreeLibrary(handle); |
|
|
|