コード例 #1
0
        /// <summary>
        /// Gets the device description string matching the given device handle and the given type.
        /// </summary>
        /// <returns>The device string.</returns>
        /// <param name="handle">Handle.</param>
        /// <param name="type">Type.</param>
        static string GetDeviceString(DeviceHandle handle, DeviceStringType type)
        {
            if (handle.IsValid)
            {
                var p = MusicManager.GetPlugins();
                foreach (var m in p)
                {
                    var devices = m.GetDevices();
                    foreach (var d in devices)
                    {
                        if (Equals(handle, d.Handle))
                        {
                            if (type == DeviceStringType.DriverName)
                            {
                                return(d.MusicDriverName);
                            }
                            else if (type == DeviceStringType.DriverId)
                            {
                                return(d.MusicDriverId);
                            }
                            else if (type == DeviceStringType.DeviceName)
                            {
                                return(d.CompleteName);
                            }
                            else if (type == DeviceStringType.DeviceId)
                            {
                                return(d.CompleteId);
                            }
                            else
                            {
                                return("auto");
                            }
                        }
                    }
                }
            }

            return("auto");
        }
コード例 #2
0
ファイル: MidiDriver.cs プロジェクト: scemino/nscumm
        /// <summary>
        /// Gets the device description string matching the given device handle and the given type.
        /// </summary>
        /// <returns>The device string.</returns>
        /// <param name="handle">Handle.</param>
        /// <param name="type">Type.</param>
        static string GetDeviceString(DeviceHandle handle, DeviceStringType type)
        {
            if (handle.IsValid)
            {
                var p = MusicManager.GetPlugins();
                foreach (var m in p)
                {
                    var devices = m.GetDevices();
                    foreach (var d in devices)
                    {
                        if (Equals(handle, d.Handle))
                        {
                            if (type == DeviceStringType.DriverName)
                                return d.MusicDriverName;
                            else if (type == DeviceStringType.DriverId)
                                return d.MusicDriverId;
                            else if (type == DeviceStringType.DeviceName)
                                return d.CompleteName;
                            else if (type == DeviceStringType.DeviceId)
                                return d.CompleteId;
                            else
                                return "auto";
                        }
                    }
                }
            }

            return "auto";
        }