/** * Construct with a reference to a channel to represent. * * @param chan The channel whose waveform we are manipulating. */ public OscillatorPane(Channel chan) { this.chan = chan; setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); add(new JLabel("Volume:")); add(vol = new JSpinSlide(0, 127, chan.vol)); add(new JLabel("Frequency:")); add(freq = new JSpinSlide(0, sps / 4, chan.freq)); add(new JLabel("Duration (ms):")); add(dur = new JSpinSlide(0, 60000, chan.dur)); add(new JLabel("Wave Equasion:")); add(eq = new JTextField(chan.eq)); add(play = new JButton("Play")); setMaximumSize(new Dimension(200, Integer.MAX_VALUE)); vol.setMajorTicks(true, 8); vol.addChangeListener(this); freq.setMajorTicks(true, 100); freq.addChangeListener(this); dur.setMajorTicks(true, 2000); dur.addChangeListener(this); play.addActionListener(this); recalculateBytes(); }