The following is a script to control interactivity in music for the game Whiplash. The script is fed to a proprietary music interactivity system use in that game. It receives variable input from the game program, and responds to change the music according to the amount of action in which the the player engages. =================================================== // Hubs.txt // Midi script for Hubs music module. #include Hubs.inc @1:1:0 // Initialize tempo, volume, and track muting for all slots SelectSlot 0 SetTempo 90 SelectSlot 1 AssignSequence HiberSeq StartSlot SetSlotVolume 127 SlotVolumeFade 0 1 UnmuteChannels 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 SelectSlot 2 AssignSequence IdleSeq StartSlot SetSlotVolume 127 SlotVolumeFade 0 127 UnmuteChannels 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 SelectSlot 3 AssignSequence MovingSeq StartSlot SetSlotVolume 127 SlotVolumeFade 0 127 UnmuteChannels 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 SelectSlot 4 AssignSequence ActionSeq StartSlot SetSlotVolume 127 SlotVolumeFade 0 1 UnmuteChannels 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 SelectSlot 5 AssignSequence MayhemSeq StartSlot SetSlotVolume 127 SlotVolumeFade 0 1 UnmuteChannels 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 SelectSlot 6 AssignSequence AlarmSeq StartSlot SetSlotVolume 1 UnmuteChannels 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 // SetVariable 0 Glide SetVariable 1 State // Var 1 - Setting to '1' starts the music in state "Moving" SetVariable 0 PreviousState // Var 2 - Facilitates state switching SetVariable 0 Counter // Var 3 - Allows timing of idle mode SetVariable 0 Alarm // Var 0 - Actual alarm on-off switch SetVariable 0 AlarmState // Var 4 - Is this needed?? SetVariable 0 PreviousAlarmState // Var 5 - Facilitates alarm switching // ---------- MAINLOOP ----------------- @1:1:0 DefineLabel MainLoop BranchIfVarGreaterOrEqual Counter 250 SkipCounter AddVariable 1 Counter DefineLabel SkipCounter BranchIfVarNotEqual State PreviousState State BranchIfVarEqual Alarm PreviousAlarmState Endloop BranchIfVarEqual Alarm 0 AlarmOff BranchIfVarEqual Alarm 1 AlarmOn DefineLabel AlarmOff SetVariable PreviousAlarmState AlarmState SelectSlot ScriptSlot SetTempo 90 SelectSlot HiberSlot SetTempo 90 SelectSlot IdleSlot SetTempo 90 SelectSlot MovingSlot SetTempo 90 SelectSlot ActionSlot SetTempo 90 SelectSlot MayhemSlot SetTempo 90 SelectSlot AlarmSlot SetTempo 90 SetSlotVolume 1 SetVariable 0 PreviousAlarmState Goto EndLoop DefineLabel AlarmOn SelectSlot ScriptSlot SetTempo 96 SelectSlot HiberSlot SetTempo 96 SelectSlot IdleSlot SetTempo 96 SelectSlot MovingSlot SetTempo 96 SelectSlot ActionSlot SetTempo 96 SelectSlot MayhemSlot SetTempo 96 SelectSlot AlarmSlot SetTempo 96 SetSlotVolume 127 SetVariable 1 PreviousAlarmState Goto EndLoop @1:1:1 DefineLabel EndLoop // WHY IS THE FOLLOWING LINE HERE? BranchIfVarEqual State 0 Idle // Because this facilitates returning to the idle loop to check // on the counter to delay entrance of state Hiber @1:2:0 Goto Mainloop // ---------- STATES ------------------- // IDLE - @2:1:0 DefineLabel ResetCounter // This is state zero SetVariable 0 Counter DefineLabel Idle // This is state four CopyVariable State PreviousState @2:2:0 BranchIfVarLess Counter 31 Mainloop BranchIfVarGreater Counter 31 Hiber SelectSlot IdleSlot SlotVolumeFade 1 127 UnmuteChannels 2 3 // Bass, Seq SelectSlot MovingSlot SlotVolumeFade 8 1 UnmuteChannels 2 // Bass echo SelectSlot ActionSlot SlotVolumeFade 8 1 SelectSlot MayhemSlot SlotVolumeFade 8 1 // HIBERNATE - DefineLabel Hiber BranchIfVarLess Counter 96 Mainloop SelectSlot IdleSlot SlotVolumeFade 8 1 SelectSlot HiberSlot SlotVolumeFade 4 127 Goto Mainloop // ------------------------------------ // MOVING - @3:1:0 DefineLabel Moving SelectSlot HiberSlot SlotVolumeFade 8 1 SelectSlot IdleSlot SlotVolumeFade 1 127 MuteChannels 3 // Seq UnmuteChannels 2 // Bass SelectSlot MovingSlot SlotVolumeFade 1 127 UnmuteChannels 2 3 // Bass echo, Seq SelectSlot ActionSlot SlotVolumeFade 8 1 SelectSlot MayhemSlot SlotVolumeFade 8 1 SetVariable 0 Counter CopyVariable State PreviousState Goto Mainloop // ------------------------------------ // ACTION - @4:1:0 DefineLabel Action SelectSlot HiberSlot SlotVolumeFade 8 1 SelectSlot IdleSlot SlotVolumeFade 1 127 UnmuteChannels 2 // Bass SelectSlot MovingSlot SlotVolumeFade 1 127 UnmuteChannels 2 // Bass echo SelectSlot ActionSlot SlotVolumeFade 1 127 SelectSlot MayhemSlot SlotVolumeFade 8 1 SetVariable 0 Counter CopyVariable State PreviousState SetVariable 0 MayhemLoopCounter @4:2:0 DefineLabel MayhemCheckLoop BranchIfVarEqual State Mayhem State BranchIfVarEqual MayhemLoopCounter 16 MayhemLoopDone AddVariable 1 MayhemLoopCounter @4:3:0 GoTo MayhemCheckLoop DefineLabel MayhemLoopDone @4:4:0 Goto Mainloop // ------------------------------------ // MAYHEM - @9:1:0 DefineLabel Mayhem SelectSlot HiberSlot // Not really needed SlotVolumeFade 8 1 // Not really needed SelectSlot IdleSlot SlotVolumeFade 1 127 MuteChannels 2 // Bass SelectSlot MovingSlot SlotVolumeFade 1 127 MuteChannels 2 // Bass echo SelectSlot ActionSlot SlotVolumeFade 1 127 SelectSlot MayhemSlot SlotVolumeFade 1 127 SetVariable 0 Counter CopyVariable State PreviousState @12:1:0 Goto Mainloop // ----