bool LV2EffectsModule::Initialize() { // Try to initialise Lilv, or return. gWorld = lilv_world_new(); if (!gWorld) { return false; } gAudioPortClass = lilv_new_uri(gWorld, LV2_CORE__AudioPort); gControlPortClass = lilv_new_uri(gWorld, LV2_CORE__ControlPort); gMidiPortClass = lilv_new_uri(gWorld, LV2_EVENT__EventPort); gInputPortClass = lilv_new_uri(gWorld, LV2_CORE__InputPort); gOutputPortClass = lilv_new_uri(gWorld, LV2_CORE__OutputPort); gPortToggled = lilv_new_uri(gWorld, LV2_CORE__toggled); gPortIsInteger = lilv_new_uri(gWorld, LV2_CORE__integer); gPortIsSampleRate = lilv_new_uri(gWorld, LV2_CORE__sampleRate); gPortIsEnumeration = lilv_new_uri(gWorld, LV2_CORE__enumeration); gPortIsLatency = lilv_new_uri(gWorld, LV2_CORE__reportsLatency); gPortIsOptional = lilv_new_uri(gWorld, LV2_CORE__connectionOptional); gName = lilv_new_uri(gWorld, LV2_CORE__name); gPortGroup = lilv_new_uri(gWorld, LV2_PORT_GROUPS__group); gSubGroupOf = lilv_new_uri(gWorld, LV2_PORT_GROUPS__subGroupOf); lilv_world_load_all(gWorld); return true; }
int main(int argc, char** argv) { uint32_t block_size = 512; uint32_t sample_count = (1 << 19); for (int i = 1; i < argc; ++i) { if (!strcmp(argv[i], "--version")) { print_version(); return 0; } else if (!strcmp(argv[i], "--help")) { print_usage(); return 0; } else if (!strcmp(argv[i], "-f")) { full_output = true; } else if (!strcmp(argv[i], "-n") && (i + 1 < argc)) { sample_count = atoi(argv[++i]); } else if (!strcmp(argv[i], "-b") && (i + 1 < argc)) { block_size = atoi(argv[++i]); } else { print_usage(); return 1; } } LilvWorld* world = lilv_world_new(); lilv_world_load_all(world); atom_AtomPort = lilv_new_uri(world, LV2_ATOM__AtomPort); atom_Sequence = lilv_new_uri(world, LV2_ATOM__Sequence); lv2_AudioPort = lilv_new_uri(world, LV2_CORE__AudioPort); lv2_CVPort = lilv_new_uri(world, LV2_CORE__CVPort); lv2_ControlPort = lilv_new_uri(world, LV2_CORE__ControlPort); lv2_InputPort = lilv_new_uri(world, LV2_CORE__InputPort); lv2_OutputPort = lilv_new_uri(world, LV2_CORE__OutputPort); urid_map = lilv_new_uri(world, LV2_URID__map); if (full_output) { printf("# Block Samples Time Plugin\n"); } const LilvPlugins* plugins = lilv_world_get_all_plugins(world); LILV_FOREACH(plugins, i, plugins) { bench(lilv_plugins_get(plugins, i), sample_count, block_size); }
LV2World::LV2World() { world = lilv_world_new(); lilv_world_load_all (world); lv2_InputPort = lilv_new_uri (world, LV2_CORE__InputPort); lv2_OutputPort = lilv_new_uri (world, LV2_CORE__OutputPort); lv2_AudioPort = lilv_new_uri (world, LV2_CORE__AudioPort); lv2_AtomPort = lilv_new_uri (world, LV2_ATOM__AtomPort); lv2_ControlPort = lilv_new_uri (world, LV2_CORE__ControlPort); lv2_EventPort = lilv_new_uri (world, LV2_EVENT__EventPort); lv2_CVPort = lilv_new_uri (world, LV2_CORE__CVPort); midi_MidiEvent = lilv_new_uri (world, LV2_MIDI__MidiEvent); work_schedule = lilv_new_uri (world, LV2_WORKER__schedule); work_interface = lilv_new_uri (world, LV2_WORKER__interface); currentThread = 0; numThreads = 2; }
/** * Initialize the Lv2Liv */ void Lv2Lib_constructor(Lv2Lib * lv2Liv) { lv2Liv->world = lilv_world_new(); lilv_world_load_all(lv2Liv->world); lv2Liv->plugins = lilv_world_get_all_plugins(lv2Liv->world); }
bool LV2EffectsModule::Initialize() { // Try to initialise Lilv, or return. gWorld = lilv_world_new(); if (!gWorld) { return false; } // Create LilvNodes for each of the URIs we need #undef URI #define URI(n, u) LV2Effect::n = lilv_new_uri(gWorld, u); URILIST wxString newVar; #if defined(__WXMAC__) #define LV2PATH wxT("/Library/Audio/Plug-Ins/LV2") wxFileName libdir; // libdir.AssignDir(wxT(LIBDIR)); libdir.AppendDir(wxT("lv2")); newVar += wxT(":$HOME/.lv2"); // Look in ~/Library/Audio/Plug-Ins/lv2 and /Library/Audio/Plug-Ins/lv2 newVar += wxT(":$HOME") LV2PATH; newVar += wxT(":") LV2PATH; newVar += wxT(":/usr/local/lib/lv2"); newVar += wxT(":/usr/lib/lv2"); newVar += wxT(":") + libdir.GetPath(); #elif defined(__WXMSW__) newVar += wxT(";%APPDATA%\\LV2"); newVar += wxT(";%COMMONPROGRAMFILES%\\LV2"); newVar += wxT(";%COMMONPROGRAMFILES(x86)%\\LV2"); #else wxFileName libdir; libdir.AssignDir(wxT(LIBDIR)); libdir.AppendDir(wxT("lv2")); newVar += wxT(":$HOME/.lv2"); newVar += wxT(":/usr/local/lib/lv2"); newVar += wxT(":/usr/lib/lv2"); newVar += wxT(":/usr/local/lib64/lv2"); newVar += wxT(":/usr/lib64/lv2"); newVar += wxT(":") + libdir.GetPath(); #endif // Start with the LV2_PATH environment variable (if any) wxString pathVar; wxGetEnv(wxT("LV2_PATH"), &pathVar); if (pathVar.IsEmpty()) { pathVar = newVar.Mid(1); } else { pathVar += newVar; } wxSetEnv(wxT("LV2_PATH"), pathVar); lilv_world_load_all(gWorld); return true; }
Lv2PluginCache::Lv2PluginCache() : world(lilv_world_new()), lv2Constants(world) { // plugins lilv_world_load_all(world); plugins = lilv_world_get_all_plugins(world); // supported features supported[LV2_URID__map] = true; supported[LV2_URID__unmap] = true; supported[LV2_OPTIONS__options] = true; supported[LV2_BUF_SIZE__boundedBlockLength] = true; supported[LV2_STATE__mapPath] = true; supported[LV2_WORKER__schedule] = true; // URID feature (map/unmap) map.map = &uridMap; map.handle = &uridMapper; static LV2_Feature uridMapFeature = { LV2_URID__map, &map }; lv2Features[0] = &uridMapFeature; unmap.unmap = &uridUnmap; unmap.handle = &uridMapper; static LV2_Feature uridUnmapFeature = { LV2_URID__unmap, &unmap }; lv2Features[1] = &uridUnmapFeature; // Options feature options[0] = { LV2_OPTIONS_INSTANCE, 0, uridMapper.uriToId(LV2_BUF_SIZE__minBlockLength), sizeof(float), uridMapper.uriToId(LV2_ATOM__Int), &blockLength }; options[1] = { LV2_OPTIONS_INSTANCE, 0, uridMapper.uriToId(LV2_BUF_SIZE__maxBlockLength), sizeof(float), uridMapper.uriToId(LV2_ATOM__Int), &blockLength }; options[2] = { LV2_OPTIONS_INSTANCE, 0, 0, 0, 0, NULL }; static LV2_Feature optionsFeature = { LV2_OPTIONS__options, &options }; lv2Features[2] = &optionsFeature; static LV2_Feature boundedBlockFeature = { LV2_BUF_SIZE__boundedBlockLength, NULL }; lv2Features[3] = &boundedBlockFeature; // state map path feature mapPath.handle = &pathMapper; mapPath.absolute_path = &mapAbsolutePath; mapPath.abstract_path = &mapAbstractPath; static LV2_Feature stateMapPathFeature = { LV2_STATE__mapPath, &mapPath }; lv2Features[4] = &stateMapPathFeature; // worker schedule feature schedule.handle = 0; // assigned in factory method schedule.schedule_work = &scheduleWork; static LV2_Feature workerFeature = { LV2_WORKER__schedule, &schedule }; lv2Features[5] = &workerFeature; // end of features lv2Features[6] = 0; // URIDs Lv2Plugin::atomTypes.intType = uridMapper.uriToId(LV2_ATOM__Int); Lv2Plugin::atomTypes.longType = uridMapper.uriToId(LV2_ATOM__Long); Lv2Plugin::atomTypes.floatType = uridMapper.uriToId(LV2_ATOM__Float); Lv2Plugin::atomTypes.doubleType = uridMapper.uriToId(LV2_ATOM__Double); Lv2Plugin::atomTypes.stringType = uridMapper.uriToId(LV2_ATOM__String); Lv2MidiEvent::midiEventTypeId = uridMapper.uriToId(LILV_URI_MIDI_EVENT); }