video(set key color Sets the color to be used for chroma key (the color that will be transparent to video). is either a number from 0 to 15, corresponding to palette entries, or one of the following (matching solid colors of the ToolBook color palette): black dark red red white dark green green dark grey (default) dark yellow yellow none dark blue blue all dark magenta magenta dark cyan cyan Example: get video("set key color", "dark grey") Note that currently only black, white and dark grey work reliably with the DVA-4000 board and software before MIC 3.3. and Windows 3.0 rC7.t recognize the default Windows 3.0 palette settings. This will be corrected. video("set key color, ) disable "Previous" enable adjust x --** -- reset proportions moved objs -15, -15, -15,\ -15, -15, -15, - 15,\ defBounds setCaption what 0,50.1875,0 nterpage adjust setCaption previous disable enterpage enable enterpage ox%disable Previous enable Previous previous adjust defBounds setCaption disable enable 0,0,0 title odefBounds adjust buttonUp buttonDown buttonUp buttonDown defBounds adjust 6 defBounds 5670,4680,6885,5085 Go Back odefBounds adjust buttonUp buttonDown buttonUp buttonDown defBounds adjust defBounds 30,4650,1395,5085 Demo Previous odefBounds adjust buttonUp buttonDown buttonUp previous buttonDown defBounds adjust defBounds 3090,4680,4305,5085 Previous odefBounds adjust buttonUp buttonDown buttonUp buttonDown defBounds adjust defBounds 4410,4680,5580,5085 Next Reference /"reference" odefBounds adjust buttonUp buttonDown buttonUp reference buttonDown defBounds adjust defBounds 1485,4665,2715,5085 Reference The script of this book contains general purpose functions to control a full motion digital video adapter. This specific book is dedicated to the Videologic DVA-4000, but another book with the same functions could control another board. The script, controls and features of the first page are included as examples of the kinds of things you can do by calling the functions in the script of this book. Typically, the way to use this book is by including it in the system variable sysBooks to make its functions available to your application. For instance, the enterBook handler in the script of your application book could contain the statement "push DVA-4000.TBK onto sysBooks". You can use more than one system book at the same time; for instance, another system book could contain the functions to control a videodisc player, and yet another one could contain handlers and functions for a test scoring system. and functions for a test scoring system. ions for a test scoring system. How to use this book with your application All video control is through one function, video, which you call with different arguments. A typical call to video is in the form get video([, ]) Some of the calls require the parameter; a few don't. See the reference section of this book for details. Function calls to video() return 1 if successfull, -1 if they failed. Typical causes of errors would be that video("open") was not called successfully earlier in the session, or that one of the arguments to the function was illegal or out of range. Video Control audioControl(set level Sets the audio level for both stereo channels. is any integer number from 0 to 255. 0 is no sound, 255 is maximum volume. The system variable s_audio_level is set to the current audio level. video("fade in") sets it to 255 , and video("fade out") sets it to 0 . audioControl("set level",) audioControl(set level video(close) video(Fade in[ video(Freeze) video(set level video(Initialize) video(Open) video(Zoom video(set inset video(set key color video("set frame mode") video("set field mode") Sets the frame buffer to full frame mode or to field mode. In some cases, there is a noticeable flicker when a videodisc player is in still frame or playing in slow motion. When in field mode, the resolution is lower but there will be no flicker in the picture because only one of the two fields that make up a complete frame is sampled. System xproperly initialized dvaCmd x 4s_DVA_Init s_DVA_Iinit "Error: jx & CRLF -- Initialize default settings, but fno video -- shown (chromakey off). does xrespond, indicate error. initDVA , s_DVA_Key_Color xMICLoaded() "Cannot find drivers." &&\ --"Assuming you are ]separate monitor suspend X"tbkwin.dll" STRING screenFromPage(WORD, , INT, ,sysMagnification,"0,0")\ TBKWIN.DLL xfound wrong ("!EOFF") ("FSTORE MODE 0 COORDS 0,640,480") 1IREGION 0,3,FULL") LDPOS 0,3,0,0, RELATIVE") mWPOS 0,3,0,0") ("TRANSCOLOUR NONE") ("FADE 255,1 /V") BACKGROUND 0,75,75,75") FullScreen 4IsFullScreen ABSOLUTE") DSIZE 0,3, ALL") setVideoOutRect BoundsRect -- Turns on sets which being displayed %specified ToolBook units (relative can specify "pixels" -- Examples: "Foo") ("45,67,3460,4567") ("0,0,640,150 -- If full -- If invalid, turns off 4s_InsetRect, "0,0,639,479 rect ) - 1) pageToScreen( G) < 4 " && "," & ) && " " & \ & "," & \ setKeyColor x -- Sets Ocolor 16 colors palette -- Unfortunately, only 3 )seem work correctly: 5(0), d(15) dark grey (7). Maybe we'll a better trick these days. -- Note: change xtake effect SetVideoOutRect x >= 0 x <= 15 Freeze 4s_DVA_Frozen DVACmd(" INPUT 0,2,DISABLE") unFreeze 2ENABLE") -- Test that Config.sys loaded "mic" testString ) = 1 -- Now "x yx z" & CR "!STATUS" & CR P--- checking part initDVA setVideoOutRect dvaCmd setKeyColor FullScreen Freeze unFreeze MICLoaded dvaCmd Error: DVA not initialized s_DVA_Iinit s_DVA_Init initDVA MICLoaded Error: No DVA drivers tbkwin.dll screenFromPage screenFromPage Error: TBKWIN.DLL not found or wrong TBKWIN.DLL dvaCmd !EOFF dvaCmd FSTORE MODE 0 normal dvaCmd FSTORE COORDS 0,640,480 dvaCmd FSTORE IREGION 0,3,FULL dvaCmd FSTORE DPOS 0,3,0,0, RELATIVE dvaCmd FSTORE WPOS 0,3,0,0 dvaCmd TRANSCOLOUR NONE dvaCmd FADE 255,1 /V dvaCmd FSTORE BACKGROUND 0,75,75,75 suspend s_DVA_Init s_DVA_Key_Color FullScreen FSTORE DPOS 0,3,0,0 ABSOLUTE dvaCmd FSTORE DSIZE 0,3,FULL dvaCmd TRANSCOLOUR ALL dvaCmd IsFullScreen setVideoOutRect Full Screen 0,0,639,479 pixels pixels pageToScreen dvaCmd TRANSCOLOUR NONE dvaCmd TRANSCOLOUR dvaCmd FSTORE DPOS 0,3, ABSOLUTE dvaCmd FSTORE DSIZE 0,3, s_InsetRect s_DVA_Key_Color BoundsRect setKeyColor s_DVA_Key_Color Freeze DVACmd FSTORE INPUT 0,2,DISABLE s_DVA_Frozen unFreeze DVACmd FSTORE INPUT 0,2,ENABLE s_DVA_Frozen MICLoaded !EOFF x yx z !STATUS testString qaB|B| waB|B| defsize 6930,5130 bufferOpen a video overlay/keying board -- which can also have audio capabilities -- The implementation specific DVA4000 `use .same names -- arguments, fdifferent bodies, control other -- boards cmd, params 4s_DVA_Init, s_video_level, s_audio_level, s_frozen @ <> "Open" O <> "Initialize") cmd1 cmd2 "Close" InitDVA "Set" < 0 > 255 dvaCmd ("FADE" && &",1 /V") "key" c"dark" c"grey" "TRANS NONE" x(isNumber( s_DVA_Key_Color `" && "inset" setVideoOutRect "Fade" "Up" 255," & & " /V") "Down" 0," & & " /V") "Freeze" freeze "Unfreeze" unfreeze "Zoom" "In" DVAZoom "In", "Out" audioControl < 0 > 255 & ",1 /A1/A2") -- assume that tsysbook a videodisc controller a dangerous assumption, but I can't think -- another way --== General purpose utilities suspend n + 0 -- Drivers Videologic MIC software -- Sends a driver -- Will fail xproperly initialized s_DVA_Iinit "Error: jx & CRLF default settings, -- shown (chromakey off). does xrespond, indicate error. initDVA xMICLoaded() "Cannot find drivers." &&\ --"Assuming you are ]separate monitor X"tbkwin.dll" STRING screenFromPage(WORD, , INT, ,sysMagnification,"0,0")\ TBKWIN.DLL xfound wrong !EOFF") STORE MODE 0 COORDS 0,640,480") ,IREGION 0,3,FULL") EDPOS 0,3,0,0, RELATIVE") dWPOS 0,3,0,0") TRANSCOLOUR 255,1 /V") BACKGROUND 0,75,75,75") FullScreen 4IsFullScreen ("FSTORE ABSOLUTE") DSIZE 0,3, BoundsRect -- Turns on sets being displayed %specified ToolBook units (relative specify "pixels" -- Examples: "Foo") ("45,67,3460,4567") ("0,0,640,150 -- If full -- If invalid, turns off 4s_InsetRect, s_DVA_Out_rect, "0,0,639,479 ) - 1) ) < 4 s_DVA_Out_Rect " && "," & && " " & \ & "," & \ setKeyColor x -- Sets Ocolor 16 colors palette -- Unfortunately, only 3 )seem work correctly: 5(0), d(15) (7). Maybe we'll a better trick these days. -- Note: change xtake effect SetVideoOutRect x >= 0 x <= 15 4s_Frozen DVACmd(" INPUT 0,2,DISABLE") unFreeze 2ENABLE") x, ZoomRect 4s_video_zoomed, s_inRect "In" 2," & T <> -- Test Config.sys loaded "mic" testString ) = 1 -- Now "x yx z" & CR "!STATUS" & CR P--- checking part itDVA setVideoOutRect dvaCmd setKeyColor FullScreen Freeze unFreeze initDVA DVAZoom ontrol video isNumber audioControl MICLoaded t video Initialize Initialize Close + 0 s) <= 32 U(s) > 0 s) <= 32 filterCtrl s -- T< " " ) >= 32 legalName s, maxL -- , s) > 0 ,s)) ~(",",s) p > 0 suspend X"TBKWIN.DLL" INT popMenu(WORD, STRING, "titles" /"reference" C(mL) mL) & CRLF lc > 20 (lc / 2) Bi-1 Y) <> "|" "|" & , sysMagnification,\ --== housekeeping ==-- -- Generic functions a video overlay/keying board -- which can also have audio capabilities -- The implementation specific DVA4000 -same names -- arguments, fdifferent bodies, control other -- boards cmd, params 4s_DVA_Init, s_video_level, s_audio_level, s_frozen, s_DVA_Key_Color Q <> "Open" ` <> "Initialize") cmd1 cmd2 "Close" InitDVA BufferOpen "Set" < 0 > 255 dvaCmd ("FADE" && &",1 /V") "frame" "mode" 15 " && "inset" setVideoOutRect "Fade" "Up" 255," & & " /V") "Down" 0," & & " /V") "Freeze" freeze "Unfreeze" unfreeze "Save" (bufferOpen dvacmd("FST BUF RES 64 16") $SAVE 0 1 :" & "Load" `V 64 16") wLOAD 0 1 :" & "Zoom" "In" DVAZoom "In", "Out" audioControl < 0 > 255 & ",1 /A1/A2") -- assume that tsysbook a videodisc controller a dangerous assumption, but I can't think -- another way --== General purpose utilities n + 0 -- Drivers Videologic MIC software -- Sends a driver -- Will fail xproperly initialized s_DVA_Iinit "Error: writeMIC(x & jx & default settings, -- shown (chromakey off). does xrespond, indicate error. initDVA xMICLoaded() "Cannot find drivers." &&\ --"Assuming you are ]separate monitor X"tbkwin.dll" screenFromPage( INT, "0,0")\ xfound wrong !EOFF") STORE MODE 0 COORDS 0,640,480") ST HOLD 0:" & \ ;" & \ IREGION 0,3,FULL;" & \ "FSTORE DSIZE 0,3, DPOS 0,3,0,0, RELATIVE;" &\ WSIZE 0,3, EWPOS 0,3,0,0;" &\ INPUT 0,3,ENABLE;" & \ OUTPUT 0,3, RELEASE 0") ST BACK 0,0,0,0") 255,1 /V") ST enable 0, 1") sDVA_Key_Color xFullScreen 4IsFullScreen ABSOLUTE") ("TRANSCOLOUR BoundsRect -- Turns on sets being displayed %specified ToolBook units (relative specify "pixels" -- Examples: "Foo") x ("45,67,3460,4567") ("0,0,640,150 -- If full -- If invalid, turns 4s_InsetRect, s_DVA_Out_rect, "0,0,639,479 " && & ";" & \ ) - 1) ) < 4 s_DVA_Out_Rect " && "," & && " " & \ & "," & \ setKeyColor x -- Sets Ocolor 16 colors palette -- Unfortunately, 'seem work correctly: 5(0), d(15) (7). Maybe we'll a better trick these days. -- Note: change xtake effect SetVideoOutRect x >= 0 x <= 15 4s_Frozen DVACmd(" DISABLE") unFreeze b x, ZoomRect 4s_video_zoomed, s_inRect "In" 2," & T <> -- Test Config.sys loaded X"mictalk. WriteMIC( ReadMIC() 255,100 /v" & readMIC() D MicTalk.dll. should still , but"\ will be a little slower." testString A) = 1 -- Now "x yx z" "FxADE 0,1,3,5 /V;!STATUS" & result:" && & ";" && P--- checking part loadFrame rightButtonDoubleClick reader dvaCmd author initDVA xFullScreen saveFrame setVideoOutRect enterBook setKeyColor Freeze leaveBook unFreeze DVAZoom legalName video filterCtrl audioControl isNumber MICLoaded loadFrame dvaCMD fst load 0 1 : saveFrame dvaCMD fst save 0 1 : reader sizeToPage author sizeToPage sysPagesDB enterBook sysPagesDB leaveBook filterCtrl legalName filterCtrl rightButtonDoubleClick TBKWIN.DLL popMenu titles reference popMenu legalName title suspend video Initialize Initialize Close + board I("Open") e", 255) audioControl(" ", 200) key color", "Cannot . Video controls will have"\ && "no effect." , s_full_flag exitFullScreen "zoom prompt" ", 0) ("Close") } <> showFullScreen , s_norm_b, s_norm_sz, s_video_zoomed, s_old_z Rect" 640* 15, 480 * 15 -3,-22,643,483 defsize -- While , keep inset synch -- reference -- Also, adjust slider thumbs reflect %necessary 4s_old_is, s_old_vl, s_old_al, , s_old_f screen") <> s_old_vs showSetting ( /255) /255) setcaption "Zoom Out" -- Special stuff maintain correct proportions, buttons -- on cauthoring x --** -- reset moved objs -15, -15, -15,\ -15, -15, -15, - 15,\ defBounds setCaption what disable 0,50.1875,0 enable FullScreen leavePage exitFullScreen enterpage adjust leaveBook setCaption disable showFullScreen enable enterpage video set level video set level audioControl set key color key color name video Cannot initialize the DVA board. Video controls will have no effect. reader sizeToPage s_video_level s_audio_level leavePage exitFullScreen zoom target zoom prompt set level audioControl Close video s_full_flag leaveBook exitFullScreen s_full_flag showFullScreen full Rect zoom target zoom prompt s_full_flag s_norm_b s_norm_sz s_video_zoomed s_old_z exitFullScreen defsize sizeToPage full Rect s_full_flag s_norm_b s_norm_sz inset rectangle set inset full screen video set inset video showSetting thumb 2 showSetting thumb 1 setcaption Zoom Out zoom button setcaption zoom button s_old_vs s_video_zoomed s_old_z s_full_flag s_old_f s_old_is s_old_vl s_old_al s_video_level s_audio_level adjust defBounds setCaption disable enable 0,0,0 4p8zB Full Screen ShowFullScreen odefBounds adjust buttonUp buttonDown buttonUp ShowFullScreen buttonDown defBounds adjust defBounds 4095,3300,6795,3720 Full Screen Copyright 1990 Asymetrix Corporation field-1 reset --** proportions moved - 15, - 15,\ - 15, -15, reset reset key color name dial ( keydown keydown alignment centered cyan magenta Chroma key color video(" key color", hilite"\ >- 30,\ >- 30 "inset "full rect" "zoom default buttonDown buttonDown name of target? set key color video key color hilite key color name inset rectangle full rect zoom target 240,50,100 zoom target 0,50,100 default dark grey dark green dark cyan dark blue dark magenta black white yellow magenta green dark red light grey dark yellow key color hilite Inset Rectangle field-1 reset --** proportions moved - 15, - 15,\ - 15, -15, reset reset phone number dial ( keydown keydown &alignment centered C.0. 5/17/90 video("Freeze") odefBounds adjust buttonUp buttonDown buttonUp Freeze video buttonDown defBounds adjust 'defBounds 4155,705,6810,1125 Freeze :)B*; video("Unfreeze") odefBounds adjust buttonUp buttonDown buttonUp Unfreeze video buttonDown defBounds adjust T*defBounds 4155,1140,6810,1560 Unfreeze video("Fade odefBounds adjust buttonUp buttonDown buttonUp Fade in video buttonDown defBounds adjust ,defBounds 4125,2250,6810,2700 Fade In Video video("Fade out") odefBounds adjust buttonUp buttonDown buttonUp Fade out video buttonDown defBounds adjust Z/defBounds 4125,2700,6810,3150 Fade Out Video Zoom button 4s_video_zoomed ("Zoom out") Target" \ 3prompt" \ odefBounds adjust buttonUp buttonDown buttonUp Zoom out video Zoom Target Zoom Target Zoom prompt Zoom target s_video_zoomed buttonDown defBounds adjust 2defBounds 4140,1680,6810,2130 "ah3d3 Zoom Inset Rectangle: This rectangle is used as reference for the location and size of the video image keyed into the VGA output. slide 1 reset --** proportions moved - 15, - 15,\ - 15, -15, reset reset 6defpos 135,3585 phone number dial ( keydown keydown X8alignment centered thumb 1 4s_y_offset, s_def_NumF omaxY odefX -- recalibrate sBnds ("slide" && ominY oheight "0.000" old_loc <> s_old_loc optional here, depending on how the setting can be done setStuff -- clean up showSetting ratio -- Adjust reflect a changed ( I'm tied -- Assumes I am already calibrated c must be a floating point zbetween 0 1 (inclusive) ) * (1 - whatever we're supposed according thumb 1 - ( ) / ( AudioControl("Set Level", (255 * ubleClick buttonDown buttonStillDown buttonUp buttonDoubleClick showSetting setStuff buttonDown slide height height 0.000 sBnds s_y_offset s_def_NumF buttonDoubleClick buttonDown buttonStillDown setStuff s_y_offset s_old_loc buttonUp setStuff s_y_offset s_old_loc s_def_NumF showSetting ratio setStuff Set Level AudioControl @maxY @maxX Aheight ,A AminY FA:AdefX fAVAlowest 150,4800 vAhighest 150,3600 slide 2 reset --** proportions moved - 15, - 15,\ - 15, -15, reset reset Ddefpos 135,3585 phone number dial ( keydown keydown Ealignment centered thumb 2 4s_y_offset, s_def_NumF omaxY odefX -- recalibrate sBnds ("slide" && ominY oheight "0.000" old_loc <> s_old_loc optional here, depending on how the setting can be done setStuff -- clean up showSetting ratio -- Adjust reflect a changed ( I'm tied -- Assumes I am already calibrated c must be a floating point zbetween 0 1 (inclusive) ) * (1 - whatever we're supposed according thumb multiplier 1 - ( ) / ( Video("Set level", (255 * ubleClick buttonDown buttonStillDown buttonUp buttonDoubleClick showSetting setStuff buttonDown slide height height 0.000 sBnds s_y_offset s_def_NumF buttonDoubleClick buttonDown buttonStillDown setStuff s_y_offset s_old_loc buttonUp setStuff s_y_offset s_old_loc s_def_NumF showSetting ratio setStuff Set level Video multiplier Nhighest 150,3600 Nlowest 150,4800 NdefX NminY Nheight OmaxX &OmaxY Audio volume Video level PQ). The system variable s_video_level is set to the current video level. video("fade in") sets it to 255 , and video("fade out") sets it to 0 . is in hundredths of a second. If is not specified, the fade will take one second. Note: Control returns to your application as soon as the fade is initiated, not when it is complete. video("Fade in"[,]) video("Fade out"[,]) video(set level Sets the video level. is any integer number from 0 to 255. 0 is black, 255 is full level. The system variable s_video_level is set to the current video level. video("fade in") sets it to 255 , and video("fade out") sets it to 0 . video("set level",) video(set inset Sizes and places the video picture to match . is a list of four numbers defining the bounds of a rectangle in ToolBook units Example: get video("set inset", bounds of rectangle "inset reference") You can also specify a rectangle in pixels relative to the screen. Simply add the word "pixels" at the end of the rectangle string. Example: get video("set inset","10,0,450,340 pixels") can also be one of the following values: full screen -- the video will take over the full screen, regardless of chroma key color setting none -- the video inset is removed and chroma key is turned off video("set inset",) video(Zoom Zooms the portion of the incoming video defined by "rectangle" to fill the inset rectangle. is a list of four numbers defining a rectangle. It is expressed in pixels, relative to the full video frame. See the script of the rectangle "zoom target" that appears when you click the zoom button on page 1 of this book for a complete example. If you resize the display rectangle with video("set inset", ), the same portion of the video frame will be resized to fit. Zooming works on a frozen picture too. See video("Freeze"). Use video("Zoom out") to use the entire video frame again. The system variable s_video_zoomed is set to 1 when the image is zoomed, and to null when it is not... video("Zoom",) video("Zoom out") video(Freeze) video("Freeze") video("Unfreeze") Freezes or unfreezes the incoming video picture. When a picture is frozen, you can zoom in and out of it just as if it was moving. The system variable s_video_frozen is set to 1 when the image is frozen, and to null when it is not. (bTK@ H(bZaR