PitchBend.java revision 8729:0242fce0f717
198675Sdes/*
298675Sdes * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
398675Sdes * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
498675Sdes *
598675Sdes * This code is free software; you can redistribute it and/or modify it
698675Sdes * under the terms of the GNU General Public License version 2 only, as
798675Sdes * published by the Free Software Foundation.
898675Sdes *
998675Sdes * This code is distributed in the hope that it will be useful, but WITHOUT
1098675Sdes * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1198675Sdes * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
1298675Sdes * version 2 for more details (a copy is included in the LICENSE file that
1398675Sdes * accompanied this code).
1498675Sdes *
1598675Sdes * You should have received a copy of the GNU General Public License version
1698675Sdes * 2 along with this work; if not, write to the Free Software Foundation,
1798675Sdes * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1898675Sdes *
1998675Sdes * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2098675Sdes * or visit www.oracle.com if you need additional information or have any
2198675Sdes * questions.
2298675Sdes */
2398675Sdes
2498675Sdes/* @test
2598675Sdes   @summary Test SoftChannel pitchBend method */
2698675Sdes
2798675Sdesimport javax.sound.midi.*;
2898675Sdesimport javax.sound.sampled.*;
2998675Sdes
3098675Sdesimport com.sun.media.sound.*;
3198675Sdes
3298675Sdespublic class PitchBend {
3398675Sdes
3498675Sdes    private static void assertEquals(Object a, Object b) throws Exception
3598675Sdes    {
3698675Sdes        if(!a.equals(b))
3798675Sdes            throw new RuntimeException("assertEquals fails!");
3898675Sdes    }
3998675Sdes
4098675Sdes    private static void assertTrue(boolean value) throws Exception
4198675Sdes    {
4298675Sdes        if(!value)
4398675Sdes            throw new RuntimeException("assertTrue fails!");
4498675Sdes    }
4598675Sdes
4698675Sdes    public static void main(String[] args) throws Exception {
4798675Sdes        SoftTestUtils soft = new SoftTestUtils();
4898675Sdes        MidiChannel channel = soft.synth.getChannels()[0];
4998675Sdes
5098675Sdes        channel.setPitchBend(10);
5198675Sdes        assertEquals(channel.getPitchBend(), 10);
5298675Sdes        channel.setPitchBend(9000);
5398675Sdes        assertEquals(channel.getPitchBend(), 9000);
5498675Sdes
5598675Sdes        soft.close();
5698675Sdes    }
5798675Sdes}
5898675Sdes