internal void ReadSongBlock(System.IO.StreamReader file) { string line; TuningLookup tuning = new TuningLookup(); while ((line = file.ReadLine()) != null) { if (line.ToUpper() == "BLOCK_END") { return; } //READ THE DATA //Split the track data SongNoteGroup new_song_group = new SongNoteGroup(); string[] TrackData = line.Split(','); for (int i = 0; i < TrackData.Length; i++) { //we need to split the data and store in out song note string[] note_data = TrackData[i].Split(':'); new_song_group.track[i].note = note_data[0].Trim(); new_song_group.track[i].feq = tuning.GetFeq(note_data[0].Trim()); new_song_group.track[i].volume = double.Parse(note_data[1].Trim()); new_song_group.track[i].sound = int.Parse(note_data[2].Trim()); } this.track_lines.Add(new_song_group); } tuning = null; }
public SongNoteGroup Get_Current_TrackLine() { if (this.current_track_line == -1) { this.current_track_line = 0; } if (this.track_line == null) { this.track_line = this.track_lines[this.current_track_line]; } return(this.track_line); }
public bool Next_Track_Line() { current_track_line += 1; if (this.current_track_line > track_lines.Count - 1) { this.current_track_line = 0; this.track_line = this.track_lines[this.current_track_line]; return(true); } else { this.track_line = this.track_lines[this.current_track_line]; } return(false); }
internal void ReadSongBlock(System.IO.StreamReader file) { string line; TuningLookup tuning = new TuningLookup(); while ((line = file.ReadLine()) != null) { if (line.ToUpper() == "BLOCK_END") { return; } //READ THE DATA //Split the track data SongNoteGroup new_song_group = new SongNoteGroup(); string[] TrackData = line.Split(','); for (int i = 0; i < TrackData.Length; i++) { //we need to split the data and store in out song note string[] note_data = TrackData[i].Split(':'); switch (i) { case 0: new_song_group.track1.note = note_data[0].Trim(); new_song_group.track1.feq = tuning.GetFeq(note_data[0].Trim()); new_song_group.track1.volume = double.Parse(note_data[1].Trim()); new_song_group.track1.sound = int.Parse(note_data[2].Trim()); break; case 1: new_song_group.track2.note = note_data[0].Trim(); new_song_group.track2.feq = tuning.GetFeq(note_data[0].Trim()); new_song_group.track2.volume = double.Parse(note_data[1].Trim()); new_song_group.track2.sound = int.Parse(note_data[2].Trim()); break; case 2: new_song_group.track3.note = note_data[0].Trim(); new_song_group.track3.feq = tuning.GetFeq(note_data[0].Trim()); new_song_group.track3.volume = double.Parse(note_data[1].Trim()); new_song_group.track3.sound = int.Parse(note_data[2].Trim()); break; case 3: new_song_group.track4.note = note_data[0].Trim(); new_song_group.track4.feq = tuning.GetFeq(note_data[0].Trim()); new_song_group.track4.volume = double.Parse(note_data[1].Trim()); new_song_group.track4.sound = int.Parse(note_data[2].Trim()); break; case 4: new_song_group.track5.note = note_data[0].Trim(); new_song_group.track5.feq = tuning.GetFeq(note_data[0].Trim()); new_song_group.track5.volume = double.Parse(note_data[1].Trim()); new_song_group.track5.sound = int.Parse(note_data[2].Trim()); break; case 5: new_song_group.track6.note = note_data[0].Trim(); new_song_group.track6.feq = tuning.GetFeq(note_data[0].Trim()); new_song_group.track6.volume = double.Parse(note_data[1].Trim()); new_song_group.track6.sound = int.Parse(note_data[2].Trim()); break; case 6: new_song_group.track7.note = note_data[0].Trim(); new_song_group.track7.feq = tuning.GetFeq(note_data[0].Trim()); new_song_group.track7.volume = double.Parse(note_data[1].Trim()); new_song_group.track7.sound = int.Parse(note_data[2].Trim()); break; case 7: new_song_group.track8.note = note_data[0].Trim(); new_song_group.track8.feq = tuning.GetFeq(note_data[0].Trim()); new_song_group.track8.volume = double.Parse(note_data[1].Trim()); new_song_group.track8.sound = int.Parse(note_data[2].Trim()); break; } } this.track_lines.Add(new_song_group); } tuning = null; }