PolyPressure.java revision 8729:0242fce0f717
1273507Sdelphij/* 2166255Sdelphij * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. 3166255Sdelphij * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4265420Simp * 5166255Sdelphij * This code is free software; you can redistribute it and/or modify it 6166255Sdelphij * under the terms of the GNU General Public License version 2 only, as 7166621Ssimon * published by the Free Software Foundation. 8166255Sdelphij * 9275042Sbapt * This code is distributed in the hope that it will be useful, but WITHOUT 10166255Sdelphij * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11166255Sdelphij * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12275042Sbapt * version 2 for more details (a copy is included in the LICENSE file that 13166255Sdelphij * accompanied this code). 14166255Sdelphij * 15166255Sdelphij * You should have received a copy of the GNU General Public License version 16166255Sdelphij * 2 along with this work; if not, write to the Free Software Foundation, 17166621Ssimon * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18166255Sdelphij * 19166255Sdelphij * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20166255Sdelphij * or visit www.oracle.com if you need additional information or have any 21166255Sdelphij * questions. 22273507Sdelphij */ 23327020Sdelphij 24273507Sdelphij/* @test 25166255Sdelphij @summary Test SoftChannel polyPressure method */ 26166255Sdelphij 27166255Sdelphijimport javax.sound.midi.*; 28166255Sdelphijimport javax.sound.sampled.*; 29327020Sdelphij 30166621Ssimonimport com.sun.media.sound.*; 31166255Sdelphij 32272788Sngiepublic class PolyPressure { 33272788Sngie 34272788Sngie private static void assertEquals(Object a, Object b) throws Exception 35272788Sngie { 36166255Sdelphij if(!a.equals(b)) 37 throw new RuntimeException("assertEquals fails!"); 38 } 39 40 private static void assertTrue(boolean value) throws Exception 41 { 42 if(!value) 43 throw new RuntimeException("assertTrue fails!"); 44 } 45 46 public static void main(String[] args) throws Exception { 47 SoftTestUtils soft = new SoftTestUtils(); 48 MidiChannel channel = soft.synth.getChannels()[0]; 49 50 for (int i = 0; i < 128; i++) { 51 channel.setPolyPressure(i, 10); 52 assertEquals(channel.getPolyPressure(i),10); 53 channel.setPolyPressure(i, 100); 54 assertEquals(channel.getPolyPressure(i),100); 55 } 56 57 soft.close(); 58 } 59} 60