ProgramChange.java revision 8729:0242fce0f717
155714Skris/* 2160814Ssimon * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. 3238405Sjkim * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4160814Ssimon * 5160814Ssimon * This code is free software; you can redistribute it and/or modify it 6160814Ssimon * under the terms of the GNU General Public License version 2 only, as 7160814Ssimon * published by the Free Software Foundation. 8160814Ssimon * 9160814Ssimon * This code is distributed in the hope that it will be useful, but WITHOUT 10280304Sjkim * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11160814Ssimon * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12160814Ssimon * version 2 for more details (a copy is included in the LICENSE file that 13160814Ssimon * accompanied this code). 14160814Ssimon * 15160814Ssimon * You should have received a copy of the GNU General Public License version 16160814Ssimon * 2 along with this work; if not, write to the Free Software Foundation, 17160814Ssimon * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18160814Ssimon * 19160814Ssimon * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20160814Ssimon * or visit www.oracle.com if you need additional information or have any 21160814Ssimon * questions. 22160814Ssimon */ 23160814Ssimon 24160814Ssimon/* @test 25160814Ssimon @summary Test SoftChannel programChange method */ 26160814Ssimon 27160814Ssimonimport javax.sound.midi.*; 28160814Ssimonimport javax.sound.sampled.*; 29160814Ssimon 30160814Ssimonimport com.sun.media.sound.*; 31160814Ssimon 32160814Ssimonpublic class ProgramChange { 33160814Ssimon 34160814Ssimon private static void assertEquals(Object a, Object b) throws Exception 35160814Ssimon { 36160814Ssimon if(!a.equals(b)) 37160814Ssimon throw new RuntimeException("assertEquals fails!"); 38160814Ssimon } 39160814Ssimon 40160814Ssimon private static void assertTrue(boolean value) throws Exception 41160814Ssimon { 42160814Ssimon if(!value) 43160814Ssimon throw new RuntimeException("assertTrue fails!"); 44160814Ssimon } 45160814Ssimon 46160814Ssimon public static void main(String[] args) throws Exception { 47160814Ssimon SoftTestUtils soft = new SoftTestUtils(); 48160814Ssimon MidiChannel channel = soft.synth.getChannels()[0]; 49160814Ssimon 50160814Ssimon channel.programChange(36); 51160814Ssimon assertEquals(channel.getProgram(), 36); 52160814Ssimon channel.programChange(48); 53160814Ssimon assertEquals(channel.getProgram(), 48); 54160814Ssimon 5555714Skris soft.close(); 5655714Skris } 5755714Skris} 5855714Skris