chris@164: /* chris@164: * chris@164: * Plectrum model for touching and plucking strings chris@164: * chris@164: * [inspired by E. Berdahl's pluck~ abstraction for the FireFader] chris@164: * chris@164: */ chris@164: chris@164: #ifndef PLECTRUM_H_ chris@164: #define PLECTRUM_H_ chris@164: chris@164: class Plectrum chris@164: { chris@164: chris@164: public: chris@164: chris@164: Plectrum(); chris@164: void setup(float spring, float damp, float hyst); chris@164: float update(float position, float stringPosition); chris@164: chris@164: private: chris@164: chris@164: double _dt; chris@164: float _spring; chris@164: float _damp; chris@164: double _position; chris@164: double _velocity; chris@164: float _hyst; chris@164: float _lastDistance; chris@164: int _contact; chris@164: chris@164: }; chris@164: chris@164: #endif chris@164: