From 554fd8c5195424bdbcabf5de30fdc183aba391bd Mon Sep 17 00:00:00 2001 From: upstream source tree Date: Sun, 15 Mar 2015 20:14:05 -0400 Subject: obtained gcc-4.6.4.tar.bz2 from upstream website; verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository. --- libjava/classpath/native/jni/midi-dssi/README | 134 ++++++++++++++++++++++++++ 1 file changed, 134 insertions(+) create mode 100644 libjava/classpath/native/jni/midi-dssi/README (limited to 'libjava/classpath/native/jni/midi-dssi/README') diff --git a/libjava/classpath/native/jni/midi-dssi/README b/libjava/classpath/native/jni/midi-dssi/README new file mode 100644 index 000000000..6913414ff --- /dev/null +++ b/libjava/classpath/native/jni/midi-dssi/README @@ -0,0 +1,134 @@ +The file native/jni/midi-dssi/gnu_javax_sound_midi_dssi_DSSISynthesizer.c +contains two functions (get_port_default and set_control) derived from +example code in the DSSI distribution (http://dssi.sourceforge.net). +The original DSSI example code is distributed under the following +terms: + + Copyright 2004 Chris Cannam, Steve Harris and Sean Bolton. + + Permission to use, copy, modify, distribute, and sell this software + for any purpose is hereby granted without fee, provided that the + above copyright notice and this permission notice are included in + all copies or substantial portions of the software. + + +The rest of this file contain the original versions of these +functions. + + +LADSPA_Data get_port_default(const LADSPA_Descriptor *plugin, int port) +{ + LADSPA_PortRangeHint hint = plugin->PortRangeHints[port]; + float lower = hint.LowerBound * + (LADSPA_IS_HINT_SAMPLE_RATE(hint.HintDescriptor) ? sample_rate : 1.0f); + float upper = hint.UpperBound * + (LADSPA_IS_HINT_SAMPLE_RATE(hint.HintDescriptor) ? sample_rate : 1.0f); + + if (!LADSPA_IS_HINT_HAS_DEFAULT(hint.HintDescriptor)) { + if (!LADSPA_IS_HINT_BOUNDED_BELOW(hint.HintDescriptor) || + !LADSPA_IS_HINT_BOUNDED_ABOVE(hint.HintDescriptor)) { + /* No hint, its not bounded, wild guess */ + return 0.0f; + } + + if (lower <= 0.0f && upper >= 0.0f) { + /* It spans 0.0, 0.0 is often a good guess */ + return 0.0f; + } + + /* No clues, return minimum */ + return lower; + } + + /* Try all the easy ones */ + + if (LADSPA_IS_HINT_DEFAULT_0(hint.HintDescriptor)) { + return 0.0f; + } else if (LADSPA_IS_HINT_DEFAULT_1(hint.HintDescriptor)) { + return 1.0f; + } else if (LADSPA_IS_HINT_DEFAULT_100(hint.HintDescriptor)) { + return 100.0f; + } else if (LADSPA_IS_HINT_DEFAULT_440(hint.HintDescriptor)) { + return 440.0f; + } + + /* All the others require some bounds */ + + if (LADSPA_IS_HINT_BOUNDED_BELOW(hint.HintDescriptor)) { + if (LADSPA_IS_HINT_DEFAULT_MINIMUM(hint.HintDescriptor)) { + return lower; + } + } + if (LADSPA_IS_HINT_BOUNDED_ABOVE(hint.HintDescriptor)) { + if (LADSPA_IS_HINT_DEFAULT_MAXIMUM(hint.HintDescriptor)) { + return upper; + } + if (LADSPA_IS_HINT_BOUNDED_BELOW(hint.HintDescriptor)) { + if (LADSPA_IS_HINT_DEFAULT_LOW(hint.HintDescriptor)) { + return lower * 0.75f + upper * 0.25f; + } else if (LADSPA_IS_HINT_DEFAULT_MIDDLE(hint.HintDescriptor)) { + return lower * 0.5f + upper * 0.5f; + } else if (LADSPA_IS_HINT_DEFAULT_HIGH(hint.HintDescriptor)) { + return lower * 0.25f + upper * 0.75f; + } + } + } + + /* fallback */ + return 0.0f; +} + + +void +setControl(d3h_instance_t *instance, long controlIn, snd_seq_event_t *event) +{ + long port = pluginControlInPortNumbers[controlIn]; + + const LADSPA_Descriptor *p = instance->plugin->descriptor->LADSPA_Plugin; + + LADSPA_PortRangeHintDescriptor d = p->PortRangeHints[port].HintDescriptor; + + LADSPA_Data lb = p->PortRangeHints[port].LowerBound * + (LADSPA_IS_HINT_SAMPLE_RATE(p->PortRangeHints[port].HintDescriptor) ? + sample_rate : 1.0f); + + LADSPA_Data ub = p->PortRangeHints[port].UpperBound * + (LADSPA_IS_HINT_SAMPLE_RATE(p->PortRangeHints[port].HintDescriptor) ? + sample_rate : 1.0f); + + float value = (float)event->data.control.value; + + if (!LADSPA_IS_HINT_BOUNDED_BELOW(d)) { + if (!LADSPA_IS_HINT_BOUNDED_ABOVE(d)) { + /* unbounded: might as well leave the value alone. */ + } else { + /* bounded above only. just shift the range. */ + value = ub - 127.0f + value; + } + } else { + if (!LADSPA_IS_HINT_BOUNDED_ABOVE(d)) { + /* bounded below only. just shift the range. */ + value = lb + value; + } else { + /* bounded both ends. more interesting. */ + if (LADSPA_IS_HINT_LOGARITHMIC(d)) { + const float llb = logf(lb); + const float lub = logf(ub); + + value = expf(llb + ((lub - llb) * value / 127.0f)); + } else { + value = lb + ((ub - lb) * value / 127.0f); + } + } + } + + if (verbose) { + printf("%s: %s MIDI controller %d=%d -> control in %ld=%f\n", myName, + instance->friendly_name, event->data.control.param, + event->data.control.value, controlIn, value); + } + + pluginControlIns[controlIn] = value; + pluginPortUpdated[controlIn] = 1; +} + -- cgit v1.2.3