' ********************************************* ' * g_mm.inc * ' * common control code for the M&M robots * ' * Module created 06.11.2004 * ' * by Godfried-Willem Raes & Kristof Lauwers * ' ********************************************* ' the g_mm.bi file has to be included before this one. ' 20.11.2004: called on by most M&M apps. ' 30.11.2004: kl: panicbuttonwindow updated: now doublceclicking a button initialises the robot (if the codepointer is existing) ' (button's don't send right clicked messages..) ' 10.12.2004: code for harma lights added. ' 12.12.2004: %BM_SETIMAGE = &HF7 moved to g_win.inc (entire group of %BM_ constants) ' 14.12.2004: M&M all off button added by gwr. ' 05.01.2005: Bourdonola new implementation added. ' 09.01.2005: extensive tests with bourdonola. ' 15.01.2005: MM_lights coding completed. ' 16.01.2005: rigth mouse button clicks on robot icons implemented (gwr) ' now we have: ' left mouse click = always only notes off (kills sound output) ' left mouse double click = always notes off and motor off (silence machine notes & noise) ' right mouse click = default switch-on procedure. (implemented by gwr) ' 18.01.2005: used in M&M performance. ' 23.01.2005: Tubi added in interface. ' 25.01.2005: Tubi now only midi robot. ' 31.01.2005: Vibi prepared to become midi robot. ' 31.01.2005: Dripper now midi robot. ' 07.02.2005: Vibi now midi robot ' 14.02.2005: piperola renewed. ' 17.02.2005: So improved. ' 02.03.2005: new piperola PIC's ' 07.03.2005: sire added ' 01.04.2005: Dripper completed as midi robot. ' 13.04.2005: Llor pitch mapping added. ' 17.04.2005: start adding Vacca. ' 20.04.2005: sire tested. ' 27.04.2005: eerste aanzet funktie Sire_mPlay () ' 01.06.2005: ready for tests ' 10.06.2005: vacca lookup added - kl. ' 11.06.2005: further work on vacca implementation gwr. ' 16.06.2005: Vox Humanola ombouw klaar. ' 31.08.2005: some changes to be done to be able to use vaccamapping from the mPlayer: ' - getvaccamapping moved to dll and now has a param (musician type) where the note values will be filled in ' - new function vaccamap in g_indep, also used in mPlayvacca ' 03.12.2005: adapted to midi - ' 09.01.2006: Krum added. ' 21.01.2006: Krum debug ' 12.02.2006: Psch added. ' 10.04.2006: Snar added. ' 17.04.2006: Vitello added. ' 24.04.2006: vitello and snar code debugged ' 02.05.2006: start changes for Autosax V3 ' 10.05.2006: SETTINGS FOR kRUM AND CONTROLLER FOR SNAR CHANGED. ' 24.07.2006: Qt added. ' 17.08.2006: mPlayKloks function added: chooses best matching bel from all (Selected) bell-type instruments (vacca, vitello, belly, llor, harma's bell) ' still to be tested -> we wait for belly to be operational again.. ' 17.10.2006: support completed. ' lite color flags added. ' 24.02.2007: start support for Xy and Aeio. ' 12.04.2007: Xy support updated ' 26.06.2007: Simba support added ' 25.07.2007: New implementation for so added. ' 19.08.2007: implementation of . ' 07.09.2007: adapted to new rotomoton. ' 26.01.2008: added ' 08.08.2008: added. ' 28.08.2008: code upgraded. Start coding for ' 08.10.2008: added. ' 01.11.2008: added. ' 20.01.2009: upgrade 4 implemented ' 12.07.2009: on/off kode toegevoegd. Bug in lichtjes So weggewerkt. ' 22.11.2009: added. ' 08.01.2010: new default setting for harmO applied. ' 18.06.2010: new mapping for lights on Autosax implemented. ' 10.07.2010: added. ' 05.10.2010: adapted to new features in Puff and Bono ' 05.11.2010: adapted to newest features in Ob and Korn ' 11.04.2011: introduction of coding. ' 27.04.2011: added in full ' 15.05.2011: lights added, bug in Harm0 %MM_Red killed. ' 28.05.2011: coding updated conform to new pic implementations. ' 04.09.2011: added. ' 15.12.2011: Could we make this into a library? ' to be done: ' inclusion of file mPlayer ' midi file writer ' 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. FUNCTION Init_MM () EXPORT AS LONG ' hier zouden we de ini filename ook als parameter kunnen doorgeven. ' kan nuttig zijn voor diverse M&M konfiguraties. ' Zoals het nu is, kan dat ook ,maar dan moet de parameter bij het opstarten ' van de gmt_executable gebeuren. ' Alle M&M app's beginnen met een call naar Init_MM, gevolgd door een call naar ' MM_PanicButtonWindow. Deze laatste call vult het MM() array en kreeert een ' button control window. ' kl note: don't forget to call the MM__init with flags %MM_Powers/%MM_Motor for each robot function here. ' replace with the robot name.. ' the robots are supposed to be ready for mPlaying after calling this function! ' gw: but where is that function located? LOCAL retval AS DWORD GetInstrumentParams Piano, %IDM_PlayerPIANO retval = SetRobotPort (Piano, Inifilename ,hMidiO()) ' note: Inifilename is a function in g_indep.dll Piano.cptrOnProc = CODEPTR(MM_Piano_On) 'new 13.10.2010 Piano.cptrOffProc = CODEPTR(MM_Piano_off) MM_Piano_On %MM_Power GetInstrumentParams Harma, %IDM_HARMA ' updated 03.12.2005 - midi robot retval = SetRobotPort (Harma, Inifilename, hMidiO()) Harma.cptrOffProc = CODEPTR(MM_Harma_Off) Harma.cptrOnProc = CODEPTR(MM_Harma_On) MM_Harma_On %MM_MOTOR OR %MM_REGS GetInstrumentParams Vibi, %IDM_VIBI ' since 02.2005 a midi robot. retval = SetRobotPort (Vibi, Inifilename, hMidiO()) Vibi.cptrOffProc = CODEPTR(MM_Vibi_Off) Vibi.cptrOnProc = CODEPTR(MM_Vibi_On) MM_Vibi_On GetInstrumentParams Klung, %IDM_KLUNG ' since 08.2006 a midi robot retval = SetRobotPort (Klung, Inifilename, hMidiO()) Klung.cptrOffProc = CODEPTR(MM_Klung_Off) Klung.cptrOnProc = CODEPTR(MM_Klung_On) MM_Klung_On pKlungHw = GetKlungParams 'in g_file now GetInstrumentParams AutoSax, %IDM_AUTOSAX retval = SetRobotPort (Autosax, Inifilename, hMidiO()) AutoSax.cptrOffPRoc = CODEPTR(MM_AutoSax_off) Autosax.cptrOnProc = CODEPTR(MM_AutoSax_On) MM_Autosax_On %MM_MOTOR OR %MM_POWER GetInstrumentParams Belly, %IDM_BELLY ' not in conflict with %gmt_robots since we have pBelly als global there retval = SetRobotPort (Belly, IniFilename, hMidiO()) Belly.cptrOffProc = CODEPTR(MM_Belly_Off) Belly.cptrOnProc = CODEPTR(MM_Belly_On) ' InitKlokparams 'in gh.bas.. - depreciated -> use GetBellyMapping now ' for belly as midi robot: REDIM BellyNotes(Belly.LowTes TO Belly.HighTes) GetBellyMapping(BellyNotes()) MM_Belly_On %MM_POWER GetInstrumentParams Tubi, %IDM_TUBI ' since 2005: midi robot retval = SetRobotPort (Tubi, Inifilename, hMidiO()) Tubi.cptrOnProc = CODEPTR(MM_Tubi_On) Tubi.cptrOffProc = CODEPTR(MM_Tubi_Off) MM_Tubi_On GetInstrumentParams Springers, %IDM_SPRINGERS retval = SetRobotPort (Springers, Inifilename, hMidiO()) Springers.cptrOnProc = CODEPTR(MM_Springers_On) Springers.cptrOffProc = CODEPTR(MM_Springers_Off) GetInstrumentParams ThunderWood, %IDM_THUNDERWOOD retval = SetRobotport (ThunderWood, Inifilename, hMidiO()) Thunderwood.cptrOnProc = CODEPTR(MM_Thunderwood_on) ThunderWood.cptrOffProc = CODEPTR(MM_ThunderWood_Off) MM_Thunderwood_On GetInstrumentParams RotoMoton, %IDM_ROTOMOTON retval = SetRobotPort (Rotomoton, IniFilename, hMidiO()) Rotomoton.cptrOnProc = CODEPTR(MM_Rotomoton_On) RotoMoton.cptrOffProc = CODEPTR(MM_RotoMoton_Off) MM_Rotomoton_On %MM_Power #IF NOT(%DEF(%gmt_robots)) GetInstrumentParams Flex, %IDM_FLEX ' 10.06.2003 retval = SetRobotPort (Flex, Inifilename, hMidiO()) Flex.cptrOnProc = CODEPTR(MM_Flex_On) Flex.cptrOffPRoc = CODEPTR(MM_Flex_Off) 'Flex.cptrOnProc = codeptr(MM_Dummy) #ENDIF GetInstrumentParams Piperola, %IDM_PIPEROLA ' renewed 15.02.2005 retval = SetRobotPort (Piperola, IniFilename , hMidiO()) Piperola.cptrOffProc = CODEPTR(MM_Piperola_Off) Piperola.cptrOnProc = CODEPTR(MM_Piperola_On) Controller Piperola.channel, 65, %True 'don't use MM_Piperola_On here, as it allways inits wind to default GetInstrumentParams Bourdonola, %IDM_BOURDONOLA retval = SetRobotPort (Bourdonola, IniFilename, hMidiO()) Bourdonola.cptrOffProc = CODEPTR(MM_Bourdonola_Off) Bourdonola.cptrOnProc = CODEPTR(MM_Bourdonola_On) ' added 07.01.2005 Controller Bourdonola.channel, 66, 127 ' motor ON/OFF switch GetInstrumentParams Humanola, %IDM_HUMANOLA retval = SetRobotport (Humanola, Inifilename, hMidiO()) Humanola.cptrOffProc = CODEPTR(MM_Humanola_Off) Humanola.cptrOnProc = CODEPTR(MM_Humanola_On) GetInstrumentParams Krum, %IDM_KRUM retval = SetRobotport (Krum, Inifilename, hMidiO()) Krum.cptrOffProc = CODEPTR(MM_Krum_Off) Krum.cptrOnProc = CODEPTR(MM_Krum_On) MM_Krum_On %MM_MOTOR GetInstrumentParams Troms, %IDM_TROMS ' changed 12.04.2004 retval = SetRobotPort (Troms, IniFileName, hMidiO()) Troms.cptrOffProc = CODEPTR(MM_Troms_Off) GetInstrumentParams So, %IDM_SO retval = SetRobotPort (So, Inifilename, hMidiO()) ' added 09.2003 So.cptrOffProc = CODEPTR(MM_So_Off) ' enabled 25.07.2007 So.cptrOnProc = CODEPTR(MM_So_On) ' enabled 25.07.2007 MM_So_On %MM_Motor GetInstrumentParams Puff, %IDM_PUFF retval = SetRobotPort (Puff, Inifilename, hMidiO()) ' added 14.11.2003 Puff.cptrOffPRoc = CODEPTR(MM_Puff_Off) 'Puff.cptrOnProc = CODEPTR(MM_Dummy) GetInstrumentParams Trump, %IDM_TRUMP retval = SetRobotPort (Trump, Inifilename, hMidiO()) ' added 13.01.2004 Trump.cptrOffPRoc = CODEPTR(MM_Trump_Off) Trump.cptrOnProc = CODEPTR(MM_Trump_On) ' MM_Trump_On %MM_MOTOR 'noisy, don't put on unless you need it.. GetInstrumentParams Hurdy, %IDM_HURDY retval = SetRobotport (Hurdy, Inifilename, hMidiO()) ' added 12.07.2004 Hurdy.cptrOffProc = CODEPTR(MM_Hurdy_Off) ReadHurdyTuningFromFile IniFilename, Hurdy 'fills in the tuning controllers 20 and 21.. Hurdy.cptrOnProc = CODEPTR(MM_Hurdy_On) GetInstrumentParams Ake, %IDM_AKE retval = SetRobotPort (Ake, IniFilename, hMidiO()) ' added 13.10.2004 Ake.cptrOffPRoc = CODEPTR(MM_Ake_Off) Ake.cptrOnProc = CODEPTR(MM_Ake_On) MM_Ake_On %MM_MOTOR ' 20.11.2004 GetInstrumentParams Llor, %IDM_LLOR retval = SetRobotPort (Llor, Inifilename, hMidiO()) ' added 13.11.2004 Llor.cptrOffProc = CODEPTR(MM_Llor_Off) REDIM LlorNotes(Llor.LowTes TO Llor.Hightes) 'note that Llor deviates from vacca, vitello, ... in its implementation 'the mPlayllor function is in g_midi and works WITHOUT the LlorNotes() (as it uses the 5 strongest spectral components in Llor) 'we added the LlorNotes for use in the mPlayKloks function in g_mm.. GetLlorMapping Llornotes() 'Llor.cptrOnProc = CODEPTR(MM_Dummy) ' initialize pitchmapping lookup foor the LlormPlay function: retval = PlayLlor (12,10,1) ' initialises reading of data in the function. Llor will do nothing. GetInstrumentParams Dripper, %IDM_DRIPPER retval = SetRobotPort (Dripper, Inifilename, hMidiO()) ' added 31.01.2005 GetInstrumentParams Sire, %IDM_SIRE retval = SetRobotPort (Sire, Inifilename, hMidiO()) ' added 02.03.2005 Sire.cptrOffProc = CODEPTR(MM_Sire_Off) GetInstrumentParams Vacca, %IDM_VACCA retval = SetRobotPort (Vacca, Inifilename, hMidiO()) ' added 17.04.2005 REDIM VaccaNotes(Vacca.LowTes TO Vacca.HighTes) GetVaccaMapping VaccaNotes() 'in g_file.bas GetInstrumentParams Casta, %IDM_CASTA retval = SetRobotPort(Casta, Inifilename, hMidiO()) 'added kl 08.06.2005 GetInstrumentParams Casta2, %IDM_CASTA2 retval = SetRobotPort(Casta2, Inifilename, hMidiO()) 'added kl 02.05.2007 REDIM VaccaNotes(Vacca.LowTes TO Vacca.HighTes) 'only the pitch and harmony fields are used for now! IF ISFALSE GetVaccaMapping(VaccaNotes()) THEN Warning "Failed reading data for Vacca!" ' Vacca.cptrOffProc = CODEPTR(MM_Vacca_Off) GetInstrumentParams Psch, %IDM_PSCH retval = SetRobotPort (Psch, Inifilename, hMidiO()) ' added 12.02.2006 GetInstrumentParams Snar, %IDM_SNAR retval = SetRobotport (Snar, Inifilename, hMidiO()) ' added 10.04.2006 Snar.cptrOffProc = CODEPTR(MM_Troms_Off) 'for magnet and lights GetInstrumentParams Vitello, %IDM_VITELLO retval = SetRobotPort (Vitello, Inifilename, hMidiO()) ' added 17.04.2006 Vitello.cptrOnProc = CODEPTR(MM_Vitello_On) Vitello.cptrOffProc = CODEPTR(MM_Vitello_Off) REDIM VitelloNotes(44 TO Vitello.Hightes) '(Vitello.lowtes TO Vitello.Hightes) gat in tessituur!! GetVitelloMapping VitelloNotes() MM_Vitello_On GetInstrumentParams Qt, %IDM_Qt GetInstrumentParams Qtq, %IDM_QT_Q ' 2007 -krl retval = SetRobotPort (Qt, Inifilename, hMidiO()) ' added 24.07.2006 retval = SetRobotPort(qtq, Inifilename, hMidiO()) Qt.cptrOnProc = CODEPTR(MM_Qt_On) Qt.cptrOffProc = CODEPTR(MM_Qt_Off) MM_QT_On %MM_Motor ProgChange QT.channel, 122 ProgChange QTq.channel, 122 'we deliberately don't provide the offproc for Qtq - use the one for Qt! (otherwise the button would appear twice in the panicbuttonwindow) GetInstrumentParams Bako, %IDM_Bako retval = SetRobotPort (Bako, Inifilename, hMidiO()) ' added 14.10.2006 Bako.cptrOnProc = CODEPTR(MM_Bako_On) Bako.cptrOffProc = CODEPTR(MM_Bako_Off) GetInstrumentParams Xy, %IDM_Xy GetInstrumentParams Xyq, %IDM_XY_Q retval = SetRobotPort (Xy, Inifilename, hMidiO()) ' added 24.02.2007 Xy.cptrOnProc = CODEPTR(MM_Xy_On) Xy.cptrOffProc = CODEPTR(MM_Xy_Off) MM_Xy_On 'added 16052007 - was vergeten.. GetInstrumentParams Simba, %IDM_Simba retval = SetRobotPort (Simba, Inifilename, hMidiO()) Simba.cptrOnProc = CODEPTR(MM_Simba_On) Simba.cptrOffProc = CODEPTR(MM_Simba_Off) MM_Simba_On ' added 02.07.2007 GetInstrumentParams Aeio, %IDM_Aeio retval = SetRobotPort (Aeio, Inifilename, hMidiO()) ' added 24.02.2007 Aeio.cptrOnProc = CODEPTR(MM_Aeio_On) Aeio.cptrOffProc = CODEPTR(MM_Aeio_Off) GetInstrumentParams Bono, %IDM_BONO retval = SetRobotPort (Bono, Inifilename, hMidiO()) Bono.cptrOnProc = CODEPTR(MM_Bono_On) 'hier stond Simba ipv Bono -> hierdoor verscheen de button ook niet in het panicbuttonwindow Bono.cptrOffProc = CODEPTR(MM_Bono_Off) MM_Bono_On ' added 19.08.2007 GetInstrumentParams Korn, %IDM_KORN ' added 24.01.2008 retval = SetRobotPort (Korn, Inifilename, hMidiO()) Korn.cptrOnProc = CODEPTR(MM_Korn_On) Korn.cptrOffProc = CODEPTR(MM_Korn_Off) MM_Korn_on 'was missing 28.10.2008 GetInstrumentParams Toypi, %IDM_TOYPI ' 08.08.2008 retval = SetRobotPort (Toypi, Inifilename, hMidiO()) Toypi.cptrOnProc = CODEPTR(MM_Toypi_On) ToyPi.cptrOffProc = CODEPTR(MM_Toypi_Off) MM_Toypi_On GetInstrumentParams Ob, %IDM_OB ' 08.10.2008 retval = SetRobotPort (Ob, Inifilename, hMidiO()) Ob.cptrOnProc = CODEPTR(MM_Ob_On) Ob.cptrOffProc = CODEPTR(MM_Ob_Off) MM_Ob_On GetInstrumentParams Heli, %IDM_HELI ' 01.11.2008 retval = SetRobotPort (Heli, Inifilename, hMidiO()) Heli.cptrOnProc = CODEPTR(MM_Heli_On) Heli.cptrOffProc = CODEPTR(MM_Heli_Off) MM_Heli_On GetInstrumentPArams Hat, %IDM_HAT retval = SetRobotPort(Hat, Inifilename, hMidiO()) Hat.cptrOnProc = CODEPTR(MM_Hat_On) Hat.cptrOffProc = CODEPTR(MM_Hat_Off) GetInstrumentParams Harmo, %IDM_HARMO '06.12.2009 retval = SetRobotPort(Harmo, Inifilename, hMidiO()) Harmo.cptrOnProc = CODEPTR(MM_Harmo_On) Harmo.cptrOffProc = CODEPTR(MM_Harmo_Off) MM_Harmo_On %MM_Motor OR %MM_Regs GetInstrumentParams Bomi, %IDM_BOMI '04.08.2010 - kl forgot to add this one, we we did it. ' - implemented in MM_alloff also now (07.09.2010) retval = SetRobotPort(Bomi, Inifilename, hMidiO()) Bomi.cptrOnProc = CODEPTR(MM_Bomi_On) Bomi.cptrOffProc = CODEPTR(MM_Bomi_Off) MM_Bomi_On %MM_Motor GetInstrumentParams Fa, %IDM_FA '27.02.2011 retval = SetRobotPort(Fa, Inifilename, hMidiO()) Fa.cptrOnProc = CODEPTR(MM_Fa_On) Fa.cptrOffProc = CODEPTR(MM_Fa_Off) MM_Fa_On %MM_Power GetInstrumentParams Spiro, %IDM_SPIRO '11.04.2011 retval = SetRobotPort(Spiro, Inifilename, hMidiO()) Spiro.cptrOnProc = CODEPTR(MM_Spiro_On) Spiro.cptrOffProc = CODEPTR(MM_Spiro_Off) MM_Spiro_On %MM_Power FUNCTION = %True END FUNCTION FUNCTION MM_AllOff (OPTIONAL BYVAL flag AS DWORD) AS DWORD ' should switch off all notes on all automats at once. ' if flag = %MM_Notes : all notes off ' if flag = %MM_Motor : all motors off ' if flag = %MM_Lights : all lights off ' if flag = %MM_Power: power off ' %MM_Motor = &b01 ' bit 0 ' for Ake, all organs, vibi . Sometimes a switch, sometimes a cc ' %MM_Notes = &b010 ' bit 1 ' %MM_Regs = &b0100 ' bit 2 ' for Harma and Ake ' %MM_Lights = &b01000 ' bit 3 ' all lights ' %MM_Ctrl = &b010000 ' bit 4 ' for belly (mapping on) ' %MM_BowOff = &b0100000 ' bit 5 for Hurdy ' %MM_Reset = &b01000000 ' bit 6 may reset all controllers implemented on the instrument ' %MM_Valve = &b010000000 ' bit 7 for Ake ' %MM_Perc = &b0100000000 ' bit 8 humanola castagnets ' %MM_Wind = &b01000000000 ' bit 9 wind pressure (on Bourdonola), on ' %MM_NoMap = &b010000000000 ' bit 10 resets instrument note map if applicable (f.i. Belly, Llor, Autosax) ' %MM_Power = &b0100000000000 ' bit 11 power on/off switches (tubi, Vitello, Vibi, Autosax, piano) ' %MM_Red = &b01000000000000 ' bit 12 red lights ' %MM_Yellow = &b010000000000000 ' bit 13 yellow/orange lights ' %MM_Blue = &b0100000000000000 ' bit 14 blue lights ' %MM_White = &b01000000000000000 'bit 15 white lights ' %MM_Green = &b010000000000000000 ' bit 16 green lights (only on thunderwood) ' %MM_Video = &b0100000000000000000 ' bit 17 video camera in some automates SELECT CASE flag CASE %False MM_Piano_off %MM_Power SLEEP 10 MM_Piperola_off %MM_WIND OR %MM_MOTOR OR %MM_NOTES OR %MM_LIGHTS 'putting off motor without resetting wind causes all winds to blow on Init_MM!! SLEEP 1 MM_Humanola_off %MM_WIND OR %MM_MOTOR OR %MM_NOTES Humanola.Har(1).vel = NUL$(128) SLEEP 10 mm_bourdonola_off %MM_Notes OR %MM_WIND 'New bourdonola implementation 05.01.2005 - motor stays on SLEEP 10 MM_So_Off %MM_Wind OR %MM_Notes OR %MM_Motor MM_Trump_off %MM_WIND OR %MM_MOTOR OR %MM_NOTES SLEEP 10 MM_Hurdy_off MM_Ake_Off %MM_WIND OR %MM_MOTOR OR %MM_NOTES MM_Puff_Off MM_Llor_Off SLEEP 10 MM_Harma_off %MM_WIND OR %MM_NOTES OR %MM_MOTOR OR %MM_LIGHTS SLEEP 10 #IF NOT(%DEF(%gmt_robots)) MM_Flex_Off #ENDIF MM_Rotomoton_Off MM_Springers_Off SLEEP 10 MM_AutoSax_Off MM_ThunderWood_Off MM_Troms_Off MM_Tubi_Off SLEEP 10 MM_Sire_Off MM_Krum_Off %MM_Wind OR %MM_Notes OR %MM_Lights MM_Qt_Off %MM_Wind OR %MM_Notes OR %MM_Lights SLEEP 10 MM_Klung_Off %MM_Lights MM_Xy_Off MM_Simba_Off MM_Bako_Off '070709 deze ontbrak hier nog!! MM_Bono_Off MM_Korn_Off SLEEP 10 MM_Toypi_Off MM_Ob_Off MM_Heli_Off MM_Harmo_Off %MM_WIND OR %MM_NOTES OR %MM_MOTOR OR %MM_LIGHTS MM_Bomi_Off MM_Vibi_Off 'added 29.11.2010 MM_Fa_Off MM_Spiro_Off MM_Aeio_off 'ontbrak 8.12.2011 CASE ELSE IF (flag AND %MM_Notes) THEN '! 050405 was bug: hier stond "flag OR %MM_Notes" i.p.v. "(flag AND %MM_Notes)" ... MM_Piano_off %MM_Notes SLEEP 1 MM_Piperola_off %MM_NOTES SLEEP 10 MM_Humanola_off %MM_NOTES Humanola.Har(1).vel = NUL$(128) SLEEP 10 mm_bourdonola_off %MM_Notes 'New bourdonola implementation 05.01.2005 - motor stays on SLEEP 1 MM_So_Off %MM_Notes MM_Trump_off %MM_NOTES SLEEP 10 MM_Hurdy_off MM_Ake_Off %MM_NOTES MM_Llor_Off ' release SLEEP 10 MM_Harma_off %MM_Notes SLEEP 10 #IF NOT(%DEF(%gmt_robots)) MM_Flex_Off #ENDIF MM_Rotomoton_Off MM_AutoSax_Off MM_Springers_Off SLEEP 10 MM_ThunderWood_Off MM_Troms_Off ' damper off - snar MM_Sire_Off SLEEP 10 MM_Krum_Off %MM_Notes MM_Qt_Off %MM_Notes SLEEP 10 MM_Klung_Off %MM_Notes MM_Ake_Off %MM_Notes MM_Simba_Off %MM_Notes 'voor dampers MM_Bako_Off %MM_Notes MM_Bono_Off %MM_Notes MM_Korn_Off %MM_Notes MM_Ob_Off MM_Heli_Off MM_Harmo_Off %MM_Notes MM_Bomi_Off %MM_Notes MM_Vibi_Off %MM_Notes MM_Fa_Off %MM_Notes MM_Spiro_Off %MM_Notes END IF IF (flag AND %MM_Motor) THEN ' warning "allof.motor - flag=" + BIN$(flag) + BIN$(%MM_MOTOR), 10000 MM_Piperola_Off %MM_Motor MM_Bourdonola_Off %MM_Wind SLEEP 10 MM_Humanola_Off %MM_Motor MM_Vibi_Off %MM_Motor MM_So_Off %MM_Motor SLEEP 10 MM_Trump_Off %MM_Motor MM_Hurdy_Off %MM_MOTOR MM_Harma_Off %MM_Motor SLEEP 10 MM_Krum_Off %MM_Motor MM_Qt_Off %MM_Motor SLEEP 10 MM_Ake_Off %MM_Motor MM_Simba_Off %MM_Motor MM_Bako_Off %MM_Motor MM_Ob_Off %MM_Motor MM_Korn_Off %MM_Motor MM_Harmo_Off %MM_Motor MM_Bomi_Off %MM_Motor MM_Fa_Off %MM_Motor END IF IF (flag AND %MM_Lights) THEN MM_AllLightsOff END IF IF (flag AND %MM_Power) THEN MM_Piano_Off %MM_Power MM_AutoSax_Off %MM_POWER MM_Tubi_Off %MM_Power SLEEP 10 MM_Klung_Off %MM_Power MM_Vitello_Off %MM_Power SLEEP 10 'logfile "POWER OFF BELLY" MM_Belly_Off %MM_Power MM_ThunderWood_Off %MM_Power SLEEP 10 MM_Rotomoton_Off %MM_Power MM_Tubi_off %MM_Power MM_Xy_Off %MM_Power MM_Simba_Off %MM_Power MM_Bono_Off MM_Bomi_Off %MM_Power MM_Vibi_Off %MM_Power MM_Fa_Off %MM_Power MM_Spiro_Off %MM_Power END IF END SELECT FUNCTION = %True END FUNCTION SUB MM_AllLightsOff (OPTIONAL BYVAL flag AS DWORD) 'flags added 04.12.2010 - gwr. LOCAL i AS INTEGER IF (ISFALSE flag) OR (flag AND %MM_Lights) THEN MM_Troms_Off %MM_Lights MM_Puff_Off %MM_Lights MM_Snar_Off %MM_Blue MM_Ake_Off %MM_Lights MM_Aeio_Off %MM_Lights MM_Ob_Off %MM_Lights MM_Piano_Off %MM_Lights MM_Fa_Off %MM_Lights MM_Spiro_Off %MM_Lights MM_Fa_Off %MM_Lights mPlay Hurdy.channel, 0, %False ' linkerlamp, frontaal gezien. hurdy.ctrl(120) = %False mPlay Hurdy.channel, 1, 0 hurdy.ctrl(121) = %False ' Harma Lights - done 03.12.2005 FOR i = 91 TO 98 mPlay Harma.channel, i, %False NEXT i FOR i = 1 TO 5 mPlay Llor.channel, i, %False Llor.ctrl(i) = %False NEXT i FOR i = 32 TO 35 ' 34= wit licht voorkant. 32= oranje licht tussen pijpen mPlay Bourdonola.channel, i, %False ' 33 = licht tussen pijpen rechts Bourdonola.ctrl(i) = %False ' 35 = LED licht op schakelingen. NEXT i NoteOff Piperola.channel, 118 ' rood NoteOff Piperola.channel, 119 ' wit boven slagwerk FOR i = 84 TO 92 NoteOff Sire.channel, i ' only 86,89,92 implemented 30.09.2005 Sire.ctrl(i) = %False NEXT i FOR i = 92 TO 96 NoteOff Humanola.channel, i ' yellow lights on front panel NEXT i FOR i = 84 TO 87 NoteOff Psch.channel, i ' 4 blue lights NEXT i NoteOff Krum.channel, 100 NoteOff Krum.channel, 101 NoteOff Krum.channel, 102 ' rotomoton lights: MM_Rotomoton_Off %MM_Lights MM_ThunderWood_Off %MM_Lights MM_Vitello_Off %MM_Lights MM_Qt_Off %MM_Lights MM_Klung_Off %MM_Lights MM_Belly_Off %MM_Lights NoteOff Springers.channel, 2 Springers.ctrl(70) = %False MM_Bako_Off %MM_Lights MM_Xy_Off %MM_Lights MM_Casta_Off %MM_Lights MM_Simba_Off %MM_Lights NoteOff So.channel, 49 'white NoteOff So.channel, 50 'red MM_Autosax_Off %MM_Lights ' waren we vergeten tot 12.07.2009... MM_Bono_Off %MM_Lights MM_Korn_Off %MM_Lights ' white, orange and blue MM_Toypi_Off %MM_Lights MM_Heli_Off %MM_Lights MM_HarmO_Off %MM_Lights MM_Bomi_Off %MM_Lights MM_Vibi_Off %MM_Lights MM_Spiro_Off %MM_Lights END IF IF (flag AND %MM_Blue) THEN MM_Snar_Off %MM_Blue Controller Springers.channel, 70, %False Springers.ctrl(70) = %False MM_Llor_Off %MM_Lights MM_Bako_Off %MM_Blue MM_Qt_Off %MM_Lights MM_Rotomoton_Off %MM_Blue NoteOff Psch.channel, 84 NoteOff Psch.channel, 85 NoteOff Psch.channel, 86 NoteOff Psch.channel, 87 MM_Korn_Off %MM_Blue MM_Toypi_Off %MM_Blue MM_Ake_Off %MM_Blue MM_Autosax_Off %MM_Blue MM_HarmO_Off %MM_Blue MM_Piano_Off %MM_Blue MM_Thunderwood_Off %MM_Blue MM_Fa_Off %MM_Blue MM_Spiro_Off %MM_Blue END IF IF (flag AND %MM_Green) THEN MM_Thunderwood_Off %MM_Green END IF IF (Flag AND %MM_Red) THEN MM_Piperola_Off %MM_Red MM_Bourdonola_Off %MM_Red FOR i = 84 TO 92 ' 86,89,92 implemented 30.09.2005 NoteOff Sire.channel, i NEXT i MM_Harma_Off %MM_Red MM_Vitello_Off %MM_Red MM_So_Off %MM_Red MM_Xy_Off %MM_Red MM_Autosax_Off %MM_Red MM_HarmO_Off %MM_Red MM_Thunderwood_Off %MM_Red MM_Korn_Off %MM_Red MM_Vibi_Off %MM_Red MM_Puff_Off %MM_Red MM_Fa_Off %MM_Red END IF IF (flag AND %MM_Yellow) THEN MM_Bourdonola_Off %MM_Yellow ' oranje licht tussen de pijpen MM_Krum_Off %MM_Yellow MM_Belly_Off %MM_Lights MM_Puff_Off %MM_Yellow ' 104, 105 MM_Vitello_Off %MM_Yellow MM_Simba_Off %MM_Yellow ' 114 ' thunderwood oranje zwaailicht MM_Korn_Off %MM_Yellow ' 124 MM_Toypi_Off %MM_Yellow MM_Ob_Off %MM_Yellow MM_Heli_Off %MM_Yellow MM_Bono_Off %MM_Yellow MM_Autosax_Off %MM_Yellow FOR i = 92 TO 96 NoteOff Humanola.channel, i ' frontale LED's NEXT i MM_HarmO_Off %MM_Yellow MM_Piano_Off %MM_Yellow MM_Thunderwood_Off %MM_Yellow MM_Vibi_Off %MM_Yellow MM_Fa_Off %MM_Yellow END IF IF (flag AND %MM_White) THEN MM_Piperola_Off %MM_White ' 119 ' wit MM_Bourdonola_Off %MM_White ' 33,34 ' wit op frontale rij pijpen MM_Klung_Off %MM_Lights MM_Rotomoton_Off %MM_White NoteOff Hurdy.channel, 0 ' linkerlamp, frontaal gezien. NoteOff Hurdy.channel, 1 MM_Troms_Off %MM_Lights MM_Bako_Off %MM_White MM_Harma_Off %MM_White MM_Puff_Off %MM_White MM_Xy_Off %MM_White MM_Casta_Off %MM_Lights MM_Simba_Off %MM_White ' 110-113 MM_So_Off %MM_White 'NoteOff So.channel, 50 MM_Korn_Off %MM_White ' 126, 127... MM_Ake_Off %MM_White MM_Ob_Off %MM_White MM_Heli_Off %MM_White MM_Harmo_Off %MM_White MM_Bomi_Off %MM_White MM_Vibi_Off %MM_White MM_Bono_Off %MM_White END IF END SUB SUB MM_AllLightsOn (OPTIONAL BYVAL flag AS DWORD) LOCAL i AS INTEGER IF ISFALSE flag THEN MM_Troms_On %MM_Lights MM_Snar_On %MM_Lights MM_Puff_On %MM_Lights MM_Ake_On %MM_Lights mPlay Hurdy.channel, 0, %True ' linkerlamp, frontaal gezien. hurdy.ctrl(120) = %True mPlay Hurdy.channel, 1, %True hurdy.ctrl(121) = %True MM_Harma_On %MM_Lights mPlay Piperola.channel, 118, %True ' rood mPlay Piperola.channel, 119, %True ' wit MM_Llor_On %MM_Lights MM_Piano_On %MM_Lights FOR i = 32 TO 35 mPlay Bourdonola.channel, i, 127 Bourdonola.ctrl(i) = 127 NEXT i FOR i = 84 TO 92 ' 86,89,92 implemented 30.09.2005 mPlay Sire.channel, i, 127 Sire.ctrl(i) = 127 NEXT i FOR i = 92 TO 96 mPlay Humanola.channel, i, 127 ' frontale LED's NEXT i FOR i = 84 TO 87 mPlay Psch.channel, i, 127 NEXT i mPlay Krum.channel, 100, 127 mPlay Krum.channel, 101, 127 mPlay Krum.channel, 102, 127 MM_Rotomoton_On %MM_Lights MM_Vitello_On %MM_Lights ' mPlay Snar.channel, 76, 127 ' mPlay Snar.channel, 77, 127 ' mPlay Snar.channel, 75, 127 ' flash MM_Qt_On %MM_Lights ' all blue MM_Klung_On %MM_Lights MM_Belly_On %MM_Lights ' if we want to include springers police light as well: Controller Springers.channel, 70, 64 Springers.ctrl(70) = 64 MM_Thunderwood_On %MM_Lights MM_Bako_On %MM_Lights MM_Xy_On %MM_Lights MM_Casta_On %MM_Lights mPlay So.channel, 49, 127 ' red mPlay So.channel, 50, 127 ' white mPlay So.channel, 51, 127 ' logos disPlay MM_Simba_On %MM_Lights MM_Bono_On %MM_Lights MM_Korn_On %MM_Lights MM_Toypi_On %MM_Lights MM_Aeio_On %MM_Lights MM_Ob_On %MM_Lights MM_Heli_On %MM_Lights MM_HarmO_On %MM_Lights MM_Autosax_On %MM_Lights MM_Bomi_On %MM_Lights MM_Vibi_On %MM_Lights MM_Fa_On %MM_Lights MM_Spiro_On %MM_Lights ELSE ' check color flag IF (flag AND %MM_Red) THEN mPlay Piperola.channel, 118, %True ' rood MM_Bourdonola_On %MM_Red FOR i = 84 TO 92 ' 86,89,92 implemented 30.09.2005 mPlay Sire.channel, i, 127 Sire.ctrl(i) = 127 NEXT i MM_Harma_On %MM_Red MM_Vitello_On %MM_Red mPlay So.channel, 49, 127 ' rood mPlay So.channel, 51, 127 ' rood logos disPlay MM_Xy_On %MM_Red MM_Autosax_On %MM_Red MM_HarmO_On %MM_Red MM_Thunderwood_On %MM_Red MM_Korn_On %MM_Red MM_Vibi_On %MM_Red MM_Puff_On %MM_Red MM_Fa_On %MM_Red END IF IF (flag AND %MM_Blue) THEN MM_Snar_On %MM_Blue Controller Springers.channel, 70, 64 Springers.ctrl(70) = 64 MM_Llor_On %MM_Lights MM_Bako_On %MM_Blue MM_Qt_On %MM_Lights MM_Rotomoton_On %MM_Blue mPlay Psch.channel, 84, 127 mPlay Psch.channel, 85, 127 mPlay Psch.channel, 86, 127 mPlay Psch.channel, 87, 127 MM_Korn_On %MM_Blue MM_Toypi_On %MM_Blue MM_Ake_On %MM_Blue MM_Autosax_On %MM_Blue MM_HarmO_On %MM_Blue MM_Piano_On %MM_Blue MM_Thunderwood_On %MM_Blue MM_Fa_On %MM_Blue MM_Spiro_On %MM_Blue END IF IF (flag AND %MM_Yellow) THEN MM_Bourdonola_On %MM_Yellow mPlay Krum.channel, 100, 127 mPlay Krum.channel, 101, 127 mPlay Krum.channel, 102, 127 MM_Belly_On %MM_Lights MM_Puff_On %MM_Yellow ' 104, 105 MM_Vitello_On %MM_Yellow MM_Simba_On %MM_Yellow ' 114 ' thunderwood oranje zwaailicht MM_Korn_On %MM_Yellow ' 124 MM_Toypi_On %MM_Yellow MM_Ob_On %MM_Yellow MM_Heli_On %MM_Yellow MM_Bono_On %MM_Yellow MM_Autosax_On %MM_Yellow FOR i = 92 TO 96 mPlay Humanola.channel, i, 127 ' frontale LED's NEXT i MM_HarmO_On %MM_Yellow MM_Piano_On %MM_Yellow MM_Thunderwood_On %MM_Yellow MM_Vibi_On %MM_Yellow MM_Fa_On %MM_Yellow END IF IF (flag AND %MM_White) THEN mPlay Piperola.channel, 119, %True ' wit MM_Bourdonola_On %MM_WHITE MM_Klung_On %MM_Lights MM_Rotomoton_On %MM_White mPlay Hurdy.channel, 0, %True ' linkerlamp, frontaal gezien. hurdy.ctrl(120) = %True mPlay Hurdy.channel, 1, %True hurdy.ctrl(121) = %True MM_Troms_On %MM_Lights MM_Bako_On %MM_White MM_Harma_On %MM_White MM_Puff_On %MM_White MM_Xy_On %MM_White MM_Casta_On %MM_Lights MM_Simba_On %MM_White ' 110-113 mPlay So.channel, 50, 127 ' wit MM_Korn_On %MM_White ' 126, 127... MM_Ake_On %MM_White MM_Ob_On %MM_White MM_Heli_On %MM_White MM_Harmo_On %MM_White MM_Bomi_On %MM_White MM_Vibi_On %MM_White MM_Bono_On %MM_White END IF IF (flag AND %MM_Green) THEN MM_Thunderwood_On %MM_Green END IF END IF END SUB FUNCTION MM_Piano_Off (OPTIONAL BYVAL flag AS DWORD) AS DWORD IF ISFALSE flag THEN InstrumallNotesOff Piano Controller Piano.channel, 123, 0 'also does pedal and lights.13..10.2010 Piano.Har(1).vel = NUL$(128) 'Controller Piano.channel, 64, 0 ' pedaal Piano.ctrl(64) = 0 ELSE IF (flag AND %MM_Notes) THEN Controller Piano.channel, 123, 0 'should also release pedal END IF IF (flag AND %MM_Power) THEN Controller Piano.channel, 66, 0 'pedal power down END IF IF (flag AND %MM_Lights) THEN NoteOff Piano.channel, 126 NoteOff Piano.channel, 127 END IF IF (flag AND %MM_Blue) THEN NoteOff Piano.channel, 127 END IF IF (flag AND %MM_Yellow) THEN NoteOff Piano.channel, 126 END IF END IF FUNCTION = %True END FUNCTION FUNCTION MM_Piano_On (OPTIONAL BYVAL flag AS DWORD) AS DWORD IF ISFALSE flag THEN Controller Piano.channel, 66, 127 'power up the pedal. Controller Piano.channel, 123, 0 'also does pedal and lights 13.10.2010 Piano.Har(1).vel = NUL$(128) 'Controller Piano.channel, 64, 0 ' pedaal Piano.ctrl(64) = 0 ELSE IF (flag AND %MM_Power) THEN Controller Piano.channel, 66, 127 END IF IF (flag AND %MM_Lights) THEN mPlay Piano.channel, 126, 127 mPlay Piano.channel, 127, 127 END IF IF (flag AND %MM_Blue) THEN mPlay Piano.channel, 127, 127 END IF IF (flag AND %MM_Yellow) THEN mPlay Piano.channel, 126, 127 END IF END IF FUNCTION = %True END FUNCTION FUNCTION MM_Harma_Off (OPTIONAL BYVAL flag AS DWORD) AS DWORD IF ISFALSE flag THEN Controller Harma.channel, 123, %False Harma.Har(1).vel = NUL$(128) FUNCTION = %True EXIT FUNCTION END IF IF (flag AND %MM_Wind) THEN controller Harma.channel, 7, 0 Harma.ctrl(7) = 0 END IF IF (flag AND %MM_Motor) THEN ' Controller Harma.channel, 7, %False ' if we do this we should also switch the motor off ' Harma.ctrl(7) = %False ' the alternative would be to let the motor run at very Controller Harma.channel, 66, %False ' low speed (say 15 or so). Harma.ctrl(66) = %False ' Otherwize we risk getting overheat error F0011 on the dismPlay. Noteoff Harma.channel, 98 ' logos display OFF END IF IF (flag AND %MM_Notes) THEN Controller Harma.channel, 123, %False '!!! dit zet ook de registers af - kan niet de bedoeling zijn bij alloff met alleen maar MM_Notes Harma.Har(1).vel = NUL$(128) END IF IF (flag AND %MM_Regs) THEN ProgChange Harma.channel, %False Harma.patch = %False END IF IF (flag AND %MM_Lights) THEN mPlay Harma.channel, 91, %False ' klein wit lampje mPlay Harma.channel, 92, %False mPlay Harma.channel, 93, %False mPlay Harma.channel, 94, %False ' rode led-spot mPlay Harma.channel, 95, %False ' id. mPlay Harma.channel, 96, %False ' inside red mPlay Harma.channel, 97, %False ' inside red 'mPlay Harma.channel, 98, %False ' dismPlay Logos END IF IF (flag AND %MM_Red) THEN mPlay Harma.channel, 94, 0 ' rode led-spot mPlay Harma.channel, 95, 0 ' id. mPlay Harma.channel, 96, 0 mPlay Harma.channel, 97, 0 mPlay Harma.channel, 98, 0 ' dismPlay END IF IF (flag AND %MM_White) THEN mPlay Harma.channel, 91, 0 ' klein wit lampje mPlay Harma.channel, 92, 0 mPlay Harma.channel, 93, 0 END IF FUNCTION = %True END FUNCTION FUNCTION MM_HarmO_Off (OPTIONAL BYVAL flag AS DWORD) AS DWORD ' this command is essential before powering down the robot, since we assume the swells ' to be closed on a cold startup. LOCAL i AS LONG IF ISFALSE flag THEN Controller HarmO.channel, 123, %False HarmO.Har(1).vel = NUL$(128) Controller HarmO.channel, 82, 0 'tremulant OFF Harmo.ctrl(82) = %False ' close the swells: Controller HarmO.channel, 79, 0 Controller HarmO.channel, 80, 0 HarmO.ctrl(79) = %False HarmO.ctrl(80) = %False FUNCTION = %True EXIT FUNCTION END IF IF (flag AND %MM_Valve) THEN Controller HarmO.channel, 1, %False HarmO.ctrl(1) = %False END IF IF (flag AND %MM_Wind) THEN controller HarmO.channel, 7, 20 '0 Harmo.ctrl(7) = 20 '0 END IF IF (flag AND %MM_Motor) THEN Controller HarmO.channel, 66, %False Harmo.ctrl(66) = %False Controller HarmO.channel, 82, 0 'tremulant OFF Harmo.ctrl(82) = %False END IF IF (flag AND %MM_Notes) THEN Controller HarmO.channel, 123, %False Harmo.Har(1).vel = NUL$(128) END IF IF (flag AND %MM_Regs) THEN FOR i = 70 TO 78 Controller HarmO.channel, i, 0 HarmO.ctrl(i) = %False NEXT END IF IF (flag AND %MM_Lights) THEN FOR i = 119 TO 127 mPlay HarmO.channel, i, 0 NEXT END IF IF (flag AND %MM_Red) THEN NoteOff HarmO.channel, 121 ' had bug! was 127 gwr 15.05.2011 END IF IF (flag AND %MM_Yellow) THEN FOR i = 121 TO 126 mPlay HarmO.channel,i, 0 NEXT i END IF IF (flag AND %MM_Blue) THEN NoteOff HarmO.channel,119 END IF IF (flag AND %MM_White) THEN NoteOff HarmO.channel,120 END IF FUNCTION = %True END FUNCTION FUNCTION MM_Harma_On (OPTIONAL BYVAL flag AS DWORD) AS DWORD IF ISFALSE flag THEN ProgChange Harma.channel, 15 Harma.patch = 15 Controller Harma.channel, 66, %True Harma.ctrl(66) = %True Controller Harma.channel, 7, %MM_Harma_Motor Harma.ctrl(7) = %MM_Harma_Motor mPlay Harma.channel, 98, %True ' logos dismPlay ON EXIT FUNCTION END IF IF (flag AND %MM_Motor) THEN Controller Harma.channel, 66, %True Harma.ctrl(66) = %True END IF IF (flag AND %MM_Wind) THEN Controller Harma.channel, 7, %MM_Harma_Motor Harma.ctrl(7) = %MM_Harma_Motor mPlay Harma.channel, 98, %True ' logos dismPlay ON END IF IF (flag AND %MM_Regs) THEN IF ISFALSE Harma.patch THEN ProgChange Harma.channel, 15 Harma.patch = 15 ELSE ProgChange Harma.channel, Harma.patch END IF END IF IF (flag AND %MM_Lights) THEN mPlay Harma.channel, 91, %True ' klein wit lampje mPlay Harma.channel, 92, %True mPlay Harma.channel, 93, %True mPlay Harma.channel, 94, %True ' rode led-spot mPlay Harma.channel, 95, %True ' id. mPlay Harma.channel, 96, %True mPlay Harma.channel, 97, %True mPlay Harma.channel, 98, %True ' dismPlay END IF IF (flag AND %MM_Red) THEN mPlay Harma.channel, 94, %True ' rode led-spot mPlay Harma.channel, 95, %True ' id. mPlay Harma.channel, 96, %True mPlay Harma.channel, 97, %True mPlay Harma.channel, 98, %True ' dismPlay END IF IF (flag AND %MM_White) THEN mPlay Harma.channel, 91, %True ' klein wit lampje mPlay Harma.channel, 92, %True mPlay Harma.channel, 93, %True END IF FUNCTION = %True END FUNCTION FUNCTION MM_HarmO_On (OPTIONAL BYVAL flag AS DWORD) AS DWORD LOCAL i AS LONG 'warning FUNCNAME$ + STR$(flag) IF ISFALSE flag THEN Controller HarmO.channel, 66, %True HarmO.ctrl(66) = %True Controller HarmO.channel, 7, %MM_Harmo_Motor HarmO.ctrl(7) = %MM_HarmO_Motor HarmO.ctrl(1) = %MM_HarmO_Valve Controller HarmO.channel, 1, %MM_HarmO_Valve ' we assume the swells to be closed on a cold start, so here we open them: ' if this behaviour is not liked, discuss with Godfried before changing... ' xof's idea: 120 is quitre high, and it takes long to get there. above 40 you don't get much difference anymore, ' so maybe better default to value 40 or so? Controller HarmO.channel, 79, 120 Controller HarmO.channel, 80, 120 ' note that the PIC's should remember the position, so if the swells are already ' in this position, nothing ought to change on reception of this command. HarmO.ctrl(79) = 120 HarmO.ctrl(80) = 120 EXIT FUNCTION END IF IF (flag AND %MM_Motor) THEN Controller HarmO.channel, 66, %True HarmO.ctrl(66) = %True END IF IF (flag AND %MM_Valve) THEN Controller HarmO.channel, 1, %MM_HarmO_Valve HarmO.ctrl(1) = %MM_HarmO_Valve END IF IF (flag AND %MM_Wind) THEN Controller HarmO.channel, 7, %MM_HarmO_Motor Harma.ctrl(7) = %MM_HarmO_Motor END IF IF (flag AND %MM_Regs) THEN FOR i = 70 TO 78 Controller HarmO.channel, i, 127 HarmO.ctrl(i) = 127 NEXT END IF ' to be checked with hardware... IF (flag AND %MM_Lights) THEN FOR i = 119 TO 127 mPlay Harmo.channel, i, %True NEXT END IF IF (flag AND %MM_Red) THEN mPlay Harmo.channel, 121, %True ' rode led-spot op tremulant END IF IF (flag AND %MM_Yellow) THEN ' LED strips onder de solenoids: mPlay HarmO.Channel, 127, 127 ' frontale LED spots - o.k. 15.12.2009 mPlay Harmo.Channel, 126, %True mPlay Harmo.channel, 125, %True mPlay Harmo.channel, 124, %True mPlay Harmo.channel, 123, %True mPlay Harmo.channel, 122, %TRue END IF IF (flag AND %MM_White) THEN mPlay HarmO.channel, 120, %True ' ok. 22.12.2009 END IF IF (flag AND %MM_Blue) THEN mPlay HarmO.channel, 119, %True ' frontaal blauw naar grond END IF FUNCTION = %True END FUNCTION FUNCTION MM_Aeio_On (OPTIONAL BYVAL Flag AS DWORD) AS DWORD LOCAL i AS LONG IF ISFALSE flag THEN Controller Aeio.channel, 66, 64 Aeio.ctrl(66) = 64 FUNCTION = %True EXIT FUNCTION END IF IF flag AND %MM_POWER THEN Controller Aeio.channel, 66, 64 END IF IF (flag AND %MM_Lights) THEN ' alles aan... FOR i = 1 TO 6 mPlay Aeio.channel, i, 127 NEXT i END IF IF (flag AND %MM_Yellow) THEN ' yellow lites mPlay Aeio.channel, 5, 127 mPlay Aeio.channel, 6, 127 END IF IF (flag AND %MM_Blue) THEN mPlay Aeio.channel, 1, 127 mPlay Aeio.channel, 4, 127 END IF IF (flag AND %MM_RED) THEN mPlay Aeio.channel, 2, 127 END IF END FUNCTION FUNCTION MM_Aeio_Off (OPTIONAL BYVAL Flag AS DWORD) AS DWORD LOCAL i AS LONG IF ISFALSE flag THEN Controller Aeio.channel, 123, %False ' all notes off, also releases all dampers ELSEIF (flag AND %MM_Power) THEN controller Aeio.channel, 66, %False ELSEIF (flag AND %MM_Lights) THEN ' all lites off FOR i = 1 TO 6 NoteOff Aeio.channel, i NEXT i ELSEIF (flag AND %MM_Yellow) THEN ' yellow lites off NoteOff Aeio.channel, 5 NoteOff Aeio.channel, 6 ELSEIF (flag AND %MM_RED) THEN ' red lites off NoteOff Aeio.channel, 2 ELSEIF (flag AND %MM_Blue) THEN NoteOff Aeio.channel, 1 NoteOff Aeio.channel, 2 NoteOff Aeio.channel, 3 END IF FUNCTION = %True END FUNCTION FUNCTION MM_Rotomoton_On (OPTIONAL BYVAL Flag AS DWORD) AS DWORD STATIC done AS DWORD LOCAL i AS LONG IF ISFALSE flag THEN Controller Rotomoton.channel, 66, %True ' beaters power IF ISFALSE done THEN Controller Rotomoton.channel, 65, %True ' motors power done = %True END IF Rotomoton.ctrl(66) = %True Rotomoton.ctrl(65) = %True ' check position flag for position calibration ' IF ISFALSE rotomoton.ctrl(81) THEN ' controller rotomoton.channel, 81, 127 ' rotomoton.ctrl(81) = 127 ' rotomoton.ctrl(101) = %False ' ELSEIF ISFALSE rotomoton.ctrl(91) THEN ' controller rotomoton.channel, 91, 127 ' rotomoton.ctrl(91) = 127 ' rotomoton.ctrl(101) = 127 ' END IF ' IF ISFALSE rotomoton.ctrl(82) THEN ' controller rotomoton.channel, 82, 127 ' rotomoton.ctrl(82) = 127 ' rotomoton.ctrl(102)= %False ' ELSEIF ISFALSE rotomoton.ctrl(92) THEN ' controller rotomoton.channel, 92, 127 ' rotomoton.ctrl(92) = 127 ' rotomoton.ctrl(102) = 127 ' END IF ' IF ISFALSE rotomoton.ctrl(83) THEN ' controller rotomoton.channel, 83, 127 ' rotomoton.ctrl(83) = 127 ' rotomoton.ctrl(103) = %False ' ELSEIF ISFALSE rotomoton.ctrl(93) THEN ' controller rotomoton.channel, 93, 127 ' rotomoton.ctrl(93) = 127 ' rotomoton.ctrl(103) = 127 ' END IF ' IF ISFALSE rotomoton.ctrl(84) THEN ' controller rotomoton.channel, 84, 127 ' rotomoton.ctrl(84) = 127 ' rotomoton.ctrl(104) = %False ' ELSEIF ISFALSE rotomoton.ctrl(94) THEN ' controller rotomoton.channel, 94, 127 ' rotomoton.ctrl(94) = 127 ' rotomoton.ctrl(104) = 127 ' END IF ' IF ISFALSE rotomoton.ctrl(85) THEN ' controller rotomoton.channel, 85, 127 ' rotomoton.ctrl(85) = 127 ' rotomoton.ctrl(105) = %False ' ELSEIF ISFALSE rotomoton.ctrl(95) THEN ' controller rotomoton.channel, 95, 127 ' rotomoton.ctrl(105) = 127 ' rotomoton.ctrl(95) = 127 ' END IF ' de hoogste positie moet ook gekalibreerd worden, maar dat moet minstens een sekonde later gebeuren... ' in de huidige kode moet dus tweemaal op rotomoton ON geklikt worden om dit te bereiken. ' Eens geinitialiseerd, gebeurt alle verder kallibratie op rotomoton automatisch door de PIC's. De positie ' in rotomoton.ctrl(101-105) wordt natuurlijk niet automatisch aangepast... ELSE IF (flag AND %MM_POWER) THEN Controller Rotomoton.channel, 66, %True ' beaters power IF ISFALSE done THEN Controller Rotomoton.channel, 65, %True ' motors power done = %True END IF Rotomoton.ctrl(66) = %True Rotomoton.ctrl(65) = %True END IF IF (flag AND %MM_Lights) THEN FOR i = 114 TO 119 mPlay rotomoton.channel, i, 127 NEXT i END IF IF (flag AND %MM_White) THEN FOR i = 114 TO 115 ' heavy lights mPlay rotomoton.channel, i, 127 NEXT i END IF IF (flag AND %MM_Blue) THEN ' frontal blue led spots FOR i = 116 TO 117 ' expandable to note 119 later. mPlay rotomoton.channel, i, 127 NEXT i END IF END IF END FUNCTION FUNCTION MM_Rotomoton_Off (OPTIONAL BYVAL flag AS DWORD) AS DWORD LOCAL i AS LONG IF ISFALSE flag THEN Controller Rotomoton.channel, 123, %False FOR i = 114 TO 119 Noteoff rotomoton.channel, i ' lampjes uit NEXT i Controller Rotomoton.channel, 66, %False ' beaters power 'Controller Rotomoton.channel, 65, %False ' motors power - would recalibrate Rotomoton.ctrl(66) = %False 'Rotomoton.ctrl(65) = %False ELSE IF (flag AND %MM_POWER) THEN Controller Rotomoton.channel, 66, %False ' beaters power 'Controller Rotomoton.channel, 65, %False ' motors power Rotomoton.ctrl(66) = %False 'Rotomoton.ctrl(65) = %False END IF IF (flag AND %MM_MOTOR) THEN ' Controller Rotomoton.channel, 65, %False ' motors power ' Rotomoton.ctrl(65) = %False END IF IF (flag AND %MM_Lights) THEN FOR i = 114 TO 119 Noteoff rotomoton.channel, i NEXT i END IF IF (flag AND %MM_White) THEN FOR i = 114 TO 115 ' heavy car lights Noteoff rotomoton.channel, i NEXT i END IF IF (flag AND %MM_Blue) THEN ' frontal led spots FOR i = 116 TO 117 Noteoff rotomoton.channel, i NEXT i END IF END IF END FUNCTION FUNCTION MM_Llor_On (OPTIONAL BYVAL flag AS DWORD) AS DWORD LOCAL i AS INTEGER ' lites only IF ISFALSE flag OR (flag AND %MM_Lights) THEN FOR i = 1 TO 5 mPlay Llor.channel, i, %True Llor.ctrl(i) = %True NEXT i END IF END FUNCTION FUNCTION MM_Llor_Off (OPTIONAL BYVAL flag AS DWORD) AS DWORD LOCAL i AS INTEGER IF ISFALSE flag THEN ' more a reset than a notes off, since there are no held notes here. Controller Llor.channel, 123, %False ' a release of the bidirectional beaters can be given with: FOR i = 36 TO 43 Release Llor.channel, i, 127 NEXT i ELSE IF (flag AND %MM_Lights)OR (flag AND %MM_Blue) THEN ' we can use the flags to switch off the lights. FOR i = 1 TO 5 mPlay Llor.channel, i, %False Llor.ctrl(i) = %False NEXT i END IF END IF END FUNCTION 'moved to g_midi.inc. so we can use it in the mPlayer.. 'FUNCTION mPlayLlor (BYVAL n AS SINGLE, BYVAL v AS DWORD, BYVAL dev AS SINGLE) EXPORT AS DWORD ' ' returns the midi note command for Llor if the note could be mPlayed, if not, returns False ' ' dev is the amount of allowable deviation in cents. ' ' we have a similar function for Vacca since 17.07.2005 ' ' when we rebuild belly, a similar function for it will be required as well. ' LOCAL i AS DWORD ' LOCAL j AS DWORD ' LOCAL note1 AS INTEGER ' LOCAL dif AS SINGLE ' LOCAL mindif AS SINGLE ' STATIC tog AS DWORD ' STATIC LlorSpec() AS LlorSpectype ' IF ISFALSE tog THEN ' DIM LlorSpec(12) AS STATIC Llorspectype ' FOR i = 1 TO 12 ' LlorSpec(i).midi = 35 + i ' LlorSpec(i).splitpoint = 30 ' mag nooit nul zijn, noch 127 ! ' NEXT i ' ' data for the 12 bells: ' LlorSpec(1).Spek(0) = 64.43 ' LlorSpec(1).Spek(1) = 54.19 ' LlorSpec(1).Spek(2) = 70.97 ' LlorSpec(1).Spek(3) = 75.81 ' LlorSpec(1).Spek(4) = 79.78 ' LlorSpec(2).Spek(0) = 53.72 ' LlorSpec(2).Spek(1) = 70.61 ' LlorSpec(2).Spek(2) = 63.65 ' LlorSpec(2).Spek(3) = 75.99 ' LlorSpec(2).Spek(4) = 36.42 ' LlorSpec(3).Spek(0) = 59.96 ' LlorSpec(3).Spek(1) = 70.29 ' LlorSpec(3).Spek(2) = 41.33 ' LlorSpec(3).Spek(3) = 60.02 ' LlorSpec(3).Spek(4) = 60.16 ' LlorSpec(4).Spek(0) = 64.99 ' LlorSpec(4).Spek(1) = 65.09 ' LlorSpec(4).Spek(2) = 47.76 ' LlorSpec(4).Spek(3) = 80.62 ' LlorSpec(4).Spek(4) = 74.60 ' LlorSpec(5).Spek(0) = 44.68 ' 40 ' LlorSpec(5).Spek(1) = 72.25 ' LlorSpec(5).Spek(2) = 78.76 ' LlorSpec(5).Spek(3) = 74.40 ' LlorSpec(5).Spek(4) = 0 ' LlorSpec(6).Spek(0) = 68.80 ' 41 ' LlorSpec(6).Spek(1) = 51.91 ' LlorSpec(6).Spek(2) = 79.02 ' LlorSpec(6).Spek(3) = 0 ' LlorSpec(6).Spek(4) = 0 ' LlorSpec(7).Spek(0) = 52.84 ' 42 ' LlorSpec(7).Spek(1) = 70.40 ' LlorSpec(7).Spek(2) = 75.83 ' LlorSpec(7).Spek(3) = 64.79 ' LlorSpec(7).Spek(4) = 0 ' LlorSpec(8).Spek(0) = 58.22 ' 43 ' LlorSpec(8).Spek(1) = 76.31 ' LlorSpec(8).Spek(2) = 0 ' LlorSpec(8).Spek(3) = 0 ' LlorSpec(8).Spek(4) = 0 ' LlorSpec(9).Spek(0) = 64.02 ' 44 ' LlorSpec(9).Spek(1) = 82.01 ' LlorSpec(9).Spek(2) = 48.93 ' LlorSpec(9).Spek(3) = 68.24 ' LlorSpec(9).Spek(4) = 92.59 ' LlorSpec(10).Spek(0) = 70.07 ' 45 ' LlorSpec(10).Spek(1) = 87.85 ' LlorSpec(10).Spek(2) = 0 ' LlorSpec(10).Spek(3) = 0 ' LlorSpec(10).Spek(4) = 0 ' LlorSpec(11).Spek(0) = 72.86 ' 46 ' LlorSpec(11).Spek(1) = 79.02 ' LlorSpec(11).Spek(2) = 0 ' LlorSpec(11).Spek(3) = 0 ' LlorSpec(11).Spek(4) = 0 ' LlorSpec(12).Spek(0) = 79.11 ' 47 ' LlorSpec(12).Spek(1) = 0 ' LlorSpec(12).Spek(2) = 0 ' LlorSpec(12).Spek(3) = 0 ' LlorSpec(12).Spek(4) = 0 ' tog = %True ' END IF ' dev = dev /100! ' make dev. fractional ' ' first we scan for the best match, we scan the strongest spectral components of each bell: ' i = 1 ' mindif= 10000.0 ' DO ' j = 0 ' DO ' dif = ABS(n-LlorSpec(i).Spek(j)) ' IF dif < mindif THEN mindif = dif : note1 = i ' INCR j ' LOOP UNTIL j > 4 ' INCR i ' LOOP UNTIL i > 12 ' ' check this against the tollerance: ' IF mindif =< dev THEN ' IF v < LlorSpec(note1).Splitpoint THEN ' mPlay Llor.channel, note1 + 12, v * (127.0/ LlorSpec(note1).Splitpoint) ' FUNCTION = note1 + 12 ' ELSE ' mPlay Llor.channel, note1, v ' also needs rescaling. ' FUNCTION = note1 ' END IF ' ELSE ' FUNCTION = %False ' END IF 'END FUNCTION FUNCTION MM_Ake_Off (OPTIONAL BYVAL flag AS DWORD) AS DWORD ' updated gwr 19.06.2009 / 10.01.2010 IF ISFALSE flag THEN ModeMess Ake.channel, &H7B, 0 ' all notes off Ake.Har(1).vel = NUL$(128) Ake.ctrl(66) = %False Controller Ake.channel, 66, Ake.ctrl(66) ' motor controller OFF ELSE IF (flag AND %MM_Notes) THEN Controller Ake.channel, &H7B, 0 ' should work - notes and lites Ake.Har(1).vel = NUL$(128) END IF IF (Flag AND %MM_Valve) THEN Controller Ake.channel, 7, 0 ' valve in central position Ake.ctrl(7) = 0 '64 END IF IF (Flag AND %MM_Motor) OR (Flag AND %MM_Wind) THEN Ake.ctrl(66) = %False Controller Ake.channel, 66, Ake.ctrl(66) 'Controller Ake.channel, 1, 0 ' motor off (minimum speed) 'Ake.ctrl(1) = %False END IF IF (Flag AND %MM_Lights) THEN mPlay Ake.channel, 120, %False : Ake.ctrl(120) = %False mPlay Ake.channel, 121, %False : Ake.ctrl(121) = %False mPlay Ake.channel, 122, %False : Ake.ctrl(122) = %False mPlay Ake.channel, 123, %False : Ake.ctrl(123) = %False END IF IF (flag AND %MM_WHITE) THEN mPlay Ake.channel, 120, %False : Ake.ctrl(120) = %False mPlay Ake.channel, 121, %False : Ake.ctrl(121) = %False END IF IF (flag AND %MM_Blue) THEN mPlay Ake.channel, 122, %False : Ake.ctrl(122) = %False mPlay Ake.channel, 123, %False : Ake.ctrl(123) = %False END IF END IF FUNCTION = %True END FUNCTION FUNCTION MM_Ake_On (OPTIONAL BYVAL flag AS DWORD) AS DWORD ' updated 19.06.2009 gwr / 10.01.2010 IF ISFALSE flag THEN Ake.ctrl(66) = 1 '27 controller Ake.channel, 66, Ake.ctrl(66) controller Ake.channel, 1, %MM_Ake_Motor Ake.ctrl(1) = %MM_Ake_Motor ' Ake.ctrl(6) = %False ' set suction wind ??? ' Controller Ake.channel, 6, ake.ctrl(6) Ake.ctrl(7) = 120 '20 ' maximum absolute pressure Controller Ake.channel, 7, ake.ctrl(7) ' was: ' ake.ctrl(7) = %False ' suction on maximum ' Controller Ake.channel, 7, ake.ctrl(7) ELSE IF (Flag AND %MM_Valve) THEN Ake.ctrl(6) = %False Controller Ake.channel, 6, ake.ctrl(6) Ake.ctrl(7) = 20 '127 '%False ' suck Controller Ake.channel, 7, Ake.ctrl(7) END IF IF (Flag AND %MM_WIND) THEN 'IF ISFALSE ake.ctrl(66) THEN ake.ctrl(66) = 1 Controller ake.channel, 66, 1 'END IF Ake.ctrl(1) = %MM_Ake_Motor Controller Ake.channel, 1, Ake.ctrl(1) END IF IF (Flag AND %MM_Lights) THEN mPlay Ake.channel, 120, 127 mPlay Ake.channel, 121, 127 mPlay Ake.channel, 122, 127 mPlay Ake.channel, 123, 127 Ake.ctrl(120) = 127 Ake.ctrl(121) = 127 Ake.ctrl(122) = 127 Ake.ctrl(123) = 127 END IF IF (Flag AND %MM_Blue)THEN mPlay Ake.channel, 122, 127 : Ake.ctrl(122) = 127 mPlay Ake.channel, 123, 127 : Ake.ctrl(123) = 127 END IF IF (Flag AND %MM_WHITE) THEN mPlay Ake.channel, 120, 127 : Ake.ctrl(120) = 127 mPlay Ake.channel, 121, 127 : Ake.ctrl(121) = 127 END IF END IF FUNCTION = %True END FUNCTION FUNCTION MM_Humanola_Off (OPTIONAL BYVAL flag AS DWORD) AS DWORD LOCAL n AS BYTE LOCAL i AS BYTE IF ISFALSE flag THEN controller Humanola.channel, 123, %False ' all notes off Controller Humanola.channel, 10, 0 Controller Humanola.channel, 11, 0 ELSE IF (flag AND %MM_Motor) OR (flag AND %MM_Wind) THEN ' motor off Humanola.ctrl(7) = %False Controller Humanola.channel, 7, %False Controller Humanola.channel, 10, 0 'tremulant af Controller Humanola.channel, 11, 0 END IF IF (flag AND %MM_Notes) THEN Controller Humanola.channel, 123, %False Humanola.Har(1).vel = NUL$(128) END IF IF (flag AND %MM_Lights) THEN FOR i = 92 TO 96 NoteOff Humanola.channel, i NEXT i END IF END IF FUNCTION = %True END FUNCTION FUNCTION MM_Humanola_On (OPTIONAL BYVAL flag AS DWORD) AS DWORD LOCAL i AS BYTE IF ISFALSE flag THEN ' motor on Humanola.ctrl(7) = %MM_Humanola_Motor Controller Humanola.channel, 7, %MM_Humanola_Motor ELSE IF (flag AND %MM_Wind) THEN ' motor on Humanola.ctrl(7) = %MM_Humanola_Motor '89 Controller Humanola.channel, 7, %MM_Humanola_Motor END IF IF (flag AND %MM_Lights) OR (flag AND %MM_YELLOW) THEN FOR i = 92 TO 96 mPlay Humanola.channel, i, 127 NEXT i END IF END IF FUNCTION = %True END FUNCTION FUNCTION MM_Krum_Off (OPTIONAL BYVAL flag AS DWORD) AS DWORD LOCAL n AS BYTE LOCAL i AS BYTE IF ISFALSE flag THEN controller krum.channel, 123, %False ' all notes off controller krum.channel, 7, 0 ELSE IF (flag AND %MM_Motor) THEN ' motor off Krum.ctrl(66) = 0 Controller Krum.channel, 66, 0 END IF IF (flag AND %MM_Wind) THEN krum.ctrl(7) = %False Controller krum.channel, 7, %False krum.ctrl(1) = %False ' klep dicht Controller Krum.channel, 1, %False Controller Krum.channel, 12, %False ' disactivate coil windings END IF IF (flag AND %MM_Notes) THEN Controller krum.channel, 123, %False krum.Har(1).vel = NUL$(128) END IF IF (flag AND %MM_Lights) THEN 'FOR i = 92 TO 99 ' NoteOff krum.channel, i 'NEXT i Noteoff krum.channel, 100 NoteOff krum.channel, 101 NoteOff krum.channel, 102 END IF END IF FUNCTION = %True END FUNCTION FUNCTION MM_Krum_On (OPTIONAL BYVAL flag AS DWORD) AS DWORD LOCAL i AS BYTE IF ISFALSE flag THEN ' motor on Krum.ctrl(7) = %MM_Krum_Motor Controller Krum.channel, 7, %MM_Krum_Motor Controller Krum.channel, 66, 127 ' motor on Krum.ctrl(66) = 127 ELSE IF (flag AND %MM_Motor) THEN ' motor on Krum.ctrl(66) = 127 Controller Krum.channel, 66, 127 END IF IF (flag AND (%MM_Wind)) THEN Krum.ctrl(7) = %MM_Krum_Motor '127 Controller Krum.channel, 7, %MM_Krum_Motor END IF IF (flag AND %MM_Lights) THEN ' FOR i = 92 TO 99 ' mPlay Krum.channel, i, 127 ' NEXT i mPlay Krum.channel, 100, 127 mPlay Krum.channel, 101, 127 mPlay Krum.channel, 102, 127 END IF END IF FUNCTION = %True END FUNCTION FUNCTION MM_Vibi_Off (OPTIONAL BYVAL flag AS DWORD) AS DWORD IF ISFALSE flag THEN Controller Vibi.channel, 123, %False Controller Vibi.channel, &H40, %False ' no sustain, so damping will work again Controller Vibi.channel, 24, %False ' automatic damping enabled. Controller Vibi.channel, 23, 84 ' default damping value Vibi.ctrl(23) = 84 Controller Vibi.channel, 66, %False RESET Vibi.ctrl(20), Vibi.ctrl(21), Vibi.ctrl(22), Vibi.ctrl(66), Vibi.ctrl(64), Vibi.ctrl(24), Vibi.ctrl(7) Controller Vibi.channel, 7, %False ELSE IF (flag AND %MM_Motor) THEN Controller Vibi.channel, 22, 0 RESET Vibi.ctrl(20), Vibi.ctrl(21), Vibi.ctrl(22) END IF IF (flag AND %MM_Power) THEN Controller Vibi.channel, 66, 0 RESET Vibi.ctrl(66) END IF IF (flag AND %MM_Lights) THEN NoteOff Vibi.channel, 120 NoteOff Vibi.channel, 121 NoteOff Vibi.channel, 122 NoteOff Vibi.channel, 123 END IF IF (flag AND %MM_Yellow) THEN NoteOff Vibi.channel, 122 END IF IF (flag AND %MM_White) THEN NoteOff Vibi.channel, 123 NoteOff Vibi.channel, 121 END IF IF (flag AND %MM_Red) THEN NoteOff Vibi.channel, 120 END IF END IF FUNCTION = %True END FUNCTION FUNCTION MM_Vibi_On (OPTIONAL BYVAL flag AS DWORD) AS DWORD 'updated 25.11.2010 IF ISFALSE flag THEN Controller Vibi.channel, 66, 127 Vibi.ctrl(66) = %True SLEEP 10 Controller Vibi.channel, 64, 0 ' sustain OFF Controller Vibi.channel, 24, 1 ' in huidige implementatie - zou normaal 0 moeten zijn - was %False ' damping mode - do not use note off + release Controller Vibi.channel, 23, 84 ' set damping force to default value Vibi.ctrl(64) = %False Vibi.ctrl(24) = 1' %False Vibi.ctrl(23) = 84 Controller Vibi.channel, 7, 127 'valves opened. ELSE IF (flag AND %MM_Power) THEN Controller Vibi.channel, 66, 127 Vibi.ctrl(66) = %True END IF IF (flag AND %MM_Lights) THEN mPlay Vibi.channel, 120, 127 'backside red mPlay Vibi.channel, 121, 127 'frontlite white mPlay Vibi.channel, 122, 127 'yellow mPlay Vibi.channel, 123, 127 'backlite white END IF IF (flag AND %MM_Yellow ) THEN mPlay Vibi.channel, 122, 127 END IF IF (flag AND %MM_White) THEN mPlay Vibi.channel, 123, 127 mPlay Vibi.channel, 121, 127 END IF IF (flag AND %MM_Red) THEN mPlay Vibi.channel, 120, 127 END IF END IF FUNCTION = %True END FUNCTION FUNCTION MM_AutoSax_Off (OPTIONAL BYVAL flag AS DWORD) AS DWORD ' new version 18.06.2010 LOCAL i AS INTEGER IF ISFALSE flag THEN Controller Autosax.channel, 123, 0 ELSE IF (flag AND (%MM_MOTOR)) THEN Controller Autosax.channel, 66, %False Autosax.ctrl(66)= %False END IF IF (flag AND (%MM_POWER)) THEN Controller Autosax.channel, 65, %False autosax.ctrl(65) = %False END IF ' IF (flag AND (%MM_Wind)) THEN ' Autosax.ctrl(1) = %False ' Controller Autosax.channel, 1, %False ' END IF IF (flag AND (%MM_Notes)) THEN Controller Autosax.channel, 123, 0 END IF IF (flag AND %MM_Lights) THEN FOR i = 121 TO 127 NoteOff Autosax.channel, i NEXT i END IF IF (flag AND %MM_Blue) THEN Noteoff Autosax.channel, 121 Noteoff Autosax.channel, 122 END IF IF (flag AND %MM_Yellow) THEN Noteoff Autosax.channel, 127 Noteoff Autosax.channel, 123 Noteoff Autosax.channel, 124 END IF IF (flag AND %MM_Red) THEN Noteoff Autosax.channel, 125 Noteoff Autosax.channel, 126 END IF END IF FUNCTION = %True END FUNCTION FUNCTION MM_AutoSax_On (OPTIONAL BYVAL flag AS DWORD) AS DWORD ' new version 18.06.2010 LOCAL i AS INTEGER IF ISFALSE flag THEN Controller Autosax.channel, 65, 127 ' klepspanning Controller Autosax.channel, 66, 127 ' dsPIC generator Controller Autosax.channel, 7, 100 ' optor Controller Autosax.channel, 8, %False Controller Autosax.channel, 17, 100 'dyna range Controller Autosax.channel, 18, 110 'hold Controller Autosax.channel, 19, 100 'release 'to add: reset tuning and pitch bend... ELSE IF (flag AND (%MM_MOTOR)) THEN Controller Autosax.channel, 66, 127 Autosax.ctrl(66)= %True END IF IF (flag AND (%MM_POWER)) THEN Controller Autosax.channel, 65, 127 autosax.ctrl(65) = %True END IF ' IF (flag AND (%MM_Wind)) THEN ' Autosax.ctrl(1) = %MM_Autosax_Motor ' Controller Autosax.channel, 1, %MM_Autosax_Motor ' END IF IF (flag AND %MM_Lights) THEN FOR i = 0 TO 6 mPlay Autosax.channel, 121 + i, 127 NEXT i END IF IF (flag AND %MM_blue) THEN mPlay autosax.channel, 121,127 mPlay autosax.channel, 122, 127 END IF IF (flag AND %MM_Yellow) THEN mPlay autosax.channel, 127, 127 ' orange frontal mPlay autosax.channel, 123, 127 ' yellow led strips mPlay autosax.channel, 124, 127 END IF IF (Flag AND %MM_Red) THEN mPlay Autosax.channel, 125, 127 'not yet mounted mPlay Autosax.channel, 126, 127 END IF END IF FUNCTION = %True END FUNCTION FUNCTION MM_ThunderWood_Off (OPTIONAL BYVAL flag AS DWORD) AS DWORD LOCAL i AS LONG IF ISFALSE flag THEN Controller Thunderwood.channel, 123, %False 'AllNotesOff Thunderwood.channel 'ctrl 123 NoteOff Thunderwood.channel, 24 ' storm must be off at any price NoteOff Thunderwood.channel, 15 ' ratchet ELSE IF (flag AND %MM_Notes) OR (flag AND %MM_Motor) THEN 'wind en storm af - beschouwen we dit als noten of motors? - maar beide voorzien Controller Thunderwood.channel, 123, %False mPlay Thunderwood.channel, 24, 0 mPlay Thunderwood.channel, 25, 0 NoteOff Thunderwood.channel, 15 ' ratchet END IF IF (flag AND %MM_Lights) THEN 'bliksem en zwaailicht mPlay Thunderwood.channel, 0, 0 Controller ThunderWood.channel, 70, %False FOR i = 120 TO 125 NoteOff Thunderwood.channel, i NEXT i END IF IF (flag AND %MM_Green) THEN NoteOff Thunderwood.channel, 120 END IF IF (flag AND %MM_Red) THEN NoteOff Thunderwood.channel, 121 END IF IF (flag AND %MM_Yellow) THEN NoteOff Thunderwood.channel, 122 END IF IF (flag AND %MM_Blue) THEN NoteOff Thunderwood.channel, 125 END IF IF (flag AND %MM_Power) THEN Controller Thunderwood.channel, 66, 0 Controller Thunderwood.channel, 123, 0 END IF END IF FUNCTION = %TRue END FUNCTION FUNCTION MM_Thunderwood_On (OPT BYVAL flag AS DWORD) AS DWORD Controller Thunderwood.channel, 66, 127 IF flag THEN IF (flag AND %MM_Lights) THEN mPlay ThunderWood.channel, 0, 127 Controller ThunderWood.channel, 70, 48 ThunderWood.ctrl(70) = 48 mPlay Thunderwood.channel, 120, 127 'green mPlay Thunderwood.channel, 121, 127 'red mPlay Thunderwood.channel, 122, 127 'yellow mPlay Thunderwood.channel, 123, 127 ' amber ' 124 not mounted yet, but implemented on the PIC mPlay Thunderwood.channel, 125, 127 'blue END IF IF (flag AND %MM_Red) THEN mPlay Thunderwood.channel, 121, 127 END IF IF (flag AND %MM_Green) THEN mPlay Thunderwood.channel, 120, 127 END IF IF (flag AND %MM_Yellow) THEN mPlay Thunderwood.channel, 122, 127 END IF IF (flag AND %MM_Blue) THEN mPlay Thunderwood.channel, 125, 127 END IF END IF FUNCTION = %True END FUNCTION FUNCTION MM_Springers_On (OPTIONAL BYVAL flag AS DWORD) AS DWORD IF (flag AND %MM_Lights) OR (flag AND %MM_Blue) THEN Controller Springers.channel, 70, 64 Springers.ctrl(70) = 64 END IF FUNCTION = %True END FUNCTION FUNCTION MM_Psch_On(OPT BYVAL flag AS DWORD) AS DWORD IF (flag AND %MM_Lights) THEN mPlay Psch.channel, 84, 127 mPlay Psch.channel, 85, 127 mPlay Psch.channel, 86, 127 mPlay Psch.channel, 87, 127 END IF END FUNCTION FUNCTION MM_Psch_Off(OPT BYVAL flag AS DWORD) AS DWORD IF ISFALSE(flag) OR (flag AND %MM_Lights) THEN mPlay Psch.channel, 84, 0 mPlay Psch.channel, 85, 0 mPlay Psch.channel, 86, 0 mPlay Psch.channel, 87, 0 END IF END FUNCTION FUNCTION MM_Springers_Off (OPTIONAL BYVAL flag AS DWORD) AS DWORD NoteOff Springers.channel, 1 ' sic in Amorgos. - sirene (old mapping) ' = Bend Springers.channel, 0,0 NoteOff Springers.channel, 2 ' police light - old mapping 'InstrumAllNotesOff Springers Controller Springers.channel, 123, %False Springers.ctrl(70) = %False FUNCTION = %True END FUNCTION FUNCTION MM_So_Off (OPTIONAL BYVAL flag AS DWORD) AS DWORD IF ISFALSE(flag) THEN So.ctrl(1) = 0 Controller So.channel, 1, So.ctrl(1) Controller So.channel, 123, 0 Noteoff So.channel, 49 NoteOff So.channel, 50 NoteOff So.channel, 51 'hier ook de default lookup kiezen (Ctrl 13) en bend resetten? ELSE IF (flag AND %MM_Power) THEN ProgChange So.channel, %False Controller So.channel, 123, %False Controller So.channel, 66, %False So.ctrl(66) = %False END IF IF (Flag AND %MM_Wind) THEN So.ctrl(1) = %False Controller So.channel, 1, so.ctrl(1) END IF IF (Flag AND %MM_Motor) THEN So.ctrl(1) = %False Controller So.channel, 1, so.ctrl(1) END IF IF (flag AND %MM_Notes) THEN Controller So.channel, 123, 0 END IF IF (flag AND %MM_Lights) THEN Noteoff So.channel, 49 NoteOff So.channel, 50 ' we leave logos dismPlay on END IF IF (flag AND %MM_White) THEN NoteOff So.channel, 50 END IF IF (flag AND %MM_Red) THEN NoteOff So.channel, 49 END IF END IF FUNCTION = %True END FUNCTION FUNCTION MM_So_On (OPTIONAL BYVAL flag AS DWORD) AS DWORD ' version 2007 IF ISFALSE flag THEN Controller So.channel, 66, 127 So.ctrl(66) = 127 So.ctrl(1) = %MM_So_Motor ' now 50 Controller So.channel, 1, So.ctrl(1) mPlay So.channel, 51, 127 ' logos dismPlay on Controller So.channel, 18, 64 ' attack duration (default value) So.ctrl(18) = 64 Controller So.channel, 14, %False ' dismPlay midi notes So.ctrl(14) = %False Controller So.channel, 13, %False ' default valve lookup table - empirical So.ctrl(13) = %False Controller So.channel, 7, 80 ' volume controller So.ctrl(7) = 80 Bend So.channel, 0, 64 ' reset pichbend So.ctrl(20) = %False ' tuning 440Hz Controller So.channel, 20, %False Progchange So.channel, %False ' default startup mode ELSE 'note: no flag for controller 7.. IF (flag AND %MM_Motor) THEN So.ctrl(66)= 127 Controller So.channel, 66, 127 ' So.ctrl(1) = %MM_So_Motor ' Controller So.channel, 1, So.ctrl(1) END IF IF (flag AND %MM_Wind) THEN ' this will override and contradict the program change! So.ctrl(66)= 127 Controller So.channel, 66, 127 So.ctrl(1) = %MM_So_Motor Controller So.channel, 1, So.ctrl(1) END IF IF (flag AND %MM_Lights) THEN mPlay So.channel, 49,127 mPlay So.channel, 50,127 mPlay So.channel, 51, 127 END IF IF (flag AND %MM_White) THEN mPlay So.channel, 50, 127 END IF IF (flag AND %MM_Red) THEN mPlay So.channel, 49, 127 mPlay So.channel, 51, 127 END IF END IF FUNCTION = %True END FUNCTION FUNCTION MM_Bono_Off (OPTIONAL BYVAL flag AS DWORD) AS DWORD LOCAL i AS LONG IF ISFALSE(flag) THEN Controller Bono.channel, 123, 0 Controller Bono.channel, 66, %False Bend Bono.channel, 0, 64 Bono.ctrl(66) = %False ProgChange Bono.channel, 0 'default valve lookup ELSE IF (flag AND %MM_Power) THEN ProgChange Bono.channel, %False Controller Bono.channel, 123, %False Controller Bono.channel, 66, %False Bono.ctrl(66) = %False END IF IF (flag AND %MM_Notes) THEN Controller Bono.channel, 123, 0 'also does lites... END IF IF (flag AND %MM_Lights) THEN FOR i = 0 TO 5 NoteOff Bono.channel, 120 + i NEXT i END IF IF (Flag AND %MM_Yellow) THEN NoteOff Bono.channel, 120 NoteOff Bono.channel, 121 Noteoff Bono.channel, 122 NoteOff Bono.channel, 123 END IF IF (Flag AND %MM_White) THEN NoteOff Bono.channel, 125 END IF END IF FUNCTION = %True END FUNCTION FUNCTION MM_Bono_On (OPTIONAL BYVAL flag AS DWORD) AS DWORD LOCAL i AS LONG IF ISFALSE flag THEN Controller Bono.channel, 66, 127 Bono.ctrl(66) = 127 Controller Bono.channel, 18, 100 ' attack duration (default value) Bono.ctrl(18) = 64 Controller Bono.channel, 7, 127 ' volume controller Bono.ctrl(7) = 127 Bend Bono.channel, 0, 64 ' reset pichbend Bono.ctrl(20) = %False ' tuning 440Hz Controller Bono.channel, 20, 0 Controller Bono.channel, 17, 100 ' attack level Bono.ctrl(17) =100 Progchange Bono.channel, %False ' default startup mode ELSE IF (flag AND %MM_Lights) THEN FOR i = 0 TO 5 mPlay Bono.channel, 120 + i , 127 NEXT i END IF IF (flag AND %MM_White) THEN mPlay Bono.channel, 125, 127 ' white led spotlite 3W END IF IF (flag AND %MM_Red) THEN ' niks END IF IF (flag AND %MM_Yellow) THEN mPlay Bono.channel, 120, 127 mPlay Bono.channel, 121, 127 mPlay Bono.channel, 122, 127 mPlay Bono.channel, 123, 127 END IF END IF FUNCTION = %True END FUNCTION FUNCTION MM_Korn_On (OPT BYVAL flag AS DWORD) AS DWORD IF ISFALSE flag THEN Controller Korn.channel, 123, %False Korn.ctrl(13) = 0 'ventiel mapping = default 0 Controller Korn.channel, 13, Korn.ctrl(13) Korn.ctrl(17) = 100 'amplitudebegrenzing Controller Korn.channel,17 , Korn.ctrl(17) Korn.ctrl(18) = 105 'attack duration - default?? Controller Korn.channel, 18, Korn.ctrl(18) Korn.ctrl(20) = 0 ' tuning Controller Korn.channel, 20, Korn.ctrl(20) Korn.ctrl(25) = 22 ' duration of the velo pulse applied to outputs 5,6,7. ' Default setting on cold start: 64 Bend Korn.channel, 0, 64 ELSEIF (flag AND %MM_Power) THEN ' Controller Korn.channel, 70, 1 'callibrate vertical and horizontal movement - implemented ELSEIF (flag AND %MM_Lights) THEN mPlay Korn.channel, 121, 127 mPlay Korn.channel, 122, 127 mPlay Korn.channel, 123, 127 mPlay Korn.channel, 124, 1 mPlay Korn.channel, 125, 1 mPlay Korn.channel, 126, 1 mPlay Korn.channel, 127, 1 ELSEIF (flag AND %MM_White) THEN mPlay Korn.channel, 127,1 mPlay Korn.channel, 126,1 ELSEIF (flag AND %MM_Yellow) THEN mPlay Korn.channel, 124,1 ' tungsten filament bulb. , now rather white... ELSEIF (flag AND %MM_Blue) THEN mPlay Korn.channel, 125, 1 ' 1W led - blue led assembly mPlay Korn.channel, 121, 127 mPlay Korn.channel, 122, 127 ELSEIF (flag AND %MM_Red) THEN mPlay Korn.channel, 123, 127 END IF FUNCTION = %true END FUNCTION FUNCTION MM_Korn_Off (OPT BYVAL flag AS DWORD) AS DWORD IF ISFALSE(flag) THEN Controller Korn.channel, 123, %False Bend Korn.channel, 0, 64 ELSEIF (flag AND %MM_Power) THEN Controller Korn.channel, 123, %False ELSEIF (flag AND %MM_Notes) THEN Controller Korn.channel, 123, %False ELSEIF (flag AND %MM_Lights) THEN NoteOff Korn.channel, 121 NoteOff Korn.channel, 122 NoteOff Korn.channel, 123 mPlay Korn.channel, 124, 0 mPlay Korn.channel, 125, 0 mPlay Korn.channel, 126, 0 mPlay Korn.channel, 127, 0 ELSEIF (flag AND %MM_White) THEN mPlay Korn.channel, 127, 0 mPlay Korn.channel, 126, 0 ELSEIF (flag AND %MM_Yellow) THEN mPlay Korn.channel, 124, 0 ELSEIF (flag AND %MM_Blue) THEN NoteOff Korn.channel, 121 NoteOff Korn.channel, 122 NoteOff Korn.channel, 125 ELSEIF (flag AND %MM_Red) THEN NoteOff Korn.channel, 123 END IF END FUNCTION FUNCTION MM_Bourdonola_Off (OPTIONAL BYVAL flag AS DWORD) AS DWORD LOCAL n AS BYTE ' 05.01.2005 IF ISFALSE flag THEN ' all notes/ lights off - motor off Controller Bourdonola.channel, 123, 0 Bourdonola.Har(0).vel = Bourdonola.Har(1).vel Bourdonola.Har(1).vel = NUL$(128) ' 'removed 20051107 motor Off ! ' ' we only want to put of wind here - to stop the motor completely use MM_Motor flag! ' Controller Bourdonola.channel, 66, 0 ' motor ON/OFF switch ' Bourdonola.ctrl(66) = 0 Bourdonola.ctrl(1) = 0 Controller Bourdonola.channel, 1, 0 ' we do not change the motor frequency here! ELSE IF (flag AND %MM_Motor) THEN Controller Bourdonola.channel,66, 0 Bourdonola.ctrl(66) = 0 END IF IF (flag AND %MM_Wind) THEN Controller Bourdonola.channel, 1, %False ' motor speed uses controller nr. 1 Bourdonola.ctrl(1) = %False END IF IF (flag AND %MM_Lights) THEN FOR n = 32 TO 35 NoteOff Bourdonola.channel, n Bourdonola.ctrl(n) = %False NEXT i END IF IF (flag AND %MM_Notes) THEN ' will also switch the lights off Controller Bourdonola.channel, 123, 0 Bourdonola.Har(0).vel = Bourdonola.Har(1).vel Bourdonola.Har(1).vel = NUL$(128) END IF IF (flag AND %MM_YELLOW) THEN mPlay Bourdonola.channel, 32, 0 ' oranje licht tussen de pijpen END IF IF (flag AND %MM_WHITE) THEN mPlay Bourdonola.channel, 33, 0 mPlay Bourdonola.channel, 34, 0 ' wit op frontale rij pijpen END IF IF (flag AND %MM_RED) THEN mPlay Bourdonola.channel, 35, 0 ' rood boven elektronika END IF END IF FUNCTION = %True END FUNCTION FUNCTION MM_Bourdonola_On (OPTIONAL BYVAL flag AS DWORD) AS DWORD ' new 05.01.2005 LOCAL i AS BYTE IF ISFALSE flag THEN ' motor On ! Controller Bourdonola.channel, 66, 127 ' motor ON/OFF switch Bourdonola.ctrl(66) = 127 ' wind on: Controller Bourdonola.channel, 1, %MM_Bourdonola_Motor ' optimum value for 50Hz Bourdonola.ctrl(1) = %MM_Bourdonola_Motor ELSE IF (flag AND %MM_Motor) THEN 'IF ISFALSE Bourdonola.ctrl(66) THEN Controller Bourdonola.channel,66, 127 Bourdonola.ctrl(66) = 127 'ELSE ' Controller Bourdonola.channel, 66, Bourdonola.ctrl(66) 'END IF END IF IF (flag AND %MM_Wind) THEN IF ISFALSE Bourdonola.ctrl(1) THEN Controller Bourdonola.channel, 1, %MM_Bourdonola_Motor ' motor speed uses controller nr. 1 Bourdonola.ctrl(1) = %MM_Bourdonola_Motor ELSE Controller Bourdonola.channel, 1, Bourdonola.ctrl(1) END IF END IF IF (flag AND %MM_Lights) THEN FOR i = 32 TO 35 mPlay Bourdonola.channel, i, 127 Bourdonola.ctrl(i) = 127 NEXT i END IF IF (flag AND %MM_YELLOW) THEN mPlay Bourdonola.channel, 32, 127 ' oranje licht tussen de pijpen END IF IF (flag AND %MM_WHITE) THEN mPlay Bourdonola.channel, 33, 127 mPlay Bourdonola.channel, 34, 127 ' wit op frontale rij pijpen END IF IF (flag AND %MM_RED) THEN mPlay Bourdonola.channel, 35, 127 ' rood boven elektronika END IF END IF FUNCTION = %True END FUNCTION FUNCTION MM_Piperola_Off (OPTIONAL BYVAL flag AS DWORD) AS DWORD LOCAL n AS BYTE IF ISFALSE flag THEN ' does not switch off the motor... Controller Piperola.channel, 123, %False Piperola.Har(0).vel = Piperola.Har(1).vel Piperola.Har(1).vel = NUL$(128) Controller Piperola.channel, 7, %False Piperola.ctrl(7) = 0 Controller Piperola.channel, 10, %false 'tremulant af Controller Piperola.channel, 11, %false Piperola.ctrl(10) = %false Piperola.ctrl(11) = %false NoteOff Piperola.channel, 118 ' rood NoteOff Piperola.channel, 119 ' wit ' switching motor off would be: ' Controller Piperola.channel, 65, %False ELSE IF (flag AND %MM_Motor) THEN Piperola.ctrl(65) = %False Controller Piperola.channel, 10, %false 'tremulant af Controller Piperola.channel, 11, %false Controller Piperola.channel, 65, %False END IF IF (flag AND %MM_Wind) THEN Piperola.ctrl(7) = %False Controller Piperola.channel, 10, %false 'tremulant af Controller Piperola.channel, 11, %false Piperola.ctrl(10) = %false Piperola.ctrl(11) = %false Controller Piperola.channel, 7, %False END IF IF (Flag AND %MM_Notes) THEN Controller Piperola.channel, 123, %False Piperola.Har(0).vel = Piperola.Har(1).vel Piperola.Har(1).vel = NUL$(128) END IF IF (Flag AND %MM_Lights) THEN NoteOff Piperola.channel, 118 ' rood NoteOff Piperola.channel, 119 ' wit END IF IF (Flag AND %MM_Red) THEN Noteoff Piperola.channel, 118 END IF IF (flag AND %MM_White) THEN Noteoff Piperola.channel, 119 END IF END IF FUNCTION = %True END FUNCTION FUNCTION MM_Piperola_On (OPTIONAL BYVAL flag AS DWORD) AS DWORD LOCAL n AS BYTE IF ISFALSE flag THEN Piperola.ctrl(7) = %MM_Piperola_Motor Piperola.ctrl(65) = %True Controller Piperola.channel, 65, %True Controller Piperola.channel, 7, %MM_Piperola_Motor ELSE IF (flag AND %MM_Motor) THEN Controller Piperola.channel, 65, %True ' IF ISFALSE Piperola.ctrl(7) THEN '--> gebruik hiervoor %MM_Motor or %MM_Wind! ' Piperola.ctrl(7) = %MM_Piperola_Motor ' Controller Piperola.channel, 7, %MM_Piperola_Motor ' ELSE ' Controller Piperola.channel, 7, Piperola.ctrl(7) ' END IF END IF IF (flag AND %MM_Wind) THEN IF ISFALSE Piperola.ctrl(7) THEN Piperola.ctrl(7) = %MM_Piperola_Motor Controller Piperola.channel, 7, %MM_Piperola_Motor ELSE IF Piperola.ctrl(7) = 104 THEN Piperola.ctrl(7) = %MM_Piperola_Motor ' patch gwr 07.12.2007 Controller Piperola.channel, 7, Piperola.ctrl(7) END IF END IF IF (flag AND %MM_Lights) THEN mPlay Piperola.channel, 118, %True mPlay Piperola.channel, 119, %True END IF IF (flag AND %MM_Red) THEN mPlay Piperola.channel, 118, %True END IF IF (flag AND %MM_White) THEN mPlay Piperola.channel, 119, %True END IF END IF FUNCTION = %True END FUNCTION FUNCTION MM_Hurdy_Off (OPTIONAL BYVAL flag AS DWORD) AS DWORD ' tested in g_interfaces.inc IF ISFALSE flag THEN mPlay Hurdy.channel, 0, 0 ' licht mPlay Hurdy.channel, 1, 0 Hurdy.ctrl(1) = %False ' prepressure controller low string Hurdy.ctrl(2) = %False ' prepressure controller high string Modemess Hurdy.channel, 1, Hurdy.ctrl(1) Modemess Hurdy.channel, 2, Hurdy.ctrl(2) Modemess Hurdy.channel, 123, 0 ' all off - also disables e-drive IF Hurdy.ctrl(66) THEN Modemess Hurdy.channel, 66, %False ' motor off Hurdy.ctrl(66) = %False END IF KeyPress Hurdy.channel, 40, 0 ' low string bow pressure Keypress Hurdy.channel, 64, 0 ' high string bow pressure Modemess Hurdy.channel, 7, %False ' motor speed 0 Hurdy.ctrl(7) = %False EXIT FUNCTION END IF IF (flag AND %MM_Lights) OR (flag AND %MM_White) THEN mPlay Hurdy.channel, 0, %False mPlay Hurdy.channel, 1, %False END IF IF (flag AND %MM_Motor) THEN Modemess Hurdy.channel, 66, %False ' motor off Hurdy.ctrl(66) = %False END IF IF (flag AND %MM_Notes) THEN Noteoff Hurdy.channel, 40 Noteoff Hurdy.channel, 64 END IF END FUNCTION FUNCTION MM_Hurdy_On (OPTIONAL BYVAL flag AS DWORD) AS DWORD ' send tuning: Controller Hurdy.channel, 20, Hurdy.ctrl(20) ' values read on init Controller Hurdy.channel, 21, Hurdy.ctrl(21) IF (flag AND %MM_Lights) THEN mPlay Hurdy.channel, 0, 127 ' licht mPlay Hurdy.channel, 1, 127 END IF IF (flag AND %MM_Motor) THEN Controller Hurdy.channel, 66, 127 ' you should still send ctrl 7 for the speed! Hurdy.ctrl(66) = %True IF Hurdy.ctrl(7) THEN Controller Hurdy.channel, 7, Hurdy.ctrl(7) END IF END FUNCTION FUNCTION MM_Trump_Off (OPTIONAL BYVAL flag AS DWORD) AS DWORD IF ISFALSE flag THEN Modemess Trump.channel, 123, %False Trump.Har(1).vel = NUL$(128) ' motor OFF ! Controller Trump.channel, 7, %False Trump.ctrl(7) = %False ELSE IF (flag AND %MM_Motor) OR (flag AND %MM_Wind) THEN Controller Trump.channel, 7, %False Trump.ctrl(7) = %False END IF IF (flag AND %MM_Notes) THEN ModeMess Trump.channel, 123, %False Trump.Har(1).vel = NUL$(128) END IF END IF FUNCTION = %True END FUNCTION FUNCTION MM_Trump_On (OPTIONAL BYVAL flag AS DWORD) AS DWORD IF ISFALSE flag THEN ' motor On ! Controller Trump.channel, 7, %MM_Trump_Motor Trump.ctrl(7) = %MM_Trump_Motor ELSE IF (flag AND %MM_Motor) THEN IF ISFALSE Trump.ctrl(7) THEN Controller Trump.channel, 7, %MM_Trump_Motor Trump.ctrl(7) = %MM_Trump_Motor ELSE 'Controller Trump.channel, 7, Trump.ctrl(7) Controller Trump.channel, 7, %MM_Trump_Motor ' temporary patch!!! Trump.ctrl(7) = %MM_Trump_Motor END IF END IF END IF FUNCTION = %True END FUNCTION FUNCTION MM_Puff_On (OPTIONAL BYVAL flag AS DWORD) AS DWORD IF ISFALSE flag OR (flag AND %MM_Lights) THEN 'switch LED's on! - Puff eyes: mPlay Puff.channel, 121, %True '53, %True mPlay Puff.channel, 122, %True '54, %True ` 'red light: mPlay Puff.channel, 120, %True ' orange lights: mPlay Puff.channel, 104, %True mPlay Puff.channel, 105, %True ' led spots mPlay Puff.channel, 103, %True END IF IF (flag AND %MM_White) THEN mPlay Puff.channel, 121, %True 'eyes, new mapping (was 53 and 54) mPlay Puff.channel, 122, %True END IF IF (flag AND %MM_Yellow) THEN mPlay Puff.channel, 103, %True ' led spots mPlay Puff.channel, 104, %True mPlay Puff.channel, 105, %True END IF IF (flag AND %MM_Red) THEN mPlay Puff.channel, 120, %True END IF END FUNCTION FUNCTION MM_Puff_Off (OPTIONAL BYVAL flag AS DWORD) AS DWORD IF ISFALSE flag OR (flag AND %MM_Motor) THEN Controller Puff.channel, 66, %False 'disable step;ping motor Controller Puff.channel, 90, %False 'sensor system off RESET Puff.ctrl(90), Puff.ctrl(66) END IF IF ISFALSE flag OR (flag AND %MM_Lights) THEN 'switch LED's off! - Puff eyes: mPlay Puff.channel, 121, %False '53, %False mPlay Puff.channel, 122, %False '54, %False ' red: mPlay Puff.channel, 120, %False ' orange lights: mPlay Puff.channel, 104, %False mPlay Puff.channel, 105, %False ' led spots mPlay Puff.channel, 103, %False ' rotating lites: mPlay Puff.channel, 100, %False mPlay Puff.channel, 101, %False mPlay Puff.channel, 102, %False END IF IF (flag AND %MM_Yellow) THEN mPlay Puff.channel, 103, %False ' led spots mPlay Puff.channel, 104, %False mPlay Puff.channel, 105, %False END IF IF (flag AND %MM_White) THEN mPlay Puff.channel, 121, %False '53, %False mPlay Puff.channel, 122, %False '54, %False END IF IF (flag AND %MM_Red) THEN mPlay Puff.channel, 120, %False END IF END FUNCTION FUNCTION MM_Qt_On (OPTIONAL BYVAL flag AS DWORD) AS DWORD IF ISFALSE flag THEN Qt.ctrl(7) = %MM_Qt_Motor Controller Qt.channel, 7, %MM_Qt_Motor Controller Qt.channel, 66, %TRue Qt.ctrl(66) = 127 ELSE IF (flag AND %MM_Motor) THEN ' motor on Controller Qt.channel, 66, %TRue Qt.ctrl(66) = 127 END IF IF (flag AND %MM_Wind) THEN Qt.ctrl(7) = %MM_Qt_Motor Controller Qt.channel, 7, %MM_Qt_Motor END IF IF (flag AND %MM_Lights) OR (flag AND %MM_Blue) THEN mPlay Qt.channel, 35, 127 mPlay Qt.channel + 1, 35, 127 mPlay Qt.channel, 110, 127 mPlay Qt.channel, 111, 127 mPlay Qt.channel+ 1, 111, 127 Controller Qt.channel, 8, 127 ' dim lites implemented 29.07.2006 Qt.ctrl(8) = 127 mPlay Qt.channel, 120, 127 ' implemented 29.07.2006 END IF END IF FUNCTION = %True END FUNCTION FUNCTION MM_Qt_Off (OPTIONAL BYVAL flag AS DWORD) AS DWORD IF ISFALSE flag THEN controller Qt.channel, 123, %False ' all notes off Controller Qt.channel+1, 123, 0 ELSE IF (flag AND %MM_Power) THEN Controller Qt.channel, 66, %False qt.ctrl(66) = %False END IF IF (flag AND %MM_Motor) OR (flag AND %MM_Wind) THEN 'is dit zo bedoeld: %MM_Motor zet wind op 0... ' motor off Qt.ctrl(7) = %False Controller Qt.channel, 7, %False END IF IF (flag AND %MM_Notes) THEN Controller Qt.channel, 123, %False Controller Qt.channel + 1, 123, %False Qt.Har(1).vel = NUL$(128) Qtq.Har(1).vel = NUL$(128) END IF IF (flag AND %MM_Lights) OR (flag AND %MM_Blue) THEN NoteOff Qt.channel, 35 NoteOff Qt.channel + 1, 35 NoteOff Qt.channel, 110 NoteOff Qt.channel, 111 NoteOff Qt.channel+ 1, 111 Controller Qt.channel, 8, %False Qt.ctrl(8) = %False NoteOff Qt.channel, 120 ' implemented 29.07.2006 END IF END IF FUNCTION = %True END FUNCTION FUNCTION MM_Bako_On (OPTIONAL BYVAL flag AS DWORD) AS DWORD LOCAL i AS INTEGER IF ISFALSE flag THEN ' Controller Bako.channel,66, %True ' enable motor servo controller ' bako has no on/off relays... Bako.ctrl(7) = %MM_Bako_Motor Controller Bako.channel, 7, %MM_Bako_Motor ELSE IF (flag AND %MM_POwer) THEN ' Controller Bako.channel, 66, %True ' not yet implemented ' Controller Bako.channel, 70, 64 ' implemented but not yet scaled correctly END IF IF (flag AND %MM_Wind) THEN Bako.ctrl(7) = %MM_Bako_Motor Controller Bako.channel, 7, %MM_Bako_Motor END IF IF (Flag AND %MM_Lights) THEN FOR i = 10 TO 23 mPlay Bako.channel, i, 127 ' 16-20 not yet fitted NEXT i END IF IF (Flag AND %MM_Blue) THEN mPlay Bako.channel, 11, 127 ' blue led's under sharp sensor mPlay Bako.channel, 12, 127 ' front spot mPlay Bako.channel, 13, 127 ' front spot END IF IF (Flag AND %MM_White) THEN mPlay Bako.channel, 10, 127 ' halogen spotlite mPlay Bako.channel, 20, 127 ' keyboard lites mPlay Bako.channel, 21, 127 mPlay Bako.channel, 22, 127 mPlay Bako.channel, 23, 127 mPlay Bako.channel, 14, 127 ' back spot - now white led spots mPlay Bako.channel, 15, 127 ' back spot END IF END IF END FUNCTION FUNCTION MM_Bako_Off (OPTIONAL BYVAL flag AS DWORD) AS DWORD LOCAL i AS INTEGER IF ISFALSE flag THEN ' Controller Bako.channel, 66, %False ' disable motor servo controller Controller Bako.channel, 123, %False ' implemented 13.03.2007 Bako.Har(1).vel = NUL$(127) Controller Bako.channel,1, %False Controller Bako.channel,7,%False ' temporary 'the following is removed because it caused the below to allways reset when MM_AllOff was called.. ' Controller Bako.channel, 70, 40 '%False ' close bellows - 40 is temporary patch until pic is updated ELSE IF (flag AND %MM_POwer) THEN 'Controller Bako.channel, 66, %False Controller Bako.channel, 70, %False END IF IF (flag AND %MM_Lights) THEN FOR i = 10 TO 23 noteoff Bako.channel, i NEXT i END IF IF (Flag AND %MM_White) THEN noteoff Bako.channel, 10 ' frontspot noteoff bako.channel, 20 ' E10 bulbs upperpart noteoff bako.channel, 21 noteoff bako.channel, 22 noteoff bako.channel, 23 noteoff bako.channel, 14 ' white back led spots noteoff bako.channel, 15 END IF IF (Flag AND %MM_Blue) THEN noteoff Bako.channel, 11 noteoff bako.channel, 12 noteoff bako.channel, 13 END IF END IF END FUNCTION FUNCTION MM_Troms_On (OPTIONAL BYVAL flag AS DWORD) AS DWORD IF (flag AND %MM_Lights) THEN mPlay Troms.channel, 18, %True mPlay Troms.channel, 19, %True mPlay Troms.channel, 20, %True ' snar 'mPlay Troms.channel, 75, %True 'mPlay Troms.channel, 76, %True 'mPlay Troms.channel, 77, %True END IF END FUNCTION FUNCTION MM_Snar_On (OPTIONAL BYVAL flag AS DWORD) AS DWORD ' split off from troms 12.07.2009 ' snar IF (flag AND %MM_Lights) THEN mPlay Snar.channel, 75, %True mPlay Snar.channel, 76, %True mPlay Snar.channel, 77, %True END IF IF (flag AND %MM_Blue) THEN mPlay Snar.channel, 75, %True mPlay Snar.channel, 76, %True mPlay Snar.channel, 77, %True END IF END FUNCTION FUNCTION MM_Troms_Off (OPTIONAL BYVAL flag AS DWORD) AS DWORD IF ISFALSE flag THEN ' evt. damper off mPlay Troms.channel, 21, %False mPlay Troms.channel, 22, 36 ' return puls - one shot ' snar Controller Troms.channel, 11, %False 'is nu voor snaar magneet Troms.ctrl(11) = %False ' lichten doven... 'ontbrak hier tot 20070821.. mPlay Troms.channel, 18, %False mPlay Troms.channel, 19, %False mPlay Troms.channel, 20, %False ' for : ' Controller Troms.channel, 10, %False 'voor lichtjes - nog niet bedraad ' Troms.ctrl(10) = %False ' mPlay Troms.channel, 75, %False ' mPlay Troms.channel, 76, %False ' mPlay Troms.channel, 77, %False ELSEIF (flag AND %MM_Lights) THEN ' lichten doven... mPlay Troms.channel, 18, %False mPlay Troms.channel, 19, %False mPlay Troms.channel, 20, %False ' for : ' Controller Troms.channel, 10, %False 'voor lichtjes - nog niet bedraad ' Troms.ctrl(10) = %False ' mPlay Troms.channel, 75, %False ' mPlay Troms.channel, 76, %False ' mPlay Troms.channel, 77, %False END IF END FUNCTION FUNCTION MM_Snar_Off (OPTIONAL BYVAL flag AS DWORD) AS DWORD ' split off from troms 12.07.2009. ' for now the snar-off functions are still also implemented under troms. ' this is only done for compatibility with existing code. IF ISFALSE flag THEN Controller Snar.channel, 11, %False 'is nu voor snaar magneet Snar.ctrl(11) = %False Controller Snar.channel, 10, %False 'voor lichtjes - nog niet bedraad Snar.ctrl(10) = %False mPlay Snar.channel, 75, %False mPlay Snar.channel, 76, %False mPlay Snar.channel, 77, %False ELSEIF (flag AND %MM_Lights) THEN mPlay Snar.channel, 75, %False mPlay Snar.channel, 76, %False mPlay Snar.channel, 77, %False ELSEIF (flag AND %MM_Blue) THEN mPlay Snar.channel, 75, %False mPlay Snar.channel, 76, %False mPlay Snar.channel, 77, %False END IF END FUNCTION FUNCTION MM_Belly_On (OPTIONAL BYVAL flag AS DWORD) AS DWORD '20070920: pitchmapping controllers removed. since belly's upgrade they are only interpreted by the midimPlayer and not by belly itself IF ISFALSE flag THEN ' sets belly to the default values, unless flags are used controller Belly.channel, 66, 127 mPlay Belly.channel, 120, 127 mPlay Belly.channel, 121, 127 mPlay Belly.channel, 122, 127 ELSE IF (flag AND %MM_Power) THEN Controller Belly.channel, 66, 127 mPlay Belly.channel, 120, 127 mPlay Belly.channel, 121, 127 mPlay Belly.channel, 122, 127 Belly.ctrl(66) = 127 END IF IF (flag AND %MM_Lights) THEN mPlay Belly.channel, 120, 127 mPlay Belly.channel, 121, 127 mPlay Belly.channel, 122, 127 mPlay Belly.channel, 123, 127 mPlay Belly.channel, 124, 127 END IF IF (flag AND %MM_Yellow) THEN mPlay Belly.channel, 120, 127 mPlay Belly.channel, 121, 127 mPlay Belly.channel, 122, 127 END IF IF (flag AND %MM_White) THEN mPlay Belly.channel, 123, 127 mPlay Belly.channel, 124, 127 END IF IF (flag AND %MM_Video) THEN ' switch on camera Controller Belly.channel, 67, 127 END IF END IF END FUNCTION FUNCTION MM_Belly_Off (OPTIONAL BYVAL flag AS DWORD) AS DWORD IF ISFALSE flag THEN ' Controller Belly.channel, &H7B, %False ' all notes off - also switches power off - removed - was not consistent with other automats (motors stay on etc) ELSE IF (Flag AND %MM_Power) THEN Controller Belly.channel, 66, %False Belly.ctrl(66) = %False END IF IF (flag AND %MM_Lights) THEN NoteOff Belly.channel, 120 NoteOff Belly.channel, 121 NoteOff Belly.channel, 122 NoteOff Belly.channel, 123 NoteOff Belly.channel, 124 END IF IF (flag AND %MM_Yellow) THEN Noteoff Belly.channel, 120 NoteOff Belly.channel, 121 NoteOff Belly.channel, 122 END IF IF (flag AND %MM_White) THEN NoteOff Belly.channel, 123 NoteOff Belly.channel, 124 END IF IF (flag AND %MM_Video) THEN ' switch off camera Controller Belly.channel, 67, %False END IF END IF END FUNCTION FUNCTION MM_Fa_On (OPTIONAL BYVAL flag AS DWORD) AS DWORD 'todo: send defaults IF ISFALSE flag THEN Controller Fa.channel, 66, 127 Fa.ctrl(66) = 127 Controller Fa.channel, 7, 127 Fa.ctrl(7) = 127 ELSE IF (Flag AND %MM_Power) THEN Controller Fa.channel, 66, 127 Fa.ctrl(66) = 127 END IF IF (flag AND %MM_Lights) THEN mPlay Fa.channel,0, 127 mPlay Fa.channel, 1, 127 mPlay Fa.channel, 2, 127 mPlay Fa.channel, 3, 127 mPlay Fa.channel, 4, 127 mPlay Fa.channel, 5, 127 END IF IF (flag AND %MM_Yellow) THEN mPlay Fa.channel,0, 127 mPlay Fa.channel, 1, 127 END IF IF (flag AND %MM_Red) THEN mPlay Fa.channel,2, 127 mPlay Fa.channel, 3, 127 END IF IF (flag AND %MM_Blue) THEN mPlay Fa.channel,4 ,127 mPlay Fa.channel, 5, 127 END IF END IF END FUNCTION FUNCTION MM_Fa_Off (OPTIONAL BYVAL flag AS DWORD) AS DWORD IF ISFALSE flag THEN Controller Fa.channel, 123, %False Controller Fa.channel, 66, %False Fa.ctrl(66) = %False ELSE IF (flag AND %MM_Notes) THEN Controller Fa.channel, 123, %False END IF IF (flag AND %MM_Power) THEN Controller Fa.channel, 66, %False Fa.ctrl(66) = %False END IF IF (flag AND %MM_Lights) THEN NoteOff Fa.channel, 0 NoteOff Fa.channel, 1 NoteOff Fa.channel, 2 NoteOff Fa.channel, 3 NoteOff Fa.channel, 4 NoteOff Fa.channel, 5 END IF IF (flag AND %MM_Yellow) THEN NoteOff Fa.channel, 0 NoteOff Fa.channel, 1 END IF IF (flag AND %MM_Red) THEN NoteOff Fa.channel, 2 NoteOff Fa.channel, 3 END IF IF (flag AND %MM_Blue) THEN NoteOff Fa.channel, 4 NoteOff Fa.channel, 5 END IF END IF END FUNCTION FUNCTION MM_Spiro_On (OPTIONAL BYVAL flag AS DWORD) AS DWORD IF ISFALSE flag THEN ProgChange Spiro.channel, 122 'Controller Spiro.channel, 66, 127 - not implemented END IF IF (Flag AND %MM_Blue) THEN mPlay Spiro.channel,120, 127 mplay Spiro.channel, 121, 127 END IF IF (Flag AND %MM_Lights) THEN mPlay Spiro.channel,120, 127 mplay Spiro.channel, 121, 127 END IF END FUNCTION FUNCTION MM_Spiro_Off (OPTIONAL BYVAL flag AS DWORD) AS DWORD 'todo IF ISFALSE flag THEN Controller Spiro.channel, 123, %False Controller Spiro.channel, 28, %False Controller Spiro.channel, 29, %False ELSE IF (Flag AND %MM_Notes) THEN Controller Spiro.channel, 123, %False END IF IF (Flag AND %MM_Power) THEN Controller Spiro.channel, 123, %False Controller Spiro.channel, 28, %False Controller Spiro.channel, 29, %False END IF IF (Flag AND %MM_Blue) THEN Noteoff Spiro.channel, 120 NoteOff Spiro.channel, 121 END IF IF (Flag AND %MM_Lights) THEN Noteoff Spiro.channel, 120 NoteOff Spiro.channel, 121 END IF END IF END FUNCTION FUNCTION MM_Flex_On (OPTIONAL BYVAL flag AS DWORD) AS DWORD ' to be done END FUNCTION FUNCTION MM_Flex_Off (OPTIONAL BYVAL flag AS DWORD) AS DWORD #IF NOT(%DEF(%gmt_robots)) ModeMess Flex.channel, &H7B, %False ' was in Gestrobo: &H7B, 127 ' ? FUNCTION = %True #ENDIF END FUNCTION FUNCTION MM_Simba_On (OPTIONAL BYVAL flag AS DWORD) AS DWORD ' 02.07.2007 IF ISFALSE flag THEN Controller Simba.channel, 66, 127 Simba.ctrl(66) = 127 ELSE IF (flag AND %MM_Power) THEN Controller Simba.channel, 66, 127 Simba.ctrl(66) = 127 END IF IF (flag AND %MM_Lights) THEN mPlay simba.channel, 110, 127 mPlay simba.channel, 111, 127 mPlay simba.channel, 112, 127 mPlay simba.channel, 113, 127 mPlay simba.channel, 114, 127 END IF IF (flag AND %MM_Yellow) THEN mPlay simba.channel, 114, 127 END IF IF (flag AND %MM_White) THEN mPlay simba.channel, 110, 127 mPlay simba.channel, 111, 127 mPlay simba.channel, 112, 127 mPlay simba.channel, 113, 127 END IF END IF END FUNCTION FUNCTION MM_Simba_Off (OPTIONAL BYVAL flag AS DWORD) AS DWORD ' 02.07.2007 IF ISFALSE flag THEN ' Controller Simba.channel, &H7B, %False ' Controller Simba.channel, 66, %False ELSE IF (flag AND %MM_Power) THEN Controller Simba.channel, 66, %False Simba.ctrl(66)= %False END IF IF (flag AND %MM_Notes) OR (flag AND %MM_Motor) THEN Controller Simba.channel, &H7B, %False END IF IF (flag AND %MM_Lights) THEN mPlay simba.channel, 110, %False mPlay simba.channel, 111, %False mPlay simba.channel, 112, %False mPlay simba.channel, 113, %False mPlay simba.channel, 114, %False END IF IF (flag AND %MM_Yellow) THEN mPlay simba.channel, 114, %False END IF IF (flag AND %MM_White) THEN mPlay simba.channel, 110, %False mPlay simba.channel, 111, %False mPlay simba.channel, 112, %False mPlay simba.channel, 113, %False END IF END IF FUNCTION = %True END FUNCTION FUNCTION MM_Tubi_Off (OPTIONAL BYVAL flag AS DWORD) AS DWORD 'power switch only Controller Tubi.channel, 66, %False Tubi.ctrl(66) = %False FUNCTION = %True END FUNCTION FUNCTION MM_Tubi_On (OPTIONAL BYVAL flag AS DWORD) AS DWORD 'power switch Controller Tubi.channel, 66, %True Tubi.ctrl(66) = %True IF (flag AND %MM_Video) THEN ' to do: switch on camera END IF FUNCTION = %True END FUNCTION FUNCTION MM_Klung_On (OPTIONAL BYVAL flag AS DWORD) AS DWORD IF ISFALSE flag THEN controller Klung.channel, 66, 127 Klung.ctrl(66) = 127 ELSE IF (flag AND %MM_Power) THEN Controller Klung.channel, 66, 127 ' power on Klung.ctrl(66) = 127 END IF IF (flag AND %MM_Lights) THEN mPlay Klung.channel, 120 , 64 mPlay Klung.channel, 121 , 64 mPlay Klung.channel, 122 , 64 mPlay Klung.channel, 123 , 64 END IF END IF END FUNCTION FUNCTION MM_Klung_Off (OPTIONAL BYVAL flag AS DWORD) AS DWORD IF ISFALSE flag THEN Controller Klung.channel, &H7B, %False ' all notes off Controller Klung.channel, 66, %False ' power OFF Klung.ctrl(66) = %False ELSE IF (flag AND %MM_Lights) THEN NoteOff Klung.channel, 120 NoteOff Klung.channel, 121 NoteOff Klung.channel, 122 NoteOff Klung.channel, 123 END IF IF (flag AND %MM_Power) THEN Controller Klung.channel, 66, %False END IF END IF FUNCTION = %True END FUNCTION FUNCTION MM_Vitello_Off (OPTIONAL BYVAL flag AS DWORD) AS DWORD LOCAL i AS LONG IF ISFALSE flag THEN Controller Vitello.channel, 66, %False Vitello.ctrl(66) = %False ELSE IF (flag AND %MM_Lights) THEN FOR i = 12 TO 18 Noteoff Vitello.channel, i NEXT i END IF IF (flag AND %MM_Red) THEN NoteOff Vitello.channel, 12 NoteOff Vitello.channel, 13 NoteOff Vitello.channel, 14 END IF IF (flag AND %MM_Yellow) THEN NoteOff Vitello.channel, 15 NoteOff Vitello.channel, 16 Noteoff Vitello.channel, 17 NoteOff Vitello.channel, 18 END IF IF (flag AND %MM_Power) THEN 'was bug: haakjes vergeten.. Controller Vitello.channel, 66, %False Vitello.ctrl(66) = %False END IF END IF FUNCTION = %True END FUNCTION FUNCTION MM_Vitello_On (OPTIONAL BYVAL flag AS DWORD) AS DWORD LOCAL i AS LONG IF ISFALSE flag THEN Controller Vitello.channel, 66, %True Vitello.ctrl(66) = %True ELSE IF (flag AND %MM_Lights) THEN FOR i = 12 TO 18 mPlay Vitello.channel, i, 127 NEXT i END IF IF (Flag AND %MM_Power) THEN Controller Vitello.channel, 66, 127 Vitello.ctrl(66) = %True END IF IF (flag AND %MM_Red) THEN mPlay Vitello.channel, 12, 127 ' rood LED spot vooraan mPlay Vitello.channel, 13, 127 ' rood vooraan (profiel) mPlay Vitello.channel, 14, 127 ' rood achteraan (profiel) END IF IF (flag AND %MM_Yellow) THEN mPlay Vitello.channel, 15, 127 ' led spot midden mPlay Vitello.channel, 16, 127 ' led spot midden mPlay Vitello.channel, 17, 127 ' led spot achter mPlay Vitello.channel, 18, 127 ' led spot achter END IF END IF FUNCTION = %True END FUNCTION FUNCTION MM_Sire_On (OPTIONAL BYVAL flag AS DWORD) AS DWORD LOCAL i AS DWORD IF flag = %MM_Lights THEN FOR i = 84 TO 92 ' 86,89,92: RED Led spotlites, downward ' 85,88,91: RED Led lites, upwards new 12.10.2005 mPlay Sire.channel, i , %True ' only 86,89,92 implemented up to 30.09.2005 NEXT i END IF END FUNCTION FUNCTION MM_Sire_Off (OPTIONAL BYVAL flag AS DWORD) AS DWORD LOCAL i AS INTEGER IF ISFALSE flag THEN Controller Sire.channel, 123, %False ' lights off, sirens off, all 3 modules. ' we could also reset controllers 20,21,22 ELSE IF (flag AND %MM_Lights) THEN FOR i = 84 TO 92 ' new 30.09.2005 ' 86,89,92: RED Led spotlites, downward ' 85,88,91: RED Led lites, upwards new 12.10.2005 NoteOff Sire.channel, i ' only 86,89,92 implemented up to 30.09.2005 NEXT i END IF END IF FUNCTION = %True END FUNCTION FUNCTION MM_Xy_On (OPTIONAL BYVAL flag AS DWORD) AS DWORD LOCAL i AS LONG ' power on ' Controller Xy.channel, 66, 127 - not implemented! Controller Xyq.channel, 66, 127 IF (flag AND %MM_Lights) THEN FOR i = 120 TO 127 mPlay Xy.channel, i, %True mPlay Xyq.channel, i, %True NEXT i END IF IF (Flag AND %MM_Power) THEN Controller Xyq.channel, 66, 127 Xy.ctrl(66) = %True Xyq.ctrl(66) = %True END IF IF (flag AND %MM_Red) THEN mPlay Xyq.channel, 125, 127 ' rood binnenin mPlay Xyq.channel, 126, 127 mPlay Xyq.channel, 127, 127 END IF IF (flag AND %MM_White) THEN mPlay Xy.channel, 123, 127 ' xlr spots mPlay Xy.channel, 124, 127 ' xlr mPlay Xy.channel, 125, 127 ' xlr mPlay Xy.channel, 126, 127 ' xlr mPlay Xyq.channel, 123, 127 ' side panel mPlay Xyq.channel, 124, 127 ' side panel END IF END FUNCTION FUNCTION MM_Xy_Off (OPTIONAL BYVAL flag AS DWORD) AS DWORD LOCAL i AS LONG IF ISFALSE flag THEN 'Controller Xy.channel, 66, %False Controller Xyq.channel, 66, %False Xy.ctrl(66) = %False Xyq.ctrl(66) = %False ELSE IF (flag AND %MM_POWER) THEN Controller Xyq.channel, 66, %False Xyq.ctrl(66) = %False END IF IF (flag AND %MM_Lights) THEN ' lichten doven... FOR i = 120 TO 127 NoteOff Xy.channel, i NoteOff Xyq.channel, i NEXT i END IF IF (flag AND %MM_RED) THEN ' lichten doven... NoteOff Xyq.channel, 125 NoteOff Xyq.channel, 126 NoteOff Xyq.channel, 127 END IF IF (flag AND %MM_WHITE) THEN ' lichten doven... NoteOff Xy.channel, 123 NoteOff Xy.channel, 124 NoteOff Xy.channel, 125 NoteOff Xy.channel, 126 NoteOff Xyq.channel, 123 NoteOff Xyq.channel, 124 END IF END IF END FUNCTION FUNCTION MM_Casta_On (OPTIONAL BYVAL flag AS DWORD) AS DWORD IF flag = %MM_Lights THEN mPlay Casta2.channel, 111, 127 END IF END FUNCTION FUNCTION MM_Casta_Off (OPTIONAL BYVAL flag AS DWORD) AS DWORD Controller Casta2.channel, 123, %False NoteOff Casta2.channel, 111 END FUNCTION FUNCTION MM_Toypi_On(OPT BYVAL flag AS DWORD) AS DWORD LOCAL n AS BYTE 'controller Toypi.channel, 66, 1 Toypi.ctrl(66) = %True ' flags: %MM_Yellow and %MM_Blue IF (flag AND %MM_Lights) THEN FOR n = 60 TO 67 mPlay Toypi.channel, n, 127 NEXT n FOR n = 48 TO 53 mPlay Toypi.channel, n, 127 NEXT n EXIT FUNCTION END IF IF (flag AND %MM_Yellow) THEN FOR n = 60 TO 67 mPlay Toypi.channel, n, 127 NEXT n END IF IF (flag AND %MM_Blue) THEN 'FOR n = 48 TO 55 ' mPlay Toypi.channel, n, 127 'NEXT n mPlay Toypi.channel, 48, 127 mPlay Toypi.channel, 55, 127 END IF IF (flag AND %MM_White) THEN mPlay Toypi.channel, 49, 127 mPlay Toypi.channel, 54, 127 END IF FUNCTION = %True END FUNCTION FUNCTION MM_Toypi_Off(OPT BYVAL flag AS DWORD) AS DWORD LOCAL n AS BYTE IF ISFALSE flag OR (flag AND %MM_Power) THEN 'Controller Toypi.channel, 66, 0 not implemented Controller Toypi.channel, 123, %False Toypi.ctrl(66) = %False EXIT FUNCTION END IF IF (flag AND %MM_Lights) THEN Controller Toypi.channel, 123, %False EXIT FUNCTION END IF IF (flag AND %MM_Yellow) THEN FOR n = 60 TO 67 NoteOff Toypi.channel, n NEXT n END IF IF (flag AND %MM_Blue) THEN 'FOR n = 48 TO 55 ' mPlay Toypi.channel, n, %False 'NEXT n NoteOff Toypi.channel, 48 NoteOff Toypi.channel, 55 END IF IF (flag AND %MM_White) THEN NoteOff Toypi.channel, 49 NoteOff Toypi.channel, 54 END IF END FUNCTION FUNCTION MM_Ob_On (OPT BYVAL flag AS DWORD) AS DWORD IF ISFALSE flag THEN Controller Ob.channel, 123, %False Ob.ctrl(66) = 127 Controller Ob.channel, 66, 127 Ob.ctrl(17) = 120 'amplitudebegrenzing Controller Ob.channel,17 , Ob.ctrl(17) Ob.ctrl(18) = 100 'attack duration - default?? Controller Ob.channel, 19, 100 Ob.ctrl(19) = 100 ' release value Controller Ob.channel, 18, Ob.ctrl(18) Ob.ctrl(20) = 5 ' tuning Controller Ob.channel, 20, Ob.ctrl(20) Ob.ctrl(22) = 64 'vertical position Controller Ob.channel, 22, Ob.Ctrl(22) ELSEIF (flag AND %MM_Motor) THEN 'calibrate vertical position Controller Ob.channel, 22, 64 Ob.ctrl(22) = 64 ELSEIF (flag AND %MM_Lights) THEN mPlay Ob.channel, 0, 127 ' mPlay Ob.channel, 1, 127 'nc mPlay Ob.channel, 2, 127 mPlay Ob.channel, 3, 127 mPlay Ob.channel, 4, 127 mPlay Ob.channel, 5, 127 ELSEIF (flag AND %MM_White) THEN mPlay Ob.channel, 0,127 mPlay Ob.channel, 4, 127 ELSEIF (flag AND %MM_Yellow) THEN mPlay Ob.channel, 2,127 ' LED strips mPlay Ob.channel, 3, 127 mPlay Ob.channel, 5, 127 END IF FUNCTION = %true END FUNCTION FUNCTION MM_Ob_Off (OPT BYVAL flag AS DWORD) AS DWORD IF ISFALSE(flag) THEN Controller Ob.channel, 123, %False Controller Ob.channel, 22, 64 'return to vertical ELSEIF (flag AND %MM_Motor) THEN Controller Ob.channel, 123, %False Controller Ob.channel, 22, 64 ELSEIF (flag AND %MM_Notes) THEN Controller Ob.channel, 123, %False ELSEIF (flag AND %MM_Lights) THEN NoteOff Ob.channel, 0 'Noteoff Ob.channel, 1 NoteOff Ob.channel, 2 NoteOff Ob.channel, 3 NoteOff Ob.channel, 4 NoteOff Ob.channel, 5 ELSEIF (flag AND %MM_White) THEN NoteOff Ob.channel, 0 NoteOff Ob.channel, 4 ELSEIF (flag AND %MM_Yellow) THEN NoteOff Ob.channel, 2 NoteOff Ob.channel, 3 NoteOff Ob.channel, 5 END IF END FUNCTION FUNCTION MM_Heli_On (OPT BYVAL flag AS DWORD) AS DWORD IF ISFALSE(flag) THEN ' initialisatie van de controllers... Controller Heli.channel, 66, 127 Heli.ctrl(66) = 127 Controller Heli.channel, 14, 0 ' disPlay midi notes Controller Heli.channel, 13, 0 ' default lookup ELSEIF (flag AND %MM_Lights) THEN mPlay Heli.channel, 120, 127 ' yellow mPlay Heli.channel, 127, 110 ' white ELSEIF (flag AND %MM_White) THEN mPlay Heli.channel, 127, 110 ' white ELSEIF (flag AND %MM_Yellow) THEN mPlay Heli.channel, 120, 127 ' yellow END IF END FUNCTION FUNCTION MM_Heli_Off (OPT BYVAL flag AS DWORD) AS DWORD IF ISFALSE(flag) THEN Controller Heli.channel, 8, %False ' close external input. Controller Heli.channel, 123, %False Controller Heli.channel, 66, %False ' temporary patch to blank the disPlays: Controller Heli.channel, 14, 2 Controller Heli.channel, 26, &H0F Controller Heli.channel, 27, &H0F ELSEIF (flag AND %MM_Notes) THEN Controller Ob.channel, 123, %False ELSEIF (flag AND %MM_Lights) THEN mPlay Heli.channel, 120, %False ' yellow NoteOff Heli.channel, 127 ' white ELSEIF (flag AND %MM_White) THEN NoteOff Heli.channel, 127 ' white ELSEIF (flag AND %MM_Yellow) THEN mPlay Heli.channel, 120, %False END IF END FUNCTION FUNCTION MM_Hat_On (OPT BYVAL flag AS DWORD) AS DWORD IF ISFALSE flag THEN Controller Hat.Channel, 66, 1 ELSE IF (flag AND %MM_Lights) OR (flag AND %MM_WHITE) THEN mPlay Hat.channel, 96, 64 mPlay Hat.channel, 97, 64 mPlay Hat.channel, 98, 64 mPlay Hat.channel, 99, 64 END IF END IF END FUNCTION FUNCTION MM_Hat_Off (OPT BYVAL flag AS DWORD) AS DWORD IF ISFALSE(flag) THEN Controller Hat.channel, 123, 0 Controller Hat.channel, 66, 0 ELSE IF (flag AND %MM_Lights) OR (flag AND %MM_WHITE) THEN mPlay Hat.channel, 96, %False mPlay Hat.channel, 97, %False mPlay Hat.channel, 98, %False mPlay Hat.channel, 99, %False END IF END IF END FUNCTION FUNCTION MM_Bomi_Off (OPTIONAL BYVAL flag AS DWORD) AS DWORD LOCAL n AS BYTE IF ISFALSE flag THEN ' switch off the motor... Controller Bomi.channel, 123, %False Bomi.Har(0).vel = Bomi.Har(1).vel Bomi.Har(1).vel = NUL$(128) ' Controller Bomi.channel, 7, %False ' Bomi.ctrl(7) = 0 ' Controller Bomi.channel, 10, %false 'tremulant af ' Bomi.ctrl(10) = %false ' should be handled by PIC on reception of CC123 ' FOR n = 120 TO 127 ' NoteOff Bomi.channel, n ' NEXT n ' should be handled by the PIC on reception of CC123 Bomi.ctrl(1) = %False Controller Bomi.channel, 1, Bomi.ctrl(1) 'klep open. ' switching motor off would be: Controller Bomi.channel, 66, %False Controller Bomi.channel, 7, %false '2010.10.14 this one was missing!! which caused bomi to start blowing as soon as it received ctl 66 on.. ELSE IF (flag AND %MM_Motor) THEN Bomi.ctrl(66) = %False Controller Bomi.channel, 10, %false 'tremulant af Controller Bomi.channel, 66, %False END IF IF (flag AND %MM_Wind) THEN Bomi.ctrl(7) = %False Controller Bomi.channel, 7, 20 ' very slow ... %false Bomi.ctrl(10) = %false Controller Bomi.channel, 10, %False 'tremulant af Bomi.ctrl(1) = %False 'klep open Controller Bomi.channel, 1, %False END IF IF (Flag AND %MM_Notes) THEN Controller Bomi.channel, 123, %False Bomi.Har(0).vel = Bomi.Har(1).vel Bomi.Har(1).vel = NUL$(128) END IF IF (Flag AND %MM_Lights) THEN FOR n = 120 TO 127 NoteOff Bomi.channel, n NEXT n NoteOff Bomi.channel, 0 END IF IF (flag AND %MM_White) THEN FOR n = 120 TO 124 NoteOff Bomi.channel, n NEXT n END IF IF (flag AND %MM_Red) THEN NoteOff Bomi.channel, 0 END IF IF (Flag AND %MM_Yellow) THEN NoteOff Bomi.channel, 125 END IF END IF FUNCTION = %True END FUNCTION FUNCTION MM_Bomi_On (OPTIONAL BYVAL flag AS DWORD) AS DWORD IF ISFALSE flag THEN Bomi.ctrl(7) = %MM_Bomi_Motor Bomi.ctrl(66) = 127 Controller Bomi.channel, 66, Bomi.ctrl(66) Controller Bomi.channel, 7, %MM_Bomi_Motor Controller Bomi.channel, 1, 0 ' warning "bomi on generic" ELSE IF (flag AND %MM_Motor) THEN ' warning "bomi motor on: Controller Bomi.channel, 66, %True END IF IF (flag AND %MM_Wind) THEN ' IF ISFALSE Bomi.ctrl(7) THEN '?? we don't do it like this for any other robot.. ' warning "bomi wind on" Bomi.ctrl(7) = %MM_Bomi_Motor Controller Bomi.channel, 7, %MM_Bomi_Motor Bomi.ctrl(1) = 0 controller Bomi.channel, 1, 0 ' ELSE ' Controller Bomi.channel, 7, Bomi.ctrl(7) ' END IF END IF IF (flag AND %MM_Lights) THEN mPlay Bomi.channel, 120, %True mPlay Bomi.channel, 121, %True mPlay Bomi.channel, 122, %True mPlay Bomi.channel, 123, %True mPlay Bomi.channel, 124, %True mPlay Bomi.channel, 125, %True mPlay Bomi.channel, 0, %True END IF IF (flag AND %MM_White) THEN mPlay Bomi.channel, 120, %True mPlay Bomi.channel, 121, %True mPlay Bomi.channel, 122, %True mPlay Bomi.channel, 123, %True mPlay Bomi.channel, 124, %True END IF IF (flag AND %MM_Red) THEN mPlay Bomi.channel, 0, %True END IF IF (flag AND %MM_Yellow) THEN mPlay Bomi.Channel, 125, %True END IF END IF FUNCTION = %True END FUNCTION FUNCTION MM_PanicButtonWindow(OPT BYVAL instrum$, BYVAL hParent AS LONG, BYVAL x AS LONG, BYVAL y AS LONG) AS LONG 'shows window with panic buttons 'optional parent handle and x- and y coordinates 'instrum$ is an optional comma delimited list of instruments to be included 'note: new instruments are automatically included in this window as soon as they have an .cptrOffProc defined (in init_MM) #REGISTER NONE ' STATIC hw AS LONG ' changed to static by gwr. - stored in gh.mm (16.01.2005) 'kl note to self: aanpassen! aan-en af toggelen moet kunnen... ' gwr note to kl: right mouse button is very well possible... LOCAL nrButtons AS LONG LOCAL xSiz AS LONG, ySiz AS LONG ' size of buttons LOCAL xLoc AS LONG, yLoc AS LONG 'location of next button to set LOCAL i AS LONG LOCAL ICo() AS STRING * 8 LOCAL hBitmap AS LONG ' IF hw THEN FUNCTION = hw : EXIT FUNCTION ' to avoid generation of many ctrl. windows... (in Faust) IF gh.mm THEN FUNCTION = gh.mm : EXIT FUNCTION ' to avoid generation of many ctrl. windows... (in Faust) DIM MM(100) 'redimmed by Get_MM_Orkest DIM Ico(100) IF ISFALSE Get_MM_Orkest(Ico()) THEN Warning "Can't create Panic Button Window in this compilation (%gmt_Robots is defined)", 10000 EXIT FUNCTION END IF nrButtons = UBOUND(MM) + 2 FOR i = 0 TO UBOUND(MM) IF ISFALSE @MM(i).cptrOffProc THEN DECR nrButtons NEXT xSiz = 24: ySiz = 24: xloc = 1: yloc = 1 IF instrum$ <> "" THEN nrButtons = PARSECOUNT(instrum$) DIALOG NEW hparent, "Panic!", x, y, (xSiz + 1) * (nrButtons \ 7), (ySiz + 1) * (MIN(8, nrButtons)), %WS_POPUP OR %WS_CAPTION OR %DS_MODALFRAME OR %WS_SYSMENU OR %WS_MINIMIZEBOX TO gh.mm 'check size formula! ' there may be a bug above. We see different buttons according to the compilation. gwr. FOR i = 0 TO UBOUND(MM) IF (instrum$="") OR INSTR(instrum$, @MM(i).naam) THEN 'if instrum$ = "" INSTR returns 1.. IF @MM(i).cptrOffPRoc AND (@MM(i).cptrOffProc <> CODEPTR(MM_Dummy)) THEN CONTROL ADD IMGBUTTONX, gh.mm, i, "", xloc, yloc, xsiz, ysiz, %BS_FLAT OR %BS_NOTIFY OR %BS_ICON OR %BS_BITMAP CONTROL SEND gh.mm, i, %BM_SETIMAGE, %IMAGE_ICON, LoadICon(GetModuleHandle("g_lib.dll"), "" + Ico(i)) yLoc = yLoc + ySiz + 1 IF yloc > 8 * (ySiz + 1) THEN xloc = xloc + xsiz + 1 yloc = 1 END IF END IF END IF NEXT ' we add here, as a last one, the general M&M button [added by gwr] CONTROL ADD IMGBUTTONX, gh.mm, i, "", xloc, yloc, xsiz, ysiz, %BS_FLAT OR %BS_NOTIFY OR %BS_ICON OR %BS_BITMAP CONTROL SEND gh.mm, i, %BM_SETIMAGE, %IMAGE_ICON, LoadICon(GetModuleHandle("g_lib.dll"), "#" + FORMAT$(%ICO_MM)) ' --------------------------------------- DIALOG SHOW MODELESS gh.mm, CALL MM_CB_PanicButtonWindow FUNCTION = gh.mm 'hw END FUNCTION CALLBACK FUNCTION MM_CB_PanicButtonWindow ' right mouse click handled in g_lib.dll ' combinations with alt and shift will be handled there as well. ' IF CBMSG = %WM_RBUTTONDOWN THEN warning "right button @ " + FUNCNAME$, 7000 IF CBMSG = %WM_CLOSE THEN gh.mm = 0 'added kl 20050811 - was this the bug that caused a crash when closing certain pieces?? END IF IF CBMSG <> %WM_COMMAND THEN EXIT FUNCTION IF CBCTLMSG = %BN_CLICKED THEN 'we only handle button click ourselves ' added gwr: IF CBCTL = UBOUND(MM)+1 THEN MM_AllOff %MM_Notes 'kl change 20051207, so motors don't get put off EXIT FUNCTION END IF ' ---------- IF @MM(CBCTL).cptrOffPRoc THEN CALL DWORD @mm(CBCTL).cptrOffProc USING MM_Dummy (%MM_Notes OR %MM_Lights) 'we use generic offproc behavior here. maybe for some machines we could 'better pass certain flags.. ' gwr: changed 16.01.2004: now we do only notes off END IF ELSEIF CBCTLMSG = %BN_DOUBLECLICKED THEN ' added gwr: IF CBCTL = UBOUND(MM) + 1 THEN MM_AllOff MM_AllLightsOff EXIT FUNCTION END IF ' changed from: 'IF @MM(CBCTL).cptrOnProc THEN CALL DWORD @mm(CBCTL).cptrOnProc ' to IF @MM(CBCTL).cptrOffPRoc THEN CALL DWORD @mm(CBCTL).cptrOffProc USING MM_Dummy (%MM_Notes OR %MM_Motor OR %MM_Wind OR %MM_Lights) END IF ' machines ON now using the right mouse click. END IF END FUNCTION 'window from which we can send program changes to all automats that support sysexes SUB MM_ProgchangeWindow(OPT BYVAL comnd AS DWORD) 'comnd 1: forget window handle, so it's created again if the function is called again 'only call this after MM() array has been filled in!! STATIC hw AS DWORD LOCAL ITEM$() LOCAL i AS DWORD IF ISFALSE hw THEN DIALOG NEW 0, "MM_ProgChange", , , 200, 30, %WS_POPUP OR %WS_SYSMENU OR %WS_CAPTION TO hw CONTROL ADD LABEL, hw, -1, "instrument:", 1, 1, 64, 12 CONTROL ADD LABEL, hw, -1, "progchange:", 66, 1, 64, 12 DIM ITEM$(19) '!!! don't forget to adapt this every time you add a new instrument !!! ARRAY ASSIGN ITEM$() = "casta", "casta2", "harma", "mPlaypian", "snar", "vacca", "vitello", "belly", "klung", "thunderwood", "springers", "xy", "bako", "qt", "so", "toypi", "simba", "harmo", "bono", "spiro" CONTROL ADD COMBOBOX, hw, 1, ITEM$(), 1, 16, 64, 256, %CBS_DROPDOWNLIST OR %WS_TABSTOP OR %WS_VSCROLL REDIM ITEM$(12) ARRAY ASSIGN ITEM$() = "0", "120", "121", "122", "123", "124", "125", "126", "127", "1", "2", "3" CONTROL ADD COMBOBOX, hw, 2, ITEM$(), 66, 16, 64, 256, %CBS_DROPDOWN OR %WS_TABSTOP OR %WS_VSCROLL CONTROL ADD BUTTON, hw, 10, "&Send", 132, 16, 64, 12, CALL CB_PRogChangeWindow 'default seleksies: SELECT CASE App.Id CASE %IDM_CASTA, %IDM_HUMANOLA: i = 1 CASE %IDM_CASTA2 : i = 2 CASE %IDM_HARMA : i = 3 CASE %IDM_PlayERPIANO : i = 4 CASE %IDM_TROMS, %IDM_SNAR : i = 5 CASE %IDM_VACCA : i = 6 CASE %IDM_VITELLO : i = 7 CASE %IDM_BELLY : i = 8 CASE %IDM_KLUNG : i = 9 CASE %IDM_THUNDERWOOD : i = 10 CASE %IDM_SPRINGERS : i = 11 CASE %IDM_Xy : i = 12 CASE %IDM_BAKO : i = 13 CASE %IDM_QT : i = 14 CASE %IDM_SO : i = 15 CASE %IDM_TOYPI : i = 16 CASE %IDM_SIMBA : i = 17 CASE %IDM_HARMO : i = 18 CASE %IDM_BONO : i = 19 CASE %IDM_SPIRO : i = 20 CASE ELSE: i = 20 ' we also need bono, simba, korn .... END SELECT COMBOBOX SELECT hw, 1, i COMBOBOX SELECT hw, 2, IIF(i=19, 10, 4) DIALOG SHOW MODELESS hw END IF IF comnd = 1 THEN hw = 0 EXIT SUB END IF END SUB CALLBACK FUNCTION CB_ProgChangeWindow LOCAL b$ LOCAL v AS BYTE LOCAL i AS LONG IF CBMSG <> %WM_COMMAND THEN EXIT FUNCTION IF CBCTLMSG <> %BN_CLICKED THEN EXIT FUNCTION CONTROL GET TEXT CBHNDL, 2 TO b$ v = MIN(127, MAX(0, VAL(b$))) CONTROL GET TEXT CBHNDL, 1 TO b$ FOR i = LBOUND(MM) TO UBOUND (MM) IF LCASE$(TRIM$(@MM(i).naam)) = b$ THEN IF ((v > 0) AND (v < 122)) AND (LCASE$(TRIM$(@MM(i).naam)) <> "so") THEN MSGBOX "Program changes 120 and 122 are only implemented on " + $CRLF + "122 is the default for all other robots where program change is implemented" EXIT FOR END IF ProgChange @MM(i).channel, v IF LCASE$(TRIM$(@MM(i).naam)) = "qt" THEN Progchange QTQ.channel, v IF LCASE$(TRIM$(@MM(i).naam)) = "xy" THEN Progchange xyq.channel, v EXIT FOR END IF NEXT DIALOG END CBHNDL MM_ProgChangeWindow 1 END FUNCTION FUNCTION Get_MM_Orkest (BYREF Ico() AS STRING * 8) AS LONG 'MM as musician PTR is and should be global.. 'NOTE: needs to be updated for every new automat! don't forget the REDIM MM() ' #IF NOT(%DEF(%gmt_robots)) ' should be more conditional! gwr. REDIM MM(100) AS GLOBAL musician PTR ' explicit formulation added gwr 16.01.2005 REDIM Ico(UBOUND(MM)) LOCAL i AS LONG i = 0 MM(i) = VARPTR(Piano) Ico(i) = "#" + FORMAT$(%ICO_PIANO) INCR i MM(i) = VARPTR(Humanola) Ico(i) = "#" + FORMAT$(%ICO_HUMANOLA) INCR i MM(i) = VARPTR(Piperola) ' 2 Ico(i) = "#" + FORMAT$(%ICO_PIPEROLA) INCR i MM(i) = VARPTR(Bourdonola) ' i = 3 Ico(i) = "#" + FORMAT$(%ICO_BOURDONOLA) INCR i MM(i) = VARPTR(Klung) ' i = 4 Ico(i) = "#" + FORMAT$(%ICO_KLUNG) INCR i ' i = 5 MM(i) = VARPTR(Thunderwood) Ico(i) = "#" + FORMAT$(%ICO_THUNDERWOOD) INCR i MM(i) = VARPTR(Springers) Ico(i) = "#" + FORMAT$(%ICO_SPRINGERS) INCR i MM(i) = VARPTR(Troms) ' i = 7 Ico(i) = "#" + FORMAT$(%ICO_TROMS) INCR i MM(i) = VARPTR(Rotomoton) Ico(i) = "#" + FORMAT$(%ICO_ROTOMOTON) INCR i MM(i) = VARPTR(Vibi) Ico(i) = "#" + FORMAT$(%ICO_VIBI) INCR i ' i = 10 MM(i) = VARPTR(Harma) ' can coexist, ph as harmatype has no conflict with harma as musician Ico(i) = "#" + FORMAT$(%ICO_HARMA) INCR i MM(i) = VARPTR(Belly) ' may be defined even in %gmt_robots Ico(i) = "#" + FORMAT$(%ICO_BELLY) INCR i ' i = 12 MM(i)= VARPTR(AutoSax) Ico(i) = "#" + FORMAT$(%ICO_AUTOSAX) INCR i #IF NOT %DEF(%gmt_robots) MM(i) = VARPTR(Flex) Ico(i) = "#" + FORMAT$(%ICO_FLEX) INCR i #ENDIF MM(i) = VARPTR(Tubi) ' i = 14 Ico(i) = "#" + FORMAT$(%ICO_TUBI) INCR i MM(i) = VARPTR(So) Ico(i) = "#" + FORMAT$(%ICO_SO) INCR i MM(i) = VARPTR(Puff) Ico(i) = "#" + FORMAT$(%ICO_PUFF) INCR i MM(i) = VARPTR(Trump) Ico(i) = "#" + FORMAT$(%ICO_TRUMP) INCR i MM(i) = VARPTR(Hurdy) Ico(i) = "#" + FORMAT$(%ICO_HURDY) INCR i MM(i) = VARPTR(Ake) Ico(i) = "#" + FORMAT$(%ICO_AKE) INCR i MM(i) = VARPTR(Llor) ' i = 20 Ico(i) = "#" + FORMAT$(%ICO_LLOR) INCR i ' i = 21 MM(i) = VARPTR(Dripper) Ico(i) = "#" + FORMAT$(%ICO_DRIPPER) ' no conflict, pDripper used in %gmt_robots INCR i MM(i) = VARPTR(Sire) Ico(i) = "#" + FORMAT$(%ICO_SIRE) INCR i MM(i) = VARPTR(Vacca) Ico(i) = "#" + FORMAT$(%ICO_VACCA) INCR i MM(i) = VARPTR(Krum) Ico(i) = "#" + FORMAT$(%ICO_KRUM) INCR i MM(i) = VARPTR(Snar) Ico(i) = "#" + FORMAT$(%ICO_SNAR) INCR i MM(i) = VARPTR(Psch) Ico(i) = "#" + FORMAT$(%ICO_PSCH) INCR i MM(i) = VARPTR(Vitello) Ico(i) = "#" + FORMAT$(%ICO_VITELLO) INCR i MM(i) = VARPTR(Qt) Ico(i) = "#" + FORMAT$(%ICO_QT) INCR i MM(i) = VARPTR(Qtq) Ico(i) = "" INCR i MM(i) = VARPTR(Bako) Ico(i) = "#" + FORMAT$(%ICO_BAKO) INCR i MM(i) = VARPTR(Xy) Ico(i) = "#" + FORMAT$(%ICO_XY) INCR i MM(i) = VARPTR(Xyq) Ico(i) = "" INCR i MM(i) = VARPTR(Aeio) Ico(i) = "#" + FORMAT$(%ICO_AEIO) INCR i MM(i) = VARPTR(Casta) Ico(i) = "" INCR i MM(i) = VARPTR(Casta2) Ico(i) = "" INCR i MM(i) = VARPTR(Simba) Ico(i) = "#" + FORMAT$(%ICO_SIMBA) INCR i MM(i) = VARPTR(Bono) Ico(i) = "#" + FORMAT$(%ICO_BONO) INCR i MM(i) = VARPTR(Korn) Ico(i) = "#" + FORMAT$(%ICO_KORN) INCR i MM(i) = VARPTR(Toypi) Ico(i) = "#" + FORMAT$(%ICO_TOYPI) INCR i MM(i) = VARPTR(Ob) Ico(i) = "#" + FORMAT$(%ICO_OB) INCR i MM(i) = VARPTR(Heli) Ico(i) = "#" + FORMAT$(%ICO_HELI) INCR i MM(i) = VARPTR(Hat) Ico(i) = "#" + FORMAT$(%ICO_HAT) INCR i MM(i) = VARPTR(Bomi) Ico(i) = "#" + FORMAT$(%ICO_BOMI) INCR i MM(i) = VARPTR(HarmO) Ico(i) = "#" + FORMAT$(%ICO_HARMO) INCR i MM(i) = VARPTR(Fa) Ico(i) = "#" + FORMAT$(%ICO_FA) REDIM PRESERVE MM(i) REDIM PRESERVE Ico(i) FOR i = 0 TO UBOUND(MM) IF ISFALSE @MM(i).cptrOffProc THEN @MM(i).cptrOffProc = CODEPTR(MM_Dummy) IF ISFALSE @MM(i).cptrOnProc THEN @MM(i).cptrOnProc = CODEPTR(MM_Dummy) NEXT i i = VARPTR(MM(0)) ' do not write VARPTR(MM()) !!! Publish_MM (BYVAL i, UBOUND(MM)) ' function in g_lib.dll (16.01.2005) ' required to make right mouse button work. gwr. 'Publish_MM (MM(), UBOUND(MM)) ' impossible to pass an array of pointers byref ' do not try any other construction than the working one above! FUNCTION = %true END FUNCTION FUNCTION FindRobotOnChannel (BYVAL channel AS WORD) AS LONG ' 20.11.2004 - by gwr. ' returns the number of the robot connected to the port/channel passed, in the MM array. ' we may get in trouble here with belly and llor since they use same port and channel!!! ' same problem for bourdonola and piperola, vacca and vitello, troms and snar, casta(1) and humanola STATIC i AS LONG i = %False DO IF @MM(i).channel = channel THEN EXIT LOOP INCR i LOOP UNTIL i > UBOUND(MM) IF i > UBOUND(MM) THEN FUNCTION = -1 ELSE FUNCTION = i END IF END FUNCTION FUNCTION MM_Dummy (OPTIONAL BYVAL flag AS DWORD) AS DWORD ' 20.11.2004 - by gwr. ' zero codepointer avoider. ' & call prototype for call dword ... using FUNCTION = %False END FUNCTION 'moved to g_file 'FUNCTION GetVaccaMapping () AS LONG ' 'kl 0510610 ' ' toe te voegen: dynamisch bereik per bel (velomin en velomax) ' ' 16.07.2005: no longer required since we can sysex programm the scalings. ' LOCAL f AS LONG ' LOCAL i AS LONG ' f = FREEFILE ' LOCAL b$ ' OPEN ".\robots\vacca\vacca.dat" FOR INPUT ACCESS READ LOCK WRITE AS f ' DO ' LINE INPUT #f, b$ ' warning b$ ' IF EOF(f) THEN CLOSE f: EXIT FUNCTION ' IF LEFT$(TRIM$(UCASE$(b$)),15 ) = "[VACCA_MAPPING]" THEN EXIT LOOP ' LOOP ' DO ' LINE INPUT #f, b$ ' IF LEFT$(TRIM$(UCASE$(b$)), 19) = "[VACCA_MAPPING_END]" THEN EXIT LOOP ' IF EOF(f) THEN EXIT FUNCTION ' i = VAL(PARSE$(b$, ",", 1)) ' IF ISFALSE i THEN ITERATE LOOP 'comment line ' IF i < LBOUND(VaccaNotes) OR i > UBOUND(VaccaNotes) THEN Warning "Invalid data in vacca.dat! i=" + STR$(i): EXIT FUNCTION ' 'VaccaNotes(i).pitch = VAL(PARSE$(b$, ",", 2)) ' wrong, this must be frequency. Use nf instead: ' VaccaNotes(i).nf = VAL(PARSE$(b$, ",", 2)) ' AddNote2Har VaccaNotes(i).har, VaccaNotes(i).nf, 64 ' VaccaNotes(i).pitch = NF2F(VaccaNotes(i).nf) ' IF VAL(PARSE$(b$, ",", 3)) > 0 THEN AddNote2Har VaccaNotes(i).har, VAL(PARSE$(b$, ",", 3)), 32 ' LOOP ' ' read also the minvel and maxvel datafields: - gwr. 11.06.2005 ' DO ' LINE INPUT #f, b$ ' IF LEFT$(TRIM$(UCASE$(b$)), 22) = "[VACCA_VELOCITIES_END]" THEN EXIT LOOP ' IF EOF(f) THEN EXIT FUNCTION ' i = VAL(PARSE$(b$, ",", 1)) ' IF ISFALSE i THEN ITERATE LOOP 'comment line ' IF i < LBOUND(VaccaNotes) OR i > UBOUND(VaccaNotes) THEN Warning "Invalid data in vacca.dat! i=" + STR$(i): EXIT FUNCTION ' VaccaNotes(i).minvel = VAL(PARSE$(b$, ",", 2)) ' VaccaNotes(i).maxvel = VAL(PARSE$(b$, ",",3)) ' LOOP ' ' overwrite it, since no longer required: (unless we need it for prog. change 0) ' FOR i = Vacca.lowtes TO Vacca.hightes ' VaccaNotes(i).minvel = 1 ' VaccaNotes(i).maxvel = 127 ' NEXT i ' FUNCTION = %true 'END FUNCTION FUNCTION PlayVacca (BYVAL note AS SINGLE, BYVAL velo AS BYTE, BYVAL tol AS SINGLE) EXPORT AS DWORD ' 17.07.2005 ' gwr 17.07.2005 ' this function searches for a suitable cowbell for the note requested within the tollerance (in cents) ' specified as parameter. ' The function returns the midi note number for the bell used, if a bell was found. If not, it will ' return False. LOCAL i AS DWORD LOCAL nt AS SINGLE LOCAL nr AS INTEGER FUNCTION = %False nr = GetNoteNrFromKloktype(VARPTR(VaccaNotes(LBOUND(vaccanotes))), LBOUND(vaccanotes), UBOUND(Vaccanotes), note,tol) IF nr THEN mPlay Vacca.channel, nr, velo FUNCTION = nr ELSE EXIT FUNCTION END IF END FUNCTION FUNCTION PlayVitello (BYVAL note AS SINGLE, BYVAL velo AS BYTE, BYVAL tol AS SINGLE) EXPORT AS DWORD '20060809 LOCAL nr AS INTEGER nr = GetNoteNrFromKlokType(VARPTR(VitelloNotes(LBOUND(VitelloNotes))), LBOUND(VitelloNotes), UBOUND(VitelloNotes), note, tol) IF nr THEN mPlay Vitello.channel, nr, velo FUNCTION = nr END IF END FUNCTION FUNCTION PlayBelly (BYVAL note AS SINGLE, BYVAL velo AS BYTE, BYVAL tol AS SINGLE) EXPORT AS DWORD ' 17.07.2005 - 09.08.2006 ' this will override the controller setting for Belly ' needs: GLOBAL pBelly AS Bellytype PTR ' should not conflict with Belly declared as musician for midi-ctrl. 'this function is for use on the central computer and with direct mapping mode, not on the computer that controls belly directly LOCAL nr AS INTEGER nr = GetNoteNrFromKlokType(VARPTR(BellyNotes(LBOUND(BellyNotes))), LBOUND(BellyNotes), UBOUND(BellyNotes), note, tol) IF nr THEN mPlay Belly.channel, nr, velo FUNCTION = nr END IF END FUNCTION FUNCTION PlayKloks(BYVAL note AS SINGLE, BYVAL velo AS BYTE, BYVAL tol AS SINGLE, OPT BYVAL SELECTION AS DWORD, OPT BYVAL silent AS DWORD) EXPORT AS DWORD 'similar to PlayVacca, PlayVitello, ... but on different instruments at the same time 'tol is allowed deviation tolerated, in cents 'if selection is 0 (or omitted), we use all bells otherwise we set bits according to which instruments can be included ' bit 0: belly ' bit 1: vacca ' bit 2: vitello ' bit 3: Llor ' bit 4: harma (single bell n harma) 'return value= hiword = port + channel, loword = noot 'silent flag: if set, the function only returns channel and hardware note (packed as lowrd resp hiwrd) without mPlaying the note - added 20061128 '20061130: solved llor initialisation bug in init_mm and getllormapping, which caused llor not to play here .. '!!!! since the inclusion of the harma bell in this function until 20070223 we had a bug that prevented all notes sounding higher than ' the harma bell (=87) from being mPlayed! To reproduce pieces made in that period, it might be necessary to filter the output (use the function in silent ' mode and do the Playback yourself for the lower notes..) LOCAL diffs() AS SINGLE 'for each ins: the diff between best match and wanted note LOCAL mn() AS DWORD LOCAL i AS LONG DIM diffs(4) DIM mn(UBOUND(diffs)) IF ISFALSE(SELECTION) THEN SELECTION = NOT(%False) 'adapt this as more instruments get included!! ' kan niet -1 in een dword , vandaar not false (gwr) - -1 kan niet maar werkt wel - kl IF BIT(SELECTION, 0) THEN mn(0) = GetNoteNrFromKlokType(VARPTR(BellyNotes(LBOUND(BellyNotes))), LBOUND(BellyNotes), UBOUND(BellyNotes), note, tol) 'function in g_indep.bas IF mn(0) > 0 THEN diffs(0) = ABS(BellyNotes(mn(0)).nf - note) mn(0) = mn(0) + &H010000 * Belly.channel 'pack together with channel ELSE diffs(0) = 1000 END IF ELSE diffs(0) = 1000 END IF IF BIT(SELECTION, 1) THEN mn(1) = GetNoteNrFromKlokType(VARPTR(VaccaNotes(LBOUND(VaccaNotes))), LBOUND(VaccaNotes), UBOUND(VaccaNotes), note, tol) IF mn(1) > 0 THEN diffs(1) = ABS(VaccaNotes(mn(1)).nf - note) mn(1) = mn(1) + &H010000 * Vacca.channel ELSE diffs(1) = 1000 END IF ELSE diffs(1) = 1000 END IF IF BIT(SELECTION, 2) THEN mn(2) = GetNoteNrFromKlokType(VARPTR(VitelloNotes(LBOUND(VitelloNotes))), LBOUND(VitelloNotes), UBOUND(VitelloNotes), note, tol) IF mn(2) > 0 THEN diffs(2) = ABS(VitelloNotes(mn(2)).nf - note) mn(2) = mn(2) + &H010000 * Vitello.channel ELSE diffs(2) = 1000 END IF ELSE diffs(2) = 1000 END IF IF BIT(SELECTION, 3) THEN mn(3) = GetNoteNrFromKlokType(VARPTR(LlorNotes(LBOUND(LlorNotes))), LBOUND(LlorNotes), UBOUND(LlorNotes), note, tol) IF mn(3) > 0 THEN diffs(3) = ABS(LlorNotes(mn(3)).nf - note) mn(3) = mn(3) + &H010000 * Llor.channel ELSE diffs(3) = 1000 END IF ELSE diffs(3) = 1000 END IF IF BIT(SELECTION, 4) THEN mn(4) = 92 'niet echt exact - eens nachecken volgende keer dat we fft's maken.. diffs(4) = ABS(87 - note) mn(4) = mn(4) + &H010000 * Harma.channel ELSE diffs(4) = 1000 END IF ARRAY SORT diffs(), TAGARRAY mn(), ASCEND IF diffs(0) > (tol/100) THEN EXIT FUNCTION IF ISFALSE LOWRD(mn(0)) THEN EXIT FUNCTION IF ISFALSE(silent) THEN mPlay HIWRD(mn(0)), LOWRD(mn(0)), velo FUNCTION = mn(0) END FUNCTION ' in g_midi !!! 'FUNCTION PlayLlor (BYVAL note AS SINGLE, BYVAL velo AS BYTE, BYVAL tol AS SINGLE) EXPORT AS DWORD ' Warning FUNCNAME$ + " not functional yet!" 'end function 'the sire specific functions where moved to g_indep and g_midi, as we needed to be able to use them from g_midi.inc.. 'FUNCTION Sire_Velo2MidiNoot (BYVAL velo AS INTEGER) EXPORT AS SINGLE ' ' transfer function calculated with Gausfit. gwr.20.04.2005 ' IF velo < 6 THEN FUNCTION = %False : EXIT FUNCTION ' velo = MIN(velo,127) ' FUNCTION = 41.12872 + (1.560877 * velo) - (1.880568E-02 * (velo^2!)) + (7.231988E-05 * (velo^3!)) 'END FUNCTION 'FUNCTION Sire_MidiNoot2Velo (BYVAL noot AS SINGLE) EXPORT AS WORD ' ' will return the 7-bit velo value to send in HIBYT(velo) and the 7-bit LSB in LOBYT(velo) ' 'if noot > 84 then exit function ' LOCAL velo AS SINGLE ' LOCAL retval AS WORD ' LOCAL f AS SINGLE ' LOCAL lsb AS WORD ' IF noot < 48 THEN FUNCTION = %False :EXIT FUNCTION ' IF noot > 84 THEN FUNCTION = %False: EXIT FUNCTION ' velo = -1170.342 + (61.77662 * noot) - (1.077227 * (noot ^2)) + (6.265741E-03 * (noot^3)) ' retval = FIX(velo) ' must have a bug... ' f = FRAC(velo) * 128 ' now 0-127 ' SHIFT LEFT retval, 8 ' lsb = FIX(f) ' FUNCTION = retval OR lsb 'END FUNCTION 'FUNCTION Sire_Play (BYVAL noot AS INTEGER, BYVAL velo AS BYTE) EXPORT AS LONG ' ' te doen: ' ' automatische beveiliging tegen teveel hoog draaiende sirenes binnen 1 module. ' ' velo info gebruiken voor proportioneel inschakelen van meerdere sirenes bij lage noten. ' DIM Sirens(23) AS STATIC LONG ' LOCAL i AS DWORD ' STATIC j AS DWORD ' LOCAL nv AS WORD ' IF ISFALSE velo THEN ' ' zoek de sirene die de noot speelt en schakel haar uit: ' nv = Sire_MidiNoot2Velo (noot) ' i = 0 ' DO ' IF Sirens(i) = nv THEN ' mPlay Sire.channel, Sire.lowtes + i, %False ' met breaking function ' Sirens(i) = %False ' FUNCTION = %True ' EXIT FUNCTION ' END IF ' INCR i ' LOOP UNTIL i > 23 ' EXIT FUNCTION ' END IF ' i = %False ' DO ' IF ISFALSE Sirens(j) THEN ' nv = Sire_MidiNoot2Velo (noot) ' mPlay Sire.channel,Sire.lowtes + j, HIBYT(nv) ' Controller Sire.channel, Sire.lowtes + j, LOBYT(nv) ' Sirens(j) = nv ' FUNCTION = %True ' EXIT FUNCTION 'loop ' END IF ' INCR j ' IF j > 23 THEN j = 0 ' INCR i ' LOOP UNTIL i > 23 'END FUNCTION