Package javax.sound.midi

Examples of javax.sound.midi.Receiver.send()


        final int length = jsonData.length();
        final byte[] data = new byte[length];
        for (int i = 0; i < length; i++)
            data[i] = (byte) (jsonData.getInt(i) & 0xff);
        final RawMidiMessage message = new RawMidiMessage(data);
        receiver.send(message, timeStamp);
    }

    /**
     * Sets the receiver of a transmitter.
     *
 
View Full Code Here


                        mpq = ((data[0] & 0xff) << 16)
                                | ((data[1] & 0xff) << 8) | (data[2] & 0xff);
                    }
                }
            } else {
                recv.send(msg, curtime);
            }
        }

        long totallen = curtime / 1000000;
        long len = (long) (stream.getFormat().getFrameRate() * (totallen + 4));
View Full Code Here

        Receiver recv = synth.getReceiver();

        // Set volume to max and turn reverb off
        ShortMessage reverb_off = new ShortMessage();
        reverb_off.setMessage(ShortMessage.CONTROL_CHANGE, 91, 0);
        recv.send(reverb_off, -1);
        ShortMessage full_volume = new ShortMessage();
        full_volume.setMessage(ShortMessage.CONTROL_CHANGE, 7, 127);
        recv.send(full_volume, -1);

        Random random = new Random(3485934583945l);
View Full Code Here

        ShortMessage reverb_off = new ShortMessage();
        reverb_off.setMessage(ShortMessage.CONTROL_CHANGE, 91, 0);
        recv.send(reverb_off, -1);
        ShortMessage full_volume = new ShortMessage();
        full_volume.setMessage(ShortMessage.CONTROL_CHANGE, 7, 127);
        recv.send(full_volume, -1);

        Random random = new Random(3485934583945l);

        // Create random timestamps
        long[] test_timestamps = new long[30];
View Full Code Here

        // Send midi note on message to synthesizer
        for (int i = 0; i < test_timestamps.length; i++) {
            ShortMessage midi_on = new ShortMessage();
            midi_on.setMessage(ShortMessage.NOTE_ON, 69, 127);
            recv.send(midi_on,
                    (long) ((test_timestamps[i] / 44100.0) * 1000000.0));
        }

        // Measure timing from rendered audio
        float[] fbuffer = new float[100];
View Full Code Here

    Receiver recv = synth.getReceiver();
    assertTrue(recv != null);
    ShortMessage sm = new ShortMessage();
    sm.setMessage(ShortMessage.NOTE_OFF, 0, 64, 64);
        synth.open(new DummySourceDataLine(), null);
    recv.send(sm, -1);   
    synth.close();     
    try
    {
      recv.send(sm, -1);
      throw new RuntimeException("Exception not thrown!");
View Full Code Here

        synth.open(new DummySourceDataLine(), null);
    recv.send(sm, -1);   
    synth.close();     
    try
    {
      recv.send(sm, -1);
      throw new RuntimeException("Exception not thrown!");
    }
    catch(Exception e)
    {
      // Just checking if exception is thrown
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.