Old 29th July 2004, 19:46   #1
ziege
Senior Member
 
ziege's Avatar
 
Join Date: Oct 2002
Location: UK
Posts: 363
A better knob

I'd like a volume knob that works by clicking and moving the mouse up-and-down, instead of moving it in a circular motion like the current knobs on many skins.

Anyone who's used pro-audio apps will know what I mean, since these programs have had knobs like this for many years. Cubase, Reason, Rebirth, any Native Instrument progs, basically 99% of apps in general with knobs work in the way I'm after. You click them and hold the left-mouse button, then move up-and-down as if it were a slider. Sometimes they have additional functions such as Shift+Click=slower/precise movement, or Right-click=reset to zero, etc... I'm just after the basic up/down functionality though, anything else is a bonus.

Does anyone know how this could be done?

I can create a normal volume-knob, and change the gradient map from radial to linear, and this works roughly how I want. But there's one big problem with this method, the first mouse-click will change the volume to where-ever you click. Say the volume is at 75% and you want to click and move it up, if you click in the middle it will first reset the volume to 50% and then move up. I'd like it to stay at it's current volume and only change when you drag up/down.

Long-winded, but I suck at explaining stuff, sorry =/ If anyone isn't sure what I mean, I'll find a small app with those knobs to show it better.
ziege is offline   Reply With Quote
Old 29th July 2004, 20:02   #2
Mr Jones
Nothing to say...
 
Mr Jones's Avatar
 
Join Date: Sep 2000
Location: UK
Posts: 23,064
Is your knob not very good then ziege ?*snicker snicker*

/carry on
Mr Jones is offline   Reply With Quote
Old 29th July 2004, 20:41   #3
SLoB
Major Dude
 
SLoB's Avatar
 
Join Date: Jul 2003
Location: UK
Posts: 1,316
heheh aye i was wondering what the subject was on about lol

erm just set a variable to the current volume on the mouse over and then set the volume to that value on the onclick
so that the volume can stay at the same place
that would handle it i reckon
or even just have the click to show the slider so the button click has nothing to do with the slider
SLoB is offline   Reply With Quote
Old 30th July 2004, 07:23   #4
ziege
Senior Member
 
ziege's Avatar
 
Join Date: Oct 2002
Location: UK
Posts: 363
Quote:
set a variable to the current volume on the mouse over and then set the volume to that value on the onclick
Sounds easy enough I can't do it though... I've looked through std.mi and found:

isMouseOver()
extern boolean GuiObject.isMouseOver(int x, int y);

getVolume()
extern Int System.getVolume();

...I've only just written my first ever script and I'm not sure what the syntax would look like to get the volume from the mouseover. I'll prolly figure it out when I've learned a bit more. Any chance you could show me how this line should go?

Mr. Jones: no my knob is terribly inadequate but I'm working on it!

WIP: NSX-999
ziege is offline   Reply With Quote
Old 30th July 2004, 07:43   #5
leechbite
Major Dude
 
leechbite's Avatar
 
Join Date: Sep 2003
Location: Canada
Posts: 635
Send a message via Yahoo to leechbite
PHP Code:
#include <lib/std.mi>

global int lastxlasty;
global 
float sensitivity;
global 
boolean voladjust;
global 
int lastvolume;

global 
guiObject volumeknob;

system.onScriptLoaded() {
  
group scriptGroup getScriptGroup();

  
volumeknob scriptGroup.findObject("volumeknob");

  
voladjust 0;
}

volumeknob.onLeftButtonDown(int xint y) {
  
voladjust 1;

  
lastx x;
  
lasty y;

  
lastvolume getVolume();

}

volumeknob.onLeftButtonUp(int xint y) {
  
voladjust 0;
}

volumeknob.onMouseMove(int xint y) {
  
sensitivity 1.0// set this to desired sensitivity
  
if (isKeyDown(VK_SHIFTsensitivity 0.5;

  
offsetvol = (y-lasty)*sensitivity;

  
int newvol lastvolume offsetvol;

  if (
newvol<0newvol 0;
  if (
newvol>255newvol 255;

  
setVolume(newvol);

i did try nor compiled this script. It has the general idea. you might have to tweak it a bit (or a lot ).
leechbite is offline   Reply With Quote
Old 30th July 2004, 18:17   #6
ziege
Senior Member
 
ziege's Avatar
 
Join Date: Oct 2002
Location: UK
Posts: 363
Wow thanks leechbite! I'll have to sit and have a read through that later, I'm sure that's enough to get me going

WIP: NSX-999
ziege is offline   Reply With Quote
Old 30th July 2004, 18:35   #7
leechbite
Major Dude
 
leechbite's Avatar
 
Join Date: Sep 2003
Location: Canada
Posts: 635
Send a message via Yahoo to leechbite
no prob.
leechbite is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Skinning and Design > Modern Skins

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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