public void run() { if (currentFeedbackSettings != null) { currentFeedbackSettings.updateFeedback(); if (oscForwarder != null) { OSCBundle bundle = new OSCBundle(); for (int c = 0; c < numChannels; c++) { for (int b = 0; b < bins; b++) { OSCMessage msg = new OSCMessage(textSerialPort.getText() + "/" + binLabels[b] + "/" + c); Object argument = new Object(); argument = new Double(currentFeedbackSettings.getRewardFFTBins()[b][c]); // argument=new Float(meanFFTBins[b][c]); msg.addArgument(argument); bundle.addPacket(msg); oscForwarder.forwardMessage(msg); } } } } this.frame.repaint(); // oscForwarder.forwardBundle(bundle); // focusOMeter.setCurrentFeedback(currentFeedback); } }
bundle.addPacket(msg);
private void sendInternal(final OSCMessage message) { //System.out.println("" + System.currentTimeMillis() + " sending OSC message to " + message.getAddress() + " with " + message.getArguments().size() + " args"); OSCBundle bundle = new OSCBundle(); bundle.addPacket(message); sender.send(bundle); }
private void sendInternal(final OSCMessage message) { //System.out.println("" + System.currentTimeMillis() + " sending OSC message to " + message.getAddress() + " with " + message.getArguments().size() + " args"); OSCBundle bundle = new OSCBundle(); bundle.addPacket(message); sender.send(bundle); }
private void notifyOfInteraction(final String activityAddress) { OSCMessage m = new OSCMessage(activityAddress); OSCBundle bundle = new OSCBundle(); bundle.addPacket(m); notificationSender.send(bundle); }
/** * Converts the byte array to a bundle. * Assumes that the byte array is a bundle. * @return a bundle containing the data specified in the byte stream */ private OSCBundle convertBundle(final Input rawInput) { // skip the "#bundle " stuff rawInput.addToStreamPosition(BUNDLE_START.length() + 1); final Date timestamp = readTimeTag(rawInput); final OSCBundle bundle = new OSCBundle(timestamp); final OSCByteArrayToJavaConverter myConverter = new OSCByteArrayToJavaConverter(); myConverter.setCharset(charset); while (rawInput.getStreamPosition() < rawInput.getBytesLength()) { // recursively read through the stream and convert packets you find final int packetLength = readInteger(rawInput); if (packetLength == 0) { throw new IllegalArgumentException("Packet length may not be 0"); } else if ((packetLength % 4) != 0) { throw new IllegalArgumentException("Packet length has to be a multiple of 4, is:" + packetLength); } final byte[] packetBytes = new byte[packetLength]; System.arraycopy(rawInput.getBytes(), rawInput.getStreamPosition(), packetBytes, 0, packetLength); rawInput.addToStreamPosition(packetLength); final OSCPacket packet = myConverter.convert(packetBytes, packetLength); bundle.addPacket(packet); } return bundle; }