コード例 #1
0
        /*public MixTableElement MixTableElementRead()
        {
            return null;
        }*/
        protected Note ReadNote()
        {
            Note note = new Note();
            var header = ReadByte();
            note.Header = header;
            // Note status
            note.IsAccentuated = ((header & 0x40) != 0);
            note.IsDotted = ((header & 0x02) != 0);
            note.IsGhostNote = ((header & 0x04) != 0);

            // Note type
            if ((header & 0x20) != 0)
            {
                byte noteType = ReadByte();
                note.IsTieNote = noteType == 0x02;
                note.IsDeadNote = noteType == 0x03;
            }

            // Note duration
            if ((header & 0x01) != 0)
            {
                try
                {
                    // TODO: understand why we can have here a Duration whose value
                    // is SIX
                    // In GP, it seems to be some kind of special value (a triplet
                    // appears...)
                    note.Duration = ReadEnum<Duration>();
                }
                catch
                {
                }
                note.NTuplet = ReadByte();
            }

            // Note dynamic
            if ((header & 0x10) != 0)
                note.Dynamic = ReadEnum<Dynamic>();

            // Fret number
            if ((header & 0x20) != 0)
                note.FretNumber = ReadByte();

            // Fingering
            if ((header & 0x80) != 0)
            {
                /*note.FingeringLeftHand = ReadEnum<Fingering>();
                note.FingeringRightHand = ReadEnum<Fingering>();*/
                Skip(2);
            }

            // Effects on the note
            if ((header & 0x08) != 0)
                note.Effects = ReadEffectsOnNote();

            return note;
        }
コード例 #2
0
        /*public MixTableElement MixTableElementRead()
        {
            return null;
        }*/
        protected Note ReadNote()
        {
            Note note = new Note();
            var header = ReadByte();
            note.Header = header;
            // Note status
            note.IsAccentuated = ((header & 0x40) != 0);
            note.IsDotted = ((header & 0x02) != 0);
            note.IsGhostNote = ((header & 0x04) != 0);

            // Note type
            if ((header & 0x20) != 0)
            {
                byte noteType = ReadByte();
                note.IsTieNote = noteType == 0x02;
                note.IsDeadNote = noteType == 0x03;
            }

            // Note dynamic
            if ((header & 0x10) != 0)
            {
                var dynamic = ReadEnum<Dynamic>();
                //TODO set dynamic
                note.Dynamic = Dynamic.Invalid;
            }

            // Fret number
            if ((header & 0x20) != 0)
                note.FretNumber = ReadByte();

            // Fingering
            if ((header & 0x80) != 0)
            {
                note.FingeringLeftHand = ReadEnum<Fingering>();
                note.FingeringRightHand = ReadEnum<Fingering>();
            }

            // Note duration
            if ((header & 0x01) != 0)
                Skip(8);

            Skip(1);
            // Effects on the note
            if ((header & 0x08) != 0)
                note.Effects = ReadEffectsOnNote();

            return note;
        }