本文整理汇总了Java中com.sun.media.sound.ModelStandardTransform类的典型用法代码示例。如果您正苦于以下问题:Java ModelStandardTransform类的具体用法?Java ModelStandardTransform怎么用?Java ModelStandardTransform使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ModelStandardTransform类属于com.sun.media.sound包,在下文中一共展示了ModelStandardTransform类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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);
}
示例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);
}