NewSoftTuning.java revision 9330:8b1f1c2a400f
165Slagergren/* 265Slagergren * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved. 365Slagergren * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4877Sattila * 565Slagergren * This code is free software; you can redistribute it and/or modify it 665Slagergren * under the terms of the GNU General Public License version 2 only, as 765Slagergren * published by the Free Software Foundation. 8877Sattila * 965Slagergren * This code is distributed in the hope that it will be useful, but WITHOUT 1065Slagergren * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1165Slagergren * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1265Slagergren * version 2 for more details (a copy is included in the LICENSE file that 1365Slagergren * accompanied this code). 14877Sattila * 1565Slagergren * You should have received a copy of the GNU General Public License version 1665Slagergren * 2 along with this work; if not, write to the Free Software Foundation, 1765Slagergren * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18877Sattila * 1965Slagergren * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2065Slagergren * or visit www.oracle.com if you need additional information or have any 2165Slagergren * questions. 2265Slagergren */ 2365Slagergren 2465Slagergren/* @test 2565Slagergren @summary Test SoftTuning constructor */ 26877Sattila 2765Slagergrenimport javax.sound.midi.MidiUnavailableException; 2865Slagergrenimport javax.sound.midi.Patch; 2965Slagergrenimport javax.sound.sampled.*; 3065Slagergren 3165Slagergrenimport com.sun.media.sound.*; 3265Slagergren 3365Slagergrenpublic class NewSoftTuning { 34877Sattila 35877Sattila private static void assertEquals(Object a, Object b) throws Exception 3665Slagergren { 3765Slagergren if(!a.equals(b)) 38877Sattila throw new RuntimeException("assertEquals fails!"); 3965Slagergren } 4065Slagergren 4165Slagergren private static void assertTrue(boolean value) throws Exception 4265Slagergren { 4365Slagergren if(!value) 4465Slagergren throw new RuntimeException("assertTrue fails!"); 4565Slagergren } 4665Slagergren 4765Slagergren public static void main(String[] args) throws Exception { 4865Slagergren SoftTuning tuning = new SoftTuning(); 4965Slagergren double[] tunings = tuning.getTuning(); 5065Slagergren for (int i = 0; i < tunings.length; i++) { 5165Slagergren assertTrue(Math.abs(tunings[i]-i*100) < 0.00001); 5265Slagergren } 53 } 54} 55