🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.api
Article #2671

Re: Play sound in application???

#2671
From: Olivier PISANO
Date: Wed, 02 Aug 2000 00:00
28 lines
1528 bytes
Well, I am french, so sorry if I have difficulties to explain what I
mean...

It only works with JDK 1.2 or superior
In an application, you must import the java.applet.Applet class (oh,
yeah, even if it's not an applet you intend to create)and use the
AudioClip class.
Then, you have to use the newAudioClip method form this class, which
return an Audioclip. But I think you'd prefer to have an example :

This example plays a sound file.

import java.applet.* ;
import java.net.* ;

public class Sound {
    public static void main(String[] args) {
        try {
            URL url = new URL("mySound.wav");
            AudioClip sound = Applet.newAudioClip(url);
            sound.play
        }
        cacth(MalformedURLException e) { System.out.println("bad URL");
}
    }
}

Good luck !
Technical Details
Message-ID: <39889998.EE89AE8C@wanadoo.fr>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <3980d5e1_2@dnews>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 1089d0,ce2bb6ac2ab4d5be
X-Google-Attributes: gid1089d0,public
From: Olivier PISANO <gerard.pisano@wanadoo.fr>
Subject: Re: Play sound in application???
Date: 2000/08/02
Message-ID: <39889998.EE89AE8C@wanadoo.fr>
X-Deja-AN: 653776951
Content-Transfer-Encoding: 7bit
References: <3980d5e1_2@dnews>
X-Accept-Language: fr
Content-Type: text/plain; charset=us-ascii
X-Complaints-To: abuse@wanadoo.fr
X-Trace: wanadoo.fr 965253433 3994 62.161.97.137 (2 Aug 2000 21:57:13 GMT)
Organization: Wanadoo, l'internet avec France Telecom
Mime-Version: 1.0
NNTP-Posting-Date: 2 Aug 2000 21:57:13 GMT
Newsgroups: borland.public.jbuilder.java.api