Examples of ShortMessage


Examples of javax.sound.midi.ShortMessage

    /** */
    public MfiEvent[] getMfiEvents(MidiEvent midiEvent, MfiContext context)
        throws InvalidMfiDataException {

        ShortMessage shortMessage = (ShortMessage) midiEvent.getMessage();
        int channel = shortMessage.getChannel();
        int data2 = shortMessage.getData2();

        int track = context.retrieveMfiTrack(channel);
        int voice = context.retrieveVoice(channel);

        ModulationDepthMessage mfiMessage = new ModulationDepthMessage();
View Full Code Here

Examples of javax.sound.midi.ShortMessage

        throws InvalidMidiDataException {

        int channel = getVoice() + 4 * context.getMfiTrackNumber();

        MidiEvent[] events = new MidiEvent[1];
        ShortMessage shortMessage = new ShortMessage();
        shortMessage.setMessage(ShortMessage.CONTROL_CHANGE,
                                channel,
                                10,    // �p���|�b�g MSB
                                getPanpot() * 2);
        events[0] = new MidiEvent(shortMessage, context.getCurrent());
//      shortMessage = new ShortMessage();
View Full Code Here

Examples of javax.sound.midi.ShortMessage

    /** */
    public MfiEvent[] getMfiEvents(MidiEvent midiEvent, MfiContext context)
        throws InvalidMfiDataException {

        ShortMessage shortMessage = (ShortMessage) midiEvent.getMessage();
        int channel = shortMessage.getChannel();
        int data2 = shortMessage.getData2();

        int track = context.retrieveMfiTrack(channel);
        int voice = context.retrieveVoice(channel);

        PanpotMessage mfiMessage = new PanpotMessage();
View Full Code Here

Examples of javax.sound.midi.ShortMessage

        int channel = getVoice() + 4 * context.getMfiTrackNumber();
//Debug.println(this);
//      context.setPitchBendRange(channel, getPitchBendRange());

        MidiEvent[] events = new MidiEvent[3];
        ShortMessage shortMessage = new ShortMessage();
        shortMessage.setMessage(ShortMessage.CONTROL_CHANGE,
                                channel,
                                100,        // RPN MSB
                                0);         // 0: pitch bend range
        events[0] = new MidiEvent(shortMessage, context.getCurrent());
        shortMessage = new ShortMessage();
        shortMessage.setMessage(ShortMessage.CONTROL_CHANGE,
                                channel,
                                101,        // RPN LSB
                                0);         // 0: pitch bend range
        events[1] = new MidiEvent(shortMessage, context.getCurrent());
        shortMessage = new ShortMessage();
        shortMessage.setMessage(ShortMessage.CONTROL_CHANGE,
                                channel,
                                6,          // Data Entry MSB
                                getPitchBendRange());
        events[2] = new MidiEvent(shortMessage, context.getCurrent());
        return events;
View Full Code Here

Examples of javax.sound.midi.ShortMessage

    /** */
    public MfiEvent[] getMfiEvents(MidiEvent midiEvent, MfiContext context)
        throws InvalidMfiDataException {

        ShortMessage shortMessage = (ShortMessage) midiEvent.getMessage();
        int channel = shortMessage.getChannel();
        int data2 = shortMessage.getData2();

        int track = context.retrieveMfiTrack(channel);
        int voice = context.retrieveVoice(channel);

        PitchBendRangeMessage mfiMessage = new PitchBendRangeMessage();
View Full Code Here

Examples of javax.sound.midi.ShortMessage

    /** */
    public static String paramString(MidiMessage midiMessage) {
        String result = null;
        if (midiMessage instanceof ShortMessage) {
            ShortMessage msg = (ShortMessage) midiMessage;
            int channel = msg.getChannel();
            int command = msg.getCommand();
            int data1 = msg.getData1();
            int data2 = msg.getData2();
            result = "channel=" + (channel + 1) +
                ",event=" + getChannelMessage(command, data1) +
                ",data1=" + (command == ShortMessage.PROGRAM_CHANGE ? data1 + " " + MidiConstants.getInstrumentName(data1) : String.valueOf(data1)) +
                ",data2=" + data2;
        } else if (midiMessage instanceof SysexMessage) {
            SysexMessage msg = (SysexMessage) midiMessage;
            byte[] data = msg.getData();
            StringBuilder sb = new StringBuilder();
            for (int i = 0; i < data.length; i++) {
                sb.append(StringUtil.toHex2(data[i]));
                sb.append(" ");
            }
            result = "channel=n/a" +
                ",event=SYSX" +
                ",data1=" + sb +
                ",data2=";
        } else if (midiMessage instanceof MetaMessage) {
            MetaMessage msg = (MetaMessage) midiMessage;
            int type = msg.getType();
            byte[] data = msg.getData();
            StringBuilder sb = new StringBuilder();
            for (int i = 0; i < data.length; i++) {
                sb.append(StringUtil.toHex2(data[i]));
                sb.append(" ");
            }
View Full Code Here

Examples of javax.sound.midi.ShortMessage

//Debug.println("volume: " + channel + ": " + getVolume());
        context.setVolume(channel, volume);

        MidiEvent[] events = new MidiEvent[1];
        ShortMessage shortMessage = new ShortMessage();
        shortMessage.setMessage(ShortMessage.CONTROL_CHANGE,
                                channel,
                                7,          // ���C���{�����[�� MSB
                                context.getVolume(channel) * 2);
        events[0] = new MidiEvent(shortMessage, context.getCurrent());
//      shortMessage = new ShortMessage();
View Full Code Here

Examples of javax.sound.midi.ShortMessage

    /** */
    public MfiEvent[] getMfiEvents(MidiEvent midiEvent, MfiContext context)
        throws InvalidMfiDataException {

        ShortMessage shortMessage = (ShortMessage) midiEvent.getMessage();
        int channel = shortMessage.getChannel();
        int data2 = shortMessage.getData2();

        int track = context.retrieveMfiTrack(channel);
        int voice = context.retrieveVoice(channel);

        VolumeMessage mfiMessage = new VolumeMessage();
View Full Code Here

Examples of javax.sound.midi.ShortMessage

     * @throws NoSuchElementException ���� MIDI �C�x���g���Ȃ�
     * @throws IllegalStateException ���݂̃C�x���g�� {@link ShortMessage} �ł͂Ȃ�
     */
    public MidiEvent getNoteOffMidiEvent() throws NoSuchElementException {

        ShortMessage shortMessage = null;

        MidiEvent midiEvent = midiEvents.get(midiEventIndex);
        MidiMessage midiMessage = midiEvent.getMessage();
        if (midiMessage instanceof ShortMessage) {
            shortMessage = (ShortMessage) midiMessage;
        } else {
            throw new IllegalStateException("current is not ShortMessage");
        }

        int channel = shortMessage.getChannel();
        int data1 = shortMessage.getData1();

        for (int i = midiEventIndex + 1; i < midiEvents.size(); i++) {
            midiEvent = midiEvents.get(i);
            midiMessage = midiEvent.getMessage();
            if (midiMessage instanceof ShortMessage) {
                shortMessage = (ShortMessage) midiMessage;
                if (shortMessage.getChannel() == channel &&
                    shortMessage.getData1() != data1 &&
                    shortMessage.getData2() == 0 &&
                    !noteOffEventUsed.get(i)) {
//Debug.println("next: " + shortMessage.getChannel() + "ch, " + shortMessage.getData1());
                    noteOffEventUsed.set(i);
                    return midiEvent;
                }
View Full Code Here

Examples of javax.sound.midi.ShortMessage

        channel = context.retrieveChannel(channel);
        pitch = context.retrievePitch(channel, pitch);

        MidiEvent[] events = new MidiEvent[2];
        ShortMessage shortMessage = new ShortMessage();
        shortMessage.setMessage(ShortMessage.NOTE_ON,
                                channel,
                                pitch,
                                velocity);
//Debug.println("note: " + channel + ": " + pitch);
        events[0] = new MidiEvent(shortMessage, context.getCurrent());

        shortMessage = new ShortMessage();
        shortMessage.setMessage(ShortMessage.NOTE_OFF,
                                channel,
                                pitch,
                                0);
        events[1] = new MidiEvent(shortMessage, context.getCurrent() + length);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.