当前位置: 首页>>代码示例>>Java>>正文


Java ModelStandardTransform.setDirection方法代码示例

本文整理汇总了Java中com.sun.media.sound.ModelStandardTransform.setDirection方法的典型用法代码示例。如果您正苦于以下问题:Java ModelStandardTransform.setDirection方法的具体用法?Java ModelStandardTransform.setDirection怎么用?Java ModelStandardTransform.setDirection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.sun.media.sound.ModelStandardTransform的用法示例。


在下文中一共展示了ModelStandardTransform.setDirection方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: checkLinearity

import com.sun.media.sound.ModelStandardTransform; //导入方法依赖的package包/类
private static boolean checkLinearity(ModelStandardTransform transform)
{
    double lastx = 0;
    for (int p = 0; p < 2; p++)
    for (int d = 0; d < 2; d++)
    for (double i = 0; i < 1.0; i+=0.001) {
        if(p == 0)
            transform.setPolarity(ModelStandardTransform.POLARITY_UNIPOLAR);
        else
            transform.setPolarity(ModelStandardTransform.POLARITY_BIPOLAR);
        if(d == 0)
            transform.setDirection(ModelStandardTransform.DIRECTION_MIN2MAX);
        else
            transform.setDirection(ModelStandardTransform.DIRECTION_MAX2MIN);
        double x = transform.transform(i);
        if(i == 0)
            lastx = x;
        else
        {
            if(lastx - x > 0.2) return false;
            lastx = x;
        }
    }
    return true;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:26,代码来源:TransformLinear.java

示例2: main

import com.sun.media.sound.ModelStandardTransform; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
    ModelStandardTransform transform = new ModelStandardTransform();
    transform.setTransform(ModelStandardTransform.TRANSFORM_LINEAR);
    assertTrue(checkLinearity(transform));

    transform.setDirection(ModelStandardTransform.DIRECTION_MIN2MAX);
    transform.setPolarity(ModelStandardTransform.POLARITY_UNIPOLAR);
    assertTrue(Math.abs(transform.transform(0.2f) - 0.2f) < 0.0001f);
    assertTrue(Math.abs(transform.transform(0.8f) - 0.8f) < 0.0001f);

    transform.setDirection(ModelStandardTransform.DIRECTION_MAX2MIN);
    transform.setPolarity(ModelStandardTransform.POLARITY_UNIPOLAR);
    assertTrue(Math.abs(transform.transform(0.2f) - 0.8f) < 0.0001f);
    assertTrue(Math.abs(transform.transform(0.8f) - 0.2f) < 0.0001f);

    transform.setDirection(ModelStandardTransform.DIRECTION_MIN2MAX);
    transform.setPolarity(ModelStandardTransform.POLARITY_BIPOLAR);
    assertTrue(Math.abs(transform.transform(0.2f) - (-0.6f)) < 0.0001f);
    assertTrue(Math.abs(transform.transform(0.8f) - (0.6f)) < 0.0001f);

    transform.setDirection(ModelStandardTransform.DIRECTION_MAX2MIN);
    transform.setPolarity(ModelStandardTransform.POLARITY_BIPOLAR);
    assertTrue(Math.abs(transform.transform(0.2f) - (0.6f)) < 0.0001f);
    assertTrue(Math.abs(transform.transform(0.8f) - (-0.6f)) < 0.0001f);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:26,代码来源:TransformLinear.java

示例3: main

import com.sun.media.sound.ModelStandardTransform; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
    ModelStandardTransform transform = new ModelStandardTransform();
    transform.setTransform(ModelStandardTransform.TRANSFORM_SWITCH);

    transform.setDirection(ModelStandardTransform.DIRECTION_MIN2MAX);
    transform.setPolarity(ModelStandardTransform.POLARITY_UNIPOLAR);
    assertTrue(Math.abs(transform.transform(0.2f) - 0.0f) < 0.0001f);
    assertTrue(Math.abs(transform.transform(0.8f) - 1.0f) < 0.0001f);

    transform.setDirection(ModelStandardTransform.DIRECTION_MAX2MIN);
    transform.setPolarity(ModelStandardTransform.POLARITY_UNIPOLAR);
    assertTrue(Math.abs(transform.transform(0.2f) - 1.0f) < 0.0001f);
    assertTrue(Math.abs(transform.transform(0.8f) - 0.0f) < 0.0001f);

    transform.setDirection(ModelStandardTransform.DIRECTION_MIN2MAX);
    transform.setPolarity(ModelStandardTransform.POLARITY_BIPOLAR);
    assertTrue(Math.abs(transform.transform(0.2f) + 1.0f) < 0.0001f);
    assertTrue(Math.abs(transform.transform(0.8f) - 1.0f) < 0.0001f);

    transform.setDirection(ModelStandardTransform.DIRECTION_MAX2MIN);
    transform.setPolarity(ModelStandardTransform.POLARITY_BIPOLAR);
    assertTrue(Math.abs(transform.transform(0.2f) - 1.0f) < 0.0001f);
    assertTrue(Math.abs(transform.transform(0.8f) + 1.0f) < 0.0001f);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:25,代码来源:TransformSwitch.java

示例4: main

import com.sun.media.sound.ModelStandardTransform; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
    ModelStandardTransform transform = new ModelStandardTransform();
    transform.setTransform(ModelStandardTransform.TRANSFORM_CONCAVE);
    assertTrue(checkLinearity(transform));

    transform.setDirection(ModelStandardTransform.DIRECTION_MIN2MAX);
    transform.setPolarity(ModelStandardTransform.POLARITY_UNIPOLAR);
    assertTrue(Math.abs(transform.transform(0.0f) - 0.0f) < 0.0001f);
    assertTrue(transform.transform(0.5f) < 0.5f);
    assertTrue(Math.abs(transform.transform(1.0f) - 1.0f) < 0.0001f);

    transform.setDirection(ModelStandardTransform.DIRECTION_MAX2MIN);
    transform.setPolarity(ModelStandardTransform.POLARITY_UNIPOLAR);
    assertTrue(Math.abs(transform.transform(1.0f) - 0.0f) < 0.0001f);
    assertTrue(transform.transform(0.5f) < 0.5f);
    assertTrue(Math.abs(transform.transform(0.0f) - 1.0f) < 0.0001f);

    transform.setDirection(ModelStandardTransform.DIRECTION_MIN2MAX);
    transform.setPolarity(ModelStandardTransform.POLARITY_BIPOLAR);
    assertTrue(Math.abs(transform.transform(0.0f) + 1.0f) < 0.0001f);
    assertTrue(transform.transform(0.25f) > -0.5f);
    assertTrue(Math.abs(transform.transform(0.5f) - 0.0f) < 0.0001f);
    assertTrue(transform.transform(0.75f) < 0.5f);
    assertTrue(Math.abs(transform.transform(1.0f) - 1.0f) < 0.0001f);

    transform.setDirection(ModelStandardTransform.DIRECTION_MAX2MIN);
    transform.setPolarity(ModelStandardTransform.POLARITY_BIPOLAR);
    assertTrue(Math.abs(transform.transform(1.0f) + 1.0f) < 0.0001f);
    assertTrue(transform.transform(0.75f) > -0.5f);
    assertTrue(Math.abs(transform.transform(0.50f) - 0.0f) < 0.0001f);
    assertTrue(transform.transform(0.25f) < 0.5f);
    assertTrue(Math.abs(transform.transform(0.0f) - 1.0f) < 0.0001f);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:34,代码来源:TransformConcave.java

示例5: main

import com.sun.media.sound.ModelStandardTransform; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
    ModelStandardTransform transform = new ModelStandardTransform();
    transform.setTransform(ModelStandardTransform.TRANSFORM_CONVEX);
    assertTrue(checkLinearity(transform));

    transform.setDirection(ModelStandardTransform.DIRECTION_MIN2MAX);
    transform.setPolarity(ModelStandardTransform.POLARITY_UNIPOLAR);
    assertTrue(Math.abs(transform.transform(0.0f) - 0.0f) < 0.0001f);
    assertTrue(transform.transform(0.5f) > 0.5f);
    assertTrue(Math.abs(transform.transform(1.0f) - 1.0f) < 0.0001f);

    transform.setDirection(ModelStandardTransform.DIRECTION_MAX2MIN);
    transform.setPolarity(ModelStandardTransform.POLARITY_UNIPOLAR);
    assertTrue(Math.abs(transform.transform(1.0f) - 0.0f) < 0.0001f);
    assertTrue(transform.transform(0.5f) > 0.5f);
    assertTrue(Math.abs(transform.transform(0.0f) - 1.0f) < 0.0001f);

    transform.setDirection(ModelStandardTransform.DIRECTION_MIN2MAX);
    transform.setPolarity(ModelStandardTransform.POLARITY_BIPOLAR);
    assertTrue(Math.abs(transform.transform(0.0f) + 1.0f) < 0.0001f);
    assertTrue(transform.transform(0.25f) < -0.5f);
    assertTrue(Math.abs(transform.transform(0.5f) - 0.0f) < 0.0001f);
    assertTrue(transform.transform(0.75f) > 0.5f);
    assertTrue(Math.abs(transform.transform(1.0f) - 1.0f) < 0.0001f);

    transform.setDirection(ModelStandardTransform.DIRECTION_MAX2MIN);
    transform.setPolarity(ModelStandardTransform.POLARITY_BIPOLAR);
    assertTrue(Math.abs(transform.transform(1.0f) + 1.0f) < 0.0001f);
    assertTrue(transform.transform(0.75f) < -0.5f);
    assertTrue(Math.abs(transform.transform(0.50f) - 0.0f) < 0.0001f);
    assertTrue(transform.transform(0.25f) > 0.5f);
    assertTrue(Math.abs(transform.transform(0.0f) - 1.0f) < 0.0001f);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:34,代码来源:TransformConvex.java

示例6: convertSource

import com.sun.media.sound.ModelStandardTransform; //导入方法依赖的package包/类
private static ModelSource convertSource(int src) {
    if (src == 0)
        return null;
    ModelIdentifier id = null;
    int idsrc = src & 0x7F;
    if ((src & SF2Modulator.SOURCE_MIDI_CONTROL) != 0) {
        id = new ModelIdentifier("midi_cc", Integer.toString(idsrc));
    } else {
        if (idsrc == SF2Modulator.SOURCE_NOTE_ON_VELOCITY)
            id = ModelSource.SOURCE_NOTEON_VELOCITY;
        if (idsrc == SF2Modulator.SOURCE_NOTE_ON_KEYNUMBER)
            id = ModelSource.SOURCE_NOTEON_KEYNUMBER;
        if (idsrc == SF2Modulator.SOURCE_POLY_PRESSURE)
            id = ModelSource.SOURCE_MIDI_POLY_PRESSURE;
        if (idsrc == SF2Modulator.SOURCE_CHANNEL_PRESSURE)
            id = ModelSource.SOURCE_MIDI_CHANNEL_PRESSURE;
        if (idsrc == SF2Modulator.SOURCE_PITCH_WHEEL)
            id = ModelSource.SOURCE_MIDI_PITCH;
        if (idsrc == SF2Modulator.SOURCE_PITCH_SENSITIVITY)
            id = new ModelIdentifier("midi_rpn", "0");
    }
    if (id == null)
        return null;

    ModelSource msrc = new ModelSource(id);
    ModelStandardTransform transform
            = (ModelStandardTransform) msrc.getTransform();

    if ((SF2Modulator.SOURCE_DIRECTION_MAX_MIN & src) != 0)
        transform.setDirection(ModelStandardTransform.DIRECTION_MAX2MIN);
    else
        transform.setDirection(ModelStandardTransform.DIRECTION_MIN2MAX);

    if ((SF2Modulator.SOURCE_POLARITY_BIPOLAR & src) != 0)
        transform.setPolarity(ModelStandardTransform.POLARITY_BIPOLAR);
    else
        transform.setPolarity(ModelStandardTransform.POLARITY_UNIPOLAR);

    if ((SF2Modulator.SOURCE_TYPE_CONCAVE & src) != 0)
        transform.setTransform(ModelStandardTransform.TRANSFORM_CONCAVE);
    if ((SF2Modulator.SOURCE_TYPE_CONVEX & src) != 0)
        transform.setTransform(ModelStandardTransform.TRANSFORM_CONVEX);
    if ((SF2Modulator.SOURCE_TYPE_SWITCH & src) != 0)
        transform.setTransform(ModelStandardTransform.TRANSFORM_SWITCH);

    return msrc;
}
 
开发者ID:theokyr,项目名称:TuxGuitar-1.3.1-fork,代码行数:48,代码来源:SF2Instrument.java


注:本文中的com.sun.media.sound.ModelStandardTransform.setDirection方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。