Old 04-12-2021, 11:02 AM   #41
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,686
Default

This done, in the debugger I see that the "switch" line is reached multiple times when loading the VST2:

1) index = 45 (is there any documentation on that. )
2) index = 19369999232 (?????)
3) index = 45 (again)
but never 16

does that mean that JUCE v6.x can't handle it ?

I suppose you did test this with compiling to VST2. Could you also do a test with VST3 ?

-Michael
mschnell is offline   Reply With Quote
Old 04-12-2021, 11:08 AM   #42
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,686
Default

Quote:
Originally Posted by Gertius View Post
Have you already tried that?
Nope.

First I wanted to be able to compile your code with JUCE 6.x in the most decent way.
proceeding...

-Michael

Last edited by mschnell; 04-12-2021 at 12:07 PM.
mschnell is offline   Reply With Quote
Old 04-12-2021, 01:29 PM   #43
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,686
Default

Quote:
Originally Posted by Gertius View Post
For the newest JUCE version, this is handled differently and you would have to add this code by reimplementing handleVstPluginCanDo() of the VSTCallbackHandler class, similar to what you already did with handleVstManufacturerSpecific().
OK, I can break at the overloaded function.
But I don't understand what you mean by "matches()"). In JUCE there are several functions called matches, but they don't seem appropriate.

-Michael

Last edited by mschnell; 04-12-2021 at 01:48 PM.
mschnell is offline   Reply With Quote
Old 04-12-2021, 02:38 PM   #44
Gertius
Human being with feelings
 
Join Date: Nov 2012
Posts: 47
Default

I´m quite sure you need to implement the code from my last post, so that Reaper really calls the dispatcher with the right opcode index 16. Basically first you enable manufacturer-specific behavour inhandleVstPluginCanDo(), and then you evaluate it in handleVstManufacturerSpecific().

"matches()" was a helper funtion from the juce_VST_Wrapper.cpp where I took it from. Basically just a stringcompare to evaluate opcodes:

Code:
auto matches = [=](const char* s) { return strcmp (text, s) == 0; };
Yes I did this with compiling for VST2. I tried a quick test for VST3, but the embedded GUI didn´t work, so I did not pursue this further.
Gertius is offline   Reply With Quote
Old 04-12-2021, 02:40 PM   #45
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,686
Default

I replaced the "matches" by my own code and now I do see the "embed" options when right clicking the plugin

But when activating "embed in MCP", it's not shown there

The reason seems to be that the width and height are Zero when trying to display it.


I also compiled it for VST3, but nothing seems to work when loading same in Reaper. I did not do any debugging with that, yet.

Did you try to do a VST3 with your code ?

Thanks,
-Michael

Last edited by mschnell; 04-12-2021 at 03:00 PM.
mschnell is offline   Reply With Quote
Old 04-12-2021, 11:55 PM   #46
Gertius
Human being with feelings
 
Join Date: Nov 2012
Posts: 47
Default

The MCP display vanishes here too, when the plugin area in the mixer track is too small. Maybe that is the problem? You could try to drag the little line between "plugin area" and "sends area" to the bottom to make more space.

Did you also try to show it in TCP for a test? Make sure your track is big enough to display the 240 height, or else it vanishes.

As an alternative, you could modify the bmp->resize() call, and all references to the y-size in my code to a more handleable 80x80.
The size behaviour in TCP/MCP seems to have alot to do with the data in the struct REAPER_FXEMBED_SizeHints, which can be modified to change the behaviour.
I am still investigating that myself, but I already changed my code example on the first page to not use MINMAXINFO anymore, but REAPER_FXEMBED_SizeHints. According to the Reaper Embed FX interface, this is only an alias to MINMAXINFO, but I could not find minimum_aspect or preferred_aspect in MINMAXINFO, which seemsed to be needed to expand the plugin height in MCP mode.

I did only a quick try for VST3, where nothing worked, and so I focussed on VST2.

Last edited by Gertius; 04-13-2021 at 12:36 AM.
Gertius is offline   Reply With Quote
Old 04-13-2021, 05:15 AM   #47
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,686
Default

I'm going on working at this later this day...
What I found is that I get an assertion fault break in VS Code when the VST tries to embed the GUI and for some reason trys to resize to 0/0. Given that repeating break it might be hard to debug. Hence it would be good to avoid resizing to 0. I'll take a look...
Once it works, I'll show the modified source code here, so that you can try it with JUCE 5.x...

Regarding VST3 I'm in a discussion with Xenakios in the JUCE forum. He in fact once did a JUCE patch that allowed for VST3s to communicate with Reaper. He says that the official JUCE still prevents this.

-Michael

Last edited by mschnell; 04-13-2021 at 05:25 AM.
mschnell is offline   Reply With Quote
Old 04-13-2021, 11:27 AM   #48
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,686
Default

Yep. it does show in the TCP and in the MCP it enough space is available.

Great !
-Michael
mschnell is offline   Reply With Quote
Old 04-13-2021, 12:48 PM   #49
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,686
Default

here you are:

www.bschnell.de/test_1.zip
-Michael
mschnell is offline   Reply With Quote
Old 04-13-2021, 02:09 PM   #50
Gertius
Human being with feelings
 
Join Date: Nov 2012
Posts: 47
Default

Awesome, congratulations!
Gertius is offline   Reply With Quote
Old 04-13-2021, 02:46 PM   #51
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,686
Default

Does it work with JUCE 5.x ?

I guess not ... should we do a common code using #if-s ?

-Michael

Last edited by mschnell; 04-13-2021 at 10:30 PM.
mschnell is offline   Reply With Quote
Old 04-14-2021, 12:30 PM   #52
Gertius
Human being with feelings
 
Join Date: Nov 2012
Posts: 47
Default

Thanks for the offer. I´ve looked at your code and I´m sure it won´t work with my old Juce version. I don´t think it´s necessary though to make a combined version, as we are more showing concepts here I guess.
Gertius is offline   Reply With Quote
Old 04-14-2021, 12:37 PM   #53
Gertius
Human being with feelings
 
Join Date: Nov 2012
Posts: 47
Default

I have worked on user input for an embedded FX GUI for JUCE the past days.
First I tried to catch the mouse movement via the given Reaper embed FX interface and forward it to the embedComponent. This doesn´t work unfortunately, as some low-level JUCE test for the existing component fails, when it´s just painted over the bmp.

My second try was to find out where the bmp is on the screen, add the embedComponent as a window to the screen and always move it around with the bmp. This then allows for all user input, that the JUCE component normally has, so that´s great. All in all as a concept it works quite well. Unfortunately the Reaper FX interface does not give information if the bmp is visible or not, so it´s ugly sideffects that the embedComponent may be still lingering on the side of the screen, when scrolling the bmp out of sight or when minimizing Reaper. So it´s a pretty ugly solution and thought more as a concept.
Anyway, here is some example code to illustrate the concept.
EDIT: I just found out that the windows also stay on top of Reaper subwindows, so it´s really ugly and not really usable.
It would be great in the future to get more information about the visibility of the bmp from the Reaper interface, to adjust the component overlay accordingly (position on screen, visibility, visible/covered area...).
On the plus side, really all the features of the JUCE GUI work right out of the box also for the embedded gui, tooltips, mousewheel input, dragging slider etc...

Code:
		switch ((int)opt)
		{
		case 0:
			return 1;

		case WM_CREATE:
			embedComponent->setVisible(true);
			embedComponent->addToDesktop(0);
			embedComponent->setAlwaysOnTop(true);
			return 0;

		case WM_DESTROY:
			embedComponent->setVisible(false);
			embedComponent->removeFromDesktop();
			embedComponent->setAlwaysOnTop(false);
			return 0;

		case WM_GETMINMAXINFO:
			if (ptr)
			{
				REAPER_FXEMBED_SizeHints *mmi = (REAPER_FXEMBED_SizeHints*)ptr;
				mmi->min_width = 80;
				mmi->max_width = 80;

				mmi->min_height = 240;
				mmi->max_height = 240;
				mmi->minimum_aspect = 22016;
				mmi->preferred_aspect = 22016;
			}
			return 1;
		case WM_PAINT:
			if ((void*)value && ptr)
			{
				REAPER_FXEMBED_IBitmap *bmp = (REAPER_FXEMBED_IBitmap*)(void*)value;
				REAPER_FXEMBED_DrawInfo *inf = (REAPER_FXEMBED_DrawInfo*)ptr;
				
				int inf_flags = (int)(INT_PTR)inf->flags;
				if (inf_flags & 1) return 0;

				/* calculate desktop position of BMP by subtracting mouse coordinates relative to bmp from mouse coordinates relative to desktop */
				auto mms = juce::Desktop::getInstance().getMainMouseSource();
				juce::Point<float> mousePosDesktop = mms.getScreenPosition();
				juce::Point<float> mousePosBmp = juce::Point<float>(inf->mouse_x, inf->mouse_y);
				
				juce::Point<float> posBmp = mousePosDesktop - mousePosBmp;
				juce::Point<int> posBmpInt;
				posBmpInt.x = (int)posBmp.x;
				posBmpInt.y = (int)posBmp.y;

                                //set component to position of bmp, like an overlay
                                embedComponent->setTopLeftPosition(posBmpInt);

                                //define borders to make the embedComponent vanish, this is quick and dirty, relating to my 1680x1050 resolution
				int lowerBorder_x = 100;
				int upperBorder_x = 1380;
				int lowerBorder_y = 50;
				int upperBorder_y = 950;
				
				if ((lowerBorder_x <= posBmpInt.x && posBmpInt.x <= upperBorder_x) && (lowerBorder_y <= posBmpInt.y && posBmpInt.y <= upperBorder_y))
						embedComponent->setVisible(true);
					else
						embedComponent->setVisible(false);

				
				return 1;
			}

Last edited by Gertius; 04-14-2021 at 02:01 PM.
Gertius is offline   Reply With Quote
Old 04-14-2021, 03:02 PM   #54
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,686
Default

Funny "side effect" even with the version I have:

When I add ReaEQ to the same track and activate as well the JUCE plugin as ReaEQ for being embedded in the MCP, ReaEQ sits on top of the JUCE GUI instead of below it.
Maybe a Reaper bug, as the area for embedded plugin GUIs seems high enough.

If ReqEQ is before the JUCE VST in the chain, the display seems OK, though.

And moreover:
if both are embedded in TCP, both vanish it the track is not high enough for the JUCE plugin. If same is deleted, ReaEQ resizes correctly.

I suppose the JUCE GUI needs to be enabled to auto-resize decently. No idea how to do that (supposedly JUCE VST3s do that out of the box.)

-Michael

Last edited by mschnell; 04-14-2021 at 10:23 PM.
mschnell is offline   Reply With Quote
Old 04-15-2021, 12:04 AM   #55
Gertius
Human being with feelings
 
Join Date: Nov 2012
Posts: 47
Default

Ah, interesting, I hadn't tried that.

The size behaviour in TCP/MCP seems to have alot to do with the data in the struct REAPER_FXEMBED_SizeHints, which can be modified to change the behaviour.
Also I've found a switch in the Projucer for the guiComponent "isResizable".
Lastly, I would guess that you'd have to implement the resize() function of the embedComponent for it to scale properly, but I haven't really looked into it.
Gertius is offline   Reply With Quote
Old 04-15-2021, 05:55 AM   #56
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,686
Default

Quote:
Originally Posted by Gertius View Post
Lastly, I would guess that you'd have to implement the resize() function of the embedComponent for it to scale properly, but I haven't really looked into it.
I don't really understand

Do you mean the "NewComponent" in your code.

here you did override/implement resized() which seems appropriate, but maybe a lot more needs to be done there.

-Michael
mschnell is offline   Reply With Quote
Old 04-15-2021, 05:57 AM   #57
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,686
Default

Anyway I suppose many problems could be solved when doing a VST3.

But I suppose the current JUCE version can't do that without some modification, as handleVstPluginCanDo() and handleVstManufacturerSpecific() never are called.
-Michael

Last edited by mschnell; 04-15-2021 at 06:03 AM.
mschnell is offline   Reply With Quote
Old 04-17-2021, 06:44 AM   #58
Gertius
Human being with feelings
 
Join Date: Nov 2012
Posts: 47
Default

I have made some progress with user input from a JUCE embedded GUI.
It has become kind of a hack, but for my purposes it´s sufficient.
I guess it wouldn´t be suited for a product though.
Anyway, for anyone who´s interested:
I place the embedded Component in a separate top level window on the desktop in the WM_MOUSEMOVE case, at the position of the given bmp. you can use this for all user input as with any JUCE GUI. it is placed on a mouseMove event over the bmp and so it appears when you mouse over the given area. Unfortunately it catches all mouseEvents, so I cannot check for the mouse exiting the bmp to make it disappear. That´s why I connect a timer to make it disappear every time after 1 sec. if the mouse stays in the area it will just reappear.
- I also create an image snapshot of the component in the WM_PAINT case, and paint it on the bmp given by Reaper. So, visually it´s no difference if the real component is there or just the image.
- the only drawback I can see, is that the component would be placed on top of all other windows, which might be ugly. In practice it´s no problem for me.
I attach the relevant source code from my processor class, and also a gif to show the functionality.
Cheers!

Code:
pointer_sized_int ReaperGuiembed_testAudioProcessor::handleVstManufacturerSpecific(int32 index, pointer_sized_int value, void* ptr, float opt)
{
	if (index == plugInOpcodeDrawEditor)
	{
		switch ((int)opt)
		{
		case 0:
			return 1;

		case WM_GETMINMAXINFO:
			if (ptr)
			{
				REAPER_FXEMBED_SizeHints *mmi = (REAPER_FXEMBED_SizeHints*)ptr;
				mmi->min_width = 80;
				mmi->max_width = 80;

				mmi->min_height = 240;
				mmi->max_height = 240;
				mmi->minimum_aspect = 22016;
				mmi->preferred_aspect = 22016;
			}
			return 1;

/*
		case WM_LBUTTONDBLCLK:
		case WM_LBUTTONDOWN:
		case WM_LBUTTONUP:
		case WM_RBUTTONDOWN:
		case WM_RBUTTONUP:
*/
		case WM_MOUSEMOVE:
		if (ptr)
		{
			REAPER_FXEMBED_DrawInfo *inf = (REAPER_FXEMBED_DrawInfo*)ptr;
			POINT pt = { inf->mouse_x, inf->mouse_y };
			juce::Point<float> ptJuce = juce::Point<float>(inf->mouse_x, inf->mouse_y);

			Desktop &desktop = juce::Desktop::getInstance();
			auto mms = desktop.getMainMouseSource();
			auto ev = juce::MouseEvent(mms, ptJuce, 0, 0, 0, 0, 0, 0, embedComponent, embedComponent, Time(0), ptJuce, Time(0), 1, false);

			int w = inf->width, h = inf->height;
			if (inf->mouse_x < 0 || inf->mouse_y < 0)
				return 1;

			juce::Point<float> ptDesktop = mms.getScreenPosition();

			// calculate desktop position of BMP 
			juce::Point<float> mousePosDesktop = mms.getScreenPosition();
			juce::Point<float> mousePosBmp = juce::Point<float>(inf->mouse_x, inf->mouse_y);

			//posBmp = mousePosDesktop-mousePosBmp
			juce::Point<float> posBmp = mousePosDesktop - mousePosBmp;
			juce::Point<int> posBmpInt;
			posBmpInt.x = (int)posBmp.x;
			posBmpInt.y = (int)posBmp.y;
			//posBmpInt.x = (int)0;
			//posBmpInt.y = (int)0;

			int lowerBorder_x = 0;
			int upperBorder_x = w;
			int lowerBorder_y = 0;
			int upperBorder_y = h;

			if ((lowerBorder_x < pt.x && pt.x < upperBorder_x) && (lowerBorder_y < pt.y && pt.y < upperBorder_y))
			{
				embedComponent->setTopLeftPosition(posBmpInt);

				embedComponent->setVisible(true);
				embedComponent->addToDesktop(0);
				embedComponent->setAlwaysOnTop(true);
				startTimer(1000);
			}
			else
			{
				embedComponent->setVisible(false);
				embedComponent->removeFromDesktop();
				embedComponent->setAlwaysOnTop(false);
			}
		}
		return 1;

		case WM_PAINT:
			if ((void*)value && ptr)
			{
				REAPER_FXEMBED_IBitmap *bmp = (REAPER_FXEMBED_IBitmap*)(void*)value;
				REAPER_FXEMBED_DrawInfo *inf = (REAPER_FXEMBED_DrawInfo*)ptr;
				//inf->context = 2; //MCP

				bmp->resize(80, 240);
				int inf_flags = (int)(INT_PTR)inf->flags;
				//int w = inf->width, h = inf->height;

				//if ((inf_flags & 1) && !m_ui_dirty) return 0;
				if (inf_flags & 1) return 0;
				
				//copy img->bmp;
				Image img(juce::Image::PixelFormat::ARGB, bmp->getWidth(), bmp->getHeight(), true);
				Graphics g(img);

				embedComponent->paintEntireComponent(g, false);

				unsigned int* px = bmp->getBits();

				for (int x = 0; x < bmp->getWidth(); x++)
					for (int y = 0; y < bmp->getHeight(); y++)
					{
						px[y * bmp->getRowSpan() + x] = (img.getPixelAt(x, y)).getARGB();
					}


				return 1;
			}
			return 0;
		}

		return 0;
	}
};

void ReaperGuiembed_testAudioProcessor::timerCallback()
{
	embedComponent->setVisible(false);
	embedComponent->removeFromDesktop();
	embedComponent->setAlwaysOnTop(false);
	stopTimer();
};
Attached Images
File Type: gif ReaperEmbedFXJuce.gif (56.2 KB, 84 views)
Gertius is offline   Reply With Quote
Old 04-17-2021, 01:20 PM   #59
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,686
Default

Thanks !

Any progress with the resizing issues ?

IMHO, the size of the GUI copy somehow needs to be adopted to the frame Reaper provides for it in the MCP or TCP.
-Michael
mschnell is offline   Reply With Quote
Old 04-17-2021, 01:33 PM   #60
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,686
Default

Can't compile the mouse sections because "StartTimer()" is not defined in my project.

-Michael
mschnell is offline   Reply With Quote
Old 04-17-2021, 02:12 PM   #61
Gertius
Human being with feelings
 
Join Date: Nov 2012
Posts: 47
Default

I thought the code as an excerpt of the most important stuff.
You would need to derive your processor class also from juce::Timer and possibly also declare void ReaperGuiembed_testAudioProcessor::timerCallback() in your processor header file to use the functions. Other than that I guess it should work.

I did not continue work on the resizing issue, because it's not important to my project. But if you should solve it, I would be interested in your solution!
Gertius is offline   Reply With Quote
Old 04-17-2021, 10:34 PM   #62
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,686
Default

First we should consolidate our source files and work with the current JUCE version.


-Michael
mschnell is offline   Reply With Quote
Old 04-18-2021, 03:57 AM   #63
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,686
Default

Quote:
Originally Posted by Gertius View Post
I did not continue work on the resizing issue, because it's not important to my project. But if you should solve it, I would be interested in your solution!
I took a look but found that I am lacking a lot of information.

Please tell me where you found the description on the VST API extension Reaper uses for this task. I suppose here we will find how Reaper communicates the size of the frame in the TCP / MCP towards the VST.

Edit: hopefully all necessary information is in reaper_plugin_fx_embed.h

Edit: I don't find anything about getting the size of the frame, but instead you can define the aspect, min width and height. Any idea how to use this ?

-Michael

Last edited by mschnell; 04-18-2021 at 06:19 AM.
mschnell is offline   Reply With Quote
Old 04-18-2021, 07:52 AM   #64
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,686
Default

With this it works better:

Code:
/* Struct pointed to by WM_GETMINMAXINFO lParam
typedef struct tagMINMAXINFO {
    POINT ptReserved;
    POINT ptMaxSize;
    POINT ptMaxPosition;
    POINT ptMinTrackSize;
    POINT ptMaxTrackSize;
} MINMAXINFO, *PMINMAXINFO, *LPMINMAXINFO;
*/
                mmi->ptReserved.x     = 0;          //preferred_aspect
                mmi->ptReserved.y     = 0;          //minimum_aspect
                mmi->ptMaxSize.x      = 0;          // _res1
                mmi->ptMaxSize.y      = 0;          // _res2
                mmi->ptMaxPosition.x  = 0;          // _res3
                mmi->ptMaxPosition.x  = 0;          // _res4
                mmi->ptMinTrackSize.x = 80;         // min_width
                mmi->ptMinTrackSize.y = 90;         // min_height
                mmi->ptMaxTrackSize.x = 100;        // max_width
                mmi->ptMaxTrackSize.y = 110;        // max height


...


                bmp->resize(80, 90);
But a very funny effect is that the paint seemingly overwrites stuff that is below (e.g. a ReaEQ embedded GUI) when the mouse is hovered above our embedded thingy.
Seemingly somewhere still the old height of 240 appears, which is the size of the original editor window.

this even happens when I do
// embedComponent->paintEntireComponent(g, false);
Now normally a black but correctly sized embedded image is painted, but when mous hovering above it, the original Editor window with big height is painted in the MCP. And it even stays there fully functional even if the Mixer is not displayed any more and stays at that screen location when Reaper is moved somewhere else.

-Michael

Last edited by mschnell; 04-18-2021 at 08:11 AM.
mschnell is offline   Reply With Quote
Old 04-18-2021, 03:39 PM   #65
gxray
Human being with feelings
 
Join Date: Dec 2020
Location: Miami, FL USA
Posts: 396
Default

Quote:
Originally Posted by mschnell View Post
Regarding VST3 I'm in a discussion with Xenakios in the JUCE forum. He in fact once did a JUCE patch that allowed for VST3s to communicate with Reaper. He says that the official JUCE still prevents this.

-Michael
Have confirmed this is the case, burned a few hours poking around JUCE source.

You can see why this is if you look at "juce_audio_plugin_client/VST3/juce_VST3_Wrapper.cpp".

JUCE hides all the implementation details from the end-user, when you create an AudioProcessor, the backing wrapper implements the specific framework's bidding. But it doesn't provide any options for implementing a callback to override or customize initialization behavior.

IE, you cannot gain access to the raw VST3 interfaces like the host context.

I brought it up with one of the JUCE devs on Discord. After some conversation he said he would potentially implement support for the particular interfaces REAPER needs for GUI FX embedding in VST3 in a few weeks.



If you modify the constructor here, just to call a new function "AudioProcessor::initializeHost()" if it exists (when it's a VST3 audio processor), and pass in the VST host context, I'm pretty sure that it would technically give you everything you need to do this:





Just putting garbage here so it shows up, you would put this in your actual instance not the class:



Robbert van der Helm says this should work in theory:

__________________
Seasoned codemonkey
Dunno a thing about making music (here to learn!)

Last edited by gxray; 04-18-2021 at 03:44 PM.
gxray is offline   Reply With Quote
Old 04-18-2021, 03:55 PM   #66
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,686
Default

Seem really interesting !
What exactly is the Host Context ?

Thanks !

-Michael
mschnell is offline   Reply With Quote
Old 04-19-2021, 02:26 PM   #67
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,686
Default

Quote:
Originally Posted by Gertius View Post
I did not continue work on the resizing issue, because it's not important to my project. But if you should solve it, I would be interested in your solution!
This:
Code:
                REAPER_FXEMBED_SizeHints *mmi = (REAPER_FXEMBED_SizeHints*)ptr;
                mmi->min_width  = 80;
                mmi->min_height = 90;
                mmi->max_width  = 100;
                mmi->max_height = 110;
                mmi->preferred_aspect = 0;
                mmi->minimum_aspect   = 0;
is more appropriate regarding setting the size

Not sizable, yet, and still mouse-over very funny stuff happens, if your "mouse" case is enabled

-Michael

Last edited by mschnell; 04-20-2021 at 02:02 PM.
mschnell is offline   Reply With Quote
Old 04-20-2021, 02:02 PM   #68
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,686
Default

Quote:
Originally Posted by mschnell View Post
mouse-over very funny stuff happens, if your "mouse" case is enabled
I now see that I need to disable the on-top window in the timer callback

Nice !
-Michael
mschnell is offline   Reply With Quote
Old 04-20-2021, 02:06 PM   #69
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,686
Default

But now another surprise:

in the MCP the rotary follows that in the FX chan, in the TCP the rotary is stuck.

-Michael
mschnell is offline   Reply With Quote
Old 04-21-2021, 03:56 AM   #70
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,686
Default

Quote:
Originally Posted by mschnell View Post
I now see that I need to disable the on-top window in the timer callback
Moreover supposedly in most cases it makes sense to resize it to the normal size of the embedded GUI.

@gxray: I suppose we should synchronize our sources soon to be able to publish a decent version.
-Michael

Last edited by mschnell; 04-21-2021 at 09:34 AM.
mschnell is offline   Reply With Quote
Old 04-21-2021, 09:35 AM   #71
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,686
Default

@gxray: I fail to find out how the slider positions in the embedded and the "normal" GUI are synchronized.
-Michael
mschnell is offline   Reply With Quote
Old 04-22-2021, 03:58 AM   #72
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,686
Default

BTW.:

Why do we need the bmp (pixel) copy of the embedded window instead of the embedded version of a GUI (which right now only is show when the mouse hovers above it) ?

-Michael
mschnell is offline   Reply With Quote
Old 04-22-2021, 06:15 AM   #73
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,686
Default

BTW/2:

Question to C++ experts:

I am, coming up to speed with using the Reaper API in a Juce VST2.

In several places I found the hint that I can do:
void (*someFunction)();
*(long *)&someFunction = hostcb(NULL,0xdeadbeef,0xdeadf00d,0,"someFunction" ,0.0);


In Juxce 6.x I can obtain hostcb 1 by
std::function<VstHostCallbackType>&& hostcb = NULL;
void ReaperGuiembed_testAudioProcessor::handleVstHostCa llbackAvailable (std::function<VstHostCallbackType>&& callback) { hostcb = callback;}

But with this, hostcb is a function with 5 parameters and not with 6 as suggested in the example above.

By simply not providing the fist parameter (NULL) it seems to work.

But I am a bit confused as this might suggest an error on my site.

-Michael
mschnell is offline   Reply With Quote
Old 04-23-2021, 06:08 AM   #74
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,686
Default

I asked in the JUCE forum and found that the missing parameter is automatically set correctly in the JUCE library when communicating with the VST API.

-Michael
mschnell is offline   Reply With Quote
Old 04-24-2021, 01:25 PM   #75
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,686
Default

BTW.: something you can obtain via hostcb (with the hidden parameter set appropriately) is the ReaProject class.

Maybe I'll never need that, but it's peculiar, that no definition of that class seems to be available.

In fact I intend to find the folder where plugins usually save their configuration files. (i.e. e.g. "c:\Users\Michael Schnell\AppData\Roaming\REAPER\Data"). Which of the 810 available API calls (yep: getting those does work just fine ) might help ?

-Michael
mschnell is offline   Reply With Quote
Old 04-25-2021, 01:47 PM   #76
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,686
Default

@gxray:

I'd really like to provide the sources of the upgraded version of the project.

But first I'd like to either understand why the "bmp" display is necessary, or to get rid of same and always display the "normal" secondary GUI.

-Michael

Last edited by mschnell; 04-26-2021 at 10:05 PM.
mschnell is offline   Reply With Quote
Old 04-26-2021, 04:04 PM   #77
gxray
Human being with feelings
 
Join Date: Dec 2020
Location: Miami, FL USA
Posts: 396
Default

Quote:
Originally Posted by mschnell View Post
@gxray:

I'd really like to provide the sources of the upgraded version of the project.

But first I'd like to either understand why the "bmp" display is necessary, of to get rid of same tand always display the "normal" secondary GUI.

-Michael
> Why do we need the bmp (pixel) copy of the embedded window instead of the embedded version of a GUI (which right now only is show when the mouse hovers above it) ?

Unfortunately, the only way you will get answers to a lot of this stuff is if Justin/schwa feel like offering answers, or if you can find something in their post history.

There are a few other folk that might know more about the innards of how this works -- but the only other person I know of is Oli Larkin (author of iPlug2).

At one point iPlug2 had a branch where plugins had embedded REAPER TCP FX support automatically as an opt-in feature. You can find a screenshot of his here on the forums somewhere, I can't remember how I stumbled across it.

------

There's one reason why I haven't engaged as much/been as interested in the VST2 too versus VST3.

Steinberg stopped signing granting new licenses for VST2 usage in (I believe) October 2018. If you didn't already have a license, you can never get one.

Technically, this legally means that I am not allowed to use or develop with the VST2 SDK. I don't actually care that much, but if they're trying to strangle VST2 this hard I'm not sure how long the lifespan on it is.

My plan is just to keep politely checking back in with the JUCE devs every so often and asking whether they've had dev cycles to add support for the VST3 interfaces for this.

------

About the ReaProject type -- there are a little over 100 functions it's usable with. The way it's declared as a class in "reaper_plugin_functions.h" is more like an opaque type/pointer.

It's sort of like doing this:
Code:
#define HWND void*
(Not that it's a void ptr, it's probably actually really a class or struct, but there's no published surface API so the purpose it serves may as well be identical)
__________________
Seasoned codemonkey
Dunno a thing about making music (here to learn!)
gxray is offline   Reply With Quote
Old 04-26-2021, 10:16 PM   #78
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,686
Default

Re VST3:

The current situation is really frustrating, as VST2 is not available for new developers, but nicely supported by JUCE, and VST3 is not yet supported by JUCE. Funny enough there is a fork for JUCE using LV2, but not a complete implementation of VST3. I don't dare to start a fork that enhances VST3 appropriately. Xenakios, who once did exactly this, seems to have strong reasons for not actively supporting such endeavor.
You might have seen that I pointed this out in the JUCE forum, but no positive reactions from the JUCE team yet. Maybe you'd like to start yet another thread on that issue over there, to show the urgency of the issue.

I'll try if I find a way to get rid of the bmp stuff...

I don't think I actually need the ReaProject definition, as reaper_plugin_functions.h nicely provides encapsulation of all the currently 810 API functions easily ready to be called after a simple initialization.

Thanks again,
-Michael

Last edited by mschnell; 04-27-2021 at 06:29 AM.
mschnell is offline   Reply With Quote
Old 04-27-2021, 03:48 AM   #79
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,686
Default

Quote:
Originally Posted by mschnell View Post
I'll try if I find a way to get rid of the bmp stuff..
Seemingly "getting rid of the bmp stuff" is not possible, as this is the picture Reaper displays and it is provided by same, and it's only filled by the VST's code.

It seems not to be possible to have reaper display something else than such a bit map.
Hence the original code (i.e. filling the bitmap when appropriate and overlaying same for a limited amount of time by an "active" GUI snippet when it needs to be "activated" / handled by the mouse, seems necessary.

Also the funny way to get the position of that frame (via the mouse pointer) seems unavoidable.
-Michael

Last edited by mschnell; 04-27-2021 at 06:31 AM.
mschnell is offline   Reply With Quote
Old 04-27-2021, 10:35 AM   #80
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,686
Default

After done with porting the original code by gxray to JUCE 6 and doing some (hopefully ) optimization and beatifying (e.g. getting rid of the Windows header file), I uploaded a new version to the stash.
-> https://stash.reaper.fm/41907/embedded_plugin.zip
Please come back with any comments...
-Michael

Last edited by mschnell; 04-27-2021 at 01:24 PM.
mschnell is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 08:52 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.