// // ClipによるPCMデータ再生 // // 2001/10/26 宍戸 輝光 // import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.sound.sampled.*; public class jclip extends JFrame implements ActionListener { static jclip app; JComboBox flist; JTextField len; JButton play; JLabel sl; String freqi[]={"8KHz","11KHz","22KHz","44KHz"}; int freqs[]={8000,11025,22050,44100}; byte data[]; jclip() { Container cp=getContentPane(); cp.setLayout(new FlowLayout()); flist=new JComboBox(freqi); len=new JTextField(5); len.setText("64"); play=new JButton("P l a y !"); play.addActionListener(this); cp.add(new JLabel("Frequency")); cp.add(flist); cp.add(new JLabel("Length")); cp.add(len); cp.add(play); pack(); } public static void main(String args[]) { app=new jclip(); app.setVisible(true); app.setDefaultCloseOperation(EXIT_ON_CLOSE); } public void actionPerformed(ActionEvent e) { if (e.getSource()==play) { int l=Integer.parseInt(len.getText()); if (l<1) return; int freq=freqs[flist.getSelectedIndex()]; data=new byte[freq]; for (int i=0;i