From ed463ba658e593602a0aed549336bb0ecadc59d7 Mon Sep 17 00:00:00 2001
From: Phil Burk
Date: Wed, 18 May 2016 22:13:20 -0700
Subject: [PATCH] Normalize all the line endings
---
Doxyfile.developer | 484 +-
bindings/cpp/ChangeLog | 356 +-
bindings/cpp/build/vc6/devs_example.dsp | 496 +-
bindings/cpp/build/vc6/devs_example.dsw | 88 +-
bindings/cpp/build/vc6/sine_example.dsp | 504 +-
bindings/cpp/build/vc6/sine_example.dsw | 88 +-
bindings/cpp/build/vc6/static_library.dsp | 790 +-
bindings/cpp/build/vc6/static_library.dsw | 58 +-
bindings/cpp/build/vc7_1/devs_example.sln | 60 +-
bindings/cpp/build/vc7_1/devs_example.vcproj | 390 +-
bindings/cpp/build/vc7_1/sine_example.sln | 60 +-
bindings/cpp/build/vc7_1/sine_example.vcproj | 654 +-
bindings/cpp/build/vc7_1/static_library.sln | 42 +-
.../cpp/build/vc7_1/static_library.vcproj | 436 +-
bindings/cpp/doc/README | 68 +-
bindings/cpp/doc/config.doxy.linux | 420 +-
bindings/cpp/example/sine.cxx | 274 +-
.../portaudiocpp/AsioDeviceAdapter.hxx | 2 +-
.../cpp/include/portaudiocpp/AutoSystem.hxx | 124 +-
.../include/portaudiocpp/BlockingStream.hxx | 90 +-
.../portaudiocpp/CFunCallbackStream.hxx | 98 +-
.../portaudiocpp/CallbackInterface.hxx | 90 +-
.../include/portaudiocpp/CallbackStream.hxx | 80 +-
.../portaudiocpp/CppFunCallbackStream.hxx | 172 +-
bindings/cpp/include/portaudiocpp/Device.hxx | 182 +-
.../DirectionSpecificStreamParameters.hxx | 154 +-
.../cpp/include/portaudiocpp/Exception.hxx | 216 +-
bindings/cpp/include/portaudiocpp/HostApi.hxx | 152 +-
.../portaudiocpp/InterfaceCallbackStream.hxx | 98 +-
.../portaudiocpp/MemFunCallbackStream.hxx | 214 +-
.../cpp/include/portaudiocpp/PortAudioCpp.hxx | 218 +-
.../include/portaudiocpp/SampleDataFormat.hxx | 70 +-
bindings/cpp/include/portaudiocpp/Stream.hxx | 164 +-
.../include/portaudiocpp/StreamParameters.hxx | 154 +-
bindings/cpp/include/portaudiocpp/System.hxx | 214 +-
.../portaudiocpp/SystemDeviceIterator.hxx | 132 +-
.../portaudiocpp/SystemHostApiIterator.hxx | 122 +-
.../source/portaudiocpp/AsioDeviceAdapter.cxx | 142 +-
.../source/portaudiocpp/BlockingStream.cxx | 200 +-
.../portaudiocpp/CFunCallbackStream.cxx | 82 +-
.../source/portaudiocpp/CallbackInterface.cxx | 50 +-
.../source/portaudiocpp/CallbackStream.cxx | 40 +-
.../portaudiocpp/CppFunCallbackStream.cxx | 162 +-
bindings/cpp/source/portaudiocpp/Device.cxx | 336 +-
.../DirectionSpecificStreamParameters.cxx | 326 +-
.../cpp/source/portaudiocpp/Exception.cxx | 246 +-
bindings/cpp/source/portaudiocpp/HostApi.cxx | 242 +-
.../portaudiocpp/InterfaceCallbackStream.cxx | 90 +-
.../portaudiocpp/MemFunCallbackStream.cxx | 8 +-
bindings/cpp/source/portaudiocpp/Stream.cxx | 390 +-
.../source/portaudiocpp/StreamParameters.cxx | 330 +-
bindings/cpp/source/portaudiocpp/System.cxx | 616 +-
.../portaudiocpp/SystemDeviceIterator.cxx | 120 +-
.../portaudiocpp/SystemHostApiIterator.cxx | 118 +-
.../vs2010/PortAudioJNI/PortAudioJNI.sln | 52 +-
.../vs2010/PortAudioJNI/PortAudioJNI.vcproj | 396 +-
.../vs2010/PortAudioJNI/PortAudioJNI.vcxproj | 346 +-
bindings/java/jportaudio.dox | 130 +-
bindings/java/jportaudio/.classpath | 16 +-
bindings/java/jportaudio/.project | 34 +-
bindings/java/scripts/make_header.bat | 8 +-
build/msvc/portaudio.dsp | 538 +-
build/msvc/portaudio.dsw | 58 +-
build/msvc/portaudio.sln | 64 +-
build/msvc/portaudio.vcproj | 3864 +++---
cmake_support/FindASIOSDK.cmake | 82 +-
cmake_support/FindDXSDK.cmake | 118 +-
cmake_support/options_cmake.h.in | 62 +-
cmake_support/template_portaudio.def | 106 +-
doc/src/api_overview.dox | 322 +-
doc/src/license.dox | 74 +-
doc/src/mainpage.dox | 126 +-
doc/src/srcguide.dox | 108 +-
doc/src/tutorial/blocking_read_write.dox | 134 +-
doc/src/tutorial/compile_cmake.dox | 56 +-
doc/src/tutorial/compile_linux.dox | 164 +-
doc/src/tutorial/compile_mac_coreaudio.dox | 244 +-
doc/src/tutorial/compile_windows.dox | 214 +-
.../tutorial/compile_windows_asio_msvc.dox | 192 +-
doc/src/tutorial/compile_windows_mingw.dox | 104 +-
doc/src/tutorial/exploring.dox | 28 +-
doc/src/tutorial/initializing_portaudio.dox | 56 +-
doc/src/tutorial/open_default_stream.dox | 94 +-
doc/src/tutorial/querying_devices.dox | 220 +-
doc/src/tutorial/start_stop_abort.dox | 68 +-
doc/src/tutorial/terminating_portaudio.dox | 38 +-
doc/src/tutorial/tutorial_start.dox | 114 +-
doc/src/tutorial/utility_functions.dox | 136 +-
doc/src/tutorial/writing_a_callback.dox | 140 +-
doc/utils/checkfiledocs.py | 174 +-
examples/paex_read_write_wire.c | 442 +-
examples/paex_record_file.c | 906 +-
examples/paex_sine_c++.cpp | 550 +-
examples/paex_wmme_ac3.c | 442 +-
examples/paex_wmme_surround.c | 422 +-
include/pa_win_ds.h | 190 +-
include/pa_win_wasapi.h | 866 +-
include/pa_win_waveformat.h | 396 +-
qa/loopback/src/biquad_filter.c | 242 +-
qa/loopback/src/biquad_filter.h | 76 +-
qa/loopback/src/qa_tools.h | 148 +-
qa/loopback/src/write_wav.c | 484 +-
qa/loopback/src/write_wav.h | 206 +-
src/common/pa_debugprint.c | 246 +-
src/common/pa_debugprint.h | 298 +-
src/hostapi/asihpi/pa_linux_asihpi.c | 5786 ++++-----
src/hostapi/coreaudio/pa_mac_core_blocking.c | 1186 +-
src/hostapi/coreaudio/pa_mac_core_blocking.h | 272 +-
.../wasapi/mingw-include/AudioSessionTypes.h | 188 +-
.../FunctionDiscoveryKeys_devpkey.h | 372 +-
.../wasapi/mingw-include/audioclient.h | 2354 ++--
.../wasapi/mingw-include/devicetopology.h | 6550 +++++-----
.../wasapi/mingw-include/endpointvolume.h | 1240 +-
.../mingw-include/functiondiscoverykeys.h | 510 +-
src/hostapi/wasapi/mingw-include/ksmedia.h | 10 +-
.../wasapi/mingw-include/mmdeviceapi.h | 1858 +--
src/hostapi/wasapi/mingw-include/propidl.h | 2550 ++--
src/hostapi/wasapi/mingw-include/propkey.h | 8548 ++++++------
src/hostapi/wasapi/mingw-include/propkeydef.h | 52 +-
src/hostapi/wasapi/mingw-include/propsys.h | 7210 +++++------
src/hostapi/wasapi/mingw-include/rpcsal.h | 226 +-
src/hostapi/wasapi/mingw-include/sal.h | 504 +-
src/hostapi/wasapi/mingw-include/sdkddkver.h | 450 +-
src/hostapi/wasapi/mingw-include/shtypes.h | 936 +-
.../wasapi/mingw-include/structuredquery.h | 4956 +++----
src/hostapi/wasapi/pa_win_wasapi.c | 10728 ++++++++--------
src/os/win/pa_win_coinitialize.c | 286 +-
src/os/win/pa_win_coinitialize.h | 188 +-
src/os/win/pa_win_waveformat.c | 316 +-
src/os/win/pa_win_wdmks_utils.c | 618 +-
src/os/win/pa_win_wdmks_utils.h | 128 +-
test/patest_converters.c | 790 +-
test/patest_dsound_find_best_latency_params.c | 1028 +-
test/patest_dsound_low_level_latency_params.c | 374 +-
test/patest_dsound_surround.c | 410 +-
test/patest_jack_wasapi.c | 686 +-
test/patest_suggested_vs_streaminfo_latency.c | 538 +-
.../patest_suggested_vs_streaminfo_latency.py | 300 +-
test/patest_timing.c | 346 +-
test/patest_wmme_find_best_latency_params.c | 1036 +-
test/patest_wmme_low_level_latency_params.c | 384 +-
141 files changed, 45010 insertions(+), 45010 deletions(-)
diff --git a/Doxyfile.developer b/Doxyfile.developer
index a672860..c444652 100644
--- a/Doxyfile.developer
+++ b/Doxyfile.developer
@@ -1,242 +1,242 @@
-# Doxyfile 1.4.6
-
-#---------------------------------------------------------------------------
-# Project related configuration options
-#---------------------------------------------------------------------------
-PROJECT_NAME = PortAudio
-PROJECT_NUMBER = 2.0
-OUTPUT_DIRECTORY = ./doc/
-CREATE_SUBDIRS = NO
-OUTPUT_LANGUAGE = English
-USE_WINDOWS_ENCODING = NO
-BRIEF_MEMBER_DESC = YES
-REPEAT_BRIEF = YES
-ABBREVIATE_BRIEF = "The $name class" \
- "The $name widget" \
- "The $name file" \
- is \
- provides \
- specifies \
- contains \
- represents \
- a \
- an \
- the
-ALWAYS_DETAILED_SEC = NO
-INLINE_INHERITED_MEMB = NO
-FULL_PATH_NAMES = NO
-STRIP_FROM_PATH =
-STRIP_FROM_INC_PATH =
-SHORT_NAMES = NO
-JAVADOC_AUTOBRIEF = NO
-MULTILINE_CPP_IS_BRIEF = NO
-DETAILS_AT_TOP = NO
-INHERIT_DOCS = YES
-SEPARATE_MEMBER_PAGES = NO
-TAB_SIZE = 8
-ALIASES =
-OPTIMIZE_OUTPUT_FOR_C = YES
-OPTIMIZE_OUTPUT_JAVA = NO
-BUILTIN_STL_SUPPORT = NO
-DISTRIBUTE_GROUP_DOC = NO
-SUBGROUPING = YES
-#---------------------------------------------------------------------------
-# Build related configuration options
-#---------------------------------------------------------------------------
-EXTRACT_ALL = YES
-EXTRACT_PRIVATE = NO
-EXTRACT_STATIC = NO
-EXTRACT_LOCAL_CLASSES = YES
-EXTRACT_LOCAL_METHODS = NO
-HIDE_UNDOC_MEMBERS = NO
-HIDE_UNDOC_CLASSES = NO
-HIDE_FRIEND_COMPOUNDS = NO
-HIDE_IN_BODY_DOCS = NO
-INTERNAL_DOCS = YES
-CASE_SENSE_NAMES = YES
-HIDE_SCOPE_NAMES = NO
-SHOW_INCLUDE_FILES = YES
-INLINE_INFO = YES
-SORT_MEMBER_DOCS = YES
-SORT_BRIEF_DOCS = NO
-SORT_BY_SCOPE_NAME = NO
-GENERATE_TODOLIST = YES
-GENERATE_TESTLIST = YES
-GENERATE_BUGLIST = YES
-GENERATE_DEPRECATEDLIST= YES
-ENABLED_SECTIONS = INTERNAL
-MAX_INITIALIZER_LINES = 30
-SHOW_USED_FILES = YES
-SHOW_DIRECTORIES = YES
-FILE_VERSION_FILTER =
-#---------------------------------------------------------------------------
-# configuration options related to warning and progress messages
-#---------------------------------------------------------------------------
-QUIET = NO
-WARNINGS = YES
-WARN_IF_UNDOCUMENTED = YES
-WARN_IF_DOC_ERROR = YES
-WARN_NO_PARAMDOC = NO
-WARN_FORMAT = "$file:$line: $text"
-WARN_LOGFILE =
-#---------------------------------------------------------------------------
-# configuration options related to the input files
-#---------------------------------------------------------------------------
-INPUT = doc/src \
- include \
- examples \
- src \
- test \
- qa
-FILE_PATTERNS = *.h \
- *.c \
- *.cpp \
- *.java \
- *.dox
-RECURSIVE = YES
-EXCLUDE = src/hostapi/wasapi/mingw-include
-EXCLUDE_SYMLINKS = NO
-EXCLUDE_PATTERNS =
-EXAMPLE_PATH =
-EXAMPLE_PATTERNS =
-EXAMPLE_RECURSIVE = NO
-IMAGE_PATH = doc/src/images
-INPUT_FILTER =
-FILTER_PATTERNS =
-FILTER_SOURCE_FILES = NO
-#---------------------------------------------------------------------------
-# configuration options related to source browsing
-#---------------------------------------------------------------------------
-SOURCE_BROWSER = NO
-INLINE_SOURCES = NO
-STRIP_CODE_COMMENTS = YES
-REFERENCED_BY_RELATION = YES
-REFERENCES_RELATION = YES
-USE_HTAGS = NO
-VERBATIM_HEADERS = YES
-#---------------------------------------------------------------------------
-# configuration options related to the alphabetical class index
-#---------------------------------------------------------------------------
-ALPHABETICAL_INDEX = NO
-COLS_IN_ALPHA_INDEX = 5
-IGNORE_PREFIX =
-#---------------------------------------------------------------------------
-# configuration options related to the HTML output
-#---------------------------------------------------------------------------
-GENERATE_HTML = YES
-HTML_OUTPUT = html
-HTML_FILE_EXTENSION = .html
-HTML_HEADER =
-HTML_FOOTER =
-HTML_STYLESHEET =
-HTML_ALIGN_MEMBERS = YES
-GENERATE_HTMLHELP = NO
-CHM_FILE =
-HHC_LOCATION =
-GENERATE_CHI = NO
-BINARY_TOC = NO
-TOC_EXPAND = NO
-DISABLE_INDEX = NO
-ENUM_VALUES_PER_LINE = 4
-GENERATE_TREEVIEW = NO
-TREEVIEW_WIDTH = 250
-#---------------------------------------------------------------------------
-# configuration options related to the LaTeX output
-#---------------------------------------------------------------------------
-GENERATE_LATEX = NO
-LATEX_OUTPUT = latex
-LATEX_CMD_NAME = latex
-MAKEINDEX_CMD_NAME = makeindex
-COMPACT_LATEX = NO
-PAPER_TYPE = a4wide
-EXTRA_PACKAGES =
-LATEX_HEADER =
-PDF_HYPERLINKS = NO
-USE_PDFLATEX = NO
-LATEX_BATCHMODE = NO
-LATEX_HIDE_INDICES = NO
-#---------------------------------------------------------------------------
-# configuration options related to the RTF output
-#---------------------------------------------------------------------------
-GENERATE_RTF = NO
-RTF_OUTPUT = rtf
-COMPACT_RTF = NO
-RTF_HYPERLINKS = NO
-RTF_STYLESHEET_FILE =
-RTF_EXTENSIONS_FILE =
-#---------------------------------------------------------------------------
-# configuration options related to the man page output
-#---------------------------------------------------------------------------
-GENERATE_MAN = NO
-MAN_OUTPUT = man
-MAN_EXTENSION = .3
-MAN_LINKS = NO
-#---------------------------------------------------------------------------
-# configuration options related to the XML output
-#---------------------------------------------------------------------------
-GENERATE_XML = NO
-XML_OUTPUT = xml
-XML_SCHEMA =
-XML_DTD =
-XML_PROGRAMLISTING = YES
-#---------------------------------------------------------------------------
-# configuration options for the AutoGen Definitions output
-#---------------------------------------------------------------------------
-GENERATE_AUTOGEN_DEF = NO
-#---------------------------------------------------------------------------
-# configuration options related to the Perl module output
-#---------------------------------------------------------------------------
-GENERATE_PERLMOD = NO
-PERLMOD_LATEX = NO
-PERLMOD_PRETTY = YES
-PERLMOD_MAKEVAR_PREFIX =
-#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor
-#---------------------------------------------------------------------------
-ENABLE_PREPROCESSING = YES
-MACRO_EXPANSION = NO
-EXPAND_ONLY_PREDEF = NO
-SEARCH_INCLUDES = YES
-INCLUDE_PATH =
-INCLUDE_FILE_PATTERNS =
-PREDEFINED =
-EXPAND_AS_DEFINED =
-SKIP_FUNCTION_MACROS = YES
-#---------------------------------------------------------------------------
-# Configuration::additions related to external references
-#---------------------------------------------------------------------------
-TAGFILES =
-GENERATE_TAGFILE =
-ALLEXTERNALS = NO
-EXTERNAL_GROUPS = YES
-PERL_PATH = /usr/bin/perl
-#---------------------------------------------------------------------------
-# Configuration options related to the dot tool
-#---------------------------------------------------------------------------
-CLASS_DIAGRAMS = NO
-HIDE_UNDOC_RELATIONS = NO
-HAVE_DOT = NO
-CLASS_GRAPH = YES
-COLLABORATION_GRAPH = YES
-GROUP_GRAPHS = YES
-UML_LOOK = NO
-TEMPLATE_RELATIONS = YES
-INCLUDE_GRAPH = YES
-INCLUDED_BY_GRAPH = YES
-CALL_GRAPH = NO
-GRAPHICAL_HIERARCHY = YES
-DIRECTORY_GRAPH = YES
-DOT_IMAGE_FORMAT = png
-DOT_PATH =
-DOTFILE_DIRS =
-MAX_DOT_GRAPH_WIDTH = 1024
-MAX_DOT_GRAPH_HEIGHT = 1024
-MAX_DOT_GRAPH_DEPTH = 1000
-DOT_TRANSPARENT = NO
-DOT_MULTI_TARGETS = NO
-GENERATE_LEGEND = YES
-DOT_CLEANUP = YES
-#---------------------------------------------------------------------------
-# Configuration::additions related to the search engine
-#---------------------------------------------------------------------------
-SEARCHENGINE = NO
+# Doxyfile 1.4.6
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+PROJECT_NAME = PortAudio
+PROJECT_NUMBER = 2.0
+OUTPUT_DIRECTORY = ./doc/
+CREATE_SUBDIRS = NO
+OUTPUT_LANGUAGE = English
+USE_WINDOWS_ENCODING = NO
+BRIEF_MEMBER_DESC = YES
+REPEAT_BRIEF = YES
+ABBREVIATE_BRIEF = "The $name class" \
+ "The $name widget" \
+ "The $name file" \
+ is \
+ provides \
+ specifies \
+ contains \
+ represents \
+ a \
+ an \
+ the
+ALWAYS_DETAILED_SEC = NO
+INLINE_INHERITED_MEMB = NO
+FULL_PATH_NAMES = NO
+STRIP_FROM_PATH =
+STRIP_FROM_INC_PATH =
+SHORT_NAMES = NO
+JAVADOC_AUTOBRIEF = NO
+MULTILINE_CPP_IS_BRIEF = NO
+DETAILS_AT_TOP = NO
+INHERIT_DOCS = YES
+SEPARATE_MEMBER_PAGES = NO
+TAB_SIZE = 8
+ALIASES =
+OPTIMIZE_OUTPUT_FOR_C = YES
+OPTIMIZE_OUTPUT_JAVA = NO
+BUILTIN_STL_SUPPORT = NO
+DISTRIBUTE_GROUP_DOC = NO
+SUBGROUPING = YES
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+EXTRACT_ALL = YES
+EXTRACT_PRIVATE = NO
+EXTRACT_STATIC = NO
+EXTRACT_LOCAL_CLASSES = YES
+EXTRACT_LOCAL_METHODS = NO
+HIDE_UNDOC_MEMBERS = NO
+HIDE_UNDOC_CLASSES = NO
+HIDE_FRIEND_COMPOUNDS = NO
+HIDE_IN_BODY_DOCS = NO
+INTERNAL_DOCS = YES
+CASE_SENSE_NAMES = YES
+HIDE_SCOPE_NAMES = NO
+SHOW_INCLUDE_FILES = YES
+INLINE_INFO = YES
+SORT_MEMBER_DOCS = YES
+SORT_BRIEF_DOCS = NO
+SORT_BY_SCOPE_NAME = NO
+GENERATE_TODOLIST = YES
+GENERATE_TESTLIST = YES
+GENERATE_BUGLIST = YES
+GENERATE_DEPRECATEDLIST= YES
+ENABLED_SECTIONS = INTERNAL
+MAX_INITIALIZER_LINES = 30
+SHOW_USED_FILES = YES
+SHOW_DIRECTORIES = YES
+FILE_VERSION_FILTER =
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+QUIET = NO
+WARNINGS = YES
+WARN_IF_UNDOCUMENTED = YES
+WARN_IF_DOC_ERROR = YES
+WARN_NO_PARAMDOC = NO
+WARN_FORMAT = "$file:$line: $text"
+WARN_LOGFILE =
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+INPUT = doc/src \
+ include \
+ examples \
+ src \
+ test \
+ qa
+FILE_PATTERNS = *.h \
+ *.c \
+ *.cpp \
+ *.java \
+ *.dox
+RECURSIVE = YES
+EXCLUDE = src/hostapi/wasapi/mingw-include
+EXCLUDE_SYMLINKS = NO
+EXCLUDE_PATTERNS =
+EXAMPLE_PATH =
+EXAMPLE_PATTERNS =
+EXAMPLE_RECURSIVE = NO
+IMAGE_PATH = doc/src/images
+INPUT_FILTER =
+FILTER_PATTERNS =
+FILTER_SOURCE_FILES = NO
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+SOURCE_BROWSER = NO
+INLINE_SOURCES = NO
+STRIP_CODE_COMMENTS = YES
+REFERENCED_BY_RELATION = YES
+REFERENCES_RELATION = YES
+USE_HTAGS = NO
+VERBATIM_HEADERS = YES
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+ALPHABETICAL_INDEX = NO
+COLS_IN_ALPHA_INDEX = 5
+IGNORE_PREFIX =
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+GENERATE_HTML = YES
+HTML_OUTPUT = html
+HTML_FILE_EXTENSION = .html
+HTML_HEADER =
+HTML_FOOTER =
+HTML_STYLESHEET =
+HTML_ALIGN_MEMBERS = YES
+GENERATE_HTMLHELP = NO
+CHM_FILE =
+HHC_LOCATION =
+GENERATE_CHI = NO
+BINARY_TOC = NO
+TOC_EXPAND = NO
+DISABLE_INDEX = NO
+ENUM_VALUES_PER_LINE = 4
+GENERATE_TREEVIEW = NO
+TREEVIEW_WIDTH = 250
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+GENERATE_LATEX = NO
+LATEX_OUTPUT = latex
+LATEX_CMD_NAME = latex
+MAKEINDEX_CMD_NAME = makeindex
+COMPACT_LATEX = NO
+PAPER_TYPE = a4wide
+EXTRA_PACKAGES =
+LATEX_HEADER =
+PDF_HYPERLINKS = NO
+USE_PDFLATEX = NO
+LATEX_BATCHMODE = NO
+LATEX_HIDE_INDICES = NO
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+GENERATE_RTF = NO
+RTF_OUTPUT = rtf
+COMPACT_RTF = NO
+RTF_HYPERLINKS = NO
+RTF_STYLESHEET_FILE =
+RTF_EXTENSIONS_FILE =
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+GENERATE_MAN = NO
+MAN_OUTPUT = man
+MAN_EXTENSION = .3
+MAN_LINKS = NO
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+GENERATE_XML = NO
+XML_OUTPUT = xml
+XML_SCHEMA =
+XML_DTD =
+XML_PROGRAMLISTING = YES
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+GENERATE_AUTOGEN_DEF = NO
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+GENERATE_PERLMOD = NO
+PERLMOD_LATEX = NO
+PERLMOD_PRETTY = YES
+PERLMOD_MAKEVAR_PREFIX =
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+ENABLE_PREPROCESSING = YES
+MACRO_EXPANSION = NO
+EXPAND_ONLY_PREDEF = NO
+SEARCH_INCLUDES = YES
+INCLUDE_PATH =
+INCLUDE_FILE_PATTERNS =
+PREDEFINED =
+EXPAND_AS_DEFINED =
+SKIP_FUNCTION_MACROS = YES
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references
+#---------------------------------------------------------------------------
+TAGFILES =
+GENERATE_TAGFILE =
+ALLEXTERNALS = NO
+EXTERNAL_GROUPS = YES
+PERL_PATH = /usr/bin/perl
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+CLASS_DIAGRAMS = NO
+HIDE_UNDOC_RELATIONS = NO
+HAVE_DOT = NO
+CLASS_GRAPH = YES
+COLLABORATION_GRAPH = YES
+GROUP_GRAPHS = YES
+UML_LOOK = NO
+TEMPLATE_RELATIONS = YES
+INCLUDE_GRAPH = YES
+INCLUDED_BY_GRAPH = YES
+CALL_GRAPH = NO
+GRAPHICAL_HIERARCHY = YES
+DIRECTORY_GRAPH = YES
+DOT_IMAGE_FORMAT = png
+DOT_PATH =
+DOTFILE_DIRS =
+MAX_DOT_GRAPH_WIDTH = 1024
+MAX_DOT_GRAPH_HEIGHT = 1024
+MAX_DOT_GRAPH_DEPTH = 1000
+DOT_TRANSPARENT = NO
+DOT_MULTI_TARGETS = NO
+GENERATE_LEGEND = YES
+DOT_CLEANUP = YES
+#---------------------------------------------------------------------------
+# Configuration::additions related to the search engine
+#---------------------------------------------------------------------------
+SEARCHENGINE = NO
diff --git a/bindings/cpp/ChangeLog b/bindings/cpp/ChangeLog
index 0201a0f..6b0b027 100644
--- a/bindings/cpp/ChangeLog
+++ b/bindings/cpp/ChangeLog
@@ -1,178 +1,178 @@
-Note: Because PortAudioCpp is now in the main PortAudio SVN repository, having these per-release changelogs probably doesn't make much sense anymore. Perhaps it's better to just note mayor changes by date from now on.
-
-PortAudioCpp v19 revision 16 06/05/22:
-
- mblaauw:
- - Added up-to-date MSVC 6.0 projects created by David Moore. Besides MSVC 6.0 users, MSVC 7.0 users may use these projects and automatically convert them to MSVC 7.0 projects.
- - Changed the code and projects (MSVC 7.1 only) to be up-to-date with PortAudio's new directory structure.
- - Added equivalents of the PaAsio_GetInputChannelName() and PaAsio_GetOutputChannelName() functions to the AsioDeviceAdapter wrapper-class (missing functions pointed out by David Moore).
- - Added code to PortAudio's main SVN repository.
-
-PortAudioCpp v19 revision 15 (unknown release date):
-
- mblaauw:
- - Changed some exception handling code in HostApi's constructor.
- - Added accessors to PortAudio PaStream from PortAudioCpp Stream (their absense being pointed out
- by Tom Jordan).
- - Fixed a bug/typo in MemFunToCallbackInterfaceAdapter::init() thanks to Fredrik Viklund.
- - Fixed issue with concrete Stream classes possibly throwing an exception and fixed documentation w.r.t. this.
- - Moved files to portaudio/binding/cpp/. Made new msvc 7.1 projects to reflect the change and removed msvc 6.0
- and 7.0 projects (because I can no longer maintain them myself). Gnu projects will probably need updating.
-
-PortAudioCpp v19 revision 14 03/10/24:
-
- mblaauw:
- - Fixed some error handling bugs in Stream and System (pointed out by Tom Jordan).
- - Updated documentation a little (main page).
- - Fixed order of members so initializer list was in the right order in
- StreamParameters (pointed out by Ludwig Schwardt).
- - Added new lines at EOF's (as indicated by Ludwig Schwardt).
-
-PortAudioCpp v19 revision 13 03/10/19:
-
- lschwardt:
- - Added build files for GNU/Linux.
- - Fixed bug in Exception where the inherited what() member function (and destructor) had looser
- exception specification (namely no exception specification, i.e. could throw anything) than
- the std::exception base class's what() member function (which had throw(), i.e. no-throw guarantee).
- - Changed the iterators so that they have a set of public typedefs instead of deriving the C++ standard
- library std::iterator<> struct. G++ 2.95 doesn't support std::exception<> and composition-by-aggregation
- is prefered over composition-by-inheritance in this case.
- - Changed some minor things to avoid G++ warning messages.
-
- mblaauw:
- - Renamed this file (/WHATSNEW.txt) to /CHANGELOG.
- - Renamed /PA_ISSUES.txt to /PA_ISSUES.
- - Added /INSTALL file with some build info for GNU/Linux and VC6.
- - Added MSVC 6.0 projects for building PortAudioCpp as a staticly or dynamically linkable library.
- - Moved build files to /build/(gnu/ or vc6/).
- - Moved Doxygen configuration files to /doc/ and output to /doc/api_reference/.
- - Added a /doc/README with some info how to generate Doxygen documentation.
-
-PortAudioCpp v19 revision 12 03/09/02:
-
- mblaauw:
- - Updated code to reflect changes on V19-devel CVS branch.
- - Fixed some typos in the documentation.
-
-PortAudioCpp v19 revision 11 03/07/31:
-
- mblaauw:
- - Renamed SingleDirecionStreamParameters to DirectionSpecificStreamParameters.
- - Implemented BlockingStream.
- - Updated code to reflect recent changes to PortAudio V19-devel.
- - Fixed a potential memory leak when an exception was thrown in the HostApi
- constructor.
- - Renamed ``Latency'' to ``BufferSize'' in AsioDeviceAdapter.
- - Updated class documentation.
-
-PortAudioCpp v19 revision 10 03/07/18:
-
- mblaauw:
- - SingleDirectionStreamParameters now has a (static) null() method.
- - StreamParameters uses references for the direction-specific stream parameters
- instead of pointers (use null() method (above) instead of NULL).
- - StreamParameters and SingleDirectionStreamParameters must now be fully specified
- and now default values are used (because this was not very useful in general and
- only made things more complex).
- - Updated documentation.
-
-PortAudioCpp v19 revision 09 03/06/25:
-
- mblaauw:
- - Changed some things in SingleDirectionStreamParameters to ease it's usage.
- - Placed all SingleDirectionStreamParameters stuff into a separate file.
- + Totally redid the callback stuff, now it's less ackward and supports C++ functions.
-
-PortAudioCpp v19 revision 08 03/06/20:
-
- mblaauw:
- - Made deconstructors for Device and HostApi private.
- + Added a AsioDeviceWrapper host api specific device extension class.
- - Refactored Exception into a Exception base class and PaException and PaCppException
- derived classes.
- - Added ASIO specific device info to the devs.cxx example.
- - Fixed a bug in System::hostApiCount() and System::defaultHostApi().
- + Moved Device::null to System::nullDevice.
- - Fixed some bugs in Device and System.
-
-PortAudioCpp v19 revision 07 03/06/08:
-
- mblaauw:
- - Updated some doxy comments.
- + Renamed CbXyz to CallbackXyz.
- + Renamed all ``configurations'' to ``parameters''.
- + Renamed HalfDuplexStreamConfiguration to SingleDirectionStreamConfiguration.
- - Renamed SingleDirectionStreamParameters::streamParameters() to
- SingleDirectionStreamParameters::paSteamParameters.
- - Added a non-constant version of SingleDirectionStreamParameters::paStreamParameters().
- - A few improvements to SingleDirectionStreamParameters.
- - Allowed AutoSystem to be created without initializing the System singleton
- (using a ctor flag).
- - Added a BlockingStream class (not implemented for now).
- - Fixed many bugs in the implementation of the iterators.
- - Fixed a bug in Device::operator==().
- + Added a C++ version of the patest_sine.c test/example.
- - Added a ctor for StreamParameters for a default half-duplex stream.
- - Added SingleDirectionStreamParameters::setDevice() and setNumChannels().
- - Renamed System::numHostApis() to System::hostApiCount().
- + Rewrote the iterators and related classes. They are now fully STL compliant. The System now
- has a static array of all HostApis and all Devices. Only the System can create HostApis and
- Devices and they are non-copyable now. All HostApis and Devices are now passed by-reference.
- - Renamed (System::) getVersion() to version() and getVersionText() to versionText().
- - Renamed (Device::) numXyzChannels() to maxXyzChannels().
- - Changed some stuff in StreamParameters.
- + Added a C++ version of the patest_devs.c test/example.
-
-PortAudioCpp v19 revision 06 03/06/04:
-
- mblaauw:
- + Added this file to the project (roughly, a `+' denotes a major change, a `-' a minor change).
- - Added System::deviceByIndex(), useful when a Device's index is stored for instance.
- - Renamed System::hostApiFromTypeId() to System::hostApiByTypeId().
- - Updated and added some Doxygen documentation.
- - Made Stream::usedIntputLatency(), Stream::usedOutputLatency() and
- Stream::usedSampleRate() throw an paInternalError equivalent exception instead of paBadStreamPtr.
- - Changed exception handling in Stream::open() functions. They now follow the PA error handling
- mechanism better and a couple of bugs regarding ownership of objects were fixed.
- - Renamed Device::isDefaultXyzDevice() to Device::isSystemDefaultXyzDevice().
- - Added Device::isHostApiDefaultXyzDevice().
- - Added StreamConfiguration::unsetFlag().
- - Removed CUSTOM from SampleDataFormat.
- - System::hostApiByTypeId() now throws an paInternalError if the type id was out-of-range; this
- is a temporary work-around (see comments).
- - Changed CbInterface to use paCallbackFun() instead of operator()().
- - Renamed ``object'' to ``instance'' in CbMemFunAdapter.hxx.
- - Added StreamConfiguration::setXyzHostApiSpecificSampleFormat().
- - Added StreamConfiguration::isXyzSampleFormatHostApiSpecific().
- - Changed error handling in System::terminate(), it can now throw an Exception.
- - Added error handling in System::defaultHostApi().
- - Added error handling in System::hostApisEnd().
- - Changed some (but probably not all) C casts to C++ casts to avoid confusion with a
- certain Python person.
- - Renamed RaiiSystem to AutoSystem (class and file) as this is a come common convention.
- - Renamed System::numDevices() to System::deviceCount() to be more compatible with PortAudio
- (although PortAudio uses Pa_CountDevices() instead, see comment).
- - Renamed HostApi::numDevices() to HostApi::deviceCount().
- - Changed INC_ to INCLUDED_ in the header multiple include guards.
- - Changed the order of functions in the StreamConfiguration class' header.
- - Written some more info in PortAudioCpp.hxx (Doxygen).
- - Added CallbackStream.hxx and CallbackStream.cxx files.
- + Refactored StreamConfiguration to remove the duplication which was there. There is now a
- HalfDuplexStreamConfiguration class. Also made some improvements to these classes while
- doing the refactoring.
- + Moved all code files to source/portaudiocpp/ and changed includes.
- + Moved all header files to include/portaudiocpp/ to easy a binary build if needed. The project
- must be set to have .../include/ as a path to look for includes.
- + Refactored the Stream class into a Stream base class and a CallbackStream derived class.
- - Renamed Stream::usingXyz() to Stream::xyz().
- - Updated some doxy comments.
- - Changed ``using namespace portaudio'' in .cxx files to ``namespace portaudio { ... }''.
-
-PortAudioCpp v19 revision 05 03/04/09:
-
- mblaauw:
- - Initial release on the PortAudio mailinglist.
-
-
-
+Note: Because PortAudioCpp is now in the main PortAudio SVN repository, having these per-release changelogs probably doesn't make much sense anymore. Perhaps it's better to just note mayor changes by date from now on.
+
+PortAudioCpp v19 revision 16 06/05/22:
+
+ mblaauw:
+ - Added up-to-date MSVC 6.0 projects created by David Moore. Besides MSVC 6.0 users, MSVC 7.0 users may use these projects and automatically convert them to MSVC 7.0 projects.
+ - Changed the code and projects (MSVC 7.1 only) to be up-to-date with PortAudio's new directory structure.
+ - Added equivalents of the PaAsio_GetInputChannelName() and PaAsio_GetOutputChannelName() functions to the AsioDeviceAdapter wrapper-class (missing functions pointed out by David Moore).
+ - Added code to PortAudio's main SVN repository.
+
+PortAudioCpp v19 revision 15 (unknown release date):
+
+ mblaauw:
+ - Changed some exception handling code in HostApi's constructor.
+ - Added accessors to PortAudio PaStream from PortAudioCpp Stream (their absense being pointed out
+ by Tom Jordan).
+ - Fixed a bug/typo in MemFunToCallbackInterfaceAdapter::init() thanks to Fredrik Viklund.
+ - Fixed issue with concrete Stream classes possibly throwing an exception and fixed documentation w.r.t. this.
+ - Moved files to portaudio/binding/cpp/. Made new msvc 7.1 projects to reflect the change and removed msvc 6.0
+ and 7.0 projects (because I can no longer maintain them myself). Gnu projects will probably need updating.
+
+PortAudioCpp v19 revision 14 03/10/24:
+
+ mblaauw:
+ - Fixed some error handling bugs in Stream and System (pointed out by Tom Jordan).
+ - Updated documentation a little (main page).
+ - Fixed order of members so initializer list was in the right order in
+ StreamParameters (pointed out by Ludwig Schwardt).
+ - Added new lines at EOF's (as indicated by Ludwig Schwardt).
+
+PortAudioCpp v19 revision 13 03/10/19:
+
+ lschwardt:
+ - Added build files for GNU/Linux.
+ - Fixed bug in Exception where the inherited what() member function (and destructor) had looser
+ exception specification (namely no exception specification, i.e. could throw anything) than
+ the std::exception base class's what() member function (which had throw(), i.e. no-throw guarantee).
+ - Changed the iterators so that they have a set of public typedefs instead of deriving the C++ standard
+ library std::iterator<> struct. G++ 2.95 doesn't support std::exception<> and composition-by-aggregation
+ is prefered over composition-by-inheritance in this case.
+ - Changed some minor things to avoid G++ warning messages.
+
+ mblaauw:
+ - Renamed this file (/WHATSNEW.txt) to /CHANGELOG.
+ - Renamed /PA_ISSUES.txt to /PA_ISSUES.
+ - Added /INSTALL file with some build info for GNU/Linux and VC6.
+ - Added MSVC 6.0 projects for building PortAudioCpp as a staticly or dynamically linkable library.
+ - Moved build files to /build/(gnu/ or vc6/).
+ - Moved Doxygen configuration files to /doc/ and output to /doc/api_reference/.
+ - Added a /doc/README with some info how to generate Doxygen documentation.
+
+PortAudioCpp v19 revision 12 03/09/02:
+
+ mblaauw:
+ - Updated code to reflect changes on V19-devel CVS branch.
+ - Fixed some typos in the documentation.
+
+PortAudioCpp v19 revision 11 03/07/31:
+
+ mblaauw:
+ - Renamed SingleDirecionStreamParameters to DirectionSpecificStreamParameters.
+ - Implemented BlockingStream.
+ - Updated code to reflect recent changes to PortAudio V19-devel.
+ - Fixed a potential memory leak when an exception was thrown in the HostApi
+ constructor.
+ - Renamed ``Latency'' to ``BufferSize'' in AsioDeviceAdapter.
+ - Updated class documentation.
+
+PortAudioCpp v19 revision 10 03/07/18:
+
+ mblaauw:
+ - SingleDirectionStreamParameters now has a (static) null() method.
+ - StreamParameters uses references for the direction-specific stream parameters
+ instead of pointers (use null() method (above) instead of NULL).
+ - StreamParameters and SingleDirectionStreamParameters must now be fully specified
+ and now default values are used (because this was not very useful in general and
+ only made things more complex).
+ - Updated documentation.
+
+PortAudioCpp v19 revision 09 03/06/25:
+
+ mblaauw:
+ - Changed some things in SingleDirectionStreamParameters to ease it's usage.
+ - Placed all SingleDirectionStreamParameters stuff into a separate file.
+ + Totally redid the callback stuff, now it's less ackward and supports C++ functions.
+
+PortAudioCpp v19 revision 08 03/06/20:
+
+ mblaauw:
+ - Made deconstructors for Device and HostApi private.
+ + Added a AsioDeviceWrapper host api specific device extension class.
+ - Refactored Exception into a Exception base class and PaException and PaCppException
+ derived classes.
+ - Added ASIO specific device info to the devs.cxx example.
+ - Fixed a bug in System::hostApiCount() and System::defaultHostApi().
+ + Moved Device::null to System::nullDevice.
+ - Fixed some bugs in Device and System.
+
+PortAudioCpp v19 revision 07 03/06/08:
+
+ mblaauw:
+ - Updated some doxy comments.
+ + Renamed CbXyz to CallbackXyz.
+ + Renamed all ``configurations'' to ``parameters''.
+ + Renamed HalfDuplexStreamConfiguration to SingleDirectionStreamConfiguration.
+ - Renamed SingleDirectionStreamParameters::streamParameters() to
+ SingleDirectionStreamParameters::paSteamParameters.
+ - Added a non-constant version of SingleDirectionStreamParameters::paStreamParameters().
+ - A few improvements to SingleDirectionStreamParameters.
+ - Allowed AutoSystem to be created without initializing the System singleton
+ (using a ctor flag).
+ - Added a BlockingStream class (not implemented for now).
+ - Fixed many bugs in the implementation of the iterators.
+ - Fixed a bug in Device::operator==().
+ + Added a C++ version of the patest_sine.c test/example.
+ - Added a ctor for StreamParameters for a default half-duplex stream.
+ - Added SingleDirectionStreamParameters::setDevice() and setNumChannels().
+ - Renamed System::numHostApis() to System::hostApiCount().
+ + Rewrote the iterators and related classes. They are now fully STL compliant. The System now
+ has a static array of all HostApis and all Devices. Only the System can create HostApis and
+ Devices and they are non-copyable now. All HostApis and Devices are now passed by-reference.
+ - Renamed (System::) getVersion() to version() and getVersionText() to versionText().
+ - Renamed (Device::) numXyzChannels() to maxXyzChannels().
+ - Changed some stuff in StreamParameters.
+ + Added a C++ version of the patest_devs.c test/example.
+
+PortAudioCpp v19 revision 06 03/06/04:
+
+ mblaauw:
+ + Added this file to the project (roughly, a `+' denotes a major change, a `-' a minor change).
+ - Added System::deviceByIndex(), useful when a Device's index is stored for instance.
+ - Renamed System::hostApiFromTypeId() to System::hostApiByTypeId().
+ - Updated and added some Doxygen documentation.
+ - Made Stream::usedIntputLatency(), Stream::usedOutputLatency() and
+ Stream::usedSampleRate() throw an paInternalError equivalent exception instead of paBadStreamPtr.
+ - Changed exception handling in Stream::open() functions. They now follow the PA error handling
+ mechanism better and a couple of bugs regarding ownership of objects were fixed.
+ - Renamed Device::isDefaultXyzDevice() to Device::isSystemDefaultXyzDevice().
+ - Added Device::isHostApiDefaultXyzDevice().
+ - Added StreamConfiguration::unsetFlag().
+ - Removed CUSTOM from SampleDataFormat.
+ - System::hostApiByTypeId() now throws an paInternalError if the type id was out-of-range; this
+ is a temporary work-around (see comments).
+ - Changed CbInterface to use paCallbackFun() instead of operator()().
+ - Renamed ``object'' to ``instance'' in CbMemFunAdapter.hxx.
+ - Added StreamConfiguration::setXyzHostApiSpecificSampleFormat().
+ - Added StreamConfiguration::isXyzSampleFormatHostApiSpecific().
+ - Changed error handling in System::terminate(), it can now throw an Exception.
+ - Added error handling in System::defaultHostApi().
+ - Added error handling in System::hostApisEnd().
+ - Changed some (but probably not all) C casts to C++ casts to avoid confusion with a
+ certain Python person.
+ - Renamed RaiiSystem to AutoSystem (class and file) as this is a come common convention.
+ - Renamed System::numDevices() to System::deviceCount() to be more compatible with PortAudio
+ (although PortAudio uses Pa_CountDevices() instead, see comment).
+ - Renamed HostApi::numDevices() to HostApi::deviceCount().
+ - Changed INC_ to INCLUDED_ in the header multiple include guards.
+ - Changed the order of functions in the StreamConfiguration class' header.
+ - Written some more info in PortAudioCpp.hxx (Doxygen).
+ - Added CallbackStream.hxx and CallbackStream.cxx files.
+ + Refactored StreamConfiguration to remove the duplication which was there. There is now a
+ HalfDuplexStreamConfiguration class. Also made some improvements to these classes while
+ doing the refactoring.
+ + Moved all code files to source/portaudiocpp/ and changed includes.
+ + Moved all header files to include/portaudiocpp/ to easy a binary build if needed. The project
+ must be set to have .../include/ as a path to look for includes.
+ + Refactored the Stream class into a Stream base class and a CallbackStream derived class.
+ - Renamed Stream::usingXyz() to Stream::xyz().
+ - Updated some doxy comments.
+ - Changed ``using namespace portaudio'' in .cxx files to ``namespace portaudio { ... }''.
+
+PortAudioCpp v19 revision 05 03/04/09:
+
+ mblaauw:
+ - Initial release on the PortAudio mailinglist.
+
+
+
diff --git a/bindings/cpp/build/vc6/devs_example.dsp b/bindings/cpp/build/vc6/devs_example.dsp
index e980573..f2778d3 100644
--- a/bindings/cpp/build/vc6/devs_example.dsp
+++ b/bindings/cpp/build/vc6/devs_example.dsp
@@ -1,248 +1,248 @@
-# Microsoft Developer Studio Project File - Name="devs_example" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=devs_example - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "devs_example.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "devs_example.mak" CFG="devs_example - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "devs_example - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "devs_example - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "devs_example - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MTd /W3 /GX /O2 /I "../../include/" /I "../../../../include/" /I "../../../../src/common/" /I "../../../../../asiosdk2/common/" /I "../../../../../asiosdk2/host/" /I "../../../../../asiosdk2/host/pc/" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE RSC /l 0x809 /d "NDEBUG"
-# ADD RSC /l 0x809 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 portaudiocpp-vc6-r.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"../../bin/devs_example.exe" /libpath:"../../lib"
-
-!ELSEIF "$(CFG)" == "devs_example - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "../../include/" /I "../../../../include/" /I "../../../../src/common/" /I "../../../../../asiosdk2/common/" /I "../../../../../asiosdk2/host/" /I "../../../../../asiosdk2/host/pc/" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /GZ /c
-# SUBTRACT CPP /YX
-# ADD BASE RSC /l 0x809 /d "_DEBUG"
-# ADD RSC /l 0x809 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 portaudiocpp-vc6-d.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:"../../bin/devs_example.exe" /pdbtype:sept /libpath:"../../lib"
-
-!ENDIF
-
-# Begin Target
-
-# Name "devs_example - Win32 Release"
-# Name "devs_example - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\..\..\..\pa_asio\iasiothiscallresolver.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\src\common\pa_allocation.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\pa_asio\pa_asio.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\src\common\pa_converters.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\src\common\pa_cpuload.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\src\common\pa_dither.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\src\common\pa_front.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\src\common\pa_process.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\src\hostapi\skeleton\pa_hostapi_skeleton.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\src\common\pa_stream.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\src\common\pa_trace.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\src\hostapi\dsound\pa_win_ds.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\src\hostapi\dsound\pa_win_ds_dynlink.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\src\os\win\pa_win_hostapis.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\src\os\win\pa_win_util.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\src\hostapi\wmme\pa_win_wmme.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\src\os\win\pa_x86_plain_converters.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=..\..\..\..\pa_asio\iasiothiscallresolver.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\src\common\pa_allocation.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\src\common\pa_converters.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\src\common\pa_cpuload.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\src\common\pa_dither.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\src\common\pa_endianness.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\src\common\pa_hostapi.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\src\common\pa_process.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\src\common\pa_stream.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\src\common\pa_trace.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\src\common\pa_types.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\src\common\pa_util.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\src\hostapi\dsound\pa_win_ds_dynlink.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\src\os\win\pa_x86_plain_converters.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# Begin Group "Example Files"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\..\example\devs.cxx
-# End Source File
-# End Group
-# Begin Group "ASIO 2 SDK"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\..\..\..\..\asiosdk2\common\asio.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\..\asiosdk2\host\asiodrivers.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\..\asiosdk2\host\pc\asiolist.cpp
-# End Source File
-# End Group
-# End Target
-# End Project
+# Microsoft Developer Studio Project File - Name="devs_example" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=devs_example - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "devs_example.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "devs_example.mak" CFG="devs_example - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "devs_example - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "devs_example - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "devs_example - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MTd /W3 /GX /O2 /I "../../include/" /I "../../../../include/" /I "../../../../src/common/" /I "../../../../../asiosdk2/common/" /I "../../../../../asiosdk2/host/" /I "../../../../../asiosdk2/host/pc/" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x809 /d "NDEBUG"
+# ADD RSC /l 0x809 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 portaudiocpp-vc6-r.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"../../bin/devs_example.exe" /libpath:"../../lib"
+
+!ELSEIF "$(CFG)" == "devs_example - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "../../include/" /I "../../../../include/" /I "../../../../src/common/" /I "../../../../../asiosdk2/common/" /I "../../../../../asiosdk2/host/" /I "../../../../../asiosdk2/host/pc/" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /GZ /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x809 /d "_DEBUG"
+# ADD RSC /l 0x809 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 portaudiocpp-vc6-d.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:"../../bin/devs_example.exe" /pdbtype:sept /libpath:"../../lib"
+
+!ENDIF
+
+# Begin Target
+
+# Name "devs_example - Win32 Release"
+# Name "devs_example - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=..\..\..\..\pa_asio\iasiothiscallresolver.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\src\common\pa_allocation.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\pa_asio\pa_asio.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\src\common\pa_converters.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\src\common\pa_cpuload.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\src\common\pa_dither.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\src\common\pa_front.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\src\common\pa_process.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\src\hostapi\skeleton\pa_hostapi_skeleton.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\src\common\pa_stream.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\src\common\pa_trace.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\src\hostapi\dsound\pa_win_ds.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\src\hostapi\dsound\pa_win_ds_dynlink.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\src\os\win\pa_win_hostapis.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\src\os\win\pa_win_util.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\src\hostapi\wmme\pa_win_wmme.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\src\os\win\pa_x86_plain_converters.c
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=..\..\..\..\pa_asio\iasiothiscallresolver.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\src\common\pa_allocation.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\src\common\pa_converters.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\src\common\pa_cpuload.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\src\common\pa_dither.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\src\common\pa_endianness.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\src\common\pa_hostapi.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\src\common\pa_process.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\src\common\pa_stream.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\src\common\pa_trace.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\src\common\pa_types.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\src\common\pa_util.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\src\hostapi\dsound\pa_win_ds_dynlink.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\src\os\win\pa_x86_plain_converters.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# Begin Group "Example Files"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\..\example\devs.cxx
+# End Source File
+# End Group
+# Begin Group "ASIO 2 SDK"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\..\..\..\..\asiosdk2\common\asio.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\..\asiosdk2\host\asiodrivers.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\..\asiosdk2\host\pc\asiolist.cpp
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/bindings/cpp/build/vc6/devs_example.dsw b/bindings/cpp/build/vc6/devs_example.dsw
index 480c4d5..6c3bc6d 100644
--- a/bindings/cpp/build/vc6/devs_example.dsw
+++ b/bindings/cpp/build/vc6/devs_example.dsw
@@ -1,44 +1,44 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "devs_example"=".\devs_example.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name static_library
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "static_library"=".\static_library.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
+Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "devs_example"=".\devs_example.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name static_library
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "static_library"=".\static_library.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/bindings/cpp/build/vc6/sine_example.dsp b/bindings/cpp/build/vc6/sine_example.dsp
index 4e7bba1..2c4dbeb 100644
--- a/bindings/cpp/build/vc6/sine_example.dsp
+++ b/bindings/cpp/build/vc6/sine_example.dsp
@@ -1,252 +1,252 @@
-# Microsoft Developer Studio Project File - Name="sine_example" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=sine_example - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "sine_example.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "sine_example.mak" CFG="sine_example - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "sine_example - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "sine_example - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "sine_example - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MTd /W3 /GX /O2 /I "../../include/" /I "../../../../include/" /I "../../../../src/common/" /I "../../../../../asiosdk2/common/" /I "../../../../../asiosdk2/host/" /I "../../../../../asiosdk2/host/pc/" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE RSC /l 0x809 /d "NDEBUG"
-# ADD RSC /l 0x809 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 portaudiocpp-vc6-r.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"../../bin/sine_example.exe" /libpath:"../../lib"
-
-!ELSEIF "$(CFG)" == "sine_example - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "../../include/" /I "../../../../include/" /I "../../../../src/common/" /I "../../../../../asiosdk2/common/" /I "../../../../../asiosdk2/host/" /I "../../../../../asiosdk2/host/pc/" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /GZ /c
-# SUBTRACT CPP /YX
-# ADD BASE RSC /l 0x809 /d "_DEBUG"
-# ADD RSC /l 0x809 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 portaudiocpp-vc6-d.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:"../../bin/sine_example.exe" /pdbtype:sept /libpath:"../../lib"
-
-!ENDIF
-
-# Begin Target
-
-# Name "sine_example - Win32 Release"
-# Name "sine_example - Win32 Debug"
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=..\..\..\..\pa_asio\iasiothiscallresolver.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\src\common\pa_allocation.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\src\common\pa_converters.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\src\common\pa_cpuload.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\src\common\pa_dither.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\src\common\pa_endianness.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\src\common\pa_hostapi.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\src\common\pa_process.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\src\common\pa_stream.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\src\common\pa_trace.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\src\common\pa_types.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\src\common\pa_util.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\src\hostapi\dsound\pa_win_ds_dynlink.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\src\os\win\pa_x86_plain_converters.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# Begin Group "Example Files"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\..\example\sine.cxx
-# End Source File
-# End Group
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\..\..\..\pa_asio\iasiothiscallresolver.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\src\common\pa_allocation.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\pa_asio\pa_asio.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\src\common\pa_converters.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\src\common\pa_cpuload.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\src\common\pa_dither.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\src\common\pa_front.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\src\common\pa_process.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\src\hostapi\skeleton\pa_hostapi_skeleton.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\src\common\pa_stream.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\src\common\pa_trace.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\src\hostapi\dsound\pa_win_ds.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\src\hostapi\dsound\pa_win_ds_dynlink.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\src\os\win\pa_win_hostapis.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\src\os\win\pa_win_util.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\src\hostapi\wasapi\pa_win_wasapi.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\src\hostapi\wmme\pa_win_wmme.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\src\os\win\pa_x86_plain_converters.c
-# End Source File
-# End Group
-# Begin Group "ASIO 2 SDK"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\..\..\..\..\asiosdk2\common\asio.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\..\asiosdk2\host\asiodrivers.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\..\asiosdk2\host\pc\asiolist.cpp
-# End Source File
-# End Group
-# End Target
-# End Project
+# Microsoft Developer Studio Project File - Name="sine_example" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=sine_example - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "sine_example.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "sine_example.mak" CFG="sine_example - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "sine_example - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "sine_example - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "sine_example - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MTd /W3 /GX /O2 /I "../../include/" /I "../../../../include/" /I "../../../../src/common/" /I "../../../../../asiosdk2/common/" /I "../../../../../asiosdk2/host/" /I "../../../../../asiosdk2/host/pc/" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x809 /d "NDEBUG"
+# ADD RSC /l 0x809 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 portaudiocpp-vc6-r.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"../../bin/sine_example.exe" /libpath:"../../lib"
+
+!ELSEIF "$(CFG)" == "sine_example - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "../../include/" /I "../../../../include/" /I "../../../../src/common/" /I "../../../../../asiosdk2/common/" /I "../../../../../asiosdk2/host/" /I "../../../../../asiosdk2/host/pc/" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /GZ /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x809 /d "_DEBUG"
+# ADD RSC /l 0x809 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 portaudiocpp-vc6-d.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:"../../bin/sine_example.exe" /pdbtype:sept /libpath:"../../lib"
+
+!ENDIF
+
+# Begin Target
+
+# Name "sine_example - Win32 Release"
+# Name "sine_example - Win32 Debug"
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=..\..\..\..\pa_asio\iasiothiscallresolver.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\src\common\pa_allocation.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\src\common\pa_converters.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\src\common\pa_cpuload.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\src\common\pa_dither.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\src\common\pa_endianness.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\src\common\pa_hostapi.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\src\common\pa_process.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\src\common\pa_stream.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\src\common\pa_trace.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\src\common\pa_types.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\src\common\pa_util.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\src\hostapi\dsound\pa_win_ds_dynlink.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\src\os\win\pa_x86_plain_converters.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# Begin Group "Example Files"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\..\example\sine.cxx
+# End Source File
+# End Group
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=..\..\..\..\pa_asio\iasiothiscallresolver.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\src\common\pa_allocation.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\pa_asio\pa_asio.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\src\common\pa_converters.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\src\common\pa_cpuload.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\src\common\pa_dither.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\src\common\pa_front.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\src\common\pa_process.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\src\hostapi\skeleton\pa_hostapi_skeleton.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\src\common\pa_stream.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\src\common\pa_trace.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\src\hostapi\dsound\pa_win_ds.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\src\hostapi\dsound\pa_win_ds_dynlink.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\src\os\win\pa_win_hostapis.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\src\os\win\pa_win_util.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\src\hostapi\wasapi\pa_win_wasapi.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\src\hostapi\wmme\pa_win_wmme.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\src\os\win\pa_x86_plain_converters.c
+# End Source File
+# End Group
+# Begin Group "ASIO 2 SDK"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\..\..\..\..\asiosdk2\common\asio.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\..\asiosdk2\host\asiodrivers.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\..\asiosdk2\host\pc\asiolist.cpp
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/bindings/cpp/build/vc6/sine_example.dsw b/bindings/cpp/build/vc6/sine_example.dsw
index 04c4714..d3c2b62 100644
--- a/bindings/cpp/build/vc6/sine_example.dsw
+++ b/bindings/cpp/build/vc6/sine_example.dsw
@@ -1,44 +1,44 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "sine_example"=".\sine_example.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name static_library
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "static_library"=".\static_library.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
+Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "sine_example"=".\sine_example.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name static_library
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "static_library"=".\static_library.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/bindings/cpp/build/vc6/static_library.dsp b/bindings/cpp/build/vc6/static_library.dsp
index d33ba9f..4e9ded3 100644
--- a/bindings/cpp/build/vc6/static_library.dsp
+++ b/bindings/cpp/build/vc6/static_library.dsp
@@ -1,395 +1,395 @@
-# Microsoft Developer Studio Project File - Name="static_library" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Static Library" 0x0104
-
-CFG=static_library - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "static_library.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "static_library.mak" CFG="static_library - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "static_library - Win32 Release" (based on "Win32 (x86) Static Library")
-!MESSAGE "static_library - Win32 Debug" (based on "Win32 (x86) Static Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "static_library - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
-# ADD CPP /nologo /MTd /W3 /GX /O2 /I "../../include/" /I "../../../../include/" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE RSC /l 0x809 /d "NDEBUG"
-# ADD RSC /l 0x809 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo /out:"../../lib/portaudiocpp-vc6-r.lib"
-
-!ELSEIF "$(CFG)" == "static_library - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "../../include/" /I "../../../../include/" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /FD /GZ /c
-# SUBTRACT CPP /YX
-# ADD BASE RSC /l 0x809 /d "_DEBUG"
-# ADD RSC /l 0x809 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo /out:"../../lib/portaudiocpp-vc6-d.lib"
-
-!ENDIF
-
-# Begin Target
-
-# Name "static_library - Win32 Release"
-# Name "static_library - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\..\source\portaudiocpp\AsioDeviceAdapter.cxx
-
-!IF "$(CFG)" == "static_library - Win32 Release"
-
-!ELSEIF "$(CFG)" == "static_library - Win32 Debug"
-
-# SUBTRACT CPP /YX
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\source\portaudiocpp\BlockingStream.cxx
-
-!IF "$(CFG)" == "static_library - Win32 Release"
-
-!ELSEIF "$(CFG)" == "static_library - Win32 Debug"
-
-# SUBTRACT CPP /YX
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\source\portaudiocpp\CallbackInterface.cxx
-
-!IF "$(CFG)" == "static_library - Win32 Release"
-
-!ELSEIF "$(CFG)" == "static_library - Win32 Debug"
-
-# SUBTRACT CPP /YX
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\source\portaudiocpp\CallbackStream.cxx
-
-!IF "$(CFG)" == "static_library - Win32 Release"
-
-!ELSEIF "$(CFG)" == "static_library - Win32 Debug"
-
-# SUBTRACT CPP /YX
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\source\portaudiocpp\CFunCallbackStream.cxx
-
-!IF "$(CFG)" == "static_library - Win32 Release"
-
-!ELSEIF "$(CFG)" == "static_library - Win32 Debug"
-
-# SUBTRACT CPP /YX
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\source\portaudiocpp\CppFunCallbackStream.cxx
-
-!IF "$(CFG)" == "static_library - Win32 Release"
-
-!ELSEIF "$(CFG)" == "static_library - Win32 Debug"
-
-# SUBTRACT CPP /YX
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\source\portaudiocpp\Device.cxx
-
-!IF "$(CFG)" == "static_library - Win32 Release"
-
-!ELSEIF "$(CFG)" == "static_library - Win32 Debug"
-
-# SUBTRACT CPP /YX
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\source\portaudiocpp\DirectionSpecificStreamParameters.cxx
-
-!IF "$(CFG)" == "static_library - Win32 Release"
-
-!ELSEIF "$(CFG)" == "static_library - Win32 Debug"
-
-# SUBTRACT CPP /YX
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\source\portaudiocpp\Exception.cxx
-
-!IF "$(CFG)" == "static_library - Win32 Release"
-
-!ELSEIF "$(CFG)" == "static_library - Win32 Debug"
-
-# SUBTRACT CPP /YX
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\source\portaudiocpp\HostApi.cxx
-
-!IF "$(CFG)" == "static_library - Win32 Release"
-
-!ELSEIF "$(CFG)" == "static_library - Win32 Debug"
-
-# SUBTRACT CPP /YX
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\source\portaudiocpp\InterfaceCallbackStream.cxx
-
-!IF "$(CFG)" == "static_library - Win32 Release"
-
-!ELSEIF "$(CFG)" == "static_library - Win32 Debug"
-
-# SUBTRACT CPP /YX
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\source\portaudiocpp\MemFunCallbackStream.cxx
-
-!IF "$(CFG)" == "static_library - Win32 Release"
-
-!ELSEIF "$(CFG)" == "static_library - Win32 Debug"
-
-# SUBTRACT CPP /YX
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\source\portaudiocpp\Stream.cxx
-
-!IF "$(CFG)" == "static_library - Win32 Release"
-
-!ELSEIF "$(CFG)" == "static_library - Win32 Debug"
-
-# SUBTRACT CPP /YX
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\source\portaudiocpp\StreamParameters.cxx
-
-!IF "$(CFG)" == "static_library - Win32 Release"
-
-!ELSEIF "$(CFG)" == "static_library - Win32 Debug"
-
-# SUBTRACT CPP /YX
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\source\portaudiocpp\System.cxx
-
-!IF "$(CFG)" == "static_library - Win32 Release"
-
-!ELSEIF "$(CFG)" == "static_library - Win32 Debug"
-
-# SUBTRACT CPP /YX
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\source\portaudiocpp\SystemDeviceIterator.cxx
-
-!IF "$(CFG)" == "static_library - Win32 Release"
-
-!ELSEIF "$(CFG)" == "static_library - Win32 Debug"
-
-# SUBTRACT CPP /YX
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\source\portaudiocpp\SystemHostApiIterator.cxx
-
-!IF "$(CFG)" == "static_library - Win32 Release"
-
-!ELSEIF "$(CFG)" == "static_library - Win32 Debug"
-
-# SUBTRACT CPP /YX
-
-!ENDIF
-
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=..\..\include\portaudiocpp\AsioDeviceAdapter.hxx
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\include\portaudiocpp\AutoSystem.hxx
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\include\portaudiocpp\BlockingStream.hxx
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\include\portaudiocpp\CallbackInterface.hxx
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\include\portaudiocpp\CallbackStream.hxx
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\include\portaudiocpp\CFunCallbackStream.hxx
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\include\portaudiocpp\CppFunCallbackStream.hxx
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\include\portaudiocpp\Device.hxx
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\include\portaudiocpp\DirectionSpecificStreamParameters.hxx
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\include\portaudiocpp\Exception.hxx
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\include\portaudiocpp\HostApi.hxx
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\include\portaudiocpp\InterfaceCallbackStream.hxx
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\include\portaudiocpp\MemFunCallbackStream.hxx
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\include\portaudiocpp\PortAudioCpp.hxx
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\include\portaudiocpp\SampleDataFormat.hxx
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\include\portaudiocpp\Stream.hxx
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\include\portaudiocpp\StreamParameters.hxx
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\include\portaudiocpp\System.hxx
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\include\portaudiocpp\SystemDeviceIterator.hxx
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\include\portaudiocpp\SystemHostApiIterator.hxx
-# End Source File
-# End Group
-# End Target
-# End Project
+# Microsoft Developer Studio Project File - Name="static_library" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Static Library" 0x0104
+
+CFG=static_library - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "static_library.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "static_library.mak" CFG="static_library - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "static_library - Win32 Release" (based on "Win32 (x86) Static Library")
+!MESSAGE "static_library - Win32 Debug" (based on "Win32 (x86) Static Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "static_library - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
+# ADD CPP /nologo /MTd /W3 /GX /O2 /I "../../include/" /I "../../../../include/" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x809 /d "NDEBUG"
+# ADD RSC /l 0x809 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo /out:"../../lib/portaudiocpp-vc6-r.lib"
+
+!ELSEIF "$(CFG)" == "static_library - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "../../include/" /I "../../../../include/" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /FD /GZ /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x809 /d "_DEBUG"
+# ADD RSC /l 0x809 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo /out:"../../lib/portaudiocpp-vc6-d.lib"
+
+!ENDIF
+
+# Begin Target
+
+# Name "static_library - Win32 Release"
+# Name "static_library - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=..\..\source\portaudiocpp\AsioDeviceAdapter.cxx
+
+!IF "$(CFG)" == "static_library - Win32 Release"
+
+!ELSEIF "$(CFG)" == "static_library - Win32 Debug"
+
+# SUBTRACT CPP /YX
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\source\portaudiocpp\BlockingStream.cxx
+
+!IF "$(CFG)" == "static_library - Win32 Release"
+
+!ELSEIF "$(CFG)" == "static_library - Win32 Debug"
+
+# SUBTRACT CPP /YX
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\source\portaudiocpp\CallbackInterface.cxx
+
+!IF "$(CFG)" == "static_library - Win32 Release"
+
+!ELSEIF "$(CFG)" == "static_library - Win32 Debug"
+
+# SUBTRACT CPP /YX
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\source\portaudiocpp\CallbackStream.cxx
+
+!IF "$(CFG)" == "static_library - Win32 Release"
+
+!ELSEIF "$(CFG)" == "static_library - Win32 Debug"
+
+# SUBTRACT CPP /YX
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\source\portaudiocpp\CFunCallbackStream.cxx
+
+!IF "$(CFG)" == "static_library - Win32 Release"
+
+!ELSEIF "$(CFG)" == "static_library - Win32 Debug"
+
+# SUBTRACT CPP /YX
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\source\portaudiocpp\CppFunCallbackStream.cxx
+
+!IF "$(CFG)" == "static_library - Win32 Release"
+
+!ELSEIF "$(CFG)" == "static_library - Win32 Debug"
+
+# SUBTRACT CPP /YX
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\source\portaudiocpp\Device.cxx
+
+!IF "$(CFG)" == "static_library - Win32 Release"
+
+!ELSEIF "$(CFG)" == "static_library - Win32 Debug"
+
+# SUBTRACT CPP /YX
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\source\portaudiocpp\DirectionSpecificStreamParameters.cxx
+
+!IF "$(CFG)" == "static_library - Win32 Release"
+
+!ELSEIF "$(CFG)" == "static_library - Win32 Debug"
+
+# SUBTRACT CPP /YX
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\source\portaudiocpp\Exception.cxx
+
+!IF "$(CFG)" == "static_library - Win32 Release"
+
+!ELSEIF "$(CFG)" == "static_library - Win32 Debug"
+
+# SUBTRACT CPP /YX
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\source\portaudiocpp\HostApi.cxx
+
+!IF "$(CFG)" == "static_library - Win32 Release"
+
+!ELSEIF "$(CFG)" == "static_library - Win32 Debug"
+
+# SUBTRACT CPP /YX
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\source\portaudiocpp\InterfaceCallbackStream.cxx
+
+!IF "$(CFG)" == "static_library - Win32 Release"
+
+!ELSEIF "$(CFG)" == "static_library - Win32 Debug"
+
+# SUBTRACT CPP /YX
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\source\portaudiocpp\MemFunCallbackStream.cxx
+
+!IF "$(CFG)" == "static_library - Win32 Release"
+
+!ELSEIF "$(CFG)" == "static_library - Win32 Debug"
+
+# SUBTRACT CPP /YX
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\source\portaudiocpp\Stream.cxx
+
+!IF "$(CFG)" == "static_library - Win32 Release"
+
+!ELSEIF "$(CFG)" == "static_library - Win32 Debug"
+
+# SUBTRACT CPP /YX
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\source\portaudiocpp\StreamParameters.cxx
+
+!IF "$(CFG)" == "static_library - Win32 Release"
+
+!ELSEIF "$(CFG)" == "static_library - Win32 Debug"
+
+# SUBTRACT CPP /YX
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\source\portaudiocpp\System.cxx
+
+!IF "$(CFG)" == "static_library - Win32 Release"
+
+!ELSEIF "$(CFG)" == "static_library - Win32 Debug"
+
+# SUBTRACT CPP /YX
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\source\portaudiocpp\SystemDeviceIterator.cxx
+
+!IF "$(CFG)" == "static_library - Win32 Release"
+
+!ELSEIF "$(CFG)" == "static_library - Win32 Debug"
+
+# SUBTRACT CPP /YX
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\source\portaudiocpp\SystemHostApiIterator.cxx
+
+!IF "$(CFG)" == "static_library - Win32 Release"
+
+!ELSEIF "$(CFG)" == "static_library - Win32 Debug"
+
+# SUBTRACT CPP /YX
+
+!ENDIF
+
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=..\..\include\portaudiocpp\AsioDeviceAdapter.hxx
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\include\portaudiocpp\AutoSystem.hxx
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\include\portaudiocpp\BlockingStream.hxx
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\include\portaudiocpp\CallbackInterface.hxx
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\include\portaudiocpp\CallbackStream.hxx
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\include\portaudiocpp\CFunCallbackStream.hxx
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\include\portaudiocpp\CppFunCallbackStream.hxx
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\include\portaudiocpp\Device.hxx
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\include\portaudiocpp\DirectionSpecificStreamParameters.hxx
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\include\portaudiocpp\Exception.hxx
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\include\portaudiocpp\HostApi.hxx
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\include\portaudiocpp\InterfaceCallbackStream.hxx
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\include\portaudiocpp\MemFunCallbackStream.hxx
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\include\portaudiocpp\PortAudioCpp.hxx
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\include\portaudiocpp\SampleDataFormat.hxx
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\include\portaudiocpp\Stream.hxx
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\include\portaudiocpp\StreamParameters.hxx
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\include\portaudiocpp\System.hxx
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\include\portaudiocpp\SystemDeviceIterator.hxx
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\include\portaudiocpp\SystemHostApiIterator.hxx
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/bindings/cpp/build/vc6/static_library.dsw b/bindings/cpp/build/vc6/static_library.dsw
index cb9d090..0aff3f5 100644
--- a/bindings/cpp/build/vc6/static_library.dsw
+++ b/bindings/cpp/build/vc6/static_library.dsw
@@ -1,29 +1,29 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "static_library"=".\static_library.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
+Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "static_library"=".\static_library.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/bindings/cpp/build/vc7_1/devs_example.sln b/bindings/cpp/build/vc7_1/devs_example.sln
index c443bce..ef11811 100644
--- a/bindings/cpp/build/vc7_1/devs_example.sln
+++ b/bindings/cpp/build/vc7_1/devs_example.sln
@@ -1,30 +1,30 @@
-Microsoft Visual Studio Solution File, Format Version 8.00
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "devs_example", "devs_example.vcproj", "{1B9A038D-80A3-4DBD-9F0D-AF10B49B863A}"
- ProjectSection(ProjectDependencies) = postProject
- {D18EA0C9-8C65-441D-884C-55EB43A84F2A} = {D18EA0C9-8C65-441D-884C-55EB43A84F2A}
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "static_library", "static_library.vcproj", "{D18EA0C9-8C65-441D-884C-55EB43A84F2A}"
- ProjectSection(ProjectDependencies) = postProject
- EndProjectSection
-EndProject
-Global
- GlobalSection(SolutionConfiguration) = preSolution
- Debug = Debug
- Release = Release
- EndGlobalSection
- GlobalSection(ProjectConfiguration) = postSolution
- {1B9A038D-80A3-4DBD-9F0D-AF10B49B863A}.Debug.ActiveCfg = Debug|Win32
- {1B9A038D-80A3-4DBD-9F0D-AF10B49B863A}.Debug.Build.0 = Debug|Win32
- {1B9A038D-80A3-4DBD-9F0D-AF10B49B863A}.Release.ActiveCfg = Release|Win32
- {1B9A038D-80A3-4DBD-9F0D-AF10B49B863A}.Release.Build.0 = Release|Win32
- {D18EA0C9-8C65-441D-884C-55EB43A84F2A}.Debug.ActiveCfg = Debug|Win32
- {D18EA0C9-8C65-441D-884C-55EB43A84F2A}.Debug.Build.0 = Debug|Win32
- {D18EA0C9-8C65-441D-884C-55EB43A84F2A}.Release.ActiveCfg = Release|Win32
- {D18EA0C9-8C65-441D-884C-55EB43A84F2A}.Release.Build.0 = Release|Win32
- EndGlobalSection
- GlobalSection(ExtensibilityGlobals) = postSolution
- EndGlobalSection
- GlobalSection(ExtensibilityAddIns) = postSolution
- EndGlobalSection
-EndGlobal
+Microsoft Visual Studio Solution File, Format Version 8.00
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "devs_example", "devs_example.vcproj", "{1B9A038D-80A3-4DBD-9F0D-AF10B49B863A}"
+ ProjectSection(ProjectDependencies) = postProject
+ {D18EA0C9-8C65-441D-884C-55EB43A84F2A} = {D18EA0C9-8C65-441D-884C-55EB43A84F2A}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "static_library", "static_library.vcproj", "{D18EA0C9-8C65-441D-884C-55EB43A84F2A}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfiguration) = preSolution
+ Debug = Debug
+ Release = Release
+ EndGlobalSection
+ GlobalSection(ProjectConfiguration) = postSolution
+ {1B9A038D-80A3-4DBD-9F0D-AF10B49B863A}.Debug.ActiveCfg = Debug|Win32
+ {1B9A038D-80A3-4DBD-9F0D-AF10B49B863A}.Debug.Build.0 = Debug|Win32
+ {1B9A038D-80A3-4DBD-9F0D-AF10B49B863A}.Release.ActiveCfg = Release|Win32
+ {1B9A038D-80A3-4DBD-9F0D-AF10B49B863A}.Release.Build.0 = Release|Win32
+ {D18EA0C9-8C65-441D-884C-55EB43A84F2A}.Debug.ActiveCfg = Debug|Win32
+ {D18EA0C9-8C65-441D-884C-55EB43A84F2A}.Debug.Build.0 = Debug|Win32
+ {D18EA0C9-8C65-441D-884C-55EB43A84F2A}.Release.ActiveCfg = Release|Win32
+ {D18EA0C9-8C65-441D-884C-55EB43A84F2A}.Release.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddIns) = postSolution
+ EndGlobalSection
+EndGlobal
diff --git a/bindings/cpp/build/vc7_1/devs_example.vcproj b/bindings/cpp/build/vc7_1/devs_example.vcproj
index d32cf7d..b4095e4 100644
--- a/bindings/cpp/build/vc7_1/devs_example.vcproj
+++ b/bindings/cpp/build/vc7_1/devs_example.vcproj
@@ -1,195 +1,195 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/bindings/cpp/build/vc7_1/sine_example.sln b/bindings/cpp/build/vc7_1/sine_example.sln
index 7be7c58..b3c9b29 100644
--- a/bindings/cpp/build/vc7_1/sine_example.sln
+++ b/bindings/cpp/build/vc7_1/sine_example.sln
@@ -1,30 +1,30 @@
-Microsoft Visual Studio Solution File, Format Version 8.00
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sine_example", "sine_example.vcproj", "{1B9A038D-80A3-4DBD-9F0D-AF10B49B863A}"
- ProjectSection(ProjectDependencies) = postProject
- {D18EA0C9-8C65-441D-884C-55EB43A84F2A} = {D18EA0C9-8C65-441D-884C-55EB43A84F2A}
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "static_library", "static_library.vcproj", "{D18EA0C9-8C65-441D-884C-55EB43A84F2A}"
- ProjectSection(ProjectDependencies) = postProject
- EndProjectSection
-EndProject
-Global
- GlobalSection(SolutionConfiguration) = preSolution
- Debug = Debug
- Release = Release
- EndGlobalSection
- GlobalSection(ProjectConfiguration) = postSolution
- {1B9A038D-80A3-4DBD-9F0D-AF10B49B863A}.Debug.ActiveCfg = Debug|Win32
- {1B9A038D-80A3-4DBD-9F0D-AF10B49B863A}.Debug.Build.0 = Debug|Win32
- {1B9A038D-80A3-4DBD-9F0D-AF10B49B863A}.Release.ActiveCfg = Release|Win32
- {1B9A038D-80A3-4DBD-9F0D-AF10B49B863A}.Release.Build.0 = Release|Win32
- {D18EA0C9-8C65-441D-884C-55EB43A84F2A}.Debug.ActiveCfg = Debug|Win32
- {D18EA0C9-8C65-441D-884C-55EB43A84F2A}.Debug.Build.0 = Debug|Win32
- {D18EA0C9-8C65-441D-884C-55EB43A84F2A}.Release.ActiveCfg = Release|Win32
- {D18EA0C9-8C65-441D-884C-55EB43A84F2A}.Release.Build.0 = Release|Win32
- EndGlobalSection
- GlobalSection(ExtensibilityGlobals) = postSolution
- EndGlobalSection
- GlobalSection(ExtensibilityAddIns) = postSolution
- EndGlobalSection
-EndGlobal
+Microsoft Visual Studio Solution File, Format Version 8.00
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sine_example", "sine_example.vcproj", "{1B9A038D-80A3-4DBD-9F0D-AF10B49B863A}"
+ ProjectSection(ProjectDependencies) = postProject
+ {D18EA0C9-8C65-441D-884C-55EB43A84F2A} = {D18EA0C9-8C65-441D-884C-55EB43A84F2A}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "static_library", "static_library.vcproj", "{D18EA0C9-8C65-441D-884C-55EB43A84F2A}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfiguration) = preSolution
+ Debug = Debug
+ Release = Release
+ EndGlobalSection
+ GlobalSection(ProjectConfiguration) = postSolution
+ {1B9A038D-80A3-4DBD-9F0D-AF10B49B863A}.Debug.ActiveCfg = Debug|Win32
+ {1B9A038D-80A3-4DBD-9F0D-AF10B49B863A}.Debug.Build.0 = Debug|Win32
+ {1B9A038D-80A3-4DBD-9F0D-AF10B49B863A}.Release.ActiveCfg = Release|Win32
+ {1B9A038D-80A3-4DBD-9F0D-AF10B49B863A}.Release.Build.0 = Release|Win32
+ {D18EA0C9-8C65-441D-884C-55EB43A84F2A}.Debug.ActiveCfg = Debug|Win32
+ {D18EA0C9-8C65-441D-884C-55EB43A84F2A}.Debug.Build.0 = Debug|Win32
+ {D18EA0C9-8C65-441D-884C-55EB43A84F2A}.Release.ActiveCfg = Release|Win32
+ {D18EA0C9-8C65-441D-884C-55EB43A84F2A}.Release.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddIns) = postSolution
+ EndGlobalSection
+EndGlobal
diff --git a/bindings/cpp/build/vc7_1/sine_example.vcproj b/bindings/cpp/build/vc7_1/sine_example.vcproj
index f50458d..656393d 100644
--- a/bindings/cpp/build/vc7_1/sine_example.vcproj
+++ b/bindings/cpp/build/vc7_1/sine_example.vcproj
@@ -1,327 +1,327 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/bindings/cpp/build/vc7_1/static_library.sln b/bindings/cpp/build/vc7_1/static_library.sln
index 36f2ac1..4ec0b6b 100644
--- a/bindings/cpp/build/vc7_1/static_library.sln
+++ b/bindings/cpp/build/vc7_1/static_library.sln
@@ -1,21 +1,21 @@
-Microsoft Visual Studio Solution File, Format Version 8.00
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "static_library", "static_library.vcproj", "{D18EA0C9-8C65-441D-884C-55EB43A84F2A}"
- ProjectSection(ProjectDependencies) = postProject
- EndProjectSection
-EndProject
-Global
- GlobalSection(SolutionConfiguration) = preSolution
- Debug = Debug
- Release = Release
- EndGlobalSection
- GlobalSection(ProjectConfiguration) = postSolution
- {D18EA0C9-8C65-441D-884C-55EB43A84F2A}.Debug.ActiveCfg = Debug|Win32
- {D18EA0C9-8C65-441D-884C-55EB43A84F2A}.Debug.Build.0 = Debug|Win32
- {D18EA0C9-8C65-441D-884C-55EB43A84F2A}.Release.ActiveCfg = Release|Win32
- {D18EA0C9-8C65-441D-884C-55EB43A84F2A}.Release.Build.0 = Release|Win32
- EndGlobalSection
- GlobalSection(ExtensibilityGlobals) = postSolution
- EndGlobalSection
- GlobalSection(ExtensibilityAddIns) = postSolution
- EndGlobalSection
-EndGlobal
+Microsoft Visual Studio Solution File, Format Version 8.00
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "static_library", "static_library.vcproj", "{D18EA0C9-8C65-441D-884C-55EB43A84F2A}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfiguration) = preSolution
+ Debug = Debug
+ Release = Release
+ EndGlobalSection
+ GlobalSection(ProjectConfiguration) = postSolution
+ {D18EA0C9-8C65-441D-884C-55EB43A84F2A}.Debug.ActiveCfg = Debug|Win32
+ {D18EA0C9-8C65-441D-884C-55EB43A84F2A}.Debug.Build.0 = Debug|Win32
+ {D18EA0C9-8C65-441D-884C-55EB43A84F2A}.Release.ActiveCfg = Release|Win32
+ {D18EA0C9-8C65-441D-884C-55EB43A84F2A}.Release.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddIns) = postSolution
+ EndGlobalSection
+EndGlobal
diff --git a/bindings/cpp/build/vc7_1/static_library.vcproj b/bindings/cpp/build/vc7_1/static_library.vcproj
index d67324e..1b060ce 100644
--- a/bindings/cpp/build/vc7_1/static_library.vcproj
+++ b/bindings/cpp/build/vc7_1/static_library.vcproj
@@ -1,218 +1,218 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/bindings/cpp/doc/README b/bindings/cpp/doc/README
index 5e22972..efeaa72 100644
--- a/bindings/cpp/doc/README
+++ b/bindings/cpp/doc/README
@@ -1,34 +1,34 @@
-GNU/Linux:
-----------
-
-1) Download and install a recent version of Doxygen (preferably version 1.3.3 or
-later). See http://www.doxygen.org/.
-2) Download and install a recent version of GraphViz. See
-http://www.research.att.com/sw/tools/graphviz/.
-3) Run ``doxygen config.doxy.linux'' in this directory or load and generate the file
-config.doxy.linux from the Doxywizard application. Or alternatively ``make docs'' can
-be run from the build/gnu folder.
-
-The generated html documentation will be placed in /doc/api_reference/. To open
-the main page of the documentation, open the file /doc/api_reference/index.html in
-an html browser.
-
-
-Windows:
---------
-
-1) Download and install a recent Doxygen (preferably version 1.3.4 or later). See
-http://www.doxygen.org/.
-2) Download and install a recent version of GraphViz. See
-http://www.research.att.com/sw/tools/graphviz/.
-3) If needed, edit the config.doxy file in an ascii text editor so that
-``DOT_PATH'' variable points to the folder where GraphViz is installed.
-4) Run ``doxygen config.doxy'' in this directory or load and generate the file
-config.doxy from the Doxywizard application.
-
-The generated html documentation will be placed in /doc/api_reference/. To open
-the main page of the documentation, open the file /doc/api_reference/index.html in
-an html browser.
-
-
-
+GNU/Linux:
+----------
+
+1) Download and install a recent version of Doxygen (preferably version 1.3.3 or
+later). See http://www.doxygen.org/.
+2) Download and install a recent version of GraphViz. See
+http://www.research.att.com/sw/tools/graphviz/.
+3) Run ``doxygen config.doxy.linux'' in this directory or load and generate the file
+config.doxy.linux from the Doxywizard application. Or alternatively ``make docs'' can
+be run from the build/gnu folder.
+
+The generated html documentation will be placed in /doc/api_reference/. To open
+the main page of the documentation, open the file /doc/api_reference/index.html in
+an html browser.
+
+
+Windows:
+--------
+
+1) Download and install a recent Doxygen (preferably version 1.3.4 or later). See
+http://www.doxygen.org/.
+2) Download and install a recent version of GraphViz. See
+http://www.research.att.com/sw/tools/graphviz/.
+3) If needed, edit the config.doxy file in an ascii text editor so that
+``DOT_PATH'' variable points to the folder where GraphViz is installed.
+4) Run ``doxygen config.doxy'' in this directory or load and generate the file
+config.doxy from the Doxywizard application.
+
+The generated html documentation will be placed in /doc/api_reference/. To open
+the main page of the documentation, open the file /doc/api_reference/index.html in
+an html browser.
+
+
+
diff --git a/bindings/cpp/doc/config.doxy.linux b/bindings/cpp/doc/config.doxy.linux
index 38079f6..95a38ef 100644
--- a/bindings/cpp/doc/config.doxy.linux
+++ b/bindings/cpp/doc/config.doxy.linux
@@ -1,210 +1,210 @@
-# Doxyfile 1.3.3
-
-#---------------------------------------------------------------------------
-# General configuration options
-#---------------------------------------------------------------------------
-PROJECT_NAME = PortAudioCpp
-PROJECT_NUMBER = 2.0
-OUTPUT_DIRECTORY = ./
-OUTPUT_LANGUAGE = English
-USE_WINDOWS_ENCODING = YES
-EXTRACT_ALL = YES
-EXTRACT_PRIVATE = YES
-EXTRACT_STATIC = YES
-EXTRACT_LOCAL_CLASSES = YES
-HIDE_UNDOC_MEMBERS = NO
-HIDE_UNDOC_CLASSES = NO
-HIDE_FRIEND_COMPOUNDS = NO
-HIDE_IN_BODY_DOCS = NO
-BRIEF_MEMBER_DESC = YES
-REPEAT_BRIEF = YES
-ALWAYS_DETAILED_SEC = YES
-INLINE_INHERITED_MEMB = NO
-FULL_PATH_NAMES = NO
-STRIP_FROM_PATH =
-INTERNAL_DOCS = NO
-CASE_SENSE_NAMES = YES
-SHORT_NAMES = YES
-HIDE_SCOPE_NAMES = NO
-SHOW_INCLUDE_FILES = YES
-JAVADOC_AUTOBRIEF = NO
-MULTILINE_CPP_IS_BRIEF = NO
-DETAILS_AT_TOP = YES
-INHERIT_DOCS = YES
-INLINE_INFO = YES
-SORT_MEMBER_DOCS = NO
-DISTRIBUTE_GROUP_DOC = NO
-TAB_SIZE = 4
-GENERATE_TODOLIST = YES
-GENERATE_TESTLIST = YES
-GENERATE_BUGLIST = YES
-GENERATE_DEPRECATEDLIST= YES
-ALIASES =
-ENABLED_SECTIONS =
-MAX_INITIALIZER_LINES = 30
-OPTIMIZE_OUTPUT_FOR_C = NO
-OPTIMIZE_OUTPUT_JAVA = NO
-SHOW_USED_FILES = YES
-SUBGROUPING = YES
-#---------------------------------------------------------------------------
-# configuration options related to warning and progress messages
-#---------------------------------------------------------------------------
-QUIET = NO
-WARNINGS = YES
-WARN_IF_UNDOCUMENTED = YES
-WARN_IF_DOC_ERROR = YES
-WARN_FORMAT = "$file:$line: $text"
-WARN_LOGFILE =
-#---------------------------------------------------------------------------
-# configuration options related to the input files
-#---------------------------------------------------------------------------
-INPUT = ../source \
- ../include
-FILE_PATTERNS = *.hxx \
- *.cxx
-RECURSIVE = YES
-EXCLUDE =
-EXCLUDE_SYMLINKS = NO
-EXCLUDE_PATTERNS =
-EXAMPLE_PATH =
-EXAMPLE_PATTERNS =
-EXAMPLE_RECURSIVE = NO
-IMAGE_PATH =
-INPUT_FILTER =
-FILTER_SOURCE_FILES = NO
-#---------------------------------------------------------------------------
-# configuration options related to source browsing
-#---------------------------------------------------------------------------
-SOURCE_BROWSER = NO
-INLINE_SOURCES = NO
-STRIP_CODE_COMMENTS = YES
-REFERENCED_BY_RELATION = YES
-REFERENCES_RELATION = YES
-VERBATIM_HEADERS = YES
-#---------------------------------------------------------------------------
-# configuration options related to the alphabetical class index
-#---------------------------------------------------------------------------
-ALPHABETICAL_INDEX = YES
-COLS_IN_ALPHA_INDEX = 2
-IGNORE_PREFIX =
-#---------------------------------------------------------------------------
-# configuration options related to the HTML output
-#---------------------------------------------------------------------------
-GENERATE_HTML = YES
-HTML_OUTPUT = api_reference
-HTML_FILE_EXTENSION = .html
-HTML_HEADER =
-HTML_FOOTER =
-HTML_STYLESHEET =
-HTML_ALIGN_MEMBERS = YES
-GENERATE_HTMLHELP = NO
-CHM_FILE =
-HHC_LOCATION =
-GENERATE_CHI = NO
-BINARY_TOC = NO
-TOC_EXPAND = NO
-DISABLE_INDEX = NO
-ENUM_VALUES_PER_LINE = 4
-GENERATE_TREEVIEW = NO
-TREEVIEW_WIDTH = 250
-#---------------------------------------------------------------------------
-# configuration options related to the LaTeX output
-#---------------------------------------------------------------------------
-GENERATE_LATEX = NO
-LATEX_OUTPUT = latex
-LATEX_CMD_NAME = latex
-MAKEINDEX_CMD_NAME = makeindex
-COMPACT_LATEX = NO
-PAPER_TYPE = a4wide
-EXTRA_PACKAGES =
-LATEX_HEADER =
-PDF_HYPERLINKS = NO
-USE_PDFLATEX = NO
-LATEX_BATCHMODE = NO
-LATEX_HIDE_INDICES = NO
-#---------------------------------------------------------------------------
-# configuration options related to the RTF output
-#---------------------------------------------------------------------------
-GENERATE_RTF = NO
-RTF_OUTPUT = rtf
-COMPACT_RTF = NO
-RTF_HYPERLINKS = NO
-RTF_STYLESHEET_FILE =
-RTF_EXTENSIONS_FILE =
-#---------------------------------------------------------------------------
-# configuration options related to the man page output
-#---------------------------------------------------------------------------
-GENERATE_MAN = NO
-MAN_OUTPUT = man
-MAN_EXTENSION = .3
-MAN_LINKS = NO
-#---------------------------------------------------------------------------
-# configuration options related to the XML output
-#---------------------------------------------------------------------------
-GENERATE_XML = NO
-XML_OUTPUT = xml
-XML_SCHEMA =
-XML_DTD =
-#---------------------------------------------------------------------------
-# configuration options for the AutoGen Definitions output
-#---------------------------------------------------------------------------
-GENERATE_AUTOGEN_DEF = NO
-#---------------------------------------------------------------------------
-# configuration options related to the Perl module output
-#---------------------------------------------------------------------------
-GENERATE_PERLMOD = NO
-PERLMOD_LATEX = NO
-PERLMOD_PRETTY = YES
-PERLMOD_MAKEVAR_PREFIX =
-#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor
-#---------------------------------------------------------------------------
-ENABLE_PREPROCESSING = YES
-MACRO_EXPANSION = NO
-EXPAND_ONLY_PREDEF = NO
-SEARCH_INCLUDES = YES
-INCLUDE_PATH =
-INCLUDE_FILE_PATTERNS =
-PREDEFINED =
-EXPAND_AS_DEFINED =
-SKIP_FUNCTION_MACROS = YES
-#---------------------------------------------------------------------------
-# Configuration::addtions related to external references
-#---------------------------------------------------------------------------
-TAGFILES =
-GENERATE_TAGFILE =
-ALLEXTERNALS = NO
-EXTERNAL_GROUPS = YES
-PERL_PATH = /usr/bin/perl
-#---------------------------------------------------------------------------
-# Configuration options related to the dot tool
-#---------------------------------------------------------------------------
-CLASS_DIAGRAMS = YES
-HIDE_UNDOC_RELATIONS = YES
-HAVE_DOT = YES
-CLASS_GRAPH = YES
-COLLABORATION_GRAPH = YES
-UML_LOOK = YES
-TEMPLATE_RELATIONS = YES
-INCLUDE_GRAPH = YES
-INCLUDED_BY_GRAPH = YES
-CALL_GRAPH = NO
-GRAPHICAL_HIERARCHY = YES
-DOT_IMAGE_FORMAT = png
-DOT_PATH = "/usr/bin/dot"
-DOTFILE_DIRS =
-MAX_DOT_GRAPH_WIDTH = 1024
-MAX_DOT_GRAPH_HEIGHT = 1024
-MAX_DOT_GRAPH_DEPTH = 0
-GENERATE_LEGEND = YES
-DOT_CLEANUP = YES
-#---------------------------------------------------------------------------
-# Configuration::addtions related to the search engine
-#---------------------------------------------------------------------------
-SEARCHENGINE = NO
-CGI_NAME = search.cgi
-CGI_URL =
-DOC_URL =
-DOC_ABSPATH =
-BIN_ABSPATH = /usr/local/bin/
-EXT_DOC_PATHS =
+# Doxyfile 1.3.3
+
+#---------------------------------------------------------------------------
+# General configuration options
+#---------------------------------------------------------------------------
+PROJECT_NAME = PortAudioCpp
+PROJECT_NUMBER = 2.0
+OUTPUT_DIRECTORY = ./
+OUTPUT_LANGUAGE = English
+USE_WINDOWS_ENCODING = YES
+EXTRACT_ALL = YES
+EXTRACT_PRIVATE = YES
+EXTRACT_STATIC = YES
+EXTRACT_LOCAL_CLASSES = YES
+HIDE_UNDOC_MEMBERS = NO
+HIDE_UNDOC_CLASSES = NO
+HIDE_FRIEND_COMPOUNDS = NO
+HIDE_IN_BODY_DOCS = NO
+BRIEF_MEMBER_DESC = YES
+REPEAT_BRIEF = YES
+ALWAYS_DETAILED_SEC = YES
+INLINE_INHERITED_MEMB = NO
+FULL_PATH_NAMES = NO
+STRIP_FROM_PATH =
+INTERNAL_DOCS = NO
+CASE_SENSE_NAMES = YES
+SHORT_NAMES = YES
+HIDE_SCOPE_NAMES = NO
+SHOW_INCLUDE_FILES = YES
+JAVADOC_AUTOBRIEF = NO
+MULTILINE_CPP_IS_BRIEF = NO
+DETAILS_AT_TOP = YES
+INHERIT_DOCS = YES
+INLINE_INFO = YES
+SORT_MEMBER_DOCS = NO
+DISTRIBUTE_GROUP_DOC = NO
+TAB_SIZE = 4
+GENERATE_TODOLIST = YES
+GENERATE_TESTLIST = YES
+GENERATE_BUGLIST = YES
+GENERATE_DEPRECATEDLIST= YES
+ALIASES =
+ENABLED_SECTIONS =
+MAX_INITIALIZER_LINES = 30
+OPTIMIZE_OUTPUT_FOR_C = NO
+OPTIMIZE_OUTPUT_JAVA = NO
+SHOW_USED_FILES = YES
+SUBGROUPING = YES
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+QUIET = NO
+WARNINGS = YES
+WARN_IF_UNDOCUMENTED = YES
+WARN_IF_DOC_ERROR = YES
+WARN_FORMAT = "$file:$line: $text"
+WARN_LOGFILE =
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+INPUT = ../source \
+ ../include
+FILE_PATTERNS = *.hxx \
+ *.cxx
+RECURSIVE = YES
+EXCLUDE =
+EXCLUDE_SYMLINKS = NO
+EXCLUDE_PATTERNS =
+EXAMPLE_PATH =
+EXAMPLE_PATTERNS =
+EXAMPLE_RECURSIVE = NO
+IMAGE_PATH =
+INPUT_FILTER =
+FILTER_SOURCE_FILES = NO
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+SOURCE_BROWSER = NO
+INLINE_SOURCES = NO
+STRIP_CODE_COMMENTS = YES
+REFERENCED_BY_RELATION = YES
+REFERENCES_RELATION = YES
+VERBATIM_HEADERS = YES
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+ALPHABETICAL_INDEX = YES
+COLS_IN_ALPHA_INDEX = 2
+IGNORE_PREFIX =
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+GENERATE_HTML = YES
+HTML_OUTPUT = api_reference
+HTML_FILE_EXTENSION = .html
+HTML_HEADER =
+HTML_FOOTER =
+HTML_STYLESHEET =
+HTML_ALIGN_MEMBERS = YES
+GENERATE_HTMLHELP = NO
+CHM_FILE =
+HHC_LOCATION =
+GENERATE_CHI = NO
+BINARY_TOC = NO
+TOC_EXPAND = NO
+DISABLE_INDEX = NO
+ENUM_VALUES_PER_LINE = 4
+GENERATE_TREEVIEW = NO
+TREEVIEW_WIDTH = 250
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+GENERATE_LATEX = NO
+LATEX_OUTPUT = latex
+LATEX_CMD_NAME = latex
+MAKEINDEX_CMD_NAME = makeindex
+COMPACT_LATEX = NO
+PAPER_TYPE = a4wide
+EXTRA_PACKAGES =
+LATEX_HEADER =
+PDF_HYPERLINKS = NO
+USE_PDFLATEX = NO
+LATEX_BATCHMODE = NO
+LATEX_HIDE_INDICES = NO
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+GENERATE_RTF = NO
+RTF_OUTPUT = rtf
+COMPACT_RTF = NO
+RTF_HYPERLINKS = NO
+RTF_STYLESHEET_FILE =
+RTF_EXTENSIONS_FILE =
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+GENERATE_MAN = NO
+MAN_OUTPUT = man
+MAN_EXTENSION = .3
+MAN_LINKS = NO
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+GENERATE_XML = NO
+XML_OUTPUT = xml
+XML_SCHEMA =
+XML_DTD =
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+GENERATE_AUTOGEN_DEF = NO
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+GENERATE_PERLMOD = NO
+PERLMOD_LATEX = NO
+PERLMOD_PRETTY = YES
+PERLMOD_MAKEVAR_PREFIX =
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+ENABLE_PREPROCESSING = YES
+MACRO_EXPANSION = NO
+EXPAND_ONLY_PREDEF = NO
+SEARCH_INCLUDES = YES
+INCLUDE_PATH =
+INCLUDE_FILE_PATTERNS =
+PREDEFINED =
+EXPAND_AS_DEFINED =
+SKIP_FUNCTION_MACROS = YES
+#---------------------------------------------------------------------------
+# Configuration::addtions related to external references
+#---------------------------------------------------------------------------
+TAGFILES =
+GENERATE_TAGFILE =
+ALLEXTERNALS = NO
+EXTERNAL_GROUPS = YES
+PERL_PATH = /usr/bin/perl
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+CLASS_DIAGRAMS = YES
+HIDE_UNDOC_RELATIONS = YES
+HAVE_DOT = YES
+CLASS_GRAPH = YES
+COLLABORATION_GRAPH = YES
+UML_LOOK = YES
+TEMPLATE_RELATIONS = YES
+INCLUDE_GRAPH = YES
+INCLUDED_BY_GRAPH = YES
+CALL_GRAPH = NO
+GRAPHICAL_HIERARCHY = YES
+DOT_IMAGE_FORMAT = png
+DOT_PATH = "/usr/bin/dot"
+DOTFILE_DIRS =
+MAX_DOT_GRAPH_WIDTH = 1024
+MAX_DOT_GRAPH_HEIGHT = 1024
+MAX_DOT_GRAPH_DEPTH = 0
+GENERATE_LEGEND = YES
+DOT_CLEANUP = YES
+#---------------------------------------------------------------------------
+# Configuration::addtions related to the search engine
+#---------------------------------------------------------------------------
+SEARCHENGINE = NO
+CGI_NAME = search.cgi
+CGI_URL =
+DOC_URL =
+DOC_ABSPATH =
+BIN_ABSPATH = /usr/local/bin/
+EXT_DOC_PATHS =
diff --git a/bindings/cpp/example/sine.cxx b/bindings/cpp/example/sine.cxx
index 577a247..0676e3e 100644
--- a/bindings/cpp/example/sine.cxx
+++ b/bindings/cpp/example/sine.cxx
@@ -1,137 +1,137 @@
-// ---------------------------------------------------------------------------------------
-
-#include
-#include
-#include
-#include
-#include "portaudiocpp/PortAudioCpp.hxx"
-
-// ---------------------------------------------------------------------------------------
-
-// Some constants:
-const int NUM_SECONDS = 5;
-const double SAMPLE_RATE = 44100.0;
-const int FRAMES_PER_BUFFER = 64;
-const int TABLE_SIZE = 200;
-
-// ---------------------------------------------------------------------------------------
-
-// SineGenerator class:
-class SineGenerator
-{
-public:
- SineGenerator(int tableSize) : tableSize_(tableSize), leftPhase_(0), rightPhase_(0)
- {
- const double PI = 3.14159265;
- table_ = new float[tableSize];
- for (int i = 0; i < tableSize; ++i)
- {
- table_[i] = 0.125f * (float)sin(((double)i/(double)tableSize)*PI*2.);
- }
- }
-
- ~SineGenerator()
- {
- delete[] table_;
- }
-
- int generate(const void *inputBuffer, void *outputBuffer, unsigned long framesPerBuffer,
- const PaStreamCallbackTimeInfo *timeInfo, PaStreamCallbackFlags statusFlags)
- {
- assert(outputBuffer != NULL);
-
- float **out = static_cast(outputBuffer);
-
- for (unsigned int i = 0; i < framesPerBuffer; ++i)
- {
- out[0][i] = table_[leftPhase_];
- out[1][i] = table_[rightPhase_];
-
- leftPhase_ += 1;
- if (leftPhase_ >= tableSize_)
- leftPhase_ -= tableSize_;
-
- rightPhase_ += 3;
- if (rightPhase_ >= tableSize_)
- rightPhase_ -= tableSize_;
- }
-
- return paContinue;
- }
-
-private:
- float *table_;
- int tableSize_;
- int leftPhase_;
- int rightPhase_;
-};
-
-// ---------------------------------------------------------------------------------------
-
-// main:
-int main(int, char *[]);
-int main(int, char *[])
-{
- try
- {
- // Create a SineGenerator object:
- SineGenerator sineGenerator(TABLE_SIZE);
-
- std::cout << "Setting up PortAudio..." << std::endl;
-
- // Set up the System:
- portaudio::AutoSystem autoSys;
- portaudio::System &sys = portaudio::System::instance();
-
- // Set up the parameters required to open a (Callback)Stream:
- portaudio::DirectionSpecificStreamParameters outParams(sys.defaultOutputDevice(), 2, portaudio::FLOAT32, false, sys.defaultOutputDevice().defaultLowOutputLatency(), NULL);
- portaudio::StreamParameters params(portaudio::DirectionSpecificStreamParameters::null(), outParams, SAMPLE_RATE, FRAMES_PER_BUFFER, paClipOff);
-
- std::cout << "Opening stereo output stream..." << std::endl;
-
- // Create (and open) a new Stream, using the SineGenerator::generate function as a callback:
- portaudio::MemFunCallbackStream stream(params, sineGenerator, &SineGenerator::generate);
-
- std::cout << "Starting playback for " << NUM_SECONDS << " seconds." << std::endl;
-
- // Start the Stream (audio playback starts):
- stream.start();
-
- // Wait for 5 seconds:
- sys.sleep(NUM_SECONDS * 1000);
-
- std::cout << "Closing stream..." <
+#include
+#include
+#include
+#include "portaudiocpp/PortAudioCpp.hxx"
+
+// ---------------------------------------------------------------------------------------
+
+// Some constants:
+const int NUM_SECONDS = 5;
+const double SAMPLE_RATE = 44100.0;
+const int FRAMES_PER_BUFFER = 64;
+const int TABLE_SIZE = 200;
+
+// ---------------------------------------------------------------------------------------
+
+// SineGenerator class:
+class SineGenerator
+{
+public:
+ SineGenerator(int tableSize) : tableSize_(tableSize), leftPhase_(0), rightPhase_(0)
+ {
+ const double PI = 3.14159265;
+ table_ = new float[tableSize];
+ for (int i = 0; i < tableSize; ++i)
+ {
+ table_[i] = 0.125f * (float)sin(((double)i/(double)tableSize)*PI*2.);
+ }
+ }
+
+ ~SineGenerator()
+ {
+ delete[] table_;
+ }
+
+ int generate(const void *inputBuffer, void *outputBuffer, unsigned long framesPerBuffer,
+ const PaStreamCallbackTimeInfo *timeInfo, PaStreamCallbackFlags statusFlags)
+ {
+ assert(outputBuffer != NULL);
+
+ float **out = static_cast(outputBuffer);
+
+ for (unsigned int i = 0; i < framesPerBuffer; ++i)
+ {
+ out[0][i] = table_[leftPhase_];
+ out[1][i] = table_[rightPhase_];
+
+ leftPhase_ += 1;
+ if (leftPhase_ >= tableSize_)
+ leftPhase_ -= tableSize_;
+
+ rightPhase_ += 3;
+ if (rightPhase_ >= tableSize_)
+ rightPhase_ -= tableSize_;
+ }
+
+ return paContinue;
+ }
+
+private:
+ float *table_;
+ int tableSize_;
+ int leftPhase_;
+ int rightPhase_;
+};
+
+// ---------------------------------------------------------------------------------------
+
+// main:
+int main(int, char *[]);
+int main(int, char *[])
+{
+ try
+ {
+ // Create a SineGenerator object:
+ SineGenerator sineGenerator(TABLE_SIZE);
+
+ std::cout << "Setting up PortAudio..." << std::endl;
+
+ // Set up the System:
+ portaudio::AutoSystem autoSys;
+ portaudio::System &sys = portaudio::System::instance();
+
+ // Set up the parameters required to open a (Callback)Stream:
+ portaudio::DirectionSpecificStreamParameters outParams(sys.defaultOutputDevice(), 2, portaudio::FLOAT32, false, sys.defaultOutputDevice().defaultLowOutputLatency(), NULL);
+ portaudio::StreamParameters params(portaudio::DirectionSpecificStreamParameters::null(), outParams, SAMPLE_RATE, FRAMES_PER_BUFFER, paClipOff);
+
+ std::cout << "Opening stereo output stream..." << std::endl;
+
+ // Create (and open) a new Stream, using the SineGenerator::generate function as a callback:
+ portaudio::MemFunCallbackStream stream(params, sineGenerator, &SineGenerator::generate);
+
+ std::cout << "Starting playback for " << NUM_SECONDS << " seconds." << std::endl;
+
+ // Start the Stream (audio playback starts):
+ stream.start();
+
+ // Wait for 5 seconds:
+ sys.sleep(NUM_SECONDS * 1000);
+
+ std::cout << "Closing stream..." <
-
-#include "portaudio.h"
-
-#include "portaudiocpp/SampleDataFormat.hxx"
-
-// ---------------------------------------------------------------------------------------
-
-// Forward declaration(s):
-namespace portaudio
-{
- class System;
- class HostApi;
-}
-
-// ---------------------------------------------------------------------------------------
-
-// Declaration(s):
-namespace portaudio
-{
-
- //////
- /// @brief Class which represents a PortAudio device in the System.
- ///
- /// A single physical device in the system may have multiple PortAudio
- /// Device representations using different HostApi 's though. A Device
- /// can be half-duplex or full-duplex. A half-duplex Device can be used
- /// to create a half-duplex Stream. A full-duplex Device can be used to
- /// create a full-duplex Stream. If supported by the HostApi, two
- /// half-duplex Devices can even be used to create a full-duplex Stream.
- ///
- /// Note that Device objects are very light-weight and can be passed around
- /// by-value.
- //////
- class Device
- {
- public:
- // query info: name, max in channels, max out channels,
- // default low/hight input/output latency, default sample rate
- PaDeviceIndex index() const;
- const char *name() const;
- int maxInputChannels() const;
- int maxOutputChannels() const;
- PaTime defaultLowInputLatency() const;
- PaTime defaultHighInputLatency() const;
- PaTime defaultLowOutputLatency() const;
- PaTime defaultHighOutputLatency() const;
- double defaultSampleRate() const;
-
- bool isInputOnlyDevice() const; // extended
- bool isOutputOnlyDevice() const; // extended
- bool isFullDuplexDevice() const; // extended
- bool isSystemDefaultInputDevice() const; // extended
- bool isSystemDefaultOutputDevice() const; // extended
- bool isHostApiDefaultInputDevice() const; // extended
- bool isHostApiDefaultOutputDevice() const; // extended
-
- bool operator==(const Device &rhs) const;
- bool operator!=(const Device &rhs) const;
-
- // host api reference
- HostApi &hostApi();
- const HostApi &hostApi() const;
-
- private:
- PaDeviceIndex index_;
- const PaDeviceInfo *info_;
-
- private:
- friend class System;
-
- explicit Device(PaDeviceIndex index);
- ~Device();
-
- Device(const Device &); // non-copyable
- Device &operator=(const Device &); // non-copyable
- };
-
- // -----------------------------------------------------------------------------------
-
-} // namespace portaudio
-
-// ---------------------------------------------------------------------------------------
-
-#endif // INCLUDED_PORTAUDIO_DEVICE_HXX
-
+#ifndef INCLUDED_PORTAUDIO_DEVICE_HXX
+#define INCLUDED_PORTAUDIO_DEVICE_HXX
+
+// ---------------------------------------------------------------------------------------
+
+#include
+
+#include "portaudio.h"
+
+#include "portaudiocpp/SampleDataFormat.hxx"
+
+// ---------------------------------------------------------------------------------------
+
+// Forward declaration(s):
+namespace portaudio
+{
+ class System;
+ class HostApi;
+}
+
+// ---------------------------------------------------------------------------------------
+
+// Declaration(s):
+namespace portaudio
+{
+
+ //////
+ /// @brief Class which represents a PortAudio device in the System.
+ ///
+ /// A single physical device in the system may have multiple PortAudio
+ /// Device representations using different HostApi 's though. A Device
+ /// can be half-duplex or full-duplex. A half-duplex Device can be used
+ /// to create a half-duplex Stream. A full-duplex Device can be used to
+ /// create a full-duplex Stream. If supported by the HostApi, two
+ /// half-duplex Devices can even be used to create a full-duplex Stream.
+ ///
+ /// Note that Device objects are very light-weight and can be passed around
+ /// by-value.
+ //////
+ class Device
+ {
+ public:
+ // query info: name, max in channels, max out channels,
+ // default low/hight input/output latency, default sample rate
+ PaDeviceIndex index() const;
+ const char *name() const;
+ int maxInputChannels() const;
+ int maxOutputChannels() const;
+ PaTime defaultLowInputLatency() const;
+ PaTime defaultHighInputLatency() const;
+ PaTime defaultLowOutputLatency() const;
+ PaTime defaultHighOutputLatency() const;
+ double defaultSampleRate() const;
+
+ bool isInputOnlyDevice() const; // extended
+ bool isOutputOnlyDevice() const; // extended
+ bool isFullDuplexDevice() const; // extended
+ bool isSystemDefaultInputDevice() const; // extended
+ bool isSystemDefaultOutputDevice() const; // extended
+ bool isHostApiDefaultInputDevice() const; // extended
+ bool isHostApiDefaultOutputDevice() const; // extended
+
+ bool operator==(const Device &rhs) const;
+ bool operator!=(const Device &rhs) const;
+
+ // host api reference
+ HostApi &hostApi();
+ const HostApi &hostApi() const;
+
+ private:
+ PaDeviceIndex index_;
+ const PaDeviceInfo *info_;
+
+ private:
+ friend class System;
+
+ explicit Device(PaDeviceIndex index);
+ ~Device();
+
+ Device(const Device &); // non-copyable
+ Device &operator=(const Device &); // non-copyable
+ };
+
+ // -----------------------------------------------------------------------------------
+
+} // namespace portaudio
+
+// ---------------------------------------------------------------------------------------
+
+#endif // INCLUDED_PORTAUDIO_DEVICE_HXX
+
diff --git a/bindings/cpp/include/portaudiocpp/DirectionSpecificStreamParameters.hxx b/bindings/cpp/include/portaudiocpp/DirectionSpecificStreamParameters.hxx
index dd5ae0b..bc24742 100644
--- a/bindings/cpp/include/portaudiocpp/DirectionSpecificStreamParameters.hxx
+++ b/bindings/cpp/include/portaudiocpp/DirectionSpecificStreamParameters.hxx
@@ -1,77 +1,77 @@
-#ifndef INCLUDED_PORTAUDIO_SINGLEDIRECTIONSTREAMPARAMETERS_HXX
-#define INCLUDED_PORTAUDIO_SINGLEDIRECTIONSTREAMPARAMETERS_HXX
-
-// ---------------------------------------------------------------------------------------
-
-#include
-
-#include "portaudio.h"
-
-#include "portaudiocpp/System.hxx"
-#include "portaudiocpp/SampleDataFormat.hxx"
-
-// ---------------------------------------------------------------------------------------
-
-// Forward declaration(s):
-namespace portaudio
-{
- class Device;
-}
-
-// ---------------------------------------------------------------------------------------
-
-// Declaration(s):
-namespace portaudio
-{
-
- //////
- /// @brief All parameters for one direction (either in or out) of a Stream. Together with
- /// parameters common to both directions, two DirectionSpecificStreamParameters can make up
- /// a StreamParameters object which contains all parameters for a Stream.
- //////
- class DirectionSpecificStreamParameters
- {
- public:
- static DirectionSpecificStreamParameters null();
-
- DirectionSpecificStreamParameters();
- DirectionSpecificStreamParameters(const Device &device, int numChannels, SampleDataFormat format,
- bool interleaved, PaTime suggestedLatency, void *hostApiSpecificStreamInfo);
-
- // Set up methods:
- void setDevice(const Device &device);
- void setNumChannels(int numChannels);
-
- void setSampleFormat(SampleDataFormat format, bool interleaved = true);
- void setHostApiSpecificSampleFormat(PaSampleFormat format, bool interleaved = true);
-
- void setSuggestedLatency(PaTime latency);
-
- void setHostApiSpecificStreamInfo(void *streamInfo);
-
- // Accessor methods:
- PaStreamParameters *paStreamParameters();
- const PaStreamParameters *paStreamParameters() const;
-
- Device &device() const;
- int numChannels() const;
-
- SampleDataFormat sampleFormat() const;
- bool isSampleFormatInterleaved() const;
- bool isSampleFormatHostApiSpecific() const;
- PaSampleFormat hostApiSpecificSampleFormat() const;
-
- PaTime suggestedLatency() const;
-
- void *hostApiSpecificStreamInfo() const;
-
- private:
- PaStreamParameters paStreamParameters_;
- };
-
-
-} // namespace portaudio
-
-// ---------------------------------------------------------------------------------------
-
-#endif // INCLUDED_PORTAUDIO_SINGLEDIRECTIONSTREAMPARAMETERS_HXX
+#ifndef INCLUDED_PORTAUDIO_SINGLEDIRECTIONSTREAMPARAMETERS_HXX
+#define INCLUDED_PORTAUDIO_SINGLEDIRECTIONSTREAMPARAMETERS_HXX
+
+// ---------------------------------------------------------------------------------------
+
+#include
+
+#include "portaudio.h"
+
+#include "portaudiocpp/System.hxx"
+#include "portaudiocpp/SampleDataFormat.hxx"
+
+// ---------------------------------------------------------------------------------------
+
+// Forward declaration(s):
+namespace portaudio
+{
+ class Device;
+}
+
+// ---------------------------------------------------------------------------------------
+
+// Declaration(s):
+namespace portaudio
+{
+
+ //////
+ /// @brief All parameters for one direction (either in or out) of a Stream. Together with
+ /// parameters common to both directions, two DirectionSpecificStreamParameters can make up
+ /// a StreamParameters object which contains all parameters for a Stream.
+ //////
+ class DirectionSpecificStreamParameters
+ {
+ public:
+ static DirectionSpecificStreamParameters null();
+
+ DirectionSpecificStreamParameters();
+ DirectionSpecificStreamParameters(const Device &device, int numChannels, SampleDataFormat format,
+ bool interleaved, PaTime suggestedLatency, void *hostApiSpecificStreamInfo);
+
+ // Set up methods:
+ void setDevice(const Device &device);
+ void setNumChannels(int numChannels);
+
+ void setSampleFormat(SampleDataFormat format, bool interleaved = true);
+ void setHostApiSpecificSampleFormat(PaSampleFormat format, bool interleaved = true);
+
+ void setSuggestedLatency(PaTime latency);
+
+ void setHostApiSpecificStreamInfo(void *streamInfo);
+
+ // Accessor methods:
+ PaStreamParameters *paStreamParameters();
+ const PaStreamParameters *paStreamParameters() const;
+
+ Device &device() const;
+ int numChannels() const;
+
+ SampleDataFormat sampleFormat() const;
+ bool isSampleFormatInterleaved() const;
+ bool isSampleFormatHostApiSpecific() const;
+ PaSampleFormat hostApiSpecificSampleFormat() const;
+
+ PaTime suggestedLatency() const;
+
+ void *hostApiSpecificStreamInfo() const;
+
+ private:
+ PaStreamParameters paStreamParameters_;
+ };
+
+
+} // namespace portaudio
+
+// ---------------------------------------------------------------------------------------
+
+#endif // INCLUDED_PORTAUDIO_SINGLEDIRECTIONSTREAMPARAMETERS_HXX
diff --git a/bindings/cpp/include/portaudiocpp/Exception.hxx b/bindings/cpp/include/portaudiocpp/Exception.hxx
index a70c2f1..f5249c9 100644
--- a/bindings/cpp/include/portaudiocpp/Exception.hxx
+++ b/bindings/cpp/include/portaudiocpp/Exception.hxx
@@ -1,108 +1,108 @@
-#ifndef INCLUDED_PORTAUDIO_EXCEPTION_HXX
-#define INCLUDED_PORTAUDIO_EXCEPTION_HXX
-
-// ---------------------------------------------------------------------------------------
-
-#include
-
-#include "portaudio.h"
-
-// ---------------------------------------------------------------------------------------
-
-namespace portaudio
-{
-
- //////
- /// @brief Base class for all exceptions PortAudioCpp can throw.
- ///
- /// Class is derived from std::exception.
- //////
- class Exception : public std::exception
- {
- public:
- virtual ~Exception() throw() {}
-
- virtual const char *what() const throw() = 0;
- };
-
- // -----------------------------------------------------------------------------------
-
- //////
- /// @brief Wrapper for PortAudio error codes to C++ exceptions.
- ///
- /// It wraps up PortAudio's error handling mechanism using
- /// C++ exceptions and is derived from std::exception for
- /// easy exception handling and to ease integration with
- /// other code.
- ///
- /// To know what exceptions each function may throw, look up
- /// the errors that can occure in the PortAudio documentation
- /// for the equivalent functions.
- ///
- /// Some functions are likely to throw an exception (such as
- /// Stream::open(), etc) and these should always be called in
- /// try{} catch{} blocks and the thrown exceptions should be
- /// handled properly (ie. the application shouldn't just abort,
- /// but merely display a warning dialog to the user or something).
- /// However nearly all functions in PortAudioCpp are capable
- /// of throwing exceptions. When a function like Stream::isStopped()
- /// throws an exception, it's such an exceptional state that it's
- /// not likely that it can be recovered. PaExceptions such as these
- /// can ``safely'' be left to be handled by some outer catch-all-like
- /// mechanism for unrecoverable errors.
- //////
- class PaException : public Exception
- {
- public:
- explicit PaException(PaError error);
-
- const char *what() const throw();
-
- PaError paError() const;
- const char *paErrorText() const;
-
- bool isHostApiError() const; // extended
- long lastHostApiError() const;
- const char *lastHostApiErrorText() const;
-
- bool operator==(const PaException &rhs) const;
- bool operator!=(const PaException &rhs) const;
-
- private:
- PaError error_;
- };
-
- // -----------------------------------------------------------------------------------
-
- //////
- /// @brief Exceptions specific to PortAudioCpp (ie. exceptions which do not have an
- /// equivalent PortAudio error code).
- //////
- class PaCppException : public Exception
- {
- public:
- enum ExceptionSpecifier
- {
- UNABLE_TO_ADAPT_DEVICE
- };
-
- PaCppException(ExceptionSpecifier specifier);
-
- const char *what() const throw();
-
- ExceptionSpecifier specifier() const;
-
- bool operator==(const PaCppException &rhs) const;
- bool operator!=(const PaCppException &rhs) const;
-
- private:
- ExceptionSpecifier specifier_;
- };
-
-
-} // namespace portaudio
-
-// ---------------------------------------------------------------------------------------
-
-#endif // INCLUDED_PORTAUDIO_EXCEPTION_HXX
-
+#ifndef INCLUDED_PORTAUDIO_EXCEPTION_HXX
+#define INCLUDED_PORTAUDIO_EXCEPTION_HXX
+
+// ---------------------------------------------------------------------------------------
+
+#include
+
+#include "portaudio.h"
+
+// ---------------------------------------------------------------------------------------
+
+namespace portaudio
+{
+
+ //////
+ /// @brief Base class for all exceptions PortAudioCpp can throw.
+ ///
+ /// Class is derived from std::exception.
+ //////
+ class Exception : public std::exception
+ {
+ public:
+ virtual ~Exception() throw() {}
+
+ virtual const char *what() const throw() = 0;
+ };
+
+ // -----------------------------------------------------------------------------------
+
+ //////
+ /// @brief Wrapper for PortAudio error codes to C++ exceptions.
+ ///
+ /// It wraps up PortAudio's error handling mechanism using
+ /// C++ exceptions and is derived from std::exception for
+ /// easy exception handling and to ease integration with
+ /// other code.
+ ///
+ /// To know what exceptions each function may throw, look up
+ /// the errors that can occure in the PortAudio documentation
+ /// for the equivalent functions.
+ ///
+ /// Some functions are likely to throw an exception (such as
+ /// Stream::open(), etc) and these should always be called in
+ /// try{} catch{} blocks and the thrown exceptions should be
+ /// handled properly (ie. the application shouldn't just abort,
+ /// but merely display a warning dialog to the user or something).
+ /// However nearly all functions in PortAudioCpp are capable
+ /// of throwing exceptions. When a function like Stream::isStopped()
+ /// throws an exception, it's such an exceptional state that it's
+ /// not likely that it can be recovered. PaExceptions such as these
+ /// can ``safely'' be left to be handled by some outer catch-all-like
+ /// mechanism for unrecoverable errors.
+ //////
+ class PaException : public Exception
+ {
+ public:
+ explicit PaException(PaError error);
+
+ const char *what() const throw();
+
+ PaError paError() const;
+ const char *paErrorText() const;
+
+ bool isHostApiError() const; // extended
+ long lastHostApiError() const;
+ const char *lastHostApiErrorText() const;
+
+ bool operator==(const PaException &rhs) const;
+ bool operator!=(const PaException &rhs) const;
+
+ private:
+ PaError error_;
+ };
+
+ // -----------------------------------------------------------------------------------
+
+ //////
+ /// @brief Exceptions specific to PortAudioCpp (ie. exceptions which do not have an
+ /// equivalent PortAudio error code).
+ //////
+ class PaCppException : public Exception
+ {
+ public:
+ enum ExceptionSpecifier
+ {
+ UNABLE_TO_ADAPT_DEVICE
+ };
+
+ PaCppException(ExceptionSpecifier specifier);
+
+ const char *what() const throw();
+
+ ExceptionSpecifier specifier() const;
+
+ bool operator==(const PaCppException &rhs) const;
+ bool operator!=(const PaCppException &rhs) const;
+
+ private:
+ ExceptionSpecifier specifier_;
+ };
+
+
+} // namespace portaudio
+
+// ---------------------------------------------------------------------------------------
+
+#endif // INCLUDED_PORTAUDIO_EXCEPTION_HXX
+
diff --git a/bindings/cpp/include/portaudiocpp/HostApi.hxx b/bindings/cpp/include/portaudiocpp/HostApi.hxx
index 899fc42..ce397ca 100644
--- a/bindings/cpp/include/portaudiocpp/HostApi.hxx
+++ b/bindings/cpp/include/portaudiocpp/HostApi.hxx
@@ -1,76 +1,76 @@
-#ifndef INCLUDED_PORTAUDIO_HOSTAPI_HXX
-#define INCLUDED_PORTAUDIO_HOSTAPI_HXX
-
-// ---------------------------------------------------------------------------------------
-
-#include "portaudio.h"
-
-#include "portaudiocpp/System.hxx"
-
-// ---------------------------------------------------------------------------------------
-
-// Forward declaration(s):
-namespace portaudio
-{
- class Device;
-}
-
-// ---------------------------------------------------------------------------------------
-
-// Declaration(s):
-namespace portaudio
-{
-
-
- //////
- /// @brief HostApi represents a host API (usually type of driver) in the System.
- ///
- /// A single System can support multiple HostApi's each one typically having
- /// a set of Devices using that HostApi (usually driver type). All Devices in
- /// the HostApi can be enumerated and the default input/output Device for this
- /// HostApi can be retreived.
- //////
- class HostApi
- {
- public:
- typedef System::DeviceIterator DeviceIterator;
-
- // query info: id, name, numDevices
- PaHostApiTypeId typeId() const;
- PaHostApiIndex index() const;
- const char *name() const;
- int deviceCount() const;
-
- // iterate devices
- DeviceIterator devicesBegin();
- DeviceIterator devicesEnd();
-
- // default devices
- Device &defaultInputDevice() const;
- Device &defaultOutputDevice() const;
-
- // comparison operators
- bool operator==(const HostApi &rhs) const;
- bool operator!=(const HostApi &rhs) const;
-
- private:
- const PaHostApiInfo *info_;
- Device **devices_;
-
- private:
- friend class System;
-
- explicit HostApi(PaHostApiIndex index);
- ~HostApi();
-
- HostApi(const HostApi &); // non-copyable
- HostApi &operator=(const HostApi &); // non-copyable
- };
-
-
-}
-
-// ---------------------------------------------------------------------------------------
-
-#endif // INCLUDED_PORTAUDIO_HOSTAPI_HXX
-
+#ifndef INCLUDED_PORTAUDIO_HOSTAPI_HXX
+#define INCLUDED_PORTAUDIO_HOSTAPI_HXX
+
+// ---------------------------------------------------------------------------------------
+
+#include "portaudio.h"
+
+#include "portaudiocpp/System.hxx"
+
+// ---------------------------------------------------------------------------------------
+
+// Forward declaration(s):
+namespace portaudio
+{
+ class Device;
+}
+
+// ---------------------------------------------------------------------------------------
+
+// Declaration(s):
+namespace portaudio
+{
+
+
+ //////
+ /// @brief HostApi represents a host API (usually type of driver) in the System.
+ ///
+ /// A single System can support multiple HostApi's each one typically having
+ /// a set of Devices using that HostApi (usually driver type). All Devices in
+ /// the HostApi can be enumerated and the default input/output Device for this
+ /// HostApi can be retreived.
+ //////
+ class HostApi
+ {
+ public:
+ typedef System::DeviceIterator DeviceIterator;
+
+ // query info: id, name, numDevices
+ PaHostApiTypeId typeId() const;
+ PaHostApiIndex index() const;
+ const char *name() const;
+ int deviceCount() const;
+
+ // iterate devices
+ DeviceIterator devicesBegin();
+ DeviceIterator devicesEnd();
+
+ // default devices
+ Device &defaultInputDevice() const;
+ Device &defaultOutputDevice() const;
+
+ // comparison operators
+ bool operator==(const HostApi &rhs) const;
+ bool operator!=(const HostApi &rhs) const;
+
+ private:
+ const PaHostApiInfo *info_;
+ Device **devices_;
+
+ private:
+ friend class System;
+
+ explicit HostApi(PaHostApiIndex index);
+ ~HostApi();
+
+ HostApi(const HostApi &); // non-copyable
+ HostApi &operator=(const HostApi &); // non-copyable
+ };
+
+
+}
+
+// ---------------------------------------------------------------------------------------
+
+#endif // INCLUDED_PORTAUDIO_HOSTAPI_HXX
+
diff --git a/bindings/cpp/include/portaudiocpp/InterfaceCallbackStream.hxx b/bindings/cpp/include/portaudiocpp/InterfaceCallbackStream.hxx
index e496dd2..5aa49e7 100644
--- a/bindings/cpp/include/portaudiocpp/InterfaceCallbackStream.hxx
+++ b/bindings/cpp/include/portaudiocpp/InterfaceCallbackStream.hxx
@@ -1,49 +1,49 @@
-#ifndef INCLUDED_PORTAUDIO_INTERFACECALLBACKSTREAM_HXX
-#define INCLUDED_PORTAUDIO_INTERFACECALLBACKSTREAM_HXX
-
-// ---------------------------------------------------------------------------------------
-
-#include "portaudio.h"
-
-#include "portaudiocpp/CallbackStream.hxx"
-
-// ---------------------------------------------------------------------------------------
-
-// Forward declaration(s)
-namespace portaudio
-{
- class StreamParameters;
- class CallbackInterface;
-}
-
-// ---------------------------------------------------------------------------------------
-
-// Declaration(s):
-namespace portaudio
-{
-
-
- //////
- /// @brief Callback stream using an instance of an object that's derived from the CallbackInterface
- /// interface.
- //////
- class InterfaceCallbackStream : public CallbackStream
- {
- public:
- InterfaceCallbackStream();
- InterfaceCallbackStream(const StreamParameters ¶meters, CallbackInterface &instance);
- ~InterfaceCallbackStream();
-
- void open(const StreamParameters ¶meters, CallbackInterface &instance);
-
- private:
- InterfaceCallbackStream(const InterfaceCallbackStream &); // non-copyable
- InterfaceCallbackStream &operator=(const InterfaceCallbackStream &); // non-copyable
- };
-
-
-} // portaudio
-
-// ---------------------------------------------------------------------------------------
-
-#endif // INCLUDED_PORTAUDIO_INTERFACECALLBACKSTREAM_HXX
+#ifndef INCLUDED_PORTAUDIO_INTERFACECALLBACKSTREAM_HXX
+#define INCLUDED_PORTAUDIO_INTERFACECALLBACKSTREAM_HXX
+
+// ---------------------------------------------------------------------------------------
+
+#include "portaudio.h"
+
+#include "portaudiocpp/CallbackStream.hxx"
+
+// ---------------------------------------------------------------------------------------
+
+// Forward declaration(s)
+namespace portaudio
+{
+ class StreamParameters;
+ class CallbackInterface;
+}
+
+// ---------------------------------------------------------------------------------------
+
+// Declaration(s):
+namespace portaudio
+{
+
+
+ //////
+ /// @brief Callback stream using an instance of an object that's derived from the CallbackInterface
+ /// interface.
+ //////
+ class InterfaceCallbackStream : public CallbackStream
+ {
+ public:
+ InterfaceCallbackStream();
+ InterfaceCallbackStream(const StreamParameters ¶meters, CallbackInterface &instance);
+ ~InterfaceCallbackStream();
+
+ void open(const StreamParameters ¶meters, CallbackInterface &instance);
+
+ private:
+ InterfaceCallbackStream(const InterfaceCallbackStream &); // non-copyable
+ InterfaceCallbackStream &operator=(const InterfaceCallbackStream &); // non-copyable
+ };
+
+
+} // portaudio
+
+// ---------------------------------------------------------------------------------------
+
+#endif // INCLUDED_PORTAUDIO_INTERFACECALLBACKSTREAM_HXX
diff --git a/bindings/cpp/include/portaudiocpp/MemFunCallbackStream.hxx b/bindings/cpp/include/portaudiocpp/MemFunCallbackStream.hxx
index a9e50ca..01cf37b 100644
--- a/bindings/cpp/include/portaudiocpp/MemFunCallbackStream.hxx
+++ b/bindings/cpp/include/portaudiocpp/MemFunCallbackStream.hxx
@@ -1,107 +1,107 @@
-#ifndef INCLUDED_PORTAUDIO_MEMFUNCALLBACKSTREAM_HXX
-#define INCLUDED_PORTAUDIO_MEMFUNCALLBACKSTREAM_HXX
-
-// ---------------------------------------------------------------------------------------
-
-#include "portaudio.h"
-
-#include "portaudiocpp/CallbackStream.hxx"
-#include "portaudiocpp/CallbackInterface.hxx"
-#include "portaudiocpp/StreamParameters.hxx"
-#include "portaudiocpp/Exception.hxx"
-#include "portaudiocpp/InterfaceCallbackStream.hxx"
-
-// ---------------------------------------------------------------------------------------
-
-namespace portaudio
-{
-
-
- //////
- /// @brief Callback stream using a class's member function as a callback. Template argument T is the type of the
- /// class of which a member function is going to be used.
- ///
- /// Example usage:
- /// @verbatim MemFunCallback stream = MemFunCallbackStream(parameters, *this, &MyClass::myCallbackFunction); @endverbatim
- //////
- template
- class MemFunCallbackStream : public CallbackStream
- {
- public:
- typedef int (T::*CallbackFunPtr)(const void *, void *, unsigned long, const PaStreamCallbackTimeInfo *,
- PaStreamCallbackFlags);
-
- // -------------------------------------------------------------------------------
-
- MemFunCallbackStream()
- {
- }
-
- MemFunCallbackStream(const StreamParameters ¶meters, T &instance, CallbackFunPtr memFun) : adapter_(instance, memFun)
- {
- open(parameters);
- }
-
- ~MemFunCallbackStream()
- {
- close();
- }
-
- void open(const StreamParameters ¶meters, T &instance, CallbackFunPtr memFun)
- {
- // XXX: need to check if already open?
-
- adapter_.init(instance, memFun);
- open(parameters);
- }
-
- private:
- MemFunCallbackStream(const MemFunCallbackStream &); // non-copyable
- MemFunCallbackStream &operator=(const MemFunCallbackStream &); // non-copyable
-
- //////
- /// @brief Inner class which adapts a member function callback to a CallbackInterface compliant
- /// class (so it can be adapted using the paCallbackAdapter function).
- //////
- class MemFunToCallbackInterfaceAdapter : public CallbackInterface
- {
- public:
- MemFunToCallbackInterfaceAdapter() {}
- MemFunToCallbackInterfaceAdapter(T &instance, CallbackFunPtr memFun) : instance_(&instance), memFun_(memFun) {}
-
- void init(T &instance, CallbackFunPtr memFun)
- {
- instance_ = &instance;
- memFun_ = memFun;
- }
-
- int paCallbackFun(const void *inputBuffer, void *outputBuffer, unsigned long numFrames,
- const PaStreamCallbackTimeInfo *timeInfo, PaStreamCallbackFlags statusFlags)
- {
- return (instance_->*memFun_)(inputBuffer, outputBuffer, numFrames, timeInfo, statusFlags);
- }
-
- private:
- T *instance_;
- CallbackFunPtr memFun_;
- };
-
- MemFunToCallbackInterfaceAdapter adapter_;
-
- void open(const StreamParameters ¶meters)
- {
- PaError err = Pa_OpenStream(&stream_, parameters.inputParameters().paStreamParameters(), parameters.outputParameters().paStreamParameters(),
- parameters.sampleRate(), parameters.framesPerBuffer(), parameters.flags(), &impl::callbackInterfaceToPaCallbackAdapter,
- static_cast(&adapter_));
-
- if (err != paNoError)
- throw PaException(err);
- }
- };
-
-
-} // portaudio
-
-// ---------------------------------------------------------------------------------------
-
-#endif // INCLUDED_PORTAUDIO_MEMFUNCALLBACKSTREAM_HXX
+#ifndef INCLUDED_PORTAUDIO_MEMFUNCALLBACKSTREAM_HXX
+#define INCLUDED_PORTAUDIO_MEMFUNCALLBACKSTREAM_HXX
+
+// ---------------------------------------------------------------------------------------
+
+#include "portaudio.h"
+
+#include "portaudiocpp/CallbackStream.hxx"
+#include "portaudiocpp/CallbackInterface.hxx"
+#include "portaudiocpp/StreamParameters.hxx"
+#include "portaudiocpp/Exception.hxx"
+#include "portaudiocpp/InterfaceCallbackStream.hxx"
+
+// ---------------------------------------------------------------------------------------
+
+namespace portaudio
+{
+
+
+ //////
+ /// @brief Callback stream using a class's member function as a callback. Template argument T is the type of the
+ /// class of which a member function is going to be used.
+ ///
+ /// Example usage:
+ /// @verbatim MemFunCallback stream = MemFunCallbackStream(parameters, *this, &MyClass::myCallbackFunction); @endverbatim
+ //////
+ template
+ class MemFunCallbackStream : public CallbackStream
+ {
+ public:
+ typedef int (T::*CallbackFunPtr)(const void *, void *, unsigned long, const PaStreamCallbackTimeInfo *,
+ PaStreamCallbackFlags);
+
+ // -------------------------------------------------------------------------------
+
+ MemFunCallbackStream()
+ {
+ }
+
+ MemFunCallbackStream(const StreamParameters ¶meters, T &instance, CallbackFunPtr memFun) : adapter_(instance, memFun)
+ {
+ open(parameters);
+ }
+
+ ~MemFunCallbackStream()
+ {
+ close();
+ }
+
+ void open(const StreamParameters ¶meters, T &instance, CallbackFunPtr memFun)
+ {
+ // XXX: need to check if already open?
+
+ adapter_.init(instance, memFun);
+ open(parameters);
+ }
+
+ private:
+ MemFunCallbackStream(const MemFunCallbackStream &); // non-copyable
+ MemFunCallbackStream &operator=(const MemFunCallbackStream &); // non-copyable
+
+ //////
+ /// @brief Inner class which adapts a member function callback to a CallbackInterface compliant
+ /// class (so it can be adapted using the paCallbackAdapter function).
+ //////
+ class MemFunToCallbackInterfaceAdapter : public CallbackInterface
+ {
+ public:
+ MemFunToCallbackInterfaceAdapter() {}
+ MemFunToCallbackInterfaceAdapter(T &instance, CallbackFunPtr memFun) : instance_(&instance), memFun_(memFun) {}
+
+ void init(T &instance, CallbackFunPtr memFun)
+ {
+ instance_ = &instance;
+ memFun_ = memFun;
+ }
+
+ int paCallbackFun(const void *inputBuffer, void *outputBuffer, unsigned long numFrames,
+ const PaStreamCallbackTimeInfo *timeInfo, PaStreamCallbackFlags statusFlags)
+ {
+ return (instance_->*memFun_)(inputBuffer, outputBuffer, numFrames, timeInfo, statusFlags);
+ }
+
+ private:
+ T *instance_;
+ CallbackFunPtr memFun_;
+ };
+
+ MemFunToCallbackInterfaceAdapter adapter_;
+
+ void open(const StreamParameters ¶meters)
+ {
+ PaError err = Pa_OpenStream(&stream_, parameters.inputParameters().paStreamParameters(), parameters.outputParameters().paStreamParameters(),
+ parameters.sampleRate(), parameters.framesPerBuffer(), parameters.flags(), &impl::callbackInterfaceToPaCallbackAdapter,
+ static_cast(&adapter_));
+
+ if (err != paNoError)
+ throw PaException(err);
+ }
+ };
+
+
+} // portaudio
+
+// ---------------------------------------------------------------------------------------
+
+#endif // INCLUDED_PORTAUDIO_MEMFUNCALLBACKSTREAM_HXX
diff --git a/bindings/cpp/include/portaudiocpp/PortAudioCpp.hxx b/bindings/cpp/include/portaudiocpp/PortAudioCpp.hxx
index f11e7fb..96df96e 100644
--- a/bindings/cpp/include/portaudiocpp/PortAudioCpp.hxx
+++ b/bindings/cpp/include/portaudiocpp/PortAudioCpp.hxx
@@ -1,109 +1,109 @@
-#ifndef INCLUDED_PORTAUDIO_PORTAUDIOCPP_HXX
-#define INCLUDED_PORTAUDIO_PORTAUDIOCPP_HXX
-
-// ---------------------------------------------------------------------------------------
-
-//////
-/// @mainpage PortAudioCpp
-///
-///
PortAudioCpp - A Native C++ Binding of PortAudio V19
-///
PortAudio
-///
-/// PortAudio is a portable and mature C API for accessing audio hardware. It offers both callback-based and blocking
-/// style input and output, deals with sample data format conversions, dithering and much more. There are a large number
-/// of implementations available for various platforms including Windows MME, Windows DirectX, Windows and MacOS (Classic)
-/// ASIO, MacOS Classic SoundManager, MacOS X CoreAudio, OSS (Linux), Linux ALSA, JACK (MacOS X and Linux) and SGI Irix
-/// AL. Note that, currently not all of these implementations are equally complete or up-to-date (as PortAudio V19 is
-/// still in development). Because PortAudio has a C API, it can easily be called from a variety of other programming
-/// languages.
-///
-///
PortAudioCpp
-///
-/// Although, it is possible to use PortAudio's C API from within a C++ program, this is usually a little awkward
-/// as procedural and object-oriented paradigms need to be mixed. PortAudioCpp aims to resolve this by encapsulating
-/// PortAudio's C API to form an equivalent object-oriented C++ API. It provides a more natural integration of PortAudio
-/// into C++ programs as well as a more structured interface. PortAudio's concepts were preserved as much as possible and
-/// no additional features were added except for some `convenience methods'.
-///
-///
-/// PortAudioCpp's main features are:
-///
-///
Structured object model.
-///
C++ exception handling instead of C-style error return codes.
-///
Handling of callbacks using free functions (C and C++), static functions, member functions or instances of classes
-/// derived from a given interface.
-///
STL compliant iterators to host APIs and devices.
-///
Some additional convenience functions to more easily set up and use PortAudio.
-///
-///
-///
-/// PortAudioCpp requires a recent version of the PortAudio V19 source code. This can be obtained from CVS or as a snapshot
-/// from the website. The examples also require the ASIO 2 SDK which can be obtained from the Steinberg website. Alternatively, the
-/// examples can easily be modified to compile without needing ASIO.
-///
-///
-/// Supported platforms:
-///
-///
Microsoft Visual C++ 6.0, 7.0 (.NET 2002) and 7.1 (.NET 2003).
-///
GNU G++ 2.95 and G++ 3.3.
-///
-/// Other platforms should be easily supported as PortAudioCpp is platform-independent and (reasonably) C++ standard compliant.
-///
-///
-/// This documentation mainly provides information specific to PortAudioCpp. For a more complete explaination of all of the
-/// concepts used, please consult the PortAudio documentation.
-///
-///
-/// PortAudioCpp was developed by Merlijn Blaauw with many great suggestions and help from Ross Bencina. Ludwig Schwardt provided
-/// GNU/Linux build files and checked G++ compatibility. PortAudioCpp may be used under the same licensing, conditions and
-/// warranty as PortAudio. See the PortAudio license for more details.
-///
-//////
-
-// ---------------------------------------------------------------------------------------
-
-//////
-/// @namespace portaudio
-///
-/// To avoid name collision, everything in PortAudioCpp is in the portaudio
-/// namespace. If this name is too long it's usually pretty safe to use an
-/// alias like ``namespace pa = portaudio;''.
-//////
-
-// ---------------------------------------------------------------------------------------
-
-//////
-/// @file PortAudioCpp.hxx
-/// An include-all header file (for lazy programmers and using pre-compiled headers).
-//////
-
-// ---------------------------------------------------------------------------------------
-
-#include "portaudio.h"
-
-#include "portaudiocpp/AutoSystem.hxx"
-#include "portaudiocpp/BlockingStream.hxx"
-#include "portaudiocpp/CallbackInterface.hxx"
-#include "portaudiocpp/CallbackStream.hxx"
-#include "portaudiocpp/CFunCallbackStream.hxx"
-#include "portaudiocpp/CppFunCallbackStream.hxx"
-#include "portaudiocpp/Device.hxx"
-#include "portaudiocpp/Exception.hxx"
-#include "portaudiocpp/HostApi.hxx"
-#include "portaudiocpp/InterfaceCallbackStream.hxx"
-#include "portaudiocpp/MemFunCallbackStream.hxx"
-#include "portaudiocpp/SampleDataFormat.hxx"
-#include "portaudiocpp/DirectionSpecificStreamParameters.hxx"
-#include "portaudiocpp/Stream.hxx"
-#include "portaudiocpp/StreamParameters.hxx"
-#include "portaudiocpp/System.hxx"
-#include "portaudiocpp/SystemDeviceIterator.hxx"
-#include "portaudiocpp/SystemHostApiIterator.hxx"
-
-// ---------------------------------------------------------------------------------------
-
-#endif // INCLUDED_PORTAUDIO_PORTAUDIOCPP_HXX
+#ifndef INCLUDED_PORTAUDIO_PORTAUDIOCPP_HXX
+#define INCLUDED_PORTAUDIO_PORTAUDIOCPP_HXX
+
+// ---------------------------------------------------------------------------------------
+
+//////
+/// @mainpage PortAudioCpp
+///
+///
PortAudioCpp - A Native C++ Binding of PortAudio V19
+///
PortAudio
+///
+/// PortAudio is a portable and mature C API for accessing audio hardware. It offers both callback-based and blocking
+/// style input and output, deals with sample data format conversions, dithering and much more. There are a large number
+/// of implementations available for various platforms including Windows MME, Windows DirectX, Windows and MacOS (Classic)
+/// ASIO, MacOS Classic SoundManager, MacOS X CoreAudio, OSS (Linux), Linux ALSA, JACK (MacOS X and Linux) and SGI Irix
+/// AL. Note that, currently not all of these implementations are equally complete or up-to-date (as PortAudio V19 is
+/// still in development). Because PortAudio has a C API, it can easily be called from a variety of other programming
+/// languages.
+///
+///
PortAudioCpp
+///
+/// Although, it is possible to use PortAudio's C API from within a C++ program, this is usually a little awkward
+/// as procedural and object-oriented paradigms need to be mixed. PortAudioCpp aims to resolve this by encapsulating
+/// PortAudio's C API to form an equivalent object-oriented C++ API. It provides a more natural integration of PortAudio
+/// into C++ programs as well as a more structured interface. PortAudio's concepts were preserved as much as possible and
+/// no additional features were added except for some `convenience methods'.
+///
+///
+/// PortAudioCpp's main features are:
+///
+///
Structured object model.
+///
C++ exception handling instead of C-style error return codes.
+///
Handling of callbacks using free functions (C and C++), static functions, member functions or instances of classes
+/// derived from a given interface.
+///
STL compliant iterators to host APIs and devices.
+///
Some additional convenience functions to more easily set up and use PortAudio.
+///
+///
+///
+/// PortAudioCpp requires a recent version of the PortAudio V19 source code. This can be obtained from CVS or as a snapshot
+/// from the website. The examples also require the ASIO 2 SDK which can be obtained from the Steinberg website. Alternatively, the
+/// examples can easily be modified to compile without needing ASIO.
+///
+///
+/// Supported platforms:
+///
+///
Microsoft Visual C++ 6.0, 7.0 (.NET 2002) and 7.1 (.NET 2003).
+///
GNU G++ 2.95 and G++ 3.3.
+///
+/// Other platforms should be easily supported as PortAudioCpp is platform-independent and (reasonably) C++ standard compliant.
+///
+///
+/// This documentation mainly provides information specific to PortAudioCpp. For a more complete explaination of all of the
+/// concepts used, please consult the PortAudio documentation.
+///
+///
+/// PortAudioCpp was developed by Merlijn Blaauw with many great suggestions and help from Ross Bencina. Ludwig Schwardt provided
+/// GNU/Linux build files and checked G++ compatibility. PortAudioCpp may be used under the same licensing, conditions and
+/// warranty as PortAudio. See the PortAudio license for more details.
+///
+//////
+
+// ---------------------------------------------------------------------------------------
+
+//////
+/// @namespace portaudio
+///
+/// To avoid name collision, everything in PortAudioCpp is in the portaudio
+/// namespace. If this name is too long it's usually pretty safe to use an
+/// alias like ``namespace pa = portaudio;''.
+//////
+
+// ---------------------------------------------------------------------------------------
+
+//////
+/// @file PortAudioCpp.hxx
+/// An include-all header file (for lazy programmers and using pre-compiled headers).
+//////
+
+// ---------------------------------------------------------------------------------------
+
+#include "portaudio.h"
+
+#include "portaudiocpp/AutoSystem.hxx"
+#include "portaudiocpp/BlockingStream.hxx"
+#include "portaudiocpp/CallbackInterface.hxx"
+#include "portaudiocpp/CallbackStream.hxx"
+#include "portaudiocpp/CFunCallbackStream.hxx"
+#include "portaudiocpp/CppFunCallbackStream.hxx"
+#include "portaudiocpp/Device.hxx"
+#include "portaudiocpp/Exception.hxx"
+#include "portaudiocpp/HostApi.hxx"
+#include "portaudiocpp/InterfaceCallbackStream.hxx"
+#include "portaudiocpp/MemFunCallbackStream.hxx"
+#include "portaudiocpp/SampleDataFormat.hxx"
+#include "portaudiocpp/DirectionSpecificStreamParameters.hxx"
+#include "portaudiocpp/Stream.hxx"
+#include "portaudiocpp/StreamParameters.hxx"
+#include "portaudiocpp/System.hxx"
+#include "portaudiocpp/SystemDeviceIterator.hxx"
+#include "portaudiocpp/SystemHostApiIterator.hxx"
+
+// ---------------------------------------------------------------------------------------
+
+#endif // INCLUDED_PORTAUDIO_PORTAUDIOCPP_HXX
diff --git a/bindings/cpp/include/portaudiocpp/SampleDataFormat.hxx b/bindings/cpp/include/portaudiocpp/SampleDataFormat.hxx
index a7e25b2..1d3a1d9 100644
--- a/bindings/cpp/include/portaudiocpp/SampleDataFormat.hxx
+++ b/bindings/cpp/include/portaudiocpp/SampleDataFormat.hxx
@@ -1,35 +1,35 @@
-#ifndef INCLUDED_PORTAUDIO_SAMPLEDATAFORMAT_HXX
-#define INCLUDED_PORTAUDIO_SAMPLEDATAFORMAT_HXX
-
-// ---------------------------------------------------------------------------------------
-
-#include "portaudio.h"
-
-// ---------------------------------------------------------------------------------------
-
-namespace portaudio
-{
-
-
- //////
- /// @brief PortAudio sample data formats.
- ///
- /// Small helper enum to wrap the PortAudio defines.
- //////
- enum SampleDataFormat
- {
- INVALID_FORMAT = 0,
- FLOAT32 = paFloat32,
- INT32 = paInt32,
- INT24 = paInt24,
- INT16 = paInt16,
- INT8 = paInt8,
- UINT8 = paUInt8
- };
-
-
-} // namespace portaudio
-
-// ---------------------------------------------------------------------------------------
-
-#endif // INCLUDED_PORTAUDIO_SAMPLEDATAFORMAT_HXX
+#ifndef INCLUDED_PORTAUDIO_SAMPLEDATAFORMAT_HXX
+#define INCLUDED_PORTAUDIO_SAMPLEDATAFORMAT_HXX
+
+// ---------------------------------------------------------------------------------------
+
+#include "portaudio.h"
+
+// ---------------------------------------------------------------------------------------
+
+namespace portaudio
+{
+
+
+ //////
+ /// @brief PortAudio sample data formats.
+ ///
+ /// Small helper enum to wrap the PortAudio defines.
+ //////
+ enum SampleDataFormat
+ {
+ INVALID_FORMAT = 0,
+ FLOAT32 = paFloat32,
+ INT32 = paInt32,
+ INT24 = paInt24,
+ INT16 = paInt16,
+ INT8 = paInt8,
+ UINT8 = paUInt8
+ };
+
+
+} // namespace portaudio
+
+// ---------------------------------------------------------------------------------------
+
+#endif // INCLUDED_PORTAUDIO_SAMPLEDATAFORMAT_HXX
diff --git a/bindings/cpp/include/portaudiocpp/Stream.hxx b/bindings/cpp/include/portaudiocpp/Stream.hxx
index 8a255ec..1aed747 100644
--- a/bindings/cpp/include/portaudiocpp/Stream.hxx
+++ b/bindings/cpp/include/portaudiocpp/Stream.hxx
@@ -1,82 +1,82 @@
-#ifndef INCLUDED_PORTAUDIO_STREAM_HXX
-#define INCLUDED_PORTAUDIO_STREAM_HXX
-
-#include "portaudio.h"
-
-// ---------------------------------------------------------------------------------------
-
-// Forward declaration(s):
-namespace portaudio
-{
- class StreamParameters;
-}
-
-// ---------------------------------------------------------------------------------------
-
-// Declaration(s):
-namespace portaudio
-{
-
-
- //////
- /// @brief A Stream represents an active or inactive input and/or output data
- /// stream in the System.
- ///
- /// Concrete Stream classes should ensure themselves being in a closed state at
- /// destruction (i.e. by calling their own close() method in their deconstructor).
- /// Following good C++ programming practices, care must be taken to ensure no
- /// exceptions are thrown by the deconstructor of these classes. As a consequence,
- /// clients need to explicitly call close() to ensure the stream closed successfully.
- ///
- /// The Stream object can be used to manipulate the Stream's state. Also, time-constant
- /// and time-varying information about the Stream can be retreived.
- //////
- class Stream
- {
- public:
- // Opening/closing:
- virtual ~Stream();
-
- virtual void close();
- bool isOpen() const;
-
- // Additional set up:
- void setStreamFinishedCallback(PaStreamFinishedCallback *callback);
-
- // State management:
- void start();
- void stop();
- void abort();
-
- bool isStopped() const;
- bool isActive() const;
-
- // Stream info (time-constant, but might become time-variant soon):
- PaTime inputLatency() const;
- PaTime outputLatency() const;
- double sampleRate() const;
-
- // Stream info (time-varying):
- PaTime time() const;
-
- // Accessors for PortAudio PaStream, useful for interfacing
- // with PortAudio add-ons (such as PortMixer) for instance:
- const PaStream *paStream() const;
- PaStream *paStream();
-
- protected:
- Stream(); // abstract class
-
- PaStream *stream_;
-
- private:
- Stream(const Stream &); // non-copyable
- Stream &operator=(const Stream &); // non-copyable
- };
-
-
-} // namespace portaudio
-
-
-#endif // INCLUDED_PORTAUDIO_STREAM_HXX
-
+#ifndef INCLUDED_PORTAUDIO_STREAM_HXX
+#define INCLUDED_PORTAUDIO_STREAM_HXX
+
+#include "portaudio.h"
+
+// ---------------------------------------------------------------------------------------
+
+// Forward declaration(s):
+namespace portaudio
+{
+ class StreamParameters;
+}
+
+// ---------------------------------------------------------------------------------------
+
+// Declaration(s):
+namespace portaudio
+{
+
+
+ //////
+ /// @brief A Stream represents an active or inactive input and/or output data
+ /// stream in the System.
+ ///
+ /// Concrete Stream classes should ensure themselves being in a closed state at
+ /// destruction (i.e. by calling their own close() method in their deconstructor).
+ /// Following good C++ programming practices, care must be taken to ensure no
+ /// exceptions are thrown by the deconstructor of these classes. As a consequence,
+ /// clients need to explicitly call close() to ensure the stream closed successfully.
+ ///
+ /// The Stream object can be used to manipulate the Stream's state. Also, time-constant
+ /// and time-varying information about the Stream can be retreived.
+ //////
+ class Stream
+ {
+ public:
+ // Opening/closing:
+ virtual ~Stream();
+
+ virtual void close();
+ bool isOpen() const;
+
+ // Additional set up:
+ void setStreamFinishedCallback(PaStreamFinishedCallback *callback);
+
+ // State management:
+ void start();
+ void stop();
+ void abort();
+
+ bool isStopped() const;
+ bool isActive() const;
+
+ // Stream info (time-constant, but might become time-variant soon):
+ PaTime inputLatency() const;
+ PaTime outputLatency() const;
+ double sampleRate() const;
+
+ // Stream info (time-varying):
+ PaTime time() const;
+
+ // Accessors for PortAudio PaStream, useful for interfacing
+ // with PortAudio add-ons (such as PortMixer) for instance:
+ const PaStream *paStream() const;
+ PaStream *paStream();
+
+ protected:
+ Stream(); // abstract class
+
+ PaStream *stream_;
+
+ private:
+ Stream(const Stream &); // non-copyable
+ Stream &operator=(const Stream &); // non-copyable
+ };
+
+
+} // namespace portaudio
+
+
+#endif // INCLUDED_PORTAUDIO_STREAM_HXX
+
diff --git a/bindings/cpp/include/portaudiocpp/StreamParameters.hxx b/bindings/cpp/include/portaudiocpp/StreamParameters.hxx
index 2b6aa2e..c0ec9a9 100644
--- a/bindings/cpp/include/portaudiocpp/StreamParameters.hxx
+++ b/bindings/cpp/include/portaudiocpp/StreamParameters.hxx
@@ -1,77 +1,77 @@
-#ifndef INCLUDED_PORTAUDIO_STREAMPARAMETERS_HXX
-#define INCLUDED_PORTAUDIO_STREAMPARAMETERS_HXX
-
-// ---------------------------------------------------------------------------------------
-
-#include "portaudio.h"
-
-#include "portaudiocpp/DirectionSpecificStreamParameters.hxx"
-
-// ---------------------------------------------------------------------------------------
-
-// Declaration(s):
-namespace portaudio
-{
-
- //////
- /// @brief The entire set of parameters needed to configure and open
- /// a Stream.
- ///
- /// It contains parameters of input, output and shared parameters.
- /// Using the isSupported() method, the StreamParameters can be
- /// checked if opening a Stream using this StreamParameters would
- /// succeed or not. Accessors are provided to higher-level parameters
- /// aswell as the lower-level parameters which are mainly intended for
- /// internal use.
- //////
- class StreamParameters
- {
- public:
- StreamParameters();
- StreamParameters(const DirectionSpecificStreamParameters &inputParameters,
- const DirectionSpecificStreamParameters &outputParameters, double sampleRate,
- unsigned long framesPerBuffer, PaStreamFlags flags);
-
- // Set up for direction-specific:
- void setInputParameters(const DirectionSpecificStreamParameters ¶meters);
- void setOutputParameters(const DirectionSpecificStreamParameters ¶meters);
-
- // Set up for common parameters:
- void setSampleRate(double sampleRate);
- void setFramesPerBuffer(unsigned long framesPerBuffer);
- void setFlag(PaStreamFlags flag);
- void unsetFlag(PaStreamFlags flag);
- void clearFlags();
-
- // Validation:
- bool isSupported() const;
-
- // Accessors (direction-specific):
- DirectionSpecificStreamParameters &inputParameters();
- const DirectionSpecificStreamParameters &inputParameters() const;
- DirectionSpecificStreamParameters &outputParameters();
- const DirectionSpecificStreamParameters &outputParameters() const;
-
- // Accessors (common):
- double sampleRate() const;
- unsigned long framesPerBuffer() const;
- PaStreamFlags flags() const;
- bool isFlagSet(PaStreamFlags flag) const;
-
- private:
- // Half-duplex specific parameters:
- DirectionSpecificStreamParameters inputParameters_;
- DirectionSpecificStreamParameters outputParameters_;
-
- // Common parameters:
- double sampleRate_;
- unsigned long framesPerBuffer_;
- PaStreamFlags flags_;
- };
-
-
-} // namespace portaudio
-
-// ---------------------------------------------------------------------------------------
-
-#endif // INCLUDED_PORTAUDIO_STREAMPARAMETERS_HXX
+#ifndef INCLUDED_PORTAUDIO_STREAMPARAMETERS_HXX
+#define INCLUDED_PORTAUDIO_STREAMPARAMETERS_HXX
+
+// ---------------------------------------------------------------------------------------
+
+#include "portaudio.h"
+
+#include "portaudiocpp/DirectionSpecificStreamParameters.hxx"
+
+// ---------------------------------------------------------------------------------------
+
+// Declaration(s):
+namespace portaudio
+{
+
+ //////
+ /// @brief The entire set of parameters needed to configure and open
+ /// a Stream.
+ ///
+ /// It contains parameters of input, output and shared parameters.
+ /// Using the isSupported() method, the StreamParameters can be
+ /// checked if opening a Stream using this StreamParameters would
+ /// succeed or not. Accessors are provided to higher-level parameters
+ /// aswell as the lower-level parameters which are mainly intended for
+ /// internal use.
+ //////
+ class StreamParameters
+ {
+ public:
+ StreamParameters();
+ StreamParameters(const DirectionSpecificStreamParameters &inputParameters,
+ const DirectionSpecificStreamParameters &outputParameters, double sampleRate,
+ unsigned long framesPerBuffer, PaStreamFlags flags);
+
+ // Set up for direction-specific:
+ void setInputParameters(const DirectionSpecificStreamParameters ¶meters);
+ void setOutputParameters(const DirectionSpecificStreamParameters ¶meters);
+
+ // Set up for common parameters:
+ void setSampleRate(double sampleRate);
+ void setFramesPerBuffer(unsigned long framesPerBuffer);
+ void setFlag(PaStreamFlags flag);
+ void unsetFlag(PaStreamFlags flag);
+ void clearFlags();
+
+ // Validation:
+ bool isSupported() const;
+
+ // Accessors (direction-specific):
+ DirectionSpecificStreamParameters &inputParameters();
+ const DirectionSpecificStreamParameters &inputParameters() const;
+ DirectionSpecificStreamParameters &outputParameters();
+ const DirectionSpecificStreamParameters &outputParameters() const;
+
+ // Accessors (common):
+ double sampleRate() const;
+ unsigned long framesPerBuffer() const;
+ PaStreamFlags flags() const;
+ bool isFlagSet(PaStreamFlags flag) const;
+
+ private:
+ // Half-duplex specific parameters:
+ DirectionSpecificStreamParameters inputParameters_;
+ DirectionSpecificStreamParameters outputParameters_;
+
+ // Common parameters:
+ double sampleRate_;
+ unsigned long framesPerBuffer_;
+ PaStreamFlags flags_;
+ };
+
+
+} // namespace portaudio
+
+// ---------------------------------------------------------------------------------------
+
+#endif // INCLUDED_PORTAUDIO_STREAMPARAMETERS_HXX
diff --git a/bindings/cpp/include/portaudiocpp/System.hxx b/bindings/cpp/include/portaudiocpp/System.hxx
index f5fb713..d5ff9dd 100644
--- a/bindings/cpp/include/portaudiocpp/System.hxx
+++ b/bindings/cpp/include/portaudiocpp/System.hxx
@@ -1,107 +1,107 @@
-#ifndef INCLUDED_PORTAUDIO_SYSTEM_HXX
-#define INCLUDED_PORTAUDIO_SYSTEM_HXX
-
-// ---------------------------------------------------------------------------------------
-
-#include "portaudio.h"
-
-// ---------------------------------------------------------------------------------------
-
-// Forward declaration(s):
-namespace portaudio
-{
- class Device;
- class Stream;
- class HostApi;
-}
-
-// ---------------------------------------------------------------------------------------
-
-// Declaration(s):
-namespace portaudio
-{
-
-
- //////
- /// @brief System singleton which represents the PortAudio system.
- ///
- /// The System is used to initialize/terminate PortAudio and provide
- /// a single acccess point to the PortAudio System (instance()).
- /// It can be used to iterate through all HostApi 's in the System as
- /// well as all devices in the System. It also provides some utility
- /// functionality of PortAudio.
- ///
- /// Terminating the System will also abort and close the open streams.
- /// The Stream objects will need to be deallocated by the client though
- /// (it's usually a good idea to have them cleaned up automatically).
- //////
- class System
- {
- public:
- class HostApiIterator; // forward declaration
- class DeviceIterator; // forward declaration
-
- // -------------------------------------------------------------------------------
-
- static int version();
- static const char *versionText();
-
- static void initialize();
- static void terminate();
-
- static System &instance();
- static bool exists();
-
- // -------------------------------------------------------------------------------
-
- // host apis:
- HostApiIterator hostApisBegin();
- HostApiIterator hostApisEnd();
-
- HostApi &defaultHostApi();
-
- HostApi &hostApiByTypeId(PaHostApiTypeId type);
- HostApi &hostApiByIndex(PaHostApiIndex index);
-
- int hostApiCount();
-
- // -------------------------------------------------------------------------------
-
- // devices:
- DeviceIterator devicesBegin();
- DeviceIterator devicesEnd();
-
- Device &defaultInputDevice();
- Device &defaultOutputDevice();
-
- Device &deviceByIndex(PaDeviceIndex index);
-
- int deviceCount();
-
- static Device &nullDevice();
-
- // -------------------------------------------------------------------------------
-
- // misc:
- void sleep(long msec);
- int sizeOfSample(PaSampleFormat format);
-
- private:
- System();
- ~System();
-
- static System *instance_;
- static int initCount_;
-
- static HostApi **hostApis_;
- static Device **devices_;
-
- static Device *nullDevice_;
- };
-
-
-} // namespace portaudio
-
-
-#endif // INCLUDED_PORTAUDIO_SYSTEM_HXX
-
+#ifndef INCLUDED_PORTAUDIO_SYSTEM_HXX
+#define INCLUDED_PORTAUDIO_SYSTEM_HXX
+
+// ---------------------------------------------------------------------------------------
+
+#include "portaudio.h"
+
+// ---------------------------------------------------------------------------------------
+
+// Forward declaration(s):
+namespace portaudio
+{
+ class Device;
+ class Stream;
+ class HostApi;
+}
+
+// ---------------------------------------------------------------------------------------
+
+// Declaration(s):
+namespace portaudio
+{
+
+
+ //////
+ /// @brief System singleton which represents the PortAudio system.
+ ///
+ /// The System is used to initialize/terminate PortAudio and provide
+ /// a single acccess point to the PortAudio System (instance()).
+ /// It can be used to iterate through all HostApi 's in the System as
+ /// well as all devices in the System. It also provides some utility
+ /// functionality of PortAudio.
+ ///
+ /// Terminating the System will also abort and close the open streams.
+ /// The Stream objects will need to be deallocated by the client though
+ /// (it's usually a good idea to have them cleaned up automatically).
+ //////
+ class System
+ {
+ public:
+ class HostApiIterator; // forward declaration
+ class DeviceIterator; // forward declaration
+
+ // -------------------------------------------------------------------------------
+
+ static int version();
+ static const char *versionText();
+
+ static void initialize();
+ static void terminate();
+
+ static System &instance();
+ static bool exists();
+
+ // -------------------------------------------------------------------------------
+
+ // host apis:
+ HostApiIterator hostApisBegin();
+ HostApiIterator hostApisEnd();
+
+ HostApi &defaultHostApi();
+
+ HostApi &hostApiByTypeId(PaHostApiTypeId type);
+ HostApi &hostApiByIndex(PaHostApiIndex index);
+
+ int hostApiCount();
+
+ // -------------------------------------------------------------------------------
+
+ // devices:
+ DeviceIterator devicesBegin();
+ DeviceIterator devicesEnd();
+
+ Device &defaultInputDevice();
+ Device &defaultOutputDevice();
+
+ Device &deviceByIndex(PaDeviceIndex index);
+
+ int deviceCount();
+
+ static Device &nullDevice();
+
+ // -------------------------------------------------------------------------------
+
+ // misc:
+ void sleep(long msec);
+ int sizeOfSample(PaSampleFormat format);
+
+ private:
+ System();
+ ~System();
+
+ static System *instance_;
+ static int initCount_;
+
+ static HostApi **hostApis_;
+ static Device **devices_;
+
+ static Device *nullDevice_;
+ };
+
+
+} // namespace portaudio
+
+
+#endif // INCLUDED_PORTAUDIO_SYSTEM_HXX
+
diff --git a/bindings/cpp/include/portaudiocpp/SystemDeviceIterator.hxx b/bindings/cpp/include/portaudiocpp/SystemDeviceIterator.hxx
index b395ede..ffa195d 100644
--- a/bindings/cpp/include/portaudiocpp/SystemDeviceIterator.hxx
+++ b/bindings/cpp/include/portaudiocpp/SystemDeviceIterator.hxx
@@ -1,66 +1,66 @@
-#ifndef INCLUDED_PORTAUDIO_SYSTEMDEVICEITERATOR_HXX
-#define INCLUDED_PORTAUDIO_SYSTEMDEVICEITERATOR_HXX
-
-// ---------------------------------------------------------------------------------------
-
-#include
-#include
-
-#include "portaudiocpp/System.hxx"
-
-// ---------------------------------------------------------------------------------------
-
-// Forward declaration(s):
-namespace portaudio
-{
- class Device;
- class HostApi;
-}
-
-// ---------------------------------------------------------------------------------------
-
-// Declaration(s):
-namespace portaudio
-{
-
-
- //////
- /// @brief Iterator class for iterating through all Devices in a System.
- ///
- /// Devices will be iterated by iterating all Devices in each
- /// HostApi in the System. Compliant with the STL bidirectional
- /// iterator concept.
- //////
- class System::DeviceIterator
- {
- public:
- typedef std::bidirectional_iterator_tag iterator_category;
- typedef Device value_type;
- typedef ptrdiff_t difference_type;
- typedef Device * pointer;
- typedef Device & reference;
-
- Device &operator*() const;
- Device *operator->() const;
-
- DeviceIterator &operator++();
- DeviceIterator operator++(int);
- DeviceIterator &operator--();
- DeviceIterator operator--(int);
-
- bool operator==(const DeviceIterator &rhs) const;
- bool operator!=(const DeviceIterator &rhs) const;
-
- private:
- friend class System;
- friend class HostApi;
- Device **ptr_;
- };
-
-
-} // namespace portaudio
-
-// ---------------------------------------------------------------------------------------
-
-#endif // INCLUDED_PORTAUDIO_SYSTEMDEVICEITERATOR_HXX
-
+#ifndef INCLUDED_PORTAUDIO_SYSTEMDEVICEITERATOR_HXX
+#define INCLUDED_PORTAUDIO_SYSTEMDEVICEITERATOR_HXX
+
+// ---------------------------------------------------------------------------------------
+
+#include
+#include
+
+#include "portaudiocpp/System.hxx"
+
+// ---------------------------------------------------------------------------------------
+
+// Forward declaration(s):
+namespace portaudio
+{
+ class Device;
+ class HostApi;
+}
+
+// ---------------------------------------------------------------------------------------
+
+// Declaration(s):
+namespace portaudio
+{
+
+
+ //////
+ /// @brief Iterator class for iterating through all Devices in a System.
+ ///
+ /// Devices will be iterated by iterating all Devices in each
+ /// HostApi in the System. Compliant with the STL bidirectional
+ /// iterator concept.
+ //////
+ class System::DeviceIterator
+ {
+ public:
+ typedef std::bidirectional_iterator_tag iterator_category;
+ typedef Device value_type;
+ typedef ptrdiff_t difference_type;
+ typedef Device * pointer;
+ typedef Device & reference;
+
+ Device &operator*() const;
+ Device *operator->() const;
+
+ DeviceIterator &operator++();
+ DeviceIterator operator++(int);
+ DeviceIterator &operator--();
+ DeviceIterator operator--(int);
+
+ bool operator==(const DeviceIterator &rhs) const;
+ bool operator!=(const DeviceIterator &rhs) const;
+
+ private:
+ friend class System;
+ friend class HostApi;
+ Device **ptr_;
+ };
+
+
+} // namespace portaudio
+
+// ---------------------------------------------------------------------------------------
+
+#endif // INCLUDED_PORTAUDIO_SYSTEMDEVICEITERATOR_HXX
+
diff --git a/bindings/cpp/include/portaudiocpp/SystemHostApiIterator.hxx b/bindings/cpp/include/portaudiocpp/SystemHostApiIterator.hxx
index 431f87b..3e6a978 100644
--- a/bindings/cpp/include/portaudiocpp/SystemHostApiIterator.hxx
+++ b/bindings/cpp/include/portaudiocpp/SystemHostApiIterator.hxx
@@ -1,61 +1,61 @@
-#ifndef INCLUDED_PORTAUDIO_SYSTEMHOSTAPIITERATOR_HXX
-#define INCLUDED_PORTAUDIO_SYSTEMHOSTAPIITERATOR_HXX
-
-// ---------------------------------------------------------------------------------------
-
-#include
-#include
-
-#include "portaudiocpp/System.hxx"
-
-// ---------------------------------------------------------------------------------------
-
-// Forward declaration(s):
-namespace portaudio
-{
- class HostApi;
-}
-
-// ---------------------------------------------------------------------------------------
-
-// Declaration(s):
-namespace portaudio
-{
-
-
- //////
- /// @brief Iterator class for iterating through all HostApis in a System.
- ///
- /// Compliant with the STL bidirectional iterator concept.
- //////
- class System::HostApiIterator
- {
- public:
- typedef std::bidirectional_iterator_tag iterator_category;
- typedef Device value_type;
- typedef ptrdiff_t difference_type;
- typedef HostApi * pointer;
- typedef HostApi & reference;
-
- HostApi &operator*() const;
- HostApi *operator->() const;
-
- HostApiIterator &operator++();
- HostApiIterator operator++(int);
- HostApiIterator &operator--();
- HostApiIterator operator--(int);
-
- bool operator==(const HostApiIterator &rhs) const;
- bool operator!=(const HostApiIterator &rhs) const;
-
- private:
- friend class System;
- HostApi **ptr_;
- };
-
-
-} // namespace portaudio
-
-// ---------------------------------------------------------------------------------------
-
-#endif // INCLUDED_PORTAUDIO_SYSTEMHOSTAPIITERATOR_HXX
+#ifndef INCLUDED_PORTAUDIO_SYSTEMHOSTAPIITERATOR_HXX
+#define INCLUDED_PORTAUDIO_SYSTEMHOSTAPIITERATOR_HXX
+
+// ---------------------------------------------------------------------------------------
+
+#include
+#include
+
+#include "portaudiocpp/System.hxx"
+
+// ---------------------------------------------------------------------------------------
+
+// Forward declaration(s):
+namespace portaudio
+{
+ class HostApi;
+}
+
+// ---------------------------------------------------------------------------------------
+
+// Declaration(s):
+namespace portaudio
+{
+
+
+ //////
+ /// @brief Iterator class for iterating through all HostApis in a System.
+ ///
+ /// Compliant with the STL bidirectional iterator concept.
+ //////
+ class System::HostApiIterator
+ {
+ public:
+ typedef std::bidirectional_iterator_tag iterator_category;
+ typedef Device value_type;
+ typedef ptrdiff_t difference_type;
+ typedef HostApi * pointer;
+ typedef HostApi & reference;
+
+ HostApi &operator*() const;
+ HostApi *operator->() const;
+
+ HostApiIterator &operator++();
+ HostApiIterator operator++(int);
+ HostApiIterator &operator--();
+ HostApiIterator operator--(int);
+
+ bool operator==(const HostApiIterator &rhs) const;
+ bool operator!=(const HostApiIterator &rhs) const;
+
+ private:
+ friend class System;
+ HostApi **ptr_;
+ };
+
+
+} // namespace portaudio
+
+// ---------------------------------------------------------------------------------------
+
+#endif // INCLUDED_PORTAUDIO_SYSTEMHOSTAPIITERATOR_HXX
diff --git a/bindings/cpp/source/portaudiocpp/AsioDeviceAdapter.cxx b/bindings/cpp/source/portaudiocpp/AsioDeviceAdapter.cxx
index c4ee25f..3efc100 100644
--- a/bindings/cpp/source/portaudiocpp/AsioDeviceAdapter.cxx
+++ b/bindings/cpp/source/portaudiocpp/AsioDeviceAdapter.cxx
@@ -1,83 +1,83 @@
-#include "portaudiocpp/AsioDeviceAdapter.hxx"
-
-#include "portaudio.h"
-#include "pa_asio.h"
-
-#include "portaudiocpp/Device.hxx"
-#include "portaudiocpp/HostApi.hxx"
-#include "portaudiocpp/Exception.hxx"
-
-namespace portaudio
-{
- AsioDeviceAdapter::AsioDeviceAdapter(Device &device)
- {
- if (device.hostApi().typeId() != paASIO)
- throw PaCppException(PaCppException::UNABLE_TO_ADAPT_DEVICE);
-
- device_ = &device;
-
- PaError err = PaAsio_GetAvailableLatencyValues(device_->index(), &minBufferSize_, &maxBufferSize_,
- &preferredBufferSize_, &granularity_);
-
- if (err != paNoError)
- throw PaException(err);
-
- }
-
- Device &AsioDeviceAdapter::device()
- {
- return *device_;
- }
-
- long AsioDeviceAdapter::minBufferSize() const
- {
- return minBufferSize_;
- }
-
- long AsioDeviceAdapter::maxBufferSize() const
- {
- return maxBufferSize_;
- }
-
- long AsioDeviceAdapter::preferredBufferSize() const
- {
- return preferredBufferSize_;
- }
-
- long AsioDeviceAdapter::granularity() const
- {
- return granularity_;
- }
-
- void AsioDeviceAdapter::showControlPanel(void *systemSpecific)
- {
- PaError err = PaAsio_ShowControlPanel(device_->index(), systemSpecific);
-
- if (err != paNoError)
- throw PaException(err);
- }
-
- const char *AsioDeviceAdapter::inputChannelName(int channelIndex) const
- {
- const char *channelName;
+#include "portaudiocpp/AsioDeviceAdapter.hxx"
+
+#include "portaudio.h"
+#include "pa_asio.h"
+
+#include "portaudiocpp/Device.hxx"
+#include "portaudiocpp/HostApi.hxx"
+#include "portaudiocpp/Exception.hxx"
+
+namespace portaudio
+{
+ AsioDeviceAdapter::AsioDeviceAdapter(Device &device)
+ {
+ if (device.hostApi().typeId() != paASIO)
+ throw PaCppException(PaCppException::UNABLE_TO_ADAPT_DEVICE);
+
+ device_ = &device;
+
+ PaError err = PaAsio_GetAvailableLatencyValues(device_->index(), &minBufferSize_, &maxBufferSize_,
+ &preferredBufferSize_, &granularity_);
+
+ if (err != paNoError)
+ throw PaException(err);
+
+ }
+
+ Device &AsioDeviceAdapter::device()
+ {
+ return *device_;
+ }
+
+ long AsioDeviceAdapter::minBufferSize() const
+ {
+ return minBufferSize_;
+ }
+
+ long AsioDeviceAdapter::maxBufferSize() const
+ {
+ return maxBufferSize_;
+ }
+
+ long AsioDeviceAdapter::preferredBufferSize() const
+ {
+ return preferredBufferSize_;
+ }
+
+ long AsioDeviceAdapter::granularity() const
+ {
+ return granularity_;
+ }
+
+ void AsioDeviceAdapter::showControlPanel(void *systemSpecific)
+ {
+ PaError err = PaAsio_ShowControlPanel(device_->index(), systemSpecific);
+
+ if (err != paNoError)
+ throw PaException(err);
+ }
+
+ const char *AsioDeviceAdapter::inputChannelName(int channelIndex) const
+ {
+ const char *channelName;
PaError err = PaAsio_GetInputChannelName(device_->index(), channelIndex, &channelName);
if (err != paNoError)
throw PaException(err);
return channelName;
- }
-
- const char *AsioDeviceAdapter::outputChannelName(int channelIndex) const
- {
- const char *channelName;
+ }
+
+ const char *AsioDeviceAdapter::outputChannelName(int channelIndex) const
+ {
+ const char *channelName;
PaError err = PaAsio_GetOutputChannelName(device_->index(), channelIndex, &channelName);
if (err != paNoError)
throw PaException(err);
return channelName;
- }
-}
-
-
+ }
+}
+
+
diff --git a/bindings/cpp/source/portaudiocpp/BlockingStream.cxx b/bindings/cpp/source/portaudiocpp/BlockingStream.cxx
index c21535f..b26b9e8 100644
--- a/bindings/cpp/source/portaudiocpp/BlockingStream.cxx
+++ b/bindings/cpp/source/portaudiocpp/BlockingStream.cxx
@@ -1,100 +1,100 @@
-#include "portaudiocpp/BlockingStream.hxx"
-
-#include "portaudio.h"
-
-#include "portaudiocpp/StreamParameters.hxx"
-#include "portaudiocpp/Exception.hxx"
-
-namespace portaudio
-{
-
- // --------------------------------------------------------------------------------------
-
- BlockingStream::BlockingStream()
- {
- }
-
- BlockingStream::BlockingStream(const StreamParameters ¶meters)
- {
- open(parameters);
- }
-
- BlockingStream::~BlockingStream()
- {
- try
- {
- close();
- }
- catch (...)
- {
- // ignore all errors
- }
- }
-
- // --------------------------------------------------------------------------------------
-
- void BlockingStream::open(const StreamParameters ¶meters)
- {
- PaError err = Pa_OpenStream(&stream_, parameters.inputParameters().paStreamParameters(), parameters.outputParameters().paStreamParameters(),
- parameters.sampleRate(), parameters.framesPerBuffer(), parameters.flags(), NULL, NULL);
-
- if (err != paNoError)
- {
- throw PaException(err);
- }
- }
-
- // --------------------------------------------------------------------------------------
-
- void BlockingStream::read(void *buffer, unsigned long numFrames)
- {
- PaError err = Pa_ReadStream(stream_, buffer, numFrames);
-
- if (err != paNoError)
- {
- throw PaException(err);
- }
- }
-
- void BlockingStream::write(const void *buffer, unsigned long numFrames)
- {
- PaError err = Pa_WriteStream(stream_, buffer, numFrames);
-
- if (err != paNoError)
- {
- throw PaException(err);
- }
- }
-
- // --------------------------------------------------------------------------------------
-
- signed long BlockingStream::availableReadSize() const
- {
- signed long avail = Pa_GetStreamReadAvailable(stream_);
-
- if (avail < 0)
- {
- throw PaException(avail);
- }
-
- return avail;
- }
-
- signed long BlockingStream::availableWriteSize() const
- {
- signed long avail = Pa_GetStreamWriteAvailable(stream_);
-
- if (avail < 0)
- {
- throw PaException(avail);
- }
-
- return avail;
- }
-
- // --------------------------------------------------------------------------------------
-
-} // portaudio
-
-
-
+#include "portaudiocpp/BlockingStream.hxx"
+
+#include "portaudio.h"
+
+#include "portaudiocpp/StreamParameters.hxx"
+#include "portaudiocpp/Exception.hxx"
+
+namespace portaudio
+{
+
+ // --------------------------------------------------------------------------------------
+
+ BlockingStream::BlockingStream()
+ {
+ }
+
+ BlockingStream::BlockingStream(const StreamParameters ¶meters)
+ {
+ open(parameters);
+ }
+
+ BlockingStream::~BlockingStream()
+ {
+ try
+ {
+ close();
+ }
+ catch (...)
+ {
+ // ignore all errors
+ }
+ }
+
+ // --------------------------------------------------------------------------------------
+
+ void BlockingStream::open(const StreamParameters ¶meters)
+ {
+ PaError err = Pa_OpenStream(&stream_, parameters.inputParameters().paStreamParameters(), parameters.outputParameters().paStreamParameters(),
+ parameters.sampleRate(), parameters.framesPerBuffer(), parameters.flags(), NULL, NULL);
+
+ if (err != paNoError)
+ {
+ throw PaException(err);
+ }
+ }
+
+ // --------------------------------------------------------------------------------------
+
+ void BlockingStream::read(void *buffer, unsigned long numFrames)
+ {
+ PaError err = Pa_ReadStream(stream_, buffer, numFrames);
+
+ if (err != paNoError)
+ {
+ throw PaException(err);
+ }
+ }
+
+ void BlockingStream::write(const void *buffer, unsigned long numFrames)
+ {
+ PaError err = Pa_WriteStream(stream_, buffer, numFrames);
+
+ if (err != paNoError)
+ {
+ throw PaException(err);
+ }
+ }
+
+ // --------------------------------------------------------------------------------------
+
+ signed long BlockingStream::availableReadSize() const
+ {
+ signed long avail = Pa_GetStreamReadAvailable(stream_);
+
+ if (avail < 0)
+ {
+ throw PaException(avail);
+ }
+
+ return avail;
+ }
+
+ signed long BlockingStream::availableWriteSize() const
+ {
+ signed long avail = Pa_GetStreamWriteAvailable(stream_);
+
+ if (avail < 0)
+ {
+ throw PaException(avail);
+ }
+
+ return avail;
+ }
+
+ // --------------------------------------------------------------------------------------
+
+} // portaudio
+
+
+
diff --git a/bindings/cpp/source/portaudiocpp/CFunCallbackStream.cxx b/bindings/cpp/source/portaudiocpp/CFunCallbackStream.cxx
index fd2fb53..9cceda9 100644
--- a/bindings/cpp/source/portaudiocpp/CFunCallbackStream.cxx
+++ b/bindings/cpp/source/portaudiocpp/CFunCallbackStream.cxx
@@ -1,41 +1,41 @@
-#include "portaudiocpp/CFunCallbackStream.hxx"
-
-#include "portaudiocpp/StreamParameters.hxx"
-#include "portaudiocpp/Exception.hxx"
-
-namespace portaudio
-{
- CFunCallbackStream::CFunCallbackStream()
- {
- }
-
- CFunCallbackStream::CFunCallbackStream(const StreamParameters ¶meters, PaStreamCallback *funPtr, void *userData)
- {
- open(parameters, funPtr, userData);
- }
-
- CFunCallbackStream::~CFunCallbackStream()
- {
- try
- {
- close();
- }
- catch (...)
- {
- // ignore all errors
- }
- }
-
- // ---------------------------------------------------------------------------------==
-
- void CFunCallbackStream::open(const StreamParameters ¶meters, PaStreamCallback *funPtr, void *userData)
- {
- PaError err = Pa_OpenStream(&stream_, parameters.inputParameters().paStreamParameters(), parameters.outputParameters().paStreamParameters(),
- parameters.sampleRate(), parameters.framesPerBuffer(), parameters.flags(), funPtr, userData);
-
- if (err != paNoError)
- {
- throw PaException(err);
- }
- }
-}
+#include "portaudiocpp/CFunCallbackStream.hxx"
+
+#include "portaudiocpp/StreamParameters.hxx"
+#include "portaudiocpp/Exception.hxx"
+
+namespace portaudio
+{
+ CFunCallbackStream::CFunCallbackStream()
+ {
+ }
+
+ CFunCallbackStream::CFunCallbackStream(const StreamParameters ¶meters, PaStreamCallback *funPtr, void *userData)
+ {
+ open(parameters, funPtr, userData);
+ }
+
+ CFunCallbackStream::~CFunCallbackStream()
+ {
+ try
+ {
+ close();
+ }
+ catch (...)
+ {
+ // ignore all errors
+ }
+ }
+
+ // ---------------------------------------------------------------------------------==
+
+ void CFunCallbackStream::open(const StreamParameters ¶meters, PaStreamCallback *funPtr, void *userData)
+ {
+ PaError err = Pa_OpenStream(&stream_, parameters.inputParameters().paStreamParameters(), parameters.outputParameters().paStreamParameters(),
+ parameters.sampleRate(), parameters.framesPerBuffer(), parameters.flags(), funPtr, userData);
+
+ if (err != paNoError)
+ {
+ throw PaException(err);
+ }
+ }
+}
diff --git a/bindings/cpp/source/portaudiocpp/CallbackInterface.cxx b/bindings/cpp/source/portaudiocpp/CallbackInterface.cxx
index 7e34312..0137261 100644
--- a/bindings/cpp/source/portaudiocpp/CallbackInterface.cxx
+++ b/bindings/cpp/source/portaudiocpp/CallbackInterface.cxx
@@ -1,25 +1,25 @@
-#include "portaudiocpp/CallbackInterface.hxx"
-
-namespace portaudio
-{
-
- namespace impl
- {
-
- //////
- /// Adapts any CallbackInterface object to a C-callable function (ie this function). A
- /// pointer to the object should be passed as ``userData'' when setting up the callback.
- //////
- int callbackInterfaceToPaCallbackAdapter(const void *inputBuffer, void *outputBuffer, unsigned long numFrames,
- const PaStreamCallbackTimeInfo *timeInfo, PaStreamCallbackFlags statusFlags, void *userData)
- {
- CallbackInterface *cb = static_cast(userData);
- return cb->paCallbackFun(inputBuffer, outputBuffer, numFrames, timeInfo, statusFlags);
- }
-
-
- } // namespace impl
-
-} // namespace portaudio
-
-
+#include "portaudiocpp/CallbackInterface.hxx"
+
+namespace portaudio
+{
+
+ namespace impl
+ {
+
+ //////
+ /// Adapts any CallbackInterface object to a C-callable function (ie this function). A
+ /// pointer to the object should be passed as ``userData'' when setting up the callback.
+ //////
+ int callbackInterfaceToPaCallbackAdapter(const void *inputBuffer, void *outputBuffer, unsigned long numFrames,
+ const PaStreamCallbackTimeInfo *timeInfo, PaStreamCallbackFlags statusFlags, void *userData)
+ {
+ CallbackInterface *cb = static_cast(userData);
+ return cb->paCallbackFun(inputBuffer, outputBuffer, numFrames, timeInfo, statusFlags);
+ }
+
+
+ } // namespace impl
+
+} // namespace portaudio
+
+
diff --git a/bindings/cpp/source/portaudiocpp/CallbackStream.cxx b/bindings/cpp/source/portaudiocpp/CallbackStream.cxx
index 4204dbb..b6c8e1d 100644
--- a/bindings/cpp/source/portaudiocpp/CallbackStream.cxx
+++ b/bindings/cpp/source/portaudiocpp/CallbackStream.cxx
@@ -1,20 +1,20 @@
-#include "portaudiocpp/CallbackStream.hxx"
-
-namespace portaudio
-{
- CallbackStream::CallbackStream()
- {
- }
-
- CallbackStream::~CallbackStream()
- {
- }
-
- // -----------------------------------------------------------------------------------
-
- double CallbackStream::cpuLoad() const
- {
- return Pa_GetStreamCpuLoad(stream_);
- }
-
-} // namespace portaudio
+#include "portaudiocpp/CallbackStream.hxx"
+
+namespace portaudio
+{
+ CallbackStream::CallbackStream()
+ {
+ }
+
+ CallbackStream::~CallbackStream()
+ {
+ }
+
+ // -----------------------------------------------------------------------------------
+
+ double CallbackStream::cpuLoad() const
+ {
+ return Pa_GetStreamCpuLoad(stream_);
+ }
+
+} // namespace portaudio
diff --git a/bindings/cpp/source/portaudiocpp/CppFunCallbackStream.cxx b/bindings/cpp/source/portaudiocpp/CppFunCallbackStream.cxx
index 9538139..fe0b4ab 100644
--- a/bindings/cpp/source/portaudiocpp/CppFunCallbackStream.cxx
+++ b/bindings/cpp/source/portaudiocpp/CppFunCallbackStream.cxx
@@ -1,81 +1,81 @@
-#include "portaudiocpp/CppFunCallbackStream.hxx"
-
-#include "portaudiocpp/StreamParameters.hxx"
-#include "portaudiocpp/Exception.hxx"
-
-namespace portaudio
-{
- namespace impl
- {
- //////
- /// Adapts any a C++ callback to a C-callable function (ie this function). A
- /// pointer to a struct with the C++ function pointer and the actual user data should be
- /// passed as the ``userData'' parameter when setting up the callback.
- //////
- int cppCallbackToPaCallbackAdapter(const void *inputBuffer, void *outputBuffer, unsigned long numFrames,
- const PaStreamCallbackTimeInfo *timeInfo, PaStreamCallbackFlags statusFlags, void *userData)
- {
- FunCallbackStream::CppToCCallbackData *data = static_cast(userData);
- return data->funPtr(inputBuffer, outputBuffer, numFrames, timeInfo, statusFlags, data->userData);
- }
- }
-
- // -----------------------------------------------------------------------------------
-
- FunCallbackStream::CppToCCallbackData::CppToCCallbackData()
- {
- }
-
- FunCallbackStream::CppToCCallbackData::CppToCCallbackData(CallbackFunPtr funPtr, void *userData) : funPtr(funPtr), userData(userData)
- {
- }
-
- void FunCallbackStream::CppToCCallbackData::init(CallbackFunPtr funPtr, void *userData)
- {
- this->funPtr = funPtr;
- this->userData = userData;
- }
-
- // -----------------------------------------------------------------------------------
-
- FunCallbackStream::FunCallbackStream()
- {
- }
-
- FunCallbackStream::FunCallbackStream(const StreamParameters ¶meters, CallbackFunPtr funPtr, void *userData) : adapterData_(funPtr, userData)
- {
- open(parameters);
- }
-
- FunCallbackStream::~FunCallbackStream()
- {
- try
- {
- close();
- }
- catch (...)
- {
- // ignore all errors
- }
- }
-
- void FunCallbackStream::open(const StreamParameters ¶meters, CallbackFunPtr funPtr, void *userData)
- {
- adapterData_.init(funPtr, userData);
- open(parameters);
- }
-
- void FunCallbackStream::open(const StreamParameters ¶meters)
- {
- PaError err = Pa_OpenStream(&stream_, parameters.inputParameters().paStreamParameters(), parameters.outputParameters().paStreamParameters(),
- parameters.sampleRate(), parameters.framesPerBuffer(), parameters.flags(), &impl::cppCallbackToPaCallbackAdapter,
- static_cast(&adapterData_));
-
- if (err != paNoError)
- {
- throw PaException(err);
- }
- }
-
- // -----------------------------------------------------------------------------------
-}
+#include "portaudiocpp/CppFunCallbackStream.hxx"
+
+#include "portaudiocpp/StreamParameters.hxx"
+#include "portaudiocpp/Exception.hxx"
+
+namespace portaudio
+{
+ namespace impl
+ {
+ //////
+ /// Adapts any a C++ callback to a C-callable function (ie this function). A
+ /// pointer to a struct with the C++ function pointer and the actual user data should be
+ /// passed as the ``userData'' parameter when setting up the callback.
+ //////
+ int cppCallbackToPaCallbackAdapter(const void *inputBuffer, void *outputBuffer, unsigned long numFrames,
+ const PaStreamCallbackTimeInfo *timeInfo, PaStreamCallbackFlags statusFlags, void *userData)
+ {
+ FunCallbackStream::CppToCCallbackData *data = static_cast(userData);
+ return data->funPtr(inputBuffer, outputBuffer, numFrames, timeInfo, statusFlags, data->userData);
+ }
+ }
+
+ // -----------------------------------------------------------------------------------
+
+ FunCallbackStream::CppToCCallbackData::CppToCCallbackData()
+ {
+ }
+
+ FunCallbackStream::CppToCCallbackData::CppToCCallbackData(CallbackFunPtr funPtr, void *userData) : funPtr(funPtr), userData(userData)
+ {
+ }
+
+ void FunCallbackStream::CppToCCallbackData::init(CallbackFunPtr funPtr, void *userData)
+ {
+ this->funPtr = funPtr;
+ this->userData = userData;
+ }
+
+ // -----------------------------------------------------------------------------------
+
+ FunCallbackStream::FunCallbackStream()
+ {
+ }
+
+ FunCallbackStream::FunCallbackStream(const StreamParameters ¶meters, CallbackFunPtr funPtr, void *userData) : adapterData_(funPtr, userData)
+ {
+ open(parameters);
+ }
+
+ FunCallbackStream::~FunCallbackStream()
+ {
+ try
+ {
+ close();
+ }
+ catch (...)
+ {
+ // ignore all errors
+ }
+ }
+
+ void FunCallbackStream::open(const StreamParameters ¶meters, CallbackFunPtr funPtr, void *userData)
+ {
+ adapterData_.init(funPtr, userData);
+ open(parameters);
+ }
+
+ void FunCallbackStream::open(const StreamParameters ¶meters)
+ {
+ PaError err = Pa_OpenStream(&stream_, parameters.inputParameters().paStreamParameters(), parameters.outputParameters().paStreamParameters(),
+ parameters.sampleRate(), parameters.framesPerBuffer(), parameters.flags(), &impl::cppCallbackToPaCallbackAdapter,
+ static_cast(&adapterData_));
+
+ if (err != paNoError)
+ {
+ throw PaException(err);
+ }
+ }
+
+ // -----------------------------------------------------------------------------------
+}
diff --git a/bindings/cpp/source/portaudiocpp/Device.cxx b/bindings/cpp/source/portaudiocpp/Device.cxx
index 1655bd4..7b21b03 100644
--- a/bindings/cpp/source/portaudiocpp/Device.cxx
+++ b/bindings/cpp/source/portaudiocpp/Device.cxx
@@ -1,168 +1,168 @@
-#include "portaudiocpp/Device.hxx"
-
-#include
-
-#include "portaudiocpp/HostApi.hxx"
-#include "portaudiocpp/System.hxx"
-#include "portaudiocpp/Exception.hxx"
-
-namespace portaudio
-{
-
- // -------------------------------------------------------------------------------
-
- Device::Device(PaDeviceIndex index) : index_(index)
- {
- if (index == paNoDevice)
- info_ = NULL;
- else
- info_ = Pa_GetDeviceInfo(index);
- }
-
- Device::~Device()
- {
- }
-
- PaDeviceIndex Device::index() const
- {
- return index_;
- }
-
- const char *Device::name() const
- {
- if (info_ == NULL)
- return "";
-
- return info_->name;
- }
-
- int Device::maxInputChannels() const
- {
- if (info_ == NULL)
- return 0;
-
- return info_->maxInputChannels;
- }
-
- int Device::maxOutputChannels() const
- {
- if (info_ == NULL)
- return 0;
-
- return info_->maxOutputChannels;
- }
-
- PaTime Device::defaultLowInputLatency() const
- {
- if (info_ == NULL)
- return static_cast(0.0);
-
- return info_->defaultLowInputLatency;
- }
-
- PaTime Device::defaultHighInputLatency() const
- {
- if (info_ == NULL)
- return static_cast(0.0);
-
- return info_->defaultHighInputLatency;
- }
-
- PaTime Device::defaultLowOutputLatency() const
- {
- if (info_ == NULL)
- return static_cast(0.0);
-
- return info_->defaultLowOutputLatency;
- }
-
- PaTime Device::defaultHighOutputLatency() const
- {
- if (info_ == NULL)
- return static_cast(0.0);
-
- return info_->defaultHighOutputLatency;
- }
-
- double Device::defaultSampleRate() const
- {
- if (info_ == NULL)
- return 0.0;
-
- return info_->defaultSampleRate;
- }
-
- // -------------------------------------------------------------------------------
-
- bool Device::isInputOnlyDevice() const
- {
- return (maxOutputChannels() == 0);
- }
-
- bool Device::isOutputOnlyDevice() const
- {
- return (maxInputChannels() == 0);
- }
-
- bool Device::isFullDuplexDevice() const
- {
- return (maxInputChannels() > 0 && maxOutputChannels() > 0);
- }
-
- bool Device::isSystemDefaultInputDevice() const
- {
- return (System::instance().defaultInputDevice() == *this);
- }
-
- bool Device::isSystemDefaultOutputDevice() const
- {
- return (System::instance().defaultOutputDevice() == *this);
- }
-
- bool Device::isHostApiDefaultInputDevice() const
- {
- return (hostApi().defaultInputDevice() == *this);
- }
-
- bool Device::isHostApiDefaultOutputDevice() const
- {
- return (hostApi().defaultOutputDevice() == *this);
- }
-
- // -------------------------------------------------------------------------------
-
- bool Device::operator==(const Device &rhs) const
- {
- return (index_ == rhs.index_);
- }
-
- bool Device::operator!=(const Device &rhs) const
- {
- return !(*this == rhs);
- }
-
- // -------------------------------------------------------------------------------
-
- HostApi &Device::hostApi()
- {
- // NOTE: will cause an exception when called for the null device
- if (info_ == NULL)
- throw PaException(paInternalError);
-
- return System::instance().hostApiByIndex(info_->hostApi);
- }
-
- const HostApi &Device::hostApi() const
- {
- // NOTE; will cause an exception when called for the null device
- if (info_ == NULL)
- throw PaException(paInternalError);
-
- return System::instance().hostApiByIndex(info_->hostApi);
- }
-
- // -------------------------------------------------------------------------------
-
-} // namespace portaudio
-
-
+#include "portaudiocpp/Device.hxx"
+
+#include
+
+#include "portaudiocpp/HostApi.hxx"
+#include "portaudiocpp/System.hxx"
+#include "portaudiocpp/Exception.hxx"
+
+namespace portaudio
+{
+
+ // -------------------------------------------------------------------------------
+
+ Device::Device(PaDeviceIndex index) : index_(index)
+ {
+ if (index == paNoDevice)
+ info_ = NULL;
+ else
+ info_ = Pa_GetDeviceInfo(index);
+ }
+
+ Device::~Device()
+ {
+ }
+
+ PaDeviceIndex Device::index() const
+ {
+ return index_;
+ }
+
+ const char *Device::name() const
+ {
+ if (info_ == NULL)
+ return "";
+
+ return info_->name;
+ }
+
+ int Device::maxInputChannels() const
+ {
+ if (info_ == NULL)
+ return 0;
+
+ return info_->maxInputChannels;
+ }
+
+ int Device::maxOutputChannels() const
+ {
+ if (info_ == NULL)
+ return 0;
+
+ return info_->maxOutputChannels;
+ }
+
+ PaTime Device::defaultLowInputLatency() const
+ {
+ if (info_ == NULL)
+ return static_cast(0.0);
+
+ return info_->defaultLowInputLatency;
+ }
+
+ PaTime Device::defaultHighInputLatency() const
+ {
+ if (info_ == NULL)
+ return static_cast(0.0);
+
+ return info_->defaultHighInputLatency;
+ }
+
+ PaTime Device::defaultLowOutputLatency() const
+ {
+ if (info_ == NULL)
+ return static_cast(0.0);
+
+ return info_->defaultLowOutputLatency;
+ }
+
+ PaTime Device::defaultHighOutputLatency() const
+ {
+ if (info_ == NULL)
+ return static_cast(0.0);
+
+ return info_->defaultHighOutputLatency;
+ }
+
+ double Device::defaultSampleRate() const
+ {
+ if (info_ == NULL)
+ return 0.0;
+
+ return info_->defaultSampleRate;
+ }
+
+ // -------------------------------------------------------------------------------
+
+ bool Device::isInputOnlyDevice() const
+ {
+ return (maxOutputChannels() == 0);
+ }
+
+ bool Device::isOutputOnlyDevice() const
+ {
+ return (maxInputChannels() == 0);
+ }
+
+ bool Device::isFullDuplexDevice() const
+ {
+ return (maxInputChannels() > 0 && maxOutputChannels() > 0);
+ }
+
+ bool Device::isSystemDefaultInputDevice() const
+ {
+ return (System::instance().defaultInputDevice() == *this);
+ }
+
+ bool Device::isSystemDefaultOutputDevice() const
+ {
+ return (System::instance().defaultOutputDevice() == *this);
+ }
+
+ bool Device::isHostApiDefaultInputDevice() const
+ {
+ return (hostApi().defaultInputDevice() == *this);
+ }
+
+ bool Device::isHostApiDefaultOutputDevice() const
+ {
+ return (hostApi().defaultOutputDevice() == *this);
+ }
+
+ // -------------------------------------------------------------------------------
+
+ bool Device::operator==(const Device &rhs) const
+ {
+ return (index_ == rhs.index_);
+ }
+
+ bool Device::operator!=(const Device &rhs) const
+ {
+ return !(*this == rhs);
+ }
+
+ // -------------------------------------------------------------------------------
+
+ HostApi &Device::hostApi()
+ {
+ // NOTE: will cause an exception when called for the null device
+ if (info_ == NULL)
+ throw PaException(paInternalError);
+
+ return System::instance().hostApiByIndex(info_->hostApi);
+ }
+
+ const HostApi &Device::hostApi() const
+ {
+ // NOTE; will cause an exception when called for the null device
+ if (info_ == NULL)
+ throw PaException(paInternalError);
+
+ return System::instance().hostApiByIndex(info_->hostApi);
+ }
+
+ // -------------------------------------------------------------------------------
+
+} // namespace portaudio
+
+
diff --git a/bindings/cpp/source/portaudiocpp/DirectionSpecificStreamParameters.cxx b/bindings/cpp/source/portaudiocpp/DirectionSpecificStreamParameters.cxx
index d3c307c..68453d0 100644
--- a/bindings/cpp/source/portaudiocpp/DirectionSpecificStreamParameters.cxx
+++ b/bindings/cpp/source/portaudiocpp/DirectionSpecificStreamParameters.cxx
@@ -1,163 +1,163 @@
-#include "portaudiocpp/DirectionSpecificStreamParameters.hxx"
-
-#include "portaudiocpp/Device.hxx"
-
-namespace portaudio
-{
-
- // -----------------------------------------------------------------------------------
-
- //////
- /// Returns a `nil' DirectionSpecificStreamParameters object. This can be used to
- /// specify that one direction of a Stream is not required (i.e. when creating
- /// a half-duplex Stream). All fields of the null DirectionSpecificStreamParameters
- /// object are invalid except for the device and the number of channel, which are set
- /// to paNoDevice and 0 respectively.
- //////
- DirectionSpecificStreamParameters DirectionSpecificStreamParameters::null()
- {
- DirectionSpecificStreamParameters tmp;
- tmp.paStreamParameters_.device = paNoDevice;
- tmp.paStreamParameters_.channelCount = 0;
- return tmp;
- }
-
- // -----------------------------------------------------------------------------------
-
- //////
- /// Default constructor -- all parameters will be uninitialized.
- //////
- DirectionSpecificStreamParameters::DirectionSpecificStreamParameters()
- {
- }
-
- //////
- /// Constructor which sets all required fields.
- //////
- DirectionSpecificStreamParameters::DirectionSpecificStreamParameters(const Device &device, int numChannels,
- SampleDataFormat format, bool interleaved, PaTime suggestedLatency, void *hostApiSpecificStreamInfo)
- {
- setDevice(device);
- setNumChannels(numChannels);
- setSampleFormat(format, interleaved);
- setSuggestedLatency(suggestedLatency);
- setHostApiSpecificStreamInfo(hostApiSpecificStreamInfo);
- }
-
- // -----------------------------------------------------------------------------------
-
- void DirectionSpecificStreamParameters::setDevice(const Device &device)
- {
- paStreamParameters_.device = device.index();
- }
-
- void DirectionSpecificStreamParameters::setNumChannels(int numChannels)
- {
- paStreamParameters_.channelCount = numChannels;
- }
-
- void DirectionSpecificStreamParameters::setSampleFormat(SampleDataFormat format, bool interleaved)
- {
- paStreamParameters_.sampleFormat = static_cast(format);
-
- if (!interleaved)
- paStreamParameters_.sampleFormat |= paNonInterleaved;
- }
-
- void DirectionSpecificStreamParameters::setHostApiSpecificSampleFormat(PaSampleFormat format, bool interleaved)
- {
- paStreamParameters_.sampleFormat = format;
-
- paStreamParameters_.sampleFormat |= paCustomFormat;
-
- if (!interleaved)
- paStreamParameters_.sampleFormat |= paNonInterleaved;
- }
-
- void DirectionSpecificStreamParameters::setSuggestedLatency(PaTime latency)
- {
- paStreamParameters_.suggestedLatency = latency;
- }
-
- void DirectionSpecificStreamParameters::setHostApiSpecificStreamInfo(void *streamInfo)
- {
- paStreamParameters_.hostApiSpecificStreamInfo = streamInfo;
- }
-
- // -----------------------------------------------------------------------------------
-
- PaStreamParameters *DirectionSpecificStreamParameters::paStreamParameters()
- {
- if (paStreamParameters_.channelCount > 0 && paStreamParameters_.device != paNoDevice)
- return &paStreamParameters_;
- else
- return NULL;
- }
-
- const PaStreamParameters *DirectionSpecificStreamParameters::paStreamParameters() const
- {
- if (paStreamParameters_.channelCount > 0 && paStreamParameters_.device != paNoDevice)
- return &paStreamParameters_;
- else
- return NULL;
- }
-
- Device &DirectionSpecificStreamParameters::device() const
- {
- return System::instance().deviceByIndex(paStreamParameters_.device);
- }
-
- int DirectionSpecificStreamParameters::numChannels() const
- {
- return paStreamParameters_.channelCount;
- }
-
- //////
- /// Returns the (non host api-specific) sample format, without including
- /// the paNonInterleaved flag. If the sample format is host api-spefific,
- /// INVALID_FORMAT (0) will be returned.
- //////
- SampleDataFormat DirectionSpecificStreamParameters::sampleFormat() const
- {
- if (isSampleFormatHostApiSpecific())
- return INVALID_FORMAT;
- else
- return static_cast(paStreamParameters_.sampleFormat & ~paNonInterleaved);
- }
-
- bool DirectionSpecificStreamParameters::isSampleFormatInterleaved() const
- {
- return ((paStreamParameters_.sampleFormat & paNonInterleaved) == 0);
- }
-
- bool DirectionSpecificStreamParameters::isSampleFormatHostApiSpecific() const
- {
- return ((paStreamParameters_.sampleFormat & paCustomFormat) == 0);
- }
-
- //////
- /// Returns the host api-specific sample format, without including any
- /// paCustomFormat or paNonInterleaved flags. Will return 0 if the sample format is
- /// not host api-specific.
- //////
- PaSampleFormat DirectionSpecificStreamParameters::hostApiSpecificSampleFormat() const
- {
- if (isSampleFormatHostApiSpecific())
- return paStreamParameters_.sampleFormat & ~paCustomFormat & ~paNonInterleaved;
- else
- return 0;
- }
-
- PaTime DirectionSpecificStreamParameters::suggestedLatency() const
- {
- return paStreamParameters_.suggestedLatency;
- }
-
- void *DirectionSpecificStreamParameters::hostApiSpecificStreamInfo() const
- {
- return paStreamParameters_.hostApiSpecificStreamInfo;
- }
-
- // -----------------------------------------------------------------------------------
-
-} // namespace portaudio
+#include "portaudiocpp/DirectionSpecificStreamParameters.hxx"
+
+#include "portaudiocpp/Device.hxx"
+
+namespace portaudio
+{
+
+ // -----------------------------------------------------------------------------------
+
+ //////
+ /// Returns a `nil' DirectionSpecificStreamParameters object. This can be used to
+ /// specify that one direction of a Stream is not required (i.e. when creating
+ /// a half-duplex Stream). All fields of the null DirectionSpecificStreamParameters
+ /// object are invalid except for the device and the number of channel, which are set
+ /// to paNoDevice and 0 respectively.
+ //////
+ DirectionSpecificStreamParameters DirectionSpecificStreamParameters::null()
+ {
+ DirectionSpecificStreamParameters tmp;
+ tmp.paStreamParameters_.device = paNoDevice;
+ tmp.paStreamParameters_.channelCount = 0;
+ return tmp;
+ }
+
+ // -----------------------------------------------------------------------------------
+
+ //////
+ /// Default constructor -- all parameters will be uninitialized.
+ //////
+ DirectionSpecificStreamParameters::DirectionSpecificStreamParameters()
+ {
+ }
+
+ //////
+ /// Constructor which sets all required fields.
+ //////
+ DirectionSpecificStreamParameters::DirectionSpecificStreamParameters(const Device &device, int numChannels,
+ SampleDataFormat format, bool interleaved, PaTime suggestedLatency, void *hostApiSpecificStreamInfo)
+ {
+ setDevice(device);
+ setNumChannels(numChannels);
+ setSampleFormat(format, interleaved);
+ setSuggestedLatency(suggestedLatency);
+ setHostApiSpecificStreamInfo(hostApiSpecificStreamInfo);
+ }
+
+ // -----------------------------------------------------------------------------------
+
+ void DirectionSpecificStreamParameters::setDevice(const Device &device)
+ {
+ paStreamParameters_.device = device.index();
+ }
+
+ void DirectionSpecificStreamParameters::setNumChannels(int numChannels)
+ {
+ paStreamParameters_.channelCount = numChannels;
+ }
+
+ void DirectionSpecificStreamParameters::setSampleFormat(SampleDataFormat format, bool interleaved)
+ {
+ paStreamParameters_.sampleFormat = static_cast(format);
+
+ if (!interleaved)
+ paStreamParameters_.sampleFormat |= paNonInterleaved;
+ }
+
+ void DirectionSpecificStreamParameters::setHostApiSpecificSampleFormat(PaSampleFormat format, bool interleaved)
+ {
+ paStreamParameters_.sampleFormat = format;
+
+ paStreamParameters_.sampleFormat |= paCustomFormat;
+
+ if (!interleaved)
+ paStreamParameters_.sampleFormat |= paNonInterleaved;
+ }
+
+ void DirectionSpecificStreamParameters::setSuggestedLatency(PaTime latency)
+ {
+ paStreamParameters_.suggestedLatency = latency;
+ }
+
+ void DirectionSpecificStreamParameters::setHostApiSpecificStreamInfo(void *streamInfo)
+ {
+ paStreamParameters_.hostApiSpecificStreamInfo = streamInfo;
+ }
+
+ // -----------------------------------------------------------------------------------
+
+ PaStreamParameters *DirectionSpecificStreamParameters::paStreamParameters()
+ {
+ if (paStreamParameters_.channelCount > 0 && paStreamParameters_.device != paNoDevice)
+ return &paStreamParameters_;
+ else
+ return NULL;
+ }
+
+ const PaStreamParameters *DirectionSpecificStreamParameters::paStreamParameters() const
+ {
+ if (paStreamParameters_.channelCount > 0 && paStreamParameters_.device != paNoDevice)
+ return &paStreamParameters_;
+ else
+ return NULL;
+ }
+
+ Device &DirectionSpecificStreamParameters::device() const
+ {
+ return System::instance().deviceByIndex(paStreamParameters_.device);
+ }
+
+ int DirectionSpecificStreamParameters::numChannels() const
+ {
+ return paStreamParameters_.channelCount;
+ }
+
+ //////
+ /// Returns the (non host api-specific) sample format, without including
+ /// the paNonInterleaved flag. If the sample format is host api-spefific,
+ /// INVALID_FORMAT (0) will be returned.
+ //////
+ SampleDataFormat DirectionSpecificStreamParameters::sampleFormat() const
+ {
+ if (isSampleFormatHostApiSpecific())
+ return INVALID_FORMAT;
+ else
+ return static_cast(paStreamParameters_.sampleFormat & ~paNonInterleaved);
+ }
+
+ bool DirectionSpecificStreamParameters::isSampleFormatInterleaved() const
+ {
+ return ((paStreamParameters_.sampleFormat & paNonInterleaved) == 0);
+ }
+
+ bool DirectionSpecificStreamParameters::isSampleFormatHostApiSpecific() const
+ {
+ return ((paStreamParameters_.sampleFormat & paCustomFormat) == 0);
+ }
+
+ //////
+ /// Returns the host api-specific sample format, without including any
+ /// paCustomFormat or paNonInterleaved flags. Will return 0 if the sample format is
+ /// not host api-specific.
+ //////
+ PaSampleFormat DirectionSpecificStreamParameters::hostApiSpecificSampleFormat() const
+ {
+ if (isSampleFormatHostApiSpecific())
+ return paStreamParameters_.sampleFormat & ~paCustomFormat & ~paNonInterleaved;
+ else
+ return 0;
+ }
+
+ PaTime DirectionSpecificStreamParameters::suggestedLatency() const
+ {
+ return paStreamParameters_.suggestedLatency;
+ }
+
+ void *DirectionSpecificStreamParameters::hostApiSpecificStreamInfo() const
+ {
+ return paStreamParameters_.hostApiSpecificStreamInfo;
+ }
+
+ // -----------------------------------------------------------------------------------
+
+} // namespace portaudio
diff --git a/bindings/cpp/source/portaudiocpp/Exception.cxx b/bindings/cpp/source/portaudiocpp/Exception.cxx
index 2e7e701..98945c8 100644
--- a/bindings/cpp/source/portaudiocpp/Exception.cxx
+++ b/bindings/cpp/source/portaudiocpp/Exception.cxx
@@ -1,123 +1,123 @@
-#include "portaudiocpp/Exception.hxx"
-
-namespace portaudio
-{
- // -----------------------------------------------------------------------------------
- // PaException:
- // -----------------------------------------------------------------------------------
-
- //////
- /// Wraps a PortAudio error into a PortAudioCpp PaException.
- //////
- PaException::PaException(PaError error) : error_(error)
- {
- }
-
- // -----------------------------------------------------------------------------------
-
- //////
- /// Alias for paErrorText(), to have std::exception compliance.
- //////
- const char *PaException::what() const throw()
- {
- return paErrorText();
- }
-
- // -----------------------------------------------------------------------------------
-
- //////
- /// Returns the PortAudio error code (PaError).
- //////
- PaError PaException::paError() const
- {
- return error_;
- }
-
- //////
- /// Returns the error as a (zero-terminated) text string.
- //////
- const char *PaException::paErrorText() const
- {
- return Pa_GetErrorText(error_);
- }
-
- //////
- /// Returns true is the error is a HostApi error.
- //////
- bool PaException::isHostApiError() const
- {
- return (error_ == paUnanticipatedHostError);
- }
-
- //////
- /// Returns the last HostApi error (which is the current one if
- /// isHostApiError() returns true) as an error code.
- //////
- long PaException::lastHostApiError() const
- {
- return Pa_GetLastHostErrorInfo()->errorCode;
- }
-
- //////
- /// Returns the last HostApi error (which is the current one if
- /// isHostApiError() returns true) as a (zero-terminated) text
- /// string, if it's available.
- //////
- const char *PaException::lastHostApiErrorText() const
- {
- return Pa_GetLastHostErrorInfo()->errorText;
- }
-
- // -----------------------------------------------------------------------------------
-
- bool PaException::operator==(const PaException &rhs) const
- {
- return (error_ == rhs.error_);
- }
-
- bool PaException::operator!=(const PaException &rhs) const
- {
- return !(*this == rhs);
- }
-
- // -----------------------------------------------------------------------------------
- // PaCppException:
- // -----------------------------------------------------------------------------------
-
- PaCppException::PaCppException(ExceptionSpecifier specifier) : specifier_(specifier)
- {
- }
-
- const char *PaCppException::what() const throw()
- {
- switch (specifier_)
- {
- case UNABLE_TO_ADAPT_DEVICE:
- {
- return "Unable to adapt the given device to the specified host api specific device extension";
- }
- }
-
- return "Unknown exception";
- }
-
- PaCppException::ExceptionSpecifier PaCppException::specifier() const
- {
- return specifier_;
- }
-
- bool PaCppException::operator==(const PaCppException &rhs) const
- {
- return (specifier_ == rhs.specifier_);
- }
-
- bool PaCppException::operator!=(const PaCppException &rhs) const
- {
- return !(*this == rhs);
- }
-
- // -----------------------------------------------------------------------------------
-
-} // namespace portaudio
-
-
+#include "portaudiocpp/Exception.hxx"
+
+namespace portaudio
+{
+ // -----------------------------------------------------------------------------------
+ // PaException:
+ // -----------------------------------------------------------------------------------
+
+ //////
+ /// Wraps a PortAudio error into a PortAudioCpp PaException.
+ //////
+ PaException::PaException(PaError error) : error_(error)
+ {
+ }
+
+ // -----------------------------------------------------------------------------------
+
+ //////
+ /// Alias for paErrorText(), to have std::exception compliance.
+ //////
+ const char *PaException::what() const throw()
+ {
+ return paErrorText();
+ }
+
+ // -----------------------------------------------------------------------------------
+
+ //////
+ /// Returns the PortAudio error code (PaError).
+ //////
+ PaError PaException::paError() const
+ {
+ return error_;
+ }
+
+ //////
+ /// Returns the error as a (zero-terminated) text string.
+ //////
+ const char *PaException::paErrorText() const
+ {
+ return Pa_GetErrorText(error_);
+ }
+
+ //////
+ /// Returns true is the error is a HostApi error.
+ //////
+ bool PaException::isHostApiError() const
+ {
+ return (error_ == paUnanticipatedHostError);
+ }
+
+ //////
+ /// Returns the last HostApi error (which is the current one if
+ /// isHostApiError() returns true) as an error code.
+ //////
+ long PaException::lastHostApiError() const
+ {
+ return Pa_GetLastHostErrorInfo()->errorCode;
+ }
+
+ //////
+ /// Returns the last HostApi error (which is the current one if
+ /// isHostApiError() returns true) as a (zero-terminated) text
+ /// string, if it's available.
+ //////
+ const char *PaException::lastHostApiErrorText() const
+ {
+ return Pa_GetLastHostErrorInfo()->errorText;
+ }
+
+ // -----------------------------------------------------------------------------------
+
+ bool PaException::operator==(const PaException &rhs) const
+ {
+ return (error_ == rhs.error_);
+ }
+
+ bool PaException::operator!=(const PaException &rhs) const
+ {
+ return !(*this == rhs);
+ }
+
+ // -----------------------------------------------------------------------------------
+ // PaCppException:
+ // -----------------------------------------------------------------------------------
+
+ PaCppException::PaCppException(ExceptionSpecifier specifier) : specifier_(specifier)
+ {
+ }
+
+ const char *PaCppException::what() const throw()
+ {
+ switch (specifier_)
+ {
+ case UNABLE_TO_ADAPT_DEVICE:
+ {
+ return "Unable to adapt the given device to the specified host api specific device extension";
+ }
+ }
+
+ return "Unknown exception";
+ }
+
+ PaCppException::ExceptionSpecifier PaCppException::specifier() const
+ {
+ return specifier_;
+ }
+
+ bool PaCppException::operator==(const PaCppException &rhs) const
+ {
+ return (specifier_ == rhs.specifier_);
+ }
+
+ bool PaCppException::operator!=(const PaCppException &rhs) const
+ {
+ return !(*this == rhs);
+ }
+
+ // -----------------------------------------------------------------------------------
+
+} // namespace portaudio
+
+
diff --git a/bindings/cpp/source/portaudiocpp/HostApi.cxx b/bindings/cpp/source/portaudiocpp/HostApi.cxx
index c6ae019..6a09670 100644
--- a/bindings/cpp/source/portaudiocpp/HostApi.cxx
+++ b/bindings/cpp/source/portaudiocpp/HostApi.cxx
@@ -1,121 +1,121 @@
-#include "portaudiocpp/HostApi.hxx"
-
-#include "portaudiocpp/System.hxx"
-#include "portaudiocpp/Device.hxx"
-#include "portaudiocpp/SystemDeviceIterator.hxx"
-#include "portaudiocpp/Exception.hxx"
-
-namespace portaudio
-{
-
- // -----------------------------------------------------------------------------------
-
- HostApi::HostApi(PaHostApiIndex index) : devices_(NULL)
- {
- try
- {
- info_ = Pa_GetHostApiInfo(index);
-
- // Create and populate devices array:
- int numDevices = deviceCount();
-
- devices_ = new Device*[numDevices];
-
- for (int i = 0; i < numDevices; ++i)
- {
- PaDeviceIndex deviceIndex = Pa_HostApiDeviceIndexToDeviceIndex(index, i);
-
- if (deviceIndex < 0)
- {
- throw PaException(deviceIndex);
- }
-
- devices_[i] = &System::instance().deviceByIndex(deviceIndex);
- }
- }
- catch (const std::exception &e)
- {
- // Delete any (partially) constructed objects (deconstructor isn't called):
- delete[] devices_; // devices_ is either NULL or valid
-
- // Re-throw exception:
- throw e;
- }
- }
-
- HostApi::~HostApi()
- {
- // Destroy devices array:
- delete[] devices_;
- }
-
- // -----------------------------------------------------------------------------------
-
- PaHostApiTypeId HostApi::typeId() const
- {
- return info_->type;
- }
-
- PaHostApiIndex HostApi::index() const
- {
- PaHostApiIndex index = Pa_HostApiTypeIdToHostApiIndex(typeId());
-
- if (index < 0)
- throw PaException(index);
-
- return index;
- }
-
- const char *HostApi::name() const
- {
- return info_->name;
- }
-
- int HostApi::deviceCount() const
- {
- return info_->deviceCount;
- }
-
- // -----------------------------------------------------------------------------------
-
- HostApi::DeviceIterator HostApi::devicesBegin()
- {
- DeviceIterator tmp;
- tmp.ptr_ = &devices_[0]; // begin (first element)
- return tmp;
- }
-
- HostApi::DeviceIterator HostApi::devicesEnd()
- {
- DeviceIterator tmp;
- tmp.ptr_ = &devices_[deviceCount()]; // end (one past last element)
- return tmp;
- }
-
- // -----------------------------------------------------------------------------------
-
- Device &HostApi::defaultInputDevice() const
- {
- return System::instance().deviceByIndex(info_->defaultInputDevice);
- }
-
- Device &HostApi::defaultOutputDevice() const
- {
- return System::instance().deviceByIndex(info_->defaultOutputDevice);
- }
-
- // -----------------------------------------------------------------------------------
-
- bool HostApi::operator==(const HostApi &rhs) const
- {
- return (typeId() == rhs.typeId());
- }
-
- bool HostApi::operator!=(const HostApi &rhs) const
- {
- return !(*this == rhs);
- }
-
- // -----------------------------------------------------------------------------------
-
-} // namespace portaudio
+#include "portaudiocpp/HostApi.hxx"
+
+#include "portaudiocpp/System.hxx"
+#include "portaudiocpp/Device.hxx"
+#include "portaudiocpp/SystemDeviceIterator.hxx"
+#include "portaudiocpp/Exception.hxx"
+
+namespace portaudio
+{
+
+ // -----------------------------------------------------------------------------------
+
+ HostApi::HostApi(PaHostApiIndex index) : devices_(NULL)
+ {
+ try
+ {
+ info_ = Pa_GetHostApiInfo(index);
+
+ // Create and populate devices array:
+ int numDevices = deviceCount();
+
+ devices_ = new Device*[numDevices];
+
+ for (int i = 0; i < numDevices; ++i)
+ {
+ PaDeviceIndex deviceIndex = Pa_HostApiDeviceIndexToDeviceIndex(index, i);
+
+ if (deviceIndex < 0)
+ {
+ throw PaException(deviceIndex);
+ }
+
+ devices_[i] = &System::instance().deviceByIndex(deviceIndex);
+ }
+ }
+ catch (const std::exception &e)
+ {
+ // Delete any (partially) constructed objects (deconstructor isn't called):
+ delete[] devices_; // devices_ is either NULL or valid
+
+ // Re-throw exception:
+ throw e;
+ }
+ }
+
+ HostApi::~HostApi()
+ {
+ // Destroy devices array:
+ delete[] devices_;
+ }
+
+ // -----------------------------------------------------------------------------------
+
+ PaHostApiTypeId HostApi::typeId() const
+ {
+ return info_->type;
+ }
+
+ PaHostApiIndex HostApi::index() const
+ {
+ PaHostApiIndex index = Pa_HostApiTypeIdToHostApiIndex(typeId());
+
+ if (index < 0)
+ throw PaException(index);
+
+ return index;
+ }
+
+ const char *HostApi::name() const
+ {
+ return info_->name;
+ }
+
+ int HostApi::deviceCount() const
+ {
+ return info_->deviceCount;
+ }
+
+ // -----------------------------------------------------------------------------------
+
+ HostApi::DeviceIterator HostApi::devicesBegin()
+ {
+ DeviceIterator tmp;
+ tmp.ptr_ = &devices_[0]; // begin (first element)
+ return tmp;
+ }
+
+ HostApi::DeviceIterator HostApi::devicesEnd()
+ {
+ DeviceIterator tmp;
+ tmp.ptr_ = &devices_[deviceCount()]; // end (one past last element)
+ return tmp;
+ }
+
+ // -----------------------------------------------------------------------------------
+
+ Device &HostApi::defaultInputDevice() const
+ {
+ return System::instance().deviceByIndex(info_->defaultInputDevice);
+ }
+
+ Device &HostApi::defaultOutputDevice() const
+ {
+ return System::instance().deviceByIndex(info_->defaultOutputDevice);
+ }
+
+ // -----------------------------------------------------------------------------------
+
+ bool HostApi::operator==(const HostApi &rhs) const
+ {
+ return (typeId() == rhs.typeId());
+ }
+
+ bool HostApi::operator!=(const HostApi &rhs) const
+ {
+ return !(*this == rhs);
+ }
+
+ // -----------------------------------------------------------------------------------
+
+} // namespace portaudio
diff --git a/bindings/cpp/source/portaudiocpp/InterfaceCallbackStream.cxx b/bindings/cpp/source/portaudiocpp/InterfaceCallbackStream.cxx
index 09e02de..5433fa3 100644
--- a/bindings/cpp/source/portaudiocpp/InterfaceCallbackStream.cxx
+++ b/bindings/cpp/source/portaudiocpp/InterfaceCallbackStream.cxx
@@ -1,45 +1,45 @@
-#include "portaudiocpp/InterfaceCallbackStream.hxx"
-
-#include "portaudiocpp/StreamParameters.hxx"
-#include "portaudiocpp/Exception.hxx"
-#include "portaudiocpp/CallbackInterface.hxx"
-
-namespace portaudio
-{
-
- // ---------------------------------------------------------------------------------==
-
- InterfaceCallbackStream::InterfaceCallbackStream()
- {
- }
-
- InterfaceCallbackStream::InterfaceCallbackStream(const StreamParameters ¶meters, CallbackInterface &instance)
- {
- open(parameters, instance);
- }
-
- InterfaceCallbackStream::~InterfaceCallbackStream()
- {
- try
- {
- close();
- }
- catch (...)
- {
- // ignore all errors
- }
- }
-
- // ---------------------------------------------------------------------------------==
-
- void InterfaceCallbackStream::open(const StreamParameters ¶meters, CallbackInterface &instance)
- {
- PaError err = Pa_OpenStream(&stream_, parameters.inputParameters().paStreamParameters(), parameters.outputParameters().paStreamParameters(),
- parameters.sampleRate(), parameters.framesPerBuffer(), parameters.flags(), &impl::callbackInterfaceToPaCallbackAdapter, static_cast(&instance));
-
- if (err != paNoError)
- {
- throw PaException(err);
- }
- }
-}
+#include "portaudiocpp/InterfaceCallbackStream.hxx"
+
+#include "portaudiocpp/StreamParameters.hxx"
+#include "portaudiocpp/Exception.hxx"
+#include "portaudiocpp/CallbackInterface.hxx"
+
+namespace portaudio
+{
+
+ // ---------------------------------------------------------------------------------==
+
+ InterfaceCallbackStream::InterfaceCallbackStream()
+ {
+ }
+
+ InterfaceCallbackStream::InterfaceCallbackStream(const StreamParameters ¶meters, CallbackInterface &instance)
+ {
+ open(parameters, instance);
+ }
+
+ InterfaceCallbackStream::~InterfaceCallbackStream()
+ {
+ try
+ {
+ close();
+ }
+ catch (...)
+ {
+ // ignore all errors
+ }
+ }
+
+ // ---------------------------------------------------------------------------------==
+
+ void InterfaceCallbackStream::open(const StreamParameters ¶meters, CallbackInterface &instance)
+ {
+ PaError err = Pa_OpenStream(&stream_, parameters.inputParameters().paStreamParameters(), parameters.outputParameters().paStreamParameters(),
+ parameters.sampleRate(), parameters.framesPerBuffer(), parameters.flags(), &impl::callbackInterfaceToPaCallbackAdapter, static_cast(&instance));
+
+ if (err != paNoError)
+ {
+ throw PaException(err);
+ }
+ }
+}
diff --git a/bindings/cpp/source/portaudiocpp/MemFunCallbackStream.cxx b/bindings/cpp/source/portaudiocpp/MemFunCallbackStream.cxx
index 113fe5a..5141de2 100644
--- a/bindings/cpp/source/portaudiocpp/MemFunCallbackStream.cxx
+++ b/bindings/cpp/source/portaudiocpp/MemFunCallbackStream.cxx
@@ -1,4 +1,4 @@
-#include "portaudiocpp/MemFunCallbackStream.hxx"
-
-// (... template class ...)
-
+#include "portaudiocpp/MemFunCallbackStream.hxx"
+
+// (... template class ...)
+
diff --git a/bindings/cpp/source/portaudiocpp/Stream.cxx b/bindings/cpp/source/portaudiocpp/Stream.cxx
index 3b21f09..ba16e03 100644
--- a/bindings/cpp/source/portaudiocpp/Stream.cxx
+++ b/bindings/cpp/source/portaudiocpp/Stream.cxx
@@ -1,195 +1,195 @@
-#include "portaudiocpp/Stream.hxx"
-
-#include
-
-#include "portaudiocpp/Exception.hxx"
-#include "portaudiocpp/System.hxx"
-
-namespace portaudio
-{
-
- // -----------------------------------------------------------------------------------
-
- Stream::Stream() : stream_(NULL)
- {
- }
-
- Stream::~Stream()
- {
- // (can't call close here,
- // the derived class should atleast call
- // close() in it's deconstructor)
- }
-
- // -----------------------------------------------------------------------------------
-
- //////
- /// Closes the Stream if it's open, else does nothing.
- //////
- void Stream::close()
- {
- if (isOpen() && System::exists())
- {
- PaError err = Pa_CloseStream(stream_);
- stream_ = NULL;
-
- if (err != paNoError)
- throw PaException(err);
- }
- }
-
- //////
- /// Returns true if the Stream is open.
- //////
- bool Stream::isOpen() const
- {
- return (stream_ != NULL);
- }
-
- // -----------------------------------------------------------------------------------
-
- void Stream::setStreamFinishedCallback(PaStreamFinishedCallback *callback)
- {
- PaError err = Pa_SetStreamFinishedCallback(stream_, callback);
-
- if (err != paNoError)
- throw PaException(err);
- }
-
- // -----------------------------------------------------------------------------------
-
- void Stream::start()
- {
- PaError err = Pa_StartStream(stream_);
-
- if (err != paNoError)
- throw PaException(err);
- }
-
- void Stream::stop()
- {
- PaError err = Pa_StopStream(stream_);
-
- if (err != paNoError)
- throw PaException(err);
- }
-
- void Stream::abort()
- {
- PaError err = Pa_AbortStream(stream_);
-
- if (err != paNoError)
- throw PaException(err);
- }
-
- bool Stream::isStopped() const
- {
- PaError ret = Pa_IsStreamStopped(stream_);
-
- if (ret < 0)
- throw PaException(ret);
-
- return (ret == 1);
- }
-
- bool Stream::isActive() const
- {
- PaError ret = Pa_IsStreamActive(stream_);
-
- if (ret < 0)
- throw PaException(ret);
-
- return (ret == 1);
- }
-
- // -----------------------------------------------------------------------------------
-
- //////
- /// Returns the best known input latency for the Stream. This value may differ from the
- /// suggested input latency set in the StreamParameters. Includes all sources of
- /// latency known to PortAudio such as internal buffering, and Host API reported latency.
- /// Doesn't include any estimates of unknown latency.
- //////
- PaTime Stream::inputLatency() const
- {
- const PaStreamInfo *info = Pa_GetStreamInfo(stream_);
- if (info == NULL)
- {
- throw PaException(paInternalError);
- return PaTime(0.0);
- }
-
- return info->inputLatency;
- }
-
- //////
- /// Returns the best known output latency for the Stream. This value may differ from the
- /// suggested output latency set in the StreamParameters. Includes all sources of
- /// latency known to PortAudio such as internal buffering, and Host API reported latency.
- /// Doesn't include any estimates of unknown latency.
- //////
- PaTime Stream::outputLatency() const
- {
- const PaStreamInfo *info = Pa_GetStreamInfo(stream_);
- if (info == NULL)
- {
- throw PaException(paInternalError);
- return PaTime(0.0);
- }
-
- return info->outputLatency;
- }
-
- //////
- /// Returns the sample rate of the Stream. Usually this will be the
- /// best known estimate of the used sample rate. For instance when opening a
- /// Stream setting 44100.0 Hz in the StreamParameters, the actual sample
- /// rate might be something like 44103.2 Hz (due to imperfections in the
- /// sound card hardware).
- //////
- double Stream::sampleRate() const
- {
- const PaStreamInfo *info = Pa_GetStreamInfo(stream_);
- if (info == NULL)
- {
- throw PaException(paInternalError);
- return 0.0;
- }
-
- return info->sampleRate;
- }
-
- // -----------------------------------------------------------------------------------
-
- PaTime Stream::time() const
- {
- return Pa_GetStreamTime(stream_);
- }
-
- // -----------------------------------------------------------------------------------
-
- //////
- /// Accessor (const) for PortAudio PaStream pointer, useful for interfacing with
- /// PortAudio add-ons such as PortMixer for instance. Normally accessing this
- /// pointer should not be needed as PortAudioCpp aims to provide all of PortAudio's
- /// functionality.
- //////
- const PaStream *Stream::paStream() const
- {
- return stream_;
- }
-
- //////
- /// Accessor (non-const) for PortAudio PaStream pointer, useful for interfacing with
- /// PortAudio add-ons such as PortMixer for instance. Normally accessing this
- /// pointer should not be needed as PortAudioCpp aims to provide all of PortAudio's
- /// functionality.
- //////
- PaStream *Stream::paStream()
- {
- return stream_;
- }
-
- // -----------------------------------------------------------------------------------
-
-} // namespace portaudio
+#include "portaudiocpp/Stream.hxx"
+
+#include
+
+#include "portaudiocpp/Exception.hxx"
+#include "portaudiocpp/System.hxx"
+
+namespace portaudio
+{
+
+ // -----------------------------------------------------------------------------------
+
+ Stream::Stream() : stream_(NULL)
+ {
+ }
+
+ Stream::~Stream()
+ {
+ // (can't call close here,
+ // the derived class should atleast call
+ // close() in it's deconstructor)
+ }
+
+ // -----------------------------------------------------------------------------------
+
+ //////
+ /// Closes the Stream if it's open, else does nothing.
+ //////
+ void Stream::close()
+ {
+ if (isOpen() && System::exists())
+ {
+ PaError err = Pa_CloseStream(stream_);
+ stream_ = NULL;
+
+ if (err != paNoError)
+ throw PaException(err);
+ }
+ }
+
+ //////
+ /// Returns true if the Stream is open.
+ //////
+ bool Stream::isOpen() const
+ {
+ return (stream_ != NULL);
+ }
+
+ // -----------------------------------------------------------------------------------
+
+ void Stream::setStreamFinishedCallback(PaStreamFinishedCallback *callback)
+ {
+ PaError err = Pa_SetStreamFinishedCallback(stream_, callback);
+
+ if (err != paNoError)
+ throw PaException(err);
+ }
+
+ // -----------------------------------------------------------------------------------
+
+ void Stream::start()
+ {
+ PaError err = Pa_StartStream(stream_);
+
+ if (err != paNoError)
+ throw PaException(err);
+ }
+
+ void Stream::stop()
+ {
+ PaError err = Pa_StopStream(stream_);
+
+ if (err != paNoError)
+ throw PaException(err);
+ }
+
+ void Stream::abort()
+ {
+ PaError err = Pa_AbortStream(stream_);
+
+ if (err != paNoError)
+ throw PaException(err);
+ }
+
+ bool Stream::isStopped() const
+ {
+ PaError ret = Pa_IsStreamStopped(stream_);
+
+ if (ret < 0)
+ throw PaException(ret);
+
+ return (ret == 1);
+ }
+
+ bool Stream::isActive() const
+ {
+ PaError ret = Pa_IsStreamActive(stream_);
+
+ if (ret < 0)
+ throw PaException(ret);
+
+ return (ret == 1);
+ }
+
+ // -----------------------------------------------------------------------------------
+
+ //////
+ /// Returns the best known input latency for the Stream. This value may differ from the
+ /// suggested input latency set in the StreamParameters. Includes all sources of
+ /// latency known to PortAudio such as internal buffering, and Host API reported latency.
+ /// Doesn't include any estimates of unknown latency.
+ //////
+ PaTime Stream::inputLatency() const
+ {
+ const PaStreamInfo *info = Pa_GetStreamInfo(stream_);
+ if (info == NULL)
+ {
+ throw PaException(paInternalError);
+ return PaTime(0.0);
+ }
+
+ return info->inputLatency;
+ }
+
+ //////
+ /// Returns the best known output latency for the Stream. This value may differ from the
+ /// suggested output latency set in the StreamParameters. Includes all sources of
+ /// latency known to PortAudio such as internal buffering, and Host API reported latency.
+ /// Doesn't include any estimates of unknown latency.
+ //////
+ PaTime Stream::outputLatency() const
+ {
+ const PaStreamInfo *info = Pa_GetStreamInfo(stream_);
+ if (info == NULL)
+ {
+ throw PaException(paInternalError);
+ return PaTime(0.0);
+ }
+
+ return info->outputLatency;
+ }
+
+ //////
+ /// Returns the sample rate of the Stream. Usually this will be the
+ /// best known estimate of the used sample rate. For instance when opening a
+ /// Stream setting 44100.0 Hz in the StreamParameters, the actual sample
+ /// rate might be something like 44103.2 Hz (due to imperfections in the
+ /// sound card hardware).
+ //////
+ double Stream::sampleRate() const
+ {
+ const PaStreamInfo *info = Pa_GetStreamInfo(stream_);
+ if (info == NULL)
+ {
+ throw PaException(paInternalError);
+ return 0.0;
+ }
+
+ return info->sampleRate;
+ }
+
+ // -----------------------------------------------------------------------------------
+
+ PaTime Stream::time() const
+ {
+ return Pa_GetStreamTime(stream_);
+ }
+
+ // -----------------------------------------------------------------------------------
+
+ //////
+ /// Accessor (const) for PortAudio PaStream pointer, useful for interfacing with
+ /// PortAudio add-ons such as PortMixer for instance. Normally accessing this
+ /// pointer should not be needed as PortAudioCpp aims to provide all of PortAudio's
+ /// functionality.
+ //////
+ const PaStream *Stream::paStream() const
+ {
+ return stream_;
+ }
+
+ //////
+ /// Accessor (non-const) for PortAudio PaStream pointer, useful for interfacing with
+ /// PortAudio add-ons such as PortMixer for instance. Normally accessing this
+ /// pointer should not be needed as PortAudioCpp aims to provide all of PortAudio's
+ /// functionality.
+ //////
+ PaStream *Stream::paStream()
+ {
+ return stream_;
+ }
+
+ // -----------------------------------------------------------------------------------
+
+} // namespace portaudio
diff --git a/bindings/cpp/source/portaudiocpp/StreamParameters.cxx b/bindings/cpp/source/portaudiocpp/StreamParameters.cxx
index 670873b..5b9e897 100644
--- a/bindings/cpp/source/portaudiocpp/StreamParameters.cxx
+++ b/bindings/cpp/source/portaudiocpp/StreamParameters.cxx
@@ -1,165 +1,165 @@
-#include "portaudiocpp/StreamParameters.hxx"
-
-#include
-
-#include "portaudiocpp/Device.hxx"
-
-namespace portaudio
-{
- // -----------------------------------------------------------------------------------
-
- //////
- /// Default constructor; does nothing.
- //////
- StreamParameters::StreamParameters()
- {
- }
-
- //////
- /// Sets up the all parameters needed to open either a half-duplex or full-duplex Stream.
- ///
- /// @param inputParameters The parameters for the input direction of the to-be opened
- /// Stream or DirectionSpecificStreamParameters::null() for an output-only Stream.
- /// @param outputParameters The parameters for the output direction of the to-be opened
- /// Stream or DirectionSpecificStreamParameters::null() for an input-only Stream.
- /// @param sampleRate The to-be opened Stream's sample rate in Hz.
- /// @param framesPerBuffer The number of frames per buffer for a CallbackStream, or
- /// the preferred buffer granularity for a BlockingStream.
- /// @param flags The flags for the to-be opened Stream; default paNoFlag.
- //////
- StreamParameters::StreamParameters(const DirectionSpecificStreamParameters &inputParameters,
- const DirectionSpecificStreamParameters &outputParameters, double sampleRate, unsigned long framesPerBuffer,
- PaStreamFlags flags) : inputParameters_(inputParameters), outputParameters_(outputParameters),
- sampleRate_(sampleRate), framesPerBuffer_(framesPerBuffer), flags_(flags)
- {
- }
-
- // -----------------------------------------------------------------------------------
-
- //////
- /// Sets the requested sample rate. If this sample rate isn't supported by the hardware, the
- /// Stream will fail to open. The real-life sample rate used might differ slightly due to
- /// imperfections in the sound card hardware; use Stream::sampleRate() to retreive the
- /// best known estimate for this value.
- //////
- void StreamParameters::setSampleRate(double sampleRate)
- {
- sampleRate_ = sampleRate;
- }
-
- //////
- /// Either the number of frames per buffer for a CallbackStream, or
- /// the preferred buffer granularity for a BlockingStream. See PortAudio
- /// documentation.
- //////
- void StreamParameters::setFramesPerBuffer(unsigned long framesPerBuffer)
- {
- framesPerBuffer_ = framesPerBuffer;
- }
-
- //////
- /// Sets the specified flag or does nothing when the flag is already set. Doesn't
- /// `unset' any previously existing flags (use clearFlags() for that).
- //////
- void StreamParameters::setFlag(PaStreamFlags flag)
- {
- flags_ |= flag;
- }
-
- //////
- /// Unsets the specified flag or does nothing if the flag isn't set. Doesn't affect
- /// any other flags.
- //////
- void StreamParameters::unsetFlag(PaStreamFlags flag)
- {
- flags_ &= ~flag;
- }
-
- //////
- /// Clears or `unsets' all set flags.
- //////
- void StreamParameters::clearFlags()
- {
- flags_ = paNoFlag;
- }
-
- // -----------------------------------------------------------------------------------
-
- void StreamParameters::setInputParameters(const DirectionSpecificStreamParameters ¶meters)
- {
- inputParameters_ = parameters;
- }
-
- void StreamParameters::setOutputParameters(const DirectionSpecificStreamParameters ¶meters)
- {
- outputParameters_ = parameters;
- }
-
- // -----------------------------------------------------------------------------------
-
- bool StreamParameters::isSupported() const
- {
- return (Pa_IsFormatSupported(inputParameters_.paStreamParameters(),
- outputParameters_.paStreamParameters(), sampleRate_) == paFormatIsSupported);
- }
-
- // -----------------------------------------------------------------------------------
-
- double StreamParameters::sampleRate() const
- {
- return sampleRate_;
- }
-
- unsigned long StreamParameters::framesPerBuffer() const
- {
- return framesPerBuffer_;
- }
-
- //////
- /// Returns all currently set flags as a binary combined
- /// integer value (PaStreamFlags). Use isFlagSet() to
- /// avoid dealing with the bitmasks.
- //////
- PaStreamFlags StreamParameters::flags() const
- {
- return flags_;
- }
-
- //////
- /// Returns true if the specified flag is currently set
- /// or false if it isn't.
- //////
- bool StreamParameters::isFlagSet(PaStreamFlags flag) const
- {
- return ((flags_ & flag) != 0);
- }
-
- // -----------------------------------------------------------------------------------
-
- DirectionSpecificStreamParameters &StreamParameters::inputParameters()
- {
- return inputParameters_;
- }
-
- const DirectionSpecificStreamParameters &StreamParameters::inputParameters() const
- {
- return inputParameters_;
- }
-
- DirectionSpecificStreamParameters &StreamParameters::outputParameters()
- {
- return outputParameters_;
- }
-
- const DirectionSpecificStreamParameters &StreamParameters::outputParameters() const
- {
- return outputParameters_;
- }
-
- // -----------------------------------------------------------------------------------
-} // namespace portaudio
-
-
-
-
-
+#include "portaudiocpp/StreamParameters.hxx"
+
+#include
+
+#include "portaudiocpp/Device.hxx"
+
+namespace portaudio
+{
+ // -----------------------------------------------------------------------------------
+
+ //////
+ /// Default constructor; does nothing.
+ //////
+ StreamParameters::StreamParameters()
+ {
+ }
+
+ //////
+ /// Sets up the all parameters needed to open either a half-duplex or full-duplex Stream.
+ ///
+ /// @param inputParameters The parameters for the input direction of the to-be opened
+ /// Stream or DirectionSpecificStreamParameters::null() for an output-only Stream.
+ /// @param outputParameters The parameters for the output direction of the to-be opened
+ /// Stream or DirectionSpecificStreamParameters::null() for an input-only Stream.
+ /// @param sampleRate The to-be opened Stream's sample rate in Hz.
+ /// @param framesPerBuffer The number of frames per buffer for a CallbackStream, or
+ /// the preferred buffer granularity for a BlockingStream.
+ /// @param flags The flags for the to-be opened Stream; default paNoFlag.
+ //////
+ StreamParameters::StreamParameters(const DirectionSpecificStreamParameters &inputParameters,
+ const DirectionSpecificStreamParameters &outputParameters, double sampleRate, unsigned long framesPerBuffer,
+ PaStreamFlags flags) : inputParameters_(inputParameters), outputParameters_(outputParameters),
+ sampleRate_(sampleRate), framesPerBuffer_(framesPerBuffer), flags_(flags)
+ {
+ }
+
+ // -----------------------------------------------------------------------------------
+
+ //////
+ /// Sets the requested sample rate. If this sample rate isn't supported by the hardware, the
+ /// Stream will fail to open. The real-life sample rate used might differ slightly due to
+ /// imperfections in the sound card hardware; use Stream::sampleRate() to retreive the
+ /// best known estimate for this value.
+ //////
+ void StreamParameters::setSampleRate(double sampleRate)
+ {
+ sampleRate_ = sampleRate;
+ }
+
+ //////
+ /// Either the number of frames per buffer for a CallbackStream, or
+ /// the preferred buffer granularity for a BlockingStream. See PortAudio
+ /// documentation.
+ //////
+ void StreamParameters::setFramesPerBuffer(unsigned long framesPerBuffer)
+ {
+ framesPerBuffer_ = framesPerBuffer;
+ }
+
+ //////
+ /// Sets the specified flag or does nothing when the flag is already set. Doesn't
+ /// `unset' any previously existing flags (use clearFlags() for that).
+ //////
+ void StreamParameters::setFlag(PaStreamFlags flag)
+ {
+ flags_ |= flag;
+ }
+
+ //////
+ /// Unsets the specified flag or does nothing if the flag isn't set. Doesn't affect
+ /// any other flags.
+ //////
+ void StreamParameters::unsetFlag(PaStreamFlags flag)
+ {
+ flags_ &= ~flag;
+ }
+
+ //////
+ /// Clears or `unsets' all set flags.
+ //////
+ void StreamParameters::clearFlags()
+ {
+ flags_ = paNoFlag;
+ }
+
+ // -----------------------------------------------------------------------------------
+
+ void StreamParameters::setInputParameters(const DirectionSpecificStreamParameters ¶meters)
+ {
+ inputParameters_ = parameters;
+ }
+
+ void StreamParameters::setOutputParameters(const DirectionSpecificStreamParameters ¶meters)
+ {
+ outputParameters_ = parameters;
+ }
+
+ // -----------------------------------------------------------------------------------
+
+ bool StreamParameters::isSupported() const
+ {
+ return (Pa_IsFormatSupported(inputParameters_.paStreamParameters(),
+ outputParameters_.paStreamParameters(), sampleRate_) == paFormatIsSupported);
+ }
+
+ // -----------------------------------------------------------------------------------
+
+ double StreamParameters::sampleRate() const
+ {
+ return sampleRate_;
+ }
+
+ unsigned long StreamParameters::framesPerBuffer() const
+ {
+ return framesPerBuffer_;
+ }
+
+ //////
+ /// Returns all currently set flags as a binary combined
+ /// integer value (PaStreamFlags). Use isFlagSet() to
+ /// avoid dealing with the bitmasks.
+ //////
+ PaStreamFlags StreamParameters::flags() const
+ {
+ return flags_;
+ }
+
+ //////
+ /// Returns true if the specified flag is currently set
+ /// or false if it isn't.
+ //////
+ bool StreamParameters::isFlagSet(PaStreamFlags flag) const
+ {
+ return ((flags_ & flag) != 0);
+ }
+
+ // -----------------------------------------------------------------------------------
+
+ DirectionSpecificStreamParameters &StreamParameters::inputParameters()
+ {
+ return inputParameters_;
+ }
+
+ const DirectionSpecificStreamParameters &StreamParameters::inputParameters() const
+ {
+ return inputParameters_;
+ }
+
+ DirectionSpecificStreamParameters &StreamParameters::outputParameters()
+ {
+ return outputParameters_;
+ }
+
+ const DirectionSpecificStreamParameters &StreamParameters::outputParameters() const
+ {
+ return outputParameters_;
+ }
+
+ // -----------------------------------------------------------------------------------
+} // namespace portaudio
+
+
+
+
+
diff --git a/bindings/cpp/source/portaudiocpp/System.cxx b/bindings/cpp/source/portaudiocpp/System.cxx
index 692c7a1..acb419d 100644
--- a/bindings/cpp/source/portaudiocpp/System.cxx
+++ b/bindings/cpp/source/portaudiocpp/System.cxx
@@ -1,308 +1,308 @@
-#include "portaudiocpp/System.hxx"
-
-#include
-#include
-
-#include "portaudiocpp/HostApi.hxx"
-#include "portaudiocpp/Device.hxx"
-#include "portaudiocpp/Stream.hxx"
-#include "portaudiocpp/Exception.hxx"
-#include "portaudiocpp/SystemHostApiIterator.hxx"
-#include "portaudiocpp/SystemDeviceIterator.hxx"
-
-namespace portaudio
-{
- // -----------------------------------------------------------------------------------
-
- // Static members:
- System *System::instance_ = NULL;
- int System::initCount_ = 0;
- HostApi **System::hostApis_ = NULL;
- Device **System::devices_ = NULL;
- Device *System::nullDevice_ = NULL;
-
- // -----------------------------------------------------------------------------------
-
- int System::version()
- {
- return Pa_GetVersion();
- }
-
- const char *System::versionText()
- {
- return Pa_GetVersionText();
- }
-
- void System::initialize()
- {
- ++initCount_;
-
- if (initCount_ == 1)
- {
- // Create singleton:
- assert(instance_ == NULL);
- instance_ = new System();
-
- // Initialize the PortAudio system:
- {
- PaError err = Pa_Initialize();
-
- if (err != paNoError)
- throw PaException(err);
- }
-
- // Create and populate device array:
- {
- int numDevices = instance().deviceCount();
-
- devices_ = new Device*[numDevices];
-
- for (int i = 0; i < numDevices; ++i)
- devices_[i] = new Device(i);
- }
-
- // Create and populate host api array:
- {
- int numHostApis = instance().hostApiCount();
-
- hostApis_ = new HostApi*[numHostApis];
-
- for (int i = 0; i < numHostApis; ++i)
- hostApis_[i] = new HostApi(i);
- }
-
- // Create null device:
- nullDevice_ = new Device(paNoDevice);
- }
- }
-
- void System::terminate()
- {
- PaError err = paNoError;
-
- if (initCount_ == 1)
- {
- // Destroy null device:
- delete nullDevice_;
-
- // Destroy host api array:
- {
- if (hostApis_ != NULL)
- {
- int numHostApis = instance().hostApiCount();
-
- for (int i = 0; i < numHostApis; ++i)
- delete hostApis_[i];
-
- delete[] hostApis_;
- hostApis_ = NULL;
- }
- }
-
- // Destroy device array:
- {
- if (devices_ != NULL)
- {
- int numDevices = instance().deviceCount();
-
- for (int i = 0; i < numDevices; ++i)
- delete devices_[i];
-
- delete[] devices_;
- devices_ = NULL;
- }
- }
-
- // Terminate the PortAudio system:
- assert(instance_ != NULL);
- err = Pa_Terminate();
-
- // Destroy singleton:
- delete instance_;
- instance_ = NULL;
- }
-
- if (initCount_ > 0)
- --initCount_;
-
- if (err != paNoError)
- throw PaException(err);
- }
-
-
- System &System::instance()
- {
- assert(exists());
-
- return *instance_;
- }
-
- bool System::exists()
- {
- return (instance_ != NULL);
- }
-
- // -----------------------------------------------------------------------------------
-
- System::HostApiIterator System::hostApisBegin()
- {
- System::HostApiIterator tmp;
- tmp.ptr_ = &hostApis_[0]; // begin (first element)
- return tmp;
- }
-
- System::HostApiIterator System::hostApisEnd()
- {
- int count = hostApiCount();
-
- System::HostApiIterator tmp;
- tmp.ptr_ = &hostApis_[count]; // end (one past last element)
- return tmp;
- }
-
- HostApi &System::defaultHostApi()
- {
- PaHostApiIndex defaultHostApi = Pa_GetDefaultHostApi();
-
- if (defaultHostApi < 0)
- throw PaException(defaultHostApi);
-
- return *hostApis_[defaultHostApi];
- }
-
- HostApi &System::hostApiByTypeId(PaHostApiTypeId type)
- {
- PaHostApiIndex index = Pa_HostApiTypeIdToHostApiIndex(type);
-
- if (index < 0)
- throw PaException(index);
-
- return *hostApis_[index];
- }
-
- HostApi &System::hostApiByIndex(PaHostApiIndex index)
- {
- if (index < 0 || index >= hostApiCount())
- throw PaException(paInternalError);
-
- return *hostApis_[index];
- }
-
- int System::hostApiCount()
- {
- PaHostApiIndex count = Pa_GetHostApiCount();
-
- if (count < 0)
- throw PaException(count);
-
- return count;
- }
-
- // -----------------------------------------------------------------------------------
-
- System::DeviceIterator System::devicesBegin()
- {
- DeviceIterator tmp;
- tmp.ptr_ = &devices_[0];
-
- return tmp;
- }
-
- System::DeviceIterator System::devicesEnd()
- {
- int count = deviceCount();
-
- DeviceIterator tmp;
- tmp.ptr_ = &devices_[count];
-
- return tmp;
- }
-
- //////
- /// Returns the System's default input Device, or the null Device if none
- /// was available.
- //////
- Device &System::defaultInputDevice()
- {
- PaDeviceIndex index = Pa_GetDefaultInputDevice();
- return deviceByIndex(index);
- }
-
- //////
- /// Returns the System's default output Device, or the null Device if none
- /// was available.
- //////
- Device &System::defaultOutputDevice()
- {
- PaDeviceIndex index = Pa_GetDefaultOutputDevice();
- return deviceByIndex(index);
- }
-
- //////
- /// Returns the Device for the given index.
- /// Will throw a paInternalError equivalent PaException if the given index
- /// is out of range.
- //////
- Device &System::deviceByIndex(PaDeviceIndex index)
- {
- if (index < -1 || index >= deviceCount())
- {
- throw PaException(paInternalError);
- }
-
- if (index == -1)
- return System::instance().nullDevice();
-
- return *devices_[index];
- }
-
- int System::deviceCount()
- {
- PaDeviceIndex count = Pa_GetDeviceCount();
-
- if (count < 0)
- throw PaException(count);
-
- return count;
- }
-
- Device &System::nullDevice()
- {
- return *nullDevice_;
- }
-
- // -----------------------------------------------------------------------------------
-
- void System::sleep(long msec)
- {
- Pa_Sleep(msec);
- }
-
- int System::sizeOfSample(PaSampleFormat format)
- {
- PaError err = Pa_GetSampleSize(format);
- if (err < 0)
- {
- throw PaException(err);
- return 0;
- }
-
- return err;
- }
-
- // -----------------------------------------------------------------------------------
-
- System::System()
- {
- // (left blank intentionally)
- }
-
- System::~System()
- {
- // (left blank intentionally)
- }
-
- // -----------------------------------------------------------------------------------
-
-} // namespace portaudio
-
+#include "portaudiocpp/System.hxx"
+
+#include
+#include
+
+#include "portaudiocpp/HostApi.hxx"
+#include "portaudiocpp/Device.hxx"
+#include "portaudiocpp/Stream.hxx"
+#include "portaudiocpp/Exception.hxx"
+#include "portaudiocpp/SystemHostApiIterator.hxx"
+#include "portaudiocpp/SystemDeviceIterator.hxx"
+
+namespace portaudio
+{
+ // -----------------------------------------------------------------------------------
+
+ // Static members:
+ System *System::instance_ = NULL;
+ int System::initCount_ = 0;
+ HostApi **System::hostApis_ = NULL;
+ Device **System::devices_ = NULL;
+ Device *System::nullDevice_ = NULL;
+
+ // -----------------------------------------------------------------------------------
+
+ int System::version()
+ {
+ return Pa_GetVersion();
+ }
+
+ const char *System::versionText()
+ {
+ return Pa_GetVersionText();
+ }
+
+ void System::initialize()
+ {
+ ++initCount_;
+
+ if (initCount_ == 1)
+ {
+ // Create singleton:
+ assert(instance_ == NULL);
+ instance_ = new System();
+
+ // Initialize the PortAudio system:
+ {
+ PaError err = Pa_Initialize();
+
+ if (err != paNoError)
+ throw PaException(err);
+ }
+
+ // Create and populate device array:
+ {
+ int numDevices = instance().deviceCount();
+
+ devices_ = new Device*[numDevices];
+
+ for (int i = 0; i < numDevices; ++i)
+ devices_[i] = new Device(i);
+ }
+
+ // Create and populate host api array:
+ {
+ int numHostApis = instance().hostApiCount();
+
+ hostApis_ = new HostApi*[numHostApis];
+
+ for (int i = 0; i < numHostApis; ++i)
+ hostApis_[i] = new HostApi(i);
+ }
+
+ // Create null device:
+ nullDevice_ = new Device(paNoDevice);
+ }
+ }
+
+ void System::terminate()
+ {
+ PaError err = paNoError;
+
+ if (initCount_ == 1)
+ {
+ // Destroy null device:
+ delete nullDevice_;
+
+ // Destroy host api array:
+ {
+ if (hostApis_ != NULL)
+ {
+ int numHostApis = instance().hostApiCount();
+
+ for (int i = 0; i < numHostApis; ++i)
+ delete hostApis_[i];
+
+ delete[] hostApis_;
+ hostApis_ = NULL;
+ }
+ }
+
+ // Destroy device array:
+ {
+ if (devices_ != NULL)
+ {
+ int numDevices = instance().deviceCount();
+
+ for (int i = 0; i < numDevices; ++i)
+ delete devices_[i];
+
+ delete[] devices_;
+ devices_ = NULL;
+ }
+ }
+
+ // Terminate the PortAudio system:
+ assert(instance_ != NULL);
+ err = Pa_Terminate();
+
+ // Destroy singleton:
+ delete instance_;
+ instance_ = NULL;
+ }
+
+ if (initCount_ > 0)
+ --initCount_;
+
+ if (err != paNoError)
+ throw PaException(err);
+ }
+
+
+ System &System::instance()
+ {
+ assert(exists());
+
+ return *instance_;
+ }
+
+ bool System::exists()
+ {
+ return (instance_ != NULL);
+ }
+
+ // -----------------------------------------------------------------------------------
+
+ System::HostApiIterator System::hostApisBegin()
+ {
+ System::HostApiIterator tmp;
+ tmp.ptr_ = &hostApis_[0]; // begin (first element)
+ return tmp;
+ }
+
+ System::HostApiIterator System::hostApisEnd()
+ {
+ int count = hostApiCount();
+
+ System::HostApiIterator tmp;
+ tmp.ptr_ = &hostApis_[count]; // end (one past last element)
+ return tmp;
+ }
+
+ HostApi &System::defaultHostApi()
+ {
+ PaHostApiIndex defaultHostApi = Pa_GetDefaultHostApi();
+
+ if (defaultHostApi < 0)
+ throw PaException(defaultHostApi);
+
+ return *hostApis_[defaultHostApi];
+ }
+
+ HostApi &System::hostApiByTypeId(PaHostApiTypeId type)
+ {
+ PaHostApiIndex index = Pa_HostApiTypeIdToHostApiIndex(type);
+
+ if (index < 0)
+ throw PaException(index);
+
+ return *hostApis_[index];
+ }
+
+ HostApi &System::hostApiByIndex(PaHostApiIndex index)
+ {
+ if (index < 0 || index >= hostApiCount())
+ throw PaException(paInternalError);
+
+ return *hostApis_[index];
+ }
+
+ int System::hostApiCount()
+ {
+ PaHostApiIndex count = Pa_GetHostApiCount();
+
+ if (count < 0)
+ throw PaException(count);
+
+ return count;
+ }
+
+ // -----------------------------------------------------------------------------------
+
+ System::DeviceIterator System::devicesBegin()
+ {
+ DeviceIterator tmp;
+ tmp.ptr_ = &devices_[0];
+
+ return tmp;
+ }
+
+ System::DeviceIterator System::devicesEnd()
+ {
+ int count = deviceCount();
+
+ DeviceIterator tmp;
+ tmp.ptr_ = &devices_[count];
+
+ return tmp;
+ }
+
+ //////
+ /// Returns the System's default input Device, or the null Device if none
+ /// was available.
+ //////
+ Device &System::defaultInputDevice()
+ {
+ PaDeviceIndex index = Pa_GetDefaultInputDevice();
+ return deviceByIndex(index);
+ }
+
+ //////
+ /// Returns the System's default output Device, or the null Device if none
+ /// was available.
+ //////
+ Device &System::defaultOutputDevice()
+ {
+ PaDeviceIndex index = Pa_GetDefaultOutputDevice();
+ return deviceByIndex(index);
+ }
+
+ //////
+ /// Returns the Device for the given index.
+ /// Will throw a paInternalError equivalent PaException if the given index
+ /// is out of range.
+ //////
+ Device &System::deviceByIndex(PaDeviceIndex index)
+ {
+ if (index < -1 || index >= deviceCount())
+ {
+ throw PaException(paInternalError);
+ }
+
+ if (index == -1)
+ return System::instance().nullDevice();
+
+ return *devices_[index];
+ }
+
+ int System::deviceCount()
+ {
+ PaDeviceIndex count = Pa_GetDeviceCount();
+
+ if (count < 0)
+ throw PaException(count);
+
+ return count;
+ }
+
+ Device &System::nullDevice()
+ {
+ return *nullDevice_;
+ }
+
+ // -----------------------------------------------------------------------------------
+
+ void System::sleep(long msec)
+ {
+ Pa_Sleep(msec);
+ }
+
+ int System::sizeOfSample(PaSampleFormat format)
+ {
+ PaError err = Pa_GetSampleSize(format);
+ if (err < 0)
+ {
+ throw PaException(err);
+ return 0;
+ }
+
+ return err;
+ }
+
+ // -----------------------------------------------------------------------------------
+
+ System::System()
+ {
+ // (left blank intentionally)
+ }
+
+ System::~System()
+ {
+ // (left blank intentionally)
+ }
+
+ // -----------------------------------------------------------------------------------
+
+} // namespace portaudio
+
diff --git a/bindings/cpp/source/portaudiocpp/SystemDeviceIterator.cxx b/bindings/cpp/source/portaudiocpp/SystemDeviceIterator.cxx
index 9311384..f94cf10 100644
--- a/bindings/cpp/source/portaudiocpp/SystemDeviceIterator.cxx
+++ b/bindings/cpp/source/portaudiocpp/SystemDeviceIterator.cxx
@@ -1,60 +1,60 @@
-#include "portaudiocpp/SystemDeviceIterator.hxx"
-
-namespace portaudio
-{
- // -----------------------------------------------------------------------------------
-
- Device &System::DeviceIterator::operator*() const
- {
- return **ptr_;
- }
-
- Device *System::DeviceIterator::operator->() const
- {
- return &**this;
- }
-
- // -----------------------------------------------------------------------------------
-
- System::DeviceIterator &System::DeviceIterator::operator++()
- {
- ++ptr_;
- return *this;
- }
-
- System::DeviceIterator System::DeviceIterator::operator++(int)
- {
- System::DeviceIterator prev = *this;
- ++*this;
- return prev;
- }
-
- System::DeviceIterator &System::DeviceIterator::operator--()
- {
- --ptr_;
- return *this;
- }
-
- System::DeviceIterator System::DeviceIterator::operator--(int)
- {
- System::DeviceIterator prev = *this;
- --*this;
- return prev;
- }
-
- // -----------------------------------------------------------------------------------
-
- bool System::DeviceIterator::operator==(const System::DeviceIterator &rhs) const
- {
- return (ptr_ == rhs.ptr_);
- }
-
- bool System::DeviceIterator::operator!=(const System::DeviceIterator &rhs) const
- {
- return !(*this == rhs);
- }
-
- // -----------------------------------------------------------------------------------
-} // namespace portaudio
-
-
+#include "portaudiocpp/SystemDeviceIterator.hxx"
+
+namespace portaudio
+{
+ // -----------------------------------------------------------------------------------
+
+ Device &System::DeviceIterator::operator*() const
+ {
+ return **ptr_;
+ }
+
+ Device *System::DeviceIterator::operator->() const
+ {
+ return &**this;
+ }
+
+ // -----------------------------------------------------------------------------------
+
+ System::DeviceIterator &System::DeviceIterator::operator++()
+ {
+ ++ptr_;
+ return *this;
+ }
+
+ System::DeviceIterator System::DeviceIterator::operator++(int)
+ {
+ System::DeviceIterator prev = *this;
+ ++*this;
+ return prev;
+ }
+
+ System::DeviceIterator &System::DeviceIterator::operator--()
+ {
+ --ptr_;
+ return *this;
+ }
+
+ System::DeviceIterator System::DeviceIterator::operator--(int)
+ {
+ System::DeviceIterator prev = *this;
+ --*this;
+ return prev;
+ }
+
+ // -----------------------------------------------------------------------------------
+
+ bool System::DeviceIterator::operator==(const System::DeviceIterator &rhs) const
+ {
+ return (ptr_ == rhs.ptr_);
+ }
+
+ bool System::DeviceIterator::operator!=(const System::DeviceIterator &rhs) const
+ {
+ return !(*this == rhs);
+ }
+
+ // -----------------------------------------------------------------------------------
+} // namespace portaudio
+
+
diff --git a/bindings/cpp/source/portaudiocpp/SystemHostApiIterator.cxx b/bindings/cpp/source/portaudiocpp/SystemHostApiIterator.cxx
index c41b4cb..03f2d6e 100644
--- a/bindings/cpp/source/portaudiocpp/SystemHostApiIterator.cxx
+++ b/bindings/cpp/source/portaudiocpp/SystemHostApiIterator.cxx
@@ -1,59 +1,59 @@
-#include "portaudiocpp/SystemHostApiIterator.hxx"
-
-namespace portaudio
-{
- // -----------------------------------------------------------------------------------
-
- HostApi &System::HostApiIterator::operator*() const
- {
- return **ptr_;
- }
-
- HostApi *System::HostApiIterator::operator->() const
- {
- return &**this;
- }
-
- // -----------------------------------------------------------------------------------
-
- System::HostApiIterator &System::HostApiIterator::operator++()
- {
- ++ptr_;
- return *this;
- }
-
- System::HostApiIterator System::HostApiIterator::operator++(int)
- {
- System::HostApiIterator prev = *this;
- ++*this;
- return prev;
- }
-
- System::HostApiIterator &System::HostApiIterator::operator--()
- {
- --ptr_;
- return *this;
- }
-
- System::HostApiIterator System::HostApiIterator::operator--(int)
- {
- System::HostApiIterator prev = *this;
- --*this;
- return prev;
- }
-
- // -----------------------------------------------------------------------------------
-
- bool System::HostApiIterator::operator==(const System::HostApiIterator &rhs) const
- {
- return (ptr_ == rhs.ptr_);
- }
-
- bool System::HostApiIterator::operator!=(const System::HostApiIterator &rhs) const
- {
- return !(*this == rhs);
- }
-
- // -----------------------------------------------------------------------------------
-} // namespace portaudio
-
+#include "portaudiocpp/SystemHostApiIterator.hxx"
+
+namespace portaudio
+{
+ // -----------------------------------------------------------------------------------
+
+ HostApi &System::HostApiIterator::operator*() const
+ {
+ return **ptr_;
+ }
+
+ HostApi *System::HostApiIterator::operator->() const
+ {
+ return &**this;
+ }
+
+ // -----------------------------------------------------------------------------------
+
+ System::HostApiIterator &System::HostApiIterator::operator++()
+ {
+ ++ptr_;
+ return *this;
+ }
+
+ System::HostApiIterator System::HostApiIterator::operator++(int)
+ {
+ System::HostApiIterator prev = *this;
+ ++*this;
+ return prev;
+ }
+
+ System::HostApiIterator &System::HostApiIterator::operator--()
+ {
+ --ptr_;
+ return *this;
+ }
+
+ System::HostApiIterator System::HostApiIterator::operator--(int)
+ {
+ System::HostApiIterator prev = *this;
+ --*this;
+ return prev;
+ }
+
+ // -----------------------------------------------------------------------------------
+
+ bool System::HostApiIterator::operator==(const System::HostApiIterator &rhs) const
+ {
+ return (ptr_ == rhs.ptr_);
+ }
+
+ bool System::HostApiIterator::operator!=(const System::HostApiIterator &rhs) const
+ {
+ return !(*this == rhs);
+ }
+
+ // -----------------------------------------------------------------------------------
+} // namespace portaudio
+
diff --git a/bindings/java/c/build/vs2010/PortAudioJNI/PortAudioJNI.sln b/bindings/java/c/build/vs2010/PortAudioJNI/PortAudioJNI.sln
index 829bd67..6f8ef5f 100644
--- a/bindings/java/c/build/vs2010/PortAudioJNI/PortAudioJNI.sln
+++ b/bindings/java/c/build/vs2010/PortAudioJNI/PortAudioJNI.sln
@@ -1,26 +1,26 @@
-
-Microsoft Visual Studio Solution File, Format Version 11.00
-# Visual Studio 2010
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PortAudioJNI", "PortAudioJNI.vcxproj", "{4024D885-39B0-4C8A-B3E7-BAB4BA08DFBB}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Win32 = Debug|Win32
- Debug|x64 = Debug|x64
- Release|Win32 = Release|Win32
- Release|x64 = Release|x64
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {4024D885-39B0-4C8A-B3E7-BAB4BA08DFBB}.Debug|Win32.ActiveCfg = Debug|Win32
- {4024D885-39B0-4C8A-B3E7-BAB4BA08DFBB}.Debug|Win32.Build.0 = Debug|Win32
- {4024D885-39B0-4C8A-B3E7-BAB4BA08DFBB}.Debug|x64.ActiveCfg = Debug|x64
- {4024D885-39B0-4C8A-B3E7-BAB4BA08DFBB}.Debug|x64.Build.0 = Debug|x64
- {4024D885-39B0-4C8A-B3E7-BAB4BA08DFBB}.Release|Win32.ActiveCfg = Release|Win32
- {4024D885-39B0-4C8A-B3E7-BAB4BA08DFBB}.Release|Win32.Build.0 = Release|Win32
- {4024D885-39B0-4C8A-B3E7-BAB4BA08DFBB}.Release|x64.ActiveCfg = Release|x64
- {4024D885-39B0-4C8A-B3E7-BAB4BA08DFBB}.Release|x64.Build.0 = Release|x64
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
+
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PortAudioJNI", "PortAudioJNI.vcxproj", "{4024D885-39B0-4C8A-B3E7-BAB4BA08DFBB}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Debug|x64 = Debug|x64
+ Release|Win32 = Release|Win32
+ Release|x64 = Release|x64
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {4024D885-39B0-4C8A-B3E7-BAB4BA08DFBB}.Debug|Win32.ActiveCfg = Debug|Win32
+ {4024D885-39B0-4C8A-B3E7-BAB4BA08DFBB}.Debug|Win32.Build.0 = Debug|Win32
+ {4024D885-39B0-4C8A-B3E7-BAB4BA08DFBB}.Debug|x64.ActiveCfg = Debug|x64
+ {4024D885-39B0-4C8A-B3E7-BAB4BA08DFBB}.Debug|x64.Build.0 = Debug|x64
+ {4024D885-39B0-4C8A-B3E7-BAB4BA08DFBB}.Release|Win32.ActiveCfg = Release|Win32
+ {4024D885-39B0-4C8A-B3E7-BAB4BA08DFBB}.Release|Win32.Build.0 = Release|Win32
+ {4024D885-39B0-4C8A-B3E7-BAB4BA08DFBB}.Release|x64.ActiveCfg = Release|x64
+ {4024D885-39B0-4C8A-B3E7-BAB4BA08DFBB}.Release|x64.Build.0 = Release|x64
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/bindings/java/c/build/vs2010/PortAudioJNI/PortAudioJNI.vcproj b/bindings/java/c/build/vs2010/PortAudioJNI/PortAudioJNI.vcproj
index e66cd56..ce83264 100644
--- a/bindings/java/c/build/vs2010/PortAudioJNI/PortAudioJNI.vcproj
+++ b/bindings/java/c/build/vs2010/PortAudioJNI/PortAudioJNI.vcproj
@@ -1,198 +1,198 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/bindings/java/c/build/vs2010/PortAudioJNI/PortAudioJNI.vcxproj b/bindings/java/c/build/vs2010/PortAudioJNI/PortAudioJNI.vcxproj
index 1b6295c..c7e881b 100644
--- a/bindings/java/c/build/vs2010/PortAudioJNI/PortAudioJNI.vcxproj
+++ b/bindings/java/c/build/vs2010/PortAudioJNI/PortAudioJNI.vcxproj
@@ -1,174 +1,174 @@
-
-
-
-
- Debug
- Win32
-
-
- Debug
- x64
-
-
- Release
- Win32
-
-
- Release
- x64
-
-
-
- {4024D885-39B0-4C8A-B3E7-BAB4BA08DFBB}
- PortAudioJNI
- Win32Proj
-
-
-
- DynamicLibrary
- Unicode
- true
-
-
- DynamicLibrary
- Unicode
- true
-
-
- DynamicLibrary
- Unicode
-
-
- DynamicLibrary
- Unicode
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <_ProjectFileVersion>10.0.30319.1
- ..\..\..\..\jportaudio\
- ..\..\..\..\jportaudio\
- $(Configuration)\
- $(Configuration)\
- true
- true
- ..\..\..\..\jportaudio\
- ..\..\..\..\jportaudio\
- $(Configuration)\
- $(Configuration)\
- false
- false
- jportaudio_x64
- jportaudio_x86
- jportaudio_x86
- jportaudio_x64
-
-
-
- Disabled
- ..\..\..\..\..\..\include;%JAVA_HOME%\include;%JAVA_HOME%\include\win32
- WIN32;_DEBUG;_WINDOWS;_USRDLL;PORTAUDIOJNI_EXPORTS;%(PreprocessorDefinitions)
- true
- EnableFastChecks
- MultiThreadedDebugDLL
-
-
- Level3
- EditAndContinue
-
-
- true
- Windows
- MachineX86
-
-
-
-
- Disabled
- ..\..\..\..\..\..\include;%JAVA_HOME%\include;%JAVA_HOME%\include\win32
- WIN32;_DEBUG;_WINDOWS;_USRDLL;PORTAUDIOJNI_EXPORTS;%(PreprocessorDefinitions)
- EnableFastChecks
- MultiThreadedDebugDLL
-
-
- Level3
- ProgramDatabase
-
-
- true
- Windows
-
-
-
-
- MaxSpeed
- true
- WIN32;NDEBUG;_WINDOWS;_USRDLL;PORTAUDIOJNI_EXPORTS;%(PreprocessorDefinitions)
- MultiThreadedDLL
- true
-
-
- Level3
- ProgramDatabase
- ..\..\..\..\..\..\include;%JAVA_HOME%\include;%JAVA_HOME%\include\win32
-
-
- true
- Windows
- true
- true
- MachineX86
-
-
-
-
- MaxSpeed
- true
- WIN32;NDEBUG;_WINDOWS;_USRDLL;PORTAUDIOJNI_EXPORTS;%(PreprocessorDefinitions)
- MultiThreadedDLL
- true
-
-
- Level3
- ProgramDatabase
- ..\..\..\..\..\..\include;%JAVA_HOME%\include;%JAVA_HOME%\include\win32
-
-
- true
- Windows
- true
- true
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+ Debug
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ Win32
+
+
+ Release
+ x64
+
+
+
+ {4024D885-39B0-4C8A-B3E7-BAB4BA08DFBB}
+ PortAudioJNI
+ Win32Proj
+
+
+
+ DynamicLibrary
+ Unicode
+ true
+
+
+ DynamicLibrary
+ Unicode
+ true
+
+
+ DynamicLibrary
+ Unicode
+
+
+ DynamicLibrary
+ Unicode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <_ProjectFileVersion>10.0.30319.1
+ ..\..\..\..\jportaudio\
+ ..\..\..\..\jportaudio\
+ $(Configuration)\
+ $(Configuration)\
+ true
+ true
+ ..\..\..\..\jportaudio\
+ ..\..\..\..\jportaudio\
+ $(Configuration)\
+ $(Configuration)\
+ false
+ false
+ jportaudio_x64
+ jportaudio_x86
+ jportaudio_x86
+ jportaudio_x64
+
+
+
+ Disabled
+ ..\..\..\..\..\..\include;%JAVA_HOME%\include;%JAVA_HOME%\include\win32
+ WIN32;_DEBUG;_WINDOWS;_USRDLL;PORTAUDIOJNI_EXPORTS;%(PreprocessorDefinitions)
+ true
+ EnableFastChecks
+ MultiThreadedDebugDLL
+
+
+ Level3
+ EditAndContinue
+
+
+ true
+ Windows
+ MachineX86
+
+
+
+
+ Disabled
+ ..\..\..\..\..\..\include;%JAVA_HOME%\include;%JAVA_HOME%\include\win32
+ WIN32;_DEBUG;_WINDOWS;_USRDLL;PORTAUDIOJNI_EXPORTS;%(PreprocessorDefinitions)
+ EnableFastChecks
+ MultiThreadedDebugDLL
+
+
+ Level3
+ ProgramDatabase
+
+
+ true
+ Windows
+
+
+
+
+ MaxSpeed
+ true
+ WIN32;NDEBUG;_WINDOWS;_USRDLL;PORTAUDIOJNI_EXPORTS;%(PreprocessorDefinitions)
+ MultiThreadedDLL
+ true
+
+
+ Level3
+ ProgramDatabase
+ ..\..\..\..\..\..\include;%JAVA_HOME%\include;%JAVA_HOME%\include\win32
+
+
+ true
+ Windows
+ true
+ true
+ MachineX86
+
+
+
+
+ MaxSpeed
+ true
+ WIN32;NDEBUG;_WINDOWS;_USRDLL;PORTAUDIOJNI_EXPORTS;%(PreprocessorDefinitions)
+ MultiThreadedDLL
+ true
+
+
+ Level3
+ ProgramDatabase
+ ..\..\..\..\..\..\include;%JAVA_HOME%\include;%JAVA_HOME%\include\win32
+
+
+ true
+ Windows
+ true
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/bindings/java/jportaudio.dox b/bindings/java/jportaudio.dox
index 6fb4c19..f97b565 100644
--- a/bindings/java/jportaudio.dox
+++ b/bindings/java/jportaudio.dox
@@ -1,65 +1,65 @@
-/**
-@page java_binding JPortAudio Java Binding
-@ingroup jportaudio
-
-Note: this page has not been reviewed, and may contain errors.
-
-@section java_draft DRAFT - IN PROGRESS
-
-9/4/12 JPortAudio is very new and should be considered an "alpha" release.
-The building of JPortAudio will eventually be integrated into the Makefile as an optional build.
-
-Currently JPortAudio is only supported for Windows and Macintosh. Please contact us if you want to help with porting Linux.
-
-For reference documentation of the JPortAudio API see: com.portaudio.PortAudio
-
-For an example see: PlaySine.java
-
-@section java_comp_windows Building JPortAudio on Windows
-
-Build the Java code using the Eclipse project in "jportaudio". Export as "jportaudio.jar".
-
-If you modify the JNI API then you will need to regenerate the JNI .h files using:
-
-@code
-cd bindings/java/scripts
-make_header.bat
-@endcode
-
-Build the JNI DLL using the Visual Studio 2010 solution in "java/c/build/vs2010/PortAudioJNI".
-
-@section java_use_windows Using JPortAudio on Windows
-
-Put the "jportaudio.jar" in the classpath for your application.
-Place the following libraries where they can be found, typically in the same folder as your application.
-
-- portaudio_x86.dll
-- portaudio_x64.dll
-- jportaudio_x86.dll
-- jportaudio_x64.dll
-
-@section java_comp_max Building JPortAudio on Mac
-
-These are notes from building JPortAudio on a Mac with 10.6.8 and XCode 4.
-
-I created a target of type 'C' library.
-
-I added the regular PortAudio frameworks plus the JavaVM framework.
-
-I modified com_portaudio_PortAudio.h and com_portaudio_BlockingStream.h so that jni.h could found.
-
-@code
-#if defined(__APPLE__)
-#include
-#else
-#include
-#endif
-@endcode
-
-This is bad because those header files are autogenerated and will be overwritten.
-We need a better solution for this.
-
-I had trouble finding the "libjportaudio.jnilib". So I added a Build Phase that copied the library to "/Users/phil/Library/Java/Extensions".
-
-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".
-*/
+/**
+@page java_binding JPortAudio Java Binding
+@ingroup jportaudio
+
+Note: this page has not been reviewed, and may contain errors.
+
+@section java_draft DRAFT - IN PROGRESS
+
+9/4/12 JPortAudio is very new and should be considered an "alpha" release.
+The building of JPortAudio will eventually be integrated into the Makefile as an optional build.
+
+Currently JPortAudio is only supported for Windows and Macintosh. Please contact us if you want to help with porting Linux.
+
+For reference documentation of the JPortAudio API see: com.portaudio.PortAudio
+
+For an example see: PlaySine.java
+
+@section java_comp_windows Building JPortAudio on Windows
+
+Build the Java code using the Eclipse project in "jportaudio". Export as "jportaudio.jar".
+
+If you modify the JNI API then you will need to regenerate the JNI .h files using:
+
+@code
+cd bindings/java/scripts
+make_header.bat
+@endcode
+
+Build the JNI DLL using the Visual Studio 2010 solution in "java/c/build/vs2010/PortAudioJNI".
+
+@section java_use_windows Using JPortAudio on Windows
+
+Put the "jportaudio.jar" in the classpath for your application.
+Place the following libraries where they can be found, typically in the same folder as your application.
+
+- portaudio_x86.dll
+- portaudio_x64.dll
+- jportaudio_x86.dll
+- jportaudio_x64.dll
+
+@section java_comp_max Building JPortAudio on Mac
+
+These are notes from building JPortAudio on a Mac with 10.6.8 and XCode 4.
+
+I created a target of type 'C' library.
+
+I added the regular PortAudio frameworks plus the JavaVM framework.
+
+I modified com_portaudio_PortAudio.h and com_portaudio_BlockingStream.h so that jni.h could found.
+
+@code
+#if defined(__APPLE__)
+#include
+#else
+#include
+#endif
+@endcode
+
+This is bad because those header files are autogenerated and will be overwritten.
+We need a better solution for this.
+
+I had trouble finding the "libjportaudio.jnilib". So I added a Build Phase that copied the library to "/Users/phil/Library/Java/Extensions".
+
+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".
+*/
diff --git a/bindings/java/jportaudio/.classpath b/bindings/java/jportaudio/.classpath
index ea36295..6bbd70c 100644
--- a/bindings/java/jportaudio/.classpath
+++ b/bindings/java/jportaudio/.classpath
@@ -1,8 +1,8 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
diff --git a/bindings/java/jportaudio/.project b/bindings/java/jportaudio/.project
index 7395b15..8d2a750 100644
--- a/bindings/java/jportaudio/.project
+++ b/bindings/java/jportaudio/.project
@@ -1,17 +1,17 @@
-
-
- JPortAudio
-
-
-
-
-
- org.eclipse.jdt.core.javabuilder
-
-
-
-
-
- org.eclipse.jdt.core.javanature
-
-
+
+
+ JPortAudio
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+
+ org.eclipse.jdt.core.javanature
+
+
diff --git a/bindings/java/scripts/make_header.bat b/bindings/java/scripts/make_header.bat
index 14fa280..3c4f58a 100644
--- a/bindings/java/scripts/make_header.bat
+++ b/bindings/java/scripts/make_header.bat
@@ -1,4 +1,4 @@
-REM Generate the JNI header file from the Java code for JPortAudio
-REM by Phil Burk
-
-javah -classpath ../jportaudio/bin -d ../c/src com.portaudio.PortAudio com.portaudio.BlockingStream
+REM Generate the JNI header file from the Java code for JPortAudio
+REM by Phil Burk
+
+javah -classpath ../jportaudio/bin -d ../c/src com.portaudio.PortAudio com.portaudio.BlockingStream
diff --git a/build/msvc/portaudio.dsp b/build/msvc/portaudio.dsp
index 9a1bb2d..44fdd30 100644
--- a/build/msvc/portaudio.dsp
+++ b/build/msvc/portaudio.dsp
@@ -1,269 +1,269 @@
-# Microsoft Developer Studio Project File - Name="portaudio" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=portaudio - Win32 Release
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "portaudio.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "portaudio.mak" CFG="portaudio - Win32 Release"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "portaudio - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "portaudio - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "portaudio - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release_x86"
-# PROP BASE Intermediate_Dir "Release_x86"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release_x86"
-# PROP Intermediate_Dir "Release_x86"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\src\common" /I "..\..\include" /I ".\\" /I "..\..\src\os\win" /D "WIN32" /D "NDEBUG" /D "_USRDLL" /D "PA_ENABLE_DEBUG_OUTPUT" /D "_CRT_SECURE_NO_DEPRECATE" /D "PAWIN_USE_WDMKS_DEVICE_INFO" /FD /c
-# SUBTRACT CPP /YX /Yc /Yu
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib setupapi.lib /nologo /dll /machine:I386 /out:"./Release_x86/portaudio_x86.dll"
-
-!ELSEIF "$(CFG)" == "portaudio - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug_x86"
-# PROP BASE Intermediate_Dir "Debug_x86"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug_x86"
-# PROP Intermediate_Dir "Debug_x86"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\src\common" /I "..\..\include" /I ".\\" /I "..\..\src\os\win" /D "WIN32" /D "_DEBUG" /D "_USRDLL" /D "PA_ENABLE_DEBUG_OUTPUT" /D "_CRT_SECURE_NO_DEPRECATE" /D "PAWIN_USE_WDMKS_DEVICE_INFO" /FD /GZ /c
-# SUBTRACT CPP /YX /Yc /Yu
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib setupapi.lib /nologo /dll /debug /machine:I386 /out:"./Debug_x86/portaudio_x86.dll" /pdbtype:sept
-
-!ENDIF
-
-# Begin Target
-
-# Name "portaudio - Win32 Release"
-# Name "portaudio - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Group "common"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\..\src\common\pa_allocation.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\src\common\pa_converters.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\src\common\pa_cpuload.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\src\common\pa_debugprint.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\src\common\pa_dither.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\src\common\pa_front.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\src\common\pa_process.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\src\common\pa_ringbuffer.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\src\hostapi\skeleton\pa_hostapi_skeleton.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\src\common\pa_stream.c
-# End Source File
-# End Group
-# Begin Group "hostapi"
-
-# PROP Default_Filter ""
-# Begin Group "ASIO"
-
-# PROP Default_Filter ""
-# Begin Group "ASIOSDK"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\..\src\hostapi\asio\ASIOSDK\common\asio.cpp
-# ADD CPP /I "..\..\src\hostapi\asio\ASIOSDK\host" /I "..\..\src\hostapi\asio\ASIOSDK\host\pc" /I "..\..\src\hostapi\asio\ASIOSDK\common"
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\src\hostapi\asio\ASIOSDK\host\ASIOConvertSamples.cpp
-# ADD CPP /I "..\..\src\hostapi\asio\ASIOSDK\host" /I "..\..\src\hostapi\asio\ASIOSDK\host\pc" /I "..\..\src\hostapi\asio\ASIOSDK\common"
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\src\hostapi\asio\ASIOSDK\host\asiodrivers.cpp
-# ADD CPP /I "..\..\src\hostapi\asio\ASIOSDK\host" /I "..\..\src\hostapi\asio\ASIOSDK\host\pc" /I "..\..\src\hostapi\asio\ASIOSDK\common"
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\src\hostapi\asio\ASIOSDK\host\pc\asiolist.cpp
-# ADD CPP /I "..\..\src\hostapi\asio\ASIOSDK\host" /I "..\..\src\hostapi\asio\ASIOSDK\host\pc" /I "..\..\src\hostapi\asio\ASIOSDK\common"
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\src\hostapi\asio\ASIOSDK\common\combase.cpp
-# ADD CPP /I "..\..\src\hostapi\asio\ASIOSDK\host" /I "..\..\src\hostapi\asio\ASIOSDK\host\pc" /I "..\..\src\hostapi\asio\ASIOSDK\common"
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\src\hostapi\asio\ASIOSDK\common\debugmessage.cpp
-# ADD CPP /I "..\..\src\hostapi\asio\ASIOSDK\host" /I "..\..\src\hostapi\asio\ASIOSDK\host\pc" /I "..\..\src\hostapi\asio\ASIOSDK\common"
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\src\hostapi\asio\ASIOSDK\common\register.cpp
-# ADD CPP /I "..\..\src\hostapi\asio\ASIOSDK\host" /I "..\..\src\hostapi\asio\ASIOSDK\host\pc" /I "..\..\src\hostapi\asio\ASIOSDK\common"
-# End Source File
-# End Group
-# Begin Source File
-
-SOURCE=..\..\src\hostapi\asio\pa_asio.cpp
-# ADD CPP /I "..\..\src\hostapi\asio\ASIOSDK\host" /I "..\..\src\hostapi\asio\ASIOSDK\host\pc" /I "..\..\src\hostapi\asio\ASIOSDK\common"
-# End Source File
-# End Group
-# Begin Group "dsound"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\..\src\hostapi\dsound\pa_win_ds.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\src\hostapi\dsound\pa_win_ds_dynlink.c
-# End Source File
-# End Group
-# Begin Group "wmme"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\..\src\hostapi\wmme\pa_win_wmme.c
-# End Source File
-# End Group
-# Begin Group "wasapi"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\..\src\hostapi\wasapi\pa_win_wasapi.cpp
-# End Source File
-# End Group
-# Begin Group "wdm-ks"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\..\src\hostapi\wdmks\pa_win_wdmks.c
-# End Source File
-# End Group
-# End Group
-# Begin Group "os"
-
-# PROP Default_Filter ""
-# Begin Group "win"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\..\src\os\win\pa_win_hostapis.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\src\os\win\pa_win_util.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\src\os\win\pa_win_waveformat.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\src\os\win\pa_win_wdmks_utils.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\src\os\win\pa_x86_plain_converters.c
-# End Source File
-# End Group
-# End Group
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# Begin Source File
-
-SOURCE=.\portaudio.def
-# End Source File
-# End Group
-# End Target
-# End Project
+# Microsoft Developer Studio Project File - Name="portaudio" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=portaudio - Win32 Release
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "portaudio.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "portaudio.mak" CFG="portaudio - Win32 Release"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "portaudio - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "portaudio - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "portaudio - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release_x86"
+# PROP BASE Intermediate_Dir "Release_x86"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release_x86"
+# PROP Intermediate_Dir "Release_x86"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\src\common" /I "..\..\include" /I ".\\" /I "..\..\src\os\win" /D "WIN32" /D "NDEBUG" /D "_USRDLL" /D "PA_ENABLE_DEBUG_OUTPUT" /D "_CRT_SECURE_NO_DEPRECATE" /D "PAWIN_USE_WDMKS_DEVICE_INFO" /FD /c
+# SUBTRACT CPP /YX /Yc /Yu
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib setupapi.lib /nologo /dll /machine:I386 /out:"./Release_x86/portaudio_x86.dll"
+
+!ELSEIF "$(CFG)" == "portaudio - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug_x86"
+# PROP BASE Intermediate_Dir "Debug_x86"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug_x86"
+# PROP Intermediate_Dir "Debug_x86"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\src\common" /I "..\..\include" /I ".\\" /I "..\..\src\os\win" /D "WIN32" /D "_DEBUG" /D "_USRDLL" /D "PA_ENABLE_DEBUG_OUTPUT" /D "_CRT_SECURE_NO_DEPRECATE" /D "PAWIN_USE_WDMKS_DEVICE_INFO" /FD /GZ /c
+# SUBTRACT CPP /YX /Yc /Yu
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib setupapi.lib /nologo /dll /debug /machine:I386 /out:"./Debug_x86/portaudio_x86.dll" /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "portaudio - Win32 Release"
+# Name "portaudio - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Group "common"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\..\src\common\pa_allocation.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\src\common\pa_converters.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\src\common\pa_cpuload.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\src\common\pa_debugprint.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\src\common\pa_dither.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\src\common\pa_front.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\src\common\pa_process.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\src\common\pa_ringbuffer.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\src\hostapi\skeleton\pa_hostapi_skeleton.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\src\common\pa_stream.c
+# End Source File
+# End Group
+# Begin Group "hostapi"
+
+# PROP Default_Filter ""
+# Begin Group "ASIO"
+
+# PROP Default_Filter ""
+# Begin Group "ASIOSDK"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\..\src\hostapi\asio\ASIOSDK\common\asio.cpp
+# ADD CPP /I "..\..\src\hostapi\asio\ASIOSDK\host" /I "..\..\src\hostapi\asio\ASIOSDK\host\pc" /I "..\..\src\hostapi\asio\ASIOSDK\common"
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\src\hostapi\asio\ASIOSDK\host\ASIOConvertSamples.cpp
+# ADD CPP /I "..\..\src\hostapi\asio\ASIOSDK\host" /I "..\..\src\hostapi\asio\ASIOSDK\host\pc" /I "..\..\src\hostapi\asio\ASIOSDK\common"
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\src\hostapi\asio\ASIOSDK\host\asiodrivers.cpp
+# ADD CPP /I "..\..\src\hostapi\asio\ASIOSDK\host" /I "..\..\src\hostapi\asio\ASIOSDK\host\pc" /I "..\..\src\hostapi\asio\ASIOSDK\common"
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\src\hostapi\asio\ASIOSDK\host\pc\asiolist.cpp
+# ADD CPP /I "..\..\src\hostapi\asio\ASIOSDK\host" /I "..\..\src\hostapi\asio\ASIOSDK\host\pc" /I "..\..\src\hostapi\asio\ASIOSDK\common"
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\src\hostapi\asio\ASIOSDK\common\combase.cpp
+# ADD CPP /I "..\..\src\hostapi\asio\ASIOSDK\host" /I "..\..\src\hostapi\asio\ASIOSDK\host\pc" /I "..\..\src\hostapi\asio\ASIOSDK\common"
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\src\hostapi\asio\ASIOSDK\common\debugmessage.cpp
+# ADD CPP /I "..\..\src\hostapi\asio\ASIOSDK\host" /I "..\..\src\hostapi\asio\ASIOSDK\host\pc" /I "..\..\src\hostapi\asio\ASIOSDK\common"
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\src\hostapi\asio\ASIOSDK\common\register.cpp
+# ADD CPP /I "..\..\src\hostapi\asio\ASIOSDK\host" /I "..\..\src\hostapi\asio\ASIOSDK\host\pc" /I "..\..\src\hostapi\asio\ASIOSDK\common"
+# End Source File
+# End Group
+# Begin Source File
+
+SOURCE=..\..\src\hostapi\asio\pa_asio.cpp
+# ADD CPP /I "..\..\src\hostapi\asio\ASIOSDK\host" /I "..\..\src\hostapi\asio\ASIOSDK\host\pc" /I "..\..\src\hostapi\asio\ASIOSDK\common"
+# End Source File
+# End Group
+# Begin Group "dsound"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\..\src\hostapi\dsound\pa_win_ds.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\src\hostapi\dsound\pa_win_ds_dynlink.c
+# End Source File
+# End Group
+# Begin Group "wmme"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\..\src\hostapi\wmme\pa_win_wmme.c
+# End Source File
+# End Group
+# Begin Group "wasapi"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\..\src\hostapi\wasapi\pa_win_wasapi.cpp
+# End Source File
+# End Group
+# Begin Group "wdm-ks"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\..\src\hostapi\wdmks\pa_win_wdmks.c
+# End Source File
+# End Group
+# End Group
+# Begin Group "os"
+
+# PROP Default_Filter ""
+# Begin Group "win"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\..\src\os\win\pa_win_hostapis.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\src\os\win\pa_win_util.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\src\os\win\pa_win_waveformat.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\src\os\win\pa_win_wdmks_utils.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\src\os\win\pa_x86_plain_converters.c
+# End Source File
+# End Group
+# End Group
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# Begin Source File
+
+SOURCE=.\portaudio.def
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/build/msvc/portaudio.dsw b/build/msvc/portaudio.dsw
index 6af88f4..58d0ea9 100644
--- a/build/msvc/portaudio.dsw
+++ b/build/msvc/portaudio.dsw
@@ -1,29 +1,29 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "portaudio"=".\portaudio.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
+Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "portaudio"=".\portaudio.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/build/msvc/portaudio.sln b/build/msvc/portaudio.sln
index 7933517..ef9456e 100644
--- a/build/msvc/portaudio.sln
+++ b/build/msvc/portaudio.sln
@@ -1,32 +1,32 @@
-
-Microsoft Visual Studio Solution File, Format Version 9.00
-# Visual Studio 2005
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "portaudio", "portaudio.vcproj", "{0A18A071-125E-442F-AFF7-A3F68ABECF99}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Win32 = Debug|Win32
- Debug|x64 = Debug|x64
- Release|Win32 = Release|Win32
- Release|x64 = Release|x64
- ReleaseMinDependency|Win32 = ReleaseMinDependency|Win32
- ReleaseMinDependency|x64 = ReleaseMinDependency|x64
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {0A18A071-125E-442F-AFF7-A3F68ABECF99}.Debug|Win32.ActiveCfg = Debug|Win32
- {0A18A071-125E-442F-AFF7-A3F68ABECF99}.Debug|Win32.Build.0 = Debug|Win32
- {0A18A071-125E-442F-AFF7-A3F68ABECF99}.Debug|x64.ActiveCfg = Debug|x64
- {0A18A071-125E-442F-AFF7-A3F68ABECF99}.Debug|x64.Build.0 = Debug|x64
- {0A18A071-125E-442F-AFF7-A3F68ABECF99}.Release|Win32.ActiveCfg = Release|Win32
- {0A18A071-125E-442F-AFF7-A3F68ABECF99}.Release|Win32.Build.0 = Release|Win32
- {0A18A071-125E-442F-AFF7-A3F68ABECF99}.Release|x64.ActiveCfg = Release|x64
- {0A18A071-125E-442F-AFF7-A3F68ABECF99}.Release|x64.Build.0 = Release|x64
- {0A18A071-125E-442F-AFF7-A3F68ABECF99}.ReleaseMinDependency|Win32.ActiveCfg = ReleaseMinDependency|Win32
- {0A18A071-125E-442F-AFF7-A3F68ABECF99}.ReleaseMinDependency|Win32.Build.0 = ReleaseMinDependency|Win32
- {0A18A071-125E-442F-AFF7-A3F68ABECF99}.ReleaseMinDependency|x64.ActiveCfg = ReleaseMinDependency|x64
- {0A18A071-125E-442F-AFF7-A3F68ABECF99}.ReleaseMinDependency|x64.Build.0 = ReleaseMinDependency|x64
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
+
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual Studio 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "portaudio", "portaudio.vcproj", "{0A18A071-125E-442F-AFF7-A3F68ABECF99}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Debug|x64 = Debug|x64
+ Release|Win32 = Release|Win32
+ Release|x64 = Release|x64
+ ReleaseMinDependency|Win32 = ReleaseMinDependency|Win32
+ ReleaseMinDependency|x64 = ReleaseMinDependency|x64
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {0A18A071-125E-442F-AFF7-A3F68ABECF99}.Debug|Win32.ActiveCfg = Debug|Win32
+ {0A18A071-125E-442F-AFF7-A3F68ABECF99}.Debug|Win32.Build.0 = Debug|Win32
+ {0A18A071-125E-442F-AFF7-A3F68ABECF99}.Debug|x64.ActiveCfg = Debug|x64
+ {0A18A071-125E-442F-AFF7-A3F68ABECF99}.Debug|x64.Build.0 = Debug|x64
+ {0A18A071-125E-442F-AFF7-A3F68ABECF99}.Release|Win32.ActiveCfg = Release|Win32
+ {0A18A071-125E-442F-AFF7-A3F68ABECF99}.Release|Win32.Build.0 = Release|Win32
+ {0A18A071-125E-442F-AFF7-A3F68ABECF99}.Release|x64.ActiveCfg = Release|x64
+ {0A18A071-125E-442F-AFF7-A3F68ABECF99}.Release|x64.Build.0 = Release|x64
+ {0A18A071-125E-442F-AFF7-A3F68ABECF99}.ReleaseMinDependency|Win32.ActiveCfg = ReleaseMinDependency|Win32
+ {0A18A071-125E-442F-AFF7-A3F68ABECF99}.ReleaseMinDependency|Win32.Build.0 = ReleaseMinDependency|Win32
+ {0A18A071-125E-442F-AFF7-A3F68ABECF99}.ReleaseMinDependency|x64.ActiveCfg = ReleaseMinDependency|x64
+ {0A18A071-125E-442F-AFF7-A3F68ABECF99}.ReleaseMinDependency|x64.Build.0 = ReleaseMinDependency|x64
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/build/msvc/portaudio.vcproj b/build/msvc/portaudio.vcproj
index abdb8ff..e5a648b 100644
--- a/build/msvc/portaudio.vcproj
+++ b/build/msvc/portaudio.vcproj
@@ -1,1932 +1,1932 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cmake_support/FindASIOSDK.cmake b/cmake_support/FindASIOSDK.cmake
index 9e97e66..55ad33d 100644
--- a/cmake_support/FindASIOSDK.cmake
+++ b/cmake_support/FindASIOSDK.cmake
@@ -1,41 +1,41 @@
-# $Id: $
-#
-# - Try to find the ASIO SDK
-# Once done this will define
-#
-# ASIOSDK_FOUND - system has ASIO SDK
-# ASIOSDK_ROOT_DIR - path to the ASIO SDK base directory
-# ASIOSDK_INCLUDE_DIR - the ASIO SDK include directory
-
-if(WIN32)
-else(WIN32)
- message(FATAL_ERROR "FindASIOSDK.cmake: Unsupported platform ${CMAKE_SYSTEM_NAME}" )
-endif(WIN32)
-
-file(GLOB results "${CMAKE_CURRENT_SOURCE_DIR}/../as*")
-foreach(f ${results})
- if(IS_DIRECTORY ${f})
- set(ASIOSDK_PATH_HINT ${ASIOSDK_PATH_HINT} ${f})
- endif()
-endforeach()
-
-find_path(ASIOSDK_ROOT_DIR
- common/asio.h
- HINTS
- ${ASIOSDK_PATH_HINT}
-)
-
-find_path(ASIOSDK_INCLUDE_DIR
- asio.h
- PATHS
- ${ASIOSDK_ROOT_DIR}/common
-)
-
-# handle the QUIETLY and REQUIRED arguments and set ASIOSDK_FOUND to TRUE if
-# all listed variables are TRUE
-INCLUDE(FindPackageHandleStandardArgs)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(ASIOSDK DEFAULT_MSG ASIOSDK_ROOT_DIR ASIOSDK_INCLUDE_DIR)
-
-MARK_AS_ADVANCED(
- ASIOSDK_ROOT_DIR ASIOSDK_INCLUDE_DIR
-)
+# $Id: $
+#
+# - Try to find the ASIO SDK
+# Once done this will define
+#
+# ASIOSDK_FOUND - system has ASIO SDK
+# ASIOSDK_ROOT_DIR - path to the ASIO SDK base directory
+# ASIOSDK_INCLUDE_DIR - the ASIO SDK include directory
+
+if(WIN32)
+else(WIN32)
+ message(FATAL_ERROR "FindASIOSDK.cmake: Unsupported platform ${CMAKE_SYSTEM_NAME}" )
+endif(WIN32)
+
+file(GLOB results "${CMAKE_CURRENT_SOURCE_DIR}/../as*")
+foreach(f ${results})
+ if(IS_DIRECTORY ${f})
+ set(ASIOSDK_PATH_HINT ${ASIOSDK_PATH_HINT} ${f})
+ endif()
+endforeach()
+
+find_path(ASIOSDK_ROOT_DIR
+ common/asio.h
+ HINTS
+ ${ASIOSDK_PATH_HINT}
+)
+
+find_path(ASIOSDK_INCLUDE_DIR
+ asio.h
+ PATHS
+ ${ASIOSDK_ROOT_DIR}/common
+)
+
+# handle the QUIETLY and REQUIRED arguments and set ASIOSDK_FOUND to TRUE if
+# all listed variables are TRUE
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(ASIOSDK DEFAULT_MSG ASIOSDK_ROOT_DIR ASIOSDK_INCLUDE_DIR)
+
+MARK_AS_ADVANCED(
+ ASIOSDK_ROOT_DIR ASIOSDK_INCLUDE_DIR
+)
diff --git a/cmake_support/FindDXSDK.cmake b/cmake_support/FindDXSDK.cmake
index 92ba432..3d2f021 100644
--- a/cmake_support/FindDXSDK.cmake
+++ b/cmake_support/FindDXSDK.cmake
@@ -1,59 +1,59 @@
-# $Id: $
-#
-# - Try to find the DirectX SDK
-# Once done this will define
-#
-# DXSDK_FOUND - system has DirectX SDK
-# DXSDK_ROOT_DIR - path to the DirectX SDK base directory
-# DXSDK_INCLUDE_DIR - the DirectX SDK include directory
-# DXSDK_LIBRARY_DIR - DirectX SDK libraries path
-#
-# DXSDK_DSOUND_LIBRARY - Path to dsound.lib
-#
-
-if(WIN32)
-else(WIN32)
- message(FATAL_ERROR "FindDXSDK.cmake: Unsupported platform ${CMAKE_SYSTEM_NAME}" )
-endif(WIN32)
-
-find_path(DXSDK_ROOT_DIR
- include/dxsdkver.h
- HINTS
- $ENV{DXSDK_DIR}
-)
-
-find_path(DXSDK_INCLUDE_DIR
- dxsdkver.h
- PATHS
- ${DXSDK_ROOT_DIR}/include
-)
-
-IF(CMAKE_CL_64)
-find_path(DXSDK_LIBRARY_DIR
- dsound.lib
- PATHS
- ${DXSDK_ROOT_DIR}/lib/x64
-)
-ELSE(CMAKE_CL_64)
-find_path(DXSDK_LIBRARY_DIR
- dsound.lib
- PATHS
- ${DXSDK_ROOT_DIR}/lib/x86
-)
-ENDIF(CMAKE_CL_64)
-
-find_library(DXSDK_DSOUND_LIBRARY
- dsound.lib
- PATHS
- ${DXSDK_LIBRARY_DIR}
-)
-
-# handle the QUIETLY and REQUIRED arguments and set DXSDK_FOUND to TRUE if
-# all listed variables are TRUE
-INCLUDE(FindPackageHandleStandardArgs)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(DXSDK DEFAULT_MSG DXSDK_ROOT_DIR DXSDK_INCLUDE_DIR)
-
-MARK_AS_ADVANCED(
- DXSDK_ROOT_DIR DXSDK_INCLUDE_DIR
- DXSDK_LIBRARY_DIR DXSDK_DSOUND_LIBRARY
-)
+# $Id: $
+#
+# - Try to find the DirectX SDK
+# Once done this will define
+#
+# DXSDK_FOUND - system has DirectX SDK
+# DXSDK_ROOT_DIR - path to the DirectX SDK base directory
+# DXSDK_INCLUDE_DIR - the DirectX SDK include directory
+# DXSDK_LIBRARY_DIR - DirectX SDK libraries path
+#
+# DXSDK_DSOUND_LIBRARY - Path to dsound.lib
+#
+
+if(WIN32)
+else(WIN32)
+ message(FATAL_ERROR "FindDXSDK.cmake: Unsupported platform ${CMAKE_SYSTEM_NAME}" )
+endif(WIN32)
+
+find_path(DXSDK_ROOT_DIR
+ include/dxsdkver.h
+ HINTS
+ $ENV{DXSDK_DIR}
+)
+
+find_path(DXSDK_INCLUDE_DIR
+ dxsdkver.h
+ PATHS
+ ${DXSDK_ROOT_DIR}/include
+)
+
+IF(CMAKE_CL_64)
+find_path(DXSDK_LIBRARY_DIR
+ dsound.lib
+ PATHS
+ ${DXSDK_ROOT_DIR}/lib/x64
+)
+ELSE(CMAKE_CL_64)
+find_path(DXSDK_LIBRARY_DIR
+ dsound.lib
+ PATHS
+ ${DXSDK_ROOT_DIR}/lib/x86
+)
+ENDIF(CMAKE_CL_64)
+
+find_library(DXSDK_DSOUND_LIBRARY
+ dsound.lib
+ PATHS
+ ${DXSDK_LIBRARY_DIR}
+)
+
+# handle the QUIETLY and REQUIRED arguments and set DXSDK_FOUND to TRUE if
+# all listed variables are TRUE
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(DXSDK DEFAULT_MSG DXSDK_ROOT_DIR DXSDK_INCLUDE_DIR)
+
+MARK_AS_ADVANCED(
+ DXSDK_ROOT_DIR DXSDK_INCLUDE_DIR
+ DXSDK_LIBRARY_DIR DXSDK_DSOUND_LIBRARY
+)
diff --git a/cmake_support/options_cmake.h.in b/cmake_support/options_cmake.h.in
index 8308bb7..cd07605 100644
--- a/cmake_support/options_cmake.h.in
+++ b/cmake_support/options_cmake.h.in
@@ -1,31 +1,31 @@
-/* $Id: $
-
- !!! @GENERATED_MESSAGE@ !!!
-
- Header file configured by CMake to convert CMake options/vars to macros. It is done this way because if set via
- preprocessor options, MSVC f.i. has no way of knowing when an option (or var) changes as there is no dependency chain.
-
- The generated "options_cmake.h" should be included like so:
-
- #ifdef PORTAUDIO_CMAKE_GENERATED
- #include "options_cmake.h"
- #endif
-
- so that non-CMake build environments are left intact.
-
- Source template: cmake_support/options_cmake.h.in
-*/
-
-#ifdef _WIN32
-#if defined(PA_USE_ASIO) || defined(PA_USE_DS) || defined(PA_USE_WMME) || defined(PA_USE_WASAPI) || defined(PA_USE_WDMKS)
-#error "This header needs to be included before pa_hostapi.h!!"
-#endif
-
-#cmakedefine01 PA_USE_ASIO
-#cmakedefine01 PA_USE_DS
-#cmakedefine01 PA_USE_WMME
-#cmakedefine01 PA_USE_WASAPI
-#cmakedefine01 PA_USE_WDMKS
-#else
-#error "Platform currently not supported by CMake script"
-#endif
+/* $Id: $
+
+ !!! @GENERATED_MESSAGE@ !!!
+
+ Header file configured by CMake to convert CMake options/vars to macros. It is done this way because if set via
+ preprocessor options, MSVC f.i. has no way of knowing when an option (or var) changes as there is no dependency chain.
+
+ The generated "options_cmake.h" should be included like so:
+
+ #ifdef PORTAUDIO_CMAKE_GENERATED
+ #include "options_cmake.h"
+ #endif
+
+ so that non-CMake build environments are left intact.
+
+ Source template: cmake_support/options_cmake.h.in
+*/
+
+#ifdef _WIN32
+#if defined(PA_USE_ASIO) || defined(PA_USE_DS) || defined(PA_USE_WMME) || defined(PA_USE_WASAPI) || defined(PA_USE_WDMKS)
+#error "This header needs to be included before pa_hostapi.h!!"
+#endif
+
+#cmakedefine01 PA_USE_ASIO
+#cmakedefine01 PA_USE_DS
+#cmakedefine01 PA_USE_WMME
+#cmakedefine01 PA_USE_WASAPI
+#cmakedefine01 PA_USE_WDMKS
+#else
+#error "Platform currently not supported by CMake script"
+#endif
diff --git a/cmake_support/template_portaudio.def b/cmake_support/template_portaudio.def
index 0e06d0a..8ce2a98 100644
--- a/cmake_support/template_portaudio.def
+++ b/cmake_support/template_portaudio.def
@@ -1,53 +1,53 @@
-; $Id: $
-;
-; !!! @GENERATED_MESSAGE@ !!!
-EXPORTS
-
-;
-Pa_GetVersion @1
-Pa_GetVersionText @2
-Pa_GetErrorText @3
-Pa_Initialize @4
-Pa_Terminate @5
-Pa_GetHostApiCount @6
-Pa_GetDefaultHostApi @7
-Pa_GetHostApiInfo @8
-Pa_HostApiTypeIdToHostApiIndex @9
-Pa_HostApiDeviceIndexToDeviceIndex @10
-Pa_GetLastHostErrorInfo @11
-Pa_GetDeviceCount @12
-Pa_GetDefaultInputDevice @13
-Pa_GetDefaultOutputDevice @14
-Pa_GetDeviceInfo @15
-Pa_IsFormatSupported @16
-Pa_OpenStream @17
-Pa_OpenDefaultStream @18
-Pa_CloseStream @19
-Pa_SetStreamFinishedCallback @20
-Pa_StartStream @21
-Pa_StopStream @22
-Pa_AbortStream @23
-Pa_IsStreamStopped @24
-Pa_IsStreamActive @25
-Pa_GetStreamInfo @26
-Pa_GetStreamTime @27
-Pa_GetStreamCpuLoad @28
-Pa_ReadStream @29
-Pa_WriteStream @30
-Pa_GetStreamReadAvailable @31
-Pa_GetStreamWriteAvailable @32
-Pa_GetSampleSize @33
-Pa_Sleep @34
-@DEF_EXCLUDE_ASIO_SYMBOLS@PaAsio_GetAvailableBufferSizes @50
-@DEF_EXCLUDE_ASIO_SYMBOLS@PaAsio_ShowControlPanel @51
-PaUtil_InitializeX86PlainConverters @52
-@DEF_EXCLUDE_ASIO_SYMBOLS@PaAsio_GetInputChannelName @53
-@DEF_EXCLUDE_ASIO_SYMBOLS@PaAsio_GetOutputChannelName @54
-PaUtil_SetDebugPrintFunction @55
-@DEF_EXCLUDE_WASAPI_SYMBOLS@PaWasapi_GetDeviceDefaultFormat @56
-@DEF_EXCLUDE_WASAPI_SYMBOLS@PaWasapi_GetDeviceRole @57
-@DEF_EXCLUDE_WASAPI_SYMBOLS@PaWasapi_ThreadPriorityBoost @58
-@DEF_EXCLUDE_WASAPI_SYMBOLS@PaWasapi_ThreadPriorityRevert @59
-@DEF_EXCLUDE_WASAPI_SYMBOLS@PaWasapi_GetFramesPerHostBuffer @60
-@DEF_EXCLUDE_WASAPI_SYMBOLS@PaWasapi_GetJackDescription @61
-@DEF_EXCLUDE_WASAPI_SYMBOLS@PaWasapi_GetJackCount @62
+; $Id: $
+;
+; !!! @GENERATED_MESSAGE@ !!!
+EXPORTS
+
+;
+Pa_GetVersion @1
+Pa_GetVersionText @2
+Pa_GetErrorText @3
+Pa_Initialize @4
+Pa_Terminate @5
+Pa_GetHostApiCount @6
+Pa_GetDefaultHostApi @7
+Pa_GetHostApiInfo @8
+Pa_HostApiTypeIdToHostApiIndex @9
+Pa_HostApiDeviceIndexToDeviceIndex @10
+Pa_GetLastHostErrorInfo @11
+Pa_GetDeviceCount @12
+Pa_GetDefaultInputDevice @13
+Pa_GetDefaultOutputDevice @14
+Pa_GetDeviceInfo @15
+Pa_IsFormatSupported @16
+Pa_OpenStream @17
+Pa_OpenDefaultStream @18
+Pa_CloseStream @19
+Pa_SetStreamFinishedCallback @20
+Pa_StartStream @21
+Pa_StopStream @22
+Pa_AbortStream @23
+Pa_IsStreamStopped @24
+Pa_IsStreamActive @25
+Pa_GetStreamInfo @26
+Pa_GetStreamTime @27
+Pa_GetStreamCpuLoad @28
+Pa_ReadStream @29
+Pa_WriteStream @30
+Pa_GetStreamReadAvailable @31
+Pa_GetStreamWriteAvailable @32
+Pa_GetSampleSize @33
+Pa_Sleep @34
+@DEF_EXCLUDE_ASIO_SYMBOLS@PaAsio_GetAvailableBufferSizes @50
+@DEF_EXCLUDE_ASIO_SYMBOLS@PaAsio_ShowControlPanel @51
+PaUtil_InitializeX86PlainConverters @52
+@DEF_EXCLUDE_ASIO_SYMBOLS@PaAsio_GetInputChannelName @53
+@DEF_EXCLUDE_ASIO_SYMBOLS@PaAsio_GetOutputChannelName @54
+PaUtil_SetDebugPrintFunction @55
+@DEF_EXCLUDE_WASAPI_SYMBOLS@PaWasapi_GetDeviceDefaultFormat @56
+@DEF_EXCLUDE_WASAPI_SYMBOLS@PaWasapi_GetDeviceRole @57
+@DEF_EXCLUDE_WASAPI_SYMBOLS@PaWasapi_ThreadPriorityBoost @58
+@DEF_EXCLUDE_WASAPI_SYMBOLS@PaWasapi_ThreadPriorityRevert @59
+@DEF_EXCLUDE_WASAPI_SYMBOLS@PaWasapi_GetFramesPerHostBuffer @60
+@DEF_EXCLUDE_WASAPI_SYMBOLS@PaWasapi_GetJackDescription @61
+@DEF_EXCLUDE_WASAPI_SYMBOLS@PaWasapi_GetJackCount @62
diff --git a/doc/src/api_overview.dox b/doc/src/api_overview.dox
index 2758f21..98a0dbd 100644
--- a/doc/src/api_overview.dox
+++ b/doc/src/api_overview.dox
@@ -1,162 +1,162 @@
-/** @page api_overview PortAudio API Overview
-
-This page provides a top-down overview of the entire PortAudio API. It describes how all of the PortAudio data types and functions fit together. It provides links to the documentation for each function and data type. You can find all of the detailed documentation for each API function and data type on the portaudio.h page.
-
-@section introduction Introduction
-
-PortAudio provides a uniform application programming interface (API) across all supported platforms. You can think of the PortAudio library as a wrapper that converts calls to the PortAudio API into calls to platform-specific native audio APIs. Operating systems often offer more than one native audio API and some APIs (such as JACK) may be available on multiple target operating systems. PortAudio supports all the major native audio APIs on each supported platform. The diagram below illustrates the relationship between your application, PortAudio, and the supported native audio APIs:
-
-@image html portaudio-external-architecture-diagram.png
-
-PortAudio provides a uniform interface to native audio APIs. However, it doesn't always provide totally uniform functionality. There are cases where PortAudio is limited by the capabilities of the underlying native audio API. For example, PortAudio doesn't provide sample rate conversion if you request a sample rate that is not supported by the native audio API. Another example is that the ASIO SDK only allows one device to be open at a time, so PortAudio/ASIO doesn't currently support opening multiple ASIO devices simultaneously.
-
-@section key_abstractions Key abstractions: Host APIs, Devices and Streams
-
-The PortAudio processing model includes three main abstractions: Host APIs, audio Devices and audio Streams.
-
-Host APIs represent platform-specific native audio APIs. Some examples of Host APIs are Core Audio on Mac OS, WMME and DirectSound on Windows and OSS and ALSA on Linux. The diagram in the previous section shows many of the supported native APIs. Sometimes it's useful to know which Host APIs you're dealing with, but it is easy to use PortAudio without ever interacting directly with the Host API abstraction.
-
-Devices represent individual hardware audio interfaces or audio ports on the host platform. Devices have names and certain capabilities such as supported sample rates and the number of supported input and output channels. PortAudio provides functions to enumerate available Devices and to query for Device capabilities.
-
-Streams manage active audio input and output from and to Devices. Streams may be half duplex (input or output) or full duplex (simultaneous input and output). Streams operate at a specific sample rate with particular sample formats, buffer sizes and internal buffering latencies. You specify these parameters when you open the Stream. Audio data is communicated between a Stream and your application via a user provided asynchronous callback function or by invoking synchronous read and write functions.
-
-PortAudio supports audio input and output in a variety of sample formats: 8, 16, 24 and 32 bit integer formats and 32 bit floating point, irrespective of the formats supported by the native audio API. PortAudio also supports multichannel buffers in both interleaved and non-interleaved (separate buffer per channel) formats and automatically performs conversion when necessary. If requested, PortAudio can clamp out-of range samples and/or dither to a native format.
-
-The PortAudio API offers the following functionality:
-- Initialize and terminate the library
-- Enumerate available Host APIs
-- Enumerate available Devices either globally, or within each Host API
-- Discover default or recommended Devices and Device settings
-- Discover Device capabilities such as supported audio data formats and sample rates
-- Create and control audio Streams to acquire audio from and output audio to Devices
-- Provide Stream timing information to support synchronising audio with other parts of your application
-- Retrieve version and error information.
-
-These functions are described in more detail below.
-
-
-@section top_level_functions Initialization, termination and utility functions
-
-The PortAudio library must be initialized before it can be used and terminated to clean up afterwards. You initialize PortAudio by calling Pa_Initialize() and clean up by calling Pa_Terminate().
-
-You can query PortAudio for version information using Pa_GetVersion() to get a numeric version number and Pa_GetVersionText() to get a string.
-
-The size in bytes of the various sample formats represented by the @ref PaSampleFormat enumeration can be obtained using Pa_GetSampleSize().
-
-Pa_Sleep() sleeps for a specified number of milliseconds. This isn't intended for use in production systems; it's provided only as a simple portable way to implement tests and examples where the main thread sleeps while audio is acquired or played by an asynchronous callback function.
-
-@section host_apis Host APIs
-
-A Host API acts as a top-level grouping for all of the Devices offered by a single native platform audio API. Each Host API has a unique type identifier, a name, zero or more Devices, and nominated default input and output Devices.
-
-Host APIs are usually referenced by index: an integer of type @ref PaHostApiIndex that ranges between zero and Pa_GetHostApiCount() - 1. You can enumerate all available Host APIs by counting across this range.
-
-You can retrieve the index of the default Host API by calling Pa_GetDefaultHostApi().
-
-Information about a Host API, such as it's name and default devices, is stored in a @ref PaHostApiInfo structure. You can retrieve a pointer to a particular Host API's @ref PaHostApiInfo structure by calling Pa_GetHostApiInfo() with the Host API's index as a parameter.
-
-Most PortAudio functions reference Host APIs by @ref PaHostApiIndex indices. Each Host API also has a unique type identifier defined in the @ref PaHostApiTypeId enumeration.
-You can call Pa_HostApiTypeIdToHostApiIndex() to retrieve the current @ref PaHostApiIndex for a particular @ref PaHostApiTypeId.
-
-@section devices Devices
-
-A Device represents an audio endpoint provided by a particular native audio API. This usually corresponds to a specific input or output port on a hardware audio interface, or to the interface as a whole. Each Host API operates independently, so a single physical audio port may be addressable via different Devices exposed by different Host APIs.
-
-A Device has a name, is associated with a Host API, and has a maximum number of supported input and output channels. PortAudio provides recommended default latency values and a default sample rate for each Device. To obtain more detailed information about device capabilities you can call Pa_IsFormatSupported() to query whether it is possible to open a Stream using particular Devices, parameters and sample rate.
-
-Although each Device conceptually belongs to a specific Host API, most PortAudio functions and data structures refer to Devices using a global, Host API-independent index of type @ref PaDeviceIndex – an integer of that ranges between zero and Pa_GetDeviceCount() - 1. The reasons for this are partly historical but it also makes it easy for applications to ignore the Host API abstraction and just work with Devices and Streams.
-
-If you want to enumerate Devices belonging to a particular Host API you can count between 0 and PaHostApiInfo::deviceCount - 1. You can convert this Host API-specific index value to a global @ref PaDeviceIndex value by calling Pa_HostApiDeviceIndexToDeviceIndex().
-
-Information about a Device is stored in a @ref PaDeviceInfo structure. You can retrieve a pointer to a Devices's @ref PaDeviceInfo structure by calling Pa_GetDeviceInfo() with the Device's index as a parameter.
-
-You can retrieve the indices of the global default input and output devices using Pa_GetDefaultInputDevice() and Pa_GetDefaultOutputDevice(). Default Devices for each Host API are stored in the Host API's @ref PaHostApiInfo structures.
-
-For an example of enumerating devices and printing information about their capabilities see the pa_devs.c program in the test directory of the PortAudio distribution.
-
-@section streams Streams
-
-A Stream represents an active flow of audio data between your application and one or more audio Devices. A Stream operates at a specific sample rate with specific sample formats and buffer sizes.
-
-@subsection io_methods I/O Methods: callback and read/write
-
-PortAudio offers two methods for communicating audio data between an open Stream and your Application: (1) an asynchronous callback interface, where PortAudio calls a user defined callback function when new audio data is available or required, and (2) synchronous read and write functions which can be used in a blocking or non-blocking manner. You choose between the two methods when you open a Stream. The two methods are discussed in more detail below.
-
-@subsection opening_and_closing_streams Opening and Closing Streams
-
-You call Pa_OpenStream() to open a Stream, specifying the Device(s) to use, the number of input and output channels, sample formats, suggested latency values and flags that control dithering, clipping and overflow handling. You specify many of these parameters in two PaStreamParameters structures, one for input and one for output. If you're using the callback I/O method you also pass a callback buffer size, callback function pointer and user data pointer.
-
-Devices may be full duplex (supporting simultaneous input and output) or half duplex (supporting input or output) – usually this reflects the structure of the underlying native audio API. When opening a Stream you can specify one full duplex Device for both input and output, or two different Devices for input and output. Some Host APIs only support full-duplex operation with a full-duplex device (e.g. ASIO) but most are able to aggregate two half duplex devices into a full duplex Stream. PortAudio requires that all devices specified in a call to Pa_OpenStream() belong to the same Host API.
-
-A successful call to Pa_OpenStream() creates a pointer to a @ref PaStream – an opaque handle representing the open Stream. All PortAudio API functions that operate on open Streams take a pointer to a @ref PaStream as their first parameter.
-
-PortAudio also provides Pa_OpenDefaultStream() – a simpler alternative to Pa_OpenStream() which you can use when you want to open the default audio Device(s) with default latency parameters.
-
-You call Pa_CloseStream() to close a Stream when you've finished using it.
-
-@subsection starting_and_stopping_streams Starting and Stopping Streams
-
-Newly opened Streams are initially stopped. You call Pa_StartStream() to start a Stream. You can stop a running Stream using Pa_StopStream() or Pa_AbortStream() (the Stop function plays out all internally queued audio data, while Abort tries to stop as quickly as possible). An open Stream can be started and stopped multiple times. You can call Pa_IsStreamStopped() to query whether a Stream is running or stopped.
-
-By calling Pa_SetStreamFinishedCallback() it is possible to register a special @ref PaStreamFinishedCallback that will be called when the Stream has completed playing any internally queued buffers. This can be used in conjunction with the @ref paComplete stream callback return value (see below) to avoid blocking on a call to Pa_StopStream() while queued audio data is still playing.
-
-@subsection callback_io_method The Callback I/O Method
-
-So-called 'callback Streams' operate by periodically invoking a callback function you supply to Pa_OpenStream(). The callback function must implement the @ref PaStreamCallback signature. It gets called by PortAudio every time PortAudio needs your application to consume or produce audio data. The callback is passed pointers to buffers containing the audio to process. The format (interleave, sample data type) and size of these buffers is determined by the parameters passed to Pa_OpenStream() when the Stream was opened.
-
-Stream callbacks usually return @ref paContinue to indicate that PortAudio should keep the stream running. It is possible to deactivate a Stream from the stream callback by returning either @ref paComplete or @ref paAbort. In this case the Stream enters a deactivated state after the last buffer has finished playing (@ref paComplete) or as soon as possible (@ref paAbort). You can detect the deactivated state by calling Pa_IsStreamActive() or by using Pa_SetStreamFinishedCallback() to subscribe to a stream finished notification. Note that even if the stream callback returns @ref paComplete it's still necessary to call Pa_StopStream() or Pa_AbortStream() to enter the stopped state.
-
-Many of the tests in the /tests directory of the PortAudio distribution implement PortAudio stream callbacks. For example see: patest_sine.c (audio output), patest_record.c (audio input), patest_wire.c (audio pass-through) and pa_fuzz.c (simple audio effects processing).
-
-IMPORTANT: The stream callback function often needs to operate with very high or real-time priority. As a result there are strict requirements placed on the type of code that can be executed in a stream callback. In general this means avoiding any code that might block, including: acquiring locks, calling OS API functions including allocating memory. With the exception of Pa_GetStreamCpuLoad() you may not call PortAudio API functions from within the stream callback.
-
-@subsection read_write_io_method The Read/Write I/O Method
-
-As an alternative to the callback I/O method, PortAudio provides a synchronous read/write interface for acquiring and playing audio. This can be useful for applications that don't require the lowest possibly latency, or don't warrant the increased complexity of synchronising with an asynchronous callback funciton. This I/O method is also useful when calling PortAudio from programming languages that don't support asynchronous callbacks.
-
-To open a Stream in read/write mode you pass a NULL stream callback function pointer to Pa_OpenStream().
-
-To write audio data to a Stream call Pa_WriteStream() and to read data call Pa_ReadStream(). These functions will block if the internal buffers are full, making them safe to call in a tight loop. If you want to avoid blocking you can query the amount of available read or write space using Pa_GetStreamReadAvailable() or Pa_GetStreamWriteAvailable() and use the returned values to limit the amount of data you read or write.
-
-For examples of the read/write I/O method see the following examples in the /tests directory of the PortAudio distribution: patest_read_record.c (audio input), patest_write_sine.c (audio output), patest_read_write_wire.c (audio pass-through).
-
-@subsection stream_info Retrieving Stream Information
-
-You can retrieve information about an open Stream by calling Pa_GetStreamInfo(). This returns a @ref PaStreamInfo structure containing the actual input and output latency and sample rate of the stream. It's possible for these values to be different from the suggested values passed to Pa_OpenStream().
-
-When using a callback stream you can call Pa_GetStreamCpuLoad() to retrieve a rough estimate of the amount of CPU time your callback function is using.
-
-@subsection stream_timing Stream Timing Information
-
-When using the callback I/O method your stream callback function receives timing information via a pointer to a PaStreamCallbackTimeInfo structure. This structure contains the current time along with the estimated hardware capture and playback time of the first sample of the input and output buffers. All times are measured in seconds relative to a Stream-specific clock. The current Stream clock time can be retrieved using Pa_GetStreamTime().
-
-You can use the stream callback @ref PaStreamCallbackTimeInfo times in conjunction with timestamps returned by Pa_GetStreamTime() to implement time synchronization schemes such as time aligning your GUI display with rendered audio, or maintaining synchronization between MIDI and audio playback.
-
-@section error_handling Error Handling
-
-Most PortAudio functions return error codes using values from the @ref PaError enumeration. All error codes are negative values. Some functions return values greater than or equal to zero for normal results and a negative error code in case of error.
-
-You can convert @ref PaError error codes to human readable text by calling Pa_GetErrorText().
-
-PortAudio usually tries to translate error conditions into portable @ref PaError error codes. However if an unexpected error is encountered the @ref paUnanticipatedHostError code may be returned. In this case a further mechanism is provided to query for Host API-specific error information. If PortAudio returns @ref paUnanticipatedHostError you can call Pa_GetLastHostErrorInfo() to retrieve a pointer to a @ref PaHostErrorInfo structure that provides more information, including the Host API that encountered the error, a native API error code and error text.
-
-@section host_api_extensions Host API and Platform-specific Extensions
-
-The public PortAudio API only exposes functionality that can be provided across all target platforms. In some cases individual native audio APIs offer unique functionality. Some PortAudio Host APIs expose this functionality via Host API-specific extensions. Examples include access to low-level buffering and priority parameters, opening a Stream with only a subset of a Device's channels, or accessing channel metadata such as channel names.
-
-Host API-specific extensions are provided in the form of additional functions and data structures defined in Host API-specific header files found in the /include directory.
-
-The @ref PaStreamParameters structure passed to Pa_IsFormatSupported() and Pa_OpenStream() has a field named @ref PaStreamParameters::hostApiSpecificStreamInfo that is sometimes used to pass low level information when opening a Stream.
-
-See the documentation for the individual Host API-specific header files for details of the extended functionality they expose:
-
-- pa_asio.h
-- pa_jack.h
-- pa_linux_alsa.h
-- pa_mac_core.h
-- pa_win_ds.h
-- pa_win_wasapi.h
-- pa_win_wmme.h
-- pa_win_waveformat.h
-
+/** @page api_overview PortAudio API Overview
+
+This page provides a top-down overview of the entire PortAudio API. It describes how all of the PortAudio data types and functions fit together. It provides links to the documentation for each function and data type. You can find all of the detailed documentation for each API function and data type on the portaudio.h page.
+
+@section introduction Introduction
+
+PortAudio provides a uniform application programming interface (API) across all supported platforms. You can think of the PortAudio library as a wrapper that converts calls to the PortAudio API into calls to platform-specific native audio APIs. Operating systems often offer more than one native audio API and some APIs (such as JACK) may be available on multiple target operating systems. PortAudio supports all the major native audio APIs on each supported platform. The diagram below illustrates the relationship between your application, PortAudio, and the supported native audio APIs:
+
+@image html portaudio-external-architecture-diagram.png
+
+PortAudio provides a uniform interface to native audio APIs. However, it doesn't always provide totally uniform functionality. There are cases where PortAudio is limited by the capabilities of the underlying native audio API. For example, PortAudio doesn't provide sample rate conversion if you request a sample rate that is not supported by the native audio API. Another example is that the ASIO SDK only allows one device to be open at a time, so PortAudio/ASIO doesn't currently support opening multiple ASIO devices simultaneously.
+
+@section key_abstractions Key abstractions: Host APIs, Devices and Streams
+
+The PortAudio processing model includes three main abstractions: Host APIs, audio Devices and audio Streams.
+
+Host APIs represent platform-specific native audio APIs. Some examples of Host APIs are Core Audio on Mac OS, WMME and DirectSound on Windows and OSS and ALSA on Linux. The diagram in the previous section shows many of the supported native APIs. Sometimes it's useful to know which Host APIs you're dealing with, but it is easy to use PortAudio without ever interacting directly with the Host API abstraction.
+
+Devices represent individual hardware audio interfaces or audio ports on the host platform. Devices have names and certain capabilities such as supported sample rates and the number of supported input and output channels. PortAudio provides functions to enumerate available Devices and to query for Device capabilities.
+
+Streams manage active audio input and output from and to Devices. Streams may be half duplex (input or output) or full duplex (simultaneous input and output). Streams operate at a specific sample rate with particular sample formats, buffer sizes and internal buffering latencies. You specify these parameters when you open the Stream. Audio data is communicated between a Stream and your application via a user provided asynchronous callback function or by invoking synchronous read and write functions.
+
+PortAudio supports audio input and output in a variety of sample formats: 8, 16, 24 and 32 bit integer formats and 32 bit floating point, irrespective of the formats supported by the native audio API. PortAudio also supports multichannel buffers in both interleaved and non-interleaved (separate buffer per channel) formats and automatically performs conversion when necessary. If requested, PortAudio can clamp out-of range samples and/or dither to a native format.
+
+The PortAudio API offers the following functionality:
+- Initialize and terminate the library
+- Enumerate available Host APIs
+- Enumerate available Devices either globally, or within each Host API
+- Discover default or recommended Devices and Device settings
+- Discover Device capabilities such as supported audio data formats and sample rates
+- Create and control audio Streams to acquire audio from and output audio to Devices
+- Provide Stream timing information to support synchronising audio with other parts of your application
+- Retrieve version and error information.
+
+These functions are described in more detail below.
+
+
+@section top_level_functions Initialization, termination and utility functions
+
+The PortAudio library must be initialized before it can be used and terminated to clean up afterwards. You initialize PortAudio by calling Pa_Initialize() and clean up by calling Pa_Terminate().
+
+You can query PortAudio for version information using Pa_GetVersion() to get a numeric version number and Pa_GetVersionText() to get a string.
+
+The size in bytes of the various sample formats represented by the @ref PaSampleFormat enumeration can be obtained using Pa_GetSampleSize().
+
+Pa_Sleep() sleeps for a specified number of milliseconds. This isn't intended for use in production systems; it's provided only as a simple portable way to implement tests and examples where the main thread sleeps while audio is acquired or played by an asynchronous callback function.
+
+@section host_apis Host APIs
+
+A Host API acts as a top-level grouping for all of the Devices offered by a single native platform audio API. Each Host API has a unique type identifier, a name, zero or more Devices, and nominated default input and output Devices.
+
+Host APIs are usually referenced by index: an integer of type @ref PaHostApiIndex that ranges between zero and Pa_GetHostApiCount() - 1. You can enumerate all available Host APIs by counting across this range.
+
+You can retrieve the index of the default Host API by calling Pa_GetDefaultHostApi().
+
+Information about a Host API, such as it's name and default devices, is stored in a @ref PaHostApiInfo structure. You can retrieve a pointer to a particular Host API's @ref PaHostApiInfo structure by calling Pa_GetHostApiInfo() with the Host API's index as a parameter.
+
+Most PortAudio functions reference Host APIs by @ref PaHostApiIndex indices. Each Host API also has a unique type identifier defined in the @ref PaHostApiTypeId enumeration.
+You can call Pa_HostApiTypeIdToHostApiIndex() to retrieve the current @ref PaHostApiIndex for a particular @ref PaHostApiTypeId.
+
+@section devices Devices
+
+A Device represents an audio endpoint provided by a particular native audio API. This usually corresponds to a specific input or output port on a hardware audio interface, or to the interface as a whole. Each Host API operates independently, so a single physical audio port may be addressable via different Devices exposed by different Host APIs.
+
+A Device has a name, is associated with a Host API, and has a maximum number of supported input and output channels. PortAudio provides recommended default latency values and a default sample rate for each Device. To obtain more detailed information about device capabilities you can call Pa_IsFormatSupported() to query whether it is possible to open a Stream using particular Devices, parameters and sample rate.
+
+Although each Device conceptually belongs to a specific Host API, most PortAudio functions and data structures refer to Devices using a global, Host API-independent index of type @ref PaDeviceIndex – an integer of that ranges between zero and Pa_GetDeviceCount() - 1. The reasons for this are partly historical but it also makes it easy for applications to ignore the Host API abstraction and just work with Devices and Streams.
+
+If you want to enumerate Devices belonging to a particular Host API you can count between 0 and PaHostApiInfo::deviceCount - 1. You can convert this Host API-specific index value to a global @ref PaDeviceIndex value by calling Pa_HostApiDeviceIndexToDeviceIndex().
+
+Information about a Device is stored in a @ref PaDeviceInfo structure. You can retrieve a pointer to a Devices's @ref PaDeviceInfo structure by calling Pa_GetDeviceInfo() with the Device's index as a parameter.
+
+You can retrieve the indices of the global default input and output devices using Pa_GetDefaultInputDevice() and Pa_GetDefaultOutputDevice(). Default Devices for each Host API are stored in the Host API's @ref PaHostApiInfo structures.
+
+For an example of enumerating devices and printing information about their capabilities see the pa_devs.c program in the test directory of the PortAudio distribution.
+
+@section streams Streams
+
+A Stream represents an active flow of audio data between your application and one or more audio Devices. A Stream operates at a specific sample rate with specific sample formats and buffer sizes.
+
+@subsection io_methods I/O Methods: callback and read/write
+
+PortAudio offers two methods for communicating audio data between an open Stream and your Application: (1) an asynchronous callback interface, where PortAudio calls a user defined callback function when new audio data is available or required, and (2) synchronous read and write functions which can be used in a blocking or non-blocking manner. You choose between the two methods when you open a Stream. The two methods are discussed in more detail below.
+
+@subsection opening_and_closing_streams Opening and Closing Streams
+
+You call Pa_OpenStream() to open a Stream, specifying the Device(s) to use, the number of input and output channels, sample formats, suggested latency values and flags that control dithering, clipping and overflow handling. You specify many of these parameters in two PaStreamParameters structures, one for input and one for output. If you're using the callback I/O method you also pass a callback buffer size, callback function pointer and user data pointer.
+
+Devices may be full duplex (supporting simultaneous input and output) or half duplex (supporting input or output) – usually this reflects the structure of the underlying native audio API. When opening a Stream you can specify one full duplex Device for both input and output, or two different Devices for input and output. Some Host APIs only support full-duplex operation with a full-duplex device (e.g. ASIO) but most are able to aggregate two half duplex devices into a full duplex Stream. PortAudio requires that all devices specified in a call to Pa_OpenStream() belong to the same Host API.
+
+A successful call to Pa_OpenStream() creates a pointer to a @ref PaStream – an opaque handle representing the open Stream. All PortAudio API functions that operate on open Streams take a pointer to a @ref PaStream as their first parameter.
+
+PortAudio also provides Pa_OpenDefaultStream() – a simpler alternative to Pa_OpenStream() which you can use when you want to open the default audio Device(s) with default latency parameters.
+
+You call Pa_CloseStream() to close a Stream when you've finished using it.
+
+@subsection starting_and_stopping_streams Starting and Stopping Streams
+
+Newly opened Streams are initially stopped. You call Pa_StartStream() to start a Stream. You can stop a running Stream using Pa_StopStream() or Pa_AbortStream() (the Stop function plays out all internally queued audio data, while Abort tries to stop as quickly as possible). An open Stream can be started and stopped multiple times. You can call Pa_IsStreamStopped() to query whether a Stream is running or stopped.
+
+By calling Pa_SetStreamFinishedCallback() it is possible to register a special @ref PaStreamFinishedCallback that will be called when the Stream has completed playing any internally queued buffers. This can be used in conjunction with the @ref paComplete stream callback return value (see below) to avoid blocking on a call to Pa_StopStream() while queued audio data is still playing.
+
+@subsection callback_io_method The Callback I/O Method
+
+So-called 'callback Streams' operate by periodically invoking a callback function you supply to Pa_OpenStream(). The callback function must implement the @ref PaStreamCallback signature. It gets called by PortAudio every time PortAudio needs your application to consume or produce audio data. The callback is passed pointers to buffers containing the audio to process. The format (interleave, sample data type) and size of these buffers is determined by the parameters passed to Pa_OpenStream() when the Stream was opened.
+
+Stream callbacks usually return @ref paContinue to indicate that PortAudio should keep the stream running. It is possible to deactivate a Stream from the stream callback by returning either @ref paComplete or @ref paAbort. In this case the Stream enters a deactivated state after the last buffer has finished playing (@ref paComplete) or as soon as possible (@ref paAbort). You can detect the deactivated state by calling Pa_IsStreamActive() or by using Pa_SetStreamFinishedCallback() to subscribe to a stream finished notification. Note that even if the stream callback returns @ref paComplete it's still necessary to call Pa_StopStream() or Pa_AbortStream() to enter the stopped state.
+
+Many of the tests in the /tests directory of the PortAudio distribution implement PortAudio stream callbacks. For example see: patest_sine.c (audio output), patest_record.c (audio input), patest_wire.c (audio pass-through) and pa_fuzz.c (simple audio effects processing).
+
+IMPORTANT: The stream callback function often needs to operate with very high or real-time priority. As a result there are strict requirements placed on the type of code that can be executed in a stream callback. In general this means avoiding any code that might block, including: acquiring locks, calling OS API functions including allocating memory. With the exception of Pa_GetStreamCpuLoad() you may not call PortAudio API functions from within the stream callback.
+
+@subsection read_write_io_method The Read/Write I/O Method
+
+As an alternative to the callback I/O method, PortAudio provides a synchronous read/write interface for acquiring and playing audio. This can be useful for applications that don't require the lowest possibly latency, or don't warrant the increased complexity of synchronising with an asynchronous callback funciton. This I/O method is also useful when calling PortAudio from programming languages that don't support asynchronous callbacks.
+
+To open a Stream in read/write mode you pass a NULL stream callback function pointer to Pa_OpenStream().
+
+To write audio data to a Stream call Pa_WriteStream() and to read data call Pa_ReadStream(). These functions will block if the internal buffers are full, making them safe to call in a tight loop. If you want to avoid blocking you can query the amount of available read or write space using Pa_GetStreamReadAvailable() or Pa_GetStreamWriteAvailable() and use the returned values to limit the amount of data you read or write.
+
+For examples of the read/write I/O method see the following examples in the /tests directory of the PortAudio distribution: patest_read_record.c (audio input), patest_write_sine.c (audio output), patest_read_write_wire.c (audio pass-through).
+
+@subsection stream_info Retrieving Stream Information
+
+You can retrieve information about an open Stream by calling Pa_GetStreamInfo(). This returns a @ref PaStreamInfo structure containing the actual input and output latency and sample rate of the stream. It's possible for these values to be different from the suggested values passed to Pa_OpenStream().
+
+When using a callback stream you can call Pa_GetStreamCpuLoad() to retrieve a rough estimate of the amount of CPU time your callback function is using.
+
+@subsection stream_timing Stream Timing Information
+
+When using the callback I/O method your stream callback function receives timing information via a pointer to a PaStreamCallbackTimeInfo structure. This structure contains the current time along with the estimated hardware capture and playback time of the first sample of the input and output buffers. All times are measured in seconds relative to a Stream-specific clock. The current Stream clock time can be retrieved using Pa_GetStreamTime().
+
+You can use the stream callback @ref PaStreamCallbackTimeInfo times in conjunction with timestamps returned by Pa_GetStreamTime() to implement time synchronization schemes such as time aligning your GUI display with rendered audio, or maintaining synchronization between MIDI and audio playback.
+
+@section error_handling Error Handling
+
+Most PortAudio functions return error codes using values from the @ref PaError enumeration. All error codes are negative values. Some functions return values greater than or equal to zero for normal results and a negative error code in case of error.
+
+You can convert @ref PaError error codes to human readable text by calling Pa_GetErrorText().
+
+PortAudio usually tries to translate error conditions into portable @ref PaError error codes. However if an unexpected error is encountered the @ref paUnanticipatedHostError code may be returned. In this case a further mechanism is provided to query for Host API-specific error information. If PortAudio returns @ref paUnanticipatedHostError you can call Pa_GetLastHostErrorInfo() to retrieve a pointer to a @ref PaHostErrorInfo structure that provides more information, including the Host API that encountered the error, a native API error code and error text.
+
+@section host_api_extensions Host API and Platform-specific Extensions
+
+The public PortAudio API only exposes functionality that can be provided across all target platforms. In some cases individual native audio APIs offer unique functionality. Some PortAudio Host APIs expose this functionality via Host API-specific extensions. Examples include access to low-level buffering and priority parameters, opening a Stream with only a subset of a Device's channels, or accessing channel metadata such as channel names.
+
+Host API-specific extensions are provided in the form of additional functions and data structures defined in Host API-specific header files found in the /include directory.
+
+The @ref PaStreamParameters structure passed to Pa_IsFormatSupported() and Pa_OpenStream() has a field named @ref PaStreamParameters::hostApiSpecificStreamInfo that is sometimes used to pass low level information when opening a Stream.
+
+See the documentation for the individual Host API-specific header files for details of the extended functionality they expose:
+
+- pa_asio.h
+- pa_jack.h
+- pa_linux_alsa.h
+- pa_mac_core.h
+- pa_win_ds.h
+- pa_win_wasapi.h
+- pa_win_wmme.h
+- pa_win_waveformat.h
+
*/
\ No newline at end of file
diff --git a/doc/src/license.dox b/doc/src/license.dox
index 31724b6..8d0c51f 100644
--- a/doc/src/license.dox
+++ b/doc/src/license.dox
@@ -1,38 +1,38 @@
-/** @page License PortAudio License
-
-PortAudio Portable Real-Time Audio Library
-Copyright (c) 1999-2011 Ross Bencina, Phil Burk
-
-
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files
-(the "Software"), to deal in the Software without restriction,
-including without limitation the rights to use, copy, modify, merge,
-publish, distribute, sublicense, and/or sell copies of the Software,
-and to permit persons to whom the Software is furnished to do so,
-subject to the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
-ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-
-
-The text above constitutes the entire PortAudio license; however,
-the PortAudio community also makes the following non-binding requests:
-
-Any person wishing to distribute modifications to the Software is
-requested to send the modifications to the original developer so that
-they can be incorporated into the canonical version. It is also
-requested that these non-binding requests be included along with the
-license above.
-
+/** @page License PortAudio License
+
+PortAudio Portable Real-Time Audio Library
+Copyright (c) 1999-2011 Ross Bencina, Phil Burk
+
+
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files
+(the "Software"), to deal in the Software without restriction,
+including without limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of the Software,
+and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+
+
+The text above constitutes the entire PortAudio license; however,
+the PortAudio community also makes the following non-binding requests:
+
+Any person wishing to distribute modifications to the Software is
+requested to send the modifications to the original developer so that
+they can be incorporated into the canonical version. It is also
+requested that these non-binding requests be included along with the
+license above.
+
*/
\ No newline at end of file
diff --git a/doc/src/mainpage.dox b/doc/src/mainpage.dox
index 9905d87..4af01dd 100644
--- a/doc/src/mainpage.dox
+++ b/doc/src/mainpage.dox
@@ -1,64 +1,64 @@
-/* doxygen index page */
-/** @mainpage
-
-@section overview Overview
-
-PortAudio is a cross-platform, open-source C language library for real-time audio input and output.
-The library provides functions that allow your software to acquire and output real-time audio streams from your computer's hardware audio interfaces. It is designed to simplify writing cross-platform audio applications, and also to simplify the development of audio software in general by hiding the complexities of dealing directly with each native audio API. PortAudio is used to implement sound recording, editing and mixing applications, software synthesizers, effects processors, music players, internet telephony applications, software defined radios and more. Supported platforms include MS Windows, Mac OS X and Linux. Third-party language bindings make it possible to call PortAudio from other programming languages including @ref java_binding "Java", C++, C#, Python, PureBasic, FreePascal and Lazarus.
-
-@section start_here Start here
-
-- @ref api_overview
-A top-down view of the PortAudio API, its capabilities, functions and data structures
-
-- @ref tutorial_start
-Get started writing code with PortAudio tutorials
-
-- @ref examples_src "Examples"
-Simple example programs demonstrating PortAudio usage
-
-- @ref License
-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.
-
-
-@section reference API Reference
-
-- portaudio.h Portable API
-Detailed documentation for each portable API function and data type
-
-- @ref public_header "Host API Specific Extensions"
-Documentation for non-portable platform-specific host API extensions
-
-
-@section resources Resources
-
-- The PortAudio website
-
-- Our mailing list for users and developers
-
-- The PortAudio wiki
-
-- @ref java_binding
-Documentation for the Java JNI interface to PortAudio
-
-@section developer_resources Developer Resources
-
-@if INTERNAL
-- @ref srcguide
-@endif
-
-- Our wiki and issue tracking system
-
-- Developer guidelines
-
-- Implementation style guidelines
-
-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.
-
-
-@section older_api_versions Older API Versions
-
-This documentation covers the current API version: PortAudio V19, API version 2.0. API 2.0 differs in a number of ways from previous versions (most often encountered in PortAudio V18), please consult the enhancement proposals for details of what was added/changed for V19:
-http://www.portaudio.com/docs/proposals/index.html
-
+/* doxygen index page */
+/** @mainpage
+
+@section overview Overview
+
+PortAudio is a cross-platform, open-source C language library for real-time audio input and output.
+The library provides functions that allow your software to acquire and output real-time audio streams from your computer's hardware audio interfaces. It is designed to simplify writing cross-platform audio applications, and also to simplify the development of audio software in general by hiding the complexities of dealing directly with each native audio API. PortAudio is used to implement sound recording, editing and mixing applications, software synthesizers, effects processors, music players, internet telephony applications, software defined radios and more. Supported platforms include MS Windows, Mac OS X and Linux. Third-party language bindings make it possible to call PortAudio from other programming languages including @ref java_binding "Java", C++, C#, Python, PureBasic, FreePascal and Lazarus.
+
+@section start_here Start here
+
+- @ref api_overview
+A top-down view of the PortAudio API, its capabilities, functions and data structures
+
+- @ref tutorial_start
+Get started writing code with PortAudio tutorials
+
+- @ref examples_src "Examples"
+Simple example programs demonstrating PortAudio usage
+
+- @ref License
+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.
+
+
+@section reference API Reference
+
+- portaudio.h Portable API
+Detailed documentation for each portable API function and data type
+
+- @ref public_header "Host API Specific Extensions"
+Documentation for non-portable platform-specific host API extensions
+
+
+@section resources Resources
+
+- The PortAudio website
+
+- Our mailing list for users and developers
+
+- The PortAudio wiki
+
+- @ref java_binding
+Documentation for the Java JNI interface to PortAudio
+
+@section developer_resources Developer Resources
+
+@if INTERNAL
+- @ref srcguide
+@endif
+
+- Our wiki and issue tracking system
+
+- Developer guidelines
+
+- Implementation style guidelines
+
+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.
+
+
+@section older_api_versions Older API Versions
+
+This documentation covers the current API version: PortAudio V19, API version 2.0. API 2.0 differs in a number of ways from previous versions (most often encountered in PortAudio V18), please consult the enhancement proposals for details of what was added/changed for V19:
+http://www.portaudio.com/docs/proposals/index.html
+
*/
\ No newline at end of file
diff --git a/doc/src/srcguide.dox b/doc/src/srcguide.dox
index c13babf..26fd941 100644
--- a/doc/src/srcguide.dox
+++ b/doc/src/srcguide.dox
@@ -1,55 +1,55 @@
-/*
- define all of the file groups used to structure the documentation.
-*/
-
-/**
- @defgroup public_header Public API definitions for users of PortAudio
-*/
-
-/**
- @internal
- @defgroup common_src Source code common to all implementations
-*/
-
-/**
- @internal
- @defgroup win_src Source code common to all Windows implementations
-*/
-
-/**
- @internal
- @defgroup unix_src Source code common to all Unix implementations
-*/
-
-/**
- @internal
- @defgroup macosx_src Source code common to all Macintosh implementations
-*/
-
-/**
- @internal
- @defgroup hostapi_src Source code for specific Host APIs
-*/
-
-/**
- @internal
- @defgroup test_src Test programs
-*/
-
-/**
- @defgroup examples_src Example programs demonstrating PortAudio usage
-*/
-
-/**
- @internal
- @page srcguide A guide to the PortAudio sources
-
- - \ref public_header
- - \ref examples_src
- - \ref common_src
- - \ref win_src
- - \ref unix_src
- - \ref macosx_src
- - \ref hostapi_src
- - \ref test_src
+/*
+ define all of the file groups used to structure the documentation.
+*/
+
+/**
+ @defgroup public_header Public API definitions for users of PortAudio
+*/
+
+/**
+ @internal
+ @defgroup common_src Source code common to all implementations
+*/
+
+/**
+ @internal
+ @defgroup win_src Source code common to all Windows implementations
+*/
+
+/**
+ @internal
+ @defgroup unix_src Source code common to all Unix implementations
+*/
+
+/**
+ @internal
+ @defgroup macosx_src Source code common to all Macintosh implementations
+*/
+
+/**
+ @internal
+ @defgroup hostapi_src Source code for specific Host APIs
+*/
+
+/**
+ @internal
+ @defgroup test_src Test programs
+*/
+
+/**
+ @defgroup examples_src Example programs demonstrating PortAudio usage
+*/
+
+/**
+ @internal
+ @page srcguide A guide to the PortAudio sources
+
+ - \ref public_header
+ - \ref examples_src
+ - \ref common_src
+ - \ref win_src
+ - \ref unix_src
+ - \ref macosx_src
+ - \ref hostapi_src
+ - \ref test_src
*/
\ No newline at end of file
diff --git a/doc/src/tutorial/blocking_read_write.dox b/doc/src/tutorial/blocking_read_write.dox
index 558be7e..8905ee3 100644
--- a/doc/src/tutorial/blocking_read_write.dox
+++ b/doc/src/tutorial/blocking_read_write.dox
@@ -1,68 +1,68 @@
-/** @page blocking_read_write Blocking Read/Write Functions
-@ingroup tutorial
-
-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.
-
-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.
-
-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.
-
-@code
- /* -- initialize PortAudio -- */
- err = Pa_Initialize();
- if( err != paNoError ) goto error;
-
- /* -- setup input and output -- */
- inputParameters.device = Pa_GetDefaultInputDevice(); /* default input device */
- inputParameters.channelCount = NUM_CHANNELS;
- inputParameters.sampleFormat = PA_SAMPLE_TYPE;
- inputParameters.suggestedLatency = Pa_GetDeviceInfo( inputParameters.device )->defaultHighInputLatency ;
- inputParameters.hostApiSpecificStreamInfo = NULL;
-
- outputParameters.device = Pa_GetDefaultOutputDevice(); /* default output device */
- outputParameters.channelCount = NUM_CHANNELS;
- outputParameters.sampleFormat = PA_SAMPLE_TYPE;
- outputParameters.suggestedLatency = Pa_GetDeviceInfo( outputParameters.device )->defaultHighOutputLatency;
- outputParameters.hostApiSpecificStreamInfo = NULL;
-
- /* -- setup stream -- */
- err = Pa_OpenStream(
- &stream,
- &inputParameters,
- &outputParameters,
- SAMPLE_RATE,
- FRAMES_PER_BUFFER,
- paClipOff, /* we won't output out of range samples so don't bother clipping them */
- NULL, /* no callback, use blocking API */
- NULL ); /* no callback, so no callback userData */
- if( err != paNoError ) goto error;
-
- /* -- start stream -- */
- err = Pa_StartStream( stream );
- if( err != paNoError ) goto error;
- printf("Wire on. Will run one minute.\n"); fflush(stdout);
-
- /* -- Here's the loop where we pass data from input to output -- */
- for( i=0; i<(60*SAMPLE_RATE)/FRAMES_PER_BUFFER; ++i )
- {
- err = Pa_WriteStream( stream, sampleBlock, FRAMES_PER_BUFFER );
- if( err ) goto xrun;
- err = Pa_ReadStream( stream, sampleBlock, FRAMES_PER_BUFFER );
- if( err ) goto xrun;
- }
- /* -- Now we stop the stream -- */
- err = Pa_StopStream( stream );
- if( err != paNoError ) goto error;
-
- /* -- don't forget to cleanup! -- */
- err = Pa_CloseStream( stream );
- if( err != paNoError ) goto error;
-
- Pa_Terminate();
- return 0;
-@endcode
-
-
-Previous: \ref querying_devices | Next: \ref exploring
-
+/** @page blocking_read_write Blocking Read/Write Functions
+@ingroup tutorial
+
+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.
+
+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.
+
+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.
+
+@code
+ /* -- initialize PortAudio -- */
+ err = Pa_Initialize();
+ if( err != paNoError ) goto error;
+
+ /* -- setup input and output -- */
+ inputParameters.device = Pa_GetDefaultInputDevice(); /* default input device */
+ inputParameters.channelCount = NUM_CHANNELS;
+ inputParameters.sampleFormat = PA_SAMPLE_TYPE;
+ inputParameters.suggestedLatency = Pa_GetDeviceInfo( inputParameters.device )->defaultHighInputLatency ;
+ inputParameters.hostApiSpecificStreamInfo = NULL;
+
+ outputParameters.device = Pa_GetDefaultOutputDevice(); /* default output device */
+ outputParameters.channelCount = NUM_CHANNELS;
+ outputParameters.sampleFormat = PA_SAMPLE_TYPE;
+ outputParameters.suggestedLatency = Pa_GetDeviceInfo( outputParameters.device )->defaultHighOutputLatency;
+ outputParameters.hostApiSpecificStreamInfo = NULL;
+
+ /* -- setup stream -- */
+ err = Pa_OpenStream(
+ &stream,
+ &inputParameters,
+ &outputParameters,
+ SAMPLE_RATE,
+ FRAMES_PER_BUFFER,
+ paClipOff, /* we won't output out of range samples so don't bother clipping them */
+ NULL, /* no callback, use blocking API */
+ NULL ); /* no callback, so no callback userData */
+ if( err != paNoError ) goto error;
+
+ /* -- start stream -- */
+ err = Pa_StartStream( stream );
+ if( err != paNoError ) goto error;
+ printf("Wire on. Will run one minute.\n"); fflush(stdout);
+
+ /* -- Here's the loop where we pass data from input to output -- */
+ for( i=0; i<(60*SAMPLE_RATE)/FRAMES_PER_BUFFER; ++i )
+ {
+ err = Pa_WriteStream( stream, sampleBlock, FRAMES_PER_BUFFER );
+ if( err ) goto xrun;
+ err = Pa_ReadStream( stream, sampleBlock, FRAMES_PER_BUFFER );
+ if( err ) goto xrun;
+ }
+ /* -- Now we stop the stream -- */
+ err = Pa_StopStream( stream );
+ if( err != paNoError ) goto error;
+
+ /* -- don't forget to cleanup! -- */
+ err = Pa_CloseStream( stream );
+ if( err != paNoError ) goto error;
+
+ Pa_Terminate();
+ return 0;
+@endcode
+
+
+Previous: \ref querying_devices | Next: \ref exploring
+
*/
\ No newline at end of file
diff --git a/doc/src/tutorial/compile_cmake.dox b/doc/src/tutorial/compile_cmake.dox
index ce83108..ddf5eae 100644
--- a/doc/src/tutorial/compile_cmake.dox
+++ b/doc/src/tutorial/compile_cmake.dox
@@ -1,29 +1,29 @@
-/** @page compile_cmake Creating MSVC Build Files via CMake
-@ingroup tutorial
-
-This is a simple "How-to" for creating build files for Microsoft Visual C++ via CMake and the CMakeLists.txt file
-
-1. Install CMake if you haven't got it already ([http://www.cmake.org], minimum version required is 2.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
-
-3. Run the CMake GUI application and browse to source files directory and build directory:
- a. The source files directory ("Where is the source code") is where the portaudio CMakeLists.txt file is located.
- 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
- source files tree (a so called "out-of-source build")
-
-4. Click Configure. This will prompt you to select which build files to generate. Note Only Microsoft Visual C++ build files currently supported!
-
-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)
-
-6. Click Generate and you'll now (hopefully) have your VS build files in your previously defined build directory.
-
-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.
-
-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)
-
---- Robert Bielik
-
-Back to the Tutorial: \ref tutorial_start
-
+/** @page compile_cmake Creating MSVC Build Files via CMake
+@ingroup tutorial
+
+This is a simple "How-to" for creating build files for Microsoft Visual C++ via CMake and the CMakeLists.txt file
+
+1. Install CMake if you haven't got it already ([http://www.cmake.org], minimum version required is 2.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
+
+3. Run the CMake GUI application and browse to source files directory and build directory:
+ a. The source files directory ("Where is the source code") is where the portaudio CMakeLists.txt file is located.
+ 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
+ source files tree (a so called "out-of-source build")
+
+4. Click Configure. This will prompt you to select which build files to generate. Note Only Microsoft Visual C++ build files currently supported!
+
+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)
+
+6. Click Generate and you'll now (hopefully) have your VS build files in your previously defined build directory.
+
+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.
+
+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)
+
+--- Robert Bielik
+
+Back to the Tutorial: \ref tutorial_start
+
*/
\ No newline at end of file
diff --git a/doc/src/tutorial/compile_linux.dox b/doc/src/tutorial/compile_linux.dox
index 649a3fe..e227d75 100644
--- a/doc/src/tutorial/compile_linux.dox
+++ b/doc/src/tutorial/compile_linux.dox
@@ -1,83 +1,83 @@
-/** @page compile_linux Building Portaudio for Linux
-@ingroup tutorial
-
-Note: this page has not been reviewed, and may contain errors.
-
-@section comp_linux1 Installing ALSA Development Kit
-
-The OSS sound API is very old and not well supported. It is recommended that you use the ALSA sound API.
-The PortAudio configure script will look for the ALSA SDK. You can install the ALSA SDK on Ubuntu using:
-
-@code
-sudo apt-get install libasound-dev
-@endcode
-
-You might need to use yum, or some other package manager, instead of apt-get on your machine.
-If you do not install ALSA then you might get a message when testing that says you have no audio devices.
-
-You can find out more about ALSA here: http://www.alsa-project.org/
-
-@section comp_linux2 Configuring and Compiling PortAudio
-
-You can build PortAudio in Linux Environments using the standard configure/make tools:
-
-@code
-./configure && make
-@endcode
-
-That will build PortAudio using Jack, ALSA and OSS in whatever combination they are found on your system. For example, if you have Jack and OSS but not ALSA, it will build using Jack and OSS but not ALSA. This step also builds a number of tests, which can be found in the bin directory of PortAudio. It's a good idea to run some of these tests to make sure PortAudio is working correctly.
-
-@section comp_linux3 Using PortAudio in your Projects
-
-To use PortAudio in your apps, you can simply install the .so files:
-
-@code
-sudo make install
-@endcode
-
-Projects built this way will expect PortAudio to be installed on target systems in order to run. If you want to build a more self-contained binary, you may use the libportaudio.a file:
-
-@code
-cp lib/.libs/libportaudio.a /YOUR/PROJECT/DIR
-@endcode
-
-On some systems you may need to use:
-
-@code
-cp /usr/local/lib/libportaudio.a /YOUR/PROJECT/DIR
-@endcode
-
-You may also need to copy portaudio.h, located in the include/ directory of PortAudio into your project. Note that you will usually need to link with the approriate libraries that you used, such as ALSA and JACK, as well as with librt and libpthread. For example:
-
-@code
-gcc main.c libportaudio.a -lrt -lm -lasound -ljack -pthread -o YOUR_BINARY
-@endcode
-
-@section comp_linux4 Linux Extensions
-
-Note that the ALSA PortAudio back-end adds a few extensions to the standard API that you may take advantage of. To use these functions be sure to include the pa_linux_alsa.h file found in the include file in the PortAudio folder. This file contains further documentation on the following functions:
-
- PaAlsaStreamInfo/PaAlsa_InitializeStreamInfo::
- Objects of the !PaAlsaStreamInfo type may be used for the !hostApiSpecificStreamInfo attribute of a !PaStreamParameters object, in order to specify the name of an ALSA device to open directly. Specify the device via !PaAlsaStreamInfo.deviceString, after initializing the object with PaAlsa_InitializeStreamInfo.
-
- PaAlsa_EnableRealtimeScheduling::
- PA ALSA supports real-time scheduling of the audio callback thread (using the FIFO pthread scheduling policy), via the extension PaAlsa_EnableRealtimeScheduling. Call this on the stream before starting it with the enableScheduling parameter set to true or false, to enable or disable this behaviour respectively.
-
- PaAlsa_GetStreamInputCard::
- Use this function to get the ALSA-lib card index of the stream's input device.
-
- PaAlsa_GetStreamOutputCard::
- Use this function to get the ALSA-lib card index of the stream's output device.
-
-Of particular importance is PaAlsa_EnableRealtimeScheduling, which allows ALSA to run at a high priority to prevent ordinary processes on the system from preempting audio playback. Without this, low latency audio playback will be irregular and will contain frequent drop-outs.
-
-@section comp_linux5 Linux Debugging
-
-Eliot Blennerhassett writes:
-
-On linux build, use e.g. "libtool gdb bin/patest_sine8" to debug that program.
-This is because on linux bin/patest_sine8 is a libtool shell script that wraps
-bin/.libs/patest_sine8 and allows it to find the appropriate libraries within
-the build tree.
-
+/** @page compile_linux Building Portaudio for Linux
+@ingroup tutorial
+
+Note: this page has not been reviewed, and may contain errors.
+
+@section comp_linux1 Installing ALSA Development Kit
+
+The OSS sound API is very old and not well supported. It is recommended that you use the ALSA sound API.
+The PortAudio configure script will look for the ALSA SDK. You can install the ALSA SDK on Ubuntu using:
+
+@code
+sudo apt-get install libasound-dev
+@endcode
+
+You might need to use yum, or some other package manager, instead of apt-get on your machine.
+If you do not install ALSA then you might get a message when testing that says you have no audio devices.
+
+You can find out more about ALSA here: http://www.alsa-project.org/
+
+@section comp_linux2 Configuring and Compiling PortAudio
+
+You can build PortAudio in Linux Environments using the standard configure/make tools:
+
+@code
+./configure && make
+@endcode
+
+That will build PortAudio using Jack, ALSA and OSS in whatever combination they are found on your system. For example, if you have Jack and OSS but not ALSA, it will build using Jack and OSS but not ALSA. This step also builds a number of tests, which can be found in the bin directory of PortAudio. It's a good idea to run some of these tests to make sure PortAudio is working correctly.
+
+@section comp_linux3 Using PortAudio in your Projects
+
+To use PortAudio in your apps, you can simply install the .so files:
+
+@code
+sudo make install
+@endcode
+
+Projects built this way will expect PortAudio to be installed on target systems in order to run. If you want to build a more self-contained binary, you may use the libportaudio.a file:
+
+@code
+cp lib/.libs/libportaudio.a /YOUR/PROJECT/DIR
+@endcode
+
+On some systems you may need to use:
+
+@code
+cp /usr/local/lib/libportaudio.a /YOUR/PROJECT/DIR
+@endcode
+
+You may also need to copy portaudio.h, located in the include/ directory of PortAudio into your project. Note that you will usually need to link with the approriate libraries that you used, such as ALSA and JACK, as well as with librt and libpthread. For example:
+
+@code
+gcc main.c libportaudio.a -lrt -lm -lasound -ljack -pthread -o YOUR_BINARY
+@endcode
+
+@section comp_linux4 Linux Extensions
+
+Note that the ALSA PortAudio back-end adds a few extensions to the standard API that you may take advantage of. To use these functions be sure to include the pa_linux_alsa.h file found in the include file in the PortAudio folder. This file contains further documentation on the following functions:
+
+ PaAlsaStreamInfo/PaAlsa_InitializeStreamInfo::
+ Objects of the !PaAlsaStreamInfo type may be used for the !hostApiSpecificStreamInfo attribute of a !PaStreamParameters object, in order to specify the name of an ALSA device to open directly. Specify the device via !PaAlsaStreamInfo.deviceString, after initializing the object with PaAlsa_InitializeStreamInfo.
+
+ PaAlsa_EnableRealtimeScheduling::
+ PA ALSA supports real-time scheduling of the audio callback thread (using the FIFO pthread scheduling policy), via the extension PaAlsa_EnableRealtimeScheduling. Call this on the stream before starting it with the enableScheduling parameter set to true or false, to enable or disable this behaviour respectively.
+
+ PaAlsa_GetStreamInputCard::
+ Use this function to get the ALSA-lib card index of the stream's input device.
+
+ PaAlsa_GetStreamOutputCard::
+ Use this function to get the ALSA-lib card index of the stream's output device.
+
+Of particular importance is PaAlsa_EnableRealtimeScheduling, which allows ALSA to run at a high priority to prevent ordinary processes on the system from preempting audio playback. Without this, low latency audio playback will be irregular and will contain frequent drop-outs.
+
+@section comp_linux5 Linux Debugging
+
+Eliot Blennerhassett writes:
+
+On linux build, use e.g. "libtool gdb bin/patest_sine8" to debug that program.
+This is because on linux bin/patest_sine8 is a libtool shell script that wraps
+bin/.libs/patest_sine8 and allows it to find the appropriate libraries within
+the build tree.
+
*/
\ No newline at end of file
diff --git a/doc/src/tutorial/compile_mac_coreaudio.dox b/doc/src/tutorial/compile_mac_coreaudio.dox
index 63ae500..e16ce33 100644
--- a/doc/src/tutorial/compile_mac_coreaudio.dox
+++ b/doc/src/tutorial/compile_mac_coreaudio.dox
@@ -1,122 +1,122 @@
-/** @page compile_mac_coreaudio Building Portaudio for Mac OS X
-@ingroup tutorial
-
-@section comp_mac_ca_1 Requirements
-
-* OS X 10.4 or later. PortAudio v19 currently only compiles and runs on OS X version 10.4 or later. Because of its heavy reliance on memory barriers, it's not clear how easy it would be to back-port PortAudio to OS X version 10.3. Leopard support requires the 2007 snapshot or later.
-
-* Apple's Xcode and its related tools installed in the default location. There is no Xcode project for PortAudio.
-
-* Mac 10.4 SDK. Look for "/Developer/SDKs/MacOSX10.4u.sdk" folder on your system. It may be installed with XCode. If not then you can download it from Apple Developer Connection. http://connect.apple.com/
-
-@section comp_mac_ca_2 Building
-
-To build PortAudio, simply use the Unix-style "./configure && make":
-
-@code
- ./configure && make
-@endcode
-
-You do not need to do "make install", and we don't recommend it; however, you may be using software that instructs you to do so, in which case you should follow those instructions. (Note from Phil: I had to do "sudo make install" after the command above, otherwise XCode complained that it could not find "/usr/local/lib/libportaudio.dylib" when I compiled an example.)
-
-The result of these steps will be a file named "libportaudio.dylib" in the directory "usr/local/lib/".
-
-By default, this will create universal binaries and therefore requires the Universal SDK from Apple, included with XCode 2.1 and higher.
-
-@section comp_mac_ca_3 Other Build Options
-
-There are a variety of other options for building PortAudio. The default described above is recommended as it is the most supported and tested; however, your needs may differ and require other options, which are described below.
-
-@subsection comp_mac_ca_3.1 Building Non-Universal Libraries
-
-By default, PortAudio is built as a universal binary. This includes 64-bit versions if you are compiling on 10.5, Leopard. If you want a "thin", or single architecture library, you have two options:
-
- * build a non-universal library using configure options.
- * use lipo(1) on whatever part of the library you plan to use.
-
-Note that the first option may require an extremely recent version of PortAudio (February 5th '08 at least).
-
-@subsection comp_mac_ca_3.2 Building with --disable-mac-universal
-
-To build a non-universal library for the host architecture, simply use the --disable-mac-universal option with configure.
-
-@code
- ./configure --disable-mac-universal && make
-@endcode
-
-The --disable-mac-universal option may also be used in conjunction with environment variables to give you more control over the universal binary build process. For example, to build a universal binary for the i386 and ppc architectures using the 10.4u sdk (which is the default on 10.4, but not 10.5), you might specify this configure command line:
-
-@code
- CFLAGS="-O2 -g -Wall -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.3" \
- LDFLAGS="-arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.3" \
- ./configure --disable-mac-universal --disable-dependency-tracking
-@endcode
-
-For more info, see Apple's documentation on the matter:
-
- * http://developer.apple.com/technotes/tn2005/tn2137.html
- * http://developer.apple.com/documentation/Porting/Conceptual/PortingUnix/intro/chapter_1_section_1.html
-
-@subsection comp_mac_ca_3.3 Using lipo
-
-The second option is to build normally, and use lipo (1) to extract the architectures you want. For example, if you want a "thin", i386 library only:
-
-@code
- lipo lib/.libs/libportaudio.a -thin i386 -output libportaudio.a
-@endcode
-
-or if you want to extract a single architecture fat file:
-
-@code
- lipo lib/.libs/libportaudio.a -extract i386 -output libportaudio.a
-@endcode
-
-@subsection comp_mac_ca_3.4 Building With Debug Options
-
-By default, PortAudio on the mac is built without any debugging options. This is because asserts are generally inappropriate for a production environment and debugging information has been suspected, though not proven, to cause trouble with some interfaces. If you would like to compile with debugging, you must run configure with the appropriate flags. For example:
-
-@code
- ./configure --enable-mac-debug && make
-@endcode
-
-This will enable -g and disable -DNDEBUG which will effectively enable asserts.
-
-@section comp_mac_ca_4 Using the Library in XCode Projects
-
-If you are planning to follow the rest of the tutorial, several project types will work. You can create a "Standard Tool" under "Command Line Utility". If you are not following the rest of the tutorial, any type of project should work with PortAudio, but these instructions may not work perfectly.
-
-Once you've compiled PortAudio, the easiest and recommended way to use PortAudio in your XCode project is to add "/include/portaudio.h" and "/lib/.libs/libportaudio.a" to your project. Because "/lib/.libs/" is a hidden directory, you won't be able to navigate to it using the finder or the standard Mac OS file dialogs by clicking on files and folders. You can use command-shift-G in the finder to specify the exact path, or, from the shell, if you are in the portaudio directory, you can enter this command:
-
-@code
- open lib/.libs
-@endcode
-
-Then drag the "libportaudio.a" file into your XCode project and place it in the "External Frameworks and Libraries" group, if the project type has it. If not you can simply add it to the top level folder of the project.
-
-You will need to add the following frameworks to your XCode project:
-
- - CoreAudio.framework
- - AudioToolbox.framework
- - AudioUnit.framework
- - CoreServices.framework
- - Carbon.framework
-
-@section comp_mac_ca_5 Using the Library in Other Projects
-
-For gcc/Make style projects, include "include/portaudio.h" and link "libportaudio.a", and use the frameworks listed in the previous section. How you do so depends on your build.
-
-@section comp_mac_ca_6 Using Mac-only Extensions to PortAudio
-
-For additional, Mac-only extensions to the PortAudio interface, you may also want to grab "include/pa_mac_core.h". This file contains some special, mac-only features relating to sample-rate conversion, channel mapping, performance and device hogging. See "src/hostapi/coreaudio/notes.txt" for more details on these features.
-
-@section comp_mac_ca_7 What Happened to Makefile.darwin?
-
-Note, there used to be a special makefile just for darwin. This is no longer supported because you can build universal binaries from the standard configure routine. If you find this file in your directory structure it means you have an outdated version of PortAudio.
-
-@code
- make -f Makefile.darwin
-@endcode
-
-Back to the Tutorial: \ref tutorial_start
-
-*/
+/** @page compile_mac_coreaudio Building Portaudio for Mac OS X
+@ingroup tutorial
+
+@section comp_mac_ca_1 Requirements
+
+* OS X 10.4 or later. PortAudio v19 currently only compiles and runs on OS X version 10.4 or later. Because of its heavy reliance on memory barriers, it's not clear how easy it would be to back-port PortAudio to OS X version 10.3. Leopard support requires the 2007 snapshot or later.
+
+* Apple's Xcode and its related tools installed in the default location. There is no Xcode project for PortAudio.
+
+* Mac 10.4 SDK. Look for "/Developer/SDKs/MacOSX10.4u.sdk" folder on your system. It may be installed with XCode. If not then you can download it from Apple Developer Connection. http://connect.apple.com/
+
+@section comp_mac_ca_2 Building
+
+To build PortAudio, simply use the Unix-style "./configure && make":
+
+@code
+ ./configure && make
+@endcode
+
+You do not need to do "make install", and we don't recommend it; however, you may be using software that instructs you to do so, in which case you should follow those instructions. (Note from Phil: I had to do "sudo make install" after the command above, otherwise XCode complained that it could not find "/usr/local/lib/libportaudio.dylib" when I compiled an example.)
+
+The result of these steps will be a file named "libportaudio.dylib" in the directory "usr/local/lib/".
+
+By default, this will create universal binaries and therefore requires the Universal SDK from Apple, included with XCode 2.1 and higher.
+
+@section comp_mac_ca_3 Other Build Options
+
+There are a variety of other options for building PortAudio. The default described above is recommended as it is the most supported and tested; however, your needs may differ and require other options, which are described below.
+
+@subsection comp_mac_ca_3.1 Building Non-Universal Libraries
+
+By default, PortAudio is built as a universal binary. This includes 64-bit versions if you are compiling on 10.5, Leopard. If you want a "thin", or single architecture library, you have two options:
+
+ * build a non-universal library using configure options.
+ * use lipo(1) on whatever part of the library you plan to use.
+
+Note that the first option may require an extremely recent version of PortAudio (February 5th '08 at least).
+
+@subsection comp_mac_ca_3.2 Building with --disable-mac-universal
+
+To build a non-universal library for the host architecture, simply use the --disable-mac-universal option with configure.
+
+@code
+ ./configure --disable-mac-universal && make
+@endcode
+
+The --disable-mac-universal option may also be used in conjunction with environment variables to give you more control over the universal binary build process. For example, to build a universal binary for the i386 and ppc architectures using the 10.4u sdk (which is the default on 10.4, but not 10.5), you might specify this configure command line:
+
+@code
+ CFLAGS="-O2 -g -Wall -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.3" \
+ LDFLAGS="-arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.3" \
+ ./configure --disable-mac-universal --disable-dependency-tracking
+@endcode
+
+For more info, see Apple's documentation on the matter:
+
+ * http://developer.apple.com/technotes/tn2005/tn2137.html
+ * http://developer.apple.com/documentation/Porting/Conceptual/PortingUnix/intro/chapter_1_section_1.html
+
+@subsection comp_mac_ca_3.3 Using lipo
+
+The second option is to build normally, and use lipo (1) to extract the architectures you want. For example, if you want a "thin", i386 library only:
+
+@code
+ lipo lib/.libs/libportaudio.a -thin i386 -output libportaudio.a
+@endcode
+
+or if you want to extract a single architecture fat file:
+
+@code
+ lipo lib/.libs/libportaudio.a -extract i386 -output libportaudio.a
+@endcode
+
+@subsection comp_mac_ca_3.4 Building With Debug Options
+
+By default, PortAudio on the mac is built without any debugging options. This is because asserts are generally inappropriate for a production environment and debugging information has been suspected, though not proven, to cause trouble with some interfaces. If you would like to compile with debugging, you must run configure with the appropriate flags. For example:
+
+@code
+ ./configure --enable-mac-debug && make
+@endcode
+
+This will enable -g and disable -DNDEBUG which will effectively enable asserts.
+
+@section comp_mac_ca_4 Using the Library in XCode Projects
+
+If you are planning to follow the rest of the tutorial, several project types will work. You can create a "Standard Tool" under "Command Line Utility". If you are not following the rest of the tutorial, any type of project should work with PortAudio, but these instructions may not work perfectly.
+
+Once you've compiled PortAudio, the easiest and recommended way to use PortAudio in your XCode project is to add "/include/portaudio.h" and "/lib/.libs/libportaudio.a" to your project. Because "/lib/.libs/" is a hidden directory, you won't be able to navigate to it using the finder or the standard Mac OS file dialogs by clicking on files and folders. You can use command-shift-G in the finder to specify the exact path, or, from the shell, if you are in the portaudio directory, you can enter this command:
+
+@code
+ open lib/.libs
+@endcode
+
+Then drag the "libportaudio.a" file into your XCode project and place it in the "External Frameworks and Libraries" group, if the project type has it. If not you can simply add it to the top level folder of the project.
+
+You will need to add the following frameworks to your XCode project:
+
+ - CoreAudio.framework
+ - AudioToolbox.framework
+ - AudioUnit.framework
+ - CoreServices.framework
+ - Carbon.framework
+
+@section comp_mac_ca_5 Using the Library in Other Projects
+
+For gcc/Make style projects, include "include/portaudio.h" and link "libportaudio.a", and use the frameworks listed in the previous section. How you do so depends on your build.
+
+@section comp_mac_ca_6 Using Mac-only Extensions to PortAudio
+
+For additional, Mac-only extensions to the PortAudio interface, you may also want to grab "include/pa_mac_core.h". This file contains some special, mac-only features relating to sample-rate conversion, channel mapping, performance and device hogging. See "src/hostapi/coreaudio/notes.txt" for more details on these features.
+
+@section comp_mac_ca_7 What Happened to Makefile.darwin?
+
+Note, there used to be a special makefile just for darwin. This is no longer supported because you can build universal binaries from the standard configure routine. If you find this file in your directory structure it means you have an outdated version of PortAudio.
+
+@code
+ make -f Makefile.darwin
+@endcode
+
+Back to the Tutorial: \ref tutorial_start
+
+*/
diff --git a/doc/src/tutorial/compile_windows.dox b/doc/src/tutorial/compile_windows.dox
index adead46..2258939 100644
--- a/doc/src/tutorial/compile_windows.dox
+++ b/doc/src/tutorial/compile_windows.dox
@@ -1,108 +1,108 @@
-/** @page compile_windows Building PortAudio for Windows using Microsoft Visual Studio
-@ingroup tutorial
-
-Below is a list of steps to build PortAudio into a dll and lib file. The resulting dll file may contain all five current win32 PortAudio APIs: MME, DirectSound, WASAPI, WDM/KS and ASIO, depending on the preprocessor definitions set in step 9 below.
-
-PortAudio can be compiled using Visual C++ Express Edition which is available free from Microsoft. If you do not already have a C++ development environment, simply download and install. These instructions have been observed to succeed using Visual Studio 2010 as well.
-
-1) Building PortAudio with DirectSound support requires the files dsound.h and dsconf.h. Download and install the DirectX SDK from http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=3021d52b-514e-41d3-ad02-438a3ba730ba to obtain these files. If you installed the DirectX SDK then the DirectSound libraries and header files should be found automatically by Visual Studio/Visual C++. If you get an error saying dsound.h or dsconf.h is missing, you will need to add an extra include path to the Visual Studio project file referencing the DirectX includes directory.
-
-2) For ASIO support, download the ASIO SDK from Steinberg at http://www.steinberg.net/en/company/developer.html . The SDK is free, but you will need to set up a developer account with Steinberg. To use the Visual Studio projects mentioned below, copy the entire ASIOSDK2 folder into src\\hostapi\\asio\\. Rename it from ASIOSDK2 to ASIOSDK. To build without ASIO (or other host API) see the "Building without ASIO support" section below.
-
-3) If you have Visual Studio 6.0, 7.0(VC.NET/2001) or 7.1(VC.2003), open portaudio.dsp and convert if needed.
-
-4) If you have Visual Studio 2005, Visual C++ 2008 Express Edition or Visual Studio 2010, open the portaudio.sln file located in build\\msvc\\. Doing so will open Visual Studio or Visual C++. Click "Finish" if a conversion wizard appears. The sln file contains four configurations: Win32 and Win64 in both Release and Debug variants.
-
-@section comp_win1 For Visual Studio 2005, Visual C++ 2008 Express Edition or Visual Studio 2010
-
-The steps below describe settings for recent versions of Visual Studio. Similar settings can be set in earlier versions of Visual Studio.
-
-5) Open Project -> portaudio Properties and select "Configuration Properties" in the tree view.
-
-6) Select "all configurations" in the "Configurations" combo box above. Select "All Platforms" in the "Platforms" combo box.
-
-7) Now set a few options:
-
-Required:
-
-C/C++ -> Code Generation -> Runtime library = /MT
-
-Optional:
-
-C/C++ -> Optimization -> Omit frame pointers = Yes
-
-Optional: C/C++ -> Code Generation -> Floating point model = fast
-
-NOTE: When using PortAudio from C/C++ it is not usually necessary to explicitly set the structure member alignment; the default should work fine. However some languages require, for example, 4-byte alignment. If you are having problems with portaudio.h structure members not being properly read or written to, it may be necessary to explicitly set this value by going to C/C++ -> Code Generation -> Struct member alignment and setting it to an appropriate value (four is a common value). If your compiler is configurable, you should ensure that it is set to use the same structure member alignment value as used for the PortAudio build.
-
-Click "Ok" when you have finished setting these parameters.
-
-@section comp_win2 Preprocessor Definitions
-
-Since the preprocessor definitions are different for each configuration and platform, you'll need to edit these individually for each configuration/platform combination that you want to modify using the "Configurations" and "Platforms" combo boxes.
-
-8) To suppress PortAudio runtime debug console output, go to Project -> Properties -> Configuration Properties -> C/C++ -> Preprocessor. In the field 'Preprocessor Definitions', find PA_ENABLE_DEBUG_OUTPUT and remove it. The console will not output debug messages.
-
-9) Also in the preprocessor definitions you need to explicitly define the native audio APIs you wish to use. For Windows the available API definitions are:
-
-PA_USE_ASIO
-PA_USE_DS (DirectSound)
-PA_USE_WMME (MME)
-PA_USE_WASAPI
-PA_USE_WDMKS
-PA_USE_SKELETON
-
-For each of these, the value of 0 indicates that support for this API should not be included. The value 1 indicates that support for this API should be included. (PA_USE_SKELETON is not usually used, it is a code sample for developers wanting to support a new API).
-
-@section comp_win3 Building
-
-As when setting Preprocessor definitions, building is a per-configuration per-platform process. Follow these instructions for each configuration/platform combination that you're interested in.
-
-10) From the Build menu click Build -> Build solution. For 32-bit compilations, the dll file created by this process (portaudio_x86.dll) can be found in the directory build\\msvc\\Win32\\Release. For 64-bit compilations, the dll file is called portaudio_x64.dll, and is found in the directory build\\msvc\\x64\\Release.
-
-11) Now, any project that requires portaudio can be linked with portaudio_x86.lib (or _x64) and include the relevant headers (portaudio.h, and/or pa_asio.h , pa_x86_plain_converters.h) You may want to add/remove some DLL entry points. At the time of writing the following 6 entries are not part of the official PortAudio API defined in portaudio.h:
-
-(from portaudio.def)
-@code
-...
-PaAsio_GetAvailableLatencyValues @50
-PaAsio_ShowControlPanel @51
-PaUtil_InitializeX86PlainConverters @52
-PaAsio_GetInputChannelName @53
-PaAsio_GetOutputChannelName @54
-PaUtil_SetLogPrintFunction @55
-@endcode
-
-@section comp_win4 Building without ASIO support
-
-To build PortAudio without ASIO support you need to:
-
-1) Make sure your project doesn't try to build any ASIO SDK files. If you're using one of the shipped projects, remove the ASIO related files from the project. In the shipped projects you can find them in the project tree under portaudio > Source Files > hostapi > ASIO > ASIOSDK
-
-2) Make sure your project doesn't try to build the PortAudio ASIO implementation files:
-
-@code
-src\\hostapi\\pa_asio.cpp
-src\\hostapi\\iasiothiscallresolver.cpp
-@endcode
-
-If you're using one of the shipped projects, remove them from the project. In the shipped projects you can find them in the project tree under portaudio > Source Files > hostapi > ASIO
-
-3) Define the preprocessor symbols in the project properties as described in step 9 above. In VS2005 this can be accomplished by selecting
-Project Properties -> Configuration Properties -> C/C++ -> Preprocessor -> Preprocessor Definitions. Omitting PA_USE_ASIO or setting it to 0 stops src\\os\\win\\pa_win_hostapis.c from trying to initialize the PortAudio ASIO implementation.
-
-4) Remove PaAsio_* entry points from portaudio.def
-
-
------
-David Viens, davidv@plogue.com
-
-Updated by Chris on 5/26/2011
-
-Improvements by John Clements on 12/15/2011
-
-Edits by Ross on 1/20/2014
-
-Back to the Tutorial: \ref tutorial_start
-
+/** @page compile_windows Building PortAudio for Windows using Microsoft Visual Studio
+@ingroup tutorial
+
+Below is a list of steps to build PortAudio into a dll and lib file. The resulting dll file may contain all five current win32 PortAudio APIs: MME, DirectSound, WASAPI, WDM/KS and ASIO, depending on the preprocessor definitions set in step 9 below.
+
+PortAudio can be compiled using Visual C++ Express Edition which is available free from Microsoft. If you do not already have a C++ development environment, simply download and install. These instructions have been observed to succeed using Visual Studio 2010 as well.
+
+1) Building PortAudio with DirectSound support requires the files dsound.h and dsconf.h. Download and install the DirectX SDK from http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=3021d52b-514e-41d3-ad02-438a3ba730ba to obtain these files. If you installed the DirectX SDK then the DirectSound libraries and header files should be found automatically by Visual Studio/Visual C++. If you get an error saying dsound.h or dsconf.h is missing, you will need to add an extra include path to the Visual Studio project file referencing the DirectX includes directory.
+
+2) For ASIO support, download the ASIO SDK from Steinberg at http://www.steinberg.net/en/company/developer.html . The SDK is free, but you will need to set up a developer account with Steinberg. To use the Visual Studio projects mentioned below, copy the entire ASIOSDK2 folder into src\\hostapi\\asio\\. Rename it from ASIOSDK2 to ASIOSDK. To build without ASIO (or other host API) see the "Building without ASIO support" section below.
+
+3) If you have Visual Studio 6.0, 7.0(VC.NET/2001) or 7.1(VC.2003), open portaudio.dsp and convert if needed.
+
+4) If you have Visual Studio 2005, Visual C++ 2008 Express Edition or Visual Studio 2010, open the portaudio.sln file located in build\\msvc\\. Doing so will open Visual Studio or Visual C++. Click "Finish" if a conversion wizard appears. The sln file contains four configurations: Win32 and Win64 in both Release and Debug variants.
+
+@section comp_win1 For Visual Studio 2005, Visual C++ 2008 Express Edition or Visual Studio 2010
+
+The steps below describe settings for recent versions of Visual Studio. Similar settings can be set in earlier versions of Visual Studio.
+
+5) Open Project -> portaudio Properties and select "Configuration Properties" in the tree view.
+
+6) Select "all configurations" in the "Configurations" combo box above. Select "All Platforms" in the "Platforms" combo box.
+
+7) Now set a few options:
+
+Required:
+
+C/C++ -> Code Generation -> Runtime library = /MT
+
+Optional:
+
+C/C++ -> Optimization -> Omit frame pointers = Yes
+
+Optional: C/C++ -> Code Generation -> Floating point model = fast
+
+NOTE: When using PortAudio from C/C++ it is not usually necessary to explicitly set the structure member alignment; the default should work fine. However some languages require, for example, 4-byte alignment. If you are having problems with portaudio.h structure members not being properly read or written to, it may be necessary to explicitly set this value by going to C/C++ -> Code Generation -> Struct member alignment and setting it to an appropriate value (four is a common value). If your compiler is configurable, you should ensure that it is set to use the same structure member alignment value as used for the PortAudio build.
+
+Click "Ok" when you have finished setting these parameters.
+
+@section comp_win2 Preprocessor Definitions
+
+Since the preprocessor definitions are different for each configuration and platform, you'll need to edit these individually for each configuration/platform combination that you want to modify using the "Configurations" and "Platforms" combo boxes.
+
+8) To suppress PortAudio runtime debug console output, go to Project -> Properties -> Configuration Properties -> C/C++ -> Preprocessor. In the field 'Preprocessor Definitions', find PA_ENABLE_DEBUG_OUTPUT and remove it. The console will not output debug messages.
+
+9) Also in the preprocessor definitions you need to explicitly define the native audio APIs you wish to use. For Windows the available API definitions are:
+
+PA_USE_ASIO
+PA_USE_DS (DirectSound)
+PA_USE_WMME (MME)
+PA_USE_WASAPI
+PA_USE_WDMKS
+PA_USE_SKELETON
+
+For each of these, the value of 0 indicates that support for this API should not be included. The value 1 indicates that support for this API should be included. (PA_USE_SKELETON is not usually used, it is a code sample for developers wanting to support a new API).
+
+@section comp_win3 Building
+
+As when setting Preprocessor definitions, building is a per-configuration per-platform process. Follow these instructions for each configuration/platform combination that you're interested in.
+
+10) From the Build menu click Build -> Build solution. For 32-bit compilations, the dll file created by this process (portaudio_x86.dll) can be found in the directory build\\msvc\\Win32\\Release. For 64-bit compilations, the dll file is called portaudio_x64.dll, and is found in the directory build\\msvc\\x64\\Release.
+
+11) Now, any project that requires portaudio can be linked with portaudio_x86.lib (or _x64) and include the relevant headers (portaudio.h, and/or pa_asio.h , pa_x86_plain_converters.h) You may want to add/remove some DLL entry points. At the time of writing the following 6 entries are not part of the official PortAudio API defined in portaudio.h:
+
+(from portaudio.def)
+@code
+...
+PaAsio_GetAvailableLatencyValues @50
+PaAsio_ShowControlPanel @51
+PaUtil_InitializeX86PlainConverters @52
+PaAsio_GetInputChannelName @53
+PaAsio_GetOutputChannelName @54
+PaUtil_SetLogPrintFunction @55
+@endcode
+
+@section comp_win4 Building without ASIO support
+
+To build PortAudio without ASIO support you need to:
+
+1) Make sure your project doesn't try to build any ASIO SDK files. If you're using one of the shipped projects, remove the ASIO related files from the project. In the shipped projects you can find them in the project tree under portaudio > Source Files > hostapi > ASIO > ASIOSDK
+
+2) Make sure your project doesn't try to build the PortAudio ASIO implementation files:
+
+@code
+src\\hostapi\\pa_asio.cpp
+src\\hostapi\\iasiothiscallresolver.cpp
+@endcode
+
+If you're using one of the shipped projects, remove them from the project. In the shipped projects you can find them in the project tree under portaudio > Source Files > hostapi > ASIO
+
+3) Define the preprocessor symbols in the project properties as described in step 9 above. In VS2005 this can be accomplished by selecting
+Project Properties -> Configuration Properties -> C/C++ -> Preprocessor -> Preprocessor Definitions. Omitting PA_USE_ASIO or setting it to 0 stops src\\os\\win\\pa_win_hostapis.c from trying to initialize the PortAudio ASIO implementation.
+
+4) Remove PaAsio_* entry points from portaudio.def
+
+
+-----
+David Viens, davidv@plogue.com
+
+Updated by Chris on 5/26/2011
+
+Improvements by John Clements on 12/15/2011
+
+Edits by Ross on 1/20/2014
+
+Back to the Tutorial: \ref tutorial_start
+
*/
\ No newline at end of file
diff --git a/doc/src/tutorial/compile_windows_asio_msvc.dox b/doc/src/tutorial/compile_windows_asio_msvc.dox
index b4c2ab0..cf3a0e5 100644
--- a/doc/src/tutorial/compile_windows_asio_msvc.dox
+++ b/doc/src/tutorial/compile_windows_asio_msvc.dox
@@ -1,97 +1,97 @@
-/** @page compile_windows_asio_msvc Building Portaudio for Windows with ASIO support using MSVC
-@ingroup tutorial
-
-@section comp_win_asiomsvc1 Portaudio Windows ASIO with MSVC
-
-This tutorial describes how to build PortAudio with ASIO support using MSVC *from scratch*, without an existing Visual Studio project. For instructions for building PortAudio (including ASIO support) using the bundled Visual Studio project file see the compiling instructions for \ref compile_windows.
-
-ASIO is a low latency audio API from Steinberg. To compile an ASIO
-application, you must first download the ASIO SDK from Steinberg. You also
-need to obtain ASIO drivers for your audio device. Download the ASIO SDK from Steinberg at http://www.steinberg.net/en/company/developer.html . The SDK is free but you will need to set up a developer account with Steinberg.
-
-This tutorial assumes that you have 3 directories set up at the same level (side by side), one containing PortAudio, one containing the ASIO SDK and one containing your Visual Studio project:
-
-@code
-/ASIOSDK2
-/portaudio
-/DirContainingYourVisualStudioProject (should directly contain the .sln, .vcproj or .vcprojx etc.)
-@endcode
-
-First, make sure that the Steinberg SDK and the portaudio files are "side by side" in the same directory.
-
-Open Microsoft Visual C++ and create a new blank Console exe Project/Workspace in that same directory.
-
-For example, the paths for all three groups might read like this:
-
-@code
-C:\Program Files\Microsoft Visual Studio\VC98\My Projects\ASIOSDK2
-C:\Program Files\Microsoft Visual Studio\VC98\My Projects\portaudio
-C:\Program Files\Microsoft Visual Studio\VC98\My Projects\Sawtooth
-@endcode
-
-
-Next, add the following Steinberg ASIO SDK files to the project Source Files:
-
-@code
-asio.cpp (ASIOSDK2\common)
-asiodrivers.cpp (ASIOSDK2\host)
-asiolist.cpp (ASIOSDK2\host\pc)
-@endcode
-
-
-Then, add the following PortAudio files to the project Source Files:
-
-@code
-pa_asio.cpp (portaudio\src\hostapi\asio)
-pa_allocation.c (portaudio\src\common)
-pa_converters.c (portaudio\src\common)
-pa_cpuload.c (portaudio\src\common)
-pa_dither.c (portaudio\src\common)
-pa_front.c (portaudio\src\common)
-pa_process.c (portaudio\src\common)
-pa_ringbuffer.c (portaudio\src\common)
-pa_stream.c (portaudio\src\common)
-pa_trace.c (portaudio\src\common)
-pa_win_hostapis.c (portaudio\src\os\win)
-pa_win_util.c (portaudio\src\os\win)
-pa_win_coinitialize.c (portaudio\src\os\win)
-pa_win_waveformat.c (portaudio\src\os\win)
-pa_x86_plain_converters.c (portaudio\src\os\win)
-paex_saw.c (portaudio\examples) (Or another file containing main()
- for the console exe to be built.)
-@endcode
-
-
-Although not strictly necessary, you may also want to add the following files to the project Header Files:
-
-@code
-portaudio.h (portaudio\include)
-pa_asio.h (portaudio\include)
-@endcode
-
-These header files define the interfaces to the PortAudio API.
-
-
-Next, go to Project Settings > All Configurations > C/C++ > Preprocessor > Preprocessor Definitions and add
-PA_USE_ASIO=1 to any entries that might be there.
-
-eg: WIN32;_CONSOLE;_MBCS changes to WIN32;_CONSOLE,_MBCS;PA_USE_ASIO=1
-
-Then, on the same Project Settings tab, go down to Additional Include Directories (in VS2010 you'll find this setting under C/C++ > General) and enter the following relative include paths:
-
-@code
-..\portaudio\include;..\portaudio\src\common;..\portaudio\src\os\win;..\asiosdk2\common;..\asiosdk2\host;..\asiosdk2\host\pc
-@endcode
-
-You'll need to make sure the relative paths are correct for the particular directory layout you're using. The above should work fine if you use the side-by-side layout we recommended earlier.
-
-Some source code in the ASIO SDK is not compatible with the Win32 API UNICODE mode (The ASIO SDK expects the non-Unicode Win32 API). Therefore you need to make sure your project is set to not use Unicode. You do this by setting the project Character Set to "Use Multi-Byte Character Set" (NOT "Use Unicode Character Set"). In VS2010 the Character Set option can be found at Configuration Properties > General > Character Set. (An alternative to setting the project to non-Unicode is to patch asiolist.cpp to work when UNICODE is defined: put #undef UNICODE at the top of the file before windows.h is included.)
-
-You should now be able to build any of the test executables in the portaudio\\examples directory.
-We suggest that you start with paex_saw.c because it's one of the simplest example files.
-
---- Chris Share, Tom McCandless, Ross Bencina
-
-Back to the Tutorial: \ref tutorial_start
-
+/** @page compile_windows_asio_msvc Building Portaudio for Windows with ASIO support using MSVC
+@ingroup tutorial
+
+@section comp_win_asiomsvc1 Portaudio Windows ASIO with MSVC
+
+This tutorial describes how to build PortAudio with ASIO support using MSVC *from scratch*, without an existing Visual Studio project. For instructions for building PortAudio (including ASIO support) using the bundled Visual Studio project file see the compiling instructions for \ref compile_windows.
+
+ASIO is a low latency audio API from Steinberg. To compile an ASIO
+application, you must first download the ASIO SDK from Steinberg. You also
+need to obtain ASIO drivers for your audio device. Download the ASIO SDK from Steinberg at http://www.steinberg.net/en/company/developer.html . The SDK is free but you will need to set up a developer account with Steinberg.
+
+This tutorial assumes that you have 3 directories set up at the same level (side by side), one containing PortAudio, one containing the ASIO SDK and one containing your Visual Studio project:
+
+@code
+/ASIOSDK2
+/portaudio
+/DirContainingYourVisualStudioProject (should directly contain the .sln, .vcproj or .vcprojx etc.)
+@endcode
+
+First, make sure that the Steinberg SDK and the portaudio files are "side by side" in the same directory.
+
+Open Microsoft Visual C++ and create a new blank Console exe Project/Workspace in that same directory.
+
+For example, the paths for all three groups might read like this:
+
+@code
+C:\Program Files\Microsoft Visual Studio\VC98\My Projects\ASIOSDK2
+C:\Program Files\Microsoft Visual Studio\VC98\My Projects\portaudio
+C:\Program Files\Microsoft Visual Studio\VC98\My Projects\Sawtooth
+@endcode
+
+
+Next, add the following Steinberg ASIO SDK files to the project Source Files:
+
+@code
+asio.cpp (ASIOSDK2\common)
+asiodrivers.cpp (ASIOSDK2\host)
+asiolist.cpp (ASIOSDK2\host\pc)
+@endcode
+
+
+Then, add the following PortAudio files to the project Source Files:
+
+@code
+pa_asio.cpp (portaudio\src\hostapi\asio)
+pa_allocation.c (portaudio\src\common)
+pa_converters.c (portaudio\src\common)
+pa_cpuload.c (portaudio\src\common)
+pa_dither.c (portaudio\src\common)
+pa_front.c (portaudio\src\common)
+pa_process.c (portaudio\src\common)
+pa_ringbuffer.c (portaudio\src\common)
+pa_stream.c (portaudio\src\common)
+pa_trace.c (portaudio\src\common)
+pa_win_hostapis.c (portaudio\src\os\win)
+pa_win_util.c (portaudio\src\os\win)
+pa_win_coinitialize.c (portaudio\src\os\win)
+pa_win_waveformat.c (portaudio\src\os\win)
+pa_x86_plain_converters.c (portaudio\src\os\win)
+paex_saw.c (portaudio\examples) (Or another file containing main()
+ for the console exe to be built.)
+@endcode
+
+
+Although not strictly necessary, you may also want to add the following files to the project Header Files:
+
+@code
+portaudio.h (portaudio\include)
+pa_asio.h (portaudio\include)
+@endcode
+
+These header files define the interfaces to the PortAudio API.
+
+
+Next, go to Project Settings > All Configurations > C/C++ > Preprocessor > Preprocessor Definitions and add
+PA_USE_ASIO=1 to any entries that might be there.
+
+eg: WIN32;_CONSOLE;_MBCS changes to WIN32;_CONSOLE,_MBCS;PA_USE_ASIO=1
+
+Then, on the same Project Settings tab, go down to Additional Include Directories (in VS2010 you'll find this setting under C/C++ > General) and enter the following relative include paths:
+
+@code
+..\portaudio\include;..\portaudio\src\common;..\portaudio\src\os\win;..\asiosdk2\common;..\asiosdk2\host;..\asiosdk2\host\pc
+@endcode
+
+You'll need to make sure the relative paths are correct for the particular directory layout you're using. The above should work fine if you use the side-by-side layout we recommended earlier.
+
+Some source code in the ASIO SDK is not compatible with the Win32 API UNICODE mode (The ASIO SDK expects the non-Unicode Win32 API). Therefore you need to make sure your project is set to not use Unicode. You do this by setting the project Character Set to "Use Multi-Byte Character Set" (NOT "Use Unicode Character Set"). In VS2010 the Character Set option can be found at Configuration Properties > General > Character Set. (An alternative to setting the project to non-Unicode is to patch asiolist.cpp to work when UNICODE is defined: put #undef UNICODE at the top of the file before windows.h is included.)
+
+You should now be able to build any of the test executables in the portaudio\\examples directory.
+We suggest that you start with paex_saw.c because it's one of the simplest example files.
+
+--- Chris Share, Tom McCandless, Ross Bencina
+
+Back to the Tutorial: \ref tutorial_start
+
*/
\ No newline at end of file
diff --git a/doc/src/tutorial/compile_windows_mingw.dox b/doc/src/tutorial/compile_windows_mingw.dox
index f45fbda..47bba38 100644
--- a/doc/src/tutorial/compile_windows_mingw.dox
+++ b/doc/src/tutorial/compile_windows_mingw.dox
@@ -1,53 +1,53 @@
-/** @page compile_windows_mingw Building Portaudio for Windows with MinGW
-@ingroup tutorial
-
-@section comp_mingw1 Portaudio for Windows With MinGW
-
-The following document is still being reviewed
-
-= MinGW/MSYS =
-
-From the [http://www.mingw.org MinGW projectpage]:
-
-MinGW: A collection of freely available and freely distributable
-Windows specific header files and import libraries, augmenting
-the GNU Compiler Collection, (GCC), and its associated
-tools, (GNU binutils). MinGW provides a complete Open Source
-programming tool set which is suitable for the development of
-native Windows programs that do not depend on any 3rd-party C
-runtime DLLs.
-
-MSYS: A Minimal SYStem providing a POSIX compatible Bourne shell
-environment, with a small collection of UNIX command line
-tools. Primarily developed as a means to execute the configure
-scripts and Makefiles used to build Open Source software, but
-also useful as a general purpose command line interface to
-replace Windows cmd.exe.
-
-MinGW provides a compiler/linker toolchain while MSYS is required
-to actually run the PortAudio configure script.
-
-Once MinGW and MSYS are installed (see the [http://www.mingw.org/MinGWiki MinGW-Wiki]) open an MSYS shell and run the famous:
-
-@code
-./configure
-make
-make install
-@endcode
-
-The above should create a working version though you might want to
-provide '--prefix=' to configure.
-
-'./configure --help' gives details as to what can be tinkered with.
-
---- Mikael Magnusson
-
-To update your copy or check out a fresh copy of the source
-
-[wiki:UsingThePortAudioSvnRepository SVN instructions]
-
---- Bob !McGwier
-
-Back to the Tutorial: \ref tutorial_start
-
+/** @page compile_windows_mingw Building Portaudio for Windows with MinGW
+@ingroup tutorial
+
+@section comp_mingw1 Portaudio for Windows With MinGW
+
+The following document is still being reviewed
+
+= MinGW/MSYS =
+
+From the [http://www.mingw.org MinGW projectpage]:
+
+MinGW: A collection of freely available and freely distributable
+Windows specific header files and import libraries, augmenting
+the GNU Compiler Collection, (GCC), and its associated
+tools, (GNU binutils). MinGW provides a complete Open Source
+programming tool set which is suitable for the development of
+native Windows programs that do not depend on any 3rd-party C
+runtime DLLs.
+
+MSYS: A Minimal SYStem providing a POSIX compatible Bourne shell
+environment, with a small collection of UNIX command line
+tools. Primarily developed as a means to execute the configure
+scripts and Makefiles used to build Open Source software, but
+also useful as a general purpose command line interface to
+replace Windows cmd.exe.
+
+MinGW provides a compiler/linker toolchain while MSYS is required
+to actually run the PortAudio configure script.
+
+Once MinGW and MSYS are installed (see the [http://www.mingw.org/MinGWiki MinGW-Wiki]) open an MSYS shell and run the famous:
+
+@code
+./configure
+make
+make install
+@endcode
+
+The above should create a working version though you might want to
+provide '--prefix=' to configure.
+
+'./configure --help' gives details as to what can be tinkered with.
+
+--- Mikael Magnusson
+
+To update your copy or check out a fresh copy of the source
+
+[wiki:UsingThePortAudioSvnRepository SVN instructions]
+
+--- Bob !McGwier
+
+Back to the Tutorial: \ref tutorial_start
+
*/
\ No newline at end of file
diff --git a/doc/src/tutorial/exploring.dox b/doc/src/tutorial/exploring.dox
index 31d0f19..9dd0873 100644
--- a/doc/src/tutorial/exploring.dox
+++ b/doc/src/tutorial/exploring.dox
@@ -1,15 +1,15 @@
-/** @page exploring Exploring PortAudio
-@ingroup tutorial
-
-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.
-
-For an example of playing a sine wave, see examples/paex_sine.c.
-
-For an example of recording and playing back a sound, see examples/paex_record.c.
-
-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.
-
-
-Previous: \ref blocking_read_write | Next: This is the end of the tutorial.
-
+/** @page exploring Exploring PortAudio
+@ingroup tutorial
+
+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.
+
+For an example of playing a sine wave, see examples/paex_sine.c.
+
+For an example of recording and playing back a sound, see examples/paex_record.c.
+
+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.
+
+
+Previous: \ref blocking_read_write | Next: This is the end of the tutorial.
+
*/
\ No newline at end of file
diff --git a/doc/src/tutorial/initializing_portaudio.dox b/doc/src/tutorial/initializing_portaudio.dox
index d9898e3..9439c35 100644
--- a/doc/src/tutorial/initializing_portaudio.dox
+++ b/doc/src/tutorial/initializing_portaudio.dox
@@ -1,29 +1,29 @@
-/** @page initializing_portaudio Initializing PortAudio
-@ingroup tutorial
-
-@section tut_init1 Initializing PortAudio
-
-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.
-@code
-err = Pa_Initialize();
-if( err != paNoError ) goto error;
-@endcode
-
-You can get a text message that explains the error message by passing it to Pa_GetErrorText( err ). For Example:
-
-@code
-printf( "PortAudio error: %s\n", Pa_GetErrorText( err ) );
-@endcode
-
-It is also important, when you are done with PortAudio, to Terminate it:
-
-@code
-err = Pa_Terminate();
-if( err != paNoError )
- printf( "PortAudio error: %s\n", Pa_GetErrorText( err ) );
-@endcode
-
-
-Previous: \ref writing_a_callback | Next: \ref open_default_stream
-
+/** @page initializing_portaudio Initializing PortAudio
+@ingroup tutorial
+
+@section tut_init1 Initializing PortAudio
+
+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.
+@code
+err = Pa_Initialize();
+if( err != paNoError ) goto error;
+@endcode
+
+You can get a text message that explains the error message by passing it to Pa_GetErrorText( err ). For Example:
+
+@code
+printf( "PortAudio error: %s\n", Pa_GetErrorText( err ) );
+@endcode
+
+It is also important, when you are done with PortAudio, to Terminate it:
+
+@code
+err = Pa_Terminate();
+if( err != paNoError )
+ printf( "PortAudio error: %s\n", Pa_GetErrorText( err ) );
+@endcode
+
+
+Previous: \ref writing_a_callback | Next: \ref open_default_stream
+
*/
\ No newline at end of file
diff --git a/doc/src/tutorial/open_default_stream.dox b/doc/src/tutorial/open_default_stream.dox
index 174cda1..7512d1e 100644
--- a/doc/src/tutorial/open_default_stream.dox
+++ b/doc/src/tutorial/open_default_stream.dox
@@ -1,48 +1,48 @@
-/** @page open_default_stream Opening a Stream Using Defaults
-@ingroup tutorial
-
-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.)
-@code
-#define SAMPLE_RATE (44100)
-static paTestData data;
-
-.....
-
- PaStream *stream;
- PaError err;
-
- /* Open an audio I/O stream. */
- err = Pa_OpenDefaultStream( &stream,
- 0, /* no input channels */
- 2, /* stereo output */
- paFloat32, /* 32 bit floating point output */
- SAMPLE_RATE,
- 256, /* frames per buffer, i.e. the number
- of sample frames that PortAudio will
- request from the callback. Many apps
- may want to use
- paFramesPerBufferUnspecified, which
- tells PortAudio to pick the best,
- possibly changing, buffer size.*/
- patestCallback, /* this is your callback function */
- &data ); /*This is a pointer that will be passed to
- your callback*/
- if( err != paNoError ) goto error;
-@endcode
-
-The data structure and callback are described in \ref writing_a_callback.
-
-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.
-
-There are some caveats to note about simultaneous read/write:
-
- - Some platforms can only open a read/write stream using the same device.
- - Although multiple streams can be opened, it is difficult to synchronize them.
- - Some platforms don't support opening multiple streams on the same device.
- - Using multiple streams may not be as well tested as other features.
- - The PortAudio library calls must be made from the same thread or synchronized by the user.
-
-
-Previous: \ref initializing_portaudio | Next: \ref start_stop_abort
-
+/** @page open_default_stream Opening a Stream Using Defaults
+@ingroup tutorial
+
+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.)
+@code
+#define SAMPLE_RATE (44100)
+static paTestData data;
+
+.....
+
+ PaStream *stream;
+ PaError err;
+
+ /* Open an audio I/O stream. */
+ err = Pa_OpenDefaultStream( &stream,
+ 0, /* no input channels */
+ 2, /* stereo output */
+ paFloat32, /* 32 bit floating point output */
+ SAMPLE_RATE,
+ 256, /* frames per buffer, i.e. the number
+ of sample frames that PortAudio will
+ request from the callback. Many apps
+ may want to use
+ paFramesPerBufferUnspecified, which
+ tells PortAudio to pick the best,
+ possibly changing, buffer size.*/
+ patestCallback, /* this is your callback function */
+ &data ); /*This is a pointer that will be passed to
+ your callback*/
+ if( err != paNoError ) goto error;
+@endcode
+
+The data structure and callback are described in \ref writing_a_callback.
+
+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.
+
+There are some caveats to note about simultaneous read/write:
+
+ - Some platforms can only open a read/write stream using the same device.
+ - Although multiple streams can be opened, it is difficult to synchronize them.
+ - Some platforms don't support opening multiple streams on the same device.
+ - Using multiple streams may not be as well tested as other features.
+ - The PortAudio library calls must be made from the same thread or synchronized by the user.
+
+
+Previous: \ref initializing_portaudio | Next: \ref start_stop_abort
+
*/
\ No newline at end of file
diff --git a/doc/src/tutorial/querying_devices.dox b/doc/src/tutorial/querying_devices.dox
index b97cd11..1eac41a 100644
--- a/doc/src/tutorial/querying_devices.dox
+++ b/doc/src/tutorial/querying_devices.dox
@@ -1,111 +1,111 @@
-/** @page querying_devices Enumerating and Querying PortAudio Devices
-@ingroup tutorial
-
-@section tut_query1 Querying Devices
-
-It is often fine to use the default device as we did previously in this tutorial, but there are times when you'll want to explicitly choose the device from a list of available devices on the system. To see a working example of this, check out pa_devs.c in the tests/ directory of the PortAudio source code. To do so, you'll need to first initialize PortAudio and Query for the number of Devices:
-
-@code
- int numDevices;
-
- numDevices = Pa_GetDeviceCount();
- if( numDevices < 0 )
- {
- printf( "ERROR: Pa_CountDevices returned 0x%x\n", numDevices );
- err = numDevices;
- goto error;
- }
-@endcode
-
-
-If you want to get information about each device, simply loop through as follows:
-
-@code
- const PaDeviceInfo *deviceInfo;
-
- for( i=0; idefaultLowInputLatency ;
- inputParameters.hostApiSpecificStreamInfo = NULL; //See you specific host's API docs for info on using this field
-
-
- bzero( &outputParameters, sizeof( outputParameters ) ); //not necessary if you are filling in all the fields
- outputParameters.channelCount = outChan;
- outputParameters.device = outDevNum;
- outputParameters.hostApiSpecificStreamInfo = NULL;
- outputParameters.sampleFormat = paFloat32;
- outputParameters.suggestedLatency = Pa_GetDeviceInfo(outDevNum)->defaultLowOutputLatency ;
- outputParameters.hostApiSpecificStreamInfo = NULL; //See you specific host's API docs for info on using this field
-
- err = Pa_OpenStream(
- &stream,
- &inputParameters,
- &outputParameters,
- srate,
- framesPerBuffer,
- paNoFlag, //flags that can be used to define dither, clip settings and more
- portAudioCallback, //your callback function
- (void *)this ); //data to be passed to callback. In C++, it is frequently (void *)this
- //don't forget to check errors!
-@endcode
-
-
-Previous: \ref utility_functions | Next: \ref blocking_read_write
-
+/** @page querying_devices Enumerating and Querying PortAudio Devices
+@ingroup tutorial
+
+@section tut_query1 Querying Devices
+
+It is often fine to use the default device as we did previously in this tutorial, but there are times when you'll want to explicitly choose the device from a list of available devices on the system. To see a working example of this, check out pa_devs.c in the tests/ directory of the PortAudio source code. To do so, you'll need to first initialize PortAudio and Query for the number of Devices:
+
+@code
+ int numDevices;
+
+ numDevices = Pa_GetDeviceCount();
+ if( numDevices < 0 )
+ {
+ printf( "ERROR: Pa_CountDevices returned 0x%x\n", numDevices );
+ err = numDevices;
+ goto error;
+ }
+@endcode
+
+
+If you want to get information about each device, simply loop through as follows:
+
+@code
+ const PaDeviceInfo *deviceInfo;
+
+ for( i=0; idefaultLowInputLatency ;
+ inputParameters.hostApiSpecificStreamInfo = NULL; //See you specific host's API docs for info on using this field
+
+
+ bzero( &outputParameters, sizeof( outputParameters ) ); //not necessary if you are filling in all the fields
+ outputParameters.channelCount = outChan;
+ outputParameters.device = outDevNum;
+ outputParameters.hostApiSpecificStreamInfo = NULL;
+ outputParameters.sampleFormat = paFloat32;
+ outputParameters.suggestedLatency = Pa_GetDeviceInfo(outDevNum)->defaultLowOutputLatency ;
+ outputParameters.hostApiSpecificStreamInfo = NULL; //See you specific host's API docs for info on using this field
+
+ err = Pa_OpenStream(
+ &stream,
+ &inputParameters,
+ &outputParameters,
+ srate,
+ framesPerBuffer,
+ paNoFlag, //flags that can be used to define dither, clip settings and more
+ portAudioCallback, //your callback function
+ (void *)this ); //data to be passed to callback. In C++, it is frequently (void *)this
+ //don't forget to check errors!
+@endcode
+
+
+Previous: \ref utility_functions | Next: \ref blocking_read_write
+
*/
\ No newline at end of file
diff --git a/doc/src/tutorial/start_stop_abort.dox b/doc/src/tutorial/start_stop_abort.dox
index 20d7a38..6d4f777 100644
--- a/doc/src/tutorial/start_stop_abort.dox
+++ b/doc/src/tutorial/start_stop_abort.dox
@@ -1,35 +1,35 @@
-/** @page start_stop_abort Starting, Stopping and Aborting a Stream
-@ingroup tutorial
-
-@section tut_startstop1 Starting, Stopping and Aborting a Stream
-
-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.
-
-@code
- err = Pa_StartStream( stream );
- if( err != paNoError ) goto error;
-@endcode
-
-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.
-
-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.
-
-@code
- /* Sleep for several seconds. */
- Pa_Sleep(NUM_SECONDS*1000);
-@endcode
-
-Now we need to stop playback. There are several ways to do this, the simplest of which is to call Pa_StopStream():
-
-@code
- err = Pa_StopStream( stream );
- if( err != paNoError ) goto error;
-@endcode
-
-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.
-
-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.
-
-Previous: \ref open_default_stream | Next: \ref terminating_portaudio
-
+/** @page start_stop_abort Starting, Stopping and Aborting a Stream
+@ingroup tutorial
+
+@section tut_startstop1 Starting, Stopping and Aborting a Stream
+
+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.
+
+@code
+ err = Pa_StartStream( stream );
+ if( err != paNoError ) goto error;
+@endcode
+
+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.
+
+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.
+
+@code
+ /* Sleep for several seconds. */
+ Pa_Sleep(NUM_SECONDS*1000);
+@endcode
+
+Now we need to stop playback. There are several ways to do this, the simplest of which is to call Pa_StopStream():
+
+@code
+ err = Pa_StopStream( stream );
+ if( err != paNoError ) goto error;
+@endcode
+
+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.
+
+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.
+
+Previous: \ref open_default_stream | Next: \ref terminating_portaudio
+
*/
\ No newline at end of file
diff --git a/doc/src/tutorial/terminating_portaudio.dox b/doc/src/tutorial/terminating_portaudio.dox
index a554446..67f74f6 100644
--- a/doc/src/tutorial/terminating_portaudio.dox
+++ b/doc/src/tutorial/terminating_portaudio.dox
@@ -1,20 +1,20 @@
-/** @page terminating_portaudio Closing a Stream and Terminating PortAudio
-@ingroup tutorial
-
-When you are done with a stream, you should close it to free up resources:
-
-@code
- err = Pa_CloseStream( stream );
- if( err != paNoError ) goto error;
-@endcode
-
-We've already mentioned this in \ref initializing_portaudio, but in case you forgot, be sure to terminate PortAudio when you are done:
-
-@code
- err = Pa_Terminate( );
- if( err != paNoError ) goto error;
-@endcode
-
-Previous: \ref start_stop_abort | Next: \ref utility_functions
-
+/** @page terminating_portaudio Closing a Stream and Terminating PortAudio
+@ingroup tutorial
+
+When you are done with a stream, you should close it to free up resources:
+
+@code
+ err = Pa_CloseStream( stream );
+ if( err != paNoError ) goto error;
+@endcode
+
+We've already mentioned this in \ref initializing_portaudio, but in case you forgot, be sure to terminate PortAudio when you are done:
+
+@code
+ err = Pa_Terminate( );
+ if( err != paNoError ) goto error;
+@endcode
+
+Previous: \ref start_stop_abort | Next: \ref utility_functions
+
*/
\ No newline at end of file
diff --git a/doc/src/tutorial/tutorial_start.dox b/doc/src/tutorial/tutorial_start.dox
index b39c82d..d6b5e69 100644
--- a/doc/src/tutorial/tutorial_start.dox
+++ b/doc/src/tutorial/tutorial_start.dox
@@ -1,58 +1,58 @@
-/** @page tutorial_start PortAudio Tutorials
-@ingroup tutorial
-
-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.
-
-@section tut_start1 Downloading
-
-First thing you need to do is download the PortAudio source code either as a tarball from the website, or from the Subversion Repository.
-
-@section tut_start2 Compiling
-
-Once you've downloaded PortAudio you'll need to compile it, which of course, depends on your environment:
-
- - Windows
- - \ref compile_windows
- - \ref compile_windows_mingw
- - \ref compile_windows_asio_msvc
- - \ref compile_cmake
- - Mac OS X
- - \ref compile_mac_coreaudio
- - POSIX
- - \ref compile_linux
-
-Many platforms with GCC/make can use the simple ./configure && make combination and simply use the resulting libraries in their code.
-
-@section tut_start3 Programming with PortAudio
-
-Below are the steps to writing a PortAudio application using the callback technique:
-
- - Write a callback function that will be called by PortAudio when audio processing is needed.
- - Initialize the PA library and open a stream for audio I/O.
- - Start the stream. Your callback function will be now be called repeatedly by PA in the background.
- - In your callback you can read audio data from the inputBuffer and/or write data to the outputBuffer.
- - Stop the stream by returning 1 from your callback, or by calling a stop function.
- - Close the stream and terminate the library.
-
-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.
-
-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.
-
-@section tut_start4 Programming Tutorial Contents
-
-- \ref writing_a_callback
-- \ref initializing_portaudio
-- \ref open_default_stream
-- \ref start_stop_abort
-- \ref terminating_portaudio
-- \ref utility_functions
-- \ref querying_devices
-- \ref blocking_read_write
-
-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.
-
-Once you have a basic understanding of how to use PortAudio, you might be interested in \ref exploring.
-
-Next: \ref writing_a_callback
-
+/** @page tutorial_start PortAudio Tutorials
+@ingroup tutorial
+
+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.
+
+@section tut_start1 Downloading
+
+First thing you need to do is download the PortAudio source code either as a tarball from the website, or from the Subversion Repository.
+
+@section tut_start2 Compiling
+
+Once you've downloaded PortAudio you'll need to compile it, which of course, depends on your environment:
+
+ - Windows
+ - \ref compile_windows
+ - \ref compile_windows_mingw
+ - \ref compile_windows_asio_msvc
+ - \ref compile_cmake
+ - Mac OS X
+ - \ref compile_mac_coreaudio
+ - POSIX
+ - \ref compile_linux
+
+Many platforms with GCC/make can use the simple ./configure && make combination and simply use the resulting libraries in their code.
+
+@section tut_start3 Programming with PortAudio
+
+Below are the steps to writing a PortAudio application using the callback technique:
+
+ - Write a callback function that will be called by PortAudio when audio processing is needed.
+ - Initialize the PA library and open a stream for audio I/O.
+ - Start the stream. Your callback function will be now be called repeatedly by PA in the background.
+ - In your callback you can read audio data from the inputBuffer and/or write data to the outputBuffer.
+ - Stop the stream by returning 1 from your callback, or by calling a stop function.
+ - Close the stream and terminate the library.
+
+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.
+
+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.
+
+@section tut_start4 Programming Tutorial Contents
+
+- \ref writing_a_callback
+- \ref initializing_portaudio
+- \ref open_default_stream
+- \ref start_stop_abort
+- \ref terminating_portaudio
+- \ref utility_functions
+- \ref querying_devices
+- \ref blocking_read_write
+
+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.
+
+Once you have a basic understanding of how to use PortAudio, you might be interested in \ref exploring.
+
+Next: \ref writing_a_callback
+
*/
\ No newline at end of file
diff --git a/doc/src/tutorial/utility_functions.dox b/doc/src/tutorial/utility_functions.dox
index c64934c..c06bf3b 100644
--- a/doc/src/tutorial/utility_functions.dox
+++ b/doc/src/tutorial/utility_functions.dox
@@ -1,69 +1,69 @@
-/** @page utility_functions Utility Functions
-@ingroup tutorial
-
-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.
-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.
-
-@section tut_util2 Version Information
-
-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.
-
-@code
-int Pa_GetVersion (void)
-const char * Pa_GetVersionText (void)
-@endcode
-
-@section tut_util3 Error Text
-
-PortAudio allows you to get error text from an error number.
-
-@code
-const char * Pa_GetErrorText (PaError errorCode)
-@endcode
-
-@section tut_util4 Stream State
-
-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:
-
-@code
-PaError Pa_IsStreamStopped (PaStream *stream)
-PaError Pa_IsStreamActive (PaStream *stream)
-@endcode
-
-@section tut_util5 Stream Info
-
-If you need to retrieve info about a given stream, such as latency, and sample rate info, there's a function for that too:
-
-@code
-const PaStreamInfo * Pa_GetStreamInfo (PaStream *stream)
-@endcode
-
-@section tut_util6 Stream Time
-
-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.
-
-@code
-PaTime Pa_GetStreamTime (PaStream *stream)
-@endcode
-
-@section tut_util6CPU Usage
-
-To determine how much CPU is being used by the callback, use these:
-
-@code
-double Pa_GetStreamCpuLoad (PaStream *stream)
-@endcode
-
-@section tut_util7 Other utilities
-
-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.
-
-@code
-PaError Pa_GetSampleSize (PaSampleFormat format)
-void Pa_Sleep (long msec)
-@endcode
-
-
-Previous: \ref terminating_portaudio | Next: \ref querying_devices
-
+/** @page utility_functions Utility Functions
+@ingroup tutorial
+
+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.
+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.
+
+@section tut_util2 Version Information
+
+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.
+
+@code
+int Pa_GetVersion (void)
+const char * Pa_GetVersionText (void)
+@endcode
+
+@section tut_util3 Error Text
+
+PortAudio allows you to get error text from an error number.
+
+@code
+const char * Pa_GetErrorText (PaError errorCode)
+@endcode
+
+@section tut_util4 Stream State
+
+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:
+
+@code
+PaError Pa_IsStreamStopped (PaStream *stream)
+PaError Pa_IsStreamActive (PaStream *stream)
+@endcode
+
+@section tut_util5 Stream Info
+
+If you need to retrieve info about a given stream, such as latency, and sample rate info, there's a function for that too:
+
+@code
+const PaStreamInfo * Pa_GetStreamInfo (PaStream *stream)
+@endcode
+
+@section tut_util6 Stream Time
+
+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.
+
+@code
+PaTime Pa_GetStreamTime (PaStream *stream)
+@endcode
+
+@section tut_util6CPU Usage
+
+To determine how much CPU is being used by the callback, use these:
+
+@code
+double Pa_GetStreamCpuLoad (PaStream *stream)
+@endcode
+
+@section tut_util7 Other utilities
+
+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.
+
+@code
+PaError Pa_GetSampleSize (PaSampleFormat format)
+void Pa_Sleep (long msec)
+@endcode
+
+
+Previous: \ref terminating_portaudio | Next: \ref querying_devices
+
*/
\ No newline at end of file
diff --git a/doc/src/tutorial/writing_a_callback.dox b/doc/src/tutorial/writing_a_callback.dox
index 6091a19..7c2f8d3 100644
--- a/doc/src/tutorial/writing_a_callback.dox
+++ b/doc/src/tutorial/writing_a_callback.dox
@@ -1,70 +1,70 @@
-/** @page writing_a_callback Writing a Callback Function
-@ingroup tutorial
-
-To write a program using PortAudio, you must include the "portaudio.h" include file. You may wish to read "portaudio.h" because it contains a complete description of the PortAudio functions and constants. Alternatively, you could browse the [http://www.portaudio.com/docs/v19-doxydocs/portaudio_8h.html "portaudio.h" Doxygen page]
-@code
-#include "portaudio.h"
-@endcode
-The next task is to write your own "callback" function. The "callback" is a function that is called by the PortAudio engine whenever it has captured audio data, or when it needs more audio data for output.
-
-Before we begin, it's important to realize that the callback is a delicate place. This is because some systems perform the callback in a special thread, or interrupt handler, and it is rarely treated the same as the rest of your code.
-For most modern systems, you won't be able to cause crashes by making disallowed calls in the callback, but if you want your code to produce glitch-free audio, you will have to make sure you avoid function calls that may take an unbounded amount of time
-to execute. Exactly what these are depend on your platform but almost certainly include the following: memory allocation/deallocation, I/O (including file I/O as well as console I/O, such as printf()), context switching (such as exec() or
-yield()), mutex operations, or anything else that might rely on the OS. If you think short critical sections are safe please go read about priority inversion. Windows amd Mac OS schedulers have no real-time safe priority inversion prevention. Other platforms require special mutex flags. In addition, it is not safe to call any PortAudio API functions in the callback except as explicitly permitted in the documentation.
-
-
-Your callback function must return an int and accept the exact parameters specified in this typedef:
-
-@code
-typedef int PaStreamCallback( const void *input,
- void *output,
- unsigned long frameCount,
- const PaStreamCallbackTimeInfo* timeInfo,
- PaStreamCallbackFlags statusFlags,
- void *userData ) ;
-@endcode
-Here is an example callback function from the test file "patests/patest_saw.c". It calculates a simple left and right sawtooth signal and writes it to the output buffer. Notice that in this example, the signals are of float data type. The signals must be between -1.0 and +1.0. You can also use 16 bit integers or other formats which are specified during setup, but floats are easiest to work with. You can pass a pointer to your data structure through PortAudio which will appear as userData.
-
-@code
-typedef struct
-{
- float left_phase;
- float right_phase;
-}
-paTestData;
-
-/* This routine will be called by the PortAudio engine when audio is needed.
-** It may called at interrupt level on some machines so don't do anything
-** that could mess up the system like calling malloc() or free().
-*/
-static int patestCallback( const void *inputBuffer, void *outputBuffer,
- unsigned long framesPerBuffer,
- const PaStreamCallbackTimeInfo* timeInfo,
- PaStreamCallbackFlags statusFlags,
- void *userData )
-{
- /* Cast data passed through stream to our structure. */
- paTestData *data = (paTestData*)userData;
- float *out = (float*)outputBuffer;
- unsigned int i;
- (void) inputBuffer; /* Prevent unused variable warning. */
-
- for( i=0; ileft_phase; /* left */
- *out++ = data->right_phase; /* right */
- /* Generate simple sawtooth phaser that ranges between -1.0 and 1.0. */
- data->left_phase += 0.01f;
- /* When signal reaches top, drop back down. */
- if( data->left_phase >= 1.0f ) data->left_phase -= 2.0f;
- /* higher pitch so we can distinguish left and right. */
- data->right_phase += 0.03f;
- if( data->right_phase >= 1.0f ) data->right_phase -= 2.0f;
- }
- return 0;
-}
-@endcode
-
-Previous: \ref tutorial_start | Next: \ref initializing_portaudio
-
-*/
+/** @page writing_a_callback Writing a Callback Function
+@ingroup tutorial
+
+To write a program using PortAudio, you must include the "portaudio.h" include file. You may wish to read "portaudio.h" because it contains a complete description of the PortAudio functions and constants. Alternatively, you could browse the [http://www.portaudio.com/docs/v19-doxydocs/portaudio_8h.html "portaudio.h" Doxygen page]
+@code
+#include "portaudio.h"
+@endcode
+The next task is to write your own "callback" function. The "callback" is a function that is called by the PortAudio engine whenever it has captured audio data, or when it needs more audio data for output.
+
+Before we begin, it's important to realize that the callback is a delicate place. This is because some systems perform the callback in a special thread, or interrupt handler, and it is rarely treated the same as the rest of your code.
+For most modern systems, you won't be able to cause crashes by making disallowed calls in the callback, but if you want your code to produce glitch-free audio, you will have to make sure you avoid function calls that may take an unbounded amount of time
+to execute. Exactly what these are depend on your platform but almost certainly include the following: memory allocation/deallocation, I/O (including file I/O as well as console I/O, such as printf()), context switching (such as exec() or
+yield()), mutex operations, or anything else that might rely on the OS. If you think short critical sections are safe please go read about priority inversion. Windows amd Mac OS schedulers have no real-time safe priority inversion prevention. Other platforms require special mutex flags. In addition, it is not safe to call any PortAudio API functions in the callback except as explicitly permitted in the documentation.
+
+
+Your callback function must return an int and accept the exact parameters specified in this typedef:
+
+@code
+typedef int PaStreamCallback( const void *input,
+ void *output,
+ unsigned long frameCount,
+ const PaStreamCallbackTimeInfo* timeInfo,
+ PaStreamCallbackFlags statusFlags,
+ void *userData ) ;
+@endcode
+Here is an example callback function from the test file "patests/patest_saw.c". It calculates a simple left and right sawtooth signal and writes it to the output buffer. Notice that in this example, the signals are of float data type. The signals must be between -1.0 and +1.0. You can also use 16 bit integers or other formats which are specified during setup, but floats are easiest to work with. You can pass a pointer to your data structure through PortAudio which will appear as userData.
+
+@code
+typedef struct
+{
+ float left_phase;
+ float right_phase;
+}
+paTestData;
+
+/* This routine will be called by the PortAudio engine when audio is needed.
+** It may called at interrupt level on some machines so don't do anything
+** that could mess up the system like calling malloc() or free().
+*/
+static int patestCallback( const void *inputBuffer, void *outputBuffer,
+ unsigned long framesPerBuffer,
+ const PaStreamCallbackTimeInfo* timeInfo,
+ PaStreamCallbackFlags statusFlags,
+ void *userData )
+{
+ /* Cast data passed through stream to our structure. */
+ paTestData *data = (paTestData*)userData;
+ float *out = (float*)outputBuffer;
+ unsigned int i;
+ (void) inputBuffer; /* Prevent unused variable warning. */
+
+ for( i=0; ileft_phase; /* left */
+ *out++ = data->right_phase; /* right */
+ /* Generate simple sawtooth phaser that ranges between -1.0 and 1.0. */
+ data->left_phase += 0.01f;
+ /* When signal reaches top, drop back down. */
+ if( data->left_phase >= 1.0f ) data->left_phase -= 2.0f;
+ /* higher pitch so we can distinguish left and right. */
+ data->right_phase += 0.03f;
+ if( data->right_phase >= 1.0f ) data->right_phase -= 2.0f;
+ }
+ return 0;
+}
+@endcode
+
+Previous: \ref tutorial_start | Next: \ref initializing_portaudio
+
+*/
diff --git a/doc/utils/checkfiledocs.py b/doc/utils/checkfiledocs.py
index 1330eca..5d6b585 100644
--- a/doc/utils/checkfiledocs.py
+++ b/doc/utils/checkfiledocs.py
@@ -1,87 +1,87 @@
-import os
-import os.path
-import string
-
-paRootDirectory = '../../'
-paHtmlDocDirectory = os.path.join( paRootDirectory, "doc", "html" )
-
-## Script to check documentation status
-## this script assumes that html doxygen documentation has been generated
-##
-## it then walks the entire portaudio source tree and check that
-## - every source file (.c,.h,.cpp) has a doxygen comment block containing
-## - a @file directive
-## - a @brief directive
-## - a @ingroup directive
-## - it also checks that a corresponding html documentation file has been generated.
-##
-## This can be used as a first-level check to make sure the documentation is in order.
-##
-## The idea is to get a list of which files are missing doxygen documentation.
-##
-## How to run:
-## $ cd doc/utils
-## $ python checkfiledocs.py
-
-def oneOf_a_in_b(a, b):
- for x in a:
- if x in b:
- return True
- return False
-
-# recurse from top and return a list of all with the given
-# extensions. ignore .svn directories. return absolute paths
-def recursiveFindFiles( top, extensions, dirBlacklist, includePaths ):
- result = []
- for (dirpath, dirnames, filenames) in os.walk(top):
- if not oneOf_a_in_b(dirBlacklist, dirpath):
- for f in filenames:
- if os.path.splitext(f)[1] in extensions:
- if includePaths:
- result.append( os.path.abspath( os.path.join( dirpath, f ) ) )
- else:
- result.append( f )
- return result
-
-# generate the html file name that doxygen would use for
-# a particular source file. this is a brittle conversion
-# which i worked out by trial and error
-def doxygenHtmlDocFileName( sourceFile ):
- return sourceFile.replace( '_', '__' ).replace( '.', '_8' ) + '.html'
-
-
-sourceFiles = recursiveFindFiles( os.path.join(paRootDirectory,'src'), [ '.c', '.h', '.cpp' ], ['.svn', 'mingw-include'], True );
-sourceFiles += recursiveFindFiles( os.path.join(paRootDirectory,'include'), [ '.c', '.h', '.cpp' ], ['.svn'], True );
-docFiles = recursiveFindFiles( paHtmlDocDirectory, [ '.html' ], ['.svn'], False );
-
-
-
-currentFile = ""
-
-def printError( f, message ):
- global currentFile
- if f != currentFile:
- currentFile = f
- print f, ":"
- print "\t!", message
-
-
-for f in sourceFiles:
- if not doxygenHtmlDocFileName( os.path.basename(f) ) in docFiles:
- printError( f, "no doxygen generated doc page" )
-
- s = file( f, 'rt' ).read()
-
- if not '/**' in s:
- printError( f, "no doxygen /** block" )
-
- if not '@file' in s:
- printError( f, "no doxygen @file tag" )
-
- if not '@brief' in s:
- printError( f, "no doxygen @brief tag" )
-
- if not '@ingroup' in s:
- printError( f, "no doxygen @ingroup tag" )
-
-
+import os
+import os.path
+import string
+
+paRootDirectory = '../../'
+paHtmlDocDirectory = os.path.join( paRootDirectory, "doc", "html" )
+
+## Script to check documentation status
+## this script assumes that html doxygen documentation has been generated
+##
+## it then walks the entire portaudio source tree and check that
+## - every source file (.c,.h,.cpp) has a doxygen comment block containing
+## - a @file directive
+## - a @brief directive
+## - a @ingroup directive
+## - it also checks that a corresponding html documentation file has been generated.
+##
+## This can be used as a first-level check to make sure the documentation is in order.
+##
+## The idea is to get a list of which files are missing doxygen documentation.
+##
+## How to run:
+## $ cd doc/utils
+## $ python checkfiledocs.py
+
+def oneOf_a_in_b(a, b):
+ for x in a:
+ if x in b:
+ return True
+ return False
+
+# recurse from top and return a list of all with the given
+# extensions. ignore .svn directories. return absolute paths
+def recursiveFindFiles( top, extensions, dirBlacklist, includePaths ):
+ result = []
+ for (dirpath, dirnames, filenames) in os.walk(top):
+ if not oneOf_a_in_b(dirBlacklist, dirpath):
+ for f in filenames:
+ if os.path.splitext(f)[1] in extensions:
+ if includePaths:
+ result.append( os.path.abspath( os.path.join( dirpath, f ) ) )
+ else:
+ result.append( f )
+ return result
+
+# generate the html file name that doxygen would use for
+# a particular source file. this is a brittle conversion
+# which i worked out by trial and error
+def doxygenHtmlDocFileName( sourceFile ):
+ return sourceFile.replace( '_', '__' ).replace( '.', '_8' ) + '.html'
+
+
+sourceFiles = recursiveFindFiles( os.path.join(paRootDirectory,'src'), [ '.c', '.h', '.cpp' ], ['.svn', 'mingw-include'], True );
+sourceFiles += recursiveFindFiles( os.path.join(paRootDirectory,'include'), [ '.c', '.h', '.cpp' ], ['.svn'], True );
+docFiles = recursiveFindFiles( paHtmlDocDirectory, [ '.html' ], ['.svn'], False );
+
+
+
+currentFile = ""
+
+def printError( f, message ):
+ global currentFile
+ if f != currentFile:
+ currentFile = f
+ print f, ":"
+ print "\t!", message
+
+
+for f in sourceFiles:
+ if not doxygenHtmlDocFileName( os.path.basename(f) ) in docFiles:
+ printError( f, "no doxygen generated doc page" )
+
+ s = file( f, 'rt' ).read()
+
+ if not '/**' in s:
+ printError( f, "no doxygen /** block" )
+
+ if not '@file' in s:
+ printError( f, "no doxygen @file tag" )
+
+ if not '@brief' in s:
+ printError( f, "no doxygen @brief tag" )
+
+ if not '@ingroup' in s:
+ printError( f, "no doxygen @ingroup tag" )
+
+
diff --git a/examples/paex_read_write_wire.c b/examples/paex_read_write_wire.c
index 52cc6bd..2f13426 100644
--- a/examples/paex_read_write_wire.c
+++ b/examples/paex_read_write_wire.c
@@ -1,221 +1,221 @@
-/** @file paex_read_write_wire.c
- @ingroup examples_src
- @brief Tests full duplex blocking I/O by passing input straight to output.
- @author Bjorn Roche. XO Audio LLC for Z-Systems Engineering.
- @author based on code by: Phil Burk http://www.softsynth.com
- @author based on code by: Ross Bencina rossb@audiomulch.com
-*/
-/*
- * $Id: patest_read_record.c 757 2004-02-13 07:48:10Z rossbencina $
- *
- * This program uses the PortAudio Portable Audio Library.
- * For more information see: http://www.portaudio.com
- * Copyright (c) 1999-2000 Ross Bencina and Phil Burk
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files
- * (the "Software"), to deal in the Software without restriction,
- * including without limitation the rights to use, copy, modify, merge,
- * publish, distribute, sublicense, and/or sell copies of the Software,
- * and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/*
- * The text above constitutes the entire PortAudio license; however,
- * the PortAudio community also makes the following non-binding requests:
- *
- * Any person wishing to distribute modifications to the Software is
- * requested to send the modifications to the original developer so that
- * they can be incorporated into the canonical version. It is also
- * requested that these non-binding requests be included along with the
- * license above.
- */
-
-#include
-#include
-#include
-#include "portaudio.h"
-
-/* #define SAMPLE_RATE (17932) // Test failure to open with this value. */
-#define SAMPLE_RATE (44100)
-#define FRAMES_PER_BUFFER (1024)
-#define NUM_CHANNELS (2)
-#define NUM_SECONDS (15)
-/* #define DITHER_FLAG (paDitherOff) */
-#define DITHER_FLAG (0) /**/
-
-/* @todo Underflow and overflow is disabled until we fix priming of blocking write. */
-#define CHECK_OVERFLOW (0)
-#define CHECK_UNDERFLOW (0)
-
-
-/* Select sample format. */
-#if 0
-#define PA_SAMPLE_TYPE paFloat32
-#define SAMPLE_SIZE (4)
-#define SAMPLE_SILENCE (0.0f)
-#define CLEAR(a) memset( (a), 0, FRAMES_PER_BUFFER * NUM_CHANNELS * SAMPLE_SIZE )
-#define PRINTF_S_FORMAT "%.8f"
-#elif 0
-#define PA_SAMPLE_TYPE paInt16
-#define SAMPLE_SIZE (2)
-#define SAMPLE_SILENCE (0)
-#define CLEAR(a) memset( (a), 0, FRAMES_PER_BUFFER * NUM_CHANNELS * SAMPLE_SIZE )
-#define PRINTF_S_FORMAT "%d"
-#elif 1
-#define PA_SAMPLE_TYPE paInt24
-#define SAMPLE_SIZE (3)
-#define SAMPLE_SILENCE (0)
-#define CLEAR(a) memset( (a), 0, FRAMES_PER_BUFFER * NUM_CHANNELS * SAMPLE_SIZE )
-#define PRINTF_S_FORMAT "%d"
-#elif 0
-#define PA_SAMPLE_TYPE paInt8
-#define SAMPLE_SIZE (1)
-#define SAMPLE_SILENCE (0)
-#define CLEAR(a) memset( (a), 0, FRAMES_PER_BUFFER * NUM_CHANNELS * SAMPLE_SIZE )
-#define PRINTF_S_FORMAT "%d"
-#else
-#define PA_SAMPLE_TYPE paUInt8
-#define SAMPLE_SIZE (1)
-#define SAMPLE_SILENCE (128)
-#define CLEAR( a ) { \
- int i; \
- for( i=0; idefaultLowInputLatency );
- printf( "Input HL: %g s\n", Pa_GetDeviceInfo( inputParameters.device )->defaultHighInputLatency );
- inputParameters.channelCount = NUM_CHANNELS;
- inputParameters.sampleFormat = PA_SAMPLE_TYPE;
- inputParameters.suggestedLatency = Pa_GetDeviceInfo( inputParameters.device )->defaultHighInputLatency ;
- inputParameters.hostApiSpecificStreamInfo = NULL;
-
- outputParameters.device = Pa_GetDefaultOutputDevice(); /* default output device */
- printf( "Output device # %d.\n", outputParameters.device );
- printf( "Output LL: %g s\n", Pa_GetDeviceInfo( outputParameters.device )->defaultLowOutputLatency );
- printf( "Output HL: %g s\n", Pa_GetDeviceInfo( outputParameters.device )->defaultHighOutputLatency );
- outputParameters.channelCount = NUM_CHANNELS;
- outputParameters.sampleFormat = PA_SAMPLE_TYPE;
- outputParameters.suggestedLatency = Pa_GetDeviceInfo( outputParameters.device )->defaultHighOutputLatency;
- outputParameters.hostApiSpecificStreamInfo = NULL;
-
- /* -- setup -- */
-
- err = Pa_OpenStream(
- &stream,
- &inputParameters,
- &outputParameters,
- SAMPLE_RATE,
- FRAMES_PER_BUFFER,
- paClipOff, /* we won't output out of range samples so don't bother clipping them */
- NULL, /* no callback, use blocking API */
- NULL ); /* no callback, so no callback userData */
- if( err != paNoError ) goto error;
-
- err = Pa_StartStream( stream );
- if( err != paNoError ) goto error;
- printf("Wire on. Will run %d seconds.\n", NUM_SECONDS); fflush(stdout);
-
- for( i=0; i<(NUM_SECONDS*SAMPLE_RATE)/FRAMES_PER_BUFFER; ++i )
- {
- err = Pa_WriteStream( stream, sampleBlock, FRAMES_PER_BUFFER );
- if( err && CHECK_UNDERFLOW ) goto xrun;
- err = Pa_ReadStream( stream, sampleBlock, FRAMES_PER_BUFFER );
- if( err && CHECK_OVERFLOW ) goto xrun;
- }
- err = Pa_StopStream( stream );
- if( err != paNoError ) goto error;
-
- CLEAR( sampleBlock );
-/*
- err = Pa_StartStream( stream );
- if( err != paNoError ) goto error;
- printf("Wire on. Interrupt to stop.\n"); fflush(stdout);
-
- while( 1 )
- {
- err = Pa_WriteStream( stream, sampleBlock, FRAMES_PER_BUFFER );
- if( err ) goto xrun;
- err = Pa_ReadStream( stream, sampleBlock, FRAMES_PER_BUFFER );
- if( err ) goto xrun;
- }
- err = Pa_StopStream( stream );
- if( err != paNoError ) goto error;
-
- Pa_CloseStream( stream );
-*/
- free( sampleBlock );
-
- Pa_Terminate();
- return 0;
-
-xrun:
- if( stream ) {
- Pa_AbortStream( stream );
- Pa_CloseStream( stream );
- }
- free( sampleBlock );
- Pa_Terminate();
- if( err & paInputOverflow )
- fprintf( stderr, "Input Overflow.\n" );
- if( err & paOutputUnderflow )
- fprintf( stderr, "Output Underflow.\n" );
- return -2;
-
-error:
- if( stream ) {
- Pa_AbortStream( stream );
- Pa_CloseStream( stream );
- }
- free( sampleBlock );
- Pa_Terminate();
- fprintf( stderr, "An error occured while using the portaudio stream\n" );
- fprintf( stderr, "Error number: %d\n", err );
- fprintf( stderr, "Error message: %s\n", Pa_GetErrorText( err ) );
- return -1;
-}
-
+/** @file paex_read_write_wire.c
+ @ingroup examples_src
+ @brief Tests full duplex blocking I/O by passing input straight to output.
+ @author Bjorn Roche. XO Audio LLC for Z-Systems Engineering.
+ @author based on code by: Phil Burk http://www.softsynth.com
+ @author based on code by: Ross Bencina rossb@audiomulch.com
+*/
+/*
+ * $Id: patest_read_record.c 757 2004-02-13 07:48:10Z rossbencina $
+ *
+ * This program uses the PortAudio Portable Audio Library.
+ * For more information see: http://www.portaudio.com
+ * Copyright (c) 1999-2000 Ross Bencina and Phil Burk
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/*
+ * The text above constitutes the entire PortAudio license; however,
+ * the PortAudio community also makes the following non-binding requests:
+ *
+ * Any person wishing to distribute modifications to the Software is
+ * requested to send the modifications to the original developer so that
+ * they can be incorporated into the canonical version. It is also
+ * requested that these non-binding requests be included along with the
+ * license above.
+ */
+
+#include
+#include
+#include
+#include "portaudio.h"
+
+/* #define SAMPLE_RATE (17932) // Test failure to open with this value. */
+#define SAMPLE_RATE (44100)
+#define FRAMES_PER_BUFFER (1024)
+#define NUM_CHANNELS (2)
+#define NUM_SECONDS (15)
+/* #define DITHER_FLAG (paDitherOff) */
+#define DITHER_FLAG (0) /**/
+
+/* @todo Underflow and overflow is disabled until we fix priming of blocking write. */
+#define CHECK_OVERFLOW (0)
+#define CHECK_UNDERFLOW (0)
+
+
+/* Select sample format. */
+#if 0
+#define PA_SAMPLE_TYPE paFloat32
+#define SAMPLE_SIZE (4)
+#define SAMPLE_SILENCE (0.0f)
+#define CLEAR(a) memset( (a), 0, FRAMES_PER_BUFFER * NUM_CHANNELS * SAMPLE_SIZE )
+#define PRINTF_S_FORMAT "%.8f"
+#elif 0
+#define PA_SAMPLE_TYPE paInt16
+#define SAMPLE_SIZE (2)
+#define SAMPLE_SILENCE (0)
+#define CLEAR(a) memset( (a), 0, FRAMES_PER_BUFFER * NUM_CHANNELS * SAMPLE_SIZE )
+#define PRINTF_S_FORMAT "%d"
+#elif 1
+#define PA_SAMPLE_TYPE paInt24
+#define SAMPLE_SIZE (3)
+#define SAMPLE_SILENCE (0)
+#define CLEAR(a) memset( (a), 0, FRAMES_PER_BUFFER * NUM_CHANNELS * SAMPLE_SIZE )
+#define PRINTF_S_FORMAT "%d"
+#elif 0
+#define PA_SAMPLE_TYPE paInt8
+#define SAMPLE_SIZE (1)
+#define SAMPLE_SILENCE (0)
+#define CLEAR(a) memset( (a), 0, FRAMES_PER_BUFFER * NUM_CHANNELS * SAMPLE_SIZE )
+#define PRINTF_S_FORMAT "%d"
+#else
+#define PA_SAMPLE_TYPE paUInt8
+#define SAMPLE_SIZE (1)
+#define SAMPLE_SILENCE (128)
+#define CLEAR( a ) { \
+ int i; \
+ for( i=0; idefaultLowInputLatency );
+ printf( "Input HL: %g s\n", Pa_GetDeviceInfo( inputParameters.device )->defaultHighInputLatency );
+ inputParameters.channelCount = NUM_CHANNELS;
+ inputParameters.sampleFormat = PA_SAMPLE_TYPE;
+ inputParameters.suggestedLatency = Pa_GetDeviceInfo( inputParameters.device )->defaultHighInputLatency ;
+ inputParameters.hostApiSpecificStreamInfo = NULL;
+
+ outputParameters.device = Pa_GetDefaultOutputDevice(); /* default output device */
+ printf( "Output device # %d.\n", outputParameters.device );
+ printf( "Output LL: %g s\n", Pa_GetDeviceInfo( outputParameters.device )->defaultLowOutputLatency );
+ printf( "Output HL: %g s\n", Pa_GetDeviceInfo( outputParameters.device )->defaultHighOutputLatency );
+ outputParameters.channelCount = NUM_CHANNELS;
+ outputParameters.sampleFormat = PA_SAMPLE_TYPE;
+ outputParameters.suggestedLatency = Pa_GetDeviceInfo( outputParameters.device )->defaultHighOutputLatency;
+ outputParameters.hostApiSpecificStreamInfo = NULL;
+
+ /* -- setup -- */
+
+ err = Pa_OpenStream(
+ &stream,
+ &inputParameters,
+ &outputParameters,
+ SAMPLE_RATE,
+ FRAMES_PER_BUFFER,
+ paClipOff, /* we won't output out of range samples so don't bother clipping them */
+ NULL, /* no callback, use blocking API */
+ NULL ); /* no callback, so no callback userData */
+ if( err != paNoError ) goto error;
+
+ err = Pa_StartStream( stream );
+ if( err != paNoError ) goto error;
+ printf("Wire on. Will run %d seconds.\n", NUM_SECONDS); fflush(stdout);
+
+ for( i=0; i<(NUM_SECONDS*SAMPLE_RATE)/FRAMES_PER_BUFFER; ++i )
+ {
+ err = Pa_WriteStream( stream, sampleBlock, FRAMES_PER_BUFFER );
+ if( err && CHECK_UNDERFLOW ) goto xrun;
+ err = Pa_ReadStream( stream, sampleBlock, FRAMES_PER_BUFFER );
+ if( err && CHECK_OVERFLOW ) goto xrun;
+ }
+ err = Pa_StopStream( stream );
+ if( err != paNoError ) goto error;
+
+ CLEAR( sampleBlock );
+/*
+ err = Pa_StartStream( stream );
+ if( err != paNoError ) goto error;
+ printf("Wire on. Interrupt to stop.\n"); fflush(stdout);
+
+ while( 1 )
+ {
+ err = Pa_WriteStream( stream, sampleBlock, FRAMES_PER_BUFFER );
+ if( err ) goto xrun;
+ err = Pa_ReadStream( stream, sampleBlock, FRAMES_PER_BUFFER );
+ if( err ) goto xrun;
+ }
+ err = Pa_StopStream( stream );
+ if( err != paNoError ) goto error;
+
+ Pa_CloseStream( stream );
+*/
+ free( sampleBlock );
+
+ Pa_Terminate();
+ return 0;
+
+xrun:
+ if( stream ) {
+ Pa_AbortStream( stream );
+ Pa_CloseStream( stream );
+ }
+ free( sampleBlock );
+ Pa_Terminate();
+ if( err & paInputOverflow )
+ fprintf( stderr, "Input Overflow.\n" );
+ if( err & paOutputUnderflow )
+ fprintf( stderr, "Output Underflow.\n" );
+ return -2;
+
+error:
+ if( stream ) {
+ Pa_AbortStream( stream );
+ Pa_CloseStream( stream );
+ }
+ free( sampleBlock );
+ Pa_Terminate();
+ fprintf( stderr, "An error occured while using the portaudio stream\n" );
+ fprintf( stderr, "Error number: %d\n", err );
+ fprintf( stderr, "Error message: %s\n", Pa_GetErrorText( err ) );
+ return -1;
+}
+
diff --git a/examples/paex_record_file.c b/examples/paex_record_file.c
index 0d19f06..edde5ab 100644
--- a/examples/paex_record_file.c
+++ b/examples/paex_record_file.c
@@ -1,453 +1,453 @@
-/** @file paex_record_file.c
- @ingroup examples_src
- @brief Record input into a file, then playback recorded data from file (Windows only at the moment)
- @author Robert Bielik
-*/
-/*
- * $Id: paex_record_file.c 1752 2011-09-08 03:21:55Z philburk $
- *
- * This program uses the PortAudio Portable Audio Library.
- * For more information see: http://www.portaudio.com
- * Copyright (c) 1999-2000 Ross Bencina and Phil Burk
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files
- * (the "Software"), to deal in the Software without restriction,
- * including without limitation the rights to use, copy, modify, merge,
- * publish, distribute, sublicense, and/or sell copies of the Software,
- * and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/*
- * The text above constitutes the entire PortAudio license; however,
- * the PortAudio community also makes the following non-binding requests:
- *
- * Any person wishing to distribute modifications to the Software is
- * requested to send the modifications to the original developer so that
- * they can be incorporated into the canonical version. It is also
- * requested that these non-binding requests be included along with the
- * license above.
- */
-
-#include
-#include
-#include "portaudio.h"
-#include "pa_ringbuffer.h"
-#include "pa_util.h"
-
-#ifdef _WIN32
-#include
-#include
-#endif
-
-/* #define SAMPLE_RATE (17932) // Test failure to open with this value. */
-#define FILE_NAME "audio_data.raw"
-#define SAMPLE_RATE (44100)
-#define FRAMES_PER_BUFFER (512)
-#define NUM_SECONDS (10)
-#define NUM_CHANNELS (2)
-#define NUM_WRITES_PER_BUFFER (4)
-/* #define DITHER_FLAG (paDitherOff) */
-#define DITHER_FLAG (0) /**/
-
-
-/* Select sample format. */
-#if 1
-#define PA_SAMPLE_TYPE paFloat32
-typedef float SAMPLE;
-#define SAMPLE_SILENCE (0.0f)
-#define PRINTF_S_FORMAT "%.8f"
-#elif 1
-#define PA_SAMPLE_TYPE paInt16
-typedef short SAMPLE;
-#define SAMPLE_SILENCE (0)
-#define PRINTF_S_FORMAT "%d"
-#elif 0
-#define PA_SAMPLE_TYPE paInt8
-typedef char SAMPLE;
-#define SAMPLE_SILENCE (0)
-#define PRINTF_S_FORMAT "%d"
-#else
-#define PA_SAMPLE_TYPE paUInt8
-typedef unsigned char SAMPLE;
-#define SAMPLE_SILENCE (128)
-#define PRINTF_S_FORMAT "%d"
-#endif
-
-typedef struct
-{
- unsigned frameIndex;
- int threadSyncFlag;
- SAMPLE *ringBufferData;
- PaUtilRingBuffer ringBuffer;
- FILE *file;
- void *threadHandle;
-}
-paTestData;
-
-/* This routine is run in a separate thread to write data from the ring buffer into a file (during Recording) */
-static int threadFunctionWriteToRawFile(void* ptr)
-{
- paTestData* pData = (paTestData*)ptr;
-
- /* Mark thread started */
- pData->threadSyncFlag = 0;
-
- while (1)
- {
- ring_buffer_size_t elementsInBuffer = PaUtil_GetRingBufferReadAvailable(&pData->ringBuffer);
- if ( (elementsInBuffer >= pData->ringBuffer.bufferSize / NUM_WRITES_PER_BUFFER) ||
- pData->threadSyncFlag )
- {
- void* ptr[2] = {0};
- ring_buffer_size_t sizes[2] = {0};
-
- /* By using PaUtil_GetRingBufferReadRegions, we can read directly from the ring buffer */
- ring_buffer_size_t elementsRead = PaUtil_GetRingBufferReadRegions(&pData->ringBuffer, elementsInBuffer, ptr + 0, sizes + 0, ptr + 1, sizes + 1);
- if (elementsRead > 0)
- {
- int i;
- for (i = 0; i < 2 && ptr[i] != NULL; ++i)
- {
- fwrite(ptr[i], pData->ringBuffer.elementSizeBytes, sizes[i], pData->file);
- }
- PaUtil_AdvanceRingBufferReadIndex(&pData->ringBuffer, elementsRead);
- }
-
- if (pData->threadSyncFlag)
- {
- break;
- }
- }
-
- /* Sleep a little while... */
- Pa_Sleep(20);
- }
-
- pData->threadSyncFlag = 0;
-
- return 0;
-}
-
-/* This routine is run in a separate thread to read data from file into the ring buffer (during Playback). When the file
- has reached EOF, a flag is set so that the play PA callback can return paComplete */
-static int threadFunctionReadFromRawFile(void* ptr)
-{
- paTestData* pData = (paTestData*)ptr;
-
- while (1)
- {
- ring_buffer_size_t elementsInBuffer = PaUtil_GetRingBufferWriteAvailable(&pData->ringBuffer);
-
- if (elementsInBuffer >= pData->ringBuffer.bufferSize / NUM_WRITES_PER_BUFFER)
- {
- void* ptr[2] = {0};
- ring_buffer_size_t sizes[2] = {0};
-
- /* By using PaUtil_GetRingBufferWriteRegions, we can write directly into the ring buffer */
- PaUtil_GetRingBufferWriteRegions(&pData->ringBuffer, elementsInBuffer, ptr + 0, sizes + 0, ptr + 1, sizes + 1);
-
- if (!feof(pData->file))
- {
- ring_buffer_size_t itemsReadFromFile = 0;
- int i;
- for (i = 0; i < 2 && ptr[i] != NULL; ++i)
- {
- itemsReadFromFile += (ring_buffer_size_t)fread(ptr[i], pData->ringBuffer.elementSizeBytes, sizes[i], pData->file);
- }
- PaUtil_AdvanceRingBufferWriteIndex(&pData->ringBuffer, itemsReadFromFile);
-
- /* Mark thread started here, that way we "prime" the ring buffer before playback */
- pData->threadSyncFlag = 0;
- }
- else
- {
- /* No more data to read */
- pData->threadSyncFlag = 1;
- break;
- }
- }
-
- /* Sleep a little while... */
- Pa_Sleep(20);
- }
-
- return 0;
-}
-
-typedef int (*ThreadFunctionType)(void*);
-
-/* Start up a new thread in the given function, at the moment only Windows, but should be very easy to extend
- to posix type OSs (Linux/Mac) */
-static PaError startThread( paTestData* pData, ThreadFunctionType fn )
-{
-#ifdef _WIN32
- typedef unsigned (__stdcall* WinThreadFunctionType)(void*);
- pData->threadHandle = (void*)_beginthreadex(NULL, 0, (WinThreadFunctionType)fn, pData, CREATE_SUSPENDED, NULL);
- if (pData->threadHandle == NULL) return paUnanticipatedHostError;
-
- /* Set file thread to a little higher prio than normal */
- SetThreadPriority(pData->threadHandle, THREAD_PRIORITY_ABOVE_NORMAL);
-
- /* Start it up */
- pData->threadSyncFlag = 1;
- ResumeThread(pData->threadHandle);
-
-#endif
-
- /* Wait for thread to startup */
- while (pData->threadSyncFlag) {
- Pa_Sleep(10);
- }
-
- return paNoError;
-}
-
-static int stopThread( paTestData* pData )
-{
- pData->threadSyncFlag = 1;
- /* Wait for thread to stop */
- while (pData->threadSyncFlag) {
- Pa_Sleep(10);
- }
-#ifdef _WIN32
- CloseHandle(pData->threadHandle);
- pData->threadHandle = 0;
-#endif
-
- return paNoError;
-}
-
-
-/* This routine will be called by the PortAudio engine when audio is needed.
-** It may be called at interrupt level on some machines so don't do anything
-** that could mess up the system like calling malloc() or free().
-*/
-static int recordCallback( const void *inputBuffer, void *outputBuffer,
- unsigned long framesPerBuffer,
- const PaStreamCallbackTimeInfo* timeInfo,
- PaStreamCallbackFlags statusFlags,
- void *userData )
-{
- paTestData *data = (paTestData*)userData;
- ring_buffer_size_t elementsWriteable = PaUtil_GetRingBufferWriteAvailable(&data->ringBuffer);
- ring_buffer_size_t elementsToWrite = min(elementsWriteable, (ring_buffer_size_t)(framesPerBuffer * NUM_CHANNELS));
- const SAMPLE *rptr = (const SAMPLE*)inputBuffer;
-
- (void) outputBuffer; /* Prevent unused variable warnings. */
- (void) timeInfo;
- (void) statusFlags;
- (void) userData;
-
- data->frameIndex += PaUtil_WriteRingBuffer(&data->ringBuffer, rptr, elementsToWrite);
-
- return paContinue;
-}
-
-/* This routine will be called by the PortAudio engine when audio is needed.
-** It may be called at interrupt level on some machines so don't do anything
-** that could mess up the system like calling malloc() or free().
-*/
-static int playCallback( const void *inputBuffer, void *outputBuffer,
- unsigned long framesPerBuffer,
- const PaStreamCallbackTimeInfo* timeInfo,
- PaStreamCallbackFlags statusFlags,
- void *userData )
-{
- paTestData *data = (paTestData*)userData;
- ring_buffer_size_t elementsToPlay = PaUtil_GetRingBufferReadAvailable(&data->ringBuffer);
- ring_buffer_size_t elementsToRead = min(elementsToPlay, (ring_buffer_size_t)(framesPerBuffer * NUM_CHANNELS));
- SAMPLE* wptr = (SAMPLE*)outputBuffer;
-
- (void) inputBuffer; /* Prevent unused variable warnings. */
- (void) timeInfo;
- (void) statusFlags;
- (void) userData;
-
- data->frameIndex += PaUtil_ReadRingBuffer(&data->ringBuffer, wptr, elementsToRead);
-
- return data->threadSyncFlag ? paComplete : paContinue;
-}
-
-static unsigned NextPowerOf2(unsigned val)
-{
- val--;
- val = (val >> 1) | val;
- val = (val >> 2) | val;
- val = (val >> 4) | val;
- val = (val >> 8) | val;
- val = (val >> 16) | val;
- return ++val;
-}
-
-/*******************************************************************/
-int main(void);
-int main(void)
-{
- PaStreamParameters inputParameters,
- outputParameters;
- PaStream* stream;
- PaError err = paNoError;
- paTestData data = {0};
- unsigned delayCntr;
- unsigned numSamples;
- unsigned numBytes;
-
- printf("patest_record.c\n"); fflush(stdout);
-
- /* We set the ring buffer size to about 500 ms */
- numSamples = NextPowerOf2((unsigned)(SAMPLE_RATE * 0.5 * NUM_CHANNELS));
- numBytes = numSamples * sizeof(SAMPLE);
- data.ringBufferData = (SAMPLE *) PaUtil_AllocateMemory( numBytes );
- if( data.ringBufferData == NULL )
- {
- printf("Could not allocate ring buffer data.\n");
- goto done;
- }
-
- if (PaUtil_InitializeRingBuffer(&data.ringBuffer, sizeof(SAMPLE), numSamples, data.ringBufferData) < 0)
- {
- printf("Failed to initialize ring buffer. Size is not power of 2 ??\n");
- goto done;
- }
-
- err = Pa_Initialize();
- if( err != paNoError ) goto done;
-
- inputParameters.device = Pa_GetDefaultInputDevice(); /* default input device */
- if (inputParameters.device == paNoDevice) {
- fprintf(stderr,"Error: No default input device.\n");
- goto done;
- }
- inputParameters.channelCount = 2; /* stereo input */
- inputParameters.sampleFormat = PA_SAMPLE_TYPE;
- inputParameters.suggestedLatency = Pa_GetDeviceInfo( inputParameters.device )->defaultLowInputLatency;
- inputParameters.hostApiSpecificStreamInfo = NULL;
-
- /* Record some audio. -------------------------------------------- */
- err = Pa_OpenStream(
- &stream,
- &inputParameters,
- NULL, /* &outputParameters, */
- SAMPLE_RATE,
- FRAMES_PER_BUFFER,
- paClipOff, /* we won't output out of range samples so don't bother clipping them */
- recordCallback,
- &data );
- if( err != paNoError ) goto done;
-
- /* Open the raw audio 'cache' file... */
- data.file = fopen(FILE_NAME, "wb");
- if (data.file == 0) goto done;
-
- /* Start the file writing thread */
- err = startThread(&data, threadFunctionWriteToRawFile);
- if( err != paNoError ) goto done;
-
- err = Pa_StartStream( stream );
- if( err != paNoError ) goto done;
- printf("\n=== Now recording to '" FILE_NAME "' for %d seconds!! Please speak into the microphone. ===\n", NUM_SECONDS); fflush(stdout);
-
- /* Note that the RECORDING part is limited with TIME, not size of the file and/or buffer, so you can
- increase NUM_SECONDS until you run out of disk */
- delayCntr = 0;
- while( delayCntr++ < NUM_SECONDS )
- {
- printf("index = %d\n", data.frameIndex ); fflush(stdout);
- Pa_Sleep(1000);
- }
- if( err < 0 ) goto done;
-
- err = Pa_CloseStream( stream );
- if( err != paNoError ) goto done;
-
- /* Stop the thread */
- err = stopThread(&data);
- if( err != paNoError ) goto done;
-
- /* Close file */
- fclose(data.file);
- data.file = 0;
-
- /* Playback recorded data. -------------------------------------------- */
- data.frameIndex = 0;
-
- outputParameters.device = Pa_GetDefaultOutputDevice(); /* default output device */
- if (outputParameters.device == paNoDevice) {
- fprintf(stderr,"Error: No default output device.\n");
- goto done;
- }
- outputParameters.channelCount = 2; /* stereo output */
- outputParameters.sampleFormat = PA_SAMPLE_TYPE;
- outputParameters.suggestedLatency = Pa_GetDeviceInfo( outputParameters.device )->defaultLowOutputLatency;
- outputParameters.hostApiSpecificStreamInfo = NULL;
-
- printf("\n=== Now playing back from file '" FILE_NAME "' until end-of-file is reached ===\n"); fflush(stdout);
- err = Pa_OpenStream(
- &stream,
- NULL, /* no input */
- &outputParameters,
- SAMPLE_RATE,
- FRAMES_PER_BUFFER,
- paClipOff, /* we won't output out of range samples so don't bother clipping them */
- playCallback,
- &data );
- if( err != paNoError ) goto done;
-
- if( stream )
- {
- /* Open file again for reading */
- data.file = fopen(FILE_NAME, "rb");
- if (data.file != 0)
- {
- /* Start the file reading thread */
- err = startThread(&data, threadFunctionReadFromRawFile);
- if( err != paNoError ) goto done;
-
- err = Pa_StartStream( stream );
- if( err != paNoError ) goto done;
-
- printf("Waiting for playback to finish.\n"); fflush(stdout);
-
- /* The playback will end when EOF is reached */
- while( ( err = Pa_IsStreamActive( stream ) ) == 1 ) {
- printf("index = %d\n", data.frameIndex ); fflush(stdout);
- Pa_Sleep(1000);
- }
- if( err < 0 ) goto done;
- }
-
- err = Pa_CloseStream( stream );
- if( err != paNoError ) goto done;
-
- fclose(data.file);
-
- printf("Done.\n"); fflush(stdout);
- }
-
-done:
- Pa_Terminate();
- if( data.ringBufferData ) /* Sure it is NULL or valid. */
- PaUtil_FreeMemory( data.ringBufferData );
- if( err != paNoError )
- {
- fprintf( stderr, "An error occured while using the portaudio stream\n" );
- fprintf( stderr, "Error number: %d\n", err );
- fprintf( stderr, "Error message: %s\n", Pa_GetErrorText( err ) );
- err = 1; /* Always return 0 or 1, but no other return codes. */
- }
- return err;
-}
-
+/** @file paex_record_file.c
+ @ingroup examples_src
+ @brief Record input into a file, then playback recorded data from file (Windows only at the moment)
+ @author Robert Bielik
+*/
+/*
+ * $Id: paex_record_file.c 1752 2011-09-08 03:21:55Z philburk $
+ *
+ * This program uses the PortAudio Portable Audio Library.
+ * For more information see: http://www.portaudio.com
+ * Copyright (c) 1999-2000 Ross Bencina and Phil Burk
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/*
+ * The text above constitutes the entire PortAudio license; however,
+ * the PortAudio community also makes the following non-binding requests:
+ *
+ * Any person wishing to distribute modifications to the Software is
+ * requested to send the modifications to the original developer so that
+ * they can be incorporated into the canonical version. It is also
+ * requested that these non-binding requests be included along with the
+ * license above.
+ */
+
+#include
+#include
+#include "portaudio.h"
+#include "pa_ringbuffer.h"
+#include "pa_util.h"
+
+#ifdef _WIN32
+#include
+#include
+#endif
+
+/* #define SAMPLE_RATE (17932) // Test failure to open with this value. */
+#define FILE_NAME "audio_data.raw"
+#define SAMPLE_RATE (44100)
+#define FRAMES_PER_BUFFER (512)
+#define NUM_SECONDS (10)
+#define NUM_CHANNELS (2)
+#define NUM_WRITES_PER_BUFFER (4)
+/* #define DITHER_FLAG (paDitherOff) */
+#define DITHER_FLAG (0) /**/
+
+
+/* Select sample format. */
+#if 1
+#define PA_SAMPLE_TYPE paFloat32
+typedef float SAMPLE;
+#define SAMPLE_SILENCE (0.0f)
+#define PRINTF_S_FORMAT "%.8f"
+#elif 1
+#define PA_SAMPLE_TYPE paInt16
+typedef short SAMPLE;
+#define SAMPLE_SILENCE (0)
+#define PRINTF_S_FORMAT "%d"
+#elif 0
+#define PA_SAMPLE_TYPE paInt8
+typedef char SAMPLE;
+#define SAMPLE_SILENCE (0)
+#define PRINTF_S_FORMAT "%d"
+#else
+#define PA_SAMPLE_TYPE paUInt8
+typedef unsigned char SAMPLE;
+#define SAMPLE_SILENCE (128)
+#define PRINTF_S_FORMAT "%d"
+#endif
+
+typedef struct
+{
+ unsigned frameIndex;
+ int threadSyncFlag;
+ SAMPLE *ringBufferData;
+ PaUtilRingBuffer ringBuffer;
+ FILE *file;
+ void *threadHandle;
+}
+paTestData;
+
+/* This routine is run in a separate thread to write data from the ring buffer into a file (during Recording) */
+static int threadFunctionWriteToRawFile(void* ptr)
+{
+ paTestData* pData = (paTestData*)ptr;
+
+ /* Mark thread started */
+ pData->threadSyncFlag = 0;
+
+ while (1)
+ {
+ ring_buffer_size_t elementsInBuffer = PaUtil_GetRingBufferReadAvailable(&pData->ringBuffer);
+ if ( (elementsInBuffer >= pData->ringBuffer.bufferSize / NUM_WRITES_PER_BUFFER) ||
+ pData->threadSyncFlag )
+ {
+ void* ptr[2] = {0};
+ ring_buffer_size_t sizes[2] = {0};
+
+ /* By using PaUtil_GetRingBufferReadRegions, we can read directly from the ring buffer */
+ ring_buffer_size_t elementsRead = PaUtil_GetRingBufferReadRegions(&pData->ringBuffer, elementsInBuffer, ptr + 0, sizes + 0, ptr + 1, sizes + 1);
+ if (elementsRead > 0)
+ {
+ int i;
+ for (i = 0; i < 2 && ptr[i] != NULL; ++i)
+ {
+ fwrite(ptr[i], pData->ringBuffer.elementSizeBytes, sizes[i], pData->file);
+ }
+ PaUtil_AdvanceRingBufferReadIndex(&pData->ringBuffer, elementsRead);
+ }
+
+ if (pData->threadSyncFlag)
+ {
+ break;
+ }
+ }
+
+ /* Sleep a little while... */
+ Pa_Sleep(20);
+ }
+
+ pData->threadSyncFlag = 0;
+
+ return 0;
+}
+
+/* This routine is run in a separate thread to read data from file into the ring buffer (during Playback). When the file
+ has reached EOF, a flag is set so that the play PA callback can return paComplete */
+static int threadFunctionReadFromRawFile(void* ptr)
+{
+ paTestData* pData = (paTestData*)ptr;
+
+ while (1)
+ {
+ ring_buffer_size_t elementsInBuffer = PaUtil_GetRingBufferWriteAvailable(&pData->ringBuffer);
+
+ if (elementsInBuffer >= pData->ringBuffer.bufferSize / NUM_WRITES_PER_BUFFER)
+ {
+ void* ptr[2] = {0};
+ ring_buffer_size_t sizes[2] = {0};
+
+ /* By using PaUtil_GetRingBufferWriteRegions, we can write directly into the ring buffer */
+ PaUtil_GetRingBufferWriteRegions(&pData->ringBuffer, elementsInBuffer, ptr + 0, sizes + 0, ptr + 1, sizes + 1);
+
+ if (!feof(pData->file))
+ {
+ ring_buffer_size_t itemsReadFromFile = 0;
+ int i;
+ for (i = 0; i < 2 && ptr[i] != NULL; ++i)
+ {
+ itemsReadFromFile += (ring_buffer_size_t)fread(ptr[i], pData->ringBuffer.elementSizeBytes, sizes[i], pData->file);
+ }
+ PaUtil_AdvanceRingBufferWriteIndex(&pData->ringBuffer, itemsReadFromFile);
+
+ /* Mark thread started here, that way we "prime" the ring buffer before playback */
+ pData->threadSyncFlag = 0;
+ }
+ else
+ {
+ /* No more data to read */
+ pData->threadSyncFlag = 1;
+ break;
+ }
+ }
+
+ /* Sleep a little while... */
+ Pa_Sleep(20);
+ }
+
+ return 0;
+}
+
+typedef int (*ThreadFunctionType)(void*);
+
+/* Start up a new thread in the given function, at the moment only Windows, but should be very easy to extend
+ to posix type OSs (Linux/Mac) */
+static PaError startThread( paTestData* pData, ThreadFunctionType fn )
+{
+#ifdef _WIN32
+ typedef unsigned (__stdcall* WinThreadFunctionType)(void*);
+ pData->threadHandle = (void*)_beginthreadex(NULL, 0, (WinThreadFunctionType)fn, pData, CREATE_SUSPENDED, NULL);
+ if (pData->threadHandle == NULL) return paUnanticipatedHostError;
+
+ /* Set file thread to a little higher prio than normal */
+ SetThreadPriority(pData->threadHandle, THREAD_PRIORITY_ABOVE_NORMAL);
+
+ /* Start it up */
+ pData->threadSyncFlag = 1;
+ ResumeThread(pData->threadHandle);
+
+#endif
+
+ /* Wait for thread to startup */
+ while (pData->threadSyncFlag) {
+ Pa_Sleep(10);
+ }
+
+ return paNoError;
+}
+
+static int stopThread( paTestData* pData )
+{
+ pData->threadSyncFlag = 1;
+ /* Wait for thread to stop */
+ while (pData->threadSyncFlag) {
+ Pa_Sleep(10);
+ }
+#ifdef _WIN32
+ CloseHandle(pData->threadHandle);
+ pData->threadHandle = 0;
+#endif
+
+ return paNoError;
+}
+
+
+/* This routine will be called by the PortAudio engine when audio is needed.
+** It may be called at interrupt level on some machines so don't do anything
+** that could mess up the system like calling malloc() or free().
+*/
+static int recordCallback( const void *inputBuffer, void *outputBuffer,
+ unsigned long framesPerBuffer,
+ const PaStreamCallbackTimeInfo* timeInfo,
+ PaStreamCallbackFlags statusFlags,
+ void *userData )
+{
+ paTestData *data = (paTestData*)userData;
+ ring_buffer_size_t elementsWriteable = PaUtil_GetRingBufferWriteAvailable(&data->ringBuffer);
+ ring_buffer_size_t elementsToWrite = min(elementsWriteable, (ring_buffer_size_t)(framesPerBuffer * NUM_CHANNELS));
+ const SAMPLE *rptr = (const SAMPLE*)inputBuffer;
+
+ (void) outputBuffer; /* Prevent unused variable warnings. */
+ (void) timeInfo;
+ (void) statusFlags;
+ (void) userData;
+
+ data->frameIndex += PaUtil_WriteRingBuffer(&data->ringBuffer, rptr, elementsToWrite);
+
+ return paContinue;
+}
+
+/* This routine will be called by the PortAudio engine when audio is needed.
+** It may be called at interrupt level on some machines so don't do anything
+** that could mess up the system like calling malloc() or free().
+*/
+static int playCallback( const void *inputBuffer, void *outputBuffer,
+ unsigned long framesPerBuffer,
+ const PaStreamCallbackTimeInfo* timeInfo,
+ PaStreamCallbackFlags statusFlags,
+ void *userData )
+{
+ paTestData *data = (paTestData*)userData;
+ ring_buffer_size_t elementsToPlay = PaUtil_GetRingBufferReadAvailable(&data->ringBuffer);
+ ring_buffer_size_t elementsToRead = min(elementsToPlay, (ring_buffer_size_t)(framesPerBuffer * NUM_CHANNELS));
+ SAMPLE* wptr = (SAMPLE*)outputBuffer;
+
+ (void) inputBuffer; /* Prevent unused variable warnings. */
+ (void) timeInfo;
+ (void) statusFlags;
+ (void) userData;
+
+ data->frameIndex += PaUtil_ReadRingBuffer(&data->ringBuffer, wptr, elementsToRead);
+
+ return data->threadSyncFlag ? paComplete : paContinue;
+}
+
+static unsigned NextPowerOf2(unsigned val)
+{
+ val--;
+ val = (val >> 1) | val;
+ val = (val >> 2) | val;
+ val = (val >> 4) | val;
+ val = (val >> 8) | val;
+ val = (val >> 16) | val;
+ return ++val;
+}
+
+/*******************************************************************/
+int main(void);
+int main(void)
+{
+ PaStreamParameters inputParameters,
+ outputParameters;
+ PaStream* stream;
+ PaError err = paNoError;
+ paTestData data = {0};
+ unsigned delayCntr;
+ unsigned numSamples;
+ unsigned numBytes;
+
+ printf("patest_record.c\n"); fflush(stdout);
+
+ /* We set the ring buffer size to about 500 ms */
+ numSamples = NextPowerOf2((unsigned)(SAMPLE_RATE * 0.5 * NUM_CHANNELS));
+ numBytes = numSamples * sizeof(SAMPLE);
+ data.ringBufferData = (SAMPLE *) PaUtil_AllocateMemory( numBytes );
+ if( data.ringBufferData == NULL )
+ {
+ printf("Could not allocate ring buffer data.\n");
+ goto done;
+ }
+
+ if (PaUtil_InitializeRingBuffer(&data.ringBuffer, sizeof(SAMPLE), numSamples, data.ringBufferData) < 0)
+ {
+ printf("Failed to initialize ring buffer. Size is not power of 2 ??\n");
+ goto done;
+ }
+
+ err = Pa_Initialize();
+ if( err != paNoError ) goto done;
+
+ inputParameters.device = Pa_GetDefaultInputDevice(); /* default input device */
+ if (inputParameters.device == paNoDevice) {
+ fprintf(stderr,"Error: No default input device.\n");
+ goto done;
+ }
+ inputParameters.channelCount = 2; /* stereo input */
+ inputParameters.sampleFormat = PA_SAMPLE_TYPE;
+ inputParameters.suggestedLatency = Pa_GetDeviceInfo( inputParameters.device )->defaultLowInputLatency;
+ inputParameters.hostApiSpecificStreamInfo = NULL;
+
+ /* Record some audio. -------------------------------------------- */
+ err = Pa_OpenStream(
+ &stream,
+ &inputParameters,
+ NULL, /* &outputParameters, */
+ SAMPLE_RATE,
+ FRAMES_PER_BUFFER,
+ paClipOff, /* we won't output out of range samples so don't bother clipping them */
+ recordCallback,
+ &data );
+ if( err != paNoError ) goto done;
+
+ /* Open the raw audio 'cache' file... */
+ data.file = fopen(FILE_NAME, "wb");
+ if (data.file == 0) goto done;
+
+ /* Start the file writing thread */
+ err = startThread(&data, threadFunctionWriteToRawFile);
+ if( err != paNoError ) goto done;
+
+ err = Pa_StartStream( stream );
+ if( err != paNoError ) goto done;
+ printf("\n=== Now recording to '" FILE_NAME "' for %d seconds!! Please speak into the microphone. ===\n", NUM_SECONDS); fflush(stdout);
+
+ /* Note that the RECORDING part is limited with TIME, not size of the file and/or buffer, so you can
+ increase NUM_SECONDS until you run out of disk */
+ delayCntr = 0;
+ while( delayCntr++ < NUM_SECONDS )
+ {
+ printf("index = %d\n", data.frameIndex ); fflush(stdout);
+ Pa_Sleep(1000);
+ }
+ if( err < 0 ) goto done;
+
+ err = Pa_CloseStream( stream );
+ if( err != paNoError ) goto done;
+
+ /* Stop the thread */
+ err = stopThread(&data);
+ if( err != paNoError ) goto done;
+
+ /* Close file */
+ fclose(data.file);
+ data.file = 0;
+
+ /* Playback recorded data. -------------------------------------------- */
+ data.frameIndex = 0;
+
+ outputParameters.device = Pa_GetDefaultOutputDevice(); /* default output device */
+ if (outputParameters.device == paNoDevice) {
+ fprintf(stderr,"Error: No default output device.\n");
+ goto done;
+ }
+ outputParameters.channelCount = 2; /* stereo output */
+ outputParameters.sampleFormat = PA_SAMPLE_TYPE;
+ outputParameters.suggestedLatency = Pa_GetDeviceInfo( outputParameters.device )->defaultLowOutputLatency;
+ outputParameters.hostApiSpecificStreamInfo = NULL;
+
+ printf("\n=== Now playing back from file '" FILE_NAME "' until end-of-file is reached ===\n"); fflush(stdout);
+ err = Pa_OpenStream(
+ &stream,
+ NULL, /* no input */
+ &outputParameters,
+ SAMPLE_RATE,
+ FRAMES_PER_BUFFER,
+ paClipOff, /* we won't output out of range samples so don't bother clipping them */
+ playCallback,
+ &data );
+ if( err != paNoError ) goto done;
+
+ if( stream )
+ {
+ /* Open file again for reading */
+ data.file = fopen(FILE_NAME, "rb");
+ if (data.file != 0)
+ {
+ /* Start the file reading thread */
+ err = startThread(&data, threadFunctionReadFromRawFile);
+ if( err != paNoError ) goto done;
+
+ err = Pa_StartStream( stream );
+ if( err != paNoError ) goto done;
+
+ printf("Waiting for playback to finish.\n"); fflush(stdout);
+
+ /* The playback will end when EOF is reached */
+ while( ( err = Pa_IsStreamActive( stream ) ) == 1 ) {
+ printf("index = %d\n", data.frameIndex ); fflush(stdout);
+ Pa_Sleep(1000);
+ }
+ if( err < 0 ) goto done;
+ }
+
+ err = Pa_CloseStream( stream );
+ if( err != paNoError ) goto done;
+
+ fclose(data.file);
+
+ printf("Done.\n"); fflush(stdout);
+ }
+
+done:
+ Pa_Terminate();
+ if( data.ringBufferData ) /* Sure it is NULL or valid. */
+ PaUtil_FreeMemory( data.ringBufferData );
+ if( err != paNoError )
+ {
+ fprintf( stderr, "An error occured while using the portaudio stream\n" );
+ fprintf( stderr, "Error number: %d\n", err );
+ fprintf( stderr, "Error message: %s\n", Pa_GetErrorText( err ) );
+ err = 1; /* Always return 0 or 1, but no other return codes. */
+ }
+ return err;
+}
+
diff --git a/examples/paex_sine_c++.cpp b/examples/paex_sine_c++.cpp
index c1ee8aa..2859a57 100644
--- a/examples/paex_sine_c++.cpp
+++ b/examples/paex_sine_c++.cpp
@@ -1,275 +1,275 @@
-/** @file paex_sine.c
- @ingroup examples_src
- @brief Play a sine wave for several seconds.
- @author Ross Bencina
- @author Phil Burk
-*/
-/*
- * $Id: paex_sine.c 1752 2011-09-08 03:21:55Z philburk $
- *
- * This program uses the PortAudio Portable Audio Library.
- * For more information see: http://www.portaudio.com/
- * Copyright (c) 1999-2000 Ross Bencina and Phil Burk
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files
- * (the "Software"), to deal in the Software without restriction,
- * including without limitation the rights to use, copy, modify, merge,
- * publish, distribute, sublicense, and/or sell copies of the Software,
- * and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/*
- * The text above constitutes the entire PortAudio license; however,
- * the PortAudio community also makes the following non-binding requests:
- *
- * Any person wishing to distribute modifications to the Software is
- * requested to send the modifications to the original developer so that
- * they can be incorporated into the canonical version. It is also
- * requested that these non-binding requests be included along with the
- * license above.
- */
-#include
-#include
-#include "portaudio.h"
-
-#define NUM_SECONDS (5)
-#define SAMPLE_RATE (44100)
-#define FRAMES_PER_BUFFER (64)
-
-#ifndef M_PI
-#define M_PI (3.14159265)
-#endif
-
-#define TABLE_SIZE (200)
-
-class Sine
-{
-public:
- Sine() : stream(0), left_phase(0), right_phase(0)
- {
- /* initialise sinusoidal wavetable */
- for( int i=0; iname);
- }
-
- outputParameters.channelCount = 2; /* stereo output */
- outputParameters.sampleFormat = paFloat32; /* 32 bit floating point output */
- outputParameters.suggestedLatency = Pa_GetDeviceInfo( outputParameters.device )->defaultLowOutputLatency;
- outputParameters.hostApiSpecificStreamInfo = NULL;
-
- PaError err = Pa_OpenStream(
- &stream,
- NULL, /* no input */
- &outputParameters,
- SAMPLE_RATE,
- paFramesPerBufferUnspecified,
- paClipOff, /* we won't output out of range samples so don't bother clipping them */
- &Sine::paCallback,
- this /* Using 'this' for userData so we can cast to Sine* in paCallback method */
- );
-
- if (err != paNoError)
- {
- /* Failed to open stream to device !!! */
- return false;
- }
-
- err = Pa_SetStreamFinishedCallback( stream, &Sine::paStreamFinished );
-
- if (err != paNoError)
- {
- Pa_CloseStream( stream );
- stream = 0;
-
- return false;
- }
-
- return true;
- }
-
- bool close()
- {
- if (stream == 0)
- return false;
-
- PaError err = Pa_CloseStream( stream );
- stream = 0;
-
- return (err == paNoError);
- }
-
-
- bool start()
- {
- if (stream == 0)
- return false;
-
- PaError err = Pa_StartStream( stream );
-
- return (err == paNoError);
- }
-
- bool stop()
- {
- if (stream == 0)
- return false;
-
- PaError err = Pa_StopStream( stream );
-
- return (err == paNoError);
- }
-
-private:
- /* The instance callback, where we have access to every method/variable in object of class Sine */
- int paCallbackMethod(const void *inputBuffer, void *outputBuffer,
- unsigned long framesPerBuffer,
- const PaStreamCallbackTimeInfo* timeInfo,
- PaStreamCallbackFlags statusFlags)
- {
- float *out = (float*)outputBuffer;
- unsigned long i;
-
- (void) timeInfo; /* Prevent unused variable warnings. */
- (void) statusFlags;
- (void) inputBuffer;
-
- for( i=0; i= TABLE_SIZE ) left_phase -= TABLE_SIZE;
- right_phase += 3; /* higher pitch so we can distinguish left and right. */
- if( right_phase >= TABLE_SIZE ) right_phase -= TABLE_SIZE;
- }
-
- return paContinue;
-
- }
-
- /* This routine will be called by the PortAudio engine when audio is needed.
- ** It may called at interrupt level on some machines so don't do anything
- ** that could mess up the system like calling malloc() or free().
- */
- static int paCallback( const void *inputBuffer, void *outputBuffer,
- unsigned long framesPerBuffer,
- const PaStreamCallbackTimeInfo* timeInfo,
- PaStreamCallbackFlags statusFlags,
- void *userData )
- {
- /* Here we cast userData to Sine* type so we can call the instance method paCallbackMethod, we can do that since
- we called Pa_OpenStream with 'this' for userData */
- return ((Sine*)userData)->paCallbackMethod(inputBuffer, outputBuffer,
- framesPerBuffer,
- timeInfo,
- statusFlags);
- }
-
-
- void paStreamFinishedMethod()
- {
- printf( "Stream Completed: %s\n", message );
- }
-
- /*
- * This routine is called by portaudio when playback is done.
- */
- static void paStreamFinished(void* userData)
- {
- return ((Sine*)userData)->paStreamFinishedMethod();
- }
-
- PaStream *stream;
- float sine[TABLE_SIZE];
- int left_phase;
- int right_phase;
- char message[20];
-};
-
-class ScopedPaHandler
-{
-public:
- ScopedPaHandler()
- : _result(Pa_Initialize())
- {
- }
- ~ScopedPaHandler()
- {
- if (_result == paNoError)
- {
- Pa_Terminate();
- }
- }
-
- PaError result() const { return _result; }
-
-private:
- PaError _result;
-};
-
-
-/*******************************************************************/
-int main(void);
-int main(void)
-{
- Sine sine;
-
- printf("PortAudio Test: output sine wave. SR = %d, BufSize = %d\n", SAMPLE_RATE, FRAMES_PER_BUFFER);
-
- ScopedPaHandler paInit;
- if( paInit.result() != paNoError ) goto error;
-
- if (sine.open(Pa_GetDefaultOutputDevice()))
- {
- if (sine.start())
- {
- printf("Play for %d seconds.\n", NUM_SECONDS );
- Pa_Sleep( NUM_SECONDS * 1000 );
-
- sine.stop();
- }
-
- sine.close();
- }
-
- printf("Test finished.\n");
- return paNoError;
-
-error:
- fprintf( stderr, "An error occured while using the portaudio stream\n" );
- fprintf( stderr, "Error number: %d\n", paInit.result() );
- fprintf( stderr, "Error message: %s\n", Pa_GetErrorText( paInit.result() ) );
- return 1;
-}
+/** @file paex_sine.c
+ @ingroup examples_src
+ @brief Play a sine wave for several seconds.
+ @author Ross Bencina
+ @author Phil Burk
+*/
+/*
+ * $Id: paex_sine.c 1752 2011-09-08 03:21:55Z philburk $
+ *
+ * This program uses the PortAudio Portable Audio Library.
+ * For more information see: http://www.portaudio.com/
+ * Copyright (c) 1999-2000 Ross Bencina and Phil Burk
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/*
+ * The text above constitutes the entire PortAudio license; however,
+ * the PortAudio community also makes the following non-binding requests:
+ *
+ * Any person wishing to distribute modifications to the Software is
+ * requested to send the modifications to the original developer so that
+ * they can be incorporated into the canonical version. It is also
+ * requested that these non-binding requests be included along with the
+ * license above.
+ */
+#include
+#include
+#include "portaudio.h"
+
+#define NUM_SECONDS (5)
+#define SAMPLE_RATE (44100)
+#define FRAMES_PER_BUFFER (64)
+
+#ifndef M_PI
+#define M_PI (3.14159265)
+#endif
+
+#define TABLE_SIZE (200)
+
+class Sine
+{
+public:
+ Sine() : stream(0), left_phase(0), right_phase(0)
+ {
+ /* initialise sinusoidal wavetable */
+ for( int i=0; iname);
+ }
+
+ outputParameters.channelCount = 2; /* stereo output */
+ outputParameters.sampleFormat = paFloat32; /* 32 bit floating point output */
+ outputParameters.suggestedLatency = Pa_GetDeviceInfo( outputParameters.device )->defaultLowOutputLatency;
+ outputParameters.hostApiSpecificStreamInfo = NULL;
+
+ PaError err = Pa_OpenStream(
+ &stream,
+ NULL, /* no input */
+ &outputParameters,
+ SAMPLE_RATE,
+ paFramesPerBufferUnspecified,
+ paClipOff, /* we won't output out of range samples so don't bother clipping them */
+ &Sine::paCallback,
+ this /* Using 'this' for userData so we can cast to Sine* in paCallback method */
+ );
+
+ if (err != paNoError)
+ {
+ /* Failed to open stream to device !!! */
+ return false;
+ }
+
+ err = Pa_SetStreamFinishedCallback( stream, &Sine::paStreamFinished );
+
+ if (err != paNoError)
+ {
+ Pa_CloseStream( stream );
+ stream = 0;
+
+ return false;
+ }
+
+ return true;
+ }
+
+ bool close()
+ {
+ if (stream == 0)
+ return false;
+
+ PaError err = Pa_CloseStream( stream );
+ stream = 0;
+
+ return (err == paNoError);
+ }
+
+
+ bool start()
+ {
+ if (stream == 0)
+ return false;
+
+ PaError err = Pa_StartStream( stream );
+
+ return (err == paNoError);
+ }
+
+ bool stop()
+ {
+ if (stream == 0)
+ return false;
+
+ PaError err = Pa_StopStream( stream );
+
+ return (err == paNoError);
+ }
+
+private:
+ /* The instance callback, where we have access to every method/variable in object of class Sine */
+ int paCallbackMethod(const void *inputBuffer, void *outputBuffer,
+ unsigned long framesPerBuffer,
+ const PaStreamCallbackTimeInfo* timeInfo,
+ PaStreamCallbackFlags statusFlags)
+ {
+ float *out = (float*)outputBuffer;
+ unsigned long i;
+
+ (void) timeInfo; /* Prevent unused variable warnings. */
+ (void) statusFlags;
+ (void) inputBuffer;
+
+ for( i=0; i= TABLE_SIZE ) left_phase -= TABLE_SIZE;
+ right_phase += 3; /* higher pitch so we can distinguish left and right. */
+ if( right_phase >= TABLE_SIZE ) right_phase -= TABLE_SIZE;
+ }
+
+ return paContinue;
+
+ }
+
+ /* This routine will be called by the PortAudio engine when audio is needed.
+ ** It may called at interrupt level on some machines so don't do anything
+ ** that could mess up the system like calling malloc() or free().
+ */
+ static int paCallback( const void *inputBuffer, void *outputBuffer,
+ unsigned long framesPerBuffer,
+ const PaStreamCallbackTimeInfo* timeInfo,
+ PaStreamCallbackFlags statusFlags,
+ void *userData )
+ {
+ /* Here we cast userData to Sine* type so we can call the instance method paCallbackMethod, we can do that since
+ we called Pa_OpenStream with 'this' for userData */
+ return ((Sine*)userData)->paCallbackMethod(inputBuffer, outputBuffer,
+ framesPerBuffer,
+ timeInfo,
+ statusFlags);
+ }
+
+
+ void paStreamFinishedMethod()
+ {
+ printf( "Stream Completed: %s\n", message );
+ }
+
+ /*
+ * This routine is called by portaudio when playback is done.
+ */
+ static void paStreamFinished(void* userData)
+ {
+ return ((Sine*)userData)->paStreamFinishedMethod();
+ }
+
+ PaStream *stream;
+ float sine[TABLE_SIZE];
+ int left_phase;
+ int right_phase;
+ char message[20];
+};
+
+class ScopedPaHandler
+{
+public:
+ ScopedPaHandler()
+ : _result(Pa_Initialize())
+ {
+ }
+ ~ScopedPaHandler()
+ {
+ if (_result == paNoError)
+ {
+ Pa_Terminate();
+ }
+ }
+
+ PaError result() const { return _result; }
+
+private:
+ PaError _result;
+};
+
+
+/*******************************************************************/
+int main(void);
+int main(void)
+{
+ Sine sine;
+
+ printf("PortAudio Test: output sine wave. SR = %d, BufSize = %d\n", SAMPLE_RATE, FRAMES_PER_BUFFER);
+
+ ScopedPaHandler paInit;
+ if( paInit.result() != paNoError ) goto error;
+
+ if (sine.open(Pa_GetDefaultOutputDevice()))
+ {
+ if (sine.start())
+ {
+ printf("Play for %d seconds.\n", NUM_SECONDS );
+ Pa_Sleep( NUM_SECONDS * 1000 );
+
+ sine.stop();
+ }
+
+ sine.close();
+ }
+
+ printf("Test finished.\n");
+ return paNoError;
+
+error:
+ fprintf( stderr, "An error occured while using the portaudio stream\n" );
+ fprintf( stderr, "Error number: %d\n", paInit.result() );
+ fprintf( stderr, "Error message: %s\n", Pa_GetErrorText( paInit.result() ) );
+ return 1;
+}
diff --git a/examples/paex_wmme_ac3.c b/examples/paex_wmme_ac3.c
index ac8867d..e59c571 100644
--- a/examples/paex_wmme_ac3.c
+++ b/examples/paex_wmme_ac3.c
@@ -1,221 +1,221 @@
-/** @file paex_wmme_ac3.c
- @ingroup examples_src
- @brief Use WMME-specific interface to send raw AC3 data to a S/PDIF output.
- @author Ross Bencina
-*/
-/*
- * $Id: $
- * Portable Audio I/O Library
- * Windows MME ac3 sound output test
- *
- * Copyright (c) 2009 Ross Bencina
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files
- * (the "Software"), to deal in the Software without restriction,
- * including without limitation the rights to use, copy, modify, merge,
- * publish, distribute, sublicense, and/or sell copies of the Software,
- * and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/*
- * The text above constitutes the entire PortAudio license; however,
- * the PortAudio community also makes the following non-binding requests:
- *
- * Any person wishing to distribute modifications to the Software is
- * requested to send the modifications to the original developer so that
- * they can be incorporated into the canonical version. It is also
- * requested that these non-binding requests be included along with the
- * license above.
- */
-
-#include
-#include
-
-#include /* required when using pa_win_wmme.h */
-#include /* required when using pa_win_wmme.h */
-
-#include "portaudio.h"
-#include "pa_win_wmme.h"
-
-#define NUM_SECONDS (20)
-#define SAMPLE_RATE (48000)
-#define FRAMES_PER_BUFFER (64)
-
-#ifndef M_PI
-#define M_PI (3.14159265)
-#endif
-
-#define TABLE_SIZE (100)
-
-#define CHANNEL_COUNT (2)
-
-
-
-typedef struct
-{
- short *buffer;
- int bufferSampleCount;
- int playbackIndex;
-}
-paTestData;
-
-/* This routine will be called by the PortAudio engine when audio is needed.
-** It may called at interrupt level on some machines so don't do anything
-** that could mess up the system like calling malloc() or free().
-*/
-static int patestCallback( const void *inputBuffer, void *outputBuffer,
- unsigned long framesPerBuffer,
- const PaStreamCallbackTimeInfo* timeInfo,
- PaStreamCallbackFlags statusFlags,
- void *userData )
-{
- paTestData *data = (paTestData*)userData;
- short *out = (short*)outputBuffer;
- unsigned long i,j;
-
- (void) timeInfo; /* Prevent unused variable warnings. */
- (void) statusFlags;
- (void) inputBuffer;
-
- /* stream out contents of data->buffer looping at end */
-
- for( i=0; ibuffer[ data->playbackIndex++ ];
-
- if( data->playbackIndex >= data->bufferSampleCount )
- data->playbackIndex = 0; /* loop at end of buffer */
- }
- }
-
- return paContinue;
-}
-
-/*******************************************************************/
-int main(int argc, char* argv[])
-{
- PaStreamParameters outputParameters;
- PaWinMmeStreamInfo wmmeStreamInfo;
- PaStream *stream;
- PaError err;
- paTestData data;
- int deviceIndex;
- FILE *fp;
- const char *fileName = "c:\\test_48k.ac3.spdif";
- data.buffer = NULL;
-
- printf("usage: patest_wmme_ac3 fileName [paDeviceIndex]\n");
- printf("**IMPORTANT*** The provided file must include the spdif preamble at the start of every AC-3 frame. Using a normal ac3 file won't work.\n");
- printf("PortAudio Test: output a raw spdif ac3 stream. SR = %d, BufSize = %d, Chans = %d\n",
- SAMPLE_RATE, FRAMES_PER_BUFFER, CHANNEL_COUNT);
-
-
- if( argc >= 2 )
- fileName = argv[1];
-
- printf( "reading spdif ac3 raw stream file %s\n", fileName );
-
- fp = fopen( fileName, "rb" );
- if( !fp ){
- fprintf( stderr, "error opening spdif ac3 file.\n" );
- return -1;
- }
- /* get file size */
- fseek( fp, 0, SEEK_END );
- data.bufferSampleCount = ftell( fp ) / sizeof(short);
- fseek( fp, 0, SEEK_SET );
-
- /* allocate buffer, read the whole file into memory */
- data.buffer = (short*)malloc( data.bufferSampleCount * sizeof(short) );
- if( !data.buffer ){
- fprintf( stderr, "error allocating buffer.\n" );
- return -1;
- }
-
- fread( data.buffer, sizeof(short), data.bufferSampleCount, fp );
- fclose( fp );
-
- data.playbackIndex = 0;
-
- err = Pa_Initialize();
- if( err != paNoError ) goto error;
-
- deviceIndex = Pa_GetHostApiInfo( Pa_HostApiTypeIdToHostApiIndex( paMME ) )->defaultOutputDevice;
- if( argc >= 3 ){
- sscanf( argv[1], "%d", &deviceIndex );
- }
-
- printf( "using device id %d (%s)\n", deviceIndex, Pa_GetDeviceInfo(deviceIndex)->name );
-
-
- outputParameters.device = deviceIndex;
- outputParameters.channelCount = CHANNEL_COUNT;
- outputParameters.sampleFormat = paInt16; /* IMPORTANT must use paInt16 for WMME AC3 */
- outputParameters.suggestedLatency = Pa_GetDeviceInfo( outputParameters.device )->defaultLowOutputLatency;
- outputParameters.hostApiSpecificStreamInfo = NULL;
-
- wmmeStreamInfo.size = sizeof(PaWinMmeStreamInfo);
- wmmeStreamInfo.hostApiType = paMME;
- wmmeStreamInfo.version = 1;
- wmmeStreamInfo.flags = paWinMmeWaveFormatDolbyAc3Spdif;
- outputParameters.hostApiSpecificStreamInfo = &wmmeStreamInfo;
-
-
- if( Pa_IsFormatSupported( 0, &outputParameters, SAMPLE_RATE ) == paFormatIsSupported ){
- printf( "Pa_IsFormatSupported reports device will support %d channels.\n", CHANNEL_COUNT );
- }else{
- printf( "Pa_IsFormatSupported reports device will not support %d channels.\n", CHANNEL_COUNT );
- }
-
- err = Pa_OpenStream(
- &stream,
- NULL, /* no input */
- &outputParameters,
- SAMPLE_RATE,
- FRAMES_PER_BUFFER,
- 0,
- patestCallback,
- &data );
- if( err != paNoError ) goto error;
-
- err = Pa_StartStream( stream );
- if( err != paNoError ) goto error;
-
- printf("Play for %d seconds.\n", NUM_SECONDS );
- Pa_Sleep( NUM_SECONDS * 1000 );
-
- err = Pa_StopStream( stream );
- if( err != paNoError ) goto error;
-
- err = Pa_CloseStream( stream );
- if( err != paNoError ) goto error;
-
- Pa_Terminate();
- free( data.buffer );
- printf("Test finished.\n");
-
- return err;
-error:
- Pa_Terminate();
- free( data.buffer );
-
- fprintf( stderr, "An error occured while using the portaudio stream\n" );
- fprintf( stderr, "Error number: %d\n", err );
- fprintf( stderr, "Error message: %s\n", Pa_GetErrorText( err ) );
- return err;
-}
-
+/** @file paex_wmme_ac3.c
+ @ingroup examples_src
+ @brief Use WMME-specific interface to send raw AC3 data to a S/PDIF output.
+ @author Ross Bencina
+*/
+/*
+ * $Id: $
+ * Portable Audio I/O Library
+ * Windows MME ac3 sound output test
+ *
+ * Copyright (c) 2009 Ross Bencina
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/*
+ * The text above constitutes the entire PortAudio license; however,
+ * the PortAudio community also makes the following non-binding requests:
+ *
+ * Any person wishing to distribute modifications to the Software is
+ * requested to send the modifications to the original developer so that
+ * they can be incorporated into the canonical version. It is also
+ * requested that these non-binding requests be included along with the
+ * license above.
+ */
+
+#include
+#include
+
+#include /* required when using pa_win_wmme.h */
+#include /* required when using pa_win_wmme.h */
+
+#include "portaudio.h"
+#include "pa_win_wmme.h"
+
+#define NUM_SECONDS (20)
+#define SAMPLE_RATE (48000)
+#define FRAMES_PER_BUFFER (64)
+
+#ifndef M_PI
+#define M_PI (3.14159265)
+#endif
+
+#define TABLE_SIZE (100)
+
+#define CHANNEL_COUNT (2)
+
+
+
+typedef struct
+{
+ short *buffer;
+ int bufferSampleCount;
+ int playbackIndex;
+}
+paTestData;
+
+/* This routine will be called by the PortAudio engine when audio is needed.
+** It may called at interrupt level on some machines so don't do anything
+** that could mess up the system like calling malloc() or free().
+*/
+static int patestCallback( const void *inputBuffer, void *outputBuffer,
+ unsigned long framesPerBuffer,
+ const PaStreamCallbackTimeInfo* timeInfo,
+ PaStreamCallbackFlags statusFlags,
+ void *userData )
+{
+ paTestData *data = (paTestData*)userData;
+ short *out = (short*)outputBuffer;
+ unsigned long i,j;
+
+ (void) timeInfo; /* Prevent unused variable warnings. */
+ (void) statusFlags;
+ (void) inputBuffer;
+
+ /* stream out contents of data->buffer looping at end */
+
+ for( i=0; ibuffer[ data->playbackIndex++ ];
+
+ if( data->playbackIndex >= data->bufferSampleCount )
+ data->playbackIndex = 0; /* loop at end of buffer */
+ }
+ }
+
+ return paContinue;
+}
+
+/*******************************************************************/
+int main(int argc, char* argv[])
+{
+ PaStreamParameters outputParameters;
+ PaWinMmeStreamInfo wmmeStreamInfo;
+ PaStream *stream;
+ PaError err;
+ paTestData data;
+ int deviceIndex;
+ FILE *fp;
+ const char *fileName = "c:\\test_48k.ac3.spdif";
+ data.buffer = NULL;
+
+ printf("usage: patest_wmme_ac3 fileName [paDeviceIndex]\n");
+ printf("**IMPORTANT*** The provided file must include the spdif preamble at the start of every AC-3 frame. Using a normal ac3 file won't work.\n");
+ printf("PortAudio Test: output a raw spdif ac3 stream. SR = %d, BufSize = %d, Chans = %d\n",
+ SAMPLE_RATE, FRAMES_PER_BUFFER, CHANNEL_COUNT);
+
+
+ if( argc >= 2 )
+ fileName = argv[1];
+
+ printf( "reading spdif ac3 raw stream file %s\n", fileName );
+
+ fp = fopen( fileName, "rb" );
+ if( !fp ){
+ fprintf( stderr, "error opening spdif ac3 file.\n" );
+ return -1;
+ }
+ /* get file size */
+ fseek( fp, 0, SEEK_END );
+ data.bufferSampleCount = ftell( fp ) / sizeof(short);
+ fseek( fp, 0, SEEK_SET );
+
+ /* allocate buffer, read the whole file into memory */
+ data.buffer = (short*)malloc( data.bufferSampleCount * sizeof(short) );
+ if( !data.buffer ){
+ fprintf( stderr, "error allocating buffer.\n" );
+ return -1;
+ }
+
+ fread( data.buffer, sizeof(short), data.bufferSampleCount, fp );
+ fclose( fp );
+
+ data.playbackIndex = 0;
+
+ err = Pa_Initialize();
+ if( err != paNoError ) goto error;
+
+ deviceIndex = Pa_GetHostApiInfo( Pa_HostApiTypeIdToHostApiIndex( paMME ) )->defaultOutputDevice;
+ if( argc >= 3 ){
+ sscanf( argv[1], "%d", &deviceIndex );
+ }
+
+ printf( "using device id %d (%s)\n", deviceIndex, Pa_GetDeviceInfo(deviceIndex)->name );
+
+
+ outputParameters.device = deviceIndex;
+ outputParameters.channelCount = CHANNEL_COUNT;
+ outputParameters.sampleFormat = paInt16; /* IMPORTANT must use paInt16 for WMME AC3 */
+ outputParameters.suggestedLatency = Pa_GetDeviceInfo( outputParameters.device )->defaultLowOutputLatency;
+ outputParameters.hostApiSpecificStreamInfo = NULL;
+
+ wmmeStreamInfo.size = sizeof(PaWinMmeStreamInfo);
+ wmmeStreamInfo.hostApiType = paMME;
+ wmmeStreamInfo.version = 1;
+ wmmeStreamInfo.flags = paWinMmeWaveFormatDolbyAc3Spdif;
+ outputParameters.hostApiSpecificStreamInfo = &wmmeStreamInfo;
+
+
+ if( Pa_IsFormatSupported( 0, &outputParameters, SAMPLE_RATE ) == paFormatIsSupported ){
+ printf( "Pa_IsFormatSupported reports device will support %d channels.\n", CHANNEL_COUNT );
+ }else{
+ printf( "Pa_IsFormatSupported reports device will not support %d channels.\n", CHANNEL_COUNT );
+ }
+
+ err = Pa_OpenStream(
+ &stream,
+ NULL, /* no input */
+ &outputParameters,
+ SAMPLE_RATE,
+ FRAMES_PER_BUFFER,
+ 0,
+ patestCallback,
+ &data );
+ if( err != paNoError ) goto error;
+
+ err = Pa_StartStream( stream );
+ if( err != paNoError ) goto error;
+
+ printf("Play for %d seconds.\n", NUM_SECONDS );
+ Pa_Sleep( NUM_SECONDS * 1000 );
+
+ err = Pa_StopStream( stream );
+ if( err != paNoError ) goto error;
+
+ err = Pa_CloseStream( stream );
+ if( err != paNoError ) goto error;
+
+ Pa_Terminate();
+ free( data.buffer );
+ printf("Test finished.\n");
+
+ return err;
+error:
+ Pa_Terminate();
+ free( data.buffer );
+
+ fprintf( stderr, "An error occured while using the portaudio stream\n" );
+ fprintf( stderr, "Error number: %d\n", err );
+ fprintf( stderr, "Error message: %s\n", Pa_GetErrorText( err ) );
+ return err;
+}
+
diff --git a/examples/paex_wmme_surround.c b/examples/paex_wmme_surround.c
index 9940101..ddab73d 100644
--- a/examples/paex_wmme_surround.c
+++ b/examples/paex_wmme_surround.c
@@ -1,211 +1,211 @@
-/** @file paex_wmme_surround.c
- @ingroup examples_src
- @brief Use WMME-specific channelMask to request 5.1 surround sound output.
- @author Ross Bencina
-*/
-/*
- * $Id: $
- * Portable Audio I/O Library
- * Windows MME surround sound output test
- *
- * Copyright (c) 2007 Ross Bencina
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files
- * (the "Software"), to deal in the Software without restriction,
- * including without limitation the rights to use, copy, modify, merge,
- * publish, distribute, sublicense, and/or sell copies of the Software,
- * and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/*
- * The text above constitutes the entire PortAudio license; however,
- * the PortAudio community also makes the following non-binding requests:
- *
- * Any person wishing to distribute modifications to the Software is
- * requested to send the modifications to the original developer so that
- * they can be incorporated into the canonical version. It is also
- * requested that these non-binding requests be included along with the
- * license above.
- */
-
-#include
-#include
-
-#include /* required when using pa_win_wmme.h */
-#include /* required when using pa_win_wmme.h */
-
-#include "portaudio.h"
-#include "pa_win_wmme.h"
-
-#define NUM_SECONDS (12)
-#define SAMPLE_RATE (44100)
-#define FRAMES_PER_BUFFER (64)
-
-#ifndef M_PI
-#define M_PI (3.14159265)
-#endif
-
-#define TABLE_SIZE (100)
-
-#define CHANNEL_COUNT (6)
-
-
-
-typedef struct
-{
- float sine[TABLE_SIZE];
- int phase;
- int currentChannel;
- int cycleCount;
-}
-paTestData;
-
-/* This routine will be called by the PortAudio engine when audio is needed.
-** It may called at interrupt level on some machines so don't do anything
-** that could mess up the system like calling malloc() or free().
-*/
-static int patestCallback( const void *inputBuffer, void *outputBuffer,
- unsigned long framesPerBuffer,
- const PaStreamCallbackTimeInfo* timeInfo,
- PaStreamCallbackFlags statusFlags,
- void *userData )
-{
- paTestData *data = (paTestData*)userData;
- float *out = (float*)outputBuffer;
- unsigned long i,j;
-
- (void) timeInfo; /* Prevent unused variable warnings. */
- (void) statusFlags;
- (void) inputBuffer;
-
- for( i=0; icurrentChannel && data->cycleCount < 4410 ){
- *out++ = data->sine[data->phase];
- data->phase += 1 + j; // play each channel at a different pitch so they can be distinguished
- if( data->phase >= TABLE_SIZE ){
- data->phase -= TABLE_SIZE;
- }
- }else{
- *out++ = 0;
- }
- }
-
- data->cycleCount++;
- if( data->cycleCount > 44100 ){
- data->cycleCount = 0;
-
- ++data->currentChannel;
- if( data->currentChannel >= CHANNEL_COUNT )
- data->currentChannel -= CHANNEL_COUNT;
- }
- }
-
- return paContinue;
-}
-
-/*******************************************************************/
-int main(int argc, char* argv[])
-{
- PaStreamParameters outputParameters;
- PaWinMmeStreamInfo wmmeStreamInfo;
- PaStream *stream;
- PaError err;
- paTestData data;
- int i;
- int deviceIndex;
-
- printf("PortAudio Test: output a sine blip on each channel. SR = %d, BufSize = %d, Chans = %d\n", SAMPLE_RATE, FRAMES_PER_BUFFER, CHANNEL_COUNT);
-
- err = Pa_Initialize();
- if( err != paNoError ) goto error;
-
- deviceIndex = Pa_GetHostApiInfo( Pa_HostApiTypeIdToHostApiIndex( paMME ) )->defaultOutputDevice;
- if( argc == 2 ){
- sscanf( argv[1], "%d", &deviceIndex );
- }
-
- printf( "using device id %d (%s)\n", deviceIndex, Pa_GetDeviceInfo(deviceIndex)->name );
-
- /* initialise sinusoidal wavetable */
- for( i=0; idefaultLowOutputLatency;
- outputParameters.hostApiSpecificStreamInfo = NULL;
-
- /* it's not strictly necessary to provide a channelMask for surround sound
- output. But if you want to be sure which channel mask PortAudio will use
- then you should supply one */
- wmmeStreamInfo.size = sizeof(PaWinMmeStreamInfo);
- wmmeStreamInfo.hostApiType = paMME;
- wmmeStreamInfo.version = 1;
- wmmeStreamInfo.flags = paWinMmeUseChannelMask;
- wmmeStreamInfo.channelMask = PAWIN_SPEAKER_5POINT1; /* request 5.1 output format */
- outputParameters.hostApiSpecificStreamInfo = &wmmeStreamInfo;
-
-
- if( Pa_IsFormatSupported( 0, &outputParameters, SAMPLE_RATE ) == paFormatIsSupported ){
- printf( "Pa_IsFormatSupported reports device will support %d channels.\n", CHANNEL_COUNT );
- }else{
- printf( "Pa_IsFormatSupported reports device will not support %d channels.\n", CHANNEL_COUNT );
- }
-
- err = Pa_OpenStream(
- &stream,
- NULL, /* no input */
- &outputParameters,
- SAMPLE_RATE,
- FRAMES_PER_BUFFER,
- paClipOff, /* we won't output out of range samples so don't bother clipping them */
- patestCallback,
- &data );
- if( err != paNoError ) goto error;
-
- err = Pa_StartStream( stream );
- if( err != paNoError ) goto error;
-
- printf("Play for %d seconds.\n", NUM_SECONDS );
- Pa_Sleep( NUM_SECONDS * 1000 );
-
- err = Pa_StopStream( stream );
- if( err != paNoError ) goto error;
-
- err = Pa_CloseStream( stream );
- if( err != paNoError ) goto error;
-
- Pa_Terminate();
- printf("Test finished.\n");
-
- return err;
-error:
- Pa_Terminate();
- fprintf( stderr, "An error occured while using the portaudio stream\n" );
- fprintf( stderr, "Error number: %d\n", err );
- fprintf( stderr, "Error message: %s\n", Pa_GetErrorText( err ) );
- return err;
-}
-
+/** @file paex_wmme_surround.c
+ @ingroup examples_src
+ @brief Use WMME-specific channelMask to request 5.1 surround sound output.
+ @author Ross Bencina
+*/
+/*
+ * $Id: $
+ * Portable Audio I/O Library
+ * Windows MME surround sound output test
+ *
+ * Copyright (c) 2007 Ross Bencina
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/*
+ * The text above constitutes the entire PortAudio license; however,
+ * the PortAudio community also makes the following non-binding requests:
+ *
+ * Any person wishing to distribute modifications to the Software is
+ * requested to send the modifications to the original developer so that
+ * they can be incorporated into the canonical version. It is also
+ * requested that these non-binding requests be included along with the
+ * license above.
+ */
+
+#include
+#include
+
+#include /* required when using pa_win_wmme.h */
+#include /* required when using pa_win_wmme.h */
+
+#include "portaudio.h"
+#include "pa_win_wmme.h"
+
+#define NUM_SECONDS (12)
+#define SAMPLE_RATE (44100)
+#define FRAMES_PER_BUFFER (64)
+
+#ifndef M_PI
+#define M_PI (3.14159265)
+#endif
+
+#define TABLE_SIZE (100)
+
+#define CHANNEL_COUNT (6)
+
+
+
+typedef struct
+{
+ float sine[TABLE_SIZE];
+ int phase;
+ int currentChannel;
+ int cycleCount;
+}
+paTestData;
+
+/* This routine will be called by the PortAudio engine when audio is needed.
+** It may called at interrupt level on some machines so don't do anything
+** that could mess up the system like calling malloc() or free().
+*/
+static int patestCallback( const void *inputBuffer, void *outputBuffer,
+ unsigned long framesPerBuffer,
+ const PaStreamCallbackTimeInfo* timeInfo,
+ PaStreamCallbackFlags statusFlags,
+ void *userData )
+{
+ paTestData *data = (paTestData*)userData;
+ float *out = (float*)outputBuffer;
+ unsigned long i,j;
+
+ (void) timeInfo; /* Prevent unused variable warnings. */
+ (void) statusFlags;
+ (void) inputBuffer;
+
+ for( i=0; icurrentChannel && data->cycleCount < 4410 ){
+ *out++ = data->sine[data->phase];
+ data->phase += 1 + j; // play each channel at a different pitch so they can be distinguished
+ if( data->phase >= TABLE_SIZE ){
+ data->phase -= TABLE_SIZE;
+ }
+ }else{
+ *out++ = 0;
+ }
+ }
+
+ data->cycleCount++;
+ if( data->cycleCount > 44100 ){
+ data->cycleCount = 0;
+
+ ++data->currentChannel;
+ if( data->currentChannel >= CHANNEL_COUNT )
+ data->currentChannel -= CHANNEL_COUNT;
+ }
+ }
+
+ return paContinue;
+}
+
+/*******************************************************************/
+int main(int argc, char* argv[])
+{
+ PaStreamParameters outputParameters;
+ PaWinMmeStreamInfo wmmeStreamInfo;
+ PaStream *stream;
+ PaError err;
+ paTestData data;
+ int i;
+ int deviceIndex;
+
+ printf("PortAudio Test: output a sine blip on each channel. SR = %d, BufSize = %d, Chans = %d\n", SAMPLE_RATE, FRAMES_PER_BUFFER, CHANNEL_COUNT);
+
+ err = Pa_Initialize();
+ if( err != paNoError ) goto error;
+
+ deviceIndex = Pa_GetHostApiInfo( Pa_HostApiTypeIdToHostApiIndex( paMME ) )->defaultOutputDevice;
+ if( argc == 2 ){
+ sscanf( argv[1], "%d", &deviceIndex );
+ }
+
+ printf( "using device id %d (%s)\n", deviceIndex, Pa_GetDeviceInfo(deviceIndex)->name );
+
+ /* initialise sinusoidal wavetable */
+ for( i=0; idefaultLowOutputLatency;
+ outputParameters.hostApiSpecificStreamInfo = NULL;
+
+ /* it's not strictly necessary to provide a channelMask for surround sound
+ output. But if you want to be sure which channel mask PortAudio will use
+ then you should supply one */
+ wmmeStreamInfo.size = sizeof(PaWinMmeStreamInfo);
+ wmmeStreamInfo.hostApiType = paMME;
+ wmmeStreamInfo.version = 1;
+ wmmeStreamInfo.flags = paWinMmeUseChannelMask;
+ wmmeStreamInfo.channelMask = PAWIN_SPEAKER_5POINT1; /* request 5.1 output format */
+ outputParameters.hostApiSpecificStreamInfo = &wmmeStreamInfo;
+
+
+ if( Pa_IsFormatSupported( 0, &outputParameters, SAMPLE_RATE ) == paFormatIsSupported ){
+ printf( "Pa_IsFormatSupported reports device will support %d channels.\n", CHANNEL_COUNT );
+ }else{
+ printf( "Pa_IsFormatSupported reports device will not support %d channels.\n", CHANNEL_COUNT );
+ }
+
+ err = Pa_OpenStream(
+ &stream,
+ NULL, /* no input */
+ &outputParameters,
+ SAMPLE_RATE,
+ FRAMES_PER_BUFFER,
+ paClipOff, /* we won't output out of range samples so don't bother clipping them */
+ patestCallback,
+ &data );
+ if( err != paNoError ) goto error;
+
+ err = Pa_StartStream( stream );
+ if( err != paNoError ) goto error;
+
+ printf("Play for %d seconds.\n", NUM_SECONDS );
+ Pa_Sleep( NUM_SECONDS * 1000 );
+
+ err = Pa_StopStream( stream );
+ if( err != paNoError ) goto error;
+
+ err = Pa_CloseStream( stream );
+ if( err != paNoError ) goto error;
+
+ Pa_Terminate();
+ printf("Test finished.\n");
+
+ return err;
+error:
+ Pa_Terminate();
+ fprintf( stderr, "An error occured while using the portaudio stream\n" );
+ fprintf( stderr, "Error number: %d\n", err );
+ fprintf( stderr, "Error message: %s\n", Pa_GetErrorText( err ) );
+ return err;
+}
+
diff --git a/include/pa_win_ds.h b/include/pa_win_ds.h
index aff8c33..5d38641 100644
--- a/include/pa_win_ds.h
+++ b/include/pa_win_ds.h
@@ -1,95 +1,95 @@
-#ifndef PA_WIN_DS_H
-#define PA_WIN_DS_H
-/*
- * $Id: $
- * PortAudio Portable Real-Time Audio Library
- * DirectSound specific extensions
- *
- * Copyright (c) 1999-2007 Ross Bencina and Phil Burk
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files
- * (the "Software"), to deal in the Software without restriction,
- * including without limitation the rights to use, copy, modify, merge,
- * publish, distribute, sublicense, and/or sell copies of the Software,
- * and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/*
- * The text above constitutes the entire PortAudio license; however,
- * the PortAudio community also makes the following non-binding requests:
- *
- * Any person wishing to distribute modifications to the Software is
- * requested to send the modifications to the original developer so that
- * they can be incorporated into the canonical version. It is also
- * requested that these non-binding requests be included along with the
- * license above.
- */
-
-/** @file
- @ingroup public_header
- @brief DirectSound-specific PortAudio API extension header file.
-*/
-
-#include "portaudio.h"
-#include "pa_win_waveformat.h"
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif /* __cplusplus */
-
-
-#define paWinDirectSoundUseLowLevelLatencyParameters (0x01)
-#define paWinDirectSoundUseChannelMask (0x04)
-
-
-typedef struct PaWinDirectSoundStreamInfo{
- unsigned long size; /**< sizeof(PaWinDirectSoundStreamInfo) */
- PaHostApiTypeId hostApiType; /**< paDirectSound */
- unsigned long version; /**< 2 */
-
- unsigned long flags; /**< enable other features of this struct */
-
- /**
- low-level latency setting support
- Sets the size of the DirectSound host buffer.
- When flags contains the paWinDirectSoundUseLowLevelLatencyParameters
- this size will be used instead of interpreting the generic latency
- parameters to Pa_OpenStream(). If the flag is not set this value is ignored.
-
- If the stream is a full duplex stream the implementation requires that
- the values of framesPerBuffer for input and output match (if both are specified).
- */
- unsigned long framesPerBuffer;
-
- /**
- support for WAVEFORMATEXTENSIBLE channel masks. If flags contains
- paWinDirectSoundUseChannelMask this allows you to specify which speakers
- to address in a multichannel stream. Constants for channelMask
- are specified in pa_win_waveformat.h
-
- */
- PaWinWaveFormatChannelMask channelMask;
-
-}PaWinDirectSoundStreamInfo;
-
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* PA_WIN_DS_H */
+#ifndef PA_WIN_DS_H
+#define PA_WIN_DS_H
+/*
+ * $Id: $
+ * PortAudio Portable Real-Time Audio Library
+ * DirectSound specific extensions
+ *
+ * Copyright (c) 1999-2007 Ross Bencina and Phil Burk
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/*
+ * The text above constitutes the entire PortAudio license; however,
+ * the PortAudio community also makes the following non-binding requests:
+ *
+ * Any person wishing to distribute modifications to the Software is
+ * requested to send the modifications to the original developer so that
+ * they can be incorporated into the canonical version. It is also
+ * requested that these non-binding requests be included along with the
+ * license above.
+ */
+
+/** @file
+ @ingroup public_header
+ @brief DirectSound-specific PortAudio API extension header file.
+*/
+
+#include "portaudio.h"
+#include "pa_win_waveformat.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+
+#define paWinDirectSoundUseLowLevelLatencyParameters (0x01)
+#define paWinDirectSoundUseChannelMask (0x04)
+
+
+typedef struct PaWinDirectSoundStreamInfo{
+ unsigned long size; /**< sizeof(PaWinDirectSoundStreamInfo) */
+ PaHostApiTypeId hostApiType; /**< paDirectSound */
+ unsigned long version; /**< 2 */
+
+ unsigned long flags; /**< enable other features of this struct */
+
+ /**
+ low-level latency setting support
+ Sets the size of the DirectSound host buffer.
+ When flags contains the paWinDirectSoundUseLowLevelLatencyParameters
+ this size will be used instead of interpreting the generic latency
+ parameters to Pa_OpenStream(). If the flag is not set this value is ignored.
+
+ If the stream is a full duplex stream the implementation requires that
+ the values of framesPerBuffer for input and output match (if both are specified).
+ */
+ unsigned long framesPerBuffer;
+
+ /**
+ support for WAVEFORMATEXTENSIBLE channel masks. If flags contains
+ paWinDirectSoundUseChannelMask this allows you to specify which speakers
+ to address in a multichannel stream. Constants for channelMask
+ are specified in pa_win_waveformat.h
+
+ */
+ PaWinWaveFormatChannelMask channelMask;
+
+}PaWinDirectSoundStreamInfo;
+
+
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* PA_WIN_DS_H */
diff --git a/include/pa_win_wasapi.h b/include/pa_win_wasapi.h
index 40d3a09..bfc167a 100644
--- a/include/pa_win_wasapi.h
+++ b/include/pa_win_wasapi.h
@@ -1,433 +1,433 @@
-#ifndef PA_WIN_WASAPI_H
-#define PA_WIN_WASAPI_H
-/*
- * $Id: $
- * PortAudio Portable Real-Time Audio Library
- * DirectSound specific extensions
- *
- * Copyright (c) 1999-2007 Ross Bencina and Phil Burk
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files
- * (the "Software"), to deal in the Software without restriction,
- * including without limitation the rights to use, copy, modify, merge,
- * publish, distribute, sublicense, and/or sell copies of the Software,
- * and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/*
- * The text above constitutes the entire PortAudio license; however,
- * the PortAudio community also makes the following non-binding requests:
- *
- * Any person wishing to distribute modifications to the Software is
- * requested to send the modifications to the original developer so that
- * they can be incorporated into the canonical version. It is also
- * requested that these non-binding requests be included along with the
- * license above.
- */
-
-/** @file
- @ingroup public_header
- @brief WASAPI-specific PortAudio API extension header file.
-*/
-
-#include "portaudio.h"
-#include "pa_win_waveformat.h"
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif /* __cplusplus */
-
-
-/* Setup flags */
-typedef enum PaWasapiFlags
-{
- /* puts WASAPI into exclusive mode */
- paWinWasapiExclusive = (1 << 0),
-
- /* allows to skip internal PA processing completely */
- paWinWasapiRedirectHostProcessor = (1 << 1),
-
- /* assigns custom channel mask */
- paWinWasapiUseChannelMask = (1 << 2),
-
- /* selects non-Event driven method of data read/write
- Note: WASAPI Event driven core is capable of 2ms latency!!!, but Polling
- method can only provide 15-20ms latency. */
- paWinWasapiPolling = (1 << 3),
-
- /* forces custom thread priority setting, must be used if PaWasapiStreamInfo::threadPriority
- is set to a custom value */
- paWinWasapiThreadPriority = (1 << 4)
-}
-PaWasapiFlags;
-#define paWinWasapiExclusive (paWinWasapiExclusive)
-#define paWinWasapiRedirectHostProcessor (paWinWasapiRedirectHostProcessor)
-#define paWinWasapiUseChannelMask (paWinWasapiUseChannelMask)
-#define paWinWasapiPolling (paWinWasapiPolling)
-#define paWinWasapiThreadPriority (paWinWasapiThreadPriority)
-
-
-/* Host processor. Allows to skip internal PA processing completely.
- You must set paWinWasapiRedirectHostProcessor flag to PaWasapiStreamInfo::flags member
- in order to have host processor redirected to your callback.
- Use with caution! inputFrames and outputFrames depend solely on final device setup.
- To query maximal values of inputFrames/outputFrames use PaWasapi_GetFramesPerHostBuffer.
-*/
-typedef void (*PaWasapiHostProcessorCallback) (void *inputBuffer, long inputFrames,
- void *outputBuffer, long outputFrames,
- void *userData);
-
-/* Device role. */
-typedef enum PaWasapiDeviceRole
-{
- eRoleRemoteNetworkDevice = 0,
- eRoleSpeakers,
- eRoleLineLevel,
- eRoleHeadphones,
- eRoleMicrophone,
- eRoleHeadset,
- eRoleHandset,
- eRoleUnknownDigitalPassthrough,
- eRoleSPDIF,
- eRoleHDMI,
- eRoleUnknownFormFactor
-}
-PaWasapiDeviceRole;
-
-
-/* Jack connection type. */
-typedef enum PaWasapiJackConnectionType
-{
- eJackConnTypeUnknown,
- eJackConnType3Point5mm,
- eJackConnTypeQuarter,
- eJackConnTypeAtapiInternal,
- eJackConnTypeRCA,
- eJackConnTypeOptical,
- eJackConnTypeOtherDigital,
- eJackConnTypeOtherAnalog,
- eJackConnTypeMultichannelAnalogDIN,
- eJackConnTypeXlrProfessional,
- eJackConnTypeRJ11Modem,
- eJackConnTypeCombination
-}
-PaWasapiJackConnectionType;
-
-
-/* Jack geometric location. */
-typedef enum PaWasapiJackGeoLocation
-{
- eJackGeoLocUnk = 0,
- eJackGeoLocRear = 0x1, /* matches EPcxGeoLocation::eGeoLocRear */
- eJackGeoLocFront,
- eJackGeoLocLeft,
- eJackGeoLocRight,
- eJackGeoLocTop,
- eJackGeoLocBottom,
- eJackGeoLocRearPanel,
- eJackGeoLocRiser,
- eJackGeoLocInsideMobileLid,
- eJackGeoLocDrivebay,
- eJackGeoLocHDMI,
- eJackGeoLocOutsideMobileLid,
- eJackGeoLocATAPI,
- eJackGeoLocReserved5,
- eJackGeoLocReserved6,
-}
-PaWasapiJackGeoLocation;
-
-
-/* Jack general location. */
-typedef enum PaWasapiJackGenLocation
-{
- eJackGenLocPrimaryBox = 0,
- eJackGenLocInternal,
- eJackGenLocSeparate,
- eJackGenLocOther
-}
-PaWasapiJackGenLocation;
-
-
-/* Jack's type of port. */
-typedef enum PaWasapiJackPortConnection
-{
- eJackPortConnJack = 0,
- eJackPortConnIntegratedDevice,
- eJackPortConnBothIntegratedAndJack,
- eJackPortConnUnknown
-}
-PaWasapiJackPortConnection;
-
-
-/* Thread priority. */
-typedef enum PaWasapiThreadPriority
-{
- eThreadPriorityNone = 0,
- eThreadPriorityAudio, //!< Default for Shared mode.
- eThreadPriorityCapture,
- eThreadPriorityDistribution,
- eThreadPriorityGames,
- eThreadPriorityPlayback,
- eThreadPriorityProAudio, //!< Default for Exclusive mode.
- eThreadPriorityWindowManager
-}
-PaWasapiThreadPriority;
-
-
-/* Stream descriptor. */
-typedef struct PaWasapiJackDescription
-{
- unsigned long channelMapping;
- unsigned long color; /* derived from macro: #define RGB(r,g,b) ((COLORREF)(((BYTE)(r)|((WORD)((BYTE)(g))<<8))|(((DWORD)(BYTE)(b))<<16))) */
- PaWasapiJackConnectionType connectionType;
- PaWasapiJackGeoLocation geoLocation;
- PaWasapiJackGenLocation genLocation;
- PaWasapiJackPortConnection portConnection;
- unsigned int isConnected;
-}
-PaWasapiJackDescription;
-
-
-/* Stream category.
- Note:
- - values are equal to WASAPI AUDIO_STREAM_CATEGORY enum
- - supported since Windows 8.0, noop on earler versions
- - values 1,2 are deprecated on Windows 10 and not included into enumeration
-*/
-typedef enum PaWasapiStreamCategory
-{
- eAudioCategoryOther = 0,
- eAudioCategoryCommunications = 3,
- eAudioCategoryAlerts = 4,
- eAudioCategorySoundEffects = 5,
- eAudioCategoryGameEffects = 6,
- eAudioCategoryGameMedia = 7,
- eAudioCategoryGameChat = 8,
- eAudioCategorySpeech = 9,
- eAudioCategoryMovie = 10,
- eAudioCategoryMedia = 11
-}
-PaWasapiStreamCategory;
-
-
-/* Stream option.
- Note:
- - values are equal to WASAPI AUDCLNT_STREAMOPTIONS enum
- - supported since Windows 8.1, noop on earler versions
-*/
-typedef enum PaWasapiStreamOption
-{
- eStreamOptionNone = 0, //!< default
- eStreamOptionRaw = 1, //!< bypass WASAPI Audio Engine DSP effects, supported since Windows 8.1
- eStreamOptionMatchFormat = 2 //!< force WASAPI Audio Engine into a stream format, supported since Windows 10
-}
-PaWasapiStreamOption;
-
-
-/* Stream descriptor. */
-typedef struct PaWasapiStreamInfo
-{
- unsigned long size; /**< sizeof(PaWasapiStreamInfo) */
- PaHostApiTypeId hostApiType; /**< paWASAPI */
- unsigned long version; /**< 1 */
-
- unsigned long flags; /**< collection of PaWasapiFlags */
-
- /* Support for WAVEFORMATEXTENSIBLE channel masks. If flags contains
- paWinWasapiUseChannelMask this allows you to specify which speakers
- to address in a multichannel stream. Constants for channelMask
- are specified in pa_win_waveformat.h. Will be used only if
- paWinWasapiUseChannelMask flag is specified.
- */
- PaWinWaveFormatChannelMask channelMask;
-
- /* Delivers raw data to callback obtained from GetBuffer() methods skipping
- internal PortAudio processing inventory completely. userData parameter will
- be the same that was passed to Pa_OpenStream method. Will be used only if
- paWinWasapiRedirectHostProcessor flag is specified.
- */
- PaWasapiHostProcessorCallback hostProcessorOutput;
- PaWasapiHostProcessorCallback hostProcessorInput;
-
- /* Specifies thread priority explicitly. Will be used only if paWinWasapiThreadPriority flag
- is specified.
-
- Please note, if Input/Output streams are opened simultaniously (Full-Duplex mode)
- you shall specify same value for threadPriority or othervise one of the values will be used
- to setup thread priority.
- */
- PaWasapiThreadPriority threadPriority;
-
- /* Stream category. */
- PaWasapiStreamCategory streamCategory;
-
- /* Stream option. */
- PaWasapiStreamOption streamOption;
-}
-PaWasapiStreamInfo;
-
-
-/** Returns default sound format for device. Format is represented by PaWinWaveFormat or
- WAVEFORMATEXTENSIBLE structure.
-
- @param pFormat Pointer to PaWinWaveFormat or WAVEFORMATEXTENSIBLE structure.
- @param nFormatSize Size of PaWinWaveFormat or WAVEFORMATEXTENSIBLE structure in bytes.
- @param nDevice Device index.
-
- @return Non-negative value indicating the number of bytes copied into format decriptor
- or, a PaErrorCode (which are always negative) if PortAudio is not initialized
- or an error is encountered.
-*/
-int PaWasapi_GetDeviceDefaultFormat( void *pFormat, unsigned int nFormatSize, PaDeviceIndex nDevice );
-
-
-/** Returns device role (PaWasapiDeviceRole enum).
-
- @param nDevice device index.
-
- @return Non-negative value indicating device role or, a PaErrorCode (which are always negative)
- if PortAudio is not initialized or an error is encountered.
-*/
-int/*PaWasapiDeviceRole*/ PaWasapi_GetDeviceRole( PaDeviceIndex nDevice );
-
-
-/** Boost thread priority of calling thread (MMCSS). Use it for Blocking Interface only for thread
- which makes calls to Pa_WriteStream/Pa_ReadStream.
-
- @param hTask Handle to pointer to priority task. Must be used with PaWasapi_RevertThreadPriority
- method to revert thread priority to initial state.
-
- @param nPriorityClass Id of thread priority of PaWasapiThreadPriority type. Specifying
- eThreadPriorityNone does nothing.
-
- @return Error code indicating success or failure.
- @see PaWasapi_RevertThreadPriority
-*/
-PaError PaWasapi_ThreadPriorityBoost( void **hTask, PaWasapiThreadPriority nPriorityClass );
-
-
-/** Boost thread priority of calling thread (MMCSS). Use it for Blocking Interface only for thread
- which makes calls to Pa_WriteStream/Pa_ReadStream.
-
- @param hTask Task handle obtained by PaWasapi_BoostThreadPriority method.
- @return Error code indicating success or failure.
- @see PaWasapi_BoostThreadPriority
-*/
-PaError PaWasapi_ThreadPriorityRevert( void *hTask );
-
-
-/** Get number of frames per host buffer. This is maximal value of frames of WASAPI buffer which
- can be locked for operations. Use this method as helper to findout maximal values of
- inputFrames/outputFrames of PaWasapiHostProcessorCallback.
-
- @param pStream Pointer to PaStream to query.
- @param nInput Pointer to variable to receive number of input frames. Can be NULL.
- @param nOutput Pointer to variable to receive number of output frames. Can be NULL.
- @return Error code indicating success or failure.
- @see PaWasapiHostProcessorCallback
-*/
-PaError PaWasapi_GetFramesPerHostBuffer( PaStream *pStream, unsigned int *nInput, unsigned int *nOutput );
-
-
-/** Get number of jacks associated with a WASAPI device. Use this method to determine if
- there are any jacks associated with the provided WASAPI device. Not all audio devices
- will support this capability. This is valid for both input and output devices.
- @param nDevice device index.
- @param jcount Number of jacks is returned in this variable
- @return Error code indicating success or failure
- @see PaWasapi_GetJackDescription
- */
-PaError PaWasapi_GetJackCount(PaDeviceIndex nDevice, int *jcount);
-
-
-/** Get the jack description associated with a WASAPI device and jack number
- Before this function is called, use PaWasapi_GetJackCount to determine the
- number of jacks associated with device. If jcount is greater than zero, then
- each jack from 0 to jcount can be queried with this function to get the jack
- description.
- @param nDevice device index.
- @param jindex Which jack to return information
- @param KSJACK_DESCRIPTION This structure filled in on success.
- @return Error code indicating success or failure
- @see PaWasapi_GetJackCount
- */
-PaError PaWasapi_GetJackDescription(PaDeviceIndex nDevice, int jindex, PaWasapiJackDescription *pJackDescription);
-
-
-/*
- IMPORTANT:
-
- WASAPI is implemented for Callback and Blocking interfaces. It supports Shared and Exclusive
- share modes.
-
- Exclusive Mode:
-
- Exclusive mode allows to deliver audio data directly to hardware bypassing
- software mixing.
- Exclusive mode is specified by 'paWinWasapiExclusive' flag.
-
- Callback Interface:
-
- Provides best audio quality with low latency. Callback interface is implemented in
- two versions:
-
- 1) Event-Driven:
- This is the most powerful WASAPI implementation which provides glitch-free
- audio at around 3ms latency in Exclusive mode. Lowest possible latency for this mode is
- 3 ms for HD Audio class audio chips. For the Shared mode latency can not be
- lower than 20 ms.
-
- 2) Poll-Driven:
- Polling is another 2-nd method to operate with WASAPI. It is less efficient than Event-Driven
- and provides latency at around 10-13ms. Polling must be used to overcome a system bug
- under Windows Vista x64 when application is WOW64(32-bit) and Event-Driven method simply
- times out (event handle is never signalled on buffer completion). Please note, such WOW64 bug
- does not exist in Vista x86 or Windows 7.
- Polling can be setup by speciying 'paWinWasapiPolling' flag. Our WASAPI implementation detects
- WOW64 bug and sets 'paWinWasapiPolling' automatically.
-
- Thread priority:
-
- Normally thread priority is set automatically and does not require modification. Although
- if user wants some tweaking thread priority can be modified by setting 'paWinWasapiThreadPriority'
- flag and specifying 'PaWasapiStreamInfo::threadPriority' with value from PaWasapiThreadPriority
- enum.
-
- Blocking Interface:
-
- Blocking interface is implemented but due to above described Poll-Driven method can not
- deliver lowest possible latency. Specifying too low latency in Shared mode will result in
- distorted audio although Exclusive mode adds stability.
-
- Pa_IsFormatSupported:
-
- To check format with correct Share Mode (Exclusive/Shared) you must supply
- PaWasapiStreamInfo with flags paWinWasapiExclusive set through member of
- PaStreamParameters::hostApiSpecificStreamInfo structure.
-
- Pa_OpenStream:
-
- To set desired Share Mode (Exclusive/Shared) you must supply
- PaWasapiStreamInfo with flags paWinWasapiExclusive set through member of
- PaStreamParameters::hostApiSpecificStreamInfo structure.
-*/
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* PA_WIN_WASAPI_H */
+#ifndef PA_WIN_WASAPI_H
+#define PA_WIN_WASAPI_H
+/*
+ * $Id: $
+ * PortAudio Portable Real-Time Audio Library
+ * DirectSound specific extensions
+ *
+ * Copyright (c) 1999-2007 Ross Bencina and Phil Burk
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/*
+ * The text above constitutes the entire PortAudio license; however,
+ * the PortAudio community also makes the following non-binding requests:
+ *
+ * Any person wishing to distribute modifications to the Software is
+ * requested to send the modifications to the original developer so that
+ * they can be incorporated into the canonical version. It is also
+ * requested that these non-binding requests be included along with the
+ * license above.
+ */
+
+/** @file
+ @ingroup public_header
+ @brief WASAPI-specific PortAudio API extension header file.
+*/
+
+#include "portaudio.h"
+#include "pa_win_waveformat.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+
+/* Setup flags */
+typedef enum PaWasapiFlags
+{
+ /* puts WASAPI into exclusive mode */
+ paWinWasapiExclusive = (1 << 0),
+
+ /* allows to skip internal PA processing completely */
+ paWinWasapiRedirectHostProcessor = (1 << 1),
+
+ /* assigns custom channel mask */
+ paWinWasapiUseChannelMask = (1 << 2),
+
+ /* selects non-Event driven method of data read/write
+ Note: WASAPI Event driven core is capable of 2ms latency!!!, but Polling
+ method can only provide 15-20ms latency. */
+ paWinWasapiPolling = (1 << 3),
+
+ /* forces custom thread priority setting, must be used if PaWasapiStreamInfo::threadPriority
+ is set to a custom value */
+ paWinWasapiThreadPriority = (1 << 4)
+}
+PaWasapiFlags;
+#define paWinWasapiExclusive (paWinWasapiExclusive)
+#define paWinWasapiRedirectHostProcessor (paWinWasapiRedirectHostProcessor)
+#define paWinWasapiUseChannelMask (paWinWasapiUseChannelMask)
+#define paWinWasapiPolling (paWinWasapiPolling)
+#define paWinWasapiThreadPriority (paWinWasapiThreadPriority)
+
+
+/* Host processor. Allows to skip internal PA processing completely.
+ You must set paWinWasapiRedirectHostProcessor flag to PaWasapiStreamInfo::flags member
+ in order to have host processor redirected to your callback.
+ Use with caution! inputFrames and outputFrames depend solely on final device setup.
+ To query maximal values of inputFrames/outputFrames use PaWasapi_GetFramesPerHostBuffer.
+*/
+typedef void (*PaWasapiHostProcessorCallback) (void *inputBuffer, long inputFrames,
+ void *outputBuffer, long outputFrames,
+ void *userData);
+
+/* Device role. */
+typedef enum PaWasapiDeviceRole
+{
+ eRoleRemoteNetworkDevice = 0,
+ eRoleSpeakers,
+ eRoleLineLevel,
+ eRoleHeadphones,
+ eRoleMicrophone,
+ eRoleHeadset,
+ eRoleHandset,
+ eRoleUnknownDigitalPassthrough,
+ eRoleSPDIF,
+ eRoleHDMI,
+ eRoleUnknownFormFactor
+}
+PaWasapiDeviceRole;
+
+
+/* Jack connection type. */
+typedef enum PaWasapiJackConnectionType
+{
+ eJackConnTypeUnknown,
+ eJackConnType3Point5mm,
+ eJackConnTypeQuarter,
+ eJackConnTypeAtapiInternal,
+ eJackConnTypeRCA,
+ eJackConnTypeOptical,
+ eJackConnTypeOtherDigital,
+ eJackConnTypeOtherAnalog,
+ eJackConnTypeMultichannelAnalogDIN,
+ eJackConnTypeXlrProfessional,
+ eJackConnTypeRJ11Modem,
+ eJackConnTypeCombination
+}
+PaWasapiJackConnectionType;
+
+
+/* Jack geometric location. */
+typedef enum PaWasapiJackGeoLocation
+{
+ eJackGeoLocUnk = 0,
+ eJackGeoLocRear = 0x1, /* matches EPcxGeoLocation::eGeoLocRear */
+ eJackGeoLocFront,
+ eJackGeoLocLeft,
+ eJackGeoLocRight,
+ eJackGeoLocTop,
+ eJackGeoLocBottom,
+ eJackGeoLocRearPanel,
+ eJackGeoLocRiser,
+ eJackGeoLocInsideMobileLid,
+ eJackGeoLocDrivebay,
+ eJackGeoLocHDMI,
+ eJackGeoLocOutsideMobileLid,
+ eJackGeoLocATAPI,
+ eJackGeoLocReserved5,
+ eJackGeoLocReserved6,
+}
+PaWasapiJackGeoLocation;
+
+
+/* Jack general location. */
+typedef enum PaWasapiJackGenLocation
+{
+ eJackGenLocPrimaryBox = 0,
+ eJackGenLocInternal,
+ eJackGenLocSeparate,
+ eJackGenLocOther
+}
+PaWasapiJackGenLocation;
+
+
+/* Jack's type of port. */
+typedef enum PaWasapiJackPortConnection
+{
+ eJackPortConnJack = 0,
+ eJackPortConnIntegratedDevice,
+ eJackPortConnBothIntegratedAndJack,
+ eJackPortConnUnknown
+}
+PaWasapiJackPortConnection;
+
+
+/* Thread priority. */
+typedef enum PaWasapiThreadPriority
+{
+ eThreadPriorityNone = 0,
+ eThreadPriorityAudio, //!< Default for Shared mode.
+ eThreadPriorityCapture,
+ eThreadPriorityDistribution,
+ eThreadPriorityGames,
+ eThreadPriorityPlayback,
+ eThreadPriorityProAudio, //!< Default for Exclusive mode.
+ eThreadPriorityWindowManager
+}
+PaWasapiThreadPriority;
+
+
+/* Stream descriptor. */
+typedef struct PaWasapiJackDescription
+{
+ unsigned long channelMapping;
+ unsigned long color; /* derived from macro: #define RGB(r,g,b) ((COLORREF)(((BYTE)(r)|((WORD)((BYTE)(g))<<8))|(((DWORD)(BYTE)(b))<<16))) */
+ PaWasapiJackConnectionType connectionType;
+ PaWasapiJackGeoLocation geoLocation;
+ PaWasapiJackGenLocation genLocation;
+ PaWasapiJackPortConnection portConnection;
+ unsigned int isConnected;
+}
+PaWasapiJackDescription;
+
+
+/* Stream category.
+ Note:
+ - values are equal to WASAPI AUDIO_STREAM_CATEGORY enum
+ - supported since Windows 8.0, noop on earler versions
+ - values 1,2 are deprecated on Windows 10 and not included into enumeration
+*/
+typedef enum PaWasapiStreamCategory
+{
+ eAudioCategoryOther = 0,
+ eAudioCategoryCommunications = 3,
+ eAudioCategoryAlerts = 4,
+ eAudioCategorySoundEffects = 5,
+ eAudioCategoryGameEffects = 6,
+ eAudioCategoryGameMedia = 7,
+ eAudioCategoryGameChat = 8,
+ eAudioCategorySpeech = 9,
+ eAudioCategoryMovie = 10,
+ eAudioCategoryMedia = 11
+}
+PaWasapiStreamCategory;
+
+
+/* Stream option.
+ Note:
+ - values are equal to WASAPI AUDCLNT_STREAMOPTIONS enum
+ - supported since Windows 8.1, noop on earler versions
+*/
+typedef enum PaWasapiStreamOption
+{
+ eStreamOptionNone = 0, //!< default
+ eStreamOptionRaw = 1, //!< bypass WASAPI Audio Engine DSP effects, supported since Windows 8.1
+ eStreamOptionMatchFormat = 2 //!< force WASAPI Audio Engine into a stream format, supported since Windows 10
+}
+PaWasapiStreamOption;
+
+
+/* Stream descriptor. */
+typedef struct PaWasapiStreamInfo
+{
+ unsigned long size; /**< sizeof(PaWasapiStreamInfo) */
+ PaHostApiTypeId hostApiType; /**< paWASAPI */
+ unsigned long version; /**< 1 */
+
+ unsigned long flags; /**< collection of PaWasapiFlags */
+
+ /* Support for WAVEFORMATEXTENSIBLE channel masks. If flags contains
+ paWinWasapiUseChannelMask this allows you to specify which speakers
+ to address in a multichannel stream. Constants for channelMask
+ are specified in pa_win_waveformat.h. Will be used only if
+ paWinWasapiUseChannelMask flag is specified.
+ */
+ PaWinWaveFormatChannelMask channelMask;
+
+ /* Delivers raw data to callback obtained from GetBuffer() methods skipping
+ internal PortAudio processing inventory completely. userData parameter will
+ be the same that was passed to Pa_OpenStream method. Will be used only if
+ paWinWasapiRedirectHostProcessor flag is specified.
+ */
+ PaWasapiHostProcessorCallback hostProcessorOutput;
+ PaWasapiHostProcessorCallback hostProcessorInput;
+
+ /* Specifies thread priority explicitly. Will be used only if paWinWasapiThreadPriority flag
+ is specified.
+
+ Please note, if Input/Output streams are opened simultaniously (Full-Duplex mode)
+ you shall specify same value for threadPriority or othervise one of the values will be used
+ to setup thread priority.
+ */
+ PaWasapiThreadPriority threadPriority;
+
+ /* Stream category. */
+ PaWasapiStreamCategory streamCategory;
+
+ /* Stream option. */
+ PaWasapiStreamOption streamOption;
+}
+PaWasapiStreamInfo;
+
+
+/** Returns default sound format for device. Format is represented by PaWinWaveFormat or
+ WAVEFORMATEXTENSIBLE structure.
+
+ @param pFormat Pointer to PaWinWaveFormat or WAVEFORMATEXTENSIBLE structure.
+ @param nFormatSize Size of PaWinWaveFormat or WAVEFORMATEXTENSIBLE structure in bytes.
+ @param nDevice Device index.
+
+ @return Non-negative value indicating the number of bytes copied into format decriptor
+ or, a PaErrorCode (which are always negative) if PortAudio is not initialized
+ or an error is encountered.
+*/
+int PaWasapi_GetDeviceDefaultFormat( void *pFormat, unsigned int nFormatSize, PaDeviceIndex nDevice );
+
+
+/** Returns device role (PaWasapiDeviceRole enum).
+
+ @param nDevice device index.
+
+ @return Non-negative value indicating device role or, a PaErrorCode (which are always negative)
+ if PortAudio is not initialized or an error is encountered.
+*/
+int/*PaWasapiDeviceRole*/ PaWasapi_GetDeviceRole( PaDeviceIndex nDevice );
+
+
+/** Boost thread priority of calling thread (MMCSS). Use it for Blocking Interface only for thread
+ which makes calls to Pa_WriteStream/Pa_ReadStream.
+
+ @param hTask Handle to pointer to priority task. Must be used with PaWasapi_RevertThreadPriority
+ method to revert thread priority to initial state.
+
+ @param nPriorityClass Id of thread priority of PaWasapiThreadPriority type. Specifying
+ eThreadPriorityNone does nothing.
+
+ @return Error code indicating success or failure.
+ @see PaWasapi_RevertThreadPriority
+*/
+PaError PaWasapi_ThreadPriorityBoost( void **hTask, PaWasapiThreadPriority nPriorityClass );
+
+
+/** Boost thread priority of calling thread (MMCSS). Use it for Blocking Interface only for thread
+ which makes calls to Pa_WriteStream/Pa_ReadStream.
+
+ @param hTask Task handle obtained by PaWasapi_BoostThreadPriority method.
+ @return Error code indicating success or failure.
+ @see PaWasapi_BoostThreadPriority
+*/
+PaError PaWasapi_ThreadPriorityRevert( void *hTask );
+
+
+/** Get number of frames per host buffer. This is maximal value of frames of WASAPI buffer which
+ can be locked for operations. Use this method as helper to findout maximal values of
+ inputFrames/outputFrames of PaWasapiHostProcessorCallback.
+
+ @param pStream Pointer to PaStream to query.
+ @param nInput Pointer to variable to receive number of input frames. Can be NULL.
+ @param nOutput Pointer to variable to receive number of output frames. Can be NULL.
+ @return Error code indicating success or failure.
+ @see PaWasapiHostProcessorCallback
+*/
+PaError PaWasapi_GetFramesPerHostBuffer( PaStream *pStream, unsigned int *nInput, unsigned int *nOutput );
+
+
+/** Get number of jacks associated with a WASAPI device. Use this method to determine if
+ there are any jacks associated with the provided WASAPI device. Not all audio devices
+ will support this capability. This is valid for both input and output devices.
+ @param nDevice device index.
+ @param jcount Number of jacks is returned in this variable
+ @return Error code indicating success or failure
+ @see PaWasapi_GetJackDescription
+ */
+PaError PaWasapi_GetJackCount(PaDeviceIndex nDevice, int *jcount);
+
+
+/** Get the jack description associated with a WASAPI device and jack number
+ Before this function is called, use PaWasapi_GetJackCount to determine the
+ number of jacks associated with device. If jcount is greater than zero, then
+ each jack from 0 to jcount can be queried with this function to get the jack
+ description.
+ @param nDevice device index.
+ @param jindex Which jack to return information
+ @param KSJACK_DESCRIPTION This structure filled in on success.
+ @return Error code indicating success or failure
+ @see PaWasapi_GetJackCount
+ */
+PaError PaWasapi_GetJackDescription(PaDeviceIndex nDevice, int jindex, PaWasapiJackDescription *pJackDescription);
+
+
+/*
+ IMPORTANT:
+
+ WASAPI is implemented for Callback and Blocking interfaces. It supports Shared and Exclusive
+ share modes.
+
+ Exclusive Mode:
+
+ Exclusive mode allows to deliver audio data directly to hardware bypassing
+ software mixing.
+ Exclusive mode is specified by 'paWinWasapiExclusive' flag.
+
+ Callback Interface:
+
+ Provides best audio quality with low latency. Callback interface is implemented in
+ two versions:
+
+ 1) Event-Driven:
+ This is the most powerful WASAPI implementation which provides glitch-free
+ audio at around 3ms latency in Exclusive mode. Lowest possible latency for this mode is
+ 3 ms for HD Audio class audio chips. For the Shared mode latency can not be
+ lower than 20 ms.
+
+ 2) Poll-Driven:
+ Polling is another 2-nd method to operate with WASAPI. It is less efficient than Event-Driven
+ and provides latency at around 10-13ms. Polling must be used to overcome a system bug
+ under Windows Vista x64 when application is WOW64(32-bit) and Event-Driven method simply
+ times out (event handle is never signalled on buffer completion). Please note, such WOW64 bug
+ does not exist in Vista x86 or Windows 7.
+ Polling can be setup by speciying 'paWinWasapiPolling' flag. Our WASAPI implementation detects
+ WOW64 bug and sets 'paWinWasapiPolling' automatically.
+
+ Thread priority:
+
+ Normally thread priority is set automatically and does not require modification. Although
+ if user wants some tweaking thread priority can be modified by setting 'paWinWasapiThreadPriority'
+ flag and specifying 'PaWasapiStreamInfo::threadPriority' with value from PaWasapiThreadPriority
+ enum.
+
+ Blocking Interface:
+
+ Blocking interface is implemented but due to above described Poll-Driven method can not
+ deliver lowest possible latency. Specifying too low latency in Shared mode will result in
+ distorted audio although Exclusive mode adds stability.
+
+ Pa_IsFormatSupported:
+
+ To check format with correct Share Mode (Exclusive/Shared) you must supply
+ PaWasapiStreamInfo with flags paWinWasapiExclusive set through member of
+ PaStreamParameters::hostApiSpecificStreamInfo structure.
+
+ Pa_OpenStream:
+
+ To set desired Share Mode (Exclusive/Shared) you must supply
+ PaWasapiStreamInfo with flags paWinWasapiExclusive set through member of
+ PaStreamParameters::hostApiSpecificStreamInfo structure.
+*/
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* PA_WIN_WASAPI_H */
diff --git a/include/pa_win_waveformat.h b/include/pa_win_waveformat.h
index dce18c0..2c00267 100644
--- a/include/pa_win_waveformat.h
+++ b/include/pa_win_waveformat.h
@@ -1,199 +1,199 @@
-#ifndef PA_WIN_WAVEFORMAT_H
-#define PA_WIN_WAVEFORMAT_H
-
-/*
- * PortAudio Portable Real-Time Audio Library
- * Windows WAVEFORMAT* data structure utilities
- * portaudio.h should be included before this file.
- *
- * Copyright (c) 2007 Ross Bencina
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files
- * (the "Software"), to deal in the Software without restriction,
- * including without limitation the rights to use, copy, modify, merge,
- * publish, distribute, sublicense, and/or sell copies of the Software,
- * and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/*
- * The text above constitutes the entire PortAudio license; however,
- * the PortAudio community also makes the following non-binding requests:
- *
- * Any person wishing to distribute modifications to the Software is
- * requested to send the modifications to the original developer so that
- * they can be incorporated into the canonical version. It is also
- * requested that these non-binding requests be included along with the
- * license above.
- */
-
-/** @file
- @ingroup public_header
- @brief Windows specific PortAudio API extension and utilities header file.
-*/
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- The following #defines for speaker channel masks are the same
- as those in ksmedia.h, except with PAWIN_ prepended, KSAUDIO_ removed
- in some cases, and casts to PaWinWaveFormatChannelMask added.
-*/
-
-typedef unsigned long PaWinWaveFormatChannelMask;
-
-/* Speaker Positions: */
-#define PAWIN_SPEAKER_FRONT_LEFT ((PaWinWaveFormatChannelMask)0x1)
-#define PAWIN_SPEAKER_FRONT_RIGHT ((PaWinWaveFormatChannelMask)0x2)
-#define PAWIN_SPEAKER_FRONT_CENTER ((PaWinWaveFormatChannelMask)0x4)
-#define PAWIN_SPEAKER_LOW_FREQUENCY ((PaWinWaveFormatChannelMask)0x8)
-#define PAWIN_SPEAKER_BACK_LEFT ((PaWinWaveFormatChannelMask)0x10)
-#define PAWIN_SPEAKER_BACK_RIGHT ((PaWinWaveFormatChannelMask)0x20)
-#define PAWIN_SPEAKER_FRONT_LEFT_OF_CENTER ((PaWinWaveFormatChannelMask)0x40)
-#define PAWIN_SPEAKER_FRONT_RIGHT_OF_CENTER ((PaWinWaveFormatChannelMask)0x80)
-#define PAWIN_SPEAKER_BACK_CENTER ((PaWinWaveFormatChannelMask)0x100)
-#define PAWIN_SPEAKER_SIDE_LEFT ((PaWinWaveFormatChannelMask)0x200)
-#define PAWIN_SPEAKER_SIDE_RIGHT ((PaWinWaveFormatChannelMask)0x400)
-#define PAWIN_SPEAKER_TOP_CENTER ((PaWinWaveFormatChannelMask)0x800)
-#define PAWIN_SPEAKER_TOP_FRONT_LEFT ((PaWinWaveFormatChannelMask)0x1000)
-#define PAWIN_SPEAKER_TOP_FRONT_CENTER ((PaWinWaveFormatChannelMask)0x2000)
-#define PAWIN_SPEAKER_TOP_FRONT_RIGHT ((PaWinWaveFormatChannelMask)0x4000)
-#define PAWIN_SPEAKER_TOP_BACK_LEFT ((PaWinWaveFormatChannelMask)0x8000)
-#define PAWIN_SPEAKER_TOP_BACK_CENTER ((PaWinWaveFormatChannelMask)0x10000)
-#define PAWIN_SPEAKER_TOP_BACK_RIGHT ((PaWinWaveFormatChannelMask)0x20000)
-
-/* Bit mask locations reserved for future use */
-#define PAWIN_SPEAKER_RESERVED ((PaWinWaveFormatChannelMask)0x7FFC0000)
-
-/* Used to specify that any possible permutation of speaker configurations */
-#define PAWIN_SPEAKER_ALL ((PaWinWaveFormatChannelMask)0x80000000)
-
-/* DirectSound Speaker Config */
-#define PAWIN_SPEAKER_DIRECTOUT 0
-#define PAWIN_SPEAKER_MONO (PAWIN_SPEAKER_FRONT_CENTER)
-#define PAWIN_SPEAKER_STEREO (PAWIN_SPEAKER_FRONT_LEFT | PAWIN_SPEAKER_FRONT_RIGHT)
-#define PAWIN_SPEAKER_QUAD (PAWIN_SPEAKER_FRONT_LEFT | PAWIN_SPEAKER_FRONT_RIGHT | \
- PAWIN_SPEAKER_BACK_LEFT | PAWIN_SPEAKER_BACK_RIGHT)
-#define PAWIN_SPEAKER_SURROUND (PAWIN_SPEAKER_FRONT_LEFT | PAWIN_SPEAKER_FRONT_RIGHT | \
- PAWIN_SPEAKER_FRONT_CENTER | PAWIN_SPEAKER_BACK_CENTER)
-#define PAWIN_SPEAKER_5POINT1 (PAWIN_SPEAKER_FRONT_LEFT | PAWIN_SPEAKER_FRONT_RIGHT | \
- PAWIN_SPEAKER_FRONT_CENTER | PAWIN_SPEAKER_LOW_FREQUENCY | \
- PAWIN_SPEAKER_BACK_LEFT | PAWIN_SPEAKER_BACK_RIGHT)
-#define PAWIN_SPEAKER_7POINT1 (PAWIN_SPEAKER_FRONT_LEFT | PAWIN_SPEAKER_FRONT_RIGHT | \
- PAWIN_SPEAKER_FRONT_CENTER | PAWIN_SPEAKER_LOW_FREQUENCY | \
- PAWIN_SPEAKER_BACK_LEFT | PAWIN_SPEAKER_BACK_RIGHT | \
- PAWIN_SPEAKER_FRONT_LEFT_OF_CENTER | PAWIN_SPEAKER_FRONT_RIGHT_OF_CENTER)
-#define PAWIN_SPEAKER_5POINT1_SURROUND (PAWIN_SPEAKER_FRONT_LEFT | PAWIN_SPEAKER_FRONT_RIGHT | \
- PAWIN_SPEAKER_FRONT_CENTER | PAWIN_SPEAKER_LOW_FREQUENCY | \
- PAWIN_SPEAKER_SIDE_LEFT | PAWIN_SPEAKER_SIDE_RIGHT)
-#define PAWIN_SPEAKER_7POINT1_SURROUND (PAWIN_SPEAKER_FRONT_LEFT | PAWIN_SPEAKER_FRONT_RIGHT | \
- PAWIN_SPEAKER_FRONT_CENTER | PAWIN_SPEAKER_LOW_FREQUENCY | \
- PAWIN_SPEAKER_BACK_LEFT | PAWIN_SPEAKER_BACK_RIGHT | \
- PAWIN_SPEAKER_SIDE_LEFT | PAWIN_SPEAKER_SIDE_RIGHT)
-/*
- According to the Microsoft documentation:
- The following are obsolete 5.1 and 7.1 settings (they lack side speakers). Note this means
- that the default 5.1 and 7.1 settings (KSAUDIO_SPEAKER_5POINT1 and KSAUDIO_SPEAKER_7POINT1 are
- similarly obsolete but are unchanged for compatibility reasons).
-*/
-#define PAWIN_SPEAKER_5POINT1_BACK PAWIN_SPEAKER_5POINT1
-#define PAWIN_SPEAKER_7POINT1_WIDE PAWIN_SPEAKER_7POINT1
-
-/* DVD Speaker Positions */
-#define PAWIN_SPEAKER_GROUND_FRONT_LEFT PAWIN_SPEAKER_FRONT_LEFT
-#define PAWIN_SPEAKER_GROUND_FRONT_CENTER PAWIN_SPEAKER_FRONT_CENTER
-#define PAWIN_SPEAKER_GROUND_FRONT_RIGHT PAWIN_SPEAKER_FRONT_RIGHT
-#define PAWIN_SPEAKER_GROUND_REAR_LEFT PAWIN_SPEAKER_BACK_LEFT
-#define PAWIN_SPEAKER_GROUND_REAR_RIGHT PAWIN_SPEAKER_BACK_RIGHT
-#define PAWIN_SPEAKER_TOP_MIDDLE PAWIN_SPEAKER_TOP_CENTER
-#define PAWIN_SPEAKER_SUPER_WOOFER PAWIN_SPEAKER_LOW_FREQUENCY
-
-
-/*
- PaWinWaveFormat is defined here to provide compatibility with
- compilation environments which don't have headers defining
- WAVEFORMATEXTENSIBLE (e.g. older versions of MSVC, Borland C++ etc.
-
- The fields for WAVEFORMATEX and WAVEFORMATEXTENSIBLE are declared as an
- unsigned char array here to avoid clients who include this file having
- a dependency on windows.h and mmsystem.h, and also to to avoid having
- to write separate packing pragmas for each compiler.
-*/
-#define PAWIN_SIZEOF_WAVEFORMATEX 18
-#define PAWIN_SIZEOF_WAVEFORMATEXTENSIBLE (PAWIN_SIZEOF_WAVEFORMATEX + 22)
-
-typedef struct{
- unsigned char fields[ PAWIN_SIZEOF_WAVEFORMATEXTENSIBLE ];
- unsigned long extraLongForAlignment; /* ensure that compiler aligns struct to DWORD */
-} PaWinWaveFormat;
-
-/*
- WAVEFORMATEXTENSIBLE fields:
-
- union {
- WORD wValidBitsPerSample;
- WORD wSamplesPerBlock;
- WORD wReserved;
- } Samples;
- DWORD dwChannelMask;
- GUID SubFormat;
-*/
-
-#define PAWIN_INDEXOF_WVALIDBITSPERSAMPLE (PAWIN_SIZEOF_WAVEFORMATEX+0)
-#define PAWIN_INDEXOF_DWCHANNELMASK (PAWIN_SIZEOF_WAVEFORMATEX+2)
-#define PAWIN_INDEXOF_SUBFORMAT (PAWIN_SIZEOF_WAVEFORMATEX+6)
-
-
-/*
- Valid values to pass for the waveFormatTag PaWin_InitializeWaveFormatEx and
- PaWin_InitializeWaveFormatExtensible functions below. These must match
- the standard Windows WAVE_FORMAT_* values.
-*/
-#define PAWIN_WAVE_FORMAT_PCM (1)
-#define PAWIN_WAVE_FORMAT_IEEE_FLOAT (3)
-#define PAWIN_WAVE_FORMAT_DOLBY_AC3_SPDIF (0x0092)
-#define PAWIN_WAVE_FORMAT_WMA_SPDIF (0x0164)
-
-
-/*
- returns PAWIN_WAVE_FORMAT_PCM or PAWIN_WAVE_FORMAT_IEEE_FLOAT
- depending on the sampleFormat parameter.
-*/
-int PaWin_SampleFormatToLinearWaveFormatTag( PaSampleFormat sampleFormat );
-
-/*
- Use the following two functions to initialize the waveformat structure.
-*/
-
-void PaWin_InitializeWaveFormatEx( PaWinWaveFormat *waveFormat,
- int numChannels, PaSampleFormat sampleFormat, int waveFormatTag, double sampleRate );
-
-
-void PaWin_InitializeWaveFormatExtensible( PaWinWaveFormat *waveFormat,
- int numChannels, PaSampleFormat sampleFormat, int waveFormatTag, double sampleRate,
- PaWinWaveFormatChannelMask channelMask );
-
-
-/* Map a channel count to a speaker channel mask */
-PaWinWaveFormatChannelMask PaWin_DefaultChannelMask( int numChannels );
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
+#ifndef PA_WIN_WAVEFORMAT_H
+#define PA_WIN_WAVEFORMAT_H
+
+/*
+ * PortAudio Portable Real-Time Audio Library
+ * Windows WAVEFORMAT* data structure utilities
+ * portaudio.h should be included before this file.
+ *
+ * Copyright (c) 2007 Ross Bencina
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/*
+ * The text above constitutes the entire PortAudio license; however,
+ * the PortAudio community also makes the following non-binding requests:
+ *
+ * Any person wishing to distribute modifications to the Software is
+ * requested to send the modifications to the original developer so that
+ * they can be incorporated into the canonical version. It is also
+ * requested that these non-binding requests be included along with the
+ * license above.
+ */
+
+/** @file
+ @ingroup public_header
+ @brief Windows specific PortAudio API extension and utilities header file.
+*/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ The following #defines for speaker channel masks are the same
+ as those in ksmedia.h, except with PAWIN_ prepended, KSAUDIO_ removed
+ in some cases, and casts to PaWinWaveFormatChannelMask added.
+*/
+
+typedef unsigned long PaWinWaveFormatChannelMask;
+
+/* Speaker Positions: */
+#define PAWIN_SPEAKER_FRONT_LEFT ((PaWinWaveFormatChannelMask)0x1)
+#define PAWIN_SPEAKER_FRONT_RIGHT ((PaWinWaveFormatChannelMask)0x2)
+#define PAWIN_SPEAKER_FRONT_CENTER ((PaWinWaveFormatChannelMask)0x4)
+#define PAWIN_SPEAKER_LOW_FREQUENCY ((PaWinWaveFormatChannelMask)0x8)
+#define PAWIN_SPEAKER_BACK_LEFT ((PaWinWaveFormatChannelMask)0x10)
+#define PAWIN_SPEAKER_BACK_RIGHT ((PaWinWaveFormatChannelMask)0x20)
+#define PAWIN_SPEAKER_FRONT_LEFT_OF_CENTER ((PaWinWaveFormatChannelMask)0x40)
+#define PAWIN_SPEAKER_FRONT_RIGHT_OF_CENTER ((PaWinWaveFormatChannelMask)0x80)
+#define PAWIN_SPEAKER_BACK_CENTER ((PaWinWaveFormatChannelMask)0x100)
+#define PAWIN_SPEAKER_SIDE_LEFT ((PaWinWaveFormatChannelMask)0x200)
+#define PAWIN_SPEAKER_SIDE_RIGHT ((PaWinWaveFormatChannelMask)0x400)
+#define PAWIN_SPEAKER_TOP_CENTER ((PaWinWaveFormatChannelMask)0x800)
+#define PAWIN_SPEAKER_TOP_FRONT_LEFT ((PaWinWaveFormatChannelMask)0x1000)
+#define PAWIN_SPEAKER_TOP_FRONT_CENTER ((PaWinWaveFormatChannelMask)0x2000)
+#define PAWIN_SPEAKER_TOP_FRONT_RIGHT ((PaWinWaveFormatChannelMask)0x4000)
+#define PAWIN_SPEAKER_TOP_BACK_LEFT ((PaWinWaveFormatChannelMask)0x8000)
+#define PAWIN_SPEAKER_TOP_BACK_CENTER ((PaWinWaveFormatChannelMask)0x10000)
+#define PAWIN_SPEAKER_TOP_BACK_RIGHT ((PaWinWaveFormatChannelMask)0x20000)
+
+/* Bit mask locations reserved for future use */
+#define PAWIN_SPEAKER_RESERVED ((PaWinWaveFormatChannelMask)0x7FFC0000)
+
+/* Used to specify that any possible permutation of speaker configurations */
+#define PAWIN_SPEAKER_ALL ((PaWinWaveFormatChannelMask)0x80000000)
+
+/* DirectSound Speaker Config */
+#define PAWIN_SPEAKER_DIRECTOUT 0
+#define PAWIN_SPEAKER_MONO (PAWIN_SPEAKER_FRONT_CENTER)
+#define PAWIN_SPEAKER_STEREO (PAWIN_SPEAKER_FRONT_LEFT | PAWIN_SPEAKER_FRONT_RIGHT)
+#define PAWIN_SPEAKER_QUAD (PAWIN_SPEAKER_FRONT_LEFT | PAWIN_SPEAKER_FRONT_RIGHT | \
+ PAWIN_SPEAKER_BACK_LEFT | PAWIN_SPEAKER_BACK_RIGHT)
+#define PAWIN_SPEAKER_SURROUND (PAWIN_SPEAKER_FRONT_LEFT | PAWIN_SPEAKER_FRONT_RIGHT | \
+ PAWIN_SPEAKER_FRONT_CENTER | PAWIN_SPEAKER_BACK_CENTER)
+#define PAWIN_SPEAKER_5POINT1 (PAWIN_SPEAKER_FRONT_LEFT | PAWIN_SPEAKER_FRONT_RIGHT | \
+ PAWIN_SPEAKER_FRONT_CENTER | PAWIN_SPEAKER_LOW_FREQUENCY | \
+ PAWIN_SPEAKER_BACK_LEFT | PAWIN_SPEAKER_BACK_RIGHT)
+#define PAWIN_SPEAKER_7POINT1 (PAWIN_SPEAKER_FRONT_LEFT | PAWIN_SPEAKER_FRONT_RIGHT | \
+ PAWIN_SPEAKER_FRONT_CENTER | PAWIN_SPEAKER_LOW_FREQUENCY | \
+ PAWIN_SPEAKER_BACK_LEFT | PAWIN_SPEAKER_BACK_RIGHT | \
+ PAWIN_SPEAKER_FRONT_LEFT_OF_CENTER | PAWIN_SPEAKER_FRONT_RIGHT_OF_CENTER)
+#define PAWIN_SPEAKER_5POINT1_SURROUND (PAWIN_SPEAKER_FRONT_LEFT | PAWIN_SPEAKER_FRONT_RIGHT | \
+ PAWIN_SPEAKER_FRONT_CENTER | PAWIN_SPEAKER_LOW_FREQUENCY | \
+ PAWIN_SPEAKER_SIDE_LEFT | PAWIN_SPEAKER_SIDE_RIGHT)
+#define PAWIN_SPEAKER_7POINT1_SURROUND (PAWIN_SPEAKER_FRONT_LEFT | PAWIN_SPEAKER_FRONT_RIGHT | \
+ PAWIN_SPEAKER_FRONT_CENTER | PAWIN_SPEAKER_LOW_FREQUENCY | \
+ PAWIN_SPEAKER_BACK_LEFT | PAWIN_SPEAKER_BACK_RIGHT | \
+ PAWIN_SPEAKER_SIDE_LEFT | PAWIN_SPEAKER_SIDE_RIGHT)
+/*
+ According to the Microsoft documentation:
+ The following are obsolete 5.1 and 7.1 settings (they lack side speakers). Note this means
+ that the default 5.1 and 7.1 settings (KSAUDIO_SPEAKER_5POINT1 and KSAUDIO_SPEAKER_7POINT1 are
+ similarly obsolete but are unchanged for compatibility reasons).
+*/
+#define PAWIN_SPEAKER_5POINT1_BACK PAWIN_SPEAKER_5POINT1
+#define PAWIN_SPEAKER_7POINT1_WIDE PAWIN_SPEAKER_7POINT1
+
+/* DVD Speaker Positions */
+#define PAWIN_SPEAKER_GROUND_FRONT_LEFT PAWIN_SPEAKER_FRONT_LEFT
+#define PAWIN_SPEAKER_GROUND_FRONT_CENTER PAWIN_SPEAKER_FRONT_CENTER
+#define PAWIN_SPEAKER_GROUND_FRONT_RIGHT PAWIN_SPEAKER_FRONT_RIGHT
+#define PAWIN_SPEAKER_GROUND_REAR_LEFT PAWIN_SPEAKER_BACK_LEFT
+#define PAWIN_SPEAKER_GROUND_REAR_RIGHT PAWIN_SPEAKER_BACK_RIGHT
+#define PAWIN_SPEAKER_TOP_MIDDLE PAWIN_SPEAKER_TOP_CENTER
+#define PAWIN_SPEAKER_SUPER_WOOFER PAWIN_SPEAKER_LOW_FREQUENCY
+
+
+/*
+ PaWinWaveFormat is defined here to provide compatibility with
+ compilation environments which don't have headers defining
+ WAVEFORMATEXTENSIBLE (e.g. older versions of MSVC, Borland C++ etc.
+
+ The fields for WAVEFORMATEX and WAVEFORMATEXTENSIBLE are declared as an
+ unsigned char array here to avoid clients who include this file having
+ a dependency on windows.h and mmsystem.h, and also to to avoid having
+ to write separate packing pragmas for each compiler.
+*/
+#define PAWIN_SIZEOF_WAVEFORMATEX 18
+#define PAWIN_SIZEOF_WAVEFORMATEXTENSIBLE (PAWIN_SIZEOF_WAVEFORMATEX + 22)
+
+typedef struct{
+ unsigned char fields[ PAWIN_SIZEOF_WAVEFORMATEXTENSIBLE ];
+ unsigned long extraLongForAlignment; /* ensure that compiler aligns struct to DWORD */
+} PaWinWaveFormat;
+
+/*
+ WAVEFORMATEXTENSIBLE fields:
+
+ union {
+ WORD wValidBitsPerSample;
+ WORD wSamplesPerBlock;
+ WORD wReserved;
+ } Samples;
+ DWORD dwChannelMask;
+ GUID SubFormat;
+*/
+
+#define PAWIN_INDEXOF_WVALIDBITSPERSAMPLE (PAWIN_SIZEOF_WAVEFORMATEX+0)
+#define PAWIN_INDEXOF_DWCHANNELMASK (PAWIN_SIZEOF_WAVEFORMATEX+2)
+#define PAWIN_INDEXOF_SUBFORMAT (PAWIN_SIZEOF_WAVEFORMATEX+6)
+
+
+/*
+ Valid values to pass for the waveFormatTag PaWin_InitializeWaveFormatEx and
+ PaWin_InitializeWaveFormatExtensible functions below. These must match
+ the standard Windows WAVE_FORMAT_* values.
+*/
+#define PAWIN_WAVE_FORMAT_PCM (1)
+#define PAWIN_WAVE_FORMAT_IEEE_FLOAT (3)
+#define PAWIN_WAVE_FORMAT_DOLBY_AC3_SPDIF (0x0092)
+#define PAWIN_WAVE_FORMAT_WMA_SPDIF (0x0164)
+
+
+/*
+ returns PAWIN_WAVE_FORMAT_PCM or PAWIN_WAVE_FORMAT_IEEE_FLOAT
+ depending on the sampleFormat parameter.
+*/
+int PaWin_SampleFormatToLinearWaveFormatTag( PaSampleFormat sampleFormat );
+
+/*
+ Use the following two functions to initialize the waveformat structure.
+*/
+
+void PaWin_InitializeWaveFormatEx( PaWinWaveFormat *waveFormat,
+ int numChannels, PaSampleFormat sampleFormat, int waveFormatTag, double sampleRate );
+
+
+void PaWin_InitializeWaveFormatExtensible( PaWinWaveFormat *waveFormat,
+ int numChannels, PaSampleFormat sampleFormat, int waveFormatTag, double sampleRate,
+ PaWinWaveFormatChannelMask channelMask );
+
+
+/* Map a channel count to a speaker channel mask */
+PaWinWaveFormatChannelMask PaWin_DefaultChannelMask( int numChannels );
+
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
#endif /* PA_WIN_WAVEFORMAT_H */
\ No newline at end of file
diff --git a/qa/loopback/src/biquad_filter.c b/qa/loopback/src/biquad_filter.c
index d95dc90..0566085 100755
--- a/qa/loopback/src/biquad_filter.c
+++ b/qa/loopback/src/biquad_filter.c
@@ -1,122 +1,122 @@
-#include
-#include
-
-#include "biquad_filter.h"
-
-/**
- * Unit_BiquadFilter implements a second order IIR filter.
- Here is the equation that we use for this filter:
- y(n) = a0*x(n) + a1*x(n-1) + a2*x(n-2) - b1*y(n-1) - b2*y(n-2)
- *
- * @author (C) 2002 Phil Burk, SoftSynth.com, All Rights Reserved
- */
-
-#define FILTER_PI (3.141592653589793238462643)
-/***********************************************************
-** Calculate coefficients common to many parametric biquad filters.
-*/
-static void BiquadFilter_CalculateCommon( BiquadFilter *filter, double ratio, double Q )
-{
- double omega;
-
- memset( filter, 0, sizeof(BiquadFilter) );
-
-/* Don't let frequency get too close to Nyquist or filter will blow up. */
- if( ratio >= 0.499 ) ratio = 0.499;
- omega = 2.0 * (double)FILTER_PI * ratio;
-
- filter->cos_omega = (double) cos( omega );
- filter->sin_omega = (double) sin( omega );
- filter->alpha = filter->sin_omega / (2.0 * Q);
-}
-
-/*********************************************************************************
- ** Calculate coefficients for Highpass filter.
- */
-void BiquadFilter_SetupHighPass( BiquadFilter *filter, double ratio, double Q )
-{
- double scalar, opc;
-
- if( ratio < BIQUAD_MIN_RATIO ) ratio = BIQUAD_MIN_RATIO;
- if( Q < BIQUAD_MIN_Q ) Q = BIQUAD_MIN_Q;
-
- BiquadFilter_CalculateCommon( filter, ratio, Q );
-
- scalar = 1.0 / (1.0 + filter->alpha);
- opc = (1.0 + filter->cos_omega);
-
- filter->a0 = opc * 0.5 * scalar;
- filter->a1 = - opc * scalar;
- filter->a2 = filter->a0;
- filter->b1 = -2.0 * filter->cos_omega * scalar;
- filter->b2 = (1.0 - filter->alpha) * scalar;
-}
-
-
-/*********************************************************************************
- ** Calculate coefficients for Notch filter.
- */
-void BiquadFilter_SetupNotch( BiquadFilter *filter, double ratio, double Q )
-{
- double scalar, opc;
-
- if( ratio < BIQUAD_MIN_RATIO ) ratio = BIQUAD_MIN_RATIO;
- if( Q < BIQUAD_MIN_Q ) Q = BIQUAD_MIN_Q;
-
- BiquadFilter_CalculateCommon( filter, ratio, Q );
-
- scalar = 1.0 / (1.0 + filter->alpha);
- opc = (1.0 + filter->cos_omega);
-
- filter->a0 = scalar;
- filter->a1 = -2.0 * filter->cos_omega * scalar;
- filter->a2 = filter->a0;
- filter->b1 = filter->a1;
- filter->b2 = (1.0 - filter->alpha) * scalar;
-}
-
-/*****************************************************************
-** Perform core IIR filter calculation without permutation.
-*/
-void BiquadFilter_Filter( BiquadFilter *filter, float *inputs, float *outputs, int numSamples )
-{
- int i;
- double xn, yn;
- // Pull values from structure to speed up the calculation.
- double a0 = filter->a0;
- double a1 = filter->a1;
- double a2 = filter->a2;
- double b1 = filter->b1;
- double b2 = filter->b2;
- double xn1 = filter->xn1;
- double xn2 = filter->xn2;
- double yn1 = filter->yn1;
- double yn2 = filter->yn2;
-
- for( i=0; ixn1 = xn1;
- filter->xn2 = xn2;
- filter->yn1 = yn1;
- filter->yn2 = yn2;
+#include
+#include
+
+#include "biquad_filter.h"
+
+/**
+ * Unit_BiquadFilter implements a second order IIR filter.
+ Here is the equation that we use for this filter:
+ y(n) = a0*x(n) + a1*x(n-1) + a2*x(n-2) - b1*y(n-1) - b2*y(n-2)
+ *
+ * @author (C) 2002 Phil Burk, SoftSynth.com, All Rights Reserved
+ */
+
+#define FILTER_PI (3.141592653589793238462643)
+/***********************************************************
+** Calculate coefficients common to many parametric biquad filters.
+*/
+static void BiquadFilter_CalculateCommon( BiquadFilter *filter, double ratio, double Q )
+{
+ double omega;
+
+ memset( filter, 0, sizeof(BiquadFilter) );
+
+/* Don't let frequency get too close to Nyquist or filter will blow up. */
+ if( ratio >= 0.499 ) ratio = 0.499;
+ omega = 2.0 * (double)FILTER_PI * ratio;
+
+ filter->cos_omega = (double) cos( omega );
+ filter->sin_omega = (double) sin( omega );
+ filter->alpha = filter->sin_omega / (2.0 * Q);
+}
+
+/*********************************************************************************
+ ** Calculate coefficients for Highpass filter.
+ */
+void BiquadFilter_SetupHighPass( BiquadFilter *filter, double ratio, double Q )
+{
+ double scalar, opc;
+
+ if( ratio < BIQUAD_MIN_RATIO ) ratio = BIQUAD_MIN_RATIO;
+ if( Q < BIQUAD_MIN_Q ) Q = BIQUAD_MIN_Q;
+
+ BiquadFilter_CalculateCommon( filter, ratio, Q );
+
+ scalar = 1.0 / (1.0 + filter->alpha);
+ opc = (1.0 + filter->cos_omega);
+
+ filter->a0 = opc * 0.5 * scalar;
+ filter->a1 = - opc * scalar;
+ filter->a2 = filter->a0;
+ filter->b1 = -2.0 * filter->cos_omega * scalar;
+ filter->b2 = (1.0 - filter->alpha) * scalar;
+}
+
+
+/*********************************************************************************
+ ** Calculate coefficients for Notch filter.
+ */
+void BiquadFilter_SetupNotch( BiquadFilter *filter, double ratio, double Q )
+{
+ double scalar, opc;
+
+ if( ratio < BIQUAD_MIN_RATIO ) ratio = BIQUAD_MIN_RATIO;
+ if( Q < BIQUAD_MIN_Q ) Q = BIQUAD_MIN_Q;
+
+ BiquadFilter_CalculateCommon( filter, ratio, Q );
+
+ scalar = 1.0 / (1.0 + filter->alpha);
+ opc = (1.0 + filter->cos_omega);
+
+ filter->a0 = scalar;
+ filter->a1 = -2.0 * filter->cos_omega * scalar;
+ filter->a2 = filter->a0;
+ filter->b1 = filter->a1;
+ filter->b2 = (1.0 - filter->alpha) * scalar;
+}
+
+/*****************************************************************
+** Perform core IIR filter calculation without permutation.
+*/
+void BiquadFilter_Filter( BiquadFilter *filter, float *inputs, float *outputs, int numSamples )
+{
+ int i;
+ double xn, yn;
+ // Pull values from structure to speed up the calculation.
+ double a0 = filter->a0;
+ double a1 = filter->a1;
+ double a2 = filter->a2;
+ double b1 = filter->b1;
+ double b2 = filter->b2;
+ double xn1 = filter->xn1;
+ double xn2 = filter->xn2;
+ double yn1 = filter->yn1;
+ double yn2 = filter->yn2;
+
+ for( i=0; ixn1 = xn1;
+ filter->xn2 = xn2;
+ filter->yn1 = yn1;
+ filter->yn2 = yn2;
}
\ No newline at end of file
diff --git a/qa/loopback/src/biquad_filter.h b/qa/loopback/src/biquad_filter.h
index 2e0ab30..cbac688 100755
--- a/qa/loopback/src/biquad_filter.h
+++ b/qa/loopback/src/biquad_filter.h
@@ -1,38 +1,38 @@
-#ifndef _BIQUADFILTER_H
-#define _BIQUADFILTER_H
-
-
-/**
- * Unit_BiquadFilter implements a second order IIR filter.
- *
- * @author (C) 2002 Phil Burk, SoftSynth.com, All Rights Reserved
- */
-
-#define BIQUAD_MIN_RATIO (0.000001)
-#define BIQUAD_MIN_Q (0.00001)
-
-typedef struct BiquadFilter_s
-{
- double xn1; // storage for delayed signals
- double xn2;
- double yn1;
- double yn2;
-
- double a0; // coefficients
- double a1;
- double a2;
-
- double b1;
- double b2;
-
- double cos_omega;
- double sin_omega;
- double alpha;
-} BiquadFilter;
-
-void BiquadFilter_SetupHighPass( BiquadFilter *filter, double ratio, double Q );
-void BiquadFilter_SetupNotch( BiquadFilter *filter, double ratio, double Q );
-
-void BiquadFilter_Filter( BiquadFilter *filter, float *inputs, float *outputs, int numSamples );
-
-#endif
+#ifndef _BIQUADFILTER_H
+#define _BIQUADFILTER_H
+
+
+/**
+ * Unit_BiquadFilter implements a second order IIR filter.
+ *
+ * @author (C) 2002 Phil Burk, SoftSynth.com, All Rights Reserved
+ */
+
+#define BIQUAD_MIN_RATIO (0.000001)
+#define BIQUAD_MIN_Q (0.00001)
+
+typedef struct BiquadFilter_s
+{
+ double xn1; // storage for delayed signals
+ double xn2;
+ double yn1;
+ double yn2;
+
+ double a0; // coefficients
+ double a1;
+ double a2;
+
+ double b1;
+ double b2;
+
+ double cos_omega;
+ double sin_omega;
+ double alpha;
+} BiquadFilter;
+
+void BiquadFilter_SetupHighPass( BiquadFilter *filter, double ratio, double Q );
+void BiquadFilter_SetupNotch( BiquadFilter *filter, double ratio, double Q );
+
+void BiquadFilter_Filter( BiquadFilter *filter, float *inputs, float *outputs, int numSamples );
+
+#endif
diff --git a/qa/loopback/src/qa_tools.h b/qa/loopback/src/qa_tools.h
index 32be215..1f33224 100755
--- a/qa/loopback/src/qa_tools.h
+++ b/qa/loopback/src/qa_tools.h
@@ -1,74 +1,74 @@
-
-/*
- * PortAudio Portable Real-Time Audio Library
- * Latest Version at: http://www.portaudio.com
- *
- * Copyright (c) 1999-2010 Phil Burk and Ross Bencina
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files
- * (the "Software"), to deal in the Software without restriction,
- * including without limitation the rights to use, copy, modify, merge,
- * publish, distribute, sublicense, and/or sell copies of the Software,
- * and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/*
- * The text above constitutes the entire PortAudio license; however,
- * the PortAudio community also makes the following non-binding requests:
- *
- * Any person wishing to distribute modifications to the Software is
- * requested to send the modifications to the original developer so that
- * they can be incorporated into the canonical version. It is also
- * requested that these non-binding requests be included along with the
- * license above.
- */
-
-#ifndef _QA_TOOLS_H
-#define _QA_TOOLS_H
-
-extern int g_testsPassed;
-extern int g_testsFailed;
-
-#define QA_ASSERT_TRUE( message, flag ) \
- if( !(flag) ) \
- { \
- printf( "%s:%d - ERROR - %s\n", __FILE__, __LINE__, message ); \
- g_testsFailed++; \
- goto error; \
- } \
- else g_testsPassed++;
-
-
-#define QA_ASSERT_EQUALS( message, expected, actual ) \
- if( ((expected) != (actual)) ) \
- { \
- printf( "%s:%d - ERROR - %s, expected %d, got %d\n", __FILE__, __LINE__, message, expected, actual ); \
- g_testsFailed++; \
- goto error; \
- } \
- else g_testsPassed++;
-
-#define QA_ASSERT_CLOSE( message, expected, actual, tolerance ) \
- if (fabs((expected)-(actual))>(tolerance)) \
- { \
- printf( "%s:%d - ERROR - %s, expected %f, got %f, tol=%f\n", __FILE__, __LINE__, message, ((double)(expected)), ((double)(actual)), ((double)(tolerance)) ); \
- g_testsFailed++; \
- goto error; \
- } \
- else g_testsPassed++;
-
-
-#endif
+
+/*
+ * PortAudio Portable Real-Time Audio Library
+ * Latest Version at: http://www.portaudio.com
+ *
+ * Copyright (c) 1999-2010 Phil Burk and Ross Bencina
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/*
+ * The text above constitutes the entire PortAudio license; however,
+ * the PortAudio community also makes the following non-binding requests:
+ *
+ * Any person wishing to distribute modifications to the Software is
+ * requested to send the modifications to the original developer so that
+ * they can be incorporated into the canonical version. It is also
+ * requested that these non-binding requests be included along with the
+ * license above.
+ */
+
+#ifndef _QA_TOOLS_H
+#define _QA_TOOLS_H
+
+extern int g_testsPassed;
+extern int g_testsFailed;
+
+#define QA_ASSERT_TRUE( message, flag ) \
+ if( !(flag) ) \
+ { \
+ printf( "%s:%d - ERROR - %s\n", __FILE__, __LINE__, message ); \
+ g_testsFailed++; \
+ goto error; \
+ } \
+ else g_testsPassed++;
+
+
+#define QA_ASSERT_EQUALS( message, expected, actual ) \
+ if( ((expected) != (actual)) ) \
+ { \
+ printf( "%s:%d - ERROR - %s, expected %d, got %d\n", __FILE__, __LINE__, message, expected, actual ); \
+ g_testsFailed++; \
+ goto error; \
+ } \
+ else g_testsPassed++;
+
+#define QA_ASSERT_CLOSE( message, expected, actual, tolerance ) \
+ if (fabs((expected)-(actual))>(tolerance)) \
+ { \
+ printf( "%s:%d - ERROR - %s, expected %f, got %f, tol=%f\n", __FILE__, __LINE__, message, ((double)(expected)), ((double)(actual)), ((double)(tolerance)) ); \
+ g_testsFailed++; \
+ goto error; \
+ } \
+ else g_testsPassed++;
+
+
+#endif
diff --git a/qa/loopback/src/write_wav.c b/qa/loopback/src/write_wav.c
index 83aa85e..d948b34 100755
--- a/qa/loopback/src/write_wav.c
+++ b/qa/loopback/src/write_wav.c
@@ -1,242 +1,242 @@
-/*
- * PortAudio Portable Real-Time Audio Library
- * Latest Version at: http://www.portaudio.com
- *
- * Copyright (c) 1999-2010 Phil Burk and Ross Bencina
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files
- * (the "Software"), to deal in the Software without restriction,
- * including without limitation the rights to use, copy, modify, merge,
- * publish, distribute, sublicense, and/or sell copies of the Software,
- * and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/*
- * The text above constitutes the entire PortAudio license; however,
- * the PortAudio community also makes the following non-binding requests:
- *
- * Any person wishing to distribute modifications to the Software is
- * requested to send the modifications to the original developer so that
- * they can be incorporated into the canonical version. It is also
- * requested that these non-binding requests be included along with the
- * license above.
- */
-
-/**
- * Very simple WAV file writer for saving captured audio.
- */
-
-#include
-#include
-#include "write_wav.h"
-
-
-/* Write long word data to a little endian format byte array. */
-static void WriteLongLE( unsigned char **addrPtr, unsigned long data )
-{
- unsigned char *addr = *addrPtr;
- *addr++ = (unsigned char) data;
- *addr++ = (unsigned char) (data>>8);
- *addr++ = (unsigned char) (data>>16);
- *addr++ = (unsigned char) (data>>24);
- *addrPtr = addr;
-}
-
-/* Write short word data to a little endian format byte array. */
-static void WriteShortLE( unsigned char **addrPtr, unsigned short data )
-{
- unsigned char *addr = *addrPtr;
- *addr++ = (unsigned char) data;
- *addr++ = (unsigned char) (data>>8);
- *addrPtr = addr;
-}
-
-/* Write IFF ChunkType data to a byte array. */
-static void WriteChunkType( unsigned char **addrPtr, unsigned long cktyp )
-{
- unsigned char *addr = *addrPtr;
- *addr++ = (unsigned char) (cktyp>>24);
- *addr++ = (unsigned char) (cktyp>>16);
- *addr++ = (unsigned char) (cktyp>>8);
- *addr++ = (unsigned char) cktyp;
- *addrPtr = addr;
-}
-
-#define WAV_HEADER_SIZE (4 + 4 + 4 + /* RIFF+size+WAVE */ \
- 4 + 4 + 16 + /* fmt chunk */ \
- 4 + 4 ) /* data chunk */
-
-
-/*********************************************************************************
- * Open named file and write WAV header to the file.
- * The header includes the DATA chunk type and size.
- * Returns number of bytes written to file or negative error code.
- */
-long Audio_WAV_OpenWriter( WAV_Writer *writer, const char *fileName, int frameRate, int samplesPerFrame )
-{
- unsigned int bytesPerSecond;
- unsigned char header[ WAV_HEADER_SIZE ];
- unsigned char *addr = header;
- int numWritten;
-
- writer->dataSize = 0;
- writer->dataSizeOffset = 0;
-
- writer->fid = fopen( fileName, "wb" );
- if( writer->fid == NULL )
- {
- return -1;
- }
-
-/* Write RIFF header. */
- WriteChunkType( &addr, RIFF_ID );
-
-/* Write RIFF size as zero for now. Will patch later. */
- WriteLongLE( &addr, 0 );
-
-/* Write WAVE form ID. */
- WriteChunkType( &addr, WAVE_ID );
-
-/* Write format chunk based on AudioSample structure. */
- WriteChunkType( &addr, FMT_ID );
- WriteLongLE( &addr, 16 );
- WriteShortLE( &addr, WAVE_FORMAT_PCM );
- bytesPerSecond = frameRate * samplesPerFrame * sizeof( short);
- WriteShortLE( &addr, (short) samplesPerFrame );
- WriteLongLE( &addr, frameRate );
- WriteLongLE( &addr, bytesPerSecond );
- WriteShortLE( &addr, (short) (samplesPerFrame * sizeof( short)) ); /* bytesPerBlock */
- WriteShortLE( &addr, (short) 16 ); /* bits per sample */
-
-/* Write ID and size for 'data' chunk. */
- WriteChunkType( &addr, DATA_ID );
-/* Save offset so we can patch it later. */
- writer->dataSizeOffset = (int) (addr - header);
- WriteLongLE( &addr, 0 );
-
- numWritten = fwrite( header, 1, sizeof(header), writer->fid );
- if( numWritten != sizeof(header) ) return -1;
-
- return (int) numWritten;
-}
-
-/*********************************************************************************
- * Write to the data chunk portion of a WAV file.
- * Returns bytes written or negative error code.
- */
-long Audio_WAV_WriteShorts( WAV_Writer *writer,
- short *samples,
- int numSamples
- )
-{
- unsigned char buffer[2];
- unsigned char *bufferPtr;
- int i;
- short *p = samples;
- int numWritten;
- int bytesWritten;
- if( numSamples <= 0 )
- {
- return -1;
- }
-
- for( i=0; ifid );
- if( numWritten != sizeof(buffer) ) return -1;
- }
- bytesWritten = numSamples * sizeof(short);
- writer->dataSize += bytesWritten;
- return (int) bytesWritten;
-}
-
-/*********************************************************************************
- * Close WAV file.
- * Update chunk sizes so it can be read by audio applications.
- */
-long Audio_WAV_CloseWriter( WAV_Writer *writer )
-{
- unsigned char buffer[4];
- unsigned char *bufferPtr;
- int numWritten;
- int riffSize;
-
- /* Go back to beginning of file and update DATA size */
- int result = fseek( writer->fid, writer->dataSizeOffset, SEEK_SET );
- if( result < 0 ) return result;
-
- bufferPtr = buffer;
- WriteLongLE( &bufferPtr, writer->dataSize );
- numWritten = fwrite( buffer, 1, sizeof( buffer), writer->fid );
- if( numWritten != sizeof(buffer) ) return -1;
-
- /* Update RIFF size */
- result = fseek( writer->fid, 4, SEEK_SET );
- if( result < 0 ) return result;
-
- riffSize = writer->dataSize + (WAV_HEADER_SIZE - 8);
- bufferPtr = buffer;
- WriteLongLE( &bufferPtr, riffSize );
- numWritten = fwrite( buffer, 1, sizeof( buffer), writer->fid );
- if( numWritten != sizeof(buffer) ) return -1;
-
- fclose( writer->fid );
- writer->fid = NULL;
- return writer->dataSize;
-}
-
-/*********************************************************************************
- * Simple test that write a sawtooth waveform to a file.
- */
-#if 0
-int main( void )
-{
- int i;
- WAV_Writer writer;
- int result;
-#define NUM_SAMPLES (200)
- short data[NUM_SAMPLES];
- short saw = 0;
-
- for( i=0; i
+#include
+#include "write_wav.h"
+
+
+/* Write long word data to a little endian format byte array. */
+static void WriteLongLE( unsigned char **addrPtr, unsigned long data )
+{
+ unsigned char *addr = *addrPtr;
+ *addr++ = (unsigned char) data;
+ *addr++ = (unsigned char) (data>>8);
+ *addr++ = (unsigned char) (data>>16);
+ *addr++ = (unsigned char) (data>>24);
+ *addrPtr = addr;
+}
+
+/* Write short word data to a little endian format byte array. */
+static void WriteShortLE( unsigned char **addrPtr, unsigned short data )
+{
+ unsigned char *addr = *addrPtr;
+ *addr++ = (unsigned char) data;
+ *addr++ = (unsigned char) (data>>8);
+ *addrPtr = addr;
+}
+
+/* Write IFF ChunkType data to a byte array. */
+static void WriteChunkType( unsigned char **addrPtr, unsigned long cktyp )
+{
+ unsigned char *addr = *addrPtr;
+ *addr++ = (unsigned char) (cktyp>>24);
+ *addr++ = (unsigned char) (cktyp>>16);
+ *addr++ = (unsigned char) (cktyp>>8);
+ *addr++ = (unsigned char) cktyp;
+ *addrPtr = addr;
+}
+
+#define WAV_HEADER_SIZE (4 + 4 + 4 + /* RIFF+size+WAVE */ \
+ 4 + 4 + 16 + /* fmt chunk */ \
+ 4 + 4 ) /* data chunk */
+
+
+/*********************************************************************************
+ * Open named file and write WAV header to the file.
+ * The header includes the DATA chunk type and size.
+ * Returns number of bytes written to file or negative error code.
+ */
+long Audio_WAV_OpenWriter( WAV_Writer *writer, const char *fileName, int frameRate, int samplesPerFrame )
+{
+ unsigned int bytesPerSecond;
+ unsigned char header[ WAV_HEADER_SIZE ];
+ unsigned char *addr = header;
+ int numWritten;
+
+ writer->dataSize = 0;
+ writer->dataSizeOffset = 0;
+
+ writer->fid = fopen( fileName, "wb" );
+ if( writer->fid == NULL )
+ {
+ return -1;
+ }
+
+/* Write RIFF header. */
+ WriteChunkType( &addr, RIFF_ID );
+
+/* Write RIFF size as zero for now. Will patch later. */
+ WriteLongLE( &addr, 0 );
+
+/* Write WAVE form ID. */
+ WriteChunkType( &addr, WAVE_ID );
+
+/* Write format chunk based on AudioSample structure. */
+ WriteChunkType( &addr, FMT_ID );
+ WriteLongLE( &addr, 16 );
+ WriteShortLE( &addr, WAVE_FORMAT_PCM );
+ bytesPerSecond = frameRate * samplesPerFrame * sizeof( short);
+ WriteShortLE( &addr, (short) samplesPerFrame );
+ WriteLongLE( &addr, frameRate );
+ WriteLongLE( &addr, bytesPerSecond );
+ WriteShortLE( &addr, (short) (samplesPerFrame * sizeof( short)) ); /* bytesPerBlock */
+ WriteShortLE( &addr, (short) 16 ); /* bits per sample */
+
+/* Write ID and size for 'data' chunk. */
+ WriteChunkType( &addr, DATA_ID );
+/* Save offset so we can patch it later. */
+ writer->dataSizeOffset = (int) (addr - header);
+ WriteLongLE( &addr, 0 );
+
+ numWritten = fwrite( header, 1, sizeof(header), writer->fid );
+ if( numWritten != sizeof(header) ) return -1;
+
+ return (int) numWritten;
+}
+
+/*********************************************************************************
+ * Write to the data chunk portion of a WAV file.
+ * Returns bytes written or negative error code.
+ */
+long Audio_WAV_WriteShorts( WAV_Writer *writer,
+ short *samples,
+ int numSamples
+ )
+{
+ unsigned char buffer[2];
+ unsigned char *bufferPtr;
+ int i;
+ short *p = samples;
+ int numWritten;
+ int bytesWritten;
+ if( numSamples <= 0 )
+ {
+ return -1;
+ }
+
+ for( i=0; ifid );
+ if( numWritten != sizeof(buffer) ) return -1;
+ }
+ bytesWritten = numSamples * sizeof(short);
+ writer->dataSize += bytesWritten;
+ return (int) bytesWritten;
+}
+
+/*********************************************************************************
+ * Close WAV file.
+ * Update chunk sizes so it can be read by audio applications.
+ */
+long Audio_WAV_CloseWriter( WAV_Writer *writer )
+{
+ unsigned char buffer[4];
+ unsigned char *bufferPtr;
+ int numWritten;
+ int riffSize;
+
+ /* Go back to beginning of file and update DATA size */
+ int result = fseek( writer->fid, writer->dataSizeOffset, SEEK_SET );
+ if( result < 0 ) return result;
+
+ bufferPtr = buffer;
+ WriteLongLE( &bufferPtr, writer->dataSize );
+ numWritten = fwrite( buffer, 1, sizeof( buffer), writer->fid );
+ if( numWritten != sizeof(buffer) ) return -1;
+
+ /* Update RIFF size */
+ result = fseek( writer->fid, 4, SEEK_SET );
+ if( result < 0 ) return result;
+
+ riffSize = writer->dataSize + (WAV_HEADER_SIZE - 8);
+ bufferPtr = buffer;
+ WriteLongLE( &bufferPtr, riffSize );
+ numWritten = fwrite( buffer, 1, sizeof( buffer), writer->fid );
+ if( numWritten != sizeof(buffer) ) return -1;
+
+ fclose( writer->fid );
+ writer->fid = NULL;
+ return writer->dataSize;
+}
+
+/*********************************************************************************
+ * Simple test that write a sawtooth waveform to a file.
+ */
+#if 0
+int main( void )
+{
+ int i;
+ WAV_Writer writer;
+ int result;
+#define NUM_SAMPLES (200)
+ short data[NUM_SAMPLES];
+ short saw = 0;
+
+ for( i=0; i
-#include
-
-#include "pa_debugprint.h"
-
-// for OutputDebugStringA
-#if defined(_MSC_VER) && defined(PA_ENABLE_MSVC_DEBUG_OUTPUT)
- #define WIN32_LEAN_AND_MEAN // exclude rare headers
- #include "windows.h"
-#endif
-
-// User callback
-static PaUtilLogCallback userCB = NULL;
-
-// Sets user callback
-void PaUtil_SetDebugPrintFunction(PaUtilLogCallback cb)
-{
- userCB = cb;
-}
-
-/*
- If your platform doesnÂ’t have vsnprintf, you are stuck with a
- VERY dangerous alternative, vsprintf (with no n)
-*/
-#if _MSC_VER
- /* Some Windows Mobile SDKs don't define vsnprintf but all define _vsnprintf (hopefully).
- According to MSDN "vsnprintf is identical to _vsnprintf". So we use _vsnprintf with MSC.
- */
- #define VSNPRINTF _vsnprintf
-#else
- #define VSNPRINTF vsnprintf
-#endif
-
-#define PA_LOG_BUF_SIZE 2048
-
-void PaUtil_DebugPrint( const char *format, ... )
-{
- // Optional logging into Output console of Visual Studio
-#if defined(_MSC_VER) && defined(PA_ENABLE_MSVC_DEBUG_OUTPUT)
- {
- char buf[PA_LOG_BUF_SIZE];
- va_list ap;
- va_start(ap, format);
- VSNPRINTF(buf, sizeof(buf), format, ap);
- buf[sizeof(buf)-1] = 0;
- OutputDebugStringA(buf);
- va_end(ap);
- }
-#endif
-
- // Output to User-Callback
- if (userCB != NULL)
- {
- char strdump[PA_LOG_BUF_SIZE];
- va_list ap;
- va_start(ap, format);
- VSNPRINTF(strdump, sizeof(strdump), format, ap);
- strdump[sizeof(strdump)-1] = 0;
- userCB(strdump);
- va_end(ap);
- }
- else
- // Standard output to stderr
- {
- va_list ap;
- va_start(ap, format);
- vfprintf(stderr, format, ap);
- va_end(ap);
- fflush(stderr);
- }
-}
+/*
+ * $Id: pa_log.c $
+ * Portable Audio I/O Library Multi-Host API front end
+ * Validate function parameters and manage multiple host APIs.
+ *
+ * Based on the Open Source API proposed by Ross Bencina
+ * Copyright (c) 1999-2006 Ross Bencina, Phil Burk
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/*
+ * The text above constitutes the entire PortAudio license; however,
+ * the PortAudio community also makes the following non-binding requests:
+ *
+ * Any person wishing to distribute modifications to the Software is
+ * requested to send the modifications to the original developer so that
+ * they can be incorporated into the canonical version. It is also
+ * requested that these non-binding requests be included along with the
+ * license above.
+ */
+
+/** @file
+ @ingroup common_src
+
+ @brief Implements log function.
+
+ PaUtil_SetLogPrintFunction can be user called to replace the provided
+ DefaultLogPrint function, which writes to stderr.
+ One can NOT pass var_args across compiler/dll boundaries as it is not
+ "byte code/abi portable". So the technique used here is to allocate a local
+ a static array, write in it, then callback the user with a pointer to its
+ start.
+*/
+
+#include
+#include
+
+#include "pa_debugprint.h"
+
+// for OutputDebugStringA
+#if defined(_MSC_VER) && defined(PA_ENABLE_MSVC_DEBUG_OUTPUT)
+ #define WIN32_LEAN_AND_MEAN // exclude rare headers
+ #include "windows.h"
+#endif
+
+// User callback
+static PaUtilLogCallback userCB = NULL;
+
+// Sets user callback
+void PaUtil_SetDebugPrintFunction(PaUtilLogCallback cb)
+{
+ userCB = cb;
+}
+
+/*
+ If your platform doesnÂ’t have vsnprintf, you are stuck with a
+ VERY dangerous alternative, vsprintf (with no n)
+*/
+#if _MSC_VER
+ /* Some Windows Mobile SDKs don't define vsnprintf but all define _vsnprintf (hopefully).
+ According to MSDN "vsnprintf is identical to _vsnprintf". So we use _vsnprintf with MSC.
+ */
+ #define VSNPRINTF _vsnprintf
+#else
+ #define VSNPRINTF vsnprintf
+#endif
+
+#define PA_LOG_BUF_SIZE 2048
+
+void PaUtil_DebugPrint( const char *format, ... )
+{
+ // Optional logging into Output console of Visual Studio
+#if defined(_MSC_VER) && defined(PA_ENABLE_MSVC_DEBUG_OUTPUT)
+ {
+ char buf[PA_LOG_BUF_SIZE];
+ va_list ap;
+ va_start(ap, format);
+ VSNPRINTF(buf, sizeof(buf), format, ap);
+ buf[sizeof(buf)-1] = 0;
+ OutputDebugStringA(buf);
+ va_end(ap);
+ }
+#endif
+
+ // Output to User-Callback
+ if (userCB != NULL)
+ {
+ char strdump[PA_LOG_BUF_SIZE];
+ va_list ap;
+ va_start(ap, format);
+ VSNPRINTF(strdump, sizeof(strdump), format, ap);
+ strdump[sizeof(strdump)-1] = 0;
+ userCB(strdump);
+ va_end(ap);
+ }
+ else
+ // Standard output to stderr
+ {
+ va_list ap;
+ va_start(ap, format);
+ vfprintf(stderr, format, ap);
+ va_end(ap);
+ fflush(stderr);
+ }
+}
diff --git a/src/common/pa_debugprint.h b/src/common/pa_debugprint.h
index f333add..5fba766 100644
--- a/src/common/pa_debugprint.h
+++ b/src/common/pa_debugprint.h
@@ -1,149 +1,149 @@
-#ifndef PA_LOG_H
-#define PA_LOG_H
-/*
- * Log file redirector function
- * Copyright (c) 1999-2006 Ross Bencina, Phil Burk
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files
- * (the "Software"), to deal in the Software without restriction,
- * including without limitation the rights to use, copy, modify, merge,
- * publish, distribute, sublicense, and/or sell copies of the Software,
- * and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/*
- * The text above constitutes the entire PortAudio license; however,
- * the PortAudio community also makes the following non-binding requests:
- *
- * Any person wishing to distribute modifications to the Software is
- * requested to send the modifications to the original developer so that
- * they can be incorporated into the canonical version. It is also
- * requested that these non-binding requests be included along with the
- * license above.
- */
-
-/** @file
- @ingroup common_src
-*/
-
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif /* __cplusplus */
-
-
-
-void PaUtil_DebugPrint( const char *format, ... );
-
-
-/*
- The basic format for log messages is described below. If you need to
- add any log messages, please follow this format.
-
- Function entry (void function):
-
- "FunctionName called.\n"
-
- Function entry (non void function):
-
- "FunctionName called:\n"
- "\tParam1Type param1: param1Value\n"
- "\tParam2Type param2: param2Value\n" (etc...)
-
-
- Function exit (no return value):
-
- "FunctionName returned.\n"
-
- Function exit (simple return value):
-
- "FunctionName returned:\n"
- "\tReturnType: returnValue\n"
-
- If the return type is an error code, the error text is displayed in ()
-
- If the return type is not an error code, but has taken a special value
- because an error occurred, then the reason for the error is shown in []
-
- If the return type is a struct ptr, the struct is dumped.
-
- See the code below for examples
-*/
-
-/** PA_DEBUG() provides a simple debug message printing facility. The macro
- passes it's argument to a printf-like function called PaUtil_DebugPrint()
- which prints to stderr and always flushes the stream after printing.
- Because preprocessor macros cannot directly accept variable length argument
- lists, calls to the macro must include an additional set of parenthesis, eg:
- PA_DEBUG(("errorno: %d", 1001 ));
-*/
-
-
-#ifdef PA_ENABLE_DEBUG_OUTPUT
-#define PA_DEBUG(x) PaUtil_DebugPrint x ;
-#else
-#define PA_DEBUG(x)
-#endif
-
-
-#ifdef PA_LOG_API_CALLS
-#define PA_LOGAPI(x) PaUtil_DebugPrint x
-
-#define PA_LOGAPI_ENTER(functionName) PaUtil_DebugPrint( functionName " called.\n" )
-
-#define PA_LOGAPI_ENTER_PARAMS(functionName) PaUtil_DebugPrint( functionName " called:\n" )
-
-#define PA_LOGAPI_EXIT(functionName) PaUtil_DebugPrint( functionName " returned.\n" )
-
-#define PA_LOGAPI_EXIT_PAERROR( functionName, result ) \
- PaUtil_DebugPrint( functionName " returned:\n" ); \
- PaUtil_DebugPrint("\tPaError: %d ( %s )\n", result, Pa_GetErrorText( result ) )
-
-#define PA_LOGAPI_EXIT_T( functionName, resultFormatString, result ) \
- PaUtil_DebugPrint( functionName " returned:\n" ); \
- PaUtil_DebugPrint("\t" resultFormatString "\n", result )
-
-#define PA_LOGAPI_EXIT_PAERROR_OR_T_RESULT( functionName, positiveResultFormatString, result ) \
- PaUtil_DebugPrint( functionName " returned:\n" ); \
- if( result > 0 ) \
- PaUtil_DebugPrint("\t" positiveResultFormatString "\n", result ); \
- else \
- PaUtil_DebugPrint("\tPaError: %d ( %s )\n", result, Pa_GetErrorText( result ) )
-#else
-#define PA_LOGAPI(x)
-#define PA_LOGAPI_ENTER(functionName)
-#define PA_LOGAPI_ENTER_PARAMS(functionName)
-#define PA_LOGAPI_EXIT(functionName)
-#define PA_LOGAPI_EXIT_PAERROR( functionName, result )
-#define PA_LOGAPI_EXIT_T( functionName, resultFormatString, result )
-#define PA_LOGAPI_EXIT_PAERROR_OR_T_RESULT( functionName, positiveResultFormatString, result )
-#endif
-
-
-typedef void (*PaUtilLogCallback ) (const char *log);
-
-/**
- Install user provided log function
-*/
-void PaUtil_SetDebugPrintFunction(PaUtilLogCallback cb);
-
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-#endif /* PA_LOG_H */
+#ifndef PA_LOG_H
+#define PA_LOG_H
+/*
+ * Log file redirector function
+ * Copyright (c) 1999-2006 Ross Bencina, Phil Burk
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/*
+ * The text above constitutes the entire PortAudio license; however,
+ * the PortAudio community also makes the following non-binding requests:
+ *
+ * Any person wishing to distribute modifications to the Software is
+ * requested to send the modifications to the original developer so that
+ * they can be incorporated into the canonical version. It is also
+ * requested that these non-binding requests be included along with the
+ * license above.
+ */
+
+/** @file
+ @ingroup common_src
+*/
+
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+
+
+void PaUtil_DebugPrint( const char *format, ... );
+
+
+/*
+ The basic format for log messages is described below. If you need to
+ add any log messages, please follow this format.
+
+ Function entry (void function):
+
+ "FunctionName called.\n"
+
+ Function entry (non void function):
+
+ "FunctionName called:\n"
+ "\tParam1Type param1: param1Value\n"
+ "\tParam2Type param2: param2Value\n" (etc...)
+
+
+ Function exit (no return value):
+
+ "FunctionName returned.\n"
+
+ Function exit (simple return value):
+
+ "FunctionName returned:\n"
+ "\tReturnType: returnValue\n"
+
+ If the return type is an error code, the error text is displayed in ()
+
+ If the return type is not an error code, but has taken a special value
+ because an error occurred, then the reason for the error is shown in []
+
+ If the return type is a struct ptr, the struct is dumped.
+
+ See the code below for examples
+*/
+
+/** PA_DEBUG() provides a simple debug message printing facility. The macro
+ passes it's argument to a printf-like function called PaUtil_DebugPrint()
+ which prints to stderr and always flushes the stream after printing.
+ Because preprocessor macros cannot directly accept variable length argument
+ lists, calls to the macro must include an additional set of parenthesis, eg:
+ PA_DEBUG(("errorno: %d", 1001 ));
+*/
+
+
+#ifdef PA_ENABLE_DEBUG_OUTPUT
+#define PA_DEBUG(x) PaUtil_DebugPrint x ;
+#else
+#define PA_DEBUG(x)
+#endif
+
+
+#ifdef PA_LOG_API_CALLS
+#define PA_LOGAPI(x) PaUtil_DebugPrint x
+
+#define PA_LOGAPI_ENTER(functionName) PaUtil_DebugPrint( functionName " called.\n" )
+
+#define PA_LOGAPI_ENTER_PARAMS(functionName) PaUtil_DebugPrint( functionName " called:\n" )
+
+#define PA_LOGAPI_EXIT(functionName) PaUtil_DebugPrint( functionName " returned.\n" )
+
+#define PA_LOGAPI_EXIT_PAERROR( functionName, result ) \
+ PaUtil_DebugPrint( functionName " returned:\n" ); \
+ PaUtil_DebugPrint("\tPaError: %d ( %s )\n", result, Pa_GetErrorText( result ) )
+
+#define PA_LOGAPI_EXIT_T( functionName, resultFormatString, result ) \
+ PaUtil_DebugPrint( functionName " returned:\n" ); \
+ PaUtil_DebugPrint("\t" resultFormatString "\n", result )
+
+#define PA_LOGAPI_EXIT_PAERROR_OR_T_RESULT( functionName, positiveResultFormatString, result ) \
+ PaUtil_DebugPrint( functionName " returned:\n" ); \
+ if( result > 0 ) \
+ PaUtil_DebugPrint("\t" positiveResultFormatString "\n", result ); \
+ else \
+ PaUtil_DebugPrint("\tPaError: %d ( %s )\n", result, Pa_GetErrorText( result ) )
+#else
+#define PA_LOGAPI(x)
+#define PA_LOGAPI_ENTER(functionName)
+#define PA_LOGAPI_ENTER_PARAMS(functionName)
+#define PA_LOGAPI_EXIT(functionName)
+#define PA_LOGAPI_EXIT_PAERROR( functionName, result )
+#define PA_LOGAPI_EXIT_T( functionName, resultFormatString, result )
+#define PA_LOGAPI_EXIT_PAERROR_OR_T_RESULT( functionName, positiveResultFormatString, result )
+#endif
+
+
+typedef void (*PaUtilLogCallback ) (const char *log);
+
+/**
+ Install user provided log function
+*/
+void PaUtil_SetDebugPrintFunction(PaUtilLogCallback cb);
+
+
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+#endif /* PA_LOG_H */
diff --git a/src/hostapi/asihpi/pa_linux_asihpi.c b/src/hostapi/asihpi/pa_linux_asihpi.c
index 244a00c..f5a5290 100644
--- a/src/hostapi/asihpi/pa_linux_asihpi.c
+++ b/src/hostapi/asihpi/pa_linux_asihpi.c
@@ -1,2893 +1,2893 @@
-/*
- * $Id:$
- * PortAudio Portable Real-Time Audio Library
- * Latest Version at: http://www.portaudio.com
- * AudioScience HPI implementation by Fred Gleason, Ludwig Schwardt and
- * Eliot Blennerhassett
- *
- * Copyright (c) 2003 Fred Gleason
- * Copyright (c) 2005,2006 Ludwig Schwardt
- * Copyright (c) 2011 Eliot Blennerhassett
- *
- * Based on the Open Source API proposed by Ross Bencina
- * Copyright (c) 1999-2008 Ross Bencina, Phil Burk
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files
- * (the "Software"), to deal in the Software without restriction,
- * including without limitation the rights to use, copy, modify, merge,
- * publish, distribute, sublicense, and/or sell copies of the Software,
- * and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/*
- * The text above constitutes the entire PortAudio license; however,
- * the PortAudio community also makes the following non-binding requests:
- *
- * Any person wishing to distribute modifications to the Software is
- * requested to send the modifications to the original developer so that
- * they can be incorporated into the canonical version. It is also
- * requested that these non-binding requests be included along with the
- * license above.
- */
-
-/*
- * Modification History
- * 12/2003 - Initial version
- * 09/2005 - v19 version [rewrite]
- */
-
-/** @file
- @ingroup hostapi_src
- @brief Host API implementation supporting AudioScience cards
- via the Linux HPI interface.
-
-
Overview
-
- This is a PortAudio implementation for the AudioScience HPI Audio API
- on the Linux platform. AudioScience makes a range of audio adapters customised
- for the broadcasting industry, with support for both Windows and Linux.
- More information on their products can be found on their website:
-
- http://www.audioscience.com
-
- Documentation for the HPI API can be found at:
-
- http://www.audioscience.com/internet/download/sdk/hpi_usermanual_html/html/index.html
-
- The Linux HPI driver itself (a kernel module + library) can be downloaded from:
-
- http://www.audioscience.com/internet/download/linux_drivers.htm
-
-
Implementation strategy
-
- *Note* Ideally, AudioScience cards should be handled by the PortAudio ALSA
- implementation on Linux, as ALSA is the preferred Linux soundcard API. The existence
- of this host API implementation might therefore seem a bit flawed. Unfortunately, at
- the time of the creation of this implementation (June 2006), the PA ALSA implementation
- could not make use of the existing AudioScience ALSA driver. PA ALSA uses the
- "memory-mapped" (mmap) ALSA access mode to interact with the ALSA library, while the
- AudioScience ALSA driver only supports the "read-write" access mode. The appropriate
- solution to this problem is to add "read-write" support to PortAudio ALSA, thereby
- extending the range of soundcards it supports (AudioScience cards are not the only
- ones with this problem). Given the author's limited knowledge of ALSA and the
- simplicity of the HPI API, the second-best solution was born...
-
- The following mapping between HPI and PA was followed:
- HPI subsystem => PortAudio host API
- HPI adapter => nothing specific
- HPI stream => PortAudio device
-
- Each HPI stream is either input or output (not both), and can support
- different channel counts, sampling rates and sample formats. It is therefore
- a more natural fit to a PA device. A PA stream can therefore combine two
- HPI streams (one input and one output) into a "full-duplex" stream. These
- HPI streams can even be on different physical adapters. The two streams ought to be
- sample-synchronised when they reside on the same adapter, as most AudioScience adapters
- derive their ADC and DAC clocks from one master clock. When combining two adapters
- into one full-duplex stream, however, the use of a word clock connection between the
- adapters is strongly recommended.
-
- The HPI interface is inherently blocking, making use of read and write calls to
- transfer data between user buffers and driver buffers. The callback interface therefore
- requires a helper thread ("callback engine") which periodically transfers data (one thread
- per PA stream, in fact). The current implementation explicitly sleeps via Pa_Sleep() until
- enough samples can be transferred (select() or poll() would be better, but currently seems
- impossible...). The thread implementation makes use of the Unix thread helper functions
- and some pthread calls here and there. If a unified PA thread exists, this host API
- implementation might also compile on Windows, as this is the only real Linux-specific
- part of the code.
-
- There is no inherent fixed buffer size in the HPI interface, as in some other host APIs.
- The PortAudio implementation contains a buffer that is allocated during OpenStream and
- used to transfer data between the callback and the HPI driver buffer. The size of this
- buffer is quite flexible and is derived from latency suggestions and matched to the
- requested callback buffer size as far as possible. It can become quite huge, as the
- AudioScience cards are typically geared towards higher-latency applications and contain
- large hardware buffers.
-
- The HPI interface natively supports most common sample formats and sample rates (some
- conversion is done on the adapter itself).
-
- Stream time is measured based on the number of processed frames, which is adjusted by the
- number of frames currently buffered by the HPI driver.
-
- There is basic support for detecting overflow and underflow. The HPI interface does not
- explicitly indicate this, so thresholds on buffer levels are used in combination with
- stream state. Recovery from overflow and underflow is left to the PA client.
-
- Blocking streams are also implemented. It makes use of the same polling routines that
- the callback interface uses, in order to prevent the allocation of variable-sized
- buffers during reading and writing. The framesPerBuffer parameter is therefore still
- relevant, and this can be increased in the blocking case to improve efficiency.
-
- The implementation contains extensive reporting macros (slightly modified PA_ENSURE and
- PA_UNLESS versions) and a useful stream dump routine to provide debugging feedback.
-
- Output buffer priming via the user callback (i.e. paPrimeOutputBuffersUsingStreamCallback
- and friends) is not implemented yet. All output is primed with silence.
- */
-
-#include
-#include
-#include
-#include /* strlen() */
-#include /* pthreads and friends */
-#include /* assert */
-#include /* ceil, floor */
-
-#include /* HPI API */
-
-#include "portaudio.h" /* PortAudio API */
-#include "pa_util.h" /* PA_DEBUG, other small utilities */
-#include "pa_unix_util.h" /* Unix threading utilities */
-#include "pa_allocation.h" /* Group memory allocation */
-#include "pa_hostapi.h" /* Host API structs */
-#include "pa_stream.h" /* Stream interface structs */
-#include "pa_cpuload.h" /* CPU load measurer */
-#include "pa_process.h" /* Buffer processor */
-#include "pa_converters.h" /* PaUtilZeroer */
-#include "pa_debugprint.h"
-
-/* -------------------------------------------------------------------------- */
-
-/*
- * Defines
- */
-
-/* Error reporting and assertions */
-
-/** Evaluate expression, and return on any PortAudio errors */
-#define PA_ENSURE_(expr) \
- do { \
- PaError paError = (expr); \
- if( UNLIKELY( paError < paNoError ) ) \
- { \
- PA_DEBUG(( "Expression '" #expr "' failed in '" __FILE__ "', line: " STRINGIZE( __LINE__ ) "\n" )); \
- result = paError; \
- goto error; \
- } \
- } while (0);
-
-/** Assert expression, else return the provided PaError */
-#define PA_UNLESS_(expr, paError) \
- do { \
- if( UNLIKELY( (expr) == 0 ) ) \
- { \
- PA_DEBUG(( "Expression '" #expr "' failed in '" __FILE__ "', line: " STRINGIZE( __LINE__ ) "\n" )); \
- result = (paError); \
- goto error; \
- } \
- } while( 0 );
-
-/** Check return value of HPI function, and map it to PaError */
-#define PA_ASIHPI_UNLESS_(expr, paError) \
- do { \
- hpi_err_t hpiError = (expr); \
- /* If HPI error occurred */ \
- if( UNLIKELY( hpiError ) ) \
- { \
- char szError[256]; \
- HPI_GetErrorText( hpiError, szError ); \
- PA_DEBUG(( "HPI error %d occurred: %s\n", hpiError, szError )); \
- /* This message will always be displayed, even if debug info is disabled */ \
- PA_DEBUG(( "Expression '" #expr "' failed in '" __FILE__ "', line: " STRINGIZE( __LINE__ ) "\n" )); \
- if( (paError) == paUnanticipatedHostError ) \
- { \
- PA_DEBUG(( "Host error description: %s\n", szError )); \
- /* PaUtil_SetLastHostErrorInfo should only be used in the main thread */ \
- if( pthread_equal( pthread_self(), paUnixMainThread ) ) \
- { \
- PaUtil_SetLastHostErrorInfo( paInDevelopment, hpiError, szError ); \
- } \
- } \
- /* If paNoError is specified, continue as usual */ \
- /* (useful if you only want to print out the debug messages above) */ \
- if( (paError) < 0 ) \
- { \
- result = (paError); \
- goto error; \
- } \
- } \
- } while( 0 );
-
-/** Report HPI error code and text */
-#define PA_ASIHPI_REPORT_ERROR_(hpiErrorCode) \
- do { \
- char szError[256]; \
- HPI_GetErrorText( hpiError, szError ); \
- PA_DEBUG(( "HPI error %d occurred: %s\n", hpiError, szError )); \
- /* PaUtil_SetLastHostErrorInfo should only be used in the main thread */ \
- if( pthread_equal( pthread_self(), paUnixMainThread ) ) \
- { \
- PaUtil_SetLastHostErrorInfo( paInDevelopment, (hpiErrorCode), szError ); \
- } \
- } while( 0 );
-
-/* Defaults */
-
-/** Sample formats available natively on AudioScience hardware */
-#define PA_ASIHPI_AVAILABLE_FORMATS_ (paFloat32 | paInt32 | paInt24 | paInt16 | paUInt8)
-/** Enable background bus mastering (BBM) for buffer transfers, if available (see HPI docs) */
-#define PA_ASIHPI_USE_BBM_ 1
-/** Minimum number of frames in HPI buffer (for either data or available space).
- If buffer contains less data/space, it indicates xrun or completion. */
-#define PA_ASIHPI_MIN_FRAMES_ 1152
-/** Minimum polling interval in milliseconds, which determines minimum host buffer size */
-#define PA_ASIHPI_MIN_POLLING_INTERVAL_ 10
-
-/* -------------------------------------------------------------------------- */
-
-/*
- * Structures
- */
-
-/** Host API global data */
-typedef struct PaAsiHpiHostApiRepresentation
-{
- /* PortAudio "base class" - keep the baseRep first! (C-style inheritance) */
- PaUtilHostApiRepresentation baseHostApiRep;
- PaUtilStreamInterface callbackStreamInterface;
- PaUtilStreamInterface blockingStreamInterface;
-
- PaUtilAllocationGroup *allocations;
-
- /* implementation specific data goes here */
-
- PaHostApiIndex hostApiIndex;
-}
-PaAsiHpiHostApiRepresentation;
-
-
-/** Device data */
-typedef struct PaAsiHpiDeviceInfo
-{
- /* PortAudio "base class" - keep the baseRep first! (C-style inheritance) */
- /** Common PortAudio device information */
- PaDeviceInfo baseDeviceInfo;
-
- /* implementation specific data goes here */
-
- /** Adapter index */
- uint16_t adapterIndex;
- /** Adapter model number (hex) */
- uint16_t adapterType;
- /** Adapter HW/SW version */
- uint16_t adapterVersion;
- /** Adapter serial number */
- uint32_t adapterSerialNumber;
- /** Stream number */
- uint16_t streamIndex;
- /** 0=Input, 1=Output (HPI streams are either input or output but not both) */
- uint16_t streamIsOutput;
-}
-PaAsiHpiDeviceInfo;
-
-
-/** Stream state as defined by PortAudio.
- It seems that the host API implementation has to keep track of the PortAudio stream state.
- Please note that this is NOT the same as the state of the underlying HPI stream. By separating
- these two concepts, a lot of flexibility is gained. There is a rough match between the two,
- of course, but forcing a precise match is difficult. For example, HPI_STATE_DRAINED can occur
- during the Active state of PortAudio (due to underruns) and also during CallBackFinished in
- the case of an output stream. Similarly, HPI_STATE_STOPPED mostly coincides with the Stopped
- PortAudio state, by may also occur in the CallbackFinished state when recording is finished.
-
- Here is a rough match-up:
-
- PortAudio state => HPI state
- --------------- ---------
- Active => HPI_STATE_RECORDING, HPI_STATE_PLAYING, (HPI_STATE_DRAINED)
- Stopped => HPI_STATE_STOPPED
- CallbackFinished => HPI_STATE_STOPPED, HPI_STATE_DRAINED */
-typedef enum PaAsiHpiStreamState
-{
- paAsiHpiStoppedState=0,
- paAsiHpiActiveState=1,
- paAsiHpiCallbackFinishedState=2
-}
-PaAsiHpiStreamState;
-
-
-/** Stream component data (associated with one direction, i.e. either input or output) */
-typedef struct PaAsiHpiStreamComponent
-{
- /** Device information (HPI handles, etc) */
- PaAsiHpiDeviceInfo *hpiDevice;
- /** Stream handle, as passed to HPI interface. */
- hpi_handle_t hpiStream;
- /** Stream format, as passed to HPI interface */
- struct hpi_format hpiFormat;
- /** Number of bytes per frame, derived from hpiFormat and saved for convenience */
- uint32_t bytesPerFrame;
- /** Size of hardware (on-card) buffer of stream in bytes */
- uint32_t hardwareBufferSize;
- /** Size of host (BBM) buffer of stream in bytes (if used) */
- uint32_t hostBufferSize;
- /** Upper limit on the utilization of output stream buffer (both hardware and host).
- This prevents large latencies in an output-only stream with a potentially huge buffer
- and a fast data generator, which would otherwise keep the hardware buffer filled to
- capacity. See also the "Hardware Buffering=off" option in the AudioScience WAV driver. */
- uint32_t outputBufferCap;
- /** Sample buffer (halfway station between HPI and buffer processor) */
- uint8_t *tempBuffer;
- /** Sample buffer size, in bytes */
- uint32_t tempBufferSize;
-}
-PaAsiHpiStreamComponent;
-
-
-/** Stream data */
-typedef struct PaAsiHpiStream
-{
- /* PortAudio "base class" - keep the baseRep first! (C-style inheritance) */
- PaUtilStreamRepresentation baseStreamRep;
- PaUtilCpuLoadMeasurer cpuLoadMeasurer;
- PaUtilBufferProcessor bufferProcessor;
-
- PaUtilAllocationGroup *allocations;
-
- /* implementation specific data goes here */
-
- /** Separate structs for input and output sides of stream */
- PaAsiHpiStreamComponent *input, *output;
-
- /** Polling interval (in milliseconds) */
- uint32_t pollingInterval;
- /** Are we running in callback mode? */
- int callbackMode;
- /** Number of frames to transfer at a time to/from HPI */
- unsigned long maxFramesPerHostBuffer;
- /** Indicates that the stream is in the paNeverDropInput mode */
- int neverDropInput;
- /** Contains copy of user buffers, used by blocking interface to transfer non-interleaved data.
- It went here instead of to each stream component, as the stream component buffer setup in
- PaAsiHpi_SetupBuffers doesn't know the stream details such as callbackMode.
- (Maybe a problem later if ReadStream and WriteStream happens concurrently on same stream.) */
- void **blockingUserBufferCopy;
-
- /* Thread-related variables */
-
- /** Helper thread which will deliver data to user callback */
- PaUnixThread thread;
- /** PortAudio stream state (Active/Stopped/CallbackFinished) */
- volatile sig_atomic_t state;
- /** Hard abort, i.e. drop frames? */
- volatile sig_atomic_t callbackAbort;
- /** True if stream stopped via exiting callback with paComplete/paAbort flag
- (as opposed to explicit call to StopStream/AbortStream) */
- volatile sig_atomic_t callbackFinished;
-}
-PaAsiHpiStream;
-
-
-/** Stream state information, collected together for convenience */
-typedef struct PaAsiHpiStreamInfo
-{
- /** HPI stream state (HPI_STATE_STOPPED, HPI_STATE_PLAYING, etc.) */
- uint16_t state;
- /** Size (in bytes) of recording/playback data buffer in HPI driver */
- uint32_t bufferSize;
- /** Amount of data (in bytes) available in the buffer */
- uint32_t dataSize;
- /** Number of frames played/recorded since last stream reset */
- uint32_t frameCounter;
- /** Amount of data (in bytes) in hardware (on-card) buffer.
- This differs from dataSize if bus mastering (BBM) is used, which introduces another
- driver-level buffer to which dataSize/bufferSize then refers. */
- uint32_t auxDataSize;
- /** Total number of data frames currently buffered by HPI driver (host + hw buffers) */
- uint32_t totalBufferedData;
- /** Size of immediately available data (for input) or space (for output) in frames.
- This only checks the first-level buffer (typically host buffer). This amount can be
- transferred immediately. */
- uint32_t availableFrames;
- /** Indicates that hardware buffer is getting too full */
- int overflow;
- /** Indicates that hardware buffer is getting too empty */
- int underflow;
-}
-PaAsiHpiStreamInfo;
-
-/* -------------------------------------------------------------------------- */
-
-/*
- * Function prototypes
- */
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif /* __cplusplus */
-
- /* The only exposed function in the entire host API implementation */
- PaError PaAsiHpi_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiIndex index );
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-static void Terminate( struct PaUtilHostApiRepresentation *hostApi );
-static PaError IsFormatSupported( struct PaUtilHostApiRepresentation *hostApi,
- const PaStreamParameters *inputParameters,
- const PaStreamParameters *outputParameters,
- double sampleRate );
-
-/* Stream prototypes */
-static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
- PaStream **s,
- const PaStreamParameters *inputParameters,
- const PaStreamParameters *outputParameters,
- double sampleRate,
- unsigned long framesPerBuffer,
- PaStreamFlags streamFlags,
- PaStreamCallback *streamCallback,
- void *userData );
-static PaError CloseStream( PaStream *s );
-static PaError StartStream( PaStream *s );
-static PaError StopStream( PaStream *s );
-static PaError AbortStream( PaStream *s );
-static PaError IsStreamStopped( PaStream *s );
-static PaError IsStreamActive( PaStream *s );
-static PaTime GetStreamTime( PaStream *s );
-static double GetStreamCpuLoad( PaStream *s );
-
-/* Blocking prototypes */
-static PaError ReadStream( PaStream *s, void *buffer, unsigned long frames );
-static PaError WriteStream( PaStream *s, const void *buffer, unsigned long frames );
-static signed long GetStreamReadAvailable( PaStream *s );
-static signed long GetStreamWriteAvailable( PaStream *s );
-
-/* Callback prototypes */
-static void *CallbackThreadFunc( void *userData );
-
-/* Functions specific to this API */
-static PaError PaAsiHpi_BuildDeviceList( PaAsiHpiHostApiRepresentation *hpiHostApi );
-static uint16_t PaAsiHpi_PaToHpiFormat( PaSampleFormat paFormat );
-static PaSampleFormat PaAsiHpi_HpiToPaFormat( uint16_t hpiFormat );
-static PaError PaAsiHpi_CreateFormat( struct PaUtilHostApiRepresentation *hostApi,
- const PaStreamParameters *parameters, double sampleRate,
- PaAsiHpiDeviceInfo **hpiDevice, struct hpi_format *hpiFormat );
-static PaError PaAsiHpi_OpenInput( struct PaUtilHostApiRepresentation *hostApi,
- const PaAsiHpiDeviceInfo *hpiDevice, const struct hpi_format *hpiFormat,
- hpi_handle_t *hpiStream );
-static PaError PaAsiHpi_OpenOutput( struct PaUtilHostApiRepresentation *hostApi,
- const PaAsiHpiDeviceInfo *hpiDevice, const struct hpi_format *hpiFormat,
- hpi_handle_t *hpiStream );
-static PaError PaAsiHpi_GetStreamInfo( PaAsiHpiStreamComponent *streamComp, PaAsiHpiStreamInfo *info );
-static void PaAsiHpi_StreamComponentDump( PaAsiHpiStreamComponent *streamComp, PaAsiHpiStream *stream );
-static void PaAsiHpi_StreamDump( PaAsiHpiStream *stream );
-static PaError PaAsiHpi_SetupBuffers( PaAsiHpiStreamComponent *streamComp, uint32_t pollingInterval,
- unsigned long framesPerPaHostBuffer, PaTime suggestedLatency );
-static PaError PaAsiHpi_PrimeOutputWithSilence( PaAsiHpiStream *stream );
-static PaError PaAsiHpi_StartStream( PaAsiHpiStream *stream, int outputPrimed );
-static PaError PaAsiHpi_StopStream( PaAsiHpiStream *stream, int abort );
-static PaError PaAsiHpi_ExplicitStop( PaAsiHpiStream *stream, int abort );
-static void PaAsiHpi_OnThreadExit( void *userData );
-static PaError PaAsiHpi_WaitForFrames( PaAsiHpiStream *stream, unsigned long *framesAvail,
- PaStreamCallbackFlags *cbFlags );
-static void PaAsiHpi_CalculateTimeInfo( PaAsiHpiStream *stream, PaStreamCallbackTimeInfo *timeInfo );
-static PaError PaAsiHpi_BeginProcessing( PaAsiHpiStream* stream, unsigned long* numFrames,
- PaStreamCallbackFlags *cbFlags );
-static PaError PaAsiHpi_EndProcessing( PaAsiHpiStream *stream, unsigned long numFrames,
- PaStreamCallbackFlags *cbFlags );
-
-/* ==========================================================================
- * ============================= IMPLEMENTATION =============================
- * ========================================================================== */
-
-/* --------------------------- Host API Interface --------------------------- */
-
-/** Enumerate all PA devices (= HPI streams).
- This compiles a list of all HPI adapters, and registers a PA device for each input and
- output stream it finds. Most errors are ignored, as missing or erroneous devices are
- simply skipped.
-
- @param hpiHostApi Pointer to HPI host API struct
-
- @return PortAudio error code (only paInsufficientMemory in practice)
- */
-static PaError PaAsiHpi_BuildDeviceList( PaAsiHpiHostApiRepresentation *hpiHostApi )
-{
- PaError result = paNoError;
- PaUtilHostApiRepresentation *hostApi = &hpiHostApi->baseHostApiRep;
- PaHostApiInfo *baseApiInfo = &hostApi->info;
- PaAsiHpiDeviceInfo *hpiDeviceList;
- int numAdapters;
- hpi_err_t hpiError = 0;
- int i, j, deviceCount = 0, deviceIndex = 0;
-
- assert( hpiHostApi );
-
- /* Errors not considered critical here (subsystem may report 0 devices), but report them */
- /* in debug mode. */
- PA_ASIHPI_UNLESS_( HPI_SubSysGetNumAdapters( NULL, &numAdapters), paNoError );
-
- for( i=0; i < numAdapters; ++i )
- {
- uint16_t inStreams, outStreams;
- uint16_t version;
- uint32_t serial;
- uint16_t type;
- uint32_t idx;
-
- hpiError = HPI_SubSysGetAdapter(NULL, i, &idx, &type);
- if (hpiError)
- continue;
-
- /* Try to open adapter */
- hpiError = HPI_AdapterOpen( NULL, idx );
- /* Report error and skip to next device on failure */
- if( hpiError )
- {
- PA_ASIHPI_REPORT_ERROR_( hpiError );
- continue;
- }
- hpiError = HPI_AdapterGetInfo( NULL, idx, &outStreams, &inStreams,
- &version, &serial, &type );
- /* Skip to next device on failure */
- if( hpiError )
- {
- PA_ASIHPI_REPORT_ERROR_( hpiError );
- continue;
- }
- else
- {
- /* Assign default devices if available and increment device count */
- if( (baseApiInfo->defaultInputDevice == paNoDevice) && (inStreams > 0) )
- baseApiInfo->defaultInputDevice = deviceCount;
- deviceCount += inStreams;
- if( (baseApiInfo->defaultOutputDevice == paNoDevice) && (outStreams > 0) )
- baseApiInfo->defaultOutputDevice = deviceCount;
- deviceCount += outStreams;
- }
- }
-
- /* Register any discovered devices */
- if( deviceCount > 0 )
- {
- /* Memory allocation */
- PA_UNLESS_( hostApi->deviceInfos = (PaDeviceInfo**) PaUtil_GroupAllocateMemory(
- hpiHostApi->allocations, sizeof(PaDeviceInfo*) * deviceCount ),
- paInsufficientMemory );
- /* Allocate all device info structs in a contiguous block */
- PA_UNLESS_( hpiDeviceList = (PaAsiHpiDeviceInfo*) PaUtil_GroupAllocateMemory(
- hpiHostApi->allocations, sizeof(PaAsiHpiDeviceInfo) * deviceCount ),
- paInsufficientMemory );
-
- /* Now query devices again for information */
- for( i=0; i < numAdapters; ++i )
- {
- uint16_t inStreams, outStreams;
- uint16_t version;
- uint32_t serial;
- uint16_t type;
- uint32_t idx;
-
- hpiError = HPI_SubSysGetAdapter( NULL, i, &idx, &type );
- if (hpiError)
- continue;
-
- /* Assume adapter is still open from previous round */
- hpiError = HPI_AdapterGetInfo( NULL, idx,
- &outStreams, &inStreams, &version, &serial, &type );
- /* Report error and skip to next device on failure */
- if( hpiError )
- {
- PA_ASIHPI_REPORT_ERROR_( hpiError );
- continue;
- }
- else
- {
- PA_DEBUG(( "Found HPI Adapter ID=%4X Idx=%d #In=%d #Out=%d S/N=%d HWver=%c%d DSPver=%03d\n",
- type, idx, inStreams, outStreams, serial,
- ((version>>3)&0xf)+'A', /* Hw version major */
- version&0x7, /* Hw version minor */
- ((version>>13)*100)+((version>>7)&0x3f) /* DSP code version */
- ));
- }
-
- /* First add all input streams as devices */
- for( j=0; j < inStreams; ++j )
- {
- PaAsiHpiDeviceInfo *hpiDevice = &hpiDeviceList[deviceIndex];
- PaDeviceInfo *baseDeviceInfo = &hpiDevice->baseDeviceInfo;
- char srcName[72];
- char *deviceName;
-
- memset( hpiDevice, 0, sizeof(PaAsiHpiDeviceInfo) );
- /* Set implementation-specific device details */
- hpiDevice->adapterIndex = idx;
- hpiDevice->adapterType = type;
- hpiDevice->adapterVersion = version;
- hpiDevice->adapterSerialNumber = serial;
- hpiDevice->streamIndex = j;
- hpiDevice->streamIsOutput = 0;
- /* Set common PortAudio device stats */
- baseDeviceInfo->structVersion = 2;
- /* Make sure name string is owned by API info structure */
- sprintf( srcName,
- "Adapter %d (%4X) - Input Stream %d", i+1, type, j+1 );
- PA_UNLESS_( deviceName = (char *) PaUtil_GroupAllocateMemory(
- hpiHostApi->allocations, strlen(srcName) + 1 ), paInsufficientMemory );
- strcpy( deviceName, srcName );
- baseDeviceInfo->name = deviceName;
- baseDeviceInfo->hostApi = hpiHostApi->hostApiIndex;
- baseDeviceInfo->maxInputChannels = HPI_MAX_CHANNELS;
- baseDeviceInfo->maxOutputChannels = 0;
- /* Default latency values for interactive performance */
- baseDeviceInfo->defaultLowInputLatency = 0.01;
- baseDeviceInfo->defaultLowOutputLatency = -1.0;
- /* Default latency values for robust non-interactive applications (eg. playing sound files) */
- baseDeviceInfo->defaultHighInputLatency = 0.2;
- baseDeviceInfo->defaultHighOutputLatency = -1.0;
- /* HPI interface can actually handle any sampling rate to 1 Hz accuracy,
- * so this default is as good as any */
- baseDeviceInfo->defaultSampleRate = 44100;
-
- /* Store device in global PortAudio list */
- hostApi->deviceInfos[deviceIndex++] = (PaDeviceInfo *) hpiDevice;
- }
-
- /* Now add all output streams as devices (I know, the repetition is painful) */
- for( j=0; j < outStreams; ++j )
- {
- PaAsiHpiDeviceInfo *hpiDevice = &hpiDeviceList[deviceIndex];
- PaDeviceInfo *baseDeviceInfo = &hpiDevice->baseDeviceInfo;
- char srcName[72];
- char *deviceName;
-
- memset( hpiDevice, 0, sizeof(PaAsiHpiDeviceInfo) );
- /* Set implementation-specific device details */
- hpiDevice->adapterIndex = idx;
- hpiDevice->adapterType = type;
- hpiDevice->adapterVersion = version;
- hpiDevice->adapterSerialNumber = serial;
- hpiDevice->streamIndex = j;
- hpiDevice->streamIsOutput = 1;
- /* Set common PortAudio device stats */
- baseDeviceInfo->structVersion = 2;
- /* Make sure name string is owned by API info structure */
- sprintf( srcName,
- "Adapter %d (%4X) - Output Stream %d", i+1, type, j+1 );
- PA_UNLESS_( deviceName = (char *) PaUtil_GroupAllocateMemory(
- hpiHostApi->allocations, strlen(srcName) + 1 ), paInsufficientMemory );
- strcpy( deviceName, srcName );
- baseDeviceInfo->name = deviceName;
- baseDeviceInfo->hostApi = hpiHostApi->hostApiIndex;
- baseDeviceInfo->maxInputChannels = 0;
- baseDeviceInfo->maxOutputChannels = HPI_MAX_CHANNELS;
- /* Default latency values for interactive performance. */
- baseDeviceInfo->defaultLowInputLatency = -1.0;
- baseDeviceInfo->defaultLowOutputLatency = 0.01;
- /* Default latency values for robust non-interactive applications (eg. playing sound files). */
- baseDeviceInfo->defaultHighInputLatency = -1.0;
- baseDeviceInfo->defaultHighOutputLatency = 0.2;
- /* HPI interface can actually handle any sampling rate to 1 Hz accuracy,
- * so this default is as good as any */
- baseDeviceInfo->defaultSampleRate = 44100;
-
- /* Store device in global PortAudio list */
- hostApi->deviceInfos[deviceIndex++] = (PaDeviceInfo *) hpiDevice;
- }
- }
- }
-
- /* Finally acknowledge checked devices */
- baseApiInfo->deviceCount = deviceIndex;
-
-error:
- return result;
-}
-
-
-/** Initialize host API implementation.
- This is the only function exported beyond this file. It is called by PortAudio to initialize
- the host API. It stores API info, finds and registers all devices, and sets up callback and
- blocking interfaces.
-
- @param hostApi Pointer to host API struct
-
- @param hostApiIndex Index of current (HPI) host API
-
- @return PortAudio error code
- */
-PaError PaAsiHpi_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiIndex hostApiIndex )
-{
- PaError result = paNoError;
- PaAsiHpiHostApiRepresentation *hpiHostApi = NULL;
- PaHostApiInfo *baseApiInfo;
-
- /* Try to initialize HPI subsystem */
- if (!HPI_SubSysCreate())
- {
- /* the V19 development docs say that if an implementation
- * detects that it cannot be used, it should return a NULL
- * interface and paNoError */
- PA_DEBUG(( "Could not open HPI interface\n" ));
-
- *hostApi = NULL;
- return paNoError;
- }
- else
- {
- uint32_t hpiVersion;
- PA_ASIHPI_UNLESS_( HPI_SubSysGetVersionEx( NULL, &hpiVersion ), paUnanticipatedHostError );
- PA_DEBUG(( "HPI interface v%d.%02d.%02d\n",
- hpiVersion >> 16, (hpiVersion >> 8) & 0x0F, (hpiVersion & 0x0F) ));
- }
-
- /* Allocate host API structure */
- PA_UNLESS_( hpiHostApi = (PaAsiHpiHostApiRepresentation*) PaUtil_AllocateMemory(
- sizeof(PaAsiHpiHostApiRepresentation) ), paInsufficientMemory );
- PA_UNLESS_( hpiHostApi->allocations = PaUtil_CreateAllocationGroup(), paInsufficientMemory );
-
- hpiHostApi->hostApiIndex = hostApiIndex;
-
- *hostApi = &hpiHostApi->baseHostApiRep;
- baseApiInfo = &((*hostApi)->info);
- /* Fill in common API details */
- baseApiInfo->structVersion = 1;
- baseApiInfo->type = paAudioScienceHPI;
- baseApiInfo->name = "AudioScience HPI";
- baseApiInfo->deviceCount = 0;
- baseApiInfo->defaultInputDevice = paNoDevice;
- baseApiInfo->defaultOutputDevice = paNoDevice;
-
- PA_ENSURE_( PaAsiHpi_BuildDeviceList( hpiHostApi ) );
-
- (*hostApi)->Terminate = Terminate;
- (*hostApi)->OpenStream = OpenStream;
- (*hostApi)->IsFormatSupported = IsFormatSupported;
-
- PaUtil_InitializeStreamInterface( &hpiHostApi->callbackStreamInterface, CloseStream, StartStream,
- StopStream, AbortStream, IsStreamStopped, IsStreamActive,
- GetStreamTime, GetStreamCpuLoad,
- PaUtil_DummyRead, PaUtil_DummyWrite,
- PaUtil_DummyGetReadAvailable, PaUtil_DummyGetWriteAvailable );
-
- PaUtil_InitializeStreamInterface( &hpiHostApi->blockingStreamInterface, CloseStream, StartStream,
- StopStream, AbortStream, IsStreamStopped, IsStreamActive,
- GetStreamTime, PaUtil_DummyGetCpuLoad,
- ReadStream, WriteStream, GetStreamReadAvailable, GetStreamWriteAvailable );
-
- /* Store identity of main thread */
- PA_ENSURE_( PaUnixThreading_Initialize() );
-
- return result;
-error:
- if (hpiHostApi)
- PaUtil_FreeMemory( hpiHostApi );
- return result;
-}
-
-
-/** Terminate host API implementation.
- This closes all HPI adapters and frees the HPI subsystem. It also frees the host API struct
- memory. It should be called once for every PaAsiHpi_Initialize call.
-
- @param Pointer to host API struct
- */
-static void Terminate( struct PaUtilHostApiRepresentation *hostApi )
-{
- PaAsiHpiHostApiRepresentation *hpiHostApi = (PaAsiHpiHostApiRepresentation*)hostApi;
- int i;
- PaError result = paNoError;
-
- if( hpiHostApi )
- {
- /* Get rid of HPI-specific structures */
- uint16_t lastAdapterIndex = HPI_MAX_ADAPTERS;
- /* Iterate through device list and close adapters */
- for( i=0; i < hostApi->info.deviceCount; ++i )
- {
- PaAsiHpiDeviceInfo *hpiDevice = (PaAsiHpiDeviceInfo *) hostApi->deviceInfos[ i ];
- /* Close adapter only if it differs from previous one */
- if( hpiDevice->adapterIndex != lastAdapterIndex )
- {
- /* Ignore errors (report only during debugging) */
- PA_ASIHPI_UNLESS_( HPI_AdapterClose( NULL,
- hpiDevice->adapterIndex ), paNoError );
- lastAdapterIndex = hpiDevice->adapterIndex;
- }
- }
- /* Finally dismantle HPI subsystem */
- HPI_SubSysFree( NULL );
-
- if( hpiHostApi->allocations )
- {
- PaUtil_FreeAllAllocations( hpiHostApi->allocations );
- PaUtil_DestroyAllocationGroup( hpiHostApi->allocations );
- }
-
- PaUtil_FreeMemory( hpiHostApi );
- }
-error:
- return;
-}
-
-
-/** Converts PortAudio sample format to equivalent HPI format.
-
- @param paFormat PortAudio sample format
-
- @return HPI sample format
- */
-static uint16_t PaAsiHpi_PaToHpiFormat( PaSampleFormat paFormat )
-{
- /* Ignore interleaving flag */
- switch( paFormat & ~paNonInterleaved )
- {
- case paFloat32:
- return HPI_FORMAT_PCM32_FLOAT;
-
- case paInt32:
- return HPI_FORMAT_PCM32_SIGNED;
-
- case paInt24:
- return HPI_FORMAT_PCM24_SIGNED;
-
- case paInt16:
- return HPI_FORMAT_PCM16_SIGNED;
-
- case paUInt8:
- return HPI_FORMAT_PCM8_UNSIGNED;
-
- /* Default is 16-bit signed */
- case paInt8:
- default:
- return HPI_FORMAT_PCM16_SIGNED;
- }
-}
-
-
-/** Converts HPI sample format to equivalent PortAudio format.
-
- @param paFormat HPI sample format
-
- @return PortAudio sample format
- */
-static PaSampleFormat PaAsiHpi_HpiToPaFormat( uint16_t hpiFormat )
-{
- switch( hpiFormat )
- {
- case HPI_FORMAT_PCM32_FLOAT:
- return paFloat32;
-
- case HPI_FORMAT_PCM32_SIGNED:
- return paInt32;
-
- case HPI_FORMAT_PCM24_SIGNED:
- return paInt24;
-
- case HPI_FORMAT_PCM16_SIGNED:
- return paInt16;
-
- case HPI_FORMAT_PCM8_UNSIGNED:
- return paUInt8;
-
- /* Default is custom format (e.g. for HPI MP3 format) */
- default:
- return paCustomFormat;
- }
-}
-
-
-/** Creates HPI format struct based on PortAudio parameters.
- This also does some checks to see whether the desired format is valid, and whether
- the device allows it. This only checks the format of one half (input or output) of the
- PortAudio stream.
-
- @param hostApi Pointer to host API struct
-
- @param parameters Pointer to stream parameter struct
-
- @param sampleRate Desired sample rate
-
- @param hpiDevice Pointer to HPI device struct
-
- @param hpiFormat Resulting HPI format returned here
-
- @return PortAudio error code (typically indicating a problem with stream format)
- */
-static PaError PaAsiHpi_CreateFormat( struct PaUtilHostApiRepresentation *hostApi,
- const PaStreamParameters *parameters, double sampleRate,
- PaAsiHpiDeviceInfo **hpiDevice, struct hpi_format *hpiFormat )
-{
- int maxChannelCount = 0;
- PaSampleFormat hostSampleFormat = 0;
- hpi_err_t hpiError = 0;
-
- /* Unless alternate device specification is supported, reject the use of
- paUseHostApiSpecificDeviceSpecification */
- if( parameters->device == paUseHostApiSpecificDeviceSpecification )
- return paInvalidDevice;
- else
- {
- assert( parameters->device < hostApi->info.deviceCount );
- *hpiDevice = (PaAsiHpiDeviceInfo*) hostApi->deviceInfos[ parameters->device ];
- }
-
- /* Validate streamInfo - this implementation doesn't use custom stream info */
- if( parameters->hostApiSpecificStreamInfo )
- return paIncompatibleHostApiSpecificStreamInfo;
-
- /* Check that device can support channel count */
- if( (*hpiDevice)->streamIsOutput )
- {
- maxChannelCount = (*hpiDevice)->baseDeviceInfo.maxOutputChannels;
- }
- else
- {
- maxChannelCount = (*hpiDevice)->baseDeviceInfo.maxInputChannels;
- }
- if( (maxChannelCount == 0) || (parameters->channelCount > maxChannelCount) )
- return paInvalidChannelCount;
-
- /* All standard sample formats are supported by the buffer adapter,
- and this implementation doesn't support any custom sample formats */
- if( parameters->sampleFormat & paCustomFormat )
- return paSampleFormatNotSupported;
-
- /* Switch to closest HPI native format */
- hostSampleFormat = PaUtil_SelectClosestAvailableFormat(PA_ASIHPI_AVAILABLE_FORMATS_,
- parameters->sampleFormat );
- /* Setup format + info objects */
- hpiError = HPI_FormatCreate( hpiFormat, (uint16_t)parameters->channelCount,
- PaAsiHpi_PaToHpiFormat( hostSampleFormat ),
- (uint32_t)sampleRate, 0, 0 );
- if( hpiError )
- {
- PA_ASIHPI_REPORT_ERROR_( hpiError );
- switch( hpiError )
- {
- case HPI_ERROR_INVALID_FORMAT:
- return paSampleFormatNotSupported;
-
- case HPI_ERROR_INVALID_SAMPLERATE:
- case HPI_ERROR_INCOMPATIBLE_SAMPLERATE:
- return paInvalidSampleRate;
-
- case HPI_ERROR_INVALID_CHANNELS:
- return paInvalidChannelCount;
- }
- }
-
- return paNoError;
-}
-
-
-/** Open HPI input stream with given format.
- This attempts to open HPI input stream with desired format. If the format is not supported
- or the device is unavailable, the stream is closed and a PortAudio error code is returned.
-
- @param hostApi Pointer to host API struct
-
- @param hpiDevice Pointer to HPI device struct
-
- @param hpiFormat Pointer to HPI format struct
-
- @return PortAudio error code (typically indicating a problem with stream format or device)
-*/
-static PaError PaAsiHpi_OpenInput( struct PaUtilHostApiRepresentation *hostApi,
- const PaAsiHpiDeviceInfo *hpiDevice, const struct hpi_format *hpiFormat,
- hpi_handle_t *hpiStream )
-{
- PaAsiHpiHostApiRepresentation *hpiHostApi = (PaAsiHpiHostApiRepresentation*)hostApi;
- PaError result = paNoError;
- hpi_err_t hpiError = 0;
-
- /* Catch misplaced output devices, as they typically have 0 input channels */
- PA_UNLESS_( !hpiDevice->streamIsOutput, paInvalidChannelCount );
- /* Try to open input stream */
- PA_ASIHPI_UNLESS_( HPI_InStreamOpen( NULL, hpiDevice->adapterIndex,
- hpiDevice->streamIndex, hpiStream ), paDeviceUnavailable );
- /* Set input format (checking it in the process) */
- /* Could also use HPI_InStreamQueryFormat, but this economizes the process */
- hpiError = HPI_InStreamSetFormat( NULL, *hpiStream, (struct hpi_format*)hpiFormat );
- if( hpiError )
- {
- PA_ASIHPI_REPORT_ERROR_( hpiError );
- PA_ASIHPI_UNLESS_( HPI_InStreamClose( NULL, *hpiStream ), paNoError );
- switch( hpiError )
- {
- case HPI_ERROR_INVALID_FORMAT:
- return paSampleFormatNotSupported;
-
- case HPI_ERROR_INVALID_SAMPLERATE:
- case HPI_ERROR_INCOMPATIBLE_SAMPLERATE:
- return paInvalidSampleRate;
-
- case HPI_ERROR_INVALID_CHANNELS:
- return paInvalidChannelCount;
-
- default:
- /* In case anything else went wrong */
- return paInvalidDevice;
- }
- }
-
-error:
- return result;
-}
-
-
-/** Open HPI output stream with given format.
- This attempts to open HPI output stream with desired format. If the format is not supported
- or the device is unavailable, the stream is closed and a PortAudio error code is returned.
-
- @param hostApi Pointer to host API struct
-
- @param hpiDevice Pointer to HPI device struct
-
- @param hpiFormat Pointer to HPI format struct
-
- @return PortAudio error code (typically indicating a problem with stream format or device)
-*/
-static PaError PaAsiHpi_OpenOutput( struct PaUtilHostApiRepresentation *hostApi,
- const PaAsiHpiDeviceInfo *hpiDevice, const struct hpi_format *hpiFormat,
- hpi_handle_t *hpiStream )
-{
- PaAsiHpiHostApiRepresentation *hpiHostApi = (PaAsiHpiHostApiRepresentation*)hostApi;
- PaError result = paNoError;
- hpi_err_t hpiError = 0;
-
- /* Catch misplaced input devices, as they typically have 0 output channels */
- PA_UNLESS_( hpiDevice->streamIsOutput, paInvalidChannelCount );
- /* Try to open output stream */
- PA_ASIHPI_UNLESS_( HPI_OutStreamOpen( NULL, hpiDevice->adapterIndex,
- hpiDevice->streamIndex, hpiStream ), paDeviceUnavailable );
-
- /* Check output format (format is set on first write to output stream) */
- hpiError = HPI_OutStreamQueryFormat( NULL, *hpiStream, (struct hpi_format*)hpiFormat );
- if( hpiError )
- {
- PA_ASIHPI_REPORT_ERROR_( hpiError );
- PA_ASIHPI_UNLESS_( HPI_OutStreamClose( NULL, *hpiStream ), paNoError );
- switch( hpiError )
- {
- case HPI_ERROR_INVALID_FORMAT:
- return paSampleFormatNotSupported;
-
- case HPI_ERROR_INVALID_SAMPLERATE:
- case HPI_ERROR_INCOMPATIBLE_SAMPLERATE:
- return paInvalidSampleRate;
-
- case HPI_ERROR_INVALID_CHANNELS:
- return paInvalidChannelCount;
-
- default:
- /* In case anything else went wrong */
- return paInvalidDevice;
- }
- }
-
-error:
- return result;
-}
-
-
-/** Checks whether the desired stream formats and devices are supported
- (for both input and output).
- This is done by actually opening the appropriate HPI streams and closing them again.
-
- @param hostApi Pointer to host API struct
-
- @param inputParameters Pointer to stream parameter struct for input side of stream
-
- @param outputParameters Pointer to stream parameter struct for output side of stream
-
- @param sampleRate Desired sample rate
-
- @return PortAudio error code (paFormatIsSupported on success)
- */
-static PaError IsFormatSupported( struct PaUtilHostApiRepresentation *hostApi,
- const PaStreamParameters *inputParameters,
- const PaStreamParameters *outputParameters,
- double sampleRate )
-{
- PaError result = paFormatIsSupported;
- PaAsiHpiHostApiRepresentation *hpiHostApi = (PaAsiHpiHostApiRepresentation*)hostApi;
- PaAsiHpiDeviceInfo *hpiDevice = NULL;
- struct hpi_format hpiFormat;
-
- /* Input stream */
- if( inputParameters )
- {
- hpi_handle_t hpiStream;
- PA_DEBUG(( "%s: Checking input params: dev=%d, sr=%d, chans=%d, fmt=%d\n",
- __FUNCTION__, inputParameters->device, (int)sampleRate,
- inputParameters->channelCount, inputParameters->sampleFormat ));
- /* Create and validate format */
- PA_ENSURE_( PaAsiHpi_CreateFormat( hostApi, inputParameters, sampleRate,
- &hpiDevice, &hpiFormat ) );
- /* Open stream to further check format */
- PA_ENSURE_( PaAsiHpi_OpenInput( hostApi, hpiDevice, &hpiFormat, &hpiStream ) );
- /* Close stream again */
- PA_ASIHPI_UNLESS_( HPI_InStreamClose( NULL, hpiStream ), paNoError );
- }
-
- /* Output stream */
- if( outputParameters )
- {
- hpi_handle_t hpiStream;
- PA_DEBUG(( "%s: Checking output params: dev=%d, sr=%d, chans=%d, fmt=%d\n",
- __FUNCTION__, outputParameters->device, (int)sampleRate,
- outputParameters->channelCount, outputParameters->sampleFormat ));
- /* Create and validate format */
- PA_ENSURE_( PaAsiHpi_CreateFormat( hostApi, outputParameters, sampleRate,
- &hpiDevice, &hpiFormat ) );
- /* Open stream to further check format */
- PA_ENSURE_( PaAsiHpi_OpenOutput( hostApi, hpiDevice, &hpiFormat, &hpiStream ) );
- /* Close stream again */
- PA_ASIHPI_UNLESS_( HPI_OutStreamClose( NULL, hpiStream ), paNoError );
- }
-
-error:
- return result;
-}
-
-/* ---------------------------- Stream Interface ---------------------------- */
-
-/** Obtain HPI stream information.
- This obtains info such as stream state and available data/space in buffers. It also
- estimates whether an underflow or overflow occurred.
-
- @param streamComp Pointer to stream component (input or output) to query
-
- @param info Pointer to stream info struct that will contain result
-
- @return PortAudio error code (either paNoError, paDeviceUnavailable or paUnanticipatedHostError)
- */
-static PaError PaAsiHpi_GetStreamInfo( PaAsiHpiStreamComponent *streamComp, PaAsiHpiStreamInfo *info )
-{
- PaError result = paDeviceUnavailable;
- uint16_t state;
- uint32_t bufferSize, dataSize, frameCounter, auxDataSize, threshold;
- uint32_t hwBufferSize, hwDataSize;
-
- assert( streamComp );
- assert( info );
-
- /* First blank the stream info struct, in case something goes wrong below.
- This saves the caller from initializing the struct. */
- info->state = 0;
- info->bufferSize = 0;
- info->dataSize = 0;
- info->frameCounter = 0;
- info->auxDataSize = 0;
- info->totalBufferedData = 0;
- info->availableFrames = 0;
- info->underflow = 0;
- info->overflow = 0;
-
- if( streamComp->hpiDevice && streamComp->hpiStream )
- {
- /* Obtain detailed stream info (either input or output) */
- if( streamComp->hpiDevice->streamIsOutput )
- {
- PA_ASIHPI_UNLESS_( HPI_OutStreamGetInfoEx( NULL,
- streamComp->hpiStream,
- &state, &bufferSize, &dataSize, &frameCounter,
- &auxDataSize ), paUnanticipatedHostError );
- }
- else
- {
- PA_ASIHPI_UNLESS_( HPI_InStreamGetInfoEx( NULL,
- streamComp->hpiStream,
- &state, &bufferSize, &dataSize, &frameCounter,
- &auxDataSize ), paUnanticipatedHostError );
- }
- /* Load stream info */
- info->state = state;
- info->bufferSize = bufferSize;
- info->dataSize = dataSize;
- info->frameCounter = frameCounter;
- info->auxDataSize = auxDataSize;
- /* Determine total buffered data */
- info->totalBufferedData = dataSize;
- if( streamComp->hostBufferSize > 0 )
- info->totalBufferedData += auxDataSize;
- info->totalBufferedData /= streamComp->bytesPerFrame;
- /* Determine immediately available frames */
- info->availableFrames = streamComp->hpiDevice->streamIsOutput ?
- bufferSize - dataSize : dataSize;
- info->availableFrames /= streamComp->bytesPerFrame;
- /* Minimum space/data required in buffers */
- threshold = PA_MIN( streamComp->tempBufferSize,
- streamComp->bytesPerFrame * PA_ASIHPI_MIN_FRAMES_ );
- /* Obtain hardware buffer stats first, to simplify things */
- hwBufferSize = streamComp->hardwareBufferSize;
- hwDataSize = streamComp->hostBufferSize > 0 ? auxDataSize : dataSize;
- /* Underflow is a bit tricky */
- info->underflow = streamComp->hpiDevice->streamIsOutput ?
- /* Stream seems to start in drained state sometimes, so ignore initial underflow */
- (frameCounter > 0) && ( (state == HPI_STATE_DRAINED) || (hwDataSize == 0) ) :
- /* Input streams check the first-level (host) buffer for underflow */
- (state != HPI_STATE_STOPPED) && (dataSize < threshold);
- /* Check for overflow in second-level (hardware) buffer for both input and output */
- info->overflow = (state != HPI_STATE_STOPPED) && (hwBufferSize - hwDataSize < threshold);
-
- return paNoError;
- }
-
-error:
- return result;
-}
-
-
-/** Display stream component information for debugging purposes.
-
- @param streamComp Pointer to stream component (input or output) to query
-
- @param stream Pointer to stream struct which contains the component above
- */
-static void PaAsiHpi_StreamComponentDump( PaAsiHpiStreamComponent *streamComp,
- PaAsiHpiStream *stream )
-{
- PaAsiHpiStreamInfo streamInfo;
-
- assert( streamComp );
- assert( stream );
-
- /* Name of soundcard/device used by component */
- PA_DEBUG(( "device: %s\n", streamComp->hpiDevice->baseDeviceInfo.name ));
- /* Unfortunately some overlap between input and output here */
- if( streamComp->hpiDevice->streamIsOutput )
- {
- /* Settings on the user side (as experienced by user callback) */
- PA_DEBUG(( "user: %d-bit, %d ",
- 8*stream->bufferProcessor.bytesPerUserOutputSample,
- stream->bufferProcessor.outputChannelCount));
- if( stream->bufferProcessor.userOutputIsInterleaved )
- {
- PA_DEBUG(( "interleaved channels, " ));
- }
- else
- {
- PA_DEBUG(( "non-interleaved channels, " ));
- }
- PA_DEBUG(( "%d frames/buffer, latency = %5.1f ms\n",
- stream->bufferProcessor.framesPerUserBuffer,
- 1000*stream->baseStreamRep.streamInfo.outputLatency ));
- /* Settings on the host side (internal to PortAudio host API) */
- PA_DEBUG(( "host: %d-bit, %d interleaved channels, %d frames/buffer ",
- 8*stream->bufferProcessor.bytesPerHostOutputSample,
- stream->bufferProcessor.outputChannelCount,
- stream->bufferProcessor.framesPerHostBuffer ));
- }
- else
- {
- /* Settings on the user side (as experienced by user callback) */
- PA_DEBUG(( "user: %d-bit, %d ",
- 8*stream->bufferProcessor.bytesPerUserInputSample,
- stream->bufferProcessor.inputChannelCount));
- if( stream->bufferProcessor.userInputIsInterleaved )
- {
- PA_DEBUG(( "interleaved channels, " ));
- }
- else
- {
- PA_DEBUG(( "non-interleaved channels, " ));
- }
- PA_DEBUG(( "%d frames/buffer, latency = %5.1f ms\n",
- stream->bufferProcessor.framesPerUserBuffer,
- 1000*stream->baseStreamRep.streamInfo.inputLatency ));
- /* Settings on the host side (internal to PortAudio host API) */
- PA_DEBUG(( "host: %d-bit, %d interleaved channels, %d frames/buffer ",
- 8*stream->bufferProcessor.bytesPerHostInputSample,
- stream->bufferProcessor.inputChannelCount,
- stream->bufferProcessor.framesPerHostBuffer ));
- }
- switch( stream->bufferProcessor.hostBufferSizeMode )
- {
- case paUtilFixedHostBufferSize:
- PA_DEBUG(( "[fixed] " ));
- break;
- case paUtilBoundedHostBufferSize:
- PA_DEBUG(( "[bounded] " ));
- break;
- case paUtilUnknownHostBufferSize:
- PA_DEBUG(( "[unknown] " ));
- break;
- case paUtilVariableHostBufferSizePartialUsageAllowed:
- PA_DEBUG(( "[variable] " ));
- break;
- }
- PA_DEBUG(( "(%d max)\n", streamComp->tempBufferSize / streamComp->bytesPerFrame ));
- /* HPI hardware settings */
- PA_DEBUG(( "HPI: adapter %d stream %d, %d-bit, %d-channel, %d Hz\n",
- streamComp->hpiDevice->adapterIndex, streamComp->hpiDevice->streamIndex,
- 8 * streamComp->bytesPerFrame / streamComp->hpiFormat.wChannels,
- streamComp->hpiFormat.wChannels,
- streamComp->hpiFormat.dwSampleRate ));
- /* Stream state and buffer levels */
- PA_DEBUG(( "HPI: " ));
- PaAsiHpi_GetStreamInfo( streamComp, &streamInfo );
- switch( streamInfo.state )
- {
- case HPI_STATE_STOPPED:
- PA_DEBUG(( "[STOPPED] " ));
- break;
- case HPI_STATE_PLAYING:
- PA_DEBUG(( "[PLAYING] " ));
- break;
- case HPI_STATE_RECORDING:
- PA_DEBUG(( "[RECORDING] " ));
- break;
- case HPI_STATE_DRAINED:
- PA_DEBUG(( "[DRAINED] " ));
- break;
- default:
- PA_DEBUG(( "[unknown state] " ));
- break;
- }
- if( streamComp->hostBufferSize )
- {
- PA_DEBUG(( "host = %d/%d B, ", streamInfo.dataSize, streamComp->hostBufferSize ));
- PA_DEBUG(( "hw = %d/%d (%d) B, ", streamInfo.auxDataSize,
- streamComp->hardwareBufferSize, streamComp->outputBufferCap ));
- }
- else
- {
- PA_DEBUG(( "hw = %d/%d B, ", streamInfo.dataSize, streamComp->hardwareBufferSize ));
- }
- PA_DEBUG(( "count = %d", streamInfo.frameCounter ));
- if( streamInfo.overflow )
- {
- PA_DEBUG(( " [overflow]" ));
- }
- else if( streamInfo.underflow )
- {
- PA_DEBUG(( " [underflow]" ));
- }
- PA_DEBUG(( "\n" ));
-}
-
-
-/** Display stream information for debugging purposes.
-
- @param stream Pointer to stream to query
- */
-static void PaAsiHpi_StreamDump( PaAsiHpiStream *stream )
-{
- assert( stream );
-
- PA_DEBUG(( "\n------------------------- STREAM INFO FOR %p ---------------------------\n", stream ));
- /* General stream info (input+output) */
- if( stream->baseStreamRep.streamCallback )
- {
- PA_DEBUG(( "[callback] " ));
- }
- else
- {
- PA_DEBUG(( "[blocking] " ));
- }
- PA_DEBUG(( "sr=%d Hz, poll=%d ms, max %d frames/buf ",
- (int)stream->baseStreamRep.streamInfo.sampleRate,
- stream->pollingInterval, stream->maxFramesPerHostBuffer ));
- switch( stream->state )
- {
- case paAsiHpiStoppedState:
- PA_DEBUG(( "[stopped]\n" ));
- break;
- case paAsiHpiActiveState:
- PA_DEBUG(( "[active]\n" ));
- break;
- case paAsiHpiCallbackFinishedState:
- PA_DEBUG(( "[cb fin]\n" ));
- break;
- default:
- PA_DEBUG(( "[unknown state]\n" ));
- break;
- }
- if( stream->callbackMode )
- {
- PA_DEBUG(( "cb info: thread=%p, cbAbort=%d, cbFinished=%d\n",
- stream->thread.thread, stream->callbackAbort, stream->callbackFinished ));
- }
-
- PA_DEBUG(( "----------------------------------- Input ------------------------------------\n" ));
- if( stream->input )
- {
- PaAsiHpi_StreamComponentDump( stream->input, stream );
- }
- else
- {
- PA_DEBUG(( "*none*\n" ));
- }
-
- PA_DEBUG(( "----------------------------------- Output ------------------------------------\n" ));
- if( stream->output )
- {
- PaAsiHpi_StreamComponentDump( stream->output, stream );
- }
- else
- {
- PA_DEBUG(( "*none*\n" ));
- }
- PA_DEBUG(( "-------------------------------------------------------------------------------\n\n" ));
-
-}
-
-
-/** Determine buffer sizes and allocate appropriate stream buffers.
- This attempts to allocate a BBM (host) buffer for the HPI stream component (either input
- or output, as both have similar buffer needs). Not all AudioScience adapters support BBM,
- in which case the hardware buffer has to suffice. The size of the HPI host buffer is chosen
- as a multiple of framesPerPaHostBuffer, and also influenced by the suggested latency and the
- estimated minimum polling interval. The HPI host and hardware buffer sizes are stored, and an
- appropriate cap for the hardware buffer is also calculated. Finally, the temporary stream
- buffer which serves as the PortAudio host buffer for this implementation is allocated.
- This buffer contains an integer number of user buffers, to simplify buffer adaption in the
- buffer processor. The function returns paBufferTooBig if the HPI interface cannot allocate
- an HPI host buffer of the desired size.
-
- @param streamComp Pointer to stream component struct
-
- @param pollingInterval Polling interval for stream, in milliseconds
-
- @param framesPerPaHostBuffer Size of PortAudio host buffer, in frames
-
- @param suggestedLatency Suggested latency for stream component, in seconds
-
- @return PortAudio error code (possibly paBufferTooBig or paInsufficientMemory)
- */
-static PaError PaAsiHpi_SetupBuffers( PaAsiHpiStreamComponent *streamComp, uint32_t pollingInterval,
- unsigned long framesPerPaHostBuffer, PaTime suggestedLatency )
-{
- PaError result = paNoError;
- PaAsiHpiStreamInfo streamInfo;
- unsigned long hpiBufferSize = 0, paHostBufferSize = 0;
-
- assert( streamComp );
- assert( streamComp->hpiDevice );
-
- /* Obtain size of hardware buffer of HPI stream, since we will be activating BBM shortly
- and afterwards the buffer size will refer to the BBM (host-side) buffer.
- This is necessary to enable reliable detection of xruns. */
- PA_ENSURE_( PaAsiHpi_GetStreamInfo( streamComp, &streamInfo ) );
- streamComp->hardwareBufferSize = streamInfo.bufferSize;
- hpiBufferSize = streamInfo.bufferSize;
-
- /* Check if BBM (background bus mastering) is to be enabled */
- if( PA_ASIHPI_USE_BBM_ )
- {
- uint32_t bbmBufferSize = 0, preLatencyBufferSize = 0;
- hpi_err_t hpiError = 0;
- PaTime pollingOverhead;
-
- /* Check overhead of Pa_Sleep() call (minimum sleep duration in ms -> OS dependent) */
- pollingOverhead = PaUtil_GetTime();
- Pa_Sleep( 0 );
- pollingOverhead = 1000*(PaUtil_GetTime() - pollingOverhead);
- PA_DEBUG(( "polling overhead = %f ms (length of 0-second sleep)\n", pollingOverhead ));
- /* Obtain minimum recommended size for host buffer (in bytes) */
- PA_ASIHPI_UNLESS_( HPI_StreamEstimateBufferSize( &streamComp->hpiFormat,
- pollingInterval + (uint32_t)ceil( pollingOverhead ),
- &bbmBufferSize ), paUnanticipatedHostError );
- /* BBM places more stringent requirements on buffer size (see description */
- /* of HPI_StreamEstimateBufferSize in HPI API document) */
- bbmBufferSize *= 3;
- /* Make sure the BBM buffer contains multiple PA host buffers */
- if( bbmBufferSize < 3 * streamComp->bytesPerFrame * framesPerPaHostBuffer )
- bbmBufferSize = 3 * streamComp->bytesPerFrame * framesPerPaHostBuffer;
- /* Try to honor latency suggested by user by growing buffer (no decrease possible) */
- if( suggestedLatency > 0.0 )
- {
- PaTime bufferDuration = ((PaTime)bbmBufferSize) / streamComp->bytesPerFrame
- / streamComp->hpiFormat.dwSampleRate;
- /* Don't decrease buffer */
- if( bufferDuration < suggestedLatency )
- {
- /* Save old buffer size, to be retried if new size proves too big */
- preLatencyBufferSize = bbmBufferSize;
- bbmBufferSize = (uint32_t)ceil( suggestedLatency * streamComp->bytesPerFrame
- * streamComp->hpiFormat.dwSampleRate );
- }
- }
- /* Choose closest memory block boundary (HPI API document states that
- "a buffer size of Nx4096 - 20 makes the best use of memory"
- (under the entry for HPI_StreamEstimateBufferSize)) */
- bbmBufferSize = ((uint32_t)ceil((bbmBufferSize + 20)/4096.0))*4096 - 20;
- streamComp->hostBufferSize = bbmBufferSize;
- /* Allocate BBM host buffer (this enables bus mastering transfers in background) */
- if( streamComp->hpiDevice->streamIsOutput )
- hpiError = HPI_OutStreamHostBufferAllocate( NULL,
- streamComp->hpiStream,
- bbmBufferSize );
- else
- hpiError = HPI_InStreamHostBufferAllocate( NULL,
- streamComp->hpiStream,
- bbmBufferSize );
- if( hpiError )
- {
- /* Indicate that BBM is disabled */
- streamComp->hostBufferSize = 0;
- /* Retry with smaller buffer size (transfers will still work, but not via BBM) */
- if( hpiError == HPI_ERROR_INVALID_DATASIZE )
- {
- /* Retry BBM allocation with smaller size if requested latency proved too big */
- if( preLatencyBufferSize > 0 )
- {
- PA_DEBUG(( "Retrying BBM allocation with smaller size (%d vs. %d bytes)\n",
- preLatencyBufferSize, bbmBufferSize ));
- bbmBufferSize = preLatencyBufferSize;
- if( streamComp->hpiDevice->streamIsOutput )
- hpiError = HPI_OutStreamHostBufferAllocate( NULL,
- streamComp->hpiStream,
- bbmBufferSize );
- else
- hpiError = HPI_InStreamHostBufferAllocate( NULL,
- streamComp->hpiStream,
- bbmBufferSize );
- /* Another round of error checking */
- if( hpiError )
- {
- PA_ASIHPI_REPORT_ERROR_( hpiError );
- /* No escapes this time */
- if( hpiError == HPI_ERROR_INVALID_DATASIZE )
- {
- result = paBufferTooBig;
- goto error;
- }
- else if( hpiError != HPI_ERROR_INVALID_OPERATION )
- {
- result = paUnanticipatedHostError;
- goto error;
- }
- }
- else
- {
- streamComp->hostBufferSize = bbmBufferSize;
- hpiBufferSize = bbmBufferSize;
- }
- }
- else
- {
- result = paBufferTooBig;
- goto error;
- }
- }
- /* If BBM not supported, foreground transfers will be used, but not a show-stopper */
- /* Anything else is an error */
- else if (( hpiError != HPI_ERROR_INVALID_OPERATION ) &&
- ( hpiError != HPI_ERROR_INVALID_FUNC ))
- {
- PA_ASIHPI_REPORT_ERROR_( hpiError );
- result = paUnanticipatedHostError;
- goto error;
- }
- }
- else
- {
- hpiBufferSize = bbmBufferSize;
- }
- }
-
- /* Final check of buffer size */
- paHostBufferSize = streamComp->bytesPerFrame * framesPerPaHostBuffer;
- if( hpiBufferSize < 3*paHostBufferSize )
- {
- result = paBufferTooBig;
- goto error;
- }
- /* Set cap on output buffer size, based on latency suggestions */
- if( streamComp->hpiDevice->streamIsOutput )
- {
- PaTime latency = suggestedLatency > 0.0 ? suggestedLatency :
- streamComp->hpiDevice->baseDeviceInfo.defaultHighOutputLatency;
- streamComp->outputBufferCap =
- (uint32_t)ceil( latency * streamComp->bytesPerFrame * streamComp->hpiFormat.dwSampleRate );
- /* The cap should not be too small, to prevent underflow */
- if( streamComp->outputBufferCap < 4*paHostBufferSize )
- streamComp->outputBufferCap = 4*paHostBufferSize;
- }
- else
- {
- streamComp->outputBufferCap = 0;
- }
- /* Temp buffer size should be multiple of PA host buffer size (or 1x, if using fixed blocks) */
- streamComp->tempBufferSize = paHostBufferSize;
- /* Allocate temp buffer */
- PA_UNLESS_( streamComp->tempBuffer = (uint8_t *)PaUtil_AllocateMemory( streamComp->tempBufferSize ),
- paInsufficientMemory );
-error:
- return result;
-}
-
-
-/** Opens PortAudio stream.
- This determines a suitable value for framesPerBuffer, if the user didn't specify it,
- based on the suggested latency. It then opens each requested stream direction with the
- appropriate stream format, and allocates the required stream buffers. It sets up the
- various PortAudio structures dealing with streams, and estimates the stream latency.
-
- See pa_hostapi.h for a list of validity guarantees made about OpenStream parameters.
-
- @param hostApi Pointer to host API struct
-
- @param s List of open streams, where successfully opened stream will go
-
- @param inputParameters Pointer to stream parameter struct for input side of stream
-
- @param outputParameters Pointer to stream parameter struct for output side of stream
-
- @param sampleRate Desired sample rate
-
- @param framesPerBuffer Desired number of frames per buffer passed to user callback
- (or chunk size for blocking stream)
-
- @param streamFlags Stream flags
-
- @param streamCallback Pointer to user callback function (zero for blocking interface)
-
- @param userData Pointer to user data that will be passed to callback function along with data
-
- @return PortAudio error code
-*/
-static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
- PaStream **s,
- const PaStreamParameters *inputParameters,
- const PaStreamParameters *outputParameters,
- double sampleRate,
- unsigned long framesPerBuffer,
- PaStreamFlags streamFlags,
- PaStreamCallback *streamCallback,
- void *userData )
-{
- PaError result = paNoError;
- PaAsiHpiHostApiRepresentation *hpiHostApi = (PaAsiHpiHostApiRepresentation*)hostApi;
- PaAsiHpiStream *stream = NULL;
- unsigned long framesPerHostBuffer = framesPerBuffer;
- int inputChannelCount = 0, outputChannelCount = 0;
- PaSampleFormat inputSampleFormat = 0, outputSampleFormat = 0;
- PaSampleFormat hostInputSampleFormat = 0, hostOutputSampleFormat = 0;
- PaTime maxSuggestedLatency = 0.0;
-
- /* Validate platform-specific flags -> none expected for HPI */
- if( (streamFlags & paPlatformSpecificFlags) != 0 )
- return paInvalidFlag; /* unexpected platform-specific flag */
-
- /* Create blank stream structure */
- PA_UNLESS_( stream = (PaAsiHpiStream *)PaUtil_AllocateMemory( sizeof(PaAsiHpiStream) ),
- paInsufficientMemory );
- memset( stream, 0, sizeof(PaAsiHpiStream) );
-
- /* If the number of frames per buffer is unspecified, we have to come up with one. */
- if( framesPerHostBuffer == paFramesPerBufferUnspecified )
- {
- if( inputParameters )
- maxSuggestedLatency = inputParameters->suggestedLatency;
- if( outputParameters && (outputParameters->suggestedLatency > maxSuggestedLatency) )
- maxSuggestedLatency = outputParameters->suggestedLatency;
- /* Use suggested latency if available */
- if( maxSuggestedLatency > 0.0 )
- framesPerHostBuffer = (unsigned long)ceil( maxSuggestedLatency * sampleRate );
- else
- /* AudioScience cards like BIG buffers by default */
- framesPerHostBuffer = 4096;
- }
- /* Lower bounds on host buffer size, due to polling and HPI constraints */
- if( 1000.0*framesPerHostBuffer/sampleRate < PA_ASIHPI_MIN_POLLING_INTERVAL_ )
- framesPerHostBuffer = (unsigned long)ceil( sampleRate * PA_ASIHPI_MIN_POLLING_INTERVAL_ / 1000.0 );
- /* if( framesPerHostBuffer < PA_ASIHPI_MIN_FRAMES_ )
- framesPerHostBuffer = PA_ASIHPI_MIN_FRAMES_; */
- /* Efficient if host buffer size is integer multiple of user buffer size */
- if( framesPerBuffer > 0 )
- framesPerHostBuffer = (unsigned long)ceil( (double)framesPerHostBuffer / framesPerBuffer ) * framesPerBuffer;
- /* Buffer should always be a multiple of 4 bytes to facilitate 32-bit PCI transfers.
- By keeping the frames a multiple of 4, this is ensured even for 8-bit mono sound. */
- framesPerHostBuffer = (framesPerHostBuffer / 4) * 4;
- /* Polling is based on time length (in milliseconds) of user-requested block size */
- stream->pollingInterval = (uint32_t)ceil( 1000.0*framesPerHostBuffer/sampleRate );
- assert( framesPerHostBuffer > 0 );
-
- /* Open underlying streams, check formats and allocate buffers */
- if( inputParameters )
- {
- /* Create blank stream component structure */
- PA_UNLESS_( stream->input = (PaAsiHpiStreamComponent *)PaUtil_AllocateMemory( sizeof(PaAsiHpiStreamComponent) ),
- paInsufficientMemory );
- memset( stream->input, 0, sizeof(PaAsiHpiStreamComponent) );
- /* Create/validate format */
- PA_ENSURE_( PaAsiHpi_CreateFormat( hostApi, inputParameters, sampleRate,
- &stream->input->hpiDevice, &stream->input->hpiFormat ) );
- /* Open stream and set format */
- PA_ENSURE_( PaAsiHpi_OpenInput( hostApi, stream->input->hpiDevice, &stream->input->hpiFormat,
- &stream->input->hpiStream ) );
- inputChannelCount = inputParameters->channelCount;
- inputSampleFormat = inputParameters->sampleFormat;
- hostInputSampleFormat = PaAsiHpi_HpiToPaFormat( stream->input->hpiFormat.wFormat );
- stream->input->bytesPerFrame = inputChannelCount * Pa_GetSampleSize( hostInputSampleFormat );
- assert( stream->input->bytesPerFrame > 0 );
- /* Allocate host and temp buffers of appropriate size */
- PA_ENSURE_( PaAsiHpi_SetupBuffers( stream->input, stream->pollingInterval,
- framesPerHostBuffer, inputParameters->suggestedLatency ) );
- }
- if( outputParameters )
- {
- /* Create blank stream component structure */
- PA_UNLESS_( stream->output = (PaAsiHpiStreamComponent *)PaUtil_AllocateMemory( sizeof(PaAsiHpiStreamComponent) ),
- paInsufficientMemory );
- memset( stream->output, 0, sizeof(PaAsiHpiStreamComponent) );
- /* Create/validate format */
- PA_ENSURE_( PaAsiHpi_CreateFormat( hostApi, outputParameters, sampleRate,
- &stream->output->hpiDevice, &stream->output->hpiFormat ) );
- /* Open stream and check format */
- PA_ENSURE_( PaAsiHpi_OpenOutput( hostApi, stream->output->hpiDevice,
- &stream->output->hpiFormat,
- &stream->output->hpiStream ) );
- outputChannelCount = outputParameters->channelCount;
- outputSampleFormat = outputParameters->sampleFormat;
- hostOutputSampleFormat = PaAsiHpi_HpiToPaFormat( stream->output->hpiFormat.wFormat );
- stream->output->bytesPerFrame = outputChannelCount * Pa_GetSampleSize( hostOutputSampleFormat );
- /* Allocate host and temp buffers of appropriate size */
- PA_ENSURE_( PaAsiHpi_SetupBuffers( stream->output, stream->pollingInterval,
- framesPerHostBuffer, outputParameters->suggestedLatency ) );
- }
-
- /* Determine maximum frames per host buffer (least common denominator of input/output) */
- if( inputParameters && outputParameters )
- {
- stream->maxFramesPerHostBuffer = PA_MIN( stream->input->tempBufferSize / stream->input->bytesPerFrame,
- stream->output->tempBufferSize / stream->output->bytesPerFrame );
- }
- else
- {
- stream->maxFramesPerHostBuffer = inputParameters ? stream->input->tempBufferSize / stream->input->bytesPerFrame
- : stream->output->tempBufferSize / stream->output->bytesPerFrame;
- }
- assert( stream->maxFramesPerHostBuffer > 0 );
- /* Initialize various other stream parameters */
- stream->neverDropInput = streamFlags & paNeverDropInput;
- stream->state = paAsiHpiStoppedState;
-
- /* Initialize either callback or blocking interface */
- if( streamCallback )
- {
- PaUtil_InitializeStreamRepresentation( &stream->baseStreamRep,
- &hpiHostApi->callbackStreamInterface,
- streamCallback, userData );
- stream->callbackMode = 1;
- }
- else
- {
- PaUtil_InitializeStreamRepresentation( &stream->baseStreamRep,
- &hpiHostApi->blockingStreamInterface,
- streamCallback, userData );
- /* Pre-allocate non-interleaved user buffer pointers for blocking interface */
- PA_UNLESS_( stream->blockingUserBufferCopy =
- PaUtil_AllocateMemory( sizeof(void *) * PA_MAX( inputChannelCount, outputChannelCount ) ),
- paInsufficientMemory );
- stream->callbackMode = 0;
- }
- PaUtil_InitializeCpuLoadMeasurer( &stream->cpuLoadMeasurer, sampleRate );
-
- /* Following pa_linux_alsa's lead, we operate with fixed host buffer size by default, */
- /* since other modes will invariably lead to block adaption (maybe Bounded better?) */
- PA_ENSURE_( PaUtil_InitializeBufferProcessor( &stream->bufferProcessor,
- inputChannelCount, inputSampleFormat, hostInputSampleFormat,
- outputChannelCount, outputSampleFormat, hostOutputSampleFormat,
- sampleRate, streamFlags,
- framesPerBuffer, framesPerHostBuffer, paUtilFixedHostBufferSize,
- streamCallback, userData ) );
-
- stream->baseStreamRep.streamInfo.structVersion = 1;
- stream->baseStreamRep.streamInfo.sampleRate = sampleRate;
- /* Determine input latency from buffer processor and buffer sizes */
- if( stream->input )
- {
- PaTime bufferDuration = ( stream->input->hostBufferSize + stream->input->hardwareBufferSize )
- / sampleRate / stream->input->bytesPerFrame;
- stream->baseStreamRep.streamInfo.inputLatency =
- bufferDuration +
- ((PaTime)PaUtil_GetBufferProcessorInputLatencyFrames( &stream->bufferProcessor ) -
- stream->maxFramesPerHostBuffer) / sampleRate;
- assert( stream->baseStreamRep.streamInfo.inputLatency > 0.0 );
- }
- /* Determine output latency from buffer processor and buffer sizes */
- if( stream->output )
- {
- PaTime bufferDuration = ( stream->output->hostBufferSize + stream->output->hardwareBufferSize )
- / sampleRate / stream->output->bytesPerFrame;
- /* Take buffer size cap into account (see PaAsiHpi_WaitForFrames) */
- if( !stream->input && (stream->output->outputBufferCap > 0) )
- {
- bufferDuration = PA_MIN( bufferDuration,
- stream->output->outputBufferCap / sampleRate / stream->output->bytesPerFrame );
- }
- stream->baseStreamRep.streamInfo.outputLatency =
- bufferDuration +
- ((PaTime)PaUtil_GetBufferProcessorOutputLatencyFrames( &stream->bufferProcessor ) -
- stream->maxFramesPerHostBuffer) / sampleRate;
- assert( stream->baseStreamRep.streamInfo.outputLatency > 0.0 );
- }
-
- /* Report stream info, for debugging purposes */
- PaAsiHpi_StreamDump( stream );
-
- /* Save initialized stream to PA stream list */
- *s = (PaStream*)stream;
- return result;
-
-error:
- CloseStream( (PaStream*)stream );
- return result;
-}
-
-
-/** Close PortAudio stream.
- When CloseStream() is called, the multi-api layer ensures that the stream has already
- been stopped or aborted. This closes the underlying HPI streams and deallocates stream
- buffers and structs.
-
- @param s Pointer to PortAudio stream
-
- @return PortAudio error code
-*/
-static PaError CloseStream( PaStream *s )
-{
- PaError result = paNoError;
- PaAsiHpiStream *stream = (PaAsiHpiStream*)s;
-
- /* If stream is already gone, all is well */
- if( stream == NULL )
- return paNoError;
-
- /* Generic stream cleanup */
- PaUtil_TerminateBufferProcessor( &stream->bufferProcessor );
- PaUtil_TerminateStreamRepresentation( &stream->baseStreamRep );
-
- /* Implementation-specific details - close internal streams */
- if( stream->input )
- {
- /* Close HPI stream (freeing BBM host buffer in the process, if used) */
- if( stream->input->hpiStream )
- {
- PA_ASIHPI_UNLESS_( HPI_InStreamClose( NULL,
- stream->input->hpiStream ), paUnanticipatedHostError );
- }
- /* Free temp buffer and stream component */
- PaUtil_FreeMemory( stream->input->tempBuffer );
- PaUtil_FreeMemory( stream->input );
- }
- if( stream->output )
- {
- /* Close HPI stream (freeing BBM host buffer in the process, if used) */
- if( stream->output->hpiStream )
- {
- PA_ASIHPI_UNLESS_( HPI_OutStreamClose( NULL,
- stream->output->hpiStream ), paUnanticipatedHostError );
- }
- /* Free temp buffer and stream component */
- PaUtil_FreeMemory( stream->output->tempBuffer );
- PaUtil_FreeMemory( stream->output );
- }
-
- PaUtil_FreeMemory( stream->blockingUserBufferCopy );
- PaUtil_FreeMemory( stream );
-
-error:
- return result;
-}
-
-
-/** Prime HPI output stream with silence.
- This resets the output stream and uses PortAudio helper routines to fill the
- temp buffer with silence. It then writes two host buffers to the stream. This is supposed
- to be called before the stream is started. It has no effect on input-only streams.
-
- @param stream Pointer to stream struct
-
- @return PortAudio error code
- */
-static PaError PaAsiHpi_PrimeOutputWithSilence( PaAsiHpiStream *stream )
-{
- PaError result = paNoError;
- PaAsiHpiStreamComponent *out;
- PaUtilZeroer *zeroer;
- PaSampleFormat outputFormat;
- assert( stream );
- out = stream->output;
- /* Only continue if stream has output channels */
- if( !out )
- return result;
- assert( out->tempBuffer );
-
- /* Clear all existing data in hardware playback buffer */
- PA_ASIHPI_UNLESS_( HPI_OutStreamReset( NULL,
- out->hpiStream ), paUnanticipatedHostError );
- /* Fill temp buffer with silence */
- outputFormat = PaAsiHpi_HpiToPaFormat( out->hpiFormat.wFormat );
- zeroer = PaUtil_SelectZeroer( outputFormat );
- zeroer(out->tempBuffer, 1, out->tempBufferSize / Pa_GetSampleSize(outputFormat) );
- /* Write temp buffer to hardware fifo twice, to get started */
- PA_ASIHPI_UNLESS_( HPI_OutStreamWriteBuf( NULL, out->hpiStream,
- out->tempBuffer, out->tempBufferSize, &out->hpiFormat),
- paUnanticipatedHostError );
- PA_ASIHPI_UNLESS_( HPI_OutStreamWriteBuf( NULL, out->hpiStream,
- out->tempBuffer, out->tempBufferSize, &out->hpiFormat),
- paUnanticipatedHostError );
-error:
- return result;
-}
-
-
-/** Start HPI streams (both input + output).
- This starts all HPI streams in the PortAudio stream. Output streams are first primed with
- silence, if required. After this call the PA stream is in the Active state.
-
- @todo Implement priming via the user callback
-
- @param stream Pointer to stream struct
-
- @param outputPrimed True if output is already primed (if false, silence will be loaded before starting)
-
- @return PortAudio error code
- */
-static PaError PaAsiHpi_StartStream( PaAsiHpiStream *stream, int outputPrimed )
-{
- PaError result = paNoError;
-
- if( stream->input )
- {
- PA_ASIHPI_UNLESS_( HPI_InStreamStart( NULL,
- stream->input->hpiStream ), paUnanticipatedHostError );
- }
- if( stream->output )
- {
- if( !outputPrimed )
- {
- /* Buffer isn't primed, so load stream with silence */
- PA_ENSURE_( PaAsiHpi_PrimeOutputWithSilence( stream ) );
- }
- PA_ASIHPI_UNLESS_( HPI_OutStreamStart( NULL,
- stream->output->hpiStream ), paUnanticipatedHostError );
- }
- stream->state = paAsiHpiActiveState;
- stream->callbackFinished = 0;
-
- /* Report stream info for debugging purposes */
- /* PaAsiHpi_StreamDump( stream ); */
-
-error:
- return result;
-}
-
-
-/** Start PortAudio stream.
- If the stream has a callback interface, this starts a helper thread to feed the user callback.
- The thread will then take care of starting the HPI streams, and this function will block
- until the streams actually start. In the case of a blocking interface, the HPI streams
- are simply started.
-
- @param s Pointer to PortAudio stream
-
- @return PortAudio error code
-*/
-static PaError StartStream( PaStream *s )
-{
- PaError result = paNoError;
- PaAsiHpiStream *stream = (PaAsiHpiStream*)s;
-
- assert( stream );
-
- /* Ready the processor */
- PaUtil_ResetBufferProcessor( &stream->bufferProcessor );
-
- if( stream->callbackMode )
- {
- /* Create and start callback engine thread */
- /* Also waits 1 second for stream to be started by engine thread (otherwise aborts) */
- PA_ENSURE_( PaUnixThread_New( &stream->thread, &CallbackThreadFunc, stream, 1., 0 /*rtSched*/ ) );
- }
- else
- {
- PA_ENSURE_( PaAsiHpi_StartStream( stream, 0 ) );
- }
-
-error:
- return result;
-}
-
-
-/** Stop HPI streams (input + output), either softly or abruptly.
- If abort is false, the function blocks until the output stream is drained, otherwise it
- stops immediately and discards data in the stream hardware buffers.
-
- This function is safe to call from the callback engine thread as well as the main thread.
-
- @param stream Pointer to stream struct
-
- @param abort True if samples in output buffer should be discarded (otherwise blocks until stream is done)
-
- @return PortAudio error code
-
- */
-static PaError PaAsiHpi_StopStream( PaAsiHpiStream *stream, int abort )
-{
- PaError result = paNoError;
-
- assert( stream );
-
- /* Input channels */
- if( stream->input )
- {
- PA_ASIHPI_UNLESS_( HPI_InStreamReset( NULL,
- stream->input->hpiStream ), paUnanticipatedHostError );
- }
- /* Output channels */
- if( stream->output )
- {
- if( !abort )
- {
- /* Wait until HPI output stream is drained */
- while( 1 )
- {
- PaAsiHpiStreamInfo streamInfo;
- PaTime timeLeft;
-
- /* Obtain number of samples waiting to be played */
- PA_ENSURE_( PaAsiHpi_GetStreamInfo( stream->output, &streamInfo ) );
- /* Check if stream is drained */
- if( (streamInfo.state != HPI_STATE_PLAYING) &&
- (streamInfo.dataSize < stream->output->bytesPerFrame * PA_ASIHPI_MIN_FRAMES_) )
- break;
- /* Sleep amount of time represented by remaining samples */
- timeLeft = 1000.0 * streamInfo.dataSize / stream->output->bytesPerFrame
- / stream->baseStreamRep.streamInfo.sampleRate;
- Pa_Sleep( (long)ceil( timeLeft ) );
- }
- }
- PA_ASIHPI_UNLESS_( HPI_OutStreamReset( NULL,
- stream->output->hpiStream ), paUnanticipatedHostError );
- }
-
- /* Report stream info for debugging purposes */
- /* PaAsiHpi_StreamDump( stream ); */
-
-error:
- return result;
-}
-
-
-/** Stop or abort PortAudio stream.
-
- This function is used to explicitly stop the PortAudio stream (via StopStream/AbortStream),
- as opposed to the situation when the callback finishes with a result other than paContinue.
- If a stream is in callback mode we will have to inspect whether the background thread has
- finished, or we will have to take it out. In either case we join the thread before returning.
- In blocking mode, we simply tell HPI to stop abruptly (abort) or finish buffers (drain).
- The PortAudio stream will be in the Stopped state after a call to this function.
-
- Don't call this from the callback engine thread!
-
- @param stream Pointer to stream struct
-
- @param abort True if samples in output buffer should be discarded (otherwise blocks until stream is done)
-
- @return PortAudio error code
-*/
-static PaError PaAsiHpi_ExplicitStop( PaAsiHpiStream *stream, int abort )
-{
- PaError result = paNoError;
-
- /* First deal with the callback thread, cancelling and/or joining it if necessary */
- if( stream->callbackMode )
- {
- PaError threadRes;
- stream->callbackAbort = abort;
- if( abort )
- {
- PA_DEBUG(( "Aborting callback\n" ));
- }
- else
- {
- PA_DEBUG(( "Stopping callback\n" ));
- }
- PA_ENSURE_( PaUnixThread_Terminate( &stream->thread, !abort, &threadRes ) );
- if( threadRes != paNoError )
- {
- PA_DEBUG(( "Callback thread returned: %d\n", threadRes ));
- }
- }
- else
- {
- PA_ENSURE_( PaAsiHpi_StopStream( stream, abort ) );
- }
-
- stream->state = paAsiHpiStoppedState;
-
-error:
- return result;
-}
-
-
-/** Stop PortAudio stream.
- This blocks until the output buffers are drained.
-
- @param s Pointer to PortAudio stream
-
- @return PortAudio error code
-*/
-static PaError StopStream( PaStream *s )
-{
- return PaAsiHpi_ExplicitStop( (PaAsiHpiStream *) s, 0 );
-}
-
-
-/** Abort PortAudio stream.
- This discards any existing data in output buffers and stops the stream immediately.
-
- @param s Pointer to PortAudio stream
-
- @return PortAudio error code
-*/
-static PaError AbortStream( PaStream *s )
-{
- return PaAsiHpi_ExplicitStop( (PaAsiHpiStream * ) s, 1 );
-}
-
-
-/** Determine whether the stream is stopped.
- A stream is considered to be stopped prior to a successful call to StartStream and after
- a successful call to StopStream or AbortStream. If a stream callback returns a value other
- than paContinue the stream is NOT considered to be stopped (it is in CallbackFinished state).
-
- @param s Pointer to PortAudio stream
-
- @return Returns one (1) when the stream is stopped, zero (0) when the stream is running, or
- a PaErrorCode (which are always negative) if PortAudio is not initialized or an
- error is encountered.
-*/
-static PaError IsStreamStopped( PaStream *s )
-{
- PaAsiHpiStream *stream = (PaAsiHpiStream*)s;
-
- assert( stream );
- return stream->state == paAsiHpiStoppedState ? 1 : 0;
-}
-
-
-/** Determine whether the stream is active.
- A stream is active after a successful call to StartStream(), until it becomes inactive either
- as a result of a call to StopStream() or AbortStream(), or as a result of a return value
- other than paContinue from the stream callback. In the latter case, the stream is considered
- inactive after the last buffer has finished playing.
-
- @param s Pointer to PortAudio stream
-
- @return Returns one (1) when the stream is active (i.e. playing or recording audio),
- zero (0) when not playing, or a PaErrorCode (which are always negative)
- if PortAudio is not initialized or an error is encountered.
-*/
-static PaError IsStreamActive( PaStream *s )
-{
- PaAsiHpiStream *stream = (PaAsiHpiStream*)s;
-
- assert( stream );
- return stream->state == paAsiHpiActiveState ? 1 : 0;
-}
-
-
-/** Returns current stream time.
- This corresponds to the system clock. The clock should run continuously while the stream
- is open, i.e. between calls to OpenStream() and CloseStream(), therefore a frame counter
- is not good enough.
-
- @param s Pointer to PortAudio stream
-
- @return Stream time, in seconds
- */
-static PaTime GetStreamTime( PaStream *s )
-{
- return PaUtil_GetTime();
-}
-
-
-/** Returns CPU load.
-
- @param s Pointer to PortAudio stream
-
- @return CPU load (0.0 if blocking interface is used)
- */
-static double GetStreamCpuLoad( PaStream *s )
-{
- PaAsiHpiStream *stream = (PaAsiHpiStream*)s;
-
- return stream->callbackMode ? PaUtil_GetCpuLoad( &stream->cpuLoadMeasurer ) : 0.0;
-}
-
-/* --------------------------- Callback Interface --------------------------- */
-
-/** Exit routine which is called when callback thread quits.
- This takes care of stopping the HPI streams (either waiting for output to finish, or
- abruptly). It also calls the user-supplied StreamFinished callback, and sets the
- stream state to CallbackFinished if it was reached via a non-paContinue return from
- the user callback function.
-
- @param userData A pointer to an open stream previously created with Pa_OpenStream
- */
-static void PaAsiHpi_OnThreadExit( void *userData )
-{
- PaAsiHpiStream *stream = (PaAsiHpiStream *) userData;
-
- assert( stream );
-
- PaUtil_ResetCpuLoadMeasurer( &stream->cpuLoadMeasurer );
-
- PA_DEBUG(( "%s: Stopping HPI streams\n", __FUNCTION__ ));
- PaAsiHpi_StopStream( stream, stream->callbackAbort );
- PA_DEBUG(( "%s: Stoppage\n", __FUNCTION__ ));
-
- /* Eventually notify user all buffers have played */
- if( stream->baseStreamRep.streamFinishedCallback )
- {
- stream->baseStreamRep.streamFinishedCallback( stream->baseStreamRep.userData );
- }
-
- /* Unfortunately both explicit calls to Stop/AbortStream (leading to Stopped state)
- and implicit stops via paComplete/paAbort (leading to CallbackFinished state)
- end up here - need another flag to remind us which is the case */
- if( stream->callbackFinished )
- stream->state = paAsiHpiCallbackFinishedState;
-}
-
-
-/** Wait until there is enough frames to fill a host buffer.
- The routine attempts to sleep until at least a full host buffer can be retrieved from the
- input HPI stream and passed to the output HPI stream. It will first sleep until enough
- output space is available, as this is usually easily achievable. If it is an output-only
- stream, it will also sleep if the hardware buffer is too full, thereby throttling the
- filling of the output buffer and reducing output latency. The routine then blocks until
- enough input samples are available, unless this will cause an output underflow. In the
- process, input overflows and output underflows are indicated.
-
- @param stream Pointer to stream struct
-
- @param framesAvail Returns the number of available frames
-
- @param cbFlags Overflows and underflows indicated in here
-
- @return PortAudio error code (only paUnanticipatedHostError expected)
- */
-static PaError PaAsiHpi_WaitForFrames( PaAsiHpiStream *stream, unsigned long *framesAvail,
- PaStreamCallbackFlags *cbFlags )
-{
- PaError result = paNoError;
- double sampleRate;
- unsigned long framesTarget;
- uint32_t outputData = 0, outputSpace = 0, inputData = 0, framesLeft = 0;
-
- assert( stream );
- assert( stream->input || stream->output );
-
- sampleRate = stream->baseStreamRep.streamInfo.sampleRate;
- /* We have to come up with this much frames on both input and output */
- framesTarget = stream->bufferProcessor.framesPerHostBuffer;
- assert( framesTarget > 0 );
-
- while( 1 )
- {
- PaAsiHpiStreamInfo info;
- /* Check output first, as this takes priority in the default full-duplex mode */
- if( stream->output )
- {
- PA_ENSURE_( PaAsiHpi_GetStreamInfo( stream->output, &info ) );
- /* Wait until enough space is available in output buffer to receive a full block */
- if( info.availableFrames < framesTarget )
- {
- framesLeft = framesTarget - info.availableFrames;
- Pa_Sleep( (long)ceil( 1000 * framesLeft / sampleRate ) );
- continue;
- }
- /* Wait until the data in hardware buffer has dropped to a sensible level.
- Without this, the hardware buffer quickly fills up in the absence of an input
- stream to regulate its data rate (if data generation is fast). This leads to
- large latencies, as the AudioScience hardware buffers are humongous.
- This is similar to the default "Hardware Buffering=off" option in the
- AudioScience WAV driver. */
- if( !stream->input && (stream->output->outputBufferCap > 0) &&
- ( info.totalBufferedData > stream->output->outputBufferCap / stream->output->bytesPerFrame ) )
- {
- framesLeft = info.totalBufferedData - stream->output->outputBufferCap / stream->output->bytesPerFrame;
- Pa_Sleep( (long)ceil( 1000 * framesLeft / sampleRate ) );
- continue;
- }
- outputData = info.totalBufferedData;
- outputSpace = info.availableFrames;
- /* Report output underflow to callback */
- if( info.underflow )
- {
- *cbFlags |= paOutputUnderflow;
- }
- }
-
- /* Now check input side */
- if( stream->input )
- {
- PA_ENSURE_( PaAsiHpi_GetStreamInfo( stream->input, &info ) );
- /* If a full block of samples hasn't been recorded yet, wait for it if possible */
- if( info.availableFrames < framesTarget )
- {
- framesLeft = framesTarget - info.availableFrames;
- /* As long as output is not disrupted in the process, wait for a full
- block of input samples */
- if( !stream->output || (outputData > framesLeft) )
- {
- Pa_Sleep( (long)ceil( 1000 * framesLeft / sampleRate ) );
- continue;
- }
- }
- inputData = info.availableFrames;
- /** @todo The paInputOverflow flag should be set in the callback containing the
- first input sample following the overflow. That means the block currently sitting
- at the fore-front of recording, i.e. typically the one containing the newest (last)
- sample in the HPI buffer system. This is most likely not the same as the current
- block of data being passed to the callback. The current overflow should ideally
- be noted in an overflow list of sorts, with an indication of when it should be
- reported. The trouble starts if there are several separate overflow incidents,
- given a big input buffer. Oh well, something to try out later... */
- if( info.overflow )
- {
- *cbFlags |= paInputOverflow;
- }
- }
- break;
- }
- /* Full-duplex stream */
- if( stream->input && stream->output )
- {
- if( outputSpace >= framesTarget )
- *framesAvail = outputSpace;
- /* If input didn't make the target, keep the output count instead (input underflow) */
- if( (inputData >= framesTarget) && (inputData < outputSpace) )
- *framesAvail = inputData;
- }
- else
- {
- *framesAvail = stream->input ? inputData : outputSpace;
- }
-
-error:
- return result;
-}
-
-
-/** Obtain recording, current and playback timestamps of stream.
- The current time is determined by the system clock. This "now" timestamp occurs at the
- forefront of recording (and playback in the full-duplex case), which happens later than the
- input timestamp by an amount equal to the total number of recorded frames in the input buffer.
- The output timestamp indicates when the next generated sample will actually be played. This
- happens after all the samples currently in the output buffer are played. The output timestamp
- therefore follows the current timestamp by an amount equal to the number of frames yet to be
- played back in the output buffer.
-
- If the current timestamp is the present, the input timestamp is in the past and the output
- timestamp is in the future.
-
- @param stream Pointer to stream struct
-
- @param timeInfo Pointer to timeInfo struct that will contain timestamps
- */
-static void PaAsiHpi_CalculateTimeInfo( PaAsiHpiStream *stream, PaStreamCallbackTimeInfo *timeInfo )
-{
- PaAsiHpiStreamInfo streamInfo;
- double sampleRate;
-
- assert( stream );
- assert( timeInfo );
- sampleRate = stream->baseStreamRep.streamInfo.sampleRate;
-
- /* The current time ("now") is at the forefront of both recording and playback */
- timeInfo->currentTime = GetStreamTime( (PaStream *)stream );
- /* The last sample in the input buffer was recorded just now, so the first sample
- happened (number of recorded samples)/sampleRate ago */
- timeInfo->inputBufferAdcTime = timeInfo->currentTime;
- if( stream->input )
- {
- PaAsiHpi_GetStreamInfo( stream->input, &streamInfo );
- timeInfo->inputBufferAdcTime -= streamInfo.totalBufferedData / sampleRate;
- }
- /* The first of the outgoing samples will be played after all the samples in the output
- buffer is done */
- timeInfo->outputBufferDacTime = timeInfo->currentTime;
- if( stream->output )
- {
- PaAsiHpi_GetStreamInfo( stream->output, &streamInfo );
- timeInfo->outputBufferDacTime += streamInfo.totalBufferedData / sampleRate;
- }
-}
-
-
-/** Read from HPI input stream and register buffers.
- This reads data from the HPI input stream (if it exists) and registers the temp stream
- buffers of both input and output streams with the buffer processor. In the process it also
- handles input underflows in the full-duplex case.
-
- @param stream Pointer to stream struct
-
- @param numFrames On entrance the number of available frames, on exit the number of
- received frames
-
- @param cbFlags Indicates overflows and underflows
-
- @return PortAudio error code
- */
-static PaError PaAsiHpi_BeginProcessing( PaAsiHpiStream *stream, unsigned long *numFrames,
- PaStreamCallbackFlags *cbFlags )
-{
- PaError result = paNoError;
-
- assert( stream );
- if( *numFrames > stream->maxFramesPerHostBuffer )
- *numFrames = stream->maxFramesPerHostBuffer;
-
- if( stream->input )
- {
- PaAsiHpiStreamInfo info;
-
- uint32_t framesToGet = *numFrames;
-
- /* Check for overflows and underflows yet again */
- PA_ENSURE_( PaAsiHpi_GetStreamInfo( stream->input, &info ) );
- if( info.overflow )
- {
- *cbFlags |= paInputOverflow;
- }
- /* Input underflow if less than expected number of samples pitch up */
- if( framesToGet > info.availableFrames )
- {
- PaUtilZeroer *zeroer;
- PaSampleFormat inputFormat;
-
- /* Never call an input-only stream with InputUnderflow set */
- if( stream->output )
- *cbFlags |= paInputUnderflow;
- framesToGet = info.availableFrames;
- /* Fill temp buffer with silence (to make up for missing input samples) */
- inputFormat = PaAsiHpi_HpiToPaFormat( stream->input->hpiFormat.wFormat );
- zeroer = PaUtil_SelectZeroer( inputFormat );
- zeroer(stream->input->tempBuffer, 1,
- stream->input->tempBufferSize / Pa_GetSampleSize(inputFormat) );
- }
-
- /* Read block of data into temp buffer */
- PA_ASIHPI_UNLESS_( HPI_InStreamReadBuf( NULL,
- stream->input->hpiStream,
- stream->input->tempBuffer,
- framesToGet * stream->input->bytesPerFrame),
- paUnanticipatedHostError );
- /* Register temp buffer with buffer processor (always FULL buffer) */
- PaUtil_SetInputFrameCount( &stream->bufferProcessor, *numFrames );
- /* HPI interface only allows interleaved channels */
- PaUtil_SetInterleavedInputChannels( &stream->bufferProcessor,
- 0, stream->input->tempBuffer,
- stream->input->hpiFormat.wChannels );
- }
- if( stream->output )
- {
- /* Register temp buffer with buffer processor */
- PaUtil_SetOutputFrameCount( &stream->bufferProcessor, *numFrames );
- /* HPI interface only allows interleaved channels */
- PaUtil_SetInterleavedOutputChannels( &stream->bufferProcessor,
- 0, stream->output->tempBuffer,
- stream->output->hpiFormat.wChannels );
- }
-
-error:
- return result;
-}
-
-
-/** Flush output buffers to HPI output stream.
- This completes the processing cycle by writing the temp buffer to the HPI interface.
- Additional output underflows are caught before data is written to the stream, as this
- action typically remedies the underflow and hides it in the process.
-
- @param stream Pointer to stream struct
-
- @param numFrames The number of frames to write to the output stream
-
- @param cbFlags Indicates overflows and underflows
- */
-static PaError PaAsiHpi_EndProcessing( PaAsiHpiStream *stream, unsigned long numFrames,
- PaStreamCallbackFlags *cbFlags )
-{
- PaError result = paNoError;
-
- assert( stream );
-
- if( stream->output )
- {
- PaAsiHpiStreamInfo info;
- /* Check for underflows after the (potentially time-consuming) callback */
- PA_ENSURE_( PaAsiHpi_GetStreamInfo( stream->output, &info ) );
- if( info.underflow )
- {
- *cbFlags |= paOutputUnderflow;
- }
-
- /* Write temp buffer to HPI stream */
- PA_ASIHPI_UNLESS_( HPI_OutStreamWriteBuf( NULL,
- stream->output->hpiStream,
- stream->output->tempBuffer,
- numFrames * stream->output->bytesPerFrame,
- &stream->output->hpiFormat),
- paUnanticipatedHostError );
- }
-
-error:
- return result;
-}
-
-
-/** Main callback engine.
- This function runs in a separate thread and does all the work of fetching audio data from
- the AudioScience card via the HPI interface, feeding it to the user callback via the buffer
- processor, and delivering the resulting output data back to the card via HPI calls.
- It is started and terminated when the PortAudio stream is started and stopped, and starts
- the HPI streams on startup.
-
- @param userData A pointer to an open stream previously created with Pa_OpenStream.
-*/
-static void *CallbackThreadFunc( void *userData )
-{
- PaError result = paNoError;
- PaAsiHpiStream *stream = (PaAsiHpiStream *) userData;
- int callbackResult = paContinue;
-
- assert( stream );
-
- /* Cleanup routine stops streams on thread exit */
- pthread_cleanup_push( &PaAsiHpi_OnThreadExit, stream );
-
- /* Start HPI streams and notify parent when we're done */
- PA_ENSURE_( PaUnixThread_PrepareNotify( &stream->thread ) );
- /* Buffer will be primed with silence */
- PA_ENSURE_( PaAsiHpi_StartStream( stream, 0 ) );
- PA_ENSURE_( PaUnixThread_NotifyParent( &stream->thread ) );
-
- /* MAIN LOOP */
- while( 1 )
- {
- PaStreamCallbackFlags cbFlags = 0;
- unsigned long framesAvail, framesGot;
-
- pthread_testcancel();
-
- /** @concern StreamStop if the main thread has requested a stop and the stream has not
- * been effectively stopped we signal this condition by modifying callbackResult
- * (we'll want to flush buffered output). */
- if( PaUnixThread_StopRequested( &stream->thread ) && (callbackResult == paContinue) )
- {
- PA_DEBUG(( "Setting callbackResult to paComplete\n" ));
- callbackResult = paComplete;
- }
-
- /* Start winding down thread if requested */
- if( callbackResult != paContinue )
- {
- stream->callbackAbort = (callbackResult == paAbort);
- if( stream->callbackAbort ||
- /** @concern BlockAdaption: Go on if adaption buffers are empty */
- PaUtil_IsBufferProcessorOutputEmpty( &stream->bufferProcessor ) )
- {
- goto end;
- }
- PA_DEBUG(( "%s: Flushing buffer processor\n", __FUNCTION__ ));
- /* There is still buffered output that needs to be processed */
- }
-
- /* SLEEP */
- /* Wait for data (or buffer space) to become available. This basically sleeps and
- polls the HPI interface until a full block of frames can be moved. */
- PA_ENSURE_( PaAsiHpi_WaitForFrames( stream, &framesAvail, &cbFlags ) );
-
- /* Consume buffer space. Once we have a number of frames available for consumption we
- must retrieve the data from the HPI interface and pass it to the PA buffer processor.
- We should be prepared to process several chunks successively. */
- while( framesAvail > 0 )
- {
- PaStreamCallbackTimeInfo timeInfo = {0, 0, 0};
-
- pthread_testcancel();
-
- framesGot = framesAvail;
- if( stream->bufferProcessor.hostBufferSizeMode == paUtilFixedHostBufferSize )
- {
- /* We've committed to a fixed host buffer size, stick to that */
- framesGot = framesGot >= stream->maxFramesPerHostBuffer ? stream->maxFramesPerHostBuffer : 0;
- }
- else
- {
- /* We've committed to an upper bound on the size of host buffers */
- assert( stream->bufferProcessor.hostBufferSizeMode == paUtilBoundedHostBufferSize );
- framesGot = PA_MIN( framesGot, stream->maxFramesPerHostBuffer );
- }
-
- /* Obtain buffer timestamps */
- PaAsiHpi_CalculateTimeInfo( stream, &timeInfo );
- PaUtil_BeginBufferProcessing( &stream->bufferProcessor, &timeInfo, cbFlags );
- /* CPU load measurement should include processing activivity external to the stream callback */
- PaUtil_BeginCpuLoadMeasurement( &stream->cpuLoadMeasurer );
- if( framesGot > 0 )
- {
- /* READ FROM HPI INPUT STREAM */
- PA_ENSURE_( PaAsiHpi_BeginProcessing( stream, &framesGot, &cbFlags ) );
- /* Input overflow in a full-duplex stream makes for interesting times */
- if( stream->input && stream->output && (cbFlags & paInputOverflow) )
- {
- /* Special full-duplex paNeverDropInput mode */
- if( stream->neverDropInput )
- {
- PaUtil_SetNoOutput( &stream->bufferProcessor );
- cbFlags |= paOutputOverflow;
- }
- }
- /* CALL USER CALLBACK WITH INPUT DATA, AND OBTAIN OUTPUT DATA */
- PaUtil_EndBufferProcessing( &stream->bufferProcessor, &callbackResult );
- /* Clear overflow and underflow information (but PaAsiHpi_EndProcessing might
- still show up output underflow that will carry over to next round) */
- cbFlags = 0;
- /* WRITE TO HPI OUTPUT STREAM */
- PA_ENSURE_( PaAsiHpi_EndProcessing( stream, framesGot, &cbFlags ) );
- /* Advance frame counter */
- framesAvail -= framesGot;
- }
- PaUtil_EndCpuLoadMeasurement( &stream->cpuLoadMeasurer, framesGot );
-
- if( framesGot == 0 )
- {
- /* Go back to polling for more frames */
- break;
-
- }
- if( callbackResult != paContinue )
- break;
- }
- }
-
- /* This code is unreachable, but important to include regardless because it
- * is possibly a macro with a closing brace to match the opening brace in
- * pthread_cleanup_push() above. The documentation states that they must
- * always occur in pairs. */
- pthread_cleanup_pop( 1 );
-
-end:
- /* Indicates normal exit of callback, as opposed to the thread getting killed explicitly */
- stream->callbackFinished = 1;
- PA_DEBUG(( "%s: Thread %d exiting (callbackResult = %d)\n ",
- __FUNCTION__, pthread_self(), callbackResult ));
- /* Exit from thread and report any PortAudio error in the process */
- PaUnixThreading_EXIT( result );
-error:
- goto end;
-}
-
-/* --------------------------- Blocking Interface --------------------------- */
-
-/* As separate stream interfaces are used for blocking and callback streams, the following
- functions can be guaranteed to only be called for blocking streams. */
-
-/** Read data from input stream.
- This reads the indicated number of frames into the supplied buffer from an input stream,
- and blocks until this is done.
-
- @param s Pointer to PortAudio stream
-
- @param buffer Pointer to buffer that will receive interleaved data (or an array of pointers
- to a buffer for each non-interleaved channel)
-
- @param frames Number of frames to read from stream
-
- @return PortAudio error code (also indicates overflow via paInputOverflowed)
- */
-static PaError ReadStream( PaStream *s,
- void *buffer,
- unsigned long frames )
-{
- PaError result = paNoError;
- PaAsiHpiStream *stream = (PaAsiHpiStream*)s;
- PaAsiHpiStreamInfo info;
- void *userBuffer;
-
- assert( stream );
- PA_UNLESS_( stream->input, paCanNotReadFromAnOutputOnlyStream );
-
- /* Check for input overflow since previous call to ReadStream */
- PA_ENSURE_( PaAsiHpi_GetStreamInfo( stream->input, &info ) );
- if( info.overflow )
- {
- result = paInputOverflowed;
- }
-
- /* NB Make copy of user buffer pointers, since they are advanced by buffer processor */
- if( stream->bufferProcessor.userInputIsInterleaved )
- {
- userBuffer = buffer;
- }
- else
- {
- /* Copy channels into local array */
- userBuffer = stream->blockingUserBufferCopy;
- memcpy( userBuffer, buffer, sizeof (void *) * stream->input->hpiFormat.wChannels );
- }
-
- while( frames > 0 )
- {
- unsigned long framesGot, framesAvail;
- PaStreamCallbackFlags cbFlags = 0;
-
- PA_ENSURE_( PaAsiHpi_WaitForFrames( stream, &framesAvail, &cbFlags ) );
- framesGot = PA_MIN( framesAvail, frames );
- PA_ENSURE_( PaAsiHpi_BeginProcessing( stream, &framesGot, &cbFlags ) );
-
- if( framesGot > 0 )
- {
- framesGot = PaUtil_CopyInput( &stream->bufferProcessor, &userBuffer, framesGot );
- PA_ENSURE_( PaAsiHpi_EndProcessing( stream, framesGot, &cbFlags ) );
- /* Advance frame counter */
- frames -= framesGot;
- }
- }
-
-error:
- return result;
-}
-
-
-/** Write data to output stream.
- This writes the indicated number of frames from the supplied buffer to an output stream,
- and blocks until this is done.
-
- @param s Pointer to PortAudio stream
-
- @param buffer Pointer to buffer that provides interleaved data (or an array of pointers
- to a buffer for each non-interleaved channel)
-
- @param frames Number of frames to write to stream
-
- @return PortAudio error code (also indicates underflow via paOutputUnderflowed)
- */
-static PaError WriteStream( PaStream *s,
- const void *buffer,
- unsigned long frames )
-{
- PaError result = paNoError;
- PaAsiHpiStream *stream = (PaAsiHpiStream*)s;
- PaAsiHpiStreamInfo info;
- const void *userBuffer;
-
- assert( stream );
- PA_UNLESS_( stream->output, paCanNotWriteToAnInputOnlyStream );
-
- /* Check for output underflow since previous call to WriteStream */
- PA_ENSURE_( PaAsiHpi_GetStreamInfo( stream->output, &info ) );
- if( info.underflow )
- {
- result = paOutputUnderflowed;
- }
-
- /* NB Make copy of user buffer pointers, since they are advanced by buffer processor */
- if( stream->bufferProcessor.userOutputIsInterleaved )
- {
- userBuffer = buffer;
- }
- else
- {
- /* Copy channels into local array */
- userBuffer = stream->blockingUserBufferCopy;
- memcpy( (void *)userBuffer, buffer, sizeof (void *) * stream->output->hpiFormat.wChannels );
- }
-
- while( frames > 0 )
- {
- unsigned long framesGot, framesAvail;
- PaStreamCallbackFlags cbFlags = 0;
-
- PA_ENSURE_( PaAsiHpi_WaitForFrames( stream, &framesAvail, &cbFlags ) );
- framesGot = PA_MIN( framesAvail, frames );
- PA_ENSURE_( PaAsiHpi_BeginProcessing( stream, &framesGot, &cbFlags ) );
-
- if( framesGot > 0 )
- {
- framesGot = PaUtil_CopyOutput( &stream->bufferProcessor, &userBuffer, framesGot );
- PA_ENSURE_( PaAsiHpi_EndProcessing( stream, framesGot, &cbFlags ) );
- /* Advance frame counter */
- frames -= framesGot;
- }
- }
-
-error:
- return result;
-}
-
-
-/** Number of frames that can be read from input stream without blocking.
-
- @param s Pointer to PortAudio stream
-
- @return Number of frames, or PortAudio error code
- */
-static signed long GetStreamReadAvailable( PaStream *s )
-{
- PaError result = paNoError;
- PaAsiHpiStream *stream = (PaAsiHpiStream*)s;
- PaAsiHpiStreamInfo info;
-
- assert( stream );
- PA_UNLESS_( stream->input, paCanNotReadFromAnOutputOnlyStream );
-
- PA_ENSURE_( PaAsiHpi_GetStreamInfo( stream->input, &info ) );
- /* Round down to the nearest host buffer multiple */
- result = (info.availableFrames / stream->maxFramesPerHostBuffer) * stream->maxFramesPerHostBuffer;
- if( info.overflow )
- {
- result = paInputOverflowed;
- }
-
-error:
- return result;
-}
-
-
-/** Number of frames that can be written to output stream without blocking.
-
- @param s Pointer to PortAudio stream
-
- @return Number of frames, or PortAudio error code
- */
-static signed long GetStreamWriteAvailable( PaStream *s )
-{
- PaError result = paNoError;
- PaAsiHpiStream *stream = (PaAsiHpiStream*)s;
- PaAsiHpiStreamInfo info;
-
- assert( stream );
- PA_UNLESS_( stream->output, paCanNotWriteToAnInputOnlyStream );
-
- PA_ENSURE_( PaAsiHpi_GetStreamInfo( stream->output, &info ) );
- /* Round down to the nearest host buffer multiple */
- result = (info.availableFrames / stream->maxFramesPerHostBuffer) * stream->maxFramesPerHostBuffer;
- if( info.underflow )
- {
- result = paOutputUnderflowed;
- }
-
-error:
- return result;
-}
+/*
+ * $Id:$
+ * PortAudio Portable Real-Time Audio Library
+ * Latest Version at: http://www.portaudio.com
+ * AudioScience HPI implementation by Fred Gleason, Ludwig Schwardt and
+ * Eliot Blennerhassett
+ *
+ * Copyright (c) 2003 Fred Gleason
+ * Copyright (c) 2005,2006 Ludwig Schwardt
+ * Copyright (c) 2011 Eliot Blennerhassett
+ *
+ * Based on the Open Source API proposed by Ross Bencina
+ * Copyright (c) 1999-2008 Ross Bencina, Phil Burk
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/*
+ * The text above constitutes the entire PortAudio license; however,
+ * the PortAudio community also makes the following non-binding requests:
+ *
+ * Any person wishing to distribute modifications to the Software is
+ * requested to send the modifications to the original developer so that
+ * they can be incorporated into the canonical version. It is also
+ * requested that these non-binding requests be included along with the
+ * license above.
+ */
+
+/*
+ * Modification History
+ * 12/2003 - Initial version
+ * 09/2005 - v19 version [rewrite]
+ */
+
+/** @file
+ @ingroup hostapi_src
+ @brief Host API implementation supporting AudioScience cards
+ via the Linux HPI interface.
+
+
Overview
+
+ This is a PortAudio implementation for the AudioScience HPI Audio API
+ on the Linux platform. AudioScience makes a range of audio adapters customised
+ for the broadcasting industry, with support for both Windows and Linux.
+ More information on their products can be found on their website:
+
+ http://www.audioscience.com
+
+ Documentation for the HPI API can be found at:
+
+ http://www.audioscience.com/internet/download/sdk/hpi_usermanual_html/html/index.html
+
+ The Linux HPI driver itself (a kernel module + library) can be downloaded from:
+
+ http://www.audioscience.com/internet/download/linux_drivers.htm
+
+