├── .gitignore ├── Bin ├── OSX │ └── libportaudio.2.dylib ├── README.md ├── x64 │ └── portaudio_x64.dll └── x86 │ └── portaudio_x86.dll ├── Documentation └── html │ ├── License.html │ ├── annotated.html │ ├── api_overview.html │ ├── bc_s.png │ ├── bdwn.png │ ├── blocking_read_write.html │ ├── classScopedPaHandler.html │ ├── classSine.html │ ├── classes.html │ ├── closed.png │ ├── compile_cmake.html │ ├── compile_linux.html │ ├── compile_mac_coreaudio.html │ ├── compile_windows.html │ ├── compile_windows_asio_msvc.html │ ├── compile_windows_mingw.html │ ├── deprecated.html │ ├── dir_d28a4824dc47e487b107a5db32ef43c4.html │ ├── dir_d44c64559bbebec7f509842c48db8b23.html │ ├── doxygen.css │ ├── doxygen.png │ ├── dynsections.js │ ├── exploring.html │ ├── files.html │ ├── ftv2blank.png │ ├── ftv2cl.png │ ├── ftv2doc.png │ ├── ftv2folderclosed.png │ ├── ftv2folderopen.png │ ├── ftv2lastnode.png │ ├── ftv2link.png │ ├── ftv2mlastnode.png │ ├── ftv2mnode.png │ ├── ftv2mo.png │ ├── ftv2node.png │ ├── ftv2ns.png │ ├── ftv2plastnode.png │ ├── ftv2pnode.png │ ├── ftv2splitbar.png │ ├── ftv2vertline.png │ ├── functions.html │ ├── functions_vars.html │ ├── globals.html │ ├── globals_defs.html │ ├── globals_enum.html │ ├── globals_eval.html │ ├── globals_func.html │ ├── globals_type.html │ ├── group__examples__src.html │ ├── group__public__header.html │ ├── index.html │ ├── initializing_portaudio.html │ ├── jquery.js │ ├── modules.html │ ├── nav_f.png │ ├── nav_g.png │ ├── nav_h.png │ ├── open.png │ ├── open_default_stream.html │ ├── pa__asio_8h.html │ ├── pa__asio_8h_source.html │ ├── pa__devs_8c.html │ ├── pa__devs_8c_source.html │ ├── pa__fuzz_8c.html │ ├── pa__fuzz_8c_source.html │ ├── pa__jack_8h.html │ ├── pa__jack_8h_source.html │ ├── pa__linux__alsa_8h.html │ ├── pa__linux__alsa_8h_source.html │ ├── pa__mac__core_8h.html │ ├── pa__mac__core_8h_source.html │ ├── pa__win__ds_8h.html │ ├── pa__win__ds_8h_source.html │ ├── pa__win__wasapi_8h.html │ ├── pa__win__wasapi_8h_source.html │ ├── pa__win__waveformat_8h.html │ ├── pa__win__waveformat_8h_source.html │ ├── pa__win__wdmks_8h.html │ ├── pa__win__wdmks_8h_source.html │ ├── pa__win__wmme_8h.html │ ├── pa__win__wmme_8h_source.html │ ├── paex__mono__asio__channel__select_8c.html │ ├── paex__mono__asio__channel__select_8c_source.html │ ├── paex__ocean__shore_8c.html │ ├── paex__ocean__shore_8c_source.html │ ├── paex__pink_8c.html │ ├── paex__pink_8c_source.html │ ├── paex__read__write__wire_8c.html │ ├── paex__read__write__wire_8c_source.html │ ├── paex__record_8c.html │ ├── paex__record_8c_source.html │ ├── paex__record__file_8c.html │ ├── paex__record__file_8c_source.html │ ├── paex__saw_8c.html │ ├── paex__saw_8c_source.html │ ├── paex__sine_8c.html │ ├── paex__sine_8c_source.html │ ├── paex__sine__c_09_09_8cpp_source.html │ ├── paex__wmme__ac3_8c.html │ ├── paex__wmme__ac3_8c_source.html │ ├── paex__wmme__surround_8c.html │ ├── paex__wmme__surround_8c_source.html │ ├── paex__write__sine_8c.html │ ├── paex__write__sine_8c_source.html │ ├── paex__write__sine__nonint_8c.html │ ├── paex__write__sine__nonint_8c_source.html │ ├── pages.html │ ├── portaudio-external-architecture-diagram.png │ ├── portaudio_8h.html │ ├── portaudio_8h_source.html │ ├── querying_devices.html │ ├── start_stop_abort.html │ ├── structBiQuad.html │ ├── structOceanWave.html │ ├── structPaAlsaStreamInfo.html │ ├── structPaAsioStreamInfo.html │ ├── structPaDeviceInfo.html │ ├── structPaHostApiInfo.html │ ├── structPaHostErrorInfo.html │ ├── structPaMacCoreStreamInfo.html │ ├── structPaStreamCallbackTimeInfo.html │ ├── structPaStreamInfo.html │ ├── structPaStreamParameters.html │ ├── structPaVersionInfo.html │ ├── structPaWDMKSDirectionSpecificStreamInfo.html │ ├── structPaWDMKSSpecificStreamInfo.html │ ├── structPaWasapiJackDescription.html │ ├── structPaWasapiStreamInfo.html │ ├── structPaWinDirectSoundStreamInfo.html │ ├── structPaWinMmeDeviceAndChannelCount.html │ ├── structPaWinMmeStreamInfo.html │ ├── structPaWinWDMKSDeviceInfo.html │ ├── structPaWinWDMKSInfo.html │ ├── structPaWinWaveFormat.html │ ├── structPinkNoise.html │ ├── structpaTestData.html │ ├── sync_off.png │ ├── sync_on.png │ ├── tab_a.png │ ├── tab_b.png │ ├── tab_h.png │ ├── tab_s.png │ ├── tabs.css │ ├── terminating_portaudio.html │ ├── tutorial_start.html │ ├── utility_functions.html │ └── writing_a_callback.html ├── Examples ├── pa_devs │ ├── Project1.dpr │ ├── Project1.dproj │ └── Project1.res ├── paex_basic │ ├── Project1.dpr │ ├── Project1.dproj │ └── Project1.res ├── paex_saw │ ├── Project1.dpr │ ├── Project1.dproj │ └── Project1.res └── paex_sine │ ├── Project1.dpr │ ├── Project1.dproj │ └── Project1.res ├── Include └── portaudio.pas └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | # Uncomment these types if you want even more clean repository. But be careful. 2 | # It can make harm to an existing project source. Read explanations below. 3 | # 4 | # Resource files are binaries containing manifest, project icon and version info. 5 | # They can not be viewed as text or compared by diff-tools. Consider replacing them with .rc files. 6 | #*.res 7 | # 8 | # Type library file (binary). In old Delphi versions it should be stored. 9 | # Since Delphi 2009 it is produced from .ridl file and can safely be ignored. 10 | #*.tlb 11 | # 12 | # Diagram Portfolio file. Used by the diagram editor up to Delphi 7. 13 | # Uncomment this if you are not using diagrams or use newer Delphi version. 14 | #*.ddp 15 | # 16 | # Visual LiveBindings file. Added in Delphi XE2. 17 | # Uncomment this if you are not using LiveBindings Designer. 18 | #*.vlb 19 | # 20 | # Deployment Manager configuration file for your project. Added in Delphi XE2. 21 | # Uncomment this if it is not mobile development and you do not use remote debug feature. 22 | #*.deployproj 23 | # 24 | # C++ object files produced when C/C++ Output file generation is configured. 25 | # Uncomment this if you are not using external objects (zlib library for example). 26 | #*.obj 27 | # 28 | 29 | # Delphi compiler-generated binaries (safe to delete) 30 | *.exe 31 | *.dll 32 | *.bpl 33 | *.bpi 34 | *.dcp 35 | *.so 36 | *.apk 37 | *.drc 38 | *.map 39 | *.dres 40 | *.rsm 41 | *.tds 42 | *.dcu 43 | *.lib 44 | *.a 45 | *.o 46 | *.ocx 47 | 48 | # Delphi autogenerated files (duplicated info) 49 | *.cfg 50 | *.hpp 51 | *Resource.rc 52 | 53 | # Delphi local files (user-specific info) 54 | *.local 55 | *.identcache 56 | *.projdata 57 | *.tvsconfig 58 | *.dsk 59 | 60 | # Delphi history and backups 61 | __history/ 62 | __recovery/ 63 | *.~* 64 | 65 | # Castalia statistics file (since XE7 Castalia is distributed with Delphi) 66 | *.stat 67 | 68 | 69 | !/Bin/**/* -------------------------------------------------------------------------------- /Bin/OSX/libportaudio.2.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DelphiForBroadcasting/portaudio-delphi/de957923e704f1466dbab1ccdcad6906ec6f6901/Bin/OSX/libportaudio.2.dylib -------------------------------------------------------------------------------- /Bin/README.md: -------------------------------------------------------------------------------- 1 | PortAudio binaries 2 | ================== 3 | Git clone from [portaudio-binaries](https://github.com/spatialaudio/portaudio-binaries) 4 | 5 | This repository provides pre-compiled dynamic libraries for 6 | [PortAudio](http://www.portaudio.com/). 7 | 8 | 9 | DLLs for Windows (32-bit and 64-bit) 10 | ------------------------------------ 11 | 12 | The DLLs include all available host APIs, namely WMME, DirectSound, WDM/KS, 13 | WASAPI and ASIO. For more informaton about the ASIO SDK see 14 | http://www.steinberg.net/en/company/developers.html. 15 | 16 | The DLLs were created on a Debian GNU/Linux system using [MXE](http://mxe.cc/) 17 | ([this version](https://github.com/mxe/mxe/tree/87b08fae68f5e45263d1bb71e8061700d86e3c8c), using `pa_stable_v190600_20161030.tgz`) 18 | with the following commands (after installing the 19 | [dependencies](http://mxe.cc/#requirements)): 20 | 21 | git clone https://github.com/mxe/mxe.git 22 | wget http://www.steinberg.net/sdk_downloads/asiosdk2.3.zip 23 | export PATH=$(pwd)"/mxe/usr/bin:$PATH" 24 | 25 | Open the file `mxe/src/portaudio.mk` and change 26 | `--with-winapi=wmme,directx,wdmks,wasapi` to 27 | `--with-winapi=wmme,directx,wdmks,wasapi,asio` (and make sure to keep the 28 | backslash at the end of the line). 29 | To the first line starting with "$(MAKE)", append " EXAMPLES= SELFTESTS=" (without the quotes). 30 | Delete the 4 lines before the last line (i.e. keep the line with "endef"). 31 | After saving your changes, please continue: 32 | 33 | for TARGET in x86_64-w64-mingw32.static i686-w64-mingw32.static 34 | do 35 | unzip asiosdk2.3.zip 36 | # You'll need write access in /usr/local for this: 37 | mv ASIOSDK2.3 /usr/local/asiosdk2 38 | # If it doesn't work, prepend "sudo " to the previous command 39 | make -C mxe portaudio MXE_TARGETS=$TARGET 40 | $TARGET-gcc -O2 -shared -o libportaudio-$TARGET.dll -Wl,--whole-archive -lportaudio -Wl,--no-whole-archive -lstdc++ -lwinmm -lole32 -lsetupapi 41 | $TARGET-strip libportaudio-$TARGET.dll 42 | chmod -x libportaudio-$TARGET.dll 43 | # again, you'll probably have to use "sudo": 44 | rm -r /usr/local/asiosdk2 45 | done 46 | 47 | mv libportaudio-x86_64-w64-mingw32.static.dll libportaudio64bit.dll 48 | mv libportaudio-i686-w64-mingw32.static.dll libportaudio32bit.dll 49 | 50 | A different set of DLLs (compiled with Visual Studio) is available at 51 | https://github.com/adfernandes/precompiled-portaudio-windows. 52 | 53 | dylib for Mac OS X (64-bit) 54 | --------------------------- 55 | 56 | The dylib was created on a Mac OS X system using XCode. 57 | The XCode CLI tools were installed with: 58 | 59 | xcode-select --install 60 | 61 | The following commands were used for compilation: 62 | 63 | curl -O http://www.portaudio.com/archives/pa_stable_v190600_20161030.tgz 64 | tar xvf pa_stable_v190600_20161030.tgz 65 | cd portaudio 66 | # in configure: replace "-Werror" (just search for it) with "-DNDEBUG" 67 | ./configure --disable-mac-universal MACOSX_DEPLOYMENT_TARGET=10.6 68 | make 69 | cd .. 70 | cp portaudio/lib/.libs/libportaudio.2.dylib libportaudio.dylib 71 | 72 | Copyright 73 | --------- 74 | 75 | * PortAudio by Ross Bencina and Phil Burk, MIT License. 76 | 77 | * Steinberg Audio Stream I/O API by Steinberg Media Technologies GmbH. -------------------------------------------------------------------------------- /Bin/x64/portaudio_x64.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DelphiForBroadcasting/portaudio-delphi/de957923e704f1466dbab1ccdcad6906ec6f6901/Bin/x64/portaudio_x64.dll -------------------------------------------------------------------------------- /Bin/x86/portaudio_x86.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DelphiForBroadcasting/portaudio-delphi/de957923e704f1466dbab1ccdcad6906ec6f6901/Bin/x86/portaudio_x86.dll -------------------------------------------------------------------------------- /Documentation/html/License.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 |
19 | PortAudio
20 | 2.0
21 |
22 | |
23 |
PortAudio Portable Real-Time Audio Library
45 | Copyright (c) 1999-2011 Ross Bencina, Phil Burk
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
47 |The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
48 |THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
49 |
50 |
The text above constitutes the entire PortAudio license; however, the PortAudio community also makes the following non-binding requests:
52 |Any person wishing to distribute modifications to the Software is requested to send the modifications to the original developer so that they can be incorporated into the canonical version. It is also requested that these non-binding requests be included along with the license above.
53 |
19 | PortAudio
20 | 2.0
21 |
22 | |
23 |
54 | Public Member Functions | |
56 | PaError | result () const |
Definition at line 221 of file paex_sine_c++.cpp.
62 |
19 | PortAudio
20 | 2.0
21 |
22 | |
23 |
54 | Public Member Functions | |
56 | bool | open (PaDeviceIndex index) |
59 | bool | close () |
62 | bool | start () |
65 | bool | stop () |
Definition at line 58 of file paex_sine_c++.cpp.
71 |
19 | PortAudio
20 | 2.0
21 |
22 | |
23 |
19 | PortAudio
20 | 2.0
21 |
22 | |
23 |
This is a simple "How-to" for creating build files for Microsoft Visual C++ via CMake and the CMakeLists.txt file
45 |Both ASIO and DirectX SDK are automatically searched for by the CMake script, so if you have DirectX SDK installed and have placed the ASIO2 SDK according to point 2 above, you should be able to build portaudio with !DirectSound and ASIO support.
64 |Should you later on decide to change a portaudio option, just jump in at step 5 above (MSVC will then prompt you to reload projects/solutions/workspace)
65 |— Robert Bielik
66 |Back to the Tutorial: PortAudio Tutorials
67 |
19 | PortAudio
20 | 2.0
21 |
22 | |
23 |
Note: this page has not been reviewed, and may contain errors.
45 |The OSS sound API is very old and not well supported. It is recommended that you use the ALSA sound API. The PortAudio configure script will look for the ALSA SDK. You can install the ALSA SDK on Ubuntu using:
48 |You might need to use yum, or some other package manager, instead of apt-get on your machine. If you do not install ALSA then you might get a message when testing that says you have no audio devices.
50 |You can find out more about ALSA here: http://www.alsa-project.org/
51 |You can build PortAudio in Linux Environments using the standard configure/make tools:
54 |That will build PortAudio using Jack, ALSA and OSS in whatever combination they are found on your system. For example, if you have Jack and OSS but not ALSA, it will build using Jack and OSS but not ALSA. This step also builds a number of tests, which can be found in the bin directory of PortAudio. It's a good idea to run some of these tests to make sure PortAudio is working correctly.
56 |To use PortAudio in your apps, you can simply install the .so files:
59 |Projects built this way will expect PortAudio to be installed on target systems in order to run. If you want to build a more self-contained binary, you may use the libportaudio.a file:
61 |On some systems you may need to use:
63 |You may also need to copy portaudio.h, located in the include/ directory of PortAudio into your project. Note that you will usually need to link with the approriate libraries that you used, such as ALSA and JACK, as well as with librt and libpthread. For example:
65 |Note that the ALSA PortAudio back-end adds a few extensions to the standard API that you may take advantage of. To use these functions be sure to include the pa_linux_alsa.h file found in the include file in the PortAudio folder. This file contains further documentation on the following functions:
69 |PaAlsaStreamInfo/PaAlsa_InitializeStreamInfo:: Objects of the !PaAlsaStreamInfo type may be used for the !hostApiSpecificStreamInfo attribute of a !PaStreamParameters object, in order to specify the name of an ALSA device to open directly. Specify the device via !PaAlsaStreamInfo.deviceString, after initializing the object with PaAlsa_InitializeStreamInfo.
70 |PaAlsa_EnableRealtimeScheduling:: PA ALSA supports real-time scheduling of the audio callback thread (using the FIFO pthread scheduling policy), via the extension PaAlsa_EnableRealtimeScheduling. Call this on the stream before starting it with the enableScheduling parameter set to true or false, to enable or disable this behaviour respectively.
71 |PaAlsa_GetStreamInputCard:: Use this function to get the ALSA-lib card index of the stream's input device.
72 |PaAlsa_GetStreamOutputCard:: Use this function to get the ALSA-lib card index of the stream's output device.
73 |Of particular importance is PaAlsa_EnableRealtimeScheduling, which allows ALSA to run at a high priority to prevent ordinary processes on the system from preempting audio playback. Without this, low latency audio playback will be irregular and will contain frequent drop-outs.
74 |Eliot Blennerhassett writes:
77 |On linux build, use e.g. "libtool gdb bin/patest_sine8" to debug that program. This is because on linux bin/patest_sine8 is a libtool shell script that wraps bin/.libs/patest_sine8 and allows it to find the appropriate libraries within the build tree.
78 |
19 | PortAudio
20 | 2.0
21 |
22 | |
23 |
This document contains old or out-of-date information. Please see a draft of new MinGW information on our Wiki: PortAudio Wiki: Notes about building PortAudio with MinGW
47 |= MinGW/MSYS =
48 |From the [http://www.mingw.org MinGW projectpage]:
49 |MinGW: A collection of freely available and freely distributable Windows specific header files and import libraries, augmenting the GNU Compiler Collection, (GCC), and its associated tools, (GNU binutils). MinGW provides a complete Open Source programming tool set which is suitable for the development of native Windows programs that do not depend on any 3rd-party C runtime DLLs.
50 |MSYS: A Minimal SYStem providing a POSIX compatible Bourne shell environment, with a small collection of UNIX command line tools. Primarily developed as a means to execute the configure scripts and Makefiles used to build Open Source software, but also useful as a general purpose command line interface to replace Windows cmd.exe.
51 |MinGW provides a compiler/linker toolchain while MSYS is required to actually run the PortAudio configure script.
52 |Once MinGW and MSYS are installed (see the [http://www.mingw.org/MinGWiki MinGW-Wiki]) open an MSYS shell and run the famous:
53 |The above should create a working version though you might want to provide '–prefix=<path-to-install-dir>' to configure.
57 |'./configure –help' gives details as to what can be tinkered with.
58 |— Mikael Magnusson
59 |To update your copy or check out a fresh copy of the source
60 |[wiki:UsingThePortAudioSvnRepository SVN instructions]
61 |— Bob !McGwier
62 |Back to the Tutorial: PortAudio Tutorials
63 |
19 | PortAudio
20 | 2.0
21 |
22 | |
23 |
19 | PortAudio
20 | 2.0
21 |
22 | |
23 |
Now that you have a good idea of how PortAudio works, you can try out the example programs. You'll find them in the examples/ directory in the PortAudio distribution.
45 |For an example of playing a sine wave, see examples/paex_sine.c.
46 |For an example of recording and playing back a sound, see examples/paex_record.c.
47 |I also encourage you to examine the source for the PortAudio libraries. If you have suggestions on ways to improve them, please let us know. If you want to implement PortAudio on a new platform, please let us know as well so we can coordinate people's efforts.
48 |Previous: Blocking Read/Write Functions | Next: This is the end of the tutorial.
49 |
19 | PortAudio
20 | 2.0
21 |
22 | |
23 |
19 | PortAudio
20 | 2.0
21 |
22 | |
23 |
19 | PortAudio
20 | 2.0
21 |
22 | |
23 |
19 | PortAudio
20 | 2.0
21 |
22 | |
23 |
PortAudio is a cross-platform, open-source C language library for real-time audio input and output. The library provides functions that allow your software to acquire and output real-time audio streams from your computer's hardware audio interfaces. It is designed to simplify writing cross-platform audio applications, and also to simplify the development of audio software in general by hiding the complexities of dealing directly with each native audio API. PortAudio is used to implement sound recording, editing and mixing applications, software synthesizers, effects processors, music players, internet telephony applications, software defined radios and more. Supported platforms include MS Windows, Mac OS X and Linux. Third-party language bindings make it possible to call PortAudio from other programming languages including Java, C++, C#, Python, PureBasic, FreePascal and Lazarus.
47 |If you're interested in helping out with PortAudio development we're more than happy for you to be involved. Just drop by the PortAudio mailing list and ask how you can help. Or check out the starter tickets.
99 |This documentation covers the current API version: PortAudio V19, API version 2.0. API 2.0 differs in a number of ways from previous versions (most often encountered in PortAudio V18), please consult the enhancement proposals for details of what was added/changed for V19: http://www.portaudio.com/docs/proposals/index.html
102 |
19 | PortAudio
20 | 2.0
21 |
22 | |
23 |
Before making any other calls to PortAudio, you 'must' call Pa_Initialize(). This will trigger a scan of available devices which can be queried later. Like most PA functions, it will return a result of type paError. If the result is not paNoError, then an error has occurred.
47 |You can get a text message that explains the error message by passing it to Pa_GetErrorText( err ). For Example:
50 |It is also important, when you are done with PortAudio, to Terminate it:
52 |Previous: Writing a Callback Function | Next: Opening a Stream Using Defaults
56 |
19 | PortAudio
20 | 2.0
21 |
22 | |
23 |
![]() | |
![]() |
19 | PortAudio
20 | 2.0
21 |
22 | |
23 |
The next step is to open a stream, which is similar to opening a file. You can specify whether you want audio input and/or output, how many channels, the data format, sample rate, etc. Opening a ''default'' stream means opening the default input and output devices, which saves you the trouble of getting a list of devices and choosing one from the list. (We'll see how to do that later.)
45 |The data structure and callback are described in Writing a Callback Function.
71 |The above example opens the stream for writing, which is sufficient for playback. It is also possible to open a stream for reading, to do recording, or both reading and writing, for simultaneous recording and playback or even real-time audio processing. If you plan to do playback and recording at the same time, open only one stream with valid input and output parameters.
72 |There are some caveats to note about simultaneous read/write:
73 |Previous: Initializing PortAudio | Next: Starting, Stopping and Aborting a Stream
81 |
19 | PortAudio
20 | 2.0
21 |
22 | |
23 |
List available devices, including device information. 58 | More...
59 | 63 |Go to the source code of this file.
64 |66 | Functions | |
68 | int | main (void) |
List available devices, including device information.
73 |@author Phil Burk http://www.softsynth.com 74 |
Definition in file pa_devs.c.
77 |
19 | PortAudio
20 | 2.0
21 |
22 | |
23 |
JACK-specific PortAudio API extension header file. 58 | More...
59 |#include "portaudio.h"
Go to the source code of this file.
62 |64 | Functions | |
PaError | PaJack_SetClientName (const char *name) |
PaError | PaJack_GetClientName (const char **clientName) |
JACK-specific PortAudio API extension header file.
72 | 73 |Definition in file pa_jack.h.
74 |PaError PaJack_GetClientName | 81 |( | 82 |const char ** | 83 |clientName | ) | 84 |85 | |
Get the JACK client name used by PA JACK.
89 |The caller is responsible for freeing the returned pointer.
90 | 91 |PaError PaJack_SetClientName | 99 |( | 100 |const char * | 101 |name | ) | 102 |103 | |
Set the JACK client name.
107 |During Pa_Initialize, When PA JACK connects as a client of the JACK server, it requests a certain name, which is for instance prepended to port names. By default this name is "PortAudio". The JACK server may append a suffix to the client name, in order to avoid clashes among clients that try to connect with the same name (e.g., different PA JACK clients).
108 |This function must be called before Pa_Initialize, otherwise it won't have any effect. Note that the string is not copied, but instead referenced directly, so it must not be freed for as long as PA might need it.
109 |
19 | PortAudio
20 | 2.0
21 |
22 | |
23 |
DirectSound-specific PortAudio API extension header file. 60 | More...
61 | 64 |Go to the source code of this file.
65 |67 | Data Structures | |
struct | PaWinDirectSoundStreamInfo |
72 | Macros | |
74 | #define | paWinDirectSoundUseLowLevelLatencyParameters (0x01) |
77 | #define | paWinDirectSoundUseChannelMask (0x04) |
81 | Typedefs | |
83 | typedef struct 84 | PaWinDirectSoundStreamInfo | PaWinDirectSoundStreamInfo |
DirectSound-specific PortAudio API extension header file.
89 | 90 |Definition in file pa_win_ds.h.
91 |
19 | PortAudio
20 | 2.0
21 |
22 | |
23 |
Play a simple (aliasing) sawtooth wave. 60 | More...
61 | 65 |Go to the source code of this file.
66 |68 | Data Structures | |
struct | paTestData |
73 | Macros | |
75 | #define | NUM_SECONDS (4) |
78 | #define | SAMPLE_RATE (44100) |
82 | Functions | |
84 | int | main (void) |
Play a simple (aliasing) sawtooth wave.
89 | 90 | 91 |Definition in file paex_saw.c.
92 |
19 | PortAudio
20 | 2.0
21 |
22 | |
23 |
Play a sine wave for several seconds using the blocking API (Pa_WriteStream()) 59 | More...
60 | 64 |Go to the source code of this file.
65 |67 | Macros | |
69 | #define | NUM_SECONDS (5) |
72 | #define | SAMPLE_RATE (44100) |
75 | #define | FRAMES_PER_BUFFER (1024) |
78 | #define | M_PI (3.14159265) |
81 | #define | TABLE_SIZE (200) |
85 | Functions | |
87 | int | main (void) |
Play a sine wave for several seconds using the blocking API (Pa_WriteStream())
92 |@author Ross Bencina <rossb@audiomulch.com> 93 |94 | 95 |
Definition in file paex_write_sine.c.
96 |
19 | PortAudio
20 | 2.0
21 |
22 | |
23 |
Play a non-interleaved sine wave using the blocking API (Pa_WriteStream()) 59 | More...
60 | 64 |Go to the source code of this file.
65 |67 | Macros | |
69 | #define | NUM_SECONDS (5) |
72 | #define | SAMPLE_RATE (44100) |
75 | #define | FRAMES_PER_BUFFER (1024) |
78 | #define | M_PI (3.14159265) |
81 | #define | TABLE_SIZE (200) |
85 | Functions | |
87 | int | main (void) |
Play a non-interleaved sine wave using the blocking API (Pa_WriteStream())
92 |@author Ross Bencina <rossb@audiomulch.com> 93 |94 | 95 |
Definition in file paex_write_sine_nonint.c.
96 |
19 | PortAudio
20 | 2.0
21 |
22 | |
23 |
![]() | |
![]() | |
![]() | |
![]() | |
![]() | |
![]() | |
![]() | |
![]() | |
![]() | |
![]() | |
![]() | |
![]() | |
![]() | |
![]() | |
![]() | |
![]() | |
![]() | |
![]() | |
![]() |
19 | PortAudio
20 | 2.0
21 |
22 | |
23 |
PortAudio will not start playing back audio until you start the stream. After calling Pa_StartStream(), PortAudio will start calling your callback function to perform the audio processing.
47 |You can communicate with your callback routine through the data structure you passed in on the open call, or through global variables, or using other interprocess communication techniques, but please be aware that your callback function may be called at interrupt time when your foreground process is least expecting it. So avoid sharing complex data structures that are easily corrupted like double linked lists, and avoid using locks such as mutexs as this may cause your callback function to block and therefore drop audio. Such techniques may even cause deadlock on some platforms.
50 |PortAudio will continue to call your callback and process audio until you stop the stream. This can be done in one of several ways, but, before we do so, we'll want to see that some of our audio gets processed by sleeping for a few seconds. This is easy to do with Pa_Sleep(), which is used by many of the examples in the patests/ directory for exactly this purpose. Note that, for a variety of reasons, you can not rely on this function for accurate scheduling, so your stream may not run for exactly the same amount of time as you expect, but it's good enough for our example.
51 |Now we need to stop playback. There are several ways to do this, the simplest of which is to call Pa_StopStream():
54 |Pa_StopStream() is designed to make sure that the buffers you've processed in your callback are all played, which may cause some delay. Alternatively, you could call Pa_AbortStream(). On some platforms, aborting the stream is much faster and may cause some data processed by your callback not to be played.
57 |Another way to stop the stream is to return either paComplete, or paAbort from your callback. paComplete ensures that the last buffer is played whereas paAbort stops the stream as soon as possible. If you stop the stream using this technique, you will need to call Pa_StopStream() before starting the stream again.
58 |Previous: Opening a Stream Using Defaults | Next: Closing a Stream and Terminating PortAudio
59 |
19 | PortAudio
20 | 2.0
21 |
22 | |
23 |
54 | Data Fields | |
56 | float | bq_b0 |
59 | float | bq_b1 |
62 | float | bq_b2 |
65 | float | bq_a1 |
68 | float | bq_a2 |
Definition at line 83 of file paex_ocean_shore.c.
74 |
19 | PortAudio
20 | 2.0
21 |
22 | |
23 |
54 | Data Fields | |
56 | unsigned long | size |
59 | PaHostApiTypeId | hostApiType |
62 | unsigned long | version |
65 | const char * | deviceString |
Definition at line 53 of file pa_linux_alsa.h.
71 |
19 | PortAudio
20 | 2.0
21 |
22 | |
23 |
54 | Data Fields | |
unsigned long | size |
PaHostApiTypeId | hostApiType |
unsigned long | version |
62 | unsigned long | flags |
65 | int * | channelSelectors |
PaHostApiTypeId PaAsioStreamInfo::hostApiType | 78 |
unsigned long PaAsioStreamInfo::size | 93 |
unsigned long PaAsioStreamInfo::version | 108 |
19 | PortAudio
20 | 2.0
21 |
22 | |
23 |
#include <portaudio.h>
56 | Data Fields | |
PaHostApiTypeId | hostApiType |
long | errorCode |
const char * | errorText |
Structure used to return information about a host error condition.
66 | 67 |Definition at line 389 of file portaudio.h.
68 |long PaHostErrorInfo::errorCode | 75 |
the error code returned
79 | 80 |Definition at line 391 of file portaudio.h.
81 | 82 |const char* PaHostErrorInfo::errorText | 90 |
a textual description of the error if available, otherwise a zero-length string
94 | 95 |Definition at line 392 of file portaudio.h.
96 | 97 |PaHostApiTypeId PaHostErrorInfo::hostApiType | 105 |
the host API which returned the error code
109 | 110 |Definition at line 390 of file portaudio.h.
111 | 112 |
19 | PortAudio
20 | 2.0
21 |
22 | |
23 |
#include <portaudio.h>
56 | Data Fields | |
58 | int | versionMajor |
61 | int | versionMinor |
64 | int | versionSubMinor |
const char * | versionControlRevision |
const char * | versionText |
A structure containing PortAudio API version information.
73 |Definition at line 90 of file portaudio.h.
77 |const char* PaVersionInfo::versionControlRevision | 84 |
This is currently the Git revision hash but may change in the future. The versionControlRevision is updated by running a script before compiling the library. If the update does not occur, this value may refer to an earlier revision.
88 | 89 |Definition at line 99 of file portaudio.h.
90 | 91 |const char* PaVersionInfo::versionText | 99 |
Version as a string, for example "PortAudio V19.5.0-devel, revision 1952M"
103 | 104 |Definition at line 101 of file portaudio.h.
105 | 106 |
19 | PortAudio
20 | 2.0
21 |
22 | |
23 |
54 | Data Fields | |
56 | PaWDMKSDirectionSpecificStreamInfo | input |
59 | PaWDMKSDirectionSpecificStreamInfo | output |
Definition at line 128 of file pa_win_wdmks.h.
65 |
19 | PortAudio
20 | 2.0
21 |
22 | |
23 |
54 | Data Fields | |
56 | unsigned long | channelMapping |
59 | unsigned long | color |
62 | PaWasapiJackConnectionType | connectionType |
65 | PaWasapiJackGeoLocation | geoLocation |
68 | PaWasapiJackGenLocation | genLocation |
71 | PaWasapiJackPortConnection | portConnection |
74 | unsigned int | isConnected |
Definition at line 192 of file pa_win_wasapi.h.
80 |
19 | PortAudio
20 | 2.0
21 |
22 | |
23 |
54 | Data Fields | |
56 | PaDeviceIndex | device |
59 | int | channelCount |
Definition at line 76 of file pa_win_wmme.h.
65 |
19 | PortAudio
20 | 2.0
21 |
22 | |
23 |
54 | Data Fields | |
wchar_t | filterPath [MAX_PATH] |
wchar_t | topologyPath [MAX_PATH] |
60 | PaWDMKSType | streamingType |
GUID | deviceProductGuid |
Definition at line 111 of file pa_win_wdmks.h.
68 |GUID PaWinWDMKSDeviceInfo::deviceProductGuid | 75 |
The product GUID of the device (if supported)
79 | 80 |Definition at line 115 of file pa_win_wdmks.h.
81 | 82 |wchar_t PaWinWDMKSDeviceInfo::filterPath[MAX_PATH] | 90 |
KS filter path in Unicode!
94 | 95 |Definition at line 112 of file pa_win_wdmks.h.
96 | 97 |wchar_t PaWinWDMKSDeviceInfo::topologyPath[MAX_PATH] | 105 |
Topology filter path in Unicode!
109 | 110 |Definition at line 113 of file pa_win_wdmks.h.
111 | 112 |
19 | PortAudio
20 | 2.0
21 |
22 | |
23 |
54 | Data Fields | |
56 | unsigned char | fields [PAWIN_SIZEOF_WAVEFORMATEXTENSIBLE] |
59 | unsigned long | extraLongForAlignment |
Definition at line 139 of file pa_win_waveformat.h.
65 |
19 | PortAudio
20 | 2.0
21 |
22 | |
23 |
54 | Data Fields | |
56 | long | pink_Rows [PINK_MAX_RANDOM_ROWS] |
59 | long | pink_RunningSum |
62 | int | pink_Index |
65 | int | pink_IndexMask |
68 | float | pink_Scalar |
Definition at line 73 of file paex_ocean_shore.c.
74 |
19 | PortAudio
20 | 2.0
21 |
22 | |
23 |
When you are done with a stream, you should close it to free up resources:
45 |We've already mentioned this in Initializing PortAudio, but in case you forgot, be sure to terminate PortAudio when you are done:
48 |Previous: Starting, Stopping and Aborting a Stream | Next: Utility Functions
51 |
19 | PortAudio
20 | 2.0
21 |
22 | |
23 |
These tutorials takes you through a hands-on example of using PortAudio to make sound. If you'd prefer to start with a top-down overview of the PortAudio API, check out the PortAudio API Overview.
45 |First thing you need to do is download the PortAudio source code either as a tarball from the website, or from the Subversion Repository.
48 |Once you've downloaded PortAudio you'll need to compile it, which of course, depends on your environment:
51 |Many platforms with GCC/make can use the simple ./configure && make combination and simply use the resulting libraries in their code.
69 |Below are the steps to writing a PortAudio application using the callback technique:
72 |In addition to this "Callback" architecture, V19 also supports a "Blocking I/O" model which uses read and write calls which may be more familiar to non-audio programmers. Note that at this time, not all APIs support this functionality.
81 |In this tutorial, we'll show how to use the callback architecture to play a sawtooth wave. Much of the tutorial is taken from the file paex_saw.c, which is part of the PortAudio distribution. When you're done with this tutorial, you'll be armed with the basic knowledge you need to write an audio program. If you need more sample code, look in the "examples" and "test" directory of the PortAudio distribution. Another great source of info is the portaudio.h Doxygen page, which documents the entire V19 API. Also see the page for tips on programming PortAudio on the PortAudio wiki.
82 |If you are upgrading from V18, you may want to look at the Proposed Enhancements to PortAudio, which describes the differences between V18 and V19.
95 |Once you have a basic understanding of how to use PortAudio, you might be interested in Exploring PortAudio.
96 | 97 |