feat: add Ribbon descriptor (1D touch-strip gestures) - #134
Open
edumeneses wants to merge 2 commits into
Open
Conversation
Adds puara_gestures::Ribbon for a 1D touch strip (ribbon / SoftPot / linear position sensor): it turns a position + touched pair into playable gestures - absolute position, slide velocity and direction (glissando), touch-down/up events, and a quick tap (a brief touch that barely moves). It handles the awkward parts: velocity is not computed across a lift-and-retouch (so moving to a new spot does not produce a spurious jump) and it resets on release. Positions are in the sensor's own units (0..1 or raw). tapMaxTime/ tapMaxTravel define a tap. Timing uses the monotonic clock (update(pos, touched)) or an explicit step (update(pos, touched, dt)), so it behaves identically in an Arduino loop(), a thread, or an ossia score process. Provides current_value() (position). Header-only, doubles only, no STL/Boost. Includes an Arduino example, README entry, and Catch2 tests covering position/velocity/direction, re-touch jump suppression, and tap detection vs long/large touches. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0163cH7Znu2oYvnaP7fTEQMN
Follow the one-cpp-per-descriptor layout requested in review (#118): put the Ribbon test cases in tests/descriptors/ribbon.cpp and register it in the test_descriptors executable, instead of appending to the monolithic test_descriptors.cpp. No test logic changed. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0163cH7Znu2oYvnaP7fTEQMN
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
puara_gestures::Ribbonfor a 1D touch strip (ribbon / SoftPot / linear position sensor). It turns a position + touched pair into playable gestures: absoluteposition, slidevelocity/direction(glissando), touch-down/up events, and a quicktap(a brief touch that barely moves).It handles the awkward parts: velocity is not computed across a lift-and-retouch (so moving your finger to a new spot does not produce a spurious jump), and it resets cleanly on release.
API
Outputs:
position,velocity,direction,touched,onset/release,tap.tapMaxTime/tapMaxTraveldefine what counts as a tap.Design note
Timing uses the monotonic clock (
update(pos, touched)) or an explicit step (update(pos, touched, dt)) for reproducible results. Identical in Arduinoloop(), thread, or ossia process.Conventions kept
#pragma once,puara_gesturesnamespaceupdate(...)overloads,current_value()(position),reset()Files
include/puara/descriptors/ribbon.hinclude/puara/gestures.hexamples/arduino/descriptors/ribbon/ribbon.inotests/test_descriptors.cpp([descriptors][ribbon])Testing
🤖 Generated with Claude Code
https://claude.ai/code/session_0163cH7Znu2oYvnaP7fTEQMN