Files
gcc/libjava/classpath/native/jni/midi-dssi
Thomas Fitzsimmons 8c0633b7cd makemake.tcl (emit_bc_rule): Do not skip gnu-java-awt-peer-gtk.lo.
2006-05-30  Thomas Fitzsimmons  <fitzsim@redhat.com>

	* scripts/makemake.tcl (emit_bc_rule): Do not skip
	gnu-java-awt-peer-gtk.lo.
	Include gnu/java/awt/peer/gtk Java objects in libgcj.so.  Use C++
	ABI for gnu/java/awt/peer/gtk package.
	* gnu/classpath/natSystemProperties.cc (PrependVersionedLibdir):
	New function.
	(insertSystemProperties): Only set java.ext.dirs if it is not
	already defined.  Prepend GCJ_VERSIONED_LIBDIR to module search
	path where necessary.
	* configure.ac (GTK_AWT): Remove automake conditional.
	* include/jvm.h (_Jv_PrependVersionedLibdir): New function
	declaration.
	* gij.cc (main): Prepend LD_LIBRARY_PATH with GCJ_VERSIONED_LIBDIR
	and re-exec self.
	* Makefile.am (AM_CXXFLAGS): Define GCJ_VERSIONED_LIBDIR,
	GIJ_EXECUTABLE and PATH_SEPARATOR macros.
	Remove lib-gnu-java-awt-peer-gtk.la and libgcjawt.la build logic.
	* prims.cc (_Jv_PrependVersionedLibdir): New function.

2006-05-30  Thomas Fitzsimmons  <fitzsim@redhat.com>

	* native/jni/gtk-peer/Makefile.am (gcc_version): New variable.
	(gcjversionedlibdir): Likewise.
	(libgtkpeer_la_LDFLAGS): Likewise.
	Install libgtkpeer.so in GCJ versioned library directory.
	* native/jawt/Makefile.am (gcc_version): New variable.
	(gcjversionedlibdir): Likewise.
	(libjawt_la_LDFLAGS): Likewise.
	Rename libjawtgnu.so libjawt.so.  Install libjawt.so in GCJ
	versioned library directory.
	* gnu/java/awt/peer/gtk/GdkFontPeer.java (static): Call
	System.loadLibrary unconditionally.
	* gnu/java/awt/peer/gtk/GdkPixbufDecoder.java: Likewise.
	* gnu/java/awt/peer/gtk/GdkGraphics2D.java: Likewise.
	* gnu/java/awt/peer/gtk/GdkGraphics.java: Likewise.
	* gnu/java/awt/peer/gtk/GtkToolkit.java: Likewise.
	* gnu/java/awt/peer/gtk/GdkTextLayout.java: Likewise.

From-SVN: r114247
2006-05-30 21:38:51 +00:00
..
2006-05-18 17:29:21 +00:00

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;
}