
| private void toneSequence() { byte tempo = 30; byte d = 8; byte C4 = ToneControl.C4;; byte D4 = (byte)(C4 + 2); byte E4 = (byte)(C4 + 4); byte F4 = (byte)(C4 + 5); byte G4 = (byte)(C4 + 7); byte rest = ToneControl.SILENCE; byte[] mySequence = { ToneControl.VERSION, 1, ToneControl.TEMPO, tempo, ToneControl.BLOCK_START, 0, // starting A part C4,d, F4,d, F4,d, C4,d, F4,d, F4,d, C4,d, F4,d, ToneControl.BLOCK_END, 0, // ending A part ToneControl.BLOCK_START, 1, // starting B part C4,d, E4,d, E4,d, C4,d, E4,d, E4,d, C4,d, E4,d, ToneControl.BLOCK_END, 1, // ending B part ToneControl.PLAY_BLOCK, 0, // playing A part ToneControl.PLAY_BLOCK, 1, // playing A part ToneControl.PLAY_BLOCK, 0, // playing A part }; try{ Player p = Manager.createPlayer(Manager.TONE_DEVICE_LOCATOR); p.realize(); ToneControl c = (ToneControl)p.getControl("ToneControl"); c.setSequence(mySequence); p.start(); } catch (IOException ioe) { } catch (MediaException me) {} } |