PortAudio  2.0
pa_process.h
Go to the documentation of this file.
1 #ifndef PA_PROCESS_H
2 #define PA_PROCESS_H
3 /*
4  * $Id: pa_process.h 1523 2010-07-10 17:41:25Z dmitrykos $
5  * Portable Audio I/O Library callback buffer processing adapters
6  *
7  * Based on the Open Source API proposed by Ross Bencina
8  * Copyright (c) 1999-2002 Phil Burk, Ross Bencina
9  *
10  * Permission is hereby granted, free of charge, to any person obtaining
11  * a copy of this software and associated documentation files
12  * (the "Software"), to deal in the Software without restriction,
13  * including without limitation the rights to use, copy, modify, merge,
14  * publish, distribute, sublicense, and/or sell copies of the Software,
15  * and to permit persons to whom the Software is furnished to do so,
16  * subject to the following conditions:
17  *
18  * The above copyright notice and this permission notice shall be
19  * included in all copies or substantial portions of the Software.
20  *
21  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
24  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
25  * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
26  * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
27  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28  */
29 
30 /*
31  * The text above constitutes the entire PortAudio license; however,
32  * the PortAudio community also makes the following non-binding requests:
33  *
34  * Any person wishing to distribute modifications to the Software is
35  * requested to send the modifications to the original developer so that
36  * they can be incorporated into the canonical version. It is also
37  * requested that these non-binding requests be included along with the
38  * license above.
39  */
40 
203 #include "portaudio.h"
204 #include "pa_converters.h"
205 #include "pa_dither.h"
206 
207 #ifdef __cplusplus
208 extern "C"
209 {
210 #endif /* __cplusplus */
211 
212 
219 typedef enum {
222 
225 
228 
238 
239 
242 typedef struct PaUtilChannelDescriptor{
243  void *data;
244  unsigned int stride;
246 
247 
253 typedef struct {
254  unsigned long framesPerUserBuffer;
255  unsigned long framesPerHostBuffer;
256 
261  unsigned long framesPerTempBuffer;
262 
263  unsigned int inputChannelCount;
269 
270  unsigned int outputChannelCount;
276 
279 
282  unsigned long framesInTempInputBuffer;
286  unsigned long framesInTempOutputBuffer;
289 
291 
293  unsigned long hostInputFrameCount[2];
294  PaUtilChannelDescriptor *hostInputChannels[2];
300  unsigned long hostOutputFrameCount[2];
301  PaUtilChannelDescriptor *hostOutputChannels[2];
308 
309  double samplePeriod;
310 
312  void *userData;
314 
315 
318 
378  int inputChannelCount, PaSampleFormat userInputSampleFormat,
379  PaSampleFormat hostInputSampleFormat,
380  int outputChannelCount, PaSampleFormat userOutputSampleFormat,
381  PaSampleFormat hostOutputSampleFormat,
382  double sampleRate,
383  PaStreamFlags streamFlags,
384  unsigned long framesPerUserBuffer, /* 0 indicates don't care */
385  unsigned long framesPerHostBuffer,
386  PaUtilHostBufferSizeMode hostBufferSizeMode,
387  PaStreamCallback *streamCallback, void *userData );
388 
389 
398 
399 
406 void PaUtil_ResetBufferProcessor( PaUtilBufferProcessor* bufferProcessor );
407 
408 
417 unsigned long PaUtil_GetBufferProcessorInputLatency( PaUtilBufferProcessor* bufferProcessor );
418 
427 unsigned long PaUtil_GetBufferProcessorOutputLatency( PaUtilBufferProcessor* bufferProcessor );
428 
438 
439 
451 void PaUtil_SetInputFrameCount( PaUtilBufferProcessor* bufferProcessor,
452  unsigned long frameCount );
453 
454 
462 void PaUtil_SetNoInput( PaUtilBufferProcessor* bufferProcessor );
463 
464 
474 void PaUtil_SetInputChannel( PaUtilBufferProcessor* bufferProcessor,
475  unsigned int channel, void *data, unsigned int stride );
476 
477 
489  unsigned int firstChannel, void *data, unsigned int channelCount );
490 
491 
500  unsigned int channel, void *data );
501 
502 
507  unsigned long frameCount );
508 
512 void PaUtil_Set2ndInputChannel( PaUtilBufferProcessor* bufferProcessor,
513  unsigned int channel, void *data, unsigned int stride );
514 
519  unsigned int firstChannel, void *data, unsigned int channelCount );
520 
525  unsigned int channel, void *data );
526 
527 
540  unsigned long frameCount );
541 
542 
548 void PaUtil_SetNoOutput( PaUtilBufferProcessor* bufferProcessor );
549 
550 
560 void PaUtil_SetOutputChannel( PaUtilBufferProcessor* bufferProcessor,
561  unsigned int channel, void *data, unsigned int stride );
562 
563 
575  unsigned int firstChannel, void *data, unsigned int channelCount );
576 
577 
586  unsigned int channel, void *data );
587 
588 
593  unsigned long frameCount );
594 
599  unsigned int channel, void *data, unsigned int stride );
600 
605  unsigned int firstChannel, void *data, unsigned int channelCount );
606 
611  unsigned int channel, void *data );
612 
619 
633  PaStreamCallbackTimeInfo* timeInfo, PaStreamCallbackFlags callbackStatusFlags );
634 
635 
659 unsigned long PaUtil_EndBufferProcessing( PaUtilBufferProcessor* bufferProcessor,
660  int *callbackResult );
661 
662 
675 
682 
704 unsigned long PaUtil_CopyInput( PaUtilBufferProcessor* bufferProcessor,
705  void **buffer, unsigned long frameCount );
706 
707 
708 /* Copy samples from a user supplied buffer to host output channels set up by
709  the PaUtil_Set*OutputChannels functions. This function is intended for use with
710  blocking read/write streams. Copies the minimum of the number of
711  user frames (specified by the frameCount parameter) and the number of
712  host frames (specified in a previous call to SetOutputFrameCount()).
713 
714  @param bufferProcessor The buffer processor.
715 
716  @param buffer A pointer to the user buffer pointer, or a pointer to a pointer
717  to an array of user buffer pointers for a non-interleaved stream. It is
718  important that this parameter points to a copy of the user buffer pointers,
719  not to the actual user buffer pointers, because this function updates the
720  pointers before returning.
721 
722  @param frameCount The number of frames of data in the buffer(s) pointed to by
723  the buffer parameter.
724 
725  @return The number of frames copied. The buffer pointer(s) pointed to by the
726  buffer parameter are advanced to point to the frame(s) following the last one
727  copied.
728 */
729 unsigned long PaUtil_CopyOutput( PaUtilBufferProcessor* bufferProcessor,
730  const void ** buffer, unsigned long frameCount );
731 
732 
733 /* Zero samples in host output channels set up by the PaUtil_Set*OutputChannels
734  functions. This function is useful for flushing streams.
735  Zeros the minimum of frameCount and the number of host frames specified in a
736  previous call to SetOutputFrameCount().
737 
738  @param bufferProcessor The buffer processor.
739 
740  @param frameCount The maximum number of frames to zero.
741 
742  @return The number of frames zeroed.
743 */
744 unsigned long PaUtil_ZeroOutput( PaUtilBufferProcessor* bufferProcessor,
745  unsigned long frameCount );
746 
747 
751 #ifdef __cplusplus
752 }
753 #endif /* __cplusplus */
754 #endif /* PA_PROCESS_H */

Generated for PortAudio by  doxygen1.8.1.1