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_impl.hpp 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. // Copyright (C) 2013-2014 Thalmic Labs Inc.
  2. // Distributed under the Myo SDK license agreement. See LICENSE.txt for details.
  3. #include "../Myo.hpp"
  4. #include "../detail/ThrowOnError.hpp"
  5. #include <stdexcept>
  6. namespace myo {
  7. inline
  8. void Myo::vibrate(VibrationType type)
  9. {
  10. libmyo_vibrate(_myo, static_cast<libmyo_vibration_type_t>(type), ThrowOnError());
  11. }
  12. inline
  13. void Myo::requestRssi() const
  14. {
  15. libmyo_request_rssi(_myo, ThrowOnError());
  16. }
  17. inline
  18. void Myo::requestBatteryLevel() const
  19. {
  20. libmyo_request_battery_level(_myo, myo::ThrowOnError());
  21. }
  22. inline
  23. void Myo::unlock(UnlockType type)
  24. {
  25. libmyo_myo_unlock(_myo, static_cast<libmyo_unlock_type_t>(type), ThrowOnError());
  26. }
  27. inline
  28. void Myo::lock()
  29. {
  30. libmyo_myo_lock(_myo, ThrowOnError());
  31. }
  32. inline
  33. void Myo::notifyUserAction()
  34. {
  35. libmyo_myo_notify_user_action(_myo, libmyo_user_action_single, ThrowOnError());
  36. }
  37. inline
  38. void Myo::setStreamEmg(StreamEmgType type)
  39. {
  40. libmyo_set_stream_emg(_myo, static_cast<libmyo_stream_emg_t>(type), ThrowOnError());
  41. }
  42. inline
  43. libmyo_myo_t Myo::libmyoObject() const
  44. {
  45. return _myo;
  46. }
  47. inline
  48. Myo::Myo(libmyo_myo_t myo)
  49. : _myo(myo)
  50. {
  51. if (!_myo) {
  52. throw std::invalid_argument("Cannot construct Myo instance with null pointer");
  53. }
  54. }
  55. inline
  56. Myo::~Myo()
  57. {
  58. }
  59. } // namespace myo