/// <summary> /// Initializes the audio system by instantiating the driver with the given /// AudioTypeID. The audio driver must be registered with the Registrar /// class. /// </summary> /// <param name="audioType"></param> public static void Initialize(AudioTypeID audioType) { Core.Initialize(); impl = Registrar.CreateAudioDriver(audioType); impl.Initialize(); }
/// <summary> /// Initializes the Audio subsystem, to the specified driver. /// </summary> /// <param name="type"></param> public void InitializeAudio(AudioTypeID type) { if (WasCanceled) { return; } AudioLib.Audio.Initialize(type); }
/// <summary> /// Constructs an AgateDriverInfo for an audio driver. /// </summary> /// <param name="typeID">The AudioTypeID member indicating what the driver uses.</param> /// <param name="driverType">The System.Type object for the type inheriting from AudioImpl.</param> /// <param name="friendlyName">A friendly name to show the user when choosing a driver.</param> /// <param name="priority">A integer indicating the priority of this driver over others which is used when autoselecting a driver.</param> public AgateDriverInfo(AudioTypeID typeID, Type driverType, string friendlyName, int priority) { if (typeof(AudioImpl).IsAssignableFrom(driverType) == false || driverType.IsAbstract == true) { throw new ArgumentException(string.Format( "The type {0} is not a concrete implementation of AudioImpl.")); } SetValues(DriverType.Audio, driverType.FullName, friendlyName, (int)typeID, priority); }
internal static AudioImpl CreateAudioDriver(AudioTypeID audioType) { if (audioDrivers.Count == 0) { throw new AgateException("No audio drivers registered."); } AgateDriverInfo info = FindDriverInfo(audioDrivers, (int)audioType); if (info == null) { throw new AgateException(string.Format("Could not find the driver {0}.", audioType)); } return((AudioImpl)CreateDriverInstance(info)); }
/// <summary> /// Asks the user to select which drivers to use. /// </summary> /// <param name="chooseDisplay"></param> /// <param name="chooseAudio"></param> /// <param name="chooseInput"></param> /// <param name="selectedDisplay"></param> /// <param name="selectedAudio"></param> /// <param name="selectedInput"></param> /// <returns></returns> internal static bool UserSelectDrivers(bool chooseDisplay, bool chooseAudio, bool chooseInput, out DisplayTypeID selectedDisplay, out AudioTypeID selectedAudio, out InputTypeID selectedInput) { if (mDesktop == null) { CreateDesktopDriver(); if (mDesktop == null) { SelectBestDrivers(chooseDisplay, chooseAudio, chooseInput, out selectedDisplay, out selectedAudio, out selectedInput); } } IUserSetSystems frm = mDesktop.CreateUserSetSystems(); frm.SetChoices(chooseDisplay, chooseAudio, chooseInput); // set default values. selectedDisplay = DisplayTypeID.AutoSelect; selectedAudio = AudioTypeID.AutoSelect; selectedInput = InputTypeID.AutoSelect; foreach (AgateDriverInfo info in displayDrivers) { frm.AddDisplayType(info); } foreach (AgateDriverInfo info in audioDrivers) { frm.AddAudioType(info); } foreach (AgateDriverInfo info in inputDrivers) { frm.AddInputType(info); } if (frm.RunDialog() == SetSystemsDialogResult.Cancel) { return(false); } selectedDisplay = frm.DisplayType; selectedAudio = frm.AudioType; selectedInput = frm.InputType; return(true); }
private static void SelectBestDrivers(bool chooseDisplay, bool chooseAudio, bool chooseInput, out DisplayTypeID selectedDisplay, out AudioTypeID selectedAudio, out InputTypeID selectedInput) { selectedDisplay = DisplayTypeID.AutoSelect; selectedAudio = AudioTypeID.AutoSelect; selectedInput = InputTypeID.AutoSelect; if (displayDrivers.Count > 0) { selectedDisplay = (DisplayTypeID)displayDrivers[0].DriverTypeID; } if (audioDrivers.Count > 0) { selectedAudio = (AudioTypeID)audioDrivers[0].DriverTypeID; } if (inputDrivers.Count > 0) { selectedInput = (InputTypeID)inputDrivers[0].DriverTypeID; } }
private void btnOK_Click(object sender, EventArgs e) { if (mChooseDisplay) { AgateDriverInfo display = (AgateDriverInfo)displayList.SelectedItem; mDisplayType = (DisplayTypeID)display.DriverTypeID; } if (mChooseAudio) { AgateDriverInfo audio = (AgateDriverInfo)audioList.SelectedItem; mAudioType = (AudioTypeID)audio.DriverTypeID; } if (mChooseInput) { AgateDriverInfo input = (AgateDriverInfo)inputList.SelectedItem; mInputType = (InputTypeID)input.DriverTypeID; } }