Package javax.sound.midi

Examples of javax.sound.midi.MidiEvent


        assertEquals(11, seq.getTracks().length);
       
        /*
         * new Tracks accrue to the end of vector
         */
        MidiEvent event2 = new MidiEvent(new MidiMessage1(new byte[] {23, -16, 4}), 3L);
        tr1.add(event2);
        assertEquals(23, seq.getTracks()[10].get(0).getMessage().getMessage()[0]);
    }
View Full Code Here


        Sequence seq = new Sequence(Sequence.SMPTE_24, 67, 9);
        Track tr = seq.createTrack();
        Track tr1 = seq.createTrack();
        assertEquals(11, seq.getTracks().length);
       
        tr.add(new MidiEvent(new MidiMessage1(new byte[] {1, 2, 3}), 10));
        assertTrue(seq.deleteTrack(tr));
        assertFalse(seq.deleteTrack(tr));
        assertEquals(10, seq.getTracks().length);
       
        tr1 = null;
View Full Code Here

     *
     */
    public void test_getMicrosecondLength() throws Exception {
        Sequence seq = new Sequence(Sequence.PPQ, 15, 2);
        Track tr = seq.createTrack();
        MidiEvent event1 = new MidiEvent(new MidiMessage1(new byte[] {1, 2, 3}), -10L);
        MidiEvent event2 = new MidiEvent(new MidiMessage1(new byte[] {23, -16, 4}), 3L);
        MidiEvent event3 = new MidiEvent(new MidiMessage1(new byte[] {3, -67, -1}), 6L);
       
        /*------- Sequence.PPQ -------*/
        tr.add(event2);    
        assertEquals(100000, seq.getMicrosecondLength());
        Track tr1 = seq.createTrack();
        tr1.add(event1);
        tr1.add(event2);
        tr1.add(event3);
        assertEquals(200000, seq.getMicrosecondLength());
        seq.deleteTrack(tr1);
        assertEquals(100000, seq.getMicrosecondLength());
        seq.deleteTrack(tr);
        assertEquals(0, seq.getMicrosecondLength());
       
        /*------- Sequence.SMPTE_24 -------*/
        event2 = new MidiEvent(new MidiMessage1(new byte[] {23, -16, 4}), 0L);
        seq = new Sequence(Sequence.SMPTE_24, 17, 2);
        tr = seq.createTrack();
        tr.add(event2);    
        assertEquals(0, seq.getMicrosecondLength());
        tr1 = seq.createTrack();
        tr1.add(event1);
        tr1.add(event2);
        tr1.add(event3);
        assertEquals(14705, seq.getMicrosecondLength());
        seq.deleteTrack(tr1);
        assertEquals(0, seq.getMicrosecondLength());
       
        /*------- Sequence.SMPTE_25 -------*/
        event2 = new MidiEvent(new MidiMessage1(new byte[] {23, -16, 4}), 3L);
        event3 = new MidiEvent(new MidiMessage1(new byte[] {3, -67, -1}), 97913L);
        seq = new Sequence(Sequence.SMPTE_25, -5, 2);
        tr = seq.createTrack();
        tr.add(event2);    
        assertEquals(-24000, seq.getMicrosecondLength());
        tr1 = seq.createTrack();
View Full Code Here

        /*
         * I don't understand how this method works
         */
        Sequence seq = new Sequence(Sequence.PPQ, 987, 2);
        Track tr = seq.createTrack();
        MidiEvent event1 = new MidiEvent(new MidiMessage1(new byte[] {1, 2, 3, 34, -98, -27}), -10L);
        MidiEvent event2 = new MidiEvent(new MidiMessage1(new byte[] {23, -16, 4, 78, -12, 5}), 3L);
        MidiEvent event3 = new MidiEvent(new MidiMessage1(new byte[] {3, -67, -1, 87, 9, 8, -2}), 6L);
        tr.add(event1);
        tr.add(event3);
        Track tr1 = seq.createTrack();
        tr1.add(event2);
        assertEquals(0, seq.getPatchList().length);
View Full Code Here

     *
     */
    public void test_getTickLength() throws Exception {
        Sequence seq = new Sequence(Sequence.SMPTE_24, 67, 9);
        Track tr = seq.createTrack();
        MidiEvent event1 = new MidiEvent(new MidiMessage1(new byte[] {1, 2, 3}), -10L);
        MidiEvent event2 = new MidiEvent(new MidiMessage1(new byte[] {23, -16, 4}), 2L);
        MidiEvent event3 = new MidiEvent(new MidiMessage1(new byte[] {3, -67, -1}), 6L);
        tr.add(event1);
        tr.add(event2);
       
        assertEquals(2, seq.getTickLength());
        Track tr1 = seq.createTrack();
View Full Code Here

        ShortMessage message = new ShortMessage();
        try {
            long millis = System.currentTimeMillis() - startTime;
            long tick = millis * model.getResolution() / 500;
            message.setMessage(type+cc.num, num, cc.velocity);
            MidiEvent event = new MidiEvent(message, tick);
            track.add(event);
        } catch (Exception ex) { ex.printStackTrace(); }
    }
View Full Code Here

        shortMessage.setMessage(ShortMessage.PITCH_BEND,
                                channel,
                                0,                      // LSB
                                getPitchBend() * 2);    // MSB
        return new MidiEvent[] {
            new MidiEvent(shortMessage, context.getCurrent())
        };
    }
View Full Code Here

        ShortMessage shortMessage = new ShortMessage();
        shortMessage.setMessage(ShortMessage.CONTROL_CHANGE,
                                channel,
                                1,    // ���W�����[�V�����E�f�v�X MSB
                                getModulationDepth() * 2);
        events[0] = new MidiEvent(shortMessage, context.getCurrent());
//      shortMessage = new ShortMessage();
//      shortMessage.setMessage(ShortMessage.CONTROL_CHANGE,
//                  channel,
//                  33,    // ���W�����[�V�����E�f�v�X LSB
//                  0);
View Full Code Here

        metaMessage.setMessage(0x7f,    // �V�[�P���T�[�ŗL���^�C�x���g
                               data,
                               data.length);

        return new MidiEvent[] {
            new MidiEvent(metaMessage, context.getCurrent())
        };
    }
View Full Code Here

        data[7] = (byte) 0xf7;

        SysexMessage sysexMessage = new SysexMessage();
        sysexMessage.setMessage(data, data.length);
        return new MidiEvent[] {
            new MidiEvent(sysexMessage, context.getCurrent())
        };
    }
View Full Code Here

TOP

Related Classes of javax.sound.midi.MidiEvent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.