mikeoliphant / AudioPlugSharp

Easily create VST (VST3) audio plugins in C# .NET
MIT License
177 stars 21 forks source link

Using Other Controls #9

Closed MOAMaster closed 2 years ago

MOAMaster commented 2 years ago

Mike,

I really need to able to manipulate the EditorView to add and process other controls, such as graphic windows, buttons, dropdowns, textbox, etc.

I finally was able to do that. I had to add about a dozen lines across 5 files to make the grid and the parameterdisplay accessible to the plugin. Finally implemented that and added a textblock and button example to the WPF file. Also, added a button handler to the button. The button handler accesses the content property of the button, showing that you can use the "value" of any control you have placed in the grid within the Process method.

Would you like the files? would be a pretty powerful feature to add to your wrapper class.

Bruce Krell

mikeoliphant commented 2 years ago

Hi Bruce - this seems more about WPF and outside of my desired scope for AudioPlugSharp.

MOAMaster commented 2 years ago

Mike,

Your layer is very limited if you can only use the dials you offered.

Look at the VSTs that are available.

The programmer needs to be able to include text labels, buttons, comboboxes and plot areas.

In order to be able to provide this, you have to provide the ability for the programmer to add those features

to the editor. I already have test code that does all of this in a test plugin.

In your version, that can not be done.

I HAD to add about 12 lines of code in multiple modules to enable a plugin developer

to add those features. THE CHANGES WERE TO YOUR MODULES NOT WPF.

I had to make your EditorView, ParameterDisplay and Grid visible to the plugin,

which you do not currently do in a way that enables enhancements like I described

above.

This is not a WPF issue. All the changes are in your layer.

If you don’t want to do this, I’ll make my own repository with your code and my additions.

I’ll call it the enhanced version.

Your shortsightedness is disappointing and very restricting to programmers.

I know you want to help but providing such a crippled, limited tool will not be helpful.

Why not do the right thing here?

From: Mike Oliphant @.> Sent: Friday, January 21, 2022 6:41 PM To: mikeoliphant/AudioPlugSharp @.> Cc: MOAMaster @.>; Author @.> Subject: Re: [mikeoliphant/AudioPlugSharp] Using Other Controls (Issue #9)

Hi Bruce - this seems more about WPF and outside of my desired scope for AudioPlugSharp.

— Reply to this email directly, view it on GitHub https://github.com/mikeoliphant/AudioPlugSharp/issues/9#issuecomment-1019022865 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AE2KTWVAEHTSZSPBJ4EICNTUXIKM5ANCNFSM5MLWEQFA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub . You are receiving this because you authored the thread. https://github.com/notifications/beacon/AE2KTWVSPN77OU2PPKZIUGDUXIKM5A5CNFSM5MLWEQFKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOHS6Q4EI.gif Message ID: @. @.> >

mikeoliphant commented 2 years ago

Bruce, there is nothing preventing you from creating as complex a WPF interface as you like without requiring any changes to the underlying AudioPlugSharp library. I do this myself in my own plugins. Here is an example:

https://1.bp.blogspot.com/-098dD8u_TYc/X6G6QPj6tFI/AAAAAAAAJtc/l7Y4fxZ0gMYbQeGM9fPy3i-GeD5i9-lmwCLcBGAsYHQ/s1047/GuitarSim.png

You simply provide your own WPF control for the editor by overriding GetEditorView. This control could inherit from EditorView, but does not have to.

I have spent a lot of time over the past moth responding to your various questions, and my patience is running thin.

MOAMaster commented 2 years ago

Can you send me a code skeleton – a small piece of code that shows how you can

implement a control in the overridden GetEditorView?

I can implement, but don’t see how to link the control to the Grid and ParameterDisplay.

I had to add some code to make those available so I could position your ParameterDisplay

with the Knobs in the grid with the new components I created.

I don’t see how to do that as the Grid and ParameterDisplay were not available to me

without naming them and populating the references to them upward.

Would really like to see how you do that in the overridden function.

Yes, I implemented the override but don’t see how to get at the Grid,

which is currently unnamed and the parameterdisplay which is also unnamed.

Thanks.

Bruce

From: Mike Oliphant @.> Sent: Friday, January 21, 2022 7:32 PM To: mikeoliphant/AudioPlugSharp @.> Cc: MOAMaster @.>; Author @.> Subject: Re: [mikeoliphant/AudioPlugSharp] Using Other Controls (Issue #9)

Bruce, there is nothing preventing you from creating as complex a WPF interface as you like without requiring any changes to the underlying AudioPlugSharp library. I do this myself in my own plugins. Here is an example:

https://1.bp.blogspot.com/-098dD8u_TYc/X6G6QPj6tFI/AAAAAAAAJtc/l7Y4fxZ0gMYbQeGM9fPy3i-GeD5i9-lmwCLcBGAsYHQ/s1047/GuitarSim.png

You simply provide your own WPF control for the editor by overriding GetEditorView. This control could inherit from EditorView, but does not have to.

I have spent a lot of time over the past moth responding to your various questions, and my patience is running thin.

— Reply to this email directly, view it on GitHub https://github.com/mikeoliphant/AudioPlugSharp/issues/9#issuecomment-1019032322 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AE2KTWTT5CEXRQ7YSNYBELTUXIQKTANCNFSM5MLWEQFA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub . You are receiving this because you authored the thread. https://github.com/notifications/beacon/AE2KTWSX7MXUEHS662LHBMTUXIQKTA5CNFSM5MLWEQFKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOHS6TGAQ.gif Message ID: @. @.> >

mikeoliphant commented 2 years ago

Have a look here:

https://github.com/dsharlet/LiveSPICE

in particular, the VST plugin:

https://github.com/dsharlet/LiveSPICE/tree/master/LiveSPICEVst

MOAMaster commented 2 years ago

Thanks.

Trying to work out a simple example now.

Will look at this to understand.

I am sorry that you think I am a pain.

I really appreciate the amount of work you did and your willingness to share.

I know you aren’t much interested in suggestions, but I’ll make this one anyhow.

Create one more WPF example.

This one should override GetEditorView, create a new EditorView,

add a simple control (a button with a hello world click handler) and

return the new editor view. No parameters of your predefined parameter class.

You can handle your own variables and use handlers to update the variables

in response to GUI controls.

That would show how to develop your own interface with a simple example. Then, no one else has to go through the extended work like I did.

By the way, a spent a lot of time in your various wrappers.

Don’t think I know as well as you but I do understand large

parts of your wrappers. You do an excellent job of hiding a lot

of ugly details. If the software guys at Steinburg had put some

thought into the SDK, they could have easily designed it work

as simply as your C# wrappers, even in C++. I have done that

many times over the years.

Best Regards, Bruce

From: Mike Oliphant @.> Sent: Saturday, January 22, 2022 8:30 AM To: mikeoliphant/AudioPlugSharp @.> Cc: MOAMaster @.>; Author @.> Subject: Re: [mikeoliphant/AudioPlugSharp] Using Other Controls (Issue #9)

Have a look here:

https://github.com/dsharlet/LiveSPICE

in particular, the VST plugin:

https://github.com/dsharlet/LiveSPICE/tree/master/LiveSPICEVst

— Reply to this email directly, view it on GitHub https://github.com/mikeoliphant/AudioPlugSharp/issues/9#issuecomment-1019303461 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AE2KTWTUBA7R5DLKVDIUBWDUXLLQXANCNFSM5MLWEQFA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub . You are receiving this because you authored the thread. https://github.com/notifications/beacon/AE2KTWQQRB3QJKKMO5XDUQLUXLLQXA5CNFSM5MLWEQFKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOHTAVMJI.gif Message ID: @. @.> >

MOAMaster commented 2 years ago

Sorry to bug you, but I seem to be having a problem with this.

So, I thought I’d see if you could help me with implementing this.

I have studied your code that you sent.

Here is what I did.

I copied WPFExample into a new project.

Built and deployed, works just fine.

Created WPF User Control Library. in the user control xaml file, Changed the Grid to a Canvas, gave the canvas a name.

In the user control cs file, added a public parameter to hold a reference to named canvas in the user control.

In the constructor in the cs file, saved the named canvas into the public parameter of the user control.

I tested and this all works fine.

I went to the WPFExample plugin cs file.

Commented out the parameter declarations.

In the process method, commented out the calls to get the parameters.

Replaced them with hardcoded values.

Created a plugin class member to hold a reference to the canvas of the user control.

Overrode GetEditorView

In this method, created a new instance of the user control.

Saved the reference into the class member.

Then, returned the reference to the class member.

I noticed you passed a reference to the plugin back to the user control,

so you could place the child controls in the view. I am choosing to retain

a reference to the canvas of the user control and to place the child controls

onto the canvas from the plugin. I looked at your implementation and don’t

see that drawing in user control is required by your wrappers. So, that is

a design decision, either way should work.

If you have to send a reference for the plugin back into the view because

of something else in the wrappers, let me know. But I looked in AudioPluginWPF

and don’t see any need for it.

Haven’t attached any child controls.

This looks like all I had to do from studying your code.

Now the fun begins.

I verify that the GetEditorView is executed.

I verify that the user control is created with the named canvas as a child.

But, when GetEditorView returns the reference to the user control,

blam, the user control crashes.

I have studied your code quite a bit but don’t see what I could be missing.

I know that you may not be able to tell much from my description but it

looks like I am doing all I need to be doing based on the example you sent me.

Any idea what I could be doing wrong here?

Thanks for any help.

Bruce

From: Mike Oliphant @.> Sent: Saturday, January 22, 2022 8:30 AM To: mikeoliphant/AudioPlugSharp @.> Cc: MOAMaster @.>; Author @.> Subject: Re: [mikeoliphant/AudioPlugSharp] Using Other Controls (Issue #9)

Have a look here:

https://github.com/dsharlet/LiveSPICE

in particular, the VST plugin:

https://github.com/dsharlet/LiveSPICE/tree/master/LiveSPICEVst

— Reply to this email directly, view it on GitHub https://github.com/mikeoliphant/AudioPlugSharp/issues/9#issuecomment-1019303461 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AE2KTWTUBA7R5DLKVDIUBWDUXLLQXANCNFSM5MLWEQFA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub . You are receiving this because you authored the thread. https://github.com/notifications/beacon/AE2KTWQQRB3QJKKMO5XDUQLUXLLQXA5CNFSM5MLWEQFKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOHTAVMJI.gif Message ID: @. @.> >

MOAMaster commented 2 years ago

I think I found the problem – loose nut on the wheel, me!

I had made some code changes to push the view outwards, not knowing about the ability to override GetEditorView.

Those changes assumed that I was working around your Grid and Parameters.

Since they are not components in the overridden editor view, the code was blowing up.

I just commented out the calls to my changes, and the blowup stopped.

Hmmm, like I said, loose not on the wheel.

Thanks.

Bruce

From: Mike Oliphant @.> Sent: Saturday, January 22, 2022 8:30 AM To: mikeoliphant/AudioPlugSharp @.> Cc: MOAMaster @.>; Author @.> Subject: Re: [mikeoliphant/AudioPlugSharp] Using Other Controls (Issue #9)

Have a look here:

https://github.com/dsharlet/LiveSPICE

in particular, the VST plugin:

https://github.com/dsharlet/LiveSPICE/tree/master/LiveSPICEVst

— Reply to this email directly, view it on GitHub https://github.com/mikeoliphant/AudioPlugSharp/issues/9#issuecomment-1019303461 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AE2KTWTUBA7R5DLKVDIUBWDUXLLQXANCNFSM5MLWEQFA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub . You are receiving this because you authored the thread. https://github.com/notifications/beacon/AE2KTWQQRB3QJKKMO5XDUQLUXLLQXA5CNFSM5MLWEQFKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOHTAVMJI.gif Message ID: @. @.> >