olaf neophyte and de.po updates, valgrind tweaks, delete green lady, inkscape dpi=96
[goodguy/history.git] / cinelerra-5.1 / cinelerra / pluginlv2.C
index 4ec32648ae3441d44048cee56fc570852b736473..f4f1f7946df4ce9bf77b35e5dea84aa298f900aa 100644 (file)
@@ -125,9 +125,11 @@ int PluginLV2::load_lv2(const char *path, char *title)
        return 0;
 }
 
-int PluginLV2::init_lv2(PluginLV2ClientConfig &conf, int sample_rate)
+int PluginLV2::init_lv2(PluginLV2ClientConfig &conf, int sample_rate, int bfrsz)
 {
        reset_lv2();
+       double bps = 2. * sample_rate / bfrsz;
+       if( bps > refreshrate ) refreshrate = bps;
 
        lv2_AudioPort       = lilv_new_uri(world, LV2_CORE__AudioPort);
        lv2_ControlPort     = lilv_new_uri(world, LV2_CORE__ControlPort);
@@ -180,7 +182,7 @@ int PluginLV2::init_lv2(PluginLV2ClientConfig &conf, int sample_rate)
        features.append(new Lv2Feature(LV2_BUF_SIZE__boundedBlockLength,  0));
        features.append(new Lv2Feature(LV2_WORKER__schedule, &schedule));
 
-       if( sample_rate < 64 ) sample_rate = 44100;
+       if( sample_rate < 64 ) sample_rate = samplerate;
 
        atom_int   = uri_table.map(LV2_ATOM__Int);
        atom_float = uri_table.map(LV2_ATOM__Float);
@@ -191,6 +193,7 @@ int PluginLV2::init_lv2(PluginLV2ClientConfig &conf, int sample_rate)
        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);
        options.add(bufsz_maxBlockLength, sizeof(int), atom_int, &block_length);