X-Git-Url: https://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Fpluginlv2.C;h=c6ef09cbe2125257a6dc07c004b9402f11b750fd;hb=b2d226c1f41e84bbb3af93ebc0aa89f98ec0fd52;hp=d1c5a8c4022e7362ba613d70d94fed5b5e3a425d;hpb=eb7b1a0bb84ed4f40b651b74ff72e63b97cce1c2;p=goodguy%2Fcinelerra.git diff --git a/cinelerra-5.1/cinelerra/pluginlv2.C b/cinelerra-5.1/cinelerra/pluginlv2.C index d1c5a8c4..c6ef09cb 100644 --- a/cinelerra-5.1/cinelerra/pluginlv2.C +++ b/cinelerra-5.1/cinelerra/pluginlv2.C @@ -22,6 +22,7 @@ PluginLV2::PluginLV2() samplerate = 44100; refreshrate = 30.; + min_block_length = 1; block_length = 4096; midi_buf_size = 8192; @@ -51,6 +52,8 @@ PluginLV2::PluginLV2() schedule.schedule_work = lv2_worker_schedule; worker_iface = 0; worker_done = -1; pthread_mutex_init(&worker_lock, 0); + pthread_mutex_init(&startup_lock, 0); + pthread_mutex_lock(&startup_lock); pthread_cond_init(&worker_ready, 0); work_avail = 0; work_input = 0; work_output = 0; work_tail = &work_output; @@ -189,9 +192,10 @@ int PluginLV2::init_lv2(PluginLV2ClientConfig &conf, int sample_rate, int bfrsz) ui_updateRate = uri_table.map(LV2_UI__updateRate); samplerate = sample_rate; - block_length = bfrsz; options.add(param_sampleRate, sizeof(float), atom_float, &samplerate); - options.add(bufsz_minBlockLength, sizeof(int), atom_int, &block_length); + if( min_block_length > bfrsz ) min_block_length = bfrsz; + options.add(bufsz_minBlockLength, sizeof(int), atom_int, &min_block_length); + block_length = bfrsz; options.add(bufsz_maxBlockLength, sizeof(int), atom_int, &block_length); options.add(bufsz_sequenceSize, sizeof(int), atom_int, &midi_buf_size); options.add(ui_updateRate, sizeof(float), atom_float, &refreshrate); @@ -218,6 +222,7 @@ int PluginLV2::init_lv2(PluginLV2ClientConfig &conf, int sample_rate, int bfrsz) (lilv_plugin_has_feature(lilv, powerOf2BlockLength) || lilv_plugin_has_feature(lilv, fixedBlockLength) || lilv_plugin_has_feature(lilv, boundedBlockLength)) ? 4096 : 0; + init_buffer(bfrsz); return 0; } @@ -414,6 +419,7 @@ PluginLV2Work *PluginLV2::get_work() void *PluginLV2::worker_func() { pthread_mutex_lock(&worker_lock); + pthread_mutex_unlock(&startup_lock); for(;;) { while( !worker_done && !work_input ) pthread_cond_wait(&worker_ready, &worker_lock); @@ -437,6 +443,7 @@ void *PluginLV2::worker_func(void* vp) void PluginLV2::worker_start() { pthread_create(&worker_thread, 0, worker_func, this); + pthread_mutex_lock(&startup_lock); } void PluginLV2::worker_stop()