|##########|
|#MAGIC   #|CLABLLJA
|#PROJECT #|""
|#PATHS   #|"StdProject"
|#FLAGS   #|xx---x--x---xxx-----------------
|#USERSW  #|--------------------------------
|#USERMASK#|--------------------------------
|#SWITCHES#|xx---xxxxx------
|##########|
DEFINITION MODULE Narrator;
(* $A- *)
FROM T_Exec     IMPORT IOStdReq,IOReturn;
FROM Resources  IMPORT ContextPtr;
FROM Utility    IMPORT StdTags;
FROM System     IMPORT SysStringPtr;

CONST
  noMem       = IOReturn(256-2);
  noAudLib    = IOReturn(256-3);
  makeBad     = IOReturn(256-4);
  unitErr     = IOReturn(256-5);
  cantAlloc   = IOReturn(256-6);
  unimpl      = IOReturn(256-7);
  noWrite     = IOReturn(256-8);
  expunged    = IOReturn(256-9);
  phonErr     = IOReturn(256-20);
  rateErr     = IOReturn(256-21);
  pitchErr    = IOReturn(256-22);
  sexErr      = IOReturn(256-23);
  modeErr     = IOReturn(256-24);
  freqErr     = IOReturn(256-25);
  volErr      = IOReturn(256-26);
  dCentErr    = IOReturn(256-27);
  centPhonErr = IOReturn(256-28);

TYPE
  Sex              = (male,female,dummy=$1000);
  PitchMode        = (natural,robotic,manual,dummy=$1000);
  SpeakRate        = [40..400];
  Pitch            = [65..320];
  SampleFreq       = [5000..28000];
  Volume           = [0..64];
  Central          = [0..100];

  NarratorFlags    = (newIO,wordSync,sylableSync);
  NarratorFlagSet  = SET OF NarratorFlags;

  IONarratorPtr    = POINTER TO IONarrator;
  IONarrator       = RECORD OF IOStdReq
                        rate         : SpeakRate;
                        pitch        : Pitch;
                        mode         : PitchMode;
                        sex          : Sex;
                        chMask       : ANYPTR;
                        nmMask       : CARDINAL;
                        pad1         : SHORTCARD;
                        volume       : Volume;
                        sampFreq     : SampleFreq;
                        mouths       : BOOLEAN;
                        chanMask     : SHORTCARD;
                        numChan      : SHORTCARD;
                        flags        : NarratorFlagSet;
                        enthusiasm   : SHORTCARD;
                        perturbation : SHORTCARD;
                        f1adj,
                        f2adj,
                        f3adj        : SHORTINT;
                        a1adj,
                        a2adj,
                        a3adj        : SHORTINT;
                        articulate   : SHORTCARD;
                        centralize   : SHORTCARD;
                        centPhon     : SysStringPtr;
                        aVBias       : SHORTINT;
                        aFBias       : SHORTINT;
                        priority     : SHORTINT;
                        pad2         : SHORTINT;

                        width        : SHORTCARD;
                        heigth       : SHORTCARD;
                        shape        : SHORTCARD;
                        sync         : NarratorFlagSet;
                      END;

  NarratorTags      = TAGS OF StdTags;
                        rate         : SpeakRate;
                        pitch        : Pitch;
                        mode         : PitchMode;
                        sex          : Sex;
                        volume       : Volume;
                        sampFreq     : SampleFreq;
                        mouths       : BOOLEAN;
                        enthusiasm   : SHORTCARD;
                        perturbation : SHORTCARD;
                        f1adj        : SHORTINT;
                        f2adj        : SHORTINT;
                        f3adj        : SHORTINT;
                        a1adj        : SHORTINT;
                        a2adj        : SHORTINT;
                        a3adj        : SHORTINT;
                        articulate   : SHORTCARD;
                        centralize   : SHORTCARD;
                        centPhon     : SysStringPtr;
                        aVBias       : SHORTINT;
                        aFBias       : SHORTINT;
                        priority     : SHORTINT;
                      END;

PROCEDURE OpenNarrator(context  : ContextPtr:=NIL;
                       tags     : LIST OF NarratorTags):IONarratorPtr;

PROCEDURE CloseNarrator(VAR  request : IONarratorPtr);

GROUP
  ErrorGrp  = noMem,noAudLib,makeBad,unitErr,cantAlloc,
              unimpl,noWrite,expunged,phonErr,rateErr,
              pitchErr,sexErr,modeErr,freqErr,volErr,
              dCentErr,centPhonErr;

  DeviceGrp = NarratorFlags,NarratorFlagSet,IONarratorPtr,
              IONarrator,NarratorTags,OpenNarrator,CloseNarrator;

  All       = ErrorGrp,DeviceGrp;

END Narrator.
