OpenStream.java revision 829:b06c29386f63
151973Smsmith/* 251973Smsmith * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. 351973Smsmith * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 451973Smsmith * 551973Smsmith * This code is free software; you can redistribute it and/or modify it 651973Smsmith * under the terms of the GNU General Public License version 2 only, as 751973Smsmith * published by the Free Software Foundation. Sun designates this 851973Smsmith * particular file as subject to the "Classpath" exception as provided 951973Smsmith * by Sun in the LICENSE file that accompanied this code. 1051973Smsmith * 1151973Smsmith * This code is distributed in the hope that it will be useful, but WITHOUT 1251973Smsmith * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1351973Smsmith * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1451973Smsmith * version 2 for more details (a copy is included in the LICENSE file that 1551973Smsmith * accompanied this code). 1651973Smsmith * 1751973Smsmith * You should have received a copy of the GNU General Public License version 1851973Smsmith * 2 along with this work; if not, write to the Free Software Foundation, 1951973Smsmith * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2051973Smsmith * 2151973Smsmith * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 2251973Smsmith * CA 95054 USA or visit www.sun.com if you need additional information or 2351973Smsmith * have any questions. 2451973Smsmith */ 2551973Smsmith 2651973Smsmith/* @test 2751973Smsmith @summary Test SoftAudioSynthesizer openStream method */ 2851973Smsmith 2951973Smsmithimport javax.sound.midi.Patch; 3051973Smsmithimport javax.sound.sampled.*; 3151973Smsmith 3251973Smsmithimport com.sun.media.sound.*; 3351973Smsmith 3451973Smsmithpublic class OpenStream { 35240963Sjhb 36240608Sjhb private static void assertEquals(Object a, Object b) throws Exception 3751973Smsmith { 38240608Sjhb if(!a.equals(b)) 3951973Smsmith throw new RuntimeException("assertEquals fails!"); 40240608Sjhb } 4151973Smsmith 4251973Smsmith private static void assertTrue(boolean value) throws Exception 4351973Smsmith { 4458188Smsmith if(!value) 4551973Smsmith throw new RuntimeException("assertTrue fails!"); 4651973Smsmith } 4751973Smsmith 4851973Smsmith public static void main(String[] args) throws Exception { 4951973Smsmith AudioSynthesizer synth = new SoftSynthesizer(); 5051973Smsmith synth.openStream(null, null); 51112946Sphk assertTrue(synth.isOpen()); 52112946Sphk synth.close(); 5351973Smsmith } 5451973Smsmith} 5551973Smsmith