Example #1
0
void EFFECT_LV2::parse_parameter_hint_information(Lilv::Plugin plugin, Lilv::Port p, struct PARAM_DESCRIPTION *pd)
{
  /* if srate not set, use 44.1kHz (used only for calculating
   * param hint values */
  SAMPLE_SPECS::sample_rate_t srate = samples_per_second();
  /* FIXME: this is just ugly! */
  if (srate <= 0) { srate = 44100; }

  Lilv::Node name=p.get_name();

  /* parameter name */
  pd->description =name.as_string();

  Lilv::Node deflt(NULL);
  Lilv::Node min(NULL);
  Lilv::Node max(NULL);

  lilv_port_get_range(plugin.me,p.me,&deflt.me,&min.me,&max.me);

  bool isSRRelative=p.has_property(ECA_LV2_WORLD::PortSamplerateDependentNode());

  /* upper and lower bounds */
  if (min) {
    pd->bounded_below = true;

    pd->lower_bound=min.as_float();
    if (isSRRelative) {
      pd->lower_bound *= srate;
    }
  }
  else {
    pd->bounded_below = false;
  }

  if (max) {
    pd->bounded_above = true;

   pd->upper_bound=max.as_float();
   if (isSRRelative) {
     pd->upper_bound *= srate;
   }
  }
  else {
    pd->bounded_above = false;
  }

  /* defaults - case 1 */
  if (deflt) {
   pd->default_value=deflt.as_float();
  }

  /* defaults - case 2 */
  else if (min && !max) {

    if (pd->lower_bound < 0) pd->default_value = 0.0f;
    else pd->default_value = pd->lower_bound;
  }

  /* defaults - case 3 */
  else if (!min && max) {

    if (pd->upper_bound > 0) pd->default_value = 0.0f;
    else pd->default_value = pd->upper_bound;
  }

  /* defaults - case 4 */
  else if (max && min) {

    if (pd->lower_bound < 0 && pd->upper_bound > 0) pd->default_value = 0.0f;
    else if (pd->lower_bound < 0 && pd->upper_bound < 0) pd->default_value = pd->upper_bound;
    else pd->default_value = pd->lower_bound;
  }

  /* defaults - case 5 */
  else {
    DBC_CHECK(!min && !max);

    if (isSRRelative)
      pd->default_value = srate;
    else
      pd->default_value = 1.0f;
  }

  if (p.has_property(ECA_LV2_WORLD::PortToggledNode()))
    pd->toggled = true;
  else
    pd->toggled = false;

  if (p.has_property(ECA_LV2_WORLD::PortIntegerNode()))
    pd->integer = true;
  else
    pd->integer = false;

  if (p.has_property(ECA_LV2_WORLD::PortLogarithmicNode()))
    pd->logarithmic = true;
  else
    pd->logarithmic = false;

  if (p.is_a(ECA_LV2_WORLD::OutputClassNode()))
    pd->output = true;
  else
    pd->output = false;
}
Example #2
0
labelPage::labelPage() : Pages()
{
   QString deflt("");
   m_closeable = false;
   showPage(deflt);
}