示例#1
0
        public DSPSimplePatcher()
        {
            InitializeComponent();

            sound   = Global.Yse.CreateSound();
            patcher = Global.Yse.CreatePatcher();
            patcher.Create(1);

            mtof   = patcher.AddObject("mtof");
            sine   = patcher.AddObject("sine");
            lfo    = patcher.AddObject("sine");
            volume = patcher.AddObject("*");

            IHandle multiplier = patcher.AddObject("*");

            patcher.Connect(mtof, 0, sine, 0); // pass frequency to sine
            patcher.Connect(sine, 0, multiplier, 0);
            patcher.Connect(lfo, 0, multiplier, 1);
            patcher.Connect(multiplier, 0, volume, 0);
            patcher.Connect(volume, 0, patcher.GetOutputHandle(0), 0);

            mtof.SetData(0, 60f);
            lfo.SetData(0, 4f);
            volume.SetData(1, 0f);

            sound.Create(patcher);
            sound.Play();
        }
        public DSPSimplePatcher()
        {
            InitializeComponent();

            sound   = Global.Yse.NewSound();
            patcher = Global.Yse.NewPatcher();
            patcher.Create(1);

            mtof   = patcher.CreateObject(".mtof");
            sine   = patcher.CreateObject("~sine");
            lfo    = patcher.CreateObject("~sine");
            volume = patcher.CreateObject("~*");
            dac    = patcher.CreateObject("~dac");

            IHandle multiplier = patcher.CreateObject("~*");

            patcher.Connect(mtof, 0, sine, 0); // pass frequency to sine
            patcher.Connect(sine, 0, multiplier, 0);
            patcher.Connect(lfo, 0, multiplier, 1);
            patcher.Connect(multiplier, 0, volume, 0);
            patcher.Connect(volume, 0, dac, 0);

            mtof.SetFloatData(0, 60f);
            lfo.SetFloatData(0, 4f);
            volume.SetFloatData(1, 0f);

            sound.Create(patcher);
            sound.Play();
        }