Beispiel #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();
        }
Beispiel #3
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            //Yse.Yse.System().init();
            //Global = new YSE.Global(Yse.Yse.System());
            Y = new YSE.YseInterface(OnMessage);
            Y.System.Init();

            FileManager = Y.BufferIO as YSE.BufferIO;

            byte[] fileBuffer = default(byte[]);
            using (StreamReader sr = new StreamReader(Assets.Open("countdown.ogg")))
            {
                using (var memstream = new MemoryStream())
                {
                    sr.BaseStream.CopyTo(memstream);
                    fileBuffer = memstream.ToArray();
                }
            }

            FileManager.AddBuffer("file1", fileBuffer, fileBuffer.Length);
            FileManager.Active = true;

            sound = new YSE.Sound();
            sound.Create("file1");

            TimerCallback callback = new TimerCallback(Update);

            timer = new Timer(callback, null, 50, 50);

            // Get our button from the layout resource,
            // and attach an event to it
            Button startbutton = FindViewById <Button>(Resource.Id.startButton);

            startbutton.Click += delegate {
                sound.Play();
                Y.System.AudioTest = true;
                startbutton.Text   = "" + sound.Length;
            };

            Button pausebutton = FindViewById <Button>(Resource.Id.pauseButton);

            pausebutton.Click += delegate { sound.Pause(); };

            Button stopbutton = FindViewById <Button>(Resource.Id.stopButton);

            stopbutton.Click += delegate {
                sound.Stop();
                Y.System.AudioTest = false;
            };
        }