Exemplo n.º 1
0
        public static void Main(string[] args)
        {
            XtMix      mix            = new XtMix(48000, XtSample.Int16);
            XtFormat   inputFormat    = new XtFormat(mix, 2, 0, 0, 0);
            XtChannels inputChannels  = new XtChannels(2, 0, 0, 0);
            XtFormat   outputFormat   = new XtFormat(mix, 0, 0, 2, 0);
            XtChannels outputChannels = new XtChannels(0, 0, 2, 0);

            using (XtAudio audio = new XtAudio(null, IntPtr.Zero, null, null)) {
                XtService service = XtAudio.GetServiceBySetup(XtSetup.SystemAudio);
                using (XtDevice input = service.OpenDefaultDevice(false))
                    using (XtDevice output = service.OpenDefaultDevice(true)) {
                        if (input != null && input.SupportsFormat(inputFormat) &&
                            output != null && output.SupportsFormat(outputFormat))
                        {
                            using (XtStream stream = service.AggregateStream(
                                       new XtDevice[] { input, output },
                                       new XtChannels[] { inputChannels, outputChannels },
                                       new double[] { 30.0, 30.0 },
                                       2, mix, true, false, output, OnAggregate, XRun, "user-data")) {
                                stream.Start();
                                Console.WriteLine("Streaming aggregate, press any key to continue...");
                                Console.ReadLine();
                                stream.Stop();
                            }
                        }
                    }
            }
        }