Exemple #1
0
        public static void Main(string[] args)
        {
            int index = -1;

            if (args.Length == 1)
            {
                index = int.Parse(args[0]);
            }
            try
            {
                if (index == -1 || index == 0)
                {
                    Console.WriteLine("PrintSimple:");
                    PrintSimple.Main(args);
                }
                if (index == -1 || index == 1)
                {
                    Console.WriteLine("PrintDetailed:");
                    PrintDetailed.Main(args);
                }
                if (index == -1 || index == 2)
                {
                    Console.WriteLine("CaptureSimple:");
                    CaptureSimple.Main(args);
                }
                if (index == -1 || index == 3)
                {
                    Console.WriteLine("RenderSimple:");
                    RenderSimple.Main(args);
                }
                if (index == -1 || index == 4)
                {
                    Console.WriteLine("CaptureAdvanced:");
                    CaptureAdvanced.Main(args);
                }
                if (index == -1 || index == 5)
                {
                    Console.WriteLine("RenderAdvanced:");
                    RenderAdvanced.Main(args);
                }
                if (index == -1 || index == 6)
                {
                    Console.WriteLine("FullDuplex:");
                    FullDuplex.Main(args);
                }
                if (index == -1 || index == 7)
                {
                    Console.WriteLine("Aggregate:");
                    Aggregate.Main(args);
                }
            } catch (XtException e)
            {
                Console.WriteLine("Error:");
                Console.WriteLine("\tSystem: " + XtPrint.SystemToString(XtException.GetSystem(e.GetError())));
                Console.WriteLine("\tCause: " + XtPrint.CauseToString(XtException.GetCause(e.GetError())));
                Console.WriteLine("\tFault: " + XtException.GetFault(e.GetError()));
                Console.WriteLine("\tText: " + XtException.GetText(e.GetError()));
            }
        }
Exemple #2
0
        public static void Main(String[] args)
        {
            using (XtAudio audio = new XtAudio("Sample", IntPtr.Zero, OnTrace, OnFatal))
            {
                try
                {
                    Console.WriteLine("Win32: " + XtAudio.IsWin32());
                    Console.WriteLine("Version: " + XtAudio.GetVersion());
                    XtService pro = XtAudio.GetServiceBySetup(XtSetup.ProAudio);
                    Console.WriteLine("Pro Audio: " + (pro == null ? "None" : pro.GetName()));
                    XtService system = XtAudio.GetServiceBySetup(XtSetup.SystemAudio);
                    Console.WriteLine("System Audio: " + (system == null ? "None" : system.GetName()));
                    XtService consumer = XtAudio.GetServiceBySetup(XtSetup.ConsumerAudio);
                    Console.WriteLine("Consumer Audio: " + (consumer == null ? "None" : consumer.GetName()));

                    for (int s = 0; s < XtAudio.GetServiceCount(); s++)
                    {
                        XtService service = XtAudio.GetServiceByIndex(s);
                        Console.WriteLine("Service " + service.GetName() + ":");
                        Console.WriteLine("  System: " + service.GetSystem());
                        Console.WriteLine("  Device count: " + service.GetDeviceCount());
                        Console.WriteLine("  Capabilities: " + XtPrint.CapabilitiesToString(service.GetCapabilities()));

                        using (XtDevice defaultInput = service.OpenDefaultDevice(false))
                            Console.WriteLine("  Default input: " + defaultInput);

                        using (XtDevice defaultOutput = service.OpenDefaultDevice(true))
                            Console.WriteLine("  Default output: " + defaultOutput);

                        for (int d = 0; d < service.GetDeviceCount(); d++)
                        {
                            using (XtDevice device = service.OpenDevice(d))
                            {
                                Console.WriteLine("  Device " + device.GetName() + ":");
                                Console.WriteLine("    System: " + device.GetSystem());
                                Console.WriteLine("    Current mix: " + device.GetMix());
                                Console.WriteLine("    Input channels: " + device.GetChannelCount(false));
                                Console.WriteLine("    Output channels: " + device.GetChannelCount(true));
                                Console.WriteLine("    Interleaved access: " + device.SupportsAccess(true));
                                Console.WriteLine("    Non-interleaved access: " + device.SupportsAccess(false));
                            }
                        }
                    }
                } catch (XtException e)
                {
                    Console.WriteLine("Error: system %s, fault %s, cause %s, text %s, message: %s.\n",
                                      XtException.GetSystem(e.GetError()),
                                      XtException.GetFault(e.GetError()),
                                      XtException.GetCause(e.GetError()),
                                      XtException.GetText(e.GetError()),
                                      e.ToString());
                }
            }
        }