' ************************************************ ' * < TECHNOFAUSTUS > * ' * a chamber opera * ' * by * ' * Godfried-Willem Raes * ' * 1999 - 2016 * ' ************************************************ ' M&M robot port assigments must be in inifile (machinename_gmt.ini) ' Network data must also be in inifile ' CQT-setting and ii-settings in faust.ini ' requires NiDAQ and g_nih.dll ' 20.11.1999 start work on Act 1 - development versions saved as faust0..., faust1... in ' subdirectory /faust/... ' 02.10.2000 attempts to port it to NT... ' 04.02.2001 further worksession started... ' 20.02.2001 Faust text integrated. ' 04.08.2001 start rescoring for automats. ' 20.05.2002 Recoded for robot orchestra ' This piece needs the MidiMan 8x8 midi interface. ' The first selected midi port should be connected to: ' ThunderWood ' Belly ' Vibi ' Rotomoton ' Troms ' Klung ' Springers ' The second selected midi port to: ' Bourdonola ' Piperola ' The third selected midi port to: ' Vox Humanola ' AutoSax ' The fourth selected midi port to: ' Player Piano ' Harma ' 22.05.2002 rehearsal session ' 23.05.2002 rehearsals and code refinement. ' 27.05.2002 premiere try out act 1 ' 01.06.2002 springers added. Some silly bugs removed. ' 15.06.2002 ini-file port assignments added. ' 22.06.2002 Now this code module should contain only global procedures ' used througout the composition ' added. ' 17.07.2002: rehearsal session ' 22-24.07.2002: performances of Tekne. ' 15.20.2002: driptest code added for lithos ' 16.10.2002: performance of Lithos with Emilie De Vlam ' 06.11.2002: Paradiso performance at Lille, France ' 17.11.2002: all M&M mapping read from ini file. ' 18.11.2002: Eary Lis Trimbl expanded with ii-inputs ' Prologos module created. ' 25.11.2002: Net support added & temporary prologos added. ' 27.11.2002: Prologos debugged. ' 30.11.2002: Killing van taskparameterwindows in taskswitches toegevoegd. ' 01.12.2002: previous now handled in the dll g_lib.dll ' General code cleanup performed. ' 08.12.2002: Init for belly listentaskswitching via midi adapted ModeMess k, &H44, 1 and ModeMess k, 4, 20 ' Belly and Harma should also work via UDP/IP now, if we set the high nibble in the channel to ' the number of the PC in the ini file. ' This however will only work if we run Technofaustus under XP or Win2000. ' 15.12.2002: cleanup and debug session ' 16.04.2003: adapted to new functionality of DAQ. ' 06.05.2003: added to orchestra ' 29.05.2003: motor code added for piperola and humanola ' 05.06.2003: Text2har function moved to g_mus.dll ' 10.06.2003: added (scene for homunculus and ADXL202 devices) ' 16.06.2003: further work on Flexes ' 20.06.2003: now crashes under XP and 2000 after startup...: bug found: acts() was wrongly dimensioned! ' 21.07.2003: finalized. ' 24.07.2003: Tubi added in ending of Tekne ' 18.09.2003: Button added for changes between Sonar and Radar interfaces. ' 20.09.2003: Radar code common with quadrada moved to g_main.inc ' 21.09.2003: Technofaustus should now work O.K. with either sonar or radar invisible instrument. ' 23.09.2003: Gnos, Wander and Tango split off. ' 24.09.2003: Wandering Quadrada Space added to Technofaustus compilation. ' 26.09.2003: Rehearsal with Emilie ' 27.09.2003: Rehearsal with Moniek and Emilie. ' 08.10.2003: CQT code modified and placed in dll. ' 14.12.2003: Puff declares added ' 13.01.2004: Trump declares added ' 13.02.2004: start coding for descent ' 11.03.2004: check and document setup for quadrada ' 21.05.2004: Hexmotors proc. moved to g_interfaces.inc ' 12.07.2004: robotorchestra new members: trump and Hurdy. Start implementing them. ' 13.07.2004: ake added to orchestra. ' 14.07.2004: start adding 'Aux Arbres' ' 17.10.2004: Aux Arbres integrated. ' 19.10.2004: first try out ' 05.11.2004: new code module introduced: g_mm.inc: M&M ctrl. ' 20.11.2004: robot panic button window added. ' 15.12.2004: Moniek Darge embargo tegen Emilie De Vlam: Technofaustus halted... ' 08.01.2005: Bourdonola upgrade. ' 16.01.2005: solo gwr doorloop van alle kode in repetitie. ' motor button switch code removed. ' 14.01.2005: old dripper code replaced with new implementation on note 15. ' 16.07.2005: TransiTrance section added. ' 15.08.2005: support for Picradar devices added. ' Faust.ini file changed. ' Picradar's are used in 'Trance' ' 28.08.2005: CQT listentask moved to dll g_lib.dll / g_main.dll ' 29.08.2005: debug op changing midi-in listentasks. ' 30.08.2005: further debug by kl ' 06.05.2006: Lithos and Paradiso played for some japanese guests. ' 06.06.2006: Gnos further developped. ' 15.06.2006: first try out ' 15.09.2006: All modules adapted to new belly hardware. ' 21.01.2007: checked for consistency with new harmlibs. ' 04.02.2007: to be checked against changes in Hurdy. ' 15.04.2007: bugs and crashes... Paradiso repaired. Gnos and Trance to be done... ' 14.05.2007: Tekne revised with addition of Casta, Qt and Xy. ' 29.03.2009: Gnos rechecked. ' 18-24.05.2009: coding of tango a tre ' 03.06.2009: Lib constant $g_h_dll added ' 07.06.2009: Now should work with NiDAQmx or with NiDAQ 7.4, but requiring recompilation. '#IF NOT %DEF($g_h_dll) ' #IF %DEF(%NiDAQ) ' $g_h_dll = "g_nih.dll" ' #ELSEIF %DEF(%g_NiDAQmx) ' $g_h_dll = "g_nxh.dll" ' #ELSE ' $g_h_dll = "g_noh.dll" ' #ENDIF '#ENDIF ' not required, because if needed, we have access to $dll, set in g_h.bi and included in the metafile ' 09.06.2009: to be changed here: selection radar/sonar should take place on startup. Not on the fly. ' 11.06.2009: Three toggle buttons provided to this end. ' 08.07.2009: Doppler-Sonar under NiDaqmx and ii_2000 working fine. ' 11.07.2009: why do we have unpredictable start-up problems on \\Xi ??? ' 19.04.2012: Lithos rechecked and performed. ' 31.05.2014: Tekne rechecked. Not working in doppler mode. Needs upgrade. Sonar mode does work. ' 01.06.2014: mDisplay support added. ' 06.06.2014: now we include gesture.inc for full access to gesture recognition engine. ' tested o.k. ' Tekne and Dance now work in doppler mode. ' 07.06.2014: Further implementations of the gesture recognition engine. ' deleting legacy code using synths and samplers. ' 11.02.2015: Eary Lis seems to crash. Needs software revision. ' 14.10.2016: Lithos rechecked for performance with Emilie. ' 15.10.2016: Interactive procs. added to Lithos. ' All Faust code has to be adapted to use the Doppler engine. #INCLUDE "C:\B\pb\gmt\namuda\gesture.inc" ' new 06.06.2014 - this way the gesture recognition engine becomes available. ' requires Doppler mode ii2010. DECLARE FUNCTION Init_Faust () AS DWORD DECLARE FUNCTION Faust_Act_Selector () AS DWORD DECLARE CALLBACK FUNCTION ActsDlgCallback () AS LONG DECLARE SUB ButnSW_FaustStartStop () DECLARE SUB ButnSW_Acts () DECLARE SUB FaustPatches (act AS STRING) 'DECLARE SUB dummytask DECLARE SUB Drip_Test () ' code in Lithos.inc 'DECLARE SUB ButnSW_Sonar () ' allows selection of hardware 'DECLARE SUB ButnSW_Radar () ' quadrada system DECLARE SUB F_ButnSW_Doppler () ' this will become the best option. DECLARE SUB Flex_ADXL_CB () ' button callback FUNCTION Init_Faust () AS DWORD LOCAL i, retval, p AS DWORD LOCAL m AS ASCIIZ * 30 LOCAL CockpitLayo AS CockpitLabels LOCAL n AS LONG LOCAL cptr AS DWORD ' IF ISFALSE DAQparams.id THEN ' MSGBOX "You must select a DAQ device for this composition",, FUNCNAME$ ' END IF DAQparams.mode = %DAQ_NI ReadCockpitLabelsFromFile $TECHNOFAUSTUS, CockpitLayo ' App.komposduur = 900 App.tempo = 20 App.tstart = %False App.MTstart = %False 'Adapt buttons to this application: ' SWITCHES: (these can toggle) ' ButnSW(0).tag = "Thru" ' Win32Api-Call - Midi- Thru toggle switch ButnSW(1).tag0 = "Start" ' start/stop toggle ButnSW(1).tag1 = "Stop" ButnSW(1).cptr = CODEPTR(ButnSW_FaustStartStop) ' start / stop the running act ButnSW(2).tag0 = "Acts" ButnSW(2).tag1 = "Acts off" ButnSW(2).cptr = CODEPTR(ButnSW_Acts) ' change cockpit and start another act ButnSW(3).tag0 = "" ' "USER" creates/kills a user feedback window ' ButnSW(4).tag0 = "HARM" ' creates/kills a harmony display window ' ButnSW(5).tag0 = "" ' display the notes for musicians ' used for ADXL202 device in Flexes ButnSW(6).tag0 = "ADXL202" ButnSW(6).tag1 = "ADXL OFF" ButnSW(6).cptr = CODEPTR(Flex_ADXL_CB) 'codeptr(ADXL202_Button ' ButnSW(7).tag1 = "Sonar 0" ' on start-up nothing is selected, so the button should display sonar1 ' ButnSW(7).tag0 = "Sonar 1" ' ButnSW(7).cptr = CODEPTR(ButnSW_Sonar) ' new 18.09.2003 , modified 11.06.2009 ' ' ButnSW(8).tag1 = "Radar 0" ' ButnSW(8).tag0 = "Radar 1" ' ButnSW(8).cptr = CODEPTR(ButnSW_Radar) ' ButnSW(9).tag1 = "Doppl 0" ' implemented for Tekne 01.06.2014 ' ButnSW(9).tag0 = "Doppl 1" ' ButnSW(9).cptr = CODEPTR(F_ButnSW_Doppler) 'still experimental, tested o.k. on \\No ' we cannot use the coding in gesture.inc because we need the sonar-radar variable to be set. ButnSW(10).tag1 = "Doppl 0" '10 was overwriting audio button ButnSW(10).tag0 = "Doppl 1" ButnSW(10).cptr = CODEPTR(ButnSW_Doppler) ' included in gesture.inc sonar_radar = 2 ButnSW(11).tag0 = "" ' ONE SHOT FUNCTIONS: [ these are common to all acts of Technofaustus ] ButnOS(0).tag = "AllOf" ' all notes off ButnOS(0).cptr = CODEPTR(MM_AllOff) ' in g_mm.inc ' ' section for SONAR invisible instrument: [ remmed 16.10.2016 ] ' 'p = GetSonarPointer ' cptr = GetProcAddress(gh.gnh, "GETSONARPOINTER") ' CALL DWORD cptr USING GetSonarPointer TO p ' sr = p ' sr is a global declared in Technofaustus.bi ' @sr.dta = 4 ' timeframe for integration of surfaces ' Sonar_Radar = -1 ' no dev. selected on startup ' ' initialisation of tasks: ' Task(%Sonar_VU_Task).naam = "" ' Task(%Sonar_VU_Task).cPtr = GetProcAddress(gh.gnh,"SONAR_II_VU") ' Task(%Sonar_VU_Task).freq = 8 ' Task(%Sonar_VU_Task).flags = %PERTIM_TASK OR %DLL_TASK ' Task(%Sonar_Display_Task).naam = "Sonar" ' Task(%Sonar_Display_Task).cPtr = GetProcAddress(gh.gnh,"SONAR_DISPLAY") ' Task(%Sonar_Display_task).freq = 16 ' Task(%Sonar_Display_Task).flags = %PERTIM_TASK OR %DLL_TASK ' Create_Sonar_Control_Task BYVAL sr, Slider(),UDctrl() ' task 10 (pseudotask) 20.09.2003 ' Task(%Sonar_Control_Task).naam = "S-Ctrl" ' REMMED 16.10.2016 ' ' section for RADAR invisible instrument: (not active on startup!) ' DIM pr(4) AS GLOBAL RadarType PTR ' declared global in Technofaustus.bi ' FOR i = 0 TO 4 ' 'p = GetRadarPointer (i) ' in g_n*h.dll ' cptr = GetPRocAddress(gh.gnh, "GETRADARPOINTER") ' CALL DWORD cptr USING GetRadarPointer(i) TO p ' pr(i) = p ' ' set noise level: (can be changed with the R-Ctrl panel) ' @pr(i).noise = 3 ' '@pr(i).dt = 32 ' integration window, in number of samples. (determines responsiveness) ' ' with the zerocross procedure, it sets the number of below noise samples before a global zero input is ' ' returned: ' @pr(i).dt = 4 ' @pr(i).sfakt = 2 ' divisor for surface value in dll. ' @pr(i).dta = 15 ' integration time for slow amplitudes used for position determination with %Zerocross algo ' ' set params for data acquisition & math: ' ' @pr(i).params can be: %SIGNCHANGE, %DFT, %ZeroCross, %DFT ,%IsolWave, %ISOLPERIOD ' @pr(i).params = %ZEROCROSS ' new version 28.03.2003 ' @pr(i).setup = %SQUARE ' NEXT i ' ' ' new 20.09.2003: create a GUI user controll window for all relevant radar params: ' Create_Radar_Control_Task BYVAL pr(0), Slider(),UDCtrl() ' in g_main.inc !!! (g_lib.dll) ' Task(%Radar_Control_Task).naam = "R-Ctrl" ' ShowWindow Task(%Radar_Control_Task).hParam, %SW_HIDE ' ' Task(%Radar_VU_Task).naam = "" ' 1 ' Task(%Radar_VU_Task).cPtr = GetProcAddress(gh.gnh,"RADAR_II_VU") ' in g_n*h.dll ' Task(%Radar_VU_Task).freq = 16 ' Task(%Radar_VU_Task).flags = %DLL_TASK OR %PERTIM_TASK ' Task(%Radar_VU_Task).patch = 4 '%False ' used to display different param displays. ' Task(%Radar_Display_Task).naam = "Radar" ' 2 ' Task(%Radar_Display_Task).cPtr = GetProcAddress(gh.gnh,"RADAR_DISPLAY") ' in g_n*h.dll ' Task(%Radar_Display_Task).freq = 16 ' Task(%Radar_Display_Task).flags = %DLL_TASK OR %PERTIM_TASK ' Task(%Radar_Display_Task).patch = %False ' used to switch between place and wave display ' 16.10.2016: try remming all this, as it's included and done in gesture.inc ' new 07.07.2009: NiDAQmx ii_2000 in doppler mode: ' get the pointer to the doppler structure in g_nxh.dll cptr = GetProcAddress(gh.gnh, "GETDOPPLERPOINTER") CALL DWORD cptr USING GetDopplerPointer TO p ' if returns p = 0, then it crashes... pDoppler = p Create_Doppler_Control_Task BYVAL pDoppler, Slider(), UDctrl() ' in g_main.inc, g_lib.dll Task(%DopplerTetraControl).naam = "D-Ctrl" ShowWindow Task(%DopplerTetraControl).hParam, %SW_HIDE Task(%DopplerTetraDisplay).naam = "Doppler" ' 6 Task(%DopplerTetraDisplay).cPtr = GetProcAddress(gh.gnh,"DOPPLER_TETRAHEDRON_DISPLAY") ' in g_n*h.dll Task(%DopplerTetraDisplay).freq = 16 '24 Task(%DopplerTetraDisplay).flags = %DLL_TASK OR %PERTIM_TASK Task(%DopplerTetraDisplay).patch = %False '--------------------------------------------------- ' including gesture recognition engine: Task(%Gesture_Analyser).naam = "FuzzyAna" ' included in gesture.inc Task(%Gesture_Analyser).cptr = CODEPTR(Gesture_Analyser) Task(%Gesture_Analyser).freq = 256 'must be this!!! Task(%Gesture_Analyser).flags = %PERTIM_Task 'must be periodic. Task(%Doppler_FFT).naam = "FFT" ' included in gesture.inc Task(%Doppler_FFT).cptr = CODEPTR(Doppler_Transforms) 'Task(%Doppler_FFT).freq = 256 '128 is the minimum for 50% FFT overlap, 256 gives 25% overlap (with mod 4 in the task code) Task(%Doppler_FFT).freq = 480 '240 '240 for 12.8% overlap with mod 3 in the task code. '480 gives us a 6.4% overlap Task(%Doppler_FFT).flags = %PERTIM_Task 'must be periodic. '---------------------------- end try remming '--------------------------------------------------- Task(%Drip_Test).naam = "DripTest" ' for setup lithos Task(%Drip_Test).freq = 0.3333 Task(%Drip_Test).tempo = 20 Task(%Drip_Test).cptr = CODEPTR(Drip_Test) Task(%Drip_Test).flags = %False ' initialize the pitch 2 midi device to be used (for ,, , ): ' first remove default listentask: ' RemoveCockpitTask %Listen_Task CQT.naam = "cqt" ' CQT.hightes = 93 ' we read this from the ini file as well ' CQT.lowtes = 32 CQT.listentasknr = %Listen_Task' new 28.08.2005 SetPitch2MidiPorts CQT, $technofaustus, hMidiO(),hMidiI() ' 08.10.2003: create a control task for the CQT: IF Create_CQT_Control_Task (BYVAL VARPTR(cqt), Slider(), UDctrl()) THEN ' task 5 (pseudotask) ' above call must always precede the creation of the listentask, since it needs the pointer to CQT. Task(CQT.listentasknr).naam = "CQT-ear" ' 16 Task(CQT.listentasknr).freq = 100 Task(CQT.listentasknr).cptr = GetProcAddress(gh.InstDll,"CQT_LISTEN") ' in g_lib.dll IF ISFALSE Task(CQT.listentasknr).cptr THEN MSGBOX "No codeptr for midi listen",, FUNCNAME$ Task(CQT.listentasknr).flags = %HARM_TASK OR %DLL_TASK OR %PERTIM_TASK END IF FaustPatches "init" ' just to initialize the types. ' adding support for our display panel (01.06.2014)------ GetInstrumentParams mDisp_A, %IDM_4D_MidiDisplay_A retval = SetRobotPort (mDisp_A, Inifilename ,hMidiO()) ' note: Inifilename is a function in g_indep.dll GetInstrumentParams mDisp_B, %IDM_4D_MidiDisplay_B retval = SetRobotPort (mDisp_B, Inifilename ,hMidiO()) ' mDisp_A as musician is made global in gmt_glob.bi Controller mDisp_A.channel, 66, 127 ProgChange mDisp_A.channel, 0 mPlay mDisp_A.channel, 1, 16 ' blank digit mPlay mDisp_A.channel, 2, 16 mPlay mDisp_A.channel, 3, 16 mPlay mDisp_A.channel, 4, 16 Controller mDisp_B.channel, 66, 127 ProgChange mDisp_B.channel, 0 mPlay mDisp_B.channel, 1, 16 ' blank digit mPlay mDisp_B.channel, 2, 16 mPlay mDisp_B.channel, 3, 16 mPlay mDisp_B.channel, 4, 16 ' end initialisation of display-------------------------- m = "" SendMessage gh.Cockpit, %WM_SETTEXT,0, VARPTR(m) SetDlgItemText gh.Cockpit, %GMT_MSG1, "Needs invisible instruments" SetDlgItemText gh.Cockpit, %GMT_MSG2, "the CQT device and Logos robots " FUNCTION = %True END FUNCTION 'SUB dummytask 'END SUB SUB ButnSW_FaustStartStop () LOCAL ButtonNr AS LONG LOCAL i AS DWORD LOCAL cptr AS DWORD ButtonNr = App.butnSWparam - %GMT_BUTNSW_ID IF ButnSW(Buttonnr).flag THEN SetDlgItemText gh.Cockpit, %GMT_BUTNSW_ID + ButtonNr, "STOP" IF hMidiI(0) THEN ClearMiBuf 0 ' start with a blank midi input buffer BlockSysExReception hMidiI(0) 'SxThread ' dll proc END IF CALL Lithos_HiddenHarm ' initialisation for Lithos. App.MTstart = %True SELECT CASE App.Id CASE %ID_GNOS ' Promil %True ' only if the file data are correct for the input file Runtime %True StartTask %Goethe StartTask %Gnos_Gesture CASE ELSE ' to be done END SELECT ELSE App.MTstart = %False SetDlgItemText gh.Cockpit, %GMT_BUTNSW_ID + ButtonNr, "CONT" FOR i = 16 TO 63 IF Task(i).swit THEN stoptask i NEXT i END IF App.butnSWparam = %False END SUB SUB ButnSW_Acts () LOCAL ButtonNr AS LONG LOCAL i AS DWORD LOCAL j AS DWORD ButtonNr = App.butnSWparam - %GMT_BUTNSW_ID Runtime %False Promil %False FOR j = 16 TO 63 IF Task(j).swit THEN StopTask j NEXT j App.MTstart = %False App.tstart = %False IF gh.melpat THEN DestroyWindow gh.melpat ' destroy score window from paradiso ' reset the start stop button codepointer in case the act did overwrite it. ButnSW(1).tag0 = "Start" ' start/stop toggle ButnSW(1).tag1 = "Stop" ButnSW(1).cptr = CODEPTR(ButnSW_FaustStartStop) ' start / stop the running act i = Faust_Act_Selector '1.- Prologos" ' proloog: geslachtsmetamorfoze van Faustus '2.- Lithos" ' labo van faust - homunculus komt tot leven '3.- Eary Lis Trimbl" ' homunkulus opstand '4.- Paradiso" ' walpurgisnacht '5.- Tekne" ' mefistodans '6.- Flexes ' homunculus and flex with ADXL202's on boxing gloves '7.- Wander ' Wandering Quadrada Space '8.- Gnos ' Goethe text '9.- Tango ' Tango a tre '10.- Descent '11.- Aux Arbres '12.- Trance ' TransiTrance for Leuven, 2.10.2005 '0.- STOP" SELECT CASE i CASE 1 App.id = %ID_PROLOGOS CALL Init_Prologos ChangeCockpitTasks 16 CASE 2 App.id = %ID_LITHOS CALL Init_Lithos ChangeCockpitTasks 16 CASE 3 App.id = %ID_EARY CALL Init_Eary ChangeCockpitTasks 16 CASE 4 App.id = %ID_PARADISO CALL Init_Paradiso ChangeCockpitTasks 16 CASE 5 App.id = %ID_TEKNE ' updated 01.06.2014 CALL Init_Tekne ChangeCockpitTasks 16 IF ISFALSE Task(%Gesture_Analyser).tog THEN starttask %Gesture_Analyser CASE 6 App.id = %ID_FLEXES CALL Init_Flexes ChangeCockpittasks 16 CASE 7 App.id = %ID_WANDER ' added 24.09.2003 CALL Faust_Init_Wander ChangeCockpitTasks 16 CASE 8 App.id = %ID_GNOS ' working 06.06.2006 CALL Faust_Init_Gnos ChangeCockpitTasks 16 CASE 9 ' start working code 23.05.2009 App.id = %ID_FaustTango CALL Faust_INit_Tango ChangeCockpitTasks 16 IF ISFALSE Task(%Gesture_Analyser).tog THEN starttask %Gesture_Analyser CASE 10 App.id = %ID_FAUST_DESCENT ' added 13.02.2004 CALL Faust_Init_Descent () ChangeCockpitTasks 16 CASE 11 App.id = %ID_FAUST_AUXARBRES ' Mefisto aria CALL Faust_Init_AuxArbres () ChangeCockpitTasks 16 CASE 12 App.id = %ID_FAUST_TRANCE ' added 16.07.2005 CALL Faust_Init_Trance () Changecockpittasks 16 CASE 0 ' reset cockpit to blank App.id = %ID_TECHNOFAUSTUS FOR j = 16 TO 48 RemoveCockpitTask j NEXT j ChangeCockpitTasks 16 CASE ELSE ' niks END SELECT SetDlgItemText gh.Cockpit, %GMT_BUTNSW_ID + ButtonNr, "Acts" App.butnSWparam = %False END SUB 'SUB ButnSW_Sonar () ' ' note that this switch implies a change of hardware! ' ' restructured 08.06.2009 ' LOCAL ButtonNr AS LONG ' LOCAL cptr AS DWORD ' ButtonNr = App.butnSWparam - %GMT_BUTNSW_ID ' IF ISFALSE ButnSW(Buttonnr).flag THEN ' ' sonar daq uit: ' IF ISFALSE DAQparams.daqstopped THEN ' cptr = GetPRocAddress(gh.gnh, "SONAR_DAQ") ' CALL DWORD cptr USING Sonar_DAQ(%false) ' END IF ' ShowWindow Task(%Sonar_Control_Task).hParam, %SW_HIDE ' IF Task(%Sonar_VU_Task).swit THEN stoptask %Sonar_VU_Task ' sonar_Radar = -1 ' ELSE ' ' select sonar interface and switch DAQ ON ' IF Sonar_Radar =1 THEN ' IF ISFALSE DAQparams.daqstopped THEN ' cptr = GetPRocAddress(gh.gnh, "RADAR_DAQ") ' CALL DWORD cptr USING Radar_DAQ(%false) ' uitschakelen van de Radar DAQ task ' END IF ' END IF ' ShowWindow Task(%Radar_Control_Task).hParam, %SW_HIDE ' IF Task(%Radar_VU_Task).swit THEN StopTask %Radar_VU_Task ' ' ' en nu de sonar aanzetten: ' cptr = GetPRocAddress(gh.gnh, "SONAR_DAQ") ' CALL DWORD cptr USING Sonar_DAQ(%DAQ_DOUBLEBUFFER) ' ShowWindow Task(%Sonar_Control_Task).hParam, %SW_SHOW ' ' 'DAQparams.samplingrate(0) = 64 - done in the library, it cannot be changed here. ' SetDlgItemText gh.Cockpit, %GMT_TEXT_SR, STR$(DAQparams.samplingrate(0),3)' + "S/s" ' IF ISFALSE Task(%Sonar_VU_Task).swit THEN Starttask %Sonar_VU_Task ' Sonar_Radar = %False ' selects sonar ' END IF ' App.butnSWparam = %False 'END SUB ' 'SUB ButnSW_Radar () ' LOCAL ButtonNr AS LONG ' LOCAL cptr AS DWORD ' ButtonNr = App.butnSWparam - %GMT_BUTNSW_ID ' IF ISFALSE ButnSW(Buttonnr).flag THEN ' warning "Radar switch flag %False" ' ' switch RADAR DAQ OFF ' IF ISFALSE DAQparams.daqstopped THEN ' cptr = GetPRocAddress(gh.gnh, "RADAR_DAQ") ' CALL DWORD cptr USING Radar_DAQ(%false) ' uitschakelen van de Radar DAQ task ' END IF ' ShowWindow Task(%Radar_Control_Task).hParam, %SW_HIDE ' IF Task(%Radar_VU_Task).swit THEN StopTask %Radar_VU_Task ' Sonar_Radar = -1 ' ELSE ' warning "Radar switch flag %True" ' ' switch RADAR DAQ ON ' Sonar_Radar = %True ' 'Daqparams.channel = %DAQ_RADAR ' set in the dll library... ' 'DAQparams.samplingrate(0) = 128 '' Radar_DAQ %DAQ_DOUBLEBUFFER ' cptr = GetProcAddress(gh.gnh, "RADAR_DAQ") ' CALL DWORD cptr USING Radar_DAQ(%DAQ_DOUBLEBUFFER) ' SetDlgItemText gh.Cockpit, %GMT_TEXT_SR, STR$(DAQparams.samplingrate(0),3) '+ "S/s" ' ShowWindow Task(%Radar_Control_Task).hParam, %SW_SHOW ' IF ISFALSE Task(%Radar_VU_Task).swit THEN Starttask %Radar_VU_Task ' END IF ' App.butnSWparam = %False 'END SUB 'SUB F_ButnSW_Doppler () ' ' not yet fully implemented in the interactive code of the acts!!! (31.05.2014) ' ' should be the same data acquisition as in Namuda code. ' ' uses ii_2000 hardware and NiDAQmx. Sampling only data channels 8,9,10 at 1024S/s ' ' 06.06.2014: now we include gesture.inc to have full access to the gesture recognition engine. ' ' if doppler is started, we automatically start the gesture recognition engine: ' LOCAL ButtonNr AS LONG ' LOCAL cptr AS DWORD ' ButtonNr = App.butnSWparam - %GMT_BUTNSW_ID ' IF ISFALSE ButnSW(Buttonnr).flag THEN ' 'warning "Doppler switch flag %False" ' '' this should switch off the DAQ function ' 'IF ISFALSE DAQparams.daqstopped THEN ' ' cptr = GetProcAddress(gh.gnh, "DOPPLER_DAQ") ' ' CALL DWORD cptr USING Doppler_DAQ(%False) ' 'END IF ' 'Showwindow Task(%DopplerTetraControl).hParam, %SW_HIDE ' 'IF Task(%DopplerTetraDisplay).swit THEN stoptask %DopplerTetraDisplay ' ' 06.06.2014: In fact, do we have a reason to stop this ever? ' Stop_Doppler_DAQ ' in gesture.inc ' IF Task(%Gesture_Analyser).tog THEN stoptask %Gesture_Analyser ' Sonar_Radar = -1 ' ELSE ' ' warning "Doppler switch flag %True" ' ' ' this should switch on the DAQ function ' ' cptr = GetProcAddress(gh.gnh, "DOPPLER_DAQ") ' ' CALL DWORD cptr USING Doppler_DAQ(%DAQ_DOUBLEBUFFER) ' ' SetDlgItemText gh.Cockpit, %GMT_TEXT_SR, STR$(DAQparams.samplingrate(8),4) '+ "S/s" ' Start_Doppler_DAQ ' Sonar_Radar = 2 ' ' ShowWindow Task(%DopplerTetraControl).hParam, %SW_SHOW ' ' IF ISFALSE Task(%DopplerTetraDisplay).swit THEN Starttask %DopplerTetraDisplay ' IF ISFALSE Task(%Gesture_Analyser).tog THEN starttask %Gesture_Analyser 'may also go in the thread... ' END IF ' App.butnSWparam = %False 'END SUB SUB FaustPatches (act AS STRING) ' if no midi devices are selected, the patches will default to our robot orchestra with the midi port ' mapping as written in the ini-file. ' thus all our M&M robot orchestra pieces can become hardware compatible. LOCAL retval AS LONG 'DWORD ' valid for all acts: retval = Init_MM () ' in module g_mm.inc MM_PanicButtonWindow ' send the general controllers for Belly: - te herzien!!! ModeMess Belly.channel, &H44, %True ' set to intelligent listen task (pitch mapping) ModeMess Belly.channel, 4, 20 ' default instelling. IF TRIM$(act) = "init" THEN EXIT SUB IF TRIM$(LCASE$(act)) = "lithos" THEN ' niks te doen , we gebruiken de musician-types rechtstreeks. ' synth versions no longer allowable. ELSEIF TRIM$(LCASE$(act)) = "prologos" THEN Task(%prolog).channel = Piano.channel Task(%prolog).level = 127 Task(%Faust_Tango).channel = Harma.channel ' for test only Task(%Faust_Tango).patch = 15 ' extra: - for tests only 'Task(%Goethe).patch = 127 ' must be sine wave! Task(%Goethe).channel = ThunderWood.Channel ' should go to thunderwood... 'Task(%Goethe).pan = 64 Task(%Goethe).level = 120 ELSEIF TRIM$(LCASE$(act)) = "earylistrimbl" THEN Task(%Eary_piano).channel = Piano.channel Task(%Eary_Klung).channel = Klung.channel Task(%Eary_Troms).channel = Troms.channel Task(%Eary_Piperola).channel = Piperola.channel Task(%Eary_Humanola).channel = Humanola.channel Task(%Eary_Harma).channel = Harma.channel Task(%Eary_Castagnets).channel = Humanola.channel ' castagnets Task(%Eary_Thunderwood).channel = thunderwood.channel ' ThunderWood, port 0 Task(%Eary_Rotomoton).channel = rotomoton.channel ' for Rotomoton, port 0 Task(%Eary_Springers).channel = springers.channel ' springers, port 2 Task(%Eary_Vibi).channel = Vibi.channel Task(%Eary_Bourdonola).channel = Bourdonola.channel ' port 3 'Task(%cqt+15).channel = dripper.channel ' for later, when we use dripper via midi. ELSEIF TRIM$(LCASE$(act)) = "paradiso" THEN Task(%tvp3).channel = Harma.channel Task(%tvp4).channel = Klung.Channel Task(%tvp5).channel = Vibi.channel ' motor control task. Task(%tvp6).channel = Piperola.channel Task(%tvp7).channel = Piano.channel ELSEIF TRIM$(LCASE$(act)) = "tekne" THEN ' niks te doen , we gebruiken de musician-types rechtstreeks. ELSEIF TRIM$(LCASE$(act)) = "flexes" THEN ' idem ELSEIF TRIM$(LCASE$(act)) = "wandern" THEN ' idem ELSEIF TRIM$(LCASE$(act)) = "descent" THEN ' idem ELSEIF TRIM$(LCASE$(act)) = "auxarbres" THEN ' idem ELSEIF TRIM$(LCASE$(act)) = "trance" THEN ' idem ELSEIF TRIM$(LCASE$(act)) = "gnos" THEN Task(%Goethe).channel = Piano.channel ELSEIF TRIM$(LCASE$(act)) = "tango" THEN ' niks ELSE MSGBOX "No patching implemented yet for " & act,,"" END IF END SUB FUNCTION Faust_Act_Selector () AS DWORD ' 22.06.2002 , expanded 28.09.2003, 14.10.2004, 10.08.2005, 2009, 2014, 2016 ' creates a listbox such that we can switch between different sections of technofaustus LOCAL Acts() AS STRING LOCAL hDlg AS LONG DIM Acts(12) AS LOCAL STRING LOCAL cnt AS LONG ' cannot be register variable!!! Acts(0) = "01.- Prologos" ' geslachtsmetamorfoze van Faust Acts(1) = "02.- Lithos" ' tot leven komen van de homunculus Acts(2) = "03.- Eary Lis Trimbl" ' opstanding van de homunculus Acts(3) = "04.- Paradiso" ' de walpurgisnacht (met Faust en Helena, homunculus en mefisto) Acts(4) = "05.- Tekne" ' overwinningsdans van Mefisto Acts(5) = "06.- Flexes" ' homunculus and Flex ' 10.06.2003 - 24.07.2003 Acts(6) = "07.- Wander" ' wandering quadrada space - verkenning van de ruimte Acts(7) = "08.- Gnos" ' 06.06.06 faust brengt de homunkulus kennis bij: taal Acts(8) = "09.- Tango" ' dans 2 koppels: Faust-Mefisto , Homunkulus-Wagner Acts(9) = "10.- Descent" ' 13.02.2004 Acts(10)= "11.- Aux Arbres" ' 14.10.2004 Acts(11)= "12.- Trance" ' 16.07.2005 Acts(12) = "00.- STOP" ' if we add more, we have to number as 00, 01, 02, 03,04,05,06,07,08,09.10,11,12... DIALOG NEW gh.setup, "",,,160,100,, TO hDlg CONTROL ADD LISTBOX, hDlg, %ID_Acts_Dlg, acts(),0,0,140,90,,, CALL ActsDlgCallback cnt = %False DIALOG SHOW MODAL hDlg TO cnt DIALOG END hDlg FUNCTION = listboxchoice END FUNCTION CALLBACK FUNCTION ActsDlgCallback () AS LONG '%ID_Acts_Dlg = 100 LOCAL TXT$ IF CBCTLMSG = %LBN_SELCHANGE THEN LISTBOX GET TEXT CBHNDL, %ID_Acts_Dlg TO TXT$ DIALOG END CBHNDL listboxchoice = VAL(TXT$) FUNCTION = %True END IF END FUNCTION SUB Flex_ADXL_CB () LOCAL buttonnr AS LONG LOCAL cptr AS DWORD ButtonNr = App.butnSWparam - %GMT_BUTNSW_ID IF ButnSW(buttonnr).Flag THEN ' start ADXL202 'Open_Serial_IO 1, "ADXL202" cptr = GetProcAddress(gh.gnh, "OPEN_SERIAL_IO") CALL DWORD cptr USING Open_Serial_IO(1, "ADXL202") ' now global: static pADXL202 as AccelSensDevice PTR 'pADXL202 = GetADXL202pointer cptr = GetPRocAddress(gh.gnh, "GETADXL202POINTER") CALL DWORD cptr USING GetADXL202Pointer TO pADXL202 ELSE ' stop ADXL202 'Close_Serial_IO 1, "ADXL202" cptr = GetProcAddress(gh.gnh, "CLOSE_SERIAL_IO") CALL DWORD cptr USING CLose_Serial_IO(1, "ADXL202") END IF App.butnSWparam = %False ' reset END SUB '[EOF] _