Update of /cvsroot/audacity/audacity-src/src/effects/lv2
In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv29428/src/effects/lv2
Modified Files:
LV2Effect.cpp LoadLV2.cpp
Log Message:
Fixed some LV2 bugs
Index: LoadLV2.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/effects/lv2/LoadLV2.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- LoadLV2.cpp 12 Jul 2008 07:22:01 -0000 1.2
+++ LoadLV2.cpp 12 Jul 2008 07:57:45 -0000 1.3
@@ -44,23 +44,24 @@
/** This function determines whether a plugin should be displayed or not.
- It checks if the required features and non-optional port types are
- supported. */
+ It checks if the required features and port types are supported. */
static bool PluginFilter(SLV2Plugin plug) {
// We don't support any features at all, so if the plugin requires
// any we skip it.
SLV2Values req = slv2_plugin_get_required_features(plug);
- if (slv2_values_size(req) > 0)
+ size_t nFeatures = slv2_values_size(req);
+ slv2_values_free(req);
+ if (nFeatures > 0)
return false;
// We only understand audio and control ports, so if there are any others
// we skip the plugin.
uint32_t nPorts = slv2_plugin_get_num_ports(plug);
for (uint32_t i = 0; i < nPorts; ++i) {
- SLV2Port port = slv2_plugin_get_port_at_index(plug, i);
- if (!slv2_port_is_a(mData, port, gAudioPortClass) &&
- !slv2_port_is_a(mData, port, gControlPortClass))
+ SLV2Port port = slv2_plugin_get_port_by_index(plug, i);
+ if (!slv2_port_is_a(plug, port, gAudioPortClass) &&
+ !slv2_port_is_a(plug, port, gControlPortClass))
return false;
}
@@ -122,7 +123,7 @@
cats.insert(wxString::FromUTF8(slv2_value_as_uri(slv2_plugin_class_get_uri(slv2_plugin_get_class(plug)))));
LV2Effect *effect = new LV2Effect(plug, cats);
em.RegisterEffect(effect);
- std::cerr<<"Loaded LV2
\""<<slv2_value_as_string(slv2_plugin_get_name(plug))<<"\""<<std::endl;
+ //std::cerr<<"Loaded LV2
\""<<slv2_value_as_string(slv2_plugin_get_name(plug))<<"\""<<std::endl;
}
// Deallocate the plugin list (but not the plugins)
Index: LV2Effect.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/effects/lv2/LV2Effect.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- LV2Effect.cpp 8 Jul 2008 09:09:52 -0000 1.2
+++ LV2Effect.cpp 12 Jul 2008 07:57:45 -0000 1.3
@@ -768,34 +768,40 @@
bool forceint = false;
// Get the port range
- /*
- LADSPA_PortRangeHint hint = mData->PortRangeHints[ports[p]];
- if (LADSPA_IS_HINT_BOUNDED_BELOW(hint.HintDescriptor))
- lower = hint.LowerBound;
- if (LADSPA_IS_HINT_BOUNDED_ABOVE(hint.HintDescriptor))
- upper = hint.UpperBound;
- if (LADSPA_IS_HINT_SAMPLE_RATE(hint.HintDescriptor)) {
+ SLV2Port port = slv2_plugin_get_port_by_index(mData, p);
+ // XXX This is slow - store the values somewhere [larsl]
+ SLV2Value portIsSampleRate =
+ slv2_value_new_uri(gWorld, "http://lv2plug.in/ns/lv2core#sampleRate");
+ SLV2Value portIsInteger =
+ slv2_value_new_uri(gWorld, "http://lv2plug.in/ns/lv2core#integer");
+ int numPorts = slv2_plugin_get_num_ports(mData);
+ float* minimumValues = new float [numPorts];
+ float* maximumValues = new float [numPorts];
+ slv2_plugin_get_port_ranges_float(mData, minimumValues,
+ maximumValues, 0);
+ if (std::isfinite(minimumValues[p]))
+ lower = minimumValues[p];
+ if (std::isfinite(maximumValues[p]))
+ lower = maximumValues[p];
+ if (slv2_port_has_property(mData, port, portIsSampleRate) || forceint) {
lower *= sampleRate;
upper *= sampleRate;
forceint = true;
}
- */
range = upper - lower;
val = (sliders[p]->GetValue() / 1000.0) * range + lower;
-
+
// Force the value to an integer if requested
- /*
wxString str;
- if (LADSPA_IS_HINT_INTEGER(hint.HintDescriptor) || forceint)
+ if (slv2_port_has_property(mData, port, portIsInteger) || forceint)
str.Printf(wxT("%d"), (int)(val + 0.5));
else
str = Internat::ToDisplayString(val);
fields[p]->SetValue(str);
- */
-
+
inputControls[ports[p]] = val;
inSlider = false;
-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Audacity-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/audacity-cvs