home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Logiciels PC 21
/
LogicielsPC_21.iso
/
Musique
/
Jambient
/
jambient.CAB
/
ExampleScript.jms
< prev
next >
Wrap
Text File
|
2000-09-06
|
14KB
|
436 lines
Option Explicit
'A bunch of constants that help make the code read better
'For identifying loops
Const A = 1
Const B = 2
Const c = 3
Const D = 4
Const E = 5
Const f = 6
Const g = 7
Const H = 8
Const i = 9
Const j = 10
Const k = 11
Const l = 12
Const M = 13
Const N = 14
Const o = 15
Const p = 16
Const Gang = 17
Const Listener = 17
'For playstates
Const StopIt = 0
Const PlayIt = 1
Const PauseIt = 2
Const UnpauseIt = 3
'For playmodes
Const OneShot = 1
Const LoopLoop = 2
Const Track = 3
Const Drum = 4
'For types of patterns
Const VolPattern = 1
Const PithcPattern = 2
Const PanPattern = 3
'For fading
Const FadeOff = 0
Const FadeUp = 1
Const FadeSwitch = 2
Const FadeDown = 3
'For identifying types of buttons
Const SliderType = 0
Const ButtonType = 1
Const CheckType = 2
Const DropDownType = 3
Const pi=3.1415926535897932
'This variable controls what happens
'in OnPositionScroll
Dim PositionBehaviour
'For moving the mix pad ball in an orbit
Dim DegreeStep
Dim RandomRadius
Dim Degree
'For knudging loops
Dim KnudgeAmount
Dim ToScramble(16) 'keeps track of which loops to scramble
Dim ScrambleAmount
'========================
'PitchIt and InitPitchIt let the user
'bump the pitch of gang controlled loops up and down
Sub PitchIt(ListIndex, ItemText)
'this is fired whenever the user selects an option from
'the drop down
Dim Lp
Select Case ItemText
Case "Half Pitch (Gang)"
For Lp = A To p
If jam.IsGanged(Lp) Then
jam.Pitch(Lp) = jam.Pitch(Lp) / 2
End If
Next
Case "Double Pitch (Gang)"
For Lp = A To p
If jam.IsGanged(Lp) Then
jam.Pitch(Lp) = jam.Pitch(Lp) * 2
End If
Next
end Select
PitchDropDown.ListIndex = 0
End Sub
Sub InitPitchIt
if jam.AttachControl("PitchIt",DropDownType, "PitchDropDown") then
'if we were successful in attaching a drop down to the ScrollingType Procedure
'then the PosDropdown object is created
'manipulate it
with PitchDropDown
.Clear 'ensure clean slate if a reload is called
.AddItem "<Chng Gang Pitch>"
.AddItem "Half Pitch (Gang)"
.AddItem "Double Pitch (Gang)"
.ToolTipText = "Pitch up or down; click first option to cancel."
.ListIndex = 0 'set to first option
end with
end if
end sub
'==========================
'InitScrolling, PositionType, OnPositionScroll and the variable
'Position behaviour make up a code set that responds to movement
'on the 3d map
Sub PositionType(ListIndex, ItemText)
'Init scrolling attached a drop down list box to the control
'when the user clicks on it, the listindex of the selection and its text
'are passed to this procedure
PositionBehaviour = ListIndex
jam.ReadOut LIstIndex & " " & ItemText
End Sub
Sub OnPositionScroll(LoopIndex, X, Y, DX, DY)
'Sub OnPositionChange(LoopIndex, X, Y)
'this is an example of a scrolling event that is called
'when the user moves loops in the 3d map
'The behaviour depends on PositionBehaviour which is controlled
'through the drop down attached to sub PositionType
'In the mirror behaviour,
'the first 8 looptracks control the position of the one's 8 looptracks after,
Dim i
Dim Band
Dim NX
Dim NY
'jam.Readout X & ": " '& DX
Select Case PositionBehaviour 'this is set using SldMirrorType, when sliders are working
Case 0 'mirroring around both axes
If LoopIndex <= 8 Then
jam.SetXY LoopIndex + 8, X * -1, Y * -1
End If
Case 1 'mirroring around X axis only
If LoopIndex <= 8 Then
jam.SetXY LoopIndex + 8, X * -1, Y
End If
Case 2 'mirroring around Y axis only
If LoopIndex <= 8 Then
jam.SetXY LoopIndex + 8, X, Y * -1
End If
Case 3
if LoopIndex<>Listener then
Band = jam.BandOf(LoopIndex)
if LoopIndex = jam.BandFirst(Band) then
'this is the first loop in the band
For i = jam.BandFirst(Band) To jam.BandLast(Band)
If i <> LoopIndex Then
jam.GetXY i, NX, NY
jam.SetXY i, NX +DX, NY+DY
End If
Next
end if
end if
Case 4
if LoopIndex=Listener then
for i = jam.BandFirst(0) to jam.BandLast(0)
jam.GetXY i, NX, NY
jam.SetXY i, NX +DX, NY+DY
next
end if
End Select
End Sub
Sub InitScrolling
Dim MyControl
if jam.AttachControl("PositionType",DropDownType, "PosDropDown") then
'if we were successful in attaching a drop down to the ScrollingType Procedure
'then the PosDropdown object is created
'manipulate it
with PosDropDown
.Clear 'ensure clean slate if a reload is called
.AddItem "XY Mirror"
.AddItem "X Mirror"
.AddItem "Y Mirror"
.AddItem "Flying Wedge"
.AddItem "Red band follow listener"
.AddItem "None"
.ToolTipText = "Choose behaviour for scrolling routines."
.ListIndex = 0 'set to xy mirror
end with
end if
End Sub
'================================
'the following subs make up another code set that
'makes the mix pad cursor move in circles
Sub ToggleClock (Checked)
'respond to check box toggling by toggling clock
jam.Clock = checked
end sub
Sub ClockInterval (Value, Scrolling)
jam.Readout "Clock interval: " & Value & "ms"
if not Scrolling then
jam.ClockInterval = Value
end if
end sub
Sub DegreeTurn (Value,Scrolling)
jam.Readout "Degree Step per Clock tick : " & Value
if Scrolling then
'the user is still scrolling, with the mouse button down
else
'the user has let go of the mouse button
DegreeStep = Value
end if
end sub
Sub RandomRadiusSlider (Value,Scrolling)
jam.Readout "Random Radius : " & Value
if Scrolling then
'the user has let go of the mouse button
RandomRadius = Value
end if
end sub
Sub ScrambleSlider (Value,Scrolling)
Dim Lp
jam.ReadOut "Scramble by " & Value & "%"
if not Scrolling then
for Lp = a to p
ToScramble(lp)=jam.IsGanged(Lp)
next
ScrambleAmount = Value
end if
end sub
Sub OnClock(DeltaMilliSeconds, SessionSeconds, SessionMilliSeconds)
'when the clock fires, this event handler is called
'DeltaMilliSeconds is the number of milliseconds since the last clock fire
'SessionSeconds is the number of seconds since the beginning of the session
'SessionMilliSeconds is the number of milliseconds since the beginning of the session
Dim r
Dim Lp
if DegreeStep<>0 then
'function for circle given angle; * pi/180 converts degrees to radians
r = RandomRadius*rnd()
jam.Readout "Clock " & Degree
jam.PadPolar Degree, 0.5+ RandomRadius*rnd() ',0.2,0.2' XY cos(Degree* pi/180 )*(0.5+r), sin(Degree* pi/180 )*(0.5+r)
Degree = Degree+DegreeStep
if Degree>360 then
Degree = Degree-360
end if
end if
if abs(ScrambleAmount)>3 then
For Lp = A To p
If ToScramble(Lp) Then
jam.Pos(Lp) = jam.Pos(Lp) - (rnd()*ScrambleAmount)
End If
Next
end if
End Sub
Sub ScrambleWires()
Dim Lp
for Lp = A to P
jam.Wire(Lp)=int(4*rnd+1) ' assign a random channel
next
End sub
Sub InitClock
if jam.AttachControl("ToggleClock",CheckType, "ClockCheck") then
'if a check box is successfully attached, then
'it's in the object check
with ClockCheck
.caption = "Clock On"
.tooltiptext ="Toggle clock on and off to trigger events in time"
end with
end if
if jam.AttachControl("ClockInterval",SliderType, "ClockSlider") then
'if a check box is successfully attached, then
'it's in the object check
with ClockSlider
.tooltiptext ="Set clock interval"
'have to call this to set caption because of bad positioning in the slider control
jam.SetSliderCaption ClockSlider, "Clk Interval"
.ScaleMin =20
.ScaleMax = 200
.PointerValue 20
jam.ClockInterval = .PointerValue
end with
end if
if jam.AttachControl("ScrambleSlider",SliderType, "ScramSlider") then
'if a check box is successfully attached, then
'it's in the object check
with ScramSlider
.tooltiptext ="If <> 0 then ganged loops will be repositioned by and rand % based on this value, on each clock ticks"
'have to call this to set caption because of bad positioning in the slider control
jam.SetSliderCaption ScramSlider, "Scramble Amount"
.ScaleMin =-90
.ScaleMax = 90
.PointerValue 0
ScrambleAmount = .PointerValue
end with
end if
if jam.AttachControl("DegreeTurn",SliderType, "DegreeSlider") then
'if a check box is successfully attached, then
'it's in the object check
with DegreeSlider
'have to call this to set caption because of bad positioning in the slider control
jam.SetSliderCaption DegreeSlider, "Degree Step"
.ScaleMin =0
.ScaleMax = 10
.PointerValue 0
DegreeStep = .PointerValue
.ToolTipText = "Set degree step; 0 to turn off"
end with
end if
if jam.AttachControl("RandomRadiusSlider",SliderType, "RadiusSlider") then
'if a check box is successfully attached, then
'it's in the object check
with RadiusSlider
.tooltiptext ="Set random radius factor for pad cursor movement"
'have to call this to set caption because of bad positioning in the slider control
jam.SetSliderCaption RadiusSlider, "Rnd Radius"
.ScaleMin =0
.ScaleMax = 0.5
.PointerValue 0
RandomRadius = .PointerValue
.ToolTipText = "Set rand radius"
end with
end if
if jam.AttachControl("ScrambleWires",ButtonType, "Scramble") then
'if the Scramble button is successfully attached,
with Scramble
.caption = "Scramble Wires"
.tooltiptext ="Click to generate a random wire assignment"
end with
end if
'Initialize variables
Degree=0
jam.ClockInterval = 40
end sub
'================================
'this code set is for knudging ganged loops back and forth
Sub Knudge(Value, Scrolling)
Dim Lp
jam.ReadOut "Knudge Amount: " & Value & "% of sample"
if not Scrolling then
For Lp = A To p
If jam.IsGanged(Lp) Then
jam.Pos(Lp) = jam.Pos(Lp) - Value
End If
Next
end if
end sub
Sub InitKnudge()
'set up controls for the knudge procedure
if jam.AttachControl("Knudge",SliderType, "KnudgeSlider") then
'if the knudgeslider is successfully attached
with KnudgeSlider
.tooltiptext ="Click pointer to knudge, slide pointer to adjust knudge amount."
'have to call this to set caption because of bad positioning in the slider control
jam.SetSliderCaption KnudgeSlider, "Knudge"
.ScaleMin =-90
.ScaleMax = 90
.PointerValue 50
.ToolTipText = "Knudge loop forward or backward"
end with
end if
End Sub
'============================
'various event handlers
Sub OnPanChange(LoopIndex, Pan)
'an example of an event handler; CHANGE handlers are called when
'the knob is finished turning
'this one makes loop B be twice the pitch of A
If LoopIndex = A Then
jam.Pan(B) = Pan*-1
End If
End Sub
Sub OnPanScroll(LoopIndex, Pan, DPan)
'an example of an event handler; CHANGE handlers are called when
'the knob is finished turning
'this one makes loop B be twice the pitch of A
If LoopIndex = o Then
jam.Pan(P) = jam.Pan(P) +DPan
End If
End Sub
Sub OnVolChange(LoopIndex, Vol)
'an example of an event handler; CHANGE handlers are called when
'the knob is finished turning
'this one makes loop B be twice the pitch of A
If LoopIndex = A Then
jam.Vol(B) = Vol/2
End If
End Sub
Sub OnVolScroll(LoopIndex, Vol, DVol)
'an example of an event handler; CHANGE handlers are called when
'the knob is finished turning
'this one makes loop B be twice the pitch of A
If LoopIndex = o Then
jam.Vol(P) = jam.Vol(P) +DVol
End If
End Sub
Sub OnPitchScroll(LoopIndex, Pitch, DPitch)
'an example of an event handler; CHANGE handlers are called when
'the knob is finished turning
'this one makes loop B be twice the pitch of A
If LoopIndex = o Then
jam.Pitch(P) = jam.Pitch(P) +DPitch
End If
End Sub