VST3 UI problems

DSP, Plugin and Host development discussion.
Post Reply New Topic
RELATED
PRODUCTS

Post

AUTO-ADMIN: Non-MP3, WAV, OGG, SoundCloud, YouTube, Vimeo, Twitter and Facebook links in this post have been protected automatically. Once the member reaches 5 posts the links will function as normal.
Hi,

i started developing a software synth for fun and education (as a software developer and hobbyist musican). Unfortunately documentation for vst developement ist pretty rare.
I use this UIDescriptionm Editor for the UI. Works pretty well for now, but now I'm struggeling with cutom UI controls:
I want to create a control where I can manipulte (for example) an ADSR curve with the mouse.

Time for questions:
* is the "Knob" control in UIDescription Editor an instance of VSTGUI::CKnobBase?
* if I inherit a class from CKnobBase how can i get access to this custom class in the UIDescription Editor?
* for mouse control I overloaded the function VST3Editor::onMouseMoved. But i only get the mouse pos inside this whole plugin window. How can I listen to Events triggered by specified (custom)controls?
* how can i display realtime graphics? For example: If i manipulate an evelope with my mouse I want so display this. My thoughts: create a new Bitmap (or ven better I use a Bitmap created in the UIDescription Editor) and "just" manipulate it via lockPixels:

Code: Select all (#)

		{
			CBitmap* bitmap = new CBitmap("control.png");
			CView* myView = new CView(CRect(0, 0, bitmap->getWidth(), bitmap->getHeight()));

			if (bitmap != nullptr || bitmap->getPlatformBitmap() != nullptr)
			{
				bool alphaPremultiplied = false;
				auto pixelAccess = bitmap->getPlatformBitmap()->lockPixels(alphaPremultiplied);
				
				if (pixelAccess != nullptr)
				{
					CBitmapPixelAccess* result = nullptr;
					switch (pixelAccess->getPixelFormat())
					{
					case IPlatformBitmapPixelAccess::kARGB: result = new CBitmapPixelAccessOrder<1, 2, 3, 0>(); break;
					case IPlatformBitmapPixelAccess::kRGBA: result = new CBitmapPixelAccessOrder<0, 1, 2, 3>(); break;
					case IPlatformBitmapPixelAccess::kABGR: result = new CBitmapPixelAccessOrder<3, 2, 1, 0>(); break;
					case IPlatformBitmapPixelAccess::kBGRA: result = new CBitmapPixelAccessOrder<2, 1, 0, 3>(); break;
					}
					if (result)
					{
						// just a test
						for (int x = 0; x < 100; x++)
						{
							for (int y = 0; y < 100; y++)
							{		
								result->setPosition(x, y);
								result->setColor(CColor(255, 0, 0, 126));
							}
						}
							
					}
				}
			}
			myView->setBackground(bitmap);
			frame->addView(myView);
			bitmap->forget();
EDIT: mistake found for bitmap manipultaion

Code: Select all (#)

				CBitmapPixelAccess *pixelAccess = CBitmapPixelAccess::create(bitmap, alphaPremultiplied);
						[..]
						pixelAccess->setPosition(x, y);
						pixelAccess->setColor(CColor(r, r, b, a));
						[..]
				pixelAccess->forget();
, but is there a better way for realtime output?

But it didn't work. result->setColor(CColor(255, 0, 0, 126)); crashed due to CBitmapPixelAccess::currentPos is not initialzed. Any hints?


best regards
Rene...

Post Reply

Return to “DSP and Plugin Development”