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.

40 lines
679B

  1. #pragma once
  2. #include "common.hpp"
  3. #include "engine/Light.hpp"
  4. namespace rack {
  5. static const int PORT_MAX_CHANNELS = 16;
  6. struct Port {
  7. /** Voltage of the port */
  8. union {
  9. /** Accessing this directly is deprecated.
  10. Use getVoltage() and setVoltage() instead
  11. */
  12. float value;
  13. float values[PORT_MAX_CHANNELS] = {};
  14. };
  15. /** Number of polyphonic channels
  16. May be 0 to PORT_MAX_CHANNELS.
  17. */
  18. int channels = 1;
  19. /** Whether a cable is plugged in */
  20. bool active = false;
  21. Light plugLights[2];
  22. float getVoltage(int channel = 0) {
  23. return values[channel];
  24. }
  25. void setVoltage(float voltage, int channel = 0) {
  26. values[channel] = voltage;
  27. }
  28. };
  29. } // namespace rack