import javax.microedition.midlet.*; import javax.microedition.lcdui.*; import javax.microedition.media.*; import javax.microedition.media.control.*; public class main extends MIDlet implements commandListener{ public Form form; public Command exit,start,stop,play; public void startApp() { Player p=Manager.createPlayer("capture://audio?encoding=pcm"); exit=new Command("выход",Command.BACK,2); start=new Command("start",Command.OK,1); stop=new Command("stop",Command.OK,2); play=new Command("Play",Command.BACK,1); form.addCommand(exit,play,stop,start); form.setCommandListener(this); Display.getDisplay(this).setCurrent(form); } public void pauseApp() { } public void destroyApp(boolean unconditional) { notifyDestroyed(); } public void commandAction(Command c,Displayable d){ if (c==exit){ destroyApp(true); notifyDestroyed(); } if(c==start){ p.realize(); RecordControl rc=(RecordControl)p.getControl("RecordControl"); ByteArrayOutputStream output=new ByteArrayOutputStream(); rc.setRecordStream(output); rc.startRecord(); form.append("запись"); } if(c==stop){ rc.commit(); private byte[] recordedSoundArray[]=ouptut.toByteArray(); p.close; form.append("запись остановлена"); } if (c==play){ ByteArrayInputStream(recordedSoundArray); Player p2=Manager.createPlayer(recordedInputStream,"audio/basic"); p2.prefetch(); p2.start(); } } }