The javax.sound package doesn't work in 1.1 applets, only 1.4. Applets originally used Applet.getAudioClip() until javax.sound was added to give applications and applets more sound control.
I don't think I've been clear enough. I do not know how to play a sound
without using an
APPLET.
Meaning using a Frame or a JFrame.
Is that possible?
Because I run into this problem:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
| import java.applet.*; import java.awt.*; import javax.swing.*;
public class SoundFrame extends JFrame{ private AudioClip snd; private JButton play = new JButton("Play"); private JButton stop = new JButton("Stop");
public SoundFrame(){ JPanel buttons = new JPanel(); buttons.add(play); buttons.add(stop); }
public boolean action(Event e, Object o){ if (e.target == play) snd.play(); else if (e.target == stop) snd.stop(); return true; } public void loadSound(){ try{ snd = getAudioClip(, "music.au"); } catch(Exception e){ System.err.println("Error loading sound"); } } } |
Did you put sound.jar in your classpath? You may want to try getting the "LatencyTest" example working before you try doing anything else. If you still have problems, post the error message here and I'll take a look at it.
Whoops, that's not what I meant. I meant that I can't get even to your website. Page not found.