Recent

Author Topic: NSHapticFeedbackPerformer  (Read 1077 times)

msintle

  • Sr. Member
  • ****
  • Posts: 259
NSHapticFeedbackPerformer
« on: December 02, 2024, 01:29:22 am »
Does anyone have examples of using this with Lazarus for macOS?

Hansaplast

  • Hero Member
  • *****
  • Posts: 689
  • Tweaking4All.com
    • Tweaking4All
Re: NSHapticFeedbackPerformer
« Reply #1 on: December 04, 2024, 12:25:49 pm »
I have no experience with this, but these macOS 11 headers on Github for Lazarus may be helpful.
You'll find this under "AppKit".
I have not (yet) tested these files, just bumped into them while looking for something else.  :)



I am trying to find some time to play with these, but am not quite sure how to use these permanently under Lazarus.
Maybe something that can be added to the Lazarus distribution?



msintle

  • Sr. Member
  • ****
  • Posts: 259
Re: NSHapticFeedbackPerformer
« Reply #2 on: December 04, 2024, 09:47:25 pm »
I've got a "job bounty" here for anyone interested:

https://www.upwork.com/jobs/~021864320415816148444

msintle

  • Sr. Member
  • ****
  • Posts: 259
Re: NSHapticFeedbackPerformer
« Reply #3 on: December 06, 2024, 04:52:53 pm »
I've tried the following code, hallucinated by AI of course:

Code: Pascal  [Select][+][-]
  1. var
  2.   Performer: NSHapticFeedbackPerformerProtocol;
  3. begin
  4.   // Get the default haptic feedback performer
  5.   Performer := NSHapticFeedbackManager.defaultPerformer;
  6.  
  7.   // Perform multiple feedback patterns
  8.   if Assigned(Performer) then
  9.   begin
  10.     // Try different patterns
  11.     Performer.performFeedbackPattern_performanceTime(
  12.       NSHapticFeedbackPatternLevelChange,
  13.       NSHapticFeedbackPerformanceTimeNow
  14.     );
  15.  
  16.     // Optional: Add a slight delay and try another pattern
  17.     //Sleep(100);
  18.  
  19.     Performer.performFeedbackPattern_performanceTime(
  20.       NSHapticFeedbackPatternAlignment,
  21.       NSHapticFeedbackPerformanceTimeNow
  22.     );
  23.  
  24.     // Optional: Add a slight delay and try another pattern
  25.     //Sleep(100);
  26.  
  27.     Performer.performFeedbackPattern_performanceTime(
  28.       NSHapticFeedbackPatternGeneric,
  29.       NSHapticFeedbackPerformanceTimeDefault
  30.     );
  31.   end;
  32. end;
  33.  
Sadly it doesn't work. No crashes or anything, but nothing happens.

msintle

  • Sr. Member
  • ****
  • Posts: 259
Re: NSHapticFeedbackPerformer
« Reply #4 on: December 14, 2024, 07:35:29 pm »
Triggering this code from a timer actually seems to work (say an interval of 100 msec), but it needs your finger to be on the touchpad (I guess the other scenario works too, but is hardly detectable when you're actually tapping the pad).

There's an app which does it without needing to have your finger there, it's called "Haptic Touch Bar".

Any thoughts how that might be possible?

 

TinyPortal © 2005-2018