Exemplo n.º 1
0
 public void SetGraph(Graph gr)
 {
     MyGraph = gr;
     Dirty = true;
     Invalidate();
 }
Exemplo n.º 2
0
Arquivo: Form1.cs Projeto: kebby/jss
 public void SetGraph(Graph g)
 {
     button1.SetGraph(g);
 }
Exemplo n.º 3
0
Arquivo: Program.cs Projeto: kebby/jss
        /// <summary>
        /// Test the graph functions
        /// </summary>
        static Graph TestGraph()
        {
            // test code

            // make a new graph..
            var graph = new Graph
            {
                Name = "Test",
            };

            // add some stuff into the graph...
            var osc = graph.AddModule("Oscillator/Sawtooth");
            osc.X = 20; osc.Y = 50;
            osc.Params[0] = 0.01f;
            var env = graph.AddModule("Envelope/Decay");
            env.X = 120; env.Y = 50;
            env.Params[0] = 0.001f;
            var pan = graph.AddModule("Pan");
            pan.X = 220; pan.Y = 70;
            var vol = graph.AddModule("Mul Stereo");
            vol.X = 320; vol.Y = 60;
            vol.Params[0] = 0.3f;
            graph.Out.X = 420; graph.Out.Y = 50;

            // create topology
            graph.Connect(osc, env);
            graph.Connect(env, pan);
            graph.Connect(pan, vol);
            graph.Connect(vol, graph.Out);

            string code = Graph.GenerateAllCode(new[] { graph });
            Trace.WriteLine(code);

            var ms = new MemoryStream();
            var ds = new DeflateStream(ms, CompressionLevel.Optimal, true);
            var bytes = Encoding.ASCII.GetBytes(code);
            ds.Write(bytes, 0, bytes.Length);
            ds.Close();

            Trace.WriteLine("code size: " + bytes.Length + ", deflated: " + ms.Length);

            ms.Close();

            return graph;
        }