Example #1
0
 /// <summary>
 ///     Convenience method to safely open an output stream and log potential error
 /// </summary>
 /// <param name="stream"></param>
 /// <param name="outputParameters"></param>
 /// <param name="sampleRate"></param>
 /// <param name="framesPerBuffer"></param>
 /// <param name="streamFlags"></param>
 /// <param name="streamCallback"></param>
 /// <param name="userData"></param>
 /// <returns>True on success</returns>
 public bool OpenOutputStream(out IntPtr stream, ref PortAudio.PaStreamParameters?outputParameters,
                              double sampleRate, uint framesPerBuffer, PortAudio.PaStreamFlags streamFlags,
                              PortAudio.PaStreamCallbackDelegate streamCallback, IntPtr userData)
 {
     PortAudio.PaStreamParameters?inputParameters = null;
     return
         (!CheckError("OpenOutputStream",
                      OpenStream(out stream, ref inputParameters, ref outputParameters, sampleRate, framesPerBuffer, streamFlags, streamCallback, userData)));
 }
Example #2
0
        public PortAudio.PaError OpenStream(out IntPtr stream, ref PortAudio.PaStreamParameters?inputParameters, ref PortAudio.PaStreamParameters?outputParameters,
                                            double sampleRate, uint framesPerBuffer, PortAudio.PaStreamFlags streamFlags,
                                            PortAudio.PaStreamCallbackDelegate streamCallback, IntPtr userData)
        {
            lock (_Mutex)
            {
                if (_Disposed)
                {
                    throw new ObjectDisposedException("PortAudioHandle already disposed");
                }

                PortAudio.PaError res = PortAudio.Pa_OpenStream(out stream, ref inputParameters, ref outputParameters, sampleRate, framesPerBuffer, streamFlags, streamCallback,
                                                                userData);
                if (res == PortAudio.PaError.paNoError)
                {
                    _Streams.Add(stream);
                }
                return(res);
            }
        }