New solution: Continuous pinch to zoom for Cubase on macOS

Very good! And, yeah, apparently I misread the description of your keybindings.

Right, this code is part of my deafult “Cubase” preset which works on my system with standard Cubase keybindings. Anybody else having trouble with that? (Only thing I can think of right now was using a seperate keyboard which might send slightly different flags. But than, you would probably use a mouse and no trackpad, would you?)

If you want to clarify, I would suggest saving your keybindings in Cubase with a new name, restore the default keybindings and test ALT+pinch with that. If that does fix your issue, restore your keybindings and look for differences. If waveform zoom doesn’t work for you even with default keybindings, please report so and wait for other MacBook (Pro) M1 users to confirm.

I can only test on a MBP12.1 (2015) and haven’t had any problems so far. Other feedback was equally positive.

I did some testing and found that the problem happens because I’m using the Dvorak keyboard layout (either with my customized shortcuts or with with Cubase in its default state). When I change to the US layout it works fine. (I use the keyboard and trackpad on the MacBook Pro, no mouse or external keyboard)

I tried to see if I could configure PinchBar to use the codes for J (the physical J in the keyboard corresponds to H in Dvorak) and U (G in Dvorak) using the codes listed here
but it seems to be triggering option+3 instead.

524288 =             {
                flags = 524288;
                replaceWith =                 {
                    keys =                     {
                        codeA = 20;
                        codeB = 26;

Huh! Dvorak, eh? Quite an advanced test case for being one of the very first field tests! Didn’t think of that before… Thank you for being that, errr, ‘specialied’! :smiley:

AFAIK Apple’s key codes are layout independent and therefore don’t change with macOS’s keyboard settings. I confirmed that by changing Cubase’s keybinding for waveform zoom to ALT+I/D (which dvorak produces for the hardware keys G/H) and activating dvorak layout in macOS settings. The result is that Cubase correctly reacts to different ‘characters’ but to the same hardware keys and waveform zoom is triggered on ALT+pinch.

Ahhhhhh, now I found your problem!!! You see, all the key codes on that page are written in hexadecimal form, but defaults prints integers in base 10. So, the key codes you pasted in your last post are really the key codes for the number keys 3 and 7 (20 = 0x14 and 26 = 0x1A).

Btw. which tool(s) do you use for changing PinchBar’s defaults? Do you edit the plist and import them afterwards? If so, which editor do you use? I edit my plists in Xcode and, if I insert a hex value (with leading 0x) into a ‘Number’ field and hit return, it automatically converts it into base 10. Maybe other editors don’t support that, I don’t know…

Indeed, duh! I changed it to 32 (0x20) and 38 (0x26) and now it works like a charm here:

524288 =             {
 flags = 524288;
 replaceWith =                 {
     keys =                     {
         codeA = 32;
         codeB = 38;

I don’t have Xcode installed, so I’m using Emacs for editing and plutil to convert from json to/from the binary format, so no automatic hex conversion while typing in this case:

plutil -convert json -r new.plist
plutil -convert binary1 new.plist

This is actually a nice feature! I just tried a few specialized plist editors and none of them had this feature :frowning: I wish one could install just the plist editor without the whole Xcode :slight_smile:

I’m glad everything is working for you now. My main takeaway, however, is how cumbersone editing user defaults is. Originally I was hoping that PinchBar could be easily configured just using defaults. But now I know that this tool can only override top level attributes, it can’t add, edit or remove values inside arrays or dictionaries. From its own manpage:

BUGS
     Defaults can be structured in very complex ways, making it difficult for the user to
     enter them with this command.

Searching for an alternative I found that PlistBuddy is often recommented for this task as it is also shipped with macOS. But then again, this tool can’t access user defaults directly, so you have to export defaults to a plist file, edit single entries, re-import the whole file and test your changes :face_exhaling:

So in the end I have to accept that Apple doesn’t support end users to edit their own user defaults effectively (via cli) and so I see myself writing a GUI for PinchBar sooner or later… But as I said, other features go first and I don’t have that much time to spare…

Hey @pnoqable , first of all thank you for making this, the installation and integration all worked like a charm. But somehow the sensitivity is crazy high for me… When i zoom it almost immediately zoom aaaaall the way out or in. I have to super precice to get what i want. When using the native cmd+two fingers up method the speed is perfect tho. I am using a 2020 MB Pro M1. Is there maybe a simple way to adjust the sensitivity to my liking?
Cheers,
Moritz

Hello Moritz!

That’s weird, until now I havn’t read from anyone that PinchBar’s sensitivity was that much too high. I set its default value to match its feel that of CMD+scroll. Anybody else having similar problems?

Do you experience unusual sensivity for CMD+pinch and ALT+pinch as well?

PinchBar can be configured via command line, but it’s a bit tedious. I zipped and uploaded this plist file for you with 50% lowered sensivity. To import this settings, follow the steps as I wrote them for Kroger:

I don’t know if that’s enough to make it behave (somewhat) normally on your MacBook. Similar to Kroger, you could edit the plist file and re-import it to make it fit your needs. For example, to reset the sensitivity in the plist file to its default value (200) and import it again, enter the following in Terminal.app:

➜ killall PinchBar
➜ /usr/libexec/PlistBuddy -c "Set :presets:Cubase:0:sensivity 200" PinchBar.plist
➜ defaults import com.pnoqable.PinchBar PinchBar.plist

You’ll have to restart PinchBar after every defaults import.

If you want, we could also investigate the cause of this strange behaviour and fix it at its root. Here you can download a special version of PinchBar that dumps all mapped pinch events to System Log. I could compare yours to the events of my MacBook’s trackpad and locate the differences…

Thanks for your fast help!
It worked, i even lowered the sens further to 2, that feels the best now. It seems like it does a “jump” of a set amount in the zoom and lowering the sens makes it so i have to swipe more to trigger the same amount of jumps. When making the sens higher, above 10, so many zoom jumps trigger, that it becomes too fast. Now on 2 it works nice, it’s not a smooth zoom but triggering the jumps feels intuitive and works fine for me. I hope you can kind of imagine what i described, if the behavior is very weird to you, i can try explaining it in further detail (heres a screen recording i made: Bildschirmaufnahme 2023 02 12 um 18 39 29 - YouTube)
I don’t know how your code works or anything, i am just thinking that maybe making the amount that each “jump” zooms in should be way lower, so it again could trigger way more often (with the normal sens of 200 for example) to achieve the same goal… But again i dont know how any of that really works :slight_smile:

The cmd+scroll still works as it should with a good sensitivity, the cmd+pinch (zooming vertically) also works with a normal sens.
I’d surely help to investigate further, you have to explain to me though, how i can send you the log.
Cheers,
Moritz

This is great! Working without problems and greatly enhancing workflow

Sorry for the abrupt hiatus, I’ve been dealing with moderate health issues and thus had to put this project on hold for a few weeks. Feeling better now, so let’s get back on it!

@buddy_s Glad to hear that! Thank you for your feedback!

@Moritz_Paul Thanks for your feedback as well, and also for the screen recording. I’m not sure where your issue stems from. The video does not look that wrong to me but I’m unsure as I don’t know what your gesture looked like on the trackpad. I guess zooming doesn’t really correspond to your finger movement, does it? It rather seems to have fixed ‘speed’ and no acceleration or deceleration at all. Then there’s somewhat of a random jump at the end of each ‘stroke’.

None of this happens on my test devices. So, I suspect it not to be hardware related. PinchBar itself treats input events one by one as they come from the system/driver. There’s no temporal buffering or something like that. It also takes the event field called zoom amount into account (the speed of the gesture if you will). So I don’t see no reason why PinchBar would do such a thing on your MacBook.

The most relevant question that comes to my mind: Do you use any special (driver) software for your trackpad or mouse input? And by that I mean tool like SmoothMouse, MacMouseFix, BetterTouchTool or so. I could imagine that other tools screw around with the events on your MacBook and don’t handle every aspect of it very well. When prototyping PinchBar, I tested for interference with BTT and wouldn’t find any. But as I have no need for it and other tools of that kind, I’m maybe not the best tester for certain edge cases.

Does any of this make sense to you at all? I still can send you a verbose logging version of PinchBar, but maybe you can give me some hints how I could try reproducing your issues so we wouldn’t have to remote debug which is always a hassle. After all, I’d never know what your actual gesture looked like on the trackpad…