示例#1
0
        DeviceInfo GetDeviceInfo(XtService service, XtDeviceList list, int index, string defaultId)
        {
            var id     = list.GetId(index);
            var result = new DeviceInfo();

            result.Id            = id;
            result.Name          = list.GetName(id);
            result.DefaultInput  = id == defaultId;
            result.DefaultOutput = id == defaultId;
            result.Device        = service.OpenDevice(id);
            result.Capabilities  = list.GetCapabilities(id);
            return(result);
        }
示例#2
0
 static void PrintDevices(XtService service, XtDeviceList list)
 {
     for (int d = 0; d < list.GetCount(); d++)
     {
         string id = list.GetId(d);
         try
         {
             using XtDevice device = service.OpenDevice(id);
             XtMix?mix = device.GetMix();
             Console.WriteLine("    Device " + id + ":");
             Console.WriteLine("      Name: " + list.GetName(id));
             Console.WriteLine("      Capabilities: " + list.GetCapabilities(id));
             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));
             if (mix != null)
             {
                 Console.WriteLine("      Current mix: " + mix.Value.rate + " " + mix.Value.sample);
             }
         } catch (XtException e)
         { Console.WriteLine(XtAudio.GetErrorInfo(e.GetError())); }
     }
 }