\ io \ \ io_interp \ interpreter classes and functions for the piece io. \ \ \ see the file io_output for the use of this component. \ \ see the file io_top for more information on io itself. \ \ \ 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 04/17/00 Add the io_interp component. \ MOD: HeP 04/17/00 No need for separate variables for storing scaling since \ we define the necessary value in io_config, which now \ loads before this file. \ Add the io.drum.interp class. \ MOD: HeP 05/25/00 Since io's hp_ components base their coord around 0 (the \ "origin"), add the hp->midi conversion word. \ MOD: HeP 06/06/00 Add IO.PAN.INTERP class. \ MOD: HeP 06/23/00 Bug Fix! ELEMENT.ON: checks iv-interp-instrument is non \ zero before calling the instrument. \ MOD: HeP 10/01/00 Define shared velocity dimension# (constant vel_dim#) in \ file io_glob. \ MOD: HeP 10/10/00 Implement HP->PAN. \ MOD: HeP 10/11/00 Add HP->CENT. \ REV: 0.0.1 alpha __________________________________________________________ \ MOD: HeP 11/10/00 Add FADE.OUT for end of performance. \ MOD: HeP 11/14/00 Implement VEL->HP -- this is used by HP.ALERT to regulate \ output volume (see io_input and io_hp) \ REV: 0.0.1 beta __________________________________________________________ \ MOD: HeP 03-27-04 Experimental mod of FADE.OUT which takes a little longer. \ MOD: HeP 04-09-04 FADE.OUT uses the PUT.VOLUME: method. \ MOD: HeP 05-01-04 Move all includes (and conditional includes) from the \ individual files to load_io. \ MOD: HeP 05-05-04 Optimize some of the midi <-> hp_ conversion words by \ using W/ and W*. \ MOD: HeP 05-06-04 Also inline the conversion words, shaving off a few clocks \ by avoiding a JSR. \ The optimizations have no effect on how fast io runs (at \ least on a MC 68LC040 clocked at 33 MHz), but should help \ stabilize io when it recieves a barrage of MIDI packets. \ MOD: HeP 05-19-04 Experimental "muti-tasking" version of FADE.OUT which \ keeps output activity alive while executing the fade. \ MOD: HeP 05-23-04 The "muti-tasking" version of FADE.OUT necessitates \ alterations to the files io_output, io_ui and io_top. \ REV: 0.0.1 a ++ __________________________________________________________ \ MOD: HeP 11-05-08 Provisional test of the table lookup version of hp->midi \ (see io:modules:io_interp_table for more details). \ MOD: HeP 11-07-08 hp_ conversion words (e.g. HP->MIDI ) now reside in \ io:mobules:io_interp_table. \ MOD: HeP 03-22-09 Add (MODIFY.INTERP) stub called by the meta-alert-matrix. \ See: io_matrix. \ MOD: HeP 03-24-09 Move (MODIFY.INTERP) to modules:io_interp_table. \ REV: 0.0.1 b ++ __________________________________________________________ \ Version for performance at Blackrock Castle Observatory, \ Cork, Ireland, May 25, 2010. \ MOD: HeP 08-18-10 Add primary and secondary interpreters. anew task-io_interp \ graceful exit false .IF \ old version : FADE.OUT ( pulse instr -- ) swap \ 8 choose 1+ * 128 / 1 MAX \ 128 1 DO dup delay 127 i - 2 pick put.volume: [] LOOP \ 2drop ; .THEN \ following is identical to DELAY except it also calls SYS.TASK in its loop : SYS.TASK.DELAY ( ticks -- , delay and also keep hmsl alive ) dup vtime@ rtc.time@ max + vtime! time@ + BEGIN SYS.TASK \ keep morphs tasking \ dup time@ time< UNTIL drop ; : FADE.OUT ( pulse instr -- ) swap \ 8 choose 1+ * 128 / 1 MAX \ 128 1 DO dup SYS.TASK.DELAY 127 i - 2 pick put.volume: [] LOOP \ 2drop ; \ interpreter classes :class OB.IO.NOTE.INTERP.1 CENT.1 \ -- pitch -rot vel_dim# swap ed.at: [] HP->MIDI.1 \ -- vel \ on.time iv-interp-instrument TONE.ON.FOR: [] \ [ io_4gel? .IF ] 2 choose IF iv-interp-instrument PORTAMENTO.OFF: [] ELSE iv-interp-instrument PORTAMENTO.ON: [] 128 choose choose iv-interp-instrument PUT.PORTAMENTO: [] THEN [ .THEN ] ELSE 2drop THEN ;m ;class :class OB.IO.NOTE.INTERP.2 CENT.2 \ -- pitch -rot vel_dim# swap ed.at: [] HP->MIDI.2 \ -- vel \ on.time iv-interp-instrument TONE.ON.FOR: [] ELSE 2drop THEN ;m ;class :class OB.IO.CTRL.INTERP.1 MIDI.1 i at: iv-interp-ctrl# iv-interp-instrument CONTROL: [] LOOP THEN ;m ;class :class OB.IO.CTRL.INTERP.2 MIDI.2 i at: iv-interp-ctrl# iv-interp-instrument CONTROL: [] LOOP THEN ;m ;class :class OB.IO.PAN.INTERP PAN iv-interp-instrument PAN: [] ELSE 2drop THEN ;m ;class \ drumkit interpreters : SNARE.INTERP { elm# sh instr -- } elm# 0 ed.at: sh 0< IF elm# 1 ed.at: sh elm# vel_dim# ed.at: sh HP->MIDI.1 snare: instr THEN ; : KICK.INTERP { elm# sh instr -- } elm# 0 ed.at: sh 0< IF elm# 1 ed.at: sh elm# vel_dim# ed.at: sh HP->MIDI.1 kick: instr THEN ; : HIHAT.INTERP { elm# sh instr -- } elm# 0 ed.at: sh 0< IF elm# 1 ed.at: sh elm# vel_dim# ed.at: sh HP->MIDI.1 hihat: instr THEN ; : CYMBAL.INTERP { elm# sh instr -- } elm# 0 ed.at: sh 0< IF elm# 1 ed.at: sh elm# vel_dim# ed.at: sh HP->MIDI.1 cymbal: instr THEN ; : TOM.INTERP { elm# sh instr -- } elm# 0 ed.at: sh 0< IF elm# 1 ed.at: sh elm# vel_dim# ed.at: sh HP->MIDI.1 tom: instr THEN ;