Control MIDI in Ableton Live with a MYO armband
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.

Myo.hpp 2.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. // Copyright (C) 2013-2014 Thalmic Labs Inc.
  2. // Distributed under the Myo SDK license agreement. See LICENSE.txt for details.
  3. #pragma once
  4. #include <myo/libmyo.h>
  5. namespace myo {
  6. /// Represents a Myo device with a specific MAC address.
  7. /// This class can not be instantiated directly; instead, use Hub to get access to a Myo.
  8. /// There is only one Myo instance corresponding to each device; thus, if the addresses of two Myo instances compare
  9. /// equal, they refer to the same device.
  10. class Myo {
  11. public:
  12. /// Types of vibration supported by the Myo.
  13. enum VibrationType {
  14. vibrationShort = libmyo_vibration_short,
  15. vibrationMedium = libmyo_vibration_medium,
  16. vibrationLong = libmyo_vibration_long
  17. };
  18. /// Vibrate the Myo.
  19. void vibrate(VibrationType type);
  20. /// Request the RSSI of the Myo. An onRssi event will likely be generated with the value of the RSSI.
  21. /// @see DeviceListener::onRssi()
  22. void requestRssi() const;
  23. /// Request the battery level of the Myo. An onBatteryLevelReceived event will be generated with the value.
  24. /// @see DeviceListener::onBatteryLevelReceived().
  25. void requestBatteryLevel() const;
  26. /// Unlock types supported by Myo.
  27. enum UnlockType {
  28. unlockTimed = libmyo_unlock_timed,
  29. unlockHold = libmyo_unlock_hold
  30. };
  31. /// Unlock the Myo.
  32. /// Myo will remain unlocked for a short amount of time, after which it will automatically lock again.
  33. /// If Myo was locked, an onUnlock event will be generated.
  34. void unlock(UnlockType type);
  35. /// Force the Myo to lock immediately.
  36. /// If Myo was unlocked, an onLock event will be generated.
  37. void lock();
  38. /// Notify the Myo that a user action was recognized.
  39. /// Will cause Myo to vibrate.
  40. void notifyUserAction();
  41. /// Valid EMG streaming modes for a Myo.
  42. enum StreamEmgType {
  43. streamEmgDisabled = libmyo_stream_emg_disabled,
  44. streamEmgEnabled = libmyo_stream_emg_enabled
  45. };
  46. /// Sets the EMG streaming mode for a Myo.
  47. void setStreamEmg(StreamEmgType type);
  48. /// @cond MYO_INTERNALS
  49. /// Return the internal libmyo object corresponding to this device.
  50. libmyo_myo_t libmyoObject() const;
  51. /// @endcond
  52. private:
  53. Myo(libmyo_myo_t myo);
  54. ~Myo();
  55. libmyo_myo_t _myo;
  56. // Not implemented.
  57. Myo(const Myo&);
  58. Myo& operator=(const Myo&);
  59. friend class Hub;
  60. };
  61. } // namespace myo
  62. #include "impl/Myo_impl.hpp"