function [r1,r2]=klair_action(action,p1,p2) % KLAIR_ACTION performs asynchronous interaction with the KLAIR server. % % KLAIR actions are as follows: % % status=klair_action('open') % Attempts to open an RPC connection with the Klair server on the localhost. % Return value =0 connection established, =-1 server not found % % status=klair_action('open',server) % Attempts to open an RPC connection with the Klair server at the specified % network address. For example: klair_action('open','\\xps') % Return value =0 connection established, =-1 server not found % % status=klair_action('close') % Closes the open RPC connection to the Klair server % % status=klair_action('status') % Gets the current operational status of the Klair server. % Return value is a bit-wise OR of these values: % 1 = audio input running % 2 = video input running % 4 = 3D head running % 8 = vocal tract output running % % status=klair_action('time') % Gets the current clock time inside the Klair server. % Return value is clock time in milliseconds. % % status=klair_action('get',param) % Returns various configuration parameter values, depending on param: % param = 'headauto' % returns status of auto head saccades setting 0/1 % param = 'vtractrelax' % returns status of vocal tract auto relax seting 0/1 % % status=klair_action('set',param,paramval) % Sets the value of various configuration parameters % param = 'headauto' % sets auto head saccades (default 1). % param = 'vtractrelax' % sets auto vocal tract relax (default 1). % % status=klair_action('queuevtract',time,vtpars) % Adds vocal tract control vector to vocal tract input queue at given time % offset to the current time. Vocal tract parameters should be a double array % of 12 values scaled -1..+1. Returns time at which frame was actually queued. % % status=klair_action('queuecontrol',time,ctpars) % Adds head position control vector to the head input queue at given time % offset to the current time. Head position control parameters should be a % double array of 6 values. Returns time at which frame was actually queued. % % status=klair_action('queueexpress',time,expars) % Adds facial expression control vector to head input queue at given time % offset to the current time. Facial expression parameters should be a double array % of 23 values. Returns time at which frame was actually queued. % % [aframe,atime]=klair_action('getaudio',time) % Gets an audio block from the server audio output queue at a time soonest % after the given time. Returns a block of 10 frames, each of size 32 doubles, % along with the actual acquisition time for the first frame in the block. % Pass this time to the server again to get the next block. Returns a null vector % if no block is available. % % [vframe,vtime]=klair_action('getvideo',time) % Gets a video frame from the server video output queue at a time soonest % after the given time. Returns a video image 320 wide by 240 high in RGB format, % stored in a byte array, along with the actual acquisition time for the frame. % Pass this time to the server again to get the next frame. Returns a null vector % if no frame is available. % % [vframe,vtime]=klair_action('getvaudio',time) % Returns the unprocessed audio output signal from the articulatory synthesizer % generated at the server at a time soonest after the specified time. Returns % the waveform and the time of this frame. Pass this time to the server again % to get the next block. Returns a null vector if no frame is available. % % [vtpars,vtime]=klair_action('getvtract',time) % Returns the vocal tract control parameters actually used by the server at a time % soonest after the specified time. Returns a vector of parameters and time of this % frame. Pass this time to the server again to get the next block. Returns a null % vector if no frame is available. % % [vtube,vtime]=klair_action('getvtube',time) % Returns the vocal tract area function actually used by the server at a time % soonest after the specified time. Returns a vector of parameters and time of this % frame. Pass this time to the server again to get the next block. Returns a null % vector if no frame is available. % % klair was written by: % Mark Huckvale, % University College London % m.huckvale@ucl.ac.uk % % Version 1.0 - June 2009