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.

63 lines
1.3KB

  1. #pragma once
  2. namespace rack {
  3. static const int BRIDGE_NUM_PORTS = 16;
  4. // A random number which prevents connection from other protocols and old Bridge versions
  5. const int BRIDGE_HELLO = 0xff00fefd;
  6. /** All commands are called from the client and served by the server
  7. send
  8. - uint8_t cmd
  9. */
  10. enum BridgeCommand {
  11. NO_COMMAND = 0,
  12. /** Initial state of the state machine. The client should not send the command number itself, just its arguments.
  13. send
  14. - uint32_t hello
  15. */
  16. START_COMMAND,
  17. /** Requests the server to shut down the client */
  18. QUIT_COMMAND,
  19. /** Sets the port
  20. send
  21. - uint8_t port
  22. */
  23. PORT_SET_COMMAND,
  24. /** Sends a 3-byte MIDI command
  25. send
  26. - uint8_t msg[3]
  27. */
  28. MIDI_MESSAGE_SEND_COMMAND,
  29. /** Sets the audio sample rate
  30. send
  31. - uint32_t sampleRate
  32. */
  33. AUDIO_SAMPLE_RATE_SET_COMMAND,
  34. /** Sets the number of audio channels
  35. Currently not supported, hard-coded at 2.
  36. send
  37. - uint8_t channels
  38. */
  39. AUDIO_CHANNELS_SET_COMMAND,
  40. /** Sends and receives an audio buffer
  41. send
  42. - uint32_t length
  43. - float input[n]
  44. recv
  45. - float output[n]
  46. */
  47. AUDIO_PROCESS_COMMAND,
  48. /** Resumes the audio buffer, forcing Rack to wait on an audio buffer */
  49. AUDIO_ACTIVATE,
  50. /** Pauses the audio buffer, allowing Rack to not wait on an audio buffer */
  51. AUDIO_DEACTIVATE,
  52. NUM_COMMANDS
  53. };
  54. } // namespace rack