public static void ThreeBitLeadOne(byte[] Data, VoicesGroup Group, List <Stop> Result)
        {
            string str1 = string.Join("", Enumerable.ToArray <string>(Enumerable.Select <byte, string>(Enumerable.Take <byte>(Enumerable.Skip <byte>((IEnumerable <byte>)Data, Group.Offset), Group.Len), (Func <byte, string>)(x => Convert.ToString(x, 2).PadLeft(8, '0')))));

#if DEBUG
            string str2 = string.Join(" ", Enumerable.ToArray <string>(Enumerable.Select <byte, string>(Enumerable.Take <byte>(Enumerable.Skip <byte>((IEnumerable <byte>)Data, Group.Offset), 64), (Func <byte, string>)(x => Convert.ToString(x, 16).PadLeft(2, '0')))));
            Trace.WriteLine(string.Format("{0}: {1}", Group.Type.ToString(), str2));
#endif
            int sid = 0;
            while (sid < str1.Length - 2)
            {
                if (str1[sid] == '0')
                {
                    sid += 3;
                    continue;
                }
                Result.Add(new Stop(sid / 3, str1.Substring(sid + 1, 2).ToIntEx(2), Group.Type));
                sid += 3;
            }
        }
        public static void StructureB(byte[] Data, VoicesGroup Group, List <Stop> Result)
        {
            int num = BitConverter.ToInt32(Data, Group.Offset) >> 1;

            if ((num & 15) == 3)
            {
                int key = (int)Data[Group.Offset + 4] >> 1;
                Result.Add(new Stop(key, StopsFactory.UserMIDIFlag | StopsFactory.UserMIDIFlagB, Group.Type));
            }
            else if ((num & 15) == 2)
            {
                int[] numArray1 = new int[3] {
                    (num & 3840) >> 8, ((num & 983040) >> 16) - 1, ((num & 251658240) >> 24) - 1
                };
                if (numArray1.Any(x => x < 0))
                {
                    return;
                }
                Result.Add(StopsFactory.CreateMIDIStop(numArray1[0], numArray1[1], numArray1[2], Group.Type, true));
            }
        }
        public static void BitMask(byte[] Data, VoicesGroup Group, List <Stop> Result)
        {
            string str = string.Join("", Enumerable.ToArray <string>(Enumerable.Select <byte, string>(Enumerable.Take <byte>(Enumerable.Skip <byte>((IEnumerable <byte>)Data, Group.Offset), Group.Len), (Func <byte, string>)(x => Convert.ToString(x, 2).PadLeft(8, '0')))));
            int    id  = str.IndexOf('1', 0);

            while (id != -1)
            {
                if (id / 3 != 2)
                {
                    Result.Add(new Stop(id / 3, id % 3, StopType.CP));
                }
                id = str.IndexOf('1', id + 1);
            }
            //List<string> list = new List<string>();
            //string str = string.Join("", Enumerable.ToArray<string>(Enumerable.Select<byte, string>(Enumerable.Take<byte>(Enumerable.Skip<byte>((IEnumerable<byte>)Data, Group.Offset), Group.Len), (Func<byte, string>)(x => Convert.ToString(x, 2).PadLeft(8, '0')))));
            //foreach(KeyValuePair<int, string[]> keyValuePair in Group.Table) {
            //    int num = (keyValuePair.Key - 1) * 3;
            //    for(int index = 0; index < 3; ++index) {
            //        if((int)str[num + index] == 49)
            //            list.Add(keyValuePair.Value[index]);
            //    }
            //}
        }
 private void InitTables()
 {
     _SW = new VoicesGroup()
     {
         Offset  = 0x4E,
         Len     = 4,
         Type    = StopType.SwellDAT,
         Decoder = new VoicesGroup.VoicesDecoder(Decoders.ThreeBitLeadOne)
     };
     _GT = new VoicesGroup()
     {
         Offset  = 0xA2,
         Len     = 4,
         Type    = StopType.GreatDAT,
         Decoder = new VoicesGroup.VoicesDecoder(Decoders.ThreeBitLeadOne)
     };
     _PD = new VoicesGroup()
     {
         Offset  = 0x14A,
         Len     = 4,
         Type    = StopType.PedalDAT,
         Decoder = new VoicesGroup.VoicesDecoder(Decoders.ThreeBitLeadOne)
     };
 }
Exemple #5
0
 private void InitTables()
 {
     this._Great = new VoicesGroup()
     {
         Offset  = 106,
         Len     = 5,
         Type    = StopType.Great,
         Decoder = new VoicesGroup.VoicesDecoder(Decoders.ThreeBitLeadOne)
     };
     this._Swell = new VoicesGroup()
     {
         Offset  = 32,
         Len     = 5,
         Type    = StopType.Swell,
         Decoder = new VoicesGroup.VoicesDecoder(Decoders.ThreeBitLeadOne)
     };
     this._Pedal = new VoicesGroup()
     {
         Offset  = 254,
         Len     = 5,
         Type    = StopType.Pedal,
         Decoder = new VoicesGroup.VoicesDecoder(Decoders.ThreeBitLeadOne)
     };
     this._CP = new VoicesGroup()
     {
         Offset  = 0,
         Len     = 2,
         Type    = StopType.CP,
         Decoder = new VoicesGroup.VoicesDecoder(Decoders.BitMask)
     };
     this._UserGT_A = new VoicesGroup()
     {
         Offset  = 111,
         Len     = 6,
         Type    = StopType.Great,
         Decoder = new VoicesGroup.VoicesDecoder(Decoders.StructureA)
     };
     this._UserSW_A = new VoicesGroup()
     {
         Offset  = 37,
         Len     = 6,
         Type    = StopType.Swell,
         Decoder = new VoicesGroup.VoicesDecoder(Decoders.StructureA)
     };
     this._UserPD_A = new VoicesGroup()
     {
         Offset  = 259,
         Len     = 6,
         Type    = StopType.Pedal,
         Decoder = new VoicesGroup.VoicesDecoder(Decoders.StructureA)
     };
     this._UserGT_B = new VoicesGroup()
     {
         Offset  = 138,
         Len     = 6,
         Type    = StopType.Great,
         Decoder = new VoicesGroup.VoicesDecoder(Decoders.StructureB)
     };
     this._UserSW_B = new VoicesGroup()
     {
         Offset  = 64,
         Len     = 6,
         Type    = StopType.Swell,
         Decoder = new VoicesGroup.VoicesDecoder(Decoders.StructureB)
     };
     this._UserPD_B = new VoicesGroup()
     {
         Offset  = 286,
         Len     = 6,
         Type    = StopType.Pedal,
         Decoder = new VoicesGroup.VoicesDecoder(Decoders.StructureB)
     };
 }