Number of fixes: don't hold mutex while loading, fix ui crash when kit index out of range, don't load negative kit indexes, respond to midi base note port events.
Most important here is that the mutex change means the run loop with not block for a significant period ever, which previously was causing the jack thread to get zombified.
This commit is contained in:
parent
61bb1fe89e
commit
f6a8f9a514
44
drmr.c
44
drmr.c
@ -24,22 +24,34 @@
|
|||||||
|
|
||||||
static void* load_thread(void* arg) {
|
static void* load_thread(void* arg) {
|
||||||
DrMr* drmr = (DrMr*)arg;
|
DrMr* drmr = (DrMr*)arg;
|
||||||
|
drmr_sample *loaded_samples,*old_samples;
|
||||||
pthread_mutex_lock(&drmr->load_mutex);
|
int loaded_count, old_scount;
|
||||||
for(;;) {
|
for(;;) {
|
||||||
|
pthread_mutex_lock(&drmr->load_mutex);
|
||||||
pthread_cond_wait(&drmr->load_cond,
|
pthread_cond_wait(&drmr->load_cond,
|
||||||
&drmr->load_mutex);
|
&drmr->load_mutex);
|
||||||
|
pthread_mutex_unlock(&drmr->load_mutex);
|
||||||
int request = (int)floorf(*(drmr->kitReq));
|
int request = (int)floorf(*(drmr->kitReq));
|
||||||
if (request >= drmr->kits->num_kits) {
|
if (request == drmr->curKit) continue;
|
||||||
int os = drmr->num_samples;
|
old_samples = drmr->samples;
|
||||||
|
old_scount = drmr->num_samples;
|
||||||
|
if (request < 0 || request >= drmr->kits->num_kits) {
|
||||||
|
pthread_mutex_lock(&drmr->load_mutex);
|
||||||
drmr->num_samples = 0;
|
drmr->num_samples = 0;
|
||||||
if (os > 0) free_samples(drmr->samples,os);
|
|
||||||
drmr->samples = NULL;
|
drmr->samples = NULL;
|
||||||
} else
|
pthread_mutex_unlock(&drmr->load_mutex);
|
||||||
load_hydrogen_kit(drmr,drmr->kits->kits[request].path);
|
} else {
|
||||||
|
printf("loading kit: %i\n",request);
|
||||||
|
loaded_samples = load_hydrogen_kit(drmr->kits->kits[request].path,drmr->rate,&loaded_count);
|
||||||
|
// just lock for the critical moment when we swap in the new kit
|
||||||
|
pthread_mutex_lock(&drmr->load_mutex);
|
||||||
|
drmr->samples = loaded_samples;
|
||||||
|
drmr->num_samples = loaded_count;
|
||||||
|
pthread_mutex_unlock(&drmr->load_mutex);
|
||||||
|
}
|
||||||
|
if (old_scount > 0) free_samples(old_samples,old_scount);
|
||||||
drmr->curKit = request;
|
drmr->curKit = request;
|
||||||
}
|
}
|
||||||
pthread_mutex_unlock(&drmr->load_mutex);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,7 +63,9 @@ instantiate(const LV2_Descriptor* descriptor,
|
|||||||
int i;
|
int i;
|
||||||
DrMr* drmr = malloc(sizeof(DrMr));
|
DrMr* drmr = malloc(sizeof(DrMr));
|
||||||
drmr->map = NULL;
|
drmr->map = NULL;
|
||||||
|
drmr->samples = NULL;
|
||||||
drmr->num_samples = 0;
|
drmr->num_samples = 0;
|
||||||
|
drmr->curKit = -1;
|
||||||
drmr->rate = rate;
|
drmr->rate = rate;
|
||||||
|
|
||||||
if (pthread_mutex_init(&drmr->load_mutex, 0)) {
|
if (pthread_mutex_init(&drmr->load_mutex, 0)) {
|
||||||
@ -64,11 +78,6 @@ instantiate(const LV2_Descriptor* descriptor,
|
|||||||
free(drmr);
|
free(drmr);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (pthread_create(&drmr->load_thread, 0, load_thread, drmr)) {
|
|
||||||
fprintf(stderr, "Could not initialize loading thread.\n");
|
|
||||||
free(drmr);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Map midi uri
|
// Map midi uri
|
||||||
while(*features) {
|
while(*features) {
|
||||||
@ -93,9 +102,12 @@ instantiate(const LV2_Descriptor* descriptor,
|
|||||||
free(drmr);
|
free(drmr);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
drmr->samples = NULL; // prevent attempted freeing in load
|
|
||||||
load_hydrogen_kit(drmr,drmr->kits->kits->path);
|
if (pthread_create(&drmr->load_thread, 0, load_thread, drmr)) {
|
||||||
drmr->curKit = 0;
|
fprintf(stderr, "Could not initialize loading thread.\n");
|
||||||
|
free(drmr);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
drmr->gains = malloc(32*sizeof(float*));
|
drmr->gains = malloc(32*sizeof(float*));
|
||||||
drmr->pans = malloc(32*sizeof(float*));
|
drmr->pans = malloc(32*sizeof(float*));
|
||||||
|
138
drmr_hydrogen.c
138
drmr_hydrogen.c
@ -451,13 +451,16 @@ int load_sample(char* path, drmr_layer* layer, double target_rate) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int load_hydrogen_kit(DrMr* drmr, char* path) {
|
drmr_sample* load_hydrogen_kit(char *path, double rate, int *num_samples) {
|
||||||
FILE* file;
|
FILE* file;
|
||||||
char buf[BUFSIZ];
|
char buf[BUFSIZ];
|
||||||
XML_Parser parser;
|
XML_Parser parser;
|
||||||
int done;
|
int done;
|
||||||
struct hp_info info;
|
struct hp_info info;
|
||||||
struct kit_info kit_info;
|
struct kit_info kit_info;
|
||||||
|
drmr_sample *samples;
|
||||||
|
struct instrument_info * cur_i;
|
||||||
|
int i = 0, num_inst = 0;
|
||||||
|
|
||||||
snprintf(buf,BUFSIZ,"%s/drumkit.xml",path);
|
snprintf(buf,BUFSIZ,"%s/drumkit.xml",path);
|
||||||
|
|
||||||
@ -466,7 +469,7 @@ int load_hydrogen_kit(DrMr* drmr, char* path) {
|
|||||||
file = fopen(buf,"r");
|
file = fopen(buf,"r");
|
||||||
if (!file) {
|
if (!file) {
|
||||||
perror("Unable to open file:");
|
perror("Unable to open file:");
|
||||||
return 1;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
parser = XML_ParserCreate(NULL);
|
parser = XML_ParserCreate(NULL);
|
||||||
@ -487,88 +490,71 @@ int load_hydrogen_kit(DrMr* drmr, char* path) {
|
|||||||
"%s at line %lu\n",
|
"%s at line %lu\n",
|
||||||
XML_ErrorString(XML_GetErrorCode(parser)),
|
XML_ErrorString(XML_GetErrorCode(parser)),
|
||||||
XML_GetCurrentLineNumber(parser));
|
XML_GetCurrentLineNumber(parser));
|
||||||
return 1;
|
return NULL;
|
||||||
}
|
}
|
||||||
} while (!done);
|
} while (!done);
|
||||||
XML_ParserFree(parser);
|
XML_ParserFree(parser);
|
||||||
|
|
||||||
{
|
printf("Read kit: %s\n",kit_info.name);
|
||||||
drmr_sample *samples, *old_samples;
|
cur_i = kit_info.instruments;
|
||||||
struct instrument_info * cur_i;
|
while(cur_i) { // first count how many samples we have
|
||||||
int i = 0, num_inst = 0, old_scount;
|
num_inst ++;
|
||||||
printf("Read kit: %s\n",kit_info.name);
|
cur_i = cur_i->next;
|
||||||
cur_i = kit_info.instruments;
|
}
|
||||||
while(cur_i) { // first count how many samples we have
|
printf("Loading %i instruments\n",num_inst);
|
||||||
num_inst ++;
|
samples = malloc(num_inst*sizeof(drmr_sample));
|
||||||
cur_i = cur_i->next;
|
cur_i = kit_info.instruments;
|
||||||
}
|
while(cur_i) {
|
||||||
printf("Loading %i instruments\n",num_inst);
|
if (cur_i->filename) { // top level filename, just make one dummy layer
|
||||||
samples = malloc(num_inst*sizeof(drmr_sample));
|
drmr_layer *layer = malloc(sizeof(drmr_layer));
|
||||||
cur_i = kit_info.instruments;
|
layer->min = 0;
|
||||||
while(cur_i) {
|
layer->max = 1;
|
||||||
if (cur_i->filename) { // top level filename, just make one dummy layer
|
snprintf(buf,BUFSIZ,"%s/%s",path,cur_i->filename);
|
||||||
drmr_layer *layer = malloc(sizeof(drmr_layer));
|
if (load_sample(buf,layer,rate)) {
|
||||||
layer->min = 0;
|
fprintf(stderr,"Could not load sample: %s\n",buf);
|
||||||
layer->max = 1;
|
// set limit to zero, will never try and play
|
||||||
snprintf(buf,BUFSIZ,"%s/%s",path,cur_i->filename);
|
layer->info = NULL;
|
||||||
if (load_sample(buf,layer,drmr->rate)) {
|
layer->limit = 0;
|
||||||
|
layer->data = NULL;
|
||||||
|
}
|
||||||
|
samples[i].layer_count = 0;
|
||||||
|
samples[i].layers = NULL;
|
||||||
|
samples[i].offset = 0;
|
||||||
|
samples[i].info = layer->info;
|
||||||
|
samples[i].limit = layer->limit;
|
||||||
|
samples[i].data = layer->data;
|
||||||
|
free(layer);
|
||||||
|
} else {
|
||||||
|
int layer_count = 0;
|
||||||
|
int j;
|
||||||
|
struct instrument_layer *cur_l = cur_i->layers;
|
||||||
|
while(cur_l) {
|
||||||
|
layer_count++;
|
||||||
|
cur_l = cur_l->next;
|
||||||
|
}
|
||||||
|
samples[i].layer_count = layer_count;
|
||||||
|
samples[i].layers = malloc(sizeof(drmr_layer)*layer_count);
|
||||||
|
cur_l = cur_i->layers;
|
||||||
|
j = 0;
|
||||||
|
while(cur_l) {
|
||||||
|
snprintf(buf,BUFSIZ,"%s/%s",path,cur_l->filename);
|
||||||
|
if (load_sample(buf,samples[i].layers+j,rate)) {
|
||||||
fprintf(stderr,"Could not load sample: %s\n",buf);
|
fprintf(stderr,"Could not load sample: %s\n",buf);
|
||||||
// set limit to zero, will never try and play
|
// set limit to zero, will never try and play
|
||||||
layer->info = NULL;
|
samples[i].layers[j].info = NULL;
|
||||||
layer->limit = 0;
|
samples[i].layers[j].limit = 0;
|
||||||
layer->data = NULL;
|
samples[i].layers[j].data = NULL;
|
||||||
}
|
|
||||||
samples[i].layer_count = 0;
|
|
||||||
samples[i].layers = NULL;
|
|
||||||
samples[i].offset = 0;
|
|
||||||
samples[i].info = layer->info;
|
|
||||||
samples[i].limit = layer->limit;
|
|
||||||
samples[i].data = layer->data;
|
|
||||||
free(layer);
|
|
||||||
} else {
|
|
||||||
int layer_count = 0;
|
|
||||||
int j;
|
|
||||||
struct instrument_layer *cur_l = cur_i->layers;
|
|
||||||
while(cur_l) {
|
|
||||||
layer_count++;
|
|
||||||
cur_l = cur_l->next;
|
|
||||||
}
|
|
||||||
samples[i].layer_count = layer_count;
|
|
||||||
samples[i].layers = malloc(sizeof(drmr_layer)*layer_count);
|
|
||||||
cur_l = cur_i->layers;
|
|
||||||
j = 0;
|
|
||||||
while(cur_l) {
|
|
||||||
snprintf(buf,BUFSIZ,"%s/%s",path,cur_l->filename);
|
|
||||||
if (load_sample(buf,samples[i].layers+j,drmr->rate)) {
|
|
||||||
fprintf(stderr,"Could not load sample: %s\n",buf);
|
|
||||||
// set limit to zero, will never try and play
|
|
||||||
samples[i].layers[j].info = NULL;
|
|
||||||
samples[i].layers[j].limit = 0;
|
|
||||||
samples[i].layers[j].data = NULL;
|
|
||||||
}
|
|
||||||
samples[i].layers[j].min = cur_l->min;
|
|
||||||
samples[i].layers[j].max = cur_l->max;
|
|
||||||
j++;
|
|
||||||
cur_l = cur_l->next;
|
|
||||||
}
|
}
|
||||||
|
samples[i].layers[j].min = cur_l->min;
|
||||||
|
samples[i].layers[j].max = cur_l->max;
|
||||||
|
j++;
|
||||||
|
cur_l = cur_l->next;
|
||||||
}
|
}
|
||||||
samples[i].active = 0;
|
|
||||||
i++;
|
|
||||||
cur_i = cur_i->next;
|
|
||||||
}
|
}
|
||||||
old_samples = drmr->samples;
|
samples[i].active = 0;
|
||||||
old_scount = drmr->num_samples;
|
i++;
|
||||||
if (num_inst > drmr->num_samples) {
|
cur_i = cur_i->next;
|
||||||
// we have more, so we can safely swap our sample list in before updating num_samples
|
|
||||||
drmr->samples = samples;
|
|
||||||
drmr->num_samples = num_inst;
|
|
||||||
} else {
|
|
||||||
// previous has more, update count first
|
|
||||||
drmr->num_samples = num_inst;
|
|
||||||
drmr->samples = samples;
|
|
||||||
}
|
|
||||||
if (old_samples) free_samples(old_samples,old_scount);
|
|
||||||
}
|
}
|
||||||
return 0;
|
*num_samples = num_inst;
|
||||||
|
return samples;
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,6 @@ kits* scan_kits();
|
|||||||
void free_kits(kits* kits);
|
void free_kits(kits* kits);
|
||||||
void free_samples(drmr_sample* samples, int num_samples);
|
void free_samples(drmr_sample* samples, int num_samples);
|
||||||
int load_sample(char* path,drmr_layer* layer,double target_rate);
|
int load_sample(char* path,drmr_layer* layer,double target_rate);
|
||||||
int load_hydrogen_kit(DrMr* drmr, char* path);
|
drmr_sample *load_hydrogen_kit(char *path, double rate, int *num_samples);
|
||||||
|
|
||||||
#endif // DRMR_HYDRO_H
|
#endif // DRMR_HYDRO_H
|
||||||
|
111
drmr_ui.c
111
drmr_ui.c
@ -31,6 +31,7 @@ typedef struct {
|
|||||||
GtkWidget *drmr_widget;
|
GtkWidget *drmr_widget;
|
||||||
GtkTable *sample_table;
|
GtkTable *sample_table;
|
||||||
GtkComboBox *kit_combo;
|
GtkComboBox *kit_combo;
|
||||||
|
GtkSpinButton *base_spin;
|
||||||
GtkLabel *base_label;
|
GtkLabel *base_label;
|
||||||
GtkListStore *kit_store;
|
GtkListStore *kit_store;
|
||||||
GtkWidget** gain_sliders;
|
GtkWidget** gain_sliders;
|
||||||
@ -42,6 +43,7 @@ typedef struct {
|
|||||||
GQuark gain_quark, pan_quark;
|
GQuark gain_quark, pan_quark;
|
||||||
|
|
||||||
int curKit;
|
int curKit;
|
||||||
|
int kitReq;
|
||||||
kits* kits;
|
kits* kits;
|
||||||
} DrMrUi;
|
} DrMrUi;
|
||||||
|
|
||||||
@ -188,7 +190,7 @@ static void build_drmr_ui(DrMrUi* ui) {
|
|||||||
(gtk_adjustment_new(36.0, // val
|
(gtk_adjustment_new(36.0, // val
|
||||||
21.0,107.0, // min/max
|
21.0,107.0, // min/max
|
||||||
1.0, // step
|
1.0, // step
|
||||||
5.0,5.0)); // page adj/size
|
5.0,0.0)); // page adj/size
|
||||||
base_spin = gtk_spin_button_new(base_adj, 1.0, 0);
|
base_spin = gtk_spin_button_new(base_adj, 1.0, 0);
|
||||||
|
|
||||||
gtk_box_pack_start(GTK_BOX(opts_hbox),kit_label,
|
gtk_box_pack_start(GTK_BOX(opts_hbox),kit_label,
|
||||||
@ -207,6 +209,7 @@ static void build_drmr_ui(DrMrUi* ui) {
|
|||||||
ui->sample_table = NULL;
|
ui->sample_table = NULL;
|
||||||
ui->kit_combo = GTK_COMBO_BOX(kit_combo_box);
|
ui->kit_combo = GTK_COMBO_BOX(kit_combo_box);
|
||||||
ui->base_label = GTK_LABEL(base_label);
|
ui->base_label = GTK_LABEL(base_label);
|
||||||
|
ui->base_spin = GTK_SPIN_BUTTON(base_spin);
|
||||||
|
|
||||||
|
|
||||||
g_signal_connect(G_OBJECT(kit_combo_box),"changed",G_CALLBACK(kit_combobox_changed),ui);
|
g_signal_connect(G_OBJECT(kit_combo_box),"changed",G_CALLBACK(kit_combobox_changed),ui);
|
||||||
@ -257,6 +260,60 @@ static void cleanup(LV2UI_Handle handle) {
|
|||||||
free(ui);
|
free(ui);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct slider_callback_data {
|
||||||
|
GtkRange* range;
|
||||||
|
float val;
|
||||||
|
};
|
||||||
|
static gboolean slider_callback(gpointer data) {
|
||||||
|
struct slider_callback_data *cbd = (struct slider_callback_data*)data;
|
||||||
|
gtk_range_set_value(cbd->range,cbd->val);
|
||||||
|
free(cbd);
|
||||||
|
return FALSE; // don't keep calling
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean idle = FALSE;
|
||||||
|
static gboolean kit_callback(gpointer data) {
|
||||||
|
DrMrUi* ui = (DrMrUi*)data;
|
||||||
|
if (ui->kitReq != ui->curKit) {
|
||||||
|
int samples = (ui->kitReq<ui->kits->num_kits && ui->kitReq >= 0)?
|
||||||
|
ui->kits->kits[ui->kitReq].samples:
|
||||||
|
0;
|
||||||
|
GtkWidget** gain_sliders;
|
||||||
|
GtkWidget** pan_sliders;
|
||||||
|
if (ui->sample_table) {
|
||||||
|
gain_sliders = ui->gain_sliders;
|
||||||
|
pan_sliders = ui->pan_sliders;
|
||||||
|
ui->gain_sliders = NULL;
|
||||||
|
ui->pan_sliders = NULL;
|
||||||
|
if (gain_sliders) free(gain_sliders);
|
||||||
|
if (pan_sliders) free(pan_sliders);
|
||||||
|
gtk_widget_destroy(GTK_WIDGET(ui->sample_table));
|
||||||
|
ui->sample_table = NULL;
|
||||||
|
}
|
||||||
|
if (samples > 0) {
|
||||||
|
ui->sample_table = GTK_TABLE(gtk_table_new(1,1,true));
|
||||||
|
gtk_table_set_col_spacings(ui->sample_table,5);
|
||||||
|
gtk_table_set_row_spacings(ui->sample_table,5);
|
||||||
|
|
||||||
|
gain_sliders = malloc(samples*sizeof(GtkWidget*));
|
||||||
|
pan_sliders = malloc(samples*sizeof(GtkWidget*));
|
||||||
|
fill_sample_table(ui,samples,gain_sliders,pan_sliders);
|
||||||
|
gtk_box_pack_start(GTK_BOX(ui->drmr_widget),GTK_WIDGET(ui->sample_table),
|
||||||
|
true,true,5);
|
||||||
|
gtk_box_reorder_child(GTK_BOX(ui->drmr_widget),GTK_WIDGET(ui->sample_table),0);
|
||||||
|
gtk_widget_show_all(GTK_WIDGET(ui->sample_table));
|
||||||
|
ui->samples = samples;
|
||||||
|
ui->gain_sliders = gain_sliders;
|
||||||
|
ui->pan_sliders = pan_sliders;
|
||||||
|
|
||||||
|
ui->curKit = ui->kitReq;
|
||||||
|
gtk_combo_box_set_active(ui->kit_combo,ui->curKit);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
idle = FALSE;
|
||||||
|
return FALSE; // don't keep calling
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
port_event(LV2UI_Handle handle,
|
port_event(LV2UI_Handle handle,
|
||||||
uint32_t port_index,
|
uint32_t port_index,
|
||||||
@ -271,31 +328,19 @@ port_event(LV2UI_Handle handle,
|
|||||||
fprintf(stderr,"Invalid format for kitnum: %i\n",format);
|
fprintf(stderr,"Invalid format for kitnum: %i\n",format);
|
||||||
else {
|
else {
|
||||||
int kit = (int)(*((float*)buffer));
|
int kit = (int)(*((float*)buffer));
|
||||||
int samples = ui->kits->kits[kit].samples;
|
ui->kitReq = kit;
|
||||||
GtkWidget** gain_sliders;
|
if (!idle) {
|
||||||
GtkWidget** pan_sliders;
|
idle = TRUE;
|
||||||
if (ui->sample_table) {
|
g_idle_add(kit_callback,ui);
|
||||||
ui->gain_sliders = NULL;
|
|
||||||
ui->pan_sliders = NULL;
|
|
||||||
gtk_widget_destroy(GTK_WIDGET(ui->sample_table));
|
|
||||||
}
|
}
|
||||||
ui->sample_table = GTK_TABLE(gtk_table_new(1,1,true));
|
}
|
||||||
gtk_table_set_col_spacings(ui->sample_table,5);
|
}
|
||||||
gtk_table_set_row_spacings(ui->sample_table,5);
|
else if (index == DRMR_BASENOTE) {
|
||||||
ui->curKit = kit;
|
int base = (int)(*((float*)buffer));
|
||||||
if (ui->gain_sliders) free(ui->gain_sliders);
|
if (base >= 21 && base <= 107) {
|
||||||
if (ui->pan_sliders) free(ui->pan_sliders);
|
setBaseLabel((int)base);
|
||||||
gain_sliders = malloc(samples*sizeof(GtkWidget*));
|
gtk_spin_button_set_value(ui->base_spin,base);
|
||||||
pan_sliders = malloc(samples*sizeof(GtkWidget*));
|
gtk_label_set_markup(ui->base_label,baseLabelBuf);
|
||||||
fill_sample_table(ui,samples,gain_sliders,pan_sliders);
|
|
||||||
gtk_box_pack_start(GTK_BOX(ui->drmr_widget),GTK_WIDGET(ui->sample_table),
|
|
||||||
true,true,5);
|
|
||||||
gtk_box_reorder_child(GTK_BOX(ui->drmr_widget),GTK_WIDGET(ui->sample_table),0);
|
|
||||||
gtk_widget_show_all(GTK_WIDGET(ui->sample_table));
|
|
||||||
gtk_combo_box_set_active(ui->kit_combo,kit);
|
|
||||||
ui->samples = samples;
|
|
||||||
ui->gain_sliders = gain_sliders;
|
|
||||||
ui->pan_sliders = pan_sliders;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (index >= DRMR_GAIN_ONE &&
|
else if (index >= DRMR_GAIN_ONE &&
|
||||||
@ -304,8 +349,12 @@ port_event(LV2UI_Handle handle,
|
|||||||
float gain = *(float*)buffer;
|
float gain = *(float*)buffer;
|
||||||
int idx = index-DRMR_GAIN_ONE;
|
int idx = index-DRMR_GAIN_ONE;
|
||||||
if (idx < ui->samples) {
|
if (idx < ui->samples) {
|
||||||
GtkRange* range = GTK_RANGE(ui->gain_sliders[idx]);
|
struct slider_callback_data* data = malloc(sizeof(struct slider_callback_data));
|
||||||
gtk_range_set_value(range,gain);
|
data->range = GTK_RANGE(ui->gain_sliders[idx]);
|
||||||
|
data->val = gain;
|
||||||
|
g_idle_add(slider_callback,data);
|
||||||
|
//GtkRange* range = GTK_RANGE(ui->gain_sliders[idx]);
|
||||||
|
//gtk_range_set_value(range,gain);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -315,8 +364,12 @@ port_event(LV2UI_Handle handle,
|
|||||||
float pan = *(float*)buffer;
|
float pan = *(float*)buffer;
|
||||||
int idx = index-DRMR_PAN_ONE;
|
int idx = index-DRMR_PAN_ONE;
|
||||||
if (idx < ui->samples) {
|
if (idx < ui->samples) {
|
||||||
GtkRange* range = GTK_RANGE(ui->pan_sliders[idx]);
|
struct slider_callback_data* data = malloc(sizeof(struct slider_callback_data));
|
||||||
gtk_range_set_value(range,pan);
|
data->range = GTK_RANGE(ui->pan_sliders[idx]);
|
||||||
|
data->val = pan;
|
||||||
|
g_idle_add(slider_callback,data);
|
||||||
|
//GtkRange* range = GTK_RANGE(ui->pan_sliders[idx]);
|
||||||
|
//gtk_range_set_value(range,pan);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user