The JUCE cross-platform C++ framework, with DISTRHO/KXStudio specific changes
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

982 lines
28KB

  1. /**
  2. * @defgroup Graphics Graphics functions
  3. * @defgroup Midi Midi functions
  4. * @defgroup Callbacks Callbacks from the OS
  5. * @defgroup Maths Math functions
  6. * @defgroup Memory Memory Access functions
  7. * @defgroup Debug Debugging functions
  8. * @defgroup Configs Configuration functions
  9. * @defgroup Messaging Messaging functions
  10. * @defgroup Clustering Cluster functions
  11. * @defgroup Topology Topology functions
  12. * @defgroup Touch Touch functions
  13. * @defgroup Lightpad Lightpad specific functions
  14. * @defgroup ControlBlock Control Block specific functions
  15. * @defgroup Seaboard Seaboard specific functions
  16. * @defgroup Power Power functions
  17. * @defgroup Utility Utility functions
  18. * @defgroup Internal Internal functions (not for general usage)
  19. */
  20. /** Reads and returns the value of a single byte from the heap.
  21. @param byteIndex the index (in bytes) of the byte to read
  22. @returns the value of the byte
  23. @ingroup Memory
  24. */
  25. int getHeapByte (int byteIndex);
  26. /** Reads 4 bytes from the heap and returns the value as an integer.
  27. @param byteIndex the index (in bytes) of the start of the 4 bytes to read
  28. @returns the value of the 4 bytes as an integer
  29. @ingroup Memory
  30. */
  31. int getHeapInt (int byteIndex);
  32. /** Reads a sequence of bits from the heap and returns the value as an integer.
  33. @param startBitIndex the index (in bits) of the start of the sequence of bits to read
  34. @param numBits how many bits to read
  35. @returns the value of the sequence of bits as an integer
  36. @ingroup Memory
  37. */
  38. int getHeapBits (int startBitIndex, int numBits);
  39. /** Writes a single byte to the heap.
  40. @param byteIndex the index (in bytes) of the byte to set
  41. @param newValue the new value to set this byte to
  42. @ingroup Memory
  43. */
  44. void setHeapByte (int byteIndex, int newValue);
  45. /** Writes 4 bytes to the heap.
  46. @param byteIndex the index (in bytes) of the start of the 4 bytes to set
  47. @param newValue the new value to set the 4 bytes to
  48. @ingroup Memory
  49. */
  50. void setHeapInt (int byteIndex, int newValue);
  51. /** Returns the smaller of two integer values.
  52. @param a The first parameter
  53. @param b The second parameter
  54. @retval The minimum of a and b
  55. @ingroup Maths
  56. */
  57. int min (int a, int b);
  58. /** Returns the smaller of two floating point values.
  59. @param a The first parameter
  60. @param b The second parameter
  61. @retval The minimum of a and b
  62. @ingroup Maths
  63. */
  64. float min (float a, float b);
  65. /** Returns the larger of two integer values.
  66. @param a The first parameter
  67. @param b The second parameter
  68. @retval The maximum of a and b
  69. @ingroup Maths
  70. */
  71. int max (int a, int b);
  72. /** Returns the larger of two floating point values.
  73. @param a The first parameter
  74. @param b The second parameter
  75. @retval The maximum of a and b
  76. @ingroup Maths
  77. */
  78. float max (float a, float b);
  79. /** Constrains an integer value to keep it within a given range.
  80. @param lowerLimit the minimum value to return
  81. @param upperLimit the maximum value to return
  82. @param valueToConstrain the value to try to return
  83. @returns the closest value to valueToConstrain which lies between lowerLimit
  84. and upperLimit (inclusive)
  85. @ingroup Maths
  86. */
  87. int clamp (int lowerLimit, int upperLimit, int valueToConstrain);
  88. /** Constrains a floating point value to keep it within a given range.
  89. @param lowerLimit the minimum value to return
  90. @param upperLimit the maximum value to return
  91. @param valueToConstrain the value to try to return
  92. @returns the closest value to valueToConstrain which lies between lowerLimit
  93. and upperLimit (inclusive)
  94. @ingroup Maths
  95. */
  96. float clamp (float lowerLimit, float upperLimit, float valueToConstrain);
  97. /** Returns the absolute value of an integer value.
  98. @param arg The argument to compute the absolute value of
  99. @retval either -arg if arg is negative or arg if arg is positive
  100. @ingroup Maths
  101. */
  102. int abs (int arg);
  103. /** Returns the absolute value of a floating point value.
  104. @param arg The argument to compute the absolute value of
  105. @retval either -arg if arg is negative or arg if arg is positive
  106. @ingroup Maths
  107. */
  108. float abs (float arg);
  109. /** Remaps a value from a source range to a target range.
  110. @param value the value within the source range to map
  111. @param sourceMin the minimum value of the source range
  112. @param sourceMax the maximum value of the source range
  113. @param destMin the minumum value of the destination range
  114. @param destMax the maximum value of the destination range
  115. @returns the original value mapped to the destination range
  116. @ingroup Maths
  117. */
  118. float map (float value, float sourceMin, float sourceMax, float destMin, float destMax);
  119. /** Remaps a value from a source range to the range 0 - 1.0.
  120. @param value the value within the source range to map
  121. @param sourceMin the minimum value of the source range
  122. @param sourceMax the maximum value of the source range
  123. @returns the original value mapped to the range 0 - 1.0
  124. @ingroup Maths
  125. */
  126. float map (float value, float sourceMin, float sourceMax);
  127. /** Performs a modulo operation (can cope with the dividend being negative).
  128. The divisor must be greater than zero.
  129. @returns the result of the modulo operation
  130. @ingroup Maths
  131. */
  132. int mod (int dividend, int divisor);
  133. /** Returns a random floating-point number.
  134. @returns a random value in the range 0 (inclusive) to 1.0 (exclusive)
  135. @ingroup Maths
  136. */
  137. float getRandomFloat();
  138. /** Returns a random integer, limited to a given range.
  139. @returns a random integer between 0 (inclusive) and maxValue (exclusive).
  140. @ingroup Maths
  141. */
  142. int getRandomInt (int maxValue);
  143. /** Returns the number of milliseconds since a fixed event (usually system startup).
  144. @returns a monotonically increasing value which is unaffected by changes to the
  145. system clock. It should be accurate to within a few millisecseconds.
  146. @ingroup Maths
  147. */
  148. int getMillisecondCounter();
  149. /** Returns the length of time spent in the current function call in milliseconds.
  150. @returns the length of time spent in the current function call in milliseconds.
  151. @ingroup Maths
  152. */
  153. int getTimeInCurrentFunctionCall();
  154. /** Logs an integer value to the console.
  155. @param data The 32 bit signed integer to log to the topology as an integer
  156. @ingroup Debug
  157. */
  158. void log (int data);
  159. /** Logs a hexadecimal value to the console.
  160. @param data The 32 bit signed integer to log to the topology as a hexidecimal int
  161. @ingroup Debug
  162. */
  163. void logHex (int data);
  164. /** Sends a 1-byte short midi message.
  165. @ingroup Midi
  166. */
  167. void sendMIDI (int byte0);
  168. /** Sends a 2-byte short midi message.
  169. @ingroup Midi
  170. */
  171. void sendMIDI (int byte0, int byte1);
  172. /** Sends a 3-byte short midi message.
  173. @ingroup Midi
  174. */
  175. void sendMIDI (int byte0, int byte1, int byte2);
  176. /** Sends a key-down message.
  177. @param channel the midi channel, in the range 0 to 15
  178. @param noteNumber the key number, in the range 0 to 127
  179. @param velocity the velocity, in the range 0 to 127
  180. @ingroup Midi
  181. */
  182. void sendNoteOn (int channel, int noteNumber, int velocity);
  183. /** Sends a key-up message.
  184. @param channel the midi channel, in the range 0 to 15
  185. @param noteNumber the key number, in the range 0 to 127
  186. @param velocity the velocity, in the range 0 to 127
  187. @ingroup Midi
  188. */
  189. void sendNoteOff (int channel, int noteNumber, int velocity);
  190. /** Sends an aftertouch message.
  191. @param channel the midi channel, in the range 0 to 15
  192. @param noteNumber the key number, in the range 0 to 127
  193. @param level the amount of aftertouch, in the range 0 to 127
  194. @ingroup Midi
  195. */
  196. void sendAftertouch (int channel, int noteNumber, int level);
  197. /** Sends a controller message.
  198. @param channel the midi channel, in the range 0 to 15
  199. @param controller the type of controller
  200. @param value the controller value
  201. @ingroup Midi
  202. */
  203. void sendCC (int channel, int controller, int value);
  204. /** Sends a pitch bend message.
  205. @param channel the midi channel, in the range 0 to 15
  206. @param position the wheel position, in the range 0 to 16383
  207. @ingroup Midi
  208. */
  209. void sendPitchBend (int channel, int position);
  210. /** Sends a channel-pressure change event.
  211. @param channel the midi channel, in the range 0 to 15
  212. @param pressure the pressure, in the range 0 to 127
  213. @ingroup Midi
  214. */
  215. void sendChannelPressure (int channel, int pressure);
  216. /** Sets the MIDI channel range.
  217. @param useMPE
  218. @param lowChannel
  219. @param highChannel
  220. @ingroup Midi
  221. */
  222. void setChannelRange (bool useMPE, int lowChannel, int highChannel);
  223. /** Assigns a MIDI channel to a note number.
  224. @param noteNumber the note number to assign the channel to
  225. @returns the MIDI channel that has been assigned
  226. @ingroup Midi
  227. */
  228. int assignChannel (int noteNumber);
  229. /** Deassigns a channel from a note number.
  230. @param noteNumber the note number to deassign
  231. @param channel the MIDI channel
  232. @ingroup Midi
  233. */
  234. void deassignChannel (int noteNumber, int channel);
  235. /** Returns the channel that is being used for control messages.
  236. @returns the channel that is being used for control messages. (If MPE is enabled then this will be the first channel.)
  237. @ingroup Midi
  238. */
  239. int getControlChannel();
  240. /** Sets whether duplicate notes should be filtered out when MPE is enabled.
  241. @ingroup Midi
  242. */
  243. void useMPEDuplicateFilter (bool active);
  244. /** Use this method to draw the display.
  245. The block will call this approximately 25 times per second.
  246. @ingroup Callbacks
  247. */
  248. void repaint()
  249. /** Called when a button is pushed.
  250. @param index the index of the button that was pushed
  251. @ingroup Callbacks
  252. */
  253. void handleButtonDown (int index);
  254. /** Called when a button is released.
  255. @param index the index of the button that was released
  256. @ingroup Callbacks
  257. */
  258. void handleButtonUp (int index);
  259. /** Called when a control block button is pressed.
  260. @param buttonIndex the index of the button
  261. @ingroup Callbacks
  262. @note Requires >= 0.2.5 firmware
  263. @note Only valid with a control block
  264. */
  265. void onControlPress (int buttonIndex);
  266. /** Called when a control block button is released.
  267. @param buttonIndex the index of the button
  268. @ingroup Callbacks
  269. @note Requires >= 0.2.5 firmware
  270. @note Only valid with a control block
  271. */
  272. void onControlRelease (int buttonIndex);
  273. /** Called when a touch event starts.
  274. @param index the touch index, which will stay constant for each finger as it is tracked
  275. @param x the X position of this touch on the device, in block units starting from 0 (left)
  276. @param y the Y position of this touch on the device, in block units starting from 0 (top)
  277. @param z the current pressure of this touch, in the range 0.0 (no pressure) to 1.0 (very hard)
  278. @param vz the rate at which pressure is currently changing, measured in units/second
  279. @ingroup Touch
  280. */
  281. void touchStart (int index, float x, float y, float z, float vz);
  282. /** Called when a touch event moves.
  283. @param index the touch index, which will stay constant for each finger as it is tracked
  284. @param x the X position of this touch on the device, in block units starting from 0 (left)
  285. @param y the Y position of this touch on the device, in block units starting from 0 (top)
  286. @param z the current pressure of this touch, in the range 0.0 (no pressure) to 1.0 (very hard)
  287. @param vz the rate at which pressure is currently changing, measured in units/second
  288. @ingroup Touch
  289. */
  290. void touchMove (int index, float x, float y, float z, float vz);
  291. /** Called when a touch event ends.
  292. @param index the touch index, which will stay constant for each finger as it is tracked
  293. @param x the X position of this touch on the device, in block units starting from 0 (left)
  294. @param y the Y position of this touch on the device, in block units starting from 0 (top)
  295. @param z the current pressure of this touch, in the range 0.0 (no pressure) to 1.0 (very hard)
  296. @param vz the rate at which pressure is currently changing, measured in units/second
  297. @ingroup Touch
  298. */
  299. void touchEnd (int index, float x, float y, float z, float vz);
  300. /** Called when a program is loaded onto the block and is about to start. Do any setup here.
  301. @ingroup Callbacks
  302. */
  303. void initialise();
  304. /** Called when a block receives a MIDI message.
  305. @ingroup Midi
  306. */
  307. void handleMIDI (int byte0, int byte1, int byte2);
  308. /** Called when a block receives a message.
  309. @see sendMessageToBlock
  310. @ingroup Messaging
  311. */
  312. void handleMessage (int param1, int param2, int param3);
  313. /** Combines a set of 8-bit ARGB values into a 32-bit colour and returns the result.
  314. @return a 32-bit colour
  315. @param alpha The alpha in range 0 - 255 inclusive
  316. @param red The red in range 0 - 255 inclusive
  317. @param green The green in range 0 - 255 inclusive
  318. @param blue The blue in range 0 - 255 inclusive
  319. @ingroup Graphics
  320. */
  321. int makeARGB (int alpha, int red, int green, int blue);
  322. /** Blends the overlaid ARGB colour onto the base one and returns the new colour.
  323. @param baseColour the colour to blend on to
  324. @param overlaidColour The colour to blend in to the baseColour
  325. @returns The blended colour
  326. @ingroup Graphics
  327. */
  328. int blendARGB (int baseColour, int overlaidColour);
  329. /** Displays an animation indicating the current battery level of this block.
  330. A control block will light up its top LEDs indicating battery level and a lightpad
  331. block will draw the battery level on the display.
  332. @ingroup Graphics
  333. @note Requires >= 0.2.5 firmware
  334. */
  335. void displayBatteryLevel();
  336. /** Clears the display and sets all the LEDs to black.
  337. @ingroup Graphics
  338. */
  339. void clearDisplay();
  340. /** Clears the display and sets all the LEDs to a specified colour.
  341. @param rgb the colour to use (0xff...)
  342. @ingroup Graphics
  343. */
  344. void clearDisplay (int rgb);
  345. /** Sets a pixel to a specified colour with full alpha.
  346. @param rgb the colour to use (0xff...)
  347. @param x the x coordinate of the pixel to fill
  348. @param y the y coordinate of the pixel to fill
  349. @ingroup Graphics
  350. */
  351. void fillPixel (int rgb, int x, int y);
  352. /** Blends the current pixel colour with a specified colour.
  353. @param argb the colour to use
  354. @param x the x coordinate of the pixel to blend
  355. @param y the y coordinate of the pixel to blend
  356. @ingroup Graphics
  357. */
  358. void blendPixel (int argb, int x, int y);
  359. /** Fills a rectangle on the display with a specified colour.
  360. @param rgb the colour to use (0xff...)
  361. @param x the x coordinate of the rectangle to draw
  362. @param y the y coordinate of the rectangle to draw
  363. @param width the width of the rectangle to draw
  364. @param height the height of the rectangle to draw
  365. @ingroup Graphics
  366. */
  367. void fillRect (int rgb, int x, int y, int width, int height);
  368. /** Blends a rectangle on the display with a specified colour.
  369. @param argb the colour to use
  370. @param x the x coordinate of the rectangle to blend
  371. @param y the y coordinate of the rectangle to blend
  372. @param width the width of the rectangle to blend
  373. @param height the height of the rectangle to blend
  374. @ingroup Graphics
  375. */
  376. void blendRect (int argb, int x, int y, int width, int height);
  377. /** Fills a rectangle on the display with four corner colours blended together.
  378. @param colourNW the colour to use in the north west corner of the rectangle
  379. @param colourNE the colour to use in the north east corner of the rectangle
  380. @param colourSE the colour to use in the south east corner of the rectangle
  381. @param colourSW the colour to use in the south west corner of the rectangle
  382. @param x the x coordinate of the rectangle
  383. @param y the y coordinate of the rectangle
  384. @param width the width of the rectangle
  385. @param height the height of the rectangle
  386. @ingroup Graphics
  387. */
  388. void blendGradientRect (int colourNW, int colourNE, int colourSE, int colourSW, int x, int y, int width, int height);
  389. /** Blends a circle on the display with a specified colour.
  390. @param argb the colour to use
  391. @param xCentre the x position of the circle's centre in block units
  392. @param yCentre the y position of the circle's centre in block units
  393. @param radius the radius of the circle in block units
  394. @param fill if true then the circle will be filled, if false the circle will be an outline
  395. @ingroup Graphics
  396. @note Requires >= 0.2.5 firmware
  397. */
  398. void blendCircle (int argb, float xCentre, float yCentre, float radius, bool fill);
  399. /** Draws a number on the display.
  400. @param value the number to draw between 0 and 99
  401. @param colour the colour to use
  402. @param x the x coordinate to use
  403. @param y the y coordinate to use
  404. @ingroup Graphics
  405. */
  406. void drawNumber (int value, int colour, int x, int y);
  407. /** Returns the current firmware version of this block.
  408. @returns The firmware version of the form 0xMJMIRV (where MJ = Major, MI = Minor, RV = Revision)
  409. @ingroup Utility
  410. @note Requires >= 0.2.5 firmware
  411. */
  412. int getFirmwareVersion();
  413. /** Returns the battery level of this block, between 0 and 1.0.
  414. @returns the battery level of this block, between 0 and 1.0.
  415. @ingroup Power
  416. @note Requires >= 0.2.5 firmware
  417. */
  418. float getBatteryLevel();
  419. /** Returns true if this block's battery is charging.
  420. @returns true if this block's battery is charging
  421. @ingroup Power
  422. @note Requires >= 0.2.5 firmware
  423. */
  424. bool isBatteryCharging();
  425. /** Sets whether status overlays should be displayed on this block.
  426. @ingroup Utility
  427. @note Requires >= 0.2.5 firmware
  428. */
  429. void setStatusOverlayActive (bool active);
  430. /** Sets whether power saving mode should be enabled on this block.
  431. @ingroup Power
  432. @note Requires >= 0.2.5 firmware
  433. */
  434. void setPowerSavingEnabled (bool enabled);
  435. /** Returns the type of the block with a given ID.
  436. @returns an enum indicating the type of block @see Block::Type
  437. @ingroup Clustering
  438. @note Requires >= 0.2.5 firmware
  439. */
  440. int getBlockTypeForID (int blockID);
  441. /** Sends a message to the block with the specified ID.
  442. This will be processed in the handleMessage() callback.
  443. @param blockID the ID of the block to send this message to
  444. @param param1 the first chunk of data to send
  445. @param param2 the second chunk of data to send
  446. @param param3 the third chunk of data to send
  447. @ingroup Messaging
  448. */
  449. void sendMessageToBlock (int blockID, int param1, int param2, int param3);
  450. /** Sends a message to the host. To receive this the host will need to implement
  451. the Block::ProgramEventListener::handleProgramEvent() method.
  452. @param param1 the first chunk of data to send
  453. @param param2 the second chunk of data to send
  454. @param param3 the third chunk of data to send
  455. @ingroup Messaging
  456. */
  457. void sendMessageToHost (int param1, int param2, int param3);
  458. /** Draws a pressure point with a specified colour and pressure.
  459. @param argb the colour to use
  460. @param touchX the x position of the touch in block units
  461. @param touchY the y position of the touch in block units
  462. @param touchZ the pressure value of the touch
  463. @ingroup Lightpad
  464. */
  465. void addPressurePoint (int argb, float touchX, float touchY, float touchZ);
  466. /** Draws the pressure map on the display.
  467. @ingroup Lightpad
  468. */
  469. void drawPressureMap();
  470. /** Fades the pressure map on the display.
  471. @ingroup Lightpad
  472. */
  473. void fadePressureMap();
  474. /** Links a another block to this control block.
  475. @param blockID the ID of the block to link
  476. @ingroup ControlBlock
  477. @note Requires >= 0.2.5 firmware
  478. @note Only valid with a control block
  479. */
  480. void linkBlockIDtoController (int blockID);
  481. /** Repaints the control block display.
  482. @ingroup ControlBlock
  483. @note Requires >= 0.2.5 firmware
  484. @note Only valid with a control block
  485. */
  486. void repaintControl();
  487. /** Initialises one of the control block buttons.
  488. @param buttonIndex the index of the button to initialise
  489. @param modeToUse the mode to use for this button @see ControlMode
  490. @param outputType the control type to use @see ControlType
  491. @param val the current value to set this button to
  492. @param min the minimum value for this button
  493. @param max the maximum value for this button
  494. @param index the item index
  495. @param onColourToUse the colour to use when this button is on
  496. @param offColourToUse the colour to use when this button is off
  497. @ingroup ControlBlock
  498. @note Requires >= 0.2.5 firmware
  499. @note Only valid with a control block
  500. */
  501. void initControl (int buttonIndex, int modeToUse, int outputType, int val, int min, int max,
  502. int index, int onColourToUse, int offColourToUse);
  503. /** Control type for use with initControl
  504. @see initControl
  505. @ingroup ControlBlock
  506. */
  507. enum ControlType
  508. {
  509. internalConfig = 0,
  510. midiCC,
  511. sysex
  512. };
  513. /** Control mode for use with initControl
  514. @see initControl
  515. @ingroup ControlBlock
  516. */
  517. enum ControlMode
  518. {
  519. toggle = 0,
  520. togglePulse,
  521. gate,
  522. trigger,
  523. cycle,
  524. incDec,
  525. triState
  526. };
  527. /** Forces a touch event to be handled as seaboard playing.
  528. @param touchIndex the index of the touch event
  529. @ingroup Seaboard
  530. @note Requires >= 0.2.5 firmware
  531. @note Only valid on a Seaboard
  532. */
  533. void handleTouchAsSeaboard (int touchIndex);
  534. /** Returns the number of blocks in the current topology.
  535. @ingroup Topology
  536. @note Requires >= 0.2.5 firmware
  537. */
  538. int getNumBlocksInTopology();
  539. /** Returns the ID of a block at a given index in the topology.
  540. @param index The index of the block to find in the topology
  541. @returns int The id of the block
  542. @ingroup Topology
  543. @note Requires >= 0.2.5 firmware
  544. */
  545. int getBlockIDForIndex (int index);
  546. /** Returns true if this block is directly connected to the host,
  547. as opposed to only being connected to a different block via a connection port.
  548. @ingroup Topology
  549. @note Requires >= 0.2.5 firmware
  550. */
  551. bool isMasterBlock();
  552. /** Returns true if this block is connected to the host computer, this can be
  553. directly or through connections to other blocks.
  554. @ingroup Topology
  555. @note Requires >= 0.2.5 firmware
  556. */
  557. bool isConnectedToHost();
  558. /** Returns the ID of a block connected to a specified port on this block.
  559. @ingroup Topology
  560. @note Requires >= 0.2.5 firmware
  561. */
  562. int getBlockIDOnPort (int port);
  563. /** Returns the port number that is connected to the master block. Returns 0xFF if there is
  564. no port connected to master.
  565. @returns the port number that is connected to the master block. Returns 0xFF if there is
  566. no port connected to master.
  567. @ingroup Topology
  568. @note Requires >= 0.2.5 firmware
  569. */
  570. int getPortToMaster();
  571. /** Returns the horizontal distance between this block and the master block in block units.
  572. @ingroup Clustering
  573. @note Requires >= 0.2.5 firmware
  574. */
  575. int getHorizontalDistFromMaster();
  576. /** Returns the vertical distance between this block and the master block in block units.
  577. @ingroup Clustering
  578. @note Requires >= 0.2.5 firmware
  579. */
  580. int getVerticalDistFromMaster();
  581. /** Returns the angle of this block relative to the master block in degrees.
  582. @ingroup Clustering
  583. @note Requires >= 0.2.5 firmware
  584. */
  585. int getAngleFromMaster();
  586. /** Sets whether this block should auto-rotate when its angle relative to the master block changes.
  587. @ingroup Clustering
  588. @note Requires >= 0.2.5 firmware
  589. */
  590. void setAutoRotate (bool enabled);
  591. /** Returns the index of this block in the current cluster.
  592. @ingroup Clustering
  593. @note Requires >= 0.2.5 firmware
  594. */
  595. int getClusterIndex();
  596. /** Returns how many blocks wide the current cluster is.
  597. @returns the width of the cluster (note that a single block will return 1 here)
  598. @ingroup Clustering
  599. @note Requires >= 0.2.5 firmware
  600. */
  601. int getClusterWidth();
  602. /** Returns how many blocks high the current cluster is.
  603. @returns the height of the cluster (note that a single block will return 1 here)
  604. @ingroup Clustering
  605. @note Requires >= 0.2.5 firmware
  606. */
  607. int getClusterHeight();
  608. /** Returns the x index of this block in the current cluster.
  609. @returns int The cluster x position. (0, 0) is considered to be the top left block
  610. @ingroup Clustering
  611. @note Requires >= 0.2.5 firmware
  612. */
  613. int getClusterXpos();
  614. /** Returns the y index of this block in the current cluster.
  615. @returns int The cluster x position. (0, 0) is considered to be the top left block
  616. @ingroup Clustering
  617. @note Requires >= 0.2.5 firmware
  618. */
  619. int getClusterYpos();
  620. /** Returns the number of blocks in the current cluster.
  621. @returns the number of blocks in the current cluster.
  622. @ingroup Clustering
  623. @note Requires >= 0.2.5 firmware
  624. */
  625. int getNumBlocksInCurrentCluster();
  626. /** Returns the block ID for a block in the current cluster.
  627. @param index the cluster index of the block to get the ID of
  628. @ingroup Clustering
  629. @note Requires >= 0.2.5 firmware
  630. */
  631. int getBlockIdForBlockInCluster (int index);
  632. /** Returns true if the master block is in the current cluster.
  633. @ingroup Clustering
  634. @note Requires >= 0.2.5 firmware
  635. */
  636. bool isMasterInCurrentCluster();
  637. /** Returns current value of one of the local config items.
  638. @param item the config item to get (see ConfigItemId enum in juce_BlocksProtocolDefinitions.h)
  639. @ingroup Configs
  640. @note Requires >= 0.2.5 firmware
  641. */
  642. int getLocalConfig (int item);
  643. /** Sets the current value of one of the local config items.
  644. @param item the config item to set the value of (see ConfigItemId enum in juce_BlocksProtocolDefinitions.h)
  645. @param value the value to set the config to
  646. @ingroup Configs
  647. @note Requires >= 0.2.5 firmware
  648. */
  649. void setLocalConfig (int item, int value);
  650. /** Sets the local config of a block to the config item of a remote block.
  651. @param longAddress the address of the remote block
  652. @param item the config item (see ConfigItemId enum in juce_BlocksProtocolDefinitions.h)
  653. @ingroup Configs
  654. @note Requires >= 0.2.5 firmware
  655. */
  656. void requestRemoteConfig (int longAddress, int item);
  657. /** Sets the config of a remote block.
  658. @param longAddress the address of the remote block
  659. @param item the config item (see ConfigItemId enum in juce_BlocksProtocolDefinitions.h)
  660. @param value the value to set the config to
  661. @ingroup Configs
  662. @note Requires >= 0.2.5 firmware
  663. */
  664. void setRemoteConfig (int longAddress, int item, int value);
  665. /** Sets the range of one of the local config items.
  666. @param item the config item to set the range of (see ConfigItemId enum in juce_BlocksProtocolDefinitions.h)
  667. @param min the minimum value this config item should use
  668. @param max the maximum value this config item should use
  669. @ingroup Configs
  670. @note Requires >= 0.2.5 firmware
  671. */
  672. void setLocalConfigItemRange (int item, int min, int max);
  673. /** Sets whether a local config item should be active.
  674. @param item the config item to set active (see ConfigItemId enum in juce_BlocksProtocolDefinitions.h)
  675. @param isActive sets whether the config should be active or not
  676. @param saveToFlash if true then this config item will be saved to the flash memory of the block
  677. @ingroup Configs
  678. @note Requires >= 0.2.5 firmware
  679. */
  680. void setLocalConfigActiveState (int item, bool isActive, bool saveToFlash);