Exemplo n.º 1
0
		public void Evaluate(int SpreadMax)
		{
			if(FLiveSet != null)
			{
				if( (FTrack.IsChanged || FRefresh) || ( (track == null) && (FTrack[0] != null) ) )//update track
				{
					
					if(FRefreshEventInited)
					{
						if(FLiveSet[0] != null) FLiveSet[0].NotifyRefresh -= onRefresh;
					}
					
					if(FLiveSet[0] != null) 
					{
						FLiveSet[0].NotifyRefresh += onRefresh;
						FRefreshEventInited = true;
					}
					
					track = FLiveSet[0].GetTrackByName(FTrack[0].Name);
					
					if(track != null)
					{
						//clips
						double[] ClipLength;
						string[] ClipNames;
						var cnt = track.GetClips(out ClipLength, out ClipNames);
						FLength.AssignFrom(ClipLength);
						FClipName.AssignFrom(ClipNames);
					}
					//clear event
					FRefresh = false; 
				}
				//read the outputs
				if(track != null) 
				{
					if(FFireClipBang.IsChanged && FFireClipBang[0]) 
						FLiveSet[0].SendToLive(track.getAddr("fire_clip"), track.GetClipSlotByIndex(FClip[0]));
					
					if(FStop.IsChanged && FStop[0]) 
						FLiveSet[0].SendToLive(track.getAddr("stop_clip"), -1); //track.GetClipSlotByIndex(FClip[0])
					
					if(FScrub.IsChanged)
					{
						var clip =  track.GetClipBySlotIndex(track.playing_slot_index);
						if(clip != null)
						{
							float new_pos = (float) (FScrub[0] * clip.Length_in_beats);
							FLiveSet[0].SendToLive(track.getAddr("scrub_clip"), new_pos);
						}
						
					}
					
					if(FPitch.IsChanged) 
					{
						int pitch_coarse = (int) FPitch[0];
						float pitch_fine = (float) (FPitch[0] - pitch_coarse);
						
						FLiveSet[0].SendToLive(track.getAddr("pitch_clip"), pitch_coarse);
					}
					//if(FStopAll.IsChnaged && FStop[0]) FLiveSet[0].SendToLive(track.getAddr("stop_all_clips"), track.GetClipSlotByIndex(FClip[0]));
					
					FActiveClipSlot[0] 	= track.ActiveClipID;
					FActiveClipName[0] 	= track.ActiveClipName;
				} 
			}
		}
Exemplo n.º 2
0
		//Tracks
		
		public AbletonLiveTrack GetTrackByIndex(int TrackIndex)
		{
			if(TrackIndex == -1) return null;
			
			if(FTrack.ContainsKey(TrackIndex))
			{
				return FTrack[TrackIndex];
			}
			else if(TrackIndex > -1)
			{
				AbletonLiveTrack Track = new AbletonLiveTrack(TrackIndex, "_Track_" + TrackIndex.ToString());
				FTrack.Add(TrackIndex, Track);
				RaiseNotifyRefresh();
				return Track;
				
			}
			
			return null;
		}
Exemplo n.º 3
0
		public void Evaluate(int SpreadMax)
		{
			if( (FLiveSet != null) )
			{
				if( (FTrack.IsChanged || FRefresh) || ((track == null)&& (FTrack[0] != null)) )//update track
				{
					if(FRefreshEventInited)
					{
						if(FLiveSet[0] != null) FLiveSet[0].NotifyRefresh -= onRefresh;
					}
					
					if(FLiveSet[0] != null) 
					{
						FLiveSet[0].NotifyRefresh += onRefresh;
						FRefreshEventInited = true;
					}
					
				 	track = FLiveSet[0].GetTrackByName(FTrack[0].Name);
					
					FRefresh = false; 
				}
				
				if(track != null) //read the outputs
				{
					//set inputs
					if(FVolumeIn.IsChanged) FLiveSet[0].SendToLive(track.getAddr("volume"), (float) FVolumeIn[0]);
					if(FPanIn.IsChanged) 	FLiveSet[0].SendToLive(track.getAddr("pan"), (float) FPanIn[0]);
					
					if(FMutedIn.IsChanged) 	FLiveSet[0].SendToLiveTrack(track.getAddr("set"), "mute", FMutedIn[0] ? 1 : 0  );
					if(FSoloIn.IsChanged) 	FLiveSet[0].SendToLiveTrack(track.getAddr("set"), "solo", FSoloIn[0]  ? 1 : 0  );
					if(FArmedIn.IsChanged) 	FLiveSet[0].SendToLiveTrack(track.getAddr("set"), "arm",  FArmedIn[0] ? 1 : 0  );
					
					//outputs 
					FPeak[0]			= track.Peak;
					FLeft[0] 			= track.Level_L;
					FRight[0] 			= track.Level_R;
					
					FVolumeOut[0] 		= track.Volume;
					FPanOut[0] 			= track.pan;
					
					FMutedOut[0] 		= track.isMuted;
					FSoloOut[0] 		= track.isSolo;
					FArmedOut[0] 		= track.isArmed;
				} 
			}
		}