home *** CD-ROM | disk | FTP | other *** search
- on loadSynth
- global gPath, gArp, gProg, gOnSynth, gPosVolSynth, gPosPanSynth, gSynthSel, gLoadSynth, synthList, progList, arpList, folderSynthList
- set loadSynth to gLoadSynth
- set gLoadSynth to EMPTY
- cursor(4)
- set myFile to new(xtra("fileio"))
- openFile(myFile, loadSynth, 1)
- set theFile to readFile(myFile)
- closeFile(myFile)
- set myFile to 0
- set sourceSynth to word 1 of line 2 of theFile
- set isSynth to 1
- repeat with j = 1 to the number of words in line 1 of theFile
- if not getPos(["C1", "Cd1", "D1", "Dd1", "E1", "F1", "Fd1", "G1", "Gd1", "A1", "Ad1", "B1", "C2", "Cd2", "D2", "Dd2", "E2", "F2", "Fd2", "G2", "Gd2", "A2", "Ad2", "B2", "C3", "Cd3", "D3", "Dd3", "E3", "F3", "Fd3", "G3", "Gd3", "A3", "Ad3", "B3"], word j of line 1 of theFile) then
- set isSynth to 0
- exit repeat
- end if
- end repeat
- if not getPos(folderSynthList, sourceSynth) then
- set isSynth to 0
- end if
- if not getPos(arpList, word 2 of line 2 of theFile) then
- set isSynth to 0
- end if
- if not getPos(progList, word 3 of line 2 of theFile) then
- set isSynth to 0
- end if
- repeat with j = 4 to 5
- if not ((integer(word j of line 2 of theFile) >= 9) and (integer(word 4 of line 2 of theFile) <= 54)) then
- set isSynth to 0
- end if
- end repeat
- if isSynth then
- set synthList to []
- repeat with i = 1 to the number of words in line 1 of theFile
- setAt(synthList, i, word i of line 1 of theFile)
- end repeat
- set gArp to word 2 of line 2 of theFile
- set gProg to word 3 of line 2 of theFile
- set gPosVolSynth to integer(word 4 of line 2 of theFile)
- set gPosPanSynth to integer(word 5 of line 2 of theFile)
- put gProg into field "fieldProg"
- put gArp into field "fieldArp"
- put word 1 of line 2 of theFile into field "fieldSynth"
- repeat with i = 1 to 3
- set start to (12 * (i - 1)) + 3
- repeat with j = 1 to 12
- set nota to the name of member the memberNum of sprite (start + j)
- if char 1 of nota = "y" then
- set nota to chars(nota, 2, length(nota)) & i
- if not getPos(synthList, nota) then
- set nota to chars(nota, 1, length(nota) - 1)
- set the memberNum of sprite (start + j) to the number of member nota
- updateStage()
- end if
- next repeat
- end if
- set nota to nota & i
- if getPos(synthList, nota) then
- set nota to "y" & chars(nota, 1, length(nota) - 1)
- set the memberNum of sprite (start + j) to the number of member nota
- updateStage()
- end if
- end repeat
- end repeat
- if gOnSynth then
- IKSynthStop()
- else
- set gOnSynth to 1
- end if
- IKSetSynth(gPath & "Synth\" & field "fieldSynth" & "\")
- set the locV of sprite 45 to gPosVolSynth
- set the locV of sprite 46 to gPosPanSynth
- updateStage()
- case char 1 of gArp of
- "[":
- set arp to 1
- "]":
- set arp to 2
- "{":
- set arp to 4
- "}":
- set arp to 8
- end case
- IKSynthVolume(integer(128 * (-gPosVolSynth + 54) / 45))
- IKSynthPan(integer(128 * (-gPosPanSynth + 54) / 45))
- IKSynthArp(getPos(progList, gProg) - 1, arp, createSeq())
- if gSynthSel then
- set the locH of sprite 74 to -20
- set gSynthSel to 0
- end if
- else
- openWin("Message")
- tell window "Message"
- go("21")
- end tell
- end if
- cursor(-1)
- end
-