Quantcast
Channel: Adobe Community : Popular Discussions - Premiere Pro SDK
Viewing all articles
Browse latest Browse all 53010

Logarithmic Slider

$
0
0

Hello.

 

I've recently started getting accustomed to ExtendScript and I've hit a bump. Namely, the audio volume slider in Premiere Pro. I'm trying to create a slider with a label that gets the value volume value from an audio clip (activeSequence.audioTracks[0].clips[0]) and sets the slider thumb accordingly. When a user moves the thumb, it sets the audio clip's volume.

But the thing is, I would like to have it sync'd to PPro's audio clip mixer -> -inf to 0 to 6 db.

My question... could you please help me figure out the function for turning the 0-1 float value to an actual slider position?

 

I found this online regarding log sliders, but it doesn't appear to be that accurate, in regards to PPro's slider.

function logslider(position) 
{  // position will be between 0 and 100  var minp = 0;  var maxp = 100;  // The result should be between 100 an 10000000  var minv = Math.log(100);  var maxv = Math.log(10000000);  // calculate adjustment factor  var scale = (maxv-minv) / (maxp-minp);  return Math.exp(minv + scale*(position-minp));
}

Viewing all articles
Browse latest Browse all 53010

Trending Articles