The music needs to be stopped to play other sounds like right or wrong - Java javax.sound.sampled

Java examples for javax.sound.sampled:Sound

Description

The music needs to be stopped to play other sounds like right or wrong

Demo Code


//package com.java2s;

import java.applet.AudioClip;

public class Main {
    static AudioClip gameClip, rightClip, wrongClip;

    /**/*  www.j  av a2 s  .  c o  m*/
     * The music needs to be stopped to play other sounds like right or wrong
     */
    static void stopGameMusic() {
        try {
            gameClip.stop();
        } catch (Exception e) {
            System.out.println("stopGameMusic caught exception"
                    + e.getMessage());
        }
    }
}

Related Tutorials