void ExportTrack(Track track) { hopo = new bool[] { false, false, false, false, false, false }; link = new bool[] { false, false, false, false, false, false }; var gpTrack = new Gpif.Track(); gpTrack.Id = gpif.Tracks.Count; gpTrack.Name = track.Name; gpTrack.ShortName = track.Name; gpTrack.Color = track.Color; // export tuning var tuningProp = new Gpif.Property(); tuningProp.Name = "Tuning"; tuningProp.Pitches = track.Tuning.ToList(); if (track.Tuning.Count() > track.NumStrings) { // remove last few entries, as they are not used and confuse Guitar Pro tuningProp.Pitches.RemoveRange(track.NumStrings, track.Tuning.Count() - track.NumStrings); } if (track.Instrument == Track.InstrumentType.Bass) { // need to tune down one octave for (int i = 0; i < tuningProp.Pitches.Count; ++i) tuningProp.Pitches[i] -= 12; } gpTrack.Properties.Add(tuningProp); // add capo? if (track.Capo > 0) { gpTrack.Properties.Add(new Gpif.Property() { Name = "CapoFret", Fret = track.Capo } ); } if (track.Instrument == Track.InstrumentType.Guitar) { gpTrack.Instrument = new Instrument() { Ref = "e-gtr" + track.NumStrings }; gpTrack.GeneralMidi.Program = 29; gpTrack.GeneralMidi.Port = 0; gpTrack.GeneralMidi.PrimaryChannel = 0; gpTrack.GeneralMidi.SecondaryChannel = 1; gpTrack.GeneralMidi.ForeOneChannelPerString = false; } else if (track.Instrument == Track.InstrumentType.Bass) { gpTrack.Instrument = new Instrument() { Ref = "e-bass" + track.NumStrings }; gpTrack.GeneralMidi.Program = 33; gpTrack.GeneralMidi.Port = 0; gpTrack.GeneralMidi.PrimaryChannel = 2; gpTrack.GeneralMidi.SecondaryChannel = 3; gpTrack.GeneralMidi.ForeOneChannelPerString = false; } else { // TODO: Vocals } // add chord diagrams ExportChordDiagrams(gpTrack, track); gpif.Tracks.Add(gpTrack); gpif.MasterTrack.Tracks.Add(gpTrack.Id); ExportBars(track); }
void ExportTrack(Track track) { hopo = new bool[] { false, false, false, false, false, false }; link = new bool[] { false, false, false, false, false, false }; var gpTrack = new Gpif.Track(); gpTrack.Id = gpif.Tracks.Count; gpTrack.Name = track.Name; gpTrack.ShortName = track.Name; gpTrack.Color = track.Color; // export tuning var tuningProp = new Gpif.Property(); tuningProp.Name = "Tuning"; tuningProp.Pitches = track.Tuning.ToList(); if (track.Tuning.Count() > track.NumStrings) { // remove last few entries, as they are not used and confuse Guitar Pro tuningProp.Pitches.RemoveRange(track.NumStrings, track.Tuning.Count() - track.NumStrings); } if (track.Instrument == Track.InstrumentType.Bass) { // need to tune down one octave for (int i = 0; i < tuningProp.Pitches.Count; ++i) { tuningProp.Pitches[i] -= 12; } } gpTrack.Properties.Add(tuningProp); // add capo? if (track.Capo > 0) { gpTrack.Properties.Add(new Gpif.Property() { Name = "CapoFret", Fret = track.Capo } ); } if (track.Instrument == Track.InstrumentType.Guitar) { gpTrack.Instrument = new Instrument() { Ref = "e-gtr" + track.NumStrings }; gpTrack.GeneralMidi.Program = 29; gpTrack.GeneralMidi.Port = 0; gpTrack.GeneralMidi.PrimaryChannel = 0; gpTrack.GeneralMidi.SecondaryChannel = 1; gpTrack.GeneralMidi.ForeOneChannelPerString = false; } else if (track.Instrument == Track.InstrumentType.Bass) { gpTrack.Instrument = new Instrument() { Ref = "e-bass" + track.NumStrings }; gpTrack.GeneralMidi.Program = 33; gpTrack.GeneralMidi.Port = 0; gpTrack.GeneralMidi.PrimaryChannel = 2; gpTrack.GeneralMidi.SecondaryChannel = 3; gpTrack.GeneralMidi.ForeOneChannelPerString = false; } else { // TODO: Vocals } // add chord diagrams ExportChordDiagrams(gpTrack, track); gpif.Tracks.Add(gpTrack); gpif.MasterTrack.Tracks.Add(gpTrack.Id); ExportBars(track); }