JMenuItem ookMenuItem = new JMenuItem(SpecAnConstants.MENU_OOK);
ookMenuItem.setMnemonic(KeyEvent.VK_C);
ookMenuItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
WaveFile waveFile = SpectrumAnalyzer.readWaveFile(inputFile);
short data[] = SharedDSPFunctions.extractWaveFileData(waveFile);
CwDemod demod = new CwDemod(data);
String morse = demod.demodulate();
int speed = demod.getWpm();
JOptionPane.showMessageDialog(frame, "Speed: " + speed + " WPM\n" + morse);
}
});
demodMenu.add(ookMenuItem);
JMenuItem dtmfMenuItem = new JMenuItem(SpecAnConstants.MENU_DTMF);
dtmfMenuItem.setMnemonic(KeyEvent.VK_D);
dtmfMenuItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
WaveFile waveFile = SpectrumAnalyzer.readWaveFile(inputFile);
short data[] = SharedDSPFunctions.extractWaveFileData(waveFile);
String codes = DTMFDecoder.detect(data);
JOptionPane.showMessageDialog(frame, codes);
}
});