user3045496
user3045496

Reputation: 129

Java - Sound Effects Doesn't Play

I have a program which plays audio but when I need to play a different audio file it does play (and there is no mistake in the location/spelling ).

    if ((getCoordinatesOfDuplicates() == null) && (getEmptyCellsCount() == 0)) {

        try {
            java.applet.AudioClip clip =
                    java.applet.Applet.newAudioClip(
                    new java.net.URL("file:src//audio/applause2.wav"));

            clip.play();
        } catch (java.net.MalformedURLException murle) {
            System.out.println(murle);
        }
        System.out.println("Well Done");

    } else  {
        try {
            java.applet.AudioClip clip =
                    java.applet.Applet.newAudioClip(
                    new java.net.URL("file:src//audio/shutoff.wav"));

            clip.play();
        } catch (java.net.MalformedURLException murle) {
            System.out.println(murle);
        }
        System.out.println("You did something wrong in the puzzle");

    }

The Applause plays fine but the shutoff doesn't play even though the code is the exactly the same and the "You did something wrong in the puzzle" shows up.

Any Ideas?

Upvotes: 2

Views: 345

Answers (1)

Edd
Edd

Reputation: 3822

Turns out that the all the audio files were corrupted, with the exception of applause2.wav. Getting the non-corrupted files resolved the issue.

Upvotes: 1

Related Questions