Ejemplo n.º 1
0
        /// <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();
        }
Ejemplo n.º 2
0
 public void CreateBuffers(IntPtr bufferInfos, int numChannels, int bufferSize, ref AsioCallbacks callbacks)
 {
     this.pinnedcallbacks = Marshal.AllocHGlobal(Marshal.SizeOf(callbacks));
     Marshal.StructureToPtr(callbacks, this.pinnedcallbacks, false);
     this.HandleException(this.asioDriverVTable.createBuffers(this.pAsioComObject, bufferInfos, numChannels, bufferSize, this.pinnedcallbacks), "createBuffers");
 }