Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
2debad5744 | |||
f405ce33ad | |||
c067a43b27 | |||
17383c6a99 |
10
.gitignore
vendored
10
.gitignore
vendored
@ -1,7 +1,9 @@
|
||||
drmr.so
|
||||
drmr_ui.xml
|
||||
drmr_ui.so
|
||||
drmr.lv2
|
||||
*~
|
||||
drmr2.so
|
||||
drmr2_ui.xml
|
||||
drmr2_ui.so
|
||||
drmr2.lv2
|
||||
drmr2.ttl
|
||||
build
|
||||
/logo.xcf
|
||||
/htest
|
||||
|
14
drmr2-mkttl
14
drmr2-mkttl
@ -70,7 +70,19 @@ add_port "," " a lv2:InputPort , atom:AtomPort;
|
||||
lv2:name \"Control\";"
|
||||
|
||||
|
||||
idx=1
|
||||
|
||||
add_port "," " a lv2:AudioPort, lv2:OutputPort;
|
||||
lv2:index %d;
|
||||
lv2:symbol \"master_out_1\";
|
||||
lv2:name \"Master - Out 1\";"
|
||||
|
||||
add_port "," " a lv2:AudioPort, lv2:OutputPort;
|
||||
lv2:index %d;
|
||||
lv2:symbol \"master_out_2\";
|
||||
lv2:name \"Master - Out 2\";"
|
||||
|
||||
|
||||
|
||||
out_id=0
|
||||
|
||||
while [[ "${out_id}" -lt "${outport_nb}" ]]
|
||||
|
106
drmr2.c
106
drmr2.c
@ -84,6 +84,7 @@ instantiate(const LV2_Descriptor* descriptor,
|
||||
drmr->rate = rate;
|
||||
drmr->ignore_velocity = false;
|
||||
drmr->ignore_note_off = true;
|
||||
drmr->channel_nb = 0;
|
||||
|
||||
#ifdef DRMR_UI_ZERO_SAMP
|
||||
drmr->zero_position = DRMR_UI_ZERO_SAMP;
|
||||
@ -165,7 +166,15 @@ connect_port(LV2_Handle instance,
|
||||
break;
|
||||
|
||||
default:
|
||||
if( port_index >= DRMR_LEFT_00 && port_index <= DRMR_RIGHT_31)
|
||||
if( port_index == DRMR_MASTER_LEFT)
|
||||
{
|
||||
drmr->master_right = (float*)data;
|
||||
}
|
||||
else if( port_index == DRMR_MASTER_RIGHT)
|
||||
{
|
||||
drmr->master_left = (float*)data;
|
||||
}
|
||||
else if( port_index >= DRMR_LEFT_00 && port_index <= DRMR_RIGHT_31)
|
||||
{
|
||||
int outoff = (port_index - DRMR_LEFT_00) / 2;
|
||||
|
||||
@ -190,7 +199,7 @@ connect_port(LV2_Handle instance,
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -225,6 +234,8 @@ static inline LV2_Atom *build_state_message(DrMr *drmr) {
|
||||
lv2_atom_forge_bool(&drmr->forge, drmr->ignore_velocity?true:false);
|
||||
lv2_atom_forge_property_head(&drmr->forge, drmr->uris.note_off_toggle,0);
|
||||
lv2_atom_forge_bool(&drmr->forge, drmr->ignore_note_off?true:false);
|
||||
lv2_atom_forge_property_head(&drmr->forge, drmr->uris.channel_nb,0);
|
||||
lv2_atom_forge_int(&drmr->forge, drmr->channel_nb);
|
||||
lv2_atom_forge_property_head(&drmr->forge, drmr->uris.zero_position,0);
|
||||
lv2_atom_forge_int(&drmr->forge, drmr->zero_position);
|
||||
lv2_atom_forge_pop(&drmr->forge,&set_frame);
|
||||
@ -281,6 +292,10 @@ static inline void trigger_sample(DrMr *drmr, int nn, uint8_t* const data, uint3
|
||||
pthread_mutex_lock(&drmr->load_mutex);
|
||||
if (nn >= 0 && nn < drmr->num_samples) {
|
||||
if (drmr->samples[nn].layer_count > 0) {
|
||||
// drmr currently has 32 hard-coded gains so just use the last gain
|
||||
// to prevent a segfault
|
||||
int gain_idx = nn < 32 ? nn : 31;
|
||||
layer_to_sample(drmr->samples+nn,*(drmr->gains[gain_idx]));
|
||||
layer_to_sample(drmr->samples+nn,*(drmr->gains[nn]));
|
||||
if (drmr->samples[nn].limit == 0)
|
||||
fprintf(stderr,"Failed to find layer at: %i for %f\n",nn,*drmr->gains[nn]);
|
||||
@ -342,24 +357,37 @@ static void run(LV2_Handle instance, uint32_t n_samples) {
|
||||
uint8_t nn;
|
||||
uint8_t* const data = (uint8_t* const)(ev + 1);
|
||||
uint32_t offset = (ev->time.frames > 0 && ev->time.frames < n_samples) ? ev->time.frames : 0;
|
||||
//int channel = *data & 15;
|
||||
switch ((*data) >> 4) {
|
||||
case 8:
|
||||
if (!drmr->ignore_note_off) {
|
||||
nn = data[1];
|
||||
nn-=baseNote;
|
||||
untrigger_sample(drmr,nn,offset);
|
||||
}
|
||||
break;
|
||||
case 9: {
|
||||
nn = data[1];
|
||||
nn-=baseNote;
|
||||
trigger_sample(drmr,nn,data,offset);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
//printf("Unhandeled status: %i\n",(*data)>>4);
|
||||
break;
|
||||
int channel = *data & 15;
|
||||
|
||||
if( ( drmr->channel_nb == 0) || ( channel == ( drmr->channel_nb - 1)))
|
||||
{
|
||||
switch ((*data) >> 4)
|
||||
{
|
||||
case 8:
|
||||
{
|
||||
if (!drmr->ignore_note_off)
|
||||
{
|
||||
nn = data[1];
|
||||
nn-=baseNote;
|
||||
untrigger_sample(drmr,nn,offset);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case 9:
|
||||
{
|
||||
nn = data[1];
|
||||
nn-=baseNote;
|
||||
trigger_sample(drmr,nn,data,offset);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
//printf("Unhandeled status: %i\n",(*data)>>4);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (ev->body.type == drmr->uris.atom_resource) {
|
||||
@ -369,12 +397,14 @@ static void run(LV2_Handle instance, uint32_t n_samples) {
|
||||
const LV2_Atom* trigger = NULL;
|
||||
const LV2_Atom* ignvel = NULL;
|
||||
const LV2_Atom* ignno = NULL;
|
||||
const LV2_Atom* channel_nb = NULL;
|
||||
const LV2_Atom* zerop = NULL;
|
||||
lv2_atom_object_get(obj,
|
||||
drmr->uris.kit_path, &path,
|
||||
drmr->uris.sample_trigger, &trigger,
|
||||
drmr->uris.velocity_toggle, &ignvel,
|
||||
drmr->uris.note_off_toggle, &ignno,
|
||||
drmr->uris.channel_nb, &channel_nb,
|
||||
drmr->uris.zero_position, &zerop,
|
||||
0);
|
||||
if (path) {
|
||||
@ -400,6 +430,8 @@ static void run(LV2_Handle instance, uint32_t n_samples) {
|
||||
drmr->ignore_velocity = ((const LV2_Atom_Bool*)ignvel)->body;
|
||||
if (ignno)
|
||||
drmr->ignore_note_off = ((const LV2_Atom_Bool*)ignno)->body;
|
||||
if (channel_nb)
|
||||
drmr->channel_nb = ((const LV2_Atom_Int*)channel_nb)->body;
|
||||
if (zerop)
|
||||
drmr->zero_position = ((const LV2_Atom_Int*)zerop)->body;
|
||||
} else if (obj->body.otype == drmr->uris.get_state) {
|
||||
@ -427,6 +459,12 @@ static void run(LV2_Handle instance, uint32_t n_samples) {
|
||||
|
||||
pthread_mutex_lock(&drmr->load_mutex);
|
||||
|
||||
for( j = 0; j<n_samples; j++)
|
||||
{
|
||||
drmr->master_left[j] = 0.0f;
|
||||
drmr->master_right[j] = 0.0f;
|
||||
}
|
||||
|
||||
for (i = 0;i < drmr->num_samples;i++)
|
||||
{
|
||||
int pos,lim;
|
||||
@ -473,8 +511,12 @@ static void run(LV2_Handle instance, uint32_t n_samples) {
|
||||
|
||||
for (pos = datastart; pos < lim && pos < dataend; pos++)
|
||||
{
|
||||
drmr->left[i][pos] += cs->data[cs->offset]*coef_left;
|
||||
drmr->right[i][pos] += cs->data[cs->offset]*coef_right;
|
||||
drmr->master_left[pos] += cs->data[cs->offset]*coef_left;
|
||||
drmr->left[i][pos] += cs->data[cs->offset]*coef_left;
|
||||
|
||||
drmr->master_right[pos] += cs->data[cs->offset]*coef_right;
|
||||
drmr->right[i][pos] += cs->data[cs->offset]*coef_right;
|
||||
|
||||
cs->offset++;
|
||||
}
|
||||
}
|
||||
@ -485,8 +527,11 @@ static void run(LV2_Handle instance, uint32_t n_samples) {
|
||||
if (lim > n_samples) lim = n_samples;
|
||||
for (pos = datastart; pos < lim && pos < dataend; pos++)
|
||||
{
|
||||
drmr->left[i][pos] += cs->data[cs->offset++]*coef_left;
|
||||
drmr->right[i][pos] += cs->data[cs->offset++]*coef_right;
|
||||
drmr->master_left[pos] += cs->data[cs->offset]*coef_left;
|
||||
drmr->left[i][pos] += cs->data[cs->offset++]*coef_left;
|
||||
|
||||
drmr->master_right[pos] += cs->data[cs->offset]*coef_right;
|
||||
drmr->right[i][pos] += cs->data[cs->offset++]*coef_right;
|
||||
}
|
||||
}
|
||||
|
||||
@ -568,6 +613,14 @@ save_state(LV2_Handle instance,
|
||||
LV2_STATE_IS_POD | LV2_STATE_IS_PORTABLE);
|
||||
if (stat) return stat;
|
||||
|
||||
stat = store(handle,
|
||||
drmr->uris.channel_nb,
|
||||
&drmr->channel_nb,
|
||||
sizeof(int),
|
||||
drmr->uris.int_urid,
|
||||
LV2_STATE_IS_POD | LV2_STATE_IS_PORTABLE);
|
||||
if (stat) return stat;
|
||||
|
||||
stat = store(handle,
|
||||
drmr->uris.zero_position,
|
||||
&drmr->zero_position,
|
||||
@ -635,6 +688,11 @@ restore_state(LV2_Handle instance,
|
||||
if (ignore_note_off)
|
||||
drmr->ignore_note_off = *ignore_note_off?true:false;
|
||||
|
||||
const int* channel_nb =
|
||||
retrieve(handle, drmr->uris.channel_nb, &size, &type, &fgs);
|
||||
if (channel_nb)
|
||||
drmr->channel_nb = *channel_nb;
|
||||
|
||||
const int* zero_position =
|
||||
retrieve(handle, drmr->uris.zero_position, &size, &type, &fgs);
|
||||
if (zero_position)
|
||||
|
10
drmr2.h
10
drmr2.h
@ -72,6 +72,8 @@ typedef struct {
|
||||
|
||||
typedef enum {
|
||||
DRMR_CONTROL = 0,
|
||||
DRMR_MASTER_LEFT,
|
||||
DRMR_MASTER_RIGHT,
|
||||
DRMR_LEFT_00,
|
||||
DRMR_RIGHT_00,
|
||||
DRMR_LEFT_01,
|
||||
@ -219,11 +221,14 @@ typedef struct {
|
||||
LV2_URID sample_trigger;
|
||||
LV2_URID velocity_toggle;
|
||||
LV2_URID note_off_toggle;
|
||||
LV2_URID channel_nb;
|
||||
LV2_URID zero_position;
|
||||
} drmr_uris;
|
||||
|
||||
typedef struct {
|
||||
// Ports
|
||||
float* master_left;
|
||||
float* master_right;
|
||||
float** left;
|
||||
float** right;
|
||||
LV2_Atom_Sequence *control_port;
|
||||
@ -232,8 +237,10 @@ typedef struct {
|
||||
LV2_Atom_Forge forge;
|
||||
|
||||
// params
|
||||
int channel;
|
||||
bool ignore_velocity;
|
||||
bool ignore_note_off;
|
||||
int channel_nb;
|
||||
int zero_position;
|
||||
float** gains;
|
||||
float** pans;
|
||||
@ -293,6 +300,9 @@ void map_drmr_uris(LV2_URID_Map *map,
|
||||
uris->note_off_toggle =
|
||||
map->map(map->handle,
|
||||
DRMR_URI "#noteofftoggle");
|
||||
uris->channel_nb =
|
||||
map->map(map->handle,
|
||||
DRMR_URI "#channelnb");
|
||||
uris->zero_position =
|
||||
map->map(map->handle,
|
||||
DRMR_URI "#zeroposition");
|
||||
|
@ -87,6 +87,7 @@ struct kit_info {
|
||||
struct hp_info {
|
||||
char scan_only;
|
||||
char in_info;
|
||||
char in_component_list;
|
||||
char in_instrument_list;
|
||||
char in_instrument;
|
||||
char in_layer;
|
||||
@ -105,22 +106,30 @@ startElement(void *userData, const char *name, const char **atts)
|
||||
struct hp_info* info = (struct hp_info*)userData;
|
||||
info->cur_off = 0;
|
||||
if (info->in_info) {
|
||||
if (info->in_instrument) {
|
||||
if (!strcmp(name,"layer") && !info->scan_only) {
|
||||
info->in_layer = 1;
|
||||
info->cur_layer = malloc(sizeof(struct instrument_layer));
|
||||
memset(info->cur_layer,0,sizeof(struct instrument_layer));
|
||||
if (!info->in_component_list) {
|
||||
if (!strcmp(name,"componentList")) {
|
||||
info->in_component_list = 1;
|
||||
}
|
||||
}
|
||||
if (info->in_instrument_list) {
|
||||
if (!strcmp(name,"instrument")) {
|
||||
info->in_instrument = 1;
|
||||
info->cur_instrument = malloc(sizeof(struct instrument_info));
|
||||
memset(info->cur_instrument,0,sizeof(struct instrument_info));
|
||||
else
|
||||
{
|
||||
if (info->in_instrument) {
|
||||
if (!strcmp(name,"layer") && !info->scan_only) {
|
||||
info->in_layer = 1;
|
||||
info->cur_layer = malloc(sizeof(struct instrument_layer));
|
||||
memset(info->cur_layer,0,sizeof(struct instrument_layer));
|
||||
}
|
||||
}
|
||||
if (info->in_instrument_list) {
|
||||
if (!strcmp(name,"instrument")) {
|
||||
info->in_instrument = 1;
|
||||
info->cur_instrument = malloc(sizeof(struct instrument_info));
|
||||
memset(info->cur_instrument,0,sizeof(struct instrument_info));
|
||||
}
|
||||
} else {
|
||||
if (!strcmp(name,"instrumentList"))
|
||||
info->in_instrument_list = 1;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!strcmp(name,"instrumentList"))
|
||||
info->in_instrument_list = 1;
|
||||
}
|
||||
} else {
|
||||
if (!strcmp(name,"drumkit_info"))
|
||||
@ -135,7 +144,7 @@ endElement(void *userData, const char *name)
|
||||
if (info->cur_off == MAX_CHAR_DATA) info->cur_off--;
|
||||
info->cur_buf[info->cur_off]='\0';
|
||||
|
||||
if (info->in_info && !info->in_instrument_list && !strcmp(name,"name"))
|
||||
if (info->in_info && !info->in_component_list && !info->in_instrument_list && !strcmp(name,"name"))
|
||||
info->kit_info->name = strdup(info->cur_buf);
|
||||
if (info->scan_only && info->in_info && !info->in_instrument_list && !strcmp(name,"info"))
|
||||
info->kit_info->desc = strdup(info->cur_buf);
|
||||
@ -187,6 +196,7 @@ endElement(void *userData, const char *name)
|
||||
info->cur_instrument = NULL;
|
||||
info->in_instrument = 0;
|
||||
}
|
||||
if (info->in_component_list && !strcmp(name,"componentList")) info->in_component_list = 0;
|
||||
if (info->in_instrument_list && !strcmp(name,"instrumentList")) info->in_instrument_list = 0;
|
||||
if (info->in_info && !strcmp(name,"drumkit_info")) info->in_info = 0;
|
||||
}
|
||||
@ -232,9 +242,9 @@ static char* expand_path(char* path, char* buf) {
|
||||
|
||||
|
||||
|
||||
static int *compar_kit(const void *p1, const void *p2)
|
||||
static int compar_kit(const void *p1, const void *p2)
|
||||
{
|
||||
return (int) strcmp( (* (scanned_kit **) p1)->name, (* (scanned_kit **) p2)->name);
|
||||
return (int) strcmp( (* (scanned_kit **) p1)->name, (* (scanned_kit **) p2)->name);
|
||||
}
|
||||
|
||||
|
||||
@ -339,7 +349,7 @@ kits* scan_kits() {
|
||||
cp = 0;
|
||||
struct kit_list * cur_k = scanned_kits;
|
||||
while(cur_k) {
|
||||
//printf("found kit: %s\nat:%s\n\n",cur_k->skit->name,cur_k->skit->path);
|
||||
// printf("found kit: %s\nat:%s\n\n",cur_k->skit->name,cur_k->skit->path);
|
||||
cur_k = cur_k->next;
|
||||
cp++;
|
||||
}
|
||||
|
101
drmr2_ui.c
101
drmr2_ui.c
@ -51,13 +51,16 @@ typedef struct {
|
||||
GtkListStore *kit_store;
|
||||
GtkWidget** gain_sliders;
|
||||
GtkWidget** pan_sliders;
|
||||
GtkWidget** notify_leds;
|
||||
GtkWidget *channel_combo_box, *position_combo_box, *velocity_checkbox, *note_off_checkbox;
|
||||
GtkScrolledWindow *sample_view;
|
||||
|
||||
float *gain_vals,*pan_vals;
|
||||
|
||||
GtkWidget** notify_leds;
|
||||
GtkWidget *position_combo_box, *velocity_checkbox, *note_off_checkbox;
|
||||
|
||||
|
||||
gchar *bundle_path;
|
||||
|
||||
int channel;
|
||||
int cols;
|
||||
int startSamp;
|
||||
|
||||
@ -358,9 +361,7 @@ static gboolean kit_callback(gpointer data) {
|
||||
gain_sliders = malloc(samples*sizeof(GtkWidget*));
|
||||
pan_sliders = malloc(samples*sizeof(GtkWidget*));
|
||||
fill_sample_table(ui,samples,ui->kits->kits[ui->kitReq].sample_names,notify_leds,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),1);
|
||||
gtk_scrolled_window_add_with_viewport(ui->sample_view, GTK_WIDGET(ui->sample_table));
|
||||
gtk_widget_show_all(GTK_WIDGET(ui->sample_table));
|
||||
ui->samples = samples;
|
||||
ui->notify_leds = notify_leds;
|
||||
@ -417,10 +418,63 @@ static void kit_combobox_changed(GtkComboBox* box, gpointer data) {
|
||||
}
|
||||
}
|
||||
|
||||
static void channel_data(DrMrUi *ui, gpointer data) {
|
||||
lv2_atom_forge_property_head(&ui->forge, ui->uris.channel_nb,0);
|
||||
lv2_atom_forge_int(&ui->forge, GPOINTER_TO_INT(data));
|
||||
}
|
||||
|
||||
static void channel_combobox_changed(GtkComboBox* box, gpointer data) {
|
||||
DrMrUi* ui = (DrMrUi*)data;
|
||||
gint channel = gtk_combo_box_get_active (GTK_COMBO_BOX(box));
|
||||
|
||||
printf( "Channel Change: [%d]\n", channel);
|
||||
|
||||
if (channel != ui->channel) {
|
||||
ui->channel = channel;
|
||||
ui->forceUpdate = true;
|
||||
kit_callback(ui);
|
||||
send_ui_msg(ui,&channel_data,GINT_TO_POINTER(channel));
|
||||
}
|
||||
}
|
||||
|
||||
static GtkWidget *create_channel_combo(void)
|
||||
{
|
||||
GtkWidget *combo;
|
||||
GtkListStore *list_store;
|
||||
GtkCellRenderer *cell;
|
||||
GtkTreeIter iter;
|
||||
int i;
|
||||
char label[8];
|
||||
|
||||
list_store = gtk_list_store_new(1, G_TYPE_STRING);
|
||||
|
||||
gtk_list_store_append(list_store, &iter);
|
||||
gtk_list_store_set (list_store, &iter, 0, "Omni", -1);
|
||||
|
||||
for( i = 1; i <= 16; i++) {
|
||||
sprintf( label, "%02d", i);
|
||||
gtk_list_store_append(list_store, &iter);
|
||||
gtk_list_store_set (list_store, &iter, 0, label, -1);
|
||||
}
|
||||
|
||||
combo = gtk_combo_box_new_with_model(GTK_TREE_MODEL(list_store));
|
||||
|
||||
gtk_combo_box_set_active(GTK_COMBO_BOX(combo),0);
|
||||
|
||||
g_object_unref(list_store);
|
||||
|
||||
cell = gtk_cell_renderer_text_new();
|
||||
gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combo), cell, TRUE);
|
||||
gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(combo), cell, "text", 0, NULL);
|
||||
|
||||
return combo;
|
||||
}
|
||||
|
||||
static void position_data(DrMrUi *ui, gpointer data) {
|
||||
lv2_atom_forge_property_head(&ui->forge, ui->uris.zero_position,0);
|
||||
lv2_atom_forge_int(&ui->forge, GPOINTER_TO_INT(data));
|
||||
}
|
||||
|
||||
static void position_combobox_changed(GtkComboBox* box, gpointer data) {
|
||||
DrMrUi* ui = (DrMrUi*)data;
|
||||
gint ss = gtk_combo_box_get_active (GTK_COMBO_BOX(box));
|
||||
@ -458,7 +512,6 @@ static GtkWidget *create_position_combo(void)
|
||||
gtk_combo_box_set_active(GTK_COMBO_BOX(combo),0);
|
||||
#endif
|
||||
|
||||
|
||||
g_object_unref(list_store);
|
||||
|
||||
cell = gtk_cell_renderer_text_new();
|
||||
@ -510,7 +563,7 @@ static void build_drmr_ui(DrMrUi* ui) {
|
||||
GtkWidget *drmr_ui_widget;
|
||||
GtkWidget *opts_hbox1, *opts_hbox2,
|
||||
*kit_combo_box, *kit_label, *no_kit_label,
|
||||
*base_label, *base_spin, *position_label;
|
||||
*base_label, *base_spin, *channel_label, *position_label, *sample_view;
|
||||
GtkCellRenderer *cell_rend;
|
||||
GtkAdjustment *base_adj;
|
||||
|
||||
@ -551,6 +604,9 @@ static void build_drmr_ui(DrMrUi* ui) {
|
||||
5.0,0.0)); // page adj/size
|
||||
base_spin = gtk_spin_button_new(base_adj, 1.0, 0);
|
||||
|
||||
channel_label = gtk_label_new("Midi Channel: ");
|
||||
ui->channel_combo_box = create_channel_combo();
|
||||
|
||||
position_label = gtk_label_new("Sample Zero Position: ");
|
||||
ui->position_combo_box = create_position_combo();
|
||||
|
||||
@ -568,6 +624,10 @@ static void build_drmr_ui(DrMrUi* ui) {
|
||||
gtk_box_pack_start(GTK_BOX(opts_hbox1),base_spin,
|
||||
true,true,0);
|
||||
|
||||
gtk_box_pack_start(GTK_BOX(opts_hbox2),channel_label,
|
||||
false,false,15);
|
||||
gtk_box_pack_start(GTK_BOX(opts_hbox2),ui->channel_combo_box,
|
||||
false,false,0);
|
||||
gtk_box_pack_start(GTK_BOX(opts_hbox2),position_label,
|
||||
false,false,15);
|
||||
gtk_box_pack_start(GTK_BOX(opts_hbox2),ui->position_combo_box,
|
||||
@ -579,24 +639,32 @@ static void build_drmr_ui(DrMrUi* ui) {
|
||||
|
||||
gtk_box_pack_start(GTK_BOX(drmr_ui_widget),GTK_WIDGET(ui->current_kit_label),
|
||||
false,false,5);
|
||||
gtk_box_pack_start(GTK_BOX(drmr_ui_widget),gtk_hseparator_new(),
|
||||
false,false,5);
|
||||
gtk_box_pack_start(GTK_BOX(drmr_ui_widget),opts_hbox1,
|
||||
false,false,5);
|
||||
gtk_box_pack_start(GTK_BOX(drmr_ui_widget),opts_hbox2,
|
||||
false,false,5);
|
||||
|
||||
gtk_box_pack_start(GTK_BOX(drmr_ui_widget),gtk_hseparator_new(),
|
||||
false,false,5);
|
||||
|
||||
|
||||
sample_view = gtk_scrolled_window_new(NULL, NULL);
|
||||
gtk_widget_set_size_request(sample_view, -1, 300);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(sample_view),
|
||||
GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
|
||||
gtk_box_pack_start(GTK_BOX(drmr_ui_widget), sample_view,
|
||||
true, true, 5);
|
||||
|
||||
ui->drmr_widget = drmr_ui_widget;
|
||||
ui->sample_table = NULL;
|
||||
ui->kit_combo = GTK_COMBO_BOX(kit_combo_box);
|
||||
ui->base_label = GTK_LABEL(base_label);
|
||||
ui->base_spin = GTK_SPIN_BUTTON(base_spin);
|
||||
ui->no_kit_label = no_kit_label;
|
||||
|
||||
ui->sample_view = GTK_SCROLLED_WINDOW(sample_view);
|
||||
|
||||
g_signal_connect(G_OBJECT(kit_combo_box),"changed",G_CALLBACK(kit_combobox_changed),ui);
|
||||
g_signal_connect(G_OBJECT(base_spin),"value-changed",G_CALLBACK(base_changed),ui);
|
||||
g_signal_connect(G_OBJECT(ui->channel_combo_box),"changed",G_CALLBACK(channel_combobox_changed),ui);
|
||||
g_signal_connect(G_OBJECT(ui->position_combo_box),"changed",G_CALLBACK(position_combobox_changed),ui);
|
||||
g_signal_connect(G_OBJECT(ui->velocity_checkbox),"toggled",G_CALLBACK(ignore_velocity_toggled),ui);
|
||||
g_signal_connect(G_OBJECT(ui->note_off_checkbox),"toggled",G_CALLBACK(ignore_note_off_toggled),ui);
|
||||
@ -726,14 +794,18 @@ port_event(LV2UI_Handle handle,
|
||||
if (!strncmp(kitpath, "file://", 7))
|
||||
kitpath += 7;
|
||||
char *realp = realpath(kitpath,NULL);
|
||||
// fprintf(stderr, "KitPath: [%s] RealPath: [%s]\n", kitpath, realp);
|
||||
if (!realp) {
|
||||
fprintf(stderr,"Passed a path I can't resolve, bailing out\n");
|
||||
return;
|
||||
}
|
||||
int i;
|
||||
for(i = 0;i < ui->kits->num_kits;i++)
|
||||
{
|
||||
// fprintf(stderr, "CheckPath: [%s] / [%s]\n", ui->kits->kits[i].path, realp);
|
||||
if (!strcmp(ui->kits->kits[i].path,realp))
|
||||
break;
|
||||
}
|
||||
if (i < ui->kits->num_kits) {
|
||||
ui->kitReq = i;
|
||||
g_idle_add(kit_callback,ui);
|
||||
@ -744,10 +816,12 @@ port_event(LV2UI_Handle handle,
|
||||
if (obj->body.otype == ui->uris.get_state) { // read out extra state info
|
||||
const LV2_Atom* ignvel = NULL;
|
||||
const LV2_Atom* ignno = NULL;
|
||||
const LV2_Atom* channel_nb = NULL;
|
||||
const LV2_Atom* zerop = NULL;
|
||||
lv2_atom_object_get(obj,
|
||||
ui->uris.velocity_toggle, &ignvel,
|
||||
ui->uris.note_off_toggle, &ignno,
|
||||
ui->uris.channel_nb, &channel_nb,
|
||||
ui->uris.zero_position, &zerop,
|
||||
0);
|
||||
if (ignvel)
|
||||
@ -756,6 +830,9 @@ port_event(LV2UI_Handle handle,
|
||||
if (ignno)
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ui->note_off_checkbox),
|
||||
((const LV2_Atom_Bool*)ignno)->body);
|
||||
if (channel_nb)
|
||||
gtk_combo_box_set_active(GTK_COMBO_BOX(ui->channel_combo_box),
|
||||
((const LV2_Atom_Int*)channel_nb)->body);
|
||||
if (zerop)
|
||||
gtk_combo_box_set_active(GTK_COMBO_BOX(ui->position_combo_box),
|
||||
((const LV2_Atom_Int*)zerop)->body);
|
||||
|
Loading…
Reference in New Issue
Block a user