Ejemplo n.º 1
0
 private void Dispose(bool disposing)
 {
     unsafe
     {
         PaErrorException.ThrowIfError(Pa_CloseStream(stream));
     }
 }
Ejemplo n.º 2
0
        public pa_host_api_index_t HostApiTypeIdToHostApiIndex(PaHostApiTypeId type)
        {
            var index = Pa_HostApiTypeIdToHostApiIndex(type);

            PaErrorException.ThrowIfError(index);
            return(index);
        }
Ejemplo n.º 3
0
        public pa_device_index_t HostApiDeviceIndexToDeviceIndex(pa_host_api_index_t hostApi, int hostApiDeviceIndex)
        {
            var index = Pa_HostApiDeviceIndexToDeviceIndex(hostApi, hostApiDeviceIndex);

            PaErrorException.ThrowIfError(index);
            return(index);
        }
Ejemplo n.º 4
0
        public PaBlockingStream OpenStream(
            PaStreamParameters?inputParameters, PaStreamParameters?outputParameters,
            double sampleRate, int framesPerBuffer, PaStreamFlags streamFlags)
        {
            IntPtr stream;

            unsafe
            {
                PaStreamParameters inputParametersTemp, outputParametersTemp;
                IntPtr             inputParametersPtr = IntPtr.Zero;
                if (inputParameters.HasValue)
                {
                    inputParametersPtr = new IntPtr(&inputParametersTemp);
                    Marshal.StructureToPtr <PaStreamParameters>(inputParameters.Value, inputParametersPtr, false);
                }
                IntPtr outputParametersPtr = IntPtr.Zero;
                if (outputParameters.HasValue)
                {
                    outputParametersPtr = new IntPtr(&outputParametersTemp);
                    Marshal.StructureToPtr <PaStreamParameters>(outputParameters.Value, outputParametersPtr, false);
                }
                PaErrorException.ThrowIfError(Pa_OpenStream(
                                                  new IntPtr(&stream),
                                                  inputParametersPtr, outputParametersPtr,
                                                  sampleRate, (unsigned_long_t)framesPerBuffer, streamFlags,
                                                  null, IntPtr.Zero));
            }
            return(new PaBlockingStream(
                       stream,
                       inputParameters.HasValue ? inputParameters.Value.sampleFormat : 0,
                       outputParameters.HasValue ? outputParameters.Value.sampleFormat : 0,
                       inputParameters.HasValue ? inputParameters.Value.channelCount : 0,
                       outputParameters.HasValue ? outputParameters.Value.channelCount : 0));
        }
Ejemplo n.º 5
0
 public void SetStreamFinishedCallback(PaStreamFinishedCallback streamFinishedCallback, object userData)
 {
     if (streamFinishedCallback == null)
     {
         streamFinishedCallbackContainer = null;
         PaErrorException.ThrowIfError(Pa_SetStreamFinishedCallback(stream, null));
     }
     else
     {
         streamFinishedCallbackContainer = new StreamFinishedCallbackContainer(streamFinishedCallback, userData);
         PaErrorException.ThrowIfError(Pa_SetStreamFinishedCallback(stream, streamFinishedCallbackContainer.Callback));
     }
 }
Ejemplo n.º 6
0
        public PaBlockingStream OpenDefaultStream(
            int numInputChannels, int numOutputChannels, PaSampleFormat sampleFormat,
            double sampleRate, int framesPerBuffer, PaStreamFlags streamFlags)
        {
            IntPtr stream;

            unsafe
            {
                PaErrorException.ThrowIfError(Pa_OpenDefaultStream(
                                                  new IntPtr(&stream),
                                                  numInputChannels, numOutputChannels, sampleFormat,
                                                  sampleRate, (unsigned_long_t)framesPerBuffer, streamFlags,
                                                  null, IntPtr.Zero));
            }
            return(new PaBlockingStream(stream, sampleFormat, sampleFormat, numInputChannels, numOutputChannels));
        }
Ejemplo n.º 7
0
        public PaStream OpenDefaultStream(
            int numInputChannels, int numOutputChannels, PaSampleFormat sampleFormat,
            double sampleRate, int framesPerBuffer, PaStreamFlags streamFlags,
            PaStreamCallback streamCallback, object userData)
        {
            var streamCallbackContainer = new StreamCallbackContainer(
                streamCallback,
                sampleFormat, sampleFormat,
                numInputChannels, numOutputChannels, userData);
            IntPtr stream;

            unsafe
            {
                PaErrorException.ThrowIfError(Pa_OpenDefaultStream(
                                                  new IntPtr(&stream),
                                                  numInputChannels, numOutputChannels, sampleFormat,
                                                  sampleRate, (unsigned_long_t)framesPerBuffer, streamFlags,
                                                  streamCallbackContainer.Callback, IntPtr.Zero));
            }
            return(new PaStream(stream, streamCallbackContainer));
        }
Ejemplo n.º 8
0
 public void AbortStream()
 {
     PaErrorException.ThrowIfError(Pa_AbortStream(stream));
 }
Ejemplo n.º 9
0
 public void StopStream()
 {
     PaErrorException.ThrowIfError(Pa_StopStream(stream));
 }
Ejemplo n.º 10
0
 public static PaLibrary Initialize()
 {
     PaErrorException.ThrowIfError(Pa_Initialize());
     return(new PaLibrary());
 }
Ejemplo n.º 11
0
 private void Dispose(bool disposing)
 {
     PaErrorException.ThrowIfError(Pa_Terminate());
 }