annotate src/portaudio_20140130/pablio/pablio.h @ 83:ae30d91d2ffe

Replace these with versions built using an older toolset (so as to avoid ABI compatibilities when linking on Ubuntu 14.04 for packaging purposes)
author Chris Cannam
date Fri, 07 Feb 2020 11:51:13 +0000
parents 7ddb4fc30dac
children
rev   line source
Chris@39 1 #ifndef _PABLIO_H
Chris@39 2 #define _PABLIO_H
Chris@39 3
Chris@39 4 #ifdef __cplusplus
Chris@39 5 extern "C"
Chris@39 6 {
Chris@39 7 #endif /* __cplusplus */
Chris@39 8
Chris@39 9 /*
Chris@39 10 * $Id: pablio.h 1854 2012-07-09 15:53:00Z philburk $
Chris@39 11 * PABLIO.h
Chris@39 12 * Portable Audio Blocking read/write utility.
Chris@39 13 *
Chris@39 14 * Author: Phil Burk, http://www.softsynth.com/portaudio/
Chris@39 15 *
Chris@39 16 * Include file for PABLIO, the Portable Audio Blocking I/O Library.
Chris@39 17 * PABLIO is built on top of PortAudio, the Portable Audio Library.
Chris@39 18 * For more information see: http://www.portaudio.com
Chris@39 19 * Copyright (c) 1999-2000 Ross Bencina and Phil Burk
Chris@39 20 *
Chris@39 21 * Permission is hereby granted, free of charge, to any person obtaining
Chris@39 22 * a copy of this software and associated documentation files
Chris@39 23 * (the "Software"), to deal in the Software without restriction,
Chris@39 24 * including without limitation the rights to use, copy, modify, merge,
Chris@39 25 * publish, distribute, sublicense, and/or sell copies of the Software,
Chris@39 26 * and to permit persons to whom the Software is furnished to do so,
Chris@39 27 * subject to the following conditions:
Chris@39 28 *
Chris@39 29 * The above copyright notice and this permission notice shall be
Chris@39 30 * included in all copies or substantial portions of the Software.
Chris@39 31 *
Chris@39 32 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
Chris@39 33 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
Chris@39 34 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
Chris@39 35 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
Chris@39 36 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
Chris@39 37 * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
Chris@39 38 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Chris@39 39 */
Chris@39 40
Chris@39 41 /*
Chris@39 42 * The text above constitutes the entire PortAudio license; however,
Chris@39 43 * the PortAudio community also makes the following non-binding requests:
Chris@39 44 *
Chris@39 45 * Any person wishing to distribute modifications to the Software is
Chris@39 46 * requested to send the modifications to the original developer so that
Chris@39 47 * they can be incorporated into the canonical version. It is also
Chris@39 48 * requested that these non-binding requests be included along with the
Chris@39 49 * license above.
Chris@39 50 */
Chris@39 51
Chris@39 52 #include <stdio.h>
Chris@39 53 #include <stdlib.h>
Chris@39 54 #include <math.h>
Chris@39 55 #include "portaudio.h"
Chris@39 56 #include "pa_ringbuffer.h"
Chris@39 57 #include <string.h>
Chris@39 58
Chris@39 59 typedef struct
Chris@39 60 {
Chris@39 61 RingBuffer inFIFO;
Chris@39 62 RingBuffer outFIFO;
Chris@39 63 PortAudioStream *stream;
Chris@39 64 int bytesPerFrame;
Chris@39 65 int samplesPerFrame;
Chris@39 66 }
Chris@39 67 PABLIO_Stream;
Chris@39 68
Chris@39 69 /* Values for flags for OpenAudioStream(). */
Chris@39 70 #define PABLIO_READ (1<<0)
Chris@39 71 #define PABLIO_WRITE (1<<1)
Chris@39 72 #define PABLIO_READ_WRITE (PABLIO_READ|PABLIO_WRITE)
Chris@39 73 #define PABLIO_MONO (1<<2)
Chris@39 74 #define PABLIO_STEREO (1<<3)
Chris@39 75
Chris@39 76 /************************************************************
Chris@39 77 * Write data to ring buffer.
Chris@39 78 * Will not return until all the data has been written.
Chris@39 79 */
Chris@39 80 long WriteAudioStream( PABLIO_Stream *aStream, void *data, long numFrames );
Chris@39 81
Chris@39 82 /************************************************************
Chris@39 83 * Read data from ring buffer.
Chris@39 84 * Will not return until all the data has been read.
Chris@39 85 */
Chris@39 86 long ReadAudioStream( PABLIO_Stream *aStream, void *data, long numFrames );
Chris@39 87
Chris@39 88 /************************************************************
Chris@39 89 * Return the number of frames that could be written to the stream without
Chris@39 90 * having to wait.
Chris@39 91 */
Chris@39 92 long GetAudioStreamWriteable( PABLIO_Stream *aStream );
Chris@39 93
Chris@39 94 /************************************************************
Chris@39 95 * Return the number of frames that are available to be read from the
Chris@39 96 * stream without having to wait.
Chris@39 97 */
Chris@39 98 long GetAudioStreamReadable( PABLIO_Stream *aStream );
Chris@39 99
Chris@39 100 /************************************************************
Chris@39 101 * Opens a PortAudio stream with default characteristics.
Chris@39 102 * Allocates PABLIO_Stream structure.
Chris@39 103 *
Chris@39 104 * flags parameter can be an ORed combination of:
Chris@39 105 * PABLIO_READ, PABLIO_WRITE, or PABLIO_READ_WRITE,
Chris@39 106 * and either PABLIO_MONO or PABLIO_STEREO
Chris@39 107 */
Chris@39 108 PaError OpenAudioStream( PABLIO_Stream **aStreamPtr, double sampleRate,
Chris@39 109 PaSampleFormat format, long flags );
Chris@39 110
Chris@39 111 PaError CloseAudioStream( PABLIO_Stream *aStream );
Chris@39 112
Chris@39 113 #ifdef __cplusplus
Chris@39 114 }
Chris@39 115 #endif /* __cplusplus */
Chris@39 116 #endif /* _PABLIO_H */