/* Speaker Server - DMS - Apr 98 - by Sylvain HUET */ /* longspeaker ver 1.0 - part server - 01/2004 */ /* by iri : info@irizone.net */ defcom Center=enter S;; defcom Cleave=leave S;; defcom Csound=sound S S;; /*** iri > ***/ typeof LRessources = S;; /* chaines des datas de l'éditeur */ typeof BMPList = S;; /* chaine des paths des bitmaps */ /*** < iri ***/ fun getUdp(i,j)= if i>=j then nil else let _setUDP _envchannel _channel i "" -> c in if c==nil then getUdp i+1 j else [c i];; typeof clis=[[CLIENT S] r1];; typeof spk=[[CLIENT S] r1];; typeof udp=I;; fun clibycli(a,c)=let a->[x _] in x==c;; fun clibyip(a,i)=let a->[_ ip] in !strcmp i ip;; fun broad(x,s)=let x->[c _] in _DMSsend this c s;; fun broadsel(x,z)=let x->[c ip] in let z->[cc s] in if c==cc then nil else _sendUDP ip s;; fun __sound(n,s)= if s==nil || 0==strlen s then nil else let search_in_list spk @clibyip _channelIP _channel ->[c _] in if c==nil then nil else apply_on_list clis @broadsel [c Csound [n s]];; fun who(a,c)=let a->[_ udp] in _DMSsend this c Center [udp];; fun __register(i)= if nil!=search_in_list clis @clibycli DMSsender then nil else let _channelIP DMSsender.chnCLI ->chntry in let if !strcmp chntry "127.0.0.1" then _hostIP else chntry -> chnok in let strcat strcat chnok ":" itoa i -> udp in (apply_on_list clis @broad Center [udp]; apply_on_list clis @who DMSsender; set clis=[DMSsender udp]::clis; _DMSevent this DMSsender "entering" nil nil);; fun logout(cli)= let search_in_list clis @clibycli cli->z in if z==nil then nil else let z->[_ udp] in (set clis=remove_from_list clis z; apply_on_list clis @broad Cleave [udp]; _DMSevent this cli "destroyed" nil nil); let search_in_list spk @clibycli cli->z in if z==nil then nil else set spk=remove_from_list spk z; 0 ;; fun __silent()= let search_in_list clis @clibycli DMSsender ->z in if z==nil then nil else let z->[_ udp] in (set clis=remove_from_list clis z; apply_on_list clis @broad Cleave [udp]; _DMSevent this DMSsender "silent" nil nil);; /* register pour le client */ fun RSreg(a)= let lineextr a -> [Precon[Precoff[Pplayon[Pplayoff[Pplaymute[Pbgbmp _]]]]]] in ( _RSregister this Precon 1 Precon; _RSregister this Precoff 1 Precoff; _RSregister this Pplayon 1 Pplayon; _RSregister this Pplayoff 1 Pplayoff; _RSregister this Pplaymute 1 Pplaymute; _RSregister this Pbgbmp 1 Pbgbmp);; /* fonction activate : suppression des actions inutiles start_server et start_mute */ fun activate(from,cli,action,param,rep)= if !strcmp action "start_direct" then /* register les bitmaps pour être dl par le client ensuite */ (RSreg BMPList; /* création du client avec passage de la chaine des données nécessaires */ _DMScreateClientDMI this cli LRessources; 0) else if !strcmp action "destroy" then /* destruction du client */ (_DMSdelClientDMI this cli; logout cli) else nil;; fun IniDMI(file)= _DMSregisterDMI this @activate @logout @logout nil; set udp=let getUdp 3000 4000 ->[_ i] in i; /* récupération des données définies dans l'éditeur */ let _DMSgetDef this "dmi" -> defBMP in let getInfo defBMP "recon" -> recon in let getInfo defBMP "recoff" -> recoff in let getInfo defBMP "playon" -> playon in let getInfo defBMP "playoff" -> playoff in let getInfo defBMP "playmute" -> playmute in let getInfo defBMP "background" -> background in /* création des chaines de données */ ( set BMPList = linebuild (recon)::(recoff)::(playon)::(playoff)::(playmute)::(background)::nil; set LRessources = linebuild (recon)::(recoff)::(playon)::(playoff)::(playmute)::(background)::(getInfo defBMP "longspeech")::(getInfo defBMP "sizefont")::(getInfo defBMP "fontcolor")::(getInfo defBMP "tooltipON")::(getInfo defBMP "bubbleFontSize")::(getInfo defBMP "bubbleFontColor")::(getInfo defBMP "bubbleBg")::(getInfo defBMP "bubbleRecon")::(getInfo defBMP "bubbleRecoff")::(getInfo defBMP "bubblePlayon")::(getInfo defBMP "bubblePlayoff")::(getInfo defBMP "bubblePlaymute")::(getInfo defBMP "bubbleInfo")::nil ) ;;