static LV2UI_Handle instantiate( void* const ui_toplevel, const LV2UI_Descriptor* descriptor, const char* plugin_uri, const char* bundle_path, LV2UI_Write_Function write_function, LV2UI_Controller controller, RobWidget** widget, const LV2_Feature* const* features) { SFSUI* ui = (SFSUI*) calloc(1,sizeof(SFSUI)); *widget = NULL; ui->map = NULL; if (!strcmp(plugin_uri, MTR_URI "stereoscope")) { ; } else if (!strcmp(plugin_uri, MTR_URI "stereoscope_gtk")) { ; } else { free(ui); return NULL; } for (int i = 0; features[i]; ++i) { if (!strcmp(features[i]->URI, LV2_URID_URI "#map")) { ui->map = (LV2_URID_Map*)features[i]->data; } } if (!ui->map) { fprintf(stderr, "meters.lv2 UI: Host does not support urid:map\n"); free(ui); return NULL; } map_xfer_uris(ui->map, &ui->uris); lv2_atom_forge_init(&ui->forge, ui->map); ui->write = write_function; ui->controller = controller; ui->rate = 48000; ui->disable_signals = false; ui->update_grid = false; ui->clear_persistence = false; ui->fft_bins = 512; ui->freq_band = NULL; ui->freq_bins = 0; ui->width = SS_SIZE + 2 * SS_BORDER; ui->height = SS_SIZE + 2 * SS_BORDER; pthread_mutex_init(&ui->fft_lock, NULL); *widget = toplevel(ui, ui_toplevel); reinitialize_fft(ui, ui->fft_bins); ui_enable(ui); return ui; }
static LV2UI_Handle instantiate( void* const ui_toplevel, const LV2UI_Descriptor* descriptor, const char* plugin_uri, const char* bundle_path, LV2UI_Write_Function write_function, LV2UI_Controller controller, RobWidget** widget, const LV2_Feature* const* features) { MF2UI* ui = (MF2UI*) calloc(1,sizeof(MF2UI)); *widget = NULL; ui->map = NULL; if (!strcmp(plugin_uri, MTR_URI "phasewheel")) { ; } else { free(ui); return NULL; } for (int i = 0; features[i]; ++i) { if (!strcmp(features[i]->URI, LV2_URID_URI "#map")) { ui->map = (LV2_URID_Map*)features[i]->data; } } if (!ui->map) { fprintf(stderr, "meters.lv2 UI: Host does not support urid:map\n"); free(ui); return NULL; } ui->nfo = robtk_info(ui_toplevel); map_xfer_uris(ui->map, &ui->uris); lv2_atom_forge_init(&ui->forge, ui->map); ui->write = write_function; ui->controller = controller; ui->rate = 48000; ui->db_cutoff = -60; ui->db_thresh = 0.000001; // (-60dB)^2 // XXX ui->drag_cutoff_x = -1; ui->prelight_cutoff = false; ui->cor = 0.5; ui->disable_signals = false; ui->update_annotations = false; ui->update_grid = false; ui->fft_bins = 512; ui->freq_band = NULL; ui->freq_bins = 0; ui->pgain = -100; ui->peak = 0; ui->scale = 0.0; ui->pscale = 1.0; ui->width = 2 * (PH_RAD + XOFF); ui->height = 2 * (PH_RAD + YOFF); pthread_mutex_init(&ui->fft_lock, NULL); *widget = toplevel(ui, ui_toplevel); reinitialize_fft(ui, ui->fft_bins); ui_enable(ui); return ui; }