Cabbage Logo
Back to Cabbage Site

Switching images with slider

I have simple idea.I want to make hide or visible image with rslider.

For example if rslider=1,image1 will be visible and other images will be hidden.

I tried some tricks but still can’t do this.

I have great ida with this.

Waiting for your helps.

Thanks.

Hey there,

Attached is an example that does what you requested.

Cheers!
imageSwitch.csd (1.6 KB)

Thanks for reply.

But it’s only changing between two images?Is it possible to improve it for more images?

Yes,

I have made comments on the code, as to where you need to make changes to accommodate more images.

iNumOfImg = 3

Change this value, depending on how many images you’re planning to put up.

image bounds(64, 160, 82, 71), identchannel("imageIdent1"), visible(0)	
image bounds(178, 158, 85, 77), identchannel("imageIdent2"), visible(1)
.....
image bounds(64, 160, 82, 71), identchannel("imageIdentX"), visible(1)	

Name the identchannel fields in this manner, for all X number of images.

Take a look at the code in detail. Shoot, if you need more info. Also, please edit the title of your post to something more appropriate like “Switching images on and off using slider” or something like that, so that it could be of help to another person who is browsing through.

Thanks!

I changed topic name.

I will try your codes now.

But still i can’t figure it out.

I set slider to three position.1-2-3.

When slider position = 1,image 1 will be visible and the others will be invisibel.
When slider position = 2,image 2 will be visible and the others will be invisibel.
When slider position = 2,image 2 will be visible and the others will be invisibel.

I can’t do that.Only making image 1 and 2.

Oh, is that your requirement?

That raises the complexity a little bit. But here is the code for it, nonetheless. Make the same changes as stated above, for including more images. Also, at slider position = 0, I have made all the images invisible. If you are unhappy with this behavior, just change the range of the slider, starting from 1.

Cheers.

imageSwitch2.csd (1.8 KB)

Man! You are awesome! Now it’s easy to build .png knobs!

With knobman create knob and export invidual.Then put them top to top.And put rslider to top and make rslider alpha=0.And .png knob!

How can i do that with minus values? It allows only 1 and more.But i need -1 to -10.

Found!

if i(kSlider)*-1 == kCounter then

Affecting when select minus.

I will add what i did with code.

So you got it all sorted then? I wasn’t really following this thread, but let me know if you still need help.

Here is what i did with this future!I’ve used my png files to build knobs.

That’s nice. I never thought of using knobman film strips this way. Can you check one thing for me. hen you are playing some audio in Reaper and you start moving your sliders, does the GUI in Reaper freeze for a moment? Secondly, would you mind posting a simple filmstrip knob so I can try it out myself? I’m curious to see what’s the easiest way of doing this.

On Mac,i didn’t get any issue with Reaper.Everything is ok.But on Windows,Reaper has lots of issues.But it’s not about Cabbage.Other DAWs are great with Windows to using Cabbage made plugins.Mulab,Cubase,Studio One working with no issue.

I didn’t use strip.Used invidual images.Knobman can export invidual images.

Now trying to build gain reduction meter with images.First i have to find how can i control rslider with audio.

Here is what i use.

knob.zip (1.5 MB)

Thanks. I’ll check them out later. There are a few ways to control a slider with an audio signal. You can simply down sample to a k rate variable and use chnset on the rslider’s channel:

a1 inch 1
k1 downsamp a1
chnset k1, "rslider"

Or a better approach might be to use the rms opcode. For what it’s worth, I posted an example on this list a while ago on how to use function tables to display audio levels. Of course you will probably get better results with custom images.

1 Like

This code is working thanks!But i have problem with it.When i set channel to my slider,slider doesn’t affect to images.

It’s kind of impossible to tell what’s going on without seeing all your code.Can you zip your project and send it on to us?

test.zip (1.7 KB)

I’m trying with simple gain example.As you can see,i set gain1 to audio input and meter.

Your slider ranges are going from 1 to 2. Audio is always scaled between -1 and 1.