public static Increments FromJSON(JSONObject j) { var o = Increments.Prototype(); try { j.Assign("hz", ref o.hz); j.Assign("base_hz", ref o.base_hz); j.Assign("tuned_hz", ref o.tuned_hz); j.Assign("fixedFreq", ref o.fixedFreq); j.Assign("mult", ref o.mult); j.Assign("coarse", ref o.coarse); j.Assign("fine", ref o.fine); o.Detune = j.GetItem("detune", o.Detune); //Set up real detune values using the setter j.Assign("detune_randomness", ref o.detune_randomness); j.Assign("increment_offset", ref o.increment_offset); o.Recalc(); } catch (Exception e) { System.Diagnostics.Debug.Assert(false, "PG Copy failed: " + e.Message); } return(o); }
public static Increments FromString(string s) { var P = JSONData.ReadJSON(s); if (P is JSONDataError) { System.Diagnostics.Debug.Fail("Increments.FromJSON: Parsing JSON string failed."); return(Increments.Prototype()); } var j = (JSONObject)P; return(FromJSON(j)); }