To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.

The primary repository for this project is hosted at https://github.com/sonic-visualiser/sv-dependency-builds .
This repository is a read-only copy which is updated automatically every hour.

Statistics Download as Zip
| Branch: | Tag: | Revision:

root / src / portaudio_20161030_catalina_patch / pablio / pablio.h @ 162:d43aab368df9

History | View | Annotate | Download (3.93 KB)

1
#ifndef _PABLIO_H
2
#define _PABLIO_H
3

    
4
#ifdef __cplusplus
5
extern "C"
6
{
7
#endif /* __cplusplus */
8

    
9
/*
10
 * $Id$
11
 * PABLIO.h
12
 * Portable Audio Blocking read/write utility.
13
 *
14
 * Author: Phil Burk, http://www.softsynth.com/portaudio/
15
 *
16
 * Include file for PABLIO, the Portable Audio Blocking I/O Library.
17
 * PABLIO is built on top of PortAudio, the Portable Audio Library.
18
 * For more information see: http://www.portaudio.com
19
 * Copyright (c) 1999-2000 Ross Bencina and Phil Burk
20
 *
21
 * Permission is hereby granted, free of charge, to any person obtaining
22
 * a copy of this software and associated documentation files
23
 * (the "Software"), to deal in the Software without restriction,
24
 * including without limitation the rights to use, copy, modify, merge,
25
 * publish, distribute, sublicense, and/or sell copies of the Software,
26
 * and to permit persons to whom the Software is furnished to do so,
27
 * subject to the following conditions:
28
 *
29
 * The above copyright notice and this permission notice shall be
30
 * included in all copies or substantial portions of the Software.
31
 *
32
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
33
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
34
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
35
 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
36
 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
37
 * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
38
 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
39
 */
40

    
41
/*
42
 * The text above constitutes the entire PortAudio license; however, 
43
 * the PortAudio community also makes the following non-binding requests:
44
 *
45
 * Any person wishing to distribute modifications to the Software is
46
 * requested to send the modifications to the original developer so that
47
 * they can be incorporated into the canonical version. It is also 
48
 * requested that these non-binding requests be included along with the 
49
 * license above.
50
 */
51

    
52
#include <stdio.h>
53
#include <stdlib.h>
54
#include <math.h>
55
#include "portaudio.h"
56
#include "pa_ringbuffer.h"
57
#include <string.h>
58

    
59
typedef struct
60
{
61
    RingBuffer   inFIFO;
62
    RingBuffer   outFIFO;
63
    PortAudioStream *stream;
64
    int          bytesPerFrame;
65
    int          samplesPerFrame;
66
}
67
PABLIO_Stream;
68

    
69
/* Values for flags for OpenAudioStream(). */
70
#define PABLIO_READ     (1<<0)
71
#define PABLIO_WRITE    (1<<1)
72
#define PABLIO_READ_WRITE    (PABLIO_READ|PABLIO_WRITE)
73
#define PABLIO_MONO     (1<<2)
74
#define PABLIO_STEREO   (1<<3)
75

    
76
/************************************************************
77
 * Write data to ring buffer.
78
 * Will not return until all the data has been written.
79
 */
80
long WriteAudioStream( PABLIO_Stream *aStream, void *data, long numFrames );
81

    
82
/************************************************************
83
 * Read data from ring buffer.
84
 * Will not return until all the data has been read.
85
 */
86
long ReadAudioStream( PABLIO_Stream *aStream, void *data, long numFrames );
87

    
88
/************************************************************
89
 * Return the number of frames that could be written to the stream without
90
 * having to wait.
91
 */
92
long GetAudioStreamWriteable( PABLIO_Stream *aStream );
93

    
94
/************************************************************
95
 * Return the number of frames that are available to be read from the
96
 * stream without having to wait.
97
 */
98
long GetAudioStreamReadable( PABLIO_Stream *aStream );
99

    
100
/************************************************************
101
 * Opens a PortAudio stream with default characteristics.
102
 * Allocates PABLIO_Stream structure.
103
 *
104
 * flags parameter can be an ORed combination of:
105
 *    PABLIO_READ, PABLIO_WRITE, or PABLIO_READ_WRITE,
106
 *    and either PABLIO_MONO or PABLIO_STEREO
107
 */
108
PaError OpenAudioStream( PABLIO_Stream **aStreamPtr, double sampleRate,
109
                         PaSampleFormat format, long flags );
110

    
111
PaError CloseAudioStream( PABLIO_Stream *aStream );
112

    
113
#ifdef __cplusplus
114
}
115
#endif /* __cplusplus */
116
#endif /* _PABLIO_H */