gcc/libjava/classpath/native/jni/midi-dssi
Thomas Fitzsimmons 442a795bc6 Makefile.am (AM_CXXFLAGS): Define ECJ_JAR_FILE.
2007-03-13  Thomas Fitzsimmons  <fitzsim@redhat.com>

        * Makefile.am (AM_CXXFLAGS): Define ECJ_JAR_FILE.
        * classpath/configure.ac: Add --with-ecj-jar configure option.
        * classpath/gnu/classpath/Configuration.java.in (ECJ_JAR): New
        field.
        * classpath/INSTALL: Document --with-ecj-jar configure option and
        ecj jar requirement for com.sun.tools.javac support.
        * classpath/tools/Makefile.am: Build decendents of com and sun
        directories.
        * configure.ac: Substitute ECJ_JAR in stub Configuration.java.
        * gnu/classpath/Configuration.java,
        gnu/classpath/natConfiguration.cc (ecj): New method.
        (ECJ_JAR): New field.
        * scripts/makemake.tcl (scan_packages): Add com directory.
        * sources.am (property_files): Add
        classpath/resource/sun/rmi/rmic/messages.properties and
        classpath/resource/com/sun/tools/javac/messages.properties.
        * classpath/resource/com, classpath/resource/com/sun,
        classpath/resource/com/sun/tools,
        classpath/resource/com/sun/tools/javac, classpath/resource/sun,
        classpath/resource/sun/rmi, classpath/resource/sun/rmi/rmic,
        classpath/tools/classes/com, classpath/tools/classes/com/sun,
        classpath/tools/classes/com/sun/javadoc,
        classpath/tools/classes/com/sun/tools,
        classpath/tools/classes/com/sun/tools/doclets,
        classpath/tools/classes/sun, classpath/tools/classes/sun/rmi,
        classpath/tools/classes/sun/rmi/rmic, classpath/tools/com,
        classpath/tools/com/sun, classpath/tools/com/sun/javadoc,
        classpath/tools/com/sun/tools,
        classpath/tools/com/sun/tools/doclets,
        classpath/tools/com/sun/tools/javac, classpath/tools/sun,
        classpath/tools/sun/rmi, classpath/tools/sun/rmi/rmic: New
        directories.
        * classpath/resource/com/sun/tools/javac/messages.properties,
        classpath/resource/sun/rmi/rmic/messages.properties,
        classpath/tools/classes/com/sun/javadoc/ClassDoc.class,
        classpath/tools/classes/com/sun/javadoc/ConstructorDoc.class,
        classpath/tools/classes/com/sun/javadoc/Doc.class,
        classpath/tools/classes/com/sun/javadoc/DocErrorReporter.class,
        classpath/tools/classes/com/sun/javadoc/Doclet.class,
        classpath/tools/classes/com/sun/javadoc/ExecutableMemberDoc.class,
        classpath/tools/classes/com/sun/javadoc/FieldDoc.class,
        classpath/tools/classes/com/sun/javadoc/MemberDoc.class,
        classpath/tools/classes/com/sun/javadoc/MethodDoc.class,
        classpath/tools/classes/com/sun/javadoc/PackageDoc.class,
        classpath/tools/classes/com/sun/javadoc/ParamTag.class,
        classpath/tools/classes/com/sun/javadoc/Parameter.class,
        classpath/tools/classes/com/sun/javadoc/ProgramElementDoc.class,
        classpath/tools/classes/com/sun/javadoc/RootDoc.class,
        classpath/tools/classes/com/sun/javadoc/SeeTag.class,
        classpath/tools/classes/com/sun/javadoc/SerialFieldTag.class,
        classpath/tools/classes/com/sun/javadoc/SourcePosition.class,
        classpath/tools/classes/com/sun/javadoc/Tag.class,
        classpath/tools/classes/com/sun/javadoc/ThrowsTag.class,
        classpath/tools/classes/com/sun/javadoc/Type.class,
        classpath/tools/classes/com/sun/javadoc/TypeVariable.class,
        classpath/tools/classes/com/sun/tools/doclets/Taglet.class,
        classpath/tools/classes/sun/rmi/rmic/Main.class,
        classpath/tools/classes/sun/rmi/rmic/Messages.class,
        classpath/tools/com/sun/javadoc/ClassDoc.java,
        classpath/tools/com/sun/javadoc/ConstructorDoc.java,
        classpath/tools/com/sun/javadoc/Doc.java,
        classpath/tools/com/sun/javadoc/DocErrorReporter.java,
        classpath/tools/com/sun/javadoc/Doclet.java,
        classpath/tools/com/sun/javadoc/ExecutableMemberDoc.java,
        classpath/tools/com/sun/javadoc/FieldDoc.java,
        classpath/tools/com/sun/javadoc/MemberDoc.java,
        classpath/tools/com/sun/javadoc/MethodDoc.java,
        classpath/tools/com/sun/javadoc/PackageDoc.java,
        classpath/tools/com/sun/javadoc/ParamTag.java,
        classpath/tools/com/sun/javadoc/Parameter.java,
        classpath/tools/com/sun/javadoc/ProgramElementDoc.java,
        classpath/tools/com/sun/javadoc/RootDoc.java,
        classpath/tools/com/sun/javadoc/SeeTag.java,
        classpath/tools/com/sun/javadoc/SerialFieldTag.java,
        classpath/tools/com/sun/javadoc/SourcePosition.java,
        classpath/tools/com/sun/javadoc/Tag.java,
        classpath/tools/com/sun/javadoc/ThrowsTag.java,
        classpath/tools/com/sun/javadoc/Type.java,
        classpath/tools/com/sun/javadoc/TypeVariable.java,
        classpath/tools/com/sun/tools/doclets/Taglet.java,
        classpath/tools/com/sun/tools/javac/Main.java,
        classpath/tools/com/sun/tools/javac/Messages.java,
        classpath/tools/sun/rmi/rmic/Main.java,
        classpath/tools/sun/rmi/rmic/Messages.java: New files.
        * Makefile.in, classpath/Makefile.in, classpath/configure,
        classpath/doc/Makefile.in, classpath/doc/api/Makefile.in,
        classpath/examples/Makefile.in, classpath/external/Makefile.in,
        classpath/external/jsr166/Makefile.in,
        classpath/external/relaxngDatatype/Makefile.in,
        classpath/external/sax/Makefile.in,
        classpath/external/w3c_dom/Makefile.in,
        classpath/include/Makefile.in, classpath/include/config.h.in,
        classpath/lib/Makefile.in,
        classpath/lib/gnu/classpath/Configuration.class,
        classpath/native/Makefile.in, classpath/native/fdlibm/Makefile.in,
        classpath/native/jawt/Makefile.in,
        classpath/native/jni/Makefile.in,
        classpath/native/jni/classpath/Makefile.in,
        classpath/native/jni/gconf-peer/Makefile.in,
        classpath/native/jni/gtk-peer/Makefile.in,
        classpath/native/jni/java-io/Makefile.in,
        classpath/native/jni/java-lang/Makefile.in,
        classpath/native/jni/java-net/Makefile.in,
        classpath/native/jni/java-nio/Makefile.in,
        classpath/native/jni/java-util/Makefile.in,
        classpath/native/jni/midi-alsa/Makefile.in,
        classpath/native/jni/midi-dssi/Makefile.in,
        classpath/native/jni/native-lib/Makefile.in,
        classpath/native/jni/qt-peer/Makefile.in,
        classpath/native/jni/xmlj/Makefile.in,
        classpath/native/plugin/Makefile.in,
        classpath/resource/Makefile.in, classpath/scripts/Makefile.in,
        classpath/tools/Makefile.in, configure,
        gnu/classpath/Configuration.h: Regenerate.

From-SVN: r122876
2007-03-13 05:48:03 +00:00
..
.cvsignore Merged gcj-eclipse branch to trunk. 2007-01-09 19:58:05 +00:00
Makefile.am Merged gcj-eclipse branch to trunk. 2007-01-09 19:58:05 +00:00
Makefile.in Makefile.am (AM_CXXFLAGS): Define ECJ_JAR_FILE. 2007-03-13 05:48:03 +00:00
README
dssi_data.h Merged gcj-eclipse branch to trunk. 2007-01-09 19:58:05 +00:00
gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider.c
gnu_javax_sound_midi_dssi_DSSISynthesizer.c

README

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