/** @param theValue boolean */ public void add(final boolean theValue) { if (theValue) { _myTypetag = OSCBytes.append(_myTypetag, new byte[] {0x54}); } else { _myTypetag = OSCBytes.append(_myTypetag, new byte[] {0x46}); } }
/** * @param channel int * @param status int * @param value1 int * @param value2 int */ public void add(final int channel, final int status, final int value1, final int value2) { _myTypetag = OSCBytes.append(_myTypetag, new byte[] {0x6d}); // m byte[] theBytes = new byte[4]; theBytes[0] = (byte) channel; theBytes[1] = (byte) status; theBytes[2] = (byte) value1; theBytes[3] = (byte) value2; _myData = OSCBytes.append(_myData, theBytes); }
/** * @param b byte[] * @return byte[] * @invisible */ public static byte[] makeBlob(final byte[] b) { int tLength = b.length; byte[] b1 = OSCBytes.toBytes(tLength); b1 = OSCBytes.append(b1, b); int t = tLength % 4; if (t != 0) { b1 = OSCBytes.append(b1, new byte[4 - t]); } return b1; }
/** * @return byte[] * @invisible */ public byte[] getBytes() { byte[] myBytes = new byte[0]; byte[] myTypeTag = OSCBytes.copy(_myTypetag, 0); myBytes = OSCBytes.append(myBytes, _myAddrPattern, new byte[align(_myAddrPattern.length)]); if (myTypeTag.length == 0) { myTypeTag = new byte[] {KOMMA}; } else if (myTypeTag[0] != KOMMA) { myTypeTag = OSCBytes.append(new byte[] {KOMMA}, myTypeTag); } myBytes = OSCBytes.append(myBytes, myTypeTag, new byte[align(myTypeTag.length)]); myBytes = OSCBytes.append(myBytes, _myData, new byte[align(_myData.length) % 4]); return myBytes; }
/** @param theArray byte[] */ public void add(final byte[] theArray) { _myTypetag = OSCBytes.append(_myTypetag, new byte[] {0x62}); _myData = OSCBytes.append(_myData, makeBlob(theArray)); }
/** @param theValue char */ public void add(final char theValue) { _myTypetag = OSCBytes.append(_myTypetag, new byte[] {0x63}); _myData = OSCBytes.append(_myData, OSCBytes.toBytes(theValue)); }
/** @param theValue double */ public void add(final double theValue) { _myTypetag = OSCBytes.append(_myTypetag, new byte[] {0x64}); _myData = OSCBytes.append(_myData, OSCBytes.toBytes(Double.doubleToLongBits(theValue))); }
/** @param theValue float */ public void add(final float theValue) { _myTypetag = OSCBytes.append(_myTypetag, new byte[] {0x66}); _myData = OSCBytes.append(_myData, OSCBytes.toBytes(Float.floatToIntBits(theValue))); }
/** @param theValue String */ public void add(final String theValue) { _myTypetag = OSCBytes.append(_myTypetag, new byte[] {0x73}); byte[] myString = theValue.getBytes(); _myData = OSCBytes.append(_myData, myString, new byte[align(myString.length)]); }
/** * add values to an osc message. please check the add documentation for specific information. * * @example oscMessage */ public void add() { _myTypetag = OSCBytes.append(_myTypetag, new byte[] {0x4e}); }
/** * @return byte[] * @invisible */ public byte[] getAddrPatternAsBytes() { return OSCBytes.append(_myAddrPattern, new byte[align(_myAddrPattern.length)]); }