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; }
internal void Read_Sample_Block(System.IO.StreamReader file) { string line; TuningLookup tuning = new TuningLookup(); while ((line = file.ReadLine()) != null) { if (line.ToUpper() == "BLOCK_END") { return; } this.sample_list.Add(line.Trim()); } }
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; }