require "import"
import "android.widget.*"
import "android.view.*"
layout=
{
LinearLayout,
orientation=1,
layout_width=-1,
layout_height=-1,
{
LinearLayout,
layout_width=-1,
layout_height=-1,
layout_weight=0,
{
TextView,
text="语音调节面板",
Gravity="center_horizontal",
textSize='50sp';
textColor='#ff0000';
layout_width=-1,
layout_height="10%h",
layout_weight=-1,
},
},
{
LinearLayout,
layout_width=-1,
layout_height=-1,
layout_weight=0,
{
EditText,
id="edit",
hint="请输入数字",
HintTextColor='#ff00ffff',
textColor="#ff00ffff",
textSize='40sp';
layout_width=-1,
layout_height="10%h",
layout_weight=1,
},
},
{
LinearLayout,
layout_width=-1,
layout_height=-1,
layout_weight=1,
{
Button,
text="10",
onClick="sz",
textColor="#ffff00ff",
textSize='20sp';
layout_width=-1,
layout_height="10%h",
layout_weight=1,
},
{
Button,
text="20",
onClick="sz",
textColor="#ffff00ff",
textSize='20sp';
layout_width=-1,
layout_height="10%h",
layout_weight=1,
},
{
Button,
text="30",
onClick="sz",
textColor="#ffff00ff",
textSize='20sp';
layout_width=-1,
layout_height="10%h",
layout_weight=1,
},
{
Button,
text="40",
onClick="sz",
textColor="#ffff00ff",
textSize='20sp';
layout_width=-1,
layout_height="10%h",
layout_weight=1,
},
{
Button,
text="50",
onClick="sz",
textColor="#ffff00ff",
textSize='20sp';
layout_width=-1,
layout_height="10%h",
layout_weight=1,
},
},
{
LinearLayout,
layout_width=-1,
layout_height=-1,
layout_weight=1,
{
Button,
text="60",
onClick="sz",
textColor="#ffff00ff",
textSize='20sp';
layout_width=-1,
layout_height="10%h",
layout_weight=1,
},
{
Button,
text="70",
onClick="sz",
textColor="#ffff00ff",
textSize='20sp';
layout_width=-1,
layout_height="10%h",
layout_weight=1,
},
{
Button,
text="80",
onClick="sz",
textColor="#ffff00ff",
textSize='20sp';
layout_width=-1,
layout_height="10%h",
layout_weight=1,
},
{
Button,
text="90",
onClick="sz",
textColor="#ffff00ff",
textSize='20sp';
layout_width=-1,
layout_height="10%h",
layout_weight=1,
},
{
Button,
text="100",
onClick="sz",
textColor="#ffff00ff",
textSize='20sp';
layout_width=-1,
layout_height="10%h",
layout_weight=1,
},
{
Button,
text=".",
onClick="dian",
textColor="#ffff00ff",
textSize='20sp';
layout_width=-1,
layout_height="10%h",
layout_weight=1,
},},
{LinearLayout,
orientation=0,
layout_width=-1,
layout_height=-1,
layout_weight=1,
{LinearLayout,
orientation=1,
layout_width=-1,
layout_height=-1,
layout_weight=1,
{
Button,
text="主语音音量,\n无输入则切换讯飞",
onClick="zyyyl",
textColor="#ff00ff00",
textSize='20sp';
layout_width=-1,
layout_height="10%h",
layout_weight=1,
},
{
Button,
text="主语音语速,\n无输入则切换SmartVoice",
onClick="zyyys",
textColor="#ff00ff00",
textSize='20sp';
layout_width=-1,
layout_height="10%h",
layout_weight=1,
},
{
Button,
text="主语音音调,\n无输入则切换讯飞语记",
onClick="zyyyd",
textColor="#ff00ff00",
textSize='20sp';
layout_width=-1,
layout_height="10%h",
layout_weight=1,
},
{
Button,
text="主语音语速加倍,\n无输入则切换天坦语音",
onClick="zyyjb",
textColor="#ff00ff00",
textSize='20sp';
layout_width=-1,
layout_height="10%h",
layout_weight=1,
},
{Button,
text="选择主语音库",
onClick="zyyyq",
textColor="#ff00ff00",
textSize='20sp';
layout_width=-1,
layout_height="10%h",
layout_weight=1,},
},
{
LinearLayout,
orientation=1,
layout_width=-1,
layout_height=-1,
layout_weight=1,
{
Button,
text="副语音音量,\n无输入则切换系统语音引擎",
onClick="fyyyl",
textColor="#ff0000ff",
textSize='20sp';
layout_width=-1,
layout_height="10%h",
layout_weight=1,
},
{
Button,
text="副语音语速,\n无输入则切换multitts",
onClick="fyyys",
textColor="#ff0000ff",
textSize='20sp';
layout_width=-1,
layout_height="10%h",
layout_weight=1,
},
{
Button,
text="副语音语调",
onClick="fyyyd",
textColor="#ff0000ff",
textSize='20sp';
layout_width=-1,
layout_height="10%h",
layout_weight=1,
},
{
Button,
text="副语音语速加倍",
onClick="fyyjb",
textColor="#ff0000ff",
textSize='20sp';
layout_width=-1,
layout_height="10%h",
layout_weight=1,
},
{Button,
text="选择副语音库",
onClick="fyyyq",
textColor="#ff0000ff",
textSize='20sp';
layout_width=-1,
layout_height="10%h",
layout_weight=1,},
},
},
}
dlg=LuaDialog()
.setView(loadlayout(layout))
.show()
function zyyyl()
dlg.hide()
if edit.text~=""
service.setTTSVolume(tonumber(edit.text))
service.asyncSpeak("音量"..edit.text)
else
service.click({{
"%选择语音库$100","讯飞"
}})
end
end
function zyyys()
dlg.hide()
if edit.text~=""
service.setTTSSpeed(tonumber(edit.text))
service.asyncSpeak("语速"..edit.text)
else
service.click({{
"%主语音库/tts.smartvoice"
}})
end
end
function zyyyd()
dlg.hide()
if edit.text~=""
service.setTtsPitch(tonumber(edit.text))
service.asyncSpeak("语调"..edit.text)
else
service.click({{
"%主语音库/com.iflytek.vflynote"
}})
end
end
function zyyjb()
dlg.hide()
if edit.text~=""
service.setTtsScale(tonumber(edit.text))
service.asyncSpeak("加倍"..edit.text)
else
service.click({{
"%主语音库/com.android.tback"
}})
end
end
function fyyyl()
dlg.hide()
if edit.text~=""
service.setAsyncTTSVolume(tonumber(edit.text))
service.asyncSpeak("音量"..edit.text)
else
service.click({{
"%主语音库/com.xiaomi.mibrain.speech"
}})
end
end
function fyyys()
dlg.hide()
if edit.text~=""
service.setAsyncTTSSpeed(tonumber(edit.text))
service.asyncSpeak("语速"..edit.text)
else
service.click({{
"%主语音库/org.nobody.multitts"
}})
end
end
function fyyyd()
dlg.hide()
service.setAsyncTtsPitch(tonumber(edit.text))
service.asyncSpeak("语调"..edit.text)
end
function fyyjb()
dlg.hide()
service.setAsyncTtsScale(tonumber(edit.text))
service.asyncSpeak("加倍"..edit.text)
end
function zyyyq()
dlg.hide()
service.setTtsEngine()
end
function fyyyq()
dlg.hide()
service.setAsyncTtsEngine()
end
function sz(v)
edit.text=edit.text..v.getText()
end
function dian(v)
edit.text=utf8.sub(edit.text,1,-2)..v.getText()
end
来自解说社区客户端 |