COCKOS
CONFEDERATED FORUMS
Cockos : REAPER : NINJAM : Forums
Forum Home : Register : FAQ : Members List : Search :
Old 02-22-2018, 03:59 PM   #361
Opcode 7
Human being with feelings
 
Join Date: Mar 2017
Posts: 79
Default

Question :

Is there a way I can limit the GUI Scaling Bounds rect, so "Menu 1", "Menu 2", "Menu 3" stay the same size, but don't get overlapped with other items, see :

Opcode 7 is offline   Reply With Quote
Old 02-23-2018, 03:48 AM   #362
Youlean
Human being with feelings
 
Youlean's Avatar
 
Join Date: May 2015
Location: Serbia
Posts: 654
Default

It really depends on your code, but it is possible for sure.
__________________
Website | Facebook Page | IPlug-Youlean
Youlean is offline   Reply With Quote
Old 02-23-2018, 06:14 AM   #363
Bobflip
Human being with feelings
 
Join Date: Nov 2016
Posts: 341
Default

My plug does stuff like that but I've put a bunch of custom code into SetGUILayout to handle it - to see how it looks it's at http://www.bogus-noise.co.uk/compere, on resize everything moves except for the 4 large display panes, which resize to fill the available space. There's no video but you should be able to get the gist.

You basically work out how big your resized display area is, the resizing ratios, and then use that to calculate the new coordinates for the objects.

There's code like this:

Code:
// Calculate resizing variables
resizingAreaW = windowWidth;
resizingAreaH = windowHeight-50; // 50 is the bottom of the menu area

resizeRatioW = resizingAreaH / kControlAreaH;
resizeRatioH = resizingAreaW / kControlAreaW; 

param1NewHeight = kParam1Height * resizeRatioH;

// Resize controls
GetGUIResize()->MoveControlRightEdge(*mParam1, resizingAreaW);
GetGUIResize()->MoveControlBottomEdge(*mParam1, kParam1Y + param1NewHeight);
The code can get pretty big this way as you'll those MoveControl calls for every control you need to resize. There's potentially other ways to do things within IPlugGUIResize.h, but this is the way I did it.
Bobflip is offline   Reply With Quote
Old 02-23-2018, 10:29 PM   #364
Opcode 7
Human being with feelings
 
Join Date: Mar 2017
Posts: 79
Default

Hmmm, thanks. My plugin has 200+ controls, so your method wouldn't be practical for me. Youlean, do you happen to have any built in API's for this sort of thing?

Cheers
Opcode 7 is offline   Reply With Quote
Old 02-24-2018, 08:13 AM   #365
Youlean
Human being with feelings
 
Youlean's Avatar
 
Join Date: May 2015
Location: Serbia
Posts: 654
Default

Quote:
Originally Posted by Opcode 7 View Post
Hmmm, thanks. My plugin has 200+ controls, so your method wouldn't be practical for me. Youlean, do you happen to have any built in API's for this sort of thing?

Cheers
You can put all controls in IControlGroup that you want to resize and just resize that group.
__________________
Website | Facebook Page | IPlug-Youlean
Youlean is offline   Reply With Quote
Old 02-24-2018, 08:19 AM   #366
Bobflip
Human being with feelings
 
Join Date: Nov 2016
Posts: 341
Default

I wonder why that wasn't on my radar! I believe I experimented with it early on but it didn't work right, can't remember why though, I'm guessing because most of my controls were being moved rather than resized.
Bobflip is offline   Reply With Quote
Old 02-24-2018, 08:21 AM   #367
Youlean
Human being with feelings
 
Youlean's Avatar
 
Join Date: May 2015
Location: Serbia
Posts: 654
Default

Quote:
Originally Posted by Bobflip View Post
I wonder why that wasn't on my radar! I believe I experimented with it early on but it didn't work right, can't remember why though, I'm guessing because most of my controls were being moved rather than resized.
Oh, yes, I didn't implemented that for IControlGroup yet.
__________________
Website | Facebook Page | IPlug-Youlean
Youlean is offline   Reply With Quote
Old 02-24-2018, 08:53 AM   #368
Youlean
Human being with feelings
 
Youlean's Avatar
 
Join Date: May 2015
Location: Serbia
Posts: 654
Default

I think I have fixed the crash for VST3. Try it out.
__________________
Website | Facebook Page | IPlug-Youlean
Youlean is offline   Reply With Quote
Old 02-24-2018, 10:03 AM   #369
Bobflip
Human being with feelings
 
Join Date: Nov 2016
Posts: 341
Default

Just tested OSX so far but seems good here, big thanks for sorting that :-)
Tried Bitwig, but also Reaper just to check that was still in order.
Bobflip is offline   Reply With Quote
Old 02-26-2018, 09:06 PM   #370
Guod3
Human being with feelings
 
Guod3's Avatar
 
Join Date: Jan 2008
Posts: 506
Default

It's working now! I didn't account for the change in bitmap type to pointer and the compiler didn't tell me...Haha, I'm happy to be up and running again though..
Guod3 is offline   Reply With Quote
Old 02-27-2018, 06:03 AM   #371
Bobflip
Human being with feelings
 
Join Date: Nov 2016
Posts: 341
Default

Quote:
Originally Posted by Guod3 View Post
It's working now! I didn't account for the change in bitmap type to pointer and the compiler didn't tell me...Haha, I'm happy to be up and running again though..
Ah, congrats!
Bobflip is offline   Reply With Quote
Old 03-01-2018, 12:12 PM   #372
Bobflip
Human being with feelings
 
Join Date: Nov 2016
Posts: 341
Default

Been experimenting with using the kLoading flag in OnParamChange to ensure that things like my Freeze button are disabled when loading presets. It works great on loading, but noticed that Logic calls OnParamChange with kLoading immediately after saving a preset, which resets the Freeze button. Only checked Ableton so far, but it doesn't happen on there. Is this a Logic flaw or something that can be worked around?

Last edited by Bobflip; 03-01-2018 at 12:22 PM.
Bobflip is offline   Reply With Quote
Old 03-01-2018, 12:59 PM   #373
Guod3
Human being with feelings
 
Guod3's Avatar
 
Join Date: Jan 2008
Posts: 506
Default

Not sure whether this helps you Bobflip, but:
There is another implementation of OnParameterChange with source ID that has an extra possible source ID that could be helpful:
https://forum.cockos.com/showpost.ph...8&postcount=21
Quote:
Originally Posted by Guod3 View Post
It seems to work, and demystifies where all the OnParamChange() calls are coming from. This is good for me.
Code:
(IPlugBase.h)
  enum ParamChangeSource { kReset, kAutomation, kPresetRecall, kGUI, kUnknown };
I'll be adding kPlugin to identify calls to OnParamChange() from within the plugin code.
In WDL-Youlean it seems that kReset and kPresetRecall are both rolled into kLoading?
I haven't looked at the implementation in any depth but maybe it would be good to have the extra ID's in Youlean framework.
Guod3 is offline   Reply With Quote
Old 03-01-2018, 01:07 PM   #374
Bobflip
Human being with feelings
 
Join Date: Nov 2016
Posts: 341
Default

Ahh, that does look like the kind of thing. Had a brief look at the change log, but not sure how to go about bringing it into the framework myself.
Bobflip is offline   Reply With Quote
Old 03-01-2018, 01:11 PM   #375
Guod3
Human being with feelings
 
Guod3's Avatar
 
Join Date: Jan 2008
Posts: 506
Default

You can certainly try it for yourself first (is what I did) OL's post shows all the changes to files in the framework. Youleans is bound to be similar....
Guod3 is offline   Reply With Quote
Old 03-01-2018, 01:30 PM   #376
Bobflip
Human being with feelings
 
Join Date: Nov 2016
Posts: 341
Default

Yeah, that's where I was looking at the change log. Compared it with Youlean's framework but haven't ventured into that kind of thing before.
Bobflip is offline   Reply With Quote
Old 03-05-2018, 10:59 PM   #377
Guod3
Human being with feelings
 
Guod3's Avatar
 
Join Date: Jan 2008
Posts: 506
Default

I'm resizing my plugin UI window. Enlarging the dimensions by adjusting
Code:
  pGraphics = MakeGraphics(this, kWidth, kHeight);
is enlarging the canvas correctly. The whole of the new Y size is visible but the X size of the window is not bigger and the window appears with a horizontal scrollbar to access the rest of the canvas.
How to get the whole plugin window maximised to it's specified size?
Guod3 is offline   Reply With Quote
Old 03-06-2018, 04:03 AM   #378
Bobflip
Human being with feelings
 
Join Date: Nov 2016
Posts: 341
Default

Quote:
Originally Posted by Guod3 View Post
I'm resizing my plugin UI window. Enlarging the dimensions by adjusting
Code:
  pGraphics = MakeGraphics(this, kWidth, kHeight);
is enlarging the canvas correctly. The whole of the new Y size is visible but the X size of the window is not bigger and the window appears with a horizontal scrollbar to access the rest of the canvas.
How to get the whole plugin window maximised to it's specified size?
I've not encountered this. Which host are you using and have you tested in other hosts?

Also have you called this?

GetGUIResize()->SetWindowSizeLimits(defaultView, kDefaultViewMinX, kDefaultViewMinY, kDefaultViewMaxX, kDefaultViewMaxY); // Define min and max windows view
Bobflip is offline   Reply With Quote
Old 03-06-2018, 04:23 AM   #379
Guod3
Human being with feelings
 
Guod3's Avatar
 
Join Date: Jan 2008
Posts: 506
Default

How do you set or where do you get the value of defaultView?
Guod3 is offline   Reply With Quote
Old 03-06-2018, 04:28 AM   #380
Bobflip
Human being with feelings
 
Join Date: Nov 2016
Posts: 341
Default

Quote:
Originally Posted by Guod3 View Post
How do you set or where do you get the value of defaultView?
Just in the enum ELayout where you're setting the rest of the layout coordinates. The enum was in IPlugEffectGUIResize.cpp but I moved it to a new file called layout.h for my plug. You can check the GUIResize example to see how SetWindowSizeLimits is used.
Bobflip is offline   Reply With Quote
Old 03-06-2018, 05:10 AM   #381
Guod3
Human being with feelings
 
Guod3's Avatar
 
Join Date: Jan 2008
Posts: 506
Default

The fundamental problem was host related, and a little surprising.
My workstation here has 3 monitors attached, and I have had a habit of using Reaper as the debug host. It opens in a monitor that is set up in portrait mode 1680 tall but only 1050 wide. The plugin opens in another similar monitor in conventional landscape mode and the GUI for this plugin takes up the whole screen. It turned out that reaper was limiting the initial width of the plugin window to that of it's main window in this set of circumstances.
Anyhow I've learned more about Resize GUI stuff from this framework so thanks for that!
Guod3 is offline   Reply With Quote
Old 03-06-2018, 05:18 AM   #382
Bobflip
Human being with feelings
 
Join Date: Nov 2016
Posts: 341
Default

Quote:
Originally Posted by Guod3 View Post
The fundamental problem was host related, and a little surprising.
My workstation here has 3 monitors attached, and I have had a habit of using Reaper as the debug host. It opens in a monitor that is set up in portrait mode 1680 tall but only 1050 wide. The plugin opens in another similar monitor in conventional landscape mode and the GUI for this plugin takes up the whole screen. It turned out that reaper was limiting the initial width of the plugin window to that of it's main window in this set of circumstances.
Anyhow I've learned more about Resize GUI stuff from this framework so thanks for that!
Ahhh, if you'd mentioned Reaper in the original post I'd have been able to tell you that straight away, hahah!
Bobflip is offline   Reply With Quote
Old 03-06-2018, 05:22 AM   #383
Guod3
Human being with feelings
 
Guod3's Avatar
 
Join Date: Jan 2008
Posts: 506
Default

I jumped in the deep end without knowing fully what I was doing (as usual) so I was sure it would be my fault but this time, not quite!
Guod3 is offline   Reply With Quote
Old 03-11-2018, 07:29 AM   #384
k.d.iv
Human being with feelings
 
Join Date: Mar 2018
Posts: 28
Default Plugin problems

Hello. After successfully build my copy of IPlugExamples/IPlugEffect from
IPlug-Youlean on VS 2017, with the kind help from @Youlean.
Then I follow the popular Martin Finke's Blog tutorial and build my own basic synth inside the mentioned IPlugEffect.
I'm new in this stuff, so basically copy/paste most of his code (not including very last tutorial for aliasing), made some modification on graphics and successfully build it, BUT...
My problems now are that the VS debugger build everything without errors, debugger loads the savihost with the plugin, but first knobs/sliders are not in default positions(only if I double click on them they go to default) and pressed plugin keyboard key stays pressed till another key is pressed( the generated tone is on first key press, not constant).

Second problem is that, when I load the plugin in REAPER it gives me
"Runtime Error... abnormal program termination".
Building the plugin as stand alone is also builded with success, but generated for example MySynth.exe not want to start/load.

Any ideas, someone? Thanks (i'm not native English speaker, sorry for mistakes if any)

Last edited by k.d.iv; 03-11-2018 at 01:22 PM.
k.d.iv is offline   Reply With Quote
Old 03-11-2018, 07:57 AM   #385
Bobflip
Human being with feelings
 
Join Date: Nov 2016
Posts: 341
Default

That tutorial is excellent, but a bit out of date. The first post in this thread details some changes you'll need to make to your code to get it to run, however I think there may be some others in this thread as well. Starting out with the synth is probably a bit ambitious, and it'd be best to go through the parts in order, starting with the distortion. There will be less changes to make as there's less code, and you'll get a good understanding of how everything is put together.
Bobflip is offline   Reply With Quote
Old 03-11-2018, 11:09 AM   #386
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,096
Default

Quote:
Originally Posted by k.d.iv View Post
but first knobs/sliders are not in default positions(only if I double click on them they go to default) and pressed plugin keyboard key stays pressed till another key is pressed( the generated tone is on first key press, not constant).
Have you properly initialized your variables ?
Here's some info:
https://forum.cockos.com/showthread.php?t=182942

I think I had the stuck key problem also at some point but I don't remember how I solved it (I know, not very helpful, sorry.) I'll post back if I remember.
nofish is offline   Reply With Quote
Old 03-11-2018, 12:27 PM   #387
Bobflip
Human being with feelings
 
Join Date: Nov 2016
Posts: 341
Default

I'd just woken up and misread the post, didn't realise it was compiling and running in standalone! I had the not-at-default-position problem recently as well, but can't think how I solved it right now either.
Bobflip is offline   Reply With Quote
Old 03-11-2018, 01:20 PM   #388
k.d.iv
Human being with feelings
 
Join Date: Mar 2018
Posts: 28
Default

Thanks for the quick support. Yes no build/compiling errors.
For now I found that problem probably come from his function:
Code:
	
class VoiceManager{
public:
inline void changeAllVoices(VoiceChangerFunction changer) {
		for (int i = 0; i < NumberOfVoices; i++) { //NumberOfVoices = 64
			changer(voices[i]);
		}
	}
I don't want to say that function is wrong, but when commented "changer(voices[i])" in VS the "Runtime error" in REAPER disappear, and standalone .exe file work too. But if is commented knobs(parameters) not doing anything, because they use that function, I think.
It's not a fix and sadly this not fix the keyboard too.
k.d.iv is offline   Reply With Quote
Old 03-15-2018, 11:24 AM   #389
k.d.iv
Human being with feelings
 
Join Date: Mar 2018
Posts: 28
Default

Hello again.
After some testing and debugging, I realize it is probably the framework. It's an old tutorial and was made on version of WDL-OL at that specific time.
Mine reason for this thoughts are that I download source code from the tutorial and build/compile it directly, on the same VS 2017 setup... and everything works(standalone too).
So I should rethink my code again and try to combine it with Iplug-Youlean, something like that. Thanks again.
P.S.:
It turns out, that after I set VS 2017 to fetch some libs(.dlls) from "Microsoft Servers" or whatever it is... The reaper error was gone. Standalone work too, with the same code.
Also parameters was not at default, because function which load them was after the function which load graphics.
Virtual keyboard still stuck some keys, especially when press same key twice...

Last edited by k.d.iv; 03-18-2018 at 01:27 PM.
k.d.iv is offline   Reply With Quote
Old 03-27-2018, 09:16 AM   #390
k.d.iv
Human being with feelings
 
Join Date: Mar 2018
Posts: 28
Default

Hi again. I need to have multiple drawing controls in my plugin.
In IplugCairo Examples there is
Code:
 class CustomCairoControl : public IControl, ycairo_gui
{
public:
	CustomCairoControl(IPlugBase* pPlug, ycairo_base *ycairo_base, IRECT pR)
		: IControl(pPlug, pR), ycairo_gui(ycairo_base, this) {}

	bool Draw(IGraphics* pGraphics)
	{
          ycairo_prepare_draw();
But the Draw() function work only for 1 control at the time. Can I use it somehow to draw multiple controls with it?
Because i want for example, 1 class with all controls, not separate class for every control.
Or it would be bad practice and i have to make separate classes? Thanks

Last edited by k.d.iv; 03-27-2018 at 10:11 AM.
k.d.iv is offline   Reply With Quote
Old 03-27-2018, 10:11 AM   #391
Bobflip
Human being with feelings
 
Join Date: Nov 2016
Posts: 341
Default

It sounds like you may need to rethink your approach, as it's better to have multiple classes rather than one large multiclass!

Draw() should be called automatically whenever the control needs to be redrawn. This can be ensured by calling SetDirty(); from places like MyClass::SetControlValue, or having a function like this:

bool MyClass::IsDirty() {
return true;
};

The approach needed depends on the particular control though. What are you wanting to achieve?
Bobflip is offline   Reply With Quote
Old 03-27-2018, 10:42 AM   #392
k.d.iv
Human being with feelings
 
Join Date: Mar 2018
Posts: 28
Default

Two Oscillators with switch for waves mode and 1 drawable wave mode (same control basically, but with different parameters for every OSC, Filter with switch modes and visualization. Also for later drawable Envelope and LFO.
Yes hard things...
To be honest, my idea is to make something between "Synth 1" (not Sylenth1!) and "Serum" VST, but also not too advanced and complicated like "Serum".

Last edited by k.d.iv; 03-27-2018 at 11:12 AM.
k.d.iv is offline   Reply With Quote
Old 03-27-2018, 11:30 AM   #393
Bobflip
Human being with feelings
 
Join Date: Nov 2016
Posts: 341
Default

Each of those would still be separate controls, and there's no need for the envelope to be redrawn if only the oscillator has changed.

It might be worth setting up a base class which has all the common functions that are shared between your controls, and then inherit the specific classes from that, adding class-specific methods as needed.
Bobflip is offline   Reply With Quote
Old 03-27-2018, 11:34 AM   #394
Bobflip
Human being with feelings
 
Join Date: Nov 2016
Posts: 341
Default

Oh, actually, the oscillator classes would probably be a single class with different wave generation modes inside, and separate parameters for each mode (I personally prefer it when a synth retains the settings of one mode if I try a different mode and then go back to the first mode).
Bobflip is offline   Reply With Quote
Old 03-27-2018, 02:44 PM   #395
Guod3
Human being with feelings
 
Guod3's Avatar
 
Join Date: Jan 2008
Posts: 506
Default

Sounds like you would like to make a class which has various controls as class members. The underlying DSP could be also be contained in class members. This way you could haven an oscillator and filter, etc, and create as many instances in the GUI as you want for your synth very easily.
Guod3 is offline   Reply With Quote
Old 03-28-2018, 12:19 AM   #396
k.d.iv
Human being with feelings
 
Join Date: Mar 2018
Posts: 28
Default

Thanks for the answers.
I mean, at the moment if I use the code above, I would need to make for example 5 or more classes (1 for Osc1, 1 for Osc2, 1 for filter...).
And add them with 5+ lines of

pGraphics->AttachControl(new CustomCairoControl(this, GetYCAIRO(), IRECT(0, 0, 0 ,0)))

And my thoughts was - can I have 1 class with separate functions which can do the graphics..
for example - drawOscOne(), drawOscTwo()...
But this may be not right also, because it is only for graphics and later I would need to connect some of the controls too.
k.d.iv is offline   Reply With Quote
Old 03-28-2018, 12:28 AM   #397
Guod3
Human being with feelings
 
Guod3's Avatar
 
Join Date: Jan 2008
Posts: 506
Default

Based on your questions, I would take some time out to study and understand object oriented programming and the kinds of design decisions you face with this. There are always many ways to do things and they all have dramatic and/or subtle ramifications. If you can locate some examples that are something like what you want to do, this is a great start, don't try to reinvent the wheel.
Guod3 is offline   Reply With Quote
Old 03-30-2018, 10:02 AM   #398
Bobflip
Human being with feelings
 
Join Date: Nov 2016
Posts: 341
Default

Quote:
Originally Posted by k.d.iv View Post
Thanks for the answers.
I mean, at the moment if I use the code above, I would need to make for example 5 or more classes (1 for Osc1, 1 for Osc2, 1 for filter...).
And add them with 5+ lines of

pGraphics->AttachControl(new CustomCairoControl(this, GetYCAIRO(), IRECT(0, 0, 0 ,0)))

And my thoughts was - can I have 1 class with separate functions which can do the graphics..
for example - drawOscOne(), drawOscTwo()...
But this may be not right also, because it is only for graphics and later I would need to connect some of the controls too.
You only need one oscillator class definition, and you can then use that multiple times in your project. So it'd be like this:

pGraphics->AttachControl(pOsc1 = new MyOscillatorClass(this, GetYCAIRO(), IRECT(0, 0, 0 ,0)))
pGraphics->AttachControl(pOsc2 = new MyOscillatorClass(this, GetYCAIRO(), IRECT(0, 0, 0 ,0)))
pGraphics->AttachControl(pFilter = new MyFilterClass(this, GetYCAIRO(), IRECT(0, 0, 0 ,0)))

You don't need drawOscOne() and drawOscTwo(), because the Draw() routine in the class will handle it all.
Bobflip is offline   Reply With Quote
Old 03-30-2018, 10:25 AM   #399
Bobflip
Human being with feelings
 
Join Date: Nov 2016
Posts: 341
Default

Also, in the Draw() routine, you can have it call other more specific functions in that class that you have written from a switch case statement, something like this:

Code:
bool WaveDisplay::Draw(IGraphics* pGraphics)
{
   switch mOscillatorMode 
   {
      case 0:
         DrawAnalogueOscillator();
         break;
      case 1:
         DrawWavetableOscillator();
         break;
      case 2:
         DrawGranularOscillator();
         break;
   }

return true;
}
This helps keep your code tidy and manageable!
Bobflip is offline   Reply With Quote
Old 03-31-2018, 07:58 AM   #400
k.d.iv
Human being with feelings
 
Join Date: Mar 2018
Posts: 28
Default

@Bobflip your last two posts, actually do the job. Thank you very much!

Attached Images
File Type: png cairo_draw_test.png (9.8 KB, 304 views)
k.d.iv 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 03:52 PM.


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