olilarkin / wdl-ol

Enhanced version of Cockos' iPlug - A simple-to-use C++ framework for developing cross platform audio plugins and targeting multiple plugin APIs with the same code. VST / VST3 / Audiounit / RTAS / AAX (Native) formats supported. NOTE: THIS IS OBSOLETE, PLEASE SEE IPLUG2:
https://github.com/iplug2
936 stars 187 forks source link

Keyboard input causing "Alert" noise/beep in Windows #118

Open scottmudge opened 6 years ago

scottmudge commented 6 years ago

So I've created an OpenGL interface control as a child of the IControl class, which uses GLFW to create a context, and then an immediate-mode GUI backend to create user interface elements.

Because I am unable to create a new window handle and latch the input function callbacks to that as GLFW typically does, I'm simply overriding the in-built input virtual functions (OnMouseDown, OnMouseUp, OnKeyDown, etc), and then passing that data to my OpenGL GUI.

I'm able to successfully pass the mouse input to the UI, but I am having problems passing the keyboard input.

I can capture the key data fine using OnKeyDown (though I cannot get Ctrl/Alt/Shift, etc), but every time I hit a key, Windows creates the "Alert" beep/noise, and I can't stop it.

How can I appropriately capture keyboard input without having Windows throw a fit?

olilarkin commented 6 years ago

is this in a standalone app or plugin?

scottmudge commented 6 years ago

Standalone app, the plugin variants work fine.

I think the problem lies in the fact that there is no edit control for the input to be focused into. All that exists is the child plugin window. I think creating an invisible editable control to the parent window would fix the problem.

Ideally I would like to get rid of the menu bar and parent window entirely, since the about window and settings will be taken care of by the secondary UI. I would just show the plugin window as a WS_OVERLAPPED style window, but that seems like a lot of modification to make. Especially since I would still like to use the accessory functions, like being able to request files, etc.

olilarkin commented 6 years ago

i would try putting a breakpoint here https://github.com/olilarkin/wdl-ol/blob/master/IPlugExamples/IPlugEffect/app_wrapper/app_dialog.cpp#L564

perhaps these keys need to be caught and forwarded

scottmudge commented 6 years ago

Hi Oli,

Well if I change the plugin window from WS_CHILD to WS_OVERLAPPED, the beeping/alert noise stops. Of course, doing so causes the child plugin window to be a new, detached window, which is undesirable.

I think what I'll end up doing is catching all the input in the main dialog wrapper in the file you mentioed to prevent the alert tone, and then use the gainput library to act as a cross-platform input interface. This will also allow me to interface better with touch-screens, providing better future portability to android and ios.

olilarkin commented 6 years ago

interested to see what you do with GLFW...

scottmudge commented 6 years ago

Hey I sent you an email about iPlug2. My private email server is often flagged as spam (I think spammers use my host's shared smtp server?), just thought I'd let you know just in case.