HardwareHeaven.com

HardwareHeaven.com

Looking for the skin chooser?
 
 
  • Home

  • Hardware reviews

  • Articles

  • News

  • Tools

  • Gaming at HardwareHeaven

  • Forums

 

Go Back   HardwareHeaven.com > Forums > Hardware and Related Topics > kX Project Audio Driver Support Forum > General Discussion


Reply
 
Thread Tools
Old Nov 10, 2008, 12:02 PM   #1
DriverHeaven Junior Member
 
Join Date: Mar 2008
Posts: 36
Rep Power: 0
dj-gutz is on a distinguished road
System Specs

Need Help With Programming For Kxctrl

hi
im trying to program something in slycontrol script language
for those of you who doesn't know slycontrol its a remote control program like girder
website : SlyControl

my problem ( i posted a different thread about it like a week ago ) is when i upgraded from xp to vista the windows mixer didn't allow me to control anything on my volume mixers and i can't control my volume with slycontrol because it uses windows mixer..

so i searched a little bit here and i fount a script which was made on vbscript and learned from it a little bit
my problem with it was the response which was way too high for me ( 1-2 seconds till the volume was raised )

then i decided to write something in slycontrol script
basic exp. here : SlyControl

HTML Code:
  MasterVolUp = Hook( "KEY", "Ctrl+Alt+Shift+D", Enabled, Break )
{
    Break( MasterVolUp < 0 )
    ValueStorage ( "GET", "MasterVolume")  # Get MasterVolume Value
    MasterVolumePrecent =  Math ( "x+214748" , @1 ) # Add Volume
    ValueStorage("SET" , "MasterVolume" , @1 ) # Set New MasterVolume Value
    OSD( "%d" , MasterVolumePrecent ) 
    Str("INTTOSTR" , MasterVolumePrecent ) # Convert MasterVolume Value To String
    Str("SET" , "VolumeValue" , @1 ) # Set VolumeValue As MasterVolumePrecent
    Str("SET" , "Cmdline" , "-sg 13 8002 " ) # Set CommandLine
    Str("GET" , "Cmdline" , "VolumeValue") # Store CommandLine And VolumeValue At @1 , @2
    Str( "ADD" , @1 , @2 )  # Bind CommandLine And VolumeValue
    ExecFile( "kxctrl", @1 ,  , "HIDE") # Execute Full Command Line
 }
what it does is simple
my problem is with the values i insert
i want to raise the volume with 1% at a time and i can't because of dec to hex problem
slycontrol don't have an dec to hex converter and i don't know how to make one

here is the readme of the math mechanism :
HTML Code:
Math plugin
Events: none
Actions:
1. Return Variable/Constant value
  ActionManual( <Value> )
  Example:
    a = Math(123)
    b = Math(a)
    c = Math("15")
2. Calculation of any mathematical expression
  ActionManual( "<expression>" [, <xValue> [, <yValue> [, <zValue>]]] )
  Place result to @1 as string
  Place result (2 decimal places) to @2 as string
  Allowable symbols:
  1..9 - numbers
  . - a divider of a fractional part
  + - plus
  - - minus
  * - multiplication
  / - division
  ^ - exponentation
  == - equal
  > - higher
  < - lower
  >= - same or higher
  <= - same or lower
  != - not equal
  = - assignment
  ( ) - brackets
  , - a divider of function parameters
  ; - a divider of expressions
  x,y,z - extern constants
  Functions:
  ABS(var) - absolute value
  RAND(var) - pseudo random number (0...var)
  IF(exp,var1,var2)
  - if exp==0 return var1 else var2
  LN(var) - calculates the natural logarithm
  SQRT(var) - calculates the square root
  FLOOR(var) - calculates the floor of a value, floor(pi)=3
  SIN(var) - calculates the sine
  COS(var) - calculates the cosine
  TAN(var) - calculates the tangent
  ASIN(var) - calculates the arcsine
  ACOS(var) - calculates the arccosine
  ATAN(var) - calculates the arctangent
  Constants:
  PI = 3.141592653589793238
  E = 2.718281828459045235
 
  Example:
 Math("g=y;MainVolume=x",93,"9.81")
    v = Math("x^2*(g-cos(pi/4))",3)
 WriteLog("%d,%s,%s",v,@1,@2) # Display "81,81.926039,81.926"
    v = Math("MainVolume=IF(MainVolume<95,floor(MainVolume+5),100);MainVolume")
 WriteLog("%d,%s,%s",v,@1,@2) # Display "98,98.000000,98"
    v = Math("MainVolume=IF(MainVolume<95,floor(MainVolume+5),100);MainVolume")
 WriteLog("%d,%s,%s",v,@1,@2) # Display "100,100.000000,100"
so basiclly im asking how can i make a dec to hex mechanism here cuz kxctrl doesnt allow dec numbers like the editor :\

thanks in advance
gutz
sorry for the long thread

Last edited by dj-gutz; Nov 10, 2008 at 12:08 PM.
dj-gutz is offline   Reply With Quote


Old Nov 10, 2008, 12:36 PM   #2
HardwareHeaven Extreme Member
 
Join Date: Jan 2005
Posts: 5,563
Rep Power: 62
Russ is just super!Russ is just super!Russ is just super!Russ is just super!Russ is just super!Russ is just super!

Re: Need Help With Programming For Kxctrl

Have you tried my volume plugins (Master Volume, LineIn Volume, and MicIn Volume)?

I do not have Vista, so I cannot be sure if or how well they work in Vista, but you might want to give them a try: kX Stuff
[COLOR=Gray](You cannot control Master Volume at all in Vista with default DSP config? If that is the case, then my plugin (MasterVol) probably will not work either...)[/COLOR]

As for SlyControl, I do not see much documentation for it's scripting language on it's web site, so it is hard to offer any help with it. Does it support other scripting languages?

Last edited by Russ; Nov 10, 2008 at 12:55 PM.
Russ is offline   Reply With Quote
Old Nov 10, 2008, 12:55 PM Threadstarter Thread Starter   #3
DriverHeaven Junior Member
 
Join Date: Mar 2008
Posts: 36
Rep Power: 0
dj-gutz is on a distinguished road
System Specs

Re: Need Help With Programming For Kxctrl

yeh i tried them and it didn't work for me the whole mechanism of vista is screwed up..
also there is only one slider that i can connect to and im actually using 2 : fxbus 0/1 + ac97 line in

i linked the documentation..
SlyControl
also u can go to
products -> slycontrol -> scripts/plugins

here is my dsp config :
http://gutz.ahuzateden.co.il/room/kx.jpg

thanks
dj-gutz is offline   Reply With Quote
Old Nov 10, 2008, 03:01 PM   #4
HardwareHeaven Extreme Member
 
Join Date: Jan 2005
Posts: 5,563
Rep Power: 62
Russ is just super!Russ is just super!Russ is just super!Russ is just super!Russ is just super!Russ is just super!

Re: Need Help With Programming For Kxctrl

Sorry, I do not see anything there that is going to help... Additionally, even if you manage to get it to work, I think it is still going to be a lot slower than you want.

What specifically do you need this for? Is it just to control the Master Volume from the keyboard (which keys?) or is there more to it than that?
Russ is offline   Reply With Quote
Old Nov 10, 2008, 03:22 PM Threadstarter Thread Starter   #5
DriverHeaven Junior Member
 
Join Date: Mar 2008
Posts: 36
Rep Power: 0
dj-gutz is on a distinguished road
System Specs

Re: Need Help With Programming For Kxctrl

its actually working pretty good , my only problem is the values..
now it just going with no order because im using decimal numbers and i enter them like hex so when i do addings of 100000 for ex. i get : 1% , 3% , 7% , 13% etc. which is non linear..
i just want to control it in steps of 1% and not randomly..

the keyboard keys are just an emulation
what i do is to control my happauge pvr150 remote control using irserver ( mce replacment plugin program )
irserver converts my remote buttons to keystrokes
keystrokes sent to control slycontrol

yeh i know its complicated but its the only way i can do this
slycontrol and irserver don't support midi commands..

i found a way to convert decimal to hexa with dividing the number in 16 and using the remainder
but i cant find a way to descover the remainder in slycontrol
here is the method :
http://www.permadi.com/tutorial/numDecToHex/

the only thing i can think of now is to conver the number into string
find the . and cut the numbers behind it then convert them into integer again and multiply
but it will be very complicated..

Last edited by dj-gutz; Nov 10, 2008 at 03:28 PM.
dj-gutz is offline   Reply With Quote
Old Nov 10, 2008, 05:50 PM   #6
HardwareHeaven Extreme Member
 
Join Date: Jan 2005
Posts: 5,563
Rep Power: 62
Russ is just super!Russ is just super!Russ is just super!Russ is just super!Russ is just super!Russ is just super!

Re: Need Help With Programming For Kxctrl

Quote:
Originally Posted by dj-gutz View Post
i found a way to convert decimal to hexa with dividing the number in 16 and using the remainder
but i cant find a way to descover the remainder in slycontrol
here is the method :
CONVERTING DECIMAL TO HEXADECIMAL

the only thing i can think of now is to conver the number into string
find the . and cut the numbers behind it then convert them into integer again and multiply
but it will be very complicated..
Right, that is how you would do it manually, but it would be pretty complicated to try and do using SlyControl's scripting engine.

BTW: To get the remainder (assuming that SlyControl does not include a modulus operator), do the division by 16, keep only the whole part of the resulting number, multiply that by 16 and subtract that result from the original value.

In any case, if you really need it, it is easy enough to modify kX Control such that it will work with decimal numbers where needed.
Russ is offline   Reply With Quote
Old Nov 10, 2008, 06:10 PM Threadstarter Thread Starter   #7
DriverHeaven Junior Member
 
Join Date: Mar 2008
Posts: 36
Rep Power: 0
dj-gutz is on a distinguished road
System Specs

Re: Need Help With Programming For Kxctrl

Quote:
Originally Posted by Russ View Post
In any case, if you really need it, it is easy enough to modify kX Control such that it will work with decimal numbers where needed.
how can i modify kx control to do this?
i have no vc experience
i learned some c and vb but very basic..
anyway you can compile me a suitable version or something like this?

thanks dude
dj-gutz is offline   Reply With Quote
Old Nov 10, 2008, 06:11 PM   #8
HardwareHeaven Extreme Member
 
Join Date: Jan 2005
Posts: 5,563
Rep Power: 62
Russ is just super!Russ is just super!Russ is just super!Russ is just super!Russ is just super!Russ is just super!

Re: Need Help With Programming For Kxctrl

What version of kX are you using?
Russ is offline   Reply With Quote
Old Nov 10, 2008, 06:15 PM Threadstarter Thread Starter   #9
DriverHeaven Junior Member
 
Join Date: Mar 2008
Posts: 36
Rep Power: 0
dj-gutz is on a distinguished road
System Specs

Re: Need Help With Programming For Kxctrl

latest 3545b
dj-gutz is offline   Reply With Quote
Old Nov 10, 2008, 06:26 PM   #10
HardwareHeaven Extreme Member
 
Join Date: Jan 2005
Posts: 5,563
Rep Power: 62
Russ is just super!Russ is just super!Russ is just super!Russ is just super!Russ is just super!Russ is just super!

Re: Need Help With Programming For Kxctrl

OK, to confirm, you want the gg command to return the register value in decimal, and the sg command to accept the register value in decimal? That's all, right?
Russ is offline   Reply With Quote
Old Nov 10, 2008, 06:33 PM Threadstarter Thread Starter   #11
DriverHeaven Junior Member
 
Join Date: Mar 2008
Posts: 36
Rep Power: 0
dj-gutz is on a distinguished road
System Specs

Re: Need Help With Programming For Kxctrl

i dont even need gg to return the value because there is no return value option in slycontrol
what i do is writing the value with sg and simultanisly store it in slycontrol itself so i read it from there..

what i want is 2 things :
1.write to sg in decimal
2.be able to figure out what value is what precent of volume for on-screen display (for ex. i can do this if i get min and max value and divide by 100 so it shouldnt be a problem )

really thanks for the help man
dj-gutz is offline   Reply With Quote
Old Nov 10, 2008, 06:42 PM   #12
HardwareHeaven Extreme Member
 
Join Date: Jan 2005
Posts: 5,563
Rep Power: 62
Russ is just super!Russ is just super!Russ is just super!Russ is just super!Russ is just super!Russ is just super!

Re: Need Help With Programming For Kxctrl

Ok, so I will just change the sg command.

The decimal range is -2147483648 to 2147483647, or for a basic volume control (where you would probably want only positive numbers): 0 to 2147483647. You will have to make sure in your code that the value does not go below/above the min/max values (you will not hurt anything, but you will not get the result you expect).

In any case, it should only take a few minutes to do...
Russ is offline   Reply With Quote
Old Nov 10, 2008, 06:49 PM Threadstarter Thread Starter   #13
DriverHeaven Junior Member
 
Join Date: Mar 2008
Posts: 36
Rep Power: 0
dj-gutz is on a distinguished road
System Specs

Re: Need Help With Programming For Kxctrl

yeh i knew that just veryfing thanks
also just to be sure an integer can store these values right?
from what i remeber its exactly the range of an integer..

im waiting
dj-gutz is offline   Reply With Quote
Old Nov 10, 2008, 06:59 PM   #14
HardwareHeaven Extreme Member
 
Join Date: Jan 2005
Posts: 5,563
Rep Power: 62
Russ is just super!Russ is just super!Russ is just super!Russ is just super!Russ is just super!Russ is just super!

Re: Need Help With Programming For Kxctrl

Yes, that is the range of a 32 bit signed integer.

Here is the file: kxctrl2.zip
[COLOR=Gray](the above link is only temporary)[/COLOR]
[COLOR=Gray]<edit> (link removed) </edit>[/COLOR]

Let me know if it works for you.

Last edited by Russ; Nov 10, 2008 at 07:17 PM. Reason: remove temp link
Russ is offline   Reply With Quote
Old Nov 10, 2008, 07:07 PM Threadstarter Thread Starter   #15
DriverHeaven Junior Member
 
Join Date: Mar 2008
Posts: 36
Rep Power: 0
dj-gutz is on a distinguished road
System Specs

Re: Need Help With Programming For Kxctrl

Working!!!
wowww thanks alot man
you have no idea how many hours ive been working on trying to find a workaround
just for last resort i decided to try here

i really appriciate this
thanks thanks thanks thanks
dj-gutz is offline   Reply With Quote
Old Nov 10, 2008, 07:15 PM   #16
HardwareHeaven Extreme Member
 
Join Date: Jan 2005
Posts: 5,563
Rep Power: 62
Russ is just super!Russ is just super!Russ is just super!Russ is just super!Russ is just super!Russ is just super!

Re: Need Help With Programming For Kxctrl

Your welcome, I am glad I could help
Russ is offline   Reply With Quote
Reply

Thread Tools