未解
function StrFmt(alignH, alignV, trim, flag) {
return ((alignH << 28) | (alignV << 24) | (trim << 20) | flag);
}
时间戳转时分秒字符串
function TimeFmt(t) {
if (t < 0) return "00:00:00";
var zpad = function(n) {
var str = n.toString();
return (str.length < 2) ? "0" + str : str;
}
var h = Math.floor(t / 3600);
t -= h * 3600;
m = Math.floor(t / 60);
t -= m * 60, s = Math.floor(t);
return zpad(h) + ":" + zpad(m) + ":" + zpad(s);
}
格式化HMS
function Format_hms(t) {
if (t=="?") return "00:00:00";
var hms;
if (t) {
switch (t.length) {
case 4:
hms = "00:0" + t;
break;
case 5:
hms = "00:" + t;
break;
case 7:
hms = "0" + t;
break;
default:
hms = t;
break;
}
return hms;
} else {
return "00:00:00";
}
}
计算音量大小与位置关系算法,未解
function pos2vol(p) {
return (50 * Math.log(0.99 * (p / 100) + 0.01) / Math.log(10));
}
function vol2pos(v) {
return Math.round(((Math.pow(10, v / 50) - 0.01) / 0.99) * 100);
}
windows实现互斥单选按钮:
var MF_STRING = 0x00000000;
var MF_DISABLED = 0x00000002;
var PBOTips = new Array("默认", "重复(列表)", "重复(音轨)", "随机", "乱序(音轨)", "乱序(专辑)", "乱序(目录)");
PBO_Menu = function(x, y) {
var PBOmenu = window.CreatePopupMenu();
var menu_item_count = 0;
for (var i = 0; i < PBOTips.length; i++)
PBOmenu.AppendMenuItem(MF_STRING, ++menu_item_count, PBOTips[i]);
PBOmenu.CheckMenuRadioItem(1, menu_item_count, fb.PlayBackOrder + 1);
var ret = 0;
ret = PBOmenu.TrackPopupMenu(x, y, 0x0020);
if (ret) {
switch (ret) {
default:
fb.PlaybackOrder = ret - 1;
PBOmenu.CheckMenuRadioItem(1, menu_item_count, ret);
break;
}
}
PBOmenu.Dispose();
}
????CheckMenuRadioItem方法不太懂