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.

Pose.hpp 1.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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 <iosfwd>
  5. #include <string>
  6. #include <myo/libmyo.h>
  7. namespace myo {
  8. /// A pose represents a detected configuration of the user's hand.
  9. class Pose {
  10. public:
  11. /// Types of poses supported by the SDK.
  12. enum Type {
  13. rest = libmyo_pose_rest,
  14. fist = libmyo_pose_fist,
  15. waveIn = libmyo_pose_wave_in,
  16. waveOut = libmyo_pose_wave_out,
  17. fingersSpread = libmyo_pose_fingers_spread,
  18. doubleTap = libmyo_pose_double_tap,
  19. unknown = libmyo_pose_unknown
  20. };
  21. /// Construct a pose of type Pose::none.
  22. Pose();
  23. /// Construct a pose with the given type.
  24. Pose(Type type);
  25. /// Returns true if and only if the two poses are of the same type.
  26. bool operator==(Pose other) const;
  27. /// Equivalent to `!(*this == other)`.
  28. bool operator!=(Pose other) const;
  29. /// Returns the type of this pose.
  30. Type type() const;
  31. /// Return a human-readable string representation of the pose.
  32. std::string toString() const;
  33. private:
  34. Type _type;
  35. };
  36. /// @relates Pose
  37. /// Returns true if and only if the type of pose is the same as the provided type.
  38. bool operator==(Pose pose, Pose::Type t);
  39. /// @relates Pose
  40. /// Equivalent to `pose == type`.
  41. bool operator==(Pose::Type type, Pose pose);
  42. /// @relates Pose
  43. /// Equivalent to `!(pose == type)`.
  44. bool operator!=(Pose pose, Pose::Type type);
  45. /// @relates Pose
  46. /// Equivalent to `!(type == pose)`.
  47. bool operator!=(Pose::Type type, Pose pose);
  48. /// @relates Pose
  49. /// Write the name of the provided pose to the provided output stream.
  50. std::ostream& operator<<(std::ostream& out, const Pose& pose);
  51. } // namespace myo
  52. #include "impl/Pose_impl.hpp"