Exemplo n.º 1
0
        private static PaStreamCallbackResult PaStreamCallback(
             float* input,
             float* output,
             uint frameCount,
             ref PaStreamCallbackTimeInfo timeInfo,
             PaStreamCallbackFlags statusFlags,
             IntPtr userData)
        {
            #region GC boilerplate

            var gcHandle = GCHandle.FromIntPtr(userData);
            if (!gcHandle.IsAllocated)
            {
                return PaStreamCallbackResult.PaAbort;
            }
            var instance = (WaveRecorder) gcHandle.Target;

            #endregion

            try
            {
                if (instance._bufferAvailable != null)
                {
                    instance._bufferAvailable(input, (int) frameCount);
                }
            }
            catch
            {
                return PaStreamCallbackResult.PaAbort;
            }

            return PaStreamCallbackResult.PaContinue;
         }
Exemplo n.º 2
0
 private static unsafe PaStreamCallbackResult PaStreamCallback(float* input, float* output, uint frameCount, ref PaStreamCallbackTimeInfo timeInfo, PaStreamCallbackFlags statusFlags, IntPtr userData)
 {
     GCHandle gcHandle = GCHandle.FromIntPtr(userData);
       if (!gcHandle.IsAllocated)
     return PaStreamCallbackResult.PaAbort;
       WaveRecorder waveRecorder = (WaveRecorder) gcHandle.Target;
       try
       {
     if (waveRecorder._bufferAvailable != null)
       waveRecorder._bufferAvailable(input, (int) frameCount);
       }
       catch
       {
     return PaStreamCallbackResult.PaAbort;
       }
       return PaStreamCallbackResult.PaContinue;
 }