Cabbage Logo
Back to Cabbage Site

Plugin resizing (scroll down for latest solution)

Hi Rory,
I just did some tests with 4 bitmap images, each one edited with its corresponding percentage.
I have added a well-known image selector code, to synchronize the sizes.
Resize-with-images.zip (2.3 MB)


I have realized that the save is correct, when we reopen the session, but when hiding the plugin and reopening it, it does not keep the dimensions.

The implementation of this code is appreciated.

Thanks for testing Gerbo. I will have to look :wink: Should be a simple fix. You’ve created another great looking plugin I see! I’ve no doubt it will sound every bit as soon as it looks.

Ah, I tried this now too (related to preset manager combobox), and I noticed that if you’re on another index position than the first, if you hide the plugin like @Gerbo is showing, it will jump back, but only visually, the parameters will not change.

And it would also be great, to keep the resizing active without running audio as for example in Logic, as has happened in these last versions in sliders with image.

:thinking:Besides, a curious question … Is there any way that the widget keyboard does not increase the audio when the keys are pressed?

In that case I think we need a dedicated resize widget, that has nothing to do with Csound. It probably makes things easier anyway if users don’t have to mess with channels for this. I’ll take a look.

You mean is there a way to stop the keyboard widgets from triggering a note, or is there a way to stop its loudness scaling based on the mouse Y position on a mouse down event?

For example we have an effect plugin, and we need the keyboard widget to activate any other service.
When the audio runs through the effect and we press any key (without assigning anything to the keyboard yet, just the widget as it is by default), the audio increases by about 4dB.
Would it be possible to cancel this increase in amplitude?

I think that’s because you are triggering another instance of the instrument. Because default, Csound will trigger instrument 1 whenever a MIDI message comes through on channel one. For an effect you can just set the main instrument number to be 101 or something high. You can also use the massign opcode to set the MIDI routing.

I should probably change the default instrument number for effects to 101 in the basic template code that Cabbage creates :thinking:

I didn’t know that channel 1 came by default. I thought it had to be assigned.
Thanks a lot!

I’ve updated the template code now too. I’m surprised no one ever mentioned this before :laughing:

@Gerbo I’ve updated this now so that it is Logic friendly, but I’m not sure the approach I’ve taken is the best one. I’ve added a mode("resize") to the combobox:

combobox bounds(10, 180, 80, 20), items("50%", "100%", "150%", "200%"), value(2), mode("resize")

When the combobox changed function is called it sets the scale factor to comboValue/2, where the range of the combobox is 1-number of items. You can add as many items as you like, but it will always move upwards from 50%, by 50%. Maybe it would be better to move upwards from 50% in steps of 25%? 25% jumps would give better control?

@hdale94 I fixed that preset problem. That was an problem I added by mistake in a recent build…

1 Like

Or maybe it’s best to automatically add the sizes when a user make mode(“resize”)? So in the end the user only has to set the style and position of the combobox?, i.e,

combobox bounds(10, 180, 80, 20), mode("resize")

Yes much better. 75% is used a lot and it is very comfortable to use that 25.

Ok. Leave it with me. I’ll go from 25% up to 200% in steps of 25% :+1:

Anyway, both ideas are good and could be tested.

This is how I did it (25% increments).

instr 7

kMenuTrigger chnget "MenuTrigger"
kWidth = 700
kHeight = 500

if changed:k(kMenuTrigger) == 1 then  
    if (kMenuTrigger == 1) then
        SMessage sprintfk "scale(%f)", 0.75
        chnset SMessage, "formIdent"
    endif
    if (kMenuTrigger == 2) then
        SMessage sprintfk "scale(%f)", 1
        chnset SMessage, "formIdent"
    endif
    if (kMenuTrigger == 3) then
        SMessage sprintfk "scale(%f)", 1.25
        chnset SMessage, "formIdent"
    endif
    if (kMenuTrigger == 4) then
        SMessage sprintfk "scale(%f)", 1.5
        chnset SMessage, "formIdent"
    endif

endif   

endin

Not the most efficient way maybe, but it works fine, also resizes all my widgets and the .png background

I’ve changed this so that it no longer using any channels, as these were preventing it from working in Logic if you hadn’t pressed play. I’ve also updated the example. It’s much simpler now, just use the following code:

combobox bounds(10, 180, 80, 20), mode("resize"), value(3)

value(3) is 100%. You can still style the combobox, but it will automatically add its own sizes from 75% to 200%. Its size is also saved across sessions, and whenever you open or close the plugin.

Let me know how it goes.

Logic and Cubase without audio track running, when closing and opening the plugin they return to 100%

To activate it you need to make the percentage selection with the track moving.
(once activated, it works correctly without the need for audio reading)

Reaper and Live, behave correctly without audio track.
Session save is correct in all.

Thanks for testing! I’ll sort that when I get a chance.

Okay,
It is a great detail on your part, to be in depth on this matter.
Thanks :wink:

Hi @Gerbo, I have this working now BUT, it depends on the new system of updating widgets. Are you setting the value of any widgets using chnset? Or are you using identchannels() If not then all you need to do is add guimode("queue) to your form definition and you should be good to go.