private myColor readColor() { byte r = GPBase.readByte()[0]; byte g = GPBase.readByte()[0]; byte b = GPBase.readByte()[0]; GPBase.skip(1); return(new myColor(r, g, b)); }
private void readMidiChannels() { /*Read MIDI channels. * * Guitar Pro format provides 64 channels(4 MIDI ports by 16 * channels), the channels are stored in this order: * * -port1 / channel1 * - port1 / channel2 * - ... * - port1 / channel16 * - port2 / channel1 * - ... * - port4 / channel16 * * Each channel has the following form: * -Instrument: :ref:`int`. * -Volume: :ref:`byte`. * -Balance: :ref:`byte`. * -Chorus: :ref:`byte`. * -Reverb: :ref:`byte`. * -Phaser: :ref:`byte`. * -Tremolo: :ref:`byte`. * -blank1: :ref:`byte`. * -blank2: :ref:`byte`.*/ MidiChannel[] _channels = new MidiChannel[64]; for (int i = 0; i < 64; i++) { var newChannel = new MidiChannel(); newChannel.channel = i; newChannel.effectChannel = i; var instrument = GPBase.readInt()[0]; if (newChannel.isPercussionChannel() && instrument == -1) { instrument = 0; } newChannel.instrument = instrument; newChannel.volume = toChannelShort(GPBase.readByte()[0]); newChannel.balance = toChannelShort(GPBase.readByte()[0]); newChannel.chorus = toChannelShort(GPBase.readByte()[0]); newChannel.reverb = toChannelShort(GPBase.readByte()[0]); newChannel.phaser = toChannelShort(GPBase.readByte()[0]); newChannel.tremolo = toChannelShort(GPBase.readByte()[0]); _channels[i] = newChannel; GPBase.skip(2); } channels = _channels; }
private void readNewChord(Chord chord) { /*Read new-style (GP4) chord diagram. * * New-style chord diagram is read as follows: * * - Sharp: :ref:`bool`. If true, display all semitones as sharps, * otherwise display as flats. * * - Blank space, 3 :ref:`Bytes <byte>`. * * - Root: :ref:`int`. Values are: * * -1 for customized chords * 0: C * 1: C# * ... * * - Type: :ref:`int`. Determines the chord type as followed. See * :class:`guitarpro.models.ChordType` for mapping. * * - Chord extension: :ref:`int`. See * :class:`guitarpro.models.ChordExtension` for mapping. * * - Bass note: :ref:`int`. Lowest note of chord as in *C/Am*. * * - Tonality: :ref:`int`. See * :class:`guitarpro.models.ChordAlteration` for mapping. * * - Add: :ref:`bool`. Determines if an "add" (added note) is * present in the chord. * * - Name: :ref:`byte-size-string`. Max length is 22. * * - Fifth alteration: :ref:`int`. Maps to * :class:`guitarpro.models.ChordAlteration`. * * - Ninth alteration: :ref:`int`. Maps to * :class:`guitarpro.models.ChordAlteration`. * * - Eleventh alteration: :ref:`int`. Maps to * :class:`guitarpro.models.ChordAlteration`. * * - List of frets: 6 :ref:`Ints <int>`. Fret values are saved as * in default format. * * - Count of barres: :ref:`int`. Maximum count is 2. * * - Barre frets: 2 :ref:`Ints <int>`. * * - Barre start strings: 2 :ref:`Ints <int>`. * * - Barre end string: 2 :ref:`Ints <int>`. * * - Omissions: 7 :ref:`Bools <bool>`. If the value is true then * note is played in chord. * * - Blank space, 1 :ref:`byte`.*/ chord.sharp = GPBase.readBool()[0]; var intonation = chord.sharp ? "sharp" : "flat"; GPBase.skip(3); chord.root = new PitchClass(GPBase.readByte()[0], -1, "", intonation); chord.type = (ChordType)GPBase.readByte()[0]; chord.extension = (ChordExtension)GPBase.readByte()[0]; chord.bass = new PitchClass(GPBase.readInt()[0], -1, "", intonation); chord.tonality = (ChordAlteration)GPBase.readInt()[0]; chord.add = GPBase.readBool()[0]; chord.name = GPBase.readByteSizeString(22); chord.fifth = (ChordAlteration)GPBase.readByte()[0]; chord.ninth = (ChordAlteration)GPBase.readByte()[0]; chord.eleventh = (ChordAlteration)GPBase.readByte()[0]; chord.firstFret = GPBase.readInt()[0]; for (int i = 0; i < 7; i++) { var fret = GPBase.readInt()[0]; if (i < chord.strings.Length) { chord.strings[i] = fret; } } chord.barres.Clear(); var barresCount = GPBase.readByte()[0]; var barreFrets = GPBase.readByte(5); var barreStarts = GPBase.readByte(5); var barreEnds = GPBase.readByte(5); for (int x = 0; x < Math.Min(5, (int)barresCount); x++) { var barre = new Barre(barreFrets[x], barreStarts[x], barreEnds[x]); chord.barres.Add(barre); } chord.omissions = GPBase.readBool(7); GPBase.skip(1); List <Fingering> f = new List <Fingering>(); for (int x = 0; x < 7; x++) { f.Add((Fingering)GPBase.readSignedByte()[0]); } chord.fingerings = f; chord.show = GPBase.readBool()[0]; }