// Token: 0x0600332D RID: 13101 RVA: 0x00147E64 File Offset: 0x00146064
        protected override void ReadContent(MidiReader reader, ReadingSettings settings, int size)
        {
            InvalidMetaEventParameterValuePolicy invalidMetaEventParameterValuePolicy = settings.InvalidMetaEventParameterValuePolicy;

            this.Key   = (sbyte)KeySignatureEvent.ProcessValue((int)reader.ReadSByte(), "Key", -7, 7, invalidMetaEventParameterValuePolicy);
            this.Scale = (byte)KeySignatureEvent.ProcessValue((int)reader.ReadByte(), "Scale", 0, 1, invalidMetaEventParameterValuePolicy);
        }
Beispiel #2
0
        // Token: 0x06003378 RID: 13176 RVA: 0x00147F08 File Offset: 0x00146108
        protected override void ReadContent(MidiReader reader, ReadingSettings settings, int size)
        {
            InvalidMetaEventParameterValuePolicy invalidMetaEventParameterValuePolicy = settings.InvalidMetaEventParameterValuePolicy;
            byte formatAndHours = reader.ReadByte();

            this.Format    = SmpteOffsetEvent.GetFormat(formatAndHours);
            this.Hours     = SmpteOffsetEvent.ProcessValue(SmpteOffsetEvent.GetHours(formatAndHours), "Hours", 23, invalidMetaEventParameterValuePolicy);
            this.Minutes   = SmpteOffsetEvent.ProcessValue(reader.ReadByte(), "Minutes", 59, invalidMetaEventParameterValuePolicy);
            this.Seconds   = SmpteOffsetEvent.ProcessValue(reader.ReadByte(), "Seconds", 59, invalidMetaEventParameterValuePolicy);
            this.Frames    = SmpteOffsetEvent.ProcessValue(reader.ReadByte(), "Frames", SmpteOffsetEvent.MaxFrames[this.Format], invalidMetaEventParameterValuePolicy);
            this.SubFrames = SmpteOffsetEvent.ProcessValue(reader.ReadByte(), "SubFrames", 99, invalidMetaEventParameterValuePolicy);
        }
Beispiel #3
0
 // Token: 0x06003377 RID: 13175 RVA: 0x000174F2 File Offset: 0x000156F2
 private static byte ProcessValue(byte value, string property, byte max, InvalidMetaEventParameterValuePolicy policy)
 {
     if (value <= max)
     {
         return(value);
     }
     if (policy == InvalidMetaEventParameterValuePolicy.Abort)
     {
         throw new InvalidMetaEventParameterValueException(string.Format("{0} is invalid value for the {1} of a SMPTE Offset event.", value, property), (int)value);
     }
     if (policy != InvalidMetaEventParameterValuePolicy.SnapToLimits)
     {
         return(value);
     }
     return(Math.Min(value, max));
 }
        private static byte ProcessValue(byte value, string property, byte max, InvalidMetaEventParameterValuePolicy policy)
        {
            if (value <= max)
            {
                return(value);
            }

            switch (policy)
            {
            case InvalidMetaEventParameterValuePolicy.Abort:
                throw new InvalidMetaEventParameterValueException($"{value} is invalid value for the {property} of a SMPTE Offset event.", value);

            case InvalidMetaEventParameterValuePolicy.SnapToLimits:
                return(Math.Min(value, max));
            }

            return(value);
        }
Beispiel #5
0
        private byte ProcessValue(byte value, string property, byte max, InvalidMetaEventParameterValuePolicy policy)
        {
            if (value <= max)
            {
                return(value);
            }

            switch (policy)
            {
            case InvalidMetaEventParameterValuePolicy.Abort:
                throw new InvalidMetaEventParameterValueException(GetType(), property, value);

            case InvalidMetaEventParameterValuePolicy.SnapToLimits:
                return(Math.Min(value, max));
            }

            return(value);
        }
Beispiel #6
0
        private int ProcessValue(int value, string property, int min, int max, InvalidMetaEventParameterValuePolicy policy)
        {
            if (value >= min && value <= max)
            {
                return(value);
            }

            switch (policy)
            {
            case InvalidMetaEventParameterValuePolicy.Abort:
                throw new InvalidMetaEventParameterValueException(EventType, property, value);

            case InvalidMetaEventParameterValuePolicy.SnapToLimits:
                return(Math.Min(Math.Max(value, min), max));
            }

            return(value);
        }
Beispiel #7
0
        private static int ProcessValue(int value, string property, int min, int max, InvalidMetaEventParameterValuePolicy policy)
        {
            if (value >= min && value <= max)
                return value;

            switch (policy)
            {
                case InvalidMetaEventParameterValuePolicy.Abort:
                    throw new InvalidMetaEventParameterValueException($"{value} is invalid value for the {property} of a Key Signature event.", value);
                case InvalidMetaEventParameterValuePolicy.SnapToLimits:
                    return Math.Min(Math.Max(value, min), max);
            }

            return value;
        }
 // Token: 0x0600332C RID: 13100 RVA: 0x00017166 File Offset: 0x00015366
 private static int ProcessValue(int value, string property, int min, int max, InvalidMetaEventParameterValuePolicy policy)
 {
     if (value >= min && value <= max)
     {
         return(value);
     }
     if (policy == InvalidMetaEventParameterValuePolicy.Abort)
     {
         throw new InvalidMetaEventParameterValueException(string.Format("{0} is invalid value for the {1} of a Key Signature event.", value, property), value);
     }
     if (policy != InvalidMetaEventParameterValuePolicy.SnapToLimits)
     {
         return(value);
     }
     return(Math.Min(Math.Max(value, min), max));
 }