/* ----------------------------------------------------------------------------- This source file is part of OpenSpace3D For the latest info, see http://www.openspace3d.com Copyright (c) 2012 I-maginer This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA, or go to http://www.gnu.org/copyleft/lesser.txt ----------------------------------------------------------------------------- */ struct PiperVoiceList = [ VL_sName : S, VL_sQuality : S, VL_sModelUrl : S, VL_sConfUrl : S ]mkPiperVoiceList;; struct PiperLangList = [ VLg_sLang : S, VLg_lVoices : [PiperVoiceList r1] ]mkPiperLangList;; struct PiperPreview = [ VPP_Speech : ObjSpeech, VPP_player : AudioPlayer ] mkPiperPreview;; typeof lCurrentVoices = [PiperVoiceList r1];; typeof lLangsVoiceList = [[S PiperLangList] r1];; var sVoiceDirectory = "tmp/voices/";; fun cbDestroyEdit(prevstr)= _DSSpeech prevstr.VPP_Speech; audioPlayerDelete prevstr.VPP_player; 0;; fun cbCloseEdit(p)= let p -> [ctrlspeechText ctrlvoicemodel ctrlvoiceid ctrlRate ctrlEnableSpeech ctrl3daudio ctrlobjname ctrlattenuation ctrlinner ctrlouter ctrloutervol ctrlpitch ctrlVolume ctrlenableeffect prevstr] in ( _DSSpeech prevstr.VPP_Speech; audioPlayerDelete prevstr.VPP_player; let getEdCtrlEditTextValue ctrlspeechText -> text in let getSelectedEdCtrlSelect ctrlvoicemodel -> voicename in let if (voicename == nil) then nil else strcat sVoiceDirectory voicename -> voicemodel in let if (voicename == nil) then nil else strcat voicemodel ".json" -> voiceconfig in let getSelectedEdCtrlSelect ctrlvoiceid -> voiceid in let getEdCtrlFloatValue ctrlRate -> rate in let getEdCtrlCheckState ctrlEnableSpeech -> initStartSpeech in let getEdCtrlCheckState ctrl3daudio -> is3daudio in let getEdCtrlTextLineValue ctrlobjname -> source in let getEdCtrlFloatValue ctrlattenuation -> attenuation in let ftoi getEdCtrlFloatValue ctrlinner -> innerangle in let ftoi getEdCtrlFloatValue ctrlouter -> outerangle in let ftoi getEdCtrlFloatValue ctrloutervol -> outervol in let getEdCtrlFloatValue ctrlpitch -> pitch in let getEdCtrlFloatValue ctrlVolume -> volume in let getEdCtrlCheckState ctrlenableeffect -> enableeffect in ["text" text]:: ["voicemodel" voicemodel]:: ["voiceconfig" voiceconfig]:: ["voiceid" voiceid]:: ["is3daudio" itoa is3daudio]:: ["source" source]:: ["attenuation" ftoa attenuation]:: ["innerangle" itoa innerangle]:: ["outerangle" itoa outerangle]:: ["outervol" itoa outervol]:: ["pitch" ftoa pitch]:: ["volume" ftoa volume]:: ["enableeffect" itoa enableeffect]:: ["rate" ftoa rate]:: ["enableSpeech" itoa initStartSpeech]::nil; );; fun cbSpeechBufferPreview(speech, prevstr, buff)= audioPlayerUpdateBuffer prevstr.VPP_player buff; 0;; fun cbBtnTest(ctrlbtn, p)= let p -> [ctrlvoicemodel ctrlvoiceid ctrlspeechText ctrlVolume ctrlRate ctrlpitch prevstr] in let getSelectedEdCtrlSelect ctrlvoicemodel -> voicename in let getSelectedEdCtrlSelect ctrlvoiceid -> voiceid in let if (voicename == nil) then nil else strcat sVoiceDirectory voicename -> voicemodel in ( _SetSpeechVoiceModel prevstr.VPP_Speech _checkpack voicemodel; _SetSpeechVoice prevstr.VPP_Speech voiceid; audioPlayerOpenBuffered prevstr.VPP_player (_GetSpeechVoiceSampleRate prevstr.VPP_Speech) AUDIO_16BIT_MONO; audioPlayerStop prevstr.VPP_player; audioPlayerSetVolume prevstr.VPP_player ftoi (getEdCtrlFloatValue ctrlVolume); audioPlayerSetPitch prevstr.VPP_player (getEdCtrlFloatValue ctrlpitch); _SetSpeechRate prevstr.VPP_Speech ftoi (getEdCtrlFloatValue ctrlRate); _SetSpeechText prevstr.VPP_Speech (getEdCtrlEditTextValue ctrlspeechText); _CBSpeechBuffer prevstr.VPP_Speech @cbSpeechBufferPreview prevstr; audioPlayerPlay prevstr.VPP_player; _PlaySpeech prevstr.VPP_Speech; ); 0;; fun getVoiceModelDownloadPath(voicestr)= let getPathFile voicestr.VL_sModelUrl nil -> [_ fname] in let strfind "?" fname 0 -> ppos in let if ppos == nil then nil else substr fname 0 ppos -> fname in strcat sVoiceDirectory fname;; fun isVoiceDownloaded(voicestr)= if (_checkpack getVoiceModelDownloadPath voicestr) != nil then 1 else 0;; fun getLocalVoices(ctrlvoicemodel)= let getSelectedEdCtrlSelect ctrlvoicemodel -> voicename in ( resetEdCtrlSelect ctrlvoicemodel; let getFilesFromDir sVoiceDirectory "onnx"::nil -> lfiles in while (lfiles != nil) do ( let hd lfiles -> file in let getPathFile file nil -> [_ fname] in addEdCtrlSelect ctrlvoicemodel fname; set lfiles = tl lfiles; ); selectEdCtrlSelect ctrlvoicemodel voicename; ); 0;; fun cbDownloadVoiceConf(url, data, p)= let p -> [voicestr dlinfo fname] in if (data == nil) then ( setEdCtrlTextValue dlinfo strcatn (loc "OS3DSPEECH_0013")::":\n"::url::nil; 0; ) else ( setEdCtrlTextValue dlinfo strcatn (loc "OS3DSPEECH_0015")::":\n"::voicestr.VL_sName::" - "::voicestr.VL_sQuality::nil; 0; ); 0;; fun cbDownloadVoiceModel(url, wfile, p)= let p -> [voicestr dlinfo fname] in if (wfile == nil) then ( setEdCtrlTextValue dlinfo strcatn (loc "OS3DSPEECH_0013")::":\n"::url::nil; 0; ) else ( let strcat fname ".json" -> fname in ( if ((_checkpack fname) == nil) then nil else _deletepack _checkpack fname; downloadFileW voicestr.VL_sConfUrl _getmodifypack fname mkfun3 @cbDownloadVoiceConf [voicestr dlinfo fname]; ); 0; ); 0;; fun downloadVoice(voicestr, dlinfo)= setEdCtrlTextValue dlinfo strcatn (loc "OS3DSPEECH_0016")::"\n"::voicestr.VL_sModelUrl::nil; let getVoiceModelDownloadPath voicestr -> fname in ( if ((_checkpack fname) == nil) then nil else _deletepack _checkpack fname; downloadFileW voicestr.VL_sModelUrl _getmodifypack fname mkfun3 @cbDownloadVoiceModel [voicestr dlinfo fname]; ); 0;; fun listVoices()= let lLangsVoiceList -> l in while (l != nil) do ( let hd l -> [lg lst] in ( let lst.VLg_lVoices -> l2 in while (l2 != nil) do ( let hd l2 -> voicestr in addLogMessage strcatn "Lang: "::lg::" > "::lst.VLg_sLang::" Voice model: "::voicestr.VL_sName::" "::voicestr.VL_sQuality::" "::voicestr.VL_sModelUrl::" "::voicestr.VL_sConfUrl::nil; set l2 = tl l2; ); ); set l = tl l; ); 0;; fun parseVoices(str)= let nil -> data in let lineextr str -> l in let nil -> langstr in let nil -> voicename in while (l != nil) do ( let hd l -> line in if (!strcmp "*" (substr line 0 1)) then let (substr line 2 (strlen line) -2) -> lang in let strfind "`" lang 0 -> p1 in let strfind "`" lang p1+1 -> p2 in let if p1 == nil then strfind "(" lang 0 else p1 -> p1 in let if p2 == nil then strfind ")" lang p1+1 else p2 -> p2 in let substr lang p1 + 1 (p2 - (p1 + 1)) -> langref in ( set langstr = mkPiperLangList[lang nil]; set lLangsVoiceList = lcat lLangsVoiceList [langref langstr]::nil; 0; ) else if (!strcmp " *" (substr line 0 5)) then let (substr line 6 (strlen line) -6) -> voice in ( set voicename = voice; 0; ) else if (!strcmp " *" (substr line 0 9)) then let strfind " - " line 10 -> qpos in let (substr line 10 (qpos - 10)) -> quality in //low - [[model] () [[config] () let strfind "[[model](" line qpos -> mpos in let strfind ")]" line mpos -> mepos in let substr line (mpos + 9) (mepos - mpos) - 9 -> model in let strfind "[[config](" line mepos -> cpos in let strfind ")]" line cpos -> cepos in let substr line (cpos + 10) (cepos - cpos) - 10 -> conf in ( let mkPiperVoiceList [voicename quality model conf] -> voicestr in ( //addLogMessage strcatn "Voice model: "::langstr.VLg_sLang::" "::voicestr.VL_sName::" "::voicestr.VL_sQuality::" "::voicestr.VL_sModelUrl::" "::voicestr.VL_sConfUrl::nil; set langstr.VLg_lVoices = lcat langstr.VLg_lVoices voicestr::nil; ); 0; ); set l = tl l; ); 0;; fun cbFillVoicesSelect(ctrlselect, pos, val, ctrlvoice)= resetEdCtrlSelect ctrlvoice; let switchstr lLangsVoiceList val -> lst in ( set lCurrentVoices = lst.VLg_lVoices; let lst.VLg_lVoices -> l2 in while (l2 != nil) do ( let hd l2 -> voicestr in ( let if (isVoiceDownloaded voicestr) then strcatn " *"::(loc "OS3DSPEECH_0017")::"*"::nil else "" -> suffix in addEdCtrlSelect ctrlvoice strcatn voicestr.VL_sName::" - "::voicestr.VL_sQuality::suffix::nil; //addLogMessage strcatn "Voice model: "::voicestr.VL_sName::" "::voicestr.VL_sQuality::" "::voicestr.VL_sModelUrl::" "::voicestr.VL_sConfUrl::nil; ); set l2 = tl l2; ); ); selectEdCtrlSelectByPos ctrlvoice 0; 0;; fun cbBtnDownloadVoice(ctrlbtn, p)= let p -> [ctrlvoice dlinfo] in let nth_list lCurrentVoices getSelectedEdCtrlSelectPos ctrlvoice -> voicestr in if (voicestr == nil) then nil else downloadVoice voicestr dlinfo; 0;; fun cbCloseDownloadVoice(ctrlbtn, p)= let p -> [dlgwin ctrlvoicemodel ctrldlbtn] in ( dsEdWindow dlgwin; getLocalVoices ctrlvoicemodel; setEdCtrlButtonEnable ctrldlbtn 1; ); 0;; fun cbDestroyVoicesInterface(winstr, p)= let p -> [ctrlvoicemodel ctrlbtn] in ( getLocalVoices ctrlvoicemodel; setEdCtrlButtonEnable ctrlbtn 1; ); 0;; fun cbShowVoicesInterface(winstr, ctrlbtn, ctrlvoicemodel)= let getEdWindowScreenPos winstr -> [px py] in let getEdWindowSize winstr -> [pw ph] in let [(pw - 10) 190] -> [iw ih] in let crEdModalDialogWindow _channel winstr (px + 10) (py - 80) iw ih nil nil (loc "OS3DSPEECH_0007") -> dlgwin in let 10 -> ypos in let iw / 5 -> wp in let crEdCtrlLabel dlgwin 10 ypos + 2 ((wp * 2) - 20) 20 (strcat (loc "OS3DSPEECH_0010") " ") nil -> labellang in let crEdCtrlSelect dlgwin ((wp * 2) + 20) ypos ((wp * 3) - 30) 120 CB_AHSCROLL -> ctrllang in let crEdCtrlLabel dlgwin 10 (set ypos = ypos + 25) + 2 ((wp * 2) - 20) 20 (strcat (loc "OS3DSPEECH_0011") " ") nil -> labelvoice in let crEdCtrlSelect dlgwin ((wp * 2) + 20) ypos ((wp * 3) - 30) 120 CB_AHSCROLL -> ctrlvoice in let crEdCtrlText dlgwin 10 (set ypos = ypos + 30) (iw - 20) 80 "" ET_ALIGN_CENTER|ET_BORDER nil -> dlinfo in let crEdCtrlButton dlgwin ((iw / 2) - 95) (set ypos = ih - 35) 90 20 (loc "OS3DSPEECH_0012") nil -> btndownload in let crEdCtrlButton dlgwin ((iw / 2) + 5) ypos 90 20 (loc "OS3DSPEECH_0014") nil -> btnclose in ( let lLangsVoiceList -> l in while (l != nil) do ( let hd l -> [lg lst] in ( addEdCtrlSelect ctrllang lg; ); set l = tl l; ); setEdCtrlSelectCb ctrllang mkfun4 @cbFillVoicesSelect ctrlvoice; selectEdCtrlSelectByPos ctrllang 0; cbFillVoicesSelect ctrllang 0 (getSelectedEdCtrlSelect ctrllang) ctrlvoice; setEdCtrlButtonCb btndownload mkfun2 @cbBtnDownloadVoice [ctrlvoice dlinfo]; setEdCtrlButtonCb btnclose mkfun2 @cbCloseDownloadVoice [dlgwin ctrlvoicemodel ctrlbtn]; setEdwindowCbDestroy dlgwin mkfun2 @cbDestroyVoicesInterface [ctrlvoicemodel ctrlbtn]; ); //let switchstr lLangsVoiceList "fr_FR" -> lv in //downloadVoice winstr hd lv.VLg_lVoices; 0;; fun cbGetVoiceListData(url, data, p)= if (data != nil) then ( parseVoices utf8tostr data; let p -> [cbfun [ctrlbtn [winstr ctrlvoicemodel]]] in exec cbfun with [winstr ctrlbtn ctrlvoicemodel]; ) else ( let p -> [cbfun [ctrlbtn [winstr ctrlvoicemodel]]] in ( setEdCtrlButtonEnable ctrlbtn 1; _DLGMessageBox _channel winstr.EDW_win (loc "OS3DSPEECH_0012") (loc "OS3DSPEECH_0013") 0; addLogMessage "Speech PlugIT : no data found to retrieve the online voice list!"; ); 0; ); 0;; fun cbGetVoiceListConnected(rul, p, rc)= // Active Internet Connection detected if (rc == 1) then ( downloadFile "https://raw.githubusercontent.com/rhasspy/piper/master/VOICES.md" mkfun3 @cbGetVoiceListData p; 0; ) // No Active Internet Connection detected else ( let p -> [cbfun [ctrlbtn [winstr ctrlvoicemodel]]] in ( setEdCtrlButtonEnable ctrlbtn 1; _DLGMessageBox _channel winstr.EDW_win (loc "OS3DSPEECH_0012") (loc "OS3DSPEECH_0013") 0; addLogMessage "Speech PlugIT : no internet connection found to retrieve the online voice list!"; ); 0; );; fun getVoiceList(cbfun, p)= checkInternetConnection nil @cbGetVoiceListConnected [cbfun p]; 0;; //TODO test local voice and get voices ids fun cbBtnAddVoices(ctrlbtn, p)= setEdCtrlButtonEnable ctrlbtn 0; getVoiceList @cbShowVoicesInterface [ctrlbtn p]; 0;; fun createSpeechPreview(inst)= let _CRSpeech _channel -> speech in let audioPlayerCreate strcat (getPluginInstanceName inst) "_edit" 0 1 100 1.0 nil -> sndplayer in ( mkPiperPreview [speech sndplayer]; );; fun cbSelectVoiceModel(ctrlselect, pos, val, p)= let p -> [ctrlvoiceid prevstr] in let if (val == nil) then nil else strcat sVoiceDirectory val -> voicemodel in ( _SetSpeechVoiceModel prevstr.VPP_Speech _checkpack voicemodel; fillEdCtrlSelect ctrlvoiceid _GetSpeechVoices prevstr.VPP_Speech nil; selectEdCtrlSelectByPos ctrlvoiceid 0; ); 0;; fun cbSelectObj(val, type, p)= let p -> [inst winstr viewstr ctrlobjname] in let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) val -> obj in if (obj != nil) || (!strcmpi "Current camera" val) || (!strcmpi "Current camera shell" val) then ( setEdCtrlTextLineValue ctrlobjname val; ) else nil; 0;; fun cbCloseRes(ctrlbtn)= setEdCtrlButtonEnable ctrlbtn 1; 0;; fun cbBtnPickObj(ctrlbtn, p)= let p -> [inst winstr viewstr ctrlobjname objname] in ( setEdCtrlButtonEnable ctrlbtn 0; dlgSelectPluginInstanceResource inst winstr iTypeGroup|iTypeEntity|iTypeNode|iTypeLight|iTypeCamera|iTypeParticle|iTypeCubeMap|iTypeBone objname mkfun3 @cbSelectObj [inst winstr viewstr ctrlobjname] mkfun1 @cbCloseRes ctrlbtn 0; ); 0;; fun cbRefreshBtn(pickbtn, p)= let p -> [ctrlobjname] in setEdCtrlTextLineValue ctrlobjname ""; 0;; fun cbCheck3dAudio(ctrl, state, p)= let p -> [pickbtn ctrlattenuation ctrlinner ctrlouter ctrloutervol] in ( setEdCtrlButtonEnable pickbtn state; setEdCtrlFloatEnable ctrlattenuation state; setEdCtrlFloatEnable ctrlinner state; setEdCtrlFloatEnable ctrlouter state; setEdCtrlFloatEnable ctrloutervol state; ); 0;; fun dynamicedit(ewinstr, inst, viewstr, applybtn)= // let _GETscreenSize -> [sw sh] in let [455 595] -> [iw ih] in ( setEdWindowSize ewinstr iw ih; let getPluginInstanceParam inst "text" -> text in //let if (text == nil) then (loc "OS3DSPEECH_0005") else text -> text in let (getPluginInstanceParam inst "voicemodel") -> voicemodel in let if (voicemodel == nil) then nil else let getPathFile voicemodel nil -> [_ vmod] in vmod -> voicemodel in let (getPluginInstanceParam inst "voiceid") -> voiceid in let atof (getPluginInstanceParam inst "rate") -> rate in let if rate == nil then 0.0 else rate -> rate in let atoi (getPluginInstanceParam inst "is3daudio") -> is3daudio in let if is3daudio == nil then 0 else is3daudio -> is3daudio in let (getPluginInstanceParam inst "source") -> objname in let atof (getPluginInstanceParam inst "attenuation") -> attenuation in let if attenuation == nil then 1.0 else attenuation -> attenuation in let atoi (getPluginInstanceParam inst "innerangle") -> innerangle in let if innerangle == nil then 360 else innerangle -> innerangle in let atoi (getPluginInstanceParam inst "outerangle") -> outerangle in let if outerangle == nil then 360 else outerangle -> outerangle in let atoi (getPluginInstanceParam inst "outervol") -> outervol in let if outervol == nil then 0 else outervol -> outervol in let atof (getPluginInstanceParam inst "pitch") -> pitch in let if pitch == nil then 1.0 else pitch -> pitch in let atoi (getPluginInstanceParam inst "enableeffect") -> enableeffect in let if (enableeffect == nil) then 1 else enableeffect -> enableeffect in let atof (getPluginInstanceParam inst "volume") -> volume in let if volume == nil then 100.0 else volume -> volume in let atoi (getPluginInstanceParam inst "enableSpeech") -> initStartSpeech in let if initStartSpeech == nil then 1 else initStartSpeech -> initStartSpeech in let 10 -> ypos in let crEdFrameWindow _channel ewinstr 0 0 iw 280 EDWIN_RESIZE_MW nil (loc "OS3DSPEECH_0001") (loc "OS3DSPEECH_0000") -> winfrm in let crEdWindow _channel winfrm 0 18 iw 260 WN_CHILDINSIDE|WN_NOBORDER EDWIN_RESIZE_MW nil nil -> winstr in let crEdCtrlLabel winstr 7 ypos + 2 160 20 (loc "OS3DSPEECH_0004") nil -> labelSpeech in let crEdCtrlEditText winstr 10 (set ypos = ypos + 25) (iw - 20) 120 text nil nil -> ctrlspeechText in let crEdCtrlLabel winstr 10 (set ypos = ypos + 125) + 2 160 20 (strcat (loc "OS3DSPEECH_0006") " ") nil -> labelvoice in let crEdCtrlSelect winstr 10 (set ypos = ypos + 25) 280 120 CB_AHSCROLL -> ctrlvoicemodel in let crEdCtrlButton winstr 295 ypos 90 20 (loc "OS3DSPEECH_0007") nil -> btnaddvoice in let crEdCtrlButton winstr 390 ypos 60 20 (loc "OS3DSPEECH_0008") nil -> btntest in let crEdCtrlSelect winstr 10 (set ypos = ypos + 25) 160 120 CB_AHSCROLL -> ctrlvoiceid in let crEdCtrlLabel winstr 10 (set ypos = ypos + 25) + 2 160 20 (loc "OS3DSPEECH_0009") nil -> labelrate in let crEdCtrlFloat winstr 180 ypos 100 20 rate (-.100.0) 10.0 1.0 0 nil EDWIN_RESIZE_MW -> ctrlRate in let crEdFrameWindow _channel ewinstr 0 0 iw 255 EDWIN_RESIZE_MW nil (loc "OS3DSPEECH_0002") (loc "OS3DSPEECH_0000") -> winfrm in let crEdWindow _channel winfrm 0 18 iw 235 WN_CHILDINSIDE|WN_NOBORDER EDWIN_RESIZE_MW nil nil -> winstr in let crEdCtrlCheck winstr 10 ((set ypos = 10) + 2) 280 20 (loc "OS3DSPEECH_0018") EDWIN_RESIZE_MW -> ctrl3daudio in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 160 20 (loc "OS3DSPEECH_0019") nil -> labelobj in let crEdCtrlTextLine winstr 180 ypos 140 20 objname nil EDWIN_RESIZE_MW -> ctrlobjname in let crEdCtrlButton winstr 325 ypos 55 20 "..." nil -> pickbtn in let crEdCtrlButton winstr 385 ypos 35 20 "X" nil -> refreshobjname in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 160 20 (loc "OS3DSPEECH_0020") nil -> labelatt in let crEdCtrlFloat winstr 180 ypos 100 20 attenuation 0.0 10000.0 0.01 5 nil EDWIN_RESIZE_MW -> ctrlattenuation in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 160 20 (loc "OS3DSPEECH_0021") nil -> labelinner in let crEdCtrlFloat winstr 180 ypos 100 20 itof innerangle 0.0 360.0 1.0 0 nil EDWIN_RESIZE_MW -> ctrlinner in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 160 20 (loc "OS3DSPEECH_0022") nil -> labelouter in let crEdCtrlFloat winstr 180 ypos 100 20 itof outerangle 0.0 360.0 1.0 0 nil EDWIN_RESIZE_MW -> ctrlouter in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 160 20 (loc "OS3DSPEECH_0023") nil -> labeloutervol in let crEdCtrlFloat winstr 180 ypos 100 20 itof outervol 0.0 1000.0 1.0 0 nil EDWIN_RESIZE_MW -> ctrloutervol in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 160 20 (loc "OS3DSPEECH_0024") nil -> labelpitch in let crEdCtrlFloat winstr 180 ypos 100 20 pitch 0.0 10.0 0.001 4 nil EDWIN_RESIZE_MW -> ctrlpitch in let crEdCtrlLabel winstr 10 (set ypos = ypos + 25) + 2 160 20 (loc "OS3DSPEECH_0025") nil -> labelvolume in let crEdCtrlFloat winstr 180 ypos 100 20 volume 0.0 100.0 1.0 0 nil EDWIN_RESIZE_MW -> ctrlVolume in let crEdCtrlCheck winstr 10 (set ypos = ypos + 25) 280 20 (loc "OS3DSPEECH_0026") nil -> ctrlenableeffect in let crEdFrameWindow _channel ewinstr 0 0 iw 55 EDWIN_RESIZE_MW nil (loc "OS3DSPEECH_0003") (loc "OS3DSPEECH_0000") -> winfrm in let crEdWindow _channel winfrm 0 18 iw 35 WN_CHILDINSIDE|WN_NOBORDER EDWIN_RESIZE_MW nil nil -> winstr in let crEdCtrlCheck winstr 10 (set ypos = 10) 280 20 (loc "OS3DSPEECH_0027") EDWIN_RESIZE_MW -> ctrlEnableSpeech in let createSpeechPreview inst -> prevstr in ( setEdCtrlCheckState ctrlEnableSpeech initStartSpeech; getLocalVoices ctrlvoicemodel; if (voicemodel == nil) then ( selectEdCtrlSelectByPos ctrlvoicemodel 0; 0; ) else ( selectEdCtrlSelect ctrlvoicemodel voicemodel; 0; ); cbSelectVoiceModel ctrlvoicemodel nil (getSelectedEdCtrlSelect ctrlvoicemodel) [ctrlvoiceid prevstr]; selectEdCtrlSelect ctrlvoiceid voiceid; setEdCtrlSelectCb ctrlvoicemodel mkfun4 @cbSelectVoiceModel [ctrlvoiceid prevstr]; setEdCtrlButtonCb btnaddvoice mkfun2 @cbBtnAddVoices [ewinstr ctrlvoicemodel]; setEdCtrlButtonCb btntest mkfun2 @cbBtnTest [ctrlvoicemodel ctrlvoiceid ctrlspeechText ctrlVolume ctrlRate ctrlpitch prevstr]; setEdCtrlButtonCb pickbtn mkfun2 @cbBtnPickObj [inst winstr viewstr ctrlobjname objname]; setEdCtrlTextLineEnable ctrlobjname 0; setEdCtrlButtonCb refreshobjname mkfun2 @cbRefreshBtn [ctrlobjname]; setEdCtrlCheckState ctrl3daudio is3daudio; cbCheck3dAudio ctrl3daudio is3daudio [pickbtn ctrlattenuation ctrlinner ctrlouter ctrloutervol]; setEdCtrlCheckCbState ctrl3daudio mkfun3 @cbCheck3dAudio [pickbtn ctrlattenuation ctrlinner ctrlouter ctrloutervol]; setEdCtrlCheckState ctrlenableeffect enableeffect; [mkfun1 @cbCloseEdit [ctrlspeechText ctrlvoicemodel ctrlvoiceid ctrlRate ctrlEnableSpeech ctrl3daudio ctrlobjname ctrlattenuation ctrlinner ctrlouter ctrloutervol ctrlpitch ctrlVolume ctrlenableeffect prevstr] mkfun1 @cbDestroyEdit prevstr]; ); );;