Beispiel #1
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();

            TimerCallback callback = new TimerCallback(Update);

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

            FileManager = new BufferIO(true);

            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.SetActive(true);

            sound = new sound();
            sound.create("file1");

            // 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();
                Yse.Yse.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();
                Yse.Yse.System().AudioTest(false);
            };
        }
 private void PatcherButton_Click(object sender, RoutedEventArgs e)
 {
     if (patcherSound == null)
     {
         patcherSound = new sound();
         patcher      = new patcher();
         patcher.create(1);
         pHandle handle = patcher.CreateObject("~sine");
         //patcher.Connect(handle, 0, patcher.GetOutputHandle(0), 0);
         patcherSound.create(patcher);
         patcherSound.play();
     }
 }