Esempio n. 1
0
        // Shutdown audio engine
        public static void Shutdown()
        {
            PortAudio.Pa_StopStream(stream);

            PortAudio.Pa_CloseStream(stream);

            PortAudio.Pa_Terminate();
        }
Esempio n. 2
0
        public void CloseStream(IntPtr stream)
        {
            if (_Disposed)
            {
                throw new ObjectDisposedException("PortAudioHandle already disposed");
            }

            lock (_Mutex)
            {
                PortAudio.Pa_CloseStream(stream);
                _Streams.Remove(stream);
            }
        }
Esempio n. 3
0
        public void CloseStream(IntPtr stream)
        {
            lock (_Mutex)
            {
                if (_Disposed)
                {
                    throw new ObjectDisposedException("PortAudioHandle already disposed");
                }

                try
                {
                    PortAudio.Pa_CloseStream(stream);
                }
                catch (Exception ex)
                {
                    CLog.LogError(errorText: $"Error closing stream: {ex.Message}", e: ex);
                }
                _Streams.Remove(stream);
            }
        }
        /*
         * private IntPtr streamOpen(int inputChannels,int outputChannels,
         *  int sampleRate, uint framesPerBuffer) {
         *  IntPtr stream = new IntPtr();
         *  IntPtr data = new IntPtr(0);
         *  errorCheck("OpenDefaultStream",PortAudio.Pa_OpenDefaultStream(
         *      out stream,
         *      inputChannels,
         *      outputChannels,
         *      (uint) PortAudio.PaSampleFormat.paFloat32,
         *      sampleRate,
         *      framesPerBuffer,
         *      this.paStreamCallback,
         *      data));
         *  return stream;
         * }
         */

        private void streamClose(IntPtr stream)
        {
            errorCheck("CloseStream", PortAudio.Pa_CloseStream(stream));
        }