home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Minami 73
/
MINAMI73.iso
/
Extra
/
MPSetup.exe
/
1033
/
RCDATA
/
CABINET
/
wmploc.DLL
/
256
/
DVDCTRLS.JS
< prev
next >
Wrap
Text File
|
2002-12-14
|
7KB
|
269 lines
// Windows Media Player - Copyright 2000 Microsoft Corporation.
//<script>
var g_kMaxDVDRate=16;
var g_currentSpeedFormatString = theme.loadString("res://wmploc.dll/RT_STRING/#225");
var g_slowSpeedFormatString = theme.loadString("res://wmploc.dll/RT_STRING/#226");
var g_fDraggingSlider = false;
var g_kSpeedFontSize = parseInt(theme.loadString("res://wmploc.dll/RT_STRING/#3023"));
var g_SigFigs = 1;
function UpdateRateUI(rate)
{
g_SigFigs = SnapToTicks.down ? 1 : 3;
CurrentSpeedText.value = sprintf(g_currentSpeedFormatString,rate.SigFig(g_SigFigs));
SetSlider(rate);
}
function isBetween(low,high,value)
{
return ( (this>low) && (this<high) );
}
function SigFig(numSigFigs)
{
//add or subtract 0.5, 0.05, 0.005, etc before truncating to get a rounded value for the last digit
//ex 1) 1.39 + 0.05 gives you 1.44 which truncates to 1.4 (last digit rounds down)
//ex 2) -1.3549 - 0.0005 gives you -1.3554 which truncates to -1.355 (last digit rounds "up", actual value rounds down)
roundingValue = (numSigFigs > 0) ? ( 0.5 / ( Math.pow(10,numSigFigs)) ) : 0;
var valueToRound = (this > 0) ? (this + roundingValue) : (this - roundingValue);
var stringval = valueToRound.toString();
var decimalPosition = stringval.indexOf(".");
if (decimalPosition==-1)
decimalPosition = stringval.indexOf(",");
if(decimalPosition!=-1)
{
stringval = stringval.slice(0,decimalPosition+numSigFigs+1);
}
return stringval;
}
Number.prototype.isBetween = isBetween;
Number.prototype.SigFig = SigFig;
function StartStopTimer(playstate)
{
if ( (playstate>=psStopped) && (playstate<=psScanReverse) )
{
view.timerInterval=50;
}
else
{
view.timerInterval=0;
}
}
var g_kSliderPos = new Array();
g_kSliderPos[-16] =0;
g_kSliderPos[-8] =1.684;
g_kSliderPos[-6] =3.368;
g_kSliderPos[-4] =5.053;
g_kSliderPos[0] =6.737;
g_kSliderPos[0.5] =8.421;
g_kSliderPos[1] =14.035;
g_kSliderPos[1.4] =18.526;
g_kSliderPos[2] =25.263;
g_kSliderPos[4] =26.947;
g_kSliderPos[6] =28.632;
g_kSliderPos[8] =30.316;
g_kSliderPos[16] =32;
function RescaleValue(scaleAMin, scaleAMax, Avalue, scaleBMin, scaleBMax )
{
if (scaleAMax==scaleAMin) return 0;
var dA = Avalue-scaleAMin;
var ddA = dA / (scaleAMax-scaleAMin);
return scaleBMin + ddA * (scaleBMax-scaleBMin);
}
function GetSliderFromRate(rate)
{
var rateScaleMin = 0;
var rateScaleMax = 0;
if ( (rate>=-16) && (rate<=-8) )
{
rateScaleMin=-16;
rateScaleMax=-8;
}
else if ( (rate>=-8) && (rate<=-4) )
{
rateScaleMin=-8;
rateScaleMax=-4;
}
else if ( (rate>=-4) && (rate<=0) )
{
rateScaleMin=-4;
rateScaleMax=0;
}
else if ( (rate>=0) && (rate<=0.5) )
{
rateScaleMin=0;
rateScaleMax=0.5;
}
else if ( (rate>=0.5) && (rate<1) )
{
rateScaleMin=0.5;
rateScaleMax=1;
}
else if ( (rate>=1) && (rate<=1.4) )
{
rateScaleMin=1;
rateScaleMax=1.4;
}
else if ( (rate>=1.4) && (rate<=2) )
{
rateScaleMin=1.4;
rateScaleMax=2;
}
else if ( (rate>=2) && (rate<=8) )
{
rateScaleMin=2;
rateScaleMax=8;
}
else if ( (rate>=8) && (rate<=16) )
{
rateScaleMin=8;
rateScaleMax=16;
}
return RescaleValue(rateScaleMin, rateScaleMax, rate, g_kSliderPos[rateScaleMin], g_kSliderPos[rateScaleMax]);
}
function GetRateFromSlider(sliderval)
{
var rateScaleMin = 0;
var rateScaleMax = 0;
if ( (sliderval>=g_kSliderPos[-16]) && (sliderval<=g_kSliderPos[-8]) )
{
rateScaleMin=-16;
rateScaleMax=-8;
}
else if ( (sliderval>=g_kSliderPos[-8]) && (sliderval<=g_kSliderPos[-4]) )
{
rateScaleMin=-8;
rateScaleMax=-4;
}
else if ( (sliderval>=g_kSliderPos[-4]) && (sliderval<=g_kSliderPos[0]) )
{
rateScaleMin=-4;
rateScaleMax=0;
}
else if ( (sliderval>=g_kSliderPos[0]) && (sliderval<=g_kSliderPos[0.5]) )
{
rateScaleMin=0;
rateScaleMax=0.5;
}
else if ( (sliderval>=g_kSliderPos[0.5]) && (sliderval<g_kSliderPos[1]) )
{
rateScaleMin=0.5;
rateScaleMax=1;
}
else if ( (sliderval>=g_kSliderPos[1]) && (sliderval<=g_kSliderPos[1.4]) )
{
rateScaleMin=1;
rateScaleMax=1.4;
}
else if ( (sliderval>=g_kSliderPos[1.4]) && (sliderval<=g_kSliderPos[2]) )
{
rateScaleMin=1.4;
rateScaleMax=2;
}
else if ( (sliderval>=g_kSliderPos[2]) && (sliderval<=g_kSliderPos[8]) )
{
rateScaleMin=2;
rateScaleMax=8;
}
else if ( (sliderval>=g_kSliderPos[8]) && (sliderval<=g_kSliderPos[16]) )
{
rateScaleMin=8;
rateScaleMax=16;
}
return RescaleValue(g_kSliderPos[rateScaleMin], g_kSliderPos[rateScaleMax], sliderval, rateScaleMin, rateScaleMax);
}
function SetSlider(rate)
{
PlaySpeedSlider.value = GetSliderFromRate(rate);
}
function SetRate(slider)
{
var newRate = GetRateFromSlider(slider);
if (SnapToTicks.down)
{
newRate = SnapToTickMark(newRate);
}
if (0!=newRate)
{
try
{
player.settings.rate = newRate;
}
catch(err)
{}
}
UpdateRateUI(player.settings.rate);
}
function SnapToTickMark(newRate)
{
if (newRate<-12)
newRate=-16;
else if ( newRate.isBetween(-10,-9) )
newRate=-8;
else if ( newRate.isBetween(-7,-5) )
newRate=-6;
else if ( newRate.isBetween(-5,-3) )
newRate=-4;
else if ( newRate.isBetween(0.0, 0.6) )
newRate=0.5;
else if ( newRate.isBetween(0.9, 1.1) )
newRate=1;
else if ( newRate.isBetween(1.3, 1.5) )
newRate=1.4;
else if ( newRate.isBetween(1.9, 3) )
newRate=2;
else if (newRate.isBetween(3, 5) )
newRate=4;
else if (newRate.isBetween(5, 7) )
newRate=6;
else if (newRate.isBetween(7, 10) )
newRate=8;
else if (newRate>12)
newRate=16;
else
newRate = newRate.SigFig(1);
return parseFloat(newRate);
}
function GoSlow()
{
player.settings.rate=mediacenter.slowRate;
}
function GoNormal()
{
player.settings.rate=1;
}
function GoFast()
{
player.settings.rate=mediacenter.fastRate;
}
function UpdateSpeedView()
{
if ( player.controls.isAvailable("timeCompression") )
{
SpeedSubview.backgroundImage="res://wmploc/#2151";
}
else
{
SpeedSubview.backgroundImage="res://wmploc/#2158";
}
}