(FILECREATED "20-Jul-84 18:47:54" {ERIS}<SPEECH>SPECTRUM>SCALEDWINDOW.FPKG;3 30808 changes to: (FNS SCALED.WINDOW.PRINT.SCALES PRINT.SCALE.NUMBERS SCALED.WINDOW.SETUP SCALED.WINDOW.PRINT.Y.SCALE SCALED.WINDOW.REPAINTFN NumberofStripes SCALED.WINDOW.SCROLLFN) (VARS SCALEDWINDOWCOMS) previous date: "17-Jul-84 18:51:00" {ERIS}<SPEECH>WORK>SCALEDWINDOW.FPKG;1) (* Copyright (c) 1984 by Xerox Corporation. All rights reserved.) (PRETTYCOMPRINT SCALEDWINDOWCOMS) (RPAQQ SCALEDWINDOWCOMS ((FNS DISPLAY.FILE DRAWDOTTEDLINE FIRST.TIC NumberofStripes OLD.USER.CREATE.MENU SCALED.WINDOW.PRINT.SCALES SCALED.WINDOW.PRINT.Y.SCALE SCROLL SCALED.WINDOW.CLEARW PRINT.SCALE.NUMBERS PRINT.SPEECH.FILE RESHAPE.SPEECH.DISPLAY.FILE.WINDOW SCALED.WINDOW.REPAINTFN SCALED.WINDOW.RESHAPEFN SCALED.WINDOW.SCROLL.PAINTFN SCALED.WINDOW.SCROLLFN SCALED.WINDOW.SETUP SDF SETY0 SET.Y.SCALE.FACTOR SPEECH.COPY.ARRAY.TO.WAVE SPEECH.PRINT.WAVE.ARRAY) (VARS Y.AXIS.LINE.WIDTH))) (DEFINEQ (DISPLAY.FILE [LAMBDA (FILE PTR) (* pkh: "13-Jul-84 05:42") (* Alternative to SPEECH.DISPLAY.FILE for displaying a waveform; gives you a scrollable window) (COND ((NULL PTR) (* If no info about where to start printing in the file go to the beginning) (SETQ PTR 0))) (PROG (STARTX STARTY WIDTH HEIGHT WINDOW) (SETQ FILE (FULLNAME FILE 'OLD)) (SETQ WINDOW (CREATEW NIL FILE)) (SETQ STARTX (DSPXPOSITION NIL WINDOW)) (SETQ STARTY (DSPYPOSITION NIL WINDOW)) (* Associate the file with the window) (WINDOWPROP WINDOW 'FILE FILE) (SCALED.WINDOW.SETUP WINDOW -128 128 30 30 'PRINT.SPEECH.FILE NIL 2) (* Set the extent so we can scroll) (* SCALED.WINDOW.RESHAPEFN WINDOW) (WINDOWPROP WINDOW 'EXTENT (create REGION LEFT ← STARTX BOTTOM ← STARTY HEIGHT ← -1 WIDTH ← (GETFILEINFO FILE 'LENGTH]) (DRAWDOTTEDLINE [LAMBDA (X1 Y1 X2 Y2 WIDTH WINDOW DOTDISTANCE) (* pkh: "26-Jun-84 12:53") (for POINT from X1 to X2 by (COND (DOTDISTANCE DOTDISTANCE) (T 2)) do (DRAWLINE POINT Y1 POINT Y1 WIDTH 'PAINT WINDOW]) (FIRST.TIC [LAMBDA (LEFT.X.POS TIC.INTERVAL) (* pkh: "13-Jan-84 14:27") (* Find where to draw the first tic; ensure it is a multiple of the tic.interval) (COND ((IGEQ TIC.INTERVAL LEFT.X.POS) LEFT.X.POS) (T (IPLUS LEFT.X.POS (IDIFFERENCE TIC.INTERVAL (IREMAINDER LEFT.X.POS TIC.INTERVAL]) (NumberofStripes [LAMBDA (WINDOW BYTES) (* hdj "19-Jul-84 18:15") (FIX (FTIMES BYTES (GETWINDOWPROP WINDOW 'WindowToDataFactor]) (OLD.USER.CREATE.MENU [LAMBDA NIL (* pkh: "27-Dec-83 16:45") (PROG (MENU) (SETQ MENU (create MENU TITLE ← "USER MENU" ITEMS ← USER.PNAMES MENUCOLUMNS ← 6 WHENSELECTEDFN ← 'USER.WHENSELECTEDFN)) (ATTACHMENU MENU USER.WINDOW 'CENTER 'TOP (GETBOXPOSITION (fetch (MENU IMAGEWIDTH) of MENU) (fetch (MENU IMAGEHEIGHT) of MENU) NIL NIL NIL "Position USER MENU")) (GETBOXPOSITION (fetch (MENU IMAGEWIDTH) of MENU) (fetch (MENU IMAGEHEIGHT) of MENU) NIL NIL NIL "Position USER MENU") (RETURN MENU]) (SCALED.WINDOW.PRINT.SCALES [LAMBDA (WINDOW REG DATALEFT) (* hdj "20-Jul-84 18:19") (* Clears a scaled window and repaints the scales) (PROG ((DATAREGION (WINDOWPROP WINDOW 'DATAREGION)) (YPOS.FOR.XSCALE (WINDOWPROP WINDOW 'YPOS.FOR.XSCALE)) (REG (OR REG (DSPCLIPPINGREGION NIL WINDOW))) YMIN Y.SCALE.FACTOR WIDTH LEFT.START.POS NUMBER.FONT) (COND ((ILESSP (fetch (REGION LEFT) of REG) (fetch (REGION LEFT) of DATAREGION)) (* redraw the yscale if its part of the region to redisplay) (SCALED.WINDOW.PRINT.Y.SCALE WINDOW))) (* Draw the x-scale) (* DRAWLINE (IMAX (fetch (REGION LEFT) of REG) (fetch (REGION LEFT) of DATAREGION)) YPOS.FOR.XSCALE (fetch (REGION RIGHT) of REG) YPOS.FOR.XSCALE 2 (QUOTE PAINT) WINDOW) (DRAWLINE (fetch (REGION LEFT) of DATAREGION) YPOS.FOR.XSCALE (fetch (REGION RIGHT) of DATAREGION) YPOS.FOR.XSCALE 2 'PAINT WINDOW) (* Print the numbers and tics on the x-scale) (PRINT.SCALE.NUMBERS WINDOW (WINDOWPROP WINDOW 'DATALEFT]) (SCALED.WINDOW.PRINT.Y.SCALE [LAMBDA (WINDOW) (* hdj "20-Jul-84 14:47") (PROG (LEFT.Y.SCALE.OFFSET YPOS.FOR.XSCALE YMIN Y.SCALE.FACTOR WIDTH LEFT.START.POS NUMBER.FONT) (SETQ LEFT.Y.SCALE.OFFSET (WINDOWPROP WINDOW 'LEFT.Y.SCALE.OFFSET)) (SETQ YPOS.FOR.XSCALE (WINDOWPROP WINDOW 'YPOS.FOR.XSCALE)) (SETQ NUMBER.FONT (WINDOWPROP WINDOW 'NUMBER.FONT)) (SETQ YMIN (WINDOWPROP WINDOW 'YMIN)) (SETQ YMAX (WINDOWPROP WINDOW 'YMAX)) (DRAWLINE LEFT.Y.SCALE.OFFSET YPOS.FOR.XSCALE LEFT.Y.SCALE.OFFSET (WINDOWPROP WINDOW 'HEIGHT) 2 'PAINT WINDOW) (* Draw a 0-crossing if there is one) (COND ((ILESSP (WINDOWPROP WINDOW 'YMIN) 0) (* Y0 in the window coordinate system) (SETQ Y0 (WINDOWPROP WINDOW 'Y0)) (DRAWDOTTEDLINE LEFT.Y.SCALE.OFFSET Y0 (WINDOWPROP WINDOW 'WIDTH) Y0 1 WINDOW 3))) (* Print info pertaining to Y-scale) (COND ((OR (NOT (EQUAL YMIN MIN.FIXP)) (NOT (EQUAL YMAX MAX.FIXP))) (* Print YMAX) (MOVETO (IDIFFERENCE LEFT.Y.SCALE.OFFSET (IPLUS (STRINGWIDTH YMAX NUMBER.FONT) 2)) (IDIFFERENCE (WINDOWPROP WINDOW 'HEIGHT) 6) WINDOW) (* TBW *) (PRINT YMAX WINDOW) (* Print YMIN) (MOVETO (IDIFFERENCE LEFT.Y.SCALE.OFFSET (IPLUS (STRINGWIDTH YMIN NUMBER.FONT) 2)) YPOS.FOR.XSCALE WINDOW) (PRINT YMIN WINDOW]) (SCROLL [LAMBDA (WINDOW XDELTA YDELTA CONTINUOUSFLG) (* hdj "12-Jul-84 18:15") (* standard scrolling function that scrolls by blting existing bits and then calling the windows repaintfn to repaint the newly exposed bits.) (PROG ((DSP (WINDOWPROP WINDOW 'DSP)) (EXTENT (WINDOWPROP WINDOW 'EXTENT)) X CRHEIGHT CRWIDTH CRLEFT CRBOTTOM WHOLEHEIGHT WHOLEWIDTH) (SETQ X (DSPCLIPPINGREGION NIL DSP)) (SETQ WHOLEWIDTH (fetch (REGION WIDTH) of X)) (SETQ WHOLEHEIGHT (fetch (REGION HEIGHT) of X)) [COND ([NOT (SUBREGIONP WHOLEDISPLAY (WINDOWPROP WINDOW 'REGION] (* reduce clipping region to be that part of the window that is on the screen.) (SETQ X (INTERSECTREGIONS X (\DSPUNTRANSFORMREGION WHOLEDISPLAY (fetch IMAGEDATA of DSP] (SETQ CRLEFT (fetch (REGION LEFT) of X)) (SETQ CRBOTTOM (fetch (REGION BOTTOM) of X)) (SETQ CRWIDTH (fetch (REGION WIDTH) of X)) (SETQ CRHEIGHT (fetch (REGION HEIGHT) of X)) (* only one of XDELTA or YDELTA should be non-zero but do both anyway. When both can be non-zero%, this code should avoid calling the repaintfn on the part of the object that is scrolled on by X but then scrolled off by Y.) (* do X first because in the common case of printing it is faster to do it first.) [COND ((FLOATP XDELTA) (* thumb scroll%, XDELTA gives the fraction of the way from the left margin the cursor was.) (COND [(AND EXTENT (NEQ (fetch (REGION WIDTH) of EXTENT) -1)) (PROG (OLDX NEWX) (* if there is an extent%, calculate a value of XDELTA that moves to the proper place. If there is not%, Don%'t do anything.) [SETQ NEWX (IPLUS (fetch (REGION LEFT) of EXTENT) (FIXR (FTIMES XDELTA (IDIFFERENCE (fetch (REGION WIDTH) of EXTENT) WHOLEWIDTH] (SETQ OLDX (WXOFFSET NIL DSP)) (SETQ XDELTA (IDIFFERENCE OLDX NEWX] (T (SETQ XDELTA 0] [COND (CONTINUOUSFLG (* if continuous set it scroll by the linefeed height {no particularly good reason why the linefeed height but why not}.) (COND ((EQ XDELTA 0)) [(IGREATERP XDELTA 0) (* linefeed height is normally negative.) (SETQ XDELTA (IMINUS (DSPLINEFEED NIL DSP] (T (SETQ XDELTA (DSPLINEFEED NIL DSP] (COND ((AND (NEQ XDELTA 0) (COND ((AND EXTENT (NEQ (fetch (REGION WIDTH) of EXTENT) -1)) (* limit amount by the extent) (* for now limit right extent to right of window ETC. ie keep it always visible.) (SETQ XDELTA (IMIN (IDIFFERENCE CRLEFT (fetch (REGION LEFT) of EXTENT)) (IMAX (IDIFFERENCE (IPLUS CRLEFT CRWIDTH) (fetch (REGION PRIGHT) of EXTENT)) XDELTA))) (* make sure it is still not 0) (NEQ XDELTA 0)) (T T))) (* BITBLT WINDOW CRLEFT CRBOTTOM WINDOW (IPLUS XDELTA CRLEFT) CRBOTTOM CRWIDTH CRHEIGHT (QUOTE INPUT) (QUOTE REPLACE)) (WXOFFSET XDELTA DSP) (SETQ CRLEFT (IDIFFERENCE CRLEFT XDELTA)) (* REDISPLAYW WINDOW (COND ((IGREATERP XDELTA 0) (* moving to right%, create new region on left for repaintfn) (CREATEREGION CRLEFT CRBOTTOM (IMIN XDELTA CRWIDTH) CRHEIGHT)) (T (* moving to left.) (CREATEREGION (IMAX (IPLUS CRLEFT CRWIDTH XDELTA) CRLEFT) CRBOTTOM (IMIN (IMINUS XDELTA) CRWIDTH) CRHEIGHT))) T) )) [COND ((FLOATP YDELTA) (* thumb scroll%, YDELTA gives the fraction of the way from the top margin the cursor was.) (COND [(AND EXTENT (NEQ (fetch (REGION HEIGHT) of EXTENT) -1)) (PROG (OLDY NEWY) (* if there is an extent%, calculate a value of YDELTA that moves to the proper place. If there is not%, Don%'t do anything.) (SETQ NEWY (IPLUS (IDIFFERENCE (FIXR (FTIMES (FDIFFERENCE 1.0 YDELTA) (fetch (REGION HEIGHT) of EXTENT))) WHOLEHEIGHT) (fetch (REGION BOTTOM) of EXTENT))) (SETQ OLDY (WYOFFSET NIL DSP)) (SETQ YDELTA (IDIFFERENCE OLDY NEWY] (T (SETQ YDELTA 0] [COND (CONTINUOUSFLG (* if continuous set it scroll by the linefeed height) (COND ((EQ YDELTA 0)) [(IGREATERP YDELTA 0) (* linefeed height is normally negative.) (SETQ YDELTA (IMINUS (DSPLINEFEED NIL DSP] (T (SETQ YDELTA (DSPLINEFEED NIL DSP] (COND ((AND (NEQ YDELTA 0) (COND ((AND EXTENT (NEQ (fetch (REGION HEIGHT) of EXTENT) -1)) (* limit amount by the extent) (SETQ YDELTA (IMAX (IDIFFERENCE (SETQ X (PLUS CRBOTTOM CRHEIGHT)) (fetch (REGION PTOP) of EXTENT)) (IMIN (IDIFFERENCE (SUB1 X) (fetch (REGION BOTTOM) of EXTENT)) YDELTA))) (* make sure its still not 0) (NEQ YDELTA 0)) (T T))) (* move the current image if any of it is still in view.) (* BITBLT WINDOW CRLEFT CRBOTTOM WINDOW CRLEFT (IPLUS YDELTA CRBOTTOM) CRWIDTH CRHEIGHT (QUOTE INPUT) (QUOTE REPLACE)) (WYOFFSET YDELTA DSP) (* use X as pointer to bottom in scrolled clipping region.) (SETQ X (IDIFFERENCE CRBOTTOM YDELTA)) (* REDISPLAYW WINDOW (COND ((IGREATERP YDELTA 0) (* moving up.) (CREATEREGION CRLEFT X CRWIDTH (IMIN YDELTA CRHEIGHT))) (T (* moving down%, fill in top) (CREATEREGION CRLEFT (IMAX (IPLUS CRHEIGHT X YDELTA) X) CRWIDTH (IMIN (IMINUS YDELTA) CRHEIGHT)))) T) )) (RETURN]) (SCALED.WINDOW.CLEARW [LAMBDA (WINDOW) (* pkh: "10-Jul-84 23:01") (* Clears a scaled window and repaints the scales) (PROG (YPOS.FOR.XSCALE YMIN Y.SCALE.FACTOR BOTTOM.X.SCALE.OFFSET WIDTH LEFT.X.POS) (SETQ YMIN (WINDOWPROP WINDOW 'YMIN)) (SETQ Y.SCALE.FACTOR (WINDOWPROP WINDOW 'Y.SCALE.FACTOR)) (SETQ YPOS.FOR.XSCALE (WINDOWPROP WINDOW 'YPOS.FOR.XSCALE)) (SETQ BOTTOM.X.SCALE.OFFSET (WINDOWPROP WINDOW 'BOTTOM.X.SCALE.OFFSET)) (SETQ WIDTH (WINDOWPROP WINDOW 'WIDTH)) (SETQ LEFT.X.POS (OR (WINDOWPROP WINDOW 'PPORIGX) 0)) (CLEARW WINDOW) (MOVETO (WINDOWPROP WINDOW 'PPORIGX) (WINDOWPROP WINDOW 'PPORIGY) WINDOW) (* Draw X-scale) (* DRAWLINE 0 Y0 WIDTH Y0 1 (QUOTE PAINT) SCOPE.WINDOW) (SCALED.WINDOW.PRINT.SCALES WINDOW]) (PRINT.SCALE.NUMBERS [LAMBDA (WINDOW DATALEFT TIC.INTERVAL) (* hdj "20-Jul-84 15:16") (* Draws lines for tic marks; and print numbers by the tics) (* IF (NEQ 0 LEFT.X.POS) THEN (IPLUS LEFT.X.POS (IREMAINDER LEFT.X.POS TIC.INTERVAL)) ELSE 0) (PROG (NUMBER.WIDTH TEMP ODDFLG LEFT.Y.SCALE.OFFSET (YPOS.FOR.XSCALE (WINDOWPROP WINDOW 'YPOS.FOR.XSCALE) ) DATAMARK) (SETQ LEFT.Y.SCALE.OFFSET (WINDOWPROP WINDOW 'LEFT.Y.SCALE.OFFSET)) (DSPRIGHTMARGIN (fetch (REGION WIDTH) of (WINDOWPROP WINDOW 'EXTENT)) WINDOW) (COND ((NULL TIC.INTERVAL) (SETQ TIC.INTERVAL 20))) (SETQ TEMP (IDIFFERENCE (IPLUS (SETQ DATAMARK (FIRST.TIC DATALEFT TIC.INTERVAL)) LEFT.Y.SCALE.OFFSET) DATALEFT)) (for I from TEMP to (WINDOWPROP WINDOW 'WIDTH) by 20 as J from DATAMARK by TIC.INTERVAL do (SETQ NUMBER.WIDTH (STRINGWIDTH J (DSPFONT NIL WINDOW))) (MOVETO (IDIFFERENCE I (IQUOTIENT NUMBER.WIDTH 2)) (IDIFFERENCE YPOS.FOR.XSCALE 13) WINDOW) (COND ((NULL ODDFLG) (PRIN1 J WINDOW))) (DRAWLINE I YPOS.FOR.XSCALE I (IPLUS YPOS.FOR.XSCALE 4) 1 'PAINT WINDOW) (SETQ ODDFLG (NOT ODDFLG]) (PRINT.SPEECH.FILE [LAMBDA (WINDOW REGION FILE) (* pkh: "13-Jul-84 04:04") (PROG (STREAM Y Y0 X Y.SCALE.FACTOR BOTTOM.X.SCALE.OFFSET FILE) (SETQ FILE (WINDOWPROP WINDOW 'FILE)) (SETQ Y.SCALE.FACTOR (WINDOWPROP WINDOW 'Y.SCALE.FACTOR)) (SETQ BOTTOM.X.SCALE.OFFSET (WINDOWPROP WINDOW 'BOTTOM.X.SCALE.OFFSET)) (SETQ Y0 (WINDOWPROP WINDOW 'Y0)) (SETQ STREAM (OPENSTREAM (WINDOWPROP WINDOW 'FILE) 'INPUT 'OLD)) (SETFILEPTR STREAM (COND (REGION (fetch (REGION LEFT) of REGION)) (T 0))) (while (NOT (EOFP STREAM)) as X from (COND (REGION (fetch (REGION LEFT) of REGION)) (T 0)) to [COND (REGION (IPLUS (fetch (REGION LEFT) of REGION) (fetch (REGION WIDTH) of REGION))) (T (WINDOWPROP WINDOW 'WIDTH] do (SETQ Y (\BIN STREAM)) (SETQ Y (CORRECT Y)) (* Center around Y=0) (SETQ Y (FTIMES (IDIFFERENCE Y 128) Y.SCALE.FACTOR)) (DRAWLINE X Y0 X (IDIFFERENCE Y0 (MINUS Y)) 1 'PAINT WINDOW)) (CLOSEF STREAM]) (RESHAPE.SPEECH.DISPLAY.FILE.WINDOW [LAMBDA (WINDOW) (* pkh: "28-Dec-83 22:50") (PROG (BTM) (DSPRESET WINDOW) (WINDOWPROP WINDOW 'PPORIGX (DSPXPOSITION NIL WINDOW)) (WINDOWPROP WINDOW 'PPORIGY (DSPYPOSITION NIL WINDOW)) (SPEECH.DISPLAY.FILE.REPAINTFN WINDOW]) (SCALED.WINDOW.REPAINTFN [LAMBDA (WINDOW REGION) (* hdj "20-Jul-84 11:24") (* repaint function for a scaled window) (PROG [(DATALEFT (GETWINDOWPROP WINDOW 'DATALEFT)) (DATAREGION (GETWINDOWPROP WINDOW 'DATAREGION] (* Perform the printing operations) (SCALED.WINDOW.SCROLL.PAINTFN WINDOW DATAREGION DATALEFT) (* Draw the bottom x-scale; will be numbered and tacked) (SCALED.WINDOW.PRINT.SCALES WINDOW REGION DATALEFT]) (SCALED.WINDOW.RESHAPEFN [LAMBDA (WINDOW) (* edited: "17-Jul-84 18:14") (* This function should see to repainting and rescaling of scales in a scaled window when it it reshaped; calls the REPAINTFN for the window so it can replot the data) (PROG (WIDTH HEIGHT GRAPHHEIGHT Y.SCALE.FACTOR YPOS.FOR.XSCALE BOTTOM.X.SCALE.OFFSET YMIN YMAX) (* Get the relevant parameters; these haven%'t changed because of the reshaping) (SETQ YMIN (WINDOWPROP WINDOW 'YMIN)) (SETQ YMAX (WINDOWPROP WINDOW 'YMAX)) (SETQ BOTTOM.X.SCALE.OFFSET (WINDOWPROP WINDOW 'BOTTOM.X.SCALE.OFFSET)) (SETQ YPOS.FOR.XSCALE (WINDOWPROP WINDOW 'YPOS.FOR.XSCALE)) (DSPRESET WINDOW) (* Move to the beginning of window) (WINDOWPROP WINDOW 'PPORIGX (DSPXPOSITION NIL WINDOW)) (WINDOWPROP WINDOW 'PPORIGY (DSPYPOSITION NIL WINDOW)) (* New width and height) (SETQ WIDTH (WINDOWPROP WINDOW 'WIDTH)) (SETQ HEIGHT (WINDOWPROP WINDOW 'HEIGHT)) (* Compute afresh the number of pixels which the data may be plotted into) (SETQ GRAPHHEIGHT (IDIFFERENCE HEIGHT BOTTOM.X.SCALE.OFFSET)) (WINDOWPROP WINDOW 'GRAPHHEIGHT GRAPHHEIGHT) (* Recompute the Y.SCALE.FACTOR) (* Scale factor is 1 if no max or min) (* SETQ Y.SCALE.FACTOR (COND ((NOT (EQUAL YMIN MIN.FIXP) (EQUAL YMAX MAX.FIXP)) (FQUOTIENT (DIFFERENCE HEIGHT BOTTOM.X.SCALE.OFFSET) YRANGE)) (T (SHOULDNT)))) (SET.Y.SCALE.FACTOR WINDOW HEIGHT) (* Reset the window property; Recompute the position for the 0 crossing) (SETY0 WINDOW (WINDOWPROP WINDOW 'Y.SCALE.FACTOR) YMIN YMAX) (WINDOWPROP WINDOW 'DATAREGION (CREATEREGION (IPLUS LEFT.Y.SCALE.OFFSET Y.AXIS.LINE.WIDTH) (HALF BOTTOM.X.SCALE.OFFSET) (IDIFFERENCE (WINDOWPROP WINDOW 'WIDTH) (IPLUS LEFT.Y.SCALE.OFFSET Y.AXIS.LINE.WIDTH) GRAPHHEIGHT))) (SCALED.WINDOW.REPAINTFN WINDOW]) (SCALED.WINDOW.SCROLL.PAINTFN [LAMBDA (WINDOW DATAREGIONINWINDOW DATALEFT) (* edited: "17-Jul-84 18:17") (* Calls the PRINTFN for the window with the arguments WINDOW DATAREGIONINWINDOW and DATALEFT) (APPLY* (WINDOWPROP WINDOW 'PRINTFN) WINDOW DATAREGIONINWINDOW DATALEFT]) (SCALED.WINDOW.SCROLLFN [LAMBDA (WINDOW XDELTA YDELTA CONTINUOUSFLG) (* hdj "18-Jul-84 16:24") (NEWSCROLL WINDOW XDELTA YDELTA CONTINUOUSFLG) (* PROG ((REG (DSPCLIPPINGREGION NIL WINDOW))) (* SCROLLBYREPAINTFN WINDOW XDELTA YDELTA CONTINUOUSFLG) (NEWSCROLL WINDOW XDELTA YDELTA CONTINUOUSFLG) (* REDISPLAYW WINDOW REG)) ]) (SCALED.WINDOW.SETUP [LAMBDA (WINDOW YMIN YMAX BOTTOM.X.SCALE.OFFSET LEFT.Y.SCALE.OFFSET PRINTFN FONT INCREASEBETWEENTICS SCROLLFN) (* hdj "20-Jul-84 15:25") (PROG (WIDTH HEIGHT GRAPHHEIGHT Y0 Y.SCALE.FACTOR YPOS.FOR.XSCALE YRANGE) (PUTWINDOWPROP WINDOW 'SCROLLFN 'SCALED.WINDOW.SCROLLFN) (PUTWINDOWPROP WINDOW 'PRINTFN PRINTFN) (PUTWINDOWPROP WINDOW 'DATALEFT 0) (SETQ HEIGHT (WINDOWPROP WINDOW 'HEIGHT)) (SETQ WIDTH (WINDOWPROP WINDOW 'WIDTH)) (PUTWINDOWPROP WINDOW 'Y.AXIS.LINE.WIDTH Y.AXIS.LINE.WIDTH) (PUTWINDOWPROP WINDOW 'DATAREGION (CREATEREGION LEFT.Y.SCALE.OFFSET 0 (IDIFFERENCE WIDTH (IPLUS LEFT.Y.SCALE.OFFSET Y.AXIS.LINE.WIDTH)) HEIGHT)) (PUTWINDOWPROP WINDOW 'YMIN YMIN) (PUTWINDOWPROP WINDOW 'YMAX YMAX) (PUTWINDOWPROP WINDOW 'INCREASEBETWEENTICS INCREASEBETWEENTICS) (PUTWINDOWPROP WINDOW 'SCROLLFN SCROLLFN) [COND ((AND YMIN YMAX) (WINDOWPROP WINDOW 'YRANGE (IDIFFERENCE YMAX YMIN] (* Let the bottom region be for the scale) (COND ((NULL BOTTOM.X.SCALE.OFFSET) (WINDOWPROP WINDOW 'BOTTOM.X.SCALE.OFFSET 30)) (T (WINDOWPROP WINDOW 'BOTTOM.X.SCALE.OFFSET BOTTOM.X.SCALE.OFFSET))) (SETQ BOTTOM.X.SCALE.OFFSET (WINDOWPROP WINDOW 'BOTTOM.X.SCALE.OFFSET)) (COND ((NULL LEFT.Y.SCALE.OFFSET) (WINDOWPROP WINDOW 'LEFT.Y.SCALE.OFFSET 30)) (T (WINDOWPROP WINDOW 'LEFT.Y.SCALE.OFFSET LEFT.Y.SCALE.OFFSET))) (SETQ LEFT.Y.SCALE.OFFSET (WINDOWPROP WINDOW 'LEFT.Y.SCALE.OFFSET)) (WINDOWPROP WINDOW 'REPAINTFN 'SCALED.WINDOW.REPAINTFN) (WINDOWPROP WINDOW 'RESHAPEFN 'SCALED.WINDOW.RESHAPEFN) (* Set the right margin of the window so PRIN will print) (DSPRIGHTMARGIN (fetch (REGION WIDTH) of (WINDOWPROP WINDOW 'EXTENT)) WINDOW) [WINDOWPROP WINDOW 'NUMBER.FONT (COND (FONT (DSPFONT FONT WINDOW) FONT) (T (DSPFONT (FONTCREATE 'TIMESROMAN 6) WINDOW) (FONTCREATE 'TIMESROMAN 6] (WINDOWPROP WINDOW 'SCROLLFN 'SCROLLBYREPAINTFN) (* Height of the region the graph occupies) (SETQ GRAPHHEIGHT (IDIFFERENCE HEIGHT BOTTOM.X.SCALE.OFFSET)) (WINDOWPROP WINDOW 'GRAPHHEIGHT GRAPHHEIGHT) (* Where the bottom x-scale is to be drawn) (WINDOWPROP WINDOW 'YPOS.FOR.XSCALE (IQUOTIENT BOTTOM.X.SCALE.OFFSET 2)) (SETQ YPOS.FOR.XSCALE (WINDOWPROP WINDOW 'YPOS.FOR.XSCALE)) (COND ((NOT YMIN) (SETQ YMIN MIN.FIXP))) (COND ((NOT YMAX) (SETQ YMAX MAX.FIXP))) (WINDOWPROP WINDOW 'YMIN YMIN) (WINDOWPROP WINDOW 'YMAX YMAX) (* Let the bottom points be for the scale) (SETQ YRANGE (PLUS (ABS YMIN) (ABS YMAX))) (* Scale factor is 1 if no max or min) (SETQ Y.SCALE.FACTOR (FQUOTIENT (DIFFERENCE HEIGHT BOTTOM.X.SCALE.OFFSET) YRANGE)) (WINDOWPROP WINDOW 'Y.SCALE.FACTOR Y.SCALE.FACTOR) (* Find where the 0 crossing cuts into the Y-axis) (COND ((ILESSP (WINDOWPROP WINDOW 'YMIN) 0) [SETQ Y0 (FIXR (FPLUS (FTIMES (ABS (WINDOWPROP WINDOW 'YMIN)) Y.SCALE.FACTOR) (FQUOTIENT BOTTOM.X.SCALE.OFFSET 2] (* Draw the 0-crossing) (* DRAWDOTTEDLINE 0 Y0 (WINDOWPROP WINDOW (QUOTE WIDTH)) Y0 1 WINDOW 3) (WINDOWPROP WINDOW 'Y0 Y0)) (T (* There YMIN is 0 or larger; there is no 0 crossing; default Y0 to be BOTTOM.X.SCALE.OFFSET) (WINDOWPROP WINDOW 'Y0 YPOS.FOR.XSCALE) (WINDOWPROP WINDOW 'Y0 Y0))) (SCALED.WINDOW.PRINT.SCALES WINDOW) (* If max and min are not specified then choose some large number) (* Draw the scales) (* (SCALEDWINDOW.REPAINT.FN WINDOW) (DRAWLINE 0 YPOS.FOR.XSCALE (IPLUS (WINDOWPROP WINDOW (QUOTE WIDTH)) 0) YPOS.FOR.XSCALE 2 (QUOTE PAINT) WINDOW) (DRAWLINE 0 LEFT.Y.SCALE.OFFSET 0 (IPLUS (WINDOWPROP WINDOW (QUOTE WIDTH)) 0) YPOS.FOR.XSCALE 2 (QUOTE PAINT) WINDOW) (PRINT.SCALE.NUMBERS WINDOW 0) ) (SCALED.WINDOW.REPAINTFN WINDOW) (PUTWINDOWPROP WINDOW 'SCROLLFN 'SCALED.WINDOW.SCROLLFN) (RETURN WINDOW]) (SDF [LAMBDA (FILE PTR) (* pkh: "12-Jul-84 22:42") (* Alternative to SPEECH.DISPLAY.FILE for displaying a waveform; gives you a scrollable window) (COND ((NULL PTR) (* If no info about where to start printing in the file go to the beginning) (SETQ PTR 0))) (PROG (STARTX STARTY WIDTH HEIGHT WINDOW) (SETQ FILE (FULLNAME FILE 'OLD)) (SETQ WINDOW (CREATEW NIL FILE)) (SETQ STARTX (DSPXPOSITION NIL WINDOW)) (SETQ STARTY (DSPYPOSITION NIL WINDOW)) (* Associate the file with the window) (WINDOWPROP WINDOW 'FILE FILE) (SCALED.WINDOW.SETUP WINDOW -128 128 30 30 'PRINT.SPEECH.FILE) (* Set the extent so we can scroll) (* SCALED.WINDOW.RESHAPEFN WINDOW) (WINDOWPROP WINDOW 'EXTENT (create REGION LEFT ← STARTX BOTTOM ← STARTY HEIGHT ← -1 WIDTH ← (GETFILEINFO FILE 'LENGTH]) (SETY0 [LAMBDA (WINDOW Y.SCALE.FACTOR YMIN YMAX) (* pkh: "10-Jul-84 22:27") (PROG (Y0) (COND ((ILESSP (WINDOWPROP WINDOW 'YMIN) 0) [SETQ Y0 (FIXR (FPLUS (FTIMES (ABS (WINDOWPROP WINDOW 'YMIN)) Y.SCALE.FACTOR) (FQUOTIENT BOTTOM.X.SCALE.OFFSET 2] (WINDOWPROP WINDOW 'Y0 Y0) (* Draw the 0-crossing) ) (T (* There YMIN is 0 or larger; there is no 0 crossing; default Y0 to be BOTTOM.X.SCALE.OFFSET) (WINDOWPROP WINDOW 'Y0 YPOS.FOR.XSCALE))) (RETURN Y0]) (SET.Y.SCALE.FACTOR [LAMBDA (WINDOW HEIGHT) (* pkh: "11-Jul-84 22:55") (PROG (BOTTOM.X.SCALE.OFFSET YRANGE) (SETQ BOTTOM.X.SCALE.OFFSET (WINDOWPROP WINDOW 'BOTTOM.X.SCALE.OFFSET)) (SETQ YRANGE (WINDOWPROP WINDOW 'YRANGE)) (SETQ Y.SCALE.FACTOR (COND (YRANGE (FQUOTIENT (IDIFFERENCE HEIGHT BOTTOM.X.SCALE.OFFSET) YRANGE)) (T 1))) (WINDOWPROP WINDOW 'Y.SCALE.FACTOR Y.SCALE.FACTOR]) (SPEECH.COPY.ARRAY.TO.WAVE [LAMBDA (WORD ARRAY) (* pkh: "13-Jul-84 05:04") (PROG (STREAM) (SETQ STREAM (OPENSTREAM (PACKFILENAME 'HOST '{ERIS} 'DIRECTORY '<SPEECH>WAVE> 'NAME WORD 'EXTENSION 'WAVE) 'OUTPUT 'OLD/NEW)) (for I from 1 to (SUB1 (ARRAYSIZE ARRAY)) do (BOUT STREAM (ELT ARRAY I))) (CLOSEF STREAM]) (SPEECH.PRINT.WAVE.ARRAY [LAMBDA (REGION ARRAY WINDOW) (* pkh: "21-Jun-84 23:01") (PROG (Y.SCALE.FACTOR Y.POS.FOR.XSCALE BOTTOM.X.SCALE.OFFSET YMAX YMIN) (SETQ Y.SCALE.FACTOR (WINDOWPROP WINDOW 'Y.SCALE.FACTOR)) (SETQ Y.POS.FOR.XSCALE (WINDOWPROP WINDOW 'YPOS.FOR.X.SCALE)) (SETQ BOTTOM.X.SCALE.OFFSET (WINDOWPROP WINDOW 'BOTTOM.X.SCALE.OFFSET)) (SETQ YMAX (WINDOWPROP WINDOW 'YMAX)) (SETQ YMIN (WINDOWPROP WINDOW 'YMIN)) (* Read elements in the array from the part of the array corresponding to the region being displayed; check that it isn%'t out of bounds; convert the value according the the scaling factor; draw line from previous x and y position to the new one) (as X Y OLD.X OLD.Y from (COND (REGION (ADD1 (fetch (REGION LEFT) of REGION))) (T 1)) to (IMIN [COND [REGION (ADD1 (IPLUS (fetch (REGION LEFT) of REGION) (fetch (REGION WIDTH) of REGION] (T (ADD1 (WINDOWPROP WINDOW 'WIDTH] (ARRAYSIZE ARRAY)) do (SETQ Y (ELT ARRAY X)) (COND [(FLESSP Y YMIN) (printout PROMPTWINDOW "SCOPE: " Y " ") (SETQ Y (WINDOWPROP WINDOW 'YMIN] [(FGREATERP Y YMAX) (printout PROMPTWINDOW "SCOPE: " Y " ") (SETQ Y (WINDOWPROP WINDOW 'YMAX] (T (SETQ Y (SETQ Y (IPLUS (FTIMES Y Y.SCALE.FACTOR) BOTTOM.X.SCALE.OFFSET))) (COND (OLD.X (DRAWLINE OLD.X OLD.Y X Y 1 'PAINT SCOPE.WINDOW))) (SETQ OLD.Y Y) (SETQ OLD.X X]) ) (RPAQQ Y.AXIS.LINE.WIDTH 2) (PUTPROPS SCALEDWINDOW.FPKG COPYRIGHT ("Xerox Corporation" 1984)) (DECLARE: DONTCOPY (FILEMAP (NIL (1060 30687 (DISPLAY.FILE 1070 . 2331) (DRAWDOTTEDLINE 2333 . 2607) (FIRST.TIC 2609 . 3030) (NumberofStripes 3032 . 3210) (OLD.USER.CREATE.MENU 3212 . 3934) (SCALED.WINDOW.PRINT.SCALES 3936 . 5186) (SCALED.WINDOW.PRINT.Y.SCALE 5188 . 6854) (SCROLL 6856 . 13516) (SCALED.WINDOW.CLEARW 13518 . 14576) (PRINT.SCALE.NUMBERS 14578 . 16032) (PRINT.SPEECH.FILE 16034 . 17209) ( RESHAPE.SPEECH.DISPLAY.FILE.WINDOW 17211 . 17566) (SCALED.WINDOW.REPAINTFN 17568 . 18203) ( SCALED.WINDOW.RESHAPEFN 18205 . 20594) (SCALED.WINDOW.SCROLL.PAINTFN 20596 . 20984) ( SCALED.WINDOW.SCROLLFN 20986 . 21365) (SCALED.WINDOW.SETUP 21367 . 26233) (SDF 26235 . 27481) (SETY0 27483 . 28153) (SET.Y.SCALE.FACTOR 28155 . 28642) (SPEECH.COPY.ARRAY.TO.WAVE 28644 . 29070) ( SPEECH.PRINT.WAVE.ARRAY 29072 . 30685))))) STOP