/* Sound Environment Server - DMS - dec 97 - by Sébastien Metrot */ /* Rev. 1.0 - Mar. '98 - by Marc BARILLEY */ /* Rev. 1.1 - Sep. '98 - by Marc BARILLEY */ /* Rev. 1.2 - Jan. '99 - by Patrice FAVRE */ defcom CnewSound=newSound S S;; defcom Cenable = enable I;; defcom CstopMidi=stopMidi;; defcom CstartMidi=startMidi;; defcom CstopAll=stopAll;; typeof soundlist=[[S S] r1];; fun soundByName (sound, name)= let sound -> [n f] in !strcmp name n;; fun sendSoundList (sound, cli)= _DMSsend this cli CnewSound sound;; fun __started ()= apply_on_list soundlist @sendSoundList DMSsender;; fun _parser (l)= if l==nil then nil else let hd l-> [key [sound _]] in { _parser tl l; if !strcmp key "sound" then let hd tl l -> [key [name _]] in if !strcmp key "actionC" then set soundlist = [name sound]::soundlist else nil else nil };; fun activate (from, concerning, action, param, reply)= if !strcmp action "start" then _DMScreateClientDMI this concerning nil else if !strcmp action "!stopmidi!" then _DMSsend this concerning CstopMidi [] else if !strcmp action "!startmidi!" then _DMSsend this concerning CstartMidi [] else if !strcmp action "!stopall!" then _DMSsend this concerning CstopAll [] else if !strcmp action "!disable!" then _DMSsend this concerning Cenable [0] else if !strcmp action "!enable!" then _DMSsend this concerning Cenable [1] else let search_in_list soundlist @soundByName action -> [name file] in if name==nil then nil else sendSoundList [name file] concerning;; fun logout (client)= _DMSevent this client "destroyed" nil nil;; fun IniDMI (filename)= _DMSregisterDMI this @activate @logout @logout nil; set soundlist=nil; let strextr _getpack _checkpack filename -> l in _parser l;;