├── __init__.py
├── src
├── __init__.py
└── capture-audio
│ ├── __init__.py
│ ├── __main__.py
│ └── mysql.py
├── portaudio
├── bindings
│ ├── cpp
│ │ ├── NEWS
│ │ ├── AUTHORS
│ │ ├── README
│ │ ├── build
│ │ │ ├── gnu
│ │ │ │ ├── OUT_OF_DATE
│ │ │ │ ├── aclocal.m4
│ │ │ │ └── Makefile.in
│ │ │ ├── vc7
│ │ │ │ └── OUT_OF_DATE
│ │ │ ├── vc6
│ │ │ │ ├── static_library.dsw
│ │ │ │ ├── devs_example.dsw
│ │ │ │ └── sine_example.dsw
│ │ │ └── vc7_1
│ │ │ │ ├── static_library.sln
│ │ │ │ ├── devs_example.sln
│ │ │ │ └── sine_example.sln
│ │ ├── source
│ │ │ └── portaudiocpp
│ │ │ │ ├── MemFunCallbackStream.cxx
│ │ │ │ ├── CallbackStream.cxx
│ │ │ │ ├── CallbackInterface.cxx
│ │ │ │ ├── CFunCallbackStream.cxx
│ │ │ │ ├── InterfaceCallbackStream.cxx
│ │ │ │ ├── SystemDeviceIterator.cxx
│ │ │ │ ├── SystemHostApiIterator.cxx
│ │ │ │ ├── AsioDeviceAdapter.cxx
│ │ │ │ ├── BlockingStream.cxx
│ │ │ │ ├── CppFunCallbackStream.cxx
│ │ │ │ ├── HostApi.cxx
│ │ │ │ └── Exception.cxx
│ │ ├── doc
│ │ │ ├── Makefile.am
│ │ │ └── README
│ │ ├── Makefile.am
│ │ ├── bin
│ │ │ └── Makefile.am
│ │ ├── portaudiocpp.pc.in
│ │ ├── include
│ │ │ ├── Makefile.am
│ │ │ └── portaudiocpp
│ │ │ │ ├── SampleDataFormat.hxx
│ │ │ │ ├── AsioDeviceAdapter.hxx
│ │ │ │ ├── CallbackStream.hxx
│ │ │ │ ├── BlockingStream.hxx
│ │ │ │ ├── InterfaceCallbackStream.hxx
│ │ │ │ ├── CallbackInterface.hxx
│ │ │ │ ├── CFunCallbackStream.hxx
│ │ │ │ ├── SystemHostApiIterator.hxx
│ │ │ │ ├── AutoSystem.hxx
│ │ │ │ ├── SystemDeviceIterator.hxx
│ │ │ │ ├── HostApi.hxx
│ │ │ │ ├── Stream.hxx
│ │ │ │ ├── DirectionSpecificStreamParameters.hxx
│ │ │ │ ├── StreamParameters.hxx
│ │ │ │ ├── CppFunCallbackStream.hxx
│ │ │ │ ├── Device.hxx
│ │ │ │ ├── System.hxx
│ │ │ │ └── Exception.hxx
│ │ ├── lib
│ │ │ └── Makefile.am
│ │ ├── configure.ac
│ │ ├── COPYING
│ │ └── SConscript
│ └── java
│ │ ├── scripts
│ │ └── make_header.bat
│ │ ├── jportaudio
│ │ ├── .classpath
│ │ ├── .project
│ │ ├── src
│ │ │ └── com
│ │ │ │ └── portaudio
│ │ │ │ ├── StreamInfo.java
│ │ │ │ ├── StreamParameters.java
│ │ │ │ ├── HostApiInfo.java
│ │ │ │ └── DeviceInfo.java
│ │ └── jtests
│ │ │ └── com
│ │ │ └── portaudio
│ │ │ └── PlaySine.java
│ │ ├── c
│ │ ├── build
│ │ │ └── vs2010
│ │ │ │ └── PortAudioJNI
│ │ │ │ └── PortAudioJNI.sln
│ │ └── src
│ │ │ ├── jpa_tools.h
│ │ │ └── com_portaudio_BlockingStream.h
│ │ └── jportaudio.dox
├── src
│ ├── common
│ │ ├── pa_gitrevision.h
│ │ ├── pa_debugprint.c
│ │ └── pa_cpuload.h
│ ├── hostapi
│ │ ├── asio
│ │ │ ├── Pa_ASIO.pdf
│ │ │ └── Callback_adaptation_.pdf
│ │ ├── oss
│ │ │ ├── low_latency_tip.txt
│ │ │ └── recplay.c
│ │ ├── skeleton
│ │ │ └── README.txt
│ │ └── wasapi
│ │ │ ├── mingw-include
│ │ │ ├── ksguid.h
│ │ │ └── propkeydef.h
│ │ │ └── readme.txt
│ └── os
│ │ └── win
│ │ ├── pa_x86_plain_converters.h
│ │ ├── pa_win_wdmks_utils.h
│ │ └── pa_win_hostapis.c
├── doc
│ ├── src
│ │ ├── images
│ │ │ └── portaudio-external-architecture-diagram.png
│ │ ├── tutorial
│ │ │ ├── terminating_portaudio.dox
│ │ │ ├── exploring.dox
│ │ │ ├── initializing_portaudio.dox
│ │ │ ├── compile_cmake.dox
│ │ │ ├── compile_windows_mingw.dox
│ │ │ ├── start_stop_abort.dox
│ │ │ ├── utility_functions.dox
│ │ │ ├── open_default_stream.dox
│ │ │ ├── tutorial_start.dox
│ │ │ └── blocking_read_write.dox
│ │ ├── srcguide.dox
│ │ ├── license.dox
│ │ └── mainpage.dox
│ └── utils
│ │ └── checkfiledocs.py
├── testcvs
│ ├── file1.txt
│ ├── file2.txt
│ └── changeme.txt
├── fixfile.bat
├── portaudio-2.0.pc.in
├── cmake_support
│ ├── portaudio-2.0.pc.in
│ ├── options_cmake.h.in
│ ├── FindASIOSDK.cmake
│ ├── FindJack.cmake
│ ├── FindDXSDK.cmake
│ └── template_portaudio.def
├── test
│ ├── CMakeLists.txt
│ ├── README.txt
│ └── patest_ringmix.c
├── clear_gitrevision.sh
├── fixdir.bat
├── update_gitrevision.sh
├── .gitignore
├── build
│ ├── msvc
│ │ ├── portaudio.dsw
│ │ ├── portaudio.sln
│ │ └── portaudio.def
│ └── scons
│ │ └── SConscript_common
├── README.configure.txt
├── .gitattributes
├── qa
│ └── loopback
│ │ └── src
│ │ ├── biquad_filter.h
│ │ ├── test_audio_analyzer.h
│ │ ├── paqa_tools.h
│ │ └── qa_tools.h
├── pablio
│ ├── pablio.def
│ └── README.txt
├── examples
│ └── CMakeLists.txt
└── include
│ ├── pa_jack.h
│ └── pa_win_ds.h
├── requirements.txt
├── Makefile
├── docker-entrypoint.sh
├── check_device.py
├── script
├── check_device.py
└── installer.sh
├── installer.sh
├── setup.py
├── docker-build.sh
├── C_CaptureAudioFromMic.json
├── LICENSE
├── README.md
└── Dockerfile
/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/portaudio/bindings/cpp/NEWS:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/portaudio/bindings/cpp/AUTHORS:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/portaudio/bindings/cpp/README:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/portaudio/bindings/cpp/build/gnu/OUT_OF_DATE:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/portaudio/bindings/cpp/build/vc7/OUT_OF_DATE:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/requirements.txt:
--------------------------------------------------------------------------------
1 | PyAudio~=0.2.11
2 | setuptools~=51.1.1
3 | retry~=0.9.2
--------------------------------------------------------------------------------
/portaudio/src/common/pa_gitrevision.h:
--------------------------------------------------------------------------------
1 | #define PA_GIT_REVISION 396fe4b6699ae929d3a685b3ef8a7e97396139a4
2 |
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | docker-build:
2 | bash ./docker-build.sh
3 |
4 | docker-push:
5 | bash ./docker-build.sh push
6 |
--------------------------------------------------------------------------------
/portaudio/src/common/pa_debugprint.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/latonaio/Capture-Audio-From-Mic/HEAD/portaudio/src/common/pa_debugprint.c
--------------------------------------------------------------------------------
/portaudio/src/hostapi/asio/Pa_ASIO.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/latonaio/Capture-Audio-From-Mic/HEAD/portaudio/src/hostapi/asio/Pa_ASIO.pdf
--------------------------------------------------------------------------------
/docker-entrypoint.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | python3 -m capture-audio
4 | /bin/sh -c "sleep 300"
5 | curl -s -X POST localhost:10001/quitquitquit
6 |
--------------------------------------------------------------------------------
/portaudio/src/hostapi/oss/low_latency_tip.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/latonaio/Capture-Audio-From-Mic/HEAD/portaudio/src/hostapi/oss/low_latency_tip.txt
--------------------------------------------------------------------------------
/portaudio/bindings/cpp/source/portaudiocpp/MemFunCallbackStream.cxx:
--------------------------------------------------------------------------------
1 | #include "portaudiocpp/MemFunCallbackStream.hxx"
2 |
3 | // (... template class ...)
4 |
5 |
--------------------------------------------------------------------------------
/portaudio/src/hostapi/asio/Callback_adaptation_.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/latonaio/Capture-Audio-From-Mic/HEAD/portaudio/src/hostapi/asio/Callback_adaptation_.pdf
--------------------------------------------------------------------------------
/portaudio/bindings/cpp/doc/Makefile.am:
--------------------------------------------------------------------------------
1 | PACPP_ROOT = .
2 | #INCLUDES = -I$(srcdir)/$(PACPP_ROOT)/include -I$(top_srcdir)/include
3 |
4 | docs:
5 | doxygen $(srcdir)/config.doxy.linux
6 |
--------------------------------------------------------------------------------
/portaudio/bindings/cpp/Makefile.am:
--------------------------------------------------------------------------------
1 | SUBDIRS = lib include bin
2 | #doc
3 |
4 | EXTRA_DIST = portaudiocpp.pc
5 |
6 | pkgconfigdir = $(libdir)/pkgconfig
7 | pkgconfig_DATA = portaudiocpp.pc
8 |
--------------------------------------------------------------------------------
/check_device.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 |
3 | import pyaudio
4 | p = pyaudio.PyAudio()
5 |
6 | for index in range(0, p.get_device_count()):
7 | print(p. get_device_info_by_index(index))
8 |
--------------------------------------------------------------------------------
/portaudio/doc/src/images/portaudio-external-architecture-diagram.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/latonaio/Capture-Audio-From-Mic/HEAD/portaudio/doc/src/images/portaudio-external-architecture-diagram.png
--------------------------------------------------------------------------------
/portaudio/testcvs/file1.txt:
--------------------------------------------------------------------------------
1 | This is used to test the SVN versioning system.
2 |
3 | $Revision$
4 | $Author$
5 | $Date$
6 | $Id$
7 |
8 | After propset svn:keywords
9 |
10 |
--------------------------------------------------------------------------------
/portaudio/testcvs/file2.txt:
--------------------------------------------------------------------------------
1 | This is used to test the SVN versioning system.
2 |
3 | $Revision$
4 | $Author$
5 | $Date$
6 | $Id$
7 |
8 | After propset svn:keywords
9 |
10 |
--------------------------------------------------------------------------------
/script/check_device.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 |
3 | import pyaudio
4 | p = pyaudio.PyAudio()
5 |
6 | for index in range(0, p.get_device_count()):
7 | print(p. get_device_info_by_index(index))
8 |
--------------------------------------------------------------------------------
/portaudio/src/hostapi/skeleton/README.txt:
--------------------------------------------------------------------------------
1 | pa_hostapi_skeleton.c provides a starting point for implementing support for a new host API with PortAudio. The idea is that you copy it to a new directory inside /hostapi and start editing.
--------------------------------------------------------------------------------
/portaudio/bindings/java/scripts/make_header.bat:
--------------------------------------------------------------------------------
1 | REM Generate the JNI header file from the Java code for JPortAudio
2 | REM by Phil Burk
3 |
4 | javah -classpath ../jportaudio/bin -d ../c/src com.portaudio.PortAudio com.portaudio.BlockingStream
5 |
--------------------------------------------------------------------------------
/src/capture-audio/__init__.py:
--------------------------------------------------------------------------------
1 | # coding: utf-8
2 |
3 | # Copyright (c) 2019-2020 Latona. All rights reserved.
4 |
5 | from .core import main_with_kanban, main_without_kanban, main_with_kanban_itr, send_kanbans_at_highspeed, main_with_kanban_multiple
6 |
--------------------------------------------------------------------------------
/portaudio/fixfile.bat:
--------------------------------------------------------------------------------
1 | rem Use Astyle to fix style in a file
2 | fixlines -p %1%
3 | astyle --style=ansi -c -o --convert-tabs --indent-preprocessor %1%
4 | del %1%.orig
5 | @rem convert line terminators to Unix style LFs
6 | fixlines -u %1%
7 | del %1%.bak
8 |
--------------------------------------------------------------------------------
/portaudio/portaudio-2.0.pc.in:
--------------------------------------------------------------------------------
1 | prefix=@prefix@
2 | exec_prefix=@exec_prefix@
3 | libdir=@libdir@
4 | includedir=@includedir@
5 |
6 | Name: PortAudio
7 | Description: Portable audio I/O
8 | Requires:
9 | Version: 19
10 |
11 | Libs: -L${libdir} -lportaudio @LIBS@
12 | Cflags: -I${includedir} @THREAD_CFLAGS@
13 |
--------------------------------------------------------------------------------
/portaudio/bindings/cpp/bin/Makefile.am:
--------------------------------------------------------------------------------
1 | BINDIR = $(top_srcdir)/example
2 | LIBDIR = $(top_builddir)/lib
3 |
4 | noinst_PROGRAMS = devs sine
5 |
6 | LDADD = $(LIBDIR)/libportaudiocpp.la $(top_builddir)/$(PORTAUDIO_ROOT)/lib/libportaudio.la
7 |
8 | devs_SOURCES = $(BINDIR)/devs.cxx
9 | sine_SOURCES = $(BINDIR)/sine.cxx
10 |
--------------------------------------------------------------------------------
/portaudio/bindings/cpp/portaudiocpp.pc.in:
--------------------------------------------------------------------------------
1 | prefix=@prefix@
2 | exec_prefix=@exec_prefix@
3 | libdir=@libdir@
4 | includedir=@includedir@
5 |
6 | Name: PortAudioCpp
7 | Description: Portable audio I/O C++ bindings
8 | Version: 12
9 | Requires: portaudio-2.0
10 |
11 | Libs: -L${libdir} -lportaudiocpp
12 | Cflags: -I${includedir}
13 |
--------------------------------------------------------------------------------
/installer.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # if in arm, pip install cant exec.
4 | wget http://www.portaudio.com/archives/pa_stable_v190600_20161030.tgz
5 | tar xvf pa_stable_v190600_20161030.tgz
6 | cd portaudio
7 | ./configure
8 | make -j8
9 | sudo make install
10 | sudo pip3 install pyaudio
11 | rm -r portaudio pa_stable_v190600_20161030.tgz
12 |
13 |
--------------------------------------------------------------------------------
/script/installer.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # if in arm, pip install cant exec.
4 | wget http://www.portaudio.com/archives/pa_stable_v190600_20161030.tgz
5 | tar xvf pa_stable_v190600_20161030.tgz
6 | cd portaudio
7 | ./configure
8 | make -j8
9 | sudo make install
10 | sudo pip3 install pyaudio
11 | rm -r portaudio pa_stable_v190600_20161030.tgz
12 |
13 |
--------------------------------------------------------------------------------
/setup.py:
--------------------------------------------------------------------------------
1 | # coding: utf-8
2 |
3 | # Copyright (c) 2019-2020 Latona. All rights reserved.
4 |
5 | from setuptools import setup, find_packages
6 |
7 | setup(
8 | name="capture-audio",
9 | version="0.0.1",
10 | author="Latona",
11 | packages=find_packages("./src"),
12 | package_dir={"":"src"},
13 | install_requires=[],
14 | tests_require=[]
15 | )
16 |
--------------------------------------------------------------------------------
/portaudio/cmake_support/portaudio-2.0.pc.in:
--------------------------------------------------------------------------------
1 | prefix=@CMAKE_INSTALL_PREFIX@
2 | exec_prefix=${prefix}
3 | libdir=${prefix}/lib
4 | includedir=${prefix}/include
5 |
6 | Name: PortAudio
7 | Description: Portable audio I/O
8 | Requires:
9 | Version: @PA_PKGCONFIG_VERSION@
10 |
11 | Libs: -L${libdir} -lportaudio @PA_PKGCONFIG_LDFLAGS@
12 | Cflags: -I${includedir} @PA_PKGCONFIG_CFLAGS@
13 |
--------------------------------------------------------------------------------
/portaudio/test/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Test projects
2 | # Use the macro to add test projects
3 |
4 | MACRO(ADD_TEST appl_name)
5 | ADD_EXECUTABLE(${appl_name} "${appl_name}.c")
6 | TARGET_LINK_LIBRARIES(${appl_name} portaudio_static)
7 | SET_TARGET_PROPERTIES(${appl_name}
8 | PROPERTIES
9 | FOLDER "Test"
10 | )
11 | ENDMACRO(ADD_TEST)
12 |
13 | ADD_TEST(patest_longsine)
14 |
--------------------------------------------------------------------------------
/portaudio/bindings/java/jportaudio/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/portaudio/clear_gitrevision.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | #
3 | # Clear the Git commit SHA in the include file.
4 | # This should be run before checking in code to Git.
5 | #
6 | revision_filename=src/common/pa_gitrevision.h
7 |
8 | # Update the include file with the current GIT revision.
9 | echo "#define PA_GIT_REVISION unknown" > ${revision_filename}
10 |
11 | echo ${revision_filename} now contains
12 | cat ${revision_filename}
13 |
--------------------------------------------------------------------------------
/portaudio/bindings/java/jportaudio/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | JPortAudio
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 |
15 | org.eclipse.jdt.core.javanature
16 |
17 |
18 |
--------------------------------------------------------------------------------
/portaudio/bindings/cpp/source/portaudiocpp/CallbackStream.cxx:
--------------------------------------------------------------------------------
1 | #include "portaudiocpp/CallbackStream.hxx"
2 |
3 | namespace portaudio
4 | {
5 | CallbackStream::CallbackStream()
6 | {
7 | }
8 |
9 | CallbackStream::~CallbackStream()
10 | {
11 | }
12 |
13 | // -----------------------------------------------------------------------------------
14 |
15 | double CallbackStream::cpuLoad() const
16 | {
17 | return Pa_GetStreamCpuLoad(stream_);
18 | }
19 |
20 | } // namespace portaudio
21 |
--------------------------------------------------------------------------------
/docker-build.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | PUSH=$1
4 | DATE="$(date "+%Y%m%d%H%M")"
5 | REPOSITORY_NAME="latonaio"
6 | IMAGE_NAME="capture-audio-from-mic"
7 |
8 | DOCKER_BUILDKIT=1 docker build --secret id=ssh,src=$HOME/.ssh/bitbucket/id_rsa -f . -t ${REPOSITORY_NAME}/${IMAGE_NAME}:"${DATE}" .
9 | docker tag ${REPOSITORY_NAME}/${IMAGE_NAME}:"${DATE}" ${REPOSITORY_NAME}/${IMAGE_NAME}:latest
10 |
11 | if [[ $PUSH == "push" ]]; then
12 | docker push ${REPOSITORY_NAME}/${IMAGE_NAME}:"${DATE}"
13 | docker push ${REPOSITORY_NAME}/${IMAGE_NAME}:latest
14 | fi
15 |
--------------------------------------------------------------------------------
/portaudio/fixdir.bat:
--------------------------------------------------------------------------------
1 | rem Use Astyle to fix style in 'C' files
2 | cd %1%
3 |
4 | fixlines -p *.c
5 | fixlines -p *.cpp
6 | fixlines -p *.cc
7 |
8 | astyle --style=ansi -c -o --convert-tabs --indent-preprocessor *.c
9 | astyle --style=ansi -c -o --convert-tabs --indent-preprocessor *.cpp
10 | astyle --style=ansi -c -o --convert-tabs --indent-preprocessor *.cc
11 | del *.orig
12 | @rem convert line terminators to Unix style LFs
13 | fixlines -u *.c
14 | fixlines -u *.cpp
15 | fixlines -u *.cc
16 | fixlines -u *.h
17 | del *.bak
18 |
19 | cd ..\
20 |
--------------------------------------------------------------------------------
/portaudio/testcvs/changeme.txt:
--------------------------------------------------------------------------------
1 | This is just a dopy little file used to test the source code repository.
2 | Feel free to trash this file.
3 | Minor change.
4 | Another tweak.
5 | philburk tweak
6 | stephane test
7 | Phil changed this again on 2/21/02. Yawn...
8 | Bjorn test3!
9 | Phil tried to change this on 5/13/08
10 | Now we are using SVN instead of CVS. PB 2/10/10
11 | Test from builder-pc
12 |
13 | make a change using SVN on Ubuntu
14 | tweak
15 | testing
16 |
17 | PLB changing it to see if SVN broken
18 | Testing from Ubuntu with SVN on Assembla.
19 |
20 | 5/2/2016 - Now using Git!
21 |
22 |
--------------------------------------------------------------------------------
/portaudio/update_gitrevision.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | #
3 | # Write the Git commit SHA to an include file.
4 | # This should be run before compiling code on Linux or Macintosh.
5 | #
6 | revision_filename=src/common/pa_gitrevision.h
7 |
8 | # Run git first to make sure it is installed before corrupting the
9 | # include file.
10 | git rev-parse HEAD
11 |
12 | # Update the include file with the current Git revision.
13 | echo -n "#define PA_GIT_REVISION " > ${revision_filename}
14 | git rev-parse HEAD >> ${revision_filename}
15 |
16 | echo ${revision_filename} now contains
17 | cat ${revision_filename}
18 |
--------------------------------------------------------------------------------
/portaudio/.gitignore:
--------------------------------------------------------------------------------
1 | # Compiled Object files
2 | *.slo
3 | *.lo
4 | *.o
5 | *.obj
6 |
7 | # annoying files
8 | **/.DS_Store
9 |
10 | # Generated by configure and make
11 | Makefile
12 | bin-stamp
13 | bin/*
14 | config.log
15 | config.status
16 | lib-stamp
17 | lib/*
18 | libtool
19 | portaudio-2.0.pc
20 |
21 | # Precompiled Headers
22 | *.gch
23 | *.pch
24 |
25 | # Compiled Dynamic libraries
26 | *.so
27 | *.dylib
28 | *.dll
29 |
30 | # Fortran module files
31 | *.mod
32 |
33 | # Compiled Static libraries
34 | *.lai
35 | *.la
36 | *.a
37 | *.lib
38 |
39 | # Executables
40 | *.exe
41 | *.out
42 | *.app
43 |
--------------------------------------------------------------------------------
/portaudio/doc/src/tutorial/terminating_portaudio.dox:
--------------------------------------------------------------------------------
1 | /** @page terminating_portaudio Closing a Stream and Terminating PortAudio
2 | @ingroup tutorial
3 |
4 | When you are done with a stream, you should close it to free up resources:
5 |
6 | @code
7 | err = Pa_CloseStream( stream );
8 | if( err != paNoError ) goto error;
9 | @endcode
10 |
11 | We've already mentioned this in \ref initializing_portaudio, but in case you forgot, be sure to terminate PortAudio when you are done:
12 |
13 | @code
14 | err = Pa_Terminate( );
15 | if( err != paNoError ) goto error;
16 | @endcode
17 |
18 | Previous: \ref start_stop_abort | Next: \ref utility_functions
19 |
20 | */
--------------------------------------------------------------------------------
/portaudio/build/msvc/portaudio.dsw:
--------------------------------------------------------------------------------
1 | Microsoft Developer Studio Workspace File, Format Version 6.00
2 | # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
3 |
4 | ###############################################################################
5 |
6 | Project: "portaudio"=".\portaudio.dsp" - Package Owner=<4>
7 |
8 | Package=<5>
9 | {{{
10 | }}}
11 |
12 | Package=<4>
13 | {{{
14 | }}}
15 |
16 | ###############################################################################
17 |
18 | Global:
19 |
20 | Package=<5>
21 | {{{
22 | }}}
23 |
24 | Package=<3>
25 | {{{
26 | }}}
27 |
28 | ###############################################################################
29 |
30 |
--------------------------------------------------------------------------------
/portaudio/bindings/cpp/build/vc6/static_library.dsw:
--------------------------------------------------------------------------------
1 | Microsoft Developer Studio Workspace File, Format Version 6.00
2 | # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
3 |
4 | ###############################################################################
5 |
6 | Project: "static_library"=".\static_library.dsp" - Package Owner=<4>
7 |
8 | Package=<5>
9 | {{{
10 | }}}
11 |
12 | Package=<4>
13 | {{{
14 | }}}
15 |
16 | ###############################################################################
17 |
18 | Global:
19 |
20 | Package=<5>
21 | {{{
22 | }}}
23 |
24 | Package=<3>
25 | {{{
26 | }}}
27 |
28 | ###############################################################################
29 |
30 |
--------------------------------------------------------------------------------
/portaudio/doc/src/tutorial/exploring.dox:
--------------------------------------------------------------------------------
1 | /** @page exploring Exploring PortAudio
2 | @ingroup tutorial
3 |
4 | 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.
5 |
6 | For an example of playing a sine wave, see examples/paex_sine.c.
7 |
8 | For an example of recording and playing back a sound, see examples/paex_record.c.
9 |
10 | 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.
11 |
12 |
13 | Previous: \ref blocking_read_write | Next: This is the end of the tutorial.
14 |
15 | */
--------------------------------------------------------------------------------
/src/capture-audio/__main__.py:
--------------------------------------------------------------------------------
1 | # coding: utf-8
2 |
3 | # Copyright (c) 2019-2020 Latona. All rights reserved.
4 |
5 | import os
6 |
7 | from . import main_with_kanban, main_without_kanban, main_with_kanban_itr, send_kanbans_at_highspeed, \
8 | main_with_kanban_multiple
9 |
10 | KANBAN_MODE = os.environ.get("KANBAN_MODE", "main_without_kanban")
11 |
12 | if __name__ == "__main__":
13 | if KANBAN_MODE == "main_without_kanban":
14 | main_without_kanban()
15 | elif KANBAN_MODE == "main_with_kanban":
16 | main_with_kanban()
17 | elif KANBAN_MODE == "main_with_kanban_itr":
18 | main_with_kanban_itr()
19 | elif KANBAN_MODE == "send_kanbans_at_highspeed":
20 | send_kanbans_at_highspeed()
21 | elif KANBAN_MODE == "main_with_kanban_multiple":
22 | main_with_kanban_multiple()
23 |
--------------------------------------------------------------------------------
/portaudio/bindings/cpp/source/portaudiocpp/CallbackInterface.cxx:
--------------------------------------------------------------------------------
1 | #include "portaudiocpp/CallbackInterface.hxx"
2 |
3 | namespace portaudio
4 | {
5 |
6 | namespace impl
7 | {
8 |
9 | //////
10 | /// Adapts any CallbackInterface object to a C-callable function (ie this function). A
11 | /// pointer to the object should be passed as ``userData'' when setting up the callback.
12 | //////
13 | int callbackInterfaceToPaCallbackAdapter(const void *inputBuffer, void *outputBuffer, unsigned long numFrames,
14 | const PaStreamCallbackTimeInfo *timeInfo, PaStreamCallbackFlags statusFlags, void *userData)
15 | {
16 | CallbackInterface *cb = static_cast(userData);
17 | return cb->paCallbackFun(inputBuffer, outputBuffer, numFrames, timeInfo, statusFlags);
18 | }
19 |
20 |
21 | } // namespace impl
22 |
23 | } // namespace portaudio
24 |
25 |
26 |
--------------------------------------------------------------------------------
/portaudio/bindings/cpp/include/Makefile.am:
--------------------------------------------------------------------------------
1 | pkginclude_HEADERS = \
2 | portaudiocpp/AutoSystem.hxx \
3 | portaudiocpp/BlockingStream.hxx \
4 | portaudiocpp/CallbackInterface.hxx \
5 | portaudiocpp/CallbackStream.hxx \
6 | portaudiocpp/CFunCallbackStream.hxx \
7 | portaudiocpp/CppFunCallbackStream.hxx \
8 | portaudiocpp/Device.hxx \
9 | portaudiocpp/DirectionSpecificStreamParameters.hxx \
10 | portaudiocpp/Exception.hxx \
11 | portaudiocpp/HostApi.hxx \
12 | portaudiocpp/InterfaceCallbackStream.hxx \
13 | portaudiocpp/MemFunCallbackStream.hxx \
14 | portaudiocpp/PortAudioCpp.hxx \
15 | portaudiocpp/SampleDataFormat.hxx \
16 | portaudiocpp/Stream.hxx \
17 | portaudiocpp/StreamParameters.hxx \
18 | portaudiocpp/SystemDeviceIterator.hxx \
19 | portaudiocpp/SystemHostApiIterator.hxx \
20 | portaudiocpp/System.hxx
21 |
22 | # portaudiocpp/AsioDeviceAdapter.hxx
23 |
--------------------------------------------------------------------------------
/portaudio/src/hostapi/wasapi/mingw-include/ksguid.h:
--------------------------------------------------------------------------------
1 | /**
2 | * This file has no copyright assigned and is placed in the Public Domain.
3 | * This file is part of the w64 mingw-runtime package.
4 | * No warranty is given; refer to the file DISCLAIMER.PD within this package.
5 | */
6 | #define INITGUID
7 | #include
8 |
9 | #ifndef DECLSPEC_SELECTANY
10 | #define DECLSPEC_SELECTANY __declspec(selectany)
11 | #endif
12 |
13 | #ifdef DEFINE_GUIDEX
14 | #undef DEFINE_GUIDEX
15 | #endif
16 |
17 | #ifdef __cplusplus
18 | #define DEFINE_GUIDEX(name) EXTERN_C const CDECL GUID DECLSPEC_SELECTANY name = { STATICGUIDOF(name) }
19 | #else
20 | #define DEFINE_GUIDEX(name) const CDECL GUID DECLSPEC_SELECTANY name = { STATICGUIDOF(name) }
21 | #endif
22 | #ifndef STATICGUIDOF
23 | #define STATICGUIDOF(guid) STATIC_##guid
24 | #endif
25 |
26 | #ifndef DEFINE_WAVEFORMATEX_GUID
27 | #define DEFINE_WAVEFORMATEX_GUID(x) (USHORT)(x),0x0000,0x0010,0x80,0x00,0x00,0xaa,0x00,0x38,0x9b,0x71
28 | #endif
29 |
--------------------------------------------------------------------------------
/portaudio/src/hostapi/wasapi/mingw-include/propkeydef.h:
--------------------------------------------------------------------------------
1 | #ifndef PID_FIRST_USABLE
2 | #define PID_FIRST_USABLE 2
3 | #endif
4 |
5 | #ifndef REFPROPERTYKEY
6 | #ifdef __cplusplus
7 | #define REFPROPERTYKEY const PROPERTYKEY &
8 | #else // !__cplusplus
9 | #define REFPROPERTYKEY const PROPERTYKEY * __MIDL_CONST
10 | #endif // __cplusplus
11 | #endif //REFPROPERTYKEY
12 |
13 | #ifdef DEFINE_PROPERTYKEY
14 | #undef DEFINE_PROPERTYKEY
15 | #endif
16 |
17 | #ifdef INITGUID
18 | #define DEFINE_PROPERTYKEY(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8, pid) EXTERN_C const PROPERTYKEY DECLSPEC_SELECTANY name = { { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }, pid }
19 | #else
20 | #define DEFINE_PROPERTYKEY(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8, pid) EXTERN_C const PROPERTYKEY name
21 | #endif // INITGUID
22 |
23 | #ifndef IsEqualPropertyKey
24 | #define IsEqualPropertyKey(a, b) (((a).pid == (b).pid) && IsEqualIID((a).fmtid, (b).fmtid) )
25 | #endif // IsEqualPropertyKey
26 |
27 |
--------------------------------------------------------------------------------
/portaudio/README.configure.txt:
--------------------------------------------------------------------------------
1 | PortAudio uses "autoconf" tools to generate Makefiles for Linux and Mac platforms.
2 | The source for these are configure.in and Makefile.in
3 | If you modify either of these files then please run this command before
4 | testing and checking in your changes. I run this command on Linux.
5 |
6 | autoreconf -if
7 |
8 | If you do not have autoreconf then do:
9 | sudo apt-get install autoconf
10 |
11 | If you get error like "possibly undefined macro: AC_LIBTOOL_WIN32_DLL"
12 | then you try installing some more packages and then try again.
13 |
14 | sudo apt-get install build-essential
15 | sudo apt-get install pkg-config
16 | sudo apt-get install libtool
17 | autoreconf -if
18 |
19 | Then test a build by doing:
20 |
21 | ./configure
22 | make clean
23 | make
24 |
25 | then check in the related files that are modified.
26 | These might include files like:
27 |
28 | configure
29 | config.guess
30 | depcomp
31 | install.sh
32 |
33 |
--------------------------------------------------------------------------------
/portaudio/bindings/cpp/include/portaudiocpp/SampleDataFormat.hxx:
--------------------------------------------------------------------------------
1 | #ifndef INCLUDED_PORTAUDIO_SAMPLEDATAFORMAT_HXX
2 | #define INCLUDED_PORTAUDIO_SAMPLEDATAFORMAT_HXX
3 |
4 | // ---------------------------------------------------------------------------------------
5 |
6 | #include "portaudio.h"
7 |
8 | // ---------------------------------------------------------------------------------------
9 |
10 | namespace portaudio
11 | {
12 |
13 |
14 | //////
15 | /// @brief PortAudio sample data formats.
16 | ///
17 | /// Small helper enum to wrap the PortAudio defines.
18 | //////
19 | enum SampleDataFormat
20 | {
21 | INVALID_FORMAT = 0,
22 | FLOAT32 = paFloat32,
23 | INT32 = paInt32,
24 | INT24 = paInt24,
25 | INT16 = paInt16,
26 | INT8 = paInt8,
27 | UINT8 = paUInt8
28 | };
29 |
30 |
31 | } // namespace portaudio
32 |
33 | // ---------------------------------------------------------------------------------------
34 |
35 | #endif // INCLUDED_PORTAUDIO_SAMPLEDATAFORMAT_HXX
36 |
--------------------------------------------------------------------------------
/src/capture-audio/mysql.py:
--------------------------------------------------------------------------------
1 | import aion.mysql as mysql
2 | from aion.logger import lprint
3 | from enum import Enum
4 |
5 |
6 | class MicStatus(Enum):
7 | STANDBY = 'standby'
8 | ACTIVE = 'active'
9 | DISABLE = 'disable'
10 |
11 |
12 | class MysqlManager(mysql.BaseMysqlAccess):
13 | """UpdateDeviceStateToDB
14 | Store device list to mysql
15 | This function will be deleted.
16 | """
17 |
18 | def __init__(self):
19 | super().__init__("PeripheralDevice")
20 |
21 | def update_microphone_state(self, card_no, device_no, status: MicStatus, processNum):
22 | sql = """
23 | UPDATE microphones
24 | SET status = %(status)s, manager_pod_process_num = %(processNum)s
25 | WHERE card_no = %(card_no)s
26 | AND device_no = %(device_no)s ;
27 | """
28 | args = {"card_no": card_no, "device_no": device_no, "status": status.value, "processNum": processNum}
29 | self.set_query(sql, args)
30 |
--------------------------------------------------------------------------------
/C_CaptureAudioFromMic.json:
--------------------------------------------------------------------------------
1 | {
2 | "priorServiceName": null,
3 | "priorDirectoryOfService": null,
4 | "priorRuntime": {
5 | "type": null,
6 | "run": null
7 | },
8 | "priorSuccess": true,
9 | "nextServiceList": [{
10 | "nextServiceName": "CaptureAudioFromMic",
11 | "nextDirectoryOfService": "/home/latona/poseidon/Runtime/capture-audio-from-mic",
12 | "nextRuntime": {
13 | "type": "python",
14 | "run": "main.py"
15 | },
16 | "nextServiceDevice": "poseidon"
17 | }],
18 | "transactionCodes":{
19 | "transactionCode0": "",
20 | "transactionCode1": "",
21 | "transactionCode2": ""
22 | },
23 |
24 | "inputHeader": {
25 | "type": null,
26 | "content": null
27 | },
28 | "inputFileName": null,
29 | "outputHeader": {
30 | "type": "",
31 | "content": ""
32 | },
33 | "outputFileName": "",
34 | "startAt": "",
35 | "finishAt": "",
36 | "metadata": []
37 | }
38 |
--------------------------------------------------------------------------------
/portaudio/bindings/cpp/build/vc7_1/static_library.sln:
--------------------------------------------------------------------------------
1 | Microsoft Visual Studio Solution File, Format Version 8.00
2 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "static_library", "static_library.vcproj", "{D18EA0C9-8C65-441D-884C-55EB43A84F2A}"
3 | ProjectSection(ProjectDependencies) = postProject
4 | EndProjectSection
5 | EndProject
6 | Global
7 | GlobalSection(SolutionConfiguration) = preSolution
8 | Debug = Debug
9 | Release = Release
10 | EndGlobalSection
11 | GlobalSection(ProjectConfiguration) = postSolution
12 | {D18EA0C9-8C65-441D-884C-55EB43A84F2A}.Debug.ActiveCfg = Debug|Win32
13 | {D18EA0C9-8C65-441D-884C-55EB43A84F2A}.Debug.Build.0 = Debug|Win32
14 | {D18EA0C9-8C65-441D-884C-55EB43A84F2A}.Release.ActiveCfg = Release|Win32
15 | {D18EA0C9-8C65-441D-884C-55EB43A84F2A}.Release.Build.0 = Release|Win32
16 | EndGlobalSection
17 | GlobalSection(ExtensibilityGlobals) = postSolution
18 | EndGlobalSection
19 | GlobalSection(ExtensibilityAddIns) = postSolution
20 | EndGlobalSection
21 | EndGlobal
22 |
--------------------------------------------------------------------------------
/portaudio/.gitattributes:
--------------------------------------------------------------------------------
1 | # Set the default behavior, in case people don't have core.autocrlf set.
2 | * text=auto
3 |
4 | # Explicitly declare text files you want to always be normalized and converted
5 | # to native line endings on checkout.
6 | *.c text
7 | *.h text
8 | *.cpp text
9 | *.hpp text
10 | *.fth text
11 | *.java text
12 | *.f text
13 | *.txt text
14 | *.dox text
15 | *.m text
16 |
17 | # Declare files that will always have CRLF line endings on checkout.
18 | *.sln text eol=crlf
19 | *.def text eol=crlf
20 | *.dsp text eol=crlf
21 | *.dsw text eol=crlf
22 | *.vcproj text eol=crlf
23 | *.sln text eol=crlf
24 | *.doc text eol=crlf
25 | *.bat text eol=crlf
26 |
27 | # Denote all files that are truly binary and should not be modified.
28 | *.dic binary
29 | *.odt binary
30 | *.pdf binary
31 | *.png binary
32 | *.jpg binary
33 | *.wav binary
34 | *.la binary
35 | config.guess binary
36 | config.status binary
37 | config.sub binary
38 | configure binary
39 | depcomp binary
40 | install-sh binary
41 | libtool binary
42 | missing binary
43 |
44 |
--------------------------------------------------------------------------------
/portaudio/qa/loopback/src/biquad_filter.h:
--------------------------------------------------------------------------------
1 | #ifndef _BIQUADFILTER_H
2 | #define _BIQUADFILTER_H
3 |
4 |
5 | /**
6 | * Unit_BiquadFilter implements a second order IIR filter.
7 | *
8 | * @author (C) 2002 Phil Burk, SoftSynth.com, All Rights Reserved
9 | */
10 |
11 | #define BIQUAD_MIN_RATIO (0.000001)
12 | #define BIQUAD_MIN_Q (0.00001)
13 |
14 | typedef struct BiquadFilter_s
15 | {
16 | double xn1; // storage for delayed signals
17 | double xn2;
18 | double yn1;
19 | double yn2;
20 |
21 | double a0; // coefficients
22 | double a1;
23 | double a2;
24 |
25 | double b1;
26 | double b2;
27 |
28 | double cos_omega;
29 | double sin_omega;
30 | double alpha;
31 | } BiquadFilter;
32 |
33 | void BiquadFilter_SetupHighPass( BiquadFilter *filter, double ratio, double Q );
34 | void BiquadFilter_SetupNotch( BiquadFilter *filter, double ratio, double Q );
35 |
36 | void BiquadFilter_Filter( BiquadFilter *filter, float *inputs, float *outputs, int numSamples );
37 |
38 | #endif
39 |
--------------------------------------------------------------------------------
/portaudio/bindings/cpp/lib/Makefile.am:
--------------------------------------------------------------------------------
1 | SRCDIR = $(top_srcdir)/source/portaudiocpp
2 |
3 | lib_LTLIBRARIES = libportaudiocpp.la
4 |
5 | LDADD = libportaudiocpp.la
6 |
7 | libportaudiocpp_la_LDFLAGS = -version-info $(LT_VERSION_INFO) -no-undefined
8 |
9 | libportaudiocpp_la_LIBADD = $(top_builddir)/$(PORTAUDIO_ROOT)/lib/libportaudio.la
10 | libportaudiocpp_la_SOURCES = \
11 | $(SRCDIR)/BlockingStream.cxx \
12 | $(SRCDIR)/CallbackInterface.cxx \
13 | $(SRCDIR)/CallbackStream.cxx \
14 | $(SRCDIR)/CFunCallbackStream.cxx \
15 | $(SRCDIR)/CppFunCallbackStream.cxx \
16 | $(SRCDIR)/Device.cxx \
17 | $(SRCDIR)/DirectionSpecificStreamParameters.cxx \
18 | $(SRCDIR)/Exception.cxx \
19 | $(SRCDIR)/HostApi.cxx \
20 | $(SRCDIR)/InterfaceCallbackStream.cxx \
21 | $(SRCDIR)/MemFunCallbackStream.cxx \
22 | $(SRCDIR)/Stream.cxx \
23 | $(SRCDIR)/StreamParameters.cxx \
24 | $(SRCDIR)/System.cxx \
25 | $(SRCDIR)/SystemDeviceIterator.cxx \
26 | $(SRCDIR)/SystemHostApiIterator.cxx
27 |
--------------------------------------------------------------------------------
/portaudio/bindings/cpp/build/vc6/devs_example.dsw:
--------------------------------------------------------------------------------
1 | Microsoft Developer Studio Workspace File, Format Version 6.00
2 | # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
3 |
4 | ###############################################################################
5 |
6 | Project: "devs_example"=".\devs_example.dsp" - Package Owner=<4>
7 |
8 | Package=<5>
9 | {{{
10 | }}}
11 |
12 | Package=<4>
13 | {{{
14 | Begin Project Dependency
15 | Project_Dep_Name static_library
16 | End Project Dependency
17 | }}}
18 |
19 | ###############################################################################
20 |
21 | Project: "static_library"=".\static_library.dsp" - Package Owner=<4>
22 |
23 | Package=<5>
24 | {{{
25 | }}}
26 |
27 | Package=<4>
28 | {{{
29 | }}}
30 |
31 | ###############################################################################
32 |
33 | Global:
34 |
35 | Package=<5>
36 | {{{
37 | }}}
38 |
39 | Package=<3>
40 | {{{
41 | }}}
42 |
43 | ###############################################################################
44 |
45 |
--------------------------------------------------------------------------------
/portaudio/bindings/cpp/build/vc6/sine_example.dsw:
--------------------------------------------------------------------------------
1 | Microsoft Developer Studio Workspace File, Format Version 6.00
2 | # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
3 |
4 | ###############################################################################
5 |
6 | Project: "sine_example"=".\sine_example.dsp" - Package Owner=<4>
7 |
8 | Package=<5>
9 | {{{
10 | }}}
11 |
12 | Package=<4>
13 | {{{
14 | Begin Project Dependency
15 | Project_Dep_Name static_library
16 | End Project Dependency
17 | }}}
18 |
19 | ###############################################################################
20 |
21 | Project: "static_library"=".\static_library.dsp" - Package Owner=<4>
22 |
23 | Package=<5>
24 | {{{
25 | }}}
26 |
27 | Package=<4>
28 | {{{
29 | }}}
30 |
31 | ###############################################################################
32 |
33 | Global:
34 |
35 | Package=<5>
36 | {{{
37 | }}}
38 |
39 | Package=<3>
40 | {{{
41 | }}}
42 |
43 | ###############################################################################
44 |
45 |
--------------------------------------------------------------------------------
/portaudio/doc/src/tutorial/initializing_portaudio.dox:
--------------------------------------------------------------------------------
1 | /** @page initializing_portaudio Initializing PortAudio
2 | @ingroup tutorial
3 |
4 | @section tut_init1 Initializing PortAudio
5 |
6 | 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.
7 | @code
8 | err = Pa_Initialize();
9 | if( err != paNoError ) goto error;
10 | @endcode
11 |
12 | You can get a text message that explains the error message by passing it to Pa_GetErrorText( err ). For Example:
13 |
14 | @code
15 | printf( "PortAudio error: %s\n", Pa_GetErrorText( err ) );
16 | @endcode
17 |
18 | It is also important, when you are done with PortAudio, to Terminate it:
19 |
20 | @code
21 | err = Pa_Terminate();
22 | if( err != paNoError )
23 | printf( "PortAudio error: %s\n", Pa_GetErrorText( err ) );
24 | @endcode
25 |
26 |
27 | Previous: \ref writing_a_callback | Next: \ref open_default_stream
28 |
29 | */
--------------------------------------------------------------------------------
/portaudio/src/hostapi/wasapi/readme.txt:
--------------------------------------------------------------------------------
1 | **************
2 | * WASAPI API *
3 | **************
4 |
5 | -------------------------------------------
6 | Microsoft Visual Studio 2005 SP1 and higher
7 | -------------------------------------------
8 | No specific action is required to compile WASAPI API under Visual Studio.
9 | You are only required to install min. Windows Vista SDK (v6.0A) prior
10 | the compilation. To compile with WASAPI specific functionality for Windows 8
11 | and higher the min. Windows 8 SDK is required.
12 |
13 | ----------------------------------------
14 | MinGW (GCC 32/64-bit)
15 | ----------------------------------------
16 | To compile with MinGW you are required to include 'mingw-include' directory
17 | which contains necessary files with WASAPI API. These files are modified
18 | for the compatibility with MinGW compiler. These files are taken from
19 | the Windows Vista SDK (v6.0A). MinGW compilation is tested and proved to be
20 | fully working.
21 | MinGW (32-bit) tested min. version: gcc version 4.4.0 (GCC)
22 | MinGW64 (64-bit) tested min. version: gcc version 4.4.4 20100226 (prerelease) (GCC)
--------------------------------------------------------------------------------
/portaudio/cmake_support/options_cmake.h.in:
--------------------------------------------------------------------------------
1 | /* $Id: $
2 |
3 | !!! @GENERATED_MESSAGE@ !!!
4 |
5 | Header file configured by CMake to convert CMake options/vars to macros. It is done this way because if set via
6 | preprocessor options, MSVC f.i. has no way of knowing when an option (or var) changes as there is no dependency chain.
7 |
8 | The generated "options_cmake.h" should be included like so:
9 |
10 | #ifdef PORTAUDIO_CMAKE_GENERATED
11 | #include "options_cmake.h"
12 | #endif
13 |
14 | so that non-CMake build environments are left intact.
15 |
16 | Source template: cmake_support/options_cmake.h.in
17 | */
18 |
19 | #ifdef _WIN32
20 | #if defined(PA_USE_ASIO) || defined(PA_USE_DS) || defined(PA_USE_WMME) || defined(PA_USE_WASAPI) || defined(PA_USE_WDMKS)
21 | #error "This header needs to be included before pa_hostapi.h!!"
22 | #endif
23 |
24 | #cmakedefine01 PA_USE_ASIO
25 | #cmakedefine01 PA_USE_DS
26 | #cmakedefine01 PA_USE_WMME
27 | #cmakedefine01 PA_USE_WASAPI
28 | #cmakedefine01 PA_USE_WDMKS
29 | #else
30 | #error "Platform currently not supported by CMake script"
31 | #endif
32 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2020 Latona, Inc.
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/portaudio/bindings/cpp/include/portaudiocpp/AsioDeviceAdapter.hxx:
--------------------------------------------------------------------------------
1 | #ifndef INCLUDED_PORTAUDIO_ASIODEVICEADAPTER_HXX
2 | #define INCLUDED_PORTAUDIO_ASIODEVICEADAPTER_HXX
3 |
4 | namespace portaudio
5 | {
6 |
7 | // Forward declaration(s):
8 | class Device;
9 |
10 | // Declaration(s):
11 | //////
12 | /// @brief Adapts the given Device to an ASIO specific extension.
13 | ///
14 | /// Deleting the AsioDeviceAdapter does not affect the underlaying
15 | /// Device.
16 | //////
17 | class AsioDeviceAdapter
18 | {
19 | public:
20 | AsioDeviceAdapter(Device &device);
21 |
22 | Device &device();
23 |
24 | long minBufferSize() const;
25 | long maxBufferSize() const;
26 | long preferredBufferSize() const;
27 | long granularity() const;
28 |
29 | void showControlPanel(void *systemSpecific);
30 |
31 | const char *inputChannelName(int channelIndex) const;
32 | const char *outputChannelName(int channelIndex) const;
33 |
34 | private:
35 | Device *device_;
36 |
37 | long minBufferSize_;
38 | long maxBufferSize_;
39 | long preferredBufferSize_;
40 | long granularity_;
41 | };
42 | }
43 |
44 | #endif // INCLUDED_PORTAUDIO_ASIODEVICEADAPTER_HXX
45 |
--------------------------------------------------------------------------------
/portaudio/bindings/cpp/include/portaudiocpp/CallbackStream.hxx:
--------------------------------------------------------------------------------
1 | #ifndef INCLUDED_PORTAUDIO_CALLBACKSTREAM_HXX
2 | #define INCLUDED_PORTAUDIO_CALLBACKSTREAM_HXX
3 |
4 | // ---------------------------------------------------------------------------------------
5 |
6 | #include "portaudio.h"
7 |
8 | #include "portaudiocpp/Stream.hxx"
9 |
10 | // ---------------------------------------------------------------------------------------
11 |
12 | // Declaration(s):
13 | namespace portaudio
14 | {
15 |
16 |
17 | //////
18 | /// @brief Base class for all Streams which use a callback-based mechanism.
19 | //////
20 | class CallbackStream : public Stream
21 | {
22 | protected:
23 | CallbackStream();
24 | virtual ~CallbackStream();
25 |
26 | public:
27 | // stream info (time-varying)
28 | double cpuLoad() const;
29 |
30 | private:
31 | CallbackStream(const CallbackStream &); // non-copyable
32 | CallbackStream &operator=(const CallbackStream &); // non-copyable
33 | };
34 |
35 |
36 | } // namespace portaudio
37 |
38 | // ---------------------------------------------------------------------------------------
39 |
40 | #endif // INCLUDED_PORTAUDIO_CALLBACKSTREAM_HXX
41 |
--------------------------------------------------------------------------------
/portaudio/doc/src/srcguide.dox:
--------------------------------------------------------------------------------
1 | /*
2 | define all of the file groups used to structure the documentation.
3 | */
4 |
5 | /**
6 | @defgroup public_header Public API definitions for users of PortAudio
7 | */
8 |
9 | /**
10 | @internal
11 | @defgroup common_src Source code common to all implementations
12 | */
13 |
14 | /**
15 | @internal
16 | @defgroup win_src Source code common to all Windows implementations
17 | */
18 |
19 | /**
20 | @internal
21 | @defgroup unix_src Source code common to all Unix implementations
22 | */
23 |
24 | /**
25 | @internal
26 | @defgroup macosx_src Source code common to all Macintosh implementations
27 | */
28 |
29 | /**
30 | @internal
31 | @defgroup hostapi_src Source code for specific Host APIs
32 | */
33 |
34 | /**
35 | @internal
36 | @defgroup test_src Test programs
37 | */
38 |
39 | /**
40 | @defgroup examples_src Example programs demonstrating PortAudio usage
41 | */
42 |
43 | /**
44 | @internal
45 | @page srcguide A guide to the PortAudio sources
46 |
47 | - \ref public_header
48 | - \ref examples_src
49 | - \ref common_src
50 | - \ref win_src
51 | - \ref unix_src
52 | - \ref macosx_src
53 | - \ref hostapi_src
54 | - \ref test_src
55 | */
--------------------------------------------------------------------------------
/portaudio/cmake_support/FindASIOSDK.cmake:
--------------------------------------------------------------------------------
1 | # $Id: $
2 | #
3 | # - Try to find the ASIO SDK
4 | # Once done this will define
5 | #
6 | # ASIOSDK_FOUND - system has ASIO SDK
7 | # ASIOSDK_ROOT_DIR - path to the ASIO SDK base directory
8 | # ASIOSDK_INCLUDE_DIR - the ASIO SDK include directory
9 |
10 | if(WIN32)
11 | else(WIN32)
12 | message(FATAL_ERROR "FindASIOSDK.cmake: Unsupported platform ${CMAKE_SYSTEM_NAME}" )
13 | endif(WIN32)
14 |
15 | file(GLOB results "${CMAKE_CURRENT_SOURCE_DIR}/../as*")
16 | foreach(f ${results})
17 | if(IS_DIRECTORY ${f})
18 | set(ASIOSDK_PATH_HINT ${ASIOSDK_PATH_HINT} ${f})
19 | endif()
20 | endforeach()
21 |
22 | find_path(ASIOSDK_ROOT_DIR
23 | common/asio.h
24 | HINTS
25 | ${ASIOSDK_PATH_HINT}
26 | )
27 |
28 | find_path(ASIOSDK_INCLUDE_DIR
29 | asio.h
30 | PATHS
31 | ${ASIOSDK_ROOT_DIR}/common
32 | )
33 |
34 | # handle the QUIETLY and REQUIRED arguments and set ASIOSDK_FOUND to TRUE if
35 | # all listed variables are TRUE
36 | INCLUDE(FindPackageHandleStandardArgs)
37 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(ASIOSDK DEFAULT_MSG ASIOSDK_ROOT_DIR ASIOSDK_INCLUDE_DIR)
38 |
39 | MARK_AS_ADVANCED(
40 | ASIOSDK_ROOT_DIR ASIOSDK_INCLUDE_DIR
41 | )
42 |
--------------------------------------------------------------------------------
/portaudio/bindings/cpp/source/portaudiocpp/CFunCallbackStream.cxx:
--------------------------------------------------------------------------------
1 | #include "portaudiocpp/CFunCallbackStream.hxx"
2 |
3 | #include "portaudiocpp/StreamParameters.hxx"
4 | #include "portaudiocpp/Exception.hxx"
5 |
6 | namespace portaudio
7 | {
8 | CFunCallbackStream::CFunCallbackStream()
9 | {
10 | }
11 |
12 | CFunCallbackStream::CFunCallbackStream(const StreamParameters ¶meters, PaStreamCallback *funPtr, void *userData)
13 | {
14 | open(parameters, funPtr, userData);
15 | }
16 |
17 | CFunCallbackStream::~CFunCallbackStream()
18 | {
19 | try
20 | {
21 | close();
22 | }
23 | catch (...)
24 | {
25 | // ignore all errors
26 | }
27 | }
28 |
29 | // ---------------------------------------------------------------------------------==
30 |
31 | void CFunCallbackStream::open(const StreamParameters ¶meters, PaStreamCallback *funPtr, void *userData)
32 | {
33 | PaError err = Pa_OpenStream(&stream_, parameters.inputParameters().paStreamParameters(), parameters.outputParameters().paStreamParameters(),
34 | parameters.sampleRate(), parameters.framesPerBuffer(), parameters.flags(), funPtr, userData);
35 |
36 | if (err != paNoError)
37 | {
38 | throw PaException(err);
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/portaudio/pablio/pablio.def:
--------------------------------------------------------------------------------
1 | LIBRARY PABLIO
2 | DESCRIPTION 'PABLIO Portable Audio Blocking I/O'
3 |
4 | EXPORTS
5 | ; Explicit exports can go here
6 | Pa_Initialize @1
7 | Pa_Terminate @2
8 | Pa_GetHostError @3
9 | Pa_GetErrorText @4
10 | Pa_CountDevices @5
11 | Pa_GetDefaultInputDeviceID @6
12 | Pa_GetDefaultOutputDeviceID @7
13 | Pa_GetDeviceInfo @8
14 | Pa_OpenStream @9
15 | Pa_OpenDefaultStream @10
16 | Pa_CloseStream @11
17 | Pa_StartStream @12
18 | Pa_StopStream @13
19 | Pa_StreamActive @14
20 | Pa_StreamTime @15
21 | Pa_GetCPULoad @16
22 | Pa_GetMinNumBuffers @17
23 | Pa_Sleep @18
24 |
25 | OpenAudioStream @19
26 | CloseAudioStream @20
27 | WriteAudioStream @21
28 | ReadAudioStream @22
29 |
30 | Pa_GetSampleSize @23
31 |
32 | ;123456789012345678901234567890123456
33 | ;000000000111111111122222222223333333
34 |
35 |
36 |
--------------------------------------------------------------------------------
/portaudio/bindings/cpp/include/portaudiocpp/BlockingStream.hxx:
--------------------------------------------------------------------------------
1 | #ifndef INCLUDED_PORTAUDIO_BLOCKINGSTREAM_HXX
2 | #define INCLUDED_PORTAUDIO_BLOCKINGSTREAM_HXX
3 |
4 | // ---------------------------------------------------------------------------------------
5 |
6 | #include "portaudiocpp/Stream.hxx"
7 |
8 | // ---------------------------------------------------------------------------------------
9 |
10 | namespace portaudio
11 | {
12 |
13 |
14 |
15 | //////
16 | /// @brief Stream class for blocking read/write-style input and output.
17 | //////
18 | class BlockingStream : public Stream
19 | {
20 | public:
21 | BlockingStream();
22 | BlockingStream(const StreamParameters ¶meters);
23 | ~BlockingStream();
24 |
25 | void open(const StreamParameters ¶meters);
26 |
27 | void read(void *buffer, unsigned long numFrames);
28 | void write(const void *buffer, unsigned long numFrames);
29 |
30 | signed long availableReadSize() const;
31 | signed long availableWriteSize() const;
32 |
33 | private:
34 | BlockingStream(const BlockingStream &); // non-copyable
35 | BlockingStream &operator=(const BlockingStream &); // non-copyable
36 | };
37 |
38 |
39 |
40 | } // portaudio
41 |
42 | // ---------------------------------------------------------------------------------------
43 |
44 | #endif // INCLUDED_PORTAUDIO_BLOCKINGSTREAM_HXX
45 |
46 |
--------------------------------------------------------------------------------
/portaudio/build/scons/SConscript_common:
--------------------------------------------------------------------------------
1 | import os.path, sys
2 |
3 | class ConfigurationError(Exception):
4 | def __init__(self, reason):
5 | Exception.__init__(self, "Configuration failed: %s" % reason)
6 |
7 | env = Environment()
8 |
9 | # sunos, aix, hpux, irix, sunos appear to be platforms known by SCons, assuming they're POSIX compliant
10 | Posix = ("linux", "darwin", "sunos", "aix", "hpux", "irix", "sunos", "netbsd")
11 | Windows = ("win32", "cygwin")
12 |
13 | if env["PLATFORM"] == "posix":
14 | if sys.platform[:5] == "linux":
15 | Platform = "linux"
16 | elif sys.platform[:6] == "netbsd":
17 | Platform = "netbsd"
18 | else:
19 | raise ConfigurationError("Unknown platform %s" % sys.platform)
20 | else:
21 | if not env["PLATFORM"] in ("win32", "cygwin") + Posix:
22 | raise ConfigurationError("Unknown platform %s" % env["PLATFORM"])
23 | Platform = env["PLATFORM"]
24 |
25 | # Inspired by the versioning scheme followed by Qt, it seems sensible enough. There are three components: major, minor
26 | # and micro. Major changes with each subtraction from the API (backward-incompatible, i.e. V19 vs. V18), minor changes
27 | # with each addition to the API (backward-compatible), micro changes with each revision of the source code.
28 | ApiVer = "2.0.0"
29 |
30 | Export("Platform", "Posix", "ConfigurationError", "ApiVer")
31 |
--------------------------------------------------------------------------------
/portaudio/bindings/java/c/build/vs2010/PortAudioJNI/PortAudioJNI.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 11.00
3 | # Visual Studio 2010
4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PortAudioJNI", "PortAudioJNI.vcxproj", "{4024D885-39B0-4C8A-B3E7-BAB4BA08DFBB}"
5 | EndProject
6 | Global
7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
8 | Debug|Win32 = Debug|Win32
9 | Debug|x64 = Debug|x64
10 | Release|Win32 = Release|Win32
11 | Release|x64 = Release|x64
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {4024D885-39B0-4C8A-B3E7-BAB4BA08DFBB}.Debug|Win32.ActiveCfg = Debug|Win32
15 | {4024D885-39B0-4C8A-B3E7-BAB4BA08DFBB}.Debug|Win32.Build.0 = Debug|Win32
16 | {4024D885-39B0-4C8A-B3E7-BAB4BA08DFBB}.Debug|x64.ActiveCfg = Debug|x64
17 | {4024D885-39B0-4C8A-B3E7-BAB4BA08DFBB}.Debug|x64.Build.0 = Debug|x64
18 | {4024D885-39B0-4C8A-B3E7-BAB4BA08DFBB}.Release|Win32.ActiveCfg = Release|Win32
19 | {4024D885-39B0-4C8A-B3E7-BAB4BA08DFBB}.Release|Win32.Build.0 = Release|Win32
20 | {4024D885-39B0-4C8A-B3E7-BAB4BA08DFBB}.Release|x64.ActiveCfg = Release|x64
21 | {4024D885-39B0-4C8A-B3E7-BAB4BA08DFBB}.Release|x64.Build.0 = Release|x64
22 | EndGlobalSection
23 | GlobalSection(SolutionProperties) = preSolution
24 | HideSolutionNode = FALSE
25 | EndGlobalSection
26 | EndGlobal
27 |
--------------------------------------------------------------------------------
/portaudio/bindings/cpp/source/portaudiocpp/InterfaceCallbackStream.cxx:
--------------------------------------------------------------------------------
1 | #include "portaudiocpp/InterfaceCallbackStream.hxx"
2 |
3 | #include "portaudiocpp/StreamParameters.hxx"
4 | #include "portaudiocpp/Exception.hxx"
5 | #include "portaudiocpp/CallbackInterface.hxx"
6 |
7 | namespace portaudio
8 | {
9 |
10 | // ---------------------------------------------------------------------------------==
11 |
12 | InterfaceCallbackStream::InterfaceCallbackStream()
13 | {
14 | }
15 |
16 | InterfaceCallbackStream::InterfaceCallbackStream(const StreamParameters ¶meters, CallbackInterface &instance)
17 | {
18 | open(parameters, instance);
19 | }
20 |
21 | InterfaceCallbackStream::~InterfaceCallbackStream()
22 | {
23 | try
24 | {
25 | close();
26 | }
27 | catch (...)
28 | {
29 | // ignore all errors
30 | }
31 | }
32 |
33 | // ---------------------------------------------------------------------------------==
34 |
35 | void InterfaceCallbackStream::open(const StreamParameters ¶meters, CallbackInterface &instance)
36 | {
37 | PaError err = Pa_OpenStream(&stream_, parameters.inputParameters().paStreamParameters(), parameters.outputParameters().paStreamParameters(),
38 | parameters.sampleRate(), parameters.framesPerBuffer(), parameters.flags(), &impl::callbackInterfaceToPaCallbackAdapter, static_cast(&instance));
39 |
40 | if (err != paNoError)
41 | {
42 | throw PaException(err);
43 | }
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/portaudio/cmake_support/FindJack.cmake:
--------------------------------------------------------------------------------
1 | # - Try to find jack
2 | # Once done this will define
3 | # JACK_FOUND - System has jack
4 | # JACK_INCLUDE_DIRS - The jack include directories
5 | # JACK_LIBRARIES - The libraries needed to use jack
6 | # JACK_DEFINITIONS - Compiler switches required for using jack
7 |
8 | if (JACK_LIBRARIES AND JACK_INCLUDE_DIRS)
9 |
10 | # in cache already
11 | set(JACK_FOUND TRUE)
12 |
13 | else (JACK_LIBRARIES AND JACK_INCLUDE_DIRS)
14 |
15 | set(JACK_DEFINITIONS "")
16 |
17 | # Look for pkg-config and use it (if available) to find package
18 | find_package(PkgConfig QUIET)
19 | if (PKG_CONFIG_FOUND)
20 | pkg_search_module(JACK QUIET jack)
21 | endif (PKG_CONFIG_FOUND)
22 |
23 | if (NOT JACK_FOUND)
24 |
25 | find_path(JACK_INCLUDE_DIR jack/jack.h HINTS ${JACK_INCLUDEDIR} ${JACK_INCLUDE_DIRS} PATH_SUFFIXES jack)
26 | find_library(JACK_LIBRARY NAMES jack HINTS ${JACK_LIBDIR} ${JACK_LIBRARY_DIRS})
27 |
28 | set(JACK_LIBRARIES ${JACK_LIBRARY})
29 | set(JACK_INCLUDE_DIRS ${JACK_INCLUDE_DIR})
30 |
31 | include(FindPackageHandleStandardArgs)
32 |
33 | # Set JACK_FOUND if the library and include paths were found
34 | find_package_handle_standard_args(jack DEFAULT_MSG JACK_LIBRARY JACK_INCLUDE_DIR)
35 |
36 | # Don't show include/library paths in cmake GUI
37 | mark_as_advanced(JACK_INCLUDE_DIR JACK_LIBRARY)
38 |
39 | endif (NOT JACK_FOUND)
40 |
41 | endif (JACK_LIBRARIES AND JACK_INCLUDE_DIRS)
42 |
--------------------------------------------------------------------------------
/portaudio/bindings/cpp/doc/README:
--------------------------------------------------------------------------------
1 | GNU/Linux:
2 | ----------
3 |
4 | 1) Download and install a recent version of Doxygen (preferably version 1.3.3 or
5 | later). See http://www.doxygen.org/.
6 | 2) Download and install a recent version of GraphViz. See
7 | http://www.research.att.com/sw/tools/graphviz/.
8 | 3) Run ``doxygen config.doxy.linux'' in this directory or load and generate the file
9 | config.doxy.linux from the Doxywizard application. Or alternatively ``make docs'' can
10 | be run from the build/gnu folder.
11 |
12 | The generated html documentation will be placed in /doc/api_reference/. To open
13 | the main page of the documentation, open the file /doc/api_reference/index.html in
14 | an html browser.
15 |
16 |
17 | Windows:
18 | --------
19 |
20 | 1) Download and install a recent Doxygen (preferably version 1.3.4 or later). See
21 | http://www.doxygen.org/.
22 | 2) Download and install a recent version of GraphViz. See
23 | http://www.research.att.com/sw/tools/graphviz/.
24 | 3) If needed, edit the config.doxy file in an ascii text editor so that
25 | ``DOT_PATH'' variable points to the folder where GraphViz is installed.
26 | 4) Run ``doxygen config.doxy'' in this directory or load and generate the file
27 | config.doxy from the Doxywizard application.
28 |
29 | The generated html documentation will be placed in /doc/api_reference/. To open
30 | the main page of the documentation, open the file /doc/api_reference/index.html in
31 | an html browser.
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/portaudio/cmake_support/FindDXSDK.cmake:
--------------------------------------------------------------------------------
1 | # $Id: $
2 | #
3 | # - Try to find the DirectX SDK
4 | # Once done this will define
5 | #
6 | # DXSDK_FOUND - system has DirectX SDK
7 | # DXSDK_ROOT_DIR - path to the DirectX SDK base directory
8 | # DXSDK_INCLUDE_DIR - the DirectX SDK include directory
9 | # DXSDK_LIBRARY_DIR - DirectX SDK libraries path
10 | #
11 | # DXSDK_DSOUND_LIBRARY - Path to dsound.lib
12 | #
13 |
14 | if(WIN32)
15 | else(WIN32)
16 | message(FATAL_ERROR "FindDXSDK.cmake: Unsupported platform ${CMAKE_SYSTEM_NAME}" )
17 | endif(WIN32)
18 |
19 | find_path(DXSDK_ROOT_DIR
20 | include/dxsdkver.h
21 | HINTS
22 | $ENV{DXSDK_DIR}
23 | )
24 |
25 | find_path(DXSDK_INCLUDE_DIR
26 | dxsdkver.h
27 | PATHS
28 | ${DXSDK_ROOT_DIR}/include
29 | )
30 |
31 | IF(CMAKE_CL_64)
32 | find_path(DXSDK_LIBRARY_DIR
33 | dsound.lib
34 | PATHS
35 | ${DXSDK_ROOT_DIR}/lib/x64
36 | )
37 | ELSE(CMAKE_CL_64)
38 | find_path(DXSDK_LIBRARY_DIR
39 | dsound.lib
40 | PATHS
41 | ${DXSDK_ROOT_DIR}/lib/x86
42 | )
43 | ENDIF(CMAKE_CL_64)
44 |
45 | find_library(DXSDK_DSOUND_LIBRARY
46 | dsound.lib
47 | PATHS
48 | ${DXSDK_LIBRARY_DIR}
49 | )
50 |
51 | # handle the QUIETLY and REQUIRED arguments and set DXSDK_FOUND to TRUE if
52 | # all listed variables are TRUE
53 | INCLUDE(FindPackageHandleStandardArgs)
54 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(DXSDK DEFAULT_MSG DXSDK_ROOT_DIR DXSDK_INCLUDE_DIR)
55 |
56 | MARK_AS_ADVANCED(
57 | DXSDK_ROOT_DIR DXSDK_INCLUDE_DIR
58 | DXSDK_LIBRARY_DIR DXSDK_DSOUND_LIBRARY
59 | )
60 |
--------------------------------------------------------------------------------
/portaudio/examples/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Example projects
2 |
3 | MACRO(ADD_EXAMPLE appl_name)
4 | ADD_EXECUTABLE(${appl_name} "${appl_name}.c")
5 | TARGET_LINK_LIBRARIES(${appl_name} portaudio_static)
6 | SET_TARGET_PROPERTIES(${appl_name} PROPERTIES FOLDER "Examples C")
7 | IF(WIN32)
8 | SET_PROPERTY(TARGET ${appl_name} APPEND_STRING PROPERTY COMPILE_DEFINITIONS _CRT_SECURE_NO_WARNINGS)
9 | ENDIF()
10 | ENDMACRO(ADD_EXAMPLE)
11 |
12 | MACRO(ADD_EXAMPLE_CPP appl_name)
13 | ADD_EXECUTABLE(${appl_name} "${appl_name}.cpp")
14 | TARGET_LINK_LIBRARIES(${appl_name} portaudio_static)
15 | SET_TARGET_PROPERTIES(${appl_name} PROPERTIES FOLDER "Examples C++")
16 | IF(WIN32)
17 | SET_PROPERTY(TARGET ${appl_name} APPEND_STRING PROPERTY COMPILE_DEFINITIONS _CRT_SECURE_NO_WARNINGS)
18 | ENDIF()
19 | ENDMACRO(ADD_EXAMPLE_CPP)
20 |
21 | ADD_EXAMPLE(pa_devs)
22 | ADD_EXAMPLE(pa_fuzz)
23 | IF(PA_USE_ASIO AND WIN32)
24 | ADD_EXAMPLE(paex_mono_asio_channel_select)
25 | ENDIF()
26 | ADD_EXAMPLE(paex_ocean_shore)
27 | TARGET_INCLUDE_DIRECTORIES(paex_ocean_shore PRIVATE ../src/common)
28 | ADD_EXAMPLE(paex_pink)
29 | ADD_EXAMPLE(paex_read_write_wire)
30 | ADD_EXAMPLE(paex_record)
31 | ADD_EXAMPLE(paex_record_file)
32 | TARGET_INCLUDE_DIRECTORIES(paex_record_file PRIVATE ../src/common)
33 | ADD_EXAMPLE(paex_saw)
34 | ADD_EXAMPLE(paex_sine)
35 | ADD_EXAMPLE_CPP(paex_sine_c++)
36 | IF(PA_USE_WMME AND WIN32)
37 | ADD_EXAMPLE(paex_wmme_ac3)
38 | ADD_EXAMPLE(paex_wmme_surround)
39 | ENDIF()
40 | ADD_EXAMPLE(paex_write_sine)
41 | ADD_EXAMPLE(paex_write_sine_nonint)
42 |
--------------------------------------------------------------------------------
/portaudio/bindings/cpp/configure.ac:
--------------------------------------------------------------------------------
1 | #
2 | # PortAudioCpp V19 autoconf input file
3 | # Shamelessly ripped from the PortAudio one by Dominic Mazzoni
4 | # Ludwig Schwardt
5 | # Customized for automake by Mikael Magnusson
6 | #
7 |
8 | # Require autoconf >= 2.13
9 | AC_PREREQ(2.13)
10 |
11 | m4_define([lt_current], [0])
12 | m4_define([lt_revision], [12])
13 | m4_define([lt_age], [0])
14 |
15 | AC_INIT([PortAudioCpp], [12])
16 | AC_CONFIG_SRCDIR([include/portaudiocpp/PortAudioCpp.hxx])
17 | AM_INIT_AUTOMAKE
18 | AM_MAINTAINER_MODE
19 |
20 | ###### Top-level directory of pacpp
21 | ###### This makes it easy to shuffle the build directories
22 | ###### Also edit AC_CONFIG_SRCDIR above (wouldn't accept this variable)!
23 | PACPP_ROOT="\$(top_srcdir)"
24 | PORTAUDIO_ROOT="../.."
25 |
26 | # Various other variables and flags
27 | DEFAULT_INCLUDES="-I$PACPP_ROOT/include -I$PACPP_ROOT/$PORTAUDIO_ROOT/include"
28 | CFLAGS=${CFLAGS-"-g -O2 -Wall -ansi -pedantic"}
29 | CXXFLAGS=${CXXFLAGS-"${CFLAGS}"}
30 |
31 | LT_VERSION_INFO="lt_current:lt_revision:lt_age"
32 |
33 | # Checks for programs
34 |
35 | AC_PROG_CC
36 | AC_PROG_CXX
37 | AC_LIBTOOL_WIN32_DLL
38 | AC_PROG_LIBTOOL
39 |
40 | # Transfer these variables to the Makefile
41 | AC_SUBST(DEFAULT_INCLUDES)
42 | AC_SUBST(PORTAUDIO_ROOT)
43 | AC_SUBST(CXXFLAGS)
44 | AC_SUBST(LT_VERSION_INFO)
45 |
46 | AC_CONFIG_FILES([
47 | Makefile
48 | lib/Makefile
49 | include/Makefile
50 | bin/Makefile
51 | doc/Makefile
52 | portaudiocpp.pc
53 | ])
54 | AC_OUTPUT
55 |
--------------------------------------------------------------------------------
/portaudio/bindings/cpp/source/portaudiocpp/SystemDeviceIterator.cxx:
--------------------------------------------------------------------------------
1 | #include "portaudiocpp/SystemDeviceIterator.hxx"
2 |
3 | namespace portaudio
4 | {
5 | // -----------------------------------------------------------------------------------
6 |
7 | Device &System::DeviceIterator::operator*() const
8 | {
9 | return **ptr_;
10 | }
11 |
12 | Device *System::DeviceIterator::operator->() const
13 | {
14 | return &**this;
15 | }
16 |
17 | // -----------------------------------------------------------------------------------
18 |
19 | System::DeviceIterator &System::DeviceIterator::operator++()
20 | {
21 | ++ptr_;
22 | return *this;
23 | }
24 |
25 | System::DeviceIterator System::DeviceIterator::operator++(int)
26 | {
27 | System::DeviceIterator prev = *this;
28 | ++*this;
29 | return prev;
30 | }
31 |
32 | System::DeviceIterator &System::DeviceIterator::operator--()
33 | {
34 | --ptr_;
35 | return *this;
36 | }
37 |
38 | System::DeviceIterator System::DeviceIterator::operator--(int)
39 | {
40 | System::DeviceIterator prev = *this;
41 | --*this;
42 | return prev;
43 | }
44 |
45 | // -----------------------------------------------------------------------------------
46 |
47 | bool System::DeviceIterator::operator==(const System::DeviceIterator &rhs) const
48 | {
49 | return (ptr_ == rhs.ptr_);
50 | }
51 |
52 | bool System::DeviceIterator::operator!=(const System::DeviceIterator &rhs) const
53 | {
54 | return !(*this == rhs);
55 | }
56 |
57 | // -----------------------------------------------------------------------------------
58 | } // namespace portaudio
59 |
60 |
61 |
--------------------------------------------------------------------------------
/portaudio/bindings/cpp/source/portaudiocpp/SystemHostApiIterator.cxx:
--------------------------------------------------------------------------------
1 | #include "portaudiocpp/SystemHostApiIterator.hxx"
2 |
3 | namespace portaudio
4 | {
5 | // -----------------------------------------------------------------------------------
6 |
7 | HostApi &System::HostApiIterator::operator*() const
8 | {
9 | return **ptr_;
10 | }
11 |
12 | HostApi *System::HostApiIterator::operator->() const
13 | {
14 | return &**this;
15 | }
16 |
17 | // -----------------------------------------------------------------------------------
18 |
19 | System::HostApiIterator &System::HostApiIterator::operator++()
20 | {
21 | ++ptr_;
22 | return *this;
23 | }
24 |
25 | System::HostApiIterator System::HostApiIterator::operator++(int)
26 | {
27 | System::HostApiIterator prev = *this;
28 | ++*this;
29 | return prev;
30 | }
31 |
32 | System::HostApiIterator &System::HostApiIterator::operator--()
33 | {
34 | --ptr_;
35 | return *this;
36 | }
37 |
38 | System::HostApiIterator System::HostApiIterator::operator--(int)
39 | {
40 | System::HostApiIterator prev = *this;
41 | --*this;
42 | return prev;
43 | }
44 |
45 | // -----------------------------------------------------------------------------------
46 |
47 | bool System::HostApiIterator::operator==(const System::HostApiIterator &rhs) const
48 | {
49 | return (ptr_ == rhs.ptr_);
50 | }
51 |
52 | bool System::HostApiIterator::operator!=(const System::HostApiIterator &rhs) const
53 | {
54 | return !(*this == rhs);
55 | }
56 |
57 | // -----------------------------------------------------------------------------------
58 | } // namespace portaudio
59 |
60 |
--------------------------------------------------------------------------------
/portaudio/bindings/cpp/include/portaudiocpp/InterfaceCallbackStream.hxx:
--------------------------------------------------------------------------------
1 | #ifndef INCLUDED_PORTAUDIO_INTERFACECALLBACKSTREAM_HXX
2 | #define INCLUDED_PORTAUDIO_INTERFACECALLBACKSTREAM_HXX
3 |
4 | // ---------------------------------------------------------------------------------------
5 |
6 | #include "portaudio.h"
7 |
8 | #include "portaudiocpp/CallbackStream.hxx"
9 |
10 | // ---------------------------------------------------------------------------------------
11 |
12 | // Forward declaration(s)
13 | namespace portaudio
14 | {
15 | class StreamParameters;
16 | class CallbackInterface;
17 | }
18 |
19 | // ---------------------------------------------------------------------------------------
20 |
21 | // Declaration(s):
22 | namespace portaudio
23 | {
24 |
25 |
26 | //////
27 | /// @brief Callback stream using an instance of an object that's derived from the CallbackInterface
28 | /// interface.
29 | //////
30 | class InterfaceCallbackStream : public CallbackStream
31 | {
32 | public:
33 | InterfaceCallbackStream();
34 | InterfaceCallbackStream(const StreamParameters ¶meters, CallbackInterface &instance);
35 | ~InterfaceCallbackStream();
36 |
37 | void open(const StreamParameters ¶meters, CallbackInterface &instance);
38 |
39 | private:
40 | InterfaceCallbackStream(const InterfaceCallbackStream &); // non-copyable
41 | InterfaceCallbackStream &operator=(const InterfaceCallbackStream &); // non-copyable
42 | };
43 |
44 |
45 | } // portaudio
46 |
47 | // ---------------------------------------------------------------------------------------
48 |
49 | #endif // INCLUDED_PORTAUDIO_INTERFACECALLBACKSTREAM_HXX
50 |
--------------------------------------------------------------------------------
/portaudio/bindings/cpp/build/vc7_1/devs_example.sln:
--------------------------------------------------------------------------------
1 | Microsoft Visual Studio Solution File, Format Version 8.00
2 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "devs_example", "devs_example.vcproj", "{1B9A038D-80A3-4DBD-9F0D-AF10B49B863A}"
3 | ProjectSection(ProjectDependencies) = postProject
4 | {D18EA0C9-8C65-441D-884C-55EB43A84F2A} = {D18EA0C9-8C65-441D-884C-55EB43A84F2A}
5 | EndProjectSection
6 | EndProject
7 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "static_library", "static_library.vcproj", "{D18EA0C9-8C65-441D-884C-55EB43A84F2A}"
8 | ProjectSection(ProjectDependencies) = postProject
9 | EndProjectSection
10 | EndProject
11 | Global
12 | GlobalSection(SolutionConfiguration) = preSolution
13 | Debug = Debug
14 | Release = Release
15 | EndGlobalSection
16 | GlobalSection(ProjectConfiguration) = postSolution
17 | {1B9A038D-80A3-4DBD-9F0D-AF10B49B863A}.Debug.ActiveCfg = Debug|Win32
18 | {1B9A038D-80A3-4DBD-9F0D-AF10B49B863A}.Debug.Build.0 = Debug|Win32
19 | {1B9A038D-80A3-4DBD-9F0D-AF10B49B863A}.Release.ActiveCfg = Release|Win32
20 | {1B9A038D-80A3-4DBD-9F0D-AF10B49B863A}.Release.Build.0 = Release|Win32
21 | {D18EA0C9-8C65-441D-884C-55EB43A84F2A}.Debug.ActiveCfg = Debug|Win32
22 | {D18EA0C9-8C65-441D-884C-55EB43A84F2A}.Debug.Build.0 = Debug|Win32
23 | {D18EA0C9-8C65-441D-884C-55EB43A84F2A}.Release.ActiveCfg = Release|Win32
24 | {D18EA0C9-8C65-441D-884C-55EB43A84F2A}.Release.Build.0 = Release|Win32
25 | EndGlobalSection
26 | GlobalSection(ExtensibilityGlobals) = postSolution
27 | EndGlobalSection
28 | GlobalSection(ExtensibilityAddIns) = postSolution
29 | EndGlobalSection
30 | EndGlobal
31 |
--------------------------------------------------------------------------------
/portaudio/bindings/cpp/build/vc7_1/sine_example.sln:
--------------------------------------------------------------------------------
1 | Microsoft Visual Studio Solution File, Format Version 8.00
2 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sine_example", "sine_example.vcproj", "{1B9A038D-80A3-4DBD-9F0D-AF10B49B863A}"
3 | ProjectSection(ProjectDependencies) = postProject
4 | {D18EA0C9-8C65-441D-884C-55EB43A84F2A} = {D18EA0C9-8C65-441D-884C-55EB43A84F2A}
5 | EndProjectSection
6 | EndProject
7 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "static_library", "static_library.vcproj", "{D18EA0C9-8C65-441D-884C-55EB43A84F2A}"
8 | ProjectSection(ProjectDependencies) = postProject
9 | EndProjectSection
10 | EndProject
11 | Global
12 | GlobalSection(SolutionConfiguration) = preSolution
13 | Debug = Debug
14 | Release = Release
15 | EndGlobalSection
16 | GlobalSection(ProjectConfiguration) = postSolution
17 | {1B9A038D-80A3-4DBD-9F0D-AF10B49B863A}.Debug.ActiveCfg = Debug|Win32
18 | {1B9A038D-80A3-4DBD-9F0D-AF10B49B863A}.Debug.Build.0 = Debug|Win32
19 | {1B9A038D-80A3-4DBD-9F0D-AF10B49B863A}.Release.ActiveCfg = Release|Win32
20 | {1B9A038D-80A3-4DBD-9F0D-AF10B49B863A}.Release.Build.0 = Release|Win32
21 | {D18EA0C9-8C65-441D-884C-55EB43A84F2A}.Debug.ActiveCfg = Debug|Win32
22 | {D18EA0C9-8C65-441D-884C-55EB43A84F2A}.Debug.Build.0 = Debug|Win32
23 | {D18EA0C9-8C65-441D-884C-55EB43A84F2A}.Release.ActiveCfg = Release|Win32
24 | {D18EA0C9-8C65-441D-884C-55EB43A84F2A}.Release.Build.0 = Release|Win32
25 | EndGlobalSection
26 | GlobalSection(ExtensibilityGlobals) = postSolution
27 | EndGlobalSection
28 | GlobalSection(ExtensibilityAddIns) = postSolution
29 | EndGlobalSection
30 | EndGlobal
31 |
--------------------------------------------------------------------------------
/portaudio/bindings/cpp/COPYING:
--------------------------------------------------------------------------------
1 | PortAudio Portable Real-Time Audio Library
2 | Copyright (c) 1999-2006 Ross Bencina and Phil Burk
3 |
4 | Permission is hereby granted, free of charge, to any person obtaining
5 | a copy of this software and associated documentation files
6 | (the "Software"), to deal in the Software without restriction,
7 | including without limitation the rights to use, copy, modify, merge,
8 | publish, distribute, sublicense, and/or sell copies of the Software,
9 | and to permit persons to whom the Software is furnished to do so,
10 | subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be
13 | included in all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
19 | ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
20 | CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 |
23 |
24 | The text above constitutes the entire PortAudio license; however,
25 | the PortAudio community also makes the following non-binding requests:
26 |
27 | Any person wishing to distribute modifications to the Software is
28 | requested to send the modifications to the original developer so that
29 | they can be incorporated into the canonical version. It is also
30 | requested that these non-binding requests be included along with the
31 | license above.
32 |
--------------------------------------------------------------------------------
/portaudio/bindings/cpp/include/portaudiocpp/CallbackInterface.hxx:
--------------------------------------------------------------------------------
1 | #ifndef INCLUDED_PORTAUDIO_CALLBACKINTERFACE_HXX
2 | #define INCLUDED_PORTAUDIO_CALLBACKINTERFACE_HXX
3 |
4 | // ---------------------------------------------------------------------------------------
5 |
6 | #include "portaudio.h"
7 |
8 | // ---------------------------------------------------------------------------------------
9 |
10 | namespace portaudio
11 | {
12 | // -----------------------------------------------------------------------------------
13 |
14 | //////
15 | /// @brief Interface for an object that's callable as a PortAudioCpp callback object (ie that implements the
16 | /// paCallbackFun method).
17 | //////
18 | class CallbackInterface
19 | {
20 | public:
21 | virtual ~CallbackInterface() {}
22 |
23 | virtual int paCallbackFun(const void *inputBuffer, void *outputBuffer, unsigned long numFrames,
24 | const PaStreamCallbackTimeInfo *timeInfo, PaStreamCallbackFlags statusFlags) = 0;
25 | };
26 |
27 | // -----------------------------------------------------------------------------------
28 |
29 | namespace impl
30 | {
31 | extern "C"
32 | {
33 | int callbackInterfaceToPaCallbackAdapter(const void *inputBuffer, void *outputBuffer, unsigned long numFrames,
34 | const PaStreamCallbackTimeInfo *timeInfo, PaStreamCallbackFlags statusFlags,
35 | void *userData);
36 | } // extern "C"
37 | }
38 |
39 | // -----------------------------------------------------------------------------------
40 |
41 | } // namespace portaudio
42 |
43 | // ---------------------------------------------------------------------------------------
44 |
45 | #endif // INCLUDED_PORTAUDIO_CALLBACKINTERFACE_HXX
46 |
--------------------------------------------------------------------------------
/portaudio/doc/src/license.dox:
--------------------------------------------------------------------------------
1 | /** @page License PortAudio License
2 |
3 | PortAudio Portable Real-Time Audio Library
4 | Copyright (c) 1999-2011 Ross Bencina, Phil Burk
5 |
6 |
7 |
8 | Permission is hereby granted, free of charge, to any person obtaining
9 | a copy of this software and associated documentation files
10 | (the "Software"), to deal in the Software without restriction,
11 | including without limitation the rights to use, copy, modify, merge,
12 | publish, distribute, sublicense, and/or sell copies of the Software,
13 | and to permit persons to whom the Software is furnished to do so,
14 | subject to the following conditions:
15 |
16 | The above copyright notice and this permission notice shall be
17 | included in all copies or substantial portions of the Software.
18 |
19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
22 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
23 | ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
24 | CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
25 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 |
27 |
28 |
29 | The text above constitutes the entire PortAudio license; however,
30 | the PortAudio community also makes the following non-binding requests:
31 |
32 | Any person wishing to distribute modifications to the Software is
33 | requested to send the modifications to the original developer so that
34 | they can be incorporated into the canonical version. It is also
35 | requested that these non-binding requests be included along with the
36 | license above.
37 |
38 | */
--------------------------------------------------------------------------------
/portaudio/test/README.txt:
--------------------------------------------------------------------------------
1 | TODO - This should be moved into a doxydoc page.
2 |
3 | For more information on the TestPlan please visit:
4 |
5 | http://www.portaudio.com/trac/wiki/TestPlan
6 |
7 | This directory contains various programs to test PortAudio. The files
8 | named patest_* are tests.
9 |
10 | All following tests are up to date with the V19 API. They should all compile
11 | (without any warnings on GCC 3.3). Note that this does not necessarily mean that
12 | the tests pass, just that they compile.
13 |
14 | x- paqa_devs.c
15 | x- paqa_errs.c (needs reviewing)
16 | x- patest1.c
17 | x- patest_buffer.c
18 | x- patest_callbackstop.c
19 | x- patest_clip.c (last test fails, dither doesn't currently force clip in V19)
20 | x- patest_dither.c
21 | x- patest_hang.c
22 | x- patest_latency.c
23 | x- patest_leftright.c
24 | x- patest_longsine.c
25 | x- patest_many.c
26 | x- patest_maxsines.c
27 | x- patest_mono.c
28 | x- patest_multi_sine.c
29 | x- patest_pink.c
30 | x- patest_prime.c
31 | x- patest_read_record.c
32 | x- patest_record.c
33 | x- patest_ringmix.c
34 | x- patest_saw.c
35 | x- patest_sine.c
36 | x- patest_sine8.c
37 | x- patest_sine_formats.c
38 | x- patest_sine_time.c
39 | x- patest_start_stop.c
40 | x- patest_stop.c
41 | x- patest_sync.c
42 | x- patest_toomanysines.c
43 | x- patest_two_rates.c
44 | x- patest_underflow.c
45 | x- patest_wire.c
46 | x- patest_write_sine.c
47 | x- pa_devs.c
48 | x- pa_fuzz.c
49 | x- pa_minlat.c
50 |
51 | Note that Phil Burk deleted the debug_* tests on 2/26/11. They were just hacked
52 | versions of old V18 tests. If we need to debug then we can just hack a working V19 test.
53 |
--------------------------------------------------------------------------------
/portaudio/bindings/cpp/include/portaudiocpp/CFunCallbackStream.hxx:
--------------------------------------------------------------------------------
1 | #ifndef INCLUDED_PORTAUDIO_CFUNCALLBACKSTREAM_HXX
2 | #define INCLUDED_PORTAUDIO_CFUNCALLBACKSTREAM_HXX
3 |
4 | // ---------------------------------------------------------------------------------------
5 |
6 | #include "portaudio.h"
7 |
8 | #include "portaudiocpp/CallbackStream.hxx"
9 |
10 | // ---------------------------------------------------------------------------------------
11 |
12 | // Forward declaration(s)
13 | namespace portaudio
14 | {
15 | class StreamParameters;
16 | }
17 |
18 | // ---------------------------------------------------------------------------------------
19 |
20 | // Declaration(s):
21 | namespace portaudio
22 | {
23 | // -----------------------------------------------------------------------------------
24 |
25 | //////
26 | /// @brief Callback stream using a free function with C linkage. It's important that the function
27 | /// the passed function pointer points to is declared ``extern "C"''.
28 | //////
29 | class CFunCallbackStream : public CallbackStream
30 | {
31 | public:
32 | CFunCallbackStream();
33 | CFunCallbackStream(const StreamParameters ¶meters, PaStreamCallback *funPtr, void *userData);
34 | ~CFunCallbackStream();
35 |
36 | void open(const StreamParameters ¶meters, PaStreamCallback *funPtr, void *userData);
37 |
38 | private:
39 | CFunCallbackStream(const CFunCallbackStream &); // non-copyable
40 | CFunCallbackStream &operator=(const CFunCallbackStream &); // non-copyable
41 | };
42 |
43 | // -----------------------------------------------------------------------------------
44 | } // portaudio
45 |
46 | // ---------------------------------------------------------------------------------------
47 |
48 | #endif // INCLUDED_PORTAUDIO_MEMFUNCALLBACKSTREAM_HXX
49 |
50 |
--------------------------------------------------------------------------------
/portaudio/bindings/cpp/include/portaudiocpp/SystemHostApiIterator.hxx:
--------------------------------------------------------------------------------
1 | #ifndef INCLUDED_PORTAUDIO_SYSTEMHOSTAPIITERATOR_HXX
2 | #define INCLUDED_PORTAUDIO_SYSTEMHOSTAPIITERATOR_HXX
3 |
4 | // ---------------------------------------------------------------------------------------
5 |
6 | #include
7 | #include
8 |
9 | #include "portaudiocpp/System.hxx"
10 |
11 | // ---------------------------------------------------------------------------------------
12 |
13 | // Forward declaration(s):
14 | namespace portaudio
15 | {
16 | class HostApi;
17 | }
18 |
19 | // ---------------------------------------------------------------------------------------
20 |
21 | // Declaration(s):
22 | namespace portaudio
23 | {
24 |
25 |
26 | //////
27 | /// @brief Iterator class for iterating through all HostApis in a System.
28 | ///
29 | /// Compliant with the STL bidirectional iterator concept.
30 | //////
31 | class System::HostApiIterator
32 | {
33 | public:
34 | typedef std::bidirectional_iterator_tag iterator_category;
35 | typedef Device value_type;
36 | typedef ptrdiff_t difference_type;
37 | typedef HostApi * pointer;
38 | typedef HostApi & reference;
39 |
40 | HostApi &operator*() const;
41 | HostApi *operator->() const;
42 |
43 | HostApiIterator &operator++();
44 | HostApiIterator operator++(int);
45 | HostApiIterator &operator--();
46 | HostApiIterator operator--(int);
47 |
48 | bool operator==(const HostApiIterator &rhs) const;
49 | bool operator!=(const HostApiIterator &rhs) const;
50 |
51 | private:
52 | friend class System;
53 | HostApi **ptr_;
54 | };
55 |
56 |
57 | } // namespace portaudio
58 |
59 | // ---------------------------------------------------------------------------------------
60 |
61 | #endif // INCLUDED_PORTAUDIO_SYSTEMHOSTAPIITERATOR_HXX
62 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Capture-Audio-From-Mic
2 | Capture-Audio-From-Micは、ホストに接続された録音デバイスを認識し、これから受取ったストリーミング音声データをwavファイルに変換するマイクロサービスです。
3 | 主に使用するモジュール、ライブラリーとして、`PyAudio`および`portaudio`が入っています。PyAudioは、`requirements.txt` にダウンロードするべきバージョンが記載されています。
4 | Capture-Audio-From-Micには、通常のjobとして実行されるmain_without_kanbanと、pod上で運用することを前提としているmain_with_kanban_multipleが含まれています。
5 |
6 | ## 動作環境
7 | Capture-Audio-From-Micは、aion-core 上での動作を前提としており、下記動作環境が必要となります。
8 |
9 | - OS: Linux Ubuntu OS
10 | - CPU: ARM/AMD/Intel
11 | - Kubernetes
12 | - AION のリソース
13 |
14 |
15 | 最低限スペック
16 | - CPU: 2 core
17 | - memory: 4 GB
18 |
19 |
20 | ## 録音設定
21 | ### main_without_kanban
22 |
23 | | パラメーター名 | 設定値 |
24 | | :---------------: | :--------------: |
25 | | sampling_rate(Hz) | 32000 |
26 | | chunk | 4096 |
27 | | rec_time(sec) | 60 |
28 |
29 | ### main_with_kanban_multiple
30 |
31 | | パラメーター名 | 設定値 |
32 | | :---------------: | :--------------: |
33 | | sampling_rate(Hz) | 32000 |
34 | | chunk | 8192 |
35 |
36 | ※ … main_with_kanban_multipleでは、kanbanによって送られる開始信号によって録音が始まり、終了信号によって録音が終了します。
37 |
38 | ## 起動方法
39 | このリポジトリをクローンし、以下のコマンドよりサービスを起動してください。
40 |
41 | ```
42 | $ cd ~/path/to/capture-audio-from-mic
43 | $ bash docker-build.sh
44 | ```
45 |
46 |
47 | ## Input
48 | USBで接続されたUSBマイク
49 | 1pod につき1台のマイクが接続可能です。
50 | 理論上は、podの数だけ増やすことができます。
51 | main_without_kanbanは、通常のjobとして実行することが可能です。
52 | main_with_kanban_multipleは、kanbanから指示をデータとして受取り、録音を実行します。
53 | ### データフォーマット
54 | 録音開始: `status:0`
55 | 録音停止: `status:1`
56 |
57 | ## Output
58 | - wavファイル
59 | - output_kanban
60 | コンテナ上では`/var/lib/aion/Data/capture-audio-from-mic_1` へwavファイルが出力されます。
61 | k8sへのデプロイ時にこのパスに対応したマウントディレクトリを指定する必要があります。
62 |
--------------------------------------------------------------------------------
/portaudio/bindings/cpp/include/portaudiocpp/AutoSystem.hxx:
--------------------------------------------------------------------------------
1 | #ifndef INCLUDED_PORTAUDIO_AUTOSYSTEM_HXX
2 | #define INCLUDED_PORTAUDIO_AUTOSYSTEM_HXX
3 |
4 | // ---------------------------------------------------------------------------------------
5 |
6 | #include "portaudiocpp/System.hxx"
7 |
8 | // ---------------------------------------------------------------------------------------
9 |
10 | namespace portaudio
11 | {
12 |
13 |
14 | //////
15 | /// @brief A RAII idiom class to ensure automatic clean-up when an exception is
16 | /// raised.
17 | ///
18 | /// A simple helper class which uses the 'Resource Acquisition is Initialization'
19 | /// idiom (RAII). Use this class to initialize/terminate the System rather than
20 | /// using System directly. AutoSystem must be created on stack and must be valid
21 | /// throughout the time you wish to use PortAudioCpp. Your 'main' function might be
22 | /// a good place for it.
23 | ///
24 | /// To avoid having to type portaudio::System::instance().xyz() all the time, it's usually
25 | /// a good idea to make a reference to the System which can be accessed directly.
26 | /// @verbatim
27 | /// portaudio::AutoSys autoSys;
28 | /// portaudio::System &sys = portaudio::System::instance();
29 | /// @endverbatim
30 | //////
31 | class AutoSystem
32 | {
33 | public:
34 | AutoSystem(bool initialize = true)
35 | {
36 | if (initialize)
37 | System::initialize();
38 | }
39 |
40 | ~AutoSystem()
41 | {
42 | if (System::exists())
43 | System::terminate();
44 | }
45 |
46 | void initialize()
47 | {
48 | System::initialize();
49 | }
50 |
51 | void terminate()
52 | {
53 | System::terminate();
54 | }
55 | };
56 |
57 |
58 | } // namespace portaudio
59 |
60 | // ---------------------------------------------------------------------------------------
61 |
62 | #endif // INCLUDED_PORTAUDIO_AUTOSYSTEM_HXX
63 |
--------------------------------------------------------------------------------
/portaudio/build/msvc/portaudio.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 9.00
3 | # Visual Studio 2005
4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "portaudio", "portaudio.vcproj", "{0A18A071-125E-442F-AFF7-A3F68ABECF99}"
5 | EndProject
6 | Global
7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
8 | Debug|Win32 = Debug|Win32
9 | Debug|x64 = Debug|x64
10 | Release|Win32 = Release|Win32
11 | Release|x64 = Release|x64
12 | ReleaseMinDependency|Win32 = ReleaseMinDependency|Win32
13 | ReleaseMinDependency|x64 = ReleaseMinDependency|x64
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {0A18A071-125E-442F-AFF7-A3F68ABECF99}.Debug|Win32.ActiveCfg = Debug|Win32
17 | {0A18A071-125E-442F-AFF7-A3F68ABECF99}.Debug|Win32.Build.0 = Debug|Win32
18 | {0A18A071-125E-442F-AFF7-A3F68ABECF99}.Debug|x64.ActiveCfg = Debug|x64
19 | {0A18A071-125E-442F-AFF7-A3F68ABECF99}.Debug|x64.Build.0 = Debug|x64
20 | {0A18A071-125E-442F-AFF7-A3F68ABECF99}.Release|Win32.ActiveCfg = Release|Win32
21 | {0A18A071-125E-442F-AFF7-A3F68ABECF99}.Release|Win32.Build.0 = Release|Win32
22 | {0A18A071-125E-442F-AFF7-A3F68ABECF99}.Release|x64.ActiveCfg = Release|x64
23 | {0A18A071-125E-442F-AFF7-A3F68ABECF99}.Release|x64.Build.0 = Release|x64
24 | {0A18A071-125E-442F-AFF7-A3F68ABECF99}.ReleaseMinDependency|Win32.ActiveCfg = ReleaseMinDependency|Win32
25 | {0A18A071-125E-442F-AFF7-A3F68ABECF99}.ReleaseMinDependency|Win32.Build.0 = ReleaseMinDependency|Win32
26 | {0A18A071-125E-442F-AFF7-A3F68ABECF99}.ReleaseMinDependency|x64.ActiveCfg = ReleaseMinDependency|x64
27 | {0A18A071-125E-442F-AFF7-A3F68ABECF99}.ReleaseMinDependency|x64.Build.0 = ReleaseMinDependency|x64
28 | EndGlobalSection
29 | GlobalSection(SolutionProperties) = preSolution
30 | HideSolutionNode = FALSE
31 | EndGlobalSection
32 | EndGlobal
33 |
--------------------------------------------------------------------------------
/portaudio/bindings/cpp/include/portaudiocpp/SystemDeviceIterator.hxx:
--------------------------------------------------------------------------------
1 | #ifndef INCLUDED_PORTAUDIO_SYSTEMDEVICEITERATOR_HXX
2 | #define INCLUDED_PORTAUDIO_SYSTEMDEVICEITERATOR_HXX
3 |
4 | // ---------------------------------------------------------------------------------------
5 |
6 | #include
7 | #include
8 |
9 | #include "portaudiocpp/System.hxx"
10 |
11 | // ---------------------------------------------------------------------------------------
12 |
13 | // Forward declaration(s):
14 | namespace portaudio
15 | {
16 | class Device;
17 | class HostApi;
18 | }
19 |
20 | // ---------------------------------------------------------------------------------------
21 |
22 | // Declaration(s):
23 | namespace portaudio
24 | {
25 |
26 |
27 | //////
28 | /// @brief Iterator class for iterating through all Devices in a System.
29 | ///
30 | /// Devices will be iterated by iterating all Devices in each
31 | /// HostApi in the System. Compliant with the STL bidirectional
32 | /// iterator concept.
33 | //////
34 | class System::DeviceIterator
35 | {
36 | public:
37 | typedef std::bidirectional_iterator_tag iterator_category;
38 | typedef Device value_type;
39 | typedef ptrdiff_t difference_type;
40 | typedef Device * pointer;
41 | typedef Device & reference;
42 |
43 | Device &operator*() const;
44 | Device *operator->() const;
45 |
46 | DeviceIterator &operator++();
47 | DeviceIterator operator++(int);
48 | DeviceIterator &operator--();
49 | DeviceIterator operator--(int);
50 |
51 | bool operator==(const DeviceIterator &rhs) const;
52 | bool operator!=(const DeviceIterator &rhs) const;
53 |
54 | private:
55 | friend class System;
56 | friend class HostApi;
57 | Device **ptr_;
58 | };
59 |
60 |
61 | } // namespace portaudio
62 |
63 | // ---------------------------------------------------------------------------------------
64 |
65 | #endif // INCLUDED_PORTAUDIO_SYSTEMDEVICEITERATOR_HXX
66 |
67 |
--------------------------------------------------------------------------------
/portaudio/doc/src/tutorial/compile_cmake.dox:
--------------------------------------------------------------------------------
1 | /** @page compile_cmake Creating MSVC Build Files via CMake
2 | @ingroup tutorial
3 |
4 | This is a simple "How-to" for creating build files for Microsoft Visual C++ via CMake and the CMakeLists.txt file
5 |
6 | 1. Install CMake if you haven't got it already ([http://www.cmake.org], minimum version required is 2.8).
7 |
8 | 2. If you want ASIO support you need to D/L the ASIO2 SDK from Steinberg, and place it according to \ref compile_windows_asio_msvc
9 |
10 | 3. Run the CMake GUI application and browse to source files directory and build directory:
11 | a. The source files directory ("Where is the source code") is where the portaudio CMakeLists.txt file is located.
12 | b. The build directory ("Where to build the binaries") is pretty much anywhere you like. A common practice though is to have the build directory located outside the
13 | source files tree (a so called "out-of-source build")
14 |
15 | 4. Click Configure. This will prompt you to select which build files to generate. Note Only Microsoft Visual C++ build files currently supported!
16 |
17 | 5. In the CMake option list, enable the PORTAUDIO_xxx options you need, then click Configure again (Note that after this there are no options marked with red color)
18 |
19 | 6. Click Generate and you'll now (hopefully) have your VS build files in your previously defined build directory.
20 |
21 | 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.
22 |
23 | 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)
24 |
25 | --- Robert Bielik
26 |
27 | Back to the Tutorial: \ref tutorial_start
28 |
29 | */
--------------------------------------------------------------------------------
/portaudio/qa/loopback/src/test_audio_analyzer.h:
--------------------------------------------------------------------------------
1 |
2 | /*
3 | * PortAudio Portable Real-Time Audio Library
4 | * Latest Version at: http://www.portaudio.com
5 | *
6 | * Copyright (c) 1999-2010 Phil Burk and Ross Bencina
7 | *
8 | * Permission is hereby granted, free of charge, to any person obtaining
9 | * a copy of this software and associated documentation files
10 | * (the "Software"), to deal in the Software without restriction,
11 | * including without limitation the rights to use, copy, modify, merge,
12 | * publish, distribute, sublicense, and/or sell copies of the Software,
13 | * and to permit persons to whom the Software is furnished to do so,
14 | * subject to the following conditions:
15 | *
16 | * The above copyright notice and this permission notice shall be
17 | * included in all copies or substantial portions of the Software.
18 | *
19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
22 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
23 | * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
24 | * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
25 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 | */
27 |
28 | /*
29 | * The text above constitutes the entire PortAudio license; however,
30 | * the PortAudio community also makes the following non-binding requests:
31 | *
32 | * Any person wishing to distribute modifications to the Software is
33 | * requested to send the modifications to the original developer so that
34 | * they can be incorporated into the canonical version. It is also
35 | * requested that these non-binding requests be included along with the
36 | * license above.
37 | */
38 |
39 | #ifndef _TEST_AUDIO_ANALYZER_H
40 | #define _TEST_AUDIO_ANALYZER_H
41 |
42 | /** Test the audio analyzer by itself without any PortAudio calls. */
43 | int PaQa_TestAnalyzer( void );
44 |
45 |
46 | #endif /* _TEST_AUDIO_ANALYZER_H */
47 |
--------------------------------------------------------------------------------
/portaudio/doc/src/tutorial/compile_windows_mingw.dox:
--------------------------------------------------------------------------------
1 | /** @page compile_windows_mingw Building Portaudio for Windows with MinGW
2 | @ingroup tutorial
3 |
4 | @section comp_mingw1 Portaudio for Windows With MinGW
5 |
6 | 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
7 |
8 | = MinGW/MSYS =
9 |
10 | From the [http://www.mingw.org MinGW projectpage]:
11 |
12 | MinGW: A collection of freely available and freely distributable
13 | Windows specific header files and import libraries, augmenting
14 | the GNU Compiler Collection, (GCC), and its associated
15 | tools, (GNU binutils). MinGW provides a complete Open Source
16 | programming tool set which is suitable for the development of
17 | native Windows programs that do not depend on any 3rd-party C
18 | runtime DLLs.
19 |
20 | MSYS: A Minimal SYStem providing a POSIX compatible Bourne shell
21 | environment, with a small collection of UNIX command line
22 | tools. Primarily developed as a means to execute the configure
23 | scripts and Makefiles used to build Open Source software, but
24 | also useful as a general purpose command line interface to
25 | replace Windows cmd.exe.
26 |
27 | MinGW provides a compiler/linker toolchain while MSYS is required
28 | to actually run the PortAudio configure script.
29 |
30 | Once MinGW and MSYS are installed (see the [http://www.mingw.org/MinGWiki MinGW-Wiki]) open an MSYS shell and run the famous:
31 |
32 | @code
33 | ./configure
34 | make
35 | make install
36 | @endcode
37 |
38 | The above should create a working version though you might want to
39 | provide '--prefix=' to configure.
40 |
41 | './configure --help' gives details as to what can be tinkered with.
42 |
43 | --- Mikael Magnusson
44 |
45 | To update your copy or check out a fresh copy of the source
46 |
47 | [wiki:UsingThePortAudioSvnRepository SVN instructions]
48 |
49 | --- Bob !McGwier
50 |
51 | Back to the Tutorial: \ref tutorial_start
52 |
53 | */
--------------------------------------------------------------------------------
/portaudio/bindings/cpp/source/portaudiocpp/AsioDeviceAdapter.cxx:
--------------------------------------------------------------------------------
1 | #include "portaudiocpp/AsioDeviceAdapter.hxx"
2 |
3 | #include "portaudio.h"
4 | #include "pa_asio.h"
5 |
6 | #include "portaudiocpp/Device.hxx"
7 | #include "portaudiocpp/HostApi.hxx"
8 | #include "portaudiocpp/Exception.hxx"
9 |
10 | namespace portaudio
11 | {
12 | AsioDeviceAdapter::AsioDeviceAdapter(Device &device)
13 | {
14 | if (device.hostApi().typeId() != paASIO)
15 | throw PaCppException(PaCppException::UNABLE_TO_ADAPT_DEVICE);
16 |
17 | device_ = &device;
18 |
19 | PaError err = PaAsio_GetAvailableLatencyValues(device_->index(), &minBufferSize_, &maxBufferSize_,
20 | &preferredBufferSize_, &granularity_);
21 |
22 | if (err != paNoError)
23 | throw PaException(err);
24 |
25 | }
26 |
27 | Device &AsioDeviceAdapter::device()
28 | {
29 | return *device_;
30 | }
31 |
32 | long AsioDeviceAdapter::minBufferSize() const
33 | {
34 | return minBufferSize_;
35 | }
36 |
37 | long AsioDeviceAdapter::maxBufferSize() const
38 | {
39 | return maxBufferSize_;
40 | }
41 |
42 | long AsioDeviceAdapter::preferredBufferSize() const
43 | {
44 | return preferredBufferSize_;
45 | }
46 |
47 | long AsioDeviceAdapter::granularity() const
48 | {
49 | return granularity_;
50 | }
51 |
52 | void AsioDeviceAdapter::showControlPanel(void *systemSpecific)
53 | {
54 | PaError err = PaAsio_ShowControlPanel(device_->index(), systemSpecific);
55 |
56 | if (err != paNoError)
57 | throw PaException(err);
58 | }
59 |
60 | const char *AsioDeviceAdapter::inputChannelName(int channelIndex) const
61 | {
62 | const char *channelName;
63 | PaError err = PaAsio_GetInputChannelName(device_->index(), channelIndex, &channelName);
64 |
65 | if (err != paNoError)
66 | throw PaException(err);
67 |
68 | return channelName;
69 | }
70 |
71 | const char *AsioDeviceAdapter::outputChannelName(int channelIndex) const
72 | {
73 | const char *channelName;
74 | PaError err = PaAsio_GetOutputChannelName(device_->index(), channelIndex, &channelName);
75 |
76 | if (err != paNoError)
77 | throw PaException(err);
78 |
79 | return channelName;
80 | }
81 | }
82 |
83 |
84 |
--------------------------------------------------------------------------------
/portaudio/build/msvc/portaudio.def:
--------------------------------------------------------------------------------
1 | EXPORTS
2 |
3 | ;
4 | Pa_GetVersion @1
5 | Pa_GetVersionText @2
6 | Pa_GetErrorText @3
7 | Pa_Initialize @4
8 | Pa_Terminate @5
9 | Pa_GetHostApiCount @6
10 | Pa_GetDefaultHostApi @7
11 | Pa_GetHostApiInfo @8
12 | Pa_HostApiTypeIdToHostApiIndex @9
13 | Pa_HostApiDeviceIndexToDeviceIndex @10
14 | Pa_GetLastHostErrorInfo @11
15 | Pa_GetDeviceCount @12
16 | Pa_GetDefaultInputDevice @13
17 | Pa_GetDefaultOutputDevice @14
18 | Pa_GetDeviceInfo @15
19 | Pa_IsFormatSupported @16
20 | Pa_OpenStream @17
21 | Pa_OpenDefaultStream @18
22 | Pa_CloseStream @19
23 | Pa_SetStreamFinishedCallback @20
24 | Pa_StartStream @21
25 | Pa_StopStream @22
26 | Pa_AbortStream @23
27 | Pa_IsStreamStopped @24
28 | Pa_IsStreamActive @25
29 | Pa_GetStreamInfo @26
30 | Pa_GetStreamTime @27
31 | Pa_GetStreamCpuLoad @28
32 | Pa_ReadStream @29
33 | Pa_WriteStream @30
34 | Pa_GetStreamReadAvailable @31
35 | Pa_GetStreamWriteAvailable @32
36 | Pa_GetSampleSize @33
37 | Pa_Sleep @34
38 | PaAsio_GetAvailableBufferSizes @50
39 | PaAsio_ShowControlPanel @51
40 | PaUtil_InitializeX86PlainConverters @52
41 | PaAsio_GetInputChannelName @53
42 | PaAsio_GetOutputChannelName @54
43 | PaUtil_SetDebugPrintFunction @55
44 | PaWasapi_GetDeviceDefaultFormat @56
45 | PaWasapi_GetDeviceRole @57
46 | PaWasapi_ThreadPriorityBoost @58
47 | PaWasapi_ThreadPriorityRevert @59
48 | PaWasapi_GetFramesPerHostBuffer @60
49 | PaWasapi_GetJackDescription @61
50 | PaWasapi_GetJackCount @62
--------------------------------------------------------------------------------
/portaudio/bindings/cpp/include/portaudiocpp/HostApi.hxx:
--------------------------------------------------------------------------------
1 | #ifndef INCLUDED_PORTAUDIO_HOSTAPI_HXX
2 | #define INCLUDED_PORTAUDIO_HOSTAPI_HXX
3 |
4 | // ---------------------------------------------------------------------------------------
5 |
6 | #include "portaudio.h"
7 |
8 | #include "portaudiocpp/System.hxx"
9 |
10 | // ---------------------------------------------------------------------------------------
11 |
12 | // Forward declaration(s):
13 | namespace portaudio
14 | {
15 | class Device;
16 | }
17 |
18 | // ---------------------------------------------------------------------------------------
19 |
20 | // Declaration(s):
21 | namespace portaudio
22 | {
23 |
24 |
25 | //////
26 | /// @brief HostApi represents a host API (usually type of driver) in the System.
27 | ///
28 | /// A single System can support multiple HostApi's each one typically having
29 | /// a set of Devices using that HostApi (usually driver type). All Devices in
30 | /// the HostApi can be enumerated and the default input/output Device for this
31 | /// HostApi can be retreived.
32 | //////
33 | class HostApi
34 | {
35 | public:
36 | typedef System::DeviceIterator DeviceIterator;
37 |
38 | // query info: id, name, numDevices
39 | PaHostApiTypeId typeId() const;
40 | PaHostApiIndex index() const;
41 | const char *name() const;
42 | int deviceCount() const;
43 |
44 | // iterate devices
45 | DeviceIterator devicesBegin();
46 | DeviceIterator devicesEnd();
47 |
48 | // default devices
49 | Device &defaultInputDevice() const;
50 | Device &defaultOutputDevice() const;
51 |
52 | // comparison operators
53 | bool operator==(const HostApi &rhs) const;
54 | bool operator!=(const HostApi &rhs) const;
55 |
56 | private:
57 | const PaHostApiInfo *info_;
58 | Device **devices_;
59 |
60 | private:
61 | friend class System;
62 |
63 | explicit HostApi(PaHostApiIndex index);
64 | ~HostApi();
65 |
66 | HostApi(const HostApi &); // non-copyable
67 | HostApi &operator=(const HostApi &); // non-copyable
68 | };
69 |
70 |
71 | }
72 |
73 | // ---------------------------------------------------------------------------------------
74 |
75 | #endif // INCLUDED_PORTAUDIO_HOSTAPI_HXX
76 |
77 |
--------------------------------------------------------------------------------
/portaudio/pablio/README.txt:
--------------------------------------------------------------------------------
1 | README for PABLIO
2 | Portable Audio Blocking I/O Library
3 | Author: Phil Burk
4 |
5 | PABLIO is a simplified interface to PortAudio that provides
6 | read/write style blocking I/O.
7 |
8 | PABLIO is DEPRECATED. We recommend that people use the blocking I/O calls
9 | that are now part of the PortAudio API. These are Pa_ReadStream() and
10 | Pa_WriteStream().
11 |
12 | http://portaudio.com/docs/v19-doxydocs/blocking_read_write.html
13 |
14 | /*
15 | * More information on PortAudio at: http://www.portaudio.com
16 | * Copyright (c) 1999-2000 Phil Burk
17 | *
18 | * Permission is hereby granted, free of charge, to any person obtaining
19 | * a copy of this software and associated documentation files
20 | * (the "Software"), to deal in the Software without restriction,
21 | * including without limitation the rights to use, copy, modify, merge,
22 | * publish, distribute, sublicense, and/or sell copies of the Software,
23 | * and to permit persons to whom the Software is furnished to do so,
24 | * subject to the following conditions:
25 | *
26 | * The above copyright notice and this permission notice shall be
27 | * included in all copies or substantial portions of the Software.
28 | *
29 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
30 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
31 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
32 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
33 | * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
34 | * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
35 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
36 | */
37 |
38 | /*
39 | * The text above constitutes the entire PortAudio license; however,
40 | * the PortAudio community also makes the following non-binding requests:
41 | *
42 | * Any person wishing to distribute modifications to the Software is
43 | * requested to send the modifications to the original developer so that
44 | * they can be incorporated into the canonical version. It is also
45 | * requested that these non-binding requests be included along with the
46 | * license above.
47 | */
48 |
49 |
50 |
--------------------------------------------------------------------------------
/portaudio/bindings/cpp/build/gnu/aclocal.m4:
--------------------------------------------------------------------------------
1 |
2 | dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not)
3 | dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page
4 | dnl also defines GSTUFF_PKG_ERRORS on error
5 | AC_DEFUN(PKG_CHECK_MODULES, [
6 | succeeded=no
7 |
8 | if test -z "$PKG_CONFIG"; then
9 | AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
10 | fi
11 |
12 | if test "$PKG_CONFIG" = "no" ; then
13 | echo "*** The pkg-config script could not be found. Make sure it is"
14 | echo "*** in your path, or set the PKG_CONFIG environment variable"
15 | echo "*** to the full path to pkg-config."
16 | echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
17 | else
18 | PKG_CONFIG_MIN_VERSION=0.9.0
19 | if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
20 | AC_MSG_CHECKING(for $2)
21 |
22 | if $PKG_CONFIG --exists "$2" ; then
23 | AC_MSG_RESULT(yes)
24 | succeeded=yes
25 |
26 | AC_MSG_CHECKING($1_CFLAGS)
27 | $1_CFLAGS=`$PKG_CONFIG --cflags "$2"`
28 | AC_MSG_RESULT($$1_CFLAGS)
29 |
30 | AC_MSG_CHECKING($1_LIBS)
31 | $1_LIBS=`$PKG_CONFIG --libs "$2"`
32 | AC_MSG_RESULT($$1_LIBS)
33 | else
34 | $1_CFLAGS=""
35 | $1_LIBS=""
36 | ## If we have a custom action on failure, don't print errors, but
37 | ## do set a variable so people can do so.
38 | $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
39 | ifelse([$4], ,echo $$1_PKG_ERRORS,)
40 | fi
41 |
42 | AC_SUBST($1_CFLAGS)
43 | AC_SUBST($1_LIBS)
44 | else
45 | echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
46 | echo "*** See http://www.freedesktop.org/software/pkgconfig"
47 | fi
48 | fi
49 |
50 | if test $succeeded = yes; then
51 | ifelse([$3], , :, [$3])
52 | else
53 | ifelse([$4], , AC_MSG_ERROR([Library requirements ($2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.]), [$4])
54 | fi
55 | ])
56 |
57 |
58 |
--------------------------------------------------------------------------------
/portaudio/qa/loopback/src/paqa_tools.h:
--------------------------------------------------------------------------------
1 |
2 | /*
3 | * PortAudio Portable Real-Time Audio Library
4 | * Latest Version at: http://www.portaudio.com
5 | *
6 | * Copyright (c) 1999-2010 Phil Burk and Ross Bencina
7 | *
8 | * Permission is hereby granted, free of charge, to any person obtaining
9 | * a copy of this software and associated documentation files
10 | * (the "Software"), to deal in the Software without restriction,
11 | * including without limitation the rights to use, copy, modify, merge,
12 | * publish, distribute, sublicense, and/or sell copies of the Software,
13 | * and to permit persons to whom the Software is furnished to do so,
14 | * subject to the following conditions:
15 | *
16 | * The above copyright notice and this permission notice shall be
17 | * included in all copies or substantial portions of the Software.
18 | *
19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
22 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
23 | * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
24 | * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
25 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 | */
27 |
28 | /*
29 | * The text above constitutes the entire PortAudio license; however,
30 | * the PortAudio community also makes the following non-binding requests:
31 | *
32 | * Any person wishing to distribute modifications to the Software is
33 | * requested to send the modifications to the original developer so that
34 | * they can be incorporated into the canonical version. It is also
35 | * requested that these non-binding requests be included along with the
36 | * license above.
37 | */
38 |
39 | #ifndef _PAQA_TOOLS_H
40 | #define _PAQA_TOOLS_H
41 |
42 |
43 | #include
44 | #include "portaudio.h"
45 |
46 | void PaQa_ListAudioDevices(void);
47 |
48 | void PaQa_ConvertToFloat( const void *input, int numSamples, PaSampleFormat inFormat, float *output );
49 |
50 | void PaQa_ConvertFromFloat( const float *input, int numSamples, PaSampleFormat outFormat, void *output );
51 |
52 | #endif /* _PAQA_TOOLS_H */
53 |
--------------------------------------------------------------------------------
/portaudio/bindings/java/jportaudio/src/com/portaudio/StreamInfo.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Portable Audio I/O Library
3 | * Java Binding for PortAudio
4 | *
5 | * Based on the Open Source API proposed by Ross Bencina
6 | * Copyright (c) 2008 Ross Bencina
7 | *
8 | * Permission is hereby granted, free of charge, to any person obtaining
9 | * a copy of this software and associated documentation files
10 | * (the "Software"), to deal in the Software without restriction,
11 | * including without limitation the rights to use, copy, modify, merge,
12 | * publish, distribute, sublicense, and/or sell copies of the Software,
13 | * and to permit persons to whom the Software is furnished to do so,
14 | * subject to the following conditions:
15 | *
16 | * The above copyright notice and this permission notice shall be
17 | * included in all copies or substantial portions of the Software.
18 | *
19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
22 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
23 | * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
24 | * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
25 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 | */
27 |
28 | /*
29 | * The text above constitutes the entire PortAudio license; however,
30 | * the PortAudio community also makes the following non-binding requests:
31 | *
32 | * Any person wishing to distribute modifications to the Software is
33 | * requested to send the modifications to the original developer so that
34 | * they can be incorporated into the canonical version. It is also
35 | * requested that these non-binding requests be included along with the
36 | * license above.
37 | */
38 |
39 |
40 | /** @file
41 | @ingroup bindings_java
42 |
43 | @brief Information about a JPortAudio Stream.
44 | */
45 |
46 | package com.portaudio;
47 |
48 | /**
49 | * Equivalent to PaStreamInfo
50 | * @see PortAudio
51 | * @author Phil Burk
52 | *
53 | */
54 | public class StreamInfo
55 | {
56 | public int structVersion;
57 | public double outputLatency;
58 | public double inputLatency;
59 | public double sampleRate;
60 | }
61 |
--------------------------------------------------------------------------------
/portaudio/bindings/java/jportaudio/src/com/portaudio/StreamParameters.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Portable Audio I/O Library
3 | * Java Binding for PortAudio
4 | *
5 | * Based on the Open Source API proposed by Ross Bencina
6 | * Copyright (c) 2008 Ross Bencina
7 | *
8 | * Permission is hereby granted, free of charge, to any person obtaining
9 | * a copy of this software and associated documentation files
10 | * (the "Software"), to deal in the Software without restriction,
11 | * including without limitation the rights to use, copy, modify, merge,
12 | * publish, distribute, sublicense, and/or sell copies of the Software,
13 | * and to permit persons to whom the Software is furnished to do so,
14 | * subject to the following conditions:
15 | *
16 | * The above copyright notice and this permission notice shall be
17 | * included in all copies or substantial portions of the Software.
18 | *
19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
22 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
23 | * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
24 | * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
25 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 | */
27 |
28 | /*
29 | * The text above constitutes the entire PortAudio license; however,
30 | * the PortAudio community also makes the following non-binding requests:
31 | *
32 | * Any person wishing to distribute modifications to the Software is
33 | * requested to send the modifications to the original developer so that
34 | * they can be incorporated into the canonical version. It is also
35 | * requested that these non-binding requests be included along with the
36 | * license above.
37 | */
38 |
39 | /** @file
40 | @ingroup bindings_java
41 |
42 | @brief Options to use when opening a stream.
43 | */
44 | package com.portaudio;
45 | /**
46 | * Equivalent to PaStreamParameters
47 | * @see PortAudio
48 | * @author Phil Burk
49 | *
50 | */
51 | public class StreamParameters
52 | {
53 | public int device = 0;
54 | public int channelCount = 2;
55 | public int sampleFormat = PortAudio.FORMAT_FLOAT_32;
56 | public double suggestedLatency = 0.050;
57 | }
58 |
--------------------------------------------------------------------------------
/portaudio/bindings/java/jportaudio/src/com/portaudio/HostApiInfo.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Portable Audio I/O Library
3 | * Java Binding for PortAudio
4 | *
5 | * Based on the Open Source API proposed by Ross Bencina
6 | * Copyright (c) 2008 Ross Bencina
7 | *
8 | * Permission is hereby granted, free of charge, to any person obtaining
9 | * a copy of this software and associated documentation files
10 | * (the "Software"), to deal in the Software without restriction,
11 | * including without limitation the rights to use, copy, modify, merge,
12 | * publish, distribute, sublicense, and/or sell copies of the Software,
13 | * and to permit persons to whom the Software is furnished to do so,
14 | * subject to the following conditions:
15 | *
16 | * The above copyright notice and this permission notice shall be
17 | * included in all copies or substantial portions of the Software.
18 | *
19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
22 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
23 | * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
24 | * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
25 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 | */
27 |
28 | /*
29 | * The text above constitutes the entire PortAudio license; however,
30 | * the PortAudio community also makes the following non-binding requests:
31 | *
32 | * Any person wishing to distribute modifications to the Software is
33 | * requested to send the modifications to the original developer so that
34 | * they can be incorporated into the canonical version. It is also
35 | * requested that these non-binding requests be included along with the
36 | * license above.
37 | */
38 |
39 | /** @file
40 | @ingroup bindings_java
41 |
42 | @brief Information about a JPortAudio Host API.
43 | */
44 | package com.portaudio;
45 |
46 | /**
47 | * Equivalent to PaHostApiInfo
48 | * @see PortAudio
49 | * @see DeviceInfo
50 | * @author Phil Burk
51 | *
52 | */
53 | public class HostApiInfo
54 | {
55 | public int version;
56 | public int type;
57 | public String name;
58 | public int deviceCount;
59 | public int defaultInputDevice;
60 | public int defaultOutputDevice;
61 | }
62 |
--------------------------------------------------------------------------------
/portaudio/src/os/win/pa_x86_plain_converters.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Plain Intel IA32 assembly implementations of PortAudio sample converter functions.
3 | * Copyright (c) 1999-2002 Ross Bencina, Phil Burk
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining
6 | * a copy of this software and associated documentation files
7 | * (the "Software"), to deal in the Software without restriction,
8 | * including without limitation the rights to use, copy, modify, merge,
9 | * publish, distribute, sublicense, and/or sell copies of the Software,
10 | * and to permit persons to whom the Software is furnished to do so,
11 | * subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be
14 | * included in all copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
20 | * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
21 | * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 | */
24 |
25 | /*
26 | * The text above constitutes the entire PortAudio license; however,
27 | * the PortAudio community also makes the following non-binding requests:
28 | *
29 | * Any person wishing to distribute modifications to the Software is
30 | * requested to send the modifications to the original developer so that
31 | * they can be incorporated into the canonical version. It is also
32 | * requested that these non-binding requests be included along with the
33 | * license above.
34 | */
35 |
36 | /** @file
37 | @ingroup win_src
38 | */
39 |
40 | #ifndef PA_X86_PLAIN_CONVERTERS_H
41 | #define PA_X86_PLAIN_CONVERTERS_H
42 |
43 | #ifdef __cplusplus
44 | extern "C"
45 | {
46 | #endif /* __cplusplus */
47 |
48 |
49 | /**
50 | @brief Install optimized converter functions suitable for all IA32 processors
51 |
52 | It is recommended to call PaUtil_InitializeX86PlainConverters prior to calling Pa_Initialize
53 | */
54 | void PaUtil_InitializeX86PlainConverters( void );
55 |
56 |
57 | #ifdef __cplusplus
58 | }
59 | #endif /* __cplusplus */
60 | #endif /* PA_X86_PLAIN_CONVERTERS_H */
61 |
--------------------------------------------------------------------------------
/Dockerfile:
--------------------------------------------------------------------------------
1 | # syntax = docker/dockerfile:experimental
2 | FROM nvcr.io/nvidia/l4t-base:r32.3.1
3 |
4 | # Install Dependencies
5 | RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
6 | RUN apt-get update -y && apt-get upgrade -y && apt-get install -y \
7 | build-essential \
8 | make \
9 | cmake \
10 | curl \
11 | git \
12 | g++ \
13 | gcc \
14 | libsm6 \
15 | libxext6 \
16 | libxrender-dev \
17 | libgtk-3-dev \
18 | libssl-dev \
19 | libgtk-3-dev \
20 | libcurl4-openssl-dev \
21 | libgirepository1.0-dev \
22 | libmysqlclient-dev \
23 | zlib1g-dev \
24 | python-pip \
25 | python3-pip \
26 | python3-dev \
27 | tzdata \
28 | && apt-get clean \
29 | && rm -rf /var/lib/apt/lists/* \
30 | && localedef -f UTF-8 -i ja_JP ja_JP.UTF-8
31 |
32 | # for japanese
33 | ENV LANG="ja_JP.UTF-8" \
34 | LANGUAGE="ja_JP:ja" \
35 | LC_ALL="ja_JP.UTF-8"
36 |
37 | # Dependencies about mysqlclient
38 | RUN git clone https://github.com/edenhill/librdkafka && \
39 | cd librdkafka && \
40 | ./configure --prefix=/usr && \
41 | make && \
42 | make install && \
43 | cd ../ && \
44 | rm -rf librdkafka
45 |
46 | ENV POSITION=Runtime \
47 | SERVICE=capture-audio-from-mic \
48 | AION_HOME="/var/lib/aion" \
49 | SOURCE="pa_stable_v190600_20161030.tgz"
50 |
51 | # Setup Directoties
52 | RUN mkdir ${AION_HOME}
53 | RUN mkdir -p ${AION_HOME}/$POSITION/$SERVICE
54 | RUN mkdir -p ${AION_HOME}/Data/${SERVICE}_1
55 | WORKDIR ${AION_HOME}/$POSITION/$SERVICE/
56 |
57 | RUN apt update && apt-get install -y wget tar usbutils
58 | RUN apt update && apt-get install -y alsa alsa-oss
59 | RUN apt update && apt-get install -y libasound2-dev portaudio19-dev python3-pyaudio python-pyaudio
60 | RUN git config --global url."git@bitbucket.org:".insteadOf "https://bitbucket.org/"
61 | RUN --mount=type=secret,id=ssh,target=/root/.ssh/id_rsa ssh-keyscan -t rsa bitbucket.org >> /root/.ssh/known_hosts \
62 | && pip3 install -U git+ssh://git@bitbucket.org/latonaio/AION-related-python-library.git
63 | # wget http://www.portaudio.com/archives/${SOURCE} && \
64 | # tar xvf ${SOURCE} && cd portaudio && ./configure && make && make install && \
65 | # rm -rf portaudio ${SOURCE}
66 | ADD . .
67 |
68 | RUN cd portaudio && ./configure && make install
69 | RUN pip3 install pyaudio
70 | RUN python3 setup.py install
71 |
72 | CMD ["/bin/sh", "docker-entrypoint.sh"]
73 |
--------------------------------------------------------------------------------
/portaudio/bindings/java/jportaudio.dox:
--------------------------------------------------------------------------------
1 | /**
2 | @page java_binding JPortAudio Java Binding
3 | @ingroup jportaudio
4 |
5 | Note: this page has not been reviewed, and may contain errors.
6 |
7 | @section java_draft DRAFT - IN PROGRESS
8 |
9 | 9/4/12 JPortAudio is very new and should be considered an "alpha" release.
10 | The building of JPortAudio will eventually be integrated into the Makefile as an optional build.
11 |
12 | Currently JPortAudio is only supported for Windows and Macintosh. Please contact us if you want to help with porting Linux.
13 |
14 | For reference documentation of the JPortAudio API see: com.portaudio.PortAudio
15 |
16 | For an example see: PlaySine.java
17 |
18 | @section java_comp_windows Building JPortAudio on Windows
19 |
20 | Build the Java code using the Eclipse project in "jportaudio". Export as "jportaudio.jar".
21 |
22 | If you modify the JNI API then you will need to regenerate the JNI .h files using:
23 |
24 | @code
25 | cd bindings/java/scripts
26 | make_header.bat
27 | @endcode
28 |
29 | Build the JNI DLL using the Visual Studio 2010 solution in "java/c/build/vs2010/PortAudioJNI".
30 |
31 | @section java_use_windows Using JPortAudio on Windows
32 |
33 | Put the "jportaudio.jar" in the classpath for your application.
34 | Place the following libraries where they can be found, typically in the same folder as your application.
35 |
36 | - portaudio_x86.dll
37 | - portaudio_x64.dll
38 | - jportaudio_x86.dll
39 | - jportaudio_x64.dll
40 |
41 | @section java_comp_max Building JPortAudio on Mac
42 |
43 | These are notes from building JPortAudio on a Mac with 10.6.8 and XCode 4.
44 |
45 | I created a target of type 'C' library.
46 |
47 | I added the regular PortAudio frameworks plus the JavaVM framework.
48 |
49 | I modified com_portaudio_PortAudio.h and com_portaudio_BlockingStream.h so that jni.h could found.
50 |
51 | @code
52 | #if defined(__APPLE__)
53 | #include
54 | #else
55 | #include
56 | #endif
57 | @endcode
58 |
59 | This is bad because those header files are autogenerated and will be overwritten.
60 | We need a better solution for this.
61 |
62 | I had trouble finding the "libjportaudio.jnilib". So I added a Build Phase that copied the library to "/Users/phil/Library/Java/Extensions".
63 |
64 | On the Mac we can create a universal library for both 32 and 64-bit JVMs. So in the JAR file I will open "jportaudio" on Apple. ON WIndows I will continue to open "jportaudio_x64" and "jportaudio_x86".
65 | */
66 |
--------------------------------------------------------------------------------
/portaudio/bindings/cpp/include/portaudiocpp/Stream.hxx:
--------------------------------------------------------------------------------
1 | #ifndef INCLUDED_PORTAUDIO_STREAM_HXX
2 | #define INCLUDED_PORTAUDIO_STREAM_HXX
3 |
4 | #include "portaudio.h"
5 |
6 | // ---------------------------------------------------------------------------------------
7 |
8 | // Forward declaration(s):
9 | namespace portaudio
10 | {
11 | class StreamParameters;
12 | }
13 |
14 | // ---------------------------------------------------------------------------------------
15 |
16 | // Declaration(s):
17 | namespace portaudio
18 | {
19 |
20 |
21 | //////
22 | /// @brief A Stream represents an active or inactive input and/or output data
23 | /// stream in the System.
24 | ///
25 | /// Concrete Stream classes should ensure themselves being in a closed state at
26 | /// destruction (i.e. by calling their own close() method in their deconstructor).
27 | /// Following good C++ programming practices, care must be taken to ensure no
28 | /// exceptions are thrown by the deconstructor of these classes. As a consequence,
29 | /// clients need to explicitly call close() to ensure the stream closed successfully.
30 | ///
31 | /// The Stream object can be used to manipulate the Stream's state. Also, time-constant
32 | /// and time-varying information about the Stream can be retreived.
33 | //////
34 | class Stream
35 | {
36 | public:
37 | // Opening/closing:
38 | virtual ~Stream();
39 |
40 | virtual void close();
41 | bool isOpen() const;
42 |
43 | // Additional set up:
44 | void setStreamFinishedCallback(PaStreamFinishedCallback *callback);
45 |
46 | // State management:
47 | void start();
48 | void stop();
49 | void abort();
50 |
51 | bool isStopped() const;
52 | bool isActive() const;
53 |
54 | // Stream info (time-constant, but might become time-variant soon):
55 | PaTime inputLatency() const;
56 | PaTime outputLatency() const;
57 | double sampleRate() const;
58 |
59 | // Stream info (time-varying):
60 | PaTime time() const;
61 |
62 | // Accessors for PortAudio PaStream, useful for interfacing
63 | // with PortAudio add-ons (such as PortMixer) for instance:
64 | const PaStream *paStream() const;
65 | PaStream *paStream();
66 |
67 | protected:
68 | Stream(); // abstract class
69 |
70 | PaStream *stream_;
71 |
72 | private:
73 | Stream(const Stream &); // non-copyable
74 | Stream &operator=(const Stream &); // non-copyable
75 | };
76 |
77 |
78 | } // namespace portaudio
79 |
80 |
81 | #endif // INCLUDED_PORTAUDIO_STREAM_HXX
82 |
83 |
--------------------------------------------------------------------------------
/portaudio/cmake_support/template_portaudio.def:
--------------------------------------------------------------------------------
1 | ; $Id: $
2 | ;
3 | ; !!! @GENERATED_MESSAGE@ !!!
4 | EXPORTS
5 |
6 | ;
7 | Pa_GetVersion @1
8 | Pa_GetVersionText @2
9 | Pa_GetErrorText @3
10 | Pa_Initialize @4
11 | Pa_Terminate @5
12 | Pa_GetHostApiCount @6
13 | Pa_GetDefaultHostApi @7
14 | Pa_GetHostApiInfo @8
15 | Pa_HostApiTypeIdToHostApiIndex @9
16 | Pa_HostApiDeviceIndexToDeviceIndex @10
17 | Pa_GetLastHostErrorInfo @11
18 | Pa_GetDeviceCount @12
19 | Pa_GetDefaultInputDevice @13
20 | Pa_GetDefaultOutputDevice @14
21 | Pa_GetDeviceInfo @15
22 | Pa_IsFormatSupported @16
23 | Pa_OpenStream @17
24 | Pa_OpenDefaultStream @18
25 | Pa_CloseStream @19
26 | Pa_SetStreamFinishedCallback @20
27 | Pa_StartStream @21
28 | Pa_StopStream @22
29 | Pa_AbortStream @23
30 | Pa_IsStreamStopped @24
31 | Pa_IsStreamActive @25
32 | Pa_GetStreamInfo @26
33 | Pa_GetStreamTime @27
34 | Pa_GetStreamCpuLoad @28
35 | Pa_ReadStream @29
36 | Pa_WriteStream @30
37 | Pa_GetStreamReadAvailable @31
38 | Pa_GetStreamWriteAvailable @32
39 | Pa_GetSampleSize @33
40 | Pa_Sleep @34
41 | @DEF_EXCLUDE_ASIO_SYMBOLS@PaAsio_GetAvailableBufferSizes @50
42 | @DEF_EXCLUDE_ASIO_SYMBOLS@PaAsio_ShowControlPanel @51
43 | @DEF_EXCLUDE_X86_PLAIN_CONVERTERS@PaUtil_InitializeX86PlainConverters @52
44 | @DEF_EXCLUDE_ASIO_SYMBOLS@PaAsio_GetInputChannelName @53
45 | @DEF_EXCLUDE_ASIO_SYMBOLS@PaAsio_GetOutputChannelName @54
46 | PaUtil_SetDebugPrintFunction @55
47 | @DEF_EXCLUDE_WASAPI_SYMBOLS@PaWasapi_GetDeviceDefaultFormat @56
48 | @DEF_EXCLUDE_WASAPI_SYMBOLS@PaWasapi_GetDeviceRole @57
49 | @DEF_EXCLUDE_WASAPI_SYMBOLS@PaWasapi_ThreadPriorityBoost @58
50 | @DEF_EXCLUDE_WASAPI_SYMBOLS@PaWasapi_ThreadPriorityRevert @59
51 | @DEF_EXCLUDE_WASAPI_SYMBOLS@PaWasapi_GetFramesPerHostBuffer @60
52 | @DEF_EXCLUDE_WASAPI_SYMBOLS@PaWasapi_GetJackDescription @61
53 | @DEF_EXCLUDE_WASAPI_SYMBOLS@PaWasapi_GetJackCount @62
54 |
--------------------------------------------------------------------------------
/portaudio/bindings/java/jportaudio/src/com/portaudio/DeviceInfo.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Portable Audio I/O Library
3 | * Java Binding for PortAudio
4 | *
5 | * Based on the Open Source API proposed by Ross Bencina
6 | * Copyright (c) 2008 Ross Bencina
7 | *
8 | * Permission is hereby granted, free of charge, to any person obtaining
9 | * a copy of this software and associated documentation files
10 | * (the "Software"), to deal in the Software without restriction,
11 | * including without limitation the rights to use, copy, modify, merge,
12 | * publish, distribute, sublicense, and/or sell copies of the Software,
13 | * and to permit persons to whom the Software is furnished to do so,
14 | * subject to the following conditions:
15 | *
16 | * The above copyright notice and this permission notice shall be
17 | * included in all copies or substantial portions of the Software.
18 | *
19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
22 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
23 | * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
24 | * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
25 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 | */
27 |
28 | /*
29 | * The text above constitutes the entire PortAudio license; however,
30 | * the PortAudio community also makes the following non-binding requests:
31 | *
32 | * Any person wishing to distribute modifications to the Software is
33 | * requested to send the modifications to the original developer so that
34 | * they can be incorporated into the canonical version. It is also
35 | * requested that these non-binding requests be included along with the
36 | * license above.
37 | */
38 |
39 | /** @file
40 | @ingroup bindings_java
41 |
42 | @brief Information about a JPortAudio device.
43 | */
44 | package com.portaudio;
45 |
46 | /**
47 | * Equivalent to PaDeviceInfo
48 | * @see PortAudio
49 | * @see HostApiInfo
50 | * @author Phil Burk
51 | *
52 | */
53 | public class DeviceInfo
54 | {
55 | public int version;
56 | public String name;
57 | public int hostApi;
58 | public int maxInputChannels;
59 | public int maxOutputChannels;
60 | public double defaultLowInputLatency;
61 | public double defaultHighInputLatency;
62 | public double defaultLowOutputLatency;
63 | public double defaultHighOutputLatency;
64 | public double defaultSampleRate;
65 | }
66 |
--------------------------------------------------------------------------------
/portaudio/bindings/cpp/source/portaudiocpp/BlockingStream.cxx:
--------------------------------------------------------------------------------
1 | #include "portaudiocpp/BlockingStream.hxx"
2 |
3 | #include "portaudio.h"
4 |
5 | #include "portaudiocpp/StreamParameters.hxx"
6 | #include "portaudiocpp/Exception.hxx"
7 |
8 | namespace portaudio
9 | {
10 |
11 | // --------------------------------------------------------------------------------------
12 |
13 | BlockingStream::BlockingStream()
14 | {
15 | }
16 |
17 | BlockingStream::BlockingStream(const StreamParameters ¶meters)
18 | {
19 | open(parameters);
20 | }
21 |
22 | BlockingStream::~BlockingStream()
23 | {
24 | try
25 | {
26 | close();
27 | }
28 | catch (...)
29 | {
30 | // ignore all errors
31 | }
32 | }
33 |
34 | // --------------------------------------------------------------------------------------
35 |
36 | void BlockingStream::open(const StreamParameters ¶meters)
37 | {
38 | PaError err = Pa_OpenStream(&stream_, parameters.inputParameters().paStreamParameters(), parameters.outputParameters().paStreamParameters(),
39 | parameters.sampleRate(), parameters.framesPerBuffer(), parameters.flags(), NULL, NULL);
40 |
41 | if (err != paNoError)
42 | {
43 | throw PaException(err);
44 | }
45 | }
46 |
47 | // --------------------------------------------------------------------------------------
48 |
49 | void BlockingStream::read(void *buffer, unsigned long numFrames)
50 | {
51 | PaError err = Pa_ReadStream(stream_, buffer, numFrames);
52 |
53 | if (err != paNoError)
54 | {
55 | throw PaException(err);
56 | }
57 | }
58 |
59 | void BlockingStream::write(const void *buffer, unsigned long numFrames)
60 | {
61 | PaError err = Pa_WriteStream(stream_, buffer, numFrames);
62 |
63 | if (err != paNoError)
64 | {
65 | throw PaException(err);
66 | }
67 | }
68 |
69 | // --------------------------------------------------------------------------------------
70 |
71 | signed long BlockingStream::availableReadSize() const
72 | {
73 | signed long avail = Pa_GetStreamReadAvailable(stream_);
74 |
75 | if (avail < 0)
76 | {
77 | throw PaException(avail);
78 | }
79 |
80 | return avail;
81 | }
82 |
83 | signed long BlockingStream::availableWriteSize() const
84 | {
85 | signed long avail = Pa_GetStreamWriteAvailable(stream_);
86 |
87 | if (avail < 0)
88 | {
89 | throw PaException(avail);
90 | }
91 |
92 | return avail;
93 | }
94 |
95 | // --------------------------------------------------------------------------------------
96 |
97 | } // portaudio
98 |
99 |
100 |
101 |
--------------------------------------------------------------------------------
/portaudio/bindings/cpp/include/portaudiocpp/DirectionSpecificStreamParameters.hxx:
--------------------------------------------------------------------------------
1 | #ifndef INCLUDED_PORTAUDIO_SINGLEDIRECTIONSTREAMPARAMETERS_HXX
2 | #define INCLUDED_PORTAUDIO_SINGLEDIRECTIONSTREAMPARAMETERS_HXX
3 |
4 | // ---------------------------------------------------------------------------------------
5 |
6 | #include
7 |
8 | #include "portaudio.h"
9 |
10 | #include "portaudiocpp/System.hxx"
11 | #include "portaudiocpp/SampleDataFormat.hxx"
12 |
13 | // ---------------------------------------------------------------------------------------
14 |
15 | // Forward declaration(s):
16 | namespace portaudio
17 | {
18 | class Device;
19 | }
20 |
21 | // ---------------------------------------------------------------------------------------
22 |
23 | // Declaration(s):
24 | namespace portaudio
25 | {
26 |
27 | //////
28 | /// @brief All parameters for one direction (either in or out) of a Stream. Together with
29 | /// parameters common to both directions, two DirectionSpecificStreamParameters can make up
30 | /// a StreamParameters object which contains all parameters for a Stream.
31 | //////
32 | class DirectionSpecificStreamParameters
33 | {
34 | public:
35 | static DirectionSpecificStreamParameters null();
36 |
37 | DirectionSpecificStreamParameters();
38 | DirectionSpecificStreamParameters(const Device &device, int numChannels, SampleDataFormat format,
39 | bool interleaved, PaTime suggestedLatency, void *hostApiSpecificStreamInfo);
40 |
41 | // Set up methods:
42 | void setDevice(const Device &device);
43 | void setNumChannels(int numChannels);
44 |
45 | void setSampleFormat(SampleDataFormat format, bool interleaved = true);
46 | void setHostApiSpecificSampleFormat(PaSampleFormat format, bool interleaved = true);
47 |
48 | void setSuggestedLatency(PaTime latency);
49 |
50 | void setHostApiSpecificStreamInfo(void *streamInfo);
51 |
52 | // Accessor methods:
53 | PaStreamParameters *paStreamParameters();
54 | const PaStreamParameters *paStreamParameters() const;
55 |
56 | Device &device() const;
57 | int numChannels() const;
58 |
59 | SampleDataFormat sampleFormat() const;
60 | bool isSampleFormatInterleaved() const;
61 | bool isSampleFormatHostApiSpecific() const;
62 | PaSampleFormat hostApiSpecificSampleFormat() const;
63 |
64 | PaTime suggestedLatency() const;
65 |
66 | void *hostApiSpecificStreamInfo() const;
67 |
68 | private:
69 | PaStreamParameters paStreamParameters_;
70 | };
71 |
72 |
73 | } // namespace portaudio
74 |
75 | // ---------------------------------------------------------------------------------------
76 |
77 | #endif // INCLUDED_PORTAUDIO_SINGLEDIRECTIONSTREAMPARAMETERS_HXX
78 |
--------------------------------------------------------------------------------
/portaudio/src/os/win/pa_win_wdmks_utils.h:
--------------------------------------------------------------------------------
1 | #ifndef PA_WIN_WDMKS_UTILS_H
2 | #define PA_WIN_WDMKS_UTILS_H
3 |
4 | /*
5 | * PortAudio Portable Real-Time Audio Library
6 | * Windows WDM KS utilities
7 | *
8 | * Copyright (c) 1999 - 2007 Ross Bencina, Andrew Baldwin
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 |
41 | /** @file
42 | @brief Utilities for working with the Windows WDM KS API
43 | */
44 |
45 | #ifdef __cplusplus
46 | extern "C" {
47 | #endif
48 |
49 | /**
50 | Query for the maximum number of channels supported by any pin of the
51 | specified device. Returns 0 if the query fails for any reason.
52 |
53 | @param wcharDevicePath A system level PnP interface path, supplied as a WCHAR unicode string.
54 | Declard as void* to avoid introducing a dependency on wchar_t here.
55 |
56 | @param isInput A flag specifying whether to query for input (non-zero) or output (zero) channels.
57 | */
58 | int PaWin_WDMKS_QueryFilterMaximumChannelCount( void *wcharDevicePath, int isInput );
59 |
60 |
61 | #ifdef __cplusplus
62 | }
63 | #endif /* __cplusplus */
64 |
65 | #endif /* PA_WIN_WDMKS_UTILS_H */
--------------------------------------------------------------------------------
/portaudio/doc/src/tutorial/start_stop_abort.dox:
--------------------------------------------------------------------------------
1 | /** @page start_stop_abort Starting, Stopping and Aborting a Stream
2 | @ingroup tutorial
3 |
4 | @section tut_startstop1 Starting, Stopping and Aborting a Stream
5 |
6 | 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.
7 |
8 | @code
9 | err = Pa_StartStream( stream );
10 | if( err != paNoError ) goto error;
11 | @endcode
12 |
13 | 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.
14 |
15 | 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.
16 |
17 | @code
18 | /* Sleep for several seconds. */
19 | Pa_Sleep(NUM_SECONDS*1000);
20 | @endcode
21 |
22 | Now we need to stop playback. There are several ways to do this, the simplest of which is to call Pa_StopStream():
23 |
24 | @code
25 | err = Pa_StopStream( stream );
26 | if( err != paNoError ) goto error;
27 | @endcode
28 |
29 | 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.
30 |
31 | 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.
32 |
33 | Previous: \ref open_default_stream | Next: \ref terminating_portaudio
34 |
35 | */
--------------------------------------------------------------------------------
/portaudio/doc/src/tutorial/utility_functions.dox:
--------------------------------------------------------------------------------
1 | /** @page utility_functions Utility Functions
2 | @ingroup tutorial
3 |
4 | In addition to the functions described elsewhere in this tutorial, PortAudio provides a number of Utility functions that are useful in a variety of circumstances.
5 | You'll want to read the portaudio.h reference, which documents the entire V19 API for details, but we'll try to cover the basics here.
6 |
7 | @section tut_util2 Version Information
8 |
9 | PortAudio offers two functions to determine the PortAudio Version. This is most useful when you are using PortAudio as a dynamic library, but it may also be useful at other times.
10 |
11 | @code
12 | int Pa_GetVersion (void)
13 | const char * Pa_GetVersionText (void)
14 | @endcode
15 |
16 | @section tut_util3 Error Text
17 |
18 | PortAudio allows you to get error text from an error number.
19 |
20 | @code
21 | const char * Pa_GetErrorText (PaError errorCode)
22 | @endcode
23 |
24 | @section tut_util4 Stream State
25 |
26 | PortAudio Streams exist in 3 states: Active, Stopped, and Callback Stopped. If a stream is in callback stopped state, you'll need to stop it before you can start it again. If you need to query the state of a PortAudio stream, there are two functions for doing so:
27 |
28 | @code
29 | PaError Pa_IsStreamStopped (PaStream *stream)
30 | PaError Pa_IsStreamActive (PaStream *stream)
31 | @endcode
32 |
33 | @section tut_util5 Stream Info
34 |
35 | If you need to retrieve info about a given stream, such as latency, and sample rate info, there's a function for that too:
36 |
37 | @code
38 | const PaStreamInfo * Pa_GetStreamInfo (PaStream *stream)
39 | @endcode
40 |
41 | @section tut_util6 Stream Time
42 |
43 | If you need to synchronise other activities such as display updates or MIDI output with the PortAudio callback you need to know the current time according to the same timebase used by the stream callback timestamps.
44 |
45 | @code
46 | PaTime Pa_GetStreamTime (PaStream *stream)
47 | @endcode
48 |
49 | @section tut_util6CPU Usage
50 |
51 | To determine how much CPU is being used by the callback, use these:
52 |
53 | @code
54 | double Pa_GetStreamCpuLoad (PaStream *stream)
55 | @endcode
56 |
57 | @section tut_util7 Other utilities
58 |
59 | These functions allow you to determine the size of a sample from its format and sleep for a given amount of time. The sleep function should not be used for precise timing or synchronization because it makes few guarantees about the exact length of time it waits. It is most useful for testing.
60 |
61 | @code
62 | PaError Pa_GetSampleSize (PaSampleFormat format)
63 | void Pa_Sleep (long msec)
64 | @endcode
65 |
66 |
67 | Previous: \ref terminating_portaudio | Next: \ref querying_devices
68 |
69 | */
--------------------------------------------------------------------------------
/portaudio/bindings/cpp/source/portaudiocpp/CppFunCallbackStream.cxx:
--------------------------------------------------------------------------------
1 | #include "portaudiocpp/CppFunCallbackStream.hxx"
2 |
3 | #include "portaudiocpp/StreamParameters.hxx"
4 | #include "portaudiocpp/Exception.hxx"
5 |
6 | namespace portaudio
7 | {
8 | namespace impl
9 | {
10 | //////
11 | /// Adapts any a C++ callback to a C-callable function (ie this function). A
12 | /// pointer to a struct with the C++ function pointer and the actual user data should be
13 | /// passed as the ``userData'' parameter when setting up the callback.
14 | //////
15 | int cppCallbackToPaCallbackAdapter(const void *inputBuffer, void *outputBuffer, unsigned long numFrames,
16 | const PaStreamCallbackTimeInfo *timeInfo, PaStreamCallbackFlags statusFlags, void *userData)
17 | {
18 | FunCallbackStream::CppToCCallbackData *data = static_cast(userData);
19 | return data->funPtr(inputBuffer, outputBuffer, numFrames, timeInfo, statusFlags, data->userData);
20 | }
21 | }
22 |
23 | // -----------------------------------------------------------------------------------
24 |
25 | FunCallbackStream::CppToCCallbackData::CppToCCallbackData()
26 | {
27 | }
28 |
29 | FunCallbackStream::CppToCCallbackData::CppToCCallbackData(CallbackFunPtr funPtr, void *userData) : funPtr(funPtr), userData(userData)
30 | {
31 | }
32 |
33 | void FunCallbackStream::CppToCCallbackData::init(CallbackFunPtr funPtr, void *userData)
34 | {
35 | this->funPtr = funPtr;
36 | this->userData = userData;
37 | }
38 |
39 | // -----------------------------------------------------------------------------------
40 |
41 | FunCallbackStream::FunCallbackStream()
42 | {
43 | }
44 |
45 | FunCallbackStream::FunCallbackStream(const StreamParameters ¶meters, CallbackFunPtr funPtr, void *userData) : adapterData_(funPtr, userData)
46 | {
47 | open(parameters);
48 | }
49 |
50 | FunCallbackStream::~FunCallbackStream()
51 | {
52 | try
53 | {
54 | close();
55 | }
56 | catch (...)
57 | {
58 | // ignore all errors
59 | }
60 | }
61 |
62 | void FunCallbackStream::open(const StreamParameters ¶meters, CallbackFunPtr funPtr, void *userData)
63 | {
64 | adapterData_.init(funPtr, userData);
65 | open(parameters);
66 | }
67 |
68 | void FunCallbackStream::open(const StreamParameters ¶meters)
69 | {
70 | PaError err = Pa_OpenStream(&stream_, parameters.inputParameters().paStreamParameters(), parameters.outputParameters().paStreamParameters(),
71 | parameters.sampleRate(), parameters.framesPerBuffer(), parameters.flags(), &impl::cppCallbackToPaCallbackAdapter,
72 | static_cast(&adapterData_));
73 |
74 | if (err != paNoError)
75 | {
76 | throw PaException(err);
77 | }
78 | }
79 |
80 | // -----------------------------------------------------------------------------------
81 | }
82 |
--------------------------------------------------------------------------------
/portaudio/bindings/java/jportaudio/jtests/com/portaudio/PlaySine.java:
--------------------------------------------------------------------------------
1 |
2 | /** @file
3 | @ingroup bindings_java
4 |
5 | @brief Example that shows how to play sine waves using JPortAudio.
6 | */
7 | package com.portaudio;
8 |
9 | import com.portaudio.TestBasic.SineOscillator;
10 |
11 | public class PlaySine
12 | {
13 | /**
14 | * Write a sine wave to the stream.
15 | * @param stream
16 | * @param framesPerBuffer
17 | * @param numFrames
18 | * @param sampleRate
19 | */
20 | private void writeSineData( BlockingStream stream, int framesPerBuffer,
21 | int numFrames, int sampleRate )
22 | {
23 | float[] buffer = new float[framesPerBuffer * 2];
24 | SineOscillator osc1 = new SineOscillator( 200.0, sampleRate );
25 | SineOscillator osc2 = new SineOscillator( 300.0, sampleRate );
26 | int framesLeft = numFrames;
27 | while( framesLeft > 0 )
28 | {
29 | int index = 0;
30 | int framesToWrite = (framesLeft > framesPerBuffer) ? framesPerBuffer
31 | : framesLeft;
32 | for( int j = 0; j < framesToWrite; j++ )
33 | {
34 | buffer[index++] = (float) osc1.next();
35 | buffer[index++] = (float) osc2.next();
36 | }
37 | stream.write( buffer, framesToWrite );
38 | framesLeft -= framesToWrite;
39 | }
40 | }
41 |
42 | /**
43 | * Create a stream on the default device then play sine waves.
44 | */
45 | public void play()
46 | {
47 | PortAudio.initialize();
48 |
49 | // Get the default device and setup the stream parameters.
50 | int deviceId = PortAudio.getDefaultOutputDevice();
51 | DeviceInfo deviceInfo = PortAudio.getDeviceInfo( deviceId );
52 | double sampleRate = deviceInfo.defaultSampleRate;
53 | System.out.println( " deviceId = " + deviceId );
54 | System.out.println( " sampleRate = " + sampleRate );
55 | System.out.println( " device name = " + deviceInfo.name );
56 |
57 | StreamParameters streamParameters = new StreamParameters();
58 | streamParameters.channelCount = 2;
59 | streamParameters.device = deviceId;
60 | streamParameters.suggestedLatency = deviceInfo.defaultLowOutputLatency;
61 | System.out.println( " suggestedLatency = "
62 | + streamParameters.suggestedLatency );
63 |
64 | int framesPerBuffer = 256;
65 | int flags = 0;
66 |
67 | // Open a stream for output.
68 | BlockingStream stream = PortAudio.openStream( null, streamParameters,
69 | (int) sampleRate, framesPerBuffer, flags );
70 |
71 | int numFrames = (int) (sampleRate * 4); // enough for 4 seconds
72 |
73 | stream.start();
74 |
75 | writeSineData( stream, framesPerBuffer, numFrames, (int) sampleRate );
76 |
77 | stream.stop();
78 | stream.close();
79 |
80 | PortAudio.terminate();
81 | System.out.println( "JPortAudio test complete." );
82 | }
83 |
84 | public static void main( String[] args )
85 | {
86 | PlaySine player = new PlaySine();
87 | player.play();
88 | }
89 | }
90 |
--------------------------------------------------------------------------------
/portaudio/bindings/cpp/include/portaudiocpp/StreamParameters.hxx:
--------------------------------------------------------------------------------
1 | #ifndef INCLUDED_PORTAUDIO_STREAMPARAMETERS_HXX
2 | #define INCLUDED_PORTAUDIO_STREAMPARAMETERS_HXX
3 |
4 | // ---------------------------------------------------------------------------------------
5 |
6 | #include "portaudio.h"
7 |
8 | #include "portaudiocpp/DirectionSpecificStreamParameters.hxx"
9 |
10 | // ---------------------------------------------------------------------------------------
11 |
12 | // Declaration(s):
13 | namespace portaudio
14 | {
15 |
16 | //////
17 | /// @brief The entire set of parameters needed to configure and open
18 | /// a Stream.
19 | ///
20 | /// It contains parameters of input, output and shared parameters.
21 | /// Using the isSupported() method, the StreamParameters can be
22 | /// checked if opening a Stream using this StreamParameters would
23 | /// succeed or not. Accessors are provided to higher-level parameters
24 | /// aswell as the lower-level parameters which are mainly intended for
25 | /// internal use.
26 | //////
27 | class StreamParameters
28 | {
29 | public:
30 | StreamParameters();
31 | StreamParameters(const DirectionSpecificStreamParameters &inputParameters,
32 | const DirectionSpecificStreamParameters &outputParameters, double sampleRate,
33 | unsigned long framesPerBuffer, PaStreamFlags flags);
34 |
35 | // Set up for direction-specific:
36 | void setInputParameters(const DirectionSpecificStreamParameters ¶meters);
37 | void setOutputParameters(const DirectionSpecificStreamParameters ¶meters);
38 |
39 | // Set up for common parameters:
40 | void setSampleRate(double sampleRate);
41 | void setFramesPerBuffer(unsigned long framesPerBuffer);
42 | void setFlag(PaStreamFlags flag);
43 | void unsetFlag(PaStreamFlags flag);
44 | void clearFlags();
45 |
46 | // Validation:
47 | bool isSupported() const;
48 |
49 | // Accessors (direction-specific):
50 | DirectionSpecificStreamParameters &inputParameters();
51 | const DirectionSpecificStreamParameters &inputParameters() const;
52 | DirectionSpecificStreamParameters &outputParameters();
53 | const DirectionSpecificStreamParameters &outputParameters() const;
54 |
55 | // Accessors (common):
56 | double sampleRate() const;
57 | unsigned long framesPerBuffer() const;
58 | PaStreamFlags flags() const;
59 | bool isFlagSet(PaStreamFlags flag) const;
60 |
61 | private:
62 | // Half-duplex specific parameters:
63 | DirectionSpecificStreamParameters inputParameters_;
64 | DirectionSpecificStreamParameters outputParameters_;
65 |
66 | // Common parameters:
67 | double sampleRate_;
68 | unsigned long framesPerBuffer_;
69 | PaStreamFlags flags_;
70 | };
71 |
72 |
73 | } // namespace portaudio
74 |
75 | // ---------------------------------------------------------------------------------------
76 |
77 | #endif // INCLUDED_PORTAUDIO_STREAMPARAMETERS_HXX
78 |
--------------------------------------------------------------------------------
/portaudio/bindings/cpp/include/portaudiocpp/CppFunCallbackStream.hxx:
--------------------------------------------------------------------------------
1 | #ifndef INCLUDED_PORTAUDIO_CPPFUNCALLBACKSTREAM_HXX
2 | #define INCLUDED_PORTAUDIO_CPPFUNCALLBACKSTREAM_HXX
3 |
4 | // ---------------------------------------------------------------------------------------
5 |
6 | #include "portaudio.h"
7 |
8 | #include "portaudiocpp/CallbackStream.hxx"
9 |
10 | // ---------------------------------------------------------------------------------------
11 |
12 | // Forward declaration(s):
13 | namespace portaudio
14 | {
15 | class StreamParameters;
16 | }
17 |
18 | // ---------------------------------------------------------------------------------------
19 |
20 | // Declaration(s):
21 | namespace portaudio
22 | {
23 |
24 |
25 | namespace impl
26 | {
27 | extern "C"
28 | {
29 | int cppCallbackToPaCallbackAdapter(const void *inputBuffer, void *outputBuffer, unsigned long numFrames,
30 | const PaStreamCallbackTimeInfo *timeInfo, PaStreamCallbackFlags statusFlags,
31 | void *userData);
32 | } // extern "C"
33 | }
34 |
35 | // -----------------------------------------------------------------------------------
36 |
37 | //////
38 | /// @brief Callback stream using a C++ function (either a free function or a static function)
39 | /// callback.
40 | //////
41 | class FunCallbackStream : public CallbackStream
42 | {
43 | public:
44 | typedef int (*CallbackFunPtr)(const void *inputBuffer, void *outputBuffer, unsigned long numFrames,
45 | const PaStreamCallbackTimeInfo *timeInfo, PaStreamCallbackFlags statusFlags,
46 | void *userData);
47 |
48 | // -------------------------------------------------------------------------------
49 |
50 | //////
51 | /// @brief Simple structure containing a function pointer to the C++ callback function and a
52 | /// (void) pointer to the user supplied data.
53 | //////
54 | struct CppToCCallbackData
55 | {
56 | CppToCCallbackData();
57 | CppToCCallbackData(CallbackFunPtr funPtr, void *userData);
58 | void init(CallbackFunPtr funPtr, void *userData);
59 |
60 | CallbackFunPtr funPtr;
61 | void *userData;
62 | };
63 |
64 | // -------------------------------------------------------------------------------
65 |
66 | FunCallbackStream();
67 | FunCallbackStream(const StreamParameters ¶meters, CallbackFunPtr funPtr, void *userData);
68 | ~FunCallbackStream();
69 |
70 | void open(const StreamParameters ¶meters, CallbackFunPtr funPtr, void *userData);
71 |
72 | private:
73 | FunCallbackStream(const FunCallbackStream &); // non-copyable
74 | FunCallbackStream &operator=(const FunCallbackStream &); // non-copyable
75 |
76 | CppToCCallbackData adapterData_;
77 |
78 | void open(const StreamParameters ¶meters);
79 | };
80 |
81 |
82 | } // portaudio
83 |
84 | // ---------------------------------------------------------------------------------------
85 |
86 | #endif // INCLUDED_PORTAUDIO_CPPFUNCALLBACKSTREAM_HXX
87 |
--------------------------------------------------------------------------------
/portaudio/src/hostapi/oss/recplay.c:
--------------------------------------------------------------------------------
1 | /*
2 | * recplay.c
3 | * Phil Burk
4 | * Minimal record and playback test.
5 | *
6 | */
7 | #include
8 | #include
9 | #include
10 | #ifndef __STDC__
11 | /* #include */
12 | #endif /* __STDC__ */
13 | #include
14 | #ifdef __STDC__
15 | #include
16 | #else /* __STDC__ */
17 | #include
18 | #endif /* __STDC__ */
19 | #include
20 |
21 | #define NUM_BYTES (64*1024)
22 | #define BLOCK_SIZE (4*1024)
23 |
24 | #define AUDIO "/dev/dsp"
25 |
26 | char buffer[NUM_BYTES];
27 |
28 | int audioDev = 0;
29 |
30 | main (int argc, char *argv[])
31 | {
32 | int numLeft;
33 | char *ptr;
34 | int num;
35 | int samplesize;
36 |
37 | /********** RECORD ********************/
38 | /* Open audio device. */
39 | audioDev = open (AUDIO, O_RDONLY, 0);
40 | if (audioDev == -1)
41 | {
42 | perror (AUDIO);
43 | exit (-1);
44 | }
45 |
46 | /* Set to 16 bit samples. */
47 | samplesize = 16;
48 | ioctl(audioDev, SNDCTL_DSP_SAMPLESIZE, &samplesize);
49 | if (samplesize != 16)
50 | {
51 | perror("Unable to set the sample size.");
52 | exit(-1);
53 | }
54 |
55 | /* Record in blocks */
56 | printf("Begin recording.\n");
57 | numLeft = NUM_BYTES;
58 | ptr = buffer;
59 | while( numLeft >= BLOCK_SIZE )
60 | {
61 | if ( (num = read (audioDev, ptr, BLOCK_SIZE)) < 0 )
62 | {
63 | perror (AUDIO);
64 | exit (-1);
65 | }
66 | else
67 | {
68 | printf("Read %d bytes\n", num);
69 | ptr += num;
70 | numLeft -= num;
71 | }
72 | }
73 |
74 | close( audioDev );
75 |
76 | /********** PLAYBACK ********************/
77 | /* Open audio device for writing. */
78 | audioDev = open (AUDIO, O_WRONLY, 0);
79 | if (audioDev == -1)
80 | {
81 | perror (AUDIO);
82 | exit (-1);
83 | }
84 |
85 | /* Set to 16 bit samples. */
86 | samplesize = 16;
87 | ioctl(audioDev, SNDCTL_DSP_SAMPLESIZE, &samplesize);
88 | if (samplesize != 16)
89 | {
90 | perror("Unable to set the sample size.");
91 | exit(-1);
92 | }
93 |
94 | /* Play in blocks */
95 | printf("Begin playing.\n");
96 | numLeft = NUM_BYTES;
97 | ptr = buffer;
98 | while( numLeft >= BLOCK_SIZE )
99 | {
100 | if ( (num = write (audioDev, ptr, BLOCK_SIZE)) < 0 )
101 | {
102 | perror (AUDIO);
103 | exit (-1);
104 | }
105 | else
106 | {
107 | printf("Wrote %d bytes\n", num);
108 | ptr += num;
109 | numLeft -= num;
110 | }
111 | }
112 |
113 | close( audioDev );
114 | }
115 |
--------------------------------------------------------------------------------
/portaudio/bindings/cpp/SConscript:
--------------------------------------------------------------------------------
1 | import os.path
2 |
3 | Import("env", "buildDir")
4 | env.Append(CPPPATH="include")
5 |
6 | ApiVer = "0.0.12"
7 | Major, Minor, Micro = [int(c) for c in ApiVer.split(".")]
8 |
9 | sharedLibs = []
10 | staticLibs = []
11 | Import("Platform", "Posix")
12 | if Platform in Posix:
13 | env["SHLIBSUFFIX"] = ".so.%d.%d.%d" % (Major, Minor, Micro)
14 | soFile = "libportaudiocpp.so"
15 | if Platform != 'darwin':
16 | env.AppendUnique(SHLINKFLAGS="-Wl,-soname=%s.%d" % (soFile, Major))
17 |
18 | # Create symlinks
19 | def symlink(env, target, source):
20 | trgt = str(target[0])
21 | src = str(source[0])
22 | if os.path.islink(trgt) or os.path.exists(trgt):
23 | os.remove(trgt)
24 | os.symlink(os.path.basename(src), trgt)
25 | lnk0 = env.Command(soFile + ".%d" % (Major), soFile + ".%d.%d.%d" % (Major, Minor, Micro), symlink)
26 | lnk1 = env.Command(soFile, soFile + ".%d" % (Major), symlink)
27 | sharedLibs.append(lnk0)
28 | sharedLibs.append(lnk1)
29 |
30 | src = [os.path.join("source", "portaudiocpp", "%s.cxx" % f) for f in ("BlockingStream", "CallbackInterface", \
31 | "CallbackStream", "CFunCallbackStream","CppFunCallbackStream", "Device",
32 | "DirectionSpecificStreamParameters", "Exception", "HostApi", "InterfaceCallbackStream",
33 | "MemFunCallbackStream", "Stream", "StreamParameters", "System", "SystemDeviceIterator",
34 | "SystemHostApiIterator")]
35 | env.Append(LIBS="portaudio", LIBPATH=buildDir)
36 | sharedLib = env.SharedLibrary("portaudiocpp", src, LIBS=["portaudio"])
37 | staticLib = env.Library("portaudiocpp", src, LIBS=["portaudio"])
38 | sharedLibs.append(sharedLib)
39 | staticLibs.append(staticLib)
40 |
41 | headers = Split("""AutoSystem.hxx
42 | BlockingStream.hxx
43 | CallbackInterface.hxx
44 | CallbackStream.hxx
45 | CFunCallbackStream.hxx
46 | CppFunCallbackStream.hxx
47 | Device.hxx
48 | DirectionSpecificStreamParameters.hxx
49 | Exception.hxx
50 | HostApi.hxx
51 | InterfaceCallbackStream.hxx
52 | MemFunCallbackStream.hxx
53 | PortAudioCpp.hxx
54 | SampleDataFormat.hxx
55 | Stream.hxx
56 | StreamParameters.hxx
57 | SystemDeviceIterator.hxx
58 | SystemHostApiIterator.hxx
59 | System.hxx
60 | """)
61 | if env["PLATFORM"] == "win32":
62 | headers.append("AsioDeviceAdapter.hxx")
63 | headers = [File(os.path.join("include", "portaudiocpp", h)) for h in headers]
64 |
65 | Return("sharedLibs", "staticLibs", "headers")
66 |
--------------------------------------------------------------------------------
/portaudio/doc/src/tutorial/open_default_stream.dox:
--------------------------------------------------------------------------------
1 | /** @page open_default_stream Opening a Stream Using Defaults
2 | @ingroup tutorial
3 |
4 | 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.)
5 | @code
6 | #define SAMPLE_RATE (44100)
7 | static paTestData data;
8 |
9 | .....
10 |
11 | PaStream *stream;
12 | PaError err;
13 |
14 | /* Open an audio I/O stream. */
15 | err = Pa_OpenDefaultStream( &stream,
16 | 0, /* no input channels */
17 | 2, /* stereo output */
18 | paFloat32, /* 32 bit floating point output */
19 | SAMPLE_RATE,
20 | 256, /* frames per buffer, i.e. the number
21 | of sample frames that PortAudio will
22 | request from the callback. Many apps
23 | may want to use
24 | paFramesPerBufferUnspecified, which
25 | tells PortAudio to pick the best,
26 | possibly changing, buffer size.*/
27 | patestCallback, /* this is your callback function */
28 | &data ); /*This is a pointer that will be passed to
29 | your callback*/
30 | if( err != paNoError ) goto error;
31 | @endcode
32 |
33 | The data structure and callback are described in \ref writing_a_callback.
34 |
35 | 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.
36 |
37 | There are some caveats to note about simultaneous read/write:
38 |
39 | - Some platforms can only open a read/write stream using the same device.
40 | - Although multiple streams can be opened, it is difficult to synchronize them.
41 | - Some platforms don't support opening multiple streams on the same device.
42 | - Using multiple streams may not be as well tested as other features.
43 | - The PortAudio library calls must be made from the same thread or synchronized by the user.
44 |
45 |
46 | Previous: \ref initializing_portaudio | Next: \ref start_stop_abort
47 |
48 | */
--------------------------------------------------------------------------------
/portaudio/src/common/pa_cpuload.h:
--------------------------------------------------------------------------------
1 | #ifndef PA_CPULOAD_H
2 | #define PA_CPULOAD_H
3 | /*
4 | * $Id$
5 | * Portable Audio I/O Library CPU Load measurement functions
6 | * Portable CPU load measurement facility.
7 | *
8 | * Based on the Open Source API proposed by Ross Bencina
9 | * Copyright (c) 2002 Ross Bencina
10 | *
11 | * Permission is hereby granted, free of charge, to any person obtaining
12 | * a copy of this software and associated documentation files
13 | * (the "Software"), to deal in the Software without restriction,
14 | * including without limitation the rights to use, copy, modify, merge,
15 | * publish, distribute, sublicense, and/or sell copies of the Software,
16 | * and to permit persons to whom the Software is furnished to do so,
17 | * subject to the following conditions:
18 | *
19 | * The above copyright notice and this permission notice shall be
20 | * included in all copies or substantial portions of the Software.
21 | *
22 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
25 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
26 | * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
27 | * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 | */
30 |
31 | /*
32 | * The text above constitutes the entire PortAudio license; however,
33 | * the PortAudio community also makes the following non-binding requests:
34 | *
35 | * Any person wishing to distribute modifications to the Software is
36 | * requested to send the modifications to the original developer so that
37 | * they can be incorporated into the canonical version. It is also
38 | * requested that these non-binding requests be included along with the
39 | * license above.
40 | */
41 |
42 | /** @file
43 | @ingroup common_src
44 |
45 | @brief Functions to assist in measuring the CPU utilization of a callback
46 | stream. Used to implement the Pa_GetStreamCpuLoad() function.
47 | */
48 |
49 |
50 | #ifdef __cplusplus
51 | extern "C"
52 | {
53 | #endif /* __cplusplus */
54 |
55 |
56 | typedef struct {
57 | double samplingPeriod;
58 | double measurementStartTime;
59 | double averageLoad;
60 | } PaUtilCpuLoadMeasurer; /**< @todo need better name than measurer */
61 |
62 | void PaUtil_InitializeCpuLoadMeasurer( PaUtilCpuLoadMeasurer* measurer, double sampleRate );
63 | void PaUtil_BeginCpuLoadMeasurement( PaUtilCpuLoadMeasurer* measurer );
64 | void PaUtil_EndCpuLoadMeasurement( PaUtilCpuLoadMeasurer* measurer, unsigned long framesProcessed );
65 | void PaUtil_ResetCpuLoadMeasurer( PaUtilCpuLoadMeasurer* measurer );
66 | double PaUtil_GetCpuLoad( PaUtilCpuLoadMeasurer* measurer );
67 |
68 |
69 | #ifdef __cplusplus
70 | }
71 | #endif /* __cplusplus */
72 | #endif /* PA_CPULOAD_H */
73 |
--------------------------------------------------------------------------------
/portaudio/bindings/java/c/src/jpa_tools.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Portable Audio I/O Library
3 | * Java Binding for PortAudio
4 | *
5 | * Based on the Open Source API proposed by Ross Bencina
6 | * Copyright (c) 2008 Ross Bencina
7 | *
8 | * Permission is hereby granted, free of charge, to any person obtaining
9 | * a copy of this software and associated documentation files
10 | * (the "Software"), to deal in the Software without restriction,
11 | * including without limitation the rights to use, copy, modify, merge,
12 | * publish, distribute, sublicense, and/or sell copies of the Software,
13 | * and to permit persons to whom the Software is furnished to do so,
14 | * subject to the following conditions:
15 | *
16 | * The above copyright notice and this permission notice shall be
17 | * included in all copies or substantial portions of the Software.
18 | *
19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
22 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
23 | * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
24 | * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
25 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 | */
27 |
28 | /*
29 | * The text above constitutes the entire PortAudio license; however,
30 | * the PortAudio community also makes the following non-binding requests:
31 | *
32 | * Any person wishing to distribute modifications to the Software is
33 | * requested to send the modifications to the original developer so that
34 | * they can be incorporated into the canonical version. It is also
35 | * requested that these non-binding requests be included along with the
36 | * license above.
37 | */
38 |
39 | #include "com_portaudio_PortAudio.h"
40 | #include "portaudio.h"
41 |
42 | #ifndef JPA_TOOLS_H
43 | #define JPA_TOOLS_H
44 |
45 | jint jpa_GetIntField( JNIEnv *env, jclass cls, jobject obj, const char *fieldName );
46 | void jpa_SetIntField( JNIEnv *env, jclass cls, jobject obj, const char *fieldName, jint value );
47 |
48 | jlong jpa_GetLongField( JNIEnv *env, jclass cls, jobject obj, const char *fieldName );
49 | void jpa_SetLongField( JNIEnv *env, jclass cls, jobject obj, const char *fieldName, jlong value );
50 |
51 | jdouble jpa_GetDoubleField( JNIEnv *env, jclass cls, jobject obj, const char *fieldName );
52 | void jpa_SetDoubleField( JNIEnv *env, jclass cls, jobject obj, const char *fieldName, jdouble value );
53 |
54 | void jpa_SetStringField( JNIEnv *env, jclass cls, jobject obj, const char *fieldName, const char *value );
55 | PaStreamParameters *jpa_FillStreamParameters( JNIEnv *env, jobject jstreamParam, PaStreamParameters *myParams );
56 |
57 | jint jpa_CheckError( JNIEnv *env, PaError err );
58 | jint jpa_ThrowError( JNIEnv *env, const char *message );
59 |
60 | PaStream *jpa_GetStreamPointer( JNIEnv *env, jobject blockingStream );
61 |
62 | #endif /* JPA_TOOLS_H */
63 |
--------------------------------------------------------------------------------
/portaudio/include/pa_jack.h:
--------------------------------------------------------------------------------
1 | #ifndef PA_JACK_H
2 | #define PA_JACK_H
3 |
4 | /*
5 | * $Id:
6 | * PortAudio Portable Real-Time Audio Library
7 | * JACK-specific extensions
8 | *
9 | * Copyright (c) 1999-2000 Ross Bencina and Phil Burk
10 | *
11 | * Permission is hereby granted, free of charge, to any person obtaining
12 | * a copy of this software and associated documentation files
13 | * (the "Software"), to deal in the Software without restriction,
14 | * including without limitation the rights to use, copy, modify, merge,
15 | * publish, distribute, sublicense, and/or sell copies of the Software,
16 | * and to permit persons to whom the Software is furnished to do so,
17 | * subject to the following conditions:
18 | *
19 | * The above copyright notice and this permission notice shall be
20 | * included in all copies or substantial portions of the Software.
21 | *
22 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
25 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
26 | * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
27 | * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 | */
30 |
31 | /*
32 | * The text above constitutes the entire PortAudio license; however,
33 | * the PortAudio community also makes the following non-binding requests:
34 | *
35 | * Any person wishing to distribute modifications to the Software is
36 | * requested to send the modifications to the original developer so that
37 | * they can be incorporated into the canonical version. It is also
38 | * requested that these non-binding requests be included along with the
39 | * license above.
40 | */
41 |
42 | /** @file
43 | * @ingroup public_header
44 | * @brief JACK-specific PortAudio API extension header file.
45 | */
46 |
47 | #include "portaudio.h"
48 |
49 | #ifdef __cplusplus
50 | extern "C" {
51 | #endif
52 |
53 | /** Set the JACK client name.
54 | *
55 | * During Pa_Initialize, When PA JACK connects as a client of the JACK server, it requests a certain
56 | * name, which is for instance prepended to port names. By default this name is "PortAudio". The
57 | * JACK server may append a suffix to the client name, in order to avoid clashes among clients that
58 | * try to connect with the same name (e.g., different PA JACK clients).
59 | *
60 | * This function must be called before Pa_Initialize, otherwise it won't have any effect. Note that
61 | * the string is not copied, but instead referenced directly, so it must not be freed for as long as
62 | * PA might need it.
63 | * @sa PaJack_GetClientName
64 | */
65 | PaError PaJack_SetClientName( const char* name );
66 |
67 | /** Get the JACK client name used by PA JACK.
68 | *
69 | * The caller is responsible for freeing the returned pointer.
70 | */
71 | PaError PaJack_GetClientName(const char** clientName);
72 |
73 | #ifdef __cplusplus
74 | }
75 | #endif
76 |
77 | #endif
78 |
--------------------------------------------------------------------------------
/portaudio/bindings/cpp/include/portaudiocpp/Device.hxx:
--------------------------------------------------------------------------------
1 | #ifndef INCLUDED_PORTAUDIO_DEVICE_HXX
2 | #define INCLUDED_PORTAUDIO_DEVICE_HXX
3 |
4 | // ---------------------------------------------------------------------------------------
5 |
6 | #include
7 |
8 | #include "portaudio.h"
9 |
10 | #include "portaudiocpp/SampleDataFormat.hxx"
11 |
12 | // ---------------------------------------------------------------------------------------
13 |
14 | // Forward declaration(s):
15 | namespace portaudio
16 | {
17 | class System;
18 | class HostApi;
19 | }
20 |
21 | // ---------------------------------------------------------------------------------------
22 |
23 | // Declaration(s):
24 | namespace portaudio
25 | {
26 |
27 | //////
28 | /// @brief Class which represents a PortAudio device in the System.
29 | ///
30 | /// A single physical device in the system may have multiple PortAudio
31 | /// Device representations using different HostApi 's though. A Device
32 | /// can be half-duplex or full-duplex. A half-duplex Device can be used
33 | /// to create a half-duplex Stream. A full-duplex Device can be used to
34 | /// create a full-duplex Stream. If supported by the HostApi, two
35 | /// half-duplex Devices can even be used to create a full-duplex Stream.
36 | ///
37 | /// Note that Device objects are very light-weight and can be passed around
38 | /// by-value.
39 | //////
40 | class Device
41 | {
42 | public:
43 | // query info: name, max in channels, max out channels,
44 | // default low/hight input/output latency, default sample rate
45 | PaDeviceIndex index() const;
46 | const char *name() const;
47 | int maxInputChannels() const;
48 | int maxOutputChannels() const;
49 | PaTime defaultLowInputLatency() const;
50 | PaTime defaultHighInputLatency() const;
51 | PaTime defaultLowOutputLatency() const;
52 | PaTime defaultHighOutputLatency() const;
53 | double defaultSampleRate() const;
54 |
55 | bool isInputOnlyDevice() const; // extended
56 | bool isOutputOnlyDevice() const; // extended
57 | bool isFullDuplexDevice() const; // extended
58 | bool isSystemDefaultInputDevice() const; // extended
59 | bool isSystemDefaultOutputDevice() const; // extended
60 | bool isHostApiDefaultInputDevice() const; // extended
61 | bool isHostApiDefaultOutputDevice() const; // extended
62 |
63 | bool operator==(const Device &rhs) const;
64 | bool operator!=(const Device &rhs) const;
65 |
66 | // host api reference
67 | HostApi &hostApi();
68 | const HostApi &hostApi() const;
69 |
70 | private:
71 | PaDeviceIndex index_;
72 | const PaDeviceInfo *info_;
73 |
74 | private:
75 | friend class System;
76 |
77 | explicit Device(PaDeviceIndex index);
78 | ~Device();
79 |
80 | Device(const Device &); // non-copyable
81 | Device &operator=(const Device &); // non-copyable
82 | };
83 |
84 | // -----------------------------------------------------------------------------------
85 |
86 | } // namespace portaudio
87 |
88 | // ---------------------------------------------------------------------------------------
89 |
90 | #endif // INCLUDED_PORTAUDIO_DEVICE_HXX
91 |
92 |
--------------------------------------------------------------------------------
/portaudio/doc/utils/checkfiledocs.py:
--------------------------------------------------------------------------------
1 | import os
2 | import os.path
3 | import string
4 |
5 | paRootDirectory = '../../'
6 | paHtmlDocDirectory = os.path.join( paRootDirectory, "doc", "html" )
7 |
8 | ## Script to check documentation status
9 | ## this script assumes that html doxygen documentation has been generated
10 | ##
11 | ## it then walks the entire portaudio source tree and check that
12 | ## - every source file (.c,.h,.cpp) has a doxygen comment block containing
13 | ## - a @file directive
14 | ## - a @brief directive
15 | ## - a @ingroup directive
16 | ## - it also checks that a corresponding html documentation file has been generated.
17 | ##
18 | ## This can be used as a first-level check to make sure the documentation is in order.
19 | ##
20 | ## The idea is to get a list of which files are missing doxygen documentation.
21 | ##
22 | ## How to run:
23 | ## $ cd doc/utils
24 | ## $ python checkfiledocs.py
25 |
26 | def oneOf_a_in_b(a, b):
27 | for x in a:
28 | if x in b:
29 | return True
30 | return False
31 |
32 | # recurse from top and return a list of all with the given
33 | # extensions. ignore .svn directories. return absolute paths
34 | def recursiveFindFiles( top, extensions, dirBlacklist, includePaths ):
35 | result = []
36 | for (dirpath, dirnames, filenames) in os.walk(top):
37 | if not oneOf_a_in_b(dirBlacklist, dirpath):
38 | for f in filenames:
39 | if os.path.splitext(f)[1] in extensions:
40 | if includePaths:
41 | result.append( os.path.abspath( os.path.join( dirpath, f ) ) )
42 | else:
43 | result.append( f )
44 | return result
45 |
46 | # generate the html file name that doxygen would use for
47 | # a particular source file. this is a brittle conversion
48 | # which i worked out by trial and error
49 | def doxygenHtmlDocFileName( sourceFile ):
50 | return sourceFile.replace( '_', '__' ).replace( '.', '_8' ) + '.html'
51 |
52 |
53 | sourceFiles = recursiveFindFiles( os.path.join(paRootDirectory,'src'), [ '.c', '.h', '.cpp' ], ['.svn', 'mingw-include'], True );
54 | sourceFiles += recursiveFindFiles( os.path.join(paRootDirectory,'include'), [ '.c', '.h', '.cpp' ], ['.svn'], True );
55 | docFiles = recursiveFindFiles( paHtmlDocDirectory, [ '.html' ], ['.svn'], False );
56 |
57 |
58 |
59 | currentFile = ""
60 |
61 | def printError( f, message ):
62 | global currentFile
63 | if f != currentFile:
64 | currentFile = f
65 | print f, ":"
66 | print "\t!", message
67 |
68 |
69 | for f in sourceFiles:
70 | if not doxygenHtmlDocFileName( os.path.basename(f) ) in docFiles:
71 | printError( f, "no doxygen generated doc page" )
72 |
73 | s = file( f, 'rt' ).read()
74 |
75 | if not '/**' in s:
76 | printError( f, "no doxygen /** block" )
77 |
78 | if not '@file' in s:
79 | printError( f, "no doxygen @file tag" )
80 |
81 | if not '@brief' in s:
82 | printError( f, "no doxygen @brief tag" )
83 |
84 | if not '@ingroup' in s:
85 | printError( f, "no doxygen @ingroup tag" )
86 |
87 |
88 |
--------------------------------------------------------------------------------
/portaudio/bindings/cpp/include/portaudiocpp/System.hxx:
--------------------------------------------------------------------------------
1 | #ifndef INCLUDED_PORTAUDIO_SYSTEM_HXX
2 | #define INCLUDED_PORTAUDIO_SYSTEM_HXX
3 |
4 | // ---------------------------------------------------------------------------------------
5 |
6 | #include "portaudio.h"
7 |
8 | // ---------------------------------------------------------------------------------------
9 |
10 | // Forward declaration(s):
11 | namespace portaudio
12 | {
13 | class Device;
14 | class Stream;
15 | class HostApi;
16 | }
17 |
18 | // ---------------------------------------------------------------------------------------
19 |
20 | // Declaration(s):
21 | namespace portaudio
22 | {
23 |
24 |
25 | //////
26 | /// @brief System singleton which represents the PortAudio system.
27 | ///
28 | /// The System is used to initialize/terminate PortAudio and provide
29 | /// a single acccess point to the PortAudio System (instance()).
30 | /// It can be used to iterate through all HostApi 's in the System as
31 | /// well as all devices in the System. It also provides some utility
32 | /// functionality of PortAudio.
33 | ///
34 | /// Terminating the System will also abort and close the open streams.
35 | /// The Stream objects will need to be deallocated by the client though
36 | /// (it's usually a good idea to have them cleaned up automatically).
37 | //////
38 | class System
39 | {
40 | public:
41 | class HostApiIterator; // forward declaration
42 | class DeviceIterator; // forward declaration
43 |
44 | // -------------------------------------------------------------------------------
45 |
46 | static int version();
47 | static const char *versionText();
48 |
49 | static void initialize();
50 | static void terminate();
51 |
52 | static System &instance();
53 | static bool exists();
54 |
55 | // -------------------------------------------------------------------------------
56 |
57 | // host apis:
58 | HostApiIterator hostApisBegin();
59 | HostApiIterator hostApisEnd();
60 |
61 | HostApi &defaultHostApi();
62 |
63 | HostApi &hostApiByTypeId(PaHostApiTypeId type);
64 | HostApi &hostApiByIndex(PaHostApiIndex index);
65 |
66 | int hostApiCount();
67 |
68 | // -------------------------------------------------------------------------------
69 |
70 | // devices:
71 | DeviceIterator devicesBegin();
72 | DeviceIterator devicesEnd();
73 |
74 | Device &defaultInputDevice();
75 | Device &defaultOutputDevice();
76 |
77 | Device &deviceByIndex(PaDeviceIndex index);
78 |
79 | int deviceCount();
80 |
81 | static Device &nullDevice();
82 |
83 | // -------------------------------------------------------------------------------
84 |
85 | // misc:
86 | void sleep(long msec);
87 | int sizeOfSample(PaSampleFormat format);
88 |
89 | private:
90 | System();
91 | ~System();
92 |
93 | static System *instance_;
94 | static int initCount_;
95 |
96 | static HostApi **hostApis_;
97 | static Device **devices_;
98 |
99 | static Device *nullDevice_;
100 | };
101 |
102 |
103 | } // namespace portaudio
104 |
105 |
106 | #endif // INCLUDED_PORTAUDIO_SYSTEM_HXX
107 |
108 |
--------------------------------------------------------------------------------
/portaudio/doc/src/mainpage.dox:
--------------------------------------------------------------------------------
1 | /* doxygen index page */
2 | /** @mainpage
3 |
4 | @section overview Overview
5 |
6 | PortAudio is a cross-platform, open-source C language library for real-time audio input and output.
7 | 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 @ref java_binding "Java", C++, C#, Python, PureBasic, FreePascal and Lazarus.
8 |
9 | @section start_here Start here
10 |
11 | - @ref api_overview
12 | A top-down view of the PortAudio API, its capabilities, functions and data structures
13 |
14 | - @ref tutorial_start
15 | Get started writing code with PortAudio tutorials
16 |
17 | - @ref examples_src "Examples"
18 | Simple example programs demonstrating PortAudio usage
19 |
20 | - @ref License
21 | PortAudio is licenced under the MIT Expat open source licence. We make a non-binding request for you to contribute your changes back to the project.
22 |
23 |
24 | @section reference API Reference
25 |
26 | - portaudio.h Portable API
27 | Detailed documentation for each portable API function and data type
28 |
29 | - @ref public_header "Host API Specific Extensions"
30 | Documentation for non-portable platform-specific host API extensions
31 |
32 |
33 | @section resources Resources
34 |
35 | - The PortAudio website
36 |
37 | - Our mailing list for users and developers
38 |
39 | - The PortAudio wiki
40 |
41 | @section developer_resources Developer Resources
42 |
43 | @if INTERNAL
44 | - @ref srcguide
45 | @endif
46 |
47 | - Our wiki and issue tracking system
48 |
49 | - Developer guidelines
50 |
51 | - Implementation style guidelines
52 |
53 | 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.
54 |
55 |
56 | @section older_api_versions Older API Versions
57 |
58 | 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:
59 | http://www.portaudio.com/docs/proposals/index.html
60 |
61 | */
--------------------------------------------------------------------------------
/portaudio/qa/loopback/src/qa_tools.h:
--------------------------------------------------------------------------------
1 |
2 | /*
3 | * PortAudio Portable Real-Time Audio Library
4 | * Latest Version at: http://www.portaudio.com
5 | *
6 | * Copyright (c) 1999-2010 Phil Burk and Ross Bencina
7 | *
8 | * Permission is hereby granted, free of charge, to any person obtaining
9 | * a copy of this software and associated documentation files
10 | * (the "Software"), to deal in the Software without restriction,
11 | * including without limitation the rights to use, copy, modify, merge,
12 | * publish, distribute, sublicense, and/or sell copies of the Software,
13 | * and to permit persons to whom the Software is furnished to do so,
14 | * subject to the following conditions:
15 | *
16 | * The above copyright notice and this permission notice shall be
17 | * included in all copies or substantial portions of the Software.
18 | *
19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
22 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
23 | * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
24 | * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
25 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 | */
27 |
28 | /*
29 | * The text above constitutes the entire PortAudio license; however,
30 | * the PortAudio community also makes the following non-binding requests:
31 | *
32 | * Any person wishing to distribute modifications to the Software is
33 | * requested to send the modifications to the original developer so that
34 | * they can be incorporated into the canonical version. It is also
35 | * requested that these non-binding requests be included along with the
36 | * license above.
37 | */
38 |
39 | #ifndef _QA_TOOLS_H
40 | #define _QA_TOOLS_H
41 |
42 | extern int g_testsPassed;
43 | extern int g_testsFailed;
44 |
45 | #define QA_ASSERT_TRUE( message, flag ) \
46 | if( !(flag) ) \
47 | { \
48 | printf( "%s:%d - ERROR - %s\n", __FILE__, __LINE__, message ); \
49 | g_testsFailed++; \
50 | goto error; \
51 | } \
52 | else g_testsPassed++;
53 |
54 |
55 | #define QA_ASSERT_EQUALS( message, expected, actual ) \
56 | if( ((expected) != (actual)) ) \
57 | { \
58 | printf( "%s:%d - ERROR - %s, expected %d, got %d\n", __FILE__, __LINE__, message, expected, actual ); \
59 | g_testsFailed++; \
60 | goto error; \
61 | } \
62 | else g_testsPassed++;
63 |
64 | #define QA_ASSERT_CLOSE( message, expected, actual, tolerance ) \
65 | if (fabs((expected)-(actual))>(tolerance)) \
66 | { \
67 | printf( "%s:%d - ERROR - %s, expected %f, got %f, tol=%f\n", __FILE__, __LINE__, message, ((double)(expected)), ((double)(actual)), ((double)(tolerance)) ); \
68 | g_testsFailed++; \
69 | goto error; \
70 | } \
71 | else g_testsPassed++;
72 |
73 | #define QA_ASSERT_CLOSE_INT( message, expected, actual, tolerance ) \
74 | if (abs((expected)-(actual))>(tolerance)) \
75 | { \
76 | printf( "%s:%d - ERROR - %s, expected %d, got %d, tol=%d\n", __FILE__, __LINE__, message, ((int)(expected)), ((int)(actual)), ((int)(tolerance)) ); \
77 | g_testsFailed++; \
78 | goto error; \
79 | } \
80 | else g_testsPassed++;
81 |
82 |
83 | #endif
84 |
--------------------------------------------------------------------------------
/portaudio/bindings/cpp/source/portaudiocpp/HostApi.cxx:
--------------------------------------------------------------------------------
1 | #include "portaudiocpp/HostApi.hxx"
2 |
3 | #include "portaudiocpp/System.hxx"
4 | #include "portaudiocpp/Device.hxx"
5 | #include "portaudiocpp/SystemDeviceIterator.hxx"
6 | #include "portaudiocpp/Exception.hxx"
7 |
8 | namespace portaudio
9 | {
10 |
11 | // -----------------------------------------------------------------------------------
12 |
13 | HostApi::HostApi(PaHostApiIndex index) : devices_(NULL)
14 | {
15 | try
16 | {
17 | info_ = Pa_GetHostApiInfo(index);
18 |
19 | // Create and populate devices array:
20 | int numDevices = deviceCount();
21 |
22 | devices_ = new Device*[numDevices];
23 |
24 | for (int i = 0; i < numDevices; ++i)
25 | {
26 | PaDeviceIndex deviceIndex = Pa_HostApiDeviceIndexToDeviceIndex(index, i);
27 |
28 | if (deviceIndex < 0)
29 | {
30 | throw PaException(deviceIndex);
31 | }
32 |
33 | devices_[i] = &System::instance().deviceByIndex(deviceIndex);
34 | }
35 | }
36 | catch (const std::exception &e)
37 | {
38 | // Delete any (partially) constructed objects (deconstructor isn't called):
39 | delete[] devices_; // devices_ is either NULL or valid
40 |
41 | // Re-throw exception:
42 | throw e;
43 | }
44 | }
45 |
46 | HostApi::~HostApi()
47 | {
48 | // Destroy devices array:
49 | delete[] devices_;
50 | }
51 |
52 | // -----------------------------------------------------------------------------------
53 |
54 | PaHostApiTypeId HostApi::typeId() const
55 | {
56 | return info_->type;
57 | }
58 |
59 | PaHostApiIndex HostApi::index() const
60 | {
61 | PaHostApiIndex index = Pa_HostApiTypeIdToHostApiIndex(typeId());
62 |
63 | if (index < 0)
64 | throw PaException(index);
65 |
66 | return index;
67 | }
68 |
69 | const char *HostApi::name() const
70 | {
71 | return info_->name;
72 | }
73 |
74 | int HostApi::deviceCount() const
75 | {
76 | return info_->deviceCount;
77 | }
78 |
79 | // -----------------------------------------------------------------------------------
80 |
81 | HostApi::DeviceIterator HostApi::devicesBegin()
82 | {
83 | DeviceIterator tmp;
84 | tmp.ptr_ = &devices_[0]; // begin (first element)
85 | return tmp;
86 | }
87 |
88 | HostApi::DeviceIterator HostApi::devicesEnd()
89 | {
90 | DeviceIterator tmp;
91 | tmp.ptr_ = &devices_[deviceCount()]; // end (one past last element)
92 | return tmp;
93 | }
94 |
95 | // -----------------------------------------------------------------------------------
96 |
97 | Device &HostApi::defaultInputDevice() const
98 | {
99 | return System::instance().deviceByIndex(info_->defaultInputDevice);
100 | }
101 |
102 | Device &HostApi::defaultOutputDevice() const
103 | {
104 | return System::instance().deviceByIndex(info_->defaultOutputDevice);
105 | }
106 |
107 | // -----------------------------------------------------------------------------------
108 |
109 | bool HostApi::operator==(const HostApi &rhs) const
110 | {
111 | return (typeId() == rhs.typeId());
112 | }
113 |
114 | bool HostApi::operator!=(const HostApi &rhs) const
115 | {
116 | return !(*this == rhs);
117 | }
118 |
119 | // -----------------------------------------------------------------------------------
120 |
121 | } // namespace portaudio
122 |
--------------------------------------------------------------------------------
/portaudio/doc/src/tutorial/tutorial_start.dox:
--------------------------------------------------------------------------------
1 | /** @page tutorial_start PortAudio Tutorials
2 | @ingroup tutorial
3 |
4 | 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 @ref api_overview.
5 |
6 | @section tut_start1 Downloading
7 |
8 | First thing you need to do is download the PortAudio source code either as a tarball from the website, or from the Subversion Repository.
9 |
10 | @section tut_start2 Compiling
11 |
12 | Once you've downloaded PortAudio you'll need to compile it, which of course, depends on your environment:
13 |
14 | - Windows
15 | - \ref compile_windows
16 | - \ref compile_windows_mingw
17 | - \ref compile_windows_asio_msvc
18 | - \ref compile_cmake
19 | - Mac OS X
20 | - \ref compile_mac_coreaudio
21 | - POSIX
22 | - \ref compile_linux
23 |
24 | Many platforms with GCC/make can use the simple ./configure && make combination and simply use the resulting libraries in their code.
25 |
26 | @section tut_start3 Programming with PortAudio
27 |
28 | Below are the steps to writing a PortAudio application using the callback technique:
29 |
30 | - Write a callback function that will be called by PortAudio when audio processing is needed.
31 | - Initialize the PA library and open a stream for audio I/O.
32 | - Start the stream. Your callback function will be now be called repeatedly by PA in the background.
33 | - In your callback you can read audio data from the inputBuffer and/or write data to the outputBuffer.
34 | - Stop the stream by returning 1 from your callback, or by calling a stop function.
35 | - Close the stream and terminate the library.
36 |
37 | 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.
38 |
39 | 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.
40 |
41 | @section tut_start4 Programming Tutorial Contents
42 |
43 | - \ref writing_a_callback
44 | - \ref initializing_portaudio
45 | - \ref open_default_stream
46 | - \ref start_stop_abort
47 | - \ref terminating_portaudio
48 | - \ref utility_functions
49 | - \ref querying_devices
50 | - \ref blocking_read_write
51 |
52 | 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.
53 |
54 | Once you have a basic understanding of how to use PortAudio, you might be interested in \ref exploring.
55 |
56 | Next: \ref writing_a_callback
57 |
58 | */
--------------------------------------------------------------------------------
/portaudio/bindings/cpp/build/gnu/Makefile.in:
--------------------------------------------------------------------------------
1 | #
2 | # Makefile template for PortAudioCpp
3 | # Ludwig Schwardt
4 | # 01/10/2003
5 | #
6 | # Not much to edit here - rather check configure.ac
7 | #
8 |
9 | PREFIX = @prefix@
10 | CC = @CC@
11 | CXX = @CXX@
12 | CFLAGS = @CFLAGS@ @DEFS@
13 | CXXFLAGS = @CXXFLAGS@
14 | SHARED_FLAGS = @SHARED_FLAGS@
15 | LIBS = @LIBS@
16 | DLL_LIBS = @DLL_LIBS@
17 | AR = @AR@
18 | RANLIB = @RANLIB@
19 | INSTALL = @INSTALL@
20 |
21 | PACPP_ROOT = @PACPP_ROOT@
22 | PORTAUDIO = @PORTAUDIO@
23 | PADLL = @PADLL@
24 | PACPP_DLL = @PACPP_DLL@
25 | PALIB = libportaudio.a
26 | PACPP_LIB = libportaudiocpp.a
27 | PACPP_DLLV = $(PACPP_DLL).0.0.12
28 |
29 | SRCDIR = $(PACPP_ROOT)/source/portaudiocpp
30 | BINDIR = $(PACPP_ROOT)/example
31 | LIBDIR = $(PACPP_ROOT)/lib
32 | DOCDIR = $(PACPP_ROOT)/doc
33 |
34 | OBJS = \
35 | $(SRCDIR)/BlockingStream.o \
36 | $(SRCDIR)/CallbackInterface.o \
37 | $(SRCDIR)/CallbackStream.o \
38 | $(SRCDIR)/CFunCallbackStream.o \
39 | $(SRCDIR)/CppFunCallbackStream.o \
40 | $(SRCDIR)/Device.o \
41 | $(SRCDIR)/DirectionSpecificStreamParameters.o \
42 | $(SRCDIR)/Exception.o \
43 | $(SRCDIR)/HostApi.o \
44 | $(SRCDIR)/InterfaceCallbackStream.o \
45 | $(SRCDIR)/MemFunCallbackStream.o \
46 | $(SRCDIR)/Stream.o \
47 | $(SRCDIR)/StreamParameters.o \
48 | $(SRCDIR)/System.o \
49 | $(SRCDIR)/SystemDeviceIterator.o \
50 | $(SRCDIR)/SystemHostApiIterator.o
51 |
52 | # Not supported yet
53 | # $(SRCDIR)/AsioDeviceAdapter.o
54 |
55 | EXAMPLES = \
56 | $(BINDIR)/devs \
57 | $(BINDIR)/sine
58 |
59 | .PHONY: all clean docs
60 |
61 | all: $(EXAMPLES) $(LIBDIR)/$(PACPP_LIB) $(LIBDIR)/$(PACPP_DLL)
62 |
63 | clean:
64 | rm -rf $(SRCDIR)/*.o $(BINDIR)/*.o $(EXAMPLES) $(LIBDIR) $(DOCDIR)/api_reference
65 | rm -rf autom4te.cache config.status config.log
66 |
67 | docs:
68 | cd $(DOCDIR); doxygen config.doxy.linux
69 |
70 | %.o: %.c
71 | $(CC) -c $(CFLAGS) $< -o $@
72 |
73 | %.o: %.cxx
74 | $(CXX) -c $(CXXFLAGS) $< -o $@
75 |
76 |
77 | $(EXAMPLES): $(BINDIR)/%: $(BINDIR)/%.o $(OBJS)
78 | $(CXX) $^ -o $@ $(LIBS)
79 |
80 | $(LIBDIR)/$(PACPP_LIB): $(LIBDIR) $(OBJS)
81 | $(AR) ruv $(LIBDIR)/$(PACPP_LIB) $(OBJS)
82 | $(RANLIB) $(LIBDIR)/$(PACPP_LIB)
83 |
84 | $(LIBDIR)/$(PACPP_DLLV): $(LIBDIR) $(OBJS)
85 | $(CXX) $(SHARED_FLAGS) -o $(LIBDIR)/$(PACPP_DLLV) $(OBJS) $(DLL_LIBS)
86 |
87 | $(LIBDIR)/$(PACPP_DLL): $(LIBDIR) $(OBJS)
88 | $(CXX) $(SHARED_FLAGS) -o $(LIBDIR)/$(PACPP_DLL) $(OBJS) $(DLL_LIBS)
89 |
90 | #install: $(LIBDIR)/$(PACPP_LIB) $(LIBDIR)/$(PACPP_DLLV)
91 | # $(INSTALL) -m 644 $(LIBDIR)/$(PACPP_DLLV) $(PREFIX)/lib/$(PACPP_DLLV)
92 | # $(INSTALL) -m 644 $(LIBDIR)/$(PACPP_LIB) $(PREFIX)/lib/$(PACPP_LIB)
93 | # cd $(PREFIX)/lib && rm -f $(PACPP_DLL) && ln -s $(PACPP_DLLV) $(PACPP_DLL)
94 | # @echo ""
95 | # @echo "------------------------------------------------------------"
96 | # @echo "PortAudioCpp was successfully installed."
97 | # @echo ""
98 | # @echo "On some systems (e.g. Linux) you should run 'ldconfig' now"
99 | # @echo "to make the shared object available. You may also need to"
100 | # @echo "modify your LD_LIBRARY_PATH environment variable to include"
101 | # @echo "the directory $(PREFIX)/lib"
102 | # @echo "------------------------------------------------------------"
103 | # @echo ""
104 |
105 | $(LIBDIR):
106 | mkdir $(LIBDIR)
107 |
--------------------------------------------------------------------------------
/portaudio/bindings/cpp/source/portaudiocpp/Exception.cxx:
--------------------------------------------------------------------------------
1 | #include "portaudiocpp/Exception.hxx"
2 |
3 | namespace portaudio
4 | {
5 | // -----------------------------------------------------------------------------------
6 | // PaException:
7 | // -----------------------------------------------------------------------------------
8 |
9 | //////
10 | /// Wraps a PortAudio error into a PortAudioCpp PaException.
11 | //////
12 | PaException::PaException(PaError error) : error_(error)
13 | {
14 | }
15 |
16 | // -----------------------------------------------------------------------------------
17 |
18 | //////
19 | /// Alias for paErrorText(), to have std::exception compliance.
20 | //////
21 | const char *PaException::what() const throw()
22 | {
23 | return paErrorText();
24 | }
25 |
26 | // -----------------------------------------------------------------------------------
27 |
28 | //////
29 | /// Returns the PortAudio error code (PaError).
30 | //////
31 | PaError PaException::paError() const
32 | {
33 | return error_;
34 | }
35 |
36 | //////
37 | /// Returns the error as a (zero-terminated) text string.
38 | //////
39 | const char *PaException::paErrorText() const
40 | {
41 | return Pa_GetErrorText(error_);
42 | }
43 |
44 | //////
45 | /// Returns true is the error is a HostApi error.
46 | //////
47 | bool PaException::isHostApiError() const
48 | {
49 | return (error_ == paUnanticipatedHostError);
50 | }
51 |
52 | //////
53 | /// Returns the last HostApi error (which is the current one if
54 | /// isHostApiError() returns true) as an error code.
55 | //////
56 | long PaException::lastHostApiError() const
57 | {
58 | return Pa_GetLastHostErrorInfo()->errorCode;
59 | }
60 |
61 | //////
62 | /// Returns the last HostApi error (which is the current one if
63 | /// isHostApiError() returns true) as a (zero-terminated) text
64 | /// string, if it's available.
65 | //////
66 | const char *PaException::lastHostApiErrorText() const
67 | {
68 | return Pa_GetLastHostErrorInfo()->errorText;
69 | }
70 |
71 | // -----------------------------------------------------------------------------------
72 |
73 | bool PaException::operator==(const PaException &rhs) const
74 | {
75 | return (error_ == rhs.error_);
76 | }
77 |
78 | bool PaException::operator!=(const PaException &rhs) const
79 | {
80 | return !(*this == rhs);
81 | }
82 |
83 | // -----------------------------------------------------------------------------------
84 | // PaCppException:
85 | // -----------------------------------------------------------------------------------
86 |
87 | PaCppException::PaCppException(ExceptionSpecifier specifier) : specifier_(specifier)
88 | {
89 | }
90 |
91 | const char *PaCppException::what() const throw()
92 | {
93 | switch (specifier_)
94 | {
95 | case UNABLE_TO_ADAPT_DEVICE:
96 | {
97 | return "Unable to adapt the given device to the specified host api specific device extension";
98 | }
99 | }
100 |
101 | return "Unknown exception";
102 | }
103 |
104 | PaCppException::ExceptionSpecifier PaCppException::specifier() const
105 | {
106 | return specifier_;
107 | }
108 |
109 | bool PaCppException::operator==(const PaCppException &rhs) const
110 | {
111 | return (specifier_ == rhs.specifier_);
112 | }
113 |
114 | bool PaCppException::operator!=(const PaCppException &rhs) const
115 | {
116 | return !(*this == rhs);
117 | }
118 |
119 | // -----------------------------------------------------------------------------------
120 |
121 | } // namespace portaudio
122 |
123 |
124 |
--------------------------------------------------------------------------------
/portaudio/test/patest_ringmix.c:
--------------------------------------------------------------------------------
1 | /** @file patest_ringmix.c
2 | @ingroup test_src
3 | @brief Ring modulate inputs to left output, mix inputs to right output.
4 | */
5 | /*
6 | * $Id$
7 | *
8 | * This program uses the PortAudio Portable Audio Library.
9 | * For more information see: http://www.portaudio.com
10 | * Copyright (c) 1999-2000 Ross Bencina and Phil Burk
11 | *
12 | * Permission is hereby granted, free of charge, to any person obtaining
13 | * a copy of this software and associated documentation files
14 | * (the "Software"), to deal in the Software without restriction,
15 | * including without limitation the rights to use, copy, modify, merge,
16 | * publish, distribute, sublicense, and/or sell copies of the Software,
17 | * and to permit persons to whom the Software is furnished to do so,
18 | * subject to the following conditions:
19 | *
20 | * The above copyright notice and this permission notice shall be
21 | * included in all copies or substantial portions of the Software.
22 | *
23 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
26 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
27 | * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
28 | * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 | */
31 |
32 | /*
33 | * The text above constitutes the entire PortAudio license; however,
34 | * the PortAudio community also makes the following non-binding requests:
35 | *
36 | * Any person wishing to distribute modifications to the Software is
37 | * requested to send the modifications to the original developer so that
38 | * they can be incorporated into the canonical version. It is also
39 | * requested that these non-binding requests be included along with the
40 | * license above.
41 | */
42 |
43 |
44 | #include "stdio.h"
45 | #include "portaudio.h"
46 | /* This will be called asynchronously by the PortAudio engine. */
47 | static int myCallback( const void *inputBuffer, void *outputBuffer,
48 | unsigned long framesPerBuffer,
49 | const PaStreamCallbackTimeInfo* timeInfo,
50 | PaStreamCallbackFlags statusFlags,
51 | void *userData )
52 | {
53 | const float *in = (const float *) inputBuffer;
54 | float *out = (float *) outputBuffer;
55 | float leftInput, rightInput;
56 | unsigned int i;
57 |
58 | /* Read input buffer, process data, and fill output buffer. */
59 | for( i=0; i
7 |
8 | #include "portaudio.h"
9 |
10 | // ---------------------------------------------------------------------------------------
11 |
12 | namespace portaudio
13 | {
14 |
15 | //////
16 | /// @brief Base class for all exceptions PortAudioCpp can throw.
17 | ///
18 | /// Class is derived from std::exception.
19 | //////
20 | class Exception : public std::exception
21 | {
22 | public:
23 | virtual ~Exception() throw() {}
24 |
25 | virtual const char *what() const throw() = 0;
26 | };
27 |
28 | // -----------------------------------------------------------------------------------
29 |
30 | //////
31 | /// @brief Wrapper for PortAudio error codes to C++ exceptions.
32 | ///
33 | /// It wraps up PortAudio's error handling mechanism using
34 | /// C++ exceptions and is derived from std::exception for
35 | /// easy exception handling and to ease integration with
36 | /// other code.
37 | ///
38 | /// To know what exceptions each function may throw, look up
39 | /// the errors that can occure in the PortAudio documentation
40 | /// for the equivalent functions.
41 | ///
42 | /// Some functions are likely to throw an exception (such as
43 | /// Stream::open(), etc) and these should always be called in
44 | /// try{} catch{} blocks and the thrown exceptions should be
45 | /// handled properly (ie. the application shouldn't just abort,
46 | /// but merely display a warning dialog to the user or something).
47 | /// However nearly all functions in PortAudioCpp are capable
48 | /// of throwing exceptions. When a function like Stream::isStopped()
49 | /// throws an exception, it's such an exceptional state that it's
50 | /// not likely that it can be recovered. PaExceptions such as these
51 | /// can ``safely'' be left to be handled by some outer catch-all-like
52 | /// mechanism for unrecoverable errors.
53 | //////
54 | class PaException : public Exception
55 | {
56 | public:
57 | explicit PaException(PaError error);
58 |
59 | const char *what() const throw();
60 |
61 | PaError paError() const;
62 | const char *paErrorText() const;
63 |
64 | bool isHostApiError() const; // extended
65 | long lastHostApiError() const;
66 | const char *lastHostApiErrorText() const;
67 |
68 | bool operator==(const PaException &rhs) const;
69 | bool operator!=(const PaException &rhs) const;
70 |
71 | private:
72 | PaError error_;
73 | };
74 |
75 | // -----------------------------------------------------------------------------------
76 |
77 | //////
78 | /// @brief Exceptions specific to PortAudioCpp (ie. exceptions which do not have an
79 | /// equivalent PortAudio error code).
80 | //////
81 | class PaCppException : public Exception
82 | {
83 | public:
84 | enum ExceptionSpecifier
85 | {
86 | UNABLE_TO_ADAPT_DEVICE
87 | };
88 |
89 | PaCppException(ExceptionSpecifier specifier);
90 |
91 | const char *what() const throw();
92 |
93 | ExceptionSpecifier specifier() const;
94 |
95 | bool operator==(const PaCppException &rhs) const;
96 | bool operator!=(const PaCppException &rhs) const;
97 |
98 | private:
99 | ExceptionSpecifier specifier_;
100 | };
101 |
102 |
103 | } // namespace portaudio
104 |
105 | // ---------------------------------------------------------------------------------------
106 |
107 | #endif // INCLUDED_PORTAUDIO_EXCEPTION_HXX
108 |
109 |
--------------------------------------------------------------------------------
/portaudio/doc/src/tutorial/blocking_read_write.dox:
--------------------------------------------------------------------------------
1 | /** @page blocking_read_write Blocking Read/Write Functions
2 | @ingroup tutorial
3 |
4 | PortAudio V19 adds a huge advance over previous versions with a feature called Blocking I/O. Although it may have lower performance that the callback method described earlier in this tutorial, blocking I/O is easier to understand and is, in some cases, more compatible with third party systems than the callback method. Most people starting audio programming also find Blocking I/O easier to learn.
5 |
6 | Blocking I/O works in much the same way as the callback method except that instead of providing a function to provide (or consume) audio data, you must feed data to (or consume data from) PortAudio at regular intervals, usually inside a loop. The example below, excepted from patest_read_write_wire.c, shows how to open the default device, and pass data from its input to its output for a set period of time. Note that we use the default high latency values to help avoid underruns since we are usually reading and writing audio data from a relatively low priority thread, and there is usually extra buffering required to make blocking I/O work.
7 |
8 | Note that not all API's implement Blocking I/O at this point, so for maximum portability or performance, you'll still want to use callbacks.
9 |
10 | @code
11 | /* -- initialize PortAudio -- */
12 | err = Pa_Initialize();
13 | if( err != paNoError ) goto error;
14 |
15 | /* -- setup input and output -- */
16 | inputParameters.device = Pa_GetDefaultInputDevice(); /* default input device */
17 | inputParameters.channelCount = NUM_CHANNELS;
18 | inputParameters.sampleFormat = PA_SAMPLE_TYPE;
19 | inputParameters.suggestedLatency = Pa_GetDeviceInfo( inputParameters.device )->defaultHighInputLatency ;
20 | inputParameters.hostApiSpecificStreamInfo = NULL;
21 |
22 | outputParameters.device = Pa_GetDefaultOutputDevice(); /* default output device */
23 | outputParameters.channelCount = NUM_CHANNELS;
24 | outputParameters.sampleFormat = PA_SAMPLE_TYPE;
25 | outputParameters.suggestedLatency = Pa_GetDeviceInfo( outputParameters.device )->defaultHighOutputLatency;
26 | outputParameters.hostApiSpecificStreamInfo = NULL;
27 |
28 | /* -- setup stream -- */
29 | err = Pa_OpenStream(
30 | &stream,
31 | &inputParameters,
32 | &outputParameters,
33 | SAMPLE_RATE,
34 | FRAMES_PER_BUFFER,
35 | paClipOff, /* we won't output out of range samples so don't bother clipping them */
36 | NULL, /* no callback, use blocking API */
37 | NULL ); /* no callback, so no callback userData */
38 | if( err != paNoError ) goto error;
39 |
40 | /* -- start stream -- */
41 | err = Pa_StartStream( stream );
42 | if( err != paNoError ) goto error;
43 | printf("Wire on. Will run one minute.\n"); fflush(stdout);
44 |
45 | /* -- Here's the loop where we pass data from input to output -- */
46 | for( i=0; i<(60*SAMPLE_RATE)/FRAMES_PER_BUFFER; ++i )
47 | {
48 | err = Pa_WriteStream( stream, sampleBlock, FRAMES_PER_BUFFER );
49 | if( err ) goto xrun;
50 | err = Pa_ReadStream( stream, sampleBlock, FRAMES_PER_BUFFER );
51 | if( err ) goto xrun;
52 | }
53 | /* -- Now we stop the stream -- */
54 | err = Pa_StopStream( stream );
55 | if( err != paNoError ) goto error;
56 |
57 | /* -- don't forget to cleanup! -- */
58 | err = Pa_CloseStream( stream );
59 | if( err != paNoError ) goto error;
60 |
61 | Pa_Terminate();
62 | return 0;
63 | @endcode
64 |
65 |
66 | Previous: \ref querying_devices | Next: \ref exploring
67 |
68 | */
--------------------------------------------------------------------------------
/portaudio/src/os/win/pa_win_hostapis.c:
--------------------------------------------------------------------------------
1 | /*
2 | * $Id$
3 | * Portable Audio I/O Library Windows initialization table
4 | *
5 | * Based on the Open Source API proposed by Ross Bencina
6 | * Copyright (c) 1999-2008 Ross Bencina, Phil Burk
7 | *
8 | * Permission is hereby granted, free of charge, to any person obtaining
9 | * a copy of this software and associated documentation files
10 | * (the "Software"), to deal in the Software without restriction,
11 | * including without limitation the rights to use, copy, modify, merge,
12 | * publish, distribute, sublicense, and/or sell copies of the Software,
13 | * and to permit persons to whom the Software is furnished to do so,
14 | * subject to the following conditions:
15 | *
16 | * The above copyright notice and this permission notice shall be
17 | * included in all copies or substantial portions of the Software.
18 | *
19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
22 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
23 | * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
24 | * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
25 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 | */
27 |
28 | /*
29 | * The text above constitutes the entire PortAudio license; however,
30 | * the PortAudio community also makes the following non-binding requests:
31 | *
32 | * Any person wishing to distribute modifications to the Software is
33 | * requested to send the modifications to the original developer so that
34 | * they can be incorporated into the canonical version. It is also
35 | * requested that these non-binding requests be included along with the
36 | * license above.
37 | */
38 |
39 | /** @file
40 | @ingroup win_src
41 |
42 | @brief Win32 host API initialization function table.
43 | */
44 |
45 | /* This is needed to make this source file depend on CMake option changes
46 | and at the same time make it transparent for clients not using CMake.
47 | */
48 | #ifdef PORTAUDIO_CMAKE_GENERATED
49 | #include "options_cmake.h"
50 | #endif
51 |
52 | #include "pa_hostapi.h"
53 |
54 |
55 | #ifdef __cplusplus
56 | extern "C"
57 | {
58 | #endif /* __cplusplus */
59 |
60 | PaError PaSkeleton_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiIndex index );
61 | PaError PaWinMme_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiIndex index );
62 | PaError PaWinDs_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiIndex index );
63 | PaError PaAsio_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiIndex index );
64 | PaError PaWinWdm_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiIndex index );
65 | PaError PaWasapi_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiIndex index );
66 |
67 | #ifdef __cplusplus
68 | }
69 | #endif /* __cplusplus */
70 |
71 |
72 | PaUtilHostApiInitializer *paHostApiInitializers[] =
73 | {
74 |
75 | #if PA_USE_WMME
76 | PaWinMme_Initialize,
77 | #endif
78 |
79 | #if PA_USE_DS
80 | PaWinDs_Initialize,
81 | #endif
82 |
83 | #if PA_USE_ASIO
84 | PaAsio_Initialize,
85 | #endif
86 |
87 | #if PA_USE_WASAPI
88 | PaWasapi_Initialize,
89 | #endif
90 |
91 | #if PA_USE_WDMKS
92 | PaWinWdm_Initialize,
93 | #endif
94 |
95 | #if PA_USE_SKELETON
96 | PaSkeleton_Initialize, /* just for testing. last in list so it isn't marked as default. */
97 | #endif
98 |
99 | 0 /* NULL terminated array */
100 | };
101 |
102 |
103 |
--------------------------------------------------------------------------------
/portaudio/bindings/java/c/src/com_portaudio_BlockingStream.h:
--------------------------------------------------------------------------------
1 | /* DO NOT EDIT THIS FILE - it is machine generated */
2 | #if defined(__APPLE__)
3 | #include
4 | #else
5 | #include
6 | #endif
7 |
8 | /* Header for class com_portaudio_BlockingStream */
9 |
10 | #ifndef _Included_com_portaudio_BlockingStream
11 | #define _Included_com_portaudio_BlockingStream
12 | #ifdef __cplusplus
13 | extern "C" {
14 | #endif
15 | /*
16 | * Class: com_portaudio_BlockingStream
17 | * Method: getReadAvailable
18 | * Signature: ()I
19 | */
20 | JNIEXPORT jint JNICALL Java_com_portaudio_BlockingStream_getReadAvailable
21 | (JNIEnv *, jobject);
22 |
23 | /*
24 | * Class: com_portaudio_BlockingStream
25 | * Method: getWriteAvailable
26 | * Signature: ()I
27 | */
28 | JNIEXPORT jint JNICALL Java_com_portaudio_BlockingStream_getWriteAvailable
29 | (JNIEnv *, jobject);
30 |
31 | /*
32 | * Class: com_portaudio_BlockingStream
33 | * Method: readFloats
34 | * Signature: ([FI)Z
35 | */
36 | JNIEXPORT jboolean JNICALL Java_com_portaudio_BlockingStream_readFloats
37 | (JNIEnv *, jobject, jfloatArray, jint);
38 |
39 | /*
40 | * Class: com_portaudio_BlockingStream
41 | * Method: writeFloats
42 | * Signature: ([FI)Z
43 | */
44 | JNIEXPORT jboolean JNICALL Java_com_portaudio_BlockingStream_writeFloats
45 | (JNIEnv *, jobject, jfloatArray, jint);
46 |
47 | /*
48 | * Class: com_portaudio_BlockingStream
49 | * Method: readShorts
50 | * Signature: ([SI)Z
51 | */
52 | JNIEXPORT jboolean JNICALL Java_com_portaudio_BlockingStream_readShorts
53 | (JNIEnv *, jobject, jshortArray, jint);
54 |
55 | /*
56 | * Class: com_portaudio_BlockingStream
57 | * Method: writeShorts
58 | * Signature: ([SI)Z
59 | */
60 | JNIEXPORT jboolean JNICALL Java_com_portaudio_BlockingStream_writeShorts
61 | (JNIEnv *, jobject, jshortArray, jint);
62 |
63 | /*
64 | * Class: com_portaudio_BlockingStream
65 | * Method: start
66 | * Signature: ()V
67 | */
68 | JNIEXPORT void JNICALL Java_com_portaudio_BlockingStream_start
69 | (JNIEnv *, jobject);
70 |
71 | /*
72 | * Class: com_portaudio_BlockingStream
73 | * Method: stop
74 | * Signature: ()V
75 | */
76 | JNIEXPORT void JNICALL Java_com_portaudio_BlockingStream_stop
77 | (JNIEnv *, jobject);
78 |
79 | /*
80 | * Class: com_portaudio_BlockingStream
81 | * Method: abort
82 | * Signature: ()V
83 | */
84 | JNIEXPORT void JNICALL Java_com_portaudio_BlockingStream_abort
85 | (JNIEnv *, jobject);
86 |
87 | /*
88 | * Class: com_portaudio_BlockingStream
89 | * Method: close
90 | * Signature: ()V
91 | */
92 | JNIEXPORT void JNICALL Java_com_portaudio_BlockingStream_close
93 | (JNIEnv *, jobject);
94 |
95 | /*
96 | * Class: com_portaudio_BlockingStream
97 | * Method: isStopped
98 | * Signature: ()Z
99 | */
100 | JNIEXPORT jboolean JNICALL Java_com_portaudio_BlockingStream_isStopped
101 | (JNIEnv *, jobject);
102 |
103 | /*
104 | * Class: com_portaudio_BlockingStream
105 | * Method: isActive
106 | * Signature: ()Z
107 | */
108 | JNIEXPORT jboolean JNICALL Java_com_portaudio_BlockingStream_isActive
109 | (JNIEnv *, jobject);
110 |
111 | /*
112 | * Class: com_portaudio_BlockingStream
113 | * Method: getTime
114 | * Signature: ()D
115 | */
116 | JNIEXPORT jdouble JNICALL Java_com_portaudio_BlockingStream_getTime
117 | (JNIEnv *, jobject);
118 |
119 | /*
120 | * Class: com_portaudio_BlockingStream
121 | * Method: getInfo
122 | * Signature: (Lcom/portaudio/StreamInfo;)V
123 | */
124 | JNIEXPORT void JNICALL Java_com_portaudio_BlockingStream_getInfo
125 | (JNIEnv *, jobject, jobject);
126 |
127 | #ifdef __cplusplus
128 | }
129 | #endif
130 | #endif
131 |
--------------------------------------------------------------------------------
/portaudio/include/pa_win_ds.h:
--------------------------------------------------------------------------------
1 | #ifndef PA_WIN_DS_H
2 | #define PA_WIN_DS_H
3 | /*
4 | * $Id: $
5 | * PortAudio Portable Real-Time Audio Library
6 | * DirectSound specific extensions
7 | *
8 | * Copyright (c) 1999-2007 Ross Bencina and Phil Burk
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 |
41 | /** @file
42 | @ingroup public_header
43 | @brief DirectSound-specific PortAudio API extension header file.
44 | */
45 |
46 | #include "portaudio.h"
47 | #include "pa_win_waveformat.h"
48 |
49 | #ifdef __cplusplus
50 | extern "C"
51 | {
52 | #endif /* __cplusplus */
53 |
54 |
55 | #define paWinDirectSoundUseLowLevelLatencyParameters (0x01)
56 | #define paWinDirectSoundUseChannelMask (0x04)
57 |
58 |
59 | typedef struct PaWinDirectSoundStreamInfo{
60 | unsigned long size; /**< sizeof(PaWinDirectSoundStreamInfo) */
61 | PaHostApiTypeId hostApiType; /**< paDirectSound */
62 | unsigned long version; /**< 2 */
63 |
64 | unsigned long flags; /**< enable other features of this struct */
65 |
66 | /**
67 | low-level latency setting support
68 | Sets the size of the DirectSound host buffer.
69 | When flags contains the paWinDirectSoundUseLowLevelLatencyParameters
70 | this size will be used instead of interpreting the generic latency
71 | parameters to Pa_OpenStream(). If the flag is not set this value is ignored.
72 |
73 | If the stream is a full duplex stream the implementation requires that
74 | the values of framesPerBuffer for input and output match (if both are specified).
75 | */
76 | unsigned long framesPerBuffer;
77 |
78 | /**
79 | support for WAVEFORMATEXTENSIBLE channel masks. If flags contains
80 | paWinDirectSoundUseChannelMask this allows you to specify which speakers
81 | to address in a multichannel stream. Constants for channelMask
82 | are specified in pa_win_waveformat.h
83 |
84 | */
85 | PaWinWaveFormatChannelMask channelMask;
86 |
87 | }PaWinDirectSoundStreamInfo;
88 |
89 |
90 |
91 | #ifdef __cplusplus
92 | }
93 | #endif /* __cplusplus */
94 |
95 | #endif /* PA_WIN_DS_H */
96 |
--------------------------------------------------------------------------------