\ io \ \ io_screen \ graphics and user interface components for io. Additional graphics used \ for testing are found in the io_output file. \ \ \ see the file io_top for more information. \ \ \ constructor: Han-earl Park \ copyright 2008 buster & friends' C-ALTO Labs \ \ www.busterandfriends.com/io \ \ (Edinburgh, November 1996 - \ (London, August 1997 - \ (Den Haag, October 1997 - \ (Valencia, March 1999 - \ (Southampton, May 2000 - \ (Cork, April 2006 - \ \ (Cork, October 2008 - \ \ REV: 0.0.1 alpha (Southampton, October 2000) \ REV: 0.0.1 beta (Southampton, November 2000) \ REV: 0.0.1 alpha++ (Southampton, July 2004) \ REV: 0.0.1 beta++ (Cork, May 2010) \ \ \ MOD: HeP 03/05/99 Started project afresh! \ This version keeps most of the "intelligence" in the \ objects, while the piece specific elements are kept to a \ minimum. It is also a test for the "laurie" project. \ MOD: HeP 01/23/00 Move hp_ graphics to the io_hp file. \ MOD: HeP 01/31/00 Partially dynamic gui items for input configuration. \ Nasty bug traced to the implementation of PUT.ENABLE: in \ the numeric.grid class. Thus use some distinctly host \ dependent menu bar functions. \ *phew* One complex gui... \ MOD: HeP 02/03/00 Go find #@!$&!? in this file. \ MOD: HeP 02/10/00 Use a lists to hold the dynamically instantiated controls \ for input configuration. \ MOD: HeP 02/21/00 Add the global control word IO.STANDBY and corresponding \ words to each component. \ MOD: HeP 02/26/00 Add output-pan-grctrl. \ Make config-screen an instance of ob.screen+. \ MOD: HeP 04/12/00 Move the text (for the sophisticated AI engine) into $rom. \ Makes for less readable, but neater code. \ MOD: HeP 04/15/00 Add support for the macintosh enter key (same as return). \ MOD: HeP 05/06/00 The default ui command is now NOOP and not IO.START. \ Ugly, but functional fix of the bug that allowed pdur \ values of greater than 60 minutes by setting the seconds. \ MOD: HeP 05/15/00 New functions for setting up parser type, channel, etc. \ See the file io_input. \ hmsl's key-parser has a differecnt function depending on \ which screen is being displayed. \ MOD: HeP 06/01/00 Replace the confusing array of configuration words with \ IO.INPUT, SET.INPUT.TYPE and SET.OUTPUT. \ If io_script? is true, the modules:io_script component \ will be loaded and enabled. \ MOD: HeP 06/07/00 Implement stereo pan control. \ MOD: HeP 06/20/00 Split off io_ui from io_screen and io_input. \ MOD: HeP 06/24/00 Remove half the IO.GR... words (and the corresponding \ IO.SCREEN... words). Note that these words now call the \ corresponding global control procedures in addition to \ changing the gui state. \ MOD: HeP 07/13/00 Trash code that duplicated those found in the file \ myt:midi_menu. \ Add regular calls to UPDATE.SCREEN (perhaps unnecessary?) \ MOD: HeP 07/16/00 Check IO.IDLE? to prevent IO.PLAY from being called \ consecutively by the start control. \ MOD: HeP 26/08/00 Revamp turnkey menubar -- setup items are now in the file \ menu. \ MOD: HeP 09/19/00 Spin off modules:io_menus. This results in redesign of how \ the screen menu is updated. \ MOD: HeP 09/21/00 Stop the user from altering the pdur when playing (ugly \ work-around the numeric.grid's GET.ENABLE: bug). \ MOD: HeP 09/22/00 Fix bug w/ changing parser type. \ MOD: HeP 10/01/00 Setting to open_pdur will update pdur screen control. \ MOD: HeP 10/02/00 Replace all the work arounds with the myt:numeric.grid+ \ class that fixes the GET.ENABLE: related bug. \ MOD: HeP 10/15/00 Fix bug storing io-pdur. \ Supress those "witty" comments if shift key is held down. \ REV: 0.0.1 alpha __________________________________________________________ \ MOD: HeP 11/17/00 Enable #parsers_enabled number of parser at when .DEFAULT \ (and thus .INIT) is called. \ MOD: HeP 11/18/00 Use INPUT.PARSER@ and INPUT.CHANNEL@ from file io_config. \ MOD: HeP 11/20/00 Move PARSER.ERROR.DIALOG to io_input. \ MOD: HeP 11/22/00 Change commands key for screen menu to ascii 1 and 2 in \ order to reflect turnkey app's menu, and avoid conflicts \ with the midi menu (see file myt:midi_menu). \ REV: 0.0.1 beta __________________________________________________________ \ MOD: HeP 01/14/00 NEW: the config-screen first so as to appear upper on the \ non-turnkeyed screen menu. \ MOD: HeP 03-30-04 Add controls for bypassing reverb and setting device id. \ Reshuffle the screen a bit. \ MOD: HeP 04-08-04 The input config controls use the numeric.grid+ class. \ MOD: HeP 04-11-04 Correctly sets the reverb and pan settings. \ Set device id# for MIDI output. \ Comment out the lines marked #@!$&!? \ Rewrite the input config words so that we can call them \ externally. \ MOD: HeP 04-12-04 Correct an error in ENABLE.PDUR.GRCTRL that seems to have \ gone undetected for several years! \ Rewrite PDUR.MODE.GRFUNC and OUTPUT.DEVICE.GRFUNC so that \ we can call them externally. \ Tested reading and writing to file data held in the \ screeen controls. \ MOD: HeP 04-13-04 Add variable unsaved-changes? used by io_file to keep \ track of changes. (Moved these to io_glob.) \ MOD: HeP 04-15-04 Trash io_script? which wasn't being used. \ MOD: HeP 05-01-04 Rewrite the qwerty handling so that we can modify this in \ later components. \ MOD: HeP 05-11-04 Handle refresh of controls a little more gracefully. \ MOD: HeP 05-17-04 Rewrite some of the remaining control functions so we can \ call them externally without problems. This fixes a bug \ that set UNSAVED.CHANGES? to true when switching scenes. \ See also modules:io_file_glue. \ MOD: HeP 05-19-04 Split off performance duration dialog boxes to \ modules:io_pdur_dlog. Small changes to pdur control \ functions as a result. \ MOD: HeP 07-03-04 IO.STOP will switch to next "scene." \ Each component's .INIT function no longer calls the \ corresponding .DEFAULT function. Instead these are all \ called at the end of IO.INIT. See file io_top. \ (IO.GR.DEFAULT) will only call IO.SCREEN.DEFAULT if \ "io preferences" file open failed. See file io_top. \ REV: 0.0.1 a ++ __________________________________________________________ \ REV: 0.0.1 b ++ __________________________________________________________ \ Version for performance at Blackrock Castle Observatory, \ Cork, Ireland, May 25, 2010. \ \ \ ToDo: With the use of numeric.grid+ class, are the DRAW: messages redundant \ when values are updated? \ ToDo: multi-channel midi ui control? Provisions for more than one ui \ controller at a time? In that case, will need to redefine \ ui-ctrl-grctrl as a check.grid. \ ToDo: More consistent and comprehensive error reporting. anew task-io_screen \ performance screen ob.screen+ perf-screen ob.radio.grid start-grctrl ob.check.grid pause-grctrl ob.menu.grid reset-grctrl ob.menu.grid panic-grctrl ob.numeric.grid+ pdur-time-grctrl ob.radio.grid pdur-mode-grctrl \ configuration screen ob.screen+ config-screen ob.array prev-grctrl-device \ to 'undo' the input device settings ob.objlist input-grctrl-holder \ list of dynamically created controls ob.radio.grid output-device-grctrl ob.numeric.grid+ output-chan-grctrl ob.check.grid output-panrev-grctrl ob.numeric.grid+ ui-chan-grctrl ob.radio.grid ui-ctrl-grctrl ob.menu.grid default-grctrl ob.menu.grid play-grctrl \ refresh control : REFRESH.CONTROL ( control -- , draw control if drawn on screen ) dup ?drawn: [] IF draw: [] ELSE drop THEN ; \ window io_turnkey? .IF : IO.OPEN ( -- , replacement for hmsl.open ) hmsl-window @ 0= IF HMSL-NewWindow window.defaults \ io.title HMSL-NewWindow ..! wt_title \ gr_window_top hmsl-newwindow .. wt_rect ..! rect_top gr_window_left hmsl-newwindow .. wt_rect ..! rect_left gr_window_top gr_window_height + hmsl-newwindow .. wt_rect ..! rect_bottom gr_window_left gr_window_width + hmsl-newwindow .. wt_rect ..! rect_right \ 4 hmsl-newwindow ..! wt_procID \ non growable document window false hmsl-newwindow ..! wt_goAwayFlag \ no close box \ HMSL-NewWindow gr.openwindow dup hmsl-window ! dup IF gr.set.curwindow 0 TextFont() ELSE drop ." Could not open io window!" cr abort THEN THEN hmsl-window @ SelectWindow() ; .THEN \ MenuBar io_turnkey? NOT .IF \ turnkey menus are found in modules:io_menus : DISABLE.CONFIG.MENU ( -- , disable item from screens menu ) config-screen indexof: custom-screens IF custom_menu_id GetMHandle() swap 1+ DisableItem() THEN ; : ENABLE.CONFIG.MENU ( -- ) config-screen indexof: custom-screens IF custom_menu_id GetMHandle() swap 1+ EnableItem() THEN ; : IO.DRAW.MENUS ( -- , called via draw.hmsl.menus ) menus.draw \ draw standard hmsl menus \ 1 get.value: start-grctrl IF disable.config.menu DrawMenuBar() THEN ; : IO.MENUS.DEFAULT ( -- ) ; : IO.MENUS.RESET ( -- ) ; : IO.MENUS.UPDATE ( -- ) ; : IO.MENUS.PANIC ( -- ) ; : IO.MENUS.STANDBY ( -- ) disable.config.menu ; : IO.MENUS.START ( -- ) ; : MENUS.IMBNF ( -- , it must be nearly finished ) ; : IO.MENUS.STOP ( -- ) enable.config.menu ; : IO.MENUS.PAUSE ( -- ) enable.config.menu ; : IO.MENUS.RESUME ( -- ) disable.config.menu ; : IO.MENUS.INIT ( -- ) 'c io.draw.menus is DRAW.HMSL.MENUS ; : IO.MENUS.TERM ( -- ) 'c menus.draw is DRAW.HMSL.MENUS ; .THEN \ "Performance" screen \ turn pdur controls on/off : DISABLE.PDUR.GRCTRL ( -- ) false -1 put.enable: pdur-mode-grctrl false -1 put.enable: pdur-time-grctrl pdur-mode-grctrl refresh.control pdur-time-grctrl refresh.control ; : ENABLE.PDUR.GRCTRL ( -- ) true -1 put.enable: pdur-mode-grctrl io-pdur-mode @ open_pdur = IF PDUR.SEC@ 60 /mod 1 put.value: pdur-time-grctrl 2 put.value: pdur-time-grctrl ELSE true -1 put.enable: pdur-time-grctrl pdur-time-grctrl refresh.control THEN pdur-mode-grctrl refresh.control ; \ performance controls : START.GRFUNC ( n pt# -- ) IF io.idle? AND \ prevent io.play from retriggering IF true 0 put.enable: pause-grctrl draw: pause-grctrl false 0 put.enable: reset-grctrl draw: reset-grctrl disable.pdur.grctrl IO.PLAY THEN ELSE IF IO.STOP enable.pdur.grctrl false 0 put.value: pause-grctrl false 0 put.enable: pause-grctrl true 0 put.enable: reset-grctrl pause-grctrl refresh.control reset-grctrl refresh.control THEN THEN ; : PAUSE.GRFUNC ( n pt# -- ) drop IF IO.PAUSE ELSE IO.RESUME THEN \ 12 gr.height! \ #@!$&!? ; : RESET.GRFUNC ( n pt# -- ) 2drop " By resetting the system, you will loose ioÕs current Ôpersonality.Õ Are you sure you want to do this?" dialog.a/b IF IO.RESET THEN \ update.screen 12 gr.height! \ #@!$&!? ; : PANIC.GRFUNC ( n pt# -- ) 2drop IO.PANIC \ 12 gr.height! \ #@!$&!? ; \ performance duration : (PDUR.MODE.GRFUNC) ( n pt# -- ) nip dup set.pdur.mode \ open_pdur = IF PDUR.SEC@ 60 /mod 1 put.value: pdur-time-grctrl 2 put.value: pdur-time-grctrl \ false -1 put.enable: pdur-time-grctrl ELSE true -1 put.enable: pdur-time-grctrl THEN ; : PDUR.MODE.GRFUNC ( n pt# -- ) unsaved.change \ (pdur.mode.grfunc) \ n pt# -- draw: pdur-time-grctrl ; variable pdur-prev-minutes : (PDUR.STORE.VALUE) ( -- ) 1 get.value: pdur-time-grctrl 60 * 2 get.value: pdur-time-grctrl + PDUR.SEC! 1 get.value: pdur-time-grctrl pdur-prev-minutes ! ; : PDUR.TOO.LONG? ( -- flag ) ?shift IF false ELSE 1 get.value: pdur-time-grctrl dup [ max_pdur 60 / io_rtc_rate / ] literal > over pdur-prev-minutes @ 4+ > AND swap [ max_pdur 60 / io_rtc_rate / ] literal - 0 max choose AND THEN ; : PDUR.STORE.VALUE ( -- ) pdur.too.long? IF pdur.dialog \ -- flag , defined in modules:io_pdur_dlog IF unsaved.change \ (pdur.store.value) ELSE pdur-prev-minutes @ 1 put.value: pdur-time-grctrl 1 draw.part: pdur-time-grctrl THEN ELSE unsaved.change \ (pdur.store.value) THEN ; : PDUR.HRS.GRFUNC ( n -- ) IF 60m.dialog \ defined in modules:io_pdur_dlog THEN 00 0 put.value: pdur-time-grctrl 0 draw.part: pdur-time-grctrl ; : PDUR.MIN.GRFUNC ( n -- ) dup 59 > IF drop \ 60m.dialog \ defined in modules:io_pdur_dlog \ 00 0 put.value: pdur-time-grctrl pdur-prev-minutes @ 1 put.value: pdur-time-grctrl 1 draw.part: pdur-time-grctrl ELSE IF -1 ELSE 0 THEN 2 put.min: pdur-time-grctrl THEN ; : PDUR.SEC.GRFUNC ( n -- ) dup 0 59 within? IF drop ELSE 0> IF 1 get.value: pdur-time-grctrl dup 59 = IF drop 59 2 put.value: pdur-time-grctrl ELSE 1+ 1 put.value: pdur-time-grctrl 00 2 put.value: pdur-time-grctrl THEN -1 2 put.min: pdur-time-grctrl ELSE 1 get.value: pdur-time-grctrl 1- \ dup NOT IF 00 2 put.min: pdur-time-grctrl THEN \ 1 put.value: pdur-time-grctrl 59 2 put.value: pdur-time-grctrl THEN draw: pdur-time-grctrl THEN ; : PDUR.TIME.GRFUNC ( n pt# -- ) CASE 0 OF pdur.hrs.grfunc ENDOF 1 OF pdur.min.grfunc ENDOF 2 OF pdur.sec.grfunc ENDOF ENDCASE ; : PDUR.TIME.UP.GRFUNC ( n pt# -- ) pdur.time.grfunc pdur.store.value ; \ setup "Performance" screen : PERF.DRAW.FUNC ( -- ) 'c ui.qwerty.vector key-parser ! ; : PERF.SCREEN.DEFAULT ( -- ) false 0 put.enable: pause-grctrl \ io-pdur-mode @ 0>= IF true io-pdur-mode @ put.value: pdur-mode-grctrl THEN \ io-pdur @ io_rtc_rate / 60 /mod 1 put.value: pdur-time-grctrl 2 put.value: pdur-time-grctrl ; : PERF.SCREEN.INIT ( -- ) sub" perf.screen.init" \ 8 3 new: perf-screen ascii 2 put.key: perf-screen " Performance" put.title: perf-screen 'c ui.qwerty.func put.key.function: perf-screen 'c perf.draw.func put.draw.function: perf-screen \ 2 1 new: start-grctrl 1 1 new: pause-grctrl 1 1 new: reset-grctrl 1 1 new: panic-grctrl 1 3 new: pdur-time-grctrl 1 3 new: pdur-mode-grctrl \ start-grctrl 2520 3050 add: perf-screen pause-grctrl 2000 3050 add: perf-screen reset-grctrl 200 3050 add: perf-screen panic-grctrl 800 3050 add: perf-screen pdur-time-grctrl 1000 1700 add: perf-screen pdur-mode-grctrl 200 1700 add: perf-screen \ 500 240 put.wh: start-grctrl 450 240 put.wh: pause-grctrl 520 240 put.wh: reset-grctrl 470 240 put.wh: panic-grctrl 270 240 put.wh: pdur-time-grctrl 460 240 put.wh: pdur-mode-grctrl \ " Duration:" put.title: pdur-mode-grctrl \ " Stop" 0 put.text: start-grctrl " Start" 1 put.text: start-grctrl " Pause" 0 put.text: pause-grctrl " Reset..." 0 put.text: reset-grctrl " Panic!" 0 put.text: panic-grctrl stuff{ " hrs:" " min:" " sec:" }stuff.text: pdur-time-grctrl stuff{ " Strict" " Loose" " Open" }stuff.text: pdur-mode-grctrl \ 0 0 put.min: pdur-time-grctrl 1 0 put.max: pdur-time-grctrl 0 1 put.min: pdur-time-grctrl 60 1 put.max: pdur-time-grctrl -1 2 put.min: pdur-time-grctrl 60 2 put.max: pdur-time-grctrl \ 'c start.grfunc put.up.function: start-grctrl 'c pause.grfunc put.down.function: pause-grctrl 'c reset.grfunc put.up.function: reset-grctrl 'c panic.grfunc put.up.function: panic-grctrl 'c pdur.time.grfunc put.move.function: pdur-time-grctrl 'c pdur.time.up.grfunc put.up.function: pdur-time-grctrl 'c pdur.mode.grfunc put.up.function: pdur-mode-grctrl \ status-grtext 200 600 add: perf-screen 4000 800 put.wh: status-grtext 36 put.size: status-grtext \ ui-grtext 2000 1700 add: perf-screen 2000 800 put.wh: ui-grtext 48 put.size: ui-grtext ; \ "Configuration" screen \ input config : (INPUT.ENABLE.GRFUNC) { flag pt# obj | indx ctrl# p_type chan# bend -- } get.data: obj -> indx \ flag IF indx 3 * -> ctrl# \ ctrl# 1+ get: input-grctrl-holder 3 0 DO i over get.value: [] IF drop i LEAVE THEN LOOP -> p_type \ ctrl# 2 + get: input-grctrl-holder 0 swap get.value: [] -> chan# \ ctrl# 2 + get: input-grctrl-holder 1 swap get.value: [] -> bend \ p_type chan# bend indx SET.INPUT \ -- err ?dup IF parser.error.dialog false 0 obj put.value: [] THEN ELSE indx disable.parser THEN ; : INPUT.ENABLE.GRFUNC ( flag pt# -- ) unsaved.change \ current.object (input.enable.grfunc) \ flag pt# obj -- ; : (INPUT.DEVICE.GRFUNC) { flag pt# obj | indx -- } get.data: obj -> indx \ indx parser.enabled? IF indx at: prev-grctrl-device pt# = \ only execute first time NOT IF pt# indx SET.INPUT.TYPE \ -- err ?dup IF parser.error.dialog \ false pt# put.value: obj indx at: prev-grctrl-device true swap put.value: obj ELSE pt# indx to: prev-grctrl-device THEN THEN ELSE pt# indx to: prev-grctrl-device \ MOD: HeP 09/22/00 THEN ; : INPUT.DEVICE.GRFUNC ( flag pt# -- ) unsaved.change \ current.object (input.device.grfunc) \ flag pt# obj -- ; : (INPUT.CHAN.GRFUNC) { n pt# obj | indx -- } get.data: obj -> indx \ indx parser.enabled? IF pt# IF n indx SET.PARSER.BEND ELSE n indx SET.PARSER.CHAN# \ -- err ?dup IF parser.error.dialog indx get: parser-holder get.channel: [] 0 put.value: obj THEN THEN THEN ; : INPUT.CHAN.GRFUNC ( flag pt# -- ) unsaved.change \ current.object (input.chan.grfunc) \ flag pt# obj -- ; \ output config : (OUTPUT.DEVICE.GRFUNC) ( n pt# -- ) nip CASE \ \ pan: on/off enabled? \ reverb: on/off enabled? \ device: applicable? \ type: type \ 0 OF true use-pan? @ true use-reverb? @ true vl_instr ENDOF 1 OF true use-pan? @ true use-reverb? @ false gm_instr ENDOF 2 OF false false false false false dr_instr ENDOF ENDCASE \ SET.OUTPUT \ type -- \ dup IF io-instr @ get.device.id: [] ELSE 0 THEN 1 put.value: output-chan-grctrl 1 put.enable: output-chan-grctrl \ 1 put.value: output-panrev-grctrl 1 put.enable: output-panrev-grctrl \ 0 put.value: output-panrev-grctrl 0 put.enable: output-panrev-grctrl \ io-instr @ get.channel: [] 0 put.value: output-chan-grctrl ; : OUTPUT.DEVICE.GRFUNC ( n pt# -- ) unsaved.change \ (output.device.grfunc) \ n pt# -- \ draw: output-chan-grctrl draw: output-panrev-grctrl ; : (OUTPUT.CHAN.GRFUNC) ( n pt# -- ) IF io-instr @ put.device.id: [] ELSE io-instr @ put.channel: [] THEN ; : OUTPUT.CHAN.GRFUNC ( n pt# -- ) unsaved.change (output.chan.grfunc) ; : (OUTPUT.PANREV.GRFUNC) ( n pt# -- ) IF IF enable.reverb ELSE disable.reverb THEN ELSE IF enable.pan ELSE disable.pan THEN THEN ; : OUTPUT.PANREV.GRFUNC ( n pt# -- ) unsaved.change (output.panrev.grfunc) ; \ user interface : IO.UI.CHAN#! ( n -- ) io-ui-chan# ! ; : IO.UI.DIALOG ( -- ) " You cannot use the same MIDI controller for the c1 and c2 functions." dialog.a update.screen ; : IO.UI.C1! ( n -- ) dup io-ui-c2 @ = IF drop IO.UI.DIALOG io-ui-c1 @ 1 put.value: ui-chan-grctrl ELSE io-ui-c1 ! THEN ; : IO.UI.C2! ( n -- ) dup io-ui-c1 @ = IF drop IO.UI.DIALOG io-ui-c2 @ 2 put.value: ui-chan-grctrl ELSE io-ui-c2 ! THEN ; : UI.CHAN.GRFUNC ( n pt# -- ) unsaved.change \ CASE 0 OF io.ui.chan#! ENDOF 1 OF io.ui.c1! ENDOF 2 OF io.ui.c2! ENDOF ENDCASE ; : (UI.CTRL.GRFUNC) ( n pt# -- ) nip set.ui.ctrl ; : UI.CTRL.GRFUNC ( n pt# -- ) unsaved.change \ (ui.ctrl.grfunc) ; \ default, etc : DEFAULT.GRFUNC ( n pt# -- ) 2drop " Are you sure you want to reset all values to their default, and loose your current settings?" dialog.a/b update.screen IF io.gr.default unsaved.change THEN ; : PLAY.GRFUNC ( n pt# -- ) 2drop draw: perf-screen ui.qwerty.help ; \ qwerty : CONFIG.QWERTY.HELP ( -- , print qwerty commands ) [ io_turnkey? io_test? NOT AND .IF ] cls cr cr cr cr cr [ .ELSE ] cr cr cr [ .THEN ] \ ." [ return] Performance..." cr ." [ Q ] Quit" cr ; : (CONFIG.QWERTY.VECTOR) ( char -- flag , true if handled ) EOL= dup IF draw: perf-screen ui.qwerty.help THEN ; : CONFIG.QWERTY.VECTOR ( char -- ) (config.qwerty.vector) NOT IF config.qwerty.help THEN ; : CONFIG.QWERTY.FUNC ( char screen -- ) drop config.qwerty.vector ; \ setup "Configuration" screen : CONFIG.DRAW.FUNC ( -- ) 'c config.qwerty.vector key-parser ! ; : INPUT.GRCTRL.INIT { | obj -- , dynamically setup gui controls } [ io_#input 3 * ] literal new: input-grctrl-holder \ io_#input new: prev-grctrl-device \ io_#input 0 DO instantiate ob.check.grid dup IF -> obj i put.data: obj 1 1 new: obj " Enable" 0 put.text: obj i NOT IF " Input:" put.title: obj THEN 450 240 put.wh: obj obj 200 840 i * 600 + add: config-screen 'c input.enable.grfunc put.up.function: obj \ obj add: input-grctrl-holder ELSE " Sorry, an error occurred while trying to create screen controls. Quit and try restarting the program." init.error THEN \ instantiate ob.radio.grid dup IF -> obj i put.data: obj i 1 > IF 1 2 new: obj ELSE 1 3 new: obj " Guitar" 2 put.text: obj THEN stuff{ " Mono" " Poly" }stuff.text: obj 450 240 put.wh: obj obj 750 840 i * 600 + add: config-screen 'c input.device.grfunc put.up.function: obj \ obj add: input-grctrl-holder ELSE " Sorry, an error occurred while trying to create screen controls. Quit and try restarting the program." init.error THEN \ instantiate ob.numeric.grid+ dup IF -> obj i put.data: obj 1 2 new: obj stuff{ " Chan:" " Bend:" }stuff.text: obj 1 0 put.min: obj 16 0 put.max: obj 0 1 put.min: obj 24 1 put.max: obj 270 240 put.wh: obj obj 1600 840 i * 600 + add: config-screen 'c input.chan.grfunc put.up.function: obj \ obj add: input-grctrl-holder ELSE " Sorry, an error occurred while trying to create screen controls. Quit and try restarting the program." init.error THEN LOOP ; : CONFIG.SCREEN.DEFAULT ( -- ) io_instr CASE \ \ pan: on/off enabled? \ reverb: on/off enabled? \ device: applicable? \ type: type \ vl_instr OF true use-pan? @ true use-reverb? @ true vl_instr ENDOF gm_instr OF true use-pan? @ true use-reverb? @ false gm_instr ENDOF dr_instr OF false false false false false dr_instr ENDOF ENDCASE \ true swap put.value: output-device-grctrl \ dup IF io_output_device_id# ELSE 0 THEN 1 put.value: output-chan-grctrl 1 put.enable: output-chan-grctrl \ 1 put.value: output-panrev-grctrl 1 put.enable: output-panrev-grctrl \ 0 put.value: output-panrev-grctrl 0 put.enable: output-panrev-grctrl \ io_output_chan# 0 put.value: output-chan-grctrl \ io_#input 0 DO #parsers_enabled i > 0 i 3 * get: input-grctrl-holder put.value: [] \ i 3 * 2+ get: input-grctrl-holder i input.channel@ 0 2 pick put.value: [] io_input_bend 1 rot put.value: [] \ i input.parser@ dup i to: prev-grctrl-device CASE mono_parser OF true 0 ENDOF poly_parser OF true 1 ENDOF guitar_parser OF true 2 ENDOF ENDCASE i 3 * 1+ get: input-grctrl-holder put.value: [] LOOP \ io_ui_chan# 0 put.value: ui-chan-grctrl io_ui_c1 1 put.value: ui-chan-grctrl io_ui_c2 2 put.value: ui-chan-grctrl io_ui CASE io_ui_control OF true 0 put.value: ui-ctrl-grctrl ENDOF io_ui_preset OF true 1 put.value: ui-ctrl-grctrl ENDOF io_ui_song OF true 2 put.value: ui-ctrl-grctrl ENDOF ENDCASE ; : CONFIG.SCREEN.INIT ( -- ) sub" config.screen.init" \ 4 pdur-prev-minutes ! \ io_#input 3 * 7 + 3 new: config-screen ascii 1 put.key: config-screen " Configuration" put.title: config-screen 'c config.qwerty.func put.key.function: config-screen 'c config.draw.func put.draw.function: config-screen \ config-screen default-screen ! \ INPUT.GRCTRL.INIT \ 1 3 new: output-device-grctrl 1 2 new: output-chan-grctrl 1 2 new: output-panrev-grctrl 1 3 new: ui-ctrl-grctrl 1 3 new: ui-chan-grctrl 1 1 new: default-grctrl 1 1 new: play-grctrl \ output-device-grctrl 2300 600 add: config-screen output-chan-grctrl 3250 600 add: config-screen output-panrev-grctrl 3150 1250 add: config-screen ui-ctrl-grctrl 2300 2040 add: config-screen ui-chan-grctrl 3250 2040 add: config-screen default-grctrl 2300 3050 add: config-screen play-grctrl 3050 3050 add: config-screen \ 540 240 put.wh: output-device-grctrl 280 240 put.wh: output-chan-grctrl 380 240 put.wh: output-panrev-grctrl 540 240 put.wh: ui-ctrl-grctrl 280 240 put.wh: ui-chan-grctrl 680 240 put.wh: default-grctrl 480 240 put.wh: play-grctrl \ " Output:" put.title: output-device-grctrl " User Control:" put.title: ui-ctrl-grctrl \ " VL70m" vl_instr put.text: output-device-grctrl " GenMIDI" gm_instr put.text: output-device-grctrl " Drums" dr_instr put.text: output-device-grctrl stuff{ " Chan:" " Dev:" }stuff.text: output-chan-grctrl stuff{ " Pan" " Verb" }stuff.text: output-panrev-grctrl stuff{ " Control" " Preset" " Song" }stuff.text: ui-ctrl-grctrl stuff{ " Chan:" " c1:" " c2:" }stuff.text: ui-chan-grctrl " Default..." 0 put.text: default-grctrl " Play" 0 put.text: play-grctrl \ 1 0 put.min: output-chan-grctrl 16 0 put.max: output-chan-grctrl 1 1 put.min: output-chan-grctrl 16 1 put.max: output-chan-grctrl 1 0 put.min: ui-chan-grctrl 16 0 put.max: ui-chan-grctrl 1 1 put.min: ui-chan-grctrl 127 1 put.max: ui-chan-grctrl 1 2 put.min: ui-chan-grctrl 127 2 put.max: ui-chan-grctrl \ 'c output.device.grfunc put.up.function: output-device-grctrl 'c output.chan.grfunc put.up.function: output-chan-grctrl 'c output.panrev.grfunc put.up.function: output-panrev-grctrl 'c ui.ctrl.grfunc put.up.function: ui-ctrl-grctrl 'c ui.chan.grfunc put.up.function: ui-chan-grctrl 'c default.grfunc put.up.function: default-grctrl 'c play.grfunc put.up.function: play-grctrl ; \ system control : IO.SCREEN.DEFAULT ( -- ) perf.screen.default config.screen.default ; : IO.SCREEN.PLAY ( -- ) false 0 put.value: start-grctrl true 1 put.value: start-grctrl draw: start-grctrl \ true 0 put.enable: pause-grctrl draw: pause-grctrl false 0 put.enable: reset-grctrl draw: reset-grctrl \ disable.pdur.grctrl ; : IO.SCREEN.STOP ( -- ) true 0 put.value: start-grctrl false 1 put.value: start-grctrl start-grctrl refresh.control \ false 0 put.value: pause-grctrl false 0 put.enable: pause-grctrl true 0 put.enable: reset-grctrl pause-grctrl refresh.control reset-grctrl refresh.control \ enable.pdur.grctrl ; : IO.SCREEN.PAUSE ( -- ) true 0 put.value: pause-grctrl draw: pause-grctrl ; : IO.SCREEN.RESUME ( -- ) false 0 put.value: pause-grctrl draw: pause-grctrl ; \ setup & clearup : IO.SCREEN.INIT ( -- ) test" IO.SCREEN.INIT" \ 'c config.qwerty.vector key-parser ! \ [ io_screen? .IF ] config.screen.init perf.screen.init \ 'c io.title is HMSL.TITLE 260 -> gr_window_height 450 -> gr_window_width \ \ io.screen.default \ removed MOD: 07-03-04 [ .ELSE ] hmsl-graphics OFF [ .THEN ] ; : IO.SCREEN.TERM ( -- ) test" IO.SCREEN.TERM" \ 0 key-parser ! \ [ io_screen? .IF ] freeall: perf-screen freeall: config-screen free: perf-screen free: config-screen \ deinstantiate: input-grctrl-holder free: input-grctrl-holder \ 'c (hmsl.title) is HMSL.TITLE [ .ELSE ] hmsl-graphics ON [ .THEN ] ; if.forgotten io.screen.term io_test? .IF : IO.SCREEN.PRINT ( -- ) >newline ." IO_SCREEN" cr >newline ." Print objects?" y/n cr IF >newline ." Print config-screen?" y/n cr IF print: config-screen THEN >newline ." Print perf-screen?" y/n cr IF print: perf-screen THEN THEN ; .THEN