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.

986 lines
31KB

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