Cabbage Logo
Back to Cabbage Site

Filmstrip sliders

Thanks for testing guys :+1: I’ll get back to you when I have made some more progress.

[edit:] I figured out the problem with the value scaling. Just need to find a fix. This is turning into an epic journey, and as soon as it’s done I have some side-chaining to look forward to :roll_eyes: :laughing:

1 Like

Chained right now :upside_down_face:. Prisoner I would say, with his side. Testing and many things clarifying… :wink: :+1:

1 Like

@Rory - I know this has already become a deep rabbit hole… but it seems like it could be a very rewarding one for lots of users long term. So while it’s fresh in your mind, how would you feel about including “filmstrip” support for buttons and/or checkboxes?

It would allow use of some of these:
https://www.g200kg.com/en/webknobman/gallery.php?m=p&p=58
https://www.g200kg.com/en/webknobman/gallery.php?m=p&p=120
https://www.g200kg.com/en/webknobman/gallery.php?m=p&p=1577

My ideal thought was that buttons could render the “knob”, and if button text exists overlay that over the rendered button… And with checkboxes the text would appear next to the rendered button.

This is really quite simple to do for buttons as is, apart from the text that is.
https://cabbageaudio.com/docs/button/#imgfile
But in the few cases you need text, it’s simple to add a label.

I’m having serious problems supporting horizontal and vertical sliders. I’ve really spend quite some time on this and each attempt to come up with a generic solution has failed.


As you can see, the dot on this particular v slider is not at position 0. It’s above the minimum value. Each time we click on the dot it causes the slider to jump. My efforts yesterday got close, but caused things to get messed up when dealing with complex ranges.

I’ll have to go back to the drawing board. I really don’t want to have to write my own slider class to tackle this problem :rage: That would involve quite a lot of work. :frowning:

1 Like

Btw, for now I’ve pushed through a fix for the rotary filmstrip slider ranges issues. They should work fine now.

Well, buttons (and checkboxes) can also have changing on|off text, so I was hoping to both accomplish having the image be a single file for simpler rendering and inclusion, plus allow the changing text easily, without another identchannel and manual handling code.

Also, my goal is to make as much “skin-able” as possible… and not only for my own purposes! I think it’d be great for everyone long term to be able to easily change the look and feel of existing instruments with as little “conversion” effort as possible.

I played some with vsliders. My results were “ok”, but not great. I was running into a lot of the same issues as you… plus, I only have a low res filmstrip to work with, so everything looks horribly crunchy.

Just an idea, but what if with v/h sliders there were two extra fields available to the user. “offset” and “scale”. Offset would adjust either x or y position for h or v (respectively), and scale would adjust the rendering size. This would let the user adjust for their graphic where 0 starts, and how to scale size from there to make their values fit. It would potentially require rendering outside of the stated “bounds”… but would that give a usable solution?

Sorry I got to test and report so late, but I’m still having issues

First, if the image file doesn’t exist, it doesn’t render in the normal style anymore… it doesn’t appear at all!
image

And also flimstrips in plants don’t seem to render.
image

Here’s the example I’m using:

<Cabbage>
#define RED_KNOB range(-100,100,0), channel("Knob"), colour(100,100,100,255), trackercolour(255,80,80,255), fontcolour(180,180,180,255), textcolour(180,180,180,255), trackerinsideradius(0.850), trackeroutsideradius(1.000), textboxoutlinecolour(80,80,80,255), textboxcolour(70,70,70,255), markercolour(255,80,80,255), popupprefix("Prefix: "), popuppostfix(" Postfix")

#define RED_STRIP range(-100,100,0), channel("Knob"), colour(100,100,100,255), trackercolour(255,80,80,255), fontcolour(180,180,180,255), textcolour(180,180,180,255), trackerinsideradius(0.850), trackeroutsideradius(1.000), textboxoutlinecolour(80,80,80,255), textboxcolour(70,70,70,255), markercolour(255,80,80,255), popupprefix("Prefix: "), popuppostfix(" Postfix"), filmstrip("knob2_red.png",120)
; #define RED_STRIP range(-100,100,0), channel("Knob"), colour(100,100,100,255), trackercolour(255,80,80,255), fontcolour(180,180,180,255), textcolour(180,180,180,255), trackerinsideradius(0.850), trackeroutsideradius(1.000), textboxoutlinecolour(80,80,80,255), textboxcolour(70,70,70,255), markercolour(255,80,80,255), popupprefix("Prefix: "), popuppostfix(" Postfix"), filmstrip("meter_black.png",30)

form caption("Knob Test") size(400, 300), colour(18, 0, 38), pluginid("test"), import("FilmPlant.xml")

rslider $RED_KNOB pos(0,0), size(80,80)
rslider $RED_STRIP pos(0,120), size(80,80)

rslider $RED_KNOB pos(100,0), size(80,80), text("Test Text")
rslider $RED_STRIP pos(100,120), size(80,80), text("Test Text")

rslider $RED_KNOB pos(200,0), size(80,80), text("Test Text"), valuetextbox(1)
rslider $RED_STRIP pos(200,120), size(80,80), text("Test Text"), valuetextbox(1)

Widgets pos(0,220) size(80,80), namespace("Widgets")
</Cabbage>
<CsoundSynthesizer>
<CsOptions>
-n -d -+rtmidi=NULL -M0 -m0d 
</CsOptions>
<CsInstruments>
ksmps = 32

</CsInstruments>
<CsScore>
f0 z
</CsScore>
</CsoundSynthesizer>

And the plant:

<?xml version="1.0" encoding="UTF-8"?>
<plant>
<namespace>Widgets</namespace>
<name>Widgets</name>
<cabbagecode>
	image bounds(0,0,80,80) colour(0, 0, 0,0) {
		rslider pos(0,0), size(80,80), $RED_STRIP
	}
</cabbagecode>
<csoundcode>

</csoundcode>
<help>
  Example to show imported widgets don't render filmstrips
</help>
</plant>

You can use any image file by changing the define.

Sorry @t_grey, I don’t get a chance at all yet to look into imported plants. I’m still trying to figure out how to get the best from h and v sliders.

Your last suggestion about rendering outside there bounds of the slider is one of her options I looked at, but that’s won’t work. It just gets cut off. I will try some more things tomorrow.

I think putting button on and off test into the frame would be pretty trivial too no?

Ok, no worries! Just reporting it as I see it :slight_smile: I keep stepping back to 9/28, it’s working well for me right now.

I’m sorry, I don’t understand what you mean…?

Sorry, i am writing on my phone :roll_eyes::rofl:

I meant adding on and off text to button frames would be pretty simple to do? I just see trying to add text around png frames as a bit of a nightmare.

I think I have a solution to this at last. Leave it with me. I’ll try to get something by you later this evening if I can.

I’ve pushed yet another attempt at this. For this one, I’ve changed the filmstrip() identifier somewhat. It now looks like this:

filmstrip(“filename”, numFrames, removeA, removeB) The filmstrip identifier allow users to use a filmstrip style .png to skin their sliders. “filename” is the name of the .png file to be used. numFrames is the number of frames in the film strip image. removeA and removeB will rescale the underlying slider object, which is invisible due to the skin laid on top of it. For example, in the case of a hslider, removeA(.1) will remove .1 of the overall length of the slider from the left side, removeB(.1) will remove .1 of the overall length from the right. This allows one to rescale sliders according to where their skin images start and end.

For a vslider removeA and removeB refer to the top and bottom of the slider. See the KnobManSlider.csd file in the Misc. examples for more details.

This might all sound a little confused, and I’m open to better naming suggestions. Take the example file for a spin and you should quickly see what the 3rd and 4th parameters do. Note they are not needed for the rotary knobs. In the new example all sliders work and behave the same way you would expect native one to. Or at least they did in the tests I ran with them!

These are the tests performed with version 2.4.7.
Without text, I have to increase the size of (rslider) by 30px, over the original size.
With text, the size to add rises to 84px. I guess it will be the sum of the spaces generated to house the text and the numbering?
Negative values now work correctly on all sliders.

That’s right. I have to compromise to accommodate the text, and make it possible to quickly swap between native sliders and filmstrips without having to completely redesign everything. Are you Ok with this? Will it work Ok for your instruments?

It is enough for me that it respects the measures such as version 2.4.2.
The text and numeric parts, from my point of view, it is preferable to put them as required by the design, I mean, that both the text and the values give more freedom to be able to place them where it is most convenient. Moreover, a great majority of times, the values are illustrated in the same base graph of the interface.
It is a significant achievement, how minimized the code is, and the ease of implementation in any design.
It’s a good job @rorywalsh

Thanks Gerbo. Good to know. I will try to get around to the side-chaining this week at some point :wink:

Hey @rorywalsh! Sorry, I’ve been slow testing h/v sliders on my end… but I’ve been slowly picking away at it. I still need to put together an example showing what I’m seeing. I’m still seeing some small oddities, but I agree with @Gerbo. Even in it’s current form, this is a huge achievement and a big win for cabbage users!

Anyways, rather than put it off until I’ve made a good stand-alone example (I’ve been testing in place with my project so far)…I’ll at least report here are some of the issues I’ve been seeing in my tests, running build 20201001.1:

If the v/hslider gets it’s value set to the limits of it’s range (for example, 0 if it’s the minimum) via chnset, the knob image gets partially cut off (not tested extensively yet, but I think this might have to do with removeA and removeB “hitboxes”)
image vs: image

Another issue I’m seeing, it seems like removeA is ignored on a vslider that has neither text() nor valuetextbox(). removeB seems to still be active however.

The “valuetextbox” generated with filmstrip sliders have different proportions and appearance than the default one. I haven’t tested extensively, but I’m guessing perhaps things like border colour, border thickness, font size, and other subtle modifiers might have been lost in transition. This isn’t a huge deal, but in some very “widget dense” scenarios the boxes have run together:
image vs: image

Other than that, they’re working great so far. The only real complaint I have about h/v so far is that I need to custom tailor removeA and removeB values for each state: plain, with text, with valuebox, and with text AND valuebox all require slightly different tweaks. This isn’t impossible to workaround, but can get a bit tedious. I think it would be perfection to nail down the canvas size differences in that regard if possible! :innocent:

It is good news Rory, to be able to finish outlining those details that still remain :smiley:. For my part everything is ready :+1:

Hmm, I will try this. Something else I’ll throw into the example file so we can keep track of all eventualities.

Right. I’ll take a look.

I noticed this and spent some time trying to remedy it, but failed miserably. I can’t think why it is, but it is also on my radar.

Tell me about it. But if we want to be able to mix native controls with filmstrips I think it is a price we will have to pay. I think most people will think we are mad for even attempting this :laughing:

I think the text position for the native rsliders is now slightly off. I’ll take a look. I just noticed.

1 Like