public System.Collections.Generic.HashSet <byte> GetModulators(byte opNum, System.Collections.Generic.HashSet <byte> modulators = null) { if (modulators == null) { modulators = new System.Collections.Generic.HashSet <byte>(opCount); } var modulators_left = new System.Collections.Generic.HashSet <byte>(opCount); for (byte i = 0; i < opCount; i++) { if (i == opNum || modulators.Contains(i)) { continue; } if (Tools.BIT(connections[i], opNum) == 1) //Target is connected to us. Add it to the set. { modulators.Add(i); modulators_left.Add(i); } } //For all the items currently in the set, find the modulators connected to it. foreach (byte m in modulators_left) { GetModulators(m, modulators); } return(modulators); }
public static byte attenuation_increment(byte rate, byte index) { return (byte) Tools.BIT(s_increment_table[rate], (byte) (4*index), 4); }