Keep empty instruments in sample list, to match up with hydrogen layout. NB: this will break existing patterns created against older versions of DrMr that used kits with empty instruments. Sorry about that.
This commit is contained in:
parent
b3dd5bb1b2
commit
6bb66abca2
3
drmr.c
3
drmr.c
@ -210,10 +210,11 @@ static void run(LV2_Handle instance, uint32_t n_samples) {
|
|||||||
// changed after the check that the midi-note is valid
|
// changed after the check that the midi-note is valid
|
||||||
pthread_mutex_lock(&drmr->load_mutex);
|
pthread_mutex_lock(&drmr->load_mutex);
|
||||||
if (nn >= 0 && nn < drmr->num_samples) {
|
if (nn >= 0 && nn < drmr->num_samples) {
|
||||||
if (drmr->samples[nn].layer_count > 0)
|
if (drmr->samples[nn].layer_count > 0) {
|
||||||
layer_to_sample(drmr->samples+nn,*(drmr->gains[nn]));
|
layer_to_sample(drmr->samples+nn,*(drmr->gains[nn]));
|
||||||
if (drmr->samples[nn].limit == 0)
|
if (drmr->samples[nn].limit == 0)
|
||||||
fprintf(stderr,"Failed to find layer at: %i for %f\n",nn,*drmr->gains[nn]);
|
fprintf(stderr,"Failed to find layer at: %i for %f\n",nn,*drmr->gains[nn]);
|
||||||
|
}
|
||||||
drmr->samples[nn].active = 1;
|
drmr->samples[nn].active = 1;
|
||||||
drmr->samples[nn].offset = 0;
|
drmr->samples[nn].offset = 0;
|
||||||
}
|
}
|
||||||
|
@ -175,9 +175,7 @@ endElement(void *userData, const char *name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (info->in_instrument &&
|
if (info->in_instrument && info->cur_instrument && !strcmp(name,"instrument")) {
|
||||||
(info->cur_instrument && (info->cur_instrument->filename || info->cur_instrument->layers)) &&
|
|
||||||
!strcmp(name,"instrument")) {
|
|
||||||
struct instrument_info * cur_i = info->kit_info->instruments;
|
struct instrument_info * cur_i = info->kit_info->instruments;
|
||||||
if (cur_i) {
|
if (cur_i) {
|
||||||
while(cur_i->next) cur_i = cur_i->next;
|
while(cur_i->next) cur_i = cur_i->next;
|
||||||
@ -530,7 +528,7 @@ drmr_sample* load_hydrogen_kit(char *path, double rate, int *num_samples) {
|
|||||||
samples[i].limit = layer->limit;
|
samples[i].limit = layer->limit;
|
||||||
samples[i].data = layer->data;
|
samples[i].data = layer->data;
|
||||||
free(layer);
|
free(layer);
|
||||||
} else {
|
} else if (cur_i->layers) {
|
||||||
int layer_count = 0;
|
int layer_count = 0;
|
||||||
int j;
|
int j;
|
||||||
struct instrument_layer *cur_l = cur_i->layers;
|
struct instrument_layer *cur_l = cur_i->layers;
|
||||||
@ -556,6 +554,13 @@ drmr_sample* load_hydrogen_kit(char *path, double rate, int *num_samples) {
|
|||||||
j++;
|
j++;
|
||||||
cur_l = cur_l->next;
|
cur_l = cur_l->next;
|
||||||
}
|
}
|
||||||
|
} else { // no layer or file, empty inst
|
||||||
|
samples[i].layer_count = 0;
|
||||||
|
samples[i].layers = NULL;
|
||||||
|
samples[i].offset = 0;
|
||||||
|
samples[i].info = NULL;
|
||||||
|
samples[i].limit = 0;
|
||||||
|
samples[i].data = NULL;
|
||||||
}
|
}
|
||||||
samples[i].active = 0;
|
samples[i].active = 0;
|
||||||
i_to_free = cur_i;
|
i_to_free = cur_i;
|
||||||
|
Loading…
Reference in New Issue
Block a user