' ****************************** ' * lukas-code for GMT * ' ****************************** ' since tasknumbers will be used throughout your code a lot ' it's a smart idea to use declared constants for the task ' numbers in your own applications. ' Each tasknumber corresponds to a single checkbox in the cockpit. (numbered from 0 to 63) '------------------------------------------------------- TYPE SekwensType DWORD Har AS HarmType Tik AS DWORD END TYPE %Edison_a = 0 %Edison_b = 1 %edison_c = 2 %edison_d = 3 %thorvaldsen_a = 4 %thorvaldsen_b = 5 %thorvaldsen_c = 6 %thorvaldsen_d = 7 %thorvaldsen_e = 8 %thorvaldsen_f = 9 %rommel = 10 %sonate_s_R = 11 %sonate_s_L = 12 %pp_taak = 13 #INCLUDE "c:\b\pb\gmt\g_mm.bi" #INCLUDE "c:\b\pb\gmt\g_mm.inc" #INCLUDE "C:\b\pb\gmt\lukas\3_plagiaatinventies_1.inc" #INCLUDE "C:\b\pb\gmt\lukas\3_plagiaatinventies_2.inc" #INCLUDE "C:\b\pb\gmt\lukas\3_plagiaatinventies_3.inc" #INCLUDE "C:\b\pb\gmt\lukas\3_plagiaatinventies_P.inc" #INCLUDE "C:\b\pb\gmt\lukas\sonate_s.inc" DECLARE FUNCTION InitLHKompos (id AS LONG) AS DWORD DECLARE SUB LukasButnSWHandler () ' rerouting of the default buttonswitch handler in GMT-main FUNCTION InitLHKompos (id AS LONG) AS DWORD ' this function is called on selection of the popup in the setup menu. ' id = App.id LOCAL i AS DWORD LOCAL h AS LONG Init_MM IF hMidiI(0) THEN ' eventuele interaktive taken met midi input... END IF ' declaration of the tasks we want to find in the cockpit: Task(%Edison_a).naam = "Edison a" Task(%Edison_a).channel = 0 Task(%Edison_a).freq = 100 Task(%Edison_a).cptr = CODEPTR(edison_stem_a) Task(%Edison_b).naam = "Edison b" Task(%Edison_b).channel = 1 Task(%Edison_b).freq = 100 Task(%Edison_b).cptr = CODEPTR(edison_stem_b) Task(%Edison_c).naam = "Edison c" Task(%Edison_c).channel = 2 Task(%Edison_c).freq = 100 Task(%Edison_c).cptr = CODEPTR(edison_stem_c) Task(%Edison_d).naam = "Edison d" Task(%Edison_d).channel = 3 Task(%Edison_d).freq = 100 Task(%Edison_d).cptr = CODEPTR(edison_stem_d) Task(%thorvaldsen_a).naam = "thor a" Task(%thorvaldsen_a).freq = 100 Task(%thorvaldsen_a).cptr = CODEPTR(thorvaldsen_stem_a) Task(%thorvaldsen_a).channel = 0 Task(%thorvaldsen_a).patch = 0 Task(%thorvaldsen_b).naam = "thor b" Task(%thorvaldsen_b).freq = 100 Task(%thorvaldsen_b).cptr = CODEPTR(thorvaldsen_stem_b) Task(%thorvaldsen_b).channel = 1 Task(%thorvaldsen_b).patch = 0 Task(%thorvaldsen_c).naam = "thor c" Task(%thorvaldsen_c).freq = 100 Task(%thorvaldsen_c).cptr = CODEPTR(thorvaldsen_stem_c) Task(%thorvaldsen_c).channel = 2 Task(%thorvaldsen_c).patch = 0 Task(%thorvaldsen_d).naam = "thor d" Task(%thorvaldsen_d).freq = 100 Task(%thorvaldsen_d).cptr = CODEPTR(thorvaldsen_stem_d) Task(%thorvaldsen_d).channel = 3 Task(%thorvaldsen_d).patch = 0 Task(%thorvaldsen_e).naam = "thor e" Task(%thorvaldsen_e).freq = 100 Task(%thorvaldsen_e).cptr = CODEPTR(thorvaldsen_stem_e) Task(%thorvaldsen_e).channel = 4 Task(%thorvaldsen_e).patch = 0 Task(%thorvaldsen_f).naam = "thor f" Task(%thorvaldsen_f).freq = 100 Task(%thorvaldsen_f).cptr = CODEPTR(thorvaldsen_stem_f) Task(%thorvaldsen_f).channel = 5 Task(%thorvaldsen_f).patch = 0 task(%rommel).naam = "rommel" task(%rommel).freq = 100 task(%rommel).cptr = CODEPTR(rommel) Task(%rommel).channel = 0 Task(%rommel).patch = 0 Task(%pp_taak).naam = "piano" Task(%pp_taak).freq = 100 task(%pp_taak).cptr = CODEPTR(Piano_speler) task(%sonate_s_R).naam = "son s R" task(%sonate_s_R).freq = 100 task(%sonate_s_R).cptr = CODEPTR(sonate_s_R) task(%sonate_s_L).naam = "son s L" task(%sonate_s_L).freq = 100 task(%sonate_s_L).cptr = CODEPTR(sonate_s_L) '---------------------------------------------------------------------------------------- ' generally we read configuration data from a config.file. However, you can also code the ' cockpit layout for the buttons in-line, as done here: ' Note that we create the buttons only if they can be functional, i.e. if the required ' devices have been selected by the user: IF ISFALSE hMidiI(0) OR ISFALSE hMidiO(0) THEN ' midi I/O devices should have been selected ButnSW(0).tag0 = "" ButnSW(0).cPtr = %False END IF ButnSW(1).tag0 = "START" ' start/stop toggle ButnSW(1).tag1 = "STOP" ButnSW(1).cptr = %False ' use the code in this module. ' tags we do not delete remain with their default handling. IF ISFALSE Audio.hwO OR ISFALSE Audio.hWI THEN ' show this button only if wave out & wave in devices were selected. ButnSW(11).tag0 = "" ' note that I/O audio streaming will only work if your hardware allows for ButnSw(11).cPtr = %False ' simultaneous bidirection wave I/O ! END IF ' ONE SHOT FUNCTIONS: IF ISFALSE hMidiO(0) THEN ButnOS(0).tag = "" ButnOS(0).cPtr = %False END IF IF hMidiO(0) THEN ' ButnOS(1).tag = "PlaySeq" ' ButnOS(1).cptr = CODEPTR(PlaySeqFile) ELSE ButnOS(1).tag = "" END IF ButnOS(2).tag = "" ButnOS(3).tag = "" ButnOS(4).tag = "" ButnOS(5).tag = "" ButnOS(6).tag = "" ButnOS(7).tag = "" ButnOS(8).tag = "" ButnOS(9).tag = "" ButnOS(10).tag = "" App.butnSWCptr = CODEPTR(LukasButnSWHandler) ' rerouting of the default button switch handler SetDlgItemText gh.Cockpit,%GMT_TEXT_SLIDER0, "Level" & CHR$(0) ' used for midi level SetDlgItemText gh.Cockpit,%GMT_TEXT_SLIDER1, "Pan" & CHR$(0) ' panning in demos STATIC m AS ASCIIZ * 40 m = "Lukas Huisman" SendMessage gh.Cockpit, %WM_SETTEXT,0, VARPTR(m) SetDlgItemText gh.Cockpit, %GMT_AUTHOR, $LH SetDlgItemText gh.Cockpit, %GMT_TITLE, "Etudes" FUNCTION = %True END FUNCTION SUB LukasButnSWHandler () LOCAL ButtonNr AS LONG LOCAL i AS DWORD ' this procedure, called by its pointer in App.ButnSWCptr, handles button clicks in the ' cockpit window. (handle= hCockpit) ' The parameter is passed in App.butnSWparam. ButtonNr = App.butnSWparam - %GMT_BUTNSW_ID SELECT CASE ButtonNr CASE 1 ' starts the promil counter. IF ButnSW(Buttonnr).flag THEN App.MTstart = %True App.tstart = timeGetTime ' start the chronometerfunction SetDlgItemText gh.Cockpit, %GMT_BUTNSW_ID + ButtonNr, "STOP" ClearMiBuf 0 ' start with a blank midi input buffer IF hMidiI(0) THEN BlockSysExReception hMidiI(0) ' SxThread dll proc END IF RunTime %True Promil %True StartTask App.GlobalHarmonyTaskNr ELSE App.MTstart = %False SetDlgItemText gh.Cockpit, %GMT_BUTNSW_ID + ButtonNr, "CONT" Promil %False StopTask App.GlobalHarmonyTasknr END IF END SELECT App.ButnSWparam = %False ' reset the passed buttonnumber. END SUB '[EOF]