voor een directo rmidi applicatie proberen we een verticale volumebar te maken. We hebben een voorbeeld van de maker van het programma over hoe dit te doen is, maar het voorbeeld gebruikt een horizontale volumebar. Hij heeft de lingo hiervoor zelf geschreven en dit lijkt niks op de code die director zelf aanmaakt voor een volumebar. De beste oplossing voor ons zou dus zijn om de code die de maker gemaakt heeft aan te passen zodat deze verticaal word, maar de vraag is dus of iemand weet hoe dit te doen is...
De code voor de horizontale bar is:
De code voor de horizontale bar is:
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
| on exitFrame
-- min 250
-- max 440
global lastPos
global xm
global gOutConnected
set pos to the left of sprite 6
-- if sprite moves
if (pos <> lastPos) then
-- get delta from left edge
set delta to pos - 250
-- get percentage of total width
set pct = float(delta) / float(440-250)
-- use percentage to create midi value
set midiValue to integer(pct * 127)
set pitchBendValue to integer(pct * 16383 - 8192)
if (gOutConnected <> 0) then
-- NOTE: comment out the sendController line and remove the "--" from
-- one of the other lines to send that particular MIDI message
sendController(xm, 1, 1, midiValue) -- send ctl chg to chan 1, ctl 1
-- sendMonoAftertouch(xm, 1, midiValue) -- send mono aftertouch chan 1
-- sendPolyAftertouch(xm, 1, 60, midiValue) -- send mono aftertouch chan 1
-- sendPitchBend(xm, 1, pitchBendValue) -- send mono aftertouch chan 1
-- sendProgramChange(xm, 1, midiValue) -- send mono aftertouch chan 1
end if
set lastPos to pos
end if
end |