Пример #1
0
		/// <summary>
		/// An edit has finished - adjust following tracks so there is 5 sec before and after start & end
		/// </summary>
		void ChangesFinished(object sender, TrackJoin e) {
			// Undoable action - save current track gaps and lengths on stack
			StackUndo(new UndoMove(), false, delegate() {
				int i = m_Tracks.IndexOf(e) + 1;
				if (i > 0) {
					while (i < m_Tracks.Count) {
						TrackJoin j = m_Tracks[i++];
						j.Adjust(5);
					}
				}
			});
		}
Пример #2
0
		/// <summary>
		/// User has change a track gap, and has pressed Ctrl to alter all the others, so need to update all subsequent ones
		/// </summary>
		void GapChanged(object sender, TrackJoin.CascadingEvent e) {
			// Keep following track lengths same, but change all the gaps
			int i = m_Tracks.IndexOf(e.Track) + 1;
			float change = 0;
			if (i > 0) {
				while (i < m_Tracks.Count) {
					TrackJoin j = m_Tracks[i++];
					j.End += change;
					change += e.Change;
					j.Start += change;
				}
			}
		}
Пример #3
0
		/// <summary>
		/// User has change the start of a track, and lock is on, so need to update all subsequent ones
		/// </summary>
		void StartChanged(object sender, TrackJoin.CascadingEvent e) {
			// Keep following track lengths the same
			int i = m_Tracks.IndexOf(e.Track) + 1;
			if (i > 0) {
				while (i < m_Tracks.Count) {
					TrackJoin j = m_Tracks[i++];
					j.End += e.Change;
					j.Start += e.Change;
				}
			}
		}
Пример #4
0
		/// <summary>
		/// Build TrackJoin controls to display joins between (and after) tracks.
		/// Must be called from UI thread.
		/// </summary>
		public void BuildTrackJoins() {
			Status("Creating display");
			m_Tracks = new List<TrackJoin>();
			if (Program.Album != null) {
				TrackJoin prev = null;	// TrackJoins need to be linked to previous one (to calculate length, etc.)
				foreach (Track t in Program.Album.Tracks) {
					TrackJoin j = new TrackJoin(prev, t) {
						Dock = DockStyle.Top,
						Name = "Track" + m_Tracks.Count,
					};
					j.waveControl.WaveFile = m_Reader;
					m_Tracks.Add(j);
					// Attach event handlers to tidy up after edits
					j.StartChanged += StartChanged;
					j.GapChanged += GapChanged;
					j.ChangesFinished += ChangesFinished;
					prev = j;
				}
				// Now one for the end of the album
				TrackJoin end = new TrackJoin(prev, null) {
					ShowStart = false,	// No start of next track
					Dock = DockStyle.Top,
					Name = "End"
				};
				end.waveControl.WaveFile = m_Reader;
				m_Tracks.Add(end);
			}
			// Add to panel - reverse causes dock to put them in the right order
			m_Tracks.Reverse();
			trackPanel.Controls.Clear();
			trackPanel.Controls.AddRange(m_Tracks.ToArray());
			m_Tracks.Reverse();
		}
Пример #5
0
		/// <summary>
		/// Constructor used by MainForm when making list of tracks.
		/// Sets everything inteligently according to prev
		/// </summary>
		/// <param name="prev">Previous track TrackJoin</param>
		/// <param name="t">Track</param>
		public TrackJoin(TrackJoin prev, Track t) : this() {
			Previous = prev;
			ShowEnd = prev != null;	// No end cursor on first track
			Track = t;
			UpdateFromTrack();
		}
Пример #6
0
			public CascadingEvent(TrackJoin track, float change) {
				Track = track;
				Change = change;
			}