Example #1
0
        public static Section GenTestSection2(IAudioClipPack clipPack)
        {
            var section	= new Section();

            // BPM:120, 4/4 -> 1bar = 4beat

            var automations		= TestAutomation();

            var layer1			= Layer.GenTestLayer(clipPack.GetHandle("test-sec2-1"));
            section.m_layers[0]	= layer1;

            var layer2			= Layer.GenTestLayer(clipPack.GetHandle("test-sec2-2"));
            layer2.AddTensionAutomation(automations[1]);
            section.m_layers[1]	= layer2;

            var layer3			= Layer.GenTestLayer(clipPack.GetHandle("test-sec2-3"));
            layer3.AddTensionAutomation(automations[0]);
            section.m_layers[2]	= layer3;

            var layer4			= Layer.GenTestLayer(clipPack.GetHandle("test-sec2-4"));
            layer4.AddTensionAutomation(automations[2]);
            section.m_layers[3]	= layer4;

            section.inTypeNatural	= InType.KickIn;
            section.inTypeManual	= InType.FadeIn;
            section.outTypeNatural	= OutType.LeaveIt;
            section.outTypeManual	= OutType.FadeOut;
            section.doNotOverlapFillIn	= false;

            section.beatFillIn		= 0;
            section.beatStart		= 1 * 4;
            section.beatEnd			= 9 * 4;

            return section;
        }
Example #2
0
        //
        public static Section CreateFromJSON(JSONObject json, IAudioClipPack clipPack)
        {
            var section	= new Section();

            section.inTypeNatural	= Engine.Utils.parseEnum<InType>(json.GetField("natural-in").str);
            section.inTypeManual	= Engine.Utils.parseEnum<InType>(json.GetField("manual-in").str);
            section.outTypeNatural	= Engine.Utils.parseEnum<OutType>(json.GetField("natural-out").str);
            section.outTypeManual	= Engine.Utils.parseEnum<OutType>(json.GetField("manual-out").str);

            section.beatFillIn		= (int)json.GetField("beat-fillin").n;
            section.beatStart		= (int)json.GetField("beat-start").n;
            section.beatEnd			= (int)json.GetField("beat-end").n;

            json.GetField("layers", (layerarr) =>
                {
                    int layeridx	= 0;
                    foreach(var layer in layerarr.list)
                    {
                        section.m_layers[layeridx]	= Layer.CreateFromJSON(layer, clipPack);
                        layeridx++;
                    }
                });

            return section;
        }