GetMidiDevice.java revision 9330:8b1f1c2a400f
191094Sdes/*
292289Sdes * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
391094Sdes * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
491094Sdes *
591094Sdes * This code is free software; you can redistribute it and/or modify it
699158Sdes * under the terms of the GNU General Public License version 2 only, as
799158Sdes * published by the Free Software Foundation.
899158Sdes *
991094Sdes * This code is distributed in the hope that it will be useful, but WITHOUT
1091094Sdes * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1191094Sdes * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
1291094Sdes * version 2 for more details (a copy is included in the LICENSE file that
1391094Sdes * accompanied this code).
1491094Sdes *
1591094Sdes * You should have received a copy of the GNU General Public License version
1691094Sdes * 2 along with this work; if not, write to the Free Software Foundation,
1791094Sdes * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1891094Sdes *
1991094Sdes * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2091094Sdes * or visit www.oracle.com if you need additional information or have any
2191094Sdes * questions.
2291094Sdes */
2391094Sdes
2491094Sdes/* @test
2591094Sdes @summary Test SoftReceiver getMidiDevice method */
2691094Sdes
2791094Sdesimport javax.sound.midi.Receiver;
2891094Sdes
2991094Sdesimport com.sun.media.sound.AudioSynthesizer;
3091094Sdesimport com.sun.media.sound.SoftReceiver;
3191094Sdesimport com.sun.media.sound.SoftSynthesizer;
3291094Sdes
3391094Sdespublic class GetMidiDevice {
34107937Sdes
3591094Sdes    public static void main(String[] args) throws Exception {
3691094Sdes
3791094Sdes        AudioSynthesizer synth = new SoftSynthesizer();
3891094Sdes        synth.openStream(null, null);
3991094Sdes        Receiver recv = synth.getReceiver();
4091094Sdes        if (((SoftReceiver) recv).getMidiDevice() != synth) {
4191094Sdes            throw new Exception("SoftReceiver.getMidiDevice() doesn't return "
4291094Sdes                    + "instance of the synthesizer");
4391094Sdes        }
4491094Sdes        synth.close();
4591094Sdes    }
4691094Sdes}
4791094Sdes
4891094Sdes