/// <summary> /// Instantiate the ASIO driver by GUID. /// </summary> /// <param name="guid">The GUID.</param> /// <returns>an ASIODriver instance</returns> public static ASIODriver GetASIODriverByGuid(Guid guid) { var driver = new ASIODriver(); driver.initFromGuid(guid); return(driver); }
/// <summary> /// Instantiate the ASIO driver by GUID. /// </summary> /// <param name="guid">The GUID.</param> /// <returns>an ASIODriver instance</returns> // Token: 0x060006D6 RID: 1750 RVA: 0x000152A4 File Offset: 0x000134A4 public static ASIODriver GetASIODriverByGuid(Guid guid) { ASIODriver asiodriver = new ASIODriver(); asiodriver.initFromGuid(guid); return(asiodriver); }
/// <summary> /// Instantiate a ASIODriver given its name. /// </summary> /// <param name="name">The name of the driver</param> /// <returns>an ASIODriver instance</returns> // Token: 0x060006D5 RID: 1749 RVA: 0x00015250 File Offset: 0x00013450 public static ASIODriver GetASIODriverByName(string name) { RegistryKey registryKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\\ASIO\\" + name); if (registryKey == null) { throw new ArgumentException(string.Format("Driver Name {0} doesn't exist", name)); } string g = registryKey.GetValue("CLSID").ToString(); return(ASIODriver.GetASIODriverByGuid(new Guid(g))); }
public ASIODriverExt(ASIODriver driver) { this.driver = driver; if (!driver.init(IntPtr.Zero)) { throw new InvalidOperationException(driver.getErrorMessage()); } this.callbacks = default(ASIOCallbacks); this.callbacks.pasioMessage = new ASIOCallbacks.ASIOAsioMessageCallBack(this.AsioMessageCallBack); this.callbacks.pbufferSwitch = new ASIOCallbacks.ASIOBufferSwitchCallBack(this.BufferSwitchCallBack); this.callbacks.pbufferSwitchTimeInfo = new ASIOCallbacks.ASIOBufferSwitchTimeInfoCallBack(this.BufferSwitchTimeInfoCallBack); this.callbacks.psampleRateDidChange = new ASIOCallbacks.ASIOSampleRateDidChangeCallBack(this.SampleRateDidChangeCallBack); this.BuildCapabilities(); }
/// <summary> /// Initializes a new instance of the <see cref="ASIODriverExt"/> class based on an already /// instantiated ASIODriver instance. /// </summary> /// <param name="driver">A ASIODriver already instantiated.</param> public ASIODriverExt(ASIODriver driver) { this.driver = driver; driver.init(IntPtr.Zero); callbacks = new ASIOCallbacks(); callbacks.pasioMessage = AsioMessageCallBack; callbacks.pbufferSwitch = BufferSwitchCallBack; callbacks.pbufferSwitchTimeInfo = BufferSwitchTimeInfoCallBack; callbacks.psampleRateDidChange = SampleRateDidChangeCallBack; BuildCapabilities(); }
/// <summary> /// Initializes a new instance of the <see cref="ASIODriverExt"/> class based on an already /// instantiated ASIODriver instance. /// </summary> /// <param name="driver">A ASIODriver already instantiated.</param> public ASIODriverExt(ASIODriver driver) { this.driver = driver; if (!driver.init(IntPtr.Zero)) { throw new InvalidOperationException(driver.getErrorMessage()); } callbacks = new ASIOCallbacks(); callbacks.pasioMessage = AsioMessageCallBack; callbacks.pbufferSwitch = BufferSwitchCallBack; callbacks.pbufferSwitchTimeInfo = BufferSwitchTimeInfoCallBack; callbacks.psampleRateDidChange = SampleRateDidChangeCallBack; BuildCapabilities(); }
/// <summary> /// Inits the vTable method from GUID. This is a tricky part of this class. /// </summary> /// <param name="ASIOGuid">The ASIO GUID.</param> // Token: 0x060006EE RID: 1774 RVA: 0x000156B4 File Offset: 0x000138B4 private void initFromGuid(Guid ASIOGuid) { int num = ASIODriver.CoCreateInstance(ref ASIOGuid, IntPtr.Zero, 1u, ref ASIOGuid, out this.pASIOComObject); if (num != 0) { throw new COMException("Unable to instantiate ASIO. Check if STAThread is set", num); } IntPtr ptr = Marshal.ReadIntPtr(this.pASIOComObject); this.asioDriverVTable = new ASIODriver.ASIODriverVTable(); FieldInfo[] fields = typeof(ASIODriver.ASIODriverVTable).GetFields(); for (int i = 0; i < fields.Length; i++) { FieldInfo fieldInfo = fields[i]; IntPtr ptr2 = Marshal.ReadIntPtr(ptr, (i + 3) * IntPtr.Size); object delegateForFunctionPointer = Marshal.GetDelegateForFunctionPointer(ptr2, fieldInfo.FieldType); fieldInfo.SetValue(this.asioDriverVTable, delegateForFunctionPointer); } }
/// <summary> /// Instantiate the ASIO driver by GUID. /// </summary> /// <param name="guid">The GUID.</param> /// <returns>an ASIODriver instance</returns> public static ASIODriver GetASIODriverByGuid(Guid guid) { ASIODriver driver = new ASIODriver(); driver.initFromGuid(guid); return driver; }