示例#1
0
        internal JSONObject ToJSONObject(bool includeIntent = true)
        {
            JSONObject j = new JSONObject();

            //Intent is necessary for clipboard operations and marshalling to GDScript so the UI knows which base64 decoder it should use.
            //The data is redundant if the table is included as part of serialized data from an EG, since the variables will hint at the intent.
            if (includeIntent)
            {
                j.AddPrim("intent", intent.ToString());
            }
            j.AddPrim("floor", floor);
            j.AddPrim("ceiling", ceiling);

            j.AddPrim("tbl", Convert.ToBase64String(TableAsBytes()));

            return(j);
        }
示例#2
0
        internal JSONObject ToJSONObject()
        {
            var o = new JSONObject();

            o.AddPrim("opCount", opCount);

            for (byte i = 0; i < opCount; i++)
            {
                if (intent[i] != OpBase.Intents.FM_OP)  //Don't bother writing intents if there's no custom operator types.
                {
                    //FIXME:  Figure out if the generic func can be resolved for the enum-specific condition without the extra argument
                    o.AddPrim("intent", intent, true);
                    break;
                }
            }

            o.AddPrim("grid", wiringGrid);
            o.AddPrim("processOrder", processOrder);
            o.AddPrim("connections", connections);

            if (compatiblePreset >= 0)
            {
                o.AddPrim("compatiblePreset", compatiblePreset);
            }

            return(o);
        }
示例#3
0
        internal JSONObject ToJSONObject()
        {
            var o = new JSONObject();

            if (fixedFreq || base_hz != Global.BASE_HZ) //Fixed frequency or some other kinda custom note.  Record the frequency values.
            {
                // if (hz!=Global.BASE_HZ)  o.AddPrim("hz", hz);
                if (base_hz != Global.BASE_HZ)
                {
                    o.AddPrim("base_hz", base_hz);
                }
                // if (tuned_hz!=Global.BASE_HZ)  o.AddPrim("tuned_hz", tuned_hz);
                o.AddPrim("fixedFreq", fixedFreq);
            }

            o.AddPrim("mult", mult);
            o.AddPrim("coarse", coarse);
            o.AddPrim("fine", fine);
            o.AddPrim("detune", Detune);  //NOT the raw value, but the value PhaseEngine UI expects to map the raw value from -1 to 1.
            o.AddPrim("detune_randomness", detune_randomness);
            o.AddPrim("increment_offset", increment_offset);

            return(o);
        }