[Pkg-voip-commits] [portaudio19] 04/09: Imported Upstream version 19.6.0

Benjamin Drung bdrung at moszumanska.debian.org
Sun Dec 25 20:36:03 UTC 2016


This is an automated email from the git hooks/post-receive script.

bdrung pushed a commit to branch master
in repository portaudio19.

commit c04f81503a07b201f4a8984cbcaee924ebdd74ef
Author: Benjamin Drung <bdrung at debian.org>
Date:   Sun Dec 25 21:31:03 2016 +0100

    Imported Upstream version 19.6.0
---
 .gitattributes                                     |    43 +
 .gitignore                                         |    42 +
 CMakeLists.txt                                     |   649 +-
 Doxyfile                                           |     1 -
 Doxyfile.developer                                 |   485 +-
 README.configure.txt                               |    14 +-
 aclocal.m4                                         |   344 +-
 bindings/cpp/ChangeLog                             |   356 +-
 bindings/cpp/INSTALL                               |    19 +-
 bindings/cpp/Makefile.in                           |   406 +-
 bindings/cpp/aclocal.m4                            |  1049 +-
 bindings/cpp/bin/Makefile.in                       |   273 +-
 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 +-
 bindings/cpp/build/vc7_1/static_library.vcproj     |   436 +-
 bindings/cpp/configure                             |   886 +-
 bindings/cpp/doc/Makefile.in                       |   113 +-
 bindings/cpp/doc/README                            |    68 +-
 bindings/cpp/doc/config.doxy.linux                 |   420 +-
 bindings/cpp/example/sine.cxx                      |   274 +-
 bindings/cpp/include/Makefile.in                   |   200 +-
 .../cpp/include/portaudiocpp/AsioDeviceAdapter.hxx |     2 +-
 bindings/cpp/include/portaudiocpp/AutoSystem.hxx   |   124 +-
 .../cpp/include/portaudiocpp/BlockingStream.hxx    |    90 +-
 .../include/portaudiocpp/CFunCallbackStream.hxx    |    98 +-
 .../cpp/include/portaudiocpp/CallbackInterface.hxx |    90 +-
 .../cpp/include/portaudiocpp/CallbackStream.hxx    |    80 +-
 .../include/portaudiocpp/CppFunCallbackStream.hxx  |   172 +-
 bindings/cpp/include/portaudiocpp/Device.hxx       |   182 +-
 .../DirectionSpecificStreamParameters.hxx          |   154 +-
 bindings/cpp/include/portaudiocpp/Exception.hxx    |   216 +-
 bindings/cpp/include/portaudiocpp/HostApi.hxx      |   152 +-
 .../portaudiocpp/InterfaceCallbackStream.hxx       |    98 +-
 .../include/portaudiocpp/MemFunCallbackStream.hxx  |   214 +-
 bindings/cpp/include/portaudiocpp/PortAudioCpp.hxx |   218 +-
 .../cpp/include/portaudiocpp/SampleDataFormat.hxx  |    70 +-
 bindings/cpp/include/portaudiocpp/Stream.hxx       |   164 +-
 .../cpp/include/portaudiocpp/StreamParameters.hxx  |   154 +-
 bindings/cpp/include/portaudiocpp/System.hxx       |   214 +-
 .../include/portaudiocpp/SystemDeviceIterator.hxx  |   132 +-
 .../include/portaudiocpp/SystemHostApiIterator.hxx |   122 +-
 bindings/cpp/lib/Makefile.in                       |   392 +-
 .../cpp/source/portaudiocpp/AsioDeviceAdapter.cxx  |   142 +-
 .../cpp/source/portaudiocpp/BlockingStream.cxx     |   200 +-
 .../cpp/source/portaudiocpp/CFunCallbackStream.cxx |    82 +-
 .../cpp/source/portaudiocpp/CallbackInterface.cxx  |    50 +-
 .../cpp/source/portaudiocpp/CallbackStream.cxx     |    40 +-
 .../source/portaudiocpp/CppFunCallbackStream.cxx   |   162 +-
 bindings/cpp/source/portaudiocpp/Device.cxx        |   336 +-
 .../DirectionSpecificStreamParameters.cxx          |   326 +-
 bindings/cpp/source/portaudiocpp/Exception.cxx     |   246 +-
 bindings/cpp/source/portaudiocpp/HostApi.cxx       |   242 +-
 .../portaudiocpp/InterfaceCallbackStream.cxx       |    90 +-
 .../source/portaudiocpp/MemFunCallbackStream.cxx   |     8 +-
 bindings/cpp/source/portaudiocpp/Stream.cxx        |   390 +-
 .../cpp/source/portaudiocpp/StreamParameters.cxx   |   330 +-
 bindings/cpp/source/portaudiocpp/System.cxx        |   616 +-
 .../source/portaudiocpp/SystemDeviceIterator.cxx   |   120 +-
 .../source/portaudiocpp/SystemHostApiIterator.cxx  |   118 +-
 .../c/build/vs2010/PortAudioJNI/PortAudioJNI.sln   |    52 +-
 .../build/vs2010/PortAudioJNI/PortAudioJNI.vcproj  |   396 +-
 .../build/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 +++----
 clear_gitrevision.sh                               |    12 +
 cmake_support/FindASIOSDK.cmake                    |    82 +-
 cmake_support/FindDXSDK.cmake                      |   118 +-
 cmake_support/FindJack.cmake                       |    41 +
 cmake_support/options_cmake.h.in                   |    62 +-
 cmake_support/portaudio-2.0.pc.in                  |    12 +
 cmake_support/template_portaudio.def               |   106 +-
 config.guess                                       |   207 +-
 config.sub                                         |   159 +-
 configure                                          |   303 +-
 configure.in                                       |    15 +-
 depcomp                                            |   531 +-
 doc/src/api_overview.dox                           |   322 +-
 doc/src/license.dox                                |    74 +-
 doc/src/mainpage.dox                               |   121 +-
 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                 |   158 +-
 doc/src/tutorial/compile_mac_coreaudio.dox         |   244 +-
 doc/src/tutorial/compile_windows.dox               |   203 +-
 doc/src/tutorial/compile_windows_asio_msvc.dox     |   190 +-
 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            |   136 +-
 doc/utils/checkfiledocs.py                         |   164 +-
 examples/CMakeLists.txt                            |    28 +-
 examples/pa_devs.c                                 |     9 +-
 examples/pa_fuzz.c                                 |     2 +-
 examples/paex_mono_asio_channel_select.c           |     2 +-
 examples/paex_ocean_shore.c                        |     4 +-
 examples/paex_pink.c                               |     2 +-
 examples/paex_read_write_wire.c                    |   426 +-
 examples/paex_record.c                             |     2 +-
 examples/paex_record_file.c                        |   911 +-
 examples/paex_saw.c                                |     2 +-
 examples/paex_sine.c                               |     5 +-
 examples/paex_sine_c++.cpp                         |   527 +-
 examples/paex_wmme_ac3.c                           |   443 +-
 examples/paex_wmme_surround.c                      |   422 +-
 examples/paex_write_sine.c                         |     2 +-
 include/pa_asio.h                                  |     2 +-
 include/pa_linux_alsa.h                            |     2 +-
 include/pa_win_ds.h                                |   190 +-
 include/pa_win_wasapi.h                            |   834 +-
 include/pa_win_waveformat.h                        |   396 +-
 include/pa_win_wdmks.h                             |    35 +-
 include/pa_win_wmme.h                              |     2 +-
 include/portaudio.h                                |    67 +-
 install-sh                                         |    35 +-
 ltmain.sh                                          |    95 +-
 missing                                            |   461 +-
 pablio/pablio.c                                    |     2 +-
 pablio/pablio.h                                    |     2 +-
 pablio/test_rw.c                                   |     2 +-
 pablio/test_rw_echo.c                              |     2 +-
 pablio/test_w_saw.c                                |     2 +-
 pablio/test_w_saw8.c                               |     2 +-
 qa/loopback/src/biquad_filter.c                    |   244 +-
 qa/loopback/src/biquad_filter.h                    |    76 +-
 qa/loopback/src/paqa.c                             |    16 +-
 qa/loopback/src/qa_tools.h                         |   157 +-
 qa/loopback/src/write_wav.c                        |   484 +-
 qa/loopback/src/write_wav.h                        |   206 +-
 qa/paqa_devs.c                                     |     2 +-
 qa/paqa_errs.c                                     |     2 +-
 src/common/pa_allocation.c                         |     2 +-
 src/common/pa_allocation.h                         |     2 +-
 src/common/pa_converters.c                         |     2 +-
 src/common/pa_converters.h                         |     2 +-
 src/common/pa_cpuload.c                            |     2 +-
 src/common/pa_cpuload.h                            |     2 +-
 src/common/pa_debugprint.c                         |   246 +-
 src/common/pa_debugprint.h                         |   298 +-
 src/common/pa_dither.c                             |     2 +-
 src/common/pa_dither.h                             |     2 +-
 src/common/pa_endianness.h                         |     2 +-
 src/common/pa_front.c                              |   155 +-
 src/common/pa_gitrevision.h                        |     1 +
 src/common/pa_hostapi.h                            |     2 +-
 src/common/pa_process.c                            |    10 +-
 src/common/pa_process.h                            |     2 +-
 src/common/pa_ringbuffer.c                         |     2 +-
 src/common/pa_ringbuffer.h                         |     2 +-
 src/common/pa_stream.c                             |     2 +-
 src/common/pa_stream.h                             |     2 +-
 src/common/pa_trace.c                              |     2 +-
 src/common/pa_trace.h                              |     2 +-
 src/common/pa_util.h                               |     2 +-
 src/hostapi/alsa/pa_linux_alsa.c                   |    37 +-
 src/hostapi/asihpi/pa_linux_asihpi.c               |  5786 +++++-----
 src/hostapi/asio/pa_asio.cpp                       |     2 +-
 src/hostapi/coreaudio/pa_mac_core.c                |   322 +-
 src/hostapi/coreaudio/pa_mac_core_blocking.c       |  1230 ++-
 src/hostapi/coreaudio/pa_mac_core_blocking.h       |   270 +-
 src/hostapi/coreaudio/pa_mac_core_old.c            |     2 +-
 src/hostapi/dsound/pa_win_ds.c                     |   160 +-
 src/hostapi/jack/pa_jack.c                         |     2 +-
 src/hostapi/oss/pa_unix_oss.c                      |     2 +-
 src/hostapi/skeleton/pa_hostapi_skeleton.c         |     2 +-
 .../wasapi/mingw-include/AudioSessionTypes.h       |    94 -
 .../mingw-include/FunctionDiscoveryKeys_devpkey.h  |   186 -
 src/hostapi/wasapi/mingw-include/audioclient.h     |  2354 ++--
 src/hostapi/wasapi/mingw-include/devicetopology.h  |  6550 +++++------
 src/hostapi/wasapi/mingw-include/endpointvolume.h  |  1240 +--
 .../wasapi/mingw-include/functiondiscoverykeys.h   |   510 +-
 src/hostapi/wasapi/mingw-include/ksmedia.h         |    10 +-
 src/hostapi/wasapi/mingw-include/mmdeviceapi.h     |  1858 ++--
 src/hostapi/wasapi/mingw-include/propidl.h         |  1275 ---
 src/hostapi/wasapi/mingw-include/propkey.h         |  4274 --------
 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       |   225 -
 src/hostapi/wasapi/mingw-include/shtypes.h         |   468 -
 src/hostapi/wasapi/mingw-include/structuredquery.h |  4956 ++++-----
 src/hostapi/wasapi/pa_win_wasapi.c                 | 10919 ++++++++++---------
 src/hostapi/wasapi/readme.txt                      |    47 +-
 src/hostapi/wdmks/pa_win_wdmks.c                   |   674 +-
 src/hostapi/wmme/pa_win_wmme.c                     |   272 +-
 src/os/unix/pa_unix_hostapis.c                     |     2 +-
 src/os/unix/pa_unix_util.c                         |     2 +-
 src/os/unix/pa_unix_util.h                         |     2 +-
 src/os/win/pa_win_coinitialize.c                   |   290 +-
 src/os/win/pa_win_coinitialize.h                   |   188 +-
 src/os/win/pa_win_hostapis.c                       |     2 +-
 src/os/win/pa_win_util.c                           |    21 +-
 src/os/win/pa_win_waveformat.c                     |   320 +-
 src/os/win/pa_win_wdmks_utils.c                    |   617 +-
 src/os/win/pa_win_wdmks_utils.h                    |   128 +-
 test/CMakeLists.txt                                |     4 +
 test/pa_minlat.c                                   |     2 +-
 test/patest1.c                                     |     2 +-
 test/patest_buffer.c                               |     2 +-
 test/patest_callbackstop.c                         |     2 +-
 test/patest_clip.c                                 |     2 +-
 test/patest_converters.c                           |   790 +-
 test/patest_dither.c                               |     2 +-
 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_hang.c                                 |     2 +-
 test/patest_in_overflow.c                          |     2 +-
 test/patest_jack_wasapi.c                          |   686 +-
 test/patest_latency.c                              |     2 +-
 test/patest_leftright.c                            |     2 +-
 test/patest_longsine.c                             |     2 +-
 test/patest_many.c                                 |     2 +-
 test/patest_maxsines.c                             |    14 +-
 test/patest_mono.c                                 |     2 +-
 test/patest_multi_sine.c                           |     4 +-
 test/patest_out_underflow.c                        |    59 +-
 test/patest_prime.c                                |     2 +-
 test/patest_read_record.c                          |     2 +-
 test/patest_ringmix.c                              |     2 +-
 test/patest_sine8.c                                |     2 +-
 test/patest_sine_formats.c                         |     2 +-
 test/patest_sine_time.c                            |     2 +-
 test/patest_start_stop.c                           |     2 +-
 test/patest_stop.c                                 |     2 +-
 test/patest_stop_playout.c                         |     2 +-
 test/patest_suggested_vs_streaminfo_latency.c      |   538 +-
 test/patest_suggested_vs_streaminfo_latency.py     |   300 +-
 test/patest_sync.c                                 |     2 +-
 test/patest_timing.c                               |   346 +-
 test/patest_toomanysines.c                         |     2 +-
 test/patest_two_rates.c                            |     2 +-
 test/patest_underflow.c                            |     2 +-
 test/patest_unplug.c                               |   243 +
 test/patest_wire.c                                 |     2 +-
 test/patest_wmme_find_best_latency_params.c        |  1036 +-
 test/patest_wmme_low_level_latency_params.c        |   384 +-
 test/patest_write_stop.c                           |     2 +-
 ...ite_stop.c => patest_write_stop_hang_illegal.c} |   141 +-
 testcvs/changeme.txt                               |     4 +-
 testcvs/file1.txt                                  |     9 +
 testcvs/file2.txt                                  |     9 +
 update_gitrevision.sh                              |    17 +
 265 files changed, 44450 insertions(+), 48010 deletions(-)

diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..95d5134
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,43 @@
+# Set the default behavior, in case people don't have core.autocrlf set.
+* text=auto
+
+# Explicitly declare text files you want to always be normalized and converted
+# to native line endings on checkout.
+*.c text
+*.h text
+*.cpp text
+*.hpp text
+*.fth text
+*.java text
+*.f text
+*.txt text
+*.dox text
+*.m text
+
+# Declare files that will always have CRLF line endings on checkout.
+*.sln text eol=crlf
+*.def text eol=crlf
+*.dsp text eol=crlf
+*.dsw text eol=crlf
+*.vcproj text eol=crlf
+*.sln text eol=crlf
+*.doc text eol=crlf
+*.bat text eol=crlf
+
+# Denote all files that are truly binary and should not be modified.
+*.dic binary
+*.odt binary
+*.pdf binary
+*.png binary
+*.jpg binary
+*.wav binary
+*.la binary
+config.guess binary
+config.status binary
+config.sub binary
+configure binary
+depcomp binary
+install-sh binary
+libtool binary
+missing binary
+
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..892ddfc
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,42 @@
+# Compiled Object files
+*.slo
+*.lo
+*.o
+*.obj
+
+# annoying files
+**/.DS_Store
+
+# Generated by configure and make
+Makefile
+bin-stamp
+bin/*
+config.log
+config.status
+lib-stamp
+lib/*
+libtool
+portaudio-2.0.pc
+
+# Precompiled Headers
+*.gch
+*.pch
+
+# Compiled Dynamic libraries
+*.so
+*.dylib
+*.dll
+
+# Fortran module files
+*.mod
+
+# Compiled Static libraries
+*.lai
+*.la
+*.a
+*.lib
+
+# Executables
+*.exe
+*.out
+*.app
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ad76118..789671a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -3,212 +3,72 @@
 # For a "How-To" please refer to the Portaudio documentation at:
 # http://www.portaudio.com/trac/wiki/TutorialDir/Compile/CMake
 #
-PROJECT( portaudio )
 
 CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
 
-OPTION(PA_CONFIG_LIB_OUTPUT_PATH "Make sure that output paths are kept neat" OFF)
-IF(CMAKE_CL_64)
-SET(TARGET_POSTFIX x64)
-IF(PA_CONFIG_LIB_OUTPUT_PATH)
-SET(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/bin/x64)
-ENDIF(PA_CONFIG_LIB_OUTPUT_PATH)
-ELSE(CMAKE_CL_64)
-SET(TARGET_POSTFIX x86)
-IF(PA_CONFIG_LIB_OUTPUT_PATH)
-SET(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/bin/Win32)
-ENDIF(PA_CONFIG_LIB_OUTPUT_PATH)
-ENDIF(CMAKE_CL_64)
-
-OPTION(PA_ENABLE_DEBUG_OUTPUT "Enable debug output for Portaudio" OFF)
-IF(PA_ENABLE_DEBUG_OUTPUT)
-ADD_DEFINITIONS(-DPA_ENABLE_DEBUG_OUTPUT)
-ENDIF(PA_ENABLE_DEBUG_OUTPUT)
-
-IF(WIN32 AND MSVC)
-OPTION(PA_DLL_LINK_WITH_STATIC_RUNTIME "Link with static runtime libraries (minimizes runtime dependencies)" ON)
-IF(PA_DLL_LINK_WITH_STATIC_RUNTIME)
-  FOREACH(flag_var
-		CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
-		CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO
-		CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
-		CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
-    IF(${flag_var} MATCHES "/MD")
-      STRING(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
-    ENDIF(${flag_var} MATCHES "/MD")
-  ENDFOREACH(flag_var)
-ENDIF(PA_DLL_LINK_WITH_STATIC_RUNTIME)
-
-ENDIF(WIN32 AND MSVC)
-
-IF(WIN32)
-OPTION(PA_UNICODE_BUILD "Enable Portaudio Unicode build" ON)
-
-SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake_support)
-# Try to find DirectX SDK
-FIND_PACKAGE(DXSDK)
-# Try to find ASIO SDK (assumes that portaudio and asiosdk folders are side-by-side, see
-# http://www.portaudio.com/trac/wiki/TutorialDir/Compile/WindowsASIOMSVC)
-FIND_PACKAGE(ASIOSDK)
-
-IF(ASIOSDK_FOUND)
-OPTION(PA_USE_ASIO "Enable support for ASIO" ON)
-ELSE(ASIOSDK_FOUND)
-OPTION(PA_USE_ASIO "Enable support for ASIO" OFF)
-ENDIF(ASIOSDK_FOUND)
-IF(DXSDK_FOUND)
-OPTION(PA_USE_DS "Enable support for DirectSound" ON)
-ELSE(DXSDK_FOUND)
-OPTION(PA_USE_DS "Enable support for DirectSound" OFF)
-ENDIF(DXSDK_FOUND)
-OPTION(PA_USE_WMME "Enable support for MME" ON)
-OPTION(PA_USE_WASAPI "Enable support for WASAPI" ON)
-OPTION(PA_USE_WDMKS "Enable support for WDMKS" ON)
-OPTION(PA_USE_WDMKS_DEVICE_INFO "Use WDM/KS API for device info" ON)
-MARK_AS_ADVANCED(PA_USE_WDMKS_DEVICE_INFO)
-IF(PA_USE_DS)
-OPTION(PA_USE_DIRECTSOUNDFULLDUPLEXCREATE "Use DirectSound full duplex create" ON)
-MARK_AS_ADVANCED(PA_USE_DIRECTSOUNDFULLDUPLEXCREATE)
-ENDIF(PA_USE_DS)
-ENDIF(WIN32)
-
-# Set variables for DEF file expansion
-IF(NOT PA_USE_ASIO)
-SET(DEF_EXCLUDE_ASIO_SYMBOLS ";")
-ENDIF(NOT PA_USE_ASIO)
-
-IF(NOT PA_USE_WASAPI)
-SET(DEF_EXCLUDE_WASAPI_SYMBOLS ";")
-ENDIF(NOT PA_USE_WASAPI)
-
-IF(PA_USE_WDMKS_DEVICE_INFO)
-ADD_DEFINITIONS(-DPAWIN_USE_WDMKS_DEVICE_INFO)
-ENDIF(PA_USE_WDMKS_DEVICE_INFO)
-
-IF(PA_USE_DIRECTSOUNDFULLDUPLEXCREATE)
-ADD_DEFINITIONS(-DPAWIN_USE_DIRECTSOUNDFULLDUPLEXCREATE)
-ENDIF(PA_USE_DIRECTSOUNDFULLDUPLEXCREATE)
-
-#######################################
-IF(WIN32)
-INCLUDE_DIRECTORIES(src/os/win)
-ENDIF(WIN32)
-
-IF(PA_USE_ASIO)
-INCLUDE_DIRECTORIES(${ASIOSDK_ROOT_DIR}/common)
-INCLUDE_DIRECTORIES(${ASIOSDK_ROOT_DIR}/host)
-INCLUDE_DIRECTORIES(${ASIOSDK_ROOT_DIR}/host/pc)
-
-SET(PA_ASIO_INCLUDES
-  include/pa_asio.h
-)  
-
-SET(PA_ASIO_SOURCES 
-  src/hostapi/asio/pa_asio.cpp
-)  
-
-SET(PA_ASIOSDK_SOURCES
-  ${ASIOSDK_ROOT_DIR}/common/asio.cpp
-  ${ASIOSDK_ROOT_DIR}/host/pc/asiolist.cpp
-  ${ASIOSDK_ROOT_DIR}/host/asiodrivers.cpp
-)
-
-SOURCE_GROUP("hostapi\\ASIO" FILES
-  ${PA_ASIO_SOURCES}
-)
-
-SOURCE_GROUP("hostapi\\ASIO\\ASIOSDK" FILES
-  ${PA_ASIOSDK_SOURCES}
-)
-ENDIF(PA_USE_ASIO)
-
-IF(PA_USE_DS)
-INCLUDE_DIRECTORIES(${DXSDK_INCLUDE_DIR})
-INCLUDE_DIRECTORIES(src/os/win)
-
-SET(PA_DS_INCLUDES
-  include/pa_win_ds.h
-  src/hostapi/dsound/pa_win_ds_dynlink.h
-)
-
-SET(PA_DS_SOURCES
-  src/hostapi/dsound/pa_win_ds.c
-  src/hostapi/dsound/pa_win_ds_dynlink.c
-)
-
-SOURCE_GROUP("hostapi\\dsound" FILES
-  ${PA_DS_INCLUDES}
-  ${PA_DS_SOURCES}
-)
-ENDIF(PA_USE_DS)
-
-IF(PA_USE_WMME)
-
-SET(PA_WMME_INCLUDES
-  include/pa_win_wmme.h
-)
-
-SET(PA_WMME_SOURCES
-  src/hostapi/wmme/pa_win_wmme.c
-)
-
-SOURCE_GROUP("hostapi\\wmme" FILES
-  ${PA_WMME_SOURCES}
-)
-ENDIF(PA_USE_WMME)
-
-IF(PA_USE_WASAPI)
-
-SET(PA_WASAPI_INCLUDES
-  include/pa_win_wasapi.h
-)
-
-SET(PA_WASAPI_SOURCES
-  src/hostapi/wasapi/pa_win_wasapi.c
-)
-
-SOURCE_GROUP("hostapi\\wasapi" FILES
-  ${PA_WASAPI_SOURCES}
-)
-ENDIF(PA_USE_WASAPI)
-
-IF(PA_USE_WDMKS)
-
-SET(PA_WDMKS_INCLUDES
-  include/pa_win_wdmks.h
-)
-
-SET(PA_WDMKS_SOURCES
-  src/hostapi/wdmks/pa_win_wdmks.c
-)
-
-SOURCE_GROUP("hostapi\\wdmks" FILES
-  ${PA_WDMKS_SOURCES}
-)
-ENDIF(PA_USE_WDMKS)
-
-SET(PA_SKELETON_SOURCES
-  src/hostapi/skeleton/pa_hostapi_skeleton.c
-)
-
-SOURCE_GROUP("hostapi\\skeleton" 
-  ${PA_SKELETON_SOURCES})
-
-#######################################
-IF(WIN32)
-SET(PA_INCLUDES 
-  include/portaudio.h
-  ${PA_ASIO_INCLUDES}
-  ${PA_DS_INCLUDES}
-  ${PA_WMME_INCLUDES}
-  ${PA_WASAPI_INCLUDES}
-  ${PA_WDMKS_INCLUDES}
-)
-ENDIF(WIN32)
-
-SOURCE_GROUP("include" FILES
-  ${PA_INCLUDES}
-)
+# Check if the user is building PortAudio stand-alone or as part of a larger
+# project. If this is part of a larger project (i.e. the CMakeLists.txt has
+# been imported by some other CMakeLists.txt), we don't want to trump over
+# the top of that project's global settings.
+IF(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_LIST_DIR})
+  IF(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
+    MESSAGE(STATUS "Setting CMAKE_BUILD_TYPE type to 'Debug' as none was specified.")
+    SET(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build." FORCE)
+    SET_PROPERTY(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release")
+  ENDIF()
+
+  PROJECT(portaudio)
+
+  SET_PROPERTY(GLOBAL PROPERTY USE_FOLDERS ON)
+
+  IF(WIN32 AND MSVC)
+    OPTION(PA_DLL_LINK_WITH_STATIC_RUNTIME "Link with static runtime libraries (minimizes runtime dependencies)" ON)
+    IF(PA_DLL_LINK_WITH_STATIC_RUNTIME)
+      FOREACH(flag_var
+        CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
+        CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO
+        CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
+        CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
+        IF(${flag_var} MATCHES "/MD")
+          STRING(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
+        ENDIF()
+      ENDFOREACH()
+    ENDIF()
+  ENDIF()
+ENDIF()
+
+SET(PA_PKGCONFIG_VERSION 19)
+
+# Most of the code from this point onwards is related to populating the
+# following variables:
+#   PA_PUBLIC_INCLUDES - This contains the list of public PortAudio header
+#       files. These files will be copied into /include paths on Unix'y
+#       systems when "make install" is invoked.
+#   PA_PRIVATE_INCLUDES - This contains the list of header files which
+#       are not part of PortAudio, but are required by the various hostapis.
+#       It is only used by CMake IDE generators (like Visual Studio) to
+#       provide quick-links to useful headers. It has no impact on build
+#       output.
+#   PA_PRIVATE_INCLUDE_PATHS - This contains the list of include paths which
+#       will be passed to the compiler while PortAudio is being built which
+#       are not required by applications using the PortAudio API.
+#   PA_PRIVATE_COMPILE_DEFINITIONS - This contains a list of preprocessor
+#       macro definitions which will be set when compiling PortAudio source
+#       files.
+#   PA_SOURCES - This contains the list of source files which will be built
+#       into the static and shared PortAudio libraries.
+#   PA_NON_UNICODE_SOURCES - This also contains a list of source files which
+#       will be build into the static and shared PortAudio libraries. However,
+#       these sources will not have any unicode compiler definitions added
+#       to them. This list should only contain external source dependencies.
+#   PA_EXTRA_SHARED_SOURCES - Contains a list of extra files which will be
+#       associated only with the shared PortAudio library. This only seems
+#       relevant for Windows shared libraries which require a list of export
+#       symbols.
+# Where other PA_* variables are set, these are almost always only used to
+# preserve the historic SOURCE_GROUP behavior (which again only has an impact
+# on IDE-style generators for visual appearance) or store the output of
+# find_library() calls.
 
 SET(PA_COMMON_INCLUDES
   src/common/pa_allocation.h
@@ -240,110 +100,309 @@ SET(PA_COMMON_SOURCES
   src/common/pa_trace.c
 )
 
-SOURCE_GROUP("common" FILES
-  ${PA_COMMON_INCLUDES}
-  ${PA_COMMON_SOURCES}
-)
-
-SOURCE_GROUP("cmake_generated" FILES
-  ${CMAKE_CURRENT_BINARY_DIR}/portaudio_cmake.def
-  ${CMAKE_CURRENT_BINARY_DIR}/options_cmake.h
-)
-
-IF(WIN32)
-SET(PA_PLATFORM_SOURCES 
-  src/os/win/pa_win_hostapis.c
-  src/os/win/pa_win_util.c
-  src/os/win/pa_win_waveformat.c
-  src/os/win/pa_win_wdmks_utils.c
-  src/os/win/pa_win_coinitialize.c
-  src/os/win/pa_x86_plain_converters.c
-)
-
-SOURCE_GROUP("os\\win" FILES
-  ${PA_PLATFORM_SOURCES}
-)
-ENDIF(WIN32)
-
-INCLUDE_DIRECTORIES( include )
-INCLUDE_DIRECTORIES( src/common )
+SOURCE_GROUP("common" FILES ${PA_COMMON_INCLUDES} ${PA_COMMON_SOURCES})
 
-IF(WIN32 AND MSVC)
-ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS)
-ENDIF(WIN32 AND MSVC)
-
-ADD_DEFINITIONS(-DPORTAUDIO_CMAKE_GENERATED)
-INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR} )
-
-SET(SOURCES_LESS_ASIO_SDK
-  ${PA_COMMON_SOURCES}
-  ${PA_ASIO_SOURCES}
-  ${PA_DS_SOURCES}
-  ${PA_WMME_SOURCES}
-  ${PA_WASAPI_SOURCES}
-  ${PA_WDMKS_SOURCES}
-  ${PA_SKELETON_SOURCES}
-  ${PA_PLATFORM_SOURCES}
-)
+SET(PA_PUBLIC_INCLUDES include/portaudio.h)
 
-IF(PA_UNICODE_BUILD)
-SET_SOURCE_FILES_PROPERTIES(
-  ${SOURCES_LESS_ASIO_SDK}
-  PROPERTIES
-  COMPILE_DEFINITIONS "UNICODE;_UNICODE"
-)
-ENDIF(PA_UNICODE_BUILD)
-
-ADD_LIBRARY(portaudio SHARED
-  ${PA_INCLUDES}
-  ${PA_COMMON_INCLUDES}
-  ${SOURCES_LESS_ASIO_SDK}
-  ${PA_ASIOSDK_SOURCES}
-  ${CMAKE_CURRENT_BINARY_DIR}/portaudio_cmake.def
-  ${CMAKE_CURRENT_BINARY_DIR}/options_cmake.h
-)
-
-ADD_LIBRARY(portaudio_static STATIC
-  ${PA_INCLUDES}
-  ${PA_COMMON_INCLUDES}
-  ${SOURCES_LESS_ASIO_SDK}
-  ${PA_ASIOSDK_SOURCES}
-  ${CMAKE_CURRENT_BINARY_DIR}/options_cmake.h
-)
+SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake_support)
 
-# Configure the exports file according to settings
-SET(GENERATED_MESSAGE "CMake generated file, do NOT edit! Use CMake-GUI to change configuration instead.")
-CONFIGURE_FILE( cmake_support/template_portaudio.def ${CMAKE_CURRENT_BINARY_DIR}/portaudio_cmake.def @ONLY )
-# Configure header for options (PA_USE_xxx)
-CONFIGURE_FILE( cmake_support/options_cmake.h.in ${CMAKE_CURRENT_BINARY_DIR}/options_cmake.h @ONLY )
+SET(PA_SKELETON_SOURCES src/hostapi/skeleton/pa_hostapi_skeleton.c)
+SOURCE_GROUP("hostapi\\skeleton" ${PA_SKELETON_SOURCES})
+SET(PA_SOURCES ${PA_COMMON_SOURCES} ${PA_SKELETON_SOURCES})
+SET(PA_PRIVATE_INCLUDE_PATHS src/common ${CMAKE_CURRENT_BINARY_DIR})
 
 IF(WIN32)
-# If we use DirectSound, we need this for the library to be found (if not in VS project settings)
-IF(PA_USE_DS AND DXSDK_FOUND)
-TARGET_LINK_LIBRARIES(portaudio ${DXSDK_DSOUND_LIBRARY})
-ENDIF(PA_USE_DS AND DXSDK_FOUND)
+  SET(PA_PRIVATE_COMPILE_DEFINITIONS ${PA_PRIVATE_COMPILE_DEFINITIONS} _CRT_SECURE_NO_WARNINGS)
+
+  SET(PA_PLATFORM_SOURCES
+    src/os/win/pa_win_hostapis.c
+    src/os/win/pa_win_util.c
+    src/os/win/pa_win_waveformat.c
+    src/os/win/pa_win_wdmks_utils.c
+    src/os/win/pa_win_coinitialize.c)
+  SET(PA_PLATFORM_INCLUDES
+    src/os/win/pa_win_coinitialize.h
+    src/os/win/pa_win_wdmks_utils.h)
+
+  IF(MSVC)
+    SET(PA_PLATFORM_SOURCES ${PA_PLATFORM_SOURCES} src/os/win/pa_x86_plain_converters.c)
+    SET(PA_PLATFORM_INCLUDES ${PA_PLATFORM_INCLUDES} src/os/win/pa_x86_plain_converters.h)
+  ELSE()
+    SET(PA_PRIVATE_COMPILE_DEFINITIONS ${PA_PRIVATE_COMPILE_DEFINITIONS} _WIN32_WINNT=0x0501 WINVER=0x0501)
+    SET(DEF_EXCLUDE_X86_PLAIN_CONVERTERS ";")
+  ENDIF()
+
+  SOURCE_GROUP("os\\win" FILES ${PA_PLATFORM_SOURCES} ${PA_PLATFORM_INCLUDES})
+  SET(PA_SOURCES ${PA_SOURCES} ${PA_PLATFORM_SOURCES})
+  SET(PA_PRIVATE_INCLUDES ${PA_PRIVATE_INCLUDES} ${PA_PLATFORM_INCLUDES})
+  SET(PA_PRIVATE_INCLUDE_PATHS ${PA_PRIVATE_INCLUDE_PATHS} src/os/win)
+
+  SET(PA_LIBRARY_DEPENDENCIES ${PA_LIBRARY_DEPENDENCIES} winmm)
+
+  # Try to find ASIO SDK (assumes that portaudio and asiosdk folders are side-by-side, see
+  # http://www.portaudio.com/trac/wiki/TutorialDir/Compile/WindowsASIOMSVC)
+  FIND_PACKAGE(ASIOSDK)
+  IF(ASIOSDK_FOUND)
+    OPTION(PA_USE_ASIO "Enable support for ASIO" ON)
+  ELSE()
+    OPTION(PA_USE_ASIO "Enable support for ASIO" OFF)
+  ENDIF()
+  IF(PA_USE_ASIO)
+    SET(PA_PRIVATE_INCLUDE_PATHS ${PA_PRIVATE_INCLUDE_PATHS} ${ASIOSDK_ROOT_DIR}/common)
+    SET(PA_PRIVATE_INCLUDE_PATHS ${PA_PRIVATE_INCLUDE_PATHS} ${ASIOSDK_ROOT_DIR}/host)
+    SET(PA_PRIVATE_INCLUDE_PATHS ${PA_PRIVATE_INCLUDE_PATHS} ${ASIOSDK_ROOT_DIR}/host/pc)
+    SET(PA_ASIO_SOURCES src/hostapi/asio/pa_asio.cpp src/hostapi/asio/iasiothiscallresolver.cpp)
+    SET(PA_ASIOSDK_SOURCES ${ASIOSDK_ROOT_DIR}/common/asio.cpp ${ASIOSDK_ROOT_DIR}/host/pc/asiolist.cpp ${ASIOSDK_ROOT_DIR}/host/asiodrivers.cpp)
+    SOURCE_GROUP("hostapi\\ASIO" FILES ${PA_ASIO_SOURCES})
+    SOURCE_GROUP("hostapi\\ASIO\\ASIOSDK" FILES ${PA_ASIOSDK_SOURCES})
+    SET(PA_PUBLIC_INCLUDES ${PA_PUBLIC_INCLUDES} include/pa_asio.h)
+    SET(PA_SOURCES ${PA_SOURCES} ${PA_ASIO_SOURCES})
+    SET(PA_NON_UNICODE_SOURCES ${PA_NON_UNICODE_SOURCES} ${PA_ASIOSDK_SOURCES})
+    SET(PA_LIBRARY_DEPENDENCIES ${PA_LIBRARY_DEPENDENCIES} ole32 uuid)
+  ELSE()
+    # Set variables for DEF file expansion
+    SET(DEF_EXCLUDE_ASIO_SYMBOLS ";")
+  ENDIF()
+
+  # Try to find DirectX SDK
+  FIND_PACKAGE(DXSDK)
+  IF(DXSDK_FOUND)
+    OPTION(PA_USE_DS "Enable support for DirectSound" ON)
+  ELSE()
+    OPTION(PA_USE_DS "Enable support for DirectSound" OFF)
+  ENDIF()
+  IF(PA_USE_DS)
+    OPTION(PA_USE_DIRECTSOUNDFULLDUPLEXCREATE "Use DirectSound full duplex create" ON)
+    MARK_AS_ADVANCED(PA_USE_DIRECTSOUNDFULLDUPLEXCREATE)
+    IF(PA_USE_DIRECTSOUNDFULLDUPLEXCREATE)
+      SET(PA_PRIVATE_COMPILE_DEFINITIONS ${PA_PRIVATE_COMPILE_DEFINITIONS} PAWIN_USE_DIRECTSOUNDFULLDUPLEXCREATE)
+    ENDIF()
+    SET(PA_PRIVATE_INCLUDE_PATHS ${PA_PRIVATE_INCLUDE_PATHS} ${DXSDK_INCLUDE_DIR})
+    SET(PA_DS_INCLUDES src/hostapi/dsound/pa_win_ds_dynlink.h)
+    SET(PA_DS_SOURCES src/hostapi/dsound/pa_win_ds.c src/hostapi/dsound/pa_win_ds_dynlink.c)
+    SOURCE_GROUP("hostapi\\dsound" FILES ${PA_DS_INCLUDES} ${PA_DS_SOURCES})
+    SET(PA_PUBLIC_INCLUDES ${PA_PUBLIC_INCLUDES} include/pa_win_ds.h)
+    SET(PA_PRIVATE_INCLUDES ${PA_PRIVATE_INCLUDES} ${PA_DS_INCLUDES})
+    SET(PA_SOURCES ${PA_SOURCES} ${PA_DS_SOURCES})
+
+    # If we use DirectSound, we need this for the library to be found (if not in VS project settings)
+    IF(DXSDK_FOUND)
+      SET(PA_LIBRARY_DEPENDENCIES ${PA_LIBRARY_DEPENDENCIES} ${DXSDK_DSOUND_LIBRARY})
+    ENDIF()
+  ENDIF()
+
+  OPTION(PA_USE_WMME "Enable support for MME" ON)
+  IF(PA_USE_WMME)
+    SET(PA_WMME_SOURCES src/hostapi/wmme/pa_win_wmme.c)
+    SOURCE_GROUP("hostapi\\wmme" FILES ${PA_WMME_SOURCES})
+    SET(PA_PUBLIC_INCLUDES ${PA_PUBLIC_INCLUDES} include/pa_win_wmme.h)
+    SET(PA_SOURCES ${PA_SOURCES} ${PA_WMME_SOURCES})
+    SET(PA_LIBRARY_DEPENDENCIES ${PA_LIBRARY_DEPENDENCIES} ole32 uuid)
+  ENDIF()
+
+  IF(MSVS)
+    OPTION(PA_USE_WASAPI "Enable support for WASAPI" ON)
+  ELSE()
+    # I was unable to get WASAPI to compile outside of Visual Studio. If
+    # anyone can figure out how to make this work with MinGW, please fix me.
+    SET(PA_USE_WASAPI OFF)
+  ENDIF()
+  IF(PA_USE_WASAPI)
+    SET(PA_WASAPI_SOURCES src/hostapi/wasapi/pa_win_wasapi.c)
+    SOURCE_GROUP("hostapi\\wasapi" FILES ${PA_WASAPI_SOURCES})
+    SET(PA_PUBLIC_INCLUDES ${PA_PUBLIC_INCLUDES} include/pa_win_wasapi.h)
+    SET(PA_SOURCES ${PA_SOURCES} ${PA_WASAPI_SOURCES})
+    SET(PA_LIBRARY_DEPENDENCIES ${PA_LIBRARY_DEPENDENCIES} ole32 uuid)
+    IF(NOT MSVC)
+      SET(PA_PRIVATE_INCLUDE_PATHS ${PA_PRIVATE_INCLUDE_PATHS} src/hostapi/wasapi/mingw-include)
+    ENDIF()
+  ELSE()
+    SET(DEF_EXCLUDE_WASAPI_SYMBOLS ";")
+  ENDIF()
+
+  OPTION(PA_USE_WDMKS "Enable support for WDMKS" ON)
+  IF(PA_USE_WDMKS)
+    SET(PA_WDMKS_SOURCES src/hostapi/wdmks/pa_win_wdmks.c)
+    SOURCE_GROUP("hostapi\\wdmks" FILES ${PA_WDMKS_SOURCES})
+    SET(PA_PUBLIC_INCLUDES ${PA_PUBLIC_INCLUDES} include/pa_win_wdmks.h)
+    SET(PA_SOURCES ${PA_SOURCES} ${PA_WDMKS_SOURCES})
+    SET(PA_LIBRARY_DEPENDENCIES ${PA_LIBRARY_DEPENDENCIES} setupapi ole32 uuid)
+  ENDIF()
+
+  OPTION(PA_USE_WDMKS_DEVICE_INFO "Use WDM/KS API for device info" ON)
+  MARK_AS_ADVANCED(PA_USE_WDMKS_DEVICE_INFO)
+  IF(PA_USE_WDMKS_DEVICE_INFO)
+    SET(PA_PRIVATE_COMPILE_DEFINITIONS ${PA_PRIVATE_COMPILE_DEFINITIONS} PAWIN_USE_WDMKS_DEVICE_INFO)
+  ENDIF()
+
+  SET(GENERATED_MESSAGE "CMake generated file, do NOT edit! Use CMake-GUI to change configuration instead.")
+  CONFIGURE_FILE(cmake_support/template_portaudio.def ${CMAKE_CURRENT_BINARY_DIR}/portaudio_cmake.def @ONLY)
+  CONFIGURE_FILE(cmake_support/options_cmake.h.in ${CMAKE_CURRENT_BINARY_DIR}/options_cmake.h @ONLY)
+  SET(PA_PRIVATE_INCLUDES ${PA_PRIVATE_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR}/options_cmake.h)
+  SET(PA_PRIVATE_COMPILE_DEFINITIONS ${PA_PRIVATE_COMPILE_DEFINITIONS} PORTAUDIO_CMAKE_GENERATED)
+  SOURCE_GROUP("cmake_generated" FILES ${CMAKE_CURRENT_BINARY_DIR}/portaudio_cmake.def ${CMAKE_CURRENT_BINARY_DIR}/options_cmake.h)
+
+  SET(PA_EXTRA_SHARED_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/portaudio_cmake.def)
+
+ELSE()
+
+  SET(PA_PRIVATE_INCLUDE_PATHS ${PA_PRIVATE_INCLUDE_PATHS} src/os/unix)
+  SET(PA_PLATFORM_SOURCES src/os/unix/pa_unix_hostapis.c src/os/unix/pa_unix_util.c)
+  SOURCE_GROUP("os\\unix" FILES ${PA_PLATFORM_SOURCES})
+  SET(PA_SOURCES ${PA_SOURCES} ${PA_PLATFORM_SOURCES})
+
+  IF(APPLE)
+
+    SET(CMAKE_MACOSX_RPATH 1)
+    OPTION(PA_USE_COREAUDIO "Enable support for CoreAudio" ON)
+    IF(PA_USE_COREAUDIO)
+      SET(PA_COREAUDIO_SOURCES
+        src/hostapi/coreaudio/pa_mac_core.c
+        src/hostapi/coreaudio/pa_mac_core_blocking.c
+        src/hostapi/coreaudio/pa_mac_core_utilities.c)
+      SET(PA_COREAUDIO_INCLUDES
+        src/hostapi/coreaudio/pa_mac_core_blocking.h
+        src/hostapi/coreaudio/pa_mac_core_utilities.h)
+      SOURCE_GROUP("hostapi\\coreaudio" FILES ${PA_COREAUDIO_SOURCES} ${PA_COREAUDIO_INCLUDES})
+      SET(PA_PUBLIC_INCLUDES ${PA_PUBLIC_INCLUDES} include/pa_mac_core.h)
+      SET(PA_PRIVATE_INCLUDES ${PA_PRIVATE_INCLUDES} ${PA_COREAUDIO_INCLUDES})
+      SET(PA_SOURCES ${PA_SOURCES} ${PA_COREAUDIO_SOURCES})
+
+      FIND_LIBRARY(COREAUDIO_LIBRARY CoreAudio REQUIRED)
+      FIND_LIBRARY(AUDIOTOOLBOX_LIBRARY AudioToolbox REQUIRED)
+      FIND_LIBRARY(AUDIOUNIT_LIBRARY AudioUnit REQUIRED)
+      FIND_LIBRARY(CARBON_LIBRARY Carbon REQUIRED)
+      MARK_AS_ADVANCED(COREAUDIO_LIBRARY AUDIOTOOLBOX_LIBRARY AUDIOUNIT_LIBRARY CARBON_LIBRARY)
+      SET(PA_LIBRARY_DEPENDENCIES ${PA_LIBRARY_DEPENDENCIES} ${COREAUDIO_LIBRARY} ${AUDIOTOOLBOX_LIBRARY} ${AUDIOUNIT_LIBRARY} ${CARBON_LIBRARY})
+      SET(PA_PRIVATE_COMPILE_DEFINITIONS ${PA_PRIVATE_COMPILE_DEFINITIONS} PA_USE_COREAUDIO)
+      SET(PA_PKGCONFIG_LDFLAGS "${PA_PKGCONFIG_LDFLAGS} -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework Carbon")
+    ENDIF()
+
+  ELSEIF(UNIX)
+
+    FIND_PACKAGE(Jack)
+    IF(JACK_FOUND)
+      OPTION(PA_USE_JACK "Enable support for Jack" ON)
+    ELSE()
+      OPTION(PA_USE_JACK "Enable support for Jack" OFF)
+    ENDIF()
+    IF(PA_USE_JACK)
+      SET(PA_PRIVATE_INCLUDE_PATHS ${PA_PRIVATE_INCLUDE_PATHS} ${JACK_INCLUDE_DIRS})
+      SET(PA_JACK_SOURCES src/hostapi/jack/pa_jack.c)
+      SOURCE_GROUP("hostapi\\JACK" FILES ${PA_JACK_SOURCES})
+      SET(PA_PUBLIC_INCLUDES ${PA_PUBLIC_INCLUDES} include/pa_jack.h)
+      SET(PA_SOURCES ${PA_SOURCES} ${PA_JACK_SOURCES})
+      SET(PA_PRIVATE_COMPILE_DEFINITIONS ${PA_PRIVATE_COMPILE_DEFINITIONS} PA_USE_JACK)
+      SET(PA_LIBRARY_DEPENDENCIES ${PA_LIBRARY_DEPENDENCIES} ${JACK_LIBRARIES})
+      SET(PA_PKGCONFIG_LDFLAGS "${PA_PKGCONFIG_LDFLAGS} -ljack")
+    ENDIF()
+
+    FIND_PACKAGE(ALSA)
+    IF(ALSA_FOUND)
+      OPTION(PA_USE_ALSA "Enable support for ALSA" ON)
+    ELSE()
+      OPTION(PA_USE_ALSA "Enable support for ALSA" OFF)
+    ENDIF()
+    IF(PA_USE_ALSA)
+      SET(PA_PRIVATE_INCLUDE_PATHS ${PA_PRIVATE_INCLUDE_PATHS} ${ALSA_INCLUDE_DIRS})
+      SET(PA_ALSA_SOURCES src/hostapi/alsa/pa_linux_alsa.c)
+      SOURCE_GROUP("hostapi\\ALSA" FILES ${PA_ALSA_SOURCES})
+      SET(PA_PUBLIC_INCLUDES ${PA_PUBLIC_INCLUDES} include/pa_linux_alsa.h)
+      SET(PA_SOURCES ${PA_SOURCES} ${PA_ALSA_SOURCES})
+      SET(PA_PRIVATE_COMPILE_DEFINITIONS ${PA_PRIVATE_COMPILE_DEFINITIONS} PA_USE_ALSA)
+      SET(PA_LIBRARY_DEPENDENCIES ${PA_LIBRARY_DEPENDENCIES} ${ALSA_LIBRARIES})
+      SET(PA_PKGCONFIG_LDFLAGS "${PA_PKGCONFIG_LDFLAGS} -lasound")
+    ENDIF()
+
+  ENDIF()
+
+  SET(PA_PKGCONFIG_LDFLAGS "${PA_PKGCONFIG_LDFLAGS} -lm -lpthread")
+  SET(PA_LIBRARY_DEPENDENCIES ${PA_LIBRARY_DEPENDENCIES} m pthread)
+
+ENDIF()
+
+SOURCE_GROUP("include" FILES ${PA_PUBLIC_INCLUDES})
+
+SET(PA_INCLUDES ${PA_PRIVATE_INCLUDES} ${PA_PUBLIC_INCLUDES})
 
-# If we use WDM/KS we need setupapi.lib
-IF(PA_USE_WDMKS)
-TARGET_LINK_LIBRARIES(portaudio setupapi)
-ENDIF(PA_USE_WDMKS)
+IF(WIN32)
+  OPTION(PA_UNICODE_BUILD "Enable Portaudio Unicode build" ON)
+  IF(PA_UNICODE_BUILD)
+    SET_SOURCE_FILES_PROPERTIES(${PA_SOURCES} PROPERTIES COMPILE_DEFINITIONS "UNICODE;_UNICODE")
+  ENDIF()
+ENDIF()
 
-SET_TARGET_PROPERTIES(portaudio PROPERTIES OUTPUT_NAME portaudio_${TARGET_POSTFIX})
-SET_TARGET_PROPERTIES(portaudio_static PROPERTIES OUTPUT_NAME portaudio_static_${TARGET_POSTFIX})
-ENDIF(WIN32)
+OPTION(PA_ENABLE_DEBUG_OUTPUT "Enable debug output for Portaudio" OFF)
+IF(PA_ENABLE_DEBUG_OUTPUT)
+  SET(PA_PRIVATE_COMPILE_DEFINITIONS ${PA_PRIVATE_COMPILE_DEFINITIONS} PA_ENABLE_DEBUG_OUTPUT)
+ENDIF()
+
+INCLUDE(TestBigEndian)
+TEST_BIG_ENDIAN(IS_BIG_ENDIAN)
+IF(IS_BIG_ENDIAN)
+  SET(PA_PRIVATE_COMPILE_DEFINITIONS ${PA_PRIVATE_COMPILE_DEFINITIONS} PA_BIG_ENDIAN)
+ELSE()
+  SET(PA_PRIVATE_COMPILE_DEFINITIONS ${PA_PRIVATE_COMPILE_DEFINITIONS} PA_LITTLE_ENDIAN)
+ENDIF()
+
+ADD_LIBRARY(portaudio SHARED ${PA_INCLUDES} ${PA_COMMON_INCLUDES} ${PA_SOURCES} ${PA_NON_UNICODE_SOURCES} ${PA_EXTRA_SHARED_SOURCES})
+SET_PROPERTY(TARGET portaudio APPEND_STRING PROPERTY COMPILE_DEFINITIONS ${PA_PRIVATE_COMPILE_DEFINITIONS})
+TARGET_INCLUDE_DIRECTORIES(portaudio PRIVATE ${PA_PRIVATE_INCLUDE_PATHS})
+TARGET_INCLUDE_DIRECTORIES(portaudio PUBLIC include)
+TARGET_LINK_LIBRARIES(portaudio ${PA_LIBRARY_DEPENDENCIES})
+
+ADD_LIBRARY(portaudio_static STATIC ${PA_INCLUDES} ${PA_COMMON_INCLUDES} ${PA_SOURCES} ${PA_NON_UNICODE_SOURCES})
+SET_PROPERTY(TARGET portaudio_static APPEND_STRING PROPERTY COMPILE_DEFINITIONS ${PA_PRIVATE_COMPILE_DEFINITIONS})
+TARGET_INCLUDE_DIRECTORIES(portaudio_static PRIVATE ${PA_PRIVATE_INCLUDE_PATHS})
+TARGET_INCLUDE_DIRECTORIES(portaudio_static PUBLIC include)
+TARGET_LINK_LIBRARIES(portaudio_static ${PA_LIBRARY_DEPENDENCIES})
 
-OPTION(PA_BUILD_TESTS "Include test projects" OFF)
-OPTION(PA_BUILD_EXAMPLES "Include example projects" OFF)
+IF(WIN32 AND MSVC)
+  OPTION(PA_CONFIG_LIB_OUTPUT_PATH "Make sure that output paths are kept neat" OFF)
+  IF(CMAKE_CL_64)
+    SET(TARGET_POSTFIX x64)
+    IF(PA_CONFIG_LIB_OUTPUT_PATH)
+      SET(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/bin/x64)
+    ENDIF()
+  ELSE()
+    SET(TARGET_POSTFIX x86)
+    IF(PA_CONFIG_LIB_OUTPUT_PATH)
+      SET(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/bin/Win32)
+    ENDIF()
+  ENDIF()
+  SET_TARGET_PROPERTIES(portaudio PROPERTIES OUTPUT_NAME portaudio_${TARGET_POSTFIX} FOLDER "Portaudio")
+  SET_TARGET_PROPERTIES(portaudio_static PROPERTIES OUTPUT_NAME portaudio_static_${TARGET_POSTFIX} FOLDER "Portaudio")
+ELSE()
+  IF(APPLE AND CMAKE_VERSION VERSION_GREATER 3.4.2)
+    OPTION(PA_OUTPUT_OSX_FRAMEWORK "Generate an OS X framework instead of the simple library" OFF)
+    IF(PA_OUTPUT_OSX_FRAMEWORK)
+      SET_TARGET_PROPERTIES(portaudio PROPERTIES
+        FRAMEWORK TRUE
+        MACOSX_FRAMEWORK_IDENTIFIER com.portaudio
+        FRAMEWORK_VERSION A
+        PUBLIC_HEADER "${PA_PUBLIC_INCLUDES}"
+        VERSION 19.0
+        SOVERSION 19.0)
+    ENDIF()
+  ENDIF()
+
+  IF(NOT PA_OUTPUT_OSX_FRAMEWORK)
+    CONFIGURE_FILE(cmake_support/portaudio-2.0.pc.in ${CMAKE_CURRENT_BINARY_DIR}/portaudio-2.0.pc @ONLY)
+    INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/portaudio-2.0.pc DESTINATION lib/pkgconfig)
+    INSTALL(FILES ${PA_PUBLIC_INCLUDES} DESTINATION include)
+    INSTALL(TARGETS portaudio DESTINATION lib)
+  ENDIF()
+ENDIF()
 
 # Prepared for inclusion of test files
+OPTION(PA_BUILD_TESTS "Include test projects" OFF)
 IF(PA_BUILD_TESTS)
-SUBDIRS(test)
-ENDIF(PA_BUILD_TESTS)
+  SUBDIRS(test)
+ENDIF()
 
 # Prepared for inclusion of test files
+OPTION(PA_BUILD_EXAMPLES "Include example projects" OFF)
 IF(PA_BUILD_EXAMPLES)
-SUBDIRS(examples)
-ENDIF(PA_BUILD_EXAMPLES)
-
-#################################
+  SUBDIRS(examples)
+ENDIF()
 
diff --git a/Doxyfile b/Doxyfile
index 69c5af3..1288182 100644
--- a/Doxyfile
+++ b/Doxyfile
@@ -84,7 +84,6 @@ WARN_LOGFILE           =
 #---------------------------------------------------------------------------
 INPUT                  = doc/src \
                          include \
-                         bindings/java \
                          examples
 FILE_PATTERNS          = *.h \
                          *.c \
diff --git a/Doxyfile.developer b/Doxyfile.developer
index 0bfb0da..c444652 100644
--- a/Doxyfile.developer
+++ b/Doxyfile.developer
@@ -1,243 +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 \
-                         bindings/java \
-                         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/README.configure.txt b/README.configure.txt
index b964cd5..6417d65 100644
--- a/README.configure.txt
+++ b/README.configure.txt
@@ -1,16 +1,26 @@
 PortAudio uses "autoconf" tools to generate Makefiles for Linux and Mac platforms.
 The source for these are configure.in and Makefile.in
 If you modify either of these files then please run this command before
-testing and checking in your changes.
+testing and checking in your changes. I run this command on Linux.
 
    autoreconf -if
 
+If you do not have autoreconf then do:
+   sudo apt-get install autoconf
+
+If you get error like "possibly undefined macro: AC_LIBTOOL_WIN32_DLL"
+then you try installing some more packages and then try again.
+
+   sudo apt-get install build-essential
+   sudo apt-get install pkg-config
+   sudo apt-get install libtool
+   autoreconf -if
+
 Then test a build by doing:
    
    ./configure
    make clean
    make
-   sudo make install
 
 then check in the related files that are modified.
 These might include files like:
diff --git a/aclocal.m4 b/aclocal.m4
index 8021aa2..85326be 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1,7 +1,7 @@
-# generated automatically by aclocal 1.11.1 -*- Autoconf -*-
+# generated automatically by aclocal 1.14.1 -*- Autoconf -*-
+
+# Copyright (C) 1996-2013 Free Software Foundation, Inc.
 
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-# 2005, 2006, 2007, 2008, 2009  Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -11,11 +11,12 @@
 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
 # PARTICULAR PURPOSE.
 
+m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
 # libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-
 #
 #   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
-#                 2006, 2007, 2008, 2009, 2010 Free Software Foundation,
-#                 Inc.
+#                 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+#                 Foundation, Inc.
 #   Written by Gordon Matzigkeit, 1996
 #
 # This file is free software; the Free Software Foundation gives
@@ -24,8 +25,8 @@
 
 m4_define([_LT_COPYING], [dnl
 #   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
-#                 2006, 2007, 2008, 2009, 2010 Free Software Foundation,
-#                 Inc.
+#                 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+#                 Foundation, Inc.
 #   Written by Gordon Matzigkeit, 1996
 #
 #   This file is part of GNU Libtool.
@@ -159,6 +160,8 @@ AC_REQUIRE([AC_CANONICAL_BUILD])dnl
 AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl
 AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl
 
+_LT_DECL([], [PATH_SEPARATOR], [1], [The PATH separator for the build system])dnl
+dnl
 _LT_DECL([], [host_alias], [0], [The host system])dnl
 _LT_DECL([], [host], [0])dnl
 _LT_DECL([], [host_os], [0])dnl
@@ -644,7 +647,7 @@ m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl
 m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION])
 configured by $[0], generated by m4_PACKAGE_STRING.
 
-Copyright (C) 2010 Free Software Foundation, Inc.
+Copyright (C) 2011 Free Software Foundation, Inc.
 This config.lt script is free software; the Free Software Foundation
 gives unlimited permision to copy, distribute and modify it."
 
@@ -808,6 +811,7 @@ AC_DEFUN([LT_LANG],
 m4_case([$1],
   [C],			[_LT_LANG(C)],
   [C++],		[_LT_LANG(CXX)],
+  [Go],			[_LT_LANG(GO)],
   [Java],		[_LT_LANG(GCJ)],
   [Fortran 77],		[_LT_LANG(F77)],
   [Fortran],		[_LT_LANG(FC)],
@@ -829,6 +833,29 @@ m4_defun([_LT_LANG],
 ])# _LT_LANG
 
 
+m4_ifndef([AC_PROG_GO], [
+# NOTE: This macro has been submitted for inclusion into   #
+#  GNU Autoconf as AC_PROG_GO.  When it is available in    #
+#  a released version of Autoconf we should remove this    #
+#  macro and use it instead.                               #
+m4_defun([AC_PROG_GO],
+[AC_LANG_PUSH(Go)dnl
+AC_ARG_VAR([GOC],     [Go compiler command])dnl
+AC_ARG_VAR([GOFLAGS], [Go compiler flags])dnl
+_AC_ARG_VAR_LDFLAGS()dnl
+AC_CHECK_TOOL(GOC, gccgo)
+if test -z "$GOC"; then
+  if test -n "$ac_tool_prefix"; then
+    AC_CHECK_PROG(GOC, [${ac_tool_prefix}gccgo], [${ac_tool_prefix}gccgo])
+  fi
+fi
+if test -z "$GOC"; then
+  AC_CHECK_PROG(GOC, gccgo, gccgo, false)
+fi
+])#m4_defun
+])#m4_ifndef
+
+
 # _LT_LANG_DEFAULT_CONFIG
 # -----------------------
 m4_defun([_LT_LANG_DEFAULT_CONFIG],
@@ -859,6 +886,10 @@ AC_PROVIDE_IFELSE([AC_PROG_GCJ],
        m4_ifdef([LT_PROG_GCJ],
 	[m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])])
 
+AC_PROVIDE_IFELSE([AC_PROG_GO],
+  [LT_LANG(GO)],
+  [m4_define([AC_PROG_GO], defn([AC_PROG_GO])[LT_LANG(GO)])])
+
 AC_PROVIDE_IFELSE([LT_PROG_RC],
   [LT_LANG(RC)],
   [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])])
@@ -961,7 +992,13 @@ m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[
 	$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
 	  -dynamiclib -Wl,-single_module conftest.c 2>conftest.err
         _lt_result=$?
-	if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then
+	# If there is a non-empty error log, and "single_module"
+	# appears in it, assume the flag caused a linker warning
+        if test -s conftest.err && $GREP single_module conftest.err; then
+	  cat conftest.err >&AS_MESSAGE_LOG_FD
+	# Otherwise, if the output was created with a 0 exit code from
+	# the compiler, it worked.
+	elif test -f libconftest.dylib && test $_lt_result -eq 0; then
 	  lt_cv_apple_cc_single_mod=yes
 	else
 	  cat conftest.err >&AS_MESSAGE_LOG_FD
@@ -969,6 +1006,7 @@ m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[
 	rm -rf libconftest.dylib*
 	rm -f conftest.*
       fi])
+
     AC_CACHE_CHECK([for -exported_symbols_list linker flag],
       [lt_cv_ld_exported_symbols_list],
       [lt_cv_ld_exported_symbols_list=no
@@ -980,6 +1018,7 @@ m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[
 	[lt_cv_ld_exported_symbols_list=no])
 	LDFLAGS="$save_LDFLAGS"
     ])
+
     AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load],
       [lt_cv_ld_force_load=no
       cat > conftest.c << _LT_EOF
@@ -997,7 +1036,9 @@ _LT_EOF
       echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD
       $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err
       _lt_result=$?
-      if test -f conftest && test ! -s conftest.err && test $_lt_result = 0 && $GREP forced_load conftest 2>&1 >/dev/null; then
+      if test -s conftest.err && $GREP force_load conftest.err; then
+	cat conftest.err >&AS_MESSAGE_LOG_FD
+      elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then
 	lt_cv_ld_force_load=yes
       else
 	cat conftest.err >&AS_MESSAGE_LOG_FD
@@ -1042,8 +1083,8 @@ _LT_EOF
 ])
 
 
-# _LT_DARWIN_LINKER_FEATURES
-# --------------------------
+# _LT_DARWIN_LINKER_FEATURES([TAG])
+# ---------------------------------
 # Checks for linker and compiler features on darwin
 m4_defun([_LT_DARWIN_LINKER_FEATURES],
 [
@@ -1054,6 +1095,8 @@ m4_defun([_LT_DARWIN_LINKER_FEATURES],
   _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
   if test "$lt_cv_ld_force_load" = "yes"; then
     _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
+    m4_case([$1], [F77], [_LT_TAGVAR(compiler_needs_object, $1)=yes],
+                  [FC],  [_LT_TAGVAR(compiler_needs_object, $1)=yes])
   else
     _LT_TAGVAR(whole_archive_flag_spec, $1)=''
   fi
@@ -1275,7 +1318,7 @@ ia64-*-hpux*)
   rm -rf conftest*
   ;;
 
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
 s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
   # Find out which ABI we are using.
   echo 'int i;' > conftest.$ac_ext
@@ -1287,9 +1330,19 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
 	    LD="${LD-ld} -m elf_i386_fbsd"
 	    ;;
 	  x86_64-*linux*)
-	    LD="${LD-ld} -m elf_i386"
+	    case `/usr/bin/file conftest.o` in
+	      *x86-64*)
+		LD="${LD-ld} -m elf32_x86_64"
+		;;
+	      *)
+		LD="${LD-ld} -m elf_i386"
+		;;
+	    esac
 	    ;;
-	  ppc64-*linux*|powerpc64-*linux*)
+	  powerpc64le-*)
+	    LD="${LD-ld} -m elf32lppclinux"
+	    ;;
+	  powerpc64-*)
 	    LD="${LD-ld} -m elf32ppclinux"
 	    ;;
 	  s390x-*linux*)
@@ -1308,7 +1361,10 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
 	  x86_64-*linux*)
 	    LD="${LD-ld} -m elf_x86_64"
 	    ;;
-	  ppc*-*linux*|powerpc*-*linux*)
+	  powerpcle-*)
+	    LD="${LD-ld} -m elf64lppc"
+	    ;;
+	  powerpc-*)
 	    LD="${LD-ld} -m elf64ppc"
 	    ;;
 	  s390*-*linux*|s390*-*tpf*)
@@ -1337,14 +1393,27 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
     CFLAGS="$SAVE_CFLAGS"
   fi
   ;;
-sparc*-*solaris*)
+*-*solaris*)
   # Find out which ABI we are using.
   echo 'int i;' > conftest.$ac_ext
   if AC_TRY_EVAL(ac_compile); then
     case `/usr/bin/file conftest.o` in
     *64-bit*)
       case $lt_cv_prog_gnu_ld in
-      yes*) LD="${LD-ld} -m elf64_sparc" ;;
+      yes*)
+        case $host in
+        i?86-*-solaris*)
+          LD="${LD-ld} -m elf_x86_64"
+          ;;
+        sparc*-*-solaris*)
+          LD="${LD-ld} -m elf64_sparc"
+          ;;
+        esac
+        # GNU ld 2.21 introduced _sol2 emulations.  Use them if available.
+        if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then
+          LD="${LD-ld}_sol2"
+        fi
+        ;;
       *)
 	if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then
 	  LD="${LD-ld} -64"
@@ -1421,13 +1490,13 @@ old_postuninstall_cmds=
 if test -n "$RANLIB"; then
   case $host_os in
   openbsd*)
-    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib"
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib"
     ;;
   *)
-    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib"
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib"
     ;;
   esac
-  old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
+  old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib"
 fi
 
 case $host_os in
@@ -1607,6 +1676,11 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
     lt_cv_sys_max_cmd_len=196608
     ;;
 
+  os2*)
+    # The test takes a long time on OS/2.
+    lt_cv_sys_max_cmd_len=8192
+    ;;
+
   osf*)
     # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
     # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
@@ -1633,7 +1707,8 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
     ;;
   *)
     lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`
-    if test -n "$lt_cv_sys_max_cmd_len"; then
+    if test -n "$lt_cv_sys_max_cmd_len" && \
+	test undefined != "$lt_cv_sys_max_cmd_len"; then
       lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
       lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
     else
@@ -1646,7 +1721,7 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
       # If test is not a shell built-in, we'll probably end up computing a
       # maximum length that is only half of the actual maximum length, but
       # we can't tell.
-      while { test "X"`func_fallback_echo "$teststring$teststring" 2>/dev/null` \
+      while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \
 	         = "X$teststring$teststring"; } >/dev/null 2>&1 &&
 	      test $i != 17 # 1/2 MB should be enough
       do
@@ -2192,7 +2267,7 @@ need_version=unknown
 
 case $host_os in
 aix3*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
   shlibpath_var=LIBPATH
 
@@ -2201,7 +2276,7 @@ aix3*)
   ;;
 
 aix[[4-9]]*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   hardcode_into_libs=yes
@@ -2266,7 +2341,7 @@ beos*)
   ;;
 
 bsdi[[45]]*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
   soname_spec='${libname}${release}${shared_ext}$major'
@@ -2405,7 +2480,7 @@ m4_if([$1], [],[
   ;;
 
 dgux*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
@@ -2413,10 +2488,6 @@ dgux*)
   shlibpath_var=LD_LIBRARY_PATH
   ;;
 
-freebsd1*)
-  dynamic_linker=no
-  ;;
-
 freebsd* | dragonfly*)
   # DragonFly does not have aout.  When/if they implement a new
   # versioning mechanism, adjust this.
@@ -2424,7 +2495,7 @@ freebsd* | dragonfly*)
     objformat=`/usr/bin/objformat`
   else
     case $host_os in
-    freebsd[[123]]*) objformat=aout ;;
+    freebsd[[23]].*) objformat=aout ;;
     *) objformat=elf ;;
     esac
   fi
@@ -2442,7 +2513,7 @@ freebsd* | dragonfly*)
   esac
   shlibpath_var=LD_LIBRARY_PATH
   case $host_os in
-  freebsd2*)
+  freebsd2.*)
     shlibpath_overrides_runpath=yes
     ;;
   freebsd3.[[01]]* | freebsdelf3.[[01]]*)
@@ -2461,19 +2532,8 @@ freebsd* | dragonfly*)
   esac
   ;;
 
-gnu*)
-  version_type=linux
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=no
-  hardcode_into_libs=yes
-  ;;
-
 haiku*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   dynamic_linker="$host_os runtime_loader"
@@ -2534,7 +2594,7 @@ hpux9* | hpux10* | hpux11*)
   ;;
 
 interix[[3-9]]*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
@@ -2550,7 +2610,7 @@ irix5* | irix6* | nonstopux*)
     nonstopux*) version_type=nonstopux ;;
     *)
 	if test "$lt_cv_prog_gnu_ld" = yes; then
-		version_type=linux
+		version_type=linux # correct to gnu/linux during the next big refactor
 	else
 		version_type=irix
 	fi ;;
@@ -2587,9 +2647,9 @@ linux*oldld* | linux*aout* | linux*coff*)
   dynamic_linker=no
   ;;
 
-# This must be Linux ELF.
-linux* | k*bsd*-gnu | kopensolaris*-gnu)
-  version_type=linux
+# This must be glibc/ELF.
+linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
@@ -2664,7 +2724,7 @@ netbsd*)
   ;;
 
 newsos6)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
   shlibpath_var=LD_LIBRARY_PATH
   shlibpath_overrides_runpath=yes
@@ -2733,7 +2793,7 @@ rdos*)
   ;;
 
 solaris*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
@@ -2758,7 +2818,7 @@ sunos4*)
   ;;
 
 sysv4 | sysv4.3*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
   soname_spec='${libname}${release}${shared_ext}$major'
   shlibpath_var=LD_LIBRARY_PATH
@@ -2782,7 +2842,7 @@ sysv4 | sysv4.3*)
 
 sysv4*MP*)
   if test -d /usr/nec ;then
-    version_type=linux
+    version_type=linux # correct to gnu/linux during the next big refactor
     library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
     soname_spec='$libname${shared_ext}.$major'
     shlibpath_var=LD_LIBRARY_PATH
@@ -2813,7 +2873,7 @@ sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
 
 tpf*)
   # TPF is a cross-target only.  Preferred cross-host = GNU/Linux.
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
@@ -2823,7 +2883,7 @@ tpf*)
   ;;
 
 uts4*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
   soname_spec='${libname}${release}${shared_ext}$major'
   shlibpath_var=LD_LIBRARY_PATH
@@ -3204,10 +3264,6 @@ freebsd* | dragonfly*)
   fi
   ;;
 
-gnu*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
-
 haiku*)
   lt_cv_deplibs_check_method=pass_all
   ;;
@@ -3245,8 +3301,8 @@ irix5* | irix6* | nonstopux*)
   lt_cv_deplibs_check_method=pass_all
   ;;
 
-# This must be Linux ELF.
-linux* | k*bsd*-gnu | kopensolaris*-gnu)
+# This must be glibc/ELF.
+linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
   lt_cv_deplibs_check_method=pass_all
   ;;
 
@@ -3665,6 +3721,7 @@ for ac_symprfx in "" "_"; do
     # which start with @ or ?.
     lt_cv_sys_global_symbol_pipe="$AWK ['"\
 "     {last_section=section; section=\$ 3};"\
+"     /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\
 "     /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\
 "     \$ 0!~/External *\|/{next};"\
 "     / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\
@@ -3997,7 +4054,7 @@ m4_if([$1], [CXX], [
 	    ;;
 	esac
 	;;
-      linux* | k*bsd*-gnu | kopensolaris*-gnu)
+      linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
 	case $cc_basename in
 	  KCC*)
 	    # KAI C++ Compiler
@@ -4249,7 +4306,9 @@ m4_if([$1], [CXX], [
     case $cc_basename in
     nvcc*) # Cuda Compiler Driver 2.2
       _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker '
-      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Xcompiler -fPIC'
+      if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then
+        _LT_TAGVAR(lt_prog_compiler_pic, $1)="-Xcompiler $_LT_TAGVAR(lt_prog_compiler_pic, $1)"
+      fi
       ;;
     esac
   else
@@ -4294,7 +4353,7 @@ m4_if([$1], [CXX], [
       _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
       ;;
 
-    linux* | k*bsd*-gnu | kopensolaris*-gnu)
+    linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
       case $cc_basename in
       # old Intel for x86_64 which still supported -KPIC.
       ecc*)
@@ -4341,18 +4400,33 @@ m4_if([$1], [CXX], [
 	;;
       *)
 	case `$CC -V 2>&1 | sed 5q` in
-	*Sun\ F* | *Sun*Fortran*)
+	*Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [[1-7]].* | *Sun*Fortran*\ 8.[[0-3]]*)
 	  # Sun Fortran 8.3 passes all unrecognized flags to the linker
 	  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
 	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
 	  _LT_TAGVAR(lt_prog_compiler_wl, $1)=''
 	  ;;
+	*Sun\ F* | *Sun*Fortran*)
+	  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	  _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+	  ;;
 	*Sun\ C*)
 	  # Sun C 5.9
 	  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
 	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
 	  _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
 	  ;;
+        *Intel*\ [[CF]]*Compiler*)
+	  _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+	  ;;
+	*Portland\ Group*)
+	  _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
+	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	  ;;
 	esac
 	;;
       esac
@@ -4512,7 +4586,9 @@ m4_if([$1], [CXX], [
     ;;
   cygwin* | mingw* | cegcc*)
     case $cc_basename in
-    cl*) ;;
+    cl*)
+      _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
+      ;;
     *)
       _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols'
       _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname']
@@ -4540,7 +4616,6 @@ m4_if([$1], [CXX], [
   _LT_TAGVAR(hardcode_direct, $1)=no
   _LT_TAGVAR(hardcode_direct_absolute, $1)=no
   _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
-  _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
   _LT_TAGVAR(hardcode_libdir_separator, $1)=
   _LT_TAGVAR(hardcode_minus_L, $1)=no
   _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
@@ -4794,8 +4869,7 @@ _LT_EOF
 	xlf* | bgf* | bgxlf* | mpixlf*)
 	  # IBM XL Fortran 10.1 on PPC cannot create shared libs itself
 	  _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive'
-	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
-	  _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir'
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
 	  _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib'
 	  if test "x$supports_anon_versioning" = xyes; then
 	    _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
@@ -5091,6 +5165,7 @@ _LT_EOF
 	# The linker will not automatically build a static lib if we build a DLL.
 	# _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
 	_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+	_LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
 	_LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols'
 	# Don't use ranlib
 	_LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'
@@ -5137,10 +5212,6 @@ _LT_EOF
       _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
       ;;
 
-    freebsd1*)
-      _LT_TAGVAR(ld_shlibs, $1)=no
-      ;;
-
     # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
     # support.  Future versions do this automatically, but an explicit c++rt0.o
     # does not break anything, and helps significantly (at the cost of a little
@@ -5153,7 +5224,7 @@ _LT_EOF
       ;;
 
     # Unfortunately, older versions of FreeBSD 2 do not have this feature.
-    freebsd2*)
+    freebsd2.*)
       _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
       _LT_TAGVAR(hardcode_direct, $1)=yes
       _LT_TAGVAR(hardcode_minus_L, $1)=yes
@@ -5192,7 +5263,6 @@ _LT_EOF
       fi
       if test "$with_gnu_ld" = no; then
 	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
-	_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir'
 	_LT_TAGVAR(hardcode_libdir_separator, $1)=:
 	_LT_TAGVAR(hardcode_direct, $1)=yes
 	_LT_TAGVAR(hardcode_direct_absolute, $1)=yes
@@ -5634,9 +5704,6 @@ _LT_TAGDECL([], [no_undefined_flag], [1],
 _LT_TAGDECL([], [hardcode_libdir_flag_spec], [1],
     [Flag to hardcode $libdir into a binary during linking.
     This must work even if $libdir does not exist])
-_LT_TAGDECL([], [hardcode_libdir_flag_spec_ld], [1],
-    [[If ld is used when linking, flag to hardcode $libdir into a binary
-    during linking.  This must work even if $libdir does not exist]])
 _LT_TAGDECL([], [hardcode_libdir_separator], [1],
     [Whether we need a single "-rpath" flag with a separated argument])
 _LT_TAGDECL([], [hardcode_direct], [0],
@@ -5790,7 +5857,6 @@ _LT_TAGVAR(export_dynamic_flag_spec, $1)=
 _LT_TAGVAR(hardcode_direct, $1)=no
 _LT_TAGVAR(hardcode_direct_absolute, $1)=no
 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
-_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
 _LT_TAGVAR(hardcode_libdir_separator, $1)=
 _LT_TAGVAR(hardcode_minus_L, $1)=no
 _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
@@ -6160,7 +6226,7 @@ if test "$_lt_caught_CXX_error" != yes; then
         esac
         ;;
 
-      freebsd[[12]]*)
+      freebsd2.*)
         # C++ shared libraries reported to be fairly broken before
 	# switch to ELF
         _LT_TAGVAR(ld_shlibs, $1)=no
@@ -6176,9 +6242,6 @@ if test "$_lt_caught_CXX_error" != yes; then
         _LT_TAGVAR(ld_shlibs, $1)=yes
         ;;
 
-      gnu*)
-        ;;
-
       haiku*)
         _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
         _LT_TAGVAR(link_all_deplibs, $1)=yes
@@ -6340,7 +6403,7 @@ if test "$_lt_caught_CXX_error" != yes; then
         _LT_TAGVAR(inherit_rpath, $1)=yes
         ;;
 
-      linux* | k*bsd*-gnu | kopensolaris*-gnu)
+      linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
         case $cc_basename in
           KCC*)
 	    # Kuck and Associates, Inc. (KAI) C++ Compiler
@@ -6921,12 +6984,18 @@ public class foo {
   }
 };
 _LT_EOF
+], [$1], [GO], [cat > conftest.$ac_ext <<_LT_EOF
+package foo
+func foo() {
+}
+_LT_EOF
 ])
 
 _lt_libdeps_save_CFLAGS=$CFLAGS
 case "$CC $CFLAGS " in #(
 *\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;;
 *\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;;
+*\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;;
 esac
 
 dnl Parse the compiler output and extract the necessary
@@ -7123,7 +7192,6 @@ _LT_TAGVAR(export_dynamic_flag_spec, $1)=
 _LT_TAGVAR(hardcode_direct, $1)=no
 _LT_TAGVAR(hardcode_direct_absolute, $1)=no
 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
-_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
 _LT_TAGVAR(hardcode_libdir_separator, $1)=
 _LT_TAGVAR(hardcode_minus_L, $1)=no
 _LT_TAGVAR(hardcode_automatic, $1)=no
@@ -7256,7 +7324,6 @@ _LT_TAGVAR(export_dynamic_flag_spec, $1)=
 _LT_TAGVAR(hardcode_direct, $1)=no
 _LT_TAGVAR(hardcode_direct_absolute, $1)=no
 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
-_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
 _LT_TAGVAR(hardcode_libdir_separator, $1)=
 _LT_TAGVAR(hardcode_minus_L, $1)=no
 _LT_TAGVAR(hardcode_automatic, $1)=no
@@ -7439,6 +7506,73 @@ CFLAGS=$lt_save_CFLAGS
 ])# _LT_LANG_GCJ_CONFIG
 
 
+# _LT_LANG_GO_CONFIG([TAG])
+# --------------------------
+# Ensure that the configuration variables for the GNU Go compiler
+# are suitably defined.  These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_GO_CONFIG],
+[AC_REQUIRE([LT_PROG_GO])dnl
+AC_LANG_SAVE
+
+# Source file extension for Go test sources.
+ac_ext=go
+
+# Object file extension for compiled Go test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="package main; func main() { }"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='package main; func main() { }'
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_TAG_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC=$CC
+lt_save_CFLAGS=$CFLAGS
+lt_save_GCC=$GCC
+GCC=yes
+CC=${GOC-"gccgo"}
+CFLAGS=$GOFLAGS
+compiler=$CC
+_LT_TAGVAR(compiler, $1)=$CC
+_LT_TAGVAR(LD, $1)="$LD"
+_LT_CC_BASENAME([$compiler])
+
+# Go did not exist at the time GCC didn't implicitly link libc in.
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(reload_flag, $1)=$reload_flag
+_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
+
+if test -n "$compiler"; then
+  _LT_COMPILER_NO_RTTI($1)
+  _LT_COMPILER_PIC($1)
+  _LT_COMPILER_C_O($1)
+  _LT_COMPILER_FILE_LOCKS($1)
+  _LT_LINKER_SHLIBS($1)
+  _LT_LINKER_HARDCODE_LIBPATH($1)
+
+  _LT_CONFIG($1)
+fi
+
+AC_LANG_RESTORE
+
+GCC=$lt_save_GCC
+CC=$lt_save_CC
+CFLAGS=$lt_save_CFLAGS
+])# _LT_LANG_GO_CONFIG
+
+
 # _LT_LANG_RC_CONFIG([TAG])
 # -------------------------
 # Ensure that the configuration variables for the Windows resource compiler
@@ -7508,6 +7642,13 @@ dnl aclocal-1.4 backwards compatibility:
 dnl AC_DEFUN([LT_AC_PROG_GCJ], [])
 
 
+# LT_PROG_GO
+# ----------
+AC_DEFUN([LT_PROG_GO],
+[AC_CHECK_TOOL(GOC, gccgo,)
+])
+
+
 # LT_PROG_RC
 # ----------
 AC_DEFUN([LT_PROG_RC],
@@ -8172,9 +8313,24 @@ dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], [])
 # MODE is either `yes' or `no'.  If omitted, it defaults to `both'.
 m4_define([_LT_WITH_PIC],
 [AC_ARG_WITH([pic],
-    [AS_HELP_STRING([--with-pic],
+    [AS_HELP_STRING([--with-pic@<:@=PKGS@:>@],
 	[try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
-    [pic_mode="$withval"],
+    [lt_p=${PACKAGE-default}
+    case $withval in
+    yes|no) pic_mode=$withval ;;
+    *)
+      pic_mode=default
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for lt_pkg in $withval; do
+	IFS="$lt_save_ifs"
+	if test "X$lt_pkg" = "X$lt_p"; then
+	  pic_mode=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac],
     [pic_mode=default])
 
 test -z "$pic_mode" && pic_mode=m4_default([$1], [default])
@@ -8346,15 +8502,15 @@ m4_define([lt_dict_filter],
 
 # @configure_input@
 
-# serial 3293 ltversion.m4
+# serial 3337 ltversion.m4
 # This file is part of GNU Libtool
 
-m4_define([LT_PACKAGE_VERSION], [2.4])
-m4_define([LT_PACKAGE_REVISION], [1.3293])
+m4_define([LT_PACKAGE_VERSION], [2.4.2])
+m4_define([LT_PACKAGE_REVISION], [1.3337])
 
 AC_DEFUN([LTVERSION_VERSION],
-[macro_version='2.4'
-macro_revision='1.3293'
+[macro_version='2.4.2'
+macro_revision='1.3337'
 _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
 _LT_DECL(, macro_revision, 0)
 ])
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/INSTALL b/bindings/cpp/INSTALL
index 7d1c323..2099840 100644
--- a/bindings/cpp/INSTALL
+++ b/bindings/cpp/INSTALL
@@ -1,8 +1,8 @@
 Installation Instructions
 *************************
 
-Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
-2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+Copyright (C) 1994-1996, 1999-2002, 2004-2013 Free Software Foundation,
+Inc.
 
    Copying and distribution of this file, with or without modification,
 are permitted in any medium without royalty provided the copyright
@@ -12,8 +12,8 @@ without warranty of any kind.
 Basic Installation
 ==================
 
-   Briefly, the shell commands `./configure; make; make install' should
-configure, build, and install this package.  The following
+   Briefly, the shell command `./configure && make && make install'
+should configure, build, and install this package.  The following
 more-detailed instructions are generic; see the `README' file for
 instructions specific to this package.  Some packages provide this
 `INSTALL' file but do not implement all of the features documented
@@ -226,6 +226,11 @@ order to use an ANSI C compiler:
 
 and if that doesn't work, install pre-built binaries of GCC for HP-UX.
 
+   HP-UX `make' updates targets which have the same time stamps as
+their prerequisites, which makes it generally unusable when shipped
+generated files such as `configure' are involved.  Use GNU `make'
+instead.
+
    On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
 parse its `<wchar.h>' header file.  The option `-nodtk' can be used as
 a workaround.  If GNU CC is not installed, it is therefore recommended
@@ -304,9 +309,10 @@ causes the specified `gcc' to be used as the C compiler (unless it is
 overridden in the site shell script).
 
 Unfortunately, this technique does not work for `CONFIG_SHELL' due to
-an Autoconf bug.  Until the bug is fixed you can use this workaround:
+an Autoconf limitation.  Until the limitation is lifted, you can use
+this workaround:
 
-     CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
+     CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash
 
 `configure' Invocation
 ======================
@@ -362,4 +368,3 @@ operates.
 
 `configure' also accepts some other, not widely useful, options.  Run
 `configure --help' for more details.
-
diff --git a/bindings/cpp/Makefile.in b/bindings/cpp/Makefile.in
index 99a4e74..a397933 100644
--- a/bindings/cpp/Makefile.in
+++ b/bindings/cpp/Makefile.in
@@ -1,9 +1,8 @@
-# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# Makefile.in generated by automake 1.14.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
-# Inc.
+# Copyright (C) 1994-2013 Free Software Foundation, Inc.
+
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -16,6 +15,51 @@
 @SET_MAKE@
 
 VPATH = @srcdir@
+am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+am__make_running_with_option = \
+  case $${target_option-} in \
+      ?) ;; \
+      *) echo "am__make_running_with_option: internal error: invalid" \
+              "target option '$${target_option-}' specified" >&2; \
+         exit 1;; \
+  esac; \
+  has_opt=no; \
+  sane_makeflags=$$MAKEFLAGS; \
+  if $(am__is_gnu_make); then \
+    sane_makeflags=$$MFLAGS; \
+  else \
+    case $$MAKEFLAGS in \
+      *\\[\ \	]*) \
+        bs=\\; \
+        sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+          | sed "s/$$bs$$bs[$$bs $$bs	]*//g"`;; \
+    esac; \
+  fi; \
+  skip_next=no; \
+  strip_trailopt () \
+  { \
+    flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+  }; \
+  for flg in $$sane_makeflags; do \
+    test $$skip_next = yes && { skip_next=no; continue; }; \
+    case $$flg in \
+      *=*|--*) continue;; \
+        -*I) strip_trailopt 'I'; skip_next=yes;; \
+      -*I?*) strip_trailopt 'I';; \
+        -*O) strip_trailopt 'O'; skip_next=yes;; \
+      -*O?*) strip_trailopt 'O';; \
+        -*l) strip_trailopt 'l'; skip_next=yes;; \
+      -*l?*) strip_trailopt 'l';; \
+      -[dEDm]) skip_next=yes;; \
+      -[JT]) skip_next=yes;; \
+    esac; \
+    case $$flg in \
+      *$$target_option*) has_opt=yes; break;; \
+    esac; \
+  done; \
+  test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
 pkgdatadir = $(datadir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
@@ -35,12 +79,13 @@ POST_UNINSTALL = :
 build_triplet = @build@
 host_triplet = @host@
 subdir = .
-DIST_COMMON = README $(am__configure_deps) \
-	$(srcdir)/../../config.guess $(srcdir)/../../config.sub \
-	$(srcdir)/../../install-sh $(srcdir)/../../ltmain.sh \
-	$(srcdir)/../../missing $(srcdir)/Makefile.am \
-	$(srcdir)/Makefile.in $(srcdir)/portaudiocpp.pc.in \
-	$(top_srcdir)/configure AUTHORS COPYING ChangeLog INSTALL NEWS
+DIST_COMMON = INSTALL NEWS README AUTHORS ChangeLog \
+	$(srcdir)/Makefile.in $(srcdir)/Makefile.am \
+	$(top_srcdir)/configure $(am__configure_deps) \
+	$(srcdir)/portaudiocpp.pc.in COPYING \
+	$(top_srcdir)/../../compile $(top_srcdir)/../../config.guess \
+	$(top_srcdir)/../../config.sub $(top_srcdir)/../../install-sh \
+	$(top_srcdir)/../../ltmain.sh $(top_srcdir)/../../missing
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
@@ -50,15 +95,33 @@ am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
 mkinstalldirs = $(install_sh) -d
 CONFIG_CLEAN_FILES = portaudiocpp.pc
 CONFIG_CLEAN_VPATH_FILES =
+AM_V_P = $(am__v_P_ at AM_V@)
+am__v_P_ = $(am__v_P_ at AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_ at AM_V@)
+am__v_GEN_ = $(am__v_GEN_ at AM_DEFAULT_V@)
+am__v_GEN_0 = @echo "  GEN     " $@;
+am__v_GEN_1 = 
+AM_V_at = $(am__v_at_ at AM_V@)
+am__v_at_ = $(am__v_at_ at AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 = 
 SOURCES =
 DIST_SOURCES =
-RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
-	html-recursive info-recursive install-data-recursive \
-	install-dvi-recursive install-exec-recursive \
-	install-html-recursive install-info-recursive \
-	install-pdf-recursive install-ps-recursive install-recursive \
-	installcheck-recursive installdirs-recursive pdf-recursive \
-	ps-recursive uninstall-recursive
+RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \
+	ctags-recursive dvi-recursive html-recursive info-recursive \
+	install-data-recursive install-dvi-recursive \
+	install-exec-recursive install-html-recursive \
+	install-info-recursive install-pdf-recursive \
+	install-ps-recursive install-recursive installcheck-recursive \
+	installdirs-recursive pdf-recursive ps-recursive \
+	tags-recursive uninstall-recursive
+am__can_run_installinfo = \
+  case $$AM_UPDATE_INFO_DIR in \
+    n|no|NO) false;; \
+    *) (install-info --version) >/dev/null 2>&1;; \
+  esac
 am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
 am__vpath_adj = case $$p in \
     $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
@@ -80,23 +143,53 @@ am__nobase_list = $(am__nobase_strip_setup); \
 am__base_list = \
   sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
   sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+  test -z "$$files" \
+    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+         $(am__cd) "$$dir" && rm -f $$files; }; \
+  }
 am__installdirs = "$(DESTDIR)$(pkgconfigdir)"
 DATA = $(pkgconfig_DATA)
 RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive	\
   distclean-recursive maintainer-clean-recursive
-AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
-	$(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
-	distdir dist dist-all distcheck
+am__recursive_targets = \
+  $(RECURSIVE_TARGETS) \
+  $(RECURSIVE_CLEAN_TARGETS) \
+  $(am__extra_recursive_targets)
+AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \
+	cscope distdir dist dist-all distcheck
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates.  Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+  BEGIN { nonempty = 0; } \
+  { items[$$0] = 1; nonempty = 1; } \
+  END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique.  This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+  list='$(am__tagged_files)'; \
+  unique=`for i in $$list; do \
+    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+  done | $(am__uniquify_input)`
 ETAGS = etags
 CTAGS = ctags
+CSCOPE = cscope
 DIST_SUBDIRS = $(SUBDIRS)
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 distdir = $(PACKAGE)-$(VERSION)
 top_distdir = $(distdir)
 am__remove_distdir = \
-  { test ! -d "$(distdir)" \
-    || { find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
-         && rm -fr "$(distdir)"; }; }
+  if test -d "$(distdir)"; then \
+    find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
+      && rm -rf "$(distdir)" \
+      || { sleep 5 && rm -rf "$(distdir)"; }; \
+  else :; fi
+am__post_remove_distdir = $(am__remove_distdir)
 am__relativize = \
   dir0=`pwd`; \
   sed_first='s,^\([^/]*\)/.*$$,\1,'; \
@@ -124,10 +217,14 @@ am__relativize = \
   reldir="$$dir2"
 DIST_ARCHIVES = $(distdir).tar.gz
 GZIP_ENV = --best
+DIST_TARGETS = dist-gzip
 distuninstallcheck_listfiles = find . -type f -print
+am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
+  | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$'
 distcleancheck_listfiles = find . -type f -print
 ACLOCAL = @ACLOCAL@
 AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
 AR = @AR@
 AS = @AS@
 AUTOCONF = @AUTOCONF@
@@ -257,7 +354,7 @@ pkgconfig_DATA = portaudiocpp.pc
 all: all-recursive
 
 .SUFFIXES:
-am--refresh:
+am--refresh: Makefile
 	@:
 $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
 	@for dep in $?; do \
@@ -304,8 +401,11 @@ distclean-libtool:
 	-rm -f libtool config.lt
 install-pkgconfigDATA: $(pkgconfig_DATA)
 	@$(NORMAL_INSTALL)
-	test -z "$(pkgconfigdir)" || $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)"
 	@list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \
+	if test -n "$$list"; then \
+	  echo " $(MKDIR_P) '$(DESTDIR)$(pkgconfigdir)'"; \
+	  $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" || exit 1; \
+	fi; \
 	for p in $$list; do \
 	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
 	  echo "$$d$$p"; \
@@ -319,27 +419,28 @@ uninstall-pkgconfigDATA:
 	@$(NORMAL_UNINSTALL)
 	@list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \
 	files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
-	test -n "$$files" || exit 0; \
-	echo " ( cd '$(DESTDIR)$(pkgconfigdir)' && rm -f" $$files ")"; \
-	cd "$(DESTDIR)$(pkgconfigdir)" && rm -f $$files
+	dir='$(DESTDIR)$(pkgconfigdir)'; $(am__uninstall_files_from_dir)
 
 # This directory's subdirectories are mostly independent; you can cd
-# into them and run `make' without going through this Makefile.
-# To change the values of `make' variables: instead of editing Makefiles,
-# (1) if the variable is set in `config.status', edit `config.status'
-#     (which will cause the Makefiles to be regenerated when you run `make');
-# (2) otherwise, pass the desired values on the `make' command line.
-$(RECURSIVE_TARGETS):
-	@fail= failcom='exit 1'; \
-	for f in x $$MAKEFLAGS; do \
-	  case $$f in \
-	    *=* | --[!k]*);; \
-	    *k*) failcom='fail=yes';; \
-	  esac; \
-	done; \
+# into them and run 'make' without going through this Makefile.
+# To change the values of 'make' variables: instead of editing Makefiles,
+# (1) if the variable is set in 'config.status', edit 'config.status'
+#     (which will cause the Makefiles to be regenerated when you run 'make');
+# (2) otherwise, pass the desired values on the 'make' command line.
+$(am__recursive_targets):
+	@fail=; \
+	if $(am__make_keepgoing); then \
+	  failcom='fail=yes'; \
+	else \
+	  failcom='exit 1'; \
+	fi; \
 	dot_seen=no; \
 	target=`echo $@ | sed s/-recursive//`; \
-	list='$(SUBDIRS)'; for subdir in $$list; do \
+	case "$@" in \
+	  distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+	  *) list='$(SUBDIRS)' ;; \
+	esac; \
+	for subdir in $$list; do \
 	  echo "Making $$target in $$subdir"; \
 	  if test "$$subdir" = "."; then \
 	    dot_seen=yes; \
@@ -354,57 +455,12 @@ $(RECURSIVE_TARGETS):
 	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
 	fi; test -z "$$fail"
 
-$(RECURSIVE_CLEAN_TARGETS):
-	@fail= failcom='exit 1'; \
-	for f in x $$MAKEFLAGS; do \
-	  case $$f in \
-	    *=* | --[!k]*);; \
-	    *k*) failcom='fail=yes';; \
-	  esac; \
-	done; \
-	dot_seen=no; \
-	case "$@" in \
-	  distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
-	  *) list='$(SUBDIRS)' ;; \
-	esac; \
-	rev=''; for subdir in $$list; do \
-	  if test "$$subdir" = "."; then :; else \
-	    rev="$$subdir $$rev"; \
-	  fi; \
-	done; \
-	rev="$$rev ."; \
-	target=`echo $@ | sed s/-recursive//`; \
-	for subdir in $$rev; do \
-	  echo "Making $$target in $$subdir"; \
-	  if test "$$subdir" = "."; then \
-	    local_target="$$target-am"; \
-	  else \
-	    local_target="$$target"; \
-	  fi; \
-	  ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
-	  || eval $$failcom; \
-	done && test -z "$$fail"
-tags-recursive:
-	list='$(SUBDIRS)'; for subdir in $$list; do \
-	  test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
-	done
-ctags-recursive:
-	list='$(SUBDIRS)'; for subdir in $$list; do \
-	  test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
-	done
+ID: $(am__tagged_files)
+	$(am__define_uniq_tagged_files); mkid -fID $$unique
+tags: tags-recursive
+TAGS: tags
 
-ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
-	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
-	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	mkid -fID $$unique
-tags: TAGS
-
-TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
-		$(TAGS_FILES) $(LISP)
+tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
 	set x; \
 	here=`pwd`; \
 	if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
@@ -420,12 +476,7 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 	      set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
 	  fi; \
 	done; \
-	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
-	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	$(am__define_uniq_tagged_files); \
 	shift; \
 	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
 	  test -n "$$unique" || unique=$$empty_fix; \
@@ -437,15 +488,11 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 	      $$unique; \
 	  fi; \
 	fi
-ctags: CTAGS
-CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
-		$(TAGS_FILES) $(LISP)
-	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
-	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+ctags: ctags-recursive
+
+CTAGS: ctags
+ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+	$(am__define_uniq_tagged_files); \
 	test -z "$(CTAGS_ARGS)$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
 	     $$unique
@@ -454,9 +501,31 @@ GTAGS:
 	here=`$(am__cd) $(top_builddir) && pwd` \
 	  && $(am__cd) $(top_srcdir) \
 	  && gtags -i $(GTAGS_ARGS) "$$here"
+cscope: cscope.files
+	test ! -s cscope.files \
+	  || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS)
+clean-cscope:
+	-rm -f cscope.files
+cscope.files: clean-cscope cscopelist
+cscopelist: cscopelist-recursive
+
+cscopelist-am: $(am__tagged_files)
+	list='$(am__tagged_files)'; \
+	case "$(srcdir)" in \
+	  [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+	  *) sdir=$(subdir)/$(srcdir) ;; \
+	esac; \
+	for i in $$list; do \
+	  if test -f "$$i"; then \
+	    echo "$(subdir)/$$i"; \
+	  else \
+	    echo "$$sdir/$$i"; \
+	  fi; \
+	done >> $(top_builddir)/cscope.files
 
 distclean-tags:
 	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+	-rm -f cscope.out cscope.in.out cscope.po.out cscope.files
 
 distdir: $(DISTFILES)
 	$(am__remove_distdir)
@@ -492,13 +561,10 @@ distdir: $(DISTFILES)
 	done
 	@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
 	  if test "$$subdir" = .; then :; else \
-	    test -d "$(distdir)/$$subdir" \
-	    || $(MKDIR_P) "$(distdir)/$$subdir" \
-	    || exit 1; \
-	  fi; \
-	done
-	@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
-	  if test "$$subdir" = .; then :; else \
+	    $(am__make_dryrun) \
+	      || test -d "$(distdir)/$$subdir" \
+	      || $(MKDIR_P) "$(distdir)/$$subdir" \
+	      || exit 1; \
 	    dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
 	    $(am__relativize); \
 	    new_distdir=$$reldir; \
@@ -527,36 +593,42 @@ distdir: $(DISTFILES)
 	|| chmod -R a+r "$(distdir)"
 dist-gzip: distdir
 	tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
-	$(am__remove_distdir)
+	$(am__post_remove_distdir)
 
 dist-bzip2: distdir
-	tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
-	$(am__remove_distdir)
+	tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2
+	$(am__post_remove_distdir)
 
-dist-lzma: distdir
-	tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma
-	$(am__remove_distdir)
+dist-lzip: distdir
+	tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz
+	$(am__post_remove_distdir)
 
 dist-xz: distdir
-	tardir=$(distdir) && $(am__tar) | xz -c >$(distdir).tar.xz
-	$(am__remove_distdir)
+	tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz
+	$(am__post_remove_distdir)
 
 dist-tarZ: distdir
+	@echo WARNING: "Support for shar distribution archives is" \
+	               "deprecated." >&2
+	@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
 	tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
-	$(am__remove_distdir)
+	$(am__post_remove_distdir)
 
 dist-shar: distdir
+	@echo WARNING: "Support for distribution archives compressed with" \
+		       "legacy program 'compress' is deprecated." >&2
+	@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
 	shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
-	$(am__remove_distdir)
+	$(am__post_remove_distdir)
 
 dist-zip: distdir
 	-rm -f $(distdir).zip
 	zip -rq $(distdir).zip $(distdir)
-	$(am__remove_distdir)
+	$(am__post_remove_distdir)
 
-dist dist-all: distdir
-	tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
-	$(am__remove_distdir)
+dist dist-all:
+	$(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:'
+	$(am__post_remove_distdir)
 
 # This target untars the dist file and tries a VPATH configuration.  Then
 # it guarantees that the distribution is self-contained by making another
@@ -567,8 +639,8 @@ distcheck: dist
 	  GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
 	*.tar.bz2*) \
 	  bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
-	*.tar.lzma*) \
-	  lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\
+	*.tar.lz*) \
+	  lzip -dc $(distdir).tar.lz | $(am__untar) ;;\
 	*.tar.xz*) \
 	  xz -dc $(distdir).tar.xz | $(am__untar) ;;\
 	*.tar.Z*) \
@@ -578,17 +650,19 @@ distcheck: dist
 	*.zip*) \
 	  unzip $(distdir).zip ;;\
 	esac
-	chmod -R a-w $(distdir); chmod a+w $(distdir)
-	mkdir $(distdir)/_build
-	mkdir $(distdir)/_inst
+	chmod -R a-w $(distdir)
+	chmod u+w $(distdir)
+	mkdir $(distdir)/_build $(distdir)/_inst
 	chmod a-w $(distdir)
 	test -d $(distdir)/_build || exit 0; \
 	dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
 	  && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
 	  && am__cwd=`pwd` \
 	  && $(am__cd) $(distdir)/_build \
-	  && ../configure --srcdir=.. --prefix="$$dc_install_base" \
+	  && ../configure \
+	    $(AM_DISTCHECK_CONFIGURE_FLAGS) \
 	    $(DISTCHECK_CONFIGURE_FLAGS) \
+	    --srcdir=.. --prefix="$$dc_install_base" \
 	  && $(MAKE) $(AM_MAKEFLAGS) \
 	  && $(MAKE) $(AM_MAKEFLAGS) dvi \
 	  && $(MAKE) $(AM_MAKEFLAGS) check \
@@ -611,13 +685,21 @@ distcheck: dist
 	  && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \
 	  && cd "$$am__cwd" \
 	  || exit 1
-	$(am__remove_distdir)
+	$(am__post_remove_distdir)
 	@(echo "$(distdir) archives ready for distribution: "; \
 	  list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
 	  sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
 distuninstallcheck:
-	@$(am__cd) '$(distuninstallcheck_dir)' \
-	&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
+	@test -n '$(distuninstallcheck_dir)' || { \
+	  echo 'ERROR: trying to run $@ with an empty' \
+	       '$$(distuninstallcheck_dir)' >&2; \
+	  exit 1; \
+	}; \
+	$(am__cd) '$(distuninstallcheck_dir)' || { \
+	  echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \
+	  exit 1; \
+	}; \
+	test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \
 	   || { echo "ERROR: files left after uninstall:" ; \
 	        if test -n "$(DESTDIR)"; then \
 	          echo "  (check DESTDIR support)"; \
@@ -651,10 +733,15 @@ install-am: all-am
 
 installcheck: installcheck-recursive
 install-strip:
-	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	  `test -z '$(STRIP)' || \
-	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
 mostlyclean-generic:
 
 clean-generic:
@@ -736,25 +823,24 @@ ps-am:
 
 uninstall-am: uninstall-pkgconfigDATA
 
-.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \
-	install-am install-strip tags-recursive
-
-.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
-	all all-am am--refresh check check-am clean clean-generic \
-	clean-libtool ctags ctags-recursive dist dist-all dist-bzip2 \
-	dist-gzip dist-lzma dist-shar dist-tarZ dist-xz dist-zip \
-	distcheck distclean distclean-generic distclean-libtool \
-	distclean-tags distcleancheck distdir distuninstallcheck dvi \
-	dvi-am html html-am info info-am install install-am \
-	install-data install-data-am install-dvi install-dvi-am \
-	install-exec install-exec-am install-html install-html-am \
-	install-info install-info-am install-man install-pdf \
-	install-pdf-am install-pkgconfigDATA install-ps install-ps-am \
-	install-strip installcheck installcheck-am installdirs \
-	installdirs-am maintainer-clean maintainer-clean-generic \
-	mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
-	ps ps-am tags tags-recursive uninstall uninstall-am \
-	uninstall-pkgconfigDATA
+.MAKE: $(am__recursive_targets) install-am install-strip
+
+.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \
+	am--refresh check check-am clean clean-cscope clean-generic \
+	clean-libtool cscope cscopelist-am ctags ctags-am dist \
+	dist-all dist-bzip2 dist-gzip dist-lzip dist-shar dist-tarZ \
+	dist-xz dist-zip distcheck distclean distclean-generic \
+	distclean-libtool distclean-tags distcleancheck distdir \
+	distuninstallcheck dvi dvi-am html html-am info info-am \
+	install install-am install-data install-data-am install-dvi \
+	install-dvi-am install-exec install-exec-am install-html \
+	install-html-am install-info install-info-am install-man \
+	install-pdf install-pdf-am install-pkgconfigDATA install-ps \
+	install-ps-am install-strip installcheck installcheck-am \
+	installdirs installdirs-am maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-generic \
+	mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \
+	uninstall-am uninstall-pkgconfigDATA
 
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
diff --git a/bindings/cpp/aclocal.m4 b/bindings/cpp/aclocal.m4
index 4719332..68c908f 100644
--- a/bindings/cpp/aclocal.m4
+++ b/bindings/cpp/aclocal.m4
@@ -1,7 +1,7 @@
-# generated automatically by aclocal 1.11.1 -*- Autoconf -*-
+# generated automatically by aclocal 1.14.1 -*- Autoconf -*-
+
+# Copyright (C) 1996-2013 Free Software Foundation, Inc.
 
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-# 2005, 2006, 2007, 2008, 2009  Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -11,19 +11,20 @@
 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
 # PARTICULAR PURPOSE.
 
+m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
 m4_ifndef([AC_AUTOCONF_VERSION],
   [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
-m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,
-[m4_warning([this file was generated for autoconf 2.68.
+m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
+[m4_warning([this file was generated for autoconf 2.69.
 You have another version of autoconf.  It may work, but is not guaranteed to.
 If you have problems, you may need to regenerate the build system entirely.
-To do so, use the procedure documented by the package, typically `autoreconf'.])])
+To do so, use the procedure documented by the package, typically 'autoreconf'.])])
 
 # libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-
 #
 #   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
-#                 2006, 2007, 2008, 2009, 2010 Free Software Foundation,
-#                 Inc.
+#                 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+#                 Foundation, Inc.
 #   Written by Gordon Matzigkeit, 1996
 #
 # This file is free software; the Free Software Foundation gives
@@ -32,8 +33,8 @@ To do so, use the procedure documented by the package, typically `autoreconf'.])
 
 m4_define([_LT_COPYING], [dnl
 #   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
-#                 2006, 2007, 2008, 2009, 2010 Free Software Foundation,
-#                 Inc.
+#                 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+#                 Foundation, Inc.
 #   Written by Gordon Matzigkeit, 1996
 #
 #   This file is part of GNU Libtool.
@@ -167,6 +168,8 @@ AC_REQUIRE([AC_CANONICAL_BUILD])dnl
 AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl
 AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl
 
+_LT_DECL([], [PATH_SEPARATOR], [1], [The PATH separator for the build system])dnl
+dnl
 _LT_DECL([], [host_alias], [0], [The host system])dnl
 _LT_DECL([], [host], [0])dnl
 _LT_DECL([], [host_os], [0])dnl
@@ -652,7 +655,7 @@ m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl
 m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION])
 configured by $[0], generated by m4_PACKAGE_STRING.
 
-Copyright (C) 2010 Free Software Foundation, Inc.
+Copyright (C) 2011 Free Software Foundation, Inc.
 This config.lt script is free software; the Free Software Foundation
 gives unlimited permision to copy, distribute and modify it."
 
@@ -816,6 +819,7 @@ AC_DEFUN([LT_LANG],
 m4_case([$1],
   [C],			[_LT_LANG(C)],
   [C++],		[_LT_LANG(CXX)],
+  [Go],			[_LT_LANG(GO)],
   [Java],		[_LT_LANG(GCJ)],
   [Fortran 77],		[_LT_LANG(F77)],
   [Fortran],		[_LT_LANG(FC)],
@@ -837,6 +841,29 @@ m4_defun([_LT_LANG],
 ])# _LT_LANG
 
 
+m4_ifndef([AC_PROG_GO], [
+# NOTE: This macro has been submitted for inclusion into   #
+#  GNU Autoconf as AC_PROG_GO.  When it is available in    #
+#  a released version of Autoconf we should remove this    #
+#  macro and use it instead.                               #
+m4_defun([AC_PROG_GO],
+[AC_LANG_PUSH(Go)dnl
+AC_ARG_VAR([GOC],     [Go compiler command])dnl
+AC_ARG_VAR([GOFLAGS], [Go compiler flags])dnl
+_AC_ARG_VAR_LDFLAGS()dnl
+AC_CHECK_TOOL(GOC, gccgo)
+if test -z "$GOC"; then
+  if test -n "$ac_tool_prefix"; then
+    AC_CHECK_PROG(GOC, [${ac_tool_prefix}gccgo], [${ac_tool_prefix}gccgo])
+  fi
+fi
+if test -z "$GOC"; then
+  AC_CHECK_PROG(GOC, gccgo, gccgo, false)
+fi
+])#m4_defun
+])#m4_ifndef
+
+
 # _LT_LANG_DEFAULT_CONFIG
 # -----------------------
 m4_defun([_LT_LANG_DEFAULT_CONFIG],
@@ -867,6 +894,10 @@ AC_PROVIDE_IFELSE([AC_PROG_GCJ],
        m4_ifdef([LT_PROG_GCJ],
 	[m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])])
 
+AC_PROVIDE_IFELSE([AC_PROG_GO],
+  [LT_LANG(GO)],
+  [m4_define([AC_PROG_GO], defn([AC_PROG_GO])[LT_LANG(GO)])])
+
 AC_PROVIDE_IFELSE([LT_PROG_RC],
   [LT_LANG(RC)],
   [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])])
@@ -969,7 +1000,13 @@ m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[
 	$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
 	  -dynamiclib -Wl,-single_module conftest.c 2>conftest.err
         _lt_result=$?
-	if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then
+	# If there is a non-empty error log, and "single_module"
+	# appears in it, assume the flag caused a linker warning
+        if test -s conftest.err && $GREP single_module conftest.err; then
+	  cat conftest.err >&AS_MESSAGE_LOG_FD
+	# Otherwise, if the output was created with a 0 exit code from
+	# the compiler, it worked.
+	elif test -f libconftest.dylib && test $_lt_result -eq 0; then
 	  lt_cv_apple_cc_single_mod=yes
 	else
 	  cat conftest.err >&AS_MESSAGE_LOG_FD
@@ -977,6 +1014,7 @@ m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[
 	rm -rf libconftest.dylib*
 	rm -f conftest.*
       fi])
+
     AC_CACHE_CHECK([for -exported_symbols_list linker flag],
       [lt_cv_ld_exported_symbols_list],
       [lt_cv_ld_exported_symbols_list=no
@@ -988,6 +1026,7 @@ m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[
 	[lt_cv_ld_exported_symbols_list=no])
 	LDFLAGS="$save_LDFLAGS"
     ])
+
     AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load],
       [lt_cv_ld_force_load=no
       cat > conftest.c << _LT_EOF
@@ -1005,7 +1044,9 @@ _LT_EOF
       echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD
       $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err
       _lt_result=$?
-      if test -f conftest && test ! -s conftest.err && test $_lt_result = 0 && $GREP forced_load conftest 2>&1 >/dev/null; then
+      if test -s conftest.err && $GREP force_load conftest.err; then
+	cat conftest.err >&AS_MESSAGE_LOG_FD
+      elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then
 	lt_cv_ld_force_load=yes
       else
 	cat conftest.err >&AS_MESSAGE_LOG_FD
@@ -1050,8 +1091,8 @@ _LT_EOF
 ])
 
 
-# _LT_DARWIN_LINKER_FEATURES
-# --------------------------
+# _LT_DARWIN_LINKER_FEATURES([TAG])
+# ---------------------------------
 # Checks for linker and compiler features on darwin
 m4_defun([_LT_DARWIN_LINKER_FEATURES],
 [
@@ -1062,6 +1103,8 @@ m4_defun([_LT_DARWIN_LINKER_FEATURES],
   _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
   if test "$lt_cv_ld_force_load" = "yes"; then
     _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
+    m4_case([$1], [F77], [_LT_TAGVAR(compiler_needs_object, $1)=yes],
+                  [FC],  [_LT_TAGVAR(compiler_needs_object, $1)=yes])
   else
     _LT_TAGVAR(whole_archive_flag_spec, $1)=''
   fi
@@ -1283,7 +1326,7 @@ ia64-*-hpux*)
   rm -rf conftest*
   ;;
 
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
 s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
   # Find out which ABI we are using.
   echo 'int i;' > conftest.$ac_ext
@@ -1295,9 +1338,19 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
 	    LD="${LD-ld} -m elf_i386_fbsd"
 	    ;;
 	  x86_64-*linux*)
-	    LD="${LD-ld} -m elf_i386"
+	    case `/usr/bin/file conftest.o` in
+	      *x86-64*)
+		LD="${LD-ld} -m elf32_x86_64"
+		;;
+	      *)
+		LD="${LD-ld} -m elf_i386"
+		;;
+	    esac
+	    ;;
+	  powerpc64le-*)
+	    LD="${LD-ld} -m elf32lppclinux"
 	    ;;
-	  ppc64-*linux*|powerpc64-*linux*)
+	  powerpc64-*)
 	    LD="${LD-ld} -m elf32ppclinux"
 	    ;;
 	  s390x-*linux*)
@@ -1316,7 +1369,10 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
 	  x86_64-*linux*)
 	    LD="${LD-ld} -m elf_x86_64"
 	    ;;
-	  ppc*-*linux*|powerpc*-*linux*)
+	  powerpcle-*)
+	    LD="${LD-ld} -m elf64lppc"
+	    ;;
+	  powerpc-*)
 	    LD="${LD-ld} -m elf64ppc"
 	    ;;
 	  s390*-*linux*|s390*-*tpf*)
@@ -1345,14 +1401,27 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
     CFLAGS="$SAVE_CFLAGS"
   fi
   ;;
-sparc*-*solaris*)
+*-*solaris*)
   # Find out which ABI we are using.
   echo 'int i;' > conftest.$ac_ext
   if AC_TRY_EVAL(ac_compile); then
     case `/usr/bin/file conftest.o` in
     *64-bit*)
       case $lt_cv_prog_gnu_ld in
-      yes*) LD="${LD-ld} -m elf64_sparc" ;;
+      yes*)
+        case $host in
+        i?86-*-solaris*)
+          LD="${LD-ld} -m elf_x86_64"
+          ;;
+        sparc*-*-solaris*)
+          LD="${LD-ld} -m elf64_sparc"
+          ;;
+        esac
+        # GNU ld 2.21 introduced _sol2 emulations.  Use them if available.
+        if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then
+          LD="${LD-ld}_sol2"
+        fi
+        ;;
       *)
 	if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then
 	  LD="${LD-ld} -64"
@@ -1429,13 +1498,13 @@ old_postuninstall_cmds=
 if test -n "$RANLIB"; then
   case $host_os in
   openbsd*)
-    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib"
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib"
     ;;
   *)
-    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib"
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib"
     ;;
   esac
-  old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
+  old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib"
 fi
 
 case $host_os in
@@ -1615,6 +1684,11 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
     lt_cv_sys_max_cmd_len=196608
     ;;
 
+  os2*)
+    # The test takes a long time on OS/2.
+    lt_cv_sys_max_cmd_len=8192
+    ;;
+
   osf*)
     # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
     # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
@@ -1641,7 +1715,8 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
     ;;
   *)
     lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`
-    if test -n "$lt_cv_sys_max_cmd_len"; then
+    if test -n "$lt_cv_sys_max_cmd_len" && \
+	test undefined != "$lt_cv_sys_max_cmd_len"; then
       lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
       lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
     else
@@ -1654,7 +1729,7 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
       # If test is not a shell built-in, we'll probably end up computing a
       # maximum length that is only half of the actual maximum length, but
       # we can't tell.
-      while { test "X"`func_fallback_echo "$teststring$teststring" 2>/dev/null` \
+      while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \
 	         = "X$teststring$teststring"; } >/dev/null 2>&1 &&
 	      test $i != 17 # 1/2 MB should be enough
       do
@@ -2200,7 +2275,7 @@ need_version=unknown
 
 case $host_os in
 aix3*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
   shlibpath_var=LIBPATH
 
@@ -2209,7 +2284,7 @@ aix3*)
   ;;
 
 aix[[4-9]]*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   hardcode_into_libs=yes
@@ -2274,7 +2349,7 @@ beos*)
   ;;
 
 bsdi[[45]]*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
   soname_spec='${libname}${release}${shared_ext}$major'
@@ -2413,7 +2488,7 @@ m4_if([$1], [],[
   ;;
 
 dgux*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
@@ -2421,10 +2496,6 @@ dgux*)
   shlibpath_var=LD_LIBRARY_PATH
   ;;
 
-freebsd1*)
-  dynamic_linker=no
-  ;;
-
 freebsd* | dragonfly*)
   # DragonFly does not have aout.  When/if they implement a new
   # versioning mechanism, adjust this.
@@ -2432,7 +2503,7 @@ freebsd* | dragonfly*)
     objformat=`/usr/bin/objformat`
   else
     case $host_os in
-    freebsd[[123]]*) objformat=aout ;;
+    freebsd[[23]].*) objformat=aout ;;
     *) objformat=elf ;;
     esac
   fi
@@ -2450,7 +2521,7 @@ freebsd* | dragonfly*)
   esac
   shlibpath_var=LD_LIBRARY_PATH
   case $host_os in
-  freebsd2*)
+  freebsd2.*)
     shlibpath_overrides_runpath=yes
     ;;
   freebsd3.[[01]]* | freebsdelf3.[[01]]*)
@@ -2469,19 +2540,8 @@ freebsd* | dragonfly*)
   esac
   ;;
 
-gnu*)
-  version_type=linux
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=no
-  hardcode_into_libs=yes
-  ;;
-
 haiku*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   dynamic_linker="$host_os runtime_loader"
@@ -2542,7 +2602,7 @@ hpux9* | hpux10* | hpux11*)
   ;;
 
 interix[[3-9]]*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
@@ -2558,7 +2618,7 @@ irix5* | irix6* | nonstopux*)
     nonstopux*) version_type=nonstopux ;;
     *)
 	if test "$lt_cv_prog_gnu_ld" = yes; then
-		version_type=linux
+		version_type=linux # correct to gnu/linux during the next big refactor
 	else
 		version_type=irix
 	fi ;;
@@ -2595,9 +2655,9 @@ linux*oldld* | linux*aout* | linux*coff*)
   dynamic_linker=no
   ;;
 
-# This must be Linux ELF.
-linux* | k*bsd*-gnu | kopensolaris*-gnu)
-  version_type=linux
+# This must be glibc/ELF.
+linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
@@ -2672,7 +2732,7 @@ netbsd*)
   ;;
 
 newsos6)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
   shlibpath_var=LD_LIBRARY_PATH
   shlibpath_overrides_runpath=yes
@@ -2741,7 +2801,7 @@ rdos*)
   ;;
 
 solaris*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
@@ -2766,7 +2826,7 @@ sunos4*)
   ;;
 
 sysv4 | sysv4.3*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
   soname_spec='${libname}${release}${shared_ext}$major'
   shlibpath_var=LD_LIBRARY_PATH
@@ -2790,7 +2850,7 @@ sysv4 | sysv4.3*)
 
 sysv4*MP*)
   if test -d /usr/nec ;then
-    version_type=linux
+    version_type=linux # correct to gnu/linux during the next big refactor
     library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
     soname_spec='$libname${shared_ext}.$major'
     shlibpath_var=LD_LIBRARY_PATH
@@ -2821,7 +2881,7 @@ sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
 
 tpf*)
   # TPF is a cross-target only.  Preferred cross-host = GNU/Linux.
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
@@ -2831,7 +2891,7 @@ tpf*)
   ;;
 
 uts4*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
   soname_spec='${libname}${release}${shared_ext}$major'
   shlibpath_var=LD_LIBRARY_PATH
@@ -3212,10 +3272,6 @@ freebsd* | dragonfly*)
   fi
   ;;
 
-gnu*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
-
 haiku*)
   lt_cv_deplibs_check_method=pass_all
   ;;
@@ -3253,8 +3309,8 @@ irix5* | irix6* | nonstopux*)
   lt_cv_deplibs_check_method=pass_all
   ;;
 
-# This must be Linux ELF.
-linux* | k*bsd*-gnu | kopensolaris*-gnu)
+# This must be glibc/ELF.
+linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
   lt_cv_deplibs_check_method=pass_all
   ;;
 
@@ -3673,6 +3729,7 @@ for ac_symprfx in "" "_"; do
     # which start with @ or ?.
     lt_cv_sys_global_symbol_pipe="$AWK ['"\
 "     {last_section=section; section=\$ 3};"\
+"     /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\
 "     /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\
 "     \$ 0!~/External *\|/{next};"\
 "     / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\
@@ -4005,7 +4062,7 @@ m4_if([$1], [CXX], [
 	    ;;
 	esac
 	;;
-      linux* | k*bsd*-gnu | kopensolaris*-gnu)
+      linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
 	case $cc_basename in
 	  KCC*)
 	    # KAI C++ Compiler
@@ -4257,7 +4314,9 @@ m4_if([$1], [CXX], [
     case $cc_basename in
     nvcc*) # Cuda Compiler Driver 2.2
       _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker '
-      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Xcompiler -fPIC'
+      if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then
+        _LT_TAGVAR(lt_prog_compiler_pic, $1)="-Xcompiler $_LT_TAGVAR(lt_prog_compiler_pic, $1)"
+      fi
       ;;
     esac
   else
@@ -4302,7 +4361,7 @@ m4_if([$1], [CXX], [
       _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
       ;;
 
-    linux* | k*bsd*-gnu | kopensolaris*-gnu)
+    linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
       case $cc_basename in
       # old Intel for x86_64 which still supported -KPIC.
       ecc*)
@@ -4349,18 +4408,33 @@ m4_if([$1], [CXX], [
 	;;
       *)
 	case `$CC -V 2>&1 | sed 5q` in
-	*Sun\ F* | *Sun*Fortran*)
+	*Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [[1-7]].* | *Sun*Fortran*\ 8.[[0-3]]*)
 	  # Sun Fortran 8.3 passes all unrecognized flags to the linker
 	  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
 	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
 	  _LT_TAGVAR(lt_prog_compiler_wl, $1)=''
 	  ;;
+	*Sun\ F* | *Sun*Fortran*)
+	  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	  _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+	  ;;
 	*Sun\ C*)
 	  # Sun C 5.9
 	  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
 	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
 	  _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
 	  ;;
+        *Intel*\ [[CF]]*Compiler*)
+	  _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+	  ;;
+	*Portland\ Group*)
+	  _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
+	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	  ;;
 	esac
 	;;
       esac
@@ -4520,7 +4594,9 @@ m4_if([$1], [CXX], [
     ;;
   cygwin* | mingw* | cegcc*)
     case $cc_basename in
-    cl*) ;;
+    cl*)
+      _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
+      ;;
     *)
       _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols'
       _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname']
@@ -4548,7 +4624,6 @@ m4_if([$1], [CXX], [
   _LT_TAGVAR(hardcode_direct, $1)=no
   _LT_TAGVAR(hardcode_direct_absolute, $1)=no
   _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
-  _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
   _LT_TAGVAR(hardcode_libdir_separator, $1)=
   _LT_TAGVAR(hardcode_minus_L, $1)=no
   _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
@@ -4802,8 +4877,7 @@ _LT_EOF
 	xlf* | bgf* | bgxlf* | mpixlf*)
 	  # IBM XL Fortran 10.1 on PPC cannot create shared libs itself
 	  _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive'
-	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
-	  _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir'
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
 	  _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib'
 	  if test "x$supports_anon_versioning" = xyes; then
 	    _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
@@ -5099,6 +5173,7 @@ _LT_EOF
 	# The linker will not automatically build a static lib if we build a DLL.
 	# _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
 	_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+	_LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
 	_LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols'
 	# Don't use ranlib
 	_LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'
@@ -5145,10 +5220,6 @@ _LT_EOF
       _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
       ;;
 
-    freebsd1*)
-      _LT_TAGVAR(ld_shlibs, $1)=no
-      ;;
-
     # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
     # support.  Future versions do this automatically, but an explicit c++rt0.o
     # does not break anything, and helps significantly (at the cost of a little
@@ -5161,7 +5232,7 @@ _LT_EOF
       ;;
 
     # Unfortunately, older versions of FreeBSD 2 do not have this feature.
-    freebsd2*)
+    freebsd2.*)
       _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
       _LT_TAGVAR(hardcode_direct, $1)=yes
       _LT_TAGVAR(hardcode_minus_L, $1)=yes
@@ -5200,7 +5271,6 @@ _LT_EOF
       fi
       if test "$with_gnu_ld" = no; then
 	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
-	_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir'
 	_LT_TAGVAR(hardcode_libdir_separator, $1)=:
 	_LT_TAGVAR(hardcode_direct, $1)=yes
 	_LT_TAGVAR(hardcode_direct_absolute, $1)=yes
@@ -5642,9 +5712,6 @@ _LT_TAGDECL([], [no_undefined_flag], [1],
 _LT_TAGDECL([], [hardcode_libdir_flag_spec], [1],
     [Flag to hardcode $libdir into a binary during linking.
     This must work even if $libdir does not exist])
-_LT_TAGDECL([], [hardcode_libdir_flag_spec_ld], [1],
-    [[If ld is used when linking, flag to hardcode $libdir into a binary
-    during linking.  This must work even if $libdir does not exist]])
 _LT_TAGDECL([], [hardcode_libdir_separator], [1],
     [Whether we need a single "-rpath" flag with a separated argument])
 _LT_TAGDECL([], [hardcode_direct], [0],
@@ -5798,7 +5865,6 @@ _LT_TAGVAR(export_dynamic_flag_spec, $1)=
 _LT_TAGVAR(hardcode_direct, $1)=no
 _LT_TAGVAR(hardcode_direct_absolute, $1)=no
 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
-_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
 _LT_TAGVAR(hardcode_libdir_separator, $1)=
 _LT_TAGVAR(hardcode_minus_L, $1)=no
 _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
@@ -6168,7 +6234,7 @@ if test "$_lt_caught_CXX_error" != yes; then
         esac
         ;;
 
-      freebsd[[12]]*)
+      freebsd2.*)
         # C++ shared libraries reported to be fairly broken before
 	# switch to ELF
         _LT_TAGVAR(ld_shlibs, $1)=no
@@ -6184,9 +6250,6 @@ if test "$_lt_caught_CXX_error" != yes; then
         _LT_TAGVAR(ld_shlibs, $1)=yes
         ;;
 
-      gnu*)
-        ;;
-
       haiku*)
         _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
         _LT_TAGVAR(link_all_deplibs, $1)=yes
@@ -6348,7 +6411,7 @@ if test "$_lt_caught_CXX_error" != yes; then
         _LT_TAGVAR(inherit_rpath, $1)=yes
         ;;
 
-      linux* | k*bsd*-gnu | kopensolaris*-gnu)
+      linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
         case $cc_basename in
           KCC*)
 	    # Kuck and Associates, Inc. (KAI) C++ Compiler
@@ -6929,12 +6992,18 @@ public class foo {
   }
 };
 _LT_EOF
+], [$1], [GO], [cat > conftest.$ac_ext <<_LT_EOF
+package foo
+func foo() {
+}
+_LT_EOF
 ])
 
 _lt_libdeps_save_CFLAGS=$CFLAGS
 case "$CC $CFLAGS " in #(
 *\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;;
 *\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;;
+*\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;;
 esac
 
 dnl Parse the compiler output and extract the necessary
@@ -7131,7 +7200,6 @@ _LT_TAGVAR(export_dynamic_flag_spec, $1)=
 _LT_TAGVAR(hardcode_direct, $1)=no
 _LT_TAGVAR(hardcode_direct_absolute, $1)=no
 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
-_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
 _LT_TAGVAR(hardcode_libdir_separator, $1)=
 _LT_TAGVAR(hardcode_minus_L, $1)=no
 _LT_TAGVAR(hardcode_automatic, $1)=no
@@ -7264,7 +7332,6 @@ _LT_TAGVAR(export_dynamic_flag_spec, $1)=
 _LT_TAGVAR(hardcode_direct, $1)=no
 _LT_TAGVAR(hardcode_direct_absolute, $1)=no
 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
-_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
 _LT_TAGVAR(hardcode_libdir_separator, $1)=
 _LT_TAGVAR(hardcode_minus_L, $1)=no
 _LT_TAGVAR(hardcode_automatic, $1)=no
@@ -7447,6 +7514,73 @@ CFLAGS=$lt_save_CFLAGS
 ])# _LT_LANG_GCJ_CONFIG
 
 
+# _LT_LANG_GO_CONFIG([TAG])
+# --------------------------
+# Ensure that the configuration variables for the GNU Go compiler
+# are suitably defined.  These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_GO_CONFIG],
+[AC_REQUIRE([LT_PROG_GO])dnl
+AC_LANG_SAVE
+
+# Source file extension for Go test sources.
+ac_ext=go
+
+# Object file extension for compiled Go test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="package main; func main() { }"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='package main; func main() { }'
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_TAG_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC=$CC
+lt_save_CFLAGS=$CFLAGS
+lt_save_GCC=$GCC
+GCC=yes
+CC=${GOC-"gccgo"}
+CFLAGS=$GOFLAGS
+compiler=$CC
+_LT_TAGVAR(compiler, $1)=$CC
+_LT_TAGVAR(LD, $1)="$LD"
+_LT_CC_BASENAME([$compiler])
+
+# Go did not exist at the time GCC didn't implicitly link libc in.
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(reload_flag, $1)=$reload_flag
+_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
+
+if test -n "$compiler"; then
+  _LT_COMPILER_NO_RTTI($1)
+  _LT_COMPILER_PIC($1)
+  _LT_COMPILER_C_O($1)
+  _LT_COMPILER_FILE_LOCKS($1)
+  _LT_LINKER_SHLIBS($1)
+  _LT_LINKER_HARDCODE_LIBPATH($1)
+
+  _LT_CONFIG($1)
+fi
+
+AC_LANG_RESTORE
+
+GCC=$lt_save_GCC
+CC=$lt_save_CC
+CFLAGS=$lt_save_CFLAGS
+])# _LT_LANG_GO_CONFIG
+
+
 # _LT_LANG_RC_CONFIG([TAG])
 # -------------------------
 # Ensure that the configuration variables for the Windows resource compiler
@@ -7516,6 +7650,13 @@ dnl aclocal-1.4 backwards compatibility:
 dnl AC_DEFUN([LT_AC_PROG_GCJ], [])
 
 
+# LT_PROG_GO
+# ----------
+AC_DEFUN([LT_PROG_GO],
+[AC_CHECK_TOOL(GOC, gccgo,)
+])
+
+
 # LT_PROG_RC
 # ----------
 AC_DEFUN([LT_PROG_RC],
@@ -8180,9 +8321,24 @@ dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], [])
 # MODE is either `yes' or `no'.  If omitted, it defaults to `both'.
 m4_define([_LT_WITH_PIC],
 [AC_ARG_WITH([pic],
-    [AS_HELP_STRING([--with-pic],
+    [AS_HELP_STRING([--with-pic@<:@=PKGS@:>@],
 	[try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
-    [pic_mode="$withval"],
+    [lt_p=${PACKAGE-default}
+    case $withval in
+    yes|no) pic_mode=$withval ;;
+    *)
+      pic_mode=default
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for lt_pkg in $withval; do
+	IFS="$lt_save_ifs"
+	if test "X$lt_pkg" = "X$lt_p"; then
+	  pic_mode=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac],
     [pic_mode=default])
 
 test -z "$pic_mode" && pic_mode=m4_default([$1], [default])
@@ -8354,15 +8510,15 @@ m4_define([lt_dict_filter],
 
 # @configure_input@
 
-# serial 3293 ltversion.m4
+# serial 3337 ltversion.m4
 # This file is part of GNU Libtool
 
-m4_define([LT_PACKAGE_VERSION], [2.4])
-m4_define([LT_PACKAGE_REVISION], [1.3293])
+m4_define([LT_PACKAGE_VERSION], [2.4.2])
+m4_define([LT_PACKAGE_REVISION], [1.3337])
 
 AC_DEFUN([LTVERSION_VERSION],
-[macro_version='2.4'
-macro_revision='1.3293'
+[macro_version='2.4.2'
+macro_revision='1.3337'
 _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
 _LT_DECL(, macro_revision, 0)
 ])
@@ -8466,7 +8622,7 @@ m4_ifndef([_LT_PROG_F77],		[AC_DEFUN([_LT_PROG_F77])])
 m4_ifndef([_LT_PROG_FC],		[AC_DEFUN([_LT_PROG_FC])])
 m4_ifndef([_LT_PROG_CXX],		[AC_DEFUN([_LT_PROG_CXX])])
 
-# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
+# Copyright (C) 2002-2013 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -8478,10 +8634,10 @@ m4_ifndef([_LT_PROG_CXX],		[AC_DEFUN([_LT_PROG_CXX])])
 # generated from the m4 files accompanying Automake X.Y.
 # (This private macro should not be called outside this file.)
 AC_DEFUN([AM_AUTOMAKE_VERSION],
-[am__api_version='1.11'
+[am__api_version='1.14'
 dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
 dnl require some minimum version.  Point them to the right macro.
-m4_if([$1], [1.11.1], [],
+m4_if([$1], [1.14.1], [],
       [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
 ])
 
@@ -8497,22 +8653,22 @@ m4_define([_AM_AUTOCONF_VERSION], [])
 # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
 # This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
-[AM_AUTOMAKE_VERSION([1.11.1])dnl
+[AM_AUTOMAKE_VERSION([1.14.1])dnl
 m4_ifndef([AC_AUTOCONF_VERSION],
   [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
 _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
 
 # AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
 
-# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
+# Copyright (C) 2001-2013 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
 # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
-# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
-# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
+# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
+# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
 #
 # Of course, Automake must honor this variable whenever it calls a
 # tool from the auxiliary directory.  The problem is that $srcdir (and
@@ -8531,7 +8687,7 @@ _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
 #
 # The reason of the latter failure is that $top_srcdir and $ac_aux_dir
 # are both prefixed by $srcdir.  In an in-source build this is usually
-# harmless because $srcdir is `.', but things will broke when you
+# harmless because $srcdir is '.', but things will broke when you
 # start a VPATH build or use an absolute $srcdir.
 #
 # So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
@@ -8557,22 +8713,19 @@ am_aux_dir=`cd $ac_aux_dir && pwd`
 
 # AM_CONDITIONAL                                            -*- Autoconf -*-
 
-# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008
-# Free Software Foundation, Inc.
+# Copyright (C) 1997-2013 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 9
-
 # AM_CONDITIONAL(NAME, SHELL-CONDITION)
 # -------------------------------------
 # Define a conditional.
 AC_DEFUN([AM_CONDITIONAL],
-[AC_PREREQ(2.52)dnl
- ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
-	[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
+[AC_PREREQ([2.52])dnl
+ m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
+       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
 AC_SUBST([$1_TRUE])dnl
 AC_SUBST([$1_FALSE])dnl
 _AM_SUBST_NOTMAKE([$1_TRUE])dnl
@@ -8591,16 +8744,14 @@ AC_CONFIG_COMMANDS_PRE(
 Usually this means the macro was only invoked conditionally.]])
 fi])])
 
-# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009
-# Free Software Foundation, Inc.
+# Copyright (C) 1999-2013 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 10
 
-# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
+# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
 # written in clear, in which case automake, when reading aclocal.m4,
 # will think it sees a *use*, and therefore will trigger all it's
 # C support machinery.  Also note that it means that autoscan, seeing
@@ -8610,7 +8761,7 @@ fi])])
 # _AM_DEPENDENCIES(NAME)
 # ----------------------
 # See how the compiler implements dependency checking.
-# NAME is "CC", "CXX", "GCJ", or "OBJC".
+# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
 # We try a few techniques and use that to set a single cache variable.
 #
 # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
@@ -8623,12 +8774,13 @@ AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
 AC_REQUIRE([AM_MAKE_INCLUDE])dnl
 AC_REQUIRE([AM_DEP_TRACK])dnl
 
-ifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
-       [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
-       [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
-       [$1], UPC,  [depcc="$UPC"  am_compiler_list=],
-       [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
-                   [depcc="$$1"   am_compiler_list=])
+m4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
+      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
+      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
+      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
+      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
+      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
+                    [depcc="$$1"   am_compiler_list=])
 
 AC_CACHE_CHECK([dependency style of $depcc],
                [am_cv_$1_dependencies_compiler_type],
@@ -8636,8 +8788,9 @@ AC_CACHE_CHECK([dependency style of $depcc],
   # We make a subdir and do the tests there.  Otherwise we can end up
   # making bogus files that we don't know about and never remove.  For
   # instance it was reported that on HP-UX the gcc test will end up
-  # making a dummy file named `D' -- because `-MD' means `put the output
-  # in D'.
+  # making a dummy file named 'D' -- because '-MD' means "put the output
+  # in D".
+  rm -rf conftest.dir
   mkdir conftest.dir
   # Copy depcomp to subdir because otherwise we won't find it if we're
   # using a relative directory.
@@ -8676,16 +8829,16 @@ AC_CACHE_CHECK([dependency style of $depcc],
     : > sub/conftest.c
     for i in 1 2 3 4 5 6; do
       echo '#include "conftst'$i'.h"' >> sub/conftest.c
-      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
-      # Solaris 8's {/usr,}/bin/sh.
-      touch sub/conftst$i.h
+      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
+      # Solaris 10 /bin/sh.
+      echo '/* dummy */' > sub/conftst$i.h
     done
     echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
 
-    # We check with `-c' and `-o' for the sake of the "dashmstdout"
+    # We check with '-c' and '-o' for the sake of the "dashmstdout"
     # mode.  It turns out that the SunPro C++ compiler does not properly
-    # handle `-M -o', and we need to detect this.  Also, some Intel
-    # versions had trouble with output in subdirs
+    # handle '-M -o', and we need to detect this.  Also, some Intel
+    # versions had trouble with output in subdirs.
     am__obj=sub/conftest.${OBJEXT-o}
     am__minus_obj="-o $am__obj"
     case $depmode in
@@ -8694,16 +8847,16 @@ AC_CACHE_CHECK([dependency style of $depcc],
       test "$am__universal" = false || continue
       ;;
     nosideeffect)
-      # after this tag, mechanisms are not by side-effect, so they'll
-      # only be used when explicitly requested
+      # After this tag, mechanisms are not by side-effect, so they'll
+      # only be used when explicitly requested.
       if test "x$enable_dependency_tracking" = xyes; then
 	continue
       else
 	break
       fi
       ;;
-    msvisualcpp | msvcmsys)
-      # This compiler won't grok `-c -o', but also, the minuso test has
+    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
+      # This compiler won't grok '-c -o', but also, the minuso test has
       # not run yet.  These depmodes are late enough in the game, and
       # so weak that their functioning should not be impacted.
       am__obj=conftest.${OBJEXT-o}
@@ -8751,7 +8904,7 @@ AM_CONDITIONAL([am__fastdep$1], [
 # AM_SET_DEPDIR
 # -------------
 # Choose a directory name for dependency files.
-# This macro is AC_REQUIREd in _AM_DEPENDENCIES
+# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
 AC_DEFUN([AM_SET_DEPDIR],
 [AC_REQUIRE([AM_SET_LEADING_DOT])dnl
 AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
@@ -8761,34 +8914,39 @@ AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
 # AM_DEP_TRACK
 # ------------
 AC_DEFUN([AM_DEP_TRACK],
-[AC_ARG_ENABLE(dependency-tracking,
-[  --disable-dependency-tracking  speeds up one-time build
-  --enable-dependency-tracking   do not reject slow dependency extractors])
+[AC_ARG_ENABLE([dependency-tracking], [dnl
+AS_HELP_STRING(
+  [--enable-dependency-tracking],
+  [do not reject slow dependency extractors])
+AS_HELP_STRING(
+  [--disable-dependency-tracking],
+  [speeds up one-time build])])
 if test "x$enable_dependency_tracking" != xno; then
   am_depcomp="$ac_aux_dir/depcomp"
   AMDEPBACKSLASH='\'
+  am__nodep='_no'
 fi
 AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
 AC_SUBST([AMDEPBACKSLASH])dnl
 _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
+AC_SUBST([am__nodep])dnl
+_AM_SUBST_NOTMAKE([am__nodep])dnl
 ])
 
 # Generate code to set up dependency tracking.              -*- Autoconf -*-
 
-# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008
-# Free Software Foundation, Inc.
+# Copyright (C) 1999-2013 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-#serial 5
 
 # _AM_OUTPUT_DEPENDENCY_COMMANDS
 # ------------------------------
 AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
 [{
-  # Autoconf 2.62 quotes --file arguments for eval, but not when files
+  # Older Autoconf quotes --file arguments for eval, but not when files
   # are listed without --file.  Let's play safe and only enable the eval
   # if we detect the quoting.
   case $CONFIG_FILES in
@@ -8801,7 +8959,7 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
     # Strip MF so we end up with the name of the file.
     mf=`echo "$mf" | sed -e 's/:.*$//'`
     # Check whether this is an Automake generated Makefile or not.
-    # We used to match only the files named `Makefile.in', but
+    # We used to match only the files named 'Makefile.in', but
     # some people rename them; so instead we look at the file content.
     # Grep'ing the first line is not enough: some people post-process
     # each Makefile.in and add a new line on top of each file to say so.
@@ -8813,21 +8971,19 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
       continue
     fi
     # Extract the definition of DEPDIR, am__include, and am__quote
-    # from the Makefile without running `make'.
+    # from the Makefile without running 'make'.
     DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
     test -z "$DEPDIR" && continue
     am__include=`sed -n 's/^am__include = //p' < "$mf"`
-    test -z "am__include" && continue
+    test -z "$am__include" && continue
     am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
-    # When using ansi2knr, U may be empty or an underscore; expand it
-    U=`sed -n 's/^U = //p' < "$mf"`
     # Find all dependency output files, they are included files with
     # $(DEPDIR) in their names.  We invoke sed twice because it is the
     # simplest approach to changing $(DEPDIR) to its actual value in the
     # expansion.
     for file in `sed -n "
       s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
-	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
       # Make sure the directory exists.
       test -f "$dirpart/$file" && continue
       fdir=`AS_DIRNAME(["$file"])`
@@ -8845,7 +9001,7 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
 # This macro should only be invoked once -- use via AC_REQUIRE.
 #
 # This code is only required when automatic dependency tracking
-# is enabled.  FIXME.  This creates each `.P' file that we will
+# is enabled.  FIXME.  This creates each '.P' file that we will
 # need in order to bootstrap the dependency handling code.
 AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
 [AC_CONFIG_COMMANDS([depfiles],
@@ -8855,18 +9011,21 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
 
 # Do all the work for Automake.                             -*- Autoconf -*-
 
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-# 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
+# Copyright (C) 1996-2013 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 16
-
 # This macro actually does too much.  Some checks are only needed if
 # your package does certain things.  But this isn't really a big deal.
 
+dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
+m4_define([AC_PROG_CC],
+m4_defn([AC_PROG_CC])
+[_AM_PROG_CC_C_O
+])
+
 # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
 # AM_INIT_AUTOMAKE([OPTIONS])
 # -----------------------------------------------
@@ -8879,7 +9038,7 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
 # arguments mandatory, and then we can depend on a new Autoconf
 # release and drop the old call support.
 AC_DEFUN([AM_INIT_AUTOMAKE],
-[AC_PREREQ([2.62])dnl
+[AC_PREREQ([2.65])dnl
 dnl Autoconf wants to disallow AM_ names.  We explicitly allow
 dnl the ones we care about.
 m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
@@ -8908,31 +9067,40 @@ AC_SUBST([CYGPATH_W])
 # Define the identity of the package.
 dnl Distinguish between old-style and new-style calls.
 m4_ifval([$2],
-[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
+[AC_DIAGNOSE([obsolete],
+             [$0: two- and three-arguments forms are deprecated.])
+m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
  AC_SUBST([PACKAGE], [$1])dnl
  AC_SUBST([VERSION], [$2])],
 [_AM_SET_OPTIONS([$1])dnl
 dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
-m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
+m4_if(
+  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
+  [ok:ok],,
   [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
  AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
  AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
 
 _AM_IF_OPTION([no-define],,
-[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
- AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
+[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
+ AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
 
 # Some tools Automake needs.
 AC_REQUIRE([AM_SANITY_CHECK])dnl
 AC_REQUIRE([AC_ARG_PROGRAM])dnl
-AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
-AM_MISSING_PROG(AUTOCONF, autoconf)
-AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
-AM_MISSING_PROG(AUTOHEADER, autoheader)
-AM_MISSING_PROG(MAKEINFO, makeinfo)
+AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
+AM_MISSING_PROG([AUTOCONF], [autoconf])
+AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
+AM_MISSING_PROG([AUTOHEADER], [autoheader])
+AM_MISSING_PROG([MAKEINFO], [makeinfo])
 AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
 AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
-AC_REQUIRE([AM_PROG_MKDIR_P])dnl
+AC_REQUIRE([AC_PROG_MKDIR_P])dnl
+# For better backward compatibility.  To be removed once Automake 1.9.x
+# dies out for good.  For more background, see:
+# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
+# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
+AC_SUBST([mkdir_p], ['$(MKDIR_P)'])
 # We need awk for the "check" target.  The system "awk" is bad on
 # some platforms.
 AC_REQUIRE([AC_PROG_AWK])dnl
@@ -8943,34 +9111,78 @@ _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
 			     [_AM_PROG_TAR([v7])])])
 _AM_IF_OPTION([no-dependencies],,
 [AC_PROVIDE_IFELSE([AC_PROG_CC],
-		  [_AM_DEPENDENCIES(CC)],
-		  [define([AC_PROG_CC],
-			  defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
+		  [_AM_DEPENDENCIES([CC])],
+		  [m4_define([AC_PROG_CC],
+			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
 AC_PROVIDE_IFELSE([AC_PROG_CXX],
-		  [_AM_DEPENDENCIES(CXX)],
-		  [define([AC_PROG_CXX],
-			  defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
+		  [_AM_DEPENDENCIES([CXX])],
+		  [m4_define([AC_PROG_CXX],
+			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
 AC_PROVIDE_IFELSE([AC_PROG_OBJC],
-		  [_AM_DEPENDENCIES(OBJC)],
-		  [define([AC_PROG_OBJC],
-			  defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
+		  [_AM_DEPENDENCIES([OBJC])],
+		  [m4_define([AC_PROG_OBJC],
+			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
+		  [_AM_DEPENDENCIES([OBJCXX])],
+		  [m4_define([AC_PROG_OBJCXX],
+			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
 ])
-_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
-dnl The `parallel-tests' driver may need to know about EXEEXT, so add the
-dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This macro
-dnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
+AC_REQUIRE([AM_SILENT_RULES])dnl
+dnl The testsuite driver may need to know about EXEEXT, so add the
+dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
+dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
 AC_CONFIG_COMMANDS_PRE(dnl
 [m4_provide_if([_AM_COMPILER_EXEEXT],
   [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
-])
 
-dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
+# POSIX will say in a future version that running "rm -f" with no argument
+# is OK; and we want to be able to make that assumption in our Makefile
+# recipes.  So use an aggressive probe to check that the usage we want is
+# actually supported "in the wild" to an acceptable degree.
+# See automake bug#10828.
+# To make any issue more visible, cause the running configure to be aborted
+# by default if the 'rm' program in use doesn't match our expectations; the
+# user can still override this though.
+if rm -f && rm -fr && rm -rf; then : OK; else
+  cat >&2 <<'END'
+Oops!
+
+Your 'rm' program seems unable to run without file operands specified
+on the command line, even when the '-f' option is present.  This is contrary
+to the behaviour of most rm programs out there, and not conforming with
+the upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
+
+Please tell bug-automake at gnu.org about your system, including the value
+of your $PATH and any error possibly output before this message.  This
+can help us improve future automake versions.
+
+END
+  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
+    echo 'Configuration will proceed anyway, since you have set the' >&2
+    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
+    echo >&2
+  else
+    cat >&2 <<'END'
+Aborting the configuration process, to ensure you take notice of the issue.
+
+You can download and install GNU coreutils to get an 'rm' implementation
+that behaves properly: <http://www.gnu.org/software/coreutils/>.
+
+If you want to complete the configuration process using your problematic
+'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
+to "yes", and re-run configure.
+
+END
+    AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
+  fi
+fi])
+
+dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
 dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
 dnl mangled by Autoconf and run in a shell conditional statement.
 m4_define([_AC_COMPILER_EXEEXT],
 m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
 
-
 # When config.status generates a header, we must update the stamp-h file.
 # This file resides in the same directory as the config header
 # that is generated.  The stamp files are numbered to have different names.
@@ -8992,7 +9204,7 @@ for _am_header in $config_headers :; do
 done
 echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
 
-# Copyright (C) 2001, 2003, 2005, 2008  Free Software Foundation, Inc.
+# Copyright (C) 2001-2013 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9011,16 +9223,14 @@ if test x"${install_sh}" != xset; then
     install_sh="\${SHELL} $am_aux_dir/install-sh"
   esac
 fi
-AC_SUBST(install_sh)])
+AC_SUBST([install_sh])])
 
-# Copyright (C) 2003, 2005  Free Software Foundation, Inc.
+# Copyright (C) 2003-2013 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 2
-
 # Check whether the underlying file-system supports filenames
 # with a leading dot.  For instance MS-DOS doesn't.
 AC_DEFUN([AM_SET_LEADING_DOT],
@@ -9037,20 +9247,17 @@ AC_SUBST([am__leading_dot])])
 # Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
 # From Jim Meyering
 
-# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008
-# Free Software Foundation, Inc.
+# Copyright (C) 1996-2013 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 5
-
 # AM_MAINTAINER_MODE([DEFAULT-MODE])
 # ----------------------------------
 # Control maintainer-specific portions of Makefiles.
-# Default is to disable them, unless `enable' is passed literally.
-# For symmetry, `disable' may be passed as well.  Anyway, the user
+# Default is to disable them, unless 'enable' is passed literally.
+# For symmetry, 'disable' may be passed as well.  Anyway, the user
 # can override the default with the --enable/--disable switch.
 AC_DEFUN([AM_MAINTAINER_MODE],
 [m4_case(m4_default([$1], [disable]),
@@ -9058,13 +9265,14 @@ AC_DEFUN([AM_MAINTAINER_MODE],
        [disable], [m4_define([am_maintainer_other], [enable])],
        [m4_define([am_maintainer_other], [enable])
         m4_warn([syntax], [unexpected argument to AM@&t at _MAINTAINER_MODE: $1])])
-AC_MSG_CHECKING([whether to am_maintainer_other maintainer-specific portions of Makefiles])
+AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
   dnl maintainer-mode's default is 'disable' unless 'enable' is passed
   AC_ARG_ENABLE([maintainer-mode],
-[  --][am_maintainer_other][-maintainer-mode  am_maintainer_other make rules and dependencies not useful
-			  (and sometimes confusing) to the casual installer],
-      [USE_MAINTAINER_MODE=$enableval],
-      [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
+    [AS_HELP_STRING([--]am_maintainer_other[-maintainer-mode],
+      am_maintainer_other[ make rules and dependencies not useful
+      (and sometimes confusing) to the casual installer])],
+    [USE_MAINTAINER_MODE=$enableval],
+    [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
   AC_MSG_RESULT([$USE_MAINTAINER_MODE])
   AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
   MAINT=$MAINTAINER_MODE_TRUE
@@ -9072,18 +9280,14 @@ AC_MSG_CHECKING([whether to am_maintainer_other maintainer-specific portions of
 ]
 )
 
-AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
-
 # Check to see how 'make' treats includes.	            -*- Autoconf -*-
 
-# Copyright (C) 2001, 2002, 2003, 2005, 2009  Free Software Foundation, Inc.
+# Copyright (C) 2001-2013 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 4
-
 # AM_MAKE_INCLUDE()
 # -----------------
 # Check to see how make treats includes.
@@ -9101,7 +9305,7 @@ am__quote=
 _am_result=none
 # First try GNU make style include.
 echo "include confinc" > confmf
-# Ignore all kinds of additional output from `make'.
+# Ignore all kinds of additional output from 'make'.
 case `$am_make -s -f confmf 2> /dev/null` in #(
 *the\ am__doit\ target*)
   am__include=include
@@ -9128,15 +9332,12 @@ rm -f confinc confmf
 
 # Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
 
-# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008
-# Free Software Foundation, Inc.
+# Copyright (C) 1997-2013 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 6
-
 # AM_MISSING_PROG(NAME, PROGRAM)
 # ------------------------------
 AC_DEFUN([AM_MISSING_PROG],
@@ -9144,11 +9345,10 @@ AC_DEFUN([AM_MISSING_PROG],
 $1=${$1-"${am_missing_run}$2"}
 AC_SUBST($1)])
 
-
 # AM_MISSING_HAS_RUN
 # ------------------
-# Define MISSING if not defined so far and test if it supports --run.
-# If it does, set am_missing_run to use it, otherwise, to nothing.
+# Define MISSING if not defined so far and test if it is modern enough.
+# If it is, set am_missing_run to use it, otherwise, to nothing.
 AC_DEFUN([AM_MISSING_HAS_RUN],
 [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
 AC_REQUIRE_AUX_FILE([missing])dnl
@@ -9161,63 +9361,35 @@ if test x"${MISSING+set}" != xset; then
   esac
 fi
 # Use eval to expand $SHELL
-if eval "$MISSING --run true"; then
-  am_missing_run="$MISSING --run "
+if eval "$MISSING --is-lightweight"; then
+  am_missing_run="$MISSING "
 else
   am_missing_run=
-  AC_MSG_WARN([`missing' script is too old or missing])
+  AC_MSG_WARN(['missing' script is too old or missing])
 fi
 ])
 
-# Copyright (C) 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# AM_PROG_MKDIR_P
-# ---------------
-# Check for `mkdir -p'.
-AC_DEFUN([AM_PROG_MKDIR_P],
-[AC_PREREQ([2.60])dnl
-AC_REQUIRE([AC_PROG_MKDIR_P])dnl
-dnl Automake 1.8 to 1.9.6 used to define mkdir_p.  We now use MKDIR_P,
-dnl while keeping a definition of mkdir_p for backward compatibility.
-dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
-dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
-dnl Makefile.ins that do not define MKDIR_P, so we do our own
-dnl adjustment using top_builddir (which is defined more often than
-dnl MKDIR_P).
-AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
-case $mkdir_p in
-  [[\\/$]]* | ?:[[\\/]]*) ;;
-  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
-esac
-])
-
 # Helper functions for option handling.                     -*- Autoconf -*-
 
-# Copyright (C) 2001, 2002, 2003, 2005, 2008  Free Software Foundation, Inc.
+# Copyright (C) 2001-2013 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 4
-
 # _AM_MANGLE_OPTION(NAME)
 # -----------------------
 AC_DEFUN([_AM_MANGLE_OPTION],
 [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
 
 # _AM_SET_OPTION(NAME)
-# ------------------------------
+# --------------------
 # Set option NAME.  Presently that only means defining a flag for this option.
 AC_DEFUN([_AM_SET_OPTION],
-[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
+[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
 
 # _AM_SET_OPTIONS(OPTIONS)
-# ----------------------------------
+# ------------------------
 # OPTIONS is a space-separated list of Automake options.
 AC_DEFUN([_AM_SET_OPTIONS],
 [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
@@ -9228,24 +9400,82 @@ AC_DEFUN([_AM_SET_OPTIONS],
 AC_DEFUN([_AM_IF_OPTION],
 [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
 
-# Check to make sure that the build environment is sane.    -*- Autoconf -*-
+# Copyright (C) 1999-2013 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# _AM_PROG_CC_C_O
+# ---------------
+# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
+# to automatically call this.
+AC_DEFUN([_AM_PROG_CC_C_O],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+AC_REQUIRE_AUX_FILE([compile])dnl
+AC_LANG_PUSH([C])dnl
+AC_CACHE_CHECK(
+  [whether $CC understands -c and -o together],
+  [am_cv_prog_cc_c_o],
+  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
+  # Make sure it works both with $CC and with simple cc.
+  # Following AC_PROG_CC_C_O, we do the test twice because some
+  # compilers refuse to overwrite an existing .o file with -o,
+  # though they will create one.
+  am_cv_prog_cc_c_o=yes
+  for am_i in 1 2; do
+    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
+         && test -f conftest2.$ac_objext; then
+      : OK
+    else
+      am_cv_prog_cc_c_o=no
+      break
+    fi
+  done
+  rm -f core conftest*
+  unset am_i])
+if test "$am_cv_prog_cc_c_o" != yes; then
+   # Losing compiler, so override with the script.
+   # FIXME: It is wrong to rewrite CC.
+   # But if we don't then we get into trouble of one sort or another.
+   # A longer-term fix would be to have automake use am__CC in this case,
+   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
+   CC="$am_aux_dir/compile $CC"
+fi
+AC_LANG_POP([C])])
 
-# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008
-# Free Software Foundation, Inc.
+# For backward compatibility.
+AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
+
+# Copyright (C) 2001-2013 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 5
+# AM_RUN_LOG(COMMAND)
+# -------------------
+# Run COMMAND, save the exit status in ac_status, and log it.
+# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
+AC_DEFUN([AM_RUN_LOG],
+[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
+   ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
+   ac_status=$?
+   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+   (exit $ac_status); }])
+
+# Check to make sure that the build environment is sane.    -*- Autoconf -*-
+
+# Copyright (C) 1996-2013 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
 
 # AM_SANITY_CHECK
 # ---------------
 AC_DEFUN([AM_SANITY_CHECK],
 [AC_MSG_CHECKING([whether build environment is sane])
-# Just in case
-sleep 1
-echo timestamp > conftest.file
 # Reject unsafe characters in $srcdir or the absolute working directory
 # name.  Accept space and tab only in the latter.
 am_lf='
@@ -9256,32 +9486,40 @@ case `pwd` in
 esac
 case $srcdir in
   *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
-    AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);;
+    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
 esac
 
-# Do `set' in a subshell so we don't clobber the current shell's
+# Do 'set' in a subshell so we don't clobber the current shell's
 # arguments.  Must try -L first in case configure is actually a
 # symlink; some systems play weird games with the mod time of symlinks
 # (eg FreeBSD returns the mod time of the symlink's containing
 # directory).
 if (
-   set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
-   if test "$[*]" = "X"; then
-      # -L didn't work.
-      set X `ls -t "$srcdir/configure" conftest.file`
-   fi
-   rm -f conftest.file
-   if test "$[*]" != "X $srcdir/configure conftest.file" \
-      && test "$[*]" != "X conftest.file $srcdir/configure"; then
-
-      # If neither matched, then we have a broken ls.  This can happen
-      # if, for instance, CONFIG_SHELL is bash and it inherits a
-      # broken ls alias from the environment.  This has actually
-      # happened.  Such a system could not be considered "sane".
-      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
-alias in your environment])
-   fi
-
+   am_has_slept=no
+   for am_try in 1 2; do
+     echo "timestamp, slept: $am_has_slept" > conftest.file
+     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
+     if test "$[*]" = "X"; then
+	# -L didn't work.
+	set X `ls -t "$srcdir/configure" conftest.file`
+     fi
+     if test "$[*]" != "X $srcdir/configure conftest.file" \
+	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
+
+	# If neither matched, then we have a broken ls.  This can happen
+	# if, for instance, CONFIG_SHELL is bash and it inherits a
+	# broken ls alias from the environment.  This has actually
+	# happened.  Such a system could not be considered "sane".
+	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
+  alias in your environment])
+     fi
+     if test "$[2]" = conftest.file || test $am_try -eq 2; then
+       break
+     fi
+     # Just in case.
+     sleep 1
+     am_has_slept=yes
+   done
    test "$[2]" = conftest.file
    )
 then
@@ -9291,9 +9529,85 @@ else
    AC_MSG_ERROR([newly created file is older than distributed files!
 Check your system clock])
 fi
-AC_MSG_RESULT(yes)])
+AC_MSG_RESULT([yes])
+# If we didn't sleep, we still need to ensure time stamps of config.status and
+# generated files are strictly newer.
+am_sleep_pid=
+if grep 'slept: no' conftest.file >/dev/null 2>&1; then
+  ( sleep 1 ) &
+  am_sleep_pid=$!
+fi
+AC_CONFIG_COMMANDS_PRE(
+  [AC_MSG_CHECKING([that generated files are newer than configure])
+   if test -n "$am_sleep_pid"; then
+     # Hide warnings about reused PIDs.
+     wait $am_sleep_pid 2>/dev/null
+   fi
+   AC_MSG_RESULT([done])])
+rm -f conftest.file
+])
+
+# Copyright (C) 2009-2013 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_SILENT_RULES([DEFAULT])
+# --------------------------
+# Enable less verbose build rules; with the default set to DEFAULT
+# ("yes" being less verbose, "no" or empty being verbose).
+AC_DEFUN([AM_SILENT_RULES],
+[AC_ARG_ENABLE([silent-rules], [dnl
+AS_HELP_STRING(
+  [--enable-silent-rules],
+  [less verbose build output (undo: "make V=1")])
+AS_HELP_STRING(
+  [--disable-silent-rules],
+  [verbose build output (undo: "make V=0")])dnl
+])
+case $enable_silent_rules in @%:@ (((
+  yes) AM_DEFAULT_VERBOSITY=0;;
+   no) AM_DEFAULT_VERBOSITY=1;;
+    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
+esac
+dnl
+dnl A few 'make' implementations (e.g., NonStop OS and NextStep)
+dnl do not support nested variable expansions.
+dnl See automake bug#9928 and bug#10237.
+am_make=${MAKE-make}
+AC_CACHE_CHECK([whether $am_make supports nested variables],
+   [am_cv_make_support_nested_variables],
+   [if AS_ECHO([['TRUE=$(BAR$(V))
+BAR0=false
+BAR1=true
+V=1
+am__doit:
+	@$(TRUE)
+.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
+  am_cv_make_support_nested_variables=yes
+else
+  am_cv_make_support_nested_variables=no
+fi])
+if test $am_cv_make_support_nested_variables = yes; then
+  dnl Using '$V' instead of '$(V)' breaks IRIX make.
+  AM_V='$(V)'
+  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
+else
+  AM_V=$AM_DEFAULT_VERBOSITY
+  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
+fi
+AC_SUBST([AM_V])dnl
+AM_SUBST_NOTMAKE([AM_V])dnl
+AC_SUBST([AM_DEFAULT_V])dnl
+AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
+AC_SUBST([AM_DEFAULT_VERBOSITY])dnl
+AM_BACKSLASH='\'
+AC_SUBST([AM_BACKSLASH])dnl
+_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
+])
 
-# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
+# Copyright (C) 2001-2013 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9301,34 +9615,32 @@ AC_MSG_RESULT(yes)])
 
 # AM_PROG_INSTALL_STRIP
 # ---------------------
-# One issue with vendor `install' (even GNU) is that you can't
+# One issue with vendor 'install' (even GNU) is that you can't
 # specify the program used to strip binaries.  This is especially
 # annoying in cross-compiling environments, where the build's strip
 # is unlikely to handle the host's binaries.
 # Fortunately install-sh will honor a STRIPPROG variable, so we
-# always use install-sh in `make install-strip', and initialize
+# always use install-sh in "make install-strip", and initialize
 # STRIPPROG with the value of the STRIP variable (set by the user).
 AC_DEFUN([AM_PROG_INSTALL_STRIP],
 [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
-# Installed binaries are usually stripped using `strip' when the user
-# run `make install-strip'.  However `strip' might not be the right
+# Installed binaries are usually stripped using 'strip' when the user
+# run "make install-strip".  However 'strip' might not be the right
 # tool to use in cross-compilation environments, therefore Automake
-# will honor the `STRIP' environment variable to overrule this program.
-dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
+# will honor the 'STRIP' environment variable to overrule this program.
+dnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
 if test "$cross_compiling" != no; then
   AC_CHECK_TOOL([STRIP], [strip], :)
 fi
 INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
 AC_SUBST([INSTALL_STRIP_PROGRAM])])
 
-# Copyright (C) 2006, 2008  Free Software Foundation, Inc.
+# Copyright (C) 2006-2013 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 2
-
 # _AM_SUBST_NOTMAKE(VARIABLE)
 # ---------------------------
 # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
@@ -9336,24 +9648,22 @@ AC_SUBST([INSTALL_STRIP_PROGRAM])])
 AC_DEFUN([_AM_SUBST_NOTMAKE])
 
 # AM_SUBST_NOTMAKE(VARIABLE)
-# ---------------------------
+# --------------------------
 # Public sister of _AM_SUBST_NOTMAKE.
 AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
 
 # Check how to create a tarball.                            -*- Autoconf -*-
 
-# Copyright (C) 2004, 2005  Free Software Foundation, Inc.
+# Copyright (C) 2004-2013 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 2
-
 # _AM_PROG_TAR(FORMAT)
 # --------------------
 # Check how to create a tarball in format FORMAT.
-# FORMAT should be one of `v7', `ustar', or `pax'.
+# FORMAT should be one of 'v7', 'ustar', or 'pax'.
 #
 # Substitute a variable $(am__tar) that is a command
 # writing to stdout a FORMAT-tarball containing the directory
@@ -9363,75 +9673,114 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
 # Substitute a variable $(am__untar) that extract such
 # a tarball read from stdin.
 #     $(am__untar) < result.tar
+#
 AC_DEFUN([_AM_PROG_TAR],
-[# Always define AMTAR for backward compatibility.
-AM_MISSING_PROG([AMTAR], [tar])
-m4_if([$1], [v7],
-     [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
-     [m4_case([$1], [ustar],, [pax],,
-              [m4_fatal([Unknown tar format])])
-AC_MSG_CHECKING([how to create a $1 tar archive])
-# Loop over all known methods to create a tar archive until one works.
+[# Always define AMTAR for backward compatibility.  Yes, it's still used
+# in the wild :-(  We should find a proper way to deprecate it ...
+AC_SUBST([AMTAR], ['$${TAR-tar}'])
+
+# We'll loop over all known methods to create a tar archive until one works.
 _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
-_am_tools=${am_cv_prog_tar_$1-$_am_tools}
-# Do not fold the above two line into one, because Tru64 sh and
-# Solaris sh will not grok spaces in the rhs of `-'.
-for _am_tool in $_am_tools
-do
-  case $_am_tool in
-  gnutar)
-    for _am_tar in tar gnutar gtar;
-    do
-      AM_RUN_LOG([$_am_tar --version]) && break
-    done
-    am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
-    am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
-    am__untar="$_am_tar -xf -"
-    ;;
-  plaintar)
-    # Must skip GNU tar: if it does not support --format= it doesn't create
-    # ustar tarball either.
-    (tar --version) >/dev/null 2>&1 && continue
-    am__tar='tar chf - "$$tardir"'
-    am__tar_='tar chf - "$tardir"'
-    am__untar='tar xf -'
-    ;;
-  pax)
-    am__tar='pax -L -x $1 -w "$$tardir"'
-    am__tar_='pax -L -x $1 -w "$tardir"'
-    am__untar='pax -r'
-    ;;
-  cpio)
-    am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
-    am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
-    am__untar='cpio -i -H $1 -d'
-    ;;
-  none)
-    am__tar=false
-    am__tar_=false
-    am__untar=false
-    ;;
-  esac
 
-  # If the value was cached, stop now.  We just wanted to have am__tar
-  # and am__untar set.
-  test -n "${am_cv_prog_tar_$1}" && break
+m4_if([$1], [v7],
+  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
+
+  [m4_case([$1],
+    [ustar],
+     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
+      # There is notably a 21 bits limit for the UID and the GID.  In fact,
+      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
+      # and bug#13588).
+      am_max_uid=2097151 # 2^21 - 1
+      am_max_gid=$am_max_uid
+      # The $UID and $GID variables are not portable, so we need to resort
+      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
+      # below are definitely unexpected, so allow the users to see them
+      # (that is, avoid stderr redirection).
+      am_uid=`id -u || echo unknown`
+      am_gid=`id -g || echo unknown`
+      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
+      if test $am_uid -le $am_max_uid; then
+         AC_MSG_RESULT([yes])
+      else
+         AC_MSG_RESULT([no])
+         _am_tools=none
+      fi
+      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
+      if test $am_gid -le $am_max_gid; then
+         AC_MSG_RESULT([yes])
+      else
+        AC_MSG_RESULT([no])
+        _am_tools=none
+      fi],
+
+  [pax],
+    [],
 
-  # tar/untar a dummy directory, and stop if the command works
-  rm -rf conftest.dir
-  mkdir conftest.dir
-  echo GrepMe > conftest.dir/file
-  AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
+  [m4_fatal([Unknown tar format])])
+
+  AC_MSG_CHECKING([how to create a $1 tar archive])
+
+  # Go ahead even if we have the value already cached.  We do so because we
+  # need to set the values for the 'am__tar' and 'am__untar' variables.
+  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
+
+  for _am_tool in $_am_tools; do
+    case $_am_tool in
+    gnutar)
+      for _am_tar in tar gnutar gtar; do
+        AM_RUN_LOG([$_am_tar --version]) && break
+      done
+      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
+      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
+      am__untar="$_am_tar -xf -"
+      ;;
+    plaintar)
+      # Must skip GNU tar: if it does not support --format= it doesn't create
+      # ustar tarball either.
+      (tar --version) >/dev/null 2>&1 && continue
+      am__tar='tar chf - "$$tardir"'
+      am__tar_='tar chf - "$tardir"'
+      am__untar='tar xf -'
+      ;;
+    pax)
+      am__tar='pax -L -x $1 -w "$$tardir"'
+      am__tar_='pax -L -x $1 -w "$tardir"'
+      am__untar='pax -r'
+      ;;
+    cpio)
+      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
+      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
+      am__untar='cpio -i -H $1 -d'
+      ;;
+    none)
+      am__tar=false
+      am__tar_=false
+      am__untar=false
+      ;;
+    esac
+
+    # If the value was cached, stop now.  We just wanted to have am__tar
+    # and am__untar set.
+    test -n "${am_cv_prog_tar_$1}" && break
+
+    # tar/untar a dummy directory, and stop if the command works.
+    rm -rf conftest.dir
+    mkdir conftest.dir
+    echo GrepMe > conftest.dir/file
+    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
+    rm -rf conftest.dir
+    if test -s conftest.tar; then
+      AM_RUN_LOG([$am__untar <conftest.tar])
+      AM_RUN_LOG([cat conftest.dir/file])
+      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
+    fi
+  done
   rm -rf conftest.dir
-  if test -s conftest.tar; then
-    AM_RUN_LOG([$am__untar <conftest.tar])
-    grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
-  fi
-done
-rm -rf conftest.dir
 
-AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
-AC_MSG_RESULT([$am_cv_prog_tar_$1])])
+  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
+  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
+
 AC_SUBST([am__tar])
 AC_SUBST([am__untar])
 ]) # _AM_PROG_TAR
diff --git a/bindings/cpp/bin/Makefile.in b/bindings/cpp/bin/Makefile.in
index 3ea2018..af20830 100644
--- a/bindings/cpp/bin/Makefile.in
+++ b/bindings/cpp/bin/Makefile.in
@@ -1,9 +1,8 @@
-# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# Makefile.in generated by automake 1.14.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
-# Inc.
+# Copyright (C) 1994-2013 Free Software Foundation, Inc.
+
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -16,6 +15,51 @@
 @SET_MAKE@
 
 VPATH = @srcdir@
+am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+am__make_running_with_option = \
+  case $${target_option-} in \
+      ?) ;; \
+      *) echo "am__make_running_with_option: internal error: invalid" \
+              "target option '$${target_option-}' specified" >&2; \
+         exit 1;; \
+  esac; \
+  has_opt=no; \
+  sane_makeflags=$$MAKEFLAGS; \
+  if $(am__is_gnu_make); then \
+    sane_makeflags=$$MFLAGS; \
+  else \
+    case $$MAKEFLAGS in \
+      *\\[\ \	]*) \
+        bs=\\; \
+        sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+          | sed "s/$$bs$$bs[$$bs $$bs	]*//g"`;; \
+    esac; \
+  fi; \
+  skip_next=no; \
+  strip_trailopt () \
+  { \
+    flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+  }; \
+  for flg in $$sane_makeflags; do \
+    test $$skip_next = yes && { skip_next=no; continue; }; \
+    case $$flg in \
+      *=*|--*) continue;; \
+        -*I) strip_trailopt 'I'; skip_next=yes;; \
+      -*I?*) strip_trailopt 'I';; \
+        -*O) strip_trailopt 'O'; skip_next=yes;; \
+      -*O?*) strip_trailopt 'O';; \
+        -*l) strip_trailopt 'l'; skip_next=yes;; \
+      -*l?*) strip_trailopt 'l';; \
+      -[dEDm]) skip_next=yes;; \
+      -[JT]) skip_next=yes;; \
+    esac; \
+    case $$flg in \
+      *$$target_option*) has_opt=yes; break;; \
+    esac; \
+  done; \
+  test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
 pkgdatadir = $(datadir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
@@ -36,7 +80,8 @@ build_triplet = @build@
 host_triplet = @host@
 noinst_PROGRAMS = devs$(EXEEXT) sine$(EXEEXT)
 subdir = bin
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
+	$(top_srcdir)/../../depcomp
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
@@ -50,30 +95,78 @@ devs_OBJECTS = $(am_devs_OBJECTS)
 devs_LDADD = $(LDADD)
 devs_DEPENDENCIES = $(LIBDIR)/libportaudiocpp.la \
 	$(top_builddir)/$(PORTAUDIO_ROOT)/lib/libportaudio.la
+AM_V_lt = $(am__v_lt_ at AM_V@)
+am__v_lt_ = $(am__v_lt_ at AM_DEFAULT_V@)
+am__v_lt_0 = --silent
+am__v_lt_1 = 
 am_sine_OBJECTS = sine.$(OBJEXT)
 sine_OBJECTS = $(am_sine_OBJECTS)
 sine_LDADD = $(LDADD)
 sine_DEPENDENCIES = $(LIBDIR)/libportaudiocpp.la \
 	$(top_builddir)/$(PORTAUDIO_ROOT)/lib/libportaudio.la
+AM_V_P = $(am__v_P_ at AM_V@)
+am__v_P_ = $(am__v_P_ at AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_ at AM_V@)
+am__v_GEN_ = $(am__v_GEN_ at AM_DEFAULT_V@)
+am__v_GEN_0 = @echo "  GEN     " $@;
+am__v_GEN_1 = 
+AM_V_at = $(am__v_at_ at AM_V@)
+am__v_at_ = $(am__v_at_ at AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 = 
 depcomp = $(SHELL) $(top_srcdir)/../../depcomp
 am__depfiles_maybe = depfiles
 am__mv = mv -f
 CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
 	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
-LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
-	--mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
-	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \
+	$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+	$(AM_CXXFLAGS) $(CXXFLAGS)
+AM_V_CXX = $(am__v_CXX_ at AM_V@)
+am__v_CXX_ = $(am__v_CXX_ at AM_DEFAULT_V@)
+am__v_CXX_0 = @echo "  CXX     " $@;
+am__v_CXX_1 = 
 CXXLD = $(CXX)
-CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
-	--mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \
-	$(LDFLAGS) -o $@
+CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
+	$(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_CXXLD = $(am__v_CXXLD_ at AM_V@)
+am__v_CXXLD_ = $(am__v_CXXLD_ at AM_DEFAULT_V@)
+am__v_CXXLD_0 = @echo "  CXXLD   " $@;
+am__v_CXXLD_1 = 
 SOURCES = $(devs_SOURCES) $(sine_SOURCES)
 DIST_SOURCES = $(devs_SOURCES) $(sine_SOURCES)
+am__can_run_installinfo = \
+  case $$AM_UPDATE_INFO_DIR in \
+    n|no|NO) false;; \
+    *) (install-info --version) >/dev/null 2>&1;; \
+  esac
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates.  Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+  BEGIN { nonempty = 0; } \
+  { items[$$0] = 1; nonempty = 1; } \
+  END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique.  This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+  list='$(am__tagged_files)'; \
+  unique=`for i in $$list; do \
+    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+  done | $(am__uniquify_input)`
 ETAGS = etags
 CTAGS = ctags
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
 AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
 AR = @AR@
 AS = @AS@
 AUTOCONF = @AUTOCONF@
@@ -243,12 +336,14 @@ clean-noinstPROGRAMS:
 	list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
 	echo " rm -f" $$list; \
 	rm -f $$list
-devs$(EXEEXT): $(devs_OBJECTS) $(devs_DEPENDENCIES) 
+
+devs$(EXEEXT): $(devs_OBJECTS) $(devs_DEPENDENCIES) $(EXTRA_devs_DEPENDENCIES) 
 	@rm -f devs$(EXEEXT)
-	$(CXXLINK) $(devs_OBJECTS) $(devs_LDADD) $(LIBS)
-sine$(EXEEXT): $(sine_OBJECTS) $(sine_DEPENDENCIES) 
+	$(AM_V_CXXLD)$(CXXLINK) $(devs_OBJECTS) $(devs_LDADD) $(LIBS)
+
+sine$(EXEEXT): $(sine_OBJECTS) $(sine_DEPENDENCIES) $(EXTRA_sine_DEPENDENCIES) 
 	@rm -f sine$(EXEEXT)
-	$(CXXLINK) $(sine_OBJECTS) $(sine_LDADD) $(LIBS)
+	$(AM_V_CXXLD)$(CXXLINK) $(sine_OBJECTS) $(sine_LDADD) $(LIBS)
 
 mostlyclean-compile:
 	-rm -f *.$(OBJEXT)
@@ -260,53 +355,53 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/sine.Po at am__quote@
 
 .cxx.o:
- at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXXCOMPILE) -c -o $@ $<
+ at am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ $<
 
 .cxx.obj:
- at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+ at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+ at am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .cxx.lo:
- at am__fastdepCXX_TRUE@	$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(LTCXXCOMPILE) -c -o $@ $<
+ at am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
 
 devs.o: $(BINDIR)/devs.cxx
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT devs.o -MD -MP -MF $(DEPDIR)/devs.Tpo -c -o devs.o `test -f '$(BINDIR)/devs.cxx' || echo '$(srcdir)/'`$(BINDIR)/devs.cxx
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/devs.Tpo $(DEPDIR)/devs.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$(BINDIR)/devs.cxx' object='devs.o' libtool=no @AMDEPBACKSLASH@
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT devs.o -MD -MP -MF $(DEPDIR)/devs.Tpo -c -o devs.o `test -f '$(BINDIR)/devs.cxx' || echo '$(srcdir)/'`$(BINDIR)/devs.cxx
+ at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/devs.Tpo $(DEPDIR)/devs.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$(BINDIR)/devs.cxx' object='devs.o' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o devs.o `test -f '$(BINDIR)/devs.cxx' || echo '$(srcdir)/'`$(BINDIR)/devs.cxx
+ at am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o devs.o `test -f '$(BINDIR)/devs.cxx' || echo '$(srcdir)/'`$(BINDIR)/devs.cxx
 
 devs.obj: $(BINDIR)/devs.cxx
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT devs.obj -MD -MP -MF $(DEPDIR)/devs.Tpo -c -o devs.obj `if test -f '$(BINDIR)/devs.cxx'; then $(CYGPATH_W) '$(BINDIR)/devs.cxx'; else $(CYGPATH_W) '$(srcdir)/$(BINDIR)/devs.cxx'; fi`
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/devs.Tpo $(DEPDIR)/devs.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$(BINDIR)/devs.cxx' object='devs.obj' libtool=no @AMDEPBACKSLASH@
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT devs.obj -MD -MP -MF $(DEPDIR)/devs.Tpo -c -o devs.obj `if test -f '$(BINDIR)/devs.cxx'; then $(CYGPATH_W) '$(BINDIR)/devs.cxx'; else $(CYGPATH_W) '$(srcdir)/$(BINDIR)/devs.cxx'; fi`
+ at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/devs.Tpo $(DEPDIR)/devs.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$(BINDIR)/devs.cxx' object='devs.obj' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o devs.obj `if test -f '$(BINDIR)/devs.cxx'; then $(CYGPATH_W) '$(BINDIR)/devs.cxx'; else $(CYGPATH_W) '$(srcdir)/$(BINDIR)/devs.cxx'; fi`
+ at am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o devs.obj `if test -f '$(BINDIR)/devs.cxx'; then $(CYGPATH_W) '$(BINDIR)/devs.cxx'; else $(CYGPATH_W) '$(srcdir)/$(BINDIR)/devs.cxx'; fi`
 
 sine.o: $(BINDIR)/sine.cxx
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT sine.o -MD -MP -MF $(DEPDIR)/sine.Tpo -c -o sine.o `test -f '$(BINDIR)/sine.cxx' || echo '$(srcdir)/'`$(BINDIR)/sine.cxx
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/sine.Tpo $(DEPDIR)/sine.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$(BINDIR)/sine.cxx' object='sine.o' libtool=no @AMDEPBACKSLASH@
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT sine.o -MD -MP -MF $(DEPDIR)/sine.Tpo -c -o sine.o `test -f '$(BINDIR)/sine.cxx' || echo '$(srcdir)/'`$(BINDIR)/sine.cxx
+ at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/sine.Tpo $(DEPDIR)/sine.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$(BINDIR)/sine.cxx' object='sine.o' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o sine.o `test -f '$(BINDIR)/sine.cxx' || echo '$(srcdir)/'`$(BINDIR)/sine.cxx
+ at am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o sine.o `test -f '$(BINDIR)/sine.cxx' || echo '$(srcdir)/'`$(BINDIR)/sine.cxx
 
 sine.obj: $(BINDIR)/sine.cxx
- at am__fastdepCXX_TRUE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT sine.obj -MD -MP -MF $(DEPDIR)/sine.Tpo -c -o sine.obj `if test -f '$(BINDIR)/sine.cxx'; then $(CYGPATH_W) '$(BINDIR)/sine.cxx'; else $(CYGPATH_W) '$(srcdir)/$(BINDIR)/sine.cxx'; fi`
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/sine.Tpo $(DEPDIR)/sine.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$(BINDIR)/sine.cxx' object='sine.obj' libtool=no @AMDEPBACKSLASH@
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT sine.obj -MD -MP -MF $(DEPDIR)/sine.Tpo -c -o sine.obj `if test -f '$(BINDIR)/sine.cxx'; then $(CYGPATH_W) '$(BINDIR)/sine.cxx'; else $(CYGPATH_W) '$(srcdir)/$(BINDIR)/sine.cxx'; fi`
+ at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/sine.Tpo $(DEPDIR)/sine.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$(BINDIR)/sine.cxx' object='sine.obj' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o sine.obj `if test -f '$(BINDIR)/sine.cxx'; then $(CYGPATH_W) '$(BINDIR)/sine.cxx'; else $(CYGPATH_W) '$(srcdir)/$(BINDIR)/sine.cxx'; fi`
+ at am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o sine.obj `if test -f '$(BINDIR)/sine.cxx'; then $(CYGPATH_W) '$(BINDIR)/sine.cxx'; else $(CYGPATH_W) '$(srcdir)/$(BINDIR)/sine.cxx'; fi`
 
 mostlyclean-libtool:
 	-rm -f *.lo
@@ -314,26 +409,15 @@ mostlyclean-libtool:
 clean-libtool:
 	-rm -rf .libs _libs
 
-ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
-	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
-	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	mkid -fID $$unique
-tags: TAGS
-
-TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
-		$(TAGS_FILES) $(LISP)
+ID: $(am__tagged_files)
+	$(am__define_uniq_tagged_files); mkid -fID $$unique
+tags: tags-am
+TAGS: tags
+
+tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
 	set x; \
 	here=`pwd`; \
-	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
-	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	$(am__define_uniq_tagged_files); \
 	shift; \
 	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
 	  test -n "$$unique" || unique=$$empty_fix; \
@@ -345,15 +429,11 @@ TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 	      $$unique; \
 	  fi; \
 	fi
-ctags: CTAGS
-CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
-		$(TAGS_FILES) $(LISP)
-	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
-	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+ctags: ctags-am
+
+CTAGS: ctags
+ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+	$(am__define_uniq_tagged_files); \
 	test -z "$(CTAGS_ARGS)$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
 	     $$unique
@@ -362,6 +442,21 @@ GTAGS:
 	here=`$(am__cd) $(top_builddir) && pwd` \
 	  && $(am__cd) $(top_srcdir) \
 	  && gtags -i $(GTAGS_ARGS) "$$here"
+cscopelist: cscopelist-am
+
+cscopelist-am: $(am__tagged_files)
+	list='$(am__tagged_files)'; \
+	case "$(srcdir)" in \
+	  [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+	  *) sdir=$(subdir)/$(srcdir) ;; \
+	esac; \
+	for i in $$list; do \
+	  if test -f "$$i"; then \
+	    echo "$(subdir)/$$i"; \
+	  else \
+	    echo "$$sdir/$$i"; \
+	  fi; \
+	done >> $(top_builddir)/cscope.files
 
 distclean-tags:
 	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
@@ -410,10 +505,15 @@ install-am: all-am
 
 installcheck: installcheck-am
 install-strip:
-	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	  `test -z '$(STRIP)' || \
-	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
 mostlyclean-generic:
 
 clean-generic:
@@ -498,18 +598,19 @@ uninstall-am:
 
 .MAKE: install-am install-strip
 
-.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
-	clean-libtool clean-noinstPROGRAMS ctags distclean \
-	distclean-compile distclean-generic distclean-libtool \
-	distclean-tags distdir dvi dvi-am html html-am info info-am \
-	install install-am install-data install-data-am install-dvi \
-	install-dvi-am install-exec install-exec-am install-html \
-	install-html-am install-info install-info-am install-man \
-	install-pdf install-pdf-am install-ps install-ps-am \
-	install-strip installcheck installcheck-am installdirs \
-	maintainer-clean maintainer-clean-generic mostlyclean \
-	mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
-	pdf pdf-am ps ps-am tags uninstall uninstall-am
+.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
+	clean-libtool clean-noinstPROGRAMS cscopelist-am ctags \
+	ctags-am distclean distclean-compile distclean-generic \
+	distclean-libtool distclean-tags distdir dvi dvi-am html \
+	html-am info info-am install install-am install-data \
+	install-data-am install-dvi install-dvi-am install-exec \
+	install-exec-am install-html install-html-am install-info \
+	install-info-am install-man install-pdf install-pdf-am \
+	install-ps install-ps-am install-strip installcheck \
+	installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-compile \
+	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+	tags tags-am uninstall uninstall-am
 
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
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 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
-	ProjectType="Visual C++"
-	Version="7.10"
-	Name="devs_example"
-	ProjectGUID="{1B9A038D-80A3-4DBD-9F0D-AF10B49B863A}"
-	Keyword="Win32Proj">
-	<Platforms>
-		<Platform
-			Name="Win32"/>
-	</Platforms>
-	<Configurations>
-		<Configuration
-			Name="Debug|Win32"
-			OutputDirectory="Debug"
-			IntermediateDirectory="Debug"
-			ConfigurationType="1"
-			CharacterSet="2">
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				AdditionalIncludeDirectories="../../include/;../../../../include/;../../../../src/common/;../../../../../asiosdk2/common/,../../../../../asiosdk2/host/,../../../../../asiosdk2/host/pc/"
-				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
-				MinimalRebuild="TRUE"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="3"
-				UsePrecompiledHeader="0"
-				ProgramDataBaseFileName="$(IntDir)/vc71.pdb"
-				WarningLevel="3"
-				Detect64BitPortabilityProblems="TRUE"
-				DebugInformationFormat="3"/>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="../../lib/portaudiocpp-vc7_1-d.lib"
-				OutputFile="../../bin/devs_example.exe"
-				LinkIncremental="2"
-				GenerateDebugInformation="TRUE"
-				ProgramDatabaseFile="$(OutDir)/devs_example.pdb"
-				SubSystem="1"
-				TargetMachine="1"/>
-			<Tool
-				Name="VCMIDLTool"/>
-			<Tool
-				Name="VCPostBuildEventTool"/>
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCPreLinkEventTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"/>
-			<Tool
-				Name="VCWebDeploymentTool"/>
-			<Tool
-				Name="VCManagedWrapperGeneratorTool"/>
-			<Tool
-				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
-		</Configuration>
-		<Configuration
-			Name="Release|Win32"
-			OutputDirectory="Release"
-			IntermediateDirectory="Release"
-			ConfigurationType="1"
-			CharacterSet="2">
-			<Tool
-				Name="VCCLCompilerTool"
-				AdditionalIncludeDirectories="../../include/;../../../../include/;../../../../src/common/;../../../../../asiosdk2/common/,../../../../../asiosdk2/host/,../../../../../asiosdk2/host/pc/"
-				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
-				RuntimeLibrary="2"
-				UsePrecompiledHeader="0"
-				ProgramDataBaseFileName="$(IntDir)/vc71.pdb"
-				WarningLevel="3"
-				Detect64BitPortabilityProblems="TRUE"
-				DebugInformationFormat="3"/>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="../../lib/portaudiocpp-vc7_1-r.lib"
-				OutputFile="../../bin/devs_example.exe"
-				LinkIncremental="1"
-				GenerateDebugInformation="TRUE"
-				SubSystem="1"
-				OptimizeReferences="2"
-				EnableCOMDATFolding="2"
-				TargetMachine="1"/>
-			<Tool
-				Name="VCMIDLTool"/>
-			<Tool
-				Name="VCPostBuildEventTool"/>
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCPreLinkEventTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"/>
-			<Tool
-				Name="VCWebDeploymentTool"/>
-			<Tool
-				Name="VCManagedWrapperGeneratorTool"/>
-			<Tool
-				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
-		</Configuration>
-	</Configurations>
-	<References>
-	</References>
-	<Files>
-		<Filter
-			Name="Files"
-			Filter="">
-			<File
-				RelativePath="..\..\example\devs.cxx">
-			</File>
-		</Filter>
-		<Filter
-			Name="PortAudio v19 Files"
-			Filter="">
-			<File
-				RelativePath="..\..\..\..\src\common\pa_allocation.c">
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\hostapi\asio\pa_asio.cpp">
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\common\pa_converters.c">
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\common\pa_cpuload.c">
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\common\pa_dither.c">
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\common\pa_front.c">
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\common\pa_process.c">
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\hostapi\skeleton\pa_hostapi_skeleton.c">
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\common\pa_stream.c">
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\common\pa_trace.c">
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\hostapi\dsound\pa_win_ds.c">
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\hostapi\dsound\pa_win_ds_dynlink.c">
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\os\win\pa_win_hostapis.c">
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\os\win\pa_win_util.c">
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\hostapi\wasapi\pa_win_wasapi.cpp">
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\hostapi\wmme\pa_win_wmme.c">
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\os\win\pa_x86_plain_converters.c">
-			</File>
-		</Filter>
-		<Filter
-			Name="ASIO 2 SDK Files"
-			Filter="">
-			<File
-				RelativePath="..\..\..\..\..\asiosdk2\common\asio.cpp">
-			</File>
-			<File
-				RelativePath="..\..\..\..\..\asiosdk2\host\asiodrivers.cpp">
-			</File>
-			<File
-				RelativePath="..\..\..\..\..\asiosdk2\host\pc\asiolist.cpp">
-			</File>
-		</Filter>
-	</Files>
-	<Globals>
-	</Globals>
-</VisualStudioProject>
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="7.10"
+	Name="devs_example"
+	ProjectGUID="{1B9A038D-80A3-4DBD-9F0D-AF10B49B863A}"
+	Keyword="Win32Proj">
+	<Platforms>
+		<Platform
+			Name="Win32"/>
+	</Platforms>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="Debug"
+			IntermediateDirectory="Debug"
+			ConfigurationType="1"
+			CharacterSet="2">
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="../../include/;../../../../include/;../../../../src/common/;../../../../../asiosdk2/common/,../../../../../asiosdk2/host/,../../../../../asiosdk2/host/pc/"
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+				MinimalRebuild="TRUE"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				ProgramDataBaseFileName="$(IntDir)/vc71.pdb"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="TRUE"
+				DebugInformationFormat="3"/>
+			<Tool
+				Name="VCCustomBuildTool"/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="../../lib/portaudiocpp-vc7_1-d.lib"
+				OutputFile="../../bin/devs_example.exe"
+				LinkIncremental="2"
+				GenerateDebugInformation="TRUE"
+				ProgramDatabaseFile="$(OutDir)/devs_example.pdb"
+				SubSystem="1"
+				TargetMachine="1"/>
+			<Tool
+				Name="VCMIDLTool"/>
+			<Tool
+				Name="VCPostBuildEventTool"/>
+			<Tool
+				Name="VCPreBuildEventTool"/>
+			<Tool
+				Name="VCPreLinkEventTool"/>
+			<Tool
+				Name="VCResourceCompilerTool"/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"/>
+			<Tool
+				Name="VCWebDeploymentTool"/>
+			<Tool
+				Name="VCManagedWrapperGeneratorTool"/>
+			<Tool
+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="Release"
+			IntermediateDirectory="Release"
+			ConfigurationType="1"
+			CharacterSet="2">
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="../../include/;../../../../include/;../../../../src/common/;../../../../../asiosdk2/common/,../../../../../asiosdk2/host/,../../../../../asiosdk2/host/pc/"
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+				RuntimeLibrary="2"
+				UsePrecompiledHeader="0"
+				ProgramDataBaseFileName="$(IntDir)/vc71.pdb"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="TRUE"
+				DebugInformationFormat="3"/>
+			<Tool
+				Name="VCCustomBuildTool"/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="../../lib/portaudiocpp-vc7_1-r.lib"
+				OutputFile="../../bin/devs_example.exe"
+				LinkIncremental="1"
+				GenerateDebugInformation="TRUE"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				TargetMachine="1"/>
+			<Tool
+				Name="VCMIDLTool"/>
+			<Tool
+				Name="VCPostBuildEventTool"/>
+			<Tool
+				Name="VCPreBuildEventTool"/>
+			<Tool
+				Name="VCPreLinkEventTool"/>
+			<Tool
+				Name="VCResourceCompilerTool"/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"/>
+			<Tool
+				Name="VCWebDeploymentTool"/>
+			<Tool
+				Name="VCManagedWrapperGeneratorTool"/>
+			<Tool
+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Files"
+			Filter="">
+			<File
+				RelativePath="..\..\example\devs.cxx">
+			</File>
+		</Filter>
+		<Filter
+			Name="PortAudio v19 Files"
+			Filter="">
+			<File
+				RelativePath="..\..\..\..\src\common\pa_allocation.c">
+			</File>
+			<File
+				RelativePath="..\..\..\..\src\hostapi\asio\pa_asio.cpp">
+			</File>
+			<File
+				RelativePath="..\..\..\..\src\common\pa_converters.c">
+			</File>
+			<File
+				RelativePath="..\..\..\..\src\common\pa_cpuload.c">
+			</File>
+			<File
+				RelativePath="..\..\..\..\src\common\pa_dither.c">
+			</File>
+			<File
+				RelativePath="..\..\..\..\src\common\pa_front.c">
+			</File>
+			<File
+				RelativePath="..\..\..\..\src\common\pa_process.c">
+			</File>
+			<File
+				RelativePath="..\..\..\..\src\hostapi\skeleton\pa_hostapi_skeleton.c">
+			</File>
+			<File
+				RelativePath="..\..\..\..\src\common\pa_stream.c">
+			</File>
+			<File
+				RelativePath="..\..\..\..\src\common\pa_trace.c">
+			</File>
+			<File
+				RelativePath="..\..\..\..\src\hostapi\dsound\pa_win_ds.c">
+			</File>
+			<File
+				RelativePath="..\..\..\..\src\hostapi\dsound\pa_win_ds_dynlink.c">
+			</File>
+			<File
+				RelativePath="..\..\..\..\src\os\win\pa_win_hostapis.c">
+			</File>
+			<File
+				RelativePath="..\..\..\..\src\os\win\pa_win_util.c">
+			</File>
+			<File
+				RelativePath="..\..\..\..\src\hostapi\wasapi\pa_win_wasapi.cpp">
+			</File>
+			<File
+				RelativePath="..\..\..\..\src\hostapi\wmme\pa_win_wmme.c">
+			</File>
+			<File
+				RelativePath="..\..\..\..\src\os\win\pa_x86_plain_converters.c">
+			</File>
+		</Filter>
+		<Filter
+			Name="ASIO 2 SDK Files"
+			Filter="">
+			<File
+				RelativePath="..\..\..\..\..\asiosdk2\common\asio.cpp">
+			</File>
+			<File
+				RelativePath="..\..\..\..\..\asiosdk2\host\asiodrivers.cpp">
+			</File>
+			<File
+				RelativePath="..\..\..\..\..\asiosdk2\host\pc\asiolist.cpp">
+			</File>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>
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 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
-	ProjectType="Visual C++"
-	Version="7.10"
-	Name="sine_example"
-	ProjectGUID="{1B9A038D-80A3-4DBD-9F0D-AF10B49B863A}"
-	Keyword="Win32Proj">
-	<Platforms>
-		<Platform
-			Name="Win32"/>
-	</Platforms>
-	<Configurations>
-		<Configuration
-			Name="Debug|Win32"
-			OutputDirectory="Debug"
-			IntermediateDirectory="Debug"
-			ConfigurationType="1"
-			CharacterSet="2">
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				AdditionalIncludeDirectories="../../include/;../../../../include/;../../../../src/common/;../../../../../asiosdk2/common/,../../../../../asiosdk2/host/,../../../../../asiosdk2/host/pc/"
-				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
-				MinimalRebuild="TRUE"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="3"
-				UsePrecompiledHeader="0"
-				ProgramDataBaseFileName="$(IntDir)/vc71.pdb"
-				WarningLevel="3"
-				Detect64BitPortabilityProblems="TRUE"
-				DebugInformationFormat="3"/>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="../../lib/portaudiocpp-vc7_1-d.lib"
-				OutputFile="../../bin/sine_example.exe"
-				LinkIncremental="2"
-				GenerateDebugInformation="TRUE"
-				ProgramDatabaseFile="$(OutDir)/sine_example.pdb"
-				SubSystem="1"
-				TargetMachine="1"/>
-			<Tool
-				Name="VCMIDLTool"/>
-			<Tool
-				Name="VCPostBuildEventTool"/>
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCPreLinkEventTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"/>
-			<Tool
-				Name="VCWebDeploymentTool"/>
-			<Tool
-				Name="VCManagedWrapperGeneratorTool"/>
-			<Tool
-				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
-		</Configuration>
-		<Configuration
-			Name="Release|Win32"
-			OutputDirectory="Release"
-			IntermediateDirectory="Release"
-			ConfigurationType="1"
-			CharacterSet="2">
-			<Tool
-				Name="VCCLCompilerTool"
-				AdditionalIncludeDirectories="../../include/;../../../../include/;../../../../src/common/;../../../../../asiosdk2/common/,../../../../../asiosdk2/host/,../../../../../asiosdk2/host/pc/"
-				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
-				RuntimeLibrary="2"
-				UsePrecompiledHeader="0"
-				ProgramDataBaseFileName="$(IntDir)/vc71.pdb"
-				WarningLevel="3"
-				Detect64BitPortabilityProblems="TRUE"
-				DebugInformationFormat="3"/>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="../../lib/portaudiocpp-vc7_1-r.lib"
-				OutputFile="../../bin/sine_example.exe"
-				LinkIncremental="1"
-				GenerateDebugInformation="TRUE"
-				SubSystem="1"
-				OptimizeReferences="2"
-				EnableCOMDATFolding="2"
-				TargetMachine="1"/>
-			<Tool
-				Name="VCMIDLTool"/>
-			<Tool
-				Name="VCPostBuildEventTool"/>
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCPreLinkEventTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"/>
-			<Tool
-				Name="VCWebDeploymentTool"/>
-			<Tool
-				Name="VCManagedWrapperGeneratorTool"/>
-			<Tool
-				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
-		</Configuration>
-	</Configurations>
-	<References>
-	</References>
-	<Files>
-		<Filter
-			Name="Files"
-			Filter="">
-			<File
-				RelativePath="..\..\example\sine.cxx">
-			</File>
-		</Filter>
-		<Filter
-			Name="PortAudio v19 Files"
-			Filter="">
-			<File
-				RelativePath="..\..\..\..\src\common\pa_allocation.c">
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						ObjectFile="$(IntDir)/$(InputName)1.obj"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						ObjectFile="$(IntDir)/$(InputName)1.obj"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\hostapi\asio\pa_asio.cpp">
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\common\pa_converters.c">
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						ObjectFile="$(IntDir)/$(InputName)1.obj"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						ObjectFile="$(IntDir)/$(InputName)1.obj"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\common\pa_cpuload.c">
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						ObjectFile="$(IntDir)/$(InputName)1.obj"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						ObjectFile="$(IntDir)/$(InputName)1.obj"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\common\pa_dither.c">
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						ObjectFile="$(IntDir)/$(InputName)1.obj"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						ObjectFile="$(IntDir)/$(InputName)1.obj"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\common\pa_front.c">
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						ObjectFile="$(IntDir)/$(InputName)1.obj"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						ObjectFile="$(IntDir)/$(InputName)1.obj"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\common\pa_process.c">
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						ObjectFile="$(IntDir)/$(InputName)1.obj"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						ObjectFile="$(IntDir)/$(InputName)1.obj"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\hostapi\skeleton\pa_hostapi_skeleton.c">
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						ObjectFile="$(IntDir)/$(InputName)1.obj"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						ObjectFile="$(IntDir)/$(InputName)1.obj"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\common\pa_stream.c">
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						ObjectFile="$(IntDir)/$(InputName)1.obj"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						ObjectFile="$(IntDir)/$(InputName)1.obj"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\common\pa_trace.c">
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						ObjectFile="$(IntDir)/$(InputName)1.obj"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						ObjectFile="$(IntDir)/$(InputName)1.obj"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\hostapi\dsound\pa_win_ds.c">
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						ObjectFile="$(IntDir)/$(InputName)1.obj"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						ObjectFile="$(IntDir)/$(InputName)1.obj"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\hostapi\dsound\pa_win_ds_dynlink.c">
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\os\win\pa_win_hostapis.c">
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\os\win\pa_win_util.c">
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\hostapi\wasapi\pa_win_wasapi.cpp">
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\hostapi\wmme\pa_win_wmme.c">
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						ObjectFile="$(IntDir)/$(InputName)1.obj"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						ObjectFile="$(IntDir)/$(InputName)1.obj"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="..\..\..\..\src\os\win\pa_x86_plain_converters.c">
-			</File>
-		</Filter>
-		<Filter
-			Name="ASIO 2 SDK Files"
-			Filter="">
-			<File
-				RelativePath="..\..\..\..\..\asiosdk2\common\asio.cpp">
-			</File>
-			<File
-				RelativePath="..\..\..\..\..\asiosdk2\host\asiodrivers.cpp">
-			</File>
-			<File
-				RelativePath="..\..\..\..\..\asiosdk2\host\pc\asiolist.cpp">
-			</File>
-		</Filter>
-	</Files>
-	<Globals>
-	</Globals>
-</VisualStudioProject>
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="7.10"
+	Name="sine_example"
+	ProjectGUID="{1B9A038D-80A3-4DBD-9F0D-AF10B49B863A}"
+	Keyword="Win32Proj">
+	<Platforms>
+		<Platform
+			Name="Win32"/>
+	</Platforms>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="Debug"
+			IntermediateDirectory="Debug"
+			ConfigurationType="1"
+			CharacterSet="2">
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="../../include/;../../../../include/;../../../../src/common/;../../../../../asiosdk2/common/,../../../../../asiosdk2/host/,../../../../../asiosdk2/host/pc/"
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+				MinimalRebuild="TRUE"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				ProgramDataBaseFileName="$(IntDir)/vc71.pdb"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="TRUE"
+				DebugInformationFormat="3"/>
+			<Tool
+				Name="VCCustomBuildTool"/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="../../lib/portaudiocpp-vc7_1-d.lib"
+				OutputFile="../../bin/sine_example.exe"
+				LinkIncremental="2"
+				GenerateDebugInformation="TRUE"
+				ProgramDatabaseFile="$(OutDir)/sine_example.pdb"
+				SubSystem="1"
+				TargetMachine="1"/>
+			<Tool
+				Name="VCMIDLTool"/>
+			<Tool
+				Name="VCPostBuildEventTool"/>
+			<Tool
+				Name="VCPreBuildEventTool"/>
+			<Tool
+				Name="VCPreLinkEventTool"/>
+			<Tool
+				Name="VCResourceCompilerTool"/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"/>
+			<Tool
+				Name="VCWebDeploymentTool"/>
+			<Tool
+				Name="VCManagedWrapperGeneratorTool"/>
+			<Tool
+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="Release"
+			IntermediateDirectory="Release"
+			ConfigurationType="1"
+			CharacterSet="2">
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="../../include/;../../../../include/;../../../../src/common/;../../../../../asiosdk2/common/,../../../../../asiosdk2/host/,../../../../../asiosdk2/host/pc/"
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+				RuntimeLibrary="2"
+				UsePrecompiledHeader="0"
+				ProgramDataBaseFileName="$(IntDir)/vc71.pdb"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="TRUE"
+				DebugInformationFormat="3"/>
+			<Tool
+				Name="VCCustomBuildTool"/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="../../lib/portaudiocpp-vc7_1-r.lib"
+				OutputFile="../../bin/sine_example.exe"
+				LinkIncremental="1"
+				GenerateDebugInformation="TRUE"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				TargetMachine="1"/>
+			<Tool
+				Name="VCMIDLTool"/>
+			<Tool
+				Name="VCPostBuildEventTool"/>
+			<Tool
+				Name="VCPreBuildEventTool"/>
+			<Tool
+				Name="VCPreLinkEventTool"/>
+			<Tool
+				Name="VCResourceCompilerTool"/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"/>
+			<Tool
+				Name="VCWebDeploymentTool"/>
+			<Tool
+				Name="VCManagedWrapperGeneratorTool"/>
+			<Tool
+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Files"
+			Filter="">
+			<File
+				RelativePath="..\..\example\sine.cxx">
+			</File>
+		</Filter>
+		<Filter
+			Name="PortAudio v19 Files"
+			Filter="">
+			<File
+				RelativePath="..\..\..\..\src\common\pa_allocation.c">
+				<FileConfiguration
+					Name="Debug|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						ObjectFile="$(IntDir)/$(InputName)1.obj"/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						ObjectFile="$(IntDir)/$(InputName)1.obj"/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\..\..\..\src\hostapi\asio\pa_asio.cpp">
+			</File>
+			<File
+				RelativePath="..\..\..\..\src\common\pa_converters.c">
+				<FileConfiguration
+					Name="Debug|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						ObjectFile="$(IntDir)/$(InputName)1.obj"/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						ObjectFile="$(IntDir)/$(InputName)1.obj"/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\..\..\..\src\common\pa_cpuload.c">
+				<FileConfiguration
+					Name="Debug|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						ObjectFile="$(IntDir)/$(InputName)1.obj"/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						ObjectFile="$(IntDir)/$(InputName)1.obj"/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\..\..\..\src\common\pa_dither.c">
+				<FileConfiguration
+					Name="Debug|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						ObjectFile="$(IntDir)/$(InputName)1.obj"/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						ObjectFile="$(IntDir)/$(InputName)1.obj"/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\..\..\..\src\common\pa_front.c">
+				<FileConfiguration
+					Name="Debug|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						ObjectFile="$(IntDir)/$(InputName)1.obj"/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						ObjectFile="$(IntDir)/$(InputName)1.obj"/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\..\..\..\src\common\pa_process.c">
+				<FileConfiguration
+					Name="Debug|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						ObjectFile="$(IntDir)/$(InputName)1.obj"/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						ObjectFile="$(IntDir)/$(InputName)1.obj"/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\..\..\..\src\hostapi\skeleton\pa_hostapi_skeleton.c">
+				<FileConfiguration
+					Name="Debug|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						ObjectFile="$(IntDir)/$(InputName)1.obj"/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						ObjectFile="$(IntDir)/$(InputName)1.obj"/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\..\..\..\src\common\pa_stream.c">
+				<FileConfiguration
+					Name="Debug|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						ObjectFile="$(IntDir)/$(InputName)1.obj"/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						ObjectFile="$(IntDir)/$(InputName)1.obj"/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\..\..\..\src\common\pa_trace.c">
+				<FileConfiguration
+					Name="Debug|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						ObjectFile="$(IntDir)/$(InputName)1.obj"/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						ObjectFile="$(IntDir)/$(InputName)1.obj"/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\..\..\..\src\hostapi\dsound\pa_win_ds.c">
+				<FileConfiguration
+					Name="Debug|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						ObjectFile="$(IntDir)/$(InputName)1.obj"/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						ObjectFile="$(IntDir)/$(InputName)1.obj"/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\..\..\..\src\hostapi\dsound\pa_win_ds_dynlink.c">
+			</File>
+			<File
+				RelativePath="..\..\..\..\src\os\win\pa_win_hostapis.c">
+			</File>
+			<File
+				RelativePath="..\..\..\..\src\os\win\pa_win_util.c">
+			</File>
+			<File
+				RelativePath="..\..\..\..\src\hostapi\wasapi\pa_win_wasapi.cpp">
+			</File>
+			<File
+				RelativePath="..\..\..\..\src\hostapi\wmme\pa_win_wmme.c">
+				<FileConfiguration
+					Name="Debug|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						ObjectFile="$(IntDir)/$(InputName)1.obj"/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						ObjectFile="$(IntDir)/$(InputName)1.obj"/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\..\..\..\src\os\win\pa_x86_plain_converters.c">
+			</File>
+		</Filter>
+		<Filter
+			Name="ASIO 2 SDK Files"
+			Filter="">
+			<File
+				RelativePath="..\..\..\..\..\asiosdk2\common\asio.cpp">
+			</File>
+			<File
+				RelativePath="..\..\..\..\..\asiosdk2\host\asiodrivers.cpp">
+			</File>
+			<File
+				RelativePath="..\..\..\..\..\asiosdk2\host\pc\asiolist.cpp">
+			</File>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>
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 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
-	ProjectType="Visual C++"
-	Version="7.10"
-	Name="static_library"
-	ProjectGUID="{D18EA0C9-8C65-441D-884C-55EB43A84F2A}"
-	Keyword="Win32Proj">
-	<Platforms>
-		<Platform
-			Name="Win32"/>
-	</Platforms>
-	<Configurations>
-		<Configuration
-			Name="Debug|Win32"
-			OutputDirectory="../../lib/"
-			IntermediateDirectory="Debug"
-			ConfigurationType="4"
-			CharacterSet="2">
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				AdditionalIncludeDirectories="../../include/;../../../../include/"
-				PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
-				MinimalRebuild="TRUE"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="3"
-				UsePrecompiledHeader="0"
-				ProgramDataBaseFileName="$(IntDir)/vc71.pdb"
-				WarningLevel="3"
-				Detect64BitPortabilityProblems="TRUE"
-				DebugInformationFormat="3"/>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
-				Name="VCLibrarianTool"
-				OutputFile="$(OutDir)/portaudiocpp-vc7_1-d.lib"/>
-			<Tool
-				Name="VCMIDLTool"/>
-			<Tool
-				Name="VCPostBuildEventTool"/>
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCPreLinkEventTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"/>
-			<Tool
-				Name="VCManagedWrapperGeneratorTool"/>
-			<Tool
-				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
-		</Configuration>
-		<Configuration
-			Name="Release|Win32"
-			OutputDirectory="../../lib/"
-			IntermediateDirectory="Release"
-			ConfigurationType="4"
-			CharacterSet="2">
-			<Tool
-				Name="VCCLCompilerTool"
-				AdditionalIncludeDirectories="../../include/;../../../../include/"
-				PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
-				RuntimeLibrary="2"
-				UsePrecompiledHeader="0"
-				ProgramDataBaseFileName="$(IntDir)/vc71.pdb"
-				WarningLevel="3"
-				Detect64BitPortabilityProblems="TRUE"
-				DebugInformationFormat="3"/>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
-				Name="VCLibrarianTool"
-				OutputFile="$(OutDir)/portaudiocpp-vc7_1-r.lib"/>
-			<Tool
-				Name="VCMIDLTool"/>
-			<Tool
-				Name="VCPostBuildEventTool"/>
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCPreLinkEventTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"/>
-			<Tool
-				Name="VCManagedWrapperGeneratorTool"/>
-			<Tool
-				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
-		</Configuration>
-	</Configurations>
-	<References>
-	</References>
-	<Files>
-		<Filter
-			Name="Files"
-			Filter="">
-			<File
-				RelativePath="..\..\source\portaudiocpp\AsioDeviceAdapter.cxx">
-			</File>
-			<File
-				RelativePath="..\..\include\portaudiocpp\AsioDeviceAdapter.hxx">
-			</File>
-			<File
-				RelativePath="..\..\include\portaudiocpp\AutoSystem.hxx">
-			</File>
-			<File
-				RelativePath="..\..\source\portaudiocpp\BlockingStream.cxx">
-			</File>
-			<File
-				RelativePath="..\..\include\portaudiocpp\BlockingStream.hxx">
-			</File>
-			<File
-				RelativePath="..\..\source\portaudiocpp\CallbackInterface.cxx">
-			</File>
-			<File
-				RelativePath="..\..\include\portaudiocpp\CallbackInterface.hxx">
-			</File>
-			<File
-				RelativePath="..\..\source\portaudiocpp\CallbackStream.cxx">
-			</File>
-			<File
-				RelativePath="..\..\include\portaudiocpp\CallbackStream.hxx">
-			</File>
-			<File
-				RelativePath="..\..\source\portaudiocpp\CFunCallbackStream.cxx">
-			</File>
-			<File
-				RelativePath="..\..\include\portaudiocpp\CFunCallbackStream.hxx">
-			</File>
-			<File
-				RelativePath="..\..\source\portaudiocpp\CppFunCallbackStream.cxx">
-			</File>
-			<File
-				RelativePath="..\..\include\portaudiocpp\CppFunCallbackStream.hxx">
-			</File>
-			<File
-				RelativePath="..\..\source\portaudiocpp\Device.cxx">
-			</File>
-			<File
-				RelativePath="..\..\include\portaudiocpp\Device.hxx">
-			</File>
-			<File
-				RelativePath="..\..\source\portaudiocpp\DirectionSpecificStreamParameters.cxx">
-			</File>
-			<File
-				RelativePath="..\..\include\portaudiocpp\DirectionSpecificStreamParameters.hxx">
-			</File>
-			<File
-				RelativePath="..\..\source\portaudiocpp\Exception.cxx">
-			</File>
-			<File
-				RelativePath="..\..\include\portaudiocpp\Exception.hxx">
-			</File>
-			<File
-				RelativePath="..\..\source\portaudiocpp\HostApi.cxx">
-			</File>
-			<File
-				RelativePath="..\..\include\portaudiocpp\HostApi.hxx">
-			</File>
-			<File
-				RelativePath="..\..\source\portaudiocpp\InterfaceCallbackStream.cxx">
-			</File>
-			<File
-				RelativePath="..\..\include\portaudiocpp\InterfaceCallbackStream.hxx">
-			</File>
-			<File
-				RelativePath="..\..\source\portaudiocpp\MemFunCallbackStream.cxx">
-			</File>
-			<File
-				RelativePath="..\..\include\portaudiocpp\MemFunCallbackStream.hxx">
-			</File>
-			<File
-				RelativePath="..\..\include\portaudiocpp\PortAudioCpp.hxx">
-			</File>
-			<File
-				RelativePath="..\..\include\portaudiocpp\SampleDataFormat.hxx">
-			</File>
-			<File
-				RelativePath="..\..\source\portaudiocpp\Stream.cxx">
-			</File>
-			<File
-				RelativePath="..\..\include\portaudiocpp\Stream.hxx">
-			</File>
-			<File
-				RelativePath="..\..\source\portaudiocpp\StreamParameters.cxx">
-			</File>
-			<File
-				RelativePath="..\..\include\portaudiocpp\StreamParameters.hxx">
-			</File>
-			<File
-				RelativePath="..\..\source\portaudiocpp\System.cxx">
-			</File>
-			<File
-				RelativePath="..\..\include\portaudiocpp\System.hxx">
-			</File>
-			<File
-				RelativePath="..\..\source\portaudiocpp\SystemDeviceIterator.cxx">
-			</File>
-			<File
-				RelativePath="..\..\include\portaudiocpp\SystemDeviceIterator.hxx">
-			</File>
-			<File
-				RelativePath="..\..\source\portaudiocpp\SystemHostApiIterator.cxx">
-			</File>
-			<File
-				RelativePath="..\..\include\portaudiocpp\SystemHostApiIterator.hxx">
-			</File>
-		</Filter>
-	</Files>
-	<Globals>
-	</Globals>
-</VisualStudioProject>
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="7.10"
+	Name="static_library"
+	ProjectGUID="{D18EA0C9-8C65-441D-884C-55EB43A84F2A}"
+	Keyword="Win32Proj">
+	<Platforms>
+		<Platform
+			Name="Win32"/>
+	</Platforms>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="../../lib/"
+			IntermediateDirectory="Debug"
+			ConfigurationType="4"
+			CharacterSet="2">
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="../../include/;../../../../include/"
+				PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+				MinimalRebuild="TRUE"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				ProgramDataBaseFileName="$(IntDir)/vc71.pdb"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="TRUE"
+				DebugInformationFormat="3"/>
+			<Tool
+				Name="VCCustomBuildTool"/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="$(OutDir)/portaudiocpp-vc7_1-d.lib"/>
+			<Tool
+				Name="VCMIDLTool"/>
+			<Tool
+				Name="VCPostBuildEventTool"/>
+			<Tool
+				Name="VCPreBuildEventTool"/>
+			<Tool
+				Name="VCPreLinkEventTool"/>
+			<Tool
+				Name="VCResourceCompilerTool"/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"/>
+			<Tool
+				Name="VCManagedWrapperGeneratorTool"/>
+			<Tool
+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="../../lib/"
+			IntermediateDirectory="Release"
+			ConfigurationType="4"
+			CharacterSet="2">
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="../../include/;../../../../include/"
+				PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+				RuntimeLibrary="2"
+				UsePrecompiledHeader="0"
+				ProgramDataBaseFileName="$(IntDir)/vc71.pdb"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="TRUE"
+				DebugInformationFormat="3"/>
+			<Tool
+				Name="VCCustomBuildTool"/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="$(OutDir)/portaudiocpp-vc7_1-r.lib"/>
+			<Tool
+				Name="VCMIDLTool"/>
+			<Tool
+				Name="VCPostBuildEventTool"/>
+			<Tool
+				Name="VCPreBuildEventTool"/>
+			<Tool
+				Name="VCPreLinkEventTool"/>
+			<Tool
+				Name="VCResourceCompilerTool"/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"/>
+			<Tool
+				Name="VCManagedWrapperGeneratorTool"/>
+			<Tool
+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Files"
+			Filter="">
+			<File
+				RelativePath="..\..\source\portaudiocpp\AsioDeviceAdapter.cxx">
+			</File>
+			<File
+				RelativePath="..\..\include\portaudiocpp\AsioDeviceAdapter.hxx">
+			</File>
+			<File
+				RelativePath="..\..\include\portaudiocpp\AutoSystem.hxx">
+			</File>
+			<File
+				RelativePath="..\..\source\portaudiocpp\BlockingStream.cxx">
+			</File>
+			<File
+				RelativePath="..\..\include\portaudiocpp\BlockingStream.hxx">
+			</File>
+			<File
+				RelativePath="..\..\source\portaudiocpp\CallbackInterface.cxx">
+			</File>
+			<File
+				RelativePath="..\..\include\portaudiocpp\CallbackInterface.hxx">
+			</File>
+			<File
+				RelativePath="..\..\source\portaudiocpp\CallbackStream.cxx">
+			</File>
+			<File
+				RelativePath="..\..\include\portaudiocpp\CallbackStream.hxx">
+			</File>
+			<File
+				RelativePath="..\..\source\portaudiocpp\CFunCallbackStream.cxx">
+			</File>
+			<File
+				RelativePath="..\..\include\portaudiocpp\CFunCallbackStream.hxx">
+			</File>
+			<File
+				RelativePath="..\..\source\portaudiocpp\CppFunCallbackStream.cxx">
+			</File>
+			<File
+				RelativePath="..\..\include\portaudiocpp\CppFunCallbackStream.hxx">
+			</File>
+			<File
+				RelativePath="..\..\source\portaudiocpp\Device.cxx">
+			</File>
+			<File
+				RelativePath="..\..\include\portaudiocpp\Device.hxx">
+			</File>
+			<File
+				RelativePath="..\..\source\portaudiocpp\DirectionSpecificStreamParameters.cxx">
+			</File>
+			<File
+				RelativePath="..\..\include\portaudiocpp\DirectionSpecificStreamParameters.hxx">
+			</File>
+			<File
+				RelativePath="..\..\source\portaudiocpp\Exception.cxx">
+			</File>
+			<File
+				RelativePath="..\..\include\portaudiocpp\Exception.hxx">
+			</File>
+			<File
+				RelativePath="..\..\source\portaudiocpp\HostApi.cxx">
+			</File>
+			<File
+				RelativePath="..\..\include\portaudiocpp\HostApi.hxx">
+			</File>
+			<File
+				RelativePath="..\..\source\portaudiocpp\InterfaceCallbackStream.cxx">
+			</File>
+			<File
+				RelativePath="..\..\include\portaudiocpp\InterfaceCallbackStream.hxx">
+			</File>
+			<File
+				RelativePath="..\..\source\portaudiocpp\MemFunCallbackStream.cxx">
+			</File>
+			<File
+				RelativePath="..\..\include\portaudiocpp\MemFunCallbackStream.hxx">
+			</File>
+			<File
+				RelativePath="..\..\include\portaudiocpp\PortAudioCpp.hxx">
+			</File>
+			<File
+				RelativePath="..\..\include\portaudiocpp\SampleDataFormat.hxx">
+			</File>
+			<File
+				RelativePath="..\..\source\portaudiocpp\Stream.cxx">
+			</File>
+			<File
+				RelativePath="..\..\include\portaudiocpp\Stream.hxx">
+			</File>
+			<File
+				RelativePath="..\..\source\portaudiocpp\StreamParameters.cxx">
+			</File>
+			<File
+				RelativePath="..\..\include\portaudiocpp\StreamParameters.hxx">
+			</File>
+			<File
+				RelativePath="..\..\source\portaudiocpp\System.cxx">
+			</File>
+			<File
+				RelativePath="..\..\include\portaudiocpp\System.hxx">
+			</File>
+			<File
+				RelativePath="..\..\source\portaudiocpp\SystemDeviceIterator.cxx">
+			</File>
+			<File
+				RelativePath="..\..\include\portaudiocpp\SystemDeviceIterator.hxx">
+			</File>
+			<File
+				RelativePath="..\..\source\portaudiocpp\SystemHostApiIterator.cxx">
+			</File>
+			<File
+				RelativePath="..\..\include\portaudiocpp\SystemHostApiIterator.hxx">
+			</File>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>
diff --git a/bindings/cpp/configure b/bindings/cpp/configure
index 9d02dfc..0186597 100755
--- a/bindings/cpp/configure
+++ b/bindings/cpp/configure
@@ -1,11 +1,9 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.68 for PortAudioCpp 12.
+# Generated by GNU Autoconf 2.69 for PortAudioCpp 12.
 #
 #
-# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
-# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software
-# Foundation, Inc.
+# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
 #
 #
 # This configure script is free software; the Free Software Foundation
@@ -134,6 +132,31 @@ export LANGUAGE
 # CDPATH.
 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
 
+# Use a proper internal environment variable to ensure we don't fall
+  # into an infinite loop, continuously re-executing ourselves.
+  if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then
+    _as_can_reexec=no; export _as_can_reexec;
+    # We cannot yet assume a decent shell, so we have to provide a
+# neutralization value for shells without unset; and this also
+# works around shells that cannot unset nonexistent variables.
+# Preserve -v and -x to the replacement shell.
+BASH_ENV=/dev/null
+ENV=/dev/null
+(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+case $- in # ((((
+  *v*x* | *x*v* ) as_opts=-vx ;;
+  *v* ) as_opts=-v ;;
+  *x* ) as_opts=-x ;;
+  * ) as_opts= ;;
+esac
+exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
+# Admittedly, this is quite paranoid, since all the known shells bail
+# out after a failed `exec'.
+$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
+as_fn_exit 255
+  fi
+  # We don't want this to propagate to other subprocesses.
+          { _as_can_reexec=; unset _as_can_reexec;}
 if test "x$CONFIG_SHELL" = x; then
   as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :
   emulate sh
@@ -167,7 +190,8 @@ if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then :
 else
   exitcode=1; echo positional parameters were not saved.
 fi
-test x\$exitcode = x0 || exit 1"
+test x\$exitcode = x0 || exit 1
+test -x / || exit 1"
   as_suggested="  as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
   as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
   eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
@@ -220,21 +244,25 @@ IFS=$as_save_IFS
 
 
       if test "x$CONFIG_SHELL" != x; then :
-  # We cannot yet assume a decent shell, so we have to provide a
-	# neutralization value for shells without unset; and this also
-	# works around shells that cannot unset nonexistent variables.
-	# Preserve -v and -x to the replacement shell.
-	BASH_ENV=/dev/null
-	ENV=/dev/null
-	(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
-	export CONFIG_SHELL
-	case $- in # ((((
-	  *v*x* | *x*v* ) as_opts=-vx ;;
-	  *v* ) as_opts=-v ;;
-	  *x* ) as_opts=-x ;;
-	  * ) as_opts= ;;
-	esac
-	exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"}
+  export CONFIG_SHELL
+             # We cannot yet assume a decent shell, so we have to provide a
+# neutralization value for shells without unset; and this also
+# works around shells that cannot unset nonexistent variables.
+# Preserve -v and -x to the replacement shell.
+BASH_ENV=/dev/null
+ENV=/dev/null
+(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+case $- in # ((((
+  *v*x* | *x*v* ) as_opts=-vx ;;
+  *v* ) as_opts=-v ;;
+  *x* ) as_opts=-x ;;
+  * ) as_opts= ;;
+esac
+exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
+# Admittedly, this is quite paranoid, since all the known shells bail
+# out after a failed `exec'.
+$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
+exit 255
 fi
 
     if test x$as_have_required = xno; then :
@@ -336,6 +364,14 @@ $as_echo X"$as_dir" |
 
 
 } # as_fn_mkdir_p
+
+# as_fn_executable_p FILE
+# -----------------------
+# Test if FILE is an executable regular file.
+as_fn_executable_p ()
+{
+  test -f "$1" && test -x "$1"
+} # as_fn_executable_p
 # as_fn_append VAR VALUE
 # ----------------------
 # Append the text in VALUE to the end of the definition contained in VAR. Take
@@ -457,6 +493,10 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits
   chmod +x "$as_me.lineno" ||
     { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
 
+  # If we had to re-execute with $CONFIG_SHELL, we're ensured to have
+  # already done that, so ensure we don't try to do so again and fall
+  # in an infinite loop.  This has already happened in practice.
+  _as_can_reexec=no; export _as_can_reexec
   # Don't try to exec as it changes $[0], causing all sort of problems
   # (the dirname of $[0] is not the place where we might find the
   # original and so on.  Autoconf is especially sensitive to this).
@@ -491,16 +531,16 @@ if (echo >conf$$.file) 2>/dev/null; then
     # ... but there are two gotchas:
     # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
     # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
-    # In both cases, we have to default to `cp -p'.
+    # In both cases, we have to default to `cp -pR'.
     ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
-      as_ln_s='cp -p'
+      as_ln_s='cp -pR'
   elif ln conf$$.file conf$$ 2>/dev/null; then
     as_ln_s=ln
   else
-    as_ln_s='cp -p'
+    as_ln_s='cp -pR'
   fi
 else
-  as_ln_s='cp -p'
+  as_ln_s='cp -pR'
 fi
 rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
 rmdir conf$$.dir 2>/dev/null
@@ -512,28 +552,8 @@ else
   as_mkdir_p=false
 fi
 
-if test -x / >/dev/null 2>&1; then
-  as_test_x='test -x'
-else
-  if ls -dL / >/dev/null 2>&1; then
-    as_ls_L_option=L
-  else
-    as_ls_L_option=
-  fi
-  as_test_x='
-    eval sh -c '\''
-      if test -d "$1"; then
-	test -d "$1/.";
-      else
-	case $1 in #(
-	-*)set "./$1";;
-	esac;
-	case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
-	???[sx]*):;;*)false;;esac;fi
-    '\'' sh
-  '
-fi
-as_executable_p=$as_test_x
+as_test_x='test -x'
+as_executable_p=as_fn_executable_p
 
 # Sed expression to map a string onto a valid CPP name.
 as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
@@ -657,6 +677,7 @@ CXX
 am__fastdepCC_FALSE
 am__fastdepCC_TRUE
 CCDEPMODE
+am__nodep
 AMDEPBACKSLASH
 AMDEP_FALSE
 AMDEP_TRUE
@@ -673,6 +694,10 @@ CC
 MAINT
 MAINTAINER_MODE_FALSE
 MAINTAINER_MODE_TRUE
+AM_BACKSLASH
+AM_DEFAULT_VERBOSITY
+AM_DEFAULT_V
+AM_V
 am__untar
 am__tar
 AMTAR
@@ -737,6 +762,7 @@ SHELL'
 ac_subst_files=''
 ac_user_opts='
 enable_option_checking
+enable_silent_rules
 enable_maintainer_mode
 enable_dependency_tracking
 enable_shared
@@ -1215,8 +1241,6 @@ target=$target_alias
 if test "x$host_alias" != x; then
   if test "x$build_alias" = x; then
     cross_compiling=maybe
-    $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host.
-    If a cross compiler is detected then cross compile mode will be used" >&2
   elif test "x$build_alias" != "x$host_alias"; then
     cross_compiling=yes
   fi
@@ -1380,10 +1404,15 @@ Optional Features:
   --disable-option-checking  ignore unrecognized --enable/--with options
   --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
   --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
-  --enable-maintainer-mode  enable make rules and dependencies not useful
-			  (and sometimes confusing) to the casual installer
-  --disable-dependency-tracking  speeds up one-time build
-  --enable-dependency-tracking   do not reject slow dependency extractors
+  --enable-silent-rules   less verbose build output (undo: "make V=1")
+  --disable-silent-rules  verbose build output (undo: "make V=0")
+  --enable-maintainer-mode
+                          enable make rules and dependencies not useful (and
+                          sometimes confusing) to the casual installer
+  --enable-dependency-tracking
+                          do not reject slow dependency extractors
+  --disable-dependency-tracking
+                          speeds up one-time build
   --enable-shared[=PKGS]  build shared libraries [default=yes]
   --enable-static[=PKGS]  build static libraries [default=yes]
   --enable-fast-install[=PKGS]
@@ -1393,7 +1422,7 @@ Optional Features:
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
   --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
-  --with-pic              try to use only PIC/non-PIC objects [default=use
+  --with-pic[=PKGS]       try to use only PIC/non-PIC objects [default=use
                           both]
   --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
   --with-sysroot=DIR Search for dependent libraries within DIR
@@ -1479,9 +1508,9 @@ test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
 PortAudioCpp configure 12
-generated by GNU Autoconf 2.68
+generated by GNU Autoconf 2.69
 
-Copyright (C) 2010 Free Software Foundation, Inc.
+Copyright (C) 2012 Free Software Foundation, Inc.
 This configure script is free software; the Free Software Foundation
 gives unlimited permission to copy, distribute and modify it.
 _ACEOF
@@ -1595,7 +1624,7 @@ $as_echo "$ac_try_echo"; } >&5
 	 test ! -s conftest.err
        } && test -s conftest$ac_exeext && {
 	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
+	 test -x conftest$ac_exeext
        }; then :
   ac_retval=0
 else
@@ -1855,7 +1884,7 @@ $as_echo "$ac_try_echo"; } >&5
 	 test ! -s conftest.err
        } && test -s conftest$ac_exeext && {
 	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
+	 test -x conftest$ac_exeext
        }; then :
   ac_retval=0
 else
@@ -1878,7 +1907,7 @@ This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
 It was created by PortAudioCpp $as_me 12, which was
-generated by GNU Autoconf 2.68.  Invocation command line was
+generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
 
@@ -2226,7 +2255,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
 
-am__api_version='1.11'
+am__api_version='1.14'
 
 ac_aux_dir=
 for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
@@ -2294,7 +2323,7 @@ case $as_dir/ in #((
     # by default.
     for ac_prog in ginstall scoinst install; do
       for ac_exec_ext in '' $ac_executable_extensions; do
-	if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then
+	if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
 	  if test $ac_prog = install &&
 	    grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
 	    # AIX install.  It has an incompatible calling convention.
@@ -2352,9 +2381,6 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5
 $as_echo_n "checking whether build environment is sane... " >&6; }
-# Just in case
-sleep 1
-echo timestamp > conftest.file
 # Reject unsafe characters in $srcdir or the absolute working directory
 # name.  Accept space and tab only in the latter.
 am_lf='
@@ -2365,32 +2391,40 @@ case `pwd` in
 esac
 case $srcdir in
   *[\\\"\#\$\&\'\`$am_lf\ \	]*)
-    as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;;
+    as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;;
 esac
 
-# Do `set' in a subshell so we don't clobber the current shell's
+# Do 'set' in a subshell so we don't clobber the current shell's
 # arguments.  Must try -L first in case configure is actually a
 # symlink; some systems play weird games with the mod time of symlinks
 # (eg FreeBSD returns the mod time of the symlink's containing
 # directory).
 if (
-   set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
-   if test "$*" = "X"; then
-      # -L didn't work.
-      set X `ls -t "$srcdir/configure" conftest.file`
-   fi
-   rm -f conftest.file
-   if test "$*" != "X $srcdir/configure conftest.file" \
-      && test "$*" != "X conftest.file $srcdir/configure"; then
-
-      # If neither matched, then we have a broken ls.  This can happen
-      # if, for instance, CONFIG_SHELL is bash and it inherits a
-      # broken ls alias from the environment.  This has actually
-      # happened.  Such a system could not be considered "sane".
-      as_fn_error $? "ls -t appears to fail.  Make sure there is not a broken
-alias in your environment" "$LINENO" 5
-   fi
-
+   am_has_slept=no
+   for am_try in 1 2; do
+     echo "timestamp, slept: $am_has_slept" > conftest.file
+     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
+     if test "$*" = "X"; then
+	# -L didn't work.
+	set X `ls -t "$srcdir/configure" conftest.file`
+     fi
+     if test "$*" != "X $srcdir/configure conftest.file" \
+	&& test "$*" != "X conftest.file $srcdir/configure"; then
+
+	# If neither matched, then we have a broken ls.  This can happen
+	# if, for instance, CONFIG_SHELL is bash and it inherits a
+	# broken ls alias from the environment.  This has actually
+	# happened.  Such a system could not be considered "sane".
+	as_fn_error $? "ls -t appears to fail.  Make sure there is not a broken
+  alias in your environment" "$LINENO" 5
+     fi
+     if test "$2" = conftest.file || test $am_try -eq 2; then
+       break
+     fi
+     # Just in case.
+     sleep 1
+     am_has_slept=yes
+   done
    test "$2" = conftest.file
    )
 then
@@ -2402,6 +2436,16 @@ Check your system clock" "$LINENO" 5
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
+# If we didn't sleep, we still need to ensure time stamps of config.status and
+# generated files are strictly newer.
+am_sleep_pid=
+if grep 'slept: no' conftest.file >/dev/null 2>&1; then
+  ( sleep 1 ) &
+  am_sleep_pid=$!
+fi
+
+rm -f conftest.file
+
 test "$program_prefix" != NONE &&
   program_transform_name="s&^&$program_prefix&;$program_transform_name"
 # Use a double $ so make ignores it.
@@ -2424,12 +2468,12 @@ if test x"${MISSING+set}" != xset; then
   esac
 fi
 # Use eval to expand $SHELL
-if eval "$MISSING --run true"; then
-  am_missing_run="$MISSING --run "
+if eval "$MISSING --is-lightweight"; then
+  am_missing_run="$MISSING "
 else
   am_missing_run=
-  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5
-$as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;}
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5
+$as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;}
 fi
 
 if test x"${install_sh}" != xset; then
@@ -2441,10 +2485,10 @@ if test x"${install_sh}" != xset; then
   esac
 fi
 
-# Installed binaries are usually stripped using `strip' when the user
-# run `make install-strip'.  However `strip' might not be the right
+# Installed binaries are usually stripped using 'strip' when the user
+# run "make install-strip".  However 'strip' might not be the right
 # tool to use in cross-compilation environments, therefore Automake
-# will honor the `STRIP' environment variable to overrule this program.
+# will honor the 'STRIP' environment variable to overrule this program.
 if test "$cross_compiling" != no; then
   if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
@@ -2463,7 +2507,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_STRIP="${ac_tool_prefix}strip"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -2503,7 +2547,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_STRIP="strip"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -2554,7 +2598,7 @@ do
   test -z "$as_dir" && as_dir=.
     for ac_prog in mkdir gmkdir; do
 	 for ac_exec_ext in '' $ac_executable_extensions; do
-	   { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue
+	   as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue
 	   case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #(
 	     'mkdir (GNU coreutils) '* | \
 	     'mkdir (coreutils) '* | \
@@ -2583,12 +2627,6 @@ fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5
 $as_echo "$MKDIR_P" >&6; }
 
-mkdir_p="$MKDIR_P"
-case $mkdir_p in
-  [\\/$]* | ?:[\\/]*) ;;
-  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
-esac
-
 for ac_prog in gawk mawk nawk awk
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
@@ -2607,7 +2645,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_AWK="$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -2671,6 +2709,45 @@ else
 fi
 rmdir .tst 2>/dev/null
 
+# Check whether --enable-silent-rules was given.
+if test "${enable_silent_rules+set}" = set; then :
+  enableval=$enable_silent_rules;
+fi
+
+case $enable_silent_rules in # (((
+  yes) AM_DEFAULT_VERBOSITY=0;;
+   no) AM_DEFAULT_VERBOSITY=1;;
+    *) AM_DEFAULT_VERBOSITY=1;;
+esac
+am_make=${MAKE-make}
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5
+$as_echo_n "checking whether $am_make supports nested variables... " >&6; }
+if ${am_cv_make_support_nested_variables+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if $as_echo 'TRUE=$(BAR$(V))
+BAR0=false
+BAR1=true
+V=1
+am__doit:
+	@$(TRUE)
+.PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then
+  am_cv_make_support_nested_variables=yes
+else
+  am_cv_make_support_nested_variables=no
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5
+$as_echo "$am_cv_make_support_nested_variables" >&6; }
+if test $am_cv_make_support_nested_variables = yes; then
+    AM_V='$(V)'
+  AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
+else
+  AM_V=$AM_DEFAULT_VERBOSITY
+  AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
+fi
+AM_BACKSLASH='\'
+
 if test "`cd $srcdir && pwd`" != "`pwd`"; then
   # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
   # is not polluted with repeated "-I."
@@ -2721,19 +2798,71 @@ AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"}
 
 MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
 
+# For better backward compatibility.  To be removed once Automake 1.9.x
+# dies out for good.  For more background, see:
+# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
+# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
+mkdir_p='$(MKDIR_P)'
+
 # We need awk for the "check" target.  The system "awk" is bad on
 # some platforms.
-# Always define AMTAR for backward compatibility.
+# Always define AMTAR for backward compatibility.  Yes, it's still used
+# in the wild :-(  We should find a proper way to deprecate it ...
+AMTAR='$${TAR-tar}'
+
 
-AMTAR=${AMTAR-"${am_missing_run}tar"}
+# We'll loop over all known methods to create a tar archive until one works.
+_am_tools='gnutar  pax cpio none'
 
-am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'
+am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'
 
 
 
 
 
 
+# POSIX will say in a future version that running "rm -f" with no argument
+# is OK; and we want to be able to make that assumption in our Makefile
+# recipes.  So use an aggressive probe to check that the usage we want is
+# actually supported "in the wild" to an acceptable degree.
+# See automake bug#10828.
+# To make any issue more visible, cause the running configure to be aborted
+# by default if the 'rm' program in use doesn't match our expectations; the
+# user can still override this though.
+if rm -f && rm -fr && rm -rf; then : OK; else
+  cat >&2 <<'END'
+Oops!
+
+Your 'rm' program seems unable to run without file operands specified
+on the command line, even when the '-f' option is present.  This is contrary
+to the behaviour of most rm programs out there, and not conforming with
+the upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
+
+Please tell bug-automake at gnu.org about your system, including the value
+of your $PATH and any error possibly output before this message.  This
+can help us improve future automake versions.
+
+END
+  if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
+    echo 'Configuration will proceed anyway, since you have set the' >&2
+    echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
+    echo >&2
+  else
+    cat >&2 <<'END'
+Aborting the configuration process, to ensure you take notice of the issue.
+
+You can download and install GNU coreutils to get an 'rm' implementation
+that behaves properly: <http://www.gnu.org/software/coreutils/>.
+
+If you want to complete the configuration process using your problematic
+'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
+to "yes", and re-run configure.
+
+END
+    as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5
+  fi
+fi
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5
 $as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; }
     # Check whether --enable-maintainer-mode was given.
@@ -2794,7 +2923,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_CC="${ac_tool_prefix}gcc"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -2834,7 +2963,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_CC="gcc"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -2887,7 +3016,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_CC="${ac_tool_prefix}cc"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -2928,7 +3057,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
        ac_prog_rejected=yes
        continue
@@ -2986,7 +3115,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -3030,7 +3159,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_CC="$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -3476,8 +3605,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <stdarg.h>
 #include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
+struct stat;
 /* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
 struct buf { int x; };
 FILE * (*rcsopen) (struct buf *, struct stat *, int);
@@ -3561,6 +3689,65 @@ ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5
+$as_echo_n "checking whether $CC understands -c and -o together... " >&6; }
+if ${am_cv_prog_cc_c_o+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+  # Make sure it works both with $CC and with simple cc.
+  # Following AC_PROG_CC_C_O, we do the test twice because some
+  # compilers refuse to overwrite an existing .o file with -o,
+  # though they will create one.
+  am_cv_prog_cc_c_o=yes
+  for am_i in 1 2; do
+    if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5
+   ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5
+   ac_status=$?
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   (exit $ac_status); } \
+         && test -f conftest2.$ac_objext; then
+      : OK
+    else
+      am_cv_prog_cc_c_o=no
+      break
+    fi
+  done
+  rm -f core conftest*
+  unset am_i
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5
+$as_echo "$am_cv_prog_cc_c_o" >&6; }
+if test "$am_cv_prog_cc_c_o" != yes; then
+   # Losing compiler, so override with the script.
+   # FIXME: It is wrong to rewrite CC.
+   # But if we don't then we get into trouble of one sort or another.
+   # A longer-term fix would be to have automake use am__CC in this case,
+   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
+   CC="$am_aux_dir/compile $CC"
+fi
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
 DEPDIR="${am__leading_dot}deps"
 
 ac_config_commands="$ac_config_commands depfiles"
@@ -3580,7 +3767,7 @@ am__quote=
 _am_result=none
 # First try GNU make style include.
 echo "include confinc" > confmf
-# Ignore all kinds of additional output from `make'.
+# Ignore all kinds of additional output from 'make'.
 case `$am_make -s -f confmf 2> /dev/null` in #(
 *the\ am__doit\ target*)
   am__include=include
@@ -3613,6 +3800,7 @@ fi
 if test "x$enable_dependency_tracking" != xno; then
   am_depcomp="$ac_aux_dir/depcomp"
   AMDEPBACKSLASH='\'
+  am__nodep='_no'
 fi
  if test "x$enable_dependency_tracking" != xno; then
   AMDEP_TRUE=
@@ -3635,8 +3823,9 @@ else
   # We make a subdir and do the tests there.  Otherwise we can end up
   # making bogus files that we don't know about and never remove.  For
   # instance it was reported that on HP-UX the gcc test will end up
-  # making a dummy file named `D' -- because `-MD' means `put the output
-  # in D'.
+  # making a dummy file named 'D' -- because '-MD' means "put the output
+  # in D".
+  rm -rf conftest.dir
   mkdir conftest.dir
   # Copy depcomp to subdir because otherwise we won't find it if we're
   # using a relative directory.
@@ -3670,16 +3859,16 @@ else
     : > sub/conftest.c
     for i in 1 2 3 4 5 6; do
       echo '#include "conftst'$i'.h"' >> sub/conftest.c
-      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
-      # Solaris 8's {/usr,}/bin/sh.
-      touch sub/conftst$i.h
+      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
+      # Solaris 10 /bin/sh.
+      echo '/* dummy */' > sub/conftst$i.h
     done
     echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
 
-    # We check with `-c' and `-o' for the sake of the "dashmstdout"
+    # We check with '-c' and '-o' for the sake of the "dashmstdout"
     # mode.  It turns out that the SunPro C++ compiler does not properly
-    # handle `-M -o', and we need to detect this.  Also, some Intel
-    # versions had trouble with output in subdirs
+    # handle '-M -o', and we need to detect this.  Also, some Intel
+    # versions had trouble with output in subdirs.
     am__obj=sub/conftest.${OBJEXT-o}
     am__minus_obj="-o $am__obj"
     case $depmode in
@@ -3688,16 +3877,16 @@ else
       test "$am__universal" = false || continue
       ;;
     nosideeffect)
-      # after this tag, mechanisms are not by side-effect, so they'll
-      # only be used when explicitly requested
+      # After this tag, mechanisms are not by side-effect, so they'll
+      # only be used when explicitly requested.
       if test "x$enable_dependency_tracking" = xyes; then
 	continue
       else
 	break
       fi
       ;;
-    msvisualcpp | msvcmsys)
-      # This compiler won't grok `-c -o', but also, the minuso test has
+    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
+      # This compiler won't grok '-c -o', but also, the minuso test has
       # not run yet.  These depmodes are late enough in the game, and
       # so weak that their functioning should not be impacted.
       am__obj=conftest.${OBJEXT-o}
@@ -3779,7 +3968,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_CXX="$ac_tool_prefix$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -3823,7 +4012,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_CXX="$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -4019,8 +4208,9 @@ else
   # We make a subdir and do the tests there.  Otherwise we can end up
   # making bogus files that we don't know about and never remove.  For
   # instance it was reported that on HP-UX the gcc test will end up
-  # making a dummy file named `D' -- because `-MD' means `put the output
-  # in D'.
+  # making a dummy file named 'D' -- because '-MD' means "put the output
+  # in D".
+  rm -rf conftest.dir
   mkdir conftest.dir
   # Copy depcomp to subdir because otherwise we won't find it if we're
   # using a relative directory.
@@ -4054,16 +4244,16 @@ else
     : > sub/conftest.c
     for i in 1 2 3 4 5 6; do
       echo '#include "conftst'$i'.h"' >> sub/conftest.c
-      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
-      # Solaris 8's {/usr,}/bin/sh.
-      touch sub/conftst$i.h
+      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
+      # Solaris 10 /bin/sh.
+      echo '/* dummy */' > sub/conftst$i.h
     done
     echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
 
-    # We check with `-c' and `-o' for the sake of the "dashmstdout"
+    # We check with '-c' and '-o' for the sake of the "dashmstdout"
     # mode.  It turns out that the SunPro C++ compiler does not properly
-    # handle `-M -o', and we need to detect this.  Also, some Intel
-    # versions had trouble with output in subdirs
+    # handle '-M -o', and we need to detect this.  Also, some Intel
+    # versions had trouble with output in subdirs.
     am__obj=sub/conftest.${OBJEXT-o}
     am__minus_obj="-o $am__obj"
     case $depmode in
@@ -4072,16 +4262,16 @@ else
       test "$am__universal" = false || continue
       ;;
     nosideeffect)
-      # after this tag, mechanisms are not by side-effect, so they'll
-      # only be used when explicitly requested
+      # After this tag, mechanisms are not by side-effect, so they'll
+      # only be used when explicitly requested.
       if test "x$enable_dependency_tracking" = xyes; then
 	continue
       else
 	break
       fi
       ;;
-    msvisualcpp | msvcmsys)
-      # This compiler won't grok `-c -o', but also, the minuso test has
+    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
+      # This compiler won't grok '-c -o', but also, the minuso test has
       # not run yet.  These depmodes are late enough in the game, and
       # so weak that their functioning should not be impacted.
       am__obj=conftest.${OBJEXT-o}
@@ -4227,7 +4417,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_AS="${ac_tool_prefix}as"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -4267,7 +4457,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_AS="as"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -4319,7 +4509,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -4359,7 +4549,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_DLLTOOL="dlltool"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -4411,7 +4601,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -4451,7 +4641,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_OBJDUMP="objdump"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -4517,8 +4707,8 @@ esac
 
 
 
-macro_version='2.4'
-macro_revision='1.3293'
+macro_version='2.4.2'
+macro_revision='1.3337'
 
 
 
@@ -4625,7 +4815,7 @@ do
     for ac_prog in sed gsed; do
     for ac_exec_ext in '' $ac_executable_extensions; do
       ac_path_SED="$as_dir/$ac_prog$ac_exec_ext"
-      { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue
+      as_fn_executable_p "$ac_path_SED" || continue
 # Check for GNU ac_path_SED and select it if it is found.
   # Check for GNU $ac_path_SED
 case `"$ac_path_SED" --version 2>&1` in
@@ -4701,7 +4891,7 @@ do
     for ac_prog in grep ggrep; do
     for ac_exec_ext in '' $ac_executable_extensions; do
       ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
-      { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue
+      as_fn_executable_p "$ac_path_GREP" || continue
 # Check for GNU ac_path_GREP and select it if it is found.
   # Check for GNU $ac_path_GREP
 case `"$ac_path_GREP" --version 2>&1` in
@@ -4767,7 +4957,7 @@ do
     for ac_prog in egrep; do
     for ac_exec_ext in '' $ac_executable_extensions; do
       ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
-      { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue
+      as_fn_executable_p "$ac_path_EGREP" || continue
 # Check for GNU ac_path_EGREP and select it if it is found.
   # Check for GNU $ac_path_EGREP
 case `"$ac_path_EGREP" --version 2>&1` in
@@ -4834,7 +5024,7 @@ do
     for ac_prog in fgrep; do
     for ac_exec_ext in '' $ac_executable_extensions; do
       ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext"
-      { test -f "$ac_path_FGREP" && $as_test_x "$ac_path_FGREP"; } || continue
+      as_fn_executable_p "$ac_path_FGREP" || continue
 # Check for GNU ac_path_FGREP and select it if it is found.
   # Check for GNU $ac_path_FGREP
 case `"$ac_path_FGREP" --version 2>&1` in
@@ -5090,7 +5280,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -5134,7 +5324,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_DUMPBIN="$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -5292,6 +5482,11 @@ else
     lt_cv_sys_max_cmd_len=196608
     ;;
 
+  os2*)
+    # The test takes a long time on OS/2.
+    lt_cv_sys_max_cmd_len=8192
+    ;;
+
   osf*)
     # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
     # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
@@ -5318,7 +5513,8 @@ else
     ;;
   *)
     lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`
-    if test -n "$lt_cv_sys_max_cmd_len"; then
+    if test -n "$lt_cv_sys_max_cmd_len" && \
+	test undefined != "$lt_cv_sys_max_cmd_len"; then
       lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
       lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
     else
@@ -5331,7 +5527,7 @@ else
       # If test is not a shell built-in, we'll probably end up computing a
       # maximum length that is only half of the actual maximum length, but
       # we can't tell.
-      while { test "X"`func_fallback_echo "$teststring$teststring" 2>/dev/null` \
+      while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \
 	         = "X$teststring$teststring"; } >/dev/null 2>&1 &&
 	      test $i != 17 # 1/2 MB should be enough
       do
@@ -5553,7 +5749,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -5593,7 +5789,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_OBJDUMP="objdump"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -5716,10 +5912,6 @@ freebsd* | dragonfly*)
   fi
   ;;
 
-gnu*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
-
 haiku*)
   lt_cv_deplibs_check_method=pass_all
   ;;
@@ -5757,8 +5949,8 @@ irix5* | irix6* | nonstopux*)
   lt_cv_deplibs_check_method=pass_all
   ;;
 
-# This must be Linux ELF.
-linux* | k*bsd*-gnu | kopensolaris*-gnu)
+# This must be glibc/ELF.
+linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
   lt_cv_deplibs_check_method=pass_all
   ;;
 
@@ -5896,7 +6088,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -5936,7 +6128,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_DLLTOOL="dlltool"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -6037,7 +6229,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_AR="$ac_tool_prefix$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -6081,7 +6273,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_AR="$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -6206,7 +6398,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_STRIP="${ac_tool_prefix}strip"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -6246,7 +6438,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_STRIP="strip"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -6305,7 +6497,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -6345,7 +6537,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_RANLIB="ranlib"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -6395,13 +6587,13 @@ old_postuninstall_cmds=
 if test -n "$RANLIB"; then
   case $host_os in
   openbsd*)
-    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib"
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib"
     ;;
   *)
-    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib"
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib"
     ;;
   esac
-  old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
+  old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib"
 fi
 
 case $host_os in
@@ -6548,6 +6740,7 @@ for ac_symprfx in "" "_"; do
     # which start with @ or ?.
     lt_cv_sys_global_symbol_pipe="$AWK '"\
 "     {last_section=section; section=\$ 3};"\
+"     /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\
 "     /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\
 "     \$ 0!~/External *\|/{next};"\
 "     / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\
@@ -6836,7 +7029,7 @@ ia64-*-hpux*)
   rm -rf conftest*
   ;;
 
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
 s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
   # Find out which ABI we are using.
   echo 'int i;' > conftest.$ac_ext
@@ -6852,9 +7045,19 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
 	    LD="${LD-ld} -m elf_i386_fbsd"
 	    ;;
 	  x86_64-*linux*)
-	    LD="${LD-ld} -m elf_i386"
+	    case `/usr/bin/file conftest.o` in
+	      *x86-64*)
+		LD="${LD-ld} -m elf32_x86_64"
+		;;
+	      *)
+		LD="${LD-ld} -m elf_i386"
+		;;
+	    esac
 	    ;;
-	  ppc64-*linux*|powerpc64-*linux*)
+	  powerpc64le-*)
+	    LD="${LD-ld} -m elf32lppclinux"
+	    ;;
+	  powerpc64-*)
 	    LD="${LD-ld} -m elf32ppclinux"
 	    ;;
 	  s390x-*linux*)
@@ -6873,7 +7076,10 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
 	  x86_64-*linux*)
 	    LD="${LD-ld} -m elf_x86_64"
 	    ;;
-	  ppc*-*linux*|powerpc*-*linux*)
+	  powerpcle-*)
+	    LD="${LD-ld} -m elf64lppc"
+	    ;;
+	  powerpc-*)
 	    LD="${LD-ld} -m elf64ppc"
 	    ;;
 	  s390*-*linux*|s390*-*tpf*)
@@ -6936,7 +7142,7 @@ $as_echo "$lt_cv_cc_needs_belf" >&6; }
     CFLAGS="$SAVE_CFLAGS"
   fi
   ;;
-sparc*-*solaris*)
+*-*solaris*)
   # Find out which ABI we are using.
   echo 'int i;' > conftest.$ac_ext
   if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
@@ -6947,7 +7153,20 @@ sparc*-*solaris*)
     case `/usr/bin/file conftest.o` in
     *64-bit*)
       case $lt_cv_prog_gnu_ld in
-      yes*) LD="${LD-ld} -m elf64_sparc" ;;
+      yes*)
+        case $host in
+        i?86-*-solaris*)
+          LD="${LD-ld} -m elf_x86_64"
+          ;;
+        sparc*-*-solaris*)
+          LD="${LD-ld} -m elf64_sparc"
+          ;;
+        esac
+        # GNU ld 2.21 introduced _sol2 emulations.  Use them if available.
+        if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then
+          LD="${LD-ld}_sol2"
+        fi
+        ;;
       *)
 	if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then
 	  LD="${LD-ld} -64"
@@ -6980,7 +7199,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -7020,7 +7239,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_MANIFEST_TOOL="mt"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -7100,7 +7319,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -7140,7 +7359,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_DSYMUTIL="dsymutil"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -7192,7 +7411,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -7232,7 +7451,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_NMEDIT="nmedit"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -7284,7 +7503,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_LIPO="${ac_tool_prefix}lipo"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -7324,7 +7543,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_LIPO="lipo"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -7376,7 +7595,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_OTOOL="${ac_tool_prefix}otool"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -7416,7 +7635,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_OTOOL="otool"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -7468,7 +7687,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -7508,7 +7727,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_OTOOL64="otool64"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -7587,7 +7806,13 @@ else
 	$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
 	  -dynamiclib -Wl,-single_module conftest.c 2>conftest.err
         _lt_result=$?
-	if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then
+	# If there is a non-empty error log, and "single_module"
+	# appears in it, assume the flag caused a linker warning
+        if test -s conftest.err && $GREP single_module conftest.err; then
+	  cat conftest.err >&5
+	# Otherwise, if the output was created with a 0 exit code from
+	# the compiler, it worked.
+	elif test -f libconftest.dylib && test $_lt_result -eq 0; then
 	  lt_cv_apple_cc_single_mod=yes
 	else
 	  cat conftest.err >&5
@@ -7598,6 +7823,7 @@ else
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5
 $as_echo "$lt_cv_apple_cc_single_mod" >&6; }
+
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5
 $as_echo_n "checking for -exported_symbols_list linker flag... " >&6; }
 if ${lt_cv_ld_exported_symbols_list+:} false; then :
@@ -7630,6 +7856,7 @@ rm -f core conftest.err conftest.$ac_objext \
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5
 $as_echo "$lt_cv_ld_exported_symbols_list" >&6; }
+
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5
 $as_echo_n "checking for -force_load linker flag... " >&6; }
 if ${lt_cv_ld_force_load+:} false; then :
@@ -7651,7 +7878,9 @@ _LT_EOF
       echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5
       $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err
       _lt_result=$?
-      if test -f conftest && test ! -s conftest.err && test $_lt_result = 0 && $GREP forced_load conftest 2>&1 >/dev/null; then
+      if test -s conftest.err && $GREP force_load conftest.err; then
+	cat conftest.err >&5
+      elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then
 	lt_cv_ld_force_load=yes
       else
 	cat conftest.err >&5
@@ -8065,7 +8294,22 @@ fi
 
 # Check whether --with-pic was given.
 if test "${with_pic+set}" = set; then :
-  withval=$with_pic; pic_mode="$withval"
+  withval=$with_pic; lt_p=${PACKAGE-default}
+    case $withval in
+    yes|no) pic_mode=$withval ;;
+    *)
+      pic_mode=default
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for lt_pkg in $withval; do
+	IFS="$lt_save_ifs"
+	if test "X$lt_pkg" = "X$lt_p"; then
+	  pic_mode=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac
 else
   pic_mode=default
 fi
@@ -8143,6 +8387,10 @@ LIBTOOL='$(SHELL) $(top_builddir)/libtool'
 
 
 
+
+
+
+
 test -z "$LN_S" && LN_S="ln -s"
 
 
@@ -8598,7 +8846,9 @@ lt_prog_compiler_static=
     case $cc_basename in
     nvcc*) # Cuda Compiler Driver 2.2
       lt_prog_compiler_wl='-Xlinker '
-      lt_prog_compiler_pic='-Xcompiler -fPIC'
+      if test -n "$lt_prog_compiler_pic"; then
+        lt_prog_compiler_pic="-Xcompiler $lt_prog_compiler_pic"
+      fi
       ;;
     esac
   else
@@ -8642,7 +8892,7 @@ lt_prog_compiler_static=
       lt_prog_compiler_static='-non_shared'
       ;;
 
-    linux* | k*bsd*-gnu | kopensolaris*-gnu)
+    linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
       case $cc_basename in
       # old Intel for x86_64 which still supported -KPIC.
       ecc*)
@@ -8689,18 +8939,33 @@ lt_prog_compiler_static=
 	;;
       *)
 	case `$CC -V 2>&1 | sed 5q` in
-	*Sun\ F* | *Sun*Fortran*)
+	*Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*)
 	  # Sun Fortran 8.3 passes all unrecognized flags to the linker
 	  lt_prog_compiler_pic='-KPIC'
 	  lt_prog_compiler_static='-Bstatic'
 	  lt_prog_compiler_wl=''
 	  ;;
+	*Sun\ F* | *Sun*Fortran*)
+	  lt_prog_compiler_pic='-KPIC'
+	  lt_prog_compiler_static='-Bstatic'
+	  lt_prog_compiler_wl='-Qoption ld '
+	  ;;
 	*Sun\ C*)
 	  # Sun C 5.9
 	  lt_prog_compiler_pic='-KPIC'
 	  lt_prog_compiler_static='-Bstatic'
 	  lt_prog_compiler_wl='-Wl,'
 	  ;;
+        *Intel*\ [CF]*Compiler*)
+	  lt_prog_compiler_wl='-Wl,'
+	  lt_prog_compiler_pic='-fPIC'
+	  lt_prog_compiler_static='-static'
+	  ;;
+	*Portland\ Group*)
+	  lt_prog_compiler_wl='-Wl,'
+	  lt_prog_compiler_pic='-fpic'
+	  lt_prog_compiler_static='-Bstatic'
+	  ;;
 	esac
 	;;
       esac
@@ -9062,7 +9327,6 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie
   hardcode_direct=no
   hardcode_direct_absolute=no
   hardcode_libdir_flag_spec=
-  hardcode_libdir_flag_spec_ld=
   hardcode_libdir_separator=
   hardcode_minus_L=no
   hardcode_shlibpath_var=unsupported
@@ -9315,8 +9579,7 @@ _LT_EOF
 	xlf* | bgf* | bgxlf* | mpixlf*)
 	  # IBM XL Fortran 10.1 on PPC cannot create shared libs itself
 	  whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive'
-	  hardcode_libdir_flag_spec=
-	  hardcode_libdir_flag_spec_ld='-rpath $libdir'
+	  hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
 	  archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib'
 	  if test "x$supports_anon_versioning" = xyes; then
 	    archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~
@@ -9696,6 +9959,7 @@ fi
 	# The linker will not automatically build a static lib if we build a DLL.
 	# _LT_TAGVAR(old_archive_from_new_cmds, )='true'
 	enable_shared_with_static_runtimes=yes
+	exclude_expsyms='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
 	export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
 	# Don't use ranlib
 	old_postinstall_cmds='chmod 644 $oldlib'
@@ -9741,6 +10005,7 @@ fi
   hardcode_shlibpath_var=unsupported
   if test "$lt_cv_ld_force_load" = "yes"; then
     whole_archive_flag_spec='`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
+
   else
     whole_archive_flag_spec=''
   fi
@@ -9769,10 +10034,6 @@ fi
       hardcode_shlibpath_var=no
       ;;
 
-    freebsd1*)
-      ld_shlibs=no
-      ;;
-
     # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
     # support.  Future versions do this automatically, but an explicit c++rt0.o
     # does not break anything, and helps significantly (at the cost of a little
@@ -9785,7 +10046,7 @@ fi
       ;;
 
     # Unfortunately, older versions of FreeBSD 2 do not have this feature.
-    freebsd2*)
+    freebsd2.*)
       archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
       hardcode_direct=yes
       hardcode_minus_L=yes
@@ -9824,7 +10085,6 @@ fi
       fi
       if test "$with_gnu_ld" = no; then
 	hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
-	hardcode_libdir_flag_spec_ld='+b $libdir'
 	hardcode_libdir_separator=:
 	hardcode_direct=yes
 	hardcode_direct_absolute=yes
@@ -10448,11 +10708,6 @@ esac
 
 
 
-
-
-
-
-
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5
 $as_echo_n "checking dynamic linker characteristics... " >&6; }
 
@@ -10542,7 +10797,7 @@ need_version=unknown
 
 case $host_os in
 aix3*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
   shlibpath_var=LIBPATH
 
@@ -10551,7 +10806,7 @@ aix3*)
   ;;
 
 aix[4-9]*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   hardcode_into_libs=yes
@@ -10616,7 +10871,7 @@ beos*)
   ;;
 
 bsdi[45]*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
   soname_spec='${libname}${release}${shared_ext}$major'
@@ -10755,7 +11010,7 @@ darwin* | rhapsody*)
   ;;
 
 dgux*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
@@ -10763,10 +11018,6 @@ dgux*)
   shlibpath_var=LD_LIBRARY_PATH
   ;;
 
-freebsd1*)
-  dynamic_linker=no
-  ;;
-
 freebsd* | dragonfly*)
   # DragonFly does not have aout.  When/if they implement a new
   # versioning mechanism, adjust this.
@@ -10774,7 +11025,7 @@ freebsd* | dragonfly*)
     objformat=`/usr/bin/objformat`
   else
     case $host_os in
-    freebsd[123]*) objformat=aout ;;
+    freebsd[23].*) objformat=aout ;;
     *) objformat=elf ;;
     esac
   fi
@@ -10792,7 +11043,7 @@ freebsd* | dragonfly*)
   esac
   shlibpath_var=LD_LIBRARY_PATH
   case $host_os in
-  freebsd2*)
+  freebsd2.*)
     shlibpath_overrides_runpath=yes
     ;;
   freebsd3.[01]* | freebsdelf3.[01]*)
@@ -10811,19 +11062,8 @@ freebsd* | dragonfly*)
   esac
   ;;
 
-gnu*)
-  version_type=linux
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=no
-  hardcode_into_libs=yes
-  ;;
-
 haiku*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   dynamic_linker="$host_os runtime_loader"
@@ -10884,7 +11124,7 @@ hpux9* | hpux10* | hpux11*)
   ;;
 
 interix[3-9]*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
@@ -10900,7 +11140,7 @@ irix5* | irix6* | nonstopux*)
     nonstopux*) version_type=nonstopux ;;
     *)
 	if test "$lt_cv_prog_gnu_ld" = yes; then
-		version_type=linux
+		version_type=linux # correct to gnu/linux during the next big refactor
 	else
 		version_type=irix
 	fi ;;
@@ -10937,9 +11177,9 @@ linux*oldld* | linux*aout* | linux*coff*)
   dynamic_linker=no
   ;;
 
-# This must be Linux ELF.
-linux* | k*bsd*-gnu | kopensolaris*-gnu)
-  version_type=linux
+# This must be glibc/ELF.
+linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
@@ -11033,7 +11273,7 @@ netbsd*)
   ;;
 
 newsos6)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
   shlibpath_var=LD_LIBRARY_PATH
   shlibpath_overrides_runpath=yes
@@ -11102,7 +11342,7 @@ rdos*)
   ;;
 
 solaris*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
@@ -11127,7 +11367,7 @@ sunos4*)
   ;;
 
 sysv4 | sysv4.3*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
   soname_spec='${libname}${release}${shared_ext}$major'
   shlibpath_var=LD_LIBRARY_PATH
@@ -11151,7 +11391,7 @@ sysv4 | sysv4.3*)
 
 sysv4*MP*)
   if test -d /usr/nec ;then
-    version_type=linux
+    version_type=linux # correct to gnu/linux during the next big refactor
     library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
     soname_spec='$libname${shared_ext}.$major'
     shlibpath_var=LD_LIBRARY_PATH
@@ -11182,7 +11422,7 @@ sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
 
 tpf*)
   # TPF is a cross-target only.  Preferred cross-host = GNU/Linux.
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
@@ -11192,7 +11432,7 @@ tpf*)
   ;;
 
 uts4*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
   soname_spec='${libname}${release}${shared_ext}$major'
   shlibpath_var=LD_LIBRARY_PATH
@@ -12117,7 +12357,6 @@ export_dynamic_flag_spec_CXX=
 hardcode_direct_CXX=no
 hardcode_direct_absolute_CXX=no
 hardcode_libdir_flag_spec_CXX=
-hardcode_libdir_flag_spec_ld_CXX=
 hardcode_libdir_separator_CXX=
 hardcode_minus_L_CXX=no
 hardcode_shlibpath_var_CXX=unsupported
@@ -12701,6 +12940,7 @@ fi
   hardcode_shlibpath_var_CXX=unsupported
   if test "$lt_cv_ld_force_load" = "yes"; then
     whole_archive_flag_spec_CXX='`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
+
   else
     whole_archive_flag_spec_CXX=''
   fi
@@ -12745,7 +12985,7 @@ fi
         esac
         ;;
 
-      freebsd[12]*)
+      freebsd2.*)
         # C++ shared libraries reported to be fairly broken before
 	# switch to ELF
         ld_shlibs_CXX=no
@@ -12761,9 +13001,6 @@ fi
         ld_shlibs_CXX=yes
         ;;
 
-      gnu*)
-        ;;
-
       haiku*)
         archive_cmds_CXX='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
         link_all_deplibs_CXX=yes
@@ -12925,7 +13162,7 @@ fi
         inherit_rpath_CXX=yes
         ;;
 
-      linux* | k*bsd*-gnu | kopensolaris*-gnu)
+      linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
         case $cc_basename in
           KCC*)
 	    # Kuck and Associates, Inc. (KAI) C++ Compiler
@@ -13421,6 +13658,7 @@ _lt_libdeps_save_CFLAGS=$CFLAGS
 case "$CC $CFLAGS " in #(
 *\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;;
 *\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;;
+*\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;;
 esac
 
 if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
@@ -13784,7 +14022,7 @@ lt_prog_compiler_static_CXX=
 	    ;;
 	esac
 	;;
-      linux* | k*bsd*-gnu | kopensolaris*-gnu)
+      linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
 	case $cc_basename in
 	  KCC*)
 	    # KAI C++ Compiler
@@ -14210,7 +14448,9 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie
     ;;
   cygwin* | mingw* | cegcc*)
     case $cc_basename in
-    cl*) ;;
+    cl*)
+      exclude_expsyms_CXX='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
+      ;;
     *)
       export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols'
       exclude_expsyms_CXX='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'
@@ -14366,8 +14606,6 @@ esac
 
 
 
-
-
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5
 $as_echo_n "checking dynamic linker characteristics... " >&6; }
 
@@ -14393,7 +14631,7 @@ need_version=unknown
 
 case $host_os in
 aix3*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
   shlibpath_var=LIBPATH
 
@@ -14402,7 +14640,7 @@ aix3*)
   ;;
 
 aix[4-9]*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   hardcode_into_libs=yes
@@ -14467,7 +14705,7 @@ beos*)
   ;;
 
 bsdi[45]*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
   soname_spec='${libname}${release}${shared_ext}$major'
@@ -14604,7 +14842,7 @@ darwin* | rhapsody*)
   ;;
 
 dgux*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
@@ -14612,10 +14850,6 @@ dgux*)
   shlibpath_var=LD_LIBRARY_PATH
   ;;
 
-freebsd1*)
-  dynamic_linker=no
-  ;;
-
 freebsd* | dragonfly*)
   # DragonFly does not have aout.  When/if they implement a new
   # versioning mechanism, adjust this.
@@ -14623,7 +14857,7 @@ freebsd* | dragonfly*)
     objformat=`/usr/bin/objformat`
   else
     case $host_os in
-    freebsd[123]*) objformat=aout ;;
+    freebsd[23].*) objformat=aout ;;
     *) objformat=elf ;;
     esac
   fi
@@ -14641,7 +14875,7 @@ freebsd* | dragonfly*)
   esac
   shlibpath_var=LD_LIBRARY_PATH
   case $host_os in
-  freebsd2*)
+  freebsd2.*)
     shlibpath_overrides_runpath=yes
     ;;
   freebsd3.[01]* | freebsdelf3.[01]*)
@@ -14660,19 +14894,8 @@ freebsd* | dragonfly*)
   esac
   ;;
 
-gnu*)
-  version_type=linux
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=no
-  hardcode_into_libs=yes
-  ;;
-
 haiku*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   dynamic_linker="$host_os runtime_loader"
@@ -14733,7 +14956,7 @@ hpux9* | hpux10* | hpux11*)
   ;;
 
 interix[3-9]*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
@@ -14749,7 +14972,7 @@ irix5* | irix6* | nonstopux*)
     nonstopux*) version_type=nonstopux ;;
     *)
 	if test "$lt_cv_prog_gnu_ld" = yes; then
-		version_type=linux
+		version_type=linux # correct to gnu/linux during the next big refactor
 	else
 		version_type=irix
 	fi ;;
@@ -14786,9 +15009,9 @@ linux*oldld* | linux*aout* | linux*coff*)
   dynamic_linker=no
   ;;
 
-# This must be Linux ELF.
-linux* | k*bsd*-gnu | kopensolaris*-gnu)
-  version_type=linux
+# This must be glibc/ELF.
+linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
@@ -14882,7 +15105,7 @@ netbsd*)
   ;;
 
 newsos6)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
   shlibpath_var=LD_LIBRARY_PATH
   shlibpath_overrides_runpath=yes
@@ -14951,7 +15174,7 @@ rdos*)
   ;;
 
 solaris*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
@@ -14976,7 +15199,7 @@ sunos4*)
   ;;
 
 sysv4 | sysv4.3*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
   soname_spec='${libname}${release}${shared_ext}$major'
   shlibpath_var=LD_LIBRARY_PATH
@@ -15000,7 +15223,7 @@ sysv4 | sysv4.3*)
 
 sysv4*MP*)
   if test -d /usr/nec ;then
-    version_type=linux
+    version_type=linux # correct to gnu/linux during the next big refactor
     library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
     soname_spec='$libname${shared_ext}.$major'
     shlibpath_var=LD_LIBRARY_PATH
@@ -15031,7 +15254,7 @@ sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
 
 tpf*)
   # TPF is a cross-target only.  Preferred cross-host = GNU/Linux.
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
@@ -15041,7 +15264,7 @@ tpf*)
   ;;
 
 uts4*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
   soname_spec='${libname}${release}${shared_ext}$major'
   shlibpath_var=LD_LIBRARY_PATH
@@ -15180,6 +15403,8 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
 
+
+
         ac_config_commands="$ac_config_commands libtool"
 
 
@@ -15342,6 +15567,14 @@ LIBOBJS=$ac_libobjs
 LTLIBOBJS=$ac_ltlibobjs
 
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5
+$as_echo_n "checking that generated files are newer than configure... " >&6; }
+   if test -n "$am_sleep_pid"; then
+     # Hide warnings about reused PIDs.
+     wait $am_sleep_pid 2>/dev/null
+   fi
+   { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5
+$as_echo "done" >&6; }
  if test -n "$EXEEXT"; then
   am__EXEEXT_TRUE=
   am__EXEEXT_FALSE='#'
@@ -15664,16 +15897,16 @@ if (echo >conf$$.file) 2>/dev/null; then
     # ... but there are two gotchas:
     # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
     # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
-    # In both cases, we have to default to `cp -p'.
+    # In both cases, we have to default to `cp -pR'.
     ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
-      as_ln_s='cp -p'
+      as_ln_s='cp -pR'
   elif ln conf$$.file conf$$ 2>/dev/null; then
     as_ln_s=ln
   else
-    as_ln_s='cp -p'
+    as_ln_s='cp -pR'
   fi
 else
-  as_ln_s='cp -p'
+  as_ln_s='cp -pR'
 fi
 rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
 rmdir conf$$.dir 2>/dev/null
@@ -15733,28 +15966,16 @@ else
   as_mkdir_p=false
 fi
 
-if test -x / >/dev/null 2>&1; then
-  as_test_x='test -x'
-else
-  if ls -dL / >/dev/null 2>&1; then
-    as_ls_L_option=L
-  else
-    as_ls_L_option=
-  fi
-  as_test_x='
-    eval sh -c '\''
-      if test -d "$1"; then
-	test -d "$1/.";
-      else
-	case $1 in #(
-	-*)set "./$1";;
-	esac;
-	case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
-	???[sx]*):;;*)false;;esac;fi
-    '\'' sh
-  '
-fi
-as_executable_p=$as_test_x
+
+# as_fn_executable_p FILE
+# -----------------------
+# Test if FILE is an executable regular file.
+as_fn_executable_p ()
+{
+  test -f "$1" && test -x "$1"
+} # as_fn_executable_p
+as_test_x='test -x'
+as_executable_p=as_fn_executable_p
 
 # Sed expression to map a string onto a valid CPP name.
 as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
@@ -15776,7 +15997,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # values after options handling.
 ac_log="
 This file was extended by PortAudioCpp $as_me 12, which was
-generated by GNU Autoconf 2.68.  Invocation command line was
+generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
   CONFIG_HEADERS  = $CONFIG_HEADERS
@@ -15833,10 +16054,10 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
 PortAudioCpp config.status 12
-configured by $0, generated by GNU Autoconf 2.68,
+configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
-Copyright (C) 2010 Free Software Foundation, Inc.
+Copyright (C) 2012 Free Software Foundation, Inc.
 This config.status script is free software; the Free Software Foundation
 gives unlimited permission to copy, distribute and modify it."
 
@@ -15916,7 +16137,7 @@ fi
 _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 if \$ac_cs_recheck; then
-  set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+  set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
   shift
   \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
   CONFIG_SHELL='$SHELL'
@@ -15961,6 +16182,7 @@ pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`'
 enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`'
 SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`'
 ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`'
+PATH_SEPARATOR='`$ECHO "$PATH_SEPARATOR" | $SED "$delay_single_quote_subst"`'
 host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`'
 host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`'
 host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`'
@@ -16041,7 +16263,6 @@ with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`'
 allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`'
 no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`'
 hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`'
-hardcode_libdir_flag_spec_ld='`$ECHO "$hardcode_libdir_flag_spec_ld" | $SED "$delay_single_quote_subst"`'
 hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`'
 hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`'
 hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`'
@@ -16113,7 +16334,6 @@ with_gnu_ld_CXX='`$ECHO "$with_gnu_ld_CXX" | $SED "$delay_single_quote_subst"`'
 allow_undefined_flag_CXX='`$ECHO "$allow_undefined_flag_CXX" | $SED "$delay_single_quote_subst"`'
 no_undefined_flag_CXX='`$ECHO "$no_undefined_flag_CXX" | $SED "$delay_single_quote_subst"`'
 hardcode_libdir_flag_spec_CXX='`$ECHO "$hardcode_libdir_flag_spec_CXX" | $SED "$delay_single_quote_subst"`'
-hardcode_libdir_flag_spec_ld_CXX='`$ECHO "$hardcode_libdir_flag_spec_ld_CXX" | $SED "$delay_single_quote_subst"`'
 hardcode_libdir_separator_CXX='`$ECHO "$hardcode_libdir_separator_CXX" | $SED "$delay_single_quote_subst"`'
 hardcode_direct_CXX='`$ECHO "$hardcode_direct_CXX" | $SED "$delay_single_quote_subst"`'
 hardcode_direct_absolute_CXX='`$ECHO "$hardcode_direct_absolute_CXX" | $SED "$delay_single_quote_subst"`'
@@ -16155,6 +16375,7 @@ DLLTOOL \
 OBJDUMP \
 SHELL \
 ECHO \
+PATH_SEPARATOR \
 SED \
 GREP \
 EGREP \
@@ -16203,7 +16424,6 @@ with_gnu_ld \
 allow_undefined_flag \
 no_undefined_flag \
 hardcode_libdir_flag_spec \
-hardcode_libdir_flag_spec_ld \
 hardcode_libdir_separator \
 exclude_expsyms \
 include_expsyms \
@@ -16237,7 +16457,6 @@ with_gnu_ld_CXX \
 allow_undefined_flag_CXX \
 no_undefined_flag_CXX \
 hardcode_libdir_flag_spec_CXX \
-hardcode_libdir_flag_spec_ld_CXX \
 hardcode_libdir_separator_CXX \
 exclude_expsyms_CXX \
 include_expsyms_CXX \
@@ -16767,7 +16986,7 @@ $as_echo "$as_me: executing $ac_file commands" >&6;}
 
   case $ac_file$ac_mode in
     "depfiles":C) test x"$AMDEP_TRUE" != x"" || {
-  # Autoconf 2.62 quotes --file arguments for eval, but not when files
+  # Older Autoconf quotes --file arguments for eval, but not when files
   # are listed without --file.  Let's play safe and only enable the eval
   # if we detect the quoting.
   case $CONFIG_FILES in
@@ -16780,7 +16999,7 @@ $as_echo "$as_me: executing $ac_file commands" >&6;}
     # Strip MF so we end up with the name of the file.
     mf=`echo "$mf" | sed -e 's/:.*$//'`
     # Check whether this is an Automake generated Makefile or not.
-    # We used to match only the files named `Makefile.in', but
+    # We used to match only the files named 'Makefile.in', but
     # some people rename them; so instead we look at the file content.
     # Grep'ing the first line is not enough: some people post-process
     # each Makefile.in and add a new line on top of each file to say so.
@@ -16814,21 +17033,19 @@ $as_echo X"$mf" |
       continue
     fi
     # Extract the definition of DEPDIR, am__include, and am__quote
-    # from the Makefile without running `make'.
+    # from the Makefile without running 'make'.
     DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
     test -z "$DEPDIR" && continue
     am__include=`sed -n 's/^am__include = //p' < "$mf"`
-    test -z "am__include" && continue
+    test -z "$am__include" && continue
     am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
-    # When using ansi2knr, U may be empty or an underscore; expand it
-    U=`sed -n 's/^U = //p' < "$mf"`
     # Find all dependency output files, they are included files with
     # $(DEPDIR) in their names.  We invoke sed twice because it is the
     # simplest approach to changing $(DEPDIR) to its actual value in the
     # expansion.
     for file in `sed -n "
       s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
-	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
       # Make sure the directory exists.
       test -f "$dirpart/$file" && continue
       fdir=`$as_dirname -- "$file" ||
@@ -16882,8 +17099,8 @@ $as_echo X"$file" |
 # NOTE: Changes made to this file will be lost: look at ltmain.sh.
 #
 #   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
-#                 2006, 2007, 2008, 2009, 2010 Free Software Foundation,
-#                 Inc.
+#                 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+#                 Foundation, Inc.
 #   Written by Gordon Matzigkeit, 1996
 #
 #   This file is part of GNU Libtool.
@@ -16946,6 +17163,9 @@ SHELL=$lt_SHELL
 # An echo program that protects backslashes.
 ECHO=$lt_ECHO
 
+# The PATH separator for the build system.
+PATH_SEPARATOR=$lt_PATH_SEPARATOR
+
 # The host system.
 host_alias=$host_alias
 host=$host
@@ -17241,10 +17461,6 @@ no_undefined_flag=$lt_no_undefined_flag
 # This must work even if \$libdir does not exist
 hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec
 
-# If ld is used when linking, flag to hardcode \$libdir into a binary
-# during linking.  This must work even if \$libdir does not exist.
-hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld
-
 # Whether we need a single "-rpath" flag with a separated argument.
 hardcode_libdir_separator=$lt_hardcode_libdir_separator
 
@@ -17587,10 +17803,6 @@ no_undefined_flag=$lt_no_undefined_flag_CXX
 # This must work even if \$libdir does not exist
 hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX
 
-# If ld is used when linking, flag to hardcode \$libdir into a binary
-# during linking.  This must work even if \$libdir does not exist.
-hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_CXX
-
 # Whether we need a single "-rpath" flag with a separated argument.
 hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX
 
diff --git a/bindings/cpp/doc/Makefile.in b/bindings/cpp/doc/Makefile.in
index 3aba564..f471ddc 100644
--- a/bindings/cpp/doc/Makefile.in
+++ b/bindings/cpp/doc/Makefile.in
@@ -1,9 +1,8 @@
-# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# Makefile.in generated by automake 1.14.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
-# Inc.
+# Copyright (C) 1994-2013 Free Software Foundation, Inc.
+
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -15,6 +14,51 @@
 
 @SET_MAKE@
 VPATH = @srcdir@
+am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+am__make_running_with_option = \
+  case $${target_option-} in \
+      ?) ;; \
+      *) echo "am__make_running_with_option: internal error: invalid" \
+              "target option '$${target_option-}' specified" >&2; \
+         exit 1;; \
+  esac; \
+  has_opt=no; \
+  sane_makeflags=$$MAKEFLAGS; \
+  if $(am__is_gnu_make); then \
+    sane_makeflags=$$MFLAGS; \
+  else \
+    case $$MAKEFLAGS in \
+      *\\[\ \	]*) \
+        bs=\\; \
+        sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+          | sed "s/$$bs$$bs[$$bs $$bs	]*//g"`;; \
+    esac; \
+  fi; \
+  skip_next=no; \
+  strip_trailopt () \
+  { \
+    flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+  }; \
+  for flg in $$sane_makeflags; do \
+    test $$skip_next = yes && { skip_next=no; continue; }; \
+    case $$flg in \
+      *=*|--*) continue;; \
+        -*I) strip_trailopt 'I'; skip_next=yes;; \
+      -*I?*) strip_trailopt 'I';; \
+        -*O) strip_trailopt 'O'; skip_next=yes;; \
+      -*O?*) strip_trailopt 'O';; \
+        -*l) strip_trailopt 'l'; skip_next=yes;; \
+      -*l?*) strip_trailopt 'l';; \
+      -[dEDm]) skip_next=yes;; \
+      -[JT]) skip_next=yes;; \
+    esac; \
+    case $$flg in \
+      *$$target_option*) has_opt=yes; break;; \
+    esac; \
+  done; \
+  test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
 pkgdatadir = $(datadir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
@@ -34,7 +78,7 @@ POST_UNINSTALL = :
 build_triplet = @build@
 host_triplet = @host@
 subdir = doc
-DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am README
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
@@ -42,11 +86,30 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 mkinstalldirs = $(install_sh) -d
 CONFIG_CLEAN_FILES =
 CONFIG_CLEAN_VPATH_FILES =
+AM_V_P = $(am__v_P_ at AM_V@)
+am__v_P_ = $(am__v_P_ at AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_ at AM_V@)
+am__v_GEN_ = $(am__v_GEN_ at AM_DEFAULT_V@)
+am__v_GEN_0 = @echo "  GEN     " $@;
+am__v_GEN_1 = 
+AM_V_at = $(am__v_at_ at AM_V@)
+am__v_at_ = $(am__v_at_ at AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 = 
 SOURCES =
 DIST_SOURCES =
+am__can_run_installinfo = \
+  case $$AM_UPDATE_INFO_DIR in \
+    n|no|NO) false;; \
+    *) (install-info --version) >/dev/null 2>&1;; \
+  esac
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
 AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
 AR = @AR@
 AS = @AS@
 AUTOCONF = @AUTOCONF@
@@ -208,11 +271,11 @@ mostlyclean-libtool:
 
 clean-libtool:
 	-rm -rf .libs _libs
-tags: TAGS
-TAGS:
+tags TAGS:
+
+ctags CTAGS:
 
-ctags: CTAGS
-CTAGS:
+cscope cscopelist:
 
 
 distdir: $(DISTFILES)
@@ -259,10 +322,15 @@ install-am: all-am
 
 installcheck: installcheck-am
 install-strip:
-	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	  `test -z '$(STRIP)' || \
-	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
 mostlyclean-generic:
 
 clean-generic:
@@ -343,15 +411,16 @@ uninstall-am:
 .MAKE: install-am install-strip
 
 .PHONY: all all-am check check-am clean clean-generic clean-libtool \
-	distclean distclean-generic distclean-libtool distdir dvi \
-	dvi-am html html-am info info-am install install-am \
-	install-data install-data-am install-dvi install-dvi-am \
-	install-exec install-exec-am install-html install-html-am \
-	install-info install-info-am install-man install-pdf \
-	install-pdf-am install-ps install-ps-am install-strip \
-	installcheck installcheck-am installdirs maintainer-clean \
-	maintainer-clean-generic mostlyclean mostlyclean-generic \
-	mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am
+	cscopelist-am ctags-am distclean distclean-generic \
+	distclean-libtool distdir dvi dvi-am html html-am info info-am \
+	install install-am install-data install-data-am install-dvi \
+	install-dvi-am install-exec install-exec-am install-html \
+	install-html-am install-info install-info-am install-man \
+	install-pdf install-pdf-am install-ps install-ps-am \
+	install-strip installcheck installcheck-am installdirs \
+	maintainer-clean maintainer-clean-generic mostlyclean \
+	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+	tags-am uninstall uninstall-am
 
 #INCLUDES = -I$(srcdir)/$(PACPP_ROOT)/include -I$(top_srcdir)/include
 
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 <iostream>
-#include <cmath>
-#include <cassert>
-#include <cstddef>
-#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<float **>(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<SineGenerator> 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..." <<std::endl;
-
-		// Stop the Stream (not strictly needed as termintating the System will also stop all open Streams):
-		stream.stop();
-
-		// Close the Stream (not strictly needed as terminating the System will also close all open Streams):
-		stream.close();
-
-		// Terminate the System (not strictly needed as the AutoSystem will also take care of this when it 
-		// goes out of scope):
-		sys.terminate();
-
-		std::cout << "Test finished." << std::endl;
-	}
-	catch (const portaudio::PaException &e)
-	{
-		std::cout << "A PortAudio error occured: " << e.paErrorText() << std::endl;
-	}
-	catch (const portaudio::PaCppException &e)
-	{
-		std::cout << "A PortAudioCpp error occured: " << e.what() << std::endl;
-	}
-	catch (const std::exception &e)
-	{
-		std::cout << "A generic exception occured: " << e.what() << std::endl;
-	}
-	catch (...)
-	{
-		std::cout << "An unknown exception occured." << std::endl;
-	}
-
-	return 0;
-}
-
-
+// ---------------------------------------------------------------------------------------
+
+#include <iostream>
+#include <cmath>
+#include <cassert>
+#include <cstddef>
+#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<float **>(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<SineGenerator> 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..." <<std::endl;
+
+		// Stop the Stream (not strictly needed as termintating the System will also stop all open Streams):
+		stream.stop();
+
+		// Close the Stream (not strictly needed as terminating the System will also close all open Streams):
+		stream.close();
+
+		// Terminate the System (not strictly needed as the AutoSystem will also take care of this when it 
+		// goes out of scope):
+		sys.terminate();
+
+		std::cout << "Test finished." << std::endl;
+	}
+	catch (const portaudio::PaException &e)
+	{
+		std::cout << "A PortAudio error occured: " << e.paErrorText() << std::endl;
+	}
+	catch (const portaudio::PaCppException &e)
+	{
+		std::cout << "A PortAudioCpp error occured: " << e.what() << std::endl;
+	}
+	catch (const std::exception &e)
+	{
+		std::cout << "A generic exception occured: " << e.what() << std::endl;
+	}
+	catch (...)
+	{
+		std::cout << "An unknown exception occured." << std::endl;
+	}
+
+	return 0;
+}
+
+
diff --git a/bindings/cpp/include/Makefile.in b/bindings/cpp/include/Makefile.in
index 280c652..986651d 100644
--- a/bindings/cpp/include/Makefile.in
+++ b/bindings/cpp/include/Makefile.in
@@ -1,9 +1,8 @@
-# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# Makefile.in generated by automake 1.14.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
-# Inc.
+# Copyright (C) 1994-2013 Free Software Foundation, Inc.
+
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -16,6 +15,51 @@
 @SET_MAKE@
 
 VPATH = @srcdir@
+am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+am__make_running_with_option = \
+  case $${target_option-} in \
+      ?) ;; \
+      *) echo "am__make_running_with_option: internal error: invalid" \
+              "target option '$${target_option-}' specified" >&2; \
+         exit 1;; \
+  esac; \
+  has_opt=no; \
+  sane_makeflags=$$MAKEFLAGS; \
+  if $(am__is_gnu_make); then \
+    sane_makeflags=$$MFLAGS; \
+  else \
+    case $$MAKEFLAGS in \
+      *\\[\ \	]*) \
+        bs=\\; \
+        sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+          | sed "s/$$bs$$bs[$$bs $$bs	]*//g"`;; \
+    esac; \
+  fi; \
+  skip_next=no; \
+  strip_trailopt () \
+  { \
+    flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+  }; \
+  for flg in $$sane_makeflags; do \
+    test $$skip_next = yes && { skip_next=no; continue; }; \
+    case $$flg in \
+      *=*|--*) continue;; \
+        -*I) strip_trailopt 'I'; skip_next=yes;; \
+      -*I?*) strip_trailopt 'I';; \
+        -*O) strip_trailopt 'O'; skip_next=yes;; \
+      -*O?*) strip_trailopt 'O';; \
+        -*l) strip_trailopt 'l'; skip_next=yes;; \
+      -*l?*) strip_trailopt 'l';; \
+      -[dEDm]) skip_next=yes;; \
+      -[JT]) skip_next=yes;; \
+    esac; \
+    case $$flg in \
+      *$$target_option*) has_opt=yes; break;; \
+    esac; \
+  done; \
+  test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
 pkgdatadir = $(datadir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
@@ -35,8 +79,8 @@ POST_UNINSTALL = :
 build_triplet = @build@
 host_triplet = @host@
 subdir = include
-DIST_COMMON = $(pkginclude_HEADERS) $(srcdir)/Makefile.am \
-	$(srcdir)/Makefile.in
+DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
+	$(pkginclude_HEADERS)
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
@@ -44,8 +88,25 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 mkinstalldirs = $(install_sh) -d
 CONFIG_CLEAN_FILES =
 CONFIG_CLEAN_VPATH_FILES =
+AM_V_P = $(am__v_P_ at AM_V@)
+am__v_P_ = $(am__v_P_ at AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_ at AM_V@)
+am__v_GEN_ = $(am__v_GEN_ at AM_DEFAULT_V@)
+am__v_GEN_0 = @echo "  GEN     " $@;
+am__v_GEN_1 = 
+AM_V_at = $(am__v_at_ at AM_V@)
+am__v_at_ = $(am__v_at_ at AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 = 
 SOURCES =
 DIST_SOURCES =
+am__can_run_installinfo = \
+  case $$AM_UPDATE_INFO_DIR in \
+    n|no|NO) false;; \
+    *) (install-info --version) >/dev/null 2>&1;; \
+  esac
 am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
 am__vpath_adj = case $$p in \
     $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
@@ -67,13 +128,37 @@ am__nobase_list = $(am__nobase_strip_setup); \
 am__base_list = \
   sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
   sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+  test -z "$$files" \
+    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+         $(am__cd) "$$dir" && rm -f $$files; }; \
+  }
 am__installdirs = "$(DESTDIR)$(pkgincludedir)"
 HEADERS = $(pkginclude_HEADERS)
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates.  Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+  BEGIN { nonempty = 0; } \
+  { items[$$0] = 1; nonempty = 1; } \
+  END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique.  This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+  list='$(am__tagged_files)'; \
+  unique=`for i in $$list; do \
+    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+  done | $(am__uniquify_input)`
 ETAGS = etags
 CTAGS = ctags
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
 AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
 AR = @AR@
 AS = @AS@
 AUTOCONF = @AUTOCONF@
@@ -257,8 +342,11 @@ clean-libtool:
 	-rm -rf .libs _libs
 install-pkgincludeHEADERS: $(pkginclude_HEADERS)
 	@$(NORMAL_INSTALL)
-	test -z "$(pkgincludedir)" || $(MKDIR_P) "$(DESTDIR)$(pkgincludedir)"
 	@list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \
+	if test -n "$$list"; then \
+	  echo " $(MKDIR_P) '$(DESTDIR)$(pkgincludedir)'"; \
+	  $(MKDIR_P) "$(DESTDIR)$(pkgincludedir)" || exit 1; \
+	fi; \
 	for p in $$list; do \
 	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
 	  echo "$$d$$p"; \
@@ -272,30 +360,17 @@ uninstall-pkgincludeHEADERS:
 	@$(NORMAL_UNINSTALL)
 	@list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \
 	files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
-	test -n "$$files" || exit 0; \
-	echo " ( cd '$(DESTDIR)$(pkgincludedir)' && rm -f" $$files ")"; \
-	cd "$(DESTDIR)$(pkgincludedir)" && rm -f $$files
-
-ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
-	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
-	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	mkid -fID $$unique
-tags: TAGS
-
-TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
-		$(TAGS_FILES) $(LISP)
+	dir='$(DESTDIR)$(pkgincludedir)'; $(am__uninstall_files_from_dir)
+
+ID: $(am__tagged_files)
+	$(am__define_uniq_tagged_files); mkid -fID $$unique
+tags: tags-am
+TAGS: tags
+
+tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
 	set x; \
 	here=`pwd`; \
-	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
-	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	$(am__define_uniq_tagged_files); \
 	shift; \
 	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
 	  test -n "$$unique" || unique=$$empty_fix; \
@@ -307,15 +382,11 @@ TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 	      $$unique; \
 	  fi; \
 	fi
-ctags: CTAGS
-CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
-		$(TAGS_FILES) $(LISP)
-	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
-	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+ctags: ctags-am
+
+CTAGS: ctags
+ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+	$(am__define_uniq_tagged_files); \
 	test -z "$(CTAGS_ARGS)$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
 	     $$unique
@@ -324,6 +395,21 @@ GTAGS:
 	here=`$(am__cd) $(top_builddir) && pwd` \
 	  && $(am__cd) $(top_srcdir) \
 	  && gtags -i $(GTAGS_ARGS) "$$here"
+cscopelist: cscopelist-am
+
+cscopelist-am: $(am__tagged_files)
+	list='$(am__tagged_files)'; \
+	case "$(srcdir)" in \
+	  [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+	  *) sdir=$(subdir)/$(srcdir) ;; \
+	esac; \
+	for i in $$list; do \
+	  if test -f "$$i"; then \
+	    echo "$(subdir)/$$i"; \
+	  else \
+	    echo "$$sdir/$$i"; \
+	  fi; \
+	done >> $(top_builddir)/cscope.files
 
 distclean-tags:
 	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
@@ -375,10 +461,15 @@ install-am: all-am
 
 installcheck: installcheck-am
 install-strip:
-	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	  `test -z '$(STRIP)' || \
-	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
 mostlyclean-generic:
 
 clean-generic:
@@ -458,18 +549,19 @@ uninstall-am: uninstall-pkgincludeHEADERS
 
 .MAKE: install-am install-strip
 
-.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
-	clean-libtool ctags distclean distclean-generic \
-	distclean-libtool distclean-tags distdir dvi dvi-am html \
-	html-am info info-am install install-am install-data \
-	install-data-am install-dvi install-dvi-am install-exec \
-	install-exec-am install-html install-html-am install-info \
-	install-info-am install-man install-pdf install-pdf-am \
-	install-pkgincludeHEADERS install-ps install-ps-am \
-	install-strip installcheck installcheck-am installdirs \
-	maintainer-clean maintainer-clean-generic mostlyclean \
-	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
-	tags uninstall uninstall-am uninstall-pkgincludeHEADERS
+.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
+	clean-libtool cscopelist-am ctags ctags-am distclean \
+	distclean-generic distclean-libtool distclean-tags distdir dvi \
+	dvi-am html html-am info info-am install install-am \
+	install-data install-data-am install-dvi install-dvi-am \
+	install-exec install-exec-am install-html install-html-am \
+	install-info install-info-am install-man install-pdf \
+	install-pdf-am install-pkgincludeHEADERS install-ps \
+	install-ps-am install-strip installcheck installcheck-am \
+	installdirs maintainer-clean maintainer-clean-generic \
+	mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
+	ps ps-am tags tags-am uninstall uninstall-am \
+	uninstall-pkgincludeHEADERS
 
 
 #       portaudiocpp/AsioDeviceAdapter.hxx
diff --git a/bindings/cpp/include/portaudiocpp/AsioDeviceAdapter.hxx b/bindings/cpp/include/portaudiocpp/AsioDeviceAdapter.hxx
index 1964b6a..26957c4 100644
--- a/bindings/cpp/include/portaudiocpp/AsioDeviceAdapter.hxx
+++ b/bindings/cpp/include/portaudiocpp/AsioDeviceAdapter.hxx
@@ -28,7 +28,7 @@ namespace portaudio
 
 		void showControlPanel(void *systemSpecific);
 
-		const char *inputChannelName(int channelIndex) const;
+		const char *inputChannelName(int channelIndex) const;
 		const char *outputChannelName(int channelIndex) const;
 
 	private:
diff --git a/bindings/cpp/include/portaudiocpp/AutoSystem.hxx b/bindings/cpp/include/portaudiocpp/AutoSystem.hxx
index 16cac5e..47e2ec1 100644
--- a/bindings/cpp/include/portaudiocpp/AutoSystem.hxx
+++ b/bindings/cpp/include/portaudiocpp/AutoSystem.hxx
@@ -1,62 +1,62 @@
-#ifndef INCLUDED_PORTAUDIO_AUTOSYSTEM_HXX
-#define INCLUDED_PORTAUDIO_AUTOSYSTEM_HXX
-
-// ---------------------------------------------------------------------------------------
-
-#include "portaudiocpp/System.hxx"
-
-// ---------------------------------------------------------------------------------------
-
-namespace portaudio
-{
-
-
-	//////
-	/// @brief A RAII idiom class to ensure automatic clean-up when an exception is 
-	/// raised.
-	///
-	/// A simple helper class which uses the 'Resource Acquisition is Initialization' 
-	/// idiom (RAII). Use this class to initialize/terminate the System rather than 
-	/// using System directly. AutoSystem must be created on stack and must be valid 
-	/// throughout the time you wish to use PortAudioCpp. Your 'main' function might be 
-	/// a good place for it.
-	///
-	/// To avoid having to type portaudio::System::instance().xyz() all the time, it's usually 
-	/// a good idea to make a reference to the System which can be accessed directly.
-	/// @verbatim
-	/// portaudio::AutoSys autoSys;
-	/// portaudio::System &sys = portaudio::System::instance();
-	/// @endverbatim
-	//////
-	class AutoSystem
-	{
-	public:
-		AutoSystem(bool initialize = true)
-		{
-			if (initialize)
-				System::initialize();
-		}
-
-		~AutoSystem()
-		{
-			if (System::exists())
-				System::terminate();
-		}
-
-		void initialize()
-		{
-			System::initialize();
-		}
-
-		void terminate()
-		{
-			System::terminate();
-		}
-	};
-
-
-} // namespace portaudio
-
-// ---------------------------------------------------------------------------------------
-
-#endif // INCLUDED_PORTAUDIO_AUTOSYSTEM_HXX
+#ifndef INCLUDED_PORTAUDIO_AUTOSYSTEM_HXX
+#define INCLUDED_PORTAUDIO_AUTOSYSTEM_HXX
+
+// ---------------------------------------------------------------------------------------
+
+#include "portaudiocpp/System.hxx"
+
+// ---------------------------------------------------------------------------------------
+
+namespace portaudio
+{
+
+
+	//////
+	/// @brief A RAII idiom class to ensure automatic clean-up when an exception is 
+	/// raised.
+	///
+	/// A simple helper class which uses the 'Resource Acquisition is Initialization' 
+	/// idiom (RAII). Use this class to initialize/terminate the System rather than 
+	/// using System directly. AutoSystem must be created on stack and must be valid 
+	/// throughout the time you wish to use PortAudioCpp. Your 'main' function might be 
+	/// a good place for it.
+	///
+	/// To avoid having to type portaudio::System::instance().xyz() all the time, it's usually 
+	/// a good idea to make a reference to the System which can be accessed directly.
+	/// @verbatim
+	/// portaudio::AutoSys autoSys;
+	/// portaudio::System &sys = portaudio::System::instance();
+	/// @endverbatim
+	//////
+	class AutoSystem
+	{
+	public:
+		AutoSystem(bool initialize = true)
+		{
+			if (initialize)
+				System::initialize();
+		}
+
+		~AutoSystem()
+		{
+			if (System::exists())
+				System::terminate();
+		}
+
+		void initialize()
+		{
+			System::initialize();
+		}
+
+		void terminate()
+		{
+			System::terminate();
+		}
+	};
+
+
+} // namespace portaudio
+
+// ---------------------------------------------------------------------------------------
+
+#endif // INCLUDED_PORTAUDIO_AUTOSYSTEM_HXX
diff --git a/bindings/cpp/include/portaudiocpp/BlockingStream.hxx b/bindings/cpp/include/portaudiocpp/BlockingStream.hxx
index 37fa766..158dfa0 100644
--- a/bindings/cpp/include/portaudiocpp/BlockingStream.hxx
+++ b/bindings/cpp/include/portaudiocpp/BlockingStream.hxx
@@ -1,45 +1,45 @@
-#ifndef INCLUDED_PORTAUDIO_BLOCKINGSTREAM_HXX
-#define INCLUDED_PORTAUDIO_BLOCKINGSTREAM_HXX
-
-// ---------------------------------------------------------------------------------------
-
-#include "portaudiocpp/Stream.hxx"
-
-// ---------------------------------------------------------------------------------------
-
-namespace portaudio
-{
-
-
-
-	//////
-	/// @brief Stream class for blocking read/write-style input and output.
-	//////
-	class BlockingStream : public Stream
-	{
-	public:
-		BlockingStream();
-		BlockingStream(const StreamParameters &parameters);
-		~BlockingStream();
-
-		void open(const StreamParameters &parameters);
-
-		void read(void *buffer, unsigned long numFrames);
-		void write(const void *buffer, unsigned long numFrames);
-
-		signed long availableReadSize() const;
-		signed long availableWriteSize() const;
-
-	private:
-		BlockingStream(const BlockingStream &); // non-copyable
-		BlockingStream &operator=(const BlockingStream &); // non-copyable
-	};
-
-
-
-} // portaudio
-
-// ---------------------------------------------------------------------------------------
-
-#endif // INCLUDED_PORTAUDIO_BLOCKINGSTREAM_HXX
-
+#ifndef INCLUDED_PORTAUDIO_BLOCKINGSTREAM_HXX
+#define INCLUDED_PORTAUDIO_BLOCKINGSTREAM_HXX
+
+// ---------------------------------------------------------------------------------------
+
+#include "portaudiocpp/Stream.hxx"
+
+// ---------------------------------------------------------------------------------------
+
+namespace portaudio
+{
+
+
+
+	//////
+	/// @brief Stream class for blocking read/write-style input and output.
+	//////
+	class BlockingStream : public Stream
+	{
+	public:
+		BlockingStream();
+		BlockingStream(const StreamParameters &parameters);
+		~BlockingStream();
+
+		void open(const StreamParameters &parameters);
+
+		void read(void *buffer, unsigned long numFrames);
+		void write(const void *buffer, unsigned long numFrames);
+
+		signed long availableReadSize() const;
+		signed long availableWriteSize() const;
+
+	private:
+		BlockingStream(const BlockingStream &); // non-copyable
+		BlockingStream &operator=(const BlockingStream &); // non-copyable
+	};
+
+
+
+} // portaudio
+
+// ---------------------------------------------------------------------------------------
+
+#endif // INCLUDED_PORTAUDIO_BLOCKINGSTREAM_HXX
+
diff --git a/bindings/cpp/include/portaudiocpp/CFunCallbackStream.hxx b/bindings/cpp/include/portaudiocpp/CFunCallbackStream.hxx
index b3e3b5c..1c7faa8 100644
--- a/bindings/cpp/include/portaudiocpp/CFunCallbackStream.hxx
+++ b/bindings/cpp/include/portaudiocpp/CFunCallbackStream.hxx
@@ -1,49 +1,49 @@
-#ifndef INCLUDED_PORTAUDIO_CFUNCALLBACKSTREAM_HXX
-#define INCLUDED_PORTAUDIO_CFUNCALLBACKSTREAM_HXX
-
-// ---------------------------------------------------------------------------------------
-
-#include "portaudio.h"
-
-#include "portaudiocpp/CallbackStream.hxx"
-
-// ---------------------------------------------------------------------------------------
-
-// Forward declaration(s)
-namespace portaudio
-{
-	class StreamParameters;
-}
-
-// ---------------------------------------------------------------------------------------
-
-// Declaration(s):
-namespace portaudio
-{
-	// -----------------------------------------------------------------------------------
-
-	//////
-	/// @brief Callback stream using a free function with C linkage. It's important that the function 
-	/// the passed function pointer points to is declared ``extern "C"''.
-	//////
-	class CFunCallbackStream : public CallbackStream
-	{
-	public:
-		CFunCallbackStream();
-		CFunCallbackStream(const StreamParameters &parameters, PaStreamCallback *funPtr, void *userData);
-		~CFunCallbackStream();
-		
-		void open(const StreamParameters &parameters, PaStreamCallback *funPtr, void *userData);
-
-	private:
-		CFunCallbackStream(const CFunCallbackStream &); // non-copyable
-		CFunCallbackStream &operator=(const CFunCallbackStream &); // non-copyable
-	};
-
-	// -----------------------------------------------------------------------------------
-} // portaudio
-
-// ---------------------------------------------------------------------------------------
-
-#endif // INCLUDED_PORTAUDIO_MEMFUNCALLBACKSTREAM_HXX
-
+#ifndef INCLUDED_PORTAUDIO_CFUNCALLBACKSTREAM_HXX
+#define INCLUDED_PORTAUDIO_CFUNCALLBACKSTREAM_HXX
+
+// ---------------------------------------------------------------------------------------
+
+#include "portaudio.h"
+
+#include "portaudiocpp/CallbackStream.hxx"
+
+// ---------------------------------------------------------------------------------------
+
+// Forward declaration(s)
+namespace portaudio
+{
+	class StreamParameters;
+}
+
+// ---------------------------------------------------------------------------------------
+
+// Declaration(s):
+namespace portaudio
+{
+	// -----------------------------------------------------------------------------------
+
+	//////
+	/// @brief Callback stream using a free function with C linkage. It's important that the function 
+	/// the passed function pointer points to is declared ``extern "C"''.
+	//////
+	class CFunCallbackStream : public CallbackStream
+	{
+	public:
+		CFunCallbackStream();
+		CFunCallbackStream(const StreamParameters &parameters, PaStreamCallback *funPtr, void *userData);
+		~CFunCallbackStream();
+		
+		void open(const StreamParameters &parameters, PaStreamCallback *funPtr, void *userData);
+
+	private:
+		CFunCallbackStream(const CFunCallbackStream &); // non-copyable
+		CFunCallbackStream &operator=(const CFunCallbackStream &); // non-copyable
+	};
+
+	// -----------------------------------------------------------------------------------
+} // portaudio
+
+// ---------------------------------------------------------------------------------------
+
+#endif // INCLUDED_PORTAUDIO_MEMFUNCALLBACKSTREAM_HXX
+
diff --git a/bindings/cpp/include/portaudiocpp/CallbackInterface.hxx b/bindings/cpp/include/portaudiocpp/CallbackInterface.hxx
index d498ec5..b306148 100644
--- a/bindings/cpp/include/portaudiocpp/CallbackInterface.hxx
+++ b/bindings/cpp/include/portaudiocpp/CallbackInterface.hxx
@@ -1,45 +1,45 @@
-#ifndef INCLUDED_PORTAUDIO_CALLBACKINTERFACE_HXX
-#define INCLUDED_PORTAUDIO_CALLBACKINTERFACE_HXX
-
-// ---------------------------------------------------------------------------------------
-
-#include "portaudio.h"
-
-// ---------------------------------------------------------------------------------------
-
-namespace portaudio
-{
-	// -----------------------------------------------------------------------------------
-
-	//////
-	/// @brief Interface for an object that's callable as a PortAudioCpp callback object (ie that implements the 
-	/// paCallbackFun method).
-	//////
-	class CallbackInterface
-	{
-	public:
-		virtual ~CallbackInterface() {}
-
-		virtual int paCallbackFun(const void *inputBuffer, void *outputBuffer, unsigned long numFrames, 
-			const PaStreamCallbackTimeInfo *timeInfo, PaStreamCallbackFlags statusFlags) = 0;
-	};
-
-	// -----------------------------------------------------------------------------------
-
-	namespace impl
-	{
-		extern "C"
-		{
-			int callbackInterfaceToPaCallbackAdapter(const void *inputBuffer, void *outputBuffer, unsigned long numFrames, 
-				const PaStreamCallbackTimeInfo *timeInfo, PaStreamCallbackFlags statusFlags, 
-				void *userData);
-		} // extern "C"
-	}
-
-	// -----------------------------------------------------------------------------------
-
-} // namespace portaudio
-
-// ---------------------------------------------------------------------------------------
-
-#endif // INCLUDED_PORTAUDIO_CALLBACKINTERFACE_HXX
+#ifndef INCLUDED_PORTAUDIO_CALLBACKINTERFACE_HXX
+#define INCLUDED_PORTAUDIO_CALLBACKINTERFACE_HXX
+
+// ---------------------------------------------------------------------------------------
+
+#include "portaudio.h"
+
+// ---------------------------------------------------------------------------------------
+
+namespace portaudio
+{
+	// -----------------------------------------------------------------------------------
+
+	//////
+	/// @brief Interface for an object that's callable as a PortAudioCpp callback object (ie that implements the 
+	/// paCallbackFun method).
+	//////
+	class CallbackInterface
+	{
+	public:
+		virtual ~CallbackInterface() {}
+
+		virtual int paCallbackFun(const void *inputBuffer, void *outputBuffer, unsigned long numFrames, 
+			const PaStreamCallbackTimeInfo *timeInfo, PaStreamCallbackFlags statusFlags) = 0;
+	};
+
+	// -----------------------------------------------------------------------------------
+
+	namespace impl
+	{
+		extern "C"
+		{
+			int callbackInterfaceToPaCallbackAdapter(const void *inputBuffer, void *outputBuffer, unsigned long numFrames, 
+				const PaStreamCallbackTimeInfo *timeInfo, PaStreamCallbackFlags statusFlags, 
+				void *userData);
+		} // extern "C"
+	}
+
+	// -----------------------------------------------------------------------------------
+
+} // namespace portaudio
+
+// ---------------------------------------------------------------------------------------
+
+#endif // INCLUDED_PORTAUDIO_CALLBACKINTERFACE_HXX
diff --git a/bindings/cpp/include/portaudiocpp/CallbackStream.hxx b/bindings/cpp/include/portaudiocpp/CallbackStream.hxx
index 0382275..7268b14 100644
--- a/bindings/cpp/include/portaudiocpp/CallbackStream.hxx
+++ b/bindings/cpp/include/portaudiocpp/CallbackStream.hxx
@@ -1,40 +1,40 @@
-#ifndef INCLUDED_PORTAUDIO_CALLBACKSTREAM_HXX
-#define INCLUDED_PORTAUDIO_CALLBACKSTREAM_HXX
-
-// ---------------------------------------------------------------------------------------
-
-#include "portaudio.h"
-
-#include "portaudiocpp/Stream.hxx"
-
-// ---------------------------------------------------------------------------------------
-
-// Declaration(s):
-namespace portaudio
-{
-
-
-	//////
-	/// @brief Base class for all Streams which use a callback-based mechanism.
-	//////
-	class CallbackStream : public Stream
-	{
-	protected:
-		CallbackStream();
-		virtual ~CallbackStream();
-
-	public:
-		// stream info (time-varying)
-		double cpuLoad() const;
-
-	private:
-		CallbackStream(const CallbackStream &); // non-copyable
-		CallbackStream &operator=(const CallbackStream &); // non-copyable
-	};
-
-
-} // namespace portaudio
-
-// ---------------------------------------------------------------------------------------
-
-#endif // INCLUDED_PORTAUDIO_CALLBACKSTREAM_HXX
+#ifndef INCLUDED_PORTAUDIO_CALLBACKSTREAM_HXX
+#define INCLUDED_PORTAUDIO_CALLBACKSTREAM_HXX
+
+// ---------------------------------------------------------------------------------------
+
+#include "portaudio.h"
+
+#include "portaudiocpp/Stream.hxx"
+
+// ---------------------------------------------------------------------------------------
+
+// Declaration(s):
+namespace portaudio
+{
+
+
+	//////
+	/// @brief Base class for all Streams which use a callback-based mechanism.
+	//////
+	class CallbackStream : public Stream
+	{
+	protected:
+		CallbackStream();
+		virtual ~CallbackStream();
+
+	public:
+		// stream info (time-varying)
+		double cpuLoad() const;
+
+	private:
+		CallbackStream(const CallbackStream &); // non-copyable
+		CallbackStream &operator=(const CallbackStream &); // non-copyable
+	};
+
+
+} // namespace portaudio
+
+// ---------------------------------------------------------------------------------------
+
+#endif // INCLUDED_PORTAUDIO_CALLBACKSTREAM_HXX
diff --git a/bindings/cpp/include/portaudiocpp/CppFunCallbackStream.hxx b/bindings/cpp/include/portaudiocpp/CppFunCallbackStream.hxx
index e0c0012..3f219ee 100644
--- a/bindings/cpp/include/portaudiocpp/CppFunCallbackStream.hxx
+++ b/bindings/cpp/include/portaudiocpp/CppFunCallbackStream.hxx
@@ -1,86 +1,86 @@
-#ifndef INCLUDED_PORTAUDIO_CPPFUNCALLBACKSTREAM_HXX
-#define INCLUDED_PORTAUDIO_CPPFUNCALLBACKSTREAM_HXX
-
-// ---------------------------------------------------------------------------------------
-
-#include "portaudio.h"
-
-#include "portaudiocpp/CallbackStream.hxx"
-
-// ---------------------------------------------------------------------------------------
-
-// Forward declaration(s):
-namespace portaudio
-{
-	class StreamParameters;
-}
-
-// ---------------------------------------------------------------------------------------
-
-// Declaration(s):
-namespace portaudio
-{
-
-
-	namespace impl
-	{
-		extern "C"
-		{
-			int cppCallbackToPaCallbackAdapter(const void *inputBuffer, void *outputBuffer, unsigned long numFrames, 
-				const PaStreamCallbackTimeInfo *timeInfo, PaStreamCallbackFlags statusFlags, 
-				void *userData);
-		} // extern "C"
-	}
-
-	// -----------------------------------------------------------------------------------
-
-	//////
-	/// @brief Callback stream using a C++ function (either a free function or a static function) 
-	/// callback.
-	//////
-	class FunCallbackStream : public CallbackStream
-	{
-	public:
-		typedef int (*CallbackFunPtr)(const void *inputBuffer, void *outputBuffer, unsigned long numFrames, 
-			const PaStreamCallbackTimeInfo *timeInfo, PaStreamCallbackFlags statusFlags, 
-			void *userData);
-
-		// -------------------------------------------------------------------------------
-
-		//////
-		/// @brief Simple structure containing a function pointer to the C++ callback function and a 
-		/// (void) pointer to the user supplied data.
-		//////
-		struct CppToCCallbackData
-		{
-			CppToCCallbackData();
-			CppToCCallbackData(CallbackFunPtr funPtr, void *userData);
-			void init(CallbackFunPtr funPtr, void *userData);
-
-			CallbackFunPtr funPtr;
-			void *userData;
-		};
-
-		// -------------------------------------------------------------------------------
-
-		FunCallbackStream();
-		FunCallbackStream(const StreamParameters &parameters, CallbackFunPtr funPtr, void *userData);
-		~FunCallbackStream();
-
-		void open(const StreamParameters &parameters, CallbackFunPtr funPtr, void *userData);
-
-	private:
-		FunCallbackStream(const FunCallbackStream &); // non-copyable
-		FunCallbackStream &operator=(const FunCallbackStream &); // non-copyable
-
-		CppToCCallbackData adapterData_;
-
-		void open(const StreamParameters &parameters);
-	};
-
-
-} // portaudio
-
-// ---------------------------------------------------------------------------------------
-
-#endif // INCLUDED_PORTAUDIO_CPPFUNCALLBACKSTREAM_HXX
+#ifndef INCLUDED_PORTAUDIO_CPPFUNCALLBACKSTREAM_HXX
+#define INCLUDED_PORTAUDIO_CPPFUNCALLBACKSTREAM_HXX
+
+// ---------------------------------------------------------------------------------------
+
+#include "portaudio.h"
+
+#include "portaudiocpp/CallbackStream.hxx"
+
+// ---------------------------------------------------------------------------------------
+
+// Forward declaration(s):
+namespace portaudio
+{
+	class StreamParameters;
+}
+
+// ---------------------------------------------------------------------------------------
+
+// Declaration(s):
+namespace portaudio
+{
+
+
+	namespace impl
+	{
+		extern "C"
+		{
+			int cppCallbackToPaCallbackAdapter(const void *inputBuffer, void *outputBuffer, unsigned long numFrames, 
+				const PaStreamCallbackTimeInfo *timeInfo, PaStreamCallbackFlags statusFlags, 
+				void *userData);
+		} // extern "C"
+	}
+
+	// -----------------------------------------------------------------------------------
+
+	//////
+	/// @brief Callback stream using a C++ function (either a free function or a static function) 
+	/// callback.
+	//////
+	class FunCallbackStream : public CallbackStream
+	{
+	public:
+		typedef int (*CallbackFunPtr)(const void *inputBuffer, void *outputBuffer, unsigned long numFrames, 
+			const PaStreamCallbackTimeInfo *timeInfo, PaStreamCallbackFlags statusFlags, 
+			void *userData);
+
+		// -------------------------------------------------------------------------------
+
+		//////
+		/// @brief Simple structure containing a function pointer to the C++ callback function and a 
+		/// (void) pointer to the user supplied data.
+		//////
+		struct CppToCCallbackData
+		{
+			CppToCCallbackData();
+			CppToCCallbackData(CallbackFunPtr funPtr, void *userData);
+			void init(CallbackFunPtr funPtr, void *userData);
+
+			CallbackFunPtr funPtr;
+			void *userData;
+		};
+
+		// -------------------------------------------------------------------------------
+
+		FunCallbackStream();
+		FunCallbackStream(const StreamParameters &parameters, CallbackFunPtr funPtr, void *userData);
+		~FunCallbackStream();
+
+		void open(const StreamParameters &parameters, CallbackFunPtr funPtr, void *userData);
+
+	private:
+		FunCallbackStream(const FunCallbackStream &); // non-copyable
+		FunCallbackStream &operator=(const FunCallbackStream &); // non-copyable
+
+		CppToCCallbackData adapterData_;
+
+		void open(const StreamParameters &parameters);
+	};
+
+
+} // portaudio
+
+// ---------------------------------------------------------------------------------------
+
+#endif // INCLUDED_PORTAUDIO_CPPFUNCALLBACKSTREAM_HXX
diff --git a/bindings/cpp/include/portaudiocpp/Device.hxx b/bindings/cpp/include/portaudiocpp/Device.hxx
index ffde7aa..3c6c3c0 100644
--- a/bindings/cpp/include/portaudiocpp/Device.hxx
+++ b/bindings/cpp/include/portaudiocpp/Device.hxx
@@ -1,91 +1,91 @@
-#ifndef INCLUDED_PORTAUDIO_DEVICE_HXX
-#define INCLUDED_PORTAUDIO_DEVICE_HXX
-
-// ---------------------------------------------------------------------------------------
-
-#include <iterator>
-
-#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);
-		bool operator!=(const Device &rhs);
-
-		// 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 <iterator>
+
+#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 <cstddef>
-
-#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 <cstddef>
+
+#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 <exception>
-
-#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 <exception>
+
+#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 &parameters, CallbackInterface &instance);
-		~InterfaceCallbackStream();
-		
-		void open(const StreamParameters &parameters, 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 &parameters, CallbackInterface &instance);
+		~InterfaceCallbackStream();
+		
+		void open(const StreamParameters &parameters, 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<MyClass> stream = MemFunCallbackStream(parameters, *this, &MyClass::myCallbackFunction); @endverbatim
-	//////
-	template<typename T>
-	class MemFunCallbackStream : public CallbackStream
-	{
-	public:
-		typedef int (T::*CallbackFunPtr)(const void *, void *, unsigned long, const PaStreamCallbackTimeInfo *, 
-			PaStreamCallbackFlags);
-
-		// -------------------------------------------------------------------------------
-
-		MemFunCallbackStream()
-		{
-		}
-
-		MemFunCallbackStream(const StreamParameters &parameters, T &instance, CallbackFunPtr memFun) : adapter_(instance, memFun)
-		{
-			open(parameters);
-		}
-
-		~MemFunCallbackStream()
-		{
-			close();
-		}
-
-		void open(const StreamParameters &parameters, 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 &parameters)
-		{
-			PaError err = Pa_OpenStream(&stream_, parameters.inputParameters().paStreamParameters(), parameters.outputParameters().paStreamParameters(), 
-				parameters.sampleRate(), parameters.framesPerBuffer(), parameters.flags(), &impl::callbackInterfaceToPaCallbackAdapter, 
-				static_cast<void *>(&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<MyClass> stream = MemFunCallbackStream(parameters, *this, &MyClass::myCallbackFunction); @endverbatim
+	//////
+	template<typename T>
+	class MemFunCallbackStream : public CallbackStream
+	{
+	public:
+		typedef int (T::*CallbackFunPtr)(const void *, void *, unsigned long, const PaStreamCallbackTimeInfo *, 
+			PaStreamCallbackFlags);
+
+		// -------------------------------------------------------------------------------
+
+		MemFunCallbackStream()
+		{
+		}
+
+		MemFunCallbackStream(const StreamParameters &parameters, T &instance, CallbackFunPtr memFun) : adapter_(instance, memFun)
+		{
+			open(parameters);
+		}
+
+		~MemFunCallbackStream()
+		{
+			close();
+		}
+
+		void open(const StreamParameters &parameters, 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 &parameters)
+		{
+			PaError err = Pa_OpenStream(&stream_, parameters.inputParameters().paStreamParameters(), parameters.outputParameters().paStreamParameters(), 
+				parameters.sampleRate(), parameters.framesPerBuffer(), parameters.flags(), &impl::callbackInterfaceToPaCallbackAdapter, 
+				static_cast<void *>(&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
-///
-///	<h1>PortAudioCpp - A Native C++ Binding of PortAudio V19</h1>
-/// <h2>PortAudio</h2>
-/// <p>
-///   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.
-/// </p>
-/// <h2>PortAudioCpp</h2>
-/// <p>
-///   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'.
-/// </p>
-/// <p>
-///   PortAudioCpp's main features are:
-///   <ul>
-///     <li>Structured object model.</li>
-///     <li>C++ exception handling instead of C-style error return codes.</li>
-///     <li>Handling of callbacks using free functions (C and C++), static functions, member functions or instances of classes 
-///     derived from a given interface.</li>
-///     <li>STL compliant iterators to host APIs and devices.</li>
-///     <li>Some additional convenience functions to more easily set up and use PortAudio.</li>
-///   </ul>
-/// </p>
-/// <p>
-///   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.
-/// </p>
-/// <p>
-///   Supported platforms:
-///   <ul>
-///     <li>Microsoft Visual C++ 6.0, 7.0 (.NET 2002) and 7.1 (.NET 2003).</li>
-///     <li>GNU G++ 2.95 and G++ 3.3.</li>
-///   </ul>
-///   Other platforms should be easily supported as PortAudioCpp is platform-independent and (reasonably) C++ standard compliant.
-/// </p>
-/// <p>
-///   This documentation mainly provides information specific to PortAudioCpp. For a more complete explaination of all of the 
-///   concepts used, please consult the PortAudio documentation.
-/// </p>
-/// <p>
-///   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 <a href="http://www.portaudio.com/license.html">the PortAudio license</a> for more details.
-/// </p>
-/// <h2>Links</h2>
-/// <p>
-///   <a href="http://www.portaudio.com/">Official PortAudio site.</a><br>
-/// </p>
-//////
-
-// ---------------------------------------------------------------------------------------
-
-//////
-/// @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
+///
+///	<h1>PortAudioCpp - A Native C++ Binding of PortAudio V19</h1>
+/// <h2>PortAudio</h2>
+/// <p>
+///   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.
+/// </p>
+/// <h2>PortAudioCpp</h2>
+/// <p>
+///   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'.
+/// </p>
+/// <p>
+///   PortAudioCpp's main features are:
+///   <ul>
+///     <li>Structured object model.</li>
+///     <li>C++ exception handling instead of C-style error return codes.</li>
+///     <li>Handling of callbacks using free functions (C and C++), static functions, member functions or instances of classes 
+///     derived from a given interface.</li>
+///     <li>STL compliant iterators to host APIs and devices.</li>
+///     <li>Some additional convenience functions to more easily set up and use PortAudio.</li>
+///   </ul>
+/// </p>
+/// <p>
+///   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.
+/// </p>
+/// <p>
+///   Supported platforms:
+///   <ul>
+///     <li>Microsoft Visual C++ 6.0, 7.0 (.NET 2002) and 7.1 (.NET 2003).</li>
+///     <li>GNU G++ 2.95 and G++ 3.3.</li>
+///   </ul>
+///   Other platforms should be easily supported as PortAudioCpp is platform-independent and (reasonably) C++ standard compliant.
+/// </p>
+/// <p>
+///   This documentation mainly provides information specific to PortAudioCpp. For a more complete explaination of all of the 
+///   concepts used, please consult the PortAudio documentation.
+/// </p>
+/// <p>
+///   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 <a href="http://www.portaudio.com/license.html">the PortAudio license</a> for more details.
+/// </p>
+/// <h2>Links</h2>
+/// <p>
+///   <a href="http://www.portaudio.com/">Official PortAudio site.</a><br>
+/// </p>
+//////
+
+// ---------------------------------------------------------------------------------------
+
+//////
+/// @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 &parameters);
-		void setOutputParameters(const DirectionSpecificStreamParameters &parameters);
-
-		// 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 &parameters);
+		void setOutputParameters(const DirectionSpecificStreamParameters &parameters);
+
+		// 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 613fc3d..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 <iterator>
-#include <cstddef>
-
-#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);
-		bool operator!=(const DeviceIterator &rhs);
-
-	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 <iterator>
+#include <cstddef>
+
+#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 b9b13b8..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 <iterator>
-#include <cstddef>
-
-#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);
-		bool operator!=(const HostApiIterator &rhs);
-
-	private:
-		friend class System;
-		HostApi **ptr_;
-	};
-
-
-} // namespace portaudio
-
-// ---------------------------------------------------------------------------------------
-
-#endif // INCLUDED_PORTAUDIO_SYSTEMHOSTAPIITERATOR_HXX
+#ifndef INCLUDED_PORTAUDIO_SYSTEMHOSTAPIITERATOR_HXX
+#define INCLUDED_PORTAUDIO_SYSTEMHOSTAPIITERATOR_HXX
+
+// ---------------------------------------------------------------------------------------
+
+#include <iterator>
+#include <cstddef>
+
+#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/lib/Makefile.in b/bindings/cpp/lib/Makefile.in
index bbd0d27..db0d614 100644
--- a/bindings/cpp/lib/Makefile.in
+++ b/bindings/cpp/lib/Makefile.in
@@ -1,9 +1,8 @@
-# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# Makefile.in generated by automake 1.14.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
-# Inc.
+# Copyright (C) 1994-2013 Free Software Foundation, Inc.
+
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -16,6 +15,51 @@
 @SET_MAKE@
 
 VPATH = @srcdir@
+am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+am__make_running_with_option = \
+  case $${target_option-} in \
+      ?) ;; \
+      *) echo "am__make_running_with_option: internal error: invalid" \
+              "target option '$${target_option-}' specified" >&2; \
+         exit 1;; \
+  esac; \
+  has_opt=no; \
+  sane_makeflags=$$MAKEFLAGS; \
+  if $(am__is_gnu_make); then \
+    sane_makeflags=$$MFLAGS; \
+  else \
+    case $$MAKEFLAGS in \
+      *\\[\ \	]*) \
+        bs=\\; \
+        sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+          | sed "s/$$bs$$bs[$$bs $$bs	]*//g"`;; \
+    esac; \
+  fi; \
+  skip_next=no; \
+  strip_trailopt () \
+  { \
+    flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+  }; \
+  for flg in $$sane_makeflags; do \
+    test $$skip_next = yes && { skip_next=no; continue; }; \
+    case $$flg in \
+      *=*|--*) continue;; \
+        -*I) strip_trailopt 'I'; skip_next=yes;; \
+      -*I?*) strip_trailopt 'I';; \
+        -*O) strip_trailopt 'O'; skip_next=yes;; \
+      -*O?*) strip_trailopt 'O';; \
+        -*l) strip_trailopt 'l'; skip_next=yes;; \
+      -*l?*) strip_trailopt 'l';; \
+      -[dEDm]) skip_next=yes;; \
+      -[JT]) skip_next=yes;; \
+    esac; \
+    case $$flg in \
+      *$$target_option*) has_opt=yes; break;; \
+    esac; \
+  done; \
+  test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
 pkgdatadir = $(datadir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
@@ -35,7 +79,8 @@ POST_UNINSTALL = :
 build_triplet = @build@
 host_triplet = @host@
 subdir = lib
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
+	$(top_srcdir)/../../depcomp
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
@@ -64,6 +109,12 @@ am__nobase_list = $(am__nobase_strip_setup); \
 am__base_list = \
   sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
   sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+  test -z "$$files" \
+    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+         $(am__cd) "$$dir" && rm -f $$files; }; \
+  }
 am__installdirs = "$(DESTDIR)$(libdir)"
 LTLIBRARIES = $(lib_LTLIBRARIES)
 libportaudiocpp_la_DEPENDENCIES =  \
@@ -76,28 +127,77 @@ am_libportaudiocpp_la_OBJECTS = BlockingStream.lo CallbackInterface.lo \
 	StreamParameters.lo System.lo SystemDeviceIterator.lo \
 	SystemHostApiIterator.lo
 libportaudiocpp_la_OBJECTS = $(am_libportaudiocpp_la_OBJECTS)
-libportaudiocpp_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
-	$(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
-	$(CXXFLAGS) $(libportaudiocpp_la_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_lt = $(am__v_lt_ at AM_V@)
+am__v_lt_ = $(am__v_lt_ at AM_DEFAULT_V@)
+am__v_lt_0 = --silent
+am__v_lt_1 = 
+libportaudiocpp_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \
+	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \
+	$(AM_CXXFLAGS) $(CXXFLAGS) $(libportaudiocpp_la_LDFLAGS) \
+	$(LDFLAGS) -o $@
+AM_V_P = $(am__v_P_ at AM_V@)
+am__v_P_ = $(am__v_P_ at AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_ at AM_V@)
+am__v_GEN_ = $(am__v_GEN_ at AM_DEFAULT_V@)
+am__v_GEN_0 = @echo "  GEN     " $@;
+am__v_GEN_1 = 
+AM_V_at = $(am__v_at_ at AM_V@)
+am__v_at_ = $(am__v_at_ at AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 = 
 depcomp = $(SHELL) $(top_srcdir)/../../depcomp
 am__depfiles_maybe = depfiles
 am__mv = mv -f
 CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
 	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
-LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
-	--mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
-	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \
+	$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+	$(AM_CXXFLAGS) $(CXXFLAGS)
+AM_V_CXX = $(am__v_CXX_ at AM_V@)
+am__v_CXX_ = $(am__v_CXX_ at AM_DEFAULT_V@)
+am__v_CXX_0 = @echo "  CXX     " $@;
+am__v_CXX_1 = 
 CXXLD = $(CXX)
-CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
-	--mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \
-	$(LDFLAGS) -o $@
+CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
+	$(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_CXXLD = $(am__v_CXXLD_ at AM_V@)
+am__v_CXXLD_ = $(am__v_CXXLD_ at AM_DEFAULT_V@)
+am__v_CXXLD_0 = @echo "  CXXLD   " $@;
+am__v_CXXLD_1 = 
 SOURCES = $(libportaudiocpp_la_SOURCES)
 DIST_SOURCES = $(libportaudiocpp_la_SOURCES)
+am__can_run_installinfo = \
+  case $$AM_UPDATE_INFO_DIR in \
+    n|no|NO) false;; \
+    *) (install-info --version) >/dev/null 2>&1;; \
+  esac
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates.  Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+  BEGIN { nonempty = 0; } \
+  { items[$$0] = 1; nonempty = 1; } \
+  END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique.  This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+  list='$(am__tagged_files)'; \
+  unique=`for i in $$list; do \
+    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+  done | $(am__uniquify_input)`
 ETAGS = etags
 CTAGS = ctags
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
 AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
 AR = @AR@
 AS = @AS@
 AUTOCONF = @AUTOCONF@
@@ -276,9 +376,9 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
 $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 $(am__aclocal_m4_deps):
+
 install-libLTLIBRARIES: $(lib_LTLIBRARIES)
 	@$(NORMAL_INSTALL)
-	test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
 	@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
 	list2=; for p in $$list; do \
 	  if test -f $$p; then \
@@ -286,6 +386,8 @@ install-libLTLIBRARIES: $(lib_LTLIBRARIES)
 	  else :; fi; \
 	done; \
 	test -z "$$list2" || { \
+	  echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \
+	  $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \
 	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
 	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
 	}
@@ -301,14 +403,17 @@ uninstall-libLTLIBRARIES:
 
 clean-libLTLIBRARIES:
 	-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
-	@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
-	  dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
-	  test "$$dir" != "$$p" || dir=.; \
-	  echo "rm -f \"$${dir}/so_locations\""; \
-	  rm -f "$${dir}/so_locations"; \
-	done
-libportaudiocpp.la: $(libportaudiocpp_la_OBJECTS) $(libportaudiocpp_la_DEPENDENCIES) 
-	$(libportaudiocpp_la_LINK) -rpath $(libdir) $(libportaudiocpp_la_OBJECTS) $(libportaudiocpp_la_LIBADD) $(LIBS)
+	@list='$(lib_LTLIBRARIES)'; \
+	locs=`for p in $$list; do echo $$p; done | \
+	      sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
+	      sort -u`; \
+	test -z "$$locs" || { \
+	  echo rm -f $${locs}; \
+	  rm -f $${locs}; \
+	}
+
+libportaudiocpp.la: $(libportaudiocpp_la_OBJECTS) $(libportaudiocpp_la_DEPENDENCIES) $(EXTRA_libportaudiocpp_la_DEPENDENCIES) 
+	$(AM_V_CXXLD)$(libportaudiocpp_la_LINK) -rpath $(libdir) $(libportaudiocpp_la_OBJECTS) $(libportaudiocpp_la_LIBADD) $(LIBS)
 
 mostlyclean-compile:
 	-rm -f *.$(OBJEXT)
@@ -334,137 +439,137 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/SystemHostApiIterator.Plo at am__quote@
 
 .cxx.o:
- at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXXCOMPILE) -c -o $@ $<
+ at am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ $<
 
 .cxx.obj:
- at am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+ at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+ at am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
 .cxx.lo:
- at am__fastdepCXX_TRUE@	$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(LTCXXCOMPILE) -c -o $@ $<
+ at am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
 
 BlockingStream.lo: $(SRCDIR)/BlockingStream.cxx
- at am__fastdepCXX_TRUE@	$(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT BlockingStream.lo -MD -MP -MF $(DEPDIR)/BlockingStream.Tpo -c -o BlockingStream.lo `test -f '$(SRCDIR)/BlockingStream.cxx' || echo '$(srcdir)/'`$(SRCDIR)/BlockingStream.cxx
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/BlockingStream.Tpo $(DEPDIR)/BlockingStream.Plo
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$(SRCDIR)/BlockingStream.cxx' object='BlockingStream.lo' libtool=yes @AMDEPBACKSLASH@
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT BlockingStream.lo -MD -MP -MF $(DEPDIR)/BlockingStream.Tpo -c -o BlockingStream.lo `test -f '$(SRCDIR)/BlockingStream.cxx' || echo '$(srcdir)/'`$(SRCDIR)/BlockingStream.cxx
+ at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/BlockingStream.Tpo $(DEPDIR)/BlockingStream.Plo
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$(SRCDIR)/BlockingStream.cxx' object='BlockingStream.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o BlockingStream.lo `test -f '$(SRCDIR)/BlockingStream.cxx' || echo '$(srcdir)/'`$(SRCDIR)/BlockingStream.cxx
+ at am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o BlockingStream.lo `test -f '$(SRCDIR)/BlockingStream.cxx' || echo '$(srcdir)/'`$(SRCDIR)/BlockingStream.cxx
 
 CallbackInterface.lo: $(SRCDIR)/CallbackInterface.cxx
- at am__fastdepCXX_TRUE@	$(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT CallbackInterface.lo -MD -MP -MF $(DEPDIR)/CallbackInterface.Tpo -c -o CallbackInterface.lo `test -f '$(SRCDIR)/CallbackInterface.cxx' || echo '$(srcdir)/'`$(SRCDIR)/CallbackInterface.cxx
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/CallbackInterface.Tpo $(DEPDIR)/CallbackInterface.Plo
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$(SRCDIR)/CallbackInterface.cxx' object='CallbackInterface.lo' libtool=yes @AMDEPBACKSLASH@
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT CallbackInterface.lo -MD -MP -MF $(DEPDIR)/CallbackInterface.Tpo -c -o CallbackInterface.lo `test -f '$(SRCDIR)/CallbackInterface.cxx' || echo '$(srcdir)/'`$(SRCDIR)/CallbackInterface.cxx
+ at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/CallbackInterface.Tpo $(DEPDIR)/CallbackInterface.Plo
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$(SRCDIR)/CallbackInterface.cxx' object='CallbackInterface.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o CallbackInterface.lo `test -f '$(SRCDIR)/CallbackInterface.cxx' || echo '$(srcdir)/'`$(SRCDIR)/CallbackInterface.cxx
+ at am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o CallbackInterface.lo `test -f '$(SRCDIR)/CallbackInterface.cxx' || echo '$(srcdir)/'`$(SRCDIR)/CallbackInterface.cxx
 
 CallbackStream.lo: $(SRCDIR)/CallbackStream.cxx
- at am__fastdepCXX_TRUE@	$(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT CallbackStream.lo -MD -MP -MF $(DEPDIR)/CallbackStream.Tpo -c -o CallbackStream.lo `test -f '$(SRCDIR)/CallbackStream.cxx' || echo '$(srcdir)/'`$(SRCDIR)/CallbackStream.cxx
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/CallbackStream.Tpo $(DEPDIR)/CallbackStream.Plo
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$(SRCDIR)/CallbackStream.cxx' object='CallbackStream.lo' libtool=yes @AMDEPBACKSLASH@
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT CallbackStream.lo -MD -MP -MF $(DEPDIR)/CallbackStream.Tpo -c -o CallbackStream.lo `test -f '$(SRCDIR)/CallbackStream.cxx' || echo '$(srcdir)/'`$(SRCDIR)/CallbackStream.cxx
+ at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/CallbackStream.Tpo $(DEPDIR)/CallbackStream.Plo
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$(SRCDIR)/CallbackStream.cxx' object='CallbackStream.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o CallbackStream.lo `test -f '$(SRCDIR)/CallbackStream.cxx' || echo '$(srcdir)/'`$(SRCDIR)/CallbackStream.cxx
+ at am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o CallbackStream.lo `test -f '$(SRCDIR)/CallbackStream.cxx' || echo '$(srcdir)/'`$(SRCDIR)/CallbackStream.cxx
 
 CFunCallbackStream.lo: $(SRCDIR)/CFunCallbackStream.cxx
- at am__fastdepCXX_TRUE@	$(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT CFunCallbackStream.lo -MD -MP -MF $(DEPDIR)/CFunCallbackStream.Tpo -c -o CFunCallbackStream.lo `test -f '$(SRCDIR)/CFunCallbackStream.cxx' || echo '$(srcdir)/'`$(SRCDIR)/CFunCallbackStream.cxx
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/CFunCallbackStream.Tpo $(DEPDIR)/CFunCallbackStream.Plo
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$(SRCDIR)/CFunCallbackStream.cxx' object='CFunCallbackStream.lo' libtool=yes @AMDEPBACKSLASH@
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT CFunCallbackStream.lo -MD -MP -MF $(DEPDIR)/CFunCallbackStream.Tpo -c -o CFunCallbackStream.lo `test -f '$(SRCDIR)/CFunCallbackStream.cxx' || echo '$(srcdir)/'`$(SRCDIR)/CFunCallbackStream.cxx
+ at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/CFunCallbackStream.Tpo $(DEPDIR)/CFunCallbackStream.Plo
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$(SRCDIR)/CFunCallbackStream.cxx' object='CFunCallbackStream.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o CFunCallbackStream.lo `test -f '$(SRCDIR)/CFunCallbackStream.cxx' || echo '$(srcdir)/'`$(SRCDIR)/CFunCallbackStream.cxx
+ at am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o CFunCallbackStream.lo `test -f '$(SRCDIR)/CFunCallbackStream.cxx' || echo '$(srcdir)/'`$(SRCDIR)/CFunCallbackStream.cxx
 
 CppFunCallbackStream.lo: $(SRCDIR)/CppFunCallbackStream.cxx
- at am__fastdepCXX_TRUE@	$(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT CppFunCallbackStream.lo -MD -MP -MF $(DEPDIR)/CppFunCallbackStream.Tpo -c -o CppFunCallbackStream.lo `test -f '$(SRCDIR)/CppFunCallbackStream.cxx' || echo '$(srcdir)/'`$(SRCDIR)/CppFunCallbackStream.cxx
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/CppFunCallbackStream.Tpo $(DEPDIR)/CppFunCallbackStream.Plo
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$(SRCDIR)/CppFunCallbackStream.cxx' object='CppFunCallbackStream.lo' libtool=yes @AMDEPBACKSLASH@
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT CppFunCallbackStream.lo -MD -MP -MF $(DEPDIR)/CppFunCallbackStream.Tpo -c -o CppFunCallbackStream.lo `test -f '$(SRCDIR)/CppFunCallbackStream.cxx' || echo '$(srcdir)/'`$(SRCDIR)/CppFunCallbackStream.cxx
+ at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/CppFunCallbackStream.Tpo $(DEPDIR)/CppFunCallbackStream.Plo
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$(SRCDIR)/CppFunCallbackStream.cxx' object='CppFunCallbackStream.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o CppFunCallbackStream.lo `test -f '$(SRCDIR)/CppFunCallbackStream.cxx' || echo '$(srcdir)/'`$(SRCDIR)/CppFunCallbackStream.cxx
+ at am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o CppFunCallbackStream.lo `test -f '$(SRCDIR)/CppFunCallbackStream.cxx' || echo '$(srcdir)/'`$(SRCDIR)/CppFunCallbackStream.cxx
 
 Device.lo: $(SRCDIR)/Device.cxx
- at am__fastdepCXX_TRUE@	$(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Device.lo -MD -MP -MF $(DEPDIR)/Device.Tpo -c -o Device.lo `test -f '$(SRCDIR)/Device.cxx' || echo '$(srcdir)/'`$(SRCDIR)/Device.cxx
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/Device.Tpo $(DEPDIR)/Device.Plo
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$(SRCDIR)/Device.cxx' object='Device.lo' libtool=yes @AMDEPBACKSLASH@
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Device.lo -MD -MP -MF $(DEPDIR)/Device.Tpo -c -o Device.lo `test -f '$(SRCDIR)/Device.cxx' || echo '$(srcdir)/'`$(SRCDIR)/Device.cxx
+ at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/Device.Tpo $(DEPDIR)/Device.Plo
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$(SRCDIR)/Device.cxx' object='Device.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Device.lo `test -f '$(SRCDIR)/Device.cxx' || echo '$(srcdir)/'`$(SRCDIR)/Device.cxx
+ at am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Device.lo `test -f '$(SRCDIR)/Device.cxx' || echo '$(srcdir)/'`$(SRCDIR)/Device.cxx
 
 DirectionSpecificStreamParameters.lo: $(SRCDIR)/DirectionSpecificStreamParameters.cxx
- at am__fastdepCXX_TRUE@	$(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT DirectionSpecificStreamParameters.lo -MD -MP -MF $(DEPDIR)/DirectionSpecificStreamParameters.Tpo -c -o DirectionSpecificStreamParameters.lo `test -f '$(SRCDIR)/DirectionSpecificStreamParameters.cxx' || echo '$(srcdir)/'`$(SRCDIR)/DirectionSpecificStreamParameters.cxx
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/DirectionSpecificStreamParameters.Tpo $(DEPDIR)/DirectionSpecificStreamParameters.Plo
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$(SRCDIR)/DirectionSpecificStreamParameters.cxx' object='DirectionSpecificStreamParameters.lo' libtool=yes @AMDEPBACKSLASH@
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT DirectionSpecificStreamParameters.lo -MD -MP -MF $(DEPDIR)/DirectionSpecificStreamParameters.Tpo -c -o DirectionSpecificStreamParameters.lo `test -f '$(SRCDIR)/DirectionSpecificStreamParameters.cxx' || echo '$(srcdir)/'`$(SRCDIR)/DirectionSpecificStreamParameters.cxx
+ at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/DirectionSpecificStreamParameters.Tpo $(DEPDIR)/DirectionSpecificStreamParameters.Plo
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$(SRCDIR)/DirectionSpecificStreamParameters.cxx' object='DirectionSpecificStreamParameters.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o DirectionSpecificStreamParameters.lo `test -f '$(SRCDIR)/DirectionSpecificStreamParameters.cxx' || echo '$(srcdir)/'`$(SRCDIR)/DirectionSpecificStreamParameters.cxx
+ at am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o DirectionSpecificStreamParameters.lo `test -f '$(SRCDIR)/DirectionSpecificStreamParameters.cxx' || echo '$(srcdir)/'`$(SRCDIR)/DirectionSpecificStreamParameters.cxx
 
 Exception.lo: $(SRCDIR)/Exception.cxx
- at am__fastdepCXX_TRUE@	$(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Exception.lo -MD -MP -MF $(DEPDIR)/Exception.Tpo -c -o Exception.lo `test -f '$(SRCDIR)/Exception.cxx' || echo '$(srcdir)/'`$(SRCDIR)/Exception.cxx
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/Exception.Tpo $(DEPDIR)/Exception.Plo
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$(SRCDIR)/Exception.cxx' object='Exception.lo' libtool=yes @AMDEPBACKSLASH@
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Exception.lo -MD -MP -MF $(DEPDIR)/Exception.Tpo -c -o Exception.lo `test -f '$(SRCDIR)/Exception.cxx' || echo '$(srcdir)/'`$(SRCDIR)/Exception.cxx
+ at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/Exception.Tpo $(DEPDIR)/Exception.Plo
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$(SRCDIR)/Exception.cxx' object='Exception.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Exception.lo `test -f '$(SRCDIR)/Exception.cxx' || echo '$(srcdir)/'`$(SRCDIR)/Exception.cxx
+ at am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Exception.lo `test -f '$(SRCDIR)/Exception.cxx' || echo '$(srcdir)/'`$(SRCDIR)/Exception.cxx
 
 HostApi.lo: $(SRCDIR)/HostApi.cxx
- at am__fastdepCXX_TRUE@	$(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT HostApi.lo -MD -MP -MF $(DEPDIR)/HostApi.Tpo -c -o HostApi.lo `test -f '$(SRCDIR)/HostApi.cxx' || echo '$(srcdir)/'`$(SRCDIR)/HostApi.cxx
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/HostApi.Tpo $(DEPDIR)/HostApi.Plo
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$(SRCDIR)/HostApi.cxx' object='HostApi.lo' libtool=yes @AMDEPBACKSLASH@
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT HostApi.lo -MD -MP -MF $(DEPDIR)/HostApi.Tpo -c -o HostApi.lo `test -f '$(SRCDIR)/HostApi.cxx' || echo '$(srcdir)/'`$(SRCDIR)/HostApi.cxx
+ at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/HostApi.Tpo $(DEPDIR)/HostApi.Plo
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$(SRCDIR)/HostApi.cxx' object='HostApi.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o HostApi.lo `test -f '$(SRCDIR)/HostApi.cxx' || echo '$(srcdir)/'`$(SRCDIR)/HostApi.cxx
+ at am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o HostApi.lo `test -f '$(SRCDIR)/HostApi.cxx' || echo '$(srcdir)/'`$(SRCDIR)/HostApi.cxx
 
 InterfaceCallbackStream.lo: $(SRCDIR)/InterfaceCallbackStream.cxx
- at am__fastdepCXX_TRUE@	$(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT InterfaceCallbackStream.lo -MD -MP -MF $(DEPDIR)/InterfaceCallbackStream.Tpo -c -o InterfaceCallbackStream.lo `test -f '$(SRCDIR)/InterfaceCallbackStream.cxx' || echo '$(srcdir)/'`$(SRCDIR)/InterfaceCallbackStream.cxx
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/InterfaceCallbackStream.Tpo $(DEPDIR)/InterfaceCallbackStream.Plo
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$(SRCDIR)/InterfaceCallbackStream.cxx' object='InterfaceCallbackStream.lo' libtool=yes @AMDEPBACKSLASH@
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT InterfaceCallbackStream.lo -MD -MP -MF $(DEPDIR)/InterfaceCallbackStream.Tpo -c -o InterfaceCallbackStream.lo `test -f '$(SRCDIR)/InterfaceCallbackStream.cxx' || echo '$(srcdir)/'`$(SRCDIR)/InterfaceCallbackStream.cxx
+ at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/InterfaceCallbackStream.Tpo $(DEPDIR)/InterfaceCallbackStream.Plo
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$(SRCDIR)/InterfaceCallbackStream.cxx' object='InterfaceCallbackStream.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o InterfaceCallbackStream.lo `test -f '$(SRCDIR)/InterfaceCallbackStream.cxx' || echo '$(srcdir)/'`$(SRCDIR)/InterfaceCallbackStream.cxx
+ at am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o InterfaceCallbackStream.lo `test -f '$(SRCDIR)/InterfaceCallbackStream.cxx' || echo '$(srcdir)/'`$(SRCDIR)/InterfaceCallbackStream.cxx
 
 MemFunCallbackStream.lo: $(SRCDIR)/MemFunCallbackStream.cxx
- at am__fastdepCXX_TRUE@	$(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT MemFunCallbackStream.lo -MD -MP -MF $(DEPDIR)/MemFunCallbackStream.Tpo -c -o MemFunCallbackStream.lo `test -f '$(SRCDIR)/MemFunCallbackStream.cxx' || echo '$(srcdir)/'`$(SRCDIR)/MemFunCallbackStream.cxx
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/MemFunCallbackStream.Tpo $(DEPDIR)/MemFunCallbackStream.Plo
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$(SRCDIR)/MemFunCallbackStream.cxx' object='MemFunCallbackStream.lo' libtool=yes @AMDEPBACKSLASH@
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT MemFunCallbackStream.lo -MD -MP -MF $(DEPDIR)/MemFunCallbackStream.Tpo -c -o MemFunCallbackStream.lo `test -f '$(SRCDIR)/MemFunCallbackStream.cxx' || echo '$(srcdir)/'`$(SRCDIR)/MemFunCallbackStream.cxx
+ at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/MemFunCallbackStream.Tpo $(DEPDIR)/MemFunCallbackStream.Plo
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$(SRCDIR)/MemFunCallbackStream.cxx' object='MemFunCallbackStream.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o MemFunCallbackStream.lo `test -f '$(SRCDIR)/MemFunCallbackStream.cxx' || echo '$(srcdir)/'`$(SRCDIR)/MemFunCallbackStream.cxx
+ at am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o MemFunCallbackStream.lo `test -f '$(SRCDIR)/MemFunCallbackStream.cxx' || echo '$(srcdir)/'`$(SRCDIR)/MemFunCallbackStream.cxx
 
 Stream.lo: $(SRCDIR)/Stream.cxx
- at am__fastdepCXX_TRUE@	$(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Stream.lo -MD -MP -MF $(DEPDIR)/Stream.Tpo -c -o Stream.lo `test -f '$(SRCDIR)/Stream.cxx' || echo '$(srcdir)/'`$(SRCDIR)/Stream.cxx
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/Stream.Tpo $(DEPDIR)/Stream.Plo
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$(SRCDIR)/Stream.cxx' object='Stream.lo' libtool=yes @AMDEPBACKSLASH@
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Stream.lo -MD -MP -MF $(DEPDIR)/Stream.Tpo -c -o Stream.lo `test -f '$(SRCDIR)/Stream.cxx' || echo '$(srcdir)/'`$(SRCDIR)/Stream.cxx
+ at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/Stream.Tpo $(DEPDIR)/Stream.Plo
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$(SRCDIR)/Stream.cxx' object='Stream.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Stream.lo `test -f '$(SRCDIR)/Stream.cxx' || echo '$(srcdir)/'`$(SRCDIR)/Stream.cxx
+ at am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Stream.lo `test -f '$(SRCDIR)/Stream.cxx' || echo '$(srcdir)/'`$(SRCDIR)/Stream.cxx
 
 StreamParameters.lo: $(SRCDIR)/StreamParameters.cxx
- at am__fastdepCXX_TRUE@	$(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT StreamParameters.lo -MD -MP -MF $(DEPDIR)/StreamParameters.Tpo -c -o StreamParameters.lo `test -f '$(SRCDIR)/StreamParameters.cxx' || echo '$(srcdir)/'`$(SRCDIR)/StreamParameters.cxx
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/StreamParameters.Tpo $(DEPDIR)/StreamParameters.Plo
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$(SRCDIR)/StreamParameters.cxx' object='StreamParameters.lo' libtool=yes @AMDEPBACKSLASH@
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT StreamParameters.lo -MD -MP -MF $(DEPDIR)/StreamParameters.Tpo -c -o StreamParameters.lo `test -f '$(SRCDIR)/StreamParameters.cxx' || echo '$(srcdir)/'`$(SRCDIR)/StreamParameters.cxx
+ at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/StreamParameters.Tpo $(DEPDIR)/StreamParameters.Plo
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$(SRCDIR)/StreamParameters.cxx' object='StreamParameters.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o StreamParameters.lo `test -f '$(SRCDIR)/StreamParameters.cxx' || echo '$(srcdir)/'`$(SRCDIR)/StreamParameters.cxx
+ at am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o StreamParameters.lo `test -f '$(SRCDIR)/StreamParameters.cxx' || echo '$(srcdir)/'`$(SRCDIR)/StreamParameters.cxx
 
 System.lo: $(SRCDIR)/System.cxx
- at am__fastdepCXX_TRUE@	$(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT System.lo -MD -MP -MF $(DEPDIR)/System.Tpo -c -o System.lo `test -f '$(SRCDIR)/System.cxx' || echo '$(srcdir)/'`$(SRCDIR)/System.cxx
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/System.Tpo $(DEPDIR)/System.Plo
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$(SRCDIR)/System.cxx' object='System.lo' libtool=yes @AMDEPBACKSLASH@
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT System.lo -MD -MP -MF $(DEPDIR)/System.Tpo -c -o System.lo `test -f '$(SRCDIR)/System.cxx' || echo '$(srcdir)/'`$(SRCDIR)/System.cxx
+ at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/System.Tpo $(DEPDIR)/System.Plo
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$(SRCDIR)/System.cxx' object='System.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o System.lo `test -f '$(SRCDIR)/System.cxx' || echo '$(srcdir)/'`$(SRCDIR)/System.cxx
+ at am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o System.lo `test -f '$(SRCDIR)/System.cxx' || echo '$(srcdir)/'`$(SRCDIR)/System.cxx
 
 SystemDeviceIterator.lo: $(SRCDIR)/SystemDeviceIterator.cxx
- at am__fastdepCXX_TRUE@	$(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT SystemDeviceIterator.lo -MD -MP -MF $(DEPDIR)/SystemDeviceIterator.Tpo -c -o SystemDeviceIterator.lo `test -f '$(SRCDIR)/SystemDeviceIterator.cxx' || echo '$(srcdir)/'`$(SRCDIR)/SystemDeviceIterator.cxx
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/SystemDeviceIterator.Tpo $(DEPDIR)/SystemDeviceIterator.Plo
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$(SRCDIR)/SystemDeviceIterator.cxx' object='SystemDeviceIterator.lo' libtool=yes @AMDEPBACKSLASH@
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT SystemDeviceIterator.lo -MD -MP -MF $(DEPDIR)/SystemDeviceIterator.Tpo -c -o SystemDeviceIterator.lo `test -f '$(SRCDIR)/SystemDeviceIterator.cxx' || echo '$(srcdir)/'`$(SRCDIR)/SystemDeviceIterator.cxx
+ at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/SystemDeviceIterator.Tpo $(DEPDIR)/SystemDeviceIterator.Plo
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$(SRCDIR)/SystemDeviceIterator.cxx' object='SystemDeviceIterator.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o SystemDeviceIterator.lo `test -f '$(SRCDIR)/SystemDeviceIterator.cxx' || echo '$(srcdir)/'`$(SRCDIR)/SystemDeviceIterator.cxx
+ at am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o SystemDeviceIterator.lo `test -f '$(SRCDIR)/SystemDeviceIterator.cxx' || echo '$(srcdir)/'`$(SRCDIR)/SystemDeviceIterator.cxx
 
 SystemHostApiIterator.lo: $(SRCDIR)/SystemHostApiIterator.cxx
- at am__fastdepCXX_TRUE@	$(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT SystemHostApiIterator.lo -MD -MP -MF $(DEPDIR)/SystemHostApiIterator.Tpo -c -o SystemHostApiIterator.lo `test -f '$(SRCDIR)/SystemHostApiIterator.cxx' || echo '$(srcdir)/'`$(SRCDIR)/SystemHostApiIterator.cxx
- at am__fastdepCXX_TRUE@	$(am__mv) $(DEPDIR)/SystemHostApiIterator.Tpo $(DEPDIR)/SystemHostApiIterator.Plo
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$(SRCDIR)/SystemHostApiIterator.cxx' object='SystemHostApiIterator.lo' libtool=yes @AMDEPBACKSLASH@
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT SystemHostApiIterator.lo -MD -MP -MF $(DEPDIR)/SystemHostApiIterator.Tpo -c -o SystemHostApiIterator.lo `test -f '$(SRCDIR)/SystemHostApiIterator.cxx' || echo '$(srcdir)/'`$(SRCDIR)/SystemHostApiIterator.cxx
+ at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/SystemHostApiIterator.Tpo $(DEPDIR)/SystemHostApiIterator.Plo
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$(SRCDIR)/SystemHostApiIterator.cxx' object='SystemHostApiIterator.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o SystemHostApiIterator.lo `test -f '$(SRCDIR)/SystemHostApiIterator.cxx' || echo '$(srcdir)/'`$(SRCDIR)/SystemHostApiIterator.cxx
+ at am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o SystemHostApiIterator.lo `test -f '$(SRCDIR)/SystemHostApiIterator.cxx' || echo '$(srcdir)/'`$(SRCDIR)/SystemHostApiIterator.cxx
 
 mostlyclean-libtool:
 	-rm -f *.lo
@@ -472,26 +577,15 @@ mostlyclean-libtool:
 clean-libtool:
 	-rm -rf .libs _libs
 
-ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
-	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
-	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	mkid -fID $$unique
-tags: TAGS
-
-TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
-		$(TAGS_FILES) $(LISP)
+ID: $(am__tagged_files)
+	$(am__define_uniq_tagged_files); mkid -fID $$unique
+tags: tags-am
+TAGS: tags
+
+tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
 	set x; \
 	here=`pwd`; \
-	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
-	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	$(am__define_uniq_tagged_files); \
 	shift; \
 	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
 	  test -n "$$unique" || unique=$$empty_fix; \
@@ -503,15 +597,11 @@ TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 	      $$unique; \
 	  fi; \
 	fi
-ctags: CTAGS
-CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
-		$(TAGS_FILES) $(LISP)
-	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
-	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+ctags: ctags-am
+
+CTAGS: ctags
+ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+	$(am__define_uniq_tagged_files); \
 	test -z "$(CTAGS_ARGS)$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
 	     $$unique
@@ -520,6 +610,21 @@ GTAGS:
 	here=`$(am__cd) $(top_builddir) && pwd` \
 	  && $(am__cd) $(top_srcdir) \
 	  && gtags -i $(GTAGS_ARGS) "$$here"
+cscopelist: cscopelist-am
+
+cscopelist-am: $(am__tagged_files)
+	list='$(am__tagged_files)'; \
+	case "$(srcdir)" in \
+	  [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+	  *) sdir=$(subdir)/$(srcdir) ;; \
+	esac; \
+	for i in $$list; do \
+	  if test -f "$$i"; then \
+	    echo "$(subdir)/$$i"; \
+	  else \
+	    echo "$$sdir/$$i"; \
+	  fi; \
+	done >> $(top_builddir)/cscope.files
 
 distclean-tags:
 	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
@@ -571,10 +676,15 @@ install-am: all-am
 
 installcheck: installcheck-am
 install-strip:
-	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	  `test -z '$(STRIP)' || \
-	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
 mostlyclean-generic:
 
 clean-generic:
@@ -659,19 +769,19 @@ uninstall-am: uninstall-libLTLIBRARIES
 
 .MAKE: install-am install-strip
 
-.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
-	clean-libLTLIBRARIES clean-libtool ctags distclean \
-	distclean-compile distclean-generic distclean-libtool \
-	distclean-tags distdir dvi dvi-am html html-am info info-am \
-	install install-am install-data install-data-am install-dvi \
-	install-dvi-am install-exec install-exec-am install-html \
-	install-html-am install-info install-info-am \
-	install-libLTLIBRARIES install-man install-pdf install-pdf-am \
-	install-ps install-ps-am install-strip installcheck \
-	installcheck-am installdirs maintainer-clean \
+.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
+	clean-libLTLIBRARIES clean-libtool cscopelist-am ctags \
+	ctags-am distclean distclean-compile distclean-generic \
+	distclean-libtool distclean-tags distdir dvi dvi-am html \
+	html-am info info-am install install-am install-data \
+	install-data-am install-dvi install-dvi-am install-exec \
+	install-exec-am install-html install-html-am install-info \
+	install-info-am install-libLTLIBRARIES install-man install-pdf \
+	install-pdf-am install-ps install-ps-am install-strip \
+	installcheck installcheck-am installdirs maintainer-clean \
 	maintainer-clean-generic mostlyclean mostlyclean-compile \
 	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
-	tags uninstall uninstall-am uninstall-libLTLIBRARIES
+	tags tags-am uninstall uninstall-am uninstall-libLTLIBRARIES
 
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
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 &parameters)
-	{
-		open(parameters);
-	}
-
-	BlockingStream::~BlockingStream()
-	{
-		try
-		{
-			close();
-		}
-		catch (...)
-		{
-			// ignore all errors
-		}
-	}
-
-	// --------------------------------------------------------------------------------------
-
-	void BlockingStream::open(const StreamParameters &parameters)
-	{
-		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 &parameters)
+	{
+		open(parameters);
+	}
+
+	BlockingStream::~BlockingStream()
+	{
+		try
+		{
+			close();
+		}
+		catch (...)
+		{
+			// ignore all errors
+		}
+	}
+
+	// --------------------------------------------------------------------------------------
+
+	void BlockingStream::open(const StreamParameters &parameters)
+	{
+		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 &parameters, PaStreamCallback *funPtr, void *userData)
-	{
-		open(parameters, funPtr, userData);
-	}
-
-	CFunCallbackStream::~CFunCallbackStream()
-	{
-		try
-		{
-			close();
-		}
-		catch (...)
-		{
-			// ignore all errors
-		}
-	}
-
-	// ---------------------------------------------------------------------------------==
-
-	void CFunCallbackStream::open(const StreamParameters &parameters, 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 &parameters, PaStreamCallback *funPtr, void *userData)
+	{
+		open(parameters, funPtr, userData);
+	}
+
+	CFunCallbackStream::~CFunCallbackStream()
+	{
+		try
+		{
+			close();
+		}
+		catch (...)
+		{
+			// ignore all errors
+		}
+	}
+
+	// ---------------------------------------------------------------------------------==
+
+	void CFunCallbackStream::open(const StreamParameters &parameters, 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<CallbackInterface *>(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<CallbackInterface *>(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<FunCallbackStream::CppToCCallbackData *>(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 &parameters, CallbackFunPtr funPtr, void *userData) : adapterData_(funPtr, userData)
-	{
-		open(parameters);
-	}
-
-	FunCallbackStream::~FunCallbackStream()
-	{
-		try
-		{
-			close();
-		}
-		catch (...)
-		{
-			// ignore all errors
-		}
-	}
-
-	void FunCallbackStream::open(const StreamParameters &parameters, CallbackFunPtr funPtr, void *userData)
-	{
-		adapterData_.init(funPtr, userData);
-		open(parameters);
-	}
-
-	void FunCallbackStream::open(const StreamParameters &parameters)
-	{
-		PaError err = Pa_OpenStream(&stream_, parameters.inputParameters().paStreamParameters(), parameters.outputParameters().paStreamParameters(), 
-			parameters.sampleRate(), parameters.framesPerBuffer(), parameters.flags(), &impl::cppCallbackToPaCallbackAdapter, 
-			static_cast<void *>(&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<FunCallbackStream::CppToCCallbackData *>(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 &parameters, CallbackFunPtr funPtr, void *userData) : adapterData_(funPtr, userData)
+	{
+		open(parameters);
+	}
+
+	FunCallbackStream::~FunCallbackStream()
+	{
+		try
+		{
+			close();
+		}
+		catch (...)
+		{
+			// ignore all errors
+		}
+	}
+
+	void FunCallbackStream::open(const StreamParameters &parameters, CallbackFunPtr funPtr, void *userData)
+	{
+		adapterData_.init(funPtr, userData);
+		open(parameters);
+	}
+
+	void FunCallbackStream::open(const StreamParameters &parameters)
+	{
+		PaError err = Pa_OpenStream(&stream_, parameters.inputParameters().paStreamParameters(), parameters.outputParameters().paStreamParameters(), 
+			parameters.sampleRate(), parameters.framesPerBuffer(), parameters.flags(), &impl::cppCallbackToPaCallbackAdapter, 
+			static_cast<void *>(&adapterData_));
+
+		if (err != paNoError)
+		{
+			throw PaException(err);
+		}
+	}
+
+	// -----------------------------------------------------------------------------------
+}
diff --git a/bindings/cpp/source/portaudiocpp/Device.cxx b/bindings/cpp/source/portaudiocpp/Device.cxx
index cd7eb7c..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 <cstddef>
-
-#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<PaTime>(0.0);
-
-			return info_->defaultLowInputLatency;
-		}
-
-		PaTime Device::defaultHighInputLatency() const
-		{
-			if (info_ == NULL)
-				return static_cast<PaTime>(0.0);
-
-			return info_->defaultHighInputLatency;
-		}
-
-		PaTime Device::defaultLowOutputLatency() const
-		{
-			if (info_ == NULL)
-				return static_cast<PaTime>(0.0);
-
-			return info_->defaultLowOutputLatency;
-		}
-
-		PaTime Device::defaultHighOutputLatency() const
-		{
-			if (info_ == NULL)
-				return static_cast<PaTime>(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)
-		{
-			return (index_ == rhs.index_);
-		}
-
-		bool Device::operator!=(const Device &rhs)
-		{
-			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 <cstddef>
+
+#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<PaTime>(0.0);
+
+			return info_->defaultLowInputLatency;
+		}
+
+		PaTime Device::defaultHighInputLatency() const
+		{
+			if (info_ == NULL)
+				return static_cast<PaTime>(0.0);
+
+			return info_->defaultHighInputLatency;
+		}
+
+		PaTime Device::defaultLowOutputLatency() const
+		{
+			if (info_ == NULL)
+				return static_cast<PaTime>(0.0);
+
+			return info_->defaultLowOutputLatency;
+		}
+
+		PaTime Device::defaultHighOutputLatency() const
+		{
+			if (info_ == NULL)
+				return static_cast<PaTime>(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<PaSampleFormat>(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<SampleDataFormat>(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<PaSampleFormat>(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<SampleDataFormat>(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 &parameters, CallbackInterface &instance)
-	{
-		open(parameters, instance);
-	}
-
-	InterfaceCallbackStream::~InterfaceCallbackStream()
-	{
-		try
-		{
-			close();
-		}
-		catch (...)
-		{
-			// ignore all errors
-		}
-	}
-
-	// ---------------------------------------------------------------------------------==
-
-	void InterfaceCallbackStream::open(const StreamParameters &parameters, CallbackInterface &instance)
-	{
-		PaError err = Pa_OpenStream(&stream_, parameters.inputParameters().paStreamParameters(), parameters.outputParameters().paStreamParameters(), 
-			parameters.sampleRate(), parameters.framesPerBuffer(), parameters.flags(), &impl::callbackInterfaceToPaCallbackAdapter, static_cast<void *>(&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 &parameters, CallbackInterface &instance)
+	{
+		open(parameters, instance);
+	}
+
+	InterfaceCallbackStream::~InterfaceCallbackStream()
+	{
+		try
+		{
+			close();
+		}
+		catch (...)
+		{
+			// ignore all errors
+		}
+	}
+
+	// ---------------------------------------------------------------------------------==
+
+	void InterfaceCallbackStream::open(const StreamParameters &parameters, CallbackInterface &instance)
+	{
+		PaError err = Pa_OpenStream(&stream_, parameters.inputParameters().paStreamParameters(), parameters.outputParameters().paStreamParameters(), 
+			parameters.sampleRate(), parameters.framesPerBuffer(), parameters.flags(), &impl::callbackInterfaceToPaCallbackAdapter, static_cast<void *>(&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 <cstddef>
-
-#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 <cstddef>
+
+#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 <cstddef>
-
-#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 &parameters)
-	{
-		inputParameters_ = parameters;
-	}
-
-	void StreamParameters::setOutputParameters(const DirectionSpecificStreamParameters &parameters)
-	{
-		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 <cstddef>
+
+#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 &parameters)
+	{
+		inputParameters_ = parameters;
+	}
+
+	void StreamParameters::setOutputParameters(const DirectionSpecificStreamParameters &parameters)
+	{
+		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 <cstddef>
-#include <cassert>
-
-#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 <cstddef>
+#include <cassert>
+
+#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 c3c00f7..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)
-	{
-		return (ptr_ == rhs.ptr_);
-	}
-
-	bool System::DeviceIterator::operator!=(const System::DeviceIterator &rhs)
-	{
-		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 f34ca40..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)
-	{
-		return (ptr_ == rhs.ptr_);
-	}
-
-	bool System::HostApiIterator::operator!=(const System::HostApiIterator &rhs)
-	{
-		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 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
-	ProjectType="Visual C++"
-	Version="9.00"
-	Name="PortAudioJNI"
-	ProjectGUID="{4024D885-39B0-4C8A-B3E7-BAB4BA08DFBB}"
-	RootNamespace="PortAudioJNI"
-	Keyword="Win32Proj"
-	TargetFrameworkVersion="196613"
-	>
-	<Platforms>
-		<Platform
-			Name="Win32"
-		/>
-	</Platforms>
-	<ToolFiles>
-	</ToolFiles>
-	<Configurations>
-		<Configuration
-			Name="Debug|Win32"
-			OutputDirectory="..\..\..\..\jportaudio"
-			IntermediateDirectory="$(ConfigurationName)"
-			ConfigurationType="2"
-			CharacterSet="1"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				AdditionalIncludeDirectories="C:\glassfish3\jdk\include;C:\glassfish3\jdk\include\win32"
-				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;PORTAUDIOJNI_EXPORTS"
-				MinimalRebuild="true"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="3"
-				UsePrecompiledHeader="0"
-				WarningLevel="3"
-				DebugInformationFormat="4"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLinkerTool"
-				LinkIncremental="2"
-				GenerateDebugInformation="true"
-				SubSystem="2"
-				TargetMachine="1"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCManifestTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCAppVerifierTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-			/>
-		</Configuration>
-		<Configuration
-			Name="Release|Win32"
-			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
-			IntermediateDirectory="$(ConfigurationName)"
-			ConfigurationType="2"
-			CharacterSet="1"
-			WholeProgramOptimization="1"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="2"
-				EnableIntrinsicFunctions="true"
-				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;PORTAUDIOJNI_EXPORTS"
-				RuntimeLibrary="2"
-				EnableFunctionLevelLinking="true"
-				UsePrecompiledHeader="0"
-				WarningLevel="3"
-				DebugInformationFormat="3"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLinkerTool"
-				LinkIncremental="1"
-				GenerateDebugInformation="true"
-				SubSystem="2"
-				OptimizeReferences="2"
-				EnableCOMDATFolding="2"
-				TargetMachine="1"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCManifestTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCAppVerifierTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-			/>
-		</Configuration>
-	</Configurations>
-	<References>
-	</References>
-	<Files>
-		<Filter
-			Name="Source Files"
-			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
-			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
-			>
-			<File
-				RelativePath="..\..\..\src\com_portaudio_PortAudio.c"
-				>
-			</File>
-		</Filter>
-		<Filter
-			Name="Header Files"
-			Filter="h;hpp;hxx;hm;inl;inc;xsd"
-			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
-			>
-			<File
-				RelativePath="..\..\..\src\com_portaudio_PortAudio.h"
-				>
-			</File>
-		</Filter>
-		<Filter
-			Name="Resource Files"
-			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
-			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
-			>
-		</Filter>
-	</Files>
-	<Globals>
-	</Globals>
-</VisualStudioProject>
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="PortAudioJNI"
+	ProjectGUID="{4024D885-39B0-4C8A-B3E7-BAB4BA08DFBB}"
+	RootNamespace="PortAudioJNI"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="196613"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="..\..\..\..\jportaudio"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="2"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="C:\glassfish3\jdk\include;C:\glassfish3\jdk\include\win32"
+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;PORTAUDIOJNI_EXPORTS"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="4"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				LinkIncremental="2"
+				GenerateDebugInformation="true"
+				SubSystem="2"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="2"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				EnableIntrinsicFunctions="true"
+				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;PORTAUDIOJNI_EXPORTS"
+				RuntimeLibrary="2"
+				EnableFunctionLevelLinking="true"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				LinkIncremental="1"
+				GenerateDebugInformation="true"
+				SubSystem="2"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath="..\..\..\src\com_portaudio_PortAudio.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+			<File
+				RelativePath="..\..\..\src\com_portaudio_PortAudio.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>
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 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <ItemGroup Label="ProjectConfigurations">
-    <ProjectConfiguration Include="Debug|Win32">
-      <Configuration>Debug</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Debug|x64">
-      <Configuration>Debug</Configuration>
-      <Platform>x64</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Release|Win32">
-      <Configuration>Release</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Release|x64">
-      <Configuration>Release</Configuration>
-      <Platform>x64</Platform>
-    </ProjectConfiguration>
-  </ItemGroup>
-  <PropertyGroup Label="Globals">
-    <ProjectGuid>{4024D885-39B0-4C8A-B3E7-BAB4BA08DFBB}</ProjectGuid>
-    <RootNamespace>PortAudioJNI</RootNamespace>
-    <Keyword>Win32Proj</Keyword>
-  </PropertyGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
-    <ConfigurationType>DynamicLibrary</ConfigurationType>
-    <CharacterSet>Unicode</CharacterSet>
-    <WholeProgramOptimization>true</WholeProgramOptimization>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
-    <ConfigurationType>DynamicLibrary</ConfigurationType>
-    <CharacterSet>Unicode</CharacterSet>
-    <WholeProgramOptimization>true</WholeProgramOptimization>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
-    <ConfigurationType>DynamicLibrary</ConfigurationType>
-    <CharacterSet>Unicode</CharacterSet>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
-    <ConfigurationType>DynamicLibrary</ConfigurationType>
-    <CharacterSet>Unicode</CharacterSet>
-  </PropertyGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
-  <ImportGroup Label="ExtensionSettings">
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-  </ImportGroup>
-  <PropertyGroup Label="UserMacros" />
-  <PropertyGroup>
-    <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
-    <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\..\..\jportaudio\</OutDir>
-    <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\..\..\..\jportaudio\</OutDir>
-    <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
-    <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Configuration)\</IntDir>
-    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
-    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
-    <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\..\..\jportaudio\</OutDir>
-    <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\..\..\jportaudio\</OutDir>
-    <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
-    <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Configuration)\</IntDir>
-    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
-    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
-    <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">jportaudio_x64</TargetName>
-    <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">jportaudio_x86</TargetName>
-    <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">jportaudio_x86</TargetName>
-    <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">jportaudio_x64</TargetName>
-  </PropertyGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-    <ClCompile>
-      <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>..\..\..\..\..\..\include;%JAVA_HOME%\include;%JAVA_HOME%\include\win32</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;PORTAUDIOJNI_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <MinimalRebuild>true</MinimalRebuild>
-      <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
-      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
-      <PrecompiledHeader>
-      </PrecompiledHeader>
-      <WarningLevel>Level3</WarningLevel>
-      <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
-    </ClCompile>
-    <Link>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <SubSystem>Windows</SubSystem>
-      <TargetMachine>MachineX86</TargetMachine>
-    </Link>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
-    <ClCompile>
-      <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>..\..\..\..\..\..\include;%JAVA_HOME%\include;%JAVA_HOME%\include\win32</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;PORTAUDIOJNI_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
-      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
-      <PrecompiledHeader>
-      </PrecompiledHeader>
-      <WarningLevel>Level3</WarningLevel>
-      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
-    </ClCompile>
-    <Link>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <SubSystem>Windows</SubSystem>
-    </Link>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-    <ClCompile>
-      <Optimization>MaxSpeed</Optimization>
-      <IntrinsicFunctions>true</IntrinsicFunctions>
-      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;PORTAUDIOJNI_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
-      <FunctionLevelLinking>true</FunctionLevelLinking>
-      <PrecompiledHeader>
-      </PrecompiledHeader>
-      <WarningLevel>Level3</WarningLevel>
-      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
-      <AdditionalIncludeDirectories>..\..\..\..\..\..\include;%JAVA_HOME%\include;%JAVA_HOME%\include\win32</AdditionalIncludeDirectories>
-    </ClCompile>
-    <Link>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <SubSystem>Windows</SubSystem>
-      <OptimizeReferences>true</OptimizeReferences>
-      <EnableCOMDATFolding>true</EnableCOMDATFolding>
-      <TargetMachine>MachineX86</TargetMachine>
-    </Link>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
-    <ClCompile>
-      <Optimization>MaxSpeed</Optimization>
-      <IntrinsicFunctions>true</IntrinsicFunctions>
-      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;PORTAUDIOJNI_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
-      <FunctionLevelLinking>true</FunctionLevelLinking>
-      <PrecompiledHeader>
-      </PrecompiledHeader>
-      <WarningLevel>Level3</WarningLevel>
-      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
-      <AdditionalIncludeDirectories>..\..\..\..\..\..\include;%JAVA_HOME%\include;%JAVA_HOME%\include\win32</AdditionalIncludeDirectories>
-    </ClCompile>
-    <Link>
-      <GenerateDebugInformation>true</GenerateDebugInformation>
-      <SubSystem>Windows</SubSystem>
-      <OptimizeReferences>true</OptimizeReferences>
-      <EnableCOMDATFolding>true</EnableCOMDATFolding>
-    </Link>
-  </ItemDefinitionGroup>
-  <ItemGroup>
-    <ClCompile Include="..\..\..\src\com_portaudio_BlockingStream.c" />
-    <ClCompile Include="..\..\..\src\com_portaudio_PortAudio.c" />
-    <ClCompile Include="..\..\..\src\jpa_tools.c" />
-  </ItemGroup>
-  <ItemGroup>
-    <ClInclude Include="..\..\..\src\com_portaudio_BlockingStream.h" />
-    <ClInclude Include="..\..\..\src\com_portaudio_PortAudio.h" />
-    <ClInclude Include="..\..\..\src\jpa_tools.h" />
-  </ItemGroup>
-  <ItemGroup>
-    <Library Include="..\..\..\..\jportaudio\portaudio_x64.lib" />
-    <Library Include="..\..\..\..\jportaudio\portaudio_x86.lib" />
-  </ItemGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
-  <ImportGroup Label="ExtensionTargets">
-  </ImportGroup>
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{4024D885-39B0-4C8A-B3E7-BAB4BA08DFBB}</ProjectGuid>
+    <RootNamespace>PortAudioJNI</RootNamespace>
+    <Keyword>Win32Proj</Keyword>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <CharacterSet>Unicode</CharacterSet>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <CharacterSet>Unicode</CharacterSet>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <PropertyGroup>
+    <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\..\..\jportaudio\</OutDir>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\..\..\..\jportaudio\</OutDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Configuration)\</IntDir>
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\..\..\jportaudio\</OutDir>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\..\..\jportaudio\</OutDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Configuration)\</IntDir>
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
+    <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">jportaudio_x64</TargetName>
+    <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">jportaudio_x86</TargetName>
+    <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">jportaudio_x86</TargetName>
+    <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">jportaudio_x64</TargetName>
+  </PropertyGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <ClCompile>
+      <Optimization>Disabled</Optimization>
+      <AdditionalIncludeDirectories>..\..\..\..\..\..\include;%JAVA_HOME%\include;%JAVA_HOME%\include\win32</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;PORTAUDIOJNI_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MinimalRebuild>true</MinimalRebuild>
+      <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+      <PrecompiledHeader>
+      </PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
+    </ClCompile>
+    <Link>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <SubSystem>Windows</SubSystem>
+      <TargetMachine>MachineX86</TargetMachine>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <ClCompile>
+      <Optimization>Disabled</Optimization>
+      <AdditionalIncludeDirectories>..\..\..\..\..\..\include;%JAVA_HOME%\include;%JAVA_HOME%\include\win32</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;PORTAUDIOJNI_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+      <PrecompiledHeader>
+      </PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+    </ClCompile>
+    <Link>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <SubSystem>Windows</SubSystem>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <ClCompile>
+      <Optimization>MaxSpeed</Optimization>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;PORTAUDIOJNI_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <PrecompiledHeader>
+      </PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+      <AdditionalIncludeDirectories>..\..\..\..\..\..\include;%JAVA_HOME%\include;%JAVA_HOME%\include\win32</AdditionalIncludeDirectories>
+    </ClCompile>
+    <Link>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <SubSystem>Windows</SubSystem>
+      <OptimizeReferences>true</OptimizeReferences>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <TargetMachine>MachineX86</TargetMachine>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <ClCompile>
+      <Optimization>MaxSpeed</Optimization>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;PORTAUDIOJNI_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <PrecompiledHeader>
+      </PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+      <AdditionalIncludeDirectories>..\..\..\..\..\..\include;%JAVA_HOME%\include;%JAVA_HOME%\include\win32</AdditionalIncludeDirectories>
+    </ClCompile>
+    <Link>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <SubSystem>Windows</SubSystem>
+      <OptimizeReferences>true</OptimizeReferences>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemGroup>
+    <ClCompile Include="..\..\..\src\com_portaudio_BlockingStream.c" />
+    <ClCompile Include="..\..\..\src\com_portaudio_PortAudio.c" />
+    <ClCompile Include="..\..\..\src\jpa_tools.c" />
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="..\..\..\src\com_portaudio_BlockingStream.h" />
+    <ClInclude Include="..\..\..\src\com_portaudio_PortAudio.h" />
+    <ClInclude Include="..\..\..\src\jpa_tools.h" />
+  </ItemGroup>
+  <ItemGroup>
+    <Library Include="..\..\..\..\jportaudio\portaudio_x64.lib" />
+    <Library Include="..\..\..\..\jportaudio\portaudio_x86.lib" />
+  </ItemGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
 </Project>
\ 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 @@
-/** 
- at page java_binding JPortAudio Java Binding
- at ingroup jportaudio
-
-<i>Note: this page has not been reviewed, and may contain errors.</i>
-
- at 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
-
- at 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:
-
- at code
-cd bindings/java/scripts
-make_header.bat
- at endcode
-
-Build the JNI DLL using the Visual Studio 2010 solution in "java/c/build/vs2010/PortAudioJNI".
-
- at 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
-
- at 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.
-
- at code
-#if defined(__APPLE__)
-#include <JavaVM/jni.h>
-#else
-#include <jni.h>
-#endif
- at 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".
-*/
+/** 
+ at page java_binding JPortAudio Java Binding
+ at ingroup jportaudio
+
+<i>Note: this page has not been reviewed, and may contain errors.</i>
+
+ at 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
+
+ at 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:
+
+ at code
+cd bindings/java/scripts
+make_header.bat
+ at endcode
+
+Build the JNI DLL using the Visual Studio 2010 solution in "java/c/build/vs2010/PortAudioJNI".
+
+ at 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
+
+ at 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.
+
+ at code
+#if defined(__APPLE__)
+#include <JavaVM/jni.h>
+#else
+#include <jni.h>
+#endif
+ at 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 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
-	<classpathentry kind="src" path="src"/>
-	<classpathentry kind="src" path="jtests"/>
-	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
-	<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/3"/>
-	<classpathentry kind="output" path="bin"/>
-</classpath>
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="src" path="jtests"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/3"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>
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 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
-	<name>JPortAudio</name>
-	<comment></comment>
-	<projects>
-	</projects>
-	<buildSpec>
-		<buildCommand>
-			<name>org.eclipse.jdt.core.javabuilder</name>
-			<arguments>
-			</arguments>
-		</buildCommand>
-	</buildSpec>
-	<natures>
-		<nature>org.eclipse.jdt.core.javanature</nature>
-	</natures>
-</projectDescription>
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>JPortAudio</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>
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 6261de8..e5a648b 100644
--- a/build/msvc/portaudio.vcproj
+++ b/build/msvc/portaudio.vcproj
@@ -1,1932 +1,1932 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
-	ProjectType="Visual C++"
-	Version="8,00"
-	Name="portaudio"
-	ProjectGUID="{0A18A071-125E-442F-AFF7-A3F68ABECF99}"
-	RootNamespace="portaudio"
-	>
-	<Platforms>
-		<Platform
-			Name="Win32"
-		/>
-		<Platform
-			Name="x64"
-		/>
-	</Platforms>
-	<ToolFiles>
-	</ToolFiles>
-	<Configurations>
-		<Configuration
-			Name="Release|Win32"
-			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
-			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
-			ConfigurationType="2"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="false"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-				PreprocessorDefinitions="NDEBUG"
-				MkTypLibCompatible="true"
-				SuppressStartupBanner="true"
-				TargetEnvironment="1"
-				TypeLibraryName=".\Release_x86/portaudio.tlb"
-				HeaderFileName=""
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="2"
-				InlineFunctionExpansion="1"
-				EnableIntrinsicFunctions="true"
-				FavorSizeOrSpeed="1"
-				AdditionalIncludeDirectories="..\..\src\common;..\..\include;.\;..\..\src\os\win"
-				PreprocessorDefinitions="WIN32;NDEBUG;_USRDLL;PA_ENABLE_DEBUG_OUTPUT;_CRT_SECURE_NO_DEPRECATE;PAWIN_USE_WDMKS_DEVICE_INFO;PA_USE_ASIO=0;PA_USE_DS=0;PA_USE_WMME=1;PA_USE_WASAPI=1;PA_USE_WDMKS=1"
-				StringPooling="true"
-				RuntimeLibrary="2"
-				EnableFunctionLevelLinking="true"
-				PrecompiledHeaderFile="$(PlatformName)\$(ConfigurationName)/portaudio.pch"
-				AssemblerListingLocation="$(PlatformName)\$(ConfigurationName)\"
-				ObjectFile="$(PlatformName)\$(ConfigurationName)\"
-				ProgramDataBaseFileName="$(PlatformName)\$(ConfigurationName)\"
-				WarningLevel="3"
-				SuppressStartupBanner="true"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="NDEBUG"
-				Culture="1033"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="ksuser.lib"
-				OutputFile="$(PlatformName)\$(ConfigurationName)\portaudio_x86.dll"
-				LinkIncremental="1"
-				SuppressStartupBanner="true"
-				AdditionalLibraryDirectories=""
-				ModuleDefinitionFile=".\portaudio.def"
-				ProgramDatabaseFile="$(PlatformName)\$(ConfigurationName)\portaudio_x86.pdb"
-				ImportLibrary="$(PlatformName)\$(ConfigurationName)\portaudio_x86.lib"
-				TargetMachine="1"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCManifestTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-				SuppressStartupBanner="true"
-				OutputFile="$(PlatformName)\$(ConfigurationName)\portaudio.bsc"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCAppVerifierTool"
-			/>
-			<Tool
-				Name="VCWebDeploymentTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-			/>
-		</Configuration>
-		<Configuration
-			Name="Release|x64"
-			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
-			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
-			ConfigurationType="2"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="false"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-				PreprocessorDefinitions="NDEBUG"
-				MkTypLibCompatible="true"
-				SuppressStartupBanner="true"
-				TargetEnvironment="3"
-				TypeLibraryName=".\Release_x86/portaudio.tlb"
-				HeaderFileName=""
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="2"
-				InlineFunctionExpansion="1"
-				EnableIntrinsicFunctions="true"
-				FavorSizeOrSpeed="1"
-				AdditionalIncludeDirectories="..\..\src\common;..\..\include;.\;..\..\src\os\win"
-				PreprocessorDefinitions="_WIN64;NDEBUG;_USRDLL;PA_ENABLE_DEBUG_OUTPUT;_CRT_SECURE_NO_DEPRECATE;PAWIN_USE_WDMKS_DEVICE_INFO;PA_WDMKS_NO_KSGUID_LIB;PA_USE_ASIO=0;PA_USE_DS=0;PA_USE_WMME=1;PA_USE_WASAPI=1;PA_USE_WDMKS=1"
-				StringPooling="true"
-				RuntimeLibrary="2"
-				EnableFunctionLevelLinking="true"
-				PrecompiledHeaderFile="$(PlatformName)\$(ConfigurationName)\portaudio.pch"
-				AssemblerListingLocation="$(PlatformName)\$(ConfigurationName)\"
-				ObjectFile="$(PlatformName)\$(ConfigurationName)\"
-				ProgramDataBaseFileName="$(PlatformName)\$(ConfigurationName)\"
-				WarningLevel="3"
-				SuppressStartupBanner="true"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="NDEBUG"
-				Culture="1033"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="ksuser.lib"
-				OutputFile="$(PlatformName)\$(ConfigurationName)\portaudio_x64.dll"
-				LinkIncremental="1"
-				SuppressStartupBanner="true"
-				AdditionalLibraryDirectories=""
-				ModuleDefinitionFile=".\portaudio.def"
-				ProgramDatabaseFile="$(PlatformName)\$(ConfigurationName)/portaudio_x64.pdb"
-				ImportLibrary="$(PlatformName)\$(ConfigurationName)/portaudio_x64.lib"
-				TargetMachine="17"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCManifestTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-				SuppressStartupBanner="true"
-				OutputFile="$(PlatformName)\$(ConfigurationName)\portaudio_x64.bsc"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCAppVerifierTool"
-			/>
-			<Tool
-				Name="VCWebDeploymentTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-			/>
-		</Configuration>
-		<Configuration
-			Name="Debug|Win32"
-			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
-			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
-			ConfigurationType="2"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="false"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-				PreprocessorDefinitions="_DEBUG"
-				MkTypLibCompatible="true"
-				SuppressStartupBanner="true"
-				TargetEnvironment="1"
-				TypeLibraryName=".\Debug_x86/portaudio.tlb"
-				HeaderFileName=""
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				AdditionalIncludeDirectories="..\..\src\common;..\..\include;.\;..\..\src\os\win"
-				PreprocessorDefinitions="WIN32;_DEBUG;_USRDLL;PA_ENABLE_DEBUG_OUTPUT;_CRT_SECURE_NO_DEPRECATE;PAWIN_USE_WDMKS_DEVICE_INFO;PA_USE_ASIO=0;PA_USE_DS=0;PA_USE_WMME=1;PA_USE_WASAPI=1;PA_USE_WDMKS=1"
-				MinimalRebuild="true"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="3"
-				PrecompiledHeaderFile="$(PlatformName)\$(ConfigurationName)/portaudio.pch"
-				AssemblerListingLocation="$(PlatformName)\$(ConfigurationName)\"
-				ObjectFile="$(PlatformName)\$(ConfigurationName)\"
-				ProgramDataBaseFileName="$(PlatformName)\$(ConfigurationName)\"
-				WarningLevel="3"
-				SuppressStartupBanner="true"
-				DebugInformationFormat="4"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="_DEBUG"
-				Culture="1033"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="ksguid.lib"
-				OutputFile="$(PlatformName)\$(ConfigurationName)\portaudio_x86.dll"
-				LinkIncremental="2"
-				SuppressStartupBanner="true"
-				ModuleDefinitionFile=".\portaudio.def"
-				GenerateDebugInformation="true"
-				ProgramDatabaseFile="$(PlatformName)\$(ConfigurationName)\portaudio_x86.pdb"
-				ImportLibrary="$(PlatformName)\$(ConfigurationName)\portaudio_x86.lib"
-				TargetMachine="1"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCManifestTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-				SuppressStartupBanner="true"
-				OutputFile="$(PlatformName)\$(ConfigurationName)\portaudio.bsc"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCAppVerifierTool"
-			/>
-			<Tool
-				Name="VCWebDeploymentTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-			/>
-		</Configuration>
-		<Configuration
-			Name="Debug|x64"
-			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
-			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
-			ConfigurationType="2"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="false"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-				PreprocessorDefinitions="_DEBUG"
-				MkTypLibCompatible="true"
-				SuppressStartupBanner="true"
-				TargetEnvironment="3"
-				TypeLibraryName=".\Debug_x86/portaudio.tlb"
-				HeaderFileName=""
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				AdditionalIncludeDirectories="..\..\src\common,..\..\include,.\,..\..\src\os\win"
-				PreprocessorDefinitions="_WIN64;_DEBUG;_USRDLL;PA_ENABLE_DEBUG_OUTPUT;_CRT_SECURE_NO_DEPRECATE;PAWIN_USE_WDMKS_DEVICE_INFO;PA_WDMKS_NO_KSGUID_LIB;PA_USE_ASIO=0;PA_USE_DS=0;PA_USE_WMME=1;PA_USE_WASAPI=1;PA_USE_WDMKS=1"
-				MinimalRebuild="true"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="3"
-				PrecompiledHeaderFile="$(PlatformName)\$(ConfigurationName)\portaudio.pch"
-				AssemblerListingLocation="$(PlatformName)\$(ConfigurationName)\"
-				ObjectFile="$(PlatformName)\$(ConfigurationName)\"
-				ProgramDataBaseFileName="$(PlatformName)\$(ConfigurationName)\"
-				WarningLevel="3"
-				SuppressStartupBanner="true"
-				DebugInformationFormat="3"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="_DEBUG"
-				Culture="1033"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="ksguid.lib"
-				OutputFile="$(PlatformName)\$(ConfigurationName)\portaudio_x64.dll"
-				LinkIncremental="2"
-				SuppressStartupBanner="true"
-				ModuleDefinitionFile=".\portaudio.def"
-				GenerateDebugInformation="true"
-				ProgramDatabaseFile="$(PlatformName)\$(ConfigurationName)/portaudio_x64.pdb"
-				ImportLibrary="$(PlatformName)\$(ConfigurationName)\portaudio_x64.lib"
-				TargetMachine="17"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCManifestTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-				SuppressStartupBanner="true"
-				OutputFile="$(PlatformName)\$(ConfigurationName)/portaudio_x64.bsc"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCAppVerifierTool"
-			/>
-			<Tool
-				Name="VCWebDeploymentTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-			/>
-		</Configuration>
-		<Configuration
-			Name="ReleaseMinDependency|Win32"
-			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
-			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
-			ConfigurationType="2"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="false"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-				PreprocessorDefinitions="NDEBUG"
-				MkTypLibCompatible="true"
-				SuppressStartupBanner="true"
-				TargetEnvironment="1"
-				TypeLibraryName=".\Release_x86/portaudio.tlb"
-				HeaderFileName=""
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="2"
-				InlineFunctionExpansion="1"
-				EnableIntrinsicFunctions="true"
-				FavorSizeOrSpeed="1"
-				AdditionalIncludeDirectories="..\..\src\common;..\..\include;.\;..\..\src\os\win"
-				PreprocessorDefinitions="WIN32;NDEBUG;_USRDLL;PA_ENABLE_DEBUG_OUTPUT;_CRT_SECURE_NO_DEPRECATE;PAWIN_USE_WDMKS_DEVICE_INFO;PA_USE_ASIO=0;PA_USE_DS=0;PA_USE_WMME=1;PA_USE_WASAPI=1;PA_USE_WDMKS=1"
-				StringPooling="true"
-				RuntimeLibrary="0"
-				EnableFunctionLevelLinking="true"
-				PrecompiledHeaderFile="$(PlatformName)\$(ConfigurationName)/portaudio.pch"
-				AssemblerListingLocation="$(PlatformName)\$(ConfigurationName)\"
-				ObjectFile="$(PlatformName)\$(ConfigurationName)\"
-				ProgramDataBaseFileName="$(PlatformName)\$(ConfigurationName)\"
-				WarningLevel="3"
-				SuppressStartupBanner="true"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="NDEBUG"
-				Culture="1033"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="ksuser.lib"
-				OutputFile="$(PlatformName)\$(ConfigurationName)\portaudio_x86.dll"
-				LinkIncremental="1"
-				SuppressStartupBanner="true"
-				AdditionalLibraryDirectories=""
-				ModuleDefinitionFile=".\portaudio.def"
-				ProgramDatabaseFile="$(PlatformName)\$(ConfigurationName)\portaudio_x86.pdb"
-				ImportLibrary="$(PlatformName)\$(ConfigurationName)\portaudio_x86.lib"
-				TargetMachine="1"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCManifestTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-				SuppressStartupBanner="true"
-				OutputFile="$(PlatformName)\$(ConfigurationName)\portaudio.bsc"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCAppVerifierTool"
-			/>
-			<Tool
-				Name="VCWebDeploymentTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-			/>
-		</Configuration>
-		<Configuration
-			Name="ReleaseMinDependency|x64"
-			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
-			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
-			ConfigurationType="2"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="false"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-				PreprocessorDefinitions="NDEBUG"
-				MkTypLibCompatible="true"
-				SuppressStartupBanner="true"
-				TargetEnvironment="3"
-				TypeLibraryName=".\Release_x86/portaudio.tlb"
-				HeaderFileName=""
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="2"
-				InlineFunctionExpansion="1"
-				EnableIntrinsicFunctions="true"
-				FavorSizeOrSpeed="1"
-				AdditionalIncludeDirectories="..\..\src\common;..\..\include;.\;..\..\src\os\win"
-				PreprocessorDefinitions="_WIN64;NDEBUG;_USRDLL;PA_ENABLE_DEBUG_OUTPUT;_CRT_SECURE_NO_DEPRECATE;PAWIN_USE_WDMKS_DEVICE_INFO;PA_WDMKS_NO_KSGUID_LIB;PA_USE_ASIO=0;PA_USE_DS=0;PA_USE_WMME=1;PA_USE_WASAPI=1;PA_USE_WDMKS=1"
-				StringPooling="true"
-				RuntimeLibrary="0"
-				EnableFunctionLevelLinking="true"
-				PrecompiledHeaderFile="$(PlatformName)\$(ConfigurationName)\portaudio.pch"
-				AssemblerListingLocation="$(PlatformName)\$(ConfigurationName)\"
-				ObjectFile="$(PlatformName)\$(ConfigurationName)\"
-				ProgramDataBaseFileName="$(PlatformName)\$(ConfigurationName)\"
-				WarningLevel="3"
-				SuppressStartupBanner="true"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="NDEBUG"
-				Culture="1033"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="ksuser.lib"
-				OutputFile="$(PlatformName)\$(ConfigurationName)\portaudio_x64.dll"
-				LinkIncremental="1"
-				SuppressStartupBanner="true"
-				AdditionalLibraryDirectories=""
-				ModuleDefinitionFile=".\portaudio.def"
-				ProgramDatabaseFile="$(PlatformName)\$(ConfigurationName)/portaudio_x64.pdb"
-				ImportLibrary="$(PlatformName)\$(ConfigurationName)/portaudio_x64.lib"
-				TargetMachine="17"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCManifestTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-				SuppressStartupBanner="true"
-				OutputFile="$(PlatformName)\$(ConfigurationName)\portaudio_x64.bsc"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCAppVerifierTool"
-			/>
-			<Tool
-				Name="VCWebDeploymentTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-			/>
-		</Configuration>
-	</Configurations>
-	<References>
-	</References>
-	<Files>
-		<Filter
-			Name="Source Files"
-			Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-			>
-			<Filter
-				Name="common"
-				>
-				<File
-					RelativePath="..\..\src\common\pa_allocation.c"
-					>
-					<FileConfiguration
-						Name="Release|Win32"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-						/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Release|x64"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-						/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Debug|Win32"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-						/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Debug|x64"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-						/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="ReleaseMinDependency|Win32"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-						/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="ReleaseMinDependency|x64"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-						/>
-					</FileConfiguration>
-				</File>
-				<File
-					RelativePath="..\..\src\common\pa_converters.c"
-					>
-					<FileConfiguration
-						Name="Release|Win32"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-						/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Release|x64"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-						/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Debug|Win32"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-						/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Debug|x64"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-						/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="ReleaseMinDependency|Win32"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-						/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="ReleaseMinDependency|x64"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-						/>
-					</FileConfiguration>
-				</File>
-				<File
-					RelativePath="..\..\src\common\pa_cpuload.c"
-					>
-					<FileConfiguration
-						Name="Release|Win32"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-						/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Release|x64"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-						/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Debug|Win32"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-						/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Debug|x64"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-						/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="ReleaseMinDependency|Win32"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-						/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="ReleaseMinDependency|x64"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-						/>
-					</FileConfiguration>
-				</File>
-				<File
-					RelativePath="..\..\src\common\pa_debugprint.c"
-					>
-					<FileConfiguration
-						Name="Release|Win32"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-						/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Release|x64"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-						/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Debug|Win32"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-						/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Debug|x64"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-						/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="ReleaseMinDependency|Win32"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-						/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="ReleaseMinDependency|x64"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-						/>
-					</FileConfiguration>
-				</File>
-				<File
-					RelativePath="..\..\src\common\pa_dither.c"
-					>
-					<FileConfiguration
-						Name="Release|Win32"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-						/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Release|x64"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-						/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Debug|Win32"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-						/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Debug|x64"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-						/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="ReleaseMinDependency|Win32"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-						/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="ReleaseMinDependency|x64"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-						/>
-					</FileConfiguration>
-				</File>
-				<File
-					RelativePath="..\..\src\common\pa_front.c"
-					>
-					<FileConfiguration
-						Name="Release|Win32"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-						/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Release|x64"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-						/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Debug|Win32"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-						/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Debug|x64"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-						/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="ReleaseMinDependency|Win32"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-						/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="ReleaseMinDependency|x64"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-						/>
-					</FileConfiguration>
-				</File>
-				<File
-					RelativePath="..\..\src\hostapi\skeleton\pa_hostapi_skeleton.c"
-					>
-					<FileConfiguration
-						Name="Release|Win32"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-						/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Release|x64"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-						/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Debug|Win32"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-						/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Debug|x64"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-						/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="ReleaseMinDependency|Win32"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-						/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="ReleaseMinDependency|x64"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-						/>
-					</FileConfiguration>
-				</File>
-				<File
-					RelativePath="..\..\src\common\pa_process.c"
-					>
-					<FileConfiguration
-						Name="Release|Win32"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-						/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Release|x64"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-						/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Debug|Win32"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-						/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Debug|x64"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-						/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="ReleaseMinDependency|Win32"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-						/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="ReleaseMinDependency|x64"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-						/>
-					</FileConfiguration>
-				</File>
-				<File
-					RelativePath="..\..\src\common\pa_ringbuffer.c"
-					>
-					<FileConfiguration
-						Name="Release|Win32"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-						/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Release|x64"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-						/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Debug|Win32"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-						/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Debug|x64"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-						/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="ReleaseMinDependency|Win32"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-						/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="ReleaseMinDependency|x64"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-						/>
-					</FileConfiguration>
-				</File>
-				<File
-					RelativePath="..\..\src\common\pa_stream.c"
-					>
-					<FileConfiguration
-						Name="Release|Win32"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-						/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Release|x64"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-						/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Debug|Win32"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-						/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Debug|x64"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-						/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="ReleaseMinDependency|Win32"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-						/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="ReleaseMinDependency|x64"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-						/>
-					</FileConfiguration>
-				</File>
-				<File
-					RelativePath="..\..\src\common\pa_trace.c"
-					>
-					<FileConfiguration
-						Name="Release|Win32"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-						/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Release|x64"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-						/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Debug|Win32"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-						/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Debug|x64"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-						/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="ReleaseMinDependency|Win32"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-						/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="ReleaseMinDependency|x64"
-						>
-						<Tool
-							Name="VCCLCompilerTool"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-						/>
-					</FileConfiguration>
-				</File>
-			</Filter>
-			<Filter
-				Name="hostapi"
-				>
-				<Filter
-					Name="ASIO"
-					>
-					<File
-						RelativePath="..\..\src\hostapi\asio\pa_asio.cpp"
-						>
-						<FileConfiguration
-							Name="Release|Win32"
-							>
-							<Tool
-								Name="VCCLCompilerTool"
-								AdditionalIncludeDirectories="..\..\src\hostapi\asio\ASIOSDK\host;..\..\src\hostapi\asio\ASIOSDK\host\pc;..\..\src\hostapi\asio\ASIOSDK\common"
-								PreprocessorDefinitions=""
-							/>
-						</FileConfiguration>
-						<FileConfiguration
-							Name="Release|x64"
-							>
-							<Tool
-								Name="VCCLCompilerTool"
-								AdditionalIncludeDirectories="..\..\src\hostapi\asio\ASIOSDK\host;..\..\src\hostapi\asio\ASIOSDK\host\pc;..\..\src\hostapi\asio\ASIOSDK\common"
-								PreprocessorDefinitions=""
-							/>
-						</FileConfiguration>
-						<FileConfiguration
-							Name="Debug|Win32"
-							>
-							<Tool
-								Name="VCCLCompilerTool"
-								AdditionalIncludeDirectories="..\..\src\hostapi\asio\ASIOSDK\host;..\..\src\hostapi\asio\ASIOSDK\host\pc;..\..\src\hostapi\asio\ASIOSDK\common"
-								PreprocessorDefinitions=""
-							/>
-						</FileConfiguration>
-						<FileConfiguration
-							Name="Debug|x64"
-							>
-							<Tool
-								Name="VCCLCompilerTool"
-								AdditionalIncludeDirectories="..\..\src\hostapi\asio\ASIOSDK\host;..\..\src\hostapi\asio\ASIOSDK\host\pc;..\..\src\hostapi\asio\ASIOSDK\common"
-								PreprocessorDefinitions=""
-							/>
-						</FileConfiguration>
-						<FileConfiguration
-							Name="ReleaseMinDependency|Win32"
-							>
-							<Tool
-								Name="VCCLCompilerTool"
-								AdditionalIncludeDirectories="..\..\src\hostapi\asio\ASIOSDK\host;..\..\src\hostapi\asio\ASIOSDK\host\pc;..\..\src\hostapi\asio\ASIOSDK\common"
-								PreprocessorDefinitions=""
-							/>
-						</FileConfiguration>
-						<FileConfiguration
-							Name="ReleaseMinDependency|x64"
-							>
-							<Tool
-								Name="VCCLCompilerTool"
-								AdditionalIncludeDirectories="..\..\src\hostapi\asio\ASIOSDK\host;..\..\src\hostapi\asio\ASIOSDK\host\pc;..\..\src\hostapi\asio\ASIOSDK\common"
-								PreprocessorDefinitions=""
-							/>
-						</FileConfiguration>
-					</File>
-					<Filter
-						Name="ASIOSDK"
-						>
-						<File
-							RelativePath="..\..\src\hostapi\asio\ASIOSDK\common\asio.cpp"
-							>
-							<FileConfiguration
-								Name="Release|Win32"
-								>
-								<Tool
-									Name="VCCLCompilerTool"
-									AdditionalIncludeDirectories="..\..\src\hostapi\asio\ASIOSDK\host;..\..\src\hostapi\asio\ASIOSDK\host\pc;..\..\src\hostapi\asio\ASIOSDK\common"
-									PreprocessorDefinitions=""
-								/>
-							</FileConfiguration>
-							<FileConfiguration
-								Name="Release|x64"
-								>
-								<Tool
-									Name="VCCLCompilerTool"
-									AdditionalIncludeDirectories="..\..\src\hostapi\asio\ASIOSDK\host;..\..\src\hostapi\asio\ASIOSDK\host\pc;..\..\src\hostapi\asio\ASIOSDK\common"
-									PreprocessorDefinitions=""
-								/>
-							</FileConfiguration>
-							<FileConfiguration
-								Name="Debug|Win32"
-								>
-								<Tool
-									Name="VCCLCompilerTool"
-									AdditionalIncludeDirectories="..\..\src\hostapi\asio\ASIOSDK\host;..\..\src\hostapi\asio\ASIOSDK\host\pc;..\..\src\hostapi\asio\ASIOSDK\common"
-									PreprocessorDefinitions=""
-								/>
-							</FileConfiguration>
-							<FileConfiguration
-								Name="Debug|x64"
-								>
-								<Tool
-									Name="VCCLCompilerTool"
-									AdditionalIncludeDirectories="..\..\src\hostapi\asio\ASIOSDK\host;..\..\src\hostapi\asio\ASIOSDK\host\pc;..\..\src\hostapi\asio\ASIOSDK\common"
-									PreprocessorDefinitions=""
-								/>
-							</FileConfiguration>
-							<FileConfiguration
-								Name="ReleaseMinDependency|Win32"
-								>
-								<Tool
-									Name="VCCLCompilerTool"
-									AdditionalIncludeDirectories="..\..\src\hostapi\asio\ASIOSDK\host;..\..\src\hostapi\asio\ASIOSDK\host\pc;..\..\src\hostapi\asio\ASIOSDK\common"
-									PreprocessorDefinitions=""
-								/>
-							</FileConfiguration>
-							<FileConfiguration
-								Name="ReleaseMinDependency|x64"
-								>
-								<Tool
-									Name="VCCLCompilerTool"
-									AdditionalIncludeDirectories="..\..\src\hostapi\asio\ASIOSDK\host;..\..\src\hostapi\asio\ASIOSDK\host\pc;..\..\src\hostapi\asio\ASIOSDK\common"
-									PreprocessorDefinitions=""
-								/>
-							</FileConfiguration>
-						</File>
-						<File
-							RelativePath="..\..\src\hostapi\asio\ASIOSDK\host\asiodrivers.cpp"
-							>
-							<FileConfiguration
-								Name="Release|Win32"
-								>
-								<Tool
-									Name="VCCLCompilerTool"
-									AdditionalIncludeDirectories="..\..\src\hostapi\asio\ASIOSDK\host;..\..\src\hostapi\asio\ASIOSDK\host\pc;..\..\src\hostapi\asio\ASIOSDK\common"
-									PreprocessorDefinitions=""
-								/>
-							</FileConfiguration>
-							<FileConfiguration
-								Name="Release|x64"
-								>
-								<Tool
-									Name="VCCLCompilerTool"
-									AdditionalIncludeDirectories="..\..\src\hostapi\asio\ASIOSDK\host;..\..\src\hostapi\asio\ASIOSDK\host\pc;..\..\src\hostapi\asio\ASIOSDK\common"
-									PreprocessorDefinitions=""
-								/>
-							</FileConfiguration>
-							<FileConfiguration
-								Name="Debug|Win32"
-								>
-								<Tool
-									Name="VCCLCompilerTool"
-									AdditionalIncludeDirectories="..\..\src\hostapi\asio\ASIOSDK\host;..\..\src\hostapi\asio\ASIOSDK\host\pc;..\..\src\hostapi\asio\ASIOSDK\common"
-									PreprocessorDefinitions=""
-								/>
-							</FileConfiguration>
-							<FileConfiguration
-								Name="Debug|x64"
-								>
-								<Tool
-									Name="VCCLCompilerTool"
-									AdditionalIncludeDirectories="..\..\src\hostapi\asio\ASIOSDK\host;..\..\src\hostapi\asio\ASIOSDK\host\pc;..\..\src\hostapi\asio\ASIOSDK\common"
-									PreprocessorDefinitions=""
-								/>
-							</FileConfiguration>
-							<FileConfiguration
-								Name="ReleaseMinDependency|Win32"
-								>
-								<Tool
-									Name="VCCLCompilerTool"
-									AdditionalIncludeDirectories="..\..\src\hostapi\asio\ASIOSDK\host;..\..\src\hostapi\asio\ASIOSDK\host\pc;..\..\src\hostapi\asio\ASIOSDK\common"
-									PreprocessorDefinitions=""
-								/>
-							</FileConfiguration>
-							<FileConfiguration
-								Name="ReleaseMinDependency|x64"
-								>
-								<Tool
-									Name="VCCLCompilerTool"
-									AdditionalIncludeDirectories="..\..\src\hostapi\asio\ASIOSDK\host;..\..\src\hostapi\asio\ASIOSDK\host\pc;..\..\src\hostapi\asio\ASIOSDK\common"
-									PreprocessorDefinitions=""
-								/>
-							</FileConfiguration>
-						</File>
-						<File
-							RelativePath="..\..\src\hostapi\asio\ASIOSDK\host\pc\asiolist.cpp"
-							>
-							<FileConfiguration
-								Name="Release|Win32"
-								>
-								<Tool
-									Name="VCCLCompilerTool"
-									AdditionalIncludeDirectories="..\..\src\hostapi\asio\ASIOSDK\host;..\..\src\hostapi\asio\ASIOSDK\host\pc;..\..\src\hostapi\asio\ASIOSDK\common"
-									PreprocessorDefinitions=""
-								/>
-							</FileConfiguration>
-							<FileConfiguration
-								Name="Release|x64"
-								>
-								<Tool
-									Name="VCCLCompilerTool"
-									AdditionalIncludeDirectories="..\..\src\hostapi\asio\ASIOSDK\host;..\..\src\hostapi\asio\ASIOSDK\host\pc;..\..\src\hostapi\asio\ASIOSDK\common"
-									PreprocessorDefinitions=""
-								/>
-							</FileConfiguration>
-							<FileConfiguration
-								Name="Debug|Win32"
-								>
-								<Tool
-									Name="VCCLCompilerTool"
-									AdditionalIncludeDirectories="..\..\src\hostapi\asio\ASIOSDK\host;..\..\src\hostapi\asio\ASIOSDK\host\pc;..\..\src\hostapi\asio\ASIOSDK\common"
-									PreprocessorDefinitions=""
-								/>
-							</FileConfiguration>
-							<FileConfiguration
-								Name="Debug|x64"
-								>
-								<Tool
-									Name="VCCLCompilerTool"
-									AdditionalIncludeDirectories="..\..\src\hostapi\asio\ASIOSDK\host;..\..\src\hostapi\asio\ASIOSDK\host\pc;..\..\src\hostapi\asio\ASIOSDK\common"
-									PreprocessorDefinitions=""
-								/>
-							</FileConfiguration>
-							<FileConfiguration
-								Name="ReleaseMinDependency|Win32"
-								>
-								<Tool
-									Name="VCCLCompilerTool"
-									AdditionalIncludeDirectories="..\..\src\hostapi\asio\ASIOSDK\host;..\..\src\hostapi\asio\ASIOSDK\host\pc;..\..\src\hostapi\asio\ASIOSDK\common"
-									PreprocessorDefinitions=""
-								/>
-							</FileConfiguration>
-							<FileConfiguration
-								Name="ReleaseMinDependency|x64"
-								>
-								<Tool
-									Name="VCCLCompilerTool"
-									AdditionalIncludeDirectories="..\..\src\hostapi\asio\ASIOSDK\host;..\..\src\hostapi\asio\ASIOSDK\host\pc;..\..\src\hostapi\asio\ASIOSDK\common"
-									PreprocessorDefinitions=""
-								/>
-							</FileConfiguration>
-						</File>
-					</Filter>
-				</Filter>
-				<Filter
-					Name="dsound"
-					>
-					<File
-						RelativePath="..\..\src\hostapi\dsound\pa_win_ds.c"
-						>
-						<FileConfiguration
-							Name="Release|Win32"
-							>
-							<Tool
-								Name="VCCLCompilerTool"
-								AdditionalIncludeDirectories=""
-								PreprocessorDefinitions=""
-							/>
-						</FileConfiguration>
-						<FileConfiguration
-							Name="Release|x64"
-							>
-							<Tool
-								Name="VCCLCompilerTool"
-								AdditionalIncludeDirectories=""
-								PreprocessorDefinitions=""
-							/>
-						</FileConfiguration>
-						<FileConfiguration
-							Name="Debug|Win32"
-							>
-							<Tool
-								Name="VCCLCompilerTool"
-								AdditionalIncludeDirectories=""
-								PreprocessorDefinitions=""
-							/>
-						</FileConfiguration>
-						<FileConfiguration
-							Name="Debug|x64"
-							>
-							<Tool
-								Name="VCCLCompilerTool"
-								AdditionalIncludeDirectories=""
-								PreprocessorDefinitions=""
-							/>
-						</FileConfiguration>
-						<FileConfiguration
-							Name="ReleaseMinDependency|Win32"
-							>
-							<Tool
-								Name="VCCLCompilerTool"
-								AdditionalIncludeDirectories=""
-								PreprocessorDefinitions=""
-							/>
-						</FileConfiguration>
-						<FileConfiguration
-							Name="ReleaseMinDependency|x64"
-							>
-							<Tool
-								Name="VCCLCompilerTool"
-								AdditionalIncludeDirectories=""
-								PreprocessorDefinitions=""
-							/>
-						</FileConfiguration>
-					</File>
-					<File
-						RelativePath="..\..\src\hostapi\dsound\pa_win_ds_dynlink.c"
-						>
-						<FileConfiguration
-							Name="Release|Win32"
-							>
-							<Tool
-								Name="VCCLCompilerTool"
-								AdditionalIncludeDirectories=""
-								PreprocessorDefinitions=""
-							/>
-						</FileConfiguration>
-						<FileConfiguration
-							Name="Release|x64"
-							>
-							<Tool
-								Name="VCCLCompilerTool"
-								AdditionalIncludeDirectories=""
-								PreprocessorDefinitions=""
-							/>
-						</FileConfiguration>
-						<FileConfiguration
-							Name="Debug|Win32"
-							>
-							<Tool
-								Name="VCCLCompilerTool"
-								AdditionalIncludeDirectories=""
-								PreprocessorDefinitions=""
-							/>
-						</FileConfiguration>
-						<FileConfiguration
-							Name="Debug|x64"
-							>
-							<Tool
-								Name="VCCLCompilerTool"
-								AdditionalIncludeDirectories=""
-								PreprocessorDefinitions=""
-							/>
-						</FileConfiguration>
-						<FileConfiguration
-							Name="ReleaseMinDependency|Win32"
-							>
-							<Tool
-								Name="VCCLCompilerTool"
-								AdditionalIncludeDirectories=""
-								PreprocessorDefinitions=""
-							/>
-						</FileConfiguration>
-						<FileConfiguration
-							Name="ReleaseMinDependency|x64"
-							>
-							<Tool
-								Name="VCCLCompilerTool"
-								AdditionalIncludeDirectories=""
-								PreprocessorDefinitions=""
-							/>
-						</FileConfiguration>
-					</File>
-				</Filter>
-				<Filter
-					Name="wmme"
-					>
-					<File
-						RelativePath="..\..\src\hostapi\wmme\pa_win_wmme.c"
-						>
-						<FileConfiguration
-							Name="Release|Win32"
-							>
-							<Tool
-								Name="VCCLCompilerTool"
-								AdditionalIncludeDirectories=""
-								PreprocessorDefinitions=""
-							/>
-						</FileConfiguration>
-						<FileConfiguration
-							Name="Release|x64"
-							>
-							<Tool
-								Name="VCCLCompilerTool"
-								AdditionalIncludeDirectories=""
-								PreprocessorDefinitions=""
-							/>
-						</FileConfiguration>
-						<FileConfiguration
-							Name="Debug|Win32"
-							>
-							<Tool
-								Name="VCCLCompilerTool"
-								AdditionalIncludeDirectories=""
-								PreprocessorDefinitions=""
-							/>
-						</FileConfiguration>
-						<FileConfiguration
-							Name="Debug|x64"
-							>
-							<Tool
-								Name="VCCLCompilerTool"
-								AdditionalIncludeDirectories=""
-								PreprocessorDefinitions=""
-							/>
-						</FileConfiguration>
-						<FileConfiguration
-							Name="ReleaseMinDependency|Win32"
-							>
-							<Tool
-								Name="VCCLCompilerTool"
-								AdditionalIncludeDirectories=""
-								PreprocessorDefinitions=""
-							/>
-						</FileConfiguration>
-						<FileConfiguration
-							Name="ReleaseMinDependency|x64"
-							>
-							<Tool
-								Name="VCCLCompilerTool"
-								AdditionalIncludeDirectories=""
-								PreprocessorDefinitions=""
-							/>
-						</FileConfiguration>
-					</File>
-				</Filter>
-				<Filter
-					Name="wasapi"
-					>
-					<File
-						RelativePath="..\..\src\hostapi\wasapi\pa_win_wasapi.c"
-						>
-					</File>
-				</Filter>
-				<Filter
-					Name="wdmks"
-					>
-					<File
-						RelativePath="..\..\src\hostapi\wdmks\pa_win_wdmks.c"
-						>
-					</File>
-				</Filter>
-			</Filter>
-			<Filter
-				Name="os"
-				>
-				<Filter
-					Name="win"
-					>
-					<File
-						RelativePath="..\..\src\os\win\pa_win_coinitialize.c"
-						>
-					</File>
-					<File
-						RelativePath="..\..\src\os\win\pa_win_hostapis.c"
-						>
-						<FileConfiguration
-							Name="Release|Win32"
-							>
-							<Tool
-								Name="VCCLCompilerTool"
-								AdditionalIncludeDirectories=""
-								PreprocessorDefinitions=""
-							/>
-						</FileConfiguration>
-						<FileConfiguration
-							Name="Release|x64"
-							>
-							<Tool
-								Name="VCCLCompilerTool"
-								AdditionalIncludeDirectories=""
-								PreprocessorDefinitions=""
-							/>
-						</FileConfiguration>
-						<FileConfiguration
-							Name="Debug|Win32"
-							>
-							<Tool
-								Name="VCCLCompilerTool"
-								AdditionalIncludeDirectories=""
-								PreprocessorDefinitions=""
-							/>
-						</FileConfiguration>
-						<FileConfiguration
-							Name="Debug|x64"
-							>
-							<Tool
-								Name="VCCLCompilerTool"
-								AdditionalIncludeDirectories=""
-								PreprocessorDefinitions=""
-							/>
-						</FileConfiguration>
-						<FileConfiguration
-							Name="ReleaseMinDependency|Win32"
-							>
-							<Tool
-								Name="VCCLCompilerTool"
-								AdditionalIncludeDirectories=""
-								PreprocessorDefinitions=""
-							/>
-						</FileConfiguration>
-						<FileConfiguration
-							Name="ReleaseMinDependency|x64"
-							>
-							<Tool
-								Name="VCCLCompilerTool"
-								AdditionalIncludeDirectories=""
-								PreprocessorDefinitions=""
-							/>
-						</FileConfiguration>
-					</File>
-					<File
-						RelativePath="..\..\src\os\win\pa_win_util.c"
-						>
-						<FileConfiguration
-							Name="Release|Win32"
-							>
-							<Tool
-								Name="VCCLCompilerTool"
-								AdditionalIncludeDirectories=""
-								PreprocessorDefinitions=""
-							/>
-						</FileConfiguration>
-						<FileConfiguration
-							Name="Release|x64"
-							>
-							<Tool
-								Name="VCCLCompilerTool"
-								AdditionalIncludeDirectories=""
-								PreprocessorDefinitions=""
-							/>
-						</FileConfiguration>
-						<FileConfiguration
-							Name="Debug|Win32"
-							>
-							<Tool
-								Name="VCCLCompilerTool"
-								AdditionalIncludeDirectories=""
-								PreprocessorDefinitions=""
-							/>
-						</FileConfiguration>
-						<FileConfiguration
-							Name="Debug|x64"
-							>
-							<Tool
-								Name="VCCLCompilerTool"
-								AdditionalIncludeDirectories=""
-								PreprocessorDefinitions=""
-							/>
-						</FileConfiguration>
-						<FileConfiguration
-							Name="ReleaseMinDependency|Win32"
-							>
-							<Tool
-								Name="VCCLCompilerTool"
-								AdditionalIncludeDirectories=""
-								PreprocessorDefinitions=""
-							/>
-						</FileConfiguration>
-						<FileConfiguration
-							Name="ReleaseMinDependency|x64"
-							>
-							<Tool
-								Name="VCCLCompilerTool"
-								AdditionalIncludeDirectories=""
-								PreprocessorDefinitions=""
-							/>
-						</FileConfiguration>
-					</File>
-					<File
-						RelativePath="..\..\src\os\win\pa_win_waveformat.c"
-						>
-					</File>
-					<File
-						RelativePath="..\..\src\os\win\pa_win_wdmks_utils.c"
-						>
-					</File>
-					<File
-						RelativePath="..\..\src\os\win\pa_x86_plain_converters.c"
-						>
-						<FileConfiguration
-							Name="Release|Win32"
-							>
-							<Tool
-								Name="VCCLCompilerTool"
-								AdditionalIncludeDirectories=""
-								PreprocessorDefinitions=""
-							/>
-						</FileConfiguration>
-						<FileConfiguration
-							Name="Release|x64"
-							>
-							<Tool
-								Name="VCCLCompilerTool"
-								AdditionalIncludeDirectories=""
-								PreprocessorDefinitions=""
-							/>
-						</FileConfiguration>
-						<FileConfiguration
-							Name="Debug|Win32"
-							>
-							<Tool
-								Name="VCCLCompilerTool"
-								AdditionalIncludeDirectories=""
-								PreprocessorDefinitions=""
-							/>
-						</FileConfiguration>
-						<FileConfiguration
-							Name="Debug|x64"
-							>
-							<Tool
-								Name="VCCLCompilerTool"
-								AdditionalIncludeDirectories=""
-								PreprocessorDefinitions=""
-							/>
-						</FileConfiguration>
-						<FileConfiguration
-							Name="ReleaseMinDependency|Win32"
-							>
-							<Tool
-								Name="VCCLCompilerTool"
-								AdditionalIncludeDirectories=""
-								PreprocessorDefinitions=""
-							/>
-						</FileConfiguration>
-						<FileConfiguration
-							Name="ReleaseMinDependency|x64"
-							>
-							<Tool
-								Name="VCCLCompilerTool"
-								AdditionalIncludeDirectories=""
-								PreprocessorDefinitions=""
-							/>
-						</FileConfiguration>
-					</File>
-				</Filter>
-			</Filter>
-		</Filter>
-		<Filter
-			Name="Resource Files"
-			Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-			>
-			<File
-				RelativePath="portaudio.def"
-				>
-			</File>
-		</Filter>
-		<Filter
-			Name="Header Files"
-			Filter="h;hpp;hxx;hm;inl"
-			>
-			<File
-				RelativePath="..\..\include\pa_asio.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\include\pa_win_ds.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\include\pa_win_wasapi.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\include\pa_win_waveformat.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\include\pa_win_wmme.h"
-				>
-			</File>
-			<File
-				RelativePath="..\..\include\portaudio.h"
-				>
-			</File>
-		</Filter>
-	</Files>
-	<Globals>
-	</Globals>
-</VisualStudioProject>
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8,00"
+	Name="portaudio"
+	ProjectGUID="{0A18A071-125E-442F-AFF7-A3F68ABECF99}"
+	RootNamespace="portaudio"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+		<Platform
+			Name="x64"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="2"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				PreprocessorDefinitions="NDEBUG"
+				MkTypLibCompatible="true"
+				SuppressStartupBanner="true"
+				TargetEnvironment="1"
+				TypeLibraryName=".\Release_x86/portaudio.tlb"
+				HeaderFileName=""
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				InlineFunctionExpansion="1"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="..\..\src\common;..\..\include;.\;..\..\src\os\win"
+				PreprocessorDefinitions="WIN32;NDEBUG;_USRDLL;PA_ENABLE_DEBUG_OUTPUT;_CRT_SECURE_NO_DEPRECATE;PAWIN_USE_WDMKS_DEVICE_INFO;PA_USE_ASIO=0;PA_USE_DS=0;PA_USE_WMME=1;PA_USE_WASAPI=1;PA_USE_WDMKS=1"
+				StringPooling="true"
+				RuntimeLibrary="2"
+				EnableFunctionLevelLinking="true"
+				PrecompiledHeaderFile="$(PlatformName)\$(ConfigurationName)/portaudio.pch"
+				AssemblerListingLocation="$(PlatformName)\$(ConfigurationName)\"
+				ObjectFile="$(PlatformName)\$(ConfigurationName)\"
+				ProgramDataBaseFileName="$(PlatformName)\$(ConfigurationName)\"
+				WarningLevel="3"
+				SuppressStartupBanner="true"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="NDEBUG"
+				Culture="1033"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="ksuser.lib"
+				OutputFile="$(PlatformName)\$(ConfigurationName)\portaudio_x86.dll"
+				LinkIncremental="1"
+				SuppressStartupBanner="true"
+				AdditionalLibraryDirectories=""
+				ModuleDefinitionFile=".\portaudio.def"
+				ProgramDatabaseFile="$(PlatformName)\$(ConfigurationName)\portaudio_x86.pdb"
+				ImportLibrary="$(PlatformName)\$(ConfigurationName)\portaudio_x86.lib"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+				SuppressStartupBanner="true"
+				OutputFile="$(PlatformName)\$(ConfigurationName)\portaudio.bsc"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="2"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				PreprocessorDefinitions="NDEBUG"
+				MkTypLibCompatible="true"
+				SuppressStartupBanner="true"
+				TargetEnvironment="3"
+				TypeLibraryName=".\Release_x86/portaudio.tlb"
+				HeaderFileName=""
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				InlineFunctionExpansion="1"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="..\..\src\common;..\..\include;.\;..\..\src\os\win"
+				PreprocessorDefinitions="_WIN64;NDEBUG;_USRDLL;PA_ENABLE_DEBUG_OUTPUT;_CRT_SECURE_NO_DEPRECATE;PAWIN_USE_WDMKS_DEVICE_INFO;PA_USE_ASIO=0;PA_USE_DS=0;PA_USE_WMME=1;PA_USE_WASAPI=1;PA_USE_WDMKS=1"
+				StringPooling="true"
+				RuntimeLibrary="2"
+				EnableFunctionLevelLinking="true"
+				PrecompiledHeaderFile="$(PlatformName)\$(ConfigurationName)\portaudio.pch"
+				AssemblerListingLocation="$(PlatformName)\$(ConfigurationName)\"
+				ObjectFile="$(PlatformName)\$(ConfigurationName)\"
+				ProgramDataBaseFileName="$(PlatformName)\$(ConfigurationName)\"
+				WarningLevel="3"
+				SuppressStartupBanner="true"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="NDEBUG"
+				Culture="1033"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="ksuser.lib"
+				OutputFile="$(PlatformName)\$(ConfigurationName)\portaudio_x64.dll"
+				LinkIncremental="1"
+				SuppressStartupBanner="true"
+				AdditionalLibraryDirectories=""
+				ModuleDefinitionFile=".\portaudio.def"
+				ProgramDatabaseFile="$(PlatformName)\$(ConfigurationName)/portaudio_x64.pdb"
+				ImportLibrary="$(PlatformName)\$(ConfigurationName)/portaudio_x64.lib"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+				SuppressStartupBanner="true"
+				OutputFile="$(PlatformName)\$(ConfigurationName)\portaudio_x64.bsc"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="2"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				PreprocessorDefinitions="_DEBUG"
+				MkTypLibCompatible="true"
+				SuppressStartupBanner="true"
+				TargetEnvironment="1"
+				TypeLibraryName=".\Debug_x86/portaudio.tlb"
+				HeaderFileName=""
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\..\src\common;..\..\include;.\;..\..\src\os\win"
+				PreprocessorDefinitions="WIN32;_DEBUG;_USRDLL;PA_ENABLE_DEBUG_OUTPUT;_CRT_SECURE_NO_DEPRECATE;PAWIN_USE_WDMKS_DEVICE_INFO;PA_USE_ASIO=0;PA_USE_DS=0;PA_USE_WMME=1;PA_USE_WASAPI=1;PA_USE_WDMKS=1"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				PrecompiledHeaderFile="$(PlatformName)\$(ConfigurationName)/portaudio.pch"
+				AssemblerListingLocation="$(PlatformName)\$(ConfigurationName)\"
+				ObjectFile="$(PlatformName)\$(ConfigurationName)\"
+				ProgramDataBaseFileName="$(PlatformName)\$(ConfigurationName)\"
+				WarningLevel="3"
+				SuppressStartupBanner="true"
+				DebugInformationFormat="4"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="_DEBUG"
+				Culture="1033"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies=""
+				OutputFile="$(PlatformName)\$(ConfigurationName)\portaudio_x86.dll"
+				LinkIncremental="2"
+				SuppressStartupBanner="true"
+				ModuleDefinitionFile=".\portaudio.def"
+				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(PlatformName)\$(ConfigurationName)\portaudio_x86.pdb"
+				ImportLibrary="$(PlatformName)\$(ConfigurationName)\portaudio_x86.lib"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+				SuppressStartupBanner="true"
+				OutputFile="$(PlatformName)\$(ConfigurationName)\portaudio.bsc"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Debug|x64"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="2"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				PreprocessorDefinitions="_DEBUG"
+				MkTypLibCompatible="true"
+				SuppressStartupBanner="true"
+				TargetEnvironment="3"
+				TypeLibraryName=".\Debug_x86/portaudio.tlb"
+				HeaderFileName=""
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\..\src\common,..\..\include,.\,..\..\src\os\win"
+				PreprocessorDefinitions="_WIN64;_DEBUG;_USRDLL;PA_ENABLE_DEBUG_OUTPUT;_CRT_SECURE_NO_DEPRECATE;PAWIN_USE_WDMKS_DEVICE_INFO;PA_USE_ASIO=0;PA_USE_DS=0;PA_USE_WMME=1;PA_USE_WASAPI=1;PA_USE_WDMKS=1"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				PrecompiledHeaderFile="$(PlatformName)\$(ConfigurationName)\portaudio.pch"
+				AssemblerListingLocation="$(PlatformName)\$(ConfigurationName)\"
+				ObjectFile="$(PlatformName)\$(ConfigurationName)\"
+				ProgramDataBaseFileName="$(PlatformName)\$(ConfigurationName)\"
+				WarningLevel="3"
+				SuppressStartupBanner="true"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="_DEBUG"
+				Culture="1033"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies=""
+				OutputFile="$(PlatformName)\$(ConfigurationName)\portaudio_x64.dll"
+				LinkIncremental="2"
+				SuppressStartupBanner="true"
+				ModuleDefinitionFile=".\portaudio.def"
+				GenerateDebugInformation="true"
+				ProgramDatabaseFile="$(PlatformName)\$(ConfigurationName)/portaudio_x64.pdb"
+				ImportLibrary="$(PlatformName)\$(ConfigurationName)\portaudio_x64.lib"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+				SuppressStartupBanner="true"
+				OutputFile="$(PlatformName)\$(ConfigurationName)/portaudio_x64.bsc"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="ReleaseMinDependency|Win32"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="2"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				PreprocessorDefinitions="NDEBUG"
+				MkTypLibCompatible="true"
+				SuppressStartupBanner="true"
+				TargetEnvironment="1"
+				TypeLibraryName=".\Release_x86/portaudio.tlb"
+				HeaderFileName=""
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				InlineFunctionExpansion="1"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="..\..\src\common;..\..\include;.\;..\..\src\os\win"
+				PreprocessorDefinitions="WIN32;NDEBUG;_USRDLL;PA_ENABLE_DEBUG_OUTPUT;_CRT_SECURE_NO_DEPRECATE;PAWIN_USE_WDMKS_DEVICE_INFO;PA_USE_ASIO=0;PA_USE_DS=0;PA_USE_WMME=1;PA_USE_WASAPI=1;PA_USE_WDMKS=1"
+				StringPooling="true"
+				RuntimeLibrary="0"
+				EnableFunctionLevelLinking="true"
+				PrecompiledHeaderFile="$(PlatformName)\$(ConfigurationName)/portaudio.pch"
+				AssemblerListingLocation="$(PlatformName)\$(ConfigurationName)\"
+				ObjectFile="$(PlatformName)\$(ConfigurationName)\"
+				ProgramDataBaseFileName="$(PlatformName)\$(ConfigurationName)\"
+				WarningLevel="3"
+				SuppressStartupBanner="true"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="NDEBUG"
+				Culture="1033"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="ksuser.lib"
+				OutputFile="$(PlatformName)\$(ConfigurationName)\portaudio_x86.dll"
+				LinkIncremental="1"
+				SuppressStartupBanner="true"
+				AdditionalLibraryDirectories=""
+				ModuleDefinitionFile=".\portaudio.def"
+				ProgramDatabaseFile="$(PlatformName)\$(ConfigurationName)\portaudio_x86.pdb"
+				ImportLibrary="$(PlatformName)\$(ConfigurationName)\portaudio_x86.lib"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+				SuppressStartupBanner="true"
+				OutputFile="$(PlatformName)\$(ConfigurationName)\portaudio.bsc"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="ReleaseMinDependency|x64"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="2"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				PreprocessorDefinitions="NDEBUG"
+				MkTypLibCompatible="true"
+				SuppressStartupBanner="true"
+				TargetEnvironment="3"
+				TypeLibraryName=".\Release_x86/portaudio.tlb"
+				HeaderFileName=""
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				InlineFunctionExpansion="1"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="..\..\src\common;..\..\include;.\;..\..\src\os\win"
+				PreprocessorDefinitions="_WIN64;NDEBUG;_USRDLL;PA_ENABLE_DEBUG_OUTPUT;_CRT_SECURE_NO_DEPRECATE;PAWIN_USE_WDMKS_DEVICE_INFO;PA_USE_ASIO=0;PA_USE_DS=0;PA_USE_WMME=1;PA_USE_WASAPI=1;PA_USE_WDMKS=1"
+				StringPooling="true"
+				RuntimeLibrary="0"
+				EnableFunctionLevelLinking="true"
+				PrecompiledHeaderFile="$(PlatformName)\$(ConfigurationName)\portaudio.pch"
+				AssemblerListingLocation="$(PlatformName)\$(ConfigurationName)\"
+				ObjectFile="$(PlatformName)\$(ConfigurationName)\"
+				ProgramDataBaseFileName="$(PlatformName)\$(ConfigurationName)\"
+				WarningLevel="3"
+				SuppressStartupBanner="true"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="NDEBUG"
+				Culture="1033"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="ksuser.lib"
+				OutputFile="$(PlatformName)\$(ConfigurationName)\portaudio_x64.dll"
+				LinkIncremental="1"
+				SuppressStartupBanner="true"
+				AdditionalLibraryDirectories=""
+				ModuleDefinitionFile=".\portaudio.def"
+				ProgramDatabaseFile="$(PlatformName)\$(ConfigurationName)/portaudio_x64.pdb"
+				ImportLibrary="$(PlatformName)\$(ConfigurationName)/portaudio_x64.lib"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+				SuppressStartupBanner="true"
+				OutputFile="$(PlatformName)\$(ConfigurationName)\portaudio_x64.bsc"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+			>
+			<Filter
+				Name="common"
+				>
+				<File
+					RelativePath="..\..\src\common\pa_allocation.c"
+					>
+					<FileConfiguration
+						Name="Release|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|x64"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Debug|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Debug|x64"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="ReleaseMinDependency|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="ReleaseMinDependency|x64"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+				</File>
+				<File
+					RelativePath="..\..\src\common\pa_converters.c"
+					>
+					<FileConfiguration
+						Name="Release|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|x64"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Debug|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Debug|x64"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="ReleaseMinDependency|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="ReleaseMinDependency|x64"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+				</File>
+				<File
+					RelativePath="..\..\src\common\pa_cpuload.c"
+					>
+					<FileConfiguration
+						Name="Release|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|x64"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Debug|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Debug|x64"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="ReleaseMinDependency|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="ReleaseMinDependency|x64"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+				</File>
+				<File
+					RelativePath="..\..\src\common\pa_debugprint.c"
+					>
+					<FileConfiguration
+						Name="Release|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|x64"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Debug|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Debug|x64"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="ReleaseMinDependency|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="ReleaseMinDependency|x64"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+				</File>
+				<File
+					RelativePath="..\..\src\common\pa_dither.c"
+					>
+					<FileConfiguration
+						Name="Release|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|x64"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Debug|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Debug|x64"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="ReleaseMinDependency|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="ReleaseMinDependency|x64"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+				</File>
+				<File
+					RelativePath="..\..\src\common\pa_front.c"
+					>
+					<FileConfiguration
+						Name="Release|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|x64"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Debug|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Debug|x64"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="ReleaseMinDependency|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="ReleaseMinDependency|x64"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+				</File>
+				<File
+					RelativePath="..\..\src\hostapi\skeleton\pa_hostapi_skeleton.c"
+					>
+					<FileConfiguration
+						Name="Release|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|x64"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Debug|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Debug|x64"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="ReleaseMinDependency|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="ReleaseMinDependency|x64"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+				</File>
+				<File
+					RelativePath="..\..\src\common\pa_process.c"
+					>
+					<FileConfiguration
+						Name="Release|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|x64"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Debug|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Debug|x64"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="ReleaseMinDependency|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="ReleaseMinDependency|x64"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+				</File>
+				<File
+					RelativePath="..\..\src\common\pa_ringbuffer.c"
+					>
+					<FileConfiguration
+						Name="Release|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|x64"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Debug|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Debug|x64"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="ReleaseMinDependency|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="ReleaseMinDependency|x64"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+				</File>
+				<File
+					RelativePath="..\..\src\common\pa_stream.c"
+					>
+					<FileConfiguration
+						Name="Release|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|x64"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Debug|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Debug|x64"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="ReleaseMinDependency|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="ReleaseMinDependency|x64"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+				</File>
+				<File
+					RelativePath="..\..\src\common\pa_trace.c"
+					>
+					<FileConfiguration
+						Name="Release|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|x64"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Debug|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Debug|x64"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="ReleaseMinDependency|Win32"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="ReleaseMinDependency|x64"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+							AdditionalIncludeDirectories=""
+							PreprocessorDefinitions=""
+						/>
+					</FileConfiguration>
+				</File>
+			</Filter>
+			<Filter
+				Name="hostapi"
+				>
+				<Filter
+					Name="ASIO"
+					>
+					<File
+						RelativePath="..\..\src\hostapi\asio\pa_asio.cpp"
+						>
+						<FileConfiguration
+							Name="Release|Win32"
+							>
+							<Tool
+								Name="VCCLCompilerTool"
+								AdditionalIncludeDirectories="..\..\src\hostapi\asio\ASIOSDK\host;..\..\src\hostapi\asio\ASIOSDK\host\pc;..\..\src\hostapi\asio\ASIOSDK\common"
+								PreprocessorDefinitions=""
+							/>
+						</FileConfiguration>
+						<FileConfiguration
+							Name="Release|x64"
+							>
+							<Tool
+								Name="VCCLCompilerTool"
+								AdditionalIncludeDirectories="..\..\src\hostapi\asio\ASIOSDK\host;..\..\src\hostapi\asio\ASIOSDK\host\pc;..\..\src\hostapi\asio\ASIOSDK\common"
+								PreprocessorDefinitions=""
+							/>
+						</FileConfiguration>
+						<FileConfiguration
+							Name="Debug|Win32"
+							>
+							<Tool
+								Name="VCCLCompilerTool"
+								AdditionalIncludeDirectories="..\..\src\hostapi\asio\ASIOSDK\host;..\..\src\hostapi\asio\ASIOSDK\host\pc;..\..\src\hostapi\asio\ASIOSDK\common"
+								PreprocessorDefinitions=""
+							/>
+						</FileConfiguration>
+						<FileConfiguration
+							Name="Debug|x64"
+							>
+							<Tool
+								Name="VCCLCompilerTool"
+								AdditionalIncludeDirectories="..\..\src\hostapi\asio\ASIOSDK\host;..\..\src\hostapi\asio\ASIOSDK\host\pc;..\..\src\hostapi\asio\ASIOSDK\common"
+								PreprocessorDefinitions=""
+							/>
+						</FileConfiguration>
+						<FileConfiguration
+							Name="ReleaseMinDependency|Win32"
+							>
+							<Tool
+								Name="VCCLCompilerTool"
+								AdditionalIncludeDirectories="..\..\src\hostapi\asio\ASIOSDK\host;..\..\src\hostapi\asio\ASIOSDK\host\pc;..\..\src\hostapi\asio\ASIOSDK\common"
+								PreprocessorDefinitions=""
+							/>
+						</FileConfiguration>
+						<FileConfiguration
+							Name="ReleaseMinDependency|x64"
+							>
+							<Tool
+								Name="VCCLCompilerTool"
+								AdditionalIncludeDirectories="..\..\src\hostapi\asio\ASIOSDK\host;..\..\src\hostapi\asio\ASIOSDK\host\pc;..\..\src\hostapi\asio\ASIOSDK\common"
+								PreprocessorDefinitions=""
+							/>
+						</FileConfiguration>
+					</File>
+					<Filter
+						Name="ASIOSDK"
+						>
+						<File
+							RelativePath="..\..\src\hostapi\asio\ASIOSDK\common\asio.cpp"
+							>
+							<FileConfiguration
+								Name="Release|Win32"
+								>
+								<Tool
+									Name="VCCLCompilerTool"
+									AdditionalIncludeDirectories="..\..\src\hostapi\asio\ASIOSDK\host;..\..\src\hostapi\asio\ASIOSDK\host\pc;..\..\src\hostapi\asio\ASIOSDK\common"
+									PreprocessorDefinitions=""
+								/>
+							</FileConfiguration>
+							<FileConfiguration
+								Name="Release|x64"
+								>
+								<Tool
+									Name="VCCLCompilerTool"
+									AdditionalIncludeDirectories="..\..\src\hostapi\asio\ASIOSDK\host;..\..\src\hostapi\asio\ASIOSDK\host\pc;..\..\src\hostapi\asio\ASIOSDK\common"
+									PreprocessorDefinitions=""
+								/>
+							</FileConfiguration>
+							<FileConfiguration
+								Name="Debug|Win32"
+								>
+								<Tool
+									Name="VCCLCompilerTool"
+									AdditionalIncludeDirectories="..\..\src\hostapi\asio\ASIOSDK\host;..\..\src\hostapi\asio\ASIOSDK\host\pc;..\..\src\hostapi\asio\ASIOSDK\common"
+									PreprocessorDefinitions=""
+								/>
+							</FileConfiguration>
+							<FileConfiguration
+								Name="Debug|x64"
+								>
+								<Tool
+									Name="VCCLCompilerTool"
+									AdditionalIncludeDirectories="..\..\src\hostapi\asio\ASIOSDK\host;..\..\src\hostapi\asio\ASIOSDK\host\pc;..\..\src\hostapi\asio\ASIOSDK\common"
+									PreprocessorDefinitions=""
+								/>
+							</FileConfiguration>
+							<FileConfiguration
+								Name="ReleaseMinDependency|Win32"
+								>
+								<Tool
+									Name="VCCLCompilerTool"
+									AdditionalIncludeDirectories="..\..\src\hostapi\asio\ASIOSDK\host;..\..\src\hostapi\asio\ASIOSDK\host\pc;..\..\src\hostapi\asio\ASIOSDK\common"
+									PreprocessorDefinitions=""
+								/>
+							</FileConfiguration>
+							<FileConfiguration
+								Name="ReleaseMinDependency|x64"
+								>
+								<Tool
+									Name="VCCLCompilerTool"
+									AdditionalIncludeDirectories="..\..\src\hostapi\asio\ASIOSDK\host;..\..\src\hostapi\asio\ASIOSDK\host\pc;..\..\src\hostapi\asio\ASIOSDK\common"
+									PreprocessorDefinitions=""
+								/>
+							</FileConfiguration>
+						</File>
+						<File
+							RelativePath="..\..\src\hostapi\asio\ASIOSDK\host\asiodrivers.cpp"
+							>
+							<FileConfiguration
+								Name="Release|Win32"
+								>
+								<Tool
+									Name="VCCLCompilerTool"
+									AdditionalIncludeDirectories="..\..\src\hostapi\asio\ASIOSDK\host;..\..\src\hostapi\asio\ASIOSDK\host\pc;..\..\src\hostapi\asio\ASIOSDK\common"
+									PreprocessorDefinitions=""
+								/>
+							</FileConfiguration>
+							<FileConfiguration
+								Name="Release|x64"
+								>
+								<Tool
+									Name="VCCLCompilerTool"
+									AdditionalIncludeDirectories="..\..\src\hostapi\asio\ASIOSDK\host;..\..\src\hostapi\asio\ASIOSDK\host\pc;..\..\src\hostapi\asio\ASIOSDK\common"
+									PreprocessorDefinitions=""
+								/>
+							</FileConfiguration>
+							<FileConfiguration
+								Name="Debug|Win32"
+								>
+								<Tool
+									Name="VCCLCompilerTool"
+									AdditionalIncludeDirectories="..\..\src\hostapi\asio\ASIOSDK\host;..\..\src\hostapi\asio\ASIOSDK\host\pc;..\..\src\hostapi\asio\ASIOSDK\common"
+									PreprocessorDefinitions=""
+								/>
+							</FileConfiguration>
+							<FileConfiguration
+								Name="Debug|x64"
+								>
+								<Tool
+									Name="VCCLCompilerTool"
+									AdditionalIncludeDirectories="..\..\src\hostapi\asio\ASIOSDK\host;..\..\src\hostapi\asio\ASIOSDK\host\pc;..\..\src\hostapi\asio\ASIOSDK\common"
+									PreprocessorDefinitions=""
+								/>
+							</FileConfiguration>
+							<FileConfiguration
+								Name="ReleaseMinDependency|Win32"
+								>
+								<Tool
+									Name="VCCLCompilerTool"
+									AdditionalIncludeDirectories="..\..\src\hostapi\asio\ASIOSDK\host;..\..\src\hostapi\asio\ASIOSDK\host\pc;..\..\src\hostapi\asio\ASIOSDK\common"
+									PreprocessorDefinitions=""
+								/>
+							</FileConfiguration>
+							<FileConfiguration
+								Name="ReleaseMinDependency|x64"
+								>
+								<Tool
+									Name="VCCLCompilerTool"
+									AdditionalIncludeDirectories="..\..\src\hostapi\asio\ASIOSDK\host;..\..\src\hostapi\asio\ASIOSDK\host\pc;..\..\src\hostapi\asio\ASIOSDK\common"
+									PreprocessorDefinitions=""
+								/>
+							</FileConfiguration>
+						</File>
+						<File
+							RelativePath="..\..\src\hostapi\asio\ASIOSDK\host\pc\asiolist.cpp"
+							>
+							<FileConfiguration
+								Name="Release|Win32"
+								>
+								<Tool
+									Name="VCCLCompilerTool"
+									AdditionalIncludeDirectories="..\..\src\hostapi\asio\ASIOSDK\host;..\..\src\hostapi\asio\ASIOSDK\host\pc;..\..\src\hostapi\asio\ASIOSDK\common"
+									PreprocessorDefinitions=""
+								/>
+							</FileConfiguration>
+							<FileConfiguration
+								Name="Release|x64"
+								>
+								<Tool
+									Name="VCCLCompilerTool"
+									AdditionalIncludeDirectories="..\..\src\hostapi\asio\ASIOSDK\host;..\..\src\hostapi\asio\ASIOSDK\host\pc;..\..\src\hostapi\asio\ASIOSDK\common"
+									PreprocessorDefinitions=""
+								/>
+							</FileConfiguration>
+							<FileConfiguration
+								Name="Debug|Win32"
+								>
+								<Tool
+									Name="VCCLCompilerTool"
+									AdditionalIncludeDirectories="..\..\src\hostapi\asio\ASIOSDK\host;..\..\src\hostapi\asio\ASIOSDK\host\pc;..\..\src\hostapi\asio\ASIOSDK\common"
+									PreprocessorDefinitions=""
+								/>
+							</FileConfiguration>
+							<FileConfiguration
+								Name="Debug|x64"
+								>
+								<Tool
+									Name="VCCLCompilerTool"
+									AdditionalIncludeDirectories="..\..\src\hostapi\asio\ASIOSDK\host;..\..\src\hostapi\asio\ASIOSDK\host\pc;..\..\src\hostapi\asio\ASIOSDK\common"
+									PreprocessorDefinitions=""
+								/>
+							</FileConfiguration>
+							<FileConfiguration
+								Name="ReleaseMinDependency|Win32"
+								>
+								<Tool
+									Name="VCCLCompilerTool"
+									AdditionalIncludeDirectories="..\..\src\hostapi\asio\ASIOSDK\host;..\..\src\hostapi\asio\ASIOSDK\host\pc;..\..\src\hostapi\asio\ASIOSDK\common"
+									PreprocessorDefinitions=""
+								/>
+							</FileConfiguration>
+							<FileConfiguration
+								Name="ReleaseMinDependency|x64"
+								>
+								<Tool
+									Name="VCCLCompilerTool"
+									AdditionalIncludeDirectories="..\..\src\hostapi\asio\ASIOSDK\host;..\..\src\hostapi\asio\ASIOSDK\host\pc;..\..\src\hostapi\asio\ASIOSDK\common"
+									PreprocessorDefinitions=""
+								/>
+							</FileConfiguration>
+						</File>
+					</Filter>
+				</Filter>
+				<Filter
+					Name="dsound"
+					>
+					<File
+						RelativePath="..\..\src\hostapi\dsound\pa_win_ds.c"
+						>
+						<FileConfiguration
+							Name="Release|Win32"
+							>
+							<Tool
+								Name="VCCLCompilerTool"
+								AdditionalIncludeDirectories=""
+								PreprocessorDefinitions=""
+							/>
+						</FileConfiguration>
+						<FileConfiguration
+							Name="Release|x64"
+							>
+							<Tool
+								Name="VCCLCompilerTool"
+								AdditionalIncludeDirectories=""
+								PreprocessorDefinitions=""
+							/>
+						</FileConfiguration>
+						<FileConfiguration
+							Name="Debug|Win32"
+							>
+							<Tool
+								Name="VCCLCompilerTool"
+								AdditionalIncludeDirectories=""
+								PreprocessorDefinitions=""
+							/>
+						</FileConfiguration>
+						<FileConfiguration
+							Name="Debug|x64"
+							>
+							<Tool
+								Name="VCCLCompilerTool"
+								AdditionalIncludeDirectories=""
+								PreprocessorDefinitions=""
+							/>
+						</FileConfiguration>
+						<FileConfiguration
+							Name="ReleaseMinDependency|Win32"
+							>
+							<Tool
+								Name="VCCLCompilerTool"
+								AdditionalIncludeDirectories=""
+								PreprocessorDefinitions=""
+							/>
+						</FileConfiguration>
+						<FileConfiguration
+							Name="ReleaseMinDependency|x64"
+							>
+							<Tool
+								Name="VCCLCompilerTool"
+								AdditionalIncludeDirectories=""
+								PreprocessorDefinitions=""
+							/>
+						</FileConfiguration>
+					</File>
+					<File
+						RelativePath="..\..\src\hostapi\dsound\pa_win_ds_dynlink.c"
+						>
+						<FileConfiguration
+							Name="Release|Win32"
+							>
+							<Tool
+								Name="VCCLCompilerTool"
+								AdditionalIncludeDirectories=""
+								PreprocessorDefinitions=""
+							/>
+						</FileConfiguration>
+						<FileConfiguration
+							Name="Release|x64"
+							>
+							<Tool
+								Name="VCCLCompilerTool"
+								AdditionalIncludeDirectories=""
+								PreprocessorDefinitions=""
+							/>
+						</FileConfiguration>
+						<FileConfiguration
+							Name="Debug|Win32"
+							>
+							<Tool
+								Name="VCCLCompilerTool"
+								AdditionalIncludeDirectories=""
+								PreprocessorDefinitions=""
+							/>
+						</FileConfiguration>
+						<FileConfiguration
+							Name="Debug|x64"
+							>
+							<Tool
+								Name="VCCLCompilerTool"
+								AdditionalIncludeDirectories=""
+								PreprocessorDefinitions=""
+							/>
+						</FileConfiguration>
+						<FileConfiguration
+							Name="ReleaseMinDependency|Win32"
+							>
+							<Tool
+								Name="VCCLCompilerTool"
+								AdditionalIncludeDirectories=""
+								PreprocessorDefinitions=""
+							/>
+						</FileConfiguration>
+						<FileConfiguration
+							Name="ReleaseMinDependency|x64"
+							>
+							<Tool
+								Name="VCCLCompilerTool"
+								AdditionalIncludeDirectories=""
+								PreprocessorDefinitions=""
+							/>
+						</FileConfiguration>
+					</File>
+				</Filter>
+				<Filter
+					Name="wmme"
+					>
+					<File
+						RelativePath="..\..\src\hostapi\wmme\pa_win_wmme.c"
+						>
+						<FileConfiguration
+							Name="Release|Win32"
+							>
+							<Tool
+								Name="VCCLCompilerTool"
+								AdditionalIncludeDirectories=""
+								PreprocessorDefinitions=""
+							/>
+						</FileConfiguration>
+						<FileConfiguration
+							Name="Release|x64"
+							>
+							<Tool
+								Name="VCCLCompilerTool"
+								AdditionalIncludeDirectories=""
+								PreprocessorDefinitions=""
+							/>
+						</FileConfiguration>
+						<FileConfiguration
+							Name="Debug|Win32"
+							>
+							<Tool
+								Name="VCCLCompilerTool"
+								AdditionalIncludeDirectories=""
+								PreprocessorDefinitions=""
+							/>
+						</FileConfiguration>
+						<FileConfiguration
+							Name="Debug|x64"
+							>
+							<Tool
+								Name="VCCLCompilerTool"
+								AdditionalIncludeDirectories=""
+								PreprocessorDefinitions=""
+							/>
+						</FileConfiguration>
+						<FileConfiguration
+							Name="ReleaseMinDependency|Win32"
+							>
+							<Tool
+								Name="VCCLCompilerTool"
+								AdditionalIncludeDirectories=""
+								PreprocessorDefinitions=""
+							/>
+						</FileConfiguration>
+						<FileConfiguration
+							Name="ReleaseMinDependency|x64"
+							>
+							<Tool
+								Name="VCCLCompilerTool"
+								AdditionalIncludeDirectories=""
+								PreprocessorDefinitions=""
+							/>
+						</FileConfiguration>
+					</File>
+				</Filter>
+				<Filter
+					Name="wasapi"
+					>
+					<File
+						RelativePath="..\..\src\hostapi\wasapi\pa_win_wasapi.c"
+						>
+					</File>
+				</Filter>
+				<Filter
+					Name="wdmks"
+					>
+					<File
+						RelativePath="..\..\src\hostapi\wdmks\pa_win_wdmks.c"
+						>
+					</File>
+				</Filter>
+			</Filter>
+			<Filter
+				Name="os"
+				>
+				<Filter
+					Name="win"
+					>
+					<File
+						RelativePath="..\..\src\os\win\pa_win_coinitialize.c"
+						>
+					</File>
+					<File
+						RelativePath="..\..\src\os\win\pa_win_hostapis.c"
+						>
+						<FileConfiguration
+							Name="Release|Win32"
+							>
+							<Tool
+								Name="VCCLCompilerTool"
+								AdditionalIncludeDirectories=""
+								PreprocessorDefinitions=""
+							/>
+						</FileConfiguration>
+						<FileConfiguration
+							Name="Release|x64"
+							>
+							<Tool
+								Name="VCCLCompilerTool"
+								AdditionalIncludeDirectories=""
+								PreprocessorDefinitions=""
+							/>
+						</FileConfiguration>
+						<FileConfiguration
+							Name="Debug|Win32"
+							>
+							<Tool
+								Name="VCCLCompilerTool"
+								AdditionalIncludeDirectories=""
+								PreprocessorDefinitions=""
+							/>
+						</FileConfiguration>
+						<FileConfiguration
+							Name="Debug|x64"
+							>
+							<Tool
+								Name="VCCLCompilerTool"
+								AdditionalIncludeDirectories=""
+								PreprocessorDefinitions=""
+							/>
+						</FileConfiguration>
+						<FileConfiguration
+							Name="ReleaseMinDependency|Win32"
+							>
+							<Tool
+								Name="VCCLCompilerTool"
+								AdditionalIncludeDirectories=""
+								PreprocessorDefinitions=""
+							/>
+						</FileConfiguration>
+						<FileConfiguration
+							Name="ReleaseMinDependency|x64"
+							>
+							<Tool
+								Name="VCCLCompilerTool"
+								AdditionalIncludeDirectories=""
+								PreprocessorDefinitions=""
+							/>
+						</FileConfiguration>
+					</File>
+					<File
+						RelativePath="..\..\src\os\win\pa_win_util.c"
+						>
+						<FileConfiguration
+							Name="Release|Win32"
+							>
+							<Tool
+								Name="VCCLCompilerTool"
+								AdditionalIncludeDirectories=""
+								PreprocessorDefinitions=""
+							/>
+						</FileConfiguration>
+						<FileConfiguration
+							Name="Release|x64"
+							>
+							<Tool
+								Name="VCCLCompilerTool"
+								AdditionalIncludeDirectories=""
+								PreprocessorDefinitions=""
+							/>
+						</FileConfiguration>
+						<FileConfiguration
+							Name="Debug|Win32"
+							>
+							<Tool
+								Name="VCCLCompilerTool"
+								AdditionalIncludeDirectories=""
+								PreprocessorDefinitions=""
+							/>
+						</FileConfiguration>
+						<FileConfiguration
+							Name="Debug|x64"
+							>
+							<Tool
+								Name="VCCLCompilerTool"
+								AdditionalIncludeDirectories=""
+								PreprocessorDefinitions=""
+							/>
+						</FileConfiguration>
+						<FileConfiguration
+							Name="ReleaseMinDependency|Win32"
+							>
+							<Tool
+								Name="VCCLCompilerTool"
+								AdditionalIncludeDirectories=""
+								PreprocessorDefinitions=""
+							/>
+						</FileConfiguration>
+						<FileConfiguration
+							Name="ReleaseMinDependency|x64"
+							>
+							<Tool
+								Name="VCCLCompilerTool"
+								AdditionalIncludeDirectories=""
+								PreprocessorDefinitions=""
+							/>
+						</FileConfiguration>
+					</File>
+					<File
+						RelativePath="..\..\src\os\win\pa_win_waveformat.c"
+						>
+					</File>
+					<File
+						RelativePath="..\..\src\os\win\pa_win_wdmks_utils.c"
+						>
+					</File>
+					<File
+						RelativePath="..\..\src\os\win\pa_x86_plain_converters.c"
+						>
+						<FileConfiguration
+							Name="Release|Win32"
+							>
+							<Tool
+								Name="VCCLCompilerTool"
+								AdditionalIncludeDirectories=""
+								PreprocessorDefinitions=""
+							/>
+						</FileConfiguration>
+						<FileConfiguration
+							Name="Release|x64"
+							>
+							<Tool
+								Name="VCCLCompilerTool"
+								AdditionalIncludeDirectories=""
+								PreprocessorDefinitions=""
+							/>
+						</FileConfiguration>
+						<FileConfiguration
+							Name="Debug|Win32"
+							>
+							<Tool
+								Name="VCCLCompilerTool"
+								AdditionalIncludeDirectories=""
+								PreprocessorDefinitions=""
+							/>
+						</FileConfiguration>
+						<FileConfiguration
+							Name="Debug|x64"
+							>
+							<Tool
+								Name="VCCLCompilerTool"
+								AdditionalIncludeDirectories=""
+								PreprocessorDefinitions=""
+							/>
+						</FileConfiguration>
+						<FileConfiguration
+							Name="ReleaseMinDependency|Win32"
+							>
+							<Tool
+								Name="VCCLCompilerTool"
+								AdditionalIncludeDirectories=""
+								PreprocessorDefinitions=""
+							/>
+						</FileConfiguration>
+						<FileConfiguration
+							Name="ReleaseMinDependency|x64"
+							>
+							<Tool
+								Name="VCCLCompilerTool"
+								AdditionalIncludeDirectories=""
+								PreprocessorDefinitions=""
+							/>
+						</FileConfiguration>
+					</File>
+				</Filter>
+			</Filter>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+			>
+			<File
+				RelativePath="portaudio.def"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl"
+			>
+			<File
+				RelativePath="..\..\include\pa_asio.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\include\pa_win_ds.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\include\pa_win_wasapi.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\include\pa_win_waveformat.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\include\pa_win_wmme.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\include\portaudio.h"
+				>
+			</File>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>
diff --git a/clear_gitrevision.sh b/clear_gitrevision.sh
new file mode 100755
index 0000000..b1b087c
--- /dev/null
+++ b/clear_gitrevision.sh
@@ -0,0 +1,12 @@
+#!/bin/bash
+#
+# Clear the Git commit SHA in the include file.
+# This should be run before checking in code to Git.
+#
+revision_filename=src/common/pa_gitrevision.h
+
+# Update the include file with the current GIT revision.
+echo "#define PA_GIT_REVISION unknown" > ${revision_filename}
+
+echo ${revision_filename} now contains
+cat ${revision_filename}
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/FindJack.cmake b/cmake_support/FindJack.cmake
new file mode 100644
index 0000000..96e0b50
--- /dev/null
+++ b/cmake_support/FindJack.cmake
@@ -0,0 +1,41 @@
+# - Try to find jack
+# Once done this will define
+#  JACK_FOUND - System has jack
+#  JACK_INCLUDE_DIRS - The jack include directories
+#  JACK_LIBRARIES - The libraries needed to use jack
+#  JACK_DEFINITIONS - Compiler switches required for using jack
+
+if (JACK_LIBRARIES AND JACK_INCLUDE_DIRS)
+
+	# in cache already
+	set(JACK_FOUND TRUE)
+
+else (JACK_LIBRARIES AND JACK_INCLUDE_DIRS)
+
+	set(JACK_DEFINITIONS "")
+
+	# Look for pkg-config and use it (if available) to find package
+	find_package(PkgConfig QUIET)
+	if (PKG_CONFIG_FOUND)
+		pkg_search_module(JACK QUIET jack)
+	endif (PKG_CONFIG_FOUND)
+
+	if (NOT JACK_FOUND)
+
+		find_path(JACK_INCLUDE_DIR jack/jack.h HINTS ${JACK_INCLUDEDIR} ${JACK_INCLUDE_DIRS} PATH_SUFFIXES jack)
+		find_library(JACK_LIBRARY NAMES jack HINTS ${JACK_LIBDIR} ${JACK_LIBRARY_DIRS})
+
+		set(JACK_LIBRARIES    ${JACK_LIBRARY})
+		set(JACK_INCLUDE_DIRS ${JACK_INCLUDE_DIR})
+
+		include(FindPackageHandleStandardArgs)
+
+		# Set JACK_FOUND if the library and include paths were found
+		find_package_handle_standard_args(jack DEFAULT_MSG JACK_LIBRARY JACK_INCLUDE_DIR)
+
+		# Don't show include/library paths in cmake GUI
+		mark_as_advanced(JACK_INCLUDE_DIR JACK_LIBRARY)
+
+	endif (NOT JACK_FOUND)
+
+endif (JACK_LIBRARIES AND JACK_INCLUDE_DIRS)
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/portaudio-2.0.pc.in b/cmake_support/portaudio-2.0.pc.in
new file mode 100644
index 0000000..738803d
--- /dev/null
+++ b/cmake_support/portaudio-2.0.pc.in
@@ -0,0 +1,12 @@
+prefix=@CMAKE_INSTALL_PREFIX@
+exec_prefix=${prefix}
+libdir=${prefix}/lib
+includedir=${prefix}/include
+
+Name: PortAudio
+Description: Portable audio I/O
+Requires:
+Version: @PA_PKGCONFIG_VERSION@
+
+Libs: -L${libdir} -lportaudio @PA_PKGCONFIG_LDFLAGS@
+Cflags: -I${includedir} @PA_PKGCONFIG_CFLAGS@
diff --git a/cmake_support/template_portaudio.def b/cmake_support/template_portaudio.def
index 0e06d0a..d05da59 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
- at DEF_EXCLUDE_ASIO_SYMBOLS@PaAsio_GetAvailableBufferSizes      @50
- at DEF_EXCLUDE_ASIO_SYMBOLS@PaAsio_ShowControlPanel             @51
-PaUtil_InitializeX86PlainConverters @52
- at DEF_EXCLUDE_ASIO_SYMBOLS@PaAsio_GetInputChannelName          @53
- at DEF_EXCLUDE_ASIO_SYMBOLS@PaAsio_GetOutputChannelName         @54
-PaUtil_SetDebugPrintFunction        @55
- at DEF_EXCLUDE_WASAPI_SYMBOLS@PaWasapi_GetDeviceDefaultFormat     @56
- at DEF_EXCLUDE_WASAPI_SYMBOLS@PaWasapi_GetDeviceRole              @57
- at DEF_EXCLUDE_WASAPI_SYMBOLS@PaWasapi_ThreadPriorityBoost        @58
- at DEF_EXCLUDE_WASAPI_SYMBOLS@PaWasapi_ThreadPriorityRevert       @59
- at DEF_EXCLUDE_WASAPI_SYMBOLS@PaWasapi_GetFramesPerHostBuffer     @60
- at DEF_EXCLUDE_WASAPI_SYMBOLS@PaWasapi_GetJackDescription         @61
- at 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
+ at DEF_EXCLUDE_ASIO_SYMBOLS@PaAsio_GetAvailableBufferSizes      @50
+ at DEF_EXCLUDE_ASIO_SYMBOLS@PaAsio_ShowControlPanel             @51
+ at DEF_EXCLUDE_X86_PLAIN_CONVERTERS@PaUtil_InitializeX86PlainConverters @52
+ at DEF_EXCLUDE_ASIO_SYMBOLS@PaAsio_GetInputChannelName          @53
+ at DEF_EXCLUDE_ASIO_SYMBOLS@PaAsio_GetOutputChannelName         @54
+PaUtil_SetDebugPrintFunction        @55
+ at DEF_EXCLUDE_WASAPI_SYMBOLS@PaWasapi_GetDeviceDefaultFormat     @56
+ at DEF_EXCLUDE_WASAPI_SYMBOLS@PaWasapi_GetDeviceRole              @57
+ at DEF_EXCLUDE_WASAPI_SYMBOLS@PaWasapi_ThreadPriorityBoost        @58
+ at DEF_EXCLUDE_WASAPI_SYMBOLS@PaWasapi_ThreadPriorityRevert       @59
+ at DEF_EXCLUDE_WASAPI_SYMBOLS@PaWasapi_GetFramesPerHostBuffer     @60
+ at DEF_EXCLUDE_WASAPI_SYMBOLS@PaWasapi_GetJackDescription         @61
+ at DEF_EXCLUDE_WASAPI_SYMBOLS@PaWasapi_GetJackCount               @62
diff --git a/config.guess b/config.guess
index 40eaed4..b79252d 100755
--- a/config.guess
+++ b/config.guess
@@ -1,14 +1,12 @@
 #! /bin/sh
 # Attempt to guess a canonical system name.
-#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
-#   2011 Free Software Foundation, Inc.
+#   Copyright 1992-2013 Free Software Foundation, Inc.
 
-timestamp='2011-05-11'
+timestamp='2013-06-10'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
+# the Free Software Foundation; either version 3 of the License, or
 # (at your option) any later version.
 #
 # This program is distributed in the hope that it will be useful, but
@@ -17,26 +15,22 @@ timestamp='2011-05-11'
 # General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
-# 02110-1301, USA.
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
 #
 # As a special exception to the GNU General Public License, if you
 # distribute this file as part of a program that contains a
 # configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-
-# Originally written by Per Bothner.  Please send patches (context
-# diff format) to <config-patches at gnu.org> and include a ChangeLog
-# entry.
+# the same distribution terms that you use for the rest of that
+# program.  This Exception is an additional permission under section 7
+# of the GNU General Public License, version 3 ("GPLv3").
 #
-# This script attempts to guess a canonical system name similar to
-# config.sub.  If it succeeds, it prints the system name on stdout, and
-# exits with 0.  Otherwise, it exits with 1.
+# Originally written by Per Bothner.
 #
 # You can get the latest version of this script from:
 # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
+#
+# Please send patches with a ChangeLog entry to config-patches at gnu.org.
+
 
 me=`echo "$0" | sed -e 's,.*/,,'`
 
@@ -56,9 +50,7 @@ version="\
 GNU config.guess ($timestamp)
 
 Originally written by Per Bothner.
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free
-Software Foundation, Inc.
+Copyright 1992-2013 Free Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -140,12 +132,33 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
 UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
 UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
 
+case "${UNAME_SYSTEM}" in
+Linux|GNU|GNU/*)
+	# If the system lacks a compiler, then just pick glibc.
+	# We could probably try harder.
+	LIBC=gnu
+
+	eval $set_cc_for_build
+	cat <<-EOF > $dummy.c
+	#include <features.h>
+	#if defined(__UCLIBC__)
+	LIBC=uclibc
+	#elif defined(__dietlibc__)
+	LIBC=dietlibc
+	#else
+	LIBC=gnu
+	#endif
+	EOF
+	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
+	;;
+esac
+
 # Note: order is significant - the case branches are not exclusive.
 
 case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
     *:NetBSD:*:*)
 	# NetBSD (nbsd) targets should (where applicable) match one or
-	# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
+	# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
 	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
 	# switched to ELF, *-*-netbsd* would select the old
 	# object file format.  This provides both forward
@@ -202,6 +215,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
 	echo "${machine}-${os}${release}"
 	exit ;;
+    *:Bitrig:*:*)
+	UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
+	echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE}
+	exit ;;
     *:OpenBSD:*:*)
 	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
 	echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
@@ -304,7 +321,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
     arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
 	echo arm-acorn-riscix${UNAME_RELEASE}
 	exit ;;
-    arm:riscos:*:*|arm:RISCOS:*:*)
+    arm*:riscos:*:*|arm*:RISCOS:*:*)
 	echo arm-unknown-riscos
 	exit ;;
     SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
@@ -792,21 +809,26 @@ EOF
 	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
 	exit ;;
     *:FreeBSD:*:*)
-	case ${UNAME_MACHINE} in
-	    pc98)
-		echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+	UNAME_PROCESSOR=`/usr/bin/uname -p`
+	case ${UNAME_PROCESSOR} in
 	    amd64)
 		echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
 	    *)
-		echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+		echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
 	esac
 	exit ;;
     i*:CYGWIN*:*)
 	echo ${UNAME_MACHINE}-pc-cygwin
 	exit ;;
+    *:MINGW64*:*)
+	echo ${UNAME_MACHINE}-pc-mingw64
+	exit ;;
     *:MINGW*:*)
 	echo ${UNAME_MACHINE}-pc-mingw32
 	exit ;;
+    i*:MSYS*:*)
+	echo ${UNAME_MACHINE}-pc-msys
+	exit ;;
     i*:windows32*:*)
 	# uname -m includes "-pc" on this system.
 	echo ${UNAME_MACHINE}-mingw32
@@ -852,15 +874,22 @@ EOF
 	exit ;;
     *:GNU:*:*)
 	# the GNU system
-	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
 	exit ;;
     *:GNU/*:*:*)
 	# other systems with GNU libc and userland
-	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
+	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
 	exit ;;
     i*86:Minix:*:*)
 	echo ${UNAME_MACHINE}-pc-minix
 	exit ;;
+    aarch64:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
+    aarch64_be:Linux:*:*)
+	UNAME_MACHINE=aarch64_be
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
     alpha:Linux:*:*)
 	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
 	  EV5)   UNAME_MACHINE=alphaev5 ;;
@@ -872,56 +901,54 @@ EOF
 	  EV68*) UNAME_MACHINE=alphaev68 ;;
 	esac
 	objdump --private-headers /bin/sh | grep -q ld.so.1
-	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
-	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
+	if test "$?" = 0 ; then LIBC="gnulibc1" ; fi
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
+    arc:Linux:*:* | arceb:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
     arm*:Linux:*:*)
 	eval $set_cc_for_build
 	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
 	    | grep -q __ARM_EABI__
 	then
-	    echo ${UNAME_MACHINE}-unknown-linux-gnu
+	    echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	else
 	    if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
 		| grep -q __ARM_PCS_VFP
 	    then
-		echo ${UNAME_MACHINE}-unknown-linux-gnueabi
+		echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi
 	    else
-		echo ${UNAME_MACHINE}-unknown-linux-gnueabihf
+		echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf
 	    fi
 	fi
 	exit ;;
     avr32*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
     cris:Linux:*:*)
-	echo cris-axis-linux-gnu
+	echo ${UNAME_MACHINE}-axis-linux-${LIBC}
 	exit ;;
     crisv32:Linux:*:*)
-	echo crisv32-axis-linux-gnu
+	echo ${UNAME_MACHINE}-axis-linux-${LIBC}
 	exit ;;
     frv:Linux:*:*)
-	echo frv-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
+    hexagon:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
     i*86:Linux:*:*)
-	LIBC=gnu
-	eval $set_cc_for_build
-	sed 's/^	//' << EOF >$dummy.c
-	#ifdef __dietlibc__
-	LIBC=dietlibc
-	#endif
-EOF
-	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
-	echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
+	echo ${UNAME_MACHINE}-pc-linux-${LIBC}
 	exit ;;
     ia64:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
     m32r*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
     m68*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
     mips:Linux:*:* | mips64:Linux:*:*)
 	eval $set_cc_for_build
@@ -940,54 +967,63 @@ EOF
 	#endif
 EOF
 	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
-	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
 	;;
+    or1k:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
     or32:Linux:*:*)
-	echo or32-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
     padre:Linux:*:*)
-	echo sparc-unknown-linux-gnu
+	echo sparc-unknown-linux-${LIBC}
 	exit ;;
     parisc64:Linux:*:* | hppa64:Linux:*:*)
-	echo hppa64-unknown-linux-gnu
+	echo hppa64-unknown-linux-${LIBC}
 	exit ;;
     parisc:Linux:*:* | hppa:Linux:*:*)
 	# Look for CPU level
 	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
-	  PA7*) echo hppa1.1-unknown-linux-gnu ;;
-	  PA8*) echo hppa2.0-unknown-linux-gnu ;;
-	  *)    echo hppa-unknown-linux-gnu ;;
+	  PA7*) echo hppa1.1-unknown-linux-${LIBC} ;;
+	  PA8*) echo hppa2.0-unknown-linux-${LIBC} ;;
+	  *)    echo hppa-unknown-linux-${LIBC} ;;
 	esac
 	exit ;;
     ppc64:Linux:*:*)
-	echo powerpc64-unknown-linux-gnu
+	echo powerpc64-unknown-linux-${LIBC}
 	exit ;;
     ppc:Linux:*:*)
-	echo powerpc-unknown-linux-gnu
+	echo powerpc-unknown-linux-${LIBC}
+	exit ;;
+    ppc64le:Linux:*:*)
+	echo powerpc64le-unknown-linux-${LIBC}
+	exit ;;
+    ppcle:Linux:*:*)
+	echo powerpcle-unknown-linux-${LIBC}
 	exit ;;
     s390:Linux:*:* | s390x:Linux:*:*)
-	echo ${UNAME_MACHINE}-ibm-linux
+	echo ${UNAME_MACHINE}-ibm-linux-${LIBC}
 	exit ;;
     sh64*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
     sh*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
     sparc:Linux:*:* | sparc64:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
     tile*:Linux:*:*)
-	echo ${UNAME_MACHINE}-tilera-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
     vax:Linux:*:*)
-	echo ${UNAME_MACHINE}-dec-linux-gnu
+	echo ${UNAME_MACHINE}-dec-linux-${LIBC}
 	exit ;;
     x86_64:Linux:*:*)
-	echo x86_64-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
     xtensa*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
     i*86:DYNIX/ptx:4*:*)
 	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
@@ -1191,6 +1227,9 @@ EOF
     BePC:Haiku:*:*)	# Haiku running on Intel PC compatible.
 	echo i586-pc-haiku
 	exit ;;
+    x86_64:Haiku:*:*)
+	echo x86_64-unknown-haiku
+	exit ;;
     SX-4:SUPER-UX:*:*)
 	echo sx4-nec-superux${UNAME_RELEASE}
 	exit ;;
@@ -1217,19 +1256,21 @@ EOF
 	exit ;;
     *:Darwin:*:*)
 	UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
-	case $UNAME_PROCESSOR in
-	    i386)
-		eval $set_cc_for_build
-		if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
-		  if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
-		      (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
-		      grep IS_64BIT_ARCH >/dev/null
-		  then
-		      UNAME_PROCESSOR="x86_64"
-		  fi
-		fi ;;
-	    unknown) UNAME_PROCESSOR=powerpc ;;
-	esac
+	eval $set_cc_for_build
+	if test "$UNAME_PROCESSOR" = unknown ; then
+	    UNAME_PROCESSOR=powerpc
+	fi
+	if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+	    if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
+		(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+		grep IS_64BIT_ARCH >/dev/null
+	    then
+		case $UNAME_PROCESSOR in
+		    i386) UNAME_PROCESSOR=x86_64 ;;
+		    powerpc) UNAME_PROCESSOR=powerpc64 ;;
+		esac
+	    fi
+	fi
 	echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
 	exit ;;
     *:procnto*:*:* | *:QNX:[0123456789]*:*)
@@ -1246,7 +1287,7 @@ EOF
     NEO-?:NONSTOP_KERNEL:*:*)
 	echo neo-tandem-nsk${UNAME_RELEASE}
 	exit ;;
-    NSE-?:NONSTOP_KERNEL:*:*)
+    NSE-*:NONSTOP_KERNEL:*:*)
 	echo nse-tandem-nsk${UNAME_RELEASE}
 	exit ;;
     NSR-?:NONSTOP_KERNEL:*:*)
@@ -1315,11 +1356,11 @@ EOF
     i*86:AROS:*:*)
 	echo ${UNAME_MACHINE}-pc-aros
 	exit ;;
+    x86_64:VMkernel:*:*)
+	echo ${UNAME_MACHINE}-unknown-esx
+	exit ;;
 esac
 
-#echo '(No uname command or uname output not recognized.)' 1>&2
-#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
-
 eval $set_cc_for_build
 cat >$dummy.c <<EOF
 #ifdef _SEQUENT_
diff --git a/config.sub b/config.sub
index 30fdca8..9633db7 100755
--- a/config.sub
+++ b/config.sub
@@ -1,38 +1,31 @@
 #! /bin/sh
 # Configuration validation subroutine script.
-#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
-#   2011 Free Software Foundation, Inc.
+#   Copyright 1992-2013 Free Software Foundation, Inc.
 
-timestamp='2011-03-23'
+timestamp='2013-08-10'
 
-# This file is (in principle) common to ALL GNU software.
-# The presence of a machine in this file suggests that SOME GNU software
-# can handle that machine.  It does not imply ALL GNU software can.
-#
-# This file is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
 # (at your option) any later version.
 #
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
-# 02110-1301, USA.
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
 #
 # As a special exception to the GNU General Public License, if you
 # distribute this file as part of a program that contains a
 # configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
+# the same distribution terms that you use for the rest of that
+# program.  This Exception is an additional permission under section 7
+# of the GNU General Public License, version 3 ("GPLv3").
 
 
-# Please send patches to <config-patches at gnu.org>.  Submit a context
-# diff and a properly formatted GNU ChangeLog entry.
+# Please send patches with a ChangeLog entry to config-patches at gnu.org.
 #
 # Configuration subroutine to validate and canonicalize a configuration type.
 # Supply the specified configuration type as an argument.
@@ -75,9 +68,7 @@ Report bugs and patches to <config-patches at gnu.org>."
 version="\
 GNU config.sub ($timestamp)
 
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free
-Software Foundation, Inc.
+Copyright 1992-2013 Free Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -125,13 +116,17 @@ esac
 maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
 case $maybe_os in
   nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
-  linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
+  linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
   knetbsd*-gnu* | netbsd*-gnu* | \
   kopensolaris*-gnu* | \
   storm-chaos* | os2-emx* | rtmk-nova*)
     os=-$maybe_os
     basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
     ;;
+  android-linux)
+    os=-linux-android
+    basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown
+    ;;
   *)
     basic_machine=`echo $1 | sed 's/-[^-]*$//'`
     if [ $basic_machine != $1 ]
@@ -154,7 +149,7 @@ case $os in
 	-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
 	-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
 	-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
-	-apple | -axis | -knuth | -cray | -microblaze)
+	-apple | -axis | -knuth | -cray | -microblaze*)
 		os=
 		basic_machine=$1
 		;;
@@ -223,6 +218,12 @@ case $os in
 	-isc*)
 		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
 		;;
+	-lynx*178)
+		os=-lynxos178
+		;;
+	-lynx*5)
+		os=-lynxos5
+		;;
 	-lynx*)
 		os=-lynxos
 		;;
@@ -247,20 +248,27 @@ case $basic_machine in
 	# Some are omitted here because they have special meanings below.
 	1750a | 580 \
 	| a29k \
+	| aarch64 | aarch64_be \
 	| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
 	| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
 	| am33_2.0 \
-	| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
+	| arc | arceb \
+	| arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
+	| avr | avr32 \
+	| be32 | be64 \
 	| bfin \
-	| c4x | clipper \
+	| c4x | c8051 | clipper \
 	| d10v | d30v | dlx | dsp16xx \
+	| epiphany \
 	| fido | fr30 | frv \
 	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+	| hexagon \
 	| i370 | i860 | i960 | ia64 \
 	| ip2k | iq2000 \
+	| le32 | le64 \
 	| lm32 \
 	| m32c | m32r | m32rle | m68000 | m68k | m88k \
-	| maxq | mb | microblaze | mcore | mep | metag \
+	| maxq | mb | microblaze | microblazeel | mcore | mep | metag \
 	| mips | mipsbe | mipseb | mipsel | mipsle \
 	| mips16 \
 	| mips64 | mips64el \
@@ -278,20 +286,21 @@ case $basic_machine in
 	| mipsisa64r2 | mipsisa64r2el \
 	| mipsisa64sb1 | mipsisa64sb1el \
 	| mipsisa64sr71k | mipsisa64sr71kel \
+	| mipsr5900 | mipsr5900el \
 	| mipstx39 | mipstx39el \
 	| mn10200 | mn10300 \
 	| moxie \
 	| mt \
 	| msp430 \
 	| nds32 | nds32le | nds32be \
-	| nios | nios2 \
+	| nios | nios2 | nios2eb | nios2el \
 	| ns16k | ns32k \
 	| open8 \
-	| or32 \
+	| or1k | or32 \
 	| pdp10 | pdp11 | pj | pjl \
 	| powerpc | powerpc64 | powerpc64le | powerpcle \
 	| pyramid \
-	| rx \
+	| rl78 | rx \
 	| score \
 	| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
 	| sh64 | sh64le \
@@ -300,7 +309,7 @@ case $basic_machine in
 	| spu \
 	| tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
 	| ubicom32 \
-	| v850 | v850e \
+	| v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
 	| we32k \
 	| x86 | xc16x | xstormy16 | xtensa \
 	| z8k | z80)
@@ -315,8 +324,7 @@ case $basic_machine in
 	c6x)
 		basic_machine=tic6x-unknown
 		;;
-	m6811 | m68hc11 | m6812 | m68hc12 | picochip)
-		# Motorola 68HC11/12.
+	m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip)
 		basic_machine=$basic_machine-unknown
 		os=-none
 		;;
@@ -329,7 +337,10 @@ case $basic_machine in
 	strongarm | thumb | xscale)
 		basic_machine=arm-unknown
 		;;
-
+	xgate)
+		basic_machine=$basic_machine-unknown
+		os=-none
+		;;
 	xscaleeb)
 		basic_machine=armeb-unknown
 		;;
@@ -352,25 +363,30 @@ case $basic_machine in
 	# Recognize the basic CPU types with company name.
 	580-* \
 	| a29k-* \
+	| aarch64-* | aarch64_be-* \
 	| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
 	| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
-	| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
+	| alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \
 	| arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
 	| avr-* | avr32-* \
+	| be32-* | be64-* \
 	| bfin-* | bs2000-* \
 	| c[123]* | c30-* | [cjt]90-* | c4x-* \
-	| clipper-* | craynv-* | cydra-* \
+	| c8051-* | clipper-* | craynv-* | cydra-* \
 	| d10v-* | d30v-* | dlx-* \
 	| elxsi-* \
 	| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
 	| h8300-* | h8500-* \
 	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
+	| hexagon-* \
 	| i*86-* | i860-* | i960-* | ia64-* \
 	| ip2k-* | iq2000-* \
+	| le32-* | le64-* \
 	| lm32-* \
 	| m32c-* | m32r-* | m32rle-* \
 	| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
-	| m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \
+	| m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
+	| microblaze-* | microblazeel-* \
 	| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
 	| mips16-* \
 	| mips64-* | mips64el-* \
@@ -388,19 +404,20 @@ case $basic_machine in
 	| mipsisa64r2-* | mipsisa64r2el-* \
 	| mipsisa64sb1-* | mipsisa64sb1el-* \
 	| mipsisa64sr71k-* | mipsisa64sr71kel-* \
+	| mipsr5900-* | mipsr5900el-* \
 	| mipstx39-* | mipstx39el-* \
 	| mmix-* \
 	| mt-* \
 	| msp430-* \
 	| nds32-* | nds32le-* | nds32be-* \
-	| nios-* | nios2-* \
+	| nios-* | nios2-* | nios2eb-* | nios2el-* \
 	| none-* | np1-* | ns16k-* | ns32k-* \
 	| open8-* \
 	| orion-* \
 	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
 	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
 	| pyramid-* \
-	| romp-* | rs6000-* | rx-* \
+	| rl78-* | romp-* | rs6000-* | rx-* \
 	| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
 	| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
 	| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
@@ -408,10 +425,11 @@ case $basic_machine in
 	| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
 	| tahoe-* \
 	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
-	| tile-* | tilegx-* \
+	| tile*-* \
 	| tron-* \
 	| ubicom32-* \
-	| v850-* | v850e-* | vax-* \
+	| v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
+	| vax-* \
 	| we32k-* \
 	| x86-* | x86_64-* | xc16x-* | xps100-* \
 	| xstormy16-* | xtensa*-* \
@@ -711,7 +729,6 @@ case $basic_machine in
 	i370-ibm* | ibm*)
 		basic_machine=i370-ibm
 		;;
-# I'm not sure what "Sysv32" means.  Should this be sysv3.2?
 	i*86v32)
 		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
 		os=-sysv32
@@ -769,11 +786,15 @@ case $basic_machine in
 		basic_machine=ns32k-utek
 		os=-sysv
 		;;
-	microblaze)
+	microblaze*)
 		basic_machine=microblaze-xilinx
 		;;
+	mingw64)
+		basic_machine=x86_64-pc
+		os=-mingw64
+		;;
 	mingw32)
-		basic_machine=i386-pc
+		basic_machine=i686-pc
 		os=-mingw32
 		;;
 	mingw32ce)
@@ -808,10 +829,18 @@ case $basic_machine in
 	ms1-*)
 		basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
 		;;
+	msys)
+		basic_machine=i686-pc
+		os=-msys
+		;;
 	mvs)
 		basic_machine=i370-ibm
 		os=-mvs
 		;;
+	nacl)
+		basic_machine=le32-unknown
+		os=-nacl
+		;;
 	ncr3000)
 		basic_machine=i486-ncr
 		os=-sysv4
@@ -992,7 +1021,11 @@ case $basic_machine in
 		basic_machine=i586-unknown
 		os=-pw32
 		;;
-	rdos)
+	rdos | rdos64)
+		basic_machine=x86_64-pc
+		os=-rdos
+		;;
+	rdos32)
 		basic_machine=i386-pc
 		os=-rdos
 		;;
@@ -1120,13 +1153,8 @@ case $basic_machine in
 		basic_machine=t90-cray
 		os=-unicos
 		;;
-	# This must be matched before tile*.
-	tilegx*)
-		basic_machine=tilegx-unknown
-		os=-linux-gnu
-		;;
 	tile*)
-		basic_machine=tile-unknown
+		basic_machine=$basic_machine-unknown
 		os=-linux-gnu
 		;;
 	tx39)
@@ -1324,21 +1352,21 @@ case $os in
 	-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
 	      | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
 	      | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
-	      | -sym* | -kopensolaris* \
+	      | -sym* | -kopensolaris* | -plan9* \
 	      | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
 	      | -aos* | -aros* \
 	      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
 	      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
 	      | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
-	      | -openbsd* | -solidbsd* \
+	      | -bitrig* | -openbsd* | -solidbsd* \
 	      | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
 	      | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
 	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
 	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
 	      | -chorusos* | -chorusrdb* | -cegcc* \
-	      | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
-	      | -mingw32* | -linux-gnu* | -linux-android* \
-	      | -linux-newlib* | -linux-uclibc* \
+	      | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+	      | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
+	      | -linux-newlib* | -linux-musl* | -linux-uclibc* \
 	      | -uxpv* | -beos* | -mpeix* | -udk* \
 	      | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
 	      | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
@@ -1470,9 +1498,6 @@ case $os in
 	-aros*)
 		os=-aros
 		;;
-	-kaos*)
-		os=-kaos
-		;;
 	-zvmoe)
 		os=-zvmoe
 		;;
@@ -1521,6 +1546,12 @@ case $basic_machine in
 	c4x-* | tic4x-*)
 		os=-coff
 		;;
+	c8051-*)
+		os=-elf
+		;;
+	hexagon-*)
+		os=-elf
+		;;
 	tic54x-*)
 		os=-coff
 		;;
@@ -1548,9 +1579,6 @@ case $basic_machine in
 		;;
 	m68000-sun)
 		os=-sunos3
-		# This also exists in the configure program, but was not the
-		# default.
-		# os=-sunos4
 		;;
 	m68*-cisco)
 		os=-aout
@@ -1564,6 +1592,9 @@ case $basic_machine in
 	mips*-*)
 		os=-elf
 		;;
+	or1k-*)
+		os=-elf
+		;;
 	or32-*)
 		os=-coff
 		;;
diff --git a/configure b/configure
index 13846d8..52314fe 100755
--- a/configure
+++ b/configure
@@ -1417,7 +1417,7 @@ Optional Packages:
   --with-asiodir          ASIO directory [/usr/local/asiosdk2]
   --with-dxdir            DirectX directory [/usr/local/dx7sdk]
 
-  --with-pic              try to use only PIC/non-PIC objects [default=use
+  --with-pic[=PKGS]       try to use only PIC/non-PIC objects [default=use
                           both]
   --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
   --with-sysroot=DIR Search for dependent libraries within DIR
@@ -4145,8 +4145,8 @@ esac
 
 
 
-macro_version='2.4'
-macro_revision='1.3293'
+macro_version='2.4.2'
+macro_revision='1.3337'
 
 
 
@@ -4920,6 +4920,11 @@ else
     lt_cv_sys_max_cmd_len=196608
     ;;
 
+  os2*)
+    # The test takes a long time on OS/2.
+    lt_cv_sys_max_cmd_len=8192
+    ;;
+
   osf*)
     # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
     # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
@@ -4946,7 +4951,8 @@ else
     ;;
   *)
     lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`
-    if test -n "$lt_cv_sys_max_cmd_len"; then
+    if test -n "$lt_cv_sys_max_cmd_len" && \
+	test undefined != "$lt_cv_sys_max_cmd_len"; then
       lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
       lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
     else
@@ -4959,7 +4965,7 @@ else
       # If test is not a shell built-in, we'll probably end up computing a
       # maximum length that is only half of the actual maximum length, but
       # we can't tell.
-      while { test "X"`func_fallback_echo "$teststring$teststring" 2>/dev/null` \
+      while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \
 	         = "X$teststring$teststring"; } >/dev/null 2>&1 &&
 	      test $i != 17 # 1/2 MB should be enough
       do
@@ -5344,10 +5350,6 @@ freebsd* | dragonfly*)
   fi
   ;;
 
-gnu*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
-
 haiku*)
   lt_cv_deplibs_check_method=pass_all
   ;;
@@ -5385,8 +5387,8 @@ irix5* | irix6* | nonstopux*)
   lt_cv_deplibs_check_method=pass_all
   ;;
 
-# This must be Linux ELF.
-linux* | k*bsd*-gnu | kopensolaris*-gnu)
+# This must be glibc/ELF.
+linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
   lt_cv_deplibs_check_method=pass_all
   ;;
 
@@ -6023,13 +6025,13 @@ old_postuninstall_cmds=
 if test -n "$RANLIB"; then
   case $host_os in
   openbsd*)
-    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib"
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib"
     ;;
   *)
-    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib"
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib"
     ;;
   esac
-  old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
+  old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib"
 fi
 
 case $host_os in
@@ -6218,6 +6220,7 @@ for ac_symprfx in "" "_"; do
     # which start with @ or ?.
     lt_cv_sys_global_symbol_pipe="$AWK '"\
 "     {last_section=section; section=\$ 3};"\
+"     /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\
 "     /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\
 "     \$ 0!~/External *\|/{next};"\
 "     / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\
@@ -6506,7 +6509,7 @@ ia64-*-hpux*)
   rm -rf conftest*
   ;;
 
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
 s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
   # Find out which ABI we are using.
   echo 'int i;' > conftest.$ac_ext
@@ -6522,9 +6525,19 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
 	    LD="${LD-ld} -m elf_i386_fbsd"
 	    ;;
 	  x86_64-*linux*)
-	    LD="${LD-ld} -m elf_i386"
+	    case `/usr/bin/file conftest.o` in
+	      *x86-64*)
+		LD="${LD-ld} -m elf32_x86_64"
+		;;
+	      *)
+		LD="${LD-ld} -m elf_i386"
+		;;
+	    esac
+	    ;;
+	  powerpc64le-*)
+	    LD="${LD-ld} -m elf32lppclinux"
 	    ;;
-	  ppc64-*linux*|powerpc64-*linux*)
+	  powerpc64-*)
 	    LD="${LD-ld} -m elf32ppclinux"
 	    ;;
 	  s390x-*linux*)
@@ -6543,7 +6556,10 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
 	  x86_64-*linux*)
 	    LD="${LD-ld} -m elf_x86_64"
 	    ;;
-	  ppc*-*linux*|powerpc*-*linux*)
+	  powerpcle-*)
+	    LD="${LD-ld} -m elf64lppc"
+	    ;;
+	  powerpc-*)
 	    LD="${LD-ld} -m elf64ppc"
 	    ;;
 	  s390*-*linux*|s390*-*tpf*)
@@ -6606,7 +6622,7 @@ $as_echo "$lt_cv_cc_needs_belf" >&6; }
     CFLAGS="$SAVE_CFLAGS"
   fi
   ;;
-sparc*-*solaris*)
+*-*solaris*)
   # Find out which ABI we are using.
   echo 'int i;' > conftest.$ac_ext
   if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
@@ -6617,7 +6633,20 @@ sparc*-*solaris*)
     case `/usr/bin/file conftest.o` in
     *64-bit*)
       case $lt_cv_prog_gnu_ld in
-      yes*) LD="${LD-ld} -m elf64_sparc" ;;
+      yes*)
+        case $host in
+        i?86-*-solaris*)
+          LD="${LD-ld} -m elf_x86_64"
+          ;;
+        sparc*-*-solaris*)
+          LD="${LD-ld} -m elf64_sparc"
+          ;;
+        esac
+        # GNU ld 2.21 introduced _sol2 emulations.  Use them if available.
+        if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then
+          LD="${LD-ld}_sol2"
+        fi
+        ;;
       *)
 	if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then
 	  LD="${LD-ld} -64"
@@ -7257,7 +7286,13 @@ else
 	$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
 	  -dynamiclib -Wl,-single_module conftest.c 2>conftest.err
         _lt_result=$?
-	if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then
+	# If there is a non-empty error log, and "single_module"
+	# appears in it, assume the flag caused a linker warning
+        if test -s conftest.err && $GREP single_module conftest.err; then
+	  cat conftest.err >&5
+	# Otherwise, if the output was created with a 0 exit code from
+	# the compiler, it worked.
+	elif test -f libconftest.dylib && test $_lt_result -eq 0; then
 	  lt_cv_apple_cc_single_mod=yes
 	else
 	  cat conftest.err >&5
@@ -7268,6 +7303,7 @@ else
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5
 $as_echo "$lt_cv_apple_cc_single_mod" >&6; }
+
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5
 $as_echo_n "checking for -exported_symbols_list linker flag... " >&6; }
 if ${lt_cv_ld_exported_symbols_list+:} false; then :
@@ -7300,6 +7336,7 @@ rm -f core conftest.err conftest.$ac_objext \
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5
 $as_echo "$lt_cv_ld_exported_symbols_list" >&6; }
+
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5
 $as_echo_n "checking for -force_load linker flag... " >&6; }
 if ${lt_cv_ld_force_load+:} false; then :
@@ -7321,7 +7358,9 @@ _LT_EOF
       echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5
       $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err
       _lt_result=$?
-      if test -f conftest && test ! -s conftest.err && test $_lt_result = 0 && $GREP forced_load conftest 2>&1 >/dev/null; then
+      if test -s conftest.err && $GREP force_load conftest.err; then
+	cat conftest.err >&5
+      elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then
 	lt_cv_ld_force_load=yes
       else
 	cat conftest.err >&5
@@ -7735,7 +7774,22 @@ fi
 
 # Check whether --with-pic was given.
 if test "${with_pic+set}" = set; then :
-  withval=$with_pic; pic_mode="$withval"
+  withval=$with_pic; lt_p=${PACKAGE-default}
+    case $withval in
+    yes|no) pic_mode=$withval ;;
+    *)
+      pic_mode=default
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for lt_pkg in $withval; do
+	IFS="$lt_save_ifs"
+	if test "X$lt_pkg" = "X$lt_p"; then
+	  pic_mode=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac
 else
   pic_mode=default
 fi
@@ -7813,6 +7867,10 @@ LIBTOOL='$(SHELL) $(top_builddir)/libtool'
 
 
 
+
+
+
+
 test -z "$LN_S" && LN_S="ln -s"
 
 
@@ -8268,7 +8326,9 @@ lt_prog_compiler_static=
     case $cc_basename in
     nvcc*) # Cuda Compiler Driver 2.2
       lt_prog_compiler_wl='-Xlinker '
-      lt_prog_compiler_pic='-Xcompiler -fPIC'
+      if test -n "$lt_prog_compiler_pic"; then
+        lt_prog_compiler_pic="-Xcompiler $lt_prog_compiler_pic"
+      fi
       ;;
     esac
   else
@@ -8312,7 +8372,7 @@ lt_prog_compiler_static=
       lt_prog_compiler_static='-non_shared'
       ;;
 
-    linux* | k*bsd*-gnu | kopensolaris*-gnu)
+    linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
       case $cc_basename in
       # old Intel for x86_64 which still supported -KPIC.
       ecc*)
@@ -8359,18 +8419,33 @@ lt_prog_compiler_static=
 	;;
       *)
 	case `$CC -V 2>&1 | sed 5q` in
-	*Sun\ F* | *Sun*Fortran*)
+	*Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*)
 	  # Sun Fortran 8.3 passes all unrecognized flags to the linker
 	  lt_prog_compiler_pic='-KPIC'
 	  lt_prog_compiler_static='-Bstatic'
 	  lt_prog_compiler_wl=''
 	  ;;
+	*Sun\ F* | *Sun*Fortran*)
+	  lt_prog_compiler_pic='-KPIC'
+	  lt_prog_compiler_static='-Bstatic'
+	  lt_prog_compiler_wl='-Qoption ld '
+	  ;;
 	*Sun\ C*)
 	  # Sun C 5.9
 	  lt_prog_compiler_pic='-KPIC'
 	  lt_prog_compiler_static='-Bstatic'
 	  lt_prog_compiler_wl='-Wl,'
 	  ;;
+        *Intel*\ [CF]*Compiler*)
+	  lt_prog_compiler_wl='-Wl,'
+	  lt_prog_compiler_pic='-fPIC'
+	  lt_prog_compiler_static='-static'
+	  ;;
+	*Portland\ Group*)
+	  lt_prog_compiler_wl='-Wl,'
+	  lt_prog_compiler_pic='-fpic'
+	  lt_prog_compiler_static='-Bstatic'
+	  ;;
 	esac
 	;;
       esac
@@ -8732,7 +8807,6 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie
   hardcode_direct=no
   hardcode_direct_absolute=no
   hardcode_libdir_flag_spec=
-  hardcode_libdir_flag_spec_ld=
   hardcode_libdir_separator=
   hardcode_minus_L=no
   hardcode_shlibpath_var=unsupported
@@ -8985,8 +9059,7 @@ _LT_EOF
 	xlf* | bgf* | bgxlf* | mpixlf*)
 	  # IBM XL Fortran 10.1 on PPC cannot create shared libs itself
 	  whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive'
-	  hardcode_libdir_flag_spec=
-	  hardcode_libdir_flag_spec_ld='-rpath $libdir'
+	  hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
 	  archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib'
 	  if test "x$supports_anon_versioning" = xyes; then
 	    archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~
@@ -9366,6 +9439,7 @@ fi
 	# The linker will not automatically build a static lib if we build a DLL.
 	# _LT_TAGVAR(old_archive_from_new_cmds, )='true'
 	enable_shared_with_static_runtimes=yes
+	exclude_expsyms='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
 	export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
 	# Don't use ranlib
 	old_postinstall_cmds='chmod 644 $oldlib'
@@ -9411,6 +9485,7 @@ fi
   hardcode_shlibpath_var=unsupported
   if test "$lt_cv_ld_force_load" = "yes"; then
     whole_archive_flag_spec='`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
+
   else
     whole_archive_flag_spec=''
   fi
@@ -9439,10 +9514,6 @@ fi
       hardcode_shlibpath_var=no
       ;;
 
-    freebsd1*)
-      ld_shlibs=no
-      ;;
-
     # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
     # support.  Future versions do this automatically, but an explicit c++rt0.o
     # does not break anything, and helps significantly (at the cost of a little
@@ -9455,7 +9526,7 @@ fi
       ;;
 
     # Unfortunately, older versions of FreeBSD 2 do not have this feature.
-    freebsd2*)
+    freebsd2.*)
       archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
       hardcode_direct=yes
       hardcode_minus_L=yes
@@ -9494,7 +9565,6 @@ fi
       fi
       if test "$with_gnu_ld" = no; then
 	hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
-	hardcode_libdir_flag_spec_ld='+b $libdir'
 	hardcode_libdir_separator=:
 	hardcode_direct=yes
 	hardcode_direct_absolute=yes
@@ -10118,11 +10188,6 @@ esac
 
 
 
-
-
-
-
-
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5
 $as_echo_n "checking dynamic linker characteristics... " >&6; }
 
@@ -10212,7 +10277,7 @@ need_version=unknown
 
 case $host_os in
 aix3*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
   shlibpath_var=LIBPATH
 
@@ -10221,7 +10286,7 @@ aix3*)
   ;;
 
 aix[4-9]*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   hardcode_into_libs=yes
@@ -10286,7 +10351,7 @@ beos*)
   ;;
 
 bsdi[45]*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
   soname_spec='${libname}${release}${shared_ext}$major'
@@ -10425,7 +10490,7 @@ darwin* | rhapsody*)
   ;;
 
 dgux*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
@@ -10433,10 +10498,6 @@ dgux*)
   shlibpath_var=LD_LIBRARY_PATH
   ;;
 
-freebsd1*)
-  dynamic_linker=no
-  ;;
-
 freebsd* | dragonfly*)
   # DragonFly does not have aout.  When/if they implement a new
   # versioning mechanism, adjust this.
@@ -10444,7 +10505,7 @@ freebsd* | dragonfly*)
     objformat=`/usr/bin/objformat`
   else
     case $host_os in
-    freebsd[123]*) objformat=aout ;;
+    freebsd[23].*) objformat=aout ;;
     *) objformat=elf ;;
     esac
   fi
@@ -10462,7 +10523,7 @@ freebsd* | dragonfly*)
   esac
   shlibpath_var=LD_LIBRARY_PATH
   case $host_os in
-  freebsd2*)
+  freebsd2.*)
     shlibpath_overrides_runpath=yes
     ;;
   freebsd3.[01]* | freebsdelf3.[01]*)
@@ -10481,19 +10542,8 @@ freebsd* | dragonfly*)
   esac
   ;;
 
-gnu*)
-  version_type=linux
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=no
-  hardcode_into_libs=yes
-  ;;
-
 haiku*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   dynamic_linker="$host_os runtime_loader"
@@ -10554,7 +10604,7 @@ hpux9* | hpux10* | hpux11*)
   ;;
 
 interix[3-9]*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
@@ -10570,7 +10620,7 @@ irix5* | irix6* | nonstopux*)
     nonstopux*) version_type=nonstopux ;;
     *)
 	if test "$lt_cv_prog_gnu_ld" = yes; then
-		version_type=linux
+		version_type=linux # correct to gnu/linux during the next big refactor
 	else
 		version_type=irix
 	fi ;;
@@ -10607,9 +10657,9 @@ linux*oldld* | linux*aout* | linux*coff*)
   dynamic_linker=no
   ;;
 
-# This must be Linux ELF.
-linux* | k*bsd*-gnu | kopensolaris*-gnu)
-  version_type=linux
+# This must be glibc/ELF.
+linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
@@ -10703,7 +10753,7 @@ netbsd*)
   ;;
 
 newsos6)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
   shlibpath_var=LD_LIBRARY_PATH
   shlibpath_overrides_runpath=yes
@@ -10772,7 +10822,7 @@ rdos*)
   ;;
 
 solaris*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
@@ -10797,7 +10847,7 @@ sunos4*)
   ;;
 
 sysv4 | sysv4.3*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
   soname_spec='${libname}${release}${shared_ext}$major'
   shlibpath_var=LD_LIBRARY_PATH
@@ -10821,7 +10871,7 @@ sysv4 | sysv4.3*)
 
 sysv4*MP*)
   if test -d /usr/nec ;then
-    version_type=linux
+    version_type=linux # correct to gnu/linux during the next big refactor
     library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
     soname_spec='$libname${shared_ext}.$major'
     shlibpath_var=LD_LIBRARY_PATH
@@ -10852,7 +10902,7 @@ sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
 
 tpf*)
   # TPF is a cross-target only.  Preferred cross-host = GNU/Linux.
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
@@ -10862,7 +10912,7 @@ tpf*)
   ;;
 
 uts4*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
   soname_spec='${libname}${release}${shared_ext}$major'
   shlibpath_var=LD_LIBRARY_PATH
@@ -11787,7 +11837,6 @@ export_dynamic_flag_spec_CXX=
 hardcode_direct_CXX=no
 hardcode_direct_absolute_CXX=no
 hardcode_libdir_flag_spec_CXX=
-hardcode_libdir_flag_spec_ld_CXX=
 hardcode_libdir_separator_CXX=
 hardcode_minus_L_CXX=no
 hardcode_shlibpath_var_CXX=unsupported
@@ -12371,6 +12420,7 @@ fi
   hardcode_shlibpath_var_CXX=unsupported
   if test "$lt_cv_ld_force_load" = "yes"; then
     whole_archive_flag_spec_CXX='`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
+
   else
     whole_archive_flag_spec_CXX=''
   fi
@@ -12415,7 +12465,7 @@ fi
         esac
         ;;
 
-      freebsd[12]*)
+      freebsd2.*)
         # C++ shared libraries reported to be fairly broken before
 	# switch to ELF
         ld_shlibs_CXX=no
@@ -12431,9 +12481,6 @@ fi
         ld_shlibs_CXX=yes
         ;;
 
-      gnu*)
-        ;;
-
       haiku*)
         archive_cmds_CXX='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
         link_all_deplibs_CXX=yes
@@ -12595,7 +12642,7 @@ fi
         inherit_rpath_CXX=yes
         ;;
 
-      linux* | k*bsd*-gnu | kopensolaris*-gnu)
+      linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
         case $cc_basename in
           KCC*)
 	    # Kuck and Associates, Inc. (KAI) C++ Compiler
@@ -13091,6 +13138,7 @@ _lt_libdeps_save_CFLAGS=$CFLAGS
 case "$CC $CFLAGS " in #(
 *\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;;
 *\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;;
+*\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;;
 esac
 
 if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
@@ -13454,7 +13502,7 @@ lt_prog_compiler_static_CXX=
 	    ;;
 	esac
 	;;
-      linux* | k*bsd*-gnu | kopensolaris*-gnu)
+      linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
 	case $cc_basename in
 	  KCC*)
 	    # KAI C++ Compiler
@@ -13880,7 +13928,9 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie
     ;;
   cygwin* | mingw* | cegcc*)
     case $cc_basename in
-    cl*) ;;
+    cl*)
+      exclude_expsyms_CXX='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
+      ;;
     *)
       export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols'
       exclude_expsyms_CXX='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'
@@ -14036,8 +14086,6 @@ esac
 
 
 
-
-
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5
 $as_echo_n "checking dynamic linker characteristics... " >&6; }
 
@@ -14063,7 +14111,7 @@ need_version=unknown
 
 case $host_os in
 aix3*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
   shlibpath_var=LIBPATH
 
@@ -14072,7 +14120,7 @@ aix3*)
   ;;
 
 aix[4-9]*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   hardcode_into_libs=yes
@@ -14137,7 +14185,7 @@ beos*)
   ;;
 
 bsdi[45]*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
   soname_spec='${libname}${release}${shared_ext}$major'
@@ -14274,7 +14322,7 @@ darwin* | rhapsody*)
   ;;
 
 dgux*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
@@ -14282,10 +14330,6 @@ dgux*)
   shlibpath_var=LD_LIBRARY_PATH
   ;;
 
-freebsd1*)
-  dynamic_linker=no
-  ;;
-
 freebsd* | dragonfly*)
   # DragonFly does not have aout.  When/if they implement a new
   # versioning mechanism, adjust this.
@@ -14293,7 +14337,7 @@ freebsd* | dragonfly*)
     objformat=`/usr/bin/objformat`
   else
     case $host_os in
-    freebsd[123]*) objformat=aout ;;
+    freebsd[23].*) objformat=aout ;;
     *) objformat=elf ;;
     esac
   fi
@@ -14311,7 +14355,7 @@ freebsd* | dragonfly*)
   esac
   shlibpath_var=LD_LIBRARY_PATH
   case $host_os in
-  freebsd2*)
+  freebsd2.*)
     shlibpath_overrides_runpath=yes
     ;;
   freebsd3.[01]* | freebsdelf3.[01]*)
@@ -14330,19 +14374,8 @@ freebsd* | dragonfly*)
   esac
   ;;
 
-gnu*)
-  version_type=linux
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=no
-  hardcode_into_libs=yes
-  ;;
-
 haiku*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   dynamic_linker="$host_os runtime_loader"
@@ -14403,7 +14436,7 @@ hpux9* | hpux10* | hpux11*)
   ;;
 
 interix[3-9]*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
@@ -14419,7 +14452,7 @@ irix5* | irix6* | nonstopux*)
     nonstopux*) version_type=nonstopux ;;
     *)
 	if test "$lt_cv_prog_gnu_ld" = yes; then
-		version_type=linux
+		version_type=linux # correct to gnu/linux during the next big refactor
 	else
 		version_type=irix
 	fi ;;
@@ -14456,9 +14489,9 @@ linux*oldld* | linux*aout* | linux*coff*)
   dynamic_linker=no
   ;;
 
-# This must be Linux ELF.
-linux* | k*bsd*-gnu | kopensolaris*-gnu)
-  version_type=linux
+# This must be glibc/ELF.
+linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
@@ -14552,7 +14585,7 @@ netbsd*)
   ;;
 
 newsos6)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
   shlibpath_var=LD_LIBRARY_PATH
   shlibpath_overrides_runpath=yes
@@ -14621,7 +14654,7 @@ rdos*)
   ;;
 
 solaris*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
@@ -14646,7 +14679,7 @@ sunos4*)
   ;;
 
 sysv4 | sysv4.3*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
   soname_spec='${libname}${release}${shared_ext}$major'
   shlibpath_var=LD_LIBRARY_PATH
@@ -14670,7 +14703,7 @@ sysv4 | sysv4.3*)
 
 sysv4*MP*)
   if test -d /usr/nec ;then
-    version_type=linux
+    version_type=linux # correct to gnu/linux during the next big refactor
     library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
     soname_spec='$libname${shared_ext}.$major'
     shlibpath_var=LD_LIBRARY_PATH
@@ -14701,7 +14734,7 @@ sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
 
 tpf*)
   # TPF is a cross-target only.  Preferred cross-host = GNU/Linux.
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
@@ -14711,7 +14744,7 @@ tpf*)
   ;;
 
 uts4*)
-  version_type=linux
+  version_type=linux # correct to gnu/linux during the next big refactor
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
   soname_spec='${libname}${release}${shared_ext}$major'
   shlibpath_var=LD_LIBRARY_PATH
@@ -14850,6 +14883,8 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
 
+
+
         ac_config_commands="$ac_config_commands libtool"
 
 
@@ -15787,7 +15822,7 @@ case "${host_os}" in
         $as_echo "#define PA_USE_COREAUDIO 1" >>confdefs.h
 
 
-        CFLAGS="$CFLAGS -I\$(top_srcdir)/src/os/unix -Werror"
+        CFLAGS="$CFLAGS -I\$(top_srcdir)/src/os/unix -Wno-deprecated -Werror"
         LIBS="-framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework Carbon"
 
         if test "x$enable_mac_universal" = "xyes" ; then
@@ -15819,8 +15854,17 @@ case "${host_os}" in
               elif xcodebuild -version -sdk macosx10.9 Path >/dev/null 2>&1 ; then
                  mac_version_min="-mmacosx-version-min=10.4"
                  mac_sysroot="-isysroot `xcodebuild -version -sdk macosx10.9 Path`"
+              elif xcodebuild -version -sdk macosx10.10 Path >/dev/null 2>&1 ; then
+                 mac_version_min="-mmacosx-version-min=10.4"
+                 mac_sysroot="-isysroot `xcodebuild -version -sdk macosx10.10 Path`"
+              elif xcodebuild -version -sdk macosx10.11 Path >/dev/null 2>&1 ; then
+                 mac_version_min="-mmacosx-version-min=10.4"
+                 mac_sysroot="-isysroot `xcodebuild -version -sdk macosx10.11 Path`"
+              elif xcodebuild -version -sdk macosx10.12 Path >/dev/null 2>&1 ; then
+                 mac_version_min="-mmacosx-version-min=10.4"
+                 mac_sysroot="-isysroot `xcodebuild -version -sdk macosx10.12 Path`"
               else
-                 as_fn_error $? "Couldn't find 10.5, 10.6, 10.7, 10.8 or 10.9 SDK" "$LINENO" 5
+                 as_fn_error $? "Could not find 10.5 to 10.12 SDK." "$LINENO" 5
               fi
            esac
 
@@ -15894,7 +15938,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
         if [ "x$with_wdmks" = "xyes" ]; then
             DXDIR="$with_dxdir"
-            add_objects src/hostapi/wdmks/pa_win_wdmks.o src/common/pa_ringbuffer.o src/os/win/pa_win_hostapis.o src/os/win/pa_win_util.o src/os/win/pa_win_wdmks_util.o src/os/win/pa_win_waveformat.o
+            add_objects src/hostapi/wdmks/pa_win_wdmks.o src/common/pa_ringbuffer.o src/os/win/pa_win_hostapis.o src/os/win/pa_win_util.o src/os/win/pa_win_wdmks_utils.o src/os/win/pa_win_waveformat.o
             LIBS="${LIBS} -lwinmm -lm -luuid -lsetupapi -lole32"
             DLL_LIBS="${DLL_LIBS} -lwinmm -lm -L$DXDIR/lib -luuid -lsetupapi -lole32"
             #VC98="\"/c/Program Files/Microsoft Visual Studio/VC98/Include\""
@@ -16943,6 +16987,7 @@ pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`'
 enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`'
 SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`'
 ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`'
+PATH_SEPARATOR='`$ECHO "$PATH_SEPARATOR" | $SED "$delay_single_quote_subst"`'
 host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`'
 host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`'
 host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`'
@@ -17023,7 +17068,6 @@ with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`'
 allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`'
 no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`'
 hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`'
-hardcode_libdir_flag_spec_ld='`$ECHO "$hardcode_libdir_flag_spec_ld" | $SED "$delay_single_quote_subst"`'
 hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`'
 hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`'
 hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`'
@@ -17095,7 +17139,6 @@ with_gnu_ld_CXX='`$ECHO "$with_gnu_ld_CXX" | $SED "$delay_single_quote_subst"`'
 allow_undefined_flag_CXX='`$ECHO "$allow_undefined_flag_CXX" | $SED "$delay_single_quote_subst"`'
 no_undefined_flag_CXX='`$ECHO "$no_undefined_flag_CXX" | $SED "$delay_single_quote_subst"`'
 hardcode_libdir_flag_spec_CXX='`$ECHO "$hardcode_libdir_flag_spec_CXX" | $SED "$delay_single_quote_subst"`'
-hardcode_libdir_flag_spec_ld_CXX='`$ECHO "$hardcode_libdir_flag_spec_ld_CXX" | $SED "$delay_single_quote_subst"`'
 hardcode_libdir_separator_CXX='`$ECHO "$hardcode_libdir_separator_CXX" | $SED "$delay_single_quote_subst"`'
 hardcode_direct_CXX='`$ECHO "$hardcode_direct_CXX" | $SED "$delay_single_quote_subst"`'
 hardcode_direct_absolute_CXX='`$ECHO "$hardcode_direct_absolute_CXX" | $SED "$delay_single_quote_subst"`'
@@ -17137,6 +17180,7 @@ DLLTOOL \
 OBJDUMP \
 SHELL \
 ECHO \
+PATH_SEPARATOR \
 SED \
 GREP \
 EGREP \
@@ -17185,7 +17229,6 @@ with_gnu_ld \
 allow_undefined_flag \
 no_undefined_flag \
 hardcode_libdir_flag_spec \
-hardcode_libdir_flag_spec_ld \
 hardcode_libdir_separator \
 exclude_expsyms \
 include_expsyms \
@@ -17219,7 +17262,6 @@ with_gnu_ld_CXX \
 allow_undefined_flag_CXX \
 no_undefined_flag_CXX \
 hardcode_libdir_flag_spec_CXX \
-hardcode_libdir_flag_spec_ld_CXX \
 hardcode_libdir_separator_CXX \
 exclude_expsyms_CXX \
 include_expsyms_CXX \
@@ -17758,8 +17800,8 @@ $as_echo "$as_me: executing $ac_file commands" >&6;}
 # NOTE: Changes made to this file will be lost: look at ltmain.sh.
 #
 #   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
-#                 2006, 2007, 2008, 2009, 2010 Free Software Foundation,
-#                 Inc.
+#                 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+#                 Foundation, Inc.
 #   Written by Gordon Matzigkeit, 1996
 #
 #   This file is part of GNU Libtool.
@@ -17822,6 +17864,9 @@ SHELL=$lt_SHELL
 # An echo program that protects backslashes.
 ECHO=$lt_ECHO
 
+# The PATH separator for the build system.
+PATH_SEPARATOR=$lt_PATH_SEPARATOR
+
 # The host system.
 host_alias=$host_alias
 host=$host
@@ -18117,10 +18162,6 @@ no_undefined_flag=$lt_no_undefined_flag
 # This must work even if \$libdir does not exist
 hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec
 
-# If ld is used when linking, flag to hardcode \$libdir into a binary
-# during linking.  This must work even if \$libdir does not exist.
-hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld
-
 # Whether we need a single "-rpath" flag with a separated argument.
 hardcode_libdir_separator=$lt_hardcode_libdir_separator
 
@@ -18463,10 +18504,6 @@ no_undefined_flag=$lt_no_undefined_flag_CXX
 # This must work even if \$libdir does not exist
 hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX
 
-# If ld is used when linking, flag to hardcode \$libdir into a binary
-# during linking.  This must work even if \$libdir does not exist.
-hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_CXX
-
 # Whether we need a single "-rpath" flag with a separated argument.
 hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX
 
diff --git a/configure.in b/configure.in
index 305b64e..13816fb 100644
--- a/configure.in
+++ b/configure.in
@@ -204,7 +204,7 @@ case "${host_os}" in
 
         AC_DEFINE(PA_USE_COREAUDIO,1)
 
-        CFLAGS="$CFLAGS -I\$(top_srcdir)/src/os/unix -Werror"
+        CFLAGS="$CFLAGS -I\$(top_srcdir)/src/os/unix -Wno-deprecated -Werror"
         LIBS="-framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework Carbon"
 
         if test "x$enable_mac_universal" = "xyes" ; then
@@ -249,8 +249,17 @@ case "${host_os}" in
               elif xcodebuild -version -sdk macosx10.9 Path >/dev/null 2>&1 ; then
                  mac_version_min="-mmacosx-version-min=10.4"
                  mac_sysroot="-isysroot `xcodebuild -version -sdk macosx10.9 Path`"
+              elif xcodebuild -version -sdk macosx10.10 Path >/dev/null 2>&1 ; then
+                 mac_version_min="-mmacosx-version-min=10.4"
+                 mac_sysroot="-isysroot `xcodebuild -version -sdk macosx10.10 Path`"
+              elif xcodebuild -version -sdk macosx10.11 Path >/dev/null 2>&1 ; then
+                 mac_version_min="-mmacosx-version-min=10.4"
+                 mac_sysroot="-isysroot `xcodebuild -version -sdk macosx10.11 Path`"
+              elif xcodebuild -version -sdk macosx10.12 Path >/dev/null 2>&1 ; then
+                 mac_version_min="-mmacosx-version-min=10.4"
+                 mac_sysroot="-isysroot `xcodebuild -version -sdk macosx10.12 Path`"
               else
-                 AC_MSG_ERROR([Couldn't find 10.5, 10.6, 10.7, 10.8 or 10.9 SDK])
+                 AC_MSG_ERROR([Could not find 10.5 to 10.12 SDK.])
               fi
            esac
 
@@ -318,7 +327,7 @@ case "${host_os}" in
 
         if [[ "x$with_wdmks" = "xyes" ]]; then
             DXDIR="$with_dxdir"
-            add_objects src/hostapi/wdmks/pa_win_wdmks.o src/common/pa_ringbuffer.o src/os/win/pa_win_hostapis.o src/os/win/pa_win_util.o src/os/win/pa_win_wdmks_util.o src/os/win/pa_win_waveformat.o
+            add_objects src/hostapi/wdmks/pa_win_wdmks.o src/common/pa_ringbuffer.o src/os/win/pa_win_hostapis.o src/os/win/pa_win_util.o src/os/win/pa_win_wdmks_utils.o src/os/win/pa_win_waveformat.o
             LIBS="${LIBS} -lwinmm -lm -luuid -lsetupapi -lole32"
             DLL_LIBS="${DLL_LIBS} -lwinmm -lm -L$DXDIR/lib -luuid -lsetupapi -lole32"
             #VC98="\"/c/Program Files/Microsoft Visual Studio/VC98/Include\""
diff --git a/depcomp b/depcomp
index df8eea7..4ebd5b3 100755
--- a/depcomp
+++ b/depcomp
@@ -1,10 +1,9 @@
 #! /bin/sh
 # depcomp - compile a program generating dependencies as side-effects
 
-scriptversion=2009-04-28.21; # UTC
+scriptversion=2013-05-30.07; # UTC
 
-# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 Free
-# Software Foundation, Inc.
+# Copyright (C) 1999-2013 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -28,9 +27,9 @@ scriptversion=2009-04-28.21; # UTC
 
 case $1 in
   '')
-     echo "$0: No command.  Try \`$0 --help' for more information." 1>&2
-     exit 1;
-     ;;
+    echo "$0: No command.  Try '$0 --help' for more information." 1>&2
+    exit 1;
+    ;;
   -h | --h*)
     cat <<\EOF
 Usage: depcomp [--help] [--version] PROGRAM [ARGS]
@@ -40,11 +39,11 @@ as side-effects.
 
 Environment variables:
   depmode     Dependency tracking mode.
-  source      Source file read by `PROGRAMS ARGS'.
-  object      Object file output by `PROGRAMS ARGS'.
+  source      Source file read by 'PROGRAMS ARGS'.
+  object      Object file output by 'PROGRAMS ARGS'.
   DEPDIR      directory where to store dependencies.
   depfile     Dependency file to output.
-  tmpdepfile  Temporary file to use when outputing dependencies.
+  tmpdepfile  Temporary file to use when outputting dependencies.
   libtool     Whether libtool is used (yes/no).
 
 Report bugs to <bug-automake at gnu.org>.
@@ -57,6 +56,66 @@ EOF
     ;;
 esac
 
+# Get the directory component of the given path, and save it in the
+# global variables '$dir'.  Note that this directory component will
+# be either empty or ending with a '/' character.  This is deliberate.
+set_dir_from ()
+{
+  case $1 in
+    */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;;
+      *) dir=;;
+  esac
+}
+
+# Get the suffix-stripped basename of the given path, and save it the
+# global variable '$base'.
+set_base_from ()
+{
+  base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'`
+}
+
+# If no dependency file was actually created by the compiler invocation,
+# we still have to create a dummy depfile, to avoid errors with the
+# Makefile "include basename.Plo" scheme.
+make_dummy_depfile ()
+{
+  echo "#dummy" > "$depfile"
+}
+
+# Factor out some common post-processing of the generated depfile.
+# Requires the auxiliary global variable '$tmpdepfile' to be set.
+aix_post_process_depfile ()
+{
+  # If the compiler actually managed to produce a dependency file,
+  # post-process it.
+  if test -f "$tmpdepfile"; then
+    # Each line is of the form 'foo.o: dependency.h'.
+    # Do two passes, one to just change these to
+    #   $object: dependency.h
+    # and one to simply output
+    #   dependency.h:
+    # which is needed to avoid the deleted-header problem.
+    { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile"
+      sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile"
+    } > "$depfile"
+    rm -f "$tmpdepfile"
+  else
+    make_dummy_depfile
+  fi
+}
+
+# A tabulation character.
+tab='	'
+# A newline character.
+nl='
+'
+# Character ranges might be problematic outside the C locale.
+# These definitions help.
+upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ
+lower=abcdefghijklmnopqrstuvwxyz
+digits=0123456789
+alpha=${upper}${lower}
+
 if test -z "$depmode" || test -z "$source" || test -z "$object"; then
   echo "depcomp: Variables source, object and depmode must be set" 1>&2
   exit 1
@@ -69,6 +128,9 @@ tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
 
 rm -f "$tmpdepfile"
 
+# Avoid interferences from the environment.
+gccflag= dashmflag=
+
 # Some modes work just like other modes, but use different flags.  We
 # parameterize here, but still list the modes in the big case below,
 # to make depend.m4 easier to write.  Note that we *cannot* use a case
@@ -80,18 +142,32 @@ if test "$depmode" = hp; then
 fi
 
 if test "$depmode" = dashXmstdout; then
-   # This is just like dashmstdout with a different argument.
-   dashmflag=-xM
-   depmode=dashmstdout
+  # This is just like dashmstdout with a different argument.
+  dashmflag=-xM
+  depmode=dashmstdout
 fi
 
 cygpath_u="cygpath -u -f -"
 if test "$depmode" = msvcmsys; then
-   # This is just like msvisualcpp but w/o cygpath translation.
-   # Just convert the backslash-escaped backslashes to single forward
-   # slashes to satisfy depend.m4
-   cygpath_u="sed s,\\\\\\\\,/,g"
-   depmode=msvisualcpp
+  # This is just like msvisualcpp but w/o cygpath translation.
+  # Just convert the backslash-escaped backslashes to single forward
+  # slashes to satisfy depend.m4
+  cygpath_u='sed s,\\\\,/,g'
+  depmode=msvisualcpp
+fi
+
+if test "$depmode" = msvc7msys; then
+  # This is just like msvc7 but w/o cygpath translation.
+  # Just convert the backslash-escaped backslashes to single forward
+  # slashes to satisfy depend.m4
+  cygpath_u='sed s,\\\\,/,g'
+  depmode=msvc7
+fi
+
+if test "$depmode" = xlc; then
+  # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information.
+  gccflag=-qmakedep=gcc,-MF
+  depmode=gcc
 fi
 
 case "$depmode" in
@@ -114,8 +190,7 @@ gcc3)
   done
   "$@"
   stat=$?
-  if test $stat -eq 0; then :
-  else
+  if test $stat -ne 0; then
     rm -f "$tmpdepfile"
     exit $stat
   fi
@@ -123,13 +198,17 @@ gcc3)
   ;;
 
 gcc)
+## Note that this doesn't just cater to obsosete pre-3.x GCC compilers.
+## but also to in-use compilers like IMB xlc/xlC and the HP C compiler.
+## (see the conditional assignment to $gccflag above).
 ## There are various ways to get dependency output from gcc.  Here's
 ## why we pick this rather obscure method:
 ## - Don't want to use -MD because we'd like the dependencies to end
 ##   up in a subdir.  Having to rename by hand is ugly.
 ##   (We might end up doing this anyway to support other compilers.)
 ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
-##   -MM, not -M (despite what the docs say).
+##   -MM, not -M (despite what the docs say).  Also, it might not be
+##   supported by the other compilers which use the 'gcc' depmode.
 ## - Using -M directly means running the compiler twice (even worse
 ##   than renaming).
   if test -z "$gccflag"; then
@@ -137,31 +216,31 @@ gcc)
   fi
   "$@" -Wp,"$gccflag$tmpdepfile"
   stat=$?
-  if test $stat -eq 0; then :
-  else
+  if test $stat -ne 0; then
     rm -f "$tmpdepfile"
     exit $stat
   fi
   rm -f "$depfile"
   echo "$object : \\" > "$depfile"
-  alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
-## The second -e expression handles DOS-style file names with drive letters.
+  # The second -e expression handles DOS-style file names with drive
+  # letters.
   sed -e 's/^[^:]*: / /' \
       -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
-## This next piece of magic avoids the `deleted header file' problem.
+## This next piece of magic avoids the "deleted header file" problem.
 ## The problem is that when a header file which appears in a .P file
 ## is deleted, the dependency causes make to die (because there is
 ## typically no way to rebuild the header).  We avoid this by adding
 ## dummy dependencies for each header file.  Too bad gcc doesn't do
 ## this for us directly.
-  tr ' ' '
-' < "$tmpdepfile" |
-## Some versions of gcc put a space before the `:'.  On the theory
+## Some versions of gcc put a space before the ':'.  On the theory
 ## that the space means something, we add a space to the output as
-## well.
+## well.  hp depmode also adds that space, but also prefixes the VPATH
+## to the object.  Take care to not repeat it in the output.
 ## Some versions of the HPUX 10.20 sed can't process this invocation
 ## correctly.  Breaking it into two sed invocations is a workaround.
-    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  tr ' ' "$nl" < "$tmpdepfile" \
+    | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \
+    | sed -e 's/$/ :/' >> "$depfile"
   rm -f "$tmpdepfile"
   ;;
 
@@ -179,8 +258,7 @@ sgi)
     "$@" -MDupdate "$tmpdepfile"
   fi
   stat=$?
-  if test $stat -eq 0; then :
-  else
+  if test $stat -ne 0; then
     rm -f "$tmpdepfile"
     exit $stat
   fi
@@ -188,43 +266,41 @@ sgi)
 
   if test -f "$tmpdepfile"; then  # yes, the sourcefile depend on other files
     echo "$object : \\" > "$depfile"
-
     # Clip off the initial element (the dependent).  Don't try to be
     # clever and replace this with sed code, as IRIX sed won't handle
     # lines with more than a fixed number of characters (4096 in
     # IRIX 6.2 sed, 8192 in IRIX 6.5).  We also remove comment lines;
-    # the IRIX cc adds comments like `#:fec' to the end of the
+    # the IRIX cc adds comments like '#:fec' to the end of the
     # dependency line.
-    tr ' ' '
-' < "$tmpdepfile" \
-    | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
-    tr '
-' ' ' >> "$depfile"
+    tr ' ' "$nl" < "$tmpdepfile" \
+      | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \
+      | tr "$nl" ' ' >> "$depfile"
     echo >> "$depfile"
-
     # The second pass generates a dummy entry for each header file.
-    tr ' ' '
-' < "$tmpdepfile" \
-   | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
-   >> "$depfile"
+    tr ' ' "$nl" < "$tmpdepfile" \
+      | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
+      >> "$depfile"
   else
-    # The sourcefile does not contain any dependencies, so just
-    # store a dummy comment line, to avoid errors with the Makefile
-    # "include basename.Plo" scheme.
-    echo "#dummy" > "$depfile"
+    make_dummy_depfile
   fi
   rm -f "$tmpdepfile"
   ;;
 
+xlc)
+  # This case exists only to let depend.m4 do its work.  It works by
+  # looking at the text of this script.  This case will never be run,
+  # since it is checked for above.
+  exit 1
+  ;;
+
 aix)
   # The C for AIX Compiler uses -M and outputs the dependencies
   # in a .u file.  In older versions, this file always lives in the
-  # current directory.  Also, the AIX compiler puts `$object:' at the
+  # current directory.  Also, the AIX compiler puts '$object:' at the
   # start of each line; $object doesn't have directory information.
   # Version 6 uses the directory in both cases.
-  dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
-  test "x$dir" = "x$object" && dir=
-  base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
+  set_dir_from "$object"
+  set_base_from "$object"
   if test "$libtool" = yes; then
     tmpdepfile1=$dir$base.u
     tmpdepfile2=$base.u
@@ -237,9 +313,7 @@ aix)
     "$@" -M
   fi
   stat=$?
-
-  if test $stat -eq 0; then :
-  else
+  if test $stat -ne 0; then
     rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
     exit $stat
   fi
@@ -248,44 +322,100 @@ aix)
   do
     test -f "$tmpdepfile" && break
   done
-  if test -f "$tmpdepfile"; then
-    # Each line is of the form `foo.o: dependent.h'.
-    # Do two passes, one to just change these to
-    # `$object: dependent.h' and one to simply `dependent.h:'.
-    sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
-    # That's a tab and a space in the [].
-    sed -e 's,^.*\.[a-z]*:[	 ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
-  else
-    # The sourcefile does not contain any dependencies, so just
-    # store a dummy comment line, to avoid errors with the Makefile
-    # "include basename.Plo" scheme.
-    echo "#dummy" > "$depfile"
+  aix_post_process_depfile
+  ;;
+
+tcc)
+  # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26
+  # FIXME: That version still under development at the moment of writing.
+  #        Make that this statement remains true also for stable, released
+  #        versions.
+  # It will wrap lines (doesn't matter whether long or short) with a
+  # trailing '\', as in:
+  #
+  #   foo.o : \
+  #    foo.c \
+  #    foo.h \
+  #
+  # It will put a trailing '\' even on the last line, and will use leading
+  # spaces rather than leading tabs (at least since its commit 0394caf7
+  # "Emit spaces for -MD").
+  "$@" -MD -MF "$tmpdepfile"
+  stat=$?
+  if test $stat -ne 0; then
+    rm -f "$tmpdepfile"
+    exit $stat
   fi
+  rm -f "$depfile"
+  # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'.
+  # We have to change lines of the first kind to '$object: \'.
+  sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile"
+  # And for each line of the second kind, we have to emit a 'dep.h:'
+  # dummy dependency, to avoid the deleted-header problem.
+  sed -n -e 's|^  *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile"
   rm -f "$tmpdepfile"
   ;;
 
-icc)
-  # Intel's C compiler understands `-MD -MF file'.  However on
-  #    icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
-  # ICC 7.0 will fill foo.d with something like
-  #    foo.o: sub/foo.c
-  #    foo.o: sub/foo.h
-  # which is wrong.  We want:
-  #    sub/foo.o: sub/foo.c
-  #    sub/foo.o: sub/foo.h
-  #    sub/foo.c:
-  #    sub/foo.h:
-  # ICC 7.1 will output
+## The order of this option in the case statement is important, since the
+## shell code in configure will try each of these formats in the order
+## listed in this file.  A plain '-MD' option would be understood by many
+## compilers, so we must ensure this comes after the gcc and icc options.
+pgcc)
+  # Portland's C compiler understands '-MD'.
+  # Will always output deps to 'file.d' where file is the root name of the
+  # source file under compilation, even if file resides in a subdirectory.
+  # The object file name does not affect the name of the '.d' file.
+  # pgcc 10.2 will output
   #    foo.o: sub/foo.c sub/foo.h
-  # and will wrap long lines using \ :
+  # and will wrap long lines using '\' :
   #    foo.o: sub/foo.c ... \
   #     sub/foo.h ... \
   #     ...
+  set_dir_from "$object"
+  # Use the source, not the object, to determine the base name, since
+  # that's sadly what pgcc will do too.
+  set_base_from "$source"
+  tmpdepfile=$base.d
+
+  # For projects that build the same source file twice into different object
+  # files, the pgcc approach of using the *source* file root name can cause
+  # problems in parallel builds.  Use a locking strategy to avoid stomping on
+  # the same $tmpdepfile.
+  lockdir=$base.d-lock
+  trap "
+    echo '$0: caught signal, cleaning up...' >&2
+    rmdir '$lockdir'
+    exit 1
+  " 1 2 13 15
+  numtries=100
+  i=$numtries
+  while test $i -gt 0; do
+    # mkdir is a portable test-and-set.
+    if mkdir "$lockdir" 2>/dev/null; then
+      # This process acquired the lock.
+      "$@" -MD
+      stat=$?
+      # Release the lock.
+      rmdir "$lockdir"
+      break
+    else
+      # If the lock is being held by a different process, wait
+      # until the winning process is done or we timeout.
+      while test -d "$lockdir" && test $i -gt 0; do
+        sleep 1
+        i=`expr $i - 1`
+      done
+    fi
+    i=`expr $i - 1`
+  done
+  trap - 1 2 13 15
+  if test $i -le 0; then
+    echo "$0: failed to acquire lock after $numtries attempts" >&2
+    echo "$0: check lockdir '$lockdir'" >&2
+    exit 1
+  fi
 
-  "$@" -MD -MF "$tmpdepfile"
-  stat=$?
-  if test $stat -eq 0; then :
-  else
+  if test $stat -ne 0; then
     rm -f "$tmpdepfile"
     exit $stat
   fi
@@ -297,8 +427,8 @@ icc)
   sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
   # Some versions of the HPUX 10.20 sed can't process this invocation
   # correctly.  Breaking it into two sed invocations is a workaround.
-  sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
-    sed -e 's/$/ :/' >> "$depfile"
+  sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \
+    | sed -e 's/$/ :/' >> "$depfile"
   rm -f "$tmpdepfile"
   ;;
 
@@ -309,9 +439,8 @@ hp2)
   # 'foo.d', which lands next to the object file, wherever that
   # happens to be.
   # Much of this is similar to the tru64 case; see comments there.
-  dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
-  test "x$dir" = "x$object" && dir=
-  base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
+  set_dir_from  "$object"
+  set_base_from "$object"
   if test "$libtool" = yes; then
     tmpdepfile1=$dir$base.d
     tmpdepfile2=$dir.libs/$base.d
@@ -322,8 +451,7 @@ hp2)
     "$@" +Maked
   fi
   stat=$?
-  if test $stat -eq 0; then :
-  else
+  if test $stat -ne 0; then
      rm -f "$tmpdepfile1" "$tmpdepfile2"
      exit $stat
   fi
@@ -333,77 +461,107 @@ hp2)
     test -f "$tmpdepfile" && break
   done
   if test -f "$tmpdepfile"; then
-    sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
-    # Add `dependent.h:' lines.
+    sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile"
+    # Add 'dependent.h:' lines.
     sed -ne '2,${
-	       s/^ *//
-	       s/ \\*$//
-	       s/$/:/
-	       p
-	     }' "$tmpdepfile" >> "$depfile"
+               s/^ *//
+               s/ \\*$//
+               s/$/:/
+               p
+             }' "$tmpdepfile" >> "$depfile"
   else
-    echo "#dummy" > "$depfile"
+    make_dummy_depfile
   fi
   rm -f "$tmpdepfile" "$tmpdepfile2"
   ;;
 
 tru64)
-   # The Tru64 compiler uses -MD to generate dependencies as a side
-   # effect.  `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
-   # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
-   # dependencies in `foo.d' instead, so we check for that too.
-   # Subdirectories are respected.
-   dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
-   test "x$dir" = "x$object" && dir=
-   base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
-
-   if test "$libtool" = yes; then
-      # With Tru64 cc, shared objects can also be used to make a
-      # static library.  This mechanism is used in libtool 1.4 series to
-      # handle both shared and static libraries in a single compilation.
-      # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
-      #
-      # With libtool 1.5 this exception was removed, and libtool now
-      # generates 2 separate objects for the 2 libraries.  These two
-      # compilations output dependencies in $dir.libs/$base.o.d and
-      # in $dir$base.o.d.  We have to check for both files, because
-      # one of the two compilations can be disabled.  We should prefer
-      # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
-      # automatically cleaned when .libs/ is deleted, while ignoring
-      # the former would cause a distcleancheck panic.
-      tmpdepfile1=$dir.libs/$base.lo.d   # libtool 1.4
-      tmpdepfile2=$dir$base.o.d          # libtool 1.5
-      tmpdepfile3=$dir.libs/$base.o.d    # libtool 1.5
-      tmpdepfile4=$dir.libs/$base.d      # Compaq CCC V6.2-504
-      "$@" -Wc,-MD
-   else
-      tmpdepfile1=$dir$base.o.d
-      tmpdepfile2=$dir$base.d
-      tmpdepfile3=$dir$base.d
-      tmpdepfile4=$dir$base.d
-      "$@" -MD
-   fi
-
-   stat=$?
-   if test $stat -eq 0; then :
-   else
-      rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
-      exit $stat
-   fi
-
-   for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
-   do
-     test -f "$tmpdepfile" && break
-   done
-   if test -f "$tmpdepfile"; then
-      sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
-      # That's a tab and a space in the [].
-      sed -e 's,^.*\.[a-z]*:[	 ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
-   else
-      echo "#dummy" > "$depfile"
-   fi
-   rm -f "$tmpdepfile"
-   ;;
+  # The Tru64 compiler uses -MD to generate dependencies as a side
+  # effect.  'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'.
+  # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
+  # dependencies in 'foo.d' instead, so we check for that too.
+  # Subdirectories are respected.
+  set_dir_from  "$object"
+  set_base_from "$object"
+
+  if test "$libtool" = yes; then
+    # Libtool generates 2 separate objects for the 2 libraries.  These
+    # two compilations output dependencies in $dir.libs/$base.o.d and
+    # in $dir$base.o.d.  We have to check for both files, because
+    # one of the two compilations can be disabled.  We should prefer
+    # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
+    # automatically cleaned when .libs/ is deleted, while ignoring
+    # the former would cause a distcleancheck panic.
+    tmpdepfile1=$dir$base.o.d          # libtool 1.5
+    tmpdepfile2=$dir.libs/$base.o.d    # Likewise.
+    tmpdepfile3=$dir.libs/$base.d      # Compaq CCC V6.2-504
+    "$@" -Wc,-MD
+  else
+    tmpdepfile1=$dir$base.d
+    tmpdepfile2=$dir$base.d
+    tmpdepfile3=$dir$base.d
+    "$@" -MD
+  fi
+
+  stat=$?
+  if test $stat -ne 0; then
+    rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
+    exit $stat
+  fi
+
+  for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
+  do
+    test -f "$tmpdepfile" && break
+  done
+  # Same post-processing that is required for AIX mode.
+  aix_post_process_depfile
+  ;;
+
+msvc7)
+  if test "$libtool" = yes; then
+    showIncludes=-Wc,-showIncludes
+  else
+    showIncludes=-showIncludes
+  fi
+  "$@" $showIncludes > "$tmpdepfile"
+  stat=$?
+  grep -v '^Note: including file: ' "$tmpdepfile"
+  if test $stat -ne 0; then
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  # The first sed program below extracts the file names and escapes
+  # backslashes for cygpath.  The second sed program outputs the file
+  # name when reading, but also accumulates all include files in the
+  # hold buffer in order to output them again at the end.  This only
+  # works with sed implementations that can handle large buffers.
+  sed < "$tmpdepfile" -n '
+/^Note: including file:  *\(.*\)/ {
+  s//\1/
+  s/\\/\\\\/g
+  p
+}' | $cygpath_u | sort -u | sed -n '
+s/ /\\ /g
+s/\(.*\)/'"$tab"'\1 \\/p
+s/.\(.*\) \\/\1:/
+H
+$ {
+  s/.*/'"$tab"'/
+  G
+  p
+}' >> "$depfile"
+  echo >> "$depfile" # make sure the fragment doesn't end with a backslash
+  rm -f "$tmpdepfile"
+  ;;
+
+msvc7msys)
+  # This case exists only to let depend.m4 do its work.  It works by
+  # looking at the text of this script.  This case will never be run,
+  # since it is checked for above.
+  exit 1
+  ;;
 
 #nosideeffect)
   # This comment above is used by automake to tell side-effect
@@ -422,7 +580,7 @@ dashmstdout)
     shift
   fi
 
-  # Remove `-o $object'.
+  # Remove '-o $object'.
   IFS=" "
   for arg
   do
@@ -442,18 +600,18 @@ dashmstdout)
   done
 
   test -z "$dashmflag" && dashmflag=-M
-  # Require at least two characters before searching for `:'
+  # Require at least two characters before searching for ':'
   # in the target name.  This is to cope with DOS-style filenames:
-  # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
+  # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise.
   "$@" $dashmflag |
-    sed 's:^[  ]*[^: ][^:][^:]*\:[    ]*:'"$object"'\: :' > "$tmpdepfile"
+    sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile"
   rm -f "$depfile"
   cat < "$tmpdepfile" > "$depfile"
-  tr ' ' '
-' < "$tmpdepfile" | \
-## Some versions of the HPUX 10.20 sed can't process this invocation
-## correctly.  Breaking it into two sed invocations is a workaround.
-    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  # Some versions of the HPUX 10.20 sed can't process this sed invocation
+  # correctly.  Breaking it into two sed invocations is a workaround.
+  tr ' ' "$nl" < "$tmpdepfile" \
+    | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
+    | sed -e 's/$/ :/' >> "$depfile"
   rm -f "$tmpdepfile"
   ;;
 
@@ -503,12 +661,15 @@ makedepend)
   touch "$tmpdepfile"
   ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
   rm -f "$depfile"
-  cat < "$tmpdepfile" > "$depfile"
-  sed '1,2d' "$tmpdepfile" | tr ' ' '
-' | \
-## Some versions of the HPUX 10.20 sed can't process this invocation
-## correctly.  Breaking it into two sed invocations is a workaround.
-    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  # makedepend may prepend the VPATH from the source file name to the object.
+  # No need to regex-escape $object, excess matching of '.' is harmless.
+  sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile"
+  # Some versions of the HPUX 10.20 sed can't process the last invocation
+  # correctly.  Breaking it into two sed invocations is a workaround.
+  sed '1,2d' "$tmpdepfile" \
+    | tr ' ' "$nl" \
+    | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
+    | sed -e 's/$/ :/' >> "$depfile"
   rm -f "$tmpdepfile" "$tmpdepfile".bak
   ;;
 
@@ -525,7 +686,7 @@ cpp)
     shift
   fi
 
-  # Remove `-o $object'.
+  # Remove '-o $object'.
   IFS=" "
   for arg
   do
@@ -544,10 +705,10 @@ cpp)
     esac
   done
 
-  "$@" -E |
-    sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
-       -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
-    sed '$ s: \\$::' > "$tmpdepfile"
+  "$@" -E \
+    | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
+             -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
+    | sed '$ s: \\$::' > "$tmpdepfile"
   rm -f "$depfile"
   echo "$object : \\" > "$depfile"
   cat < "$tmpdepfile" >> "$depfile"
@@ -579,23 +740,23 @@ msvisualcpp)
       shift
       ;;
     "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
-	set fnord "$@"
-	shift
-	shift
-	;;
+        set fnord "$@"
+        shift
+        shift
+        ;;
     *)
-	set fnord "$@" "$arg"
-	shift
-	shift
-	;;
+        set fnord "$@" "$arg"
+        shift
+        shift
+        ;;
     esac
   done
   "$@" -E 2>/dev/null |
   sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
   rm -f "$depfile"
   echo "$object : \\" > "$depfile"
-  sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::	\1 \\:p' >> "$depfile"
-  echo "	" >> "$depfile"
+  sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile"
+  echo "$tab" >> "$depfile"
   sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
   rm -f "$tmpdepfile"
   ;;
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.
-
- at 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 illus [...]
-
- at 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 op [...]
-
- at section key_abstractions Key abstractions: Host APIs, Devices and Streams
-
-The PortAudio processing model includes three main abstractions: <i>Host APIs</i>, audio <i>Devices</i> and audio <i>Streams</i>.
-
-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 [...]
-
-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.
-
-
- at 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.
-
- at 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.
-
- at 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.
-
- at 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.
-
- at 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.
-
- at 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 S [...]
-
-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.
-
- at 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.
-
- at 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 [...]
-
-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 subs [...]
-
-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).
-
-<strong>IMPORTANT:</strong> 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.
-
- at 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).
-
- at 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.
-
- at 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.
-
- at 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 AP [...]
-
- at 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.
+
+ at 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 illus [...]
+
+ at 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 op [...]
+
+ at section key_abstractions Key abstractions: Host APIs, Devices and Streams
+
+The PortAudio processing model includes three main abstractions: <i>Host APIs</i>, audio <i>Devices</i> and audio <i>Streams</i>.
+
+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 [...]
+
+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.
+
+
+ at 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.
+
+ at 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.
+
+ at 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.
+
+ at 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.
+
+ at 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.
+
+ at 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 S [...]
+
+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.
+
+ at 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.
+
+ at 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 [...]
+
+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 subs [...]
+
+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).
+
+<strong>IMPORTANT:</strong> 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.
+
+ at 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).
+
+ at 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.
+
+ at 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.
+
+ at 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 AP [...]
+
+ at 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 <br>
-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.
-
-<br>
-
-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 <br>
+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.
+
+<br>
+
+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 7c4cd35..7a54d32 100644
--- a/doc/src/mainpage.dox
+++ b/doc/src/mainpage.dox
@@ -1,62 +1,61 @@
-/* doxygen index page */
-/** @mainpage
-
- at 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 p [...]
-
- at section start_here Start here
-
-- @ref api_overview<br>
-A top-down view of the PortAudio API, its capabilities, functions and data structures
-
-- @ref tutorial_start<br> 
-Get started writing code with PortAudio tutorials
-
-- @ref examples_src "Examples"<br>
-Simple example programs demonstrating PortAudio usage
-
-- @ref License<br>
-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.
-
-
- at section reference API Reference
-
-- portaudio.h Portable API<br>
-Detailed documentation for each portable API function and data type
-
-- @ref public_header "Host API Specific Extensions"<br>
-Documentation for non-portable platform-specific host API extensions
-
-
- at section resources Resources
-
-- <a href="http://www.portaudio.com">The PortAudio website</a>
-
-- <a href="http://music.columbia.edu/mailman/listinfo/portaudio/">Our mailing list for users and developers</a><br>
-
-- <a href="http://www.assembla.com/spaces/portaudio/wiki">The PortAudio wiki</a>
-
-- @ref java_binding<br>
-Documentation for the Java JNI interface to PortAudio
-
- at section developer_resources Developer Resources
-
- at if INTERNAL
-- @ref srcguide
- at endif
-
-- <a href="http://www.assembla.com/spaces/portaudio/wiki">Our wiki and issue tracking system</a>
-
-- <a href="http://www.portaudio.com/docs/proposals/014-StyleGuide.html">Coding guidelines</a>
-
-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 <a href="http://www.assembla.com/spaces/portaudio/tickets">check out the starter tickets</a>.
-
-
- at 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
+
+ at 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 p [...]
+
+ at section start_here Start here
+
+- @ref api_overview <br>
+A top-down view of the PortAudio API, its capabilities, functions and data structures
+
+- @ref tutorial_start <br> 
+Get started writing code with PortAudio tutorials
+
+- @ref examples_src "Examples"<br>
+Simple example programs demonstrating PortAudio usage
+
+- @ref License <br>
+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.
+
+
+ at section reference API Reference
+
+- portaudio.h Portable API<br>
+Detailed documentation for each portable API function and data type
+
+- @ref public_header "Host API Specific Extensions"<br>
+Documentation for non-portable platform-specific host API extensions
+
+
+ at section resources Resources
+
+- <a href="http://www.portaudio.com">The PortAudio website</a>
+
+- <a href="http://lists.columbia.edu/mailman/listinfo/portaudio/">Our mailing list for users and developers</a><br>
+
+- <a href="http://www.assembla.com/spaces/portaudio/wiki">The PortAudio wiki</a>
+
+ at section developer_resources Developer Resources
+
+ at if INTERNAL
+- @ref srcguide
+ at endif
+
+- <a href="http://www.assembla.com/spaces/portaudio/wiki">Our wiki and issue tracking system</a>
+
+- <a href="https://www.assembla.com/spaces/portaudio/wiki/DeveloperGuidelines">Developer guidelines</a>
+
+- <a href="https://www.assembla.com/spaces/portaudio/wiki/ImplementationStyleGuidelines">Implementation style guidelines</a>
+
+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 <a href="http://www.assembla.com/spaces/portaudio/tickets">check out the starter tickets</a>.
+
+
+ at 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
- at 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 a [...]
-
-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.
-
- at 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;
- at endcode
-
-
-Previous: \ref querying_devices | Next: \ref exploring
-
+/** @page blocking_read_write Blocking Read/Write Functions
+ at 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 a [...]
+
+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.
+
+ at 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;
+ at 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
- at 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 <b>source files</b> directory and <b>build</b> directory:
-   a. The <b>source files</b> directory (<i>"Where is the source code"</i>) is where the portaudio CMakeLists.txt file is located.
-   b. The <b>build</b> directory (<i>"Where to build the binaries"</i>) is pretty much anywhere you like. A common practice though is to have the build directory located <b>outside</b> the
-      source files tree (a so called "out-of-source build")
-
-4. Click <i>Configure</i>. This will prompt you to select which build files to generate. <b>Note</b> Only Microsoft Visual C++ build files currently supported!
-
-5. In the CMake option list, enable the PORTAUDIO_xxx options you need, then click <i>Configure</i> again (Note that after this there are no options marked with red color)
-
-6. Click <i>Generate</i> and you'll now (hopefully) have your VS build files in your previously defined <b>build</b> 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
+ at 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 <b>source files</b> directory and <b>build</b> directory:
+   a. The <b>source files</b> directory (<i>"Where is the source code"</i>) is where the portaudio CMakeLists.txt file is located.
+   b. The <b>build</b> directory (<i>"Where to build the binaries"</i>) is pretty much anywhere you like. A common practice though is to have the build directory located <b>outside</b> the
+      source files tree (a so called "out-of-source build")
+
+4. Click <i>Configure</i>. This will prompt you to select which build files to generate. <b>Note</b> Only Microsoft Visual C++ build files currently supported!
+
+5. In the CMake option list, enable the PORTAUDIO_xxx options you need, then click <i>Configure</i> again (Note that after this there are no options marked with red color)
+
+6. Click <i>Generate</i> and you'll now (hopefully) have your VS build files in your previously defined <b>build</b> 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 fc5c2e6..e227d75 100644
--- a/doc/src/tutorial/compile_linux.dox
+++ b/doc/src/tutorial/compile_linux.dox
@@ -1,77 +1,83 @@
-/** @page compile_linux Building Portaudio for Linux
- at ingroup tutorial
-
-<i>Note: this page has not been reviewed, and may contain errors.</i>
-
- at 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:
-
- at code
-sudo apt-get install libasound-dev
- at 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/
-
- at section comp_linux2 Configuring and Compiling PortAudio
-
-You can build PortAudio in Linux Environments using the standard configure/make tools:
-
- at code
-./configure && make
- at 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.
-
- at section comp_linux3 Using PortAudio in your Projects
-
-To use PortAudio in your apps, you can simply install the .so files:
-
- at code
-make install
- at 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:
-
- at code
-cp lib/.libs/libportaudio.a /YOUR/PROJECT/DIR
- at 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:
-
- at code
-gcc -lrt -lasound -ljack -lpthread -o YOUR_BINARY main.c libportaudio.a
- at endcode
-
- at 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 <i>enableScheduling</i> 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.
-
- at 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
+ at ingroup tutorial
+
+<i>Note: this page has not been reviewed, and may contain errors.</i>
+
+ at 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:
+
+ at code
+sudo apt-get install libasound-dev
+ at 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/
+
+ at section comp_linux2 Configuring and Compiling PortAudio
+
+You can build PortAudio in Linux Environments using the standard configure/make tools:
+
+ at code
+./configure && make
+ at 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.
+
+ at section comp_linux3 Using PortAudio in your Projects
+
+To use PortAudio in your apps, you can simply install the .so files:
+
+ at code
+sudo make install
+ at 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:
+
+ at code
+cp lib/.libs/libportaudio.a /YOUR/PROJECT/DIR
+ at endcode
+
+On some systems you may need to use:
+
+ at code
+cp /usr/local/lib/libportaudio.a /YOUR/PROJECT/DIR
+ at 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:
+
+ at code
+gcc main.c libportaudio.a -lrt -lm -lasound -ljack -pthread -o YOUR_BINARY
+ at endcode
+
+ at 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 <i>enableScheduling</i> 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.
+
+ at 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
- at ingroup tutorial
-
- at 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/
-
- at section comp_mac_ca_2 Building
-
-To build PortAudio, simply use the Unix-style "./configure && make":
-
- at code
- ./configure && make
- at endcode
-
-You do <b>not</b> 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. 
-
- at 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.
-
- at 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).
-
- at subsection comp_mac_ca_3.2 Building with <i>--disable-mac-universal</i>
-
-To build a non-universal library for the host architecture, simply use the <i>--disable-mac-universal</i> option with configure.
-
- at code
- ./configure --disable-mac-universal && make
- at endcode
-
-The <i>--disable-mac-universal</i> 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:
-
- at 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
- at 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
-
- at 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:
-
- at code
- lipo lib/.libs/libportaudio.a -thin i386 -output libportaudio.a
- at endcode
-
-or if you want to extract a single architecture fat file:
-
- at code
- lipo lib/.libs/libportaudio.a -extract i386 -output libportaudio.a
- at endcode
-
- at 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:
-
- at code
- ./configure --enable-mac-debug && make
- at endcode
-
-This will enable -g and disable -DNDEBUG which will effectively enable asserts.
-
- at 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 "<portaudio>/include/portaudio.h" and "<portaudio>/lib/.libs/libportaudio.a" to your project. Because "<portaudio>/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 [...]
-
- at code
- open lib/.libs
- at 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
-
- at 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.
-
- at 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.
-
- at 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.
-
- at code
- make -f Makefile.darwin
- at endcode
-
-Back to the Tutorial: \ref tutorial_start
-
-*/
+/** @page compile_mac_coreaudio Building Portaudio for Mac OS X
+ at ingroup tutorial
+
+ at 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/
+
+ at section comp_mac_ca_2 Building
+
+To build PortAudio, simply use the Unix-style "./configure && make":
+
+ at code
+ ./configure && make
+ at endcode
+
+You do <b>not</b> 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. 
+
+ at 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.
+
+ at 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).
+
+ at subsection comp_mac_ca_3.2 Building with <i>--disable-mac-universal</i>
+
+To build a non-universal library for the host architecture, simply use the <i>--disable-mac-universal</i> option with configure.
+
+ at code
+ ./configure --disable-mac-universal && make
+ at endcode
+
+The <i>--disable-mac-universal</i> 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:
+
+ at 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
+ at 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
+
+ at 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:
+
+ at code
+ lipo lib/.libs/libportaudio.a -thin i386 -output libportaudio.a
+ at endcode
+
+or if you want to extract a single architecture fat file:
+
+ at code
+ lipo lib/.libs/libportaudio.a -extract i386 -output libportaudio.a
+ at endcode
+
+ at 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:
+
+ at code
+ ./configure --enable-mac-debug && make
+ at endcode
+
+This will enable -g and disable -DNDEBUG which will effectively enable asserts.
+
+ at 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 "<portaudio>/include/portaudio.h" and "<portaudio>/lib/.libs/libportaudio.a" to your project. Because "<portaudio>/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 [...]
+
+ at code
+ open lib/.libs
+ at 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
+
+ at 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.
+
+ at 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.
+
+ at 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.
+
+ at code
+ make -f Makefile.darwin
+ at 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 e235b1c..2258939 100644
--- a/doc/src/tutorial/compile_windows.dox
+++ b/doc/src/tutorial/compile_windows.dox
@@ -1,97 +1,108 @@
-/** @page compile_windows Building Portaudio for Windows using Microsoft Visual Studio
- at 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) PortAudio for Windows requires the files <i>dsound.h</i> and <i>dsconf.h</i>. 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 can declare these paths by hand [...]
-
-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. 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, double click the portaudio.sln file located in build\\msvc\\. Doing so will open Visual Studio or Visual C++. Click "Finish" if a wizard appears. The sln file contains four configurations: Win32 and Win64 in both Release and Debug variants.
-
- at section comp_win1 For Visual Studio 2005, Visual C++ 2008 Express Edition or Visual Studio 2010
-
-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:
-
-C/C++ -> Optimization -> Omit frame pointers = Yes
-
-C/C++ -> Code Generation -> Runtime library = /MT
-
-Optional: C/C++ -> Code Generation -> Floating point model = fast
-
-NOTE: For most users it is not 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 configura [...]
-
-Click "Ok" when you have finished setting these parameters.
-
- at 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 audio APIs you wish to use. For Windows the available API definitions are:
-
-PA_USE_ASIO<br>
-PA_USE_DS (DirectSound)<br>
-PA_USE_WMME (MME)<br>
-PA_USE_WASAPI<br>
-PA_USE_WDMKS<br>
-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.
-
- at 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 which 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. Right now those 6 entries are not from portaudio.h:
-
-(from portaudio.def)
- at code
-...
-PaAsio_GetAvailableLatencyValues    @50
-PaAsio_ShowControlPanel             @51
-PaUtil_InitializeX86PlainConverters @52
-PaAsio_GetInputChannelName          @53
-PaAsio_GetOutputChannelName         @54
-PaUtil_SetLogPrintFunction          @55
- at endcode
-
- at 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.
-
-2) Make sure your project doesn't try to build the PortAudio ASIO implementation files:
-
-src\\hostapi\\pa_asio.cpp src\\hostapi\\iasiothiscallresolver.cpp
-
-If you're using one of the shipped projects, remove them from the project.
-
-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 at plogue.com
-
-Updated by Chris on 5/26/2011
-
-Improvements by John Clements on 12/15/2011
-
-Back to the Tutorial: \ref tutorial_start
-
+/** @page compile_windows Building PortAudio for Windows using Microsoft Visual Studio
+ at 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 <i>dsound.h</i> and <i>dsconf.h</i>. 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 t [...]
+
+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.
+
+ at 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 y [...]
+
+Click "Ok" when you have finished setting these parameters.
+
+ at 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<br>
+PA_USE_DS (DirectSound)<br>
+PA_USE_WMME (MME)<br>
+PA_USE_WASAPI<br>
+PA_USE_WDMKS<br>
+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).
+
+ at 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)
+ at code
+...
+PaAsio_GetAvailableLatencyValues    @50
+PaAsio_ShowControlPanel             @51
+PaUtil_InitializeX86PlainConverters @52
+PaAsio_GetInputChannelName          @53
+PaAsio_GetOutputChannelName         @54
+PaUtil_SetLogPrintFunction          @55
+ at endcode
+
+ at 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:
+
+ at code
+src\\hostapi\\pa_asio.cpp
+src\\hostapi\\iasiothiscallresolver.cpp
+ at 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 at 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 98ff2e3..cf3a0e5 100644
--- a/doc/src/tutorial/compile_windows_asio_msvc.dox
+++ b/doc/src/tutorial/compile_windows_asio_msvc.dox
@@ -1,95 +1,97 @@
-/** @page compile_windows_asio_msvc Building Portaudio for Windows with ASIO support using MSVC
- at ingroup tutorial
-
- at 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:
-
- at code
-/ASIOSDK2 
-/portaudio
-/DirContainingYourVisualStudioProject
- at 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:
-
- at 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
- at endcode
-
-
-Next, add the following Steinberg ASIO SDK files to the project Source Files: 
-
- at code
-asio.cpp                        (ASIOSDK2\common)
-asiodrivers.cpp                 (ASIOSDK2\host)
-asiolist.cpp                    (ASIOSDK2\host\pc)
- at endcode
-
-
-Then, add the following PortAudio files to the project Source Files:
-
- at 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_waveformat.c             (portaudio\src\os\win)
-pa_x86_plain_converters.c       (portaudio\src\os\win)
-patest_saw.c                    (portaudio\test)  (Or another file containing main() 
-                                                   for the console exe to be built.)
- at endcode
-
-
-Although not strictly necessary, you may also want to add the following files to the project Header Files:
-
- at code
-portaudio.h                     (portaudio\include)
-pa_asio.h                       (portaudio\include)
- at 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: and enter the following relative include paths.
-
- at code
-..\portaudio\include,..\portaudio\src\common,..\asiosdk2\common,..\asiosdk2\host,..\asiosdk2\host\pc
- at 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.
-
-You should now be able to build any of the test executables in the portaudio\test directory.
-We suggest that you start with patest_saw.c because it's one of the simplest test files.
-
---- Chris Share, Tom McCandless, Ross Bencina
-
-[wiki:UsingThePortAudioSvnRepository  SVN instructions]
-Back to the Tutorial: \ref tutorial_start
-
+/** @page compile_windows_asio_msvc Building Portaudio for Windows with ASIO support using MSVC
+ at ingroup tutorial
+
+ at 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:
+
+ at code
+/ASIOSDK2 
+/portaudio
+/DirContainingYourVisualStudioProject  (should directly contain the .sln, .vcproj or .vcprojx etc.)
+ at 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:
+
+ at 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
+ at endcode
+
+
+Next, add the following Steinberg ASIO SDK files to the project Source Files: 
+
+ at code
+asio.cpp                        (ASIOSDK2\common)
+asiodrivers.cpp                 (ASIOSDK2\host)
+asiolist.cpp                    (ASIOSDK2\host\pc)
+ at endcode
+
+
+Then, add the following PortAudio files to the project Source Files:
+
+ at 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.)
+ at endcode
+
+
+Although not strictly necessary, you may also want to add the following files to the project Header Files:
+
+ at code
+portaudio.h                     (portaudio\include)
+pa_asio.h                       (portaudio\include)
+ at 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:
+
+ at code
+..\portaudio\include;..\portaudio\src\common;..\portaudio\src\os\win;..\asiosdk2\common;..\asiosdk2\host;..\asiosdk2\host\pc
+ at 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  [...]
+
+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..d521b7b 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
- at ingroup tutorial
-
- at section comp_mingw1 Portaudio for Windows With MinGW
-
-<i>The following document is still being reviewed</i>
-
-= 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:
-
- at code
-./configure
-make
-make install
- at endcode
-
-The above should create a working version though you might want to
-provide '--prefix=<path-to-install-dir>' 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
+ at ingroup tutorial
+
+ at section comp_mingw1 Portaudio for Windows With MinGW
+
+<strong>This document contains old or out-of-date information. Please see a draft of new MinGW information on our Wiki: <a href="https://app.assembla.com/spaces/portaudio/wiki/Notes_about_building_PortAudio_with_MinGW">PortAudio Wiki: Notes about building PortAudio with MinGW</a></strong>
+
+= 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:
+
+ at code
+./configure
+make
+make install
+ at endcode
+
+The above should create a working version though you might want to
+provide '--prefix=<path-to-install-dir>' 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
- at 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
+ at 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
- at ingroup tutorial
-
- at 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.
- at code
-err = Pa_Initialize();
-if( err != paNoError ) goto error;
- at endcode
-
-You can get a text message that explains the error message by passing it to Pa_GetErrorText( err ). For Example:
-
- at code
-printf(  "PortAudio error: %s\n", Pa_GetErrorText( err ) );
- at endcode
-
-It is also important, when you are done with PortAudio, to Terminate it:
-
- at code
-err = Pa_Terminate();
-if( err != paNoError )
-   printf(  "PortAudio error: %s\n", Pa_GetErrorText( err ) );
- at endcode
-
-
-Previous: \ref writing_a_callback | Next: \ref open_default_stream
-
+/** @page initializing_portaudio Initializing PortAudio
+ at ingroup tutorial
+
+ at 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.
+ at code
+err = Pa_Initialize();
+if( err != paNoError ) goto error;
+ at endcode
+
+You can get a text message that explains the error message by passing it to Pa_GetErrorText( err ). For Example:
+
+ at code
+printf(  "PortAudio error: %s\n", Pa_GetErrorText( err ) );
+ at endcode
+
+It is also important, when you are done with PortAudio, to Terminate it:
+
+ at code
+err = Pa_Terminate();
+if( err != paNoError )
+   printf(  "PortAudio error: %s\n", Pa_GetErrorText( err ) );
+ at 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
- at 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.)
- at 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;
- at 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
+ at 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.)
+ at 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;
+ at 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
- at ingroup tutorial
-
- at 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:
-
- at code
-    int numDevices;
-
-    numDevices = Pa_GetDeviceCount();
-    if( numDevices < 0 )
-    {
-        printf( "ERROR: Pa_CountDevices returned 0x%x\n", numDevices );
-        err = numDevices;
-        goto error;
-    }
- at endcode
-
-
-If you want to get information about each device, simply loop through as follows:
-
- at code
-    const   PaDeviceInfo *deviceInfo;
-
-    for( i=0; i<numDevices; i++ )
-    {
-        deviceInfo = Pa_GetDeviceInfo( i );
-        ...
-    }
- at endcode
-
-The Pa_DeviceInfo structure contains a wealth of information such as the name of the devices, the default latency associated with the devices and more. The structure has the following fields:
-
- at code
-int 	structVersion
-const char * 	name
-PaHostApiIndex 	hostApi
-int 	maxInputChannels
-int 	maxOutputChannels
-PaTime 	defaultLowInputLatency
-PaTime 	defaultLowOutputLatency
-PaTime 	defaultHighInputLatency
-PaTime 	defaultHighOutputLatency
-double 	defaultSampleRate
- at endcode
-
-You may notice that you can't determine, from this information alone, whether or not a particular sample rate is supported. This is because some devices support ranges of sample rates, others support, a list of sample rates, and still others support some sample rates and number of channels combinations but not others. To get around this, PortAudio offers a function for testing a particular device with a given format:
-
- at code
-    const PaStreamParameters *inputParameters;
-    const PaStreamParameters *outputParameters;
-    double desiredSampleRate;
-    ...
-    PaError err;
-
-    err = Pa_IsFormatSupported( inputParameters, outputParameters, desiredSampleRate );
-    if( err == paFormatIsSupported )
-    {
-       printf( "Hooray!\n");
-    }
-    else
-    {
-       printf("Too Bad.\n");
-    }
- at endcode
-
-Filling in the inputParameters and outputParameters fields is shown in a moment.
-
-Once you've found a configuration you like, or one you'd like to go ahead and try, you can open the stream by filling in the PaStreamParameters structures, and calling Pa_OpenStream:
-
- at code
-    double srate = ... ;
-    PaStream *stream;
-    unsigned long framesPerBuffer = ... ; //could be paFramesPerBufferUnspecified, in which case PortAudio will do its best to manage it for you, but, on some platforms, the framesPerBuffer will change in each call to the callback
-    PaStreamParameters outputParameters;
-    PaStreamParameters inputParameters;
-
-    bzero( &inputParameters, sizeof( inputParameters ) ); //not necessary if you are filling in all the fields
-    inputParameters.channelCount = inChan;
-    inputParameters.device = inDevNum;
-    inputParameters.hostApiSpecificStreamInfo = NULL;
-    inputParameters.sampleFormat = paFloat32;
-    inputParameters.suggestedLatency = Pa_GetDeviceInfo(inDevNum)->defaultLowInputLatency ;
-    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!
- at endcode
-
-
-Previous: \ref utility_functions | Next: \ref blocking_read_write
-
+/** @page querying_devices Enumerating and Querying PortAudio Devices
+ at ingroup tutorial
+
+ at 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:
+
+ at code
+    int numDevices;
+
+    numDevices = Pa_GetDeviceCount();
+    if( numDevices < 0 )
+    {
+        printf( "ERROR: Pa_CountDevices returned 0x%x\n", numDevices );
+        err = numDevices;
+        goto error;
+    }
+ at endcode
+
+
+If you want to get information about each device, simply loop through as follows:
+
+ at code
+    const   PaDeviceInfo *deviceInfo;
+
+    for( i=0; i<numDevices; i++ )
+    {
+        deviceInfo = Pa_GetDeviceInfo( i );
+        ...
+    }
+ at endcode
+
+The Pa_DeviceInfo structure contains a wealth of information such as the name of the devices, the default latency associated with the devices and more. The structure has the following fields:
+
+ at code
+int 	structVersion
+const char * 	name
+PaHostApiIndex 	hostApi
+int 	maxInputChannels
+int 	maxOutputChannels
+PaTime 	defaultLowInputLatency
+PaTime 	defaultLowOutputLatency
+PaTime 	defaultHighInputLatency
+PaTime 	defaultHighOutputLatency
+double 	defaultSampleRate
+ at endcode
+
+You may notice that you can't determine, from this information alone, whether or not a particular sample rate is supported. This is because some devices support ranges of sample rates, others support, a list of sample rates, and still others support some sample rates and number of channels combinations but not others. To get around this, PortAudio offers a function for testing a particular device with a given format:
+
+ at code
+    const PaStreamParameters *inputParameters;
+    const PaStreamParameters *outputParameters;
+    double desiredSampleRate;
+    ...
+    PaError err;
+
+    err = Pa_IsFormatSupported( inputParameters, outputParameters, desiredSampleRate );
+    if( err == paFormatIsSupported )
+    {
+       printf( "Hooray!\n");
+    }
+    else
+    {
+       printf("Too Bad.\n");
+    }
+ at endcode
+
+Filling in the inputParameters and outputParameters fields is shown in a moment.
+
+Once you've found a configuration you like, or one you'd like to go ahead and try, you can open the stream by filling in the PaStreamParameters structures, and calling Pa_OpenStream:
+
+ at code
+    double srate = ... ;
+    PaStream *stream;
+    unsigned long framesPerBuffer = ... ; //could be paFramesPerBufferUnspecified, in which case PortAudio will do its best to manage it for you, but, on some platforms, the framesPerBuffer will change in each call to the callback
+    PaStreamParameters outputParameters;
+    PaStreamParameters inputParameters;
+
+    bzero( &inputParameters, sizeof( inputParameters ) ); //not necessary if you are filling in all the fields
+    inputParameters.channelCount = inChan;
+    inputParameters.device = inDevNum;
+    inputParameters.hostApiSpecificStreamInfo = NULL;
+    inputParameters.sampleFormat = paFloat32;
+    inputParameters.suggestedLatency = Pa_GetDeviceInfo(inDevNum)->defaultLowInputLatency ;
+    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!
+ at 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
- at ingroup tutorial
-
- at 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.
-
- at code
-    err = Pa_StartStream( stream );
-    if( err != paNoError ) goto error;
- at 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  [...]
-
-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 fo [...]
-
- at code
-    /* Sleep for several seconds. */
-    Pa_Sleep(NUM_SECONDS*1000);
- at endcode
-
-Now we need to stop playback. There are several ways to do this, the simplest of which is to call Pa_StopStream():
-
- at code
-    err = Pa_StopStream( stream );
-    if( err != paNoError ) goto error;
- at 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
+ at ingroup tutorial
+
+ at 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.
+
+ at code
+    err = Pa_StartStream( stream );
+    if( err != paNoError ) goto error;
+ at 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  [...]
+
+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 fo [...]
+
+ at code
+    /* Sleep for several seconds. */
+    Pa_Sleep(NUM_SECONDS*1000);
+ at endcode
+
+Now we need to stop playback. There are several ways to do this, the simplest of which is to call Pa_StopStream():
+
+ at code
+    err = Pa_StopStream( stream );
+    if( err != paNoError ) goto error;
+ at 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
- at ingroup tutorial
-
-When you are done with a stream, you should close it to free up resources:
-
- at code
-    err = Pa_CloseStream( stream );
-    if( err != paNoError ) goto error;
- at endcode
-
-We've already mentioned this in \ref initializing_portaudio, but in case you forgot, be sure to terminate PortAudio when you are done:
-
- at code
-    err = Pa_Terminate( );
-    if( err != paNoError ) goto error;
- at endcode
-
-Previous: \ref start_stop_abort | Next: \ref utility_functions
-
+/** @page terminating_portaudio Closing a Stream and Terminating PortAudio
+ at ingroup tutorial
+
+When you are done with a stream, you should close it to free up resources:
+
+ at code
+    err = Pa_CloseStream( stream );
+    if( err != paNoError ) goto error;
+ at endcode
+
+We've already mentioned this in \ref initializing_portaudio, but in case you forgot, be sure to terminate PortAudio when you are done:
+
+ at code
+    err = Pa_Terminate( );
+    if( err != paNoError ) goto error;
+ at 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
- at 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.
-
- at section tut_start1 Downloading
-
-First thing you need to do is download the PortAudio source code either <a href="http://www.portaudio.com/download.html">as a tarball from the website</a>, or <a href="http://www.portaudio.com/usingsvn.html">from the Subversion Repository</a>.
-
- at 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.
-
- at 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 [...]
-
- at 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 <a href="http://www.portaudio.com/docs/proposals/index.html">Proposed Enhancements to PortAudio</a>, 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
+ at 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.
+
+ at section tut_start1 Downloading
+
+First thing you need to do is download the PortAudio source code either <a href="http://www.portaudio.com/download.html">as a tarball from the website</a>, or <a href="http://www.portaudio.com/usingsvn.html">from the Subversion Repository</a>.
+
+ at 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.
+
+ at 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 [...]
+
+ at 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 <a href="http://www.portaudio.com/docs/proposals/index.html">Proposed Enhancements to PortAudio</a>, 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
- at 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.
-
- at 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.
-
- at code
-int             Pa_GetVersion (void)
-const char *    Pa_GetVersionText (void)
- at endcode
-
- at section tut_util3 Error Text
-
-PortAudio allows you to get error text from an error number.
-
- at code
-const char *    Pa_GetErrorText (PaError errorCode)
- at endcode
-
- at 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:
-
- at code
-PaError     Pa_IsStreamStopped (PaStream *stream)
-PaError     Pa_IsStreamActive (PaStream *stream)
- at endcode
-
- at 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:
-
- at code
-const PaStreamInfo *    Pa_GetStreamInfo (PaStream *stream)
- at endcode
-
- at 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.
-
- at code
-PaTime  Pa_GetStreamTime (PaStream *stream)
- at endcode
-
- at section tut_util6CPU Usage
-
-To determine how much CPU is being used by the callback, use these:
-
- at code
-double  Pa_GetStreamCpuLoad (PaStream *stream)
- at endcode
-
- at 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.
-
- at code
-PaError Pa_GetSampleSize (PaSampleFormat format)
-void    Pa_Sleep (long msec)
- at endcode
-
-
-Previous: \ref terminating_portaudio | Next: \ref querying_devices
-
+/** @page utility_functions Utility Functions
+ at 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.
+
+ at 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.
+
+ at code
+int             Pa_GetVersion (void)
+const char *    Pa_GetVersionText (void)
+ at endcode
+
+ at section tut_util3 Error Text
+
+PortAudio allows you to get error text from an error number.
+
+ at code
+const char *    Pa_GetErrorText (PaError errorCode)
+ at endcode
+
+ at 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:
+
+ at code
+PaError     Pa_IsStreamStopped (PaStream *stream)
+PaError     Pa_IsStreamActive (PaStream *stream)
+ at endcode
+
+ at 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:
+
+ at code
+const PaStreamInfo *    Pa_GetStreamInfo (PaStream *stream)
+ at endcode
+
+ at 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.
+
+ at code
+PaTime  Pa_GetStreamTime (PaStream *stream)
+ at endcode
+
+ at section tut_util6CPU Usage
+
+To determine how much CPU is being used by the callback, use these:
+
+ at code
+double  Pa_GetStreamCpuLoad (PaStream *stream)
+ at endcode
+
+ at 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.
+
+ at code
+PaError Pa_GetSampleSize (PaSampleFormat format)
+void    Pa_Sleep (long msec)
+ at 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 ee65086..7c2f8d3 100644
--- a/doc/src/tutorial/writing_a_callback.dox
+++ b/doc/src/tutorial/writing_a_callback.dox
@@ -1,66 +1,70 @@
-/** @page writing_a_callback Writing a Callback Function
- at 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]
- at code
-#include "portaudio.h"
- at 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. In addition, if you want your audio to reach the speakers on time, you'll need to make sure whatever code you run in the callback runs quickly. What is safe or not safe will vary from platform to platform, but as a rule of thumb, don't do anything like allo [...]
-
-Your callback function must return an int and accept the exact parameters specified in this typedef:
-
- at code
-typedef int PaStreamCallback( const void *input,
-                                      void *output,
-                                      unsigned long frameCount,
-                                      const PaStreamCallbackTimeInfo* timeInfo,
-                                      PaStreamCallbackFlags statusFlags,
-                                      void *userData ) ;
- at 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.
-
- at 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; i<framesPerBuffer; i++ )
-    {
-        *out++ = data->left_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;
-}
- at endcode
-
-Previous: \ref tutorial_start | Next: \ref initializing_portaudio
-
-*/
\ No newline at end of file
+/** @page writing_a_callback Writing a Callback Function
+ at 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]
+ at code
+#include "portaudio.h"
+ at 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:
+
+ at code
+typedef int PaStreamCallback( const void *input,
+                                      void *output,
+                                      unsigned long frameCount,
+                                      const PaStreamCallbackTimeInfo* timeInfo,
+                                      PaStreamCallbackFlags statusFlags,
+                                      void *userData ) ;
+ at 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.
+
+ at 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; i<framesPerBuffer; i++ )
+    {
+        *out++ = data->left_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;
+}
+ at endcode
+
+Previous: \ref tutorial_start | Next: \ref initializing_portaudio
+
+*/
diff --git a/doc/utils/checkfiledocs.py b/doc/utils/checkfiledocs.py
index b7a754e..5d6b585 100644
--- a/doc/utils/checkfiledocs.py
+++ b/doc/utils/checkfiledocs.py
@@ -1,77 +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.
-
-
-# recurse from top and return a list of all with the given
-# extensions. ignore .svn directories. return absolute paths
-def recursiveFindFiles( top, extensions, includePaths ):
-    result = []
-    for (dirpath, dirnames, filenames) in os.walk(top):
-        if not '.svn' in 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( paRootDirectory, [ '.c', '.h', '.cpp' ], True );
-docFiles = recursiveFindFiles( paHtmlDocDirectory, [ '.html' ], 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/CMakeLists.txt b/examples/CMakeLists.txt
index 67a2cfd..f96b6ec 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -1,27 +1,41 @@
 # Example projects
 
 MACRO(ADD_EXAMPLE appl_name)
-   ADD_EXECUTABLE(${appl_name} "${appl_name}.c")
-   TARGET_LINK_LIBRARIES(${appl_name} portaudio_static)
+  ADD_EXECUTABLE(${appl_name} "${appl_name}.c")
+  TARGET_LINK_LIBRARIES(${appl_name} portaudio_static)
+  SET_TARGET_PROPERTIES(${appl_name} PROPERTIES FOLDER "Examples C")
+  IF(WIN32)
+    SET_PROPERTY(TARGET ${appl_name} APPEND_STRING PROPERTY COMPILE_DEFINITIONS _CRT_SECURE_NO_WARNINGS)
+  ENDIF()
 ENDMACRO(ADD_EXAMPLE)
 
 MACRO(ADD_EXAMPLE_CPP appl_name)
-   ADD_EXECUTABLE(${appl_name} "${appl_name}.cpp")
-   TARGET_LINK_LIBRARIES(${appl_name} portaudio_static)
+  ADD_EXECUTABLE(${appl_name} "${appl_name}.cpp")
+  TARGET_LINK_LIBRARIES(${appl_name} portaudio_static)
+  SET_TARGET_PROPERTIES(${appl_name} PROPERTIES FOLDER "Examples C++")
+  IF(WIN32)
+    SET_PROPERTY(TARGET ${appl_name} APPEND_STRING PROPERTY COMPILE_DEFINITIONS _CRT_SECURE_NO_WARNINGS)
+  ENDIF()
 ENDMACRO(ADD_EXAMPLE_CPP)
 
 ADD_EXAMPLE(pa_devs)
 ADD_EXAMPLE(pa_fuzz)
-ADD_EXAMPLE(paex_mono_asio_channel_select)
+IF(PA_USE_ASIO AND WIN32)
+  ADD_EXAMPLE(paex_mono_asio_channel_select)
+ENDIF()
 ADD_EXAMPLE(paex_ocean_shore)
+TARGET_INCLUDE_DIRECTORIES(paex_ocean_shore PRIVATE ../src/common)
 ADD_EXAMPLE(paex_pink)
 ADD_EXAMPLE(paex_read_write_wire)
 ADD_EXAMPLE(paex_record)
 ADD_EXAMPLE(paex_record_file)
+TARGET_INCLUDE_DIRECTORIES(paex_record_file PRIVATE ../src/common)
 ADD_EXAMPLE(paex_saw)
 ADD_EXAMPLE(paex_sine)
 ADD_EXAMPLE_CPP(paex_sine_c++)
-ADD_EXAMPLE(paex_wmme_ac3)
-ADD_EXAMPLE(paex_wmme_surround)
+IF(PA_USE_WMME AND WIN32)
+  ADD_EXAMPLE(paex_wmme_ac3)
+  ADD_EXAMPLE(paex_wmme_surround)
+ENDIF()
 ADD_EXAMPLE(paex_write_sine)
 ADD_EXAMPLE(paex_write_sine_nonint)
diff --git a/examples/pa_devs.c b/examples/pa_devs.c
index b959463..595a05d 100644
--- a/examples/pa_devs.c
+++ b/examples/pa_devs.c
@@ -7,7 +7,7 @@
         ASIO support.
 */
 /*
- * $Id: pa_devs.c 1891 2013-05-05 14:00:02Z rbencina $
+ * $Id$
  *
  * This program uses the PortAudio Portable Audio Library.
  * For more information see: http://www.portaudio.com
@@ -113,11 +113,10 @@ int main(void)
         printf( "ERROR: Pa_Initialize returned 0x%x\n", err );
         goto error;
     }
+    
+    printf( "PortAudio version: 0x%08X\n", Pa_GetVersion());
+    printf( "Version text: '%s'\n", Pa_GetVersionInfo()->versionText );
 
-    printf( "PortAudio version number = %d\nPortAudio version text = '%s'\n",
-            Pa_GetVersion(), Pa_GetVersionText() );
-
-            
     numDevices = Pa_GetDeviceCount();
     if( numDevices < 0 )
     {
diff --git a/examples/pa_fuzz.c b/examples/pa_fuzz.c
index 955271e..d5f99ec 100644
--- a/examples/pa_fuzz.c
+++ b/examples/pa_fuzz.c
@@ -4,7 +4,7 @@
 	@author Phil Burk  http://www.softsynth.com
 */
 /*
- * $Id: pa_fuzz.c 1752 2011-09-08 03:21:55Z philburk $
+ * $Id$
  *
  * This program uses the PortAudio Portable Audio Library.
  * For more information see: http://www.portaudio.com
diff --git a/examples/paex_mono_asio_channel_select.c b/examples/paex_mono_asio_channel_select.c
index 50f7e58..a141ac0 100644
--- a/examples/paex_mono_asio_channel_select.c
+++ b/examples/paex_mono_asio_channel_select.c
@@ -5,7 +5,7 @@
 	@author Phil Burk <philburk at softsynth.com>
 */
 /*
- * $Id: paex_mono_asio_channel_select.c 1756 2011-09-08 06:09:29Z philburk $
+ * $Id$
  *
  * Authors:
  *    Ross Bencina <rossb at audiomulch.com>
diff --git a/examples/paex_ocean_shore.c b/examples/paex_ocean_shore.c
index 30efe13..7eb7f20 100644
--- a/examples/paex_ocean_shore.c
+++ b/examples/paex_ocean_shore.c
@@ -19,7 +19,7 @@
             Robert Bielik
 */
 /*
- * $Id: paex_ocean_shore.c 1816 2012-02-22 12:20:26Z robiwan $
+ * $Id$
  *
  * This program uses the PortAudio Portable Audio Library.
  * For more information see: http://www.portaudio.com
@@ -381,7 +381,7 @@ OceanWave* InitializeWave(double SR, float attackInSeconds, float maxLevel, floa
         wave->wave_attack_incr = wave->wave_envelope_max_level / (attackInSeconds * (float)SR);
         wave->wave_decay_incr = - wave->wave_envelope_max_level / (attackInSeconds * 4 * (float)SR);
 
-        wave->wave_pan_left = sqrtf(1.0 - positionLeftRight);
+        wave->wave_pan_left = sqrtf(1.0f - positionLeftRight);
         wave->wave_pan_right = sqrtf(positionLeftRight);
     }
     return wave;
diff --git a/examples/paex_pink.c b/examples/paex_pink.c
index 46df0b7..3714ba7 100644
--- a/examples/paex_pink.c
+++ b/examples/paex_pink.c
@@ -17,7 +17,7 @@
 	@author Phil Burk  http://www.softsynth.com
 */
 /*
- * $Id: paex_pink.c 1752 2011-09-08 03:21:55Z philburk $
+ * $Id$
  *
  * This program uses the PortAudio Portable Audio Library.
  * For more information see: http://www.portaudio.com
diff --git a/examples/paex_read_write_wire.c b/examples/paex_read_write_wire.c
index 52cc6bd..4208a01 100644
--- a/examples/paex_read_write_wire.c
+++ b/examples/paex_read_write_wire.c
@@ -1,221 +1,205 @@
-/** @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 at 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 <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#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; i<FRAMES_PER_BUFFER*NUM_CHANNELS; i++ ) \
-        ((unsigned char *)a)[i] = (SAMPLE_SILENCE); \
-}
-#define PRINTF_S_FORMAT "%d"
-#endif
-
-
-/*******************************************************************/
-int main(void);
-int main(void)
-{
-    PaStreamParameters inputParameters, outputParameters;
-    PaStream *stream = NULL;
-    PaError err;
-    char *sampleBlock;
-    int i;
-    int numBytes;
-    
-    
-    printf("patest_read_write_wire.c\n"); fflush(stdout);
-
-    numBytes = FRAMES_PER_BUFFER * NUM_CHANNELS * SAMPLE_SIZE ;
-    sampleBlock = (char *) malloc( numBytes );
-    if( sampleBlock == NULL )
-    {
-        printf("Could not allocate record array.\n");
-        exit(1);
-    }
-    CLEAR( sampleBlock );
-
-    err = Pa_Initialize();
-    if( err != paNoError ) goto error;
-
-    inputParameters.device = Pa_GetDefaultInputDevice(); /* default input device */
-    printf( "Input device # %d.\n", inputParameters.device );
-    printf( "Input LL: %g s\n", Pa_GetDeviceInfo( inputParameters.device )->defaultLowInputLatency );
-    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 at 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 <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "portaudio.h"
+
+/* #define SAMPLE_RATE  (17932) // Test failure to open with this value. */
+#define SAMPLE_RATE       (44100)
+#define FRAMES_PER_BUFFER   (512)
+#define NUM_SECONDS          (10)
+/* #define DITHER_FLAG     (paDitherOff)  */
+#define DITHER_FLAG           (0)
+
+/* Select sample format. */
+#if 1
+#define PA_SAMPLE_TYPE  paFloat32
+#define SAMPLE_SIZE (4)
+#define SAMPLE_SILENCE  (0.0f)
+#define PRINTF_S_FORMAT "%.8f"
+#elif 0
+#define PA_SAMPLE_TYPE  paInt16
+#define SAMPLE_SIZE (2)
+#define SAMPLE_SILENCE  (0)
+#define PRINTF_S_FORMAT "%d"
+#elif 0
+#define PA_SAMPLE_TYPE  paInt24
+#define SAMPLE_SIZE (3)
+#define SAMPLE_SILENCE  (0)
+#define PRINTF_S_FORMAT "%d"
+#elif 0
+#define PA_SAMPLE_TYPE  paInt8
+#define SAMPLE_SIZE (1)
+#define SAMPLE_SILENCE  (0)
+#define PRINTF_S_FORMAT "%d"
+#else
+#define PA_SAMPLE_TYPE  paUInt8
+#define SAMPLE_SIZE (1)
+#define SAMPLE_SILENCE  (128)
+#define PRINTF_S_FORMAT "%d"
+#endif
+
+/*******************************************************************/
+int main(void);
+int main(void)
+{
+    PaStreamParameters inputParameters, outputParameters;
+    PaStream *stream = NULL;
+    PaError err;
+    const PaDeviceInfo* inputInfo;
+    const PaDeviceInfo* outputInfo;
+    char *sampleBlock = NULL;
+    int i;
+    int numBytes;
+    int numChannels;
+
+    printf("patest_read_write_wire.c\n"); fflush(stdout);
+    printf("sizeof(int) = %lu\n", sizeof(int)); fflush(stdout);
+    printf("sizeof(long) = %lu\n", sizeof(long)); fflush(stdout);
+
+    err = Pa_Initialize();
+    if( err != paNoError ) goto error2;
+
+    inputParameters.device = Pa_GetDefaultInputDevice(); /* default input device */
+    printf( "Input device # %d.\n", inputParameters.device );
+    inputInfo = Pa_GetDeviceInfo( inputParameters.device );
+    printf( "    Name: %s\n", inputInfo->name );
+    printf( "      LL: %g s\n", inputInfo->defaultLowInputLatency );
+    printf( "      HL: %g s\n", inputInfo->defaultHighInputLatency );
+
+    outputParameters.device = Pa_GetDefaultOutputDevice(); /* default output device */
+    printf( "Output device # %d.\n", outputParameters.device );
+    outputInfo = Pa_GetDeviceInfo( outputParameters.device );
+    printf( "   Name: %s\n", outputInfo->name );
+    printf( "     LL: %g s\n", outputInfo->defaultLowOutputLatency );
+    printf( "     HL: %g s\n", outputInfo->defaultHighOutputLatency );
+
+    numChannels = inputInfo->maxInputChannels < outputInfo->maxOutputChannels
+            ? inputInfo->maxInputChannels : outputInfo->maxOutputChannels;
+    printf( "Num channels = %d.\n", numChannels );
+
+    inputParameters.channelCount = numChannels;
+    inputParameters.sampleFormat = PA_SAMPLE_TYPE;
+    inputParameters.suggestedLatency = inputInfo->defaultHighInputLatency ;
+    inputParameters.hostApiSpecificStreamInfo = NULL;
+
+    outputParameters.channelCount = numChannels;
+    outputParameters.sampleFormat = PA_SAMPLE_TYPE;
+    outputParameters.suggestedLatency = outputInfo->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 error2;
+
+    numBytes = FRAMES_PER_BUFFER * numChannels * SAMPLE_SIZE ;
+    sampleBlock = (char *) malloc( numBytes );
+    if( sampleBlock == NULL )
+    {
+        printf("Could not allocate record array.\n");
+        goto error1;
+    }
+    memset( sampleBlock, SAMPLE_SILENCE, numBytes );
+
+    err = Pa_StartStream( stream );
+    if( err != paNoError ) goto error1;
+    printf("Wire on. Will run %d seconds.\n", NUM_SECONDS); fflush(stdout);
+
+    for( i=0; i<(NUM_SECONDS*SAMPLE_RATE)/FRAMES_PER_BUFFER; ++i )
+    {
+        // You may get underruns or overruns if the output is not primed by PortAudio.
+        err = Pa_WriteStream( stream, sampleBlock, FRAMES_PER_BUFFER );
+        if( err ) goto xrun;
+        err = Pa_ReadStream( stream, sampleBlock, FRAMES_PER_BUFFER );
+        if( err ) goto xrun;
+    }
+    printf("Wire off.\n"); fflush(stdout);
+
+    err = Pa_StopStream( stream );
+    if( err != paNoError ) goto error1;
+
+    free( sampleBlock );
+
+    Pa_Terminate();
+    return 0;
+
+xrun:
+    printf("err = %d\n", err); fflush(stdout);
+    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;
+error1:
+    free( sampleBlock );
+error2:
+    if( stream ) {
+       Pa_AbortStream( stream );
+       Pa_CloseStream( stream );
+    }
+    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.c b/examples/paex_record.c
index 25a99e9..99226fc 100644
--- a/examples/paex_record.c
+++ b/examples/paex_record.c
@@ -4,7 +4,7 @@
 	@author Phil Burk  http://www.softsynth.com
 */
 /*
- * $Id: paex_record.c 1752 2011-09-08 03:21:55Z philburk $
+ * $Id$
  *
  * This program uses the PortAudio Portable Audio Library.
  * For more information see: http://www.portaudio.com
diff --git a/examples/paex_record_file.c b/examples/paex_record_file.c
index 0d19f06..1f1211f 100644
--- a/examples/paex_record_file.c
+++ b/examples/paex_record_file.c
@@ -1,453 +1,458 @@
-/** @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 <stdio.h>
-#include <stdlib.h>
-#include "portaudio.h"
-#include "pa_ringbuffer.h"
-#include "pa_util.h"
-
-#ifdef _WIN32
-#include <windows.h>
-#include <process.h>
-#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 <stdio.h>
+#include <stdlib.h>
+#include "portaudio.h"
+#include "pa_ringbuffer.h"
+#include "pa_util.h"
+
+#ifdef _WIN32
+#include <windows.h>
+#include <process.h>
+#endif
+
+static ring_buffer_size_t rbs_min(ring_buffer_size_t a, ring_buffer_size_t b)
+{
+    return (a < b) ? a : b;
+}
+
+/* #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 = rbs_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 = rbs_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_saw.c b/examples/paex_saw.c
index ce62ab5..235f247 100644
--- a/examples/paex_saw.c
+++ b/examples/paex_saw.c
@@ -4,7 +4,7 @@
 	@author Phil Burk  http://www.softsynth.com
 */
 /*
- * $Id: paex_saw.c 1752 2011-09-08 03:21:55Z philburk $
+ * $Id$
  *
  * This program uses the PortAudio Portable Audio Library.
  * For more information see: http://www.portaudio.com
diff --git a/examples/paex_sine.c b/examples/paex_sine.c
index 5ca53c0..bda290b 100644
--- a/examples/paex_sine.c
+++ b/examples/paex_sine.c
@@ -5,7 +5,7 @@
     @author Phil Burk <philburk at softsynth.com>
 */
 /*
- * $Id: paex_sine.c 1752 2011-09-08 03:21:55Z philburk $
+ * $Id$
  *
  * This program uses the PortAudio Portable Audio Library.
  * For more information see: http://www.portaudio.com/
@@ -113,9 +113,8 @@ int main(void)
     paTestData data;
     int i;
 
-    
     printf("PortAudio Test: output sine wave. SR = %d, BufSize = %d\n", SAMPLE_RATE, FRAMES_PER_BUFFER);
-    
+
     /* initialise sinusoidal wavetable */
     for( i=0; i<TABLE_SIZE; i++ )
     {
diff --git a/examples/paex_sine_c++.cpp b/examples/paex_sine_c++.cpp
index 5b96aee..2859a57 100644
--- a/examples/paex_sine_c++.cpp
+++ b/examples/paex_sine_c++.cpp
@@ -1,252 +1,275 @@
-/** @file paex_sine.c
-	@ingroup examples_src
-	@brief Play a sine wave for several seconds.
-	@author Ross Bencina <rossb at audiomulch.com>
-    @author Phil Burk <philburk at softsynth.com>
-*/
-/*
- * $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 <stdio.h>
-#include <math.h>
-#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; i<TABLE_SIZE; i++ )
-        {
-            sine[i] = (float) sin( ((double)i/(double)TABLE_SIZE) * M_PI * 2. );
-        }
-
-        sprintf( message, "No Message" );
-    }
-
-    bool open(PaDeviceIndex index)
-    {
-        PaStreamParameters outputParameters;
-
-        outputParameters.device = index;
-        if (outputParameters.device == paNoDevice) {
-            return false;
-        }
-
-        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,
-            FRAMES_PER_BUFFER,
-            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<framesPerBuffer; i++ )
-        {
-            *out++ = sine[left_phase];  /* left */
-            *out++ = sine[right_phase];  /* right */
-            left_phase += 1;
-            if( left_phase >= 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];
-};
-
-
-/*******************************************************************/
-int main(void);
-int main(void)
-{
-    PaError err;
-    Sine sine;
-
-    printf("PortAudio Test: output sine wave. SR = %d, BufSize = %d\n", SAMPLE_RATE, FRAMES_PER_BUFFER);
-    
-    err = Pa_Initialize();
-    if( err != 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();
-    }
-
-    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_sine.c
+	@ingroup examples_src
+	@brief Play a sine wave for several seconds.
+	@author Ross Bencina <rossb at audiomulch.com>
+    @author Phil Burk <philburk at softsynth.com>
+*/
+/*
+ * $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 <stdio.h>
+#include <math.h>
+#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; i<TABLE_SIZE; i++ )
+        {
+            sine[i] = (float) sin( ((double)i/(double)TABLE_SIZE) * M_PI * 2. );
+        }
+
+        sprintf( message, "No Message" );
+    }
+
+    bool open(PaDeviceIndex index)
+    {
+        PaStreamParameters outputParameters;
+
+        outputParameters.device = index;
+        if (outputParameters.device == paNoDevice) {
+            return false;
+        }
+
+        const PaDeviceInfo* pInfo = Pa_GetDeviceInfo(index);
+        if (pInfo != 0)
+        {
+            printf("Output device name: '%s'\r", pInfo->name);
+        }
+
+        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<framesPerBuffer; i++ )
+        {
+            *out++ = sine[left_phase];  /* left */
+            *out++ = sine[right_phase];  /* right */
+            left_phase += 1;
+            if( left_phase >= 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 e7b4554..e59c571 100644
--- a/examples/paex_wmme_ac3.c
+++ b/examples/paex_wmme_ac3.c
@@ -1,222 +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 <rossb at audiomulch.com>
-*/
-/*
- * $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 <stdio.h>
-#include <math.h>
-
-#include <windows.h>    /* required when using pa_win_wmme.h */
-#include <mmsystem.h>   /* 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; i<framesPerBuffer; i++ )
-    {
-		for( j = 0; j < CHANNEL_COUNT; ++j ){
-            *out++ = data->buffer[ 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 i;
-    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 <rossb at audiomulch.com>
+*/
+/*
+ * $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 <stdio.h>
+#include <math.h>
+
+#include <windows.h>    /* required when using pa_win_wmme.h */
+#include <mmsystem.h>   /* 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; i<framesPerBuffer; i++ )
+    {
+		for( j = 0; j < CHANNEL_COUNT; ++j ){
+            *out++ = data->buffer[ 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 <rossb at audiomulch.com>
-*/
-/*
- * $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 <stdio.h>
-#include <math.h>
-
-#include <windows.h>    /* required when using pa_win_wmme.h */
-#include <mmsystem.h>   /* 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; i<framesPerBuffer; i++ )
-    {
-		for( j = 0; j < CHANNEL_COUNT; ++j ){
-			if( j == data->currentChannel && 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; i<TABLE_SIZE; i++ )
-    {
-        data.sine[i] = (float) sin( ((double)i/(double)TABLE_SIZE) * M_PI * 2. );
-    }
-
-	data.phase = 0;
-	data.currentChannel = 0;
-	data.cycleCount = 0;
-
-    outputParameters.device = deviceIndex;
-    outputParameters.channelCount = CHANNEL_COUNT;
-    outputParameters.sampleFormat = paFloat32; /* 32 bit floating point processing */
-    outputParameters.suggestedLatency = Pa_GetDeviceInfo( outputParameters.device )->defaultLowOutputLatency;
-    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 <rossb at audiomulch.com>
+*/
+/*
+ * $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 <stdio.h>
+#include <math.h>
+
+#include <windows.h>    /* required when using pa_win_wmme.h */
+#include <mmsystem.h>   /* 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; i<framesPerBuffer; i++ )
+    {
+		for( j = 0; j < CHANNEL_COUNT; ++j ){
+			if( j == data->currentChannel && 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; i<TABLE_SIZE; i++ )
+    {
+        data.sine[i] = (float) sin( ((double)i/(double)TABLE_SIZE) * M_PI * 2. );
+    }
+
+	data.phase = 0;
+	data.currentChannel = 0;
+	data.cycleCount = 0;
+
+    outputParameters.device = deviceIndex;
+    outputParameters.channelCount = CHANNEL_COUNT;
+    outputParameters.sampleFormat = paFloat32; /* 32 bit floating point processing */
+    outputParameters.suggestedLatency = Pa_GetDeviceInfo( outputParameters.device )->defaultLowOutputLatency;
+    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/examples/paex_write_sine.c b/examples/paex_write_sine.c
index fe554bf..f5ead3f 100644
--- a/examples/paex_write_sine.c
+++ b/examples/paex_write_sine.c
@@ -5,7 +5,7 @@
     @author Phil Burk <philburk at softsynth.com>
 */
 /*
- * $Id: paex_write_sine.c 1865 2012-09-01 21:16:25Z philburk $
+ * $Id$
  *
  * This program uses the PortAudio Portable Audio Library.
  * For more information see: http://www.portaudio.com/
diff --git a/include/pa_asio.h b/include/pa_asio.h
index 8f4624e..9c606a9 100644
--- a/include/pa_asio.h
+++ b/include/pa_asio.h
@@ -1,7 +1,7 @@
 #ifndef PA_ASIO_H
 #define PA_ASIO_H
 /*
- * $Id: pa_asio.h 1667 2011-05-02 15:49:20Z rossb $
+ * $Id$
  * PortAudio Portable Real-Time Audio Library
  * ASIO specific extensions
  *
diff --git a/include/pa_linux_alsa.h b/include/pa_linux_alsa.h
index 21627bd..7ac6736 100644
--- a/include/pa_linux_alsa.h
+++ b/include/pa_linux_alsa.h
@@ -2,7 +2,7 @@
 #define PA_LINUX_ALSA_H
 
 /*
- * $Id: pa_linux_alsa.h 1597 2011-02-11 00:15:51Z dmitrykos $
+ * $Id$
  * PortAudio Portable Real-Time Audio Library
  * ALSA-specific extensions
  *
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 64eb49b..1d86896 100644
--- a/include/pa_win_wasapi.h
+++ b/include/pa_win_wasapi.h
@@ -1,391 +1,443 @@
-#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 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 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;
-} 
-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
+
+ @version Available as of 19.6.0
+*/
+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
+
+ @version Available as of 19.6.0
+*/
+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.
+     @see PaWasapiStreamCategory
+     @version Available as of 19.6.0
+    */
+    PaWasapiStreamCategory streamCategory;
+
+    /** Stream option.
+     @see PaWasapiStreamOption
+     @version Available as of 19.6.0
+    */
+    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/include/pa_win_wdmks.h b/include/pa_win_wdmks.h
index 9fe9284..3592962 100644
--- a/include/pa_win_wdmks.h
+++ b/include/pa_win_wdmks.h
@@ -1,7 +1,7 @@
 #ifndef PA_WIN_WDMKS_H
 #define PA_WIN_WDMKS_H
 /*
- * $Id: pa_win_wdmks.h 1812 2012-02-14 09:32:57Z robiwan $
+ * $Id$
  * PortAudio Portable Real-Time Audio Library
  * WDM/KS specific extensions
  *
@@ -52,13 +52,44 @@
 extern "C"
 {
 #endif /* __cplusplus */
+
+    /** Flags to indicate valid fields in PaWinWDMKSInfo.
+     @see PaWinWDMKSInfo
+     @version Available as of 19.5.0.
+    */
+    typedef enum PaWinWDMKSFlags
+    {
+        /** Makes WDMKS use the supplied latency figures instead of relying on the frame size reported
+         by the WaveCyclic device. Use at own risk!
+        */
+        paWinWDMKSOverrideFramesize   = (1 << 0),
+
+        /** Makes WDMKS (output stream) use the given channelMask instead of the default.
+          @version Available as of 19.5.0.
+        */
+        paWinWDMKSUseGivenChannelMask = (1 << 1),
+
+    } PaWinWDMKSFlags;
+
     typedef struct PaWinWDMKSInfo{
         unsigned long size;             /**< sizeof(PaWinWDMKSInfo) */
         PaHostApiTypeId hostApiType;    /**< paWDMKS */
         unsigned long version;          /**< 1 */
 
-        /* The number of packets to use for WaveCyclic devices, range is [2, 8]. Set to zero for default value of 2. */
+        /** Flags indicate which fields are valid.
+         @see PaWinWDMKSFlags
+         @version Available as of 19.5.0.
+        */
+        unsigned long flags;
+
+        /** The number of packets to use for WaveCyclic devices, range is [2, 8]. Set to zero for default value of 2. */
         unsigned noOfPackets;
+
+        /** If paWinWDMKSUseGivenChannelMask bit is set in flags, use this as channelMask instead of default.
+         @see PaWinWDMKSFlags
+         @version Available as of 19.5.0.
+        */
+        unsigned channelMask;
     } PaWinWDMKSInfo;
 
     typedef enum PaWDMKSType
diff --git a/include/pa_win_wmme.h b/include/pa_win_wmme.h
index ac5efe7..f84b68b 100644
--- a/include/pa_win_wmme.h
+++ b/include/pa_win_wmme.h
@@ -1,7 +1,7 @@
 #ifndef PA_WIN_WMME_H
 #define PA_WIN_WMME_H
 /*
- * $Id: pa_win_wmme.h 1592 2011-02-04 10:41:58Z rossb $
+ * $Id$
  * PortAudio Portable Real-Time Audio Library
  * MME specific extensions
  *
diff --git a/include/portaudio.h b/include/portaudio.h
index 5e11dad..8a94aaf 100644
--- a/include/portaudio.h
+++ b/include/portaudio.h
@@ -1,7 +1,7 @@
 #ifndef PORTAUDIO_H
 #define PORTAUDIO_H
 /*
- * $Id: portaudio.h 1859 2012-09-01 00:10:13Z philburk $
+ * $Id$
  * PortAudio Portable Real-Time Audio Library
  * PortAudio API Header File
  * Latest version available at: http://www.portaudio.com/
@@ -50,18 +50,69 @@ extern "C"
 {
 #endif /* __cplusplus */
 
- 
-/** Retrieve the release number of the currently running PortAudio build,
- eg 1900.
+/** Retrieve the release number of the currently running PortAudio build.
+ For example, for version "19.5.1" this will return 0x00130501.
+
+ @see paMakeVersionNumber
 */
 int Pa_GetVersion( void );
 
-
 /** Retrieve a textual description of the current PortAudio build,
- eg "PortAudio V19-devel 13 October 2002".
+ e.g. "PortAudio V19.5.0-devel, revision 1952M".
+ The format of the text may change in the future. Do not try to parse the
+ returned string.
+
+ @deprecated As of 19.5.0, use Pa_GetVersionInfo()->versionText instead.
 */
 const char* Pa_GetVersionText( void );
 
+/**
+ Generate a packed integer version number in the same format used
+ by Pa_GetVersion(). Use this to compare a specified version number with
+ the currently running version. For example:
+
+ @code
+     if( Pa_GetVersion() < paMakeVersionNumber(19,5,1) ) {}
+ @endcode
+
+ @see Pa_GetVersion, Pa_GetVersionInfo
+ @version Available as of 19.5.0.
+*/
+#define paMakeVersionNumber(major, minor, subminor) \
+    (((major)&0xFF)<<16 | ((minor)&0xFF)<<8 | ((subminor)&0xFF))
+
+
+/**
+ A structure containing PortAudio API version information.
+ @see Pa_GetVersionInfo, paMakeVersionNumber
+ @version Available as of 19.5.0.
+*/
+typedef struct PaVersionInfo {
+    int versionMajor;
+    int versionMinor;
+    int versionSubMinor;
+    /**
+     This is currently the Git revision hash but may change in the future.
+     The versionControlRevision is updated by running a script before compiling the library.
+     If the update does not occur, this value may refer to an earlier revision.
+    */
+    const char *versionControlRevision;
+    /** Version as a string, for example "PortAudio V19.5.0-devel, revision 1952M" */
+    const char *versionText;
+} PaVersionInfo;
+    
+/** Retrieve version information for the currently running PortAudio build.
+ @return A pointer to an immutable PaVersionInfo structure.
+
+ @note This function can be called at any time. It does not require PortAudio
+ to be initialized. The structure pointed to is statically allocated. Do not
+ attempt to free it or modify it.
+
+ @see PaVersionInfo, paMakeVersionNumber
+ @version Available as of 19.5.0.
+*/
+const PaVersionInfo* Pa_GetVersionInfo();
+
 
 /** Error codes returned by PortAudio functions.
  Note that with the exception of paNoError, all PaErrorCodes are negative.
@@ -900,7 +951,7 @@ PaError Pa_CloseStream( PaStream *stream );
  (ie once a call to Pa_StopStream() will not block).
  A stream will become inactive after the stream callback returns non-zero,
  or when Pa_StopStream or Pa_AbortStream is called. For a stream providing audio
- output, if the stream callback returns paComplete, or Pa_StopStream is called,
+ output, if the stream callback returns paComplete, or Pa_StopStream() is called,
  the stream finished callback will not be called until all generated sample data
  has been played.
  
@@ -1098,7 +1149,7 @@ PaError Pa_ReadStream( PaStream* stream,
 
 
 /** Write samples to an output stream. This function doesn't return until the
- entire buffer has been consumed - this may involve waiting for the operating
+ entire buffer has been written - this may involve waiting for the operating
  system to consume the data.
 
  @param stream A pointer to an open stream previously created with Pa_OpenStream.
diff --git a/install-sh b/install-sh
index 6781b98..377bb86 100755
--- a/install-sh
+++ b/install-sh
@@ -1,7 +1,7 @@
 #!/bin/sh
 # install - install a program, script, or datafile
 
-scriptversion=2009-04-28.21; # UTC
+scriptversion=2011-11-20.07; # UTC
 
 # This originates from X11R5 (mit/util/scripts/install.sh), which was
 # later released in X11R6 (xc/config/util/install.sh) with the
@@ -35,7 +35,7 @@ scriptversion=2009-04-28.21; # UTC
 # FSF changes to this file are in the public domain.
 #
 # Calling this script install-sh is preferred over install.sh, to prevent
-# `make' implicit rules from creating a file called install from it
+# 'make' implicit rules from creating a file called install from it
 # when there is no Makefile.
 #
 # This script is compatible with the BSD install script, but was written
@@ -156,6 +156,10 @@ while test $# -ne 0; do
     -s) stripcmd=$stripprog;;
 
     -t) dst_arg=$2
+	# Protect names problematic for 'test' and other utilities.
+	case $dst_arg in
+	  -* | [=\(\)!]) dst_arg=./$dst_arg;;
+	esac
 	shift;;
 
     -T) no_target_directory=true;;
@@ -186,6 +190,10 @@ if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
     fi
     shift # arg
     dst_arg=$arg
+    # Protect names problematic for 'test' and other utilities.
+    case $dst_arg in
+      -* | [=\(\)!]) dst_arg=./$dst_arg;;
+    esac
   done
 fi
 
@@ -194,13 +202,17 @@ if test $# -eq 0; then
     echo "$0: no input file specified." >&2
     exit 1
   fi
-  # It's OK to call `install-sh -d' without argument.
+  # It's OK to call 'install-sh -d' without argument.
   # This can happen when creating conditional directories.
   exit 0
 fi
 
 if test -z "$dir_arg"; then
-  trap '(exit $?); exit' 1 2 13 15
+  do_exit='(exit $ret); exit $ret'
+  trap "ret=129; $do_exit" 1
+  trap "ret=130; $do_exit" 2
+  trap "ret=141; $do_exit" 13
+  trap "ret=143; $do_exit" 15
 
   # Set umask so as not to create temps with too-generous modes.
   # However, 'strip' requires both read and write access to temps.
@@ -228,9 +240,9 @@ fi
 
 for src
 do
-  # Protect names starting with `-'.
+  # Protect names problematic for 'test' and other utilities.
   case $src in
-    -*) src=./$src;;
+    -* | [=\(\)!]) src=./$src;;
   esac
 
   if test -n "$dir_arg"; then
@@ -252,12 +264,7 @@ do
       echo "$0: no destination specified." >&2
       exit 1
     fi
-
     dst=$dst_arg
-    # Protect names starting with `-'.
-    case $dst in
-      -*) dst=./$dst;;
-    esac
 
     # If destination is a directory, append the input filename; won't work
     # if double slashes aren't ignored.
@@ -347,7 +354,7 @@ do
 	      if test -z "$dir_arg" || {
 		   # Check for POSIX incompatibilities with -m.
 		   # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
-		   # other-writeable bit of parent directory when it shouldn't.
+		   # other-writable bit of parent directory when it shouldn't.
 		   # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
 		   ls_ld_tmpdir=`ls -ld "$tmpdir"`
 		   case $ls_ld_tmpdir in
@@ -385,7 +392,7 @@ do
 
       case $dstdir in
 	/*) prefix='/';;
-	-*) prefix='./';;
+	[-=\(\)!]*) prefix='./';;
 	*)  prefix='';;
       esac
 
@@ -403,7 +410,7 @@ do
 
       for d
       do
-	test -z "$d" && continue
+	test X"$d" = X && continue
 
 	prefix=$prefix$d
 	if test -d "$prefix"; then
diff --git a/ltmain.sh b/ltmain.sh
index b4a3231..a356aca 100644
--- a/ltmain.sh
+++ b/ltmain.sh
@@ -1,9 +1,9 @@
 
-# libtool (GNU libtool) 2.4
+# libtool (GNU libtool) 2.4.2
 # Written by Gordon Matzigkeit <gord at gnu.ai.mit.edu>, 1996
 
 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
-# 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+# 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
 # This is free software; see the source for copying conditions.  There is NO
 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
@@ -41,6 +41,7 @@
 #       --quiet, --silent    don't print informational messages
 #       --no-quiet, --no-silent
 #                            print informational messages (default)
+#       --no-warn            don't display warning messages
 #       --tag=TAG            use configuration variables from tag TAG
 #   -v, --verbose            print more informational messages than default
 #       --no-verbose         don't print the extra informational messages
@@ -69,7 +70,7 @@
 #         compiler:		$LTCC
 #         compiler flags:		$LTCFLAGS
 #         linker:		$LD (gnu? $with_gnu_ld)
-#         $progname:	(GNU libtool) 2.4 Debian-2.4-2ubuntu1
+#         $progname:	(GNU libtool) 2.4.2 Debian-2.4.2-1.7ubuntu1
 #         automake:	$automake_version
 #         autoconf:	$autoconf_version
 #
@@ -79,9 +80,9 @@
 
 PROGRAM=libtool
 PACKAGE=libtool
-VERSION="2.4 Debian-2.4-2ubuntu1"
+VERSION="2.4.2 Debian-2.4.2-1.7ubuntu1"
 TIMESTAMP=""
-package_revision=1.3293
+package_revision=1.3337
 
 # Be Bourne compatible
 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
@@ -136,15 +137,10 @@ progpath="$0"
 
 : ${CP="cp -f"}
 test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'}
-: ${EGREP="/bin/grep -E"}
-: ${FGREP="/bin/grep -F"}
-: ${GREP="/bin/grep"}
-: ${LN_S="ln -s"}
 : ${MAKE="make"}
 : ${MKDIR="mkdir"}
 : ${MV="mv -f"}
 : ${RM="rm -f"}
-: ${SED="/bin/sed"}
 : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
 : ${Xsed="$SED -e 1s/^X//"}
 
@@ -387,7 +383,7 @@ case $progpath in
      ;;
   *)
      save_IFS="$IFS"
-     IFS=:
+     IFS=${PATH_SEPARATOR-:}
      for progdir in $PATH; do
        IFS="$save_IFS"
        test -x "$progdir/$progname" && break
@@ -771,8 +767,8 @@ func_help ()
 	s*\$LTCFLAGS*'"$LTCFLAGS"'*
 	s*\$LD*'"$LD"'*
 	s/\$with_gnu_ld/'"$with_gnu_ld"'/
-	s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/
-	s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/
+	s/\$automake_version/'"`(${AUTOMAKE-automake} --version) 2>/dev/null |$SED 1q`"'/
+	s/\$autoconf_version/'"`(${AUTOCONF-autoconf} --version) 2>/dev/null |$SED 1q`"'/
 	p
 	d
      }
@@ -1052,6 +1048,7 @@ opt_finish=false
 opt_help=false
 opt_help_all=false
 opt_silent=:
+opt_warning=:
 opt_verbose=:
 opt_silent=false
 opt_verbose=false
@@ -1120,6 +1117,10 @@ esac
 			opt_silent=false
 func_append preserve_args " $opt"
 			;;
+      --no-warning|--no-warn)
+			opt_warning=false
+func_append preserve_args " $opt"
+			;;
       --no-verbose)
 			opt_verbose=false
 func_append preserve_args " $opt"
@@ -2059,7 +2060,7 @@ func_mode_compile ()
     *.[cCFSifmso] | \
     *.ada | *.adb | *.ads | *.asm | \
     *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
-    *.[fF][09]? | *.for | *.java | *.obj | *.sx | *.cu | *.cup)
+    *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup)
       func_xform "$libobj"
       libobj=$func_xform_result
       ;;
@@ -3201,11 +3202,13 @@ func_mode_install ()
 
       # Set up the ranlib parameters.
       oldlib="$destdir/$name"
+      func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
+      tool_oldlib=$func_to_tool_file_result
 
       func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
 
       if test -n "$stripme" && test -n "$old_striplib"; then
-	func_show_eval "$old_striplib $oldlib" 'exit $?'
+	func_show_eval "$old_striplib $tool_oldlib" 'exit $?'
       fi
 
       # Do each command in the postinstall commands.
@@ -3470,7 +3473,7 @@ static const void *lt_preloaded_setup() {
 	  # linked before any other PIC object.  But we must not use
 	  # pic_flag when linking with -static.  The problem exists in
 	  # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
-	  *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
+	  *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
 	    pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
 	  *-*-hpux*)
 	    pic_flag_for_symtable=" $pic_flag"  ;;
@@ -3982,14 +3985,17 @@ func_exec_program_core ()
 # launches target application with the remaining arguments.
 func_exec_program ()
 {
-  for lt_wr_arg
-  do
-    case \$lt_wr_arg in
-    --lt-*) ;;
-    *) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
-    esac
-    shift
-  done
+  case \" \$* \" in
+  *\\ --lt-*)
+    for lt_wr_arg
+    do
+      case \$lt_wr_arg in
+      --lt-*) ;;
+      *) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
+      esac
+      shift
+    done ;;
+  esac
   func_exec_program_core \${1+\"\$@\"}
 }
 
@@ -5057,9 +5063,15 @@ void lt_dump_script (FILE* f)
 {
 EOF
 	    func_emit_wrapper yes |
-              $SED -e 's/\([\\"]\)/\\\1/g' \
-	           -e 's/^/  fputs ("/' -e 's/$/\\n", f);/'
-
+	      $SED -n -e '
+s/^\(.\{79\}\)\(..*\)/\1\
+\2/
+h
+s/\([\\"]\)/\\\1/g
+s/$/\\n/
+s/\([^\n]*\).*/  fputs ("\1", f);/p
+g
+D'
             cat <<"EOF"
 }
 EOF
@@ -5643,7 +5655,8 @@ func_mode_link ()
 	continue
 	;;
 
-      -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
+      -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
+      |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
 	func_append compiler_flags " $arg"
 	func_append compile_command " $arg"
 	func_append finalize_command " $arg"
@@ -6150,7 +6163,8 @@ func_mode_link ()
 	lib=
 	found=no
 	case $deplib in
-	-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
+	-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
+        |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
 	  if test "$linkmode,$pass" = "prog,link"; then
 	    compile_deplibs="$deplib $compile_deplibs"
 	    finalize_deplibs="$deplib $finalize_deplibs"
@@ -6834,7 +6848,7 @@ func_mode_link ()
 	         test "$hardcode_direct_absolute" = no; then
 		add="$dir/$linklib"
 	      elif test "$hardcode_minus_L" = yes; then
-		add_dir="-L$dir"
+		add_dir="-L$absdir"
 		# Try looking first in the location we're being installed to.
 		if test -n "$inst_prefix_dir"; then
 		  case $libdir in
@@ -7319,6 +7333,7 @@ func_mode_link ()
 	  # which has an extra 1 added just for fun
 	  #
 	  case $version_type in
+	  # correct linux to gnu/linux during the next big refactor
 	  darwin|linux|osf|windows|none)
 	    func_arith $number_major + $number_minor
 	    current=$func_arith_result
@@ -7438,7 +7453,7 @@ func_mode_link ()
 	  versuffix="$major.$revision"
 	  ;;
 
-	linux)
+	linux) # correct to gnu/linux during the next big refactor
 	  func_arith $current - $age
 	  major=.$func_arith_result
 	  versuffix="$major.$age.$revision"
@@ -8026,6 +8041,11 @@ EOF
 
       # Test again, we may have decided not to build it any more
       if test "$build_libtool_libs" = yes; then
+	# Remove ${wl} instances when linking with ld.
+	# FIXME: should test the right _cmds variable.
+	case $archive_cmds in
+	  *\$LD\ *) wl= ;;
+        esac
 	if test "$hardcode_into_libs" = yes; then
 	  # Hardcode the library paths
 	  hardcode_libdirs=
@@ -8056,7 +8076,7 @@ EOF
 	    elif test -n "$runpath_var"; then
 	      case "$perm_rpath " in
 	      *" $libdir "*) ;;
-	      *) func_apped perm_rpath " $libdir" ;;
+	      *) func_append perm_rpath " $libdir" ;;
 	      esac
 	    fi
 	  done
@@ -8064,11 +8084,7 @@ EOF
 	  if test -n "$hardcode_libdir_separator" &&
 	     test -n "$hardcode_libdirs"; then
 	    libdir="$hardcode_libdirs"
-	    if test -n "$hardcode_libdir_flag_spec_ld"; then
-	      eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
-	    else
-	      eval dep_rpath=\"$hardcode_libdir_flag_spec\"
-	    fi
+	    eval "dep_rpath=\"$hardcode_libdir_flag_spec\""
 	  fi
 	  if test -n "$runpath_var" && test -n "$perm_rpath"; then
 	    # We should set the runpath_var.
@@ -9158,6 +9174,8 @@ EOF
 	    esac
 	  done
 	fi
+	func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
+	tool_oldlib=$func_to_tool_file_result
 	eval cmds=\"$old_archive_cmds\"
 
 	func_len " $cmds"
@@ -9267,7 +9285,8 @@ EOF
 	      *.la)
 		func_basename "$deplib"
 		name="$func_basename_result"
-		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
+		func_resolve_sysroot "$deplib"
+		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result`
 		test -z "$libdir" && \
 		  func_fatal_error "\`$deplib' is not a valid libtool archive"
 		func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name"
diff --git a/missing b/missing
index 28055d2..db98974 100755
--- a/missing
+++ b/missing
@@ -1,11 +1,10 @@
 #! /bin/sh
-# Common stub for a few missing GNU programs while installing.
+# Common wrapper for a few potentially missing GNU programs.
 
-scriptversion=2009-04-28.21; # UTC
+scriptversion=2013-10-28.13; # UTC
 
-# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006,
-# 2008, 2009 Free Software Foundation, Inc.
-# Originally by Fran,cois Pinard <pinard at iro.umontreal.ca>, 1996.
+# Copyright (C) 1996-2013 Free Software Foundation, Inc.
+# Originally written by Fran,cois Pinard <pinard at iro.umontreal.ca>, 1996.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -26,69 +25,40 @@ scriptversion=2009-04-28.21; # UTC
 # the same distribution terms that you use for the rest of that program.
 
 if test $# -eq 0; then
-  echo 1>&2 "Try \`$0 --help' for more information"
+  echo 1>&2 "Try '$0 --help' for more information"
   exit 1
 fi
 
-run=:
-sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
-sed_minuso='s/.* -o \([^ ]*\).*/\1/p'
-
-# In the cases where this matters, `missing' is being run in the
-# srcdir already.
-if test -f configure.ac; then
-  configure_ac=configure.ac
-else
-  configure_ac=configure.in
-fi
+case $1 in
 
-msg="missing on your system"
+  --is-lightweight)
+    # Used by our autoconf macros to check whether the available missing
+    # script is modern enough.
+    exit 0
+    ;;
 
-case $1 in
---run)
-  # Try to run requested program, and just exit if it succeeds.
-  run=
-  shift
-  "$@" && exit 0
-  # Exit code 63 means version mismatch.  This often happens
-  # when the user try to use an ancient version of a tool on
-  # a file that requires a minimum version.  In this case we
-  # we should proceed has if the program had been absent, or
-  # if --run hadn't been passed.
-  if test $? = 63; then
-    run=:
-    msg="probably too old"
-  fi
-  ;;
+  --run)
+    # Back-compat with the calling convention used by older automake.
+    shift
+    ;;
 
   -h|--h|--he|--hel|--help)
     echo "\
 $0 [OPTION]... PROGRAM [ARGUMENT]...
 
-Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
-error status if there is no known handling for PROGRAM.
+Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due
+to PROGRAM being missing or too old.
 
 Options:
   -h, --help      display this help and exit
   -v, --version   output version information and exit
-  --run           try to run the given command, and emulate it if it fails
 
 Supported PROGRAM values:
-  aclocal      touch file \`aclocal.m4'
-  autoconf     touch file \`configure'
-  autoheader   touch file \`config.h.in'
-  autom4te     touch the output file, or create a stub one
-  automake     touch all \`Makefile.in' files
-  bison        create \`y.tab.[ch]', if possible, from existing .[ch]
-  flex         create \`lex.yy.c', if possible, from existing .c
-  help2man     touch the output file
-  lex          create \`lex.yy.c', if possible, from existing .c
-  makeinfo     touch the output file
-  tar          try tar, gnutar, gtar, then tar without non-portable flags
-  yacc         create \`y.tab.[ch]', if possible, from existing .[ch]
+  aclocal   autoconf  autoheader   autom4te  automake  makeinfo
+  bison     yacc      flex         lex       help2man
 
-Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and
-\`g' are ignored when checking the name.
+Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and
+'g' are ignored when checking the name.
 
 Send bug reports to <bug-automake at gnu.org>."
     exit $?
@@ -100,272 +70,141 @@ Send bug reports to <bug-automake at gnu.org>."
     ;;
 
   -*)
-    echo 1>&2 "$0: Unknown \`$1' option"
-    echo 1>&2 "Try \`$0 --help' for more information"
+    echo 1>&2 "$0: unknown '$1' option"
+    echo 1>&2 "Try '$0 --help' for more information"
     exit 1
     ;;
 
 esac
 
-# normalize program name to check for.
-program=`echo "$1" | sed '
-  s/^gnu-//; t
-  s/^gnu//; t
-  s/^g//; t'`
-
-# Now exit if we have it, but it failed.  Also exit now if we
-# don't have it and --version was passed (most likely to detect
-# the program).  This is about non-GNU programs, so use $1 not
-# $program.
-case $1 in
-  lex*|yacc*)
-    # Not GNU programs, they don't have --version.
-    ;;
-
-  tar*)
-    if test -n "$run"; then
-       echo 1>&2 "ERROR: \`tar' requires --run"
-       exit 1
-    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
-       exit 1
-    fi
-    ;;
-
-  *)
-    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
-       # We have it, but it failed.
-       exit 1
-    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
-       # Could not run --version or --help.  This is probably someone
-       # running `$TOOL --version' or `$TOOL --help' to check whether
-       # $TOOL exists and not knowing $TOOL uses missing.
-       exit 1
-    fi
-    ;;
-esac
-
-# If it does not exist, or fails to run (possibly an outdated version),
-# try to emulate it.
-case $program in
-  aclocal*)
-    echo 1>&2 "\
-WARNING: \`$1' is $msg.  You should only need it if
-         you modified \`acinclude.m4' or \`${configure_ac}'.  You might want
-         to install the \`Automake' and \`Perl' packages.  Grab them from
-         any GNU archive site."
-    touch aclocal.m4
-    ;;
-
-  autoconf*)
-    echo 1>&2 "\
-WARNING: \`$1' is $msg.  You should only need it if
-         you modified \`${configure_ac}'.  You might want to install the
-         \`Autoconf' and \`GNU m4' packages.  Grab them from any GNU
-         archive site."
-    touch configure
-    ;;
-
-  autoheader*)
-    echo 1>&2 "\
-WARNING: \`$1' is $msg.  You should only need it if
-         you modified \`acconfig.h' or \`${configure_ac}'.  You might want
-         to install the \`Autoconf' and \`GNU m4' packages.  Grab them
-         from any GNU archive site."
-    files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
-    test -z "$files" && files="config.h"
-    touch_files=
-    for f in $files; do
-      case $f in
-      *:*) touch_files="$touch_files "`echo "$f" |
-				       sed -e 's/^[^:]*://' -e 's/:.*//'`;;
-      *) touch_files="$touch_files $f.in";;
-      esac
-    done
-    touch $touch_files
-    ;;
-
-  automake*)
-    echo 1>&2 "\
-WARNING: \`$1' is $msg.  You should only need it if
-         you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
-         You might want to install the \`Automake' and \`Perl' packages.
-         Grab them from any GNU archive site."
-    find . -type f -name Makefile.am -print |
-	   sed 's/\.am$/.in/' |
-	   while read f; do touch "$f"; done
-    ;;
-
-  autom4te*)
-    echo 1>&2 "\
-WARNING: \`$1' is needed, but is $msg.
-         You might have modified some files without having the
-         proper tools for further handling them.
-         You can get \`$1' as part of \`Autoconf' from any GNU
-         archive site."
-
-    file=`echo "$*" | sed -n "$sed_output"`
-    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
-    if test -f "$file"; then
-	touch $file
-    else
-	test -z "$file" || exec >$file
-	echo "#! /bin/sh"
-	echo "# Created by GNU Automake missing as a replacement of"
-	echo "#  $ $@"
-	echo "exit 0"
-	chmod +x $file
-	exit 1
-    fi
-    ;;
-
-  bison*|yacc*)
-    echo 1>&2 "\
-WARNING: \`$1' $msg.  You should only need it if
-         you modified a \`.y' file.  You may need the \`Bison' package
-         in order for those modifications to take effect.  You can get
-         \`Bison' from any GNU archive site."
-    rm -f y.tab.c y.tab.h
-    if test $# -ne 1; then
-        eval LASTARG="\${$#}"
-	case $LASTARG in
-	*.y)
-	    SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
-	    if test -f "$SRCFILE"; then
-	         cp "$SRCFILE" y.tab.c
-	    fi
-	    SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
-	    if test -f "$SRCFILE"; then
-	         cp "$SRCFILE" y.tab.h
-	    fi
-	  ;;
-	esac
-    fi
-    if test ! -f y.tab.h; then
-	echo >y.tab.h
-    fi
-    if test ! -f y.tab.c; then
-	echo 'main() { return 0; }' >y.tab.c
-    fi
-    ;;
-
-  lex*|flex*)
-    echo 1>&2 "\
-WARNING: \`$1' is $msg.  You should only need it if
-         you modified a \`.l' file.  You may need the \`Flex' package
-         in order for those modifications to take effect.  You can get
-         \`Flex' from any GNU archive site."
-    rm -f lex.yy.c
-    if test $# -ne 1; then
-        eval LASTARG="\${$#}"
-	case $LASTARG in
-	*.l)
-	    SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
-	    if test -f "$SRCFILE"; then
-	         cp "$SRCFILE" lex.yy.c
-	    fi
-	  ;;
-	esac
-    fi
-    if test ! -f lex.yy.c; then
-	echo 'main() { return 0; }' >lex.yy.c
-    fi
-    ;;
-
-  help2man*)
-    echo 1>&2 "\
-WARNING: \`$1' is $msg.  You should only need it if
-	 you modified a dependency of a manual page.  You may need the
-	 \`Help2man' package in order for those modifications to take
-	 effect.  You can get \`Help2man' from any GNU archive site."
-
-    file=`echo "$*" | sed -n "$sed_output"`
-    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
-    if test -f "$file"; then
-	touch $file
-    else
-	test -z "$file" || exec >$file
-	echo ".ab help2man is required to generate this page"
-	exit $?
-    fi
-    ;;
-
-  makeinfo*)
-    echo 1>&2 "\
-WARNING: \`$1' is $msg.  You should only need it if
-         you modified a \`.texi' or \`.texinfo' file, or any other file
-         indirectly affecting the aspect of the manual.  The spurious
-         call might also be the consequence of using a buggy \`make' (AIX,
-         DU, IRIX).  You might want to install the \`Texinfo' package or
-         the \`GNU make' package.  Grab either from any GNU archive site."
-    # The file to touch is that specified with -o ...
-    file=`echo "$*" | sed -n "$sed_output"`
-    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
-    if test -z "$file"; then
-      # ... or it is the one specified with @setfilename ...
-      infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
-      file=`sed -n '
-	/^@setfilename/{
-	  s/.* \([^ ]*\) *$/\1/
-	  p
-	  q
-	}' $infile`
-      # ... or it is derived from the source name (dir/f.texi becomes f.info)
-      test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
-    fi
-    # If the file does not exist, the user really needs makeinfo;
-    # let's fail without touching anything.
-    test -f $file || exit 1
-    touch $file
-    ;;
-
-  tar*)
-    shift
-
-    # We have already tried tar in the generic part.
-    # Look for gnutar/gtar before invocation to avoid ugly error
-    # messages.
-    if (gnutar --version > /dev/null 2>&1); then
-       gnutar "$@" && exit 0
-    fi
-    if (gtar --version > /dev/null 2>&1); then
-       gtar "$@" && exit 0
-    fi
-    firstarg="$1"
-    if shift; then
-	case $firstarg in
-	*o*)
-	    firstarg=`echo "$firstarg" | sed s/o//`
-	    tar "$firstarg" "$@" && exit 0
-	    ;;
-	esac
-	case $firstarg in
-	*h*)
-	    firstarg=`echo "$firstarg" | sed s/h//`
-	    tar "$firstarg" "$@" && exit 0
-	    ;;
-	esac
-    fi
-
-    echo 1>&2 "\
-WARNING: I can't seem to be able to run \`tar' with the given arguments.
-         You may want to install GNU tar or Free paxutils, or check the
-         command line arguments."
-    exit 1
-    ;;
-
-  *)
-    echo 1>&2 "\
-WARNING: \`$1' is needed, and is $msg.
-         You might have modified some files without having the
-         proper tools for further handling them.  Check the \`README' file,
-         it often tells you about the needed prerequisites for installing
-         this package.  You may also peek at any GNU archive site, in case
-         some other package would contain this missing \`$1' program."
-    exit 1
-    ;;
-esac
+# Run the given program, remember its exit status.
+"$@"; st=$?
+
+# If it succeeded, we are done.
+test $st -eq 0 && exit 0
+
+# Also exit now if we it failed (or wasn't found), and '--version' was
+# passed; such an option is passed most likely to detect whether the
+# program is present and works.
+case $2 in --version|--help) exit $st;; esac
+
+# Exit code 63 means version mismatch.  This often happens when the user
+# tries to use an ancient version of a tool on a file that requires a
+# minimum version.
+if test $st -eq 63; then
+  msg="probably too old"
+elif test $st -eq 127; then
+  # Program was missing.
+  msg="missing on your system"
+else
+  # Program was found and executed, but failed.  Give up.
+  exit $st
+fi
 
-exit 0
+perl_URL=http://www.perl.org/
+flex_URL=http://flex.sourceforge.net/
+gnu_software_URL=http://www.gnu.org/software
+
+program_details ()
+{
+  case $1 in
+    aclocal|automake)
+      echo "The '$1' program is part of the GNU Automake package:"
+      echo "<$gnu_software_URL/automake>"
+      echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:"
+      echo "<$gnu_software_URL/autoconf>"
+      echo "<$gnu_software_URL/m4/>"
+      echo "<$perl_URL>"
+      ;;
+    autoconf|autom4te|autoheader)
+      echo "The '$1' program is part of the GNU Autoconf package:"
+      echo "<$gnu_software_URL/autoconf/>"
+      echo "It also requires GNU m4 and Perl in order to run:"
+      echo "<$gnu_software_URL/m4/>"
+      echo "<$perl_URL>"
+      ;;
+  esac
+}
+
+give_advice ()
+{
+  # Normalize program name to check for.
+  normalized_program=`echo "$1" | sed '
+    s/^gnu-//; t
+    s/^gnu//; t
+    s/^g//; t'`
+
+  printf '%s\n' "'$1' is $msg."
+
+  configure_deps="'configure.ac' or m4 files included by 'configure.ac'"
+  case $normalized_program in
+    autoconf*)
+      echo "You should only need it if you modified 'configure.ac',"
+      echo "or m4 files included by it."
+      program_details 'autoconf'
+      ;;
+    autoheader*)
+      echo "You should only need it if you modified 'acconfig.h' or"
+      echo "$configure_deps."
+      program_details 'autoheader'
+      ;;
+    automake*)
+      echo "You should only need it if you modified 'Makefile.am' or"
+      echo "$configure_deps."
+      program_details 'automake'
+      ;;
+    aclocal*)
+      echo "You should only need it if you modified 'acinclude.m4' or"
+      echo "$configure_deps."
+      program_details 'aclocal'
+      ;;
+   autom4te*)
+      echo "You might have modified some maintainer files that require"
+      echo "the 'autom4te' program to be rebuilt."
+      program_details 'autom4te'
+      ;;
+    bison*|yacc*)
+      echo "You should only need it if you modified a '.y' file."
+      echo "You may want to install the GNU Bison package:"
+      echo "<$gnu_software_URL/bison/>"
+      ;;
+    lex*|flex*)
+      echo "You should only need it if you modified a '.l' file."
+      echo "You may want to install the Fast Lexical Analyzer package:"
+      echo "<$flex_URL>"
+      ;;
+    help2man*)
+      echo "You should only need it if you modified a dependency" \
+           "of a man page."
+      echo "You may want to install the GNU Help2man package:"
+      echo "<$gnu_software_URL/help2man/>"
+    ;;
+    makeinfo*)
+      echo "You should only need it if you modified a '.texi' file, or"
+      echo "any other file indirectly affecting the aspect of the manual."
+      echo "You might want to install the Texinfo package:"
+      echo "<$gnu_software_URL/texinfo/>"
+      echo "The spurious makeinfo call might also be the consequence of"
+      echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might"
+      echo "want to install GNU make:"
+      echo "<$gnu_software_URL/make/>"
+      ;;
+    *)
+      echo "You might have modified some files without having the proper"
+      echo "tools for further handling them.  Check the 'README' file, it"
+      echo "often tells you about the needed prerequisites for installing"
+      echo "this package.  You may also peek at any GNU archive site, in"
+      echo "case some other package contains this missing '$1' program."
+      ;;
+  esac
+}
+
+give_advice "$1" | sed -e '1s/^/WARNING: /' \
+                       -e '2,$s/^/         /' >&2
+
+# Propagate the correct exit status (expected to be 127 for a program
+# not found, 63 for a program that failed due to version mismatch).
+exit $st
 
 # Local variables:
 # eval: (add-hook 'write-file-hooks 'time-stamp)
diff --git a/pablio/pablio.c b/pablio/pablio.c
index 494702e..2275250 100644
--- a/pablio/pablio.c
+++ b/pablio/pablio.c
@@ -1,5 +1,5 @@
 /*
- * $Id: pablio.c 1151 2006-11-29 02:11:16Z leland_lucius $
+ * $Id$
  * pablio.c
  * Portable Audio Blocking Input/Output utility.
  *
diff --git a/pablio/pablio.h b/pablio/pablio.h
index e941bcf..fbc3ef4 100644
--- a/pablio/pablio.h
+++ b/pablio/pablio.h
@@ -7,7 +7,7 @@ extern "C"
 #endif /* __cplusplus */
 
 /*
- * $Id: pablio.h 1854 2012-07-09 15:53:00Z philburk $
+ * $Id$
  * PABLIO.h
  * Portable Audio Blocking read/write utility.
  *
diff --git a/pablio/test_rw.c b/pablio/test_rw.c
index d717b9a..1388246 100644
--- a/pablio/test_rw.c
+++ b/pablio/test_rw.c
@@ -1,5 +1,5 @@
 /*
- * $Id: test_rw.c 1083 2006-08-23 07:30:49Z rossb $
+ * $Id$
  * test_rw.c
  * Read input from one stream and write it to another.
  *
diff --git a/pablio/test_rw_echo.c b/pablio/test_rw_echo.c
index 3738c9e..470b4b0 100644
--- a/pablio/test_rw_echo.c
+++ b/pablio/test_rw_echo.c
@@ -1,5 +1,5 @@
 /*
- * $Id: test_rw_echo.c 1083 2006-08-23 07:30:49Z rossb $
+ * $Id$
  * test_rw_echo.c
  * Echo delayed input to output.
  *
diff --git a/pablio/test_w_saw.c b/pablio/test_w_saw.c
index 42a3d4f..39efe9e 100644
--- a/pablio/test_w_saw.c
+++ b/pablio/test_w_saw.c
@@ -1,5 +1,5 @@
 /*
- * $Id: test_w_saw.c 1083 2006-08-23 07:30:49Z rossb $
+ * $Id$
  * test_w_saw.c
  * Generate stereo sawtooth waveforms.
  *
diff --git a/pablio/test_w_saw8.c b/pablio/test_w_saw8.c
index dc0e00f..b62c820 100644
--- a/pablio/test_w_saw8.c
+++ b/pablio/test_w_saw8.c
@@ -1,5 +1,5 @@
 /*
- * $Id: test_w_saw8.c 1083 2006-08-23 07:30:49Z rossb $
+ * $Id$
  * test_w_saw8.c
  * Generate stereo 8 bit sawtooth waveforms.
  *
diff --git a/qa/loopback/src/biquad_filter.c b/qa/loopback/src/biquad_filter.c
index d95dc90..1bc4a23 100755
--- a/qa/loopback/src/biquad_filter.c
+++ b/qa/loopback/src/biquad_filter.c
@@ -1,122 +1,122 @@
-#include <math.h>
-#include <string.h>
-
-#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; i<numSamples; i++)
-	{
-		// Generate outputs by filtering inputs.
-		xn = inputs[i];
-		yn = (a0 * xn) + (a1 * xn1) + (a2 * xn2) - (b1 * yn1) - (b2 * yn2);
-		outputs[i] = yn;
-
-		// Delay input and output values.
-        xn2 = xn1;
-        xn1 = xn;
-        yn2 = yn1;
-        yn1 = yn;
-		
-		if( (i & 7) == 0 )
-		{
-			// Apply a small bipolar impulse to filter to prevent arithmetic underflow.
-			// Underflows can cause the FPU to interrupt the CPU.
-			yn1 += (double) 1.0E-26;
-			yn2 -= (double) 1.0E-26;
-		}
-	}
-	
-	filter->xn1 = xn1;
-	filter->xn2 = xn2;
-	filter->yn1 = yn1;
-	filter->yn2 = yn2;		
-}
\ No newline at end of file
+#include <math.h>
+#include <string.h>
+
+#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; i<numSamples; i++)
+	{
+		// Generate outputs by filtering inputs.
+		xn = inputs[i];
+		yn = (a0 * xn) + (a1 * xn1) + (a2 * xn2) - (b1 * yn1) - (b2 * yn2);
+		outputs[i] = yn;
+
+		// Delay input and output values.
+        xn2 = xn1;
+        xn1 = xn;
+        yn2 = yn1;
+        yn1 = yn;
+		
+		if( (i & 7) == 0 )
+		{
+			// Apply a small bipolar impulse to filter to prevent arithmetic underflow.
+			// Underflows can cause the FPU to interrupt the CPU.
+			yn1 += (double) 1.0E-26;
+			yn2 -= (double) 1.0E-26;
+		}
+	}
+	
+	filter->xn1 = xn1;
+	filter->xn2 = xn2;
+	filter->yn1 = yn1;
+	filter->yn2 = yn2;		
+}
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/paqa.c b/qa/loopback/src/paqa.c
index ad654db..cb7100d 100644
--- a/qa/loopback/src/paqa.c
+++ b/qa/loopback/src/paqa.c
@@ -890,10 +890,10 @@ static int PaQa_SingleLoopBackTest( UserOptions *userOptions, TestParameters *te
 	{
 		printf( "OK" );
 	}
-    
-	printf( "\n" );
-    
-				
+
+    // Print the # errors so far to make it easier to see where the error occured.
+	printf( " - #errs = %d\n", g_testsFailed );
+
 	PaQa_TeardownLoopbackContext( &loopbackContext );
 	if( numBadChannels > 0 )
 	{
@@ -1376,25 +1376,25 @@ int TestSampleFormatConversion( void )
 	PaQa_ConvertFromFloat( floatInput, 4, paUInt8, ucharOutput );
 	for( i=0; i<4; i++ )
 	{
-		QA_ASSERT_CLOSE( "paFloat32 -> paUInt8 -> error", ucharInput[i], ucharOutput[i], 1 );
+		QA_ASSERT_CLOSE_INT( "paFloat32 -> paUInt8 -> error", ucharInput[i], ucharOutput[i], 1 );
 	}
 	
 	PaQa_ConvertFromFloat( floatInput, 4, paInt8, charOutput );
 	for( i=0; i<4; i++ )
 	{
-		QA_ASSERT_CLOSE( "paFloat32 -> paInt8 -> error", charInput[i], charOutput[i], 1 );
+		QA_ASSERT_CLOSE_INT( "paFloat32 -> paInt8 -> error", charInput[i], charOutput[i], 1 );
 	}
 	
 	PaQa_ConvertFromFloat( floatInput, 4, paInt16, shortOutput );
 	for( i=0; i<4; i++ )
 	{
-		QA_ASSERT_CLOSE( "paFloat32 -> paInt16 error", shortInput[i], shortOutput[i], 1 );
+		QA_ASSERT_CLOSE_INT( "paFloat32 -> paInt16 error", shortInput[i], shortOutput[i], 1 );
 	}
 		
 	PaQa_ConvertFromFloat( floatInput, 4, paInt32, intOutput );
 	for( i=0; i<4; i++ )
 	{
-		QA_ASSERT_CLOSE( "paFloat32 -> paInt32 error", intInput[i], intOutput[i], 0x00010000 );
+		QA_ASSERT_CLOSE_INT( "paFloat32 -> paInt32 error", intInput[i], intOutput[i], 0x00010000 );
 	}
 	
 	
diff --git a/qa/loopback/src/qa_tools.h b/qa/loopback/src/qa_tools.h
index 32be215..320236e 100755
--- a/qa/loopback/src/qa_tools.h
+++ b/qa/loopback/src/qa_tools.h
@@ -1,74 +1,83 @@
-
-/*
- * 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++;
+
+#define QA_ASSERT_CLOSE_INT( message, expected, actual, tolerance ) \
+    if (abs((expected)-(actual))>(tolerance)) \
+    { \
+        printf( "%s:%d - ERROR - %s, expected %d, got %d, tol=%d\n", __FILE__, __LINE__, message, ((int)(expected)), ((int)(actual)), ((int)(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 <stdio.h>
-#include <stdlib.h>
-#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; i<numSamples; i++ )
-	{
-        bufferPtr = buffer;
-		WriteShortLE( &bufferPtr, *p++ );
-        numWritten = fwrite( buffer, 1, sizeof( buffer), writer->fid );
-        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<NUM_SAMPLES; i++ )
-    {
-        data[i] = saw;
-        saw += 293;
-    }
-
-
-    result =  Audio_WAV_OpenWriter( &writer, "rendered_midi.wav", 44100, 1 );
-    if( result < 0 ) goto error;
-
-    for( i=0; i<15; i++ )
-    {
-        result =  Audio_WAV_WriteShorts( &writer, data, NUM_SAMPLES );
-        if( result < 0 ) goto error;
-    }
-
-    result =  Audio_WAV_CloseWriter( &writer );
-    if( result < 0 ) goto error;
-
-
-    return 0;
-
-error:
-    printf("ERROR: result = %d\n", result );
-    return result;
-}
-#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.
+ */
+
+/**
+  * Very simple WAV file writer for saving captured audio.
+  */
+
+#include <stdio.h>
+#include <stdlib.h>
+#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; i<numSamples; i++ )
+	{
+        bufferPtr = buffer;
+		WriteShortLE( &bufferPtr, *p++ );
+        numWritten = fwrite( buffer, 1, sizeof( buffer), writer->fid );
+        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<NUM_SAMPLES; i++ )
+    {
+        data[i] = saw;
+        saw += 293;
+    }
+
+
+    result =  Audio_WAV_OpenWriter( &writer, "rendered_midi.wav", 44100, 1 );
+    if( result < 0 ) goto error;
+
+    for( i=0; i<15; i++ )
+    {
+        result =  Audio_WAV_WriteShorts( &writer, data, NUM_SAMPLES );
+        if( result < 0 ) goto error;
+    }
+
+    result =  Audio_WAV_CloseWriter( &writer );
+    if( result < 0 ) goto error;
+
+
+    return 0;
+
+error:
+    printf("ERROR: result = %d\n", result );
+    return result;
+}
+#endif
diff --git a/qa/loopback/src/write_wav.h b/qa/loopback/src/write_wav.h
index c22588a..5a9c5ab 100755
--- a/qa/loopback/src/write_wav.h
+++ b/qa/loopback/src/write_wav.h
@@ -1,103 +1,103 @@
-/*
- * 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 _WAV_WRITER_H
-#define _WAV_WRITER_H
-
-/*
- * WAV file writer.
- *
- * Author: Phil Burk
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Define WAV Chunk and FORM types as 4 byte integers. */
-#define RIFF_ID   (('R'<<24) | ('I'<<16) | ('F'<<8) | 'F')
-#define WAVE_ID   (('W'<<24) | ('A'<<16) | ('V'<<8) | 'E')
-#define FMT_ID    (('f'<<24) | ('m'<<16) | ('t'<<8) | ' ')
-#define DATA_ID   (('d'<<24) | ('a'<<16) | ('t'<<8) | 'a')
-#define FACT_ID   (('f'<<24) | ('a'<<16) | ('c'<<8) | 't')
-
-/* Errors returned by Audio_ParseSampleImage_WAV */
-#define WAV_ERR_CHUNK_SIZE     (-1)   /* Chunk size is illegal or past file size. */
-#define WAV_ERR_FILE_TYPE      (-2)   /* Not a WAV file. */
-#define WAV_ERR_ILLEGAL_VALUE  (-3)   /* Illegal or unsupported value. Eg. 927 bits/sample */
-#define WAV_ERR_FORMAT_TYPE    (-4)   /* Unsupported format, eg. compressed. */
-#define WAV_ERR_TRUNCATED      (-5)   /* End of file missing. */
-
-/* WAV PCM data format ID */
-#define WAVE_FORMAT_PCM        (1)
-#define WAVE_FORMAT_IMA_ADPCM  (0x0011)
-
-	
-typedef struct WAV_Writer_s
-{
-    FILE *fid;
-    /* Offset in file for data size. */
-    int   dataSizeOffset;
-    int   dataSize;
-} WAV_Writer;
-
-/*********************************************************************************
- * 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 );
-
-/*********************************************************************************
- * 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
-		);
-
-/*********************************************************************************
- * Close WAV file.
- * Update chunk sizes so it can be read by audio applications.
- */
-long Audio_WAV_CloseWriter( WAV_Writer *writer );
-
-#ifdef __cplusplus
-};
-#endif
-
-#endif /* _WAV_WRITER_H */
+/*
+ * 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 _WAV_WRITER_H
+#define _WAV_WRITER_H
+
+/*
+ * WAV file writer.
+ *
+ * Author: Phil Burk
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Define WAV Chunk and FORM types as 4 byte integers. */
+#define RIFF_ID   (('R'<<24) | ('I'<<16) | ('F'<<8) | 'F')
+#define WAVE_ID   (('W'<<24) | ('A'<<16) | ('V'<<8) | 'E')
+#define FMT_ID    (('f'<<24) | ('m'<<16) | ('t'<<8) | ' ')
+#define DATA_ID   (('d'<<24) | ('a'<<16) | ('t'<<8) | 'a')
+#define FACT_ID   (('f'<<24) | ('a'<<16) | ('c'<<8) | 't')
+
+/* Errors returned by Audio_ParseSampleImage_WAV */
+#define WAV_ERR_CHUNK_SIZE     (-1)   /* Chunk size is illegal or past file size. */
+#define WAV_ERR_FILE_TYPE      (-2)   /* Not a WAV file. */
+#define WAV_ERR_ILLEGAL_VALUE  (-3)   /* Illegal or unsupported value. Eg. 927 bits/sample */
+#define WAV_ERR_FORMAT_TYPE    (-4)   /* Unsupported format, eg. compressed. */
+#define WAV_ERR_TRUNCATED      (-5)   /* End of file missing. */
+
+/* WAV PCM data format ID */
+#define WAVE_FORMAT_PCM        (1)
+#define WAVE_FORMAT_IMA_ADPCM  (0x0011)
+
+	
+typedef struct WAV_Writer_s
+{
+    FILE *fid;
+    /* Offset in file for data size. */
+    int   dataSizeOffset;
+    int   dataSize;
+} WAV_Writer;
+
+/*********************************************************************************
+ * 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 );
+
+/*********************************************************************************
+ * 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
+		);
+
+/*********************************************************************************
+ * Close WAV file.
+ * Update chunk sizes so it can be read by audio applications.
+ */
+long Audio_WAV_CloseWriter( WAV_Writer *writer );
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif /* _WAV_WRITER_H */
diff --git a/qa/paqa_devs.c b/qa/paqa_devs.c
index b773e92..721b07f 100644
--- a/qa/paqa_devs.c
+++ b/qa/paqa_devs.c
@@ -14,7 +14,7 @@
     as in test pa_devs.c.
 */
 /*
- * $Id: paqa_devs.c 1910 2013-09-07 10:14:52Z gineera $
+ * $Id$
  *
  * This program uses the PortAudio Portable Audio Library.
  * For more information see: http://www.portaudio.com
diff --git a/qa/paqa_errs.c b/qa/paqa_errs.c
index 3454eba..8c1d06d 100644
--- a/qa/paqa_errs.c
+++ b/qa/paqa_errs.c
@@ -6,7 +6,7 @@
     Pieter Suurmond adapted to V19 API.
 */
 /*
- * $Id: paqa_errs.c 1756 2011-09-08 06:09:29Z philburk $
+ * $Id$
  *
  * This program uses the PortAudio Portable Audio Library.
  * For more information see: http://www.portaudio.com
diff --git a/src/common/pa_allocation.c b/src/common/pa_allocation.c
index c78c2cf..51fe15a 100644
--- a/src/common/pa_allocation.c
+++ b/src/common/pa_allocation.c
@@ -1,5 +1,5 @@
 /*
- * $Id: pa_allocation.c 1097 2006-08-26 08:27:53Z rossb $
+ * $Id$
  * Portable Audio I/O Library allocation group implementation
  * memory allocation group for tracking allocation groups
  *
diff --git a/src/common/pa_allocation.h b/src/common/pa_allocation.h
index 811dd72..bd1f4b0 100644
--- a/src/common/pa_allocation.h
+++ b/src/common/pa_allocation.h
@@ -1,7 +1,7 @@
 #ifndef PA_ALLOCATION_H
 #define PA_ALLOCATION_H
 /*
- * $Id: pa_allocation.h 1339 2008-02-15 07:50:33Z rossb $
+ * $Id$
  * Portable Audio I/O Library allocation context header
  * memory allocation context for tracking allocation groups
  *
diff --git a/src/common/pa_converters.c b/src/common/pa_converters.c
index ef65b68..2107f5e 100644
--- a/src/common/pa_converters.c
+++ b/src/common/pa_converters.c
@@ -1,5 +1,5 @@
 /*
- * $Id: pa_converters.c 1748 2011-09-01 22:08:32Z philburk $
+ * $Id$
  * Portable Audio I/O Library sample conversion mechanism
  *
  * Based on the Open Source API proposed by Ross Bencina
diff --git a/src/common/pa_converters.h b/src/common/pa_converters.h
index 7ddfcaa..469f075 100644
--- a/src/common/pa_converters.h
+++ b/src/common/pa_converters.h
@@ -1,7 +1,7 @@
 #ifndef PA_CONVERTERS_H
 #define PA_CONVERTERS_H
 /*
- * $Id: pa_converters.h 1097 2006-08-26 08:27:53Z rossb $
+ * $Id$
  * Portable Audio I/O Library sample conversion mechanism
  *
  * Based on the Open Source API proposed by Ross Bencina
diff --git a/src/common/pa_cpuload.c b/src/common/pa_cpuload.c
index 4465a50..4adf21a 100644
--- a/src/common/pa_cpuload.c
+++ b/src/common/pa_cpuload.c
@@ -1,5 +1,5 @@
 /*
- * $Id: pa_cpuload.c 1577 2011-02-01 13:03:45Z rossb $
+ * $Id$
  * Portable Audio I/O Library CPU Load measurement functions
  * Portable CPU load measurement facility.
  *
diff --git a/src/common/pa_cpuload.h b/src/common/pa_cpuload.h
index 4a59443..2a323aa 100644
--- a/src/common/pa_cpuload.h
+++ b/src/common/pa_cpuload.h
@@ -1,7 +1,7 @@
 #ifndef PA_CPULOAD_H
 #define PA_CPULOAD_H
 /*
- * $Id: pa_cpuload.h 1097 2006-08-26 08:27:53Z rossb $
+ * $Id$
  * Portable Audio I/O Library CPU Load measurement functions
  * Portable CPU load measurement facility.
  *
diff --git a/src/common/pa_debugprint.c b/src/common/pa_debugprint.c
index 67e414a..f34d4bb 100644
--- a/src/common/pa_debugprint.c
+++ b/src/common/pa_debugprint.c
@@ -1,123 +1,123 @@
-/*
- * $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 <stdio.h>
-#include <stdarg.h>
-
-#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 <stdio.h>
+#include <stdarg.h>
+
+#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/common/pa_dither.c b/src/common/pa_dither.c
index 7a1b131..140e480 100644
--- a/src/common/pa_dither.c
+++ b/src/common/pa_dither.c
@@ -1,5 +1,5 @@
 /*
- * $Id: pa_dither.c 1418 2009-10-12 21:00:53Z philburk $
+ * $Id$
  * Portable Audio I/O Library triangular dither generator
  *
  * Based on the Open Source API proposed by Ross Bencina
diff --git a/src/common/pa_dither.h b/src/common/pa_dither.h
index a5131b2..12ffc4f 100644
--- a/src/common/pa_dither.h
+++ b/src/common/pa_dither.h
@@ -1,7 +1,7 @@
 #ifndef PA_DITHER_H
 #define PA_DITHER_H
 /*
- * $Id: pa_dither.h 1418 2009-10-12 21:00:53Z philburk $
+ * $Id$
  * Portable Audio I/O Library triangular dither generator
  *
  * Based on the Open Source API proposed by Ross Bencina
diff --git a/src/common/pa_endianness.h b/src/common/pa_endianness.h
index 84e904c..9e8e059 100644
--- a/src/common/pa_endianness.h
+++ b/src/common/pa_endianness.h
@@ -1,7 +1,7 @@
 #ifndef PA_ENDIANNESS_H
 #define PA_ENDIANNESS_H
 /*
- * $Id: pa_endianness.h 1324 2008-01-27 02:03:30Z bjornroche $
+ * $Id$
  * Portable Audio I/O Library current platform endianness macros
  *
  * Based on the Open Source API proposed by Ross Bencina
diff --git a/src/common/pa_front.c b/src/common/pa_front.c
index 95d238b..188cee9 100644
--- a/src/common/pa_front.c
+++ b/src/common/pa_front.c
@@ -1,5 +1,5 @@
 /*
- * $Id: pa_front.c 1880 2012-12-04 18:39:48Z rbencina $
+ * $Id$
  * Portable Audio I/O Library Multi-Host API front end
  * Validate function parameters and manage multiple host APIs.
  *
@@ -27,26 +27,26 @@
  */
 
 /*
- * The text above constitutes the entire PortAudio license; however, 
+ * 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 
+ * 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 PortAudio API functions defined in portaudio.h, checks 
+ @brief Implements PortAudio API functions defined in portaudio.h, checks
  some errors, delegates platform-specific behavior to host API implementations.
- 
- Implements the functions defined in the PortAudio API (portaudio.h), 
- validates some parameters and checks for state inconsistencies before 
- forwarding API requests to specific Host API implementations (via the 
- interface declared in pa_hostapi.h), and Streams (via the interface 
+
+ Implements the functions defined in the PortAudio API (portaudio.h),
+ validates some parameters and checks for state inconsistencies before
+ forwarding API requests to specific Host API implementations (via the
+ interface declared in pa_hostapi.h), and Streams (via the interface
  declared in pa_stream.h).
 
  This file manages initialization and termination of Host API
@@ -65,6 +65,7 @@
 #include <stdio.h>
 #include <memory.h>
 #include <string.h>
+#include <stdlib.h> /* needed for strtol() */
 #include <assert.h> /* needed by PA_VALIDATE_ENDIANNESS */
 
 #include "portaudio.h"
@@ -76,25 +77,63 @@
 #include "pa_trace.h" /* still usefull?*/
 #include "pa_debugprint.h"
 
+#ifndef PA_GIT_REVISION
+#include "pa_gitrevision.h"
+#endif
+
+/**
+ * This is incremented if we make incompatible API changes.
+ * This version scheme is based loosely on http://semver.org/
+ */
+#define paVersionMajor     19
+
+/**
+ * This is incremented when we add functionality in a backwards-compatible manner.
+ * Or it is set to zero when paVersionMajor is incremented.
+ */
+#define paVersionMinor      6
 
-#define PA_VERSION_  1899
-#define PA_VERSION_TEXT_ "PortAudio V19-devel (built " __DATE__  " " __TIME__ ")"
+/**
+ * This is incremented when we make backwards-compatible bug fixes.
+ * Or it is set to zero when paVersionMinor changes.
+ */
+#define paVersionSubMinor   0
 
+/**
+ * This is a combination of paVersionMajor, paVersionMinor and paVersionSubMinor.
+ * It will always increase so that version numbers can be compared as integers to
+ * see which is later.
+ */
+#define paVersion  paMakeVersionNumber(paVersionMajor, paVersionMinor, paVersionSubMinor)
 
+#define STRINGIFY(x) #x
+#define TOSTRING(x) STRINGIFY(x)
 
+#define PA_VERSION_STRING_ TOSTRING(paVersionMajor) "." TOSTRING(paVersionMinor) "." TOSTRING(paVersionSubMinor)
+#define PA_VERSION_TEXT_   "PortAudio V" PA_VERSION_STRING_ "-devel, revision " TOSTRING(PA_GIT_REVISION)
 
 int Pa_GetVersion( void )
 {
-    return PA_VERSION_;
+    return paVersion;
 }
 
-
 const char* Pa_GetVersionText( void )
 {
     return PA_VERSION_TEXT_;
 }
 
+static PaVersionInfo versionInfo_ = {
+    /*.versionMajor =*/ paVersionMajor,
+    /*.versionMinor =*/ paVersionMinor,
+    /*.versionSubMinor =*/ paVersionSubMinor,
+    /*.versionControlRevision =*/ TOSTRING(PA_GIT_REVISION),
+    /*.versionText =*/ PA_VERSION_TEXT_
+};
 
+const PaVersionInfo* Pa_GetVersionInfo()
+{
+    return &versionInfo_;
+}
 
 #define PA_LAST_HOST_ERROR_TEXT_LENGTH_  1024
 
@@ -170,7 +209,7 @@ static PaError InitializeHostApis( void )
     if( !hostApis_ )
     {
         result = paInsufficientMemory;
-        goto error; 
+        goto error;
     }
 
     hostApisCount_ = 0;
@@ -196,11 +235,11 @@ static PaError InitializeHostApis( void )
             assert( hostApi->info.defaultInputDevice < hostApi->info.deviceCount );
             assert( hostApi->info.defaultOutputDevice < hostApi->info.deviceCount );
 
-            /* the first successfully initialized host API with a default input *or* 
+            /* the first successfully initialized host API with a default input *or*
                output device is used as the default host API.
             */
             if( (defaultHostApiIndex_ == -1) &&
-                    ( hostApi->info.defaultInputDevice != paNoDevice 
+                    ( hostApi->info.defaultInputDevice != paNoDevice
                         || hostApi->info.defaultOutputDevice != paNoDevice ) )
             {
                 defaultHostApiIndex_ = hostApisCount_;
@@ -238,7 +277,7 @@ error:
     <device> belongs and returns it. if <hostSpecificDeviceIndex> is
     non-null, the host specific device index is returned in it.
     returns -1 if <device> is out of range.
- 
+
 */
 static int FindHostApi( PaDeviceIndex device, int *hostSpecificDeviceIndex )
 {
@@ -328,7 +367,7 @@ PaError Pa_Initialize( void )
     {
         PA_VALIDATE_TYPE_SIZES;
         PA_VALIDATE_ENDIANNESS;
-        
+
         PaUtil_InitializeClock();
         PaUtil_ResetTraceMessages();
 
@@ -351,7 +390,8 @@ PaError Pa_Terminate( void )
 
     if( PA_IS_INITIALISED_ )
     {
-        if( --initializationCount_ == 0 )
+        // leave initializationCount_>0 so that Pa_CloseStream() can execute
+        if( initializationCount_ == 1 )
         {
             CloseOpenStreams();
 
@@ -359,6 +399,7 @@ PaError Pa_Terminate( void )
 
             PaUtil_DumpTraceMessages();
         }
+        --initializationCount_;
         result = paNoError;
     }
     else
@@ -415,11 +456,11 @@ const char *Pa_GetErrorText( PaError errorCode )
     case paCanNotWriteToAnInputOnlyStream:      result = "Can't write to an input only stream"; break;
     case paIncompatibleStreamHostApi: result = "Incompatible stream host API"; break;
     case paBadBufferPtr:             result = "Bad buffer pointer"; break;
-    default:                         
+    default:
 		if( errorCode > 0 )
-			result = "Invalid error code (value greater than zero)"; 
+			result = "Invalid error code (value greater than zero)";
         else
-			result = "Invalid error code"; 
+			result = "Invalid error code";
         break;
     }
     return result;
@@ -430,7 +471,7 @@ PaHostApiIndex Pa_HostApiTypeIdToHostApiIndex( PaHostApiTypeId type )
 {
     PaHostApiIndex result;
     int i;
-    
+
     PA_LOGAPI_ENTER_PARAMS( "Pa_HostApiTypeIdToHostApiIndex" );
     PA_LOGAPI(("\tPaHostApiTypeId type: %d\n", type ));
 
@@ -441,14 +482,14 @@ PaHostApiIndex Pa_HostApiTypeIdToHostApiIndex( PaHostApiTypeId type )
     else
     {
         result = paHostApiNotFound;
-        
+
         for( i=0; i < hostApisCount_; ++i )
         {
             if( hostApis_[i]->info.type == type )
             {
                 result = i;
                 break;
-            }         
+            }
         }
     }
 
@@ -463,7 +504,7 @@ PaError PaUtil_GetHostApiRepresentation( struct PaUtilHostApiRepresentation **ho
 {
     PaError result;
     int i;
-    
+
     if( !PA_IS_INITIALISED_ )
     {
         result = paNotInitialized;
@@ -471,7 +512,7 @@ PaError PaUtil_GetHostApiRepresentation( struct PaUtilHostApiRepresentation **ho
     else
     {
         result = paHostApiNotFound;
-                
+
         for( i=0; i < hostApisCount_; ++i )
         {
             if( hostApis_[i]->info.type == type )
@@ -492,7 +533,7 @@ PaError PaUtil_DeviceIndexToHostApiDeviceIndex(
 {
     PaError result;
     PaDeviceIndex x;
-    
+
     x = device - hostApi->privatePaFrontInfo.baseDeviceIndex;
 
     if( x < 0 || x >= hostApi->info.deviceCount )
@@ -577,7 +618,7 @@ const PaHostApiInfo* Pa_GetHostApiInfo( PaHostApiIndex hostApi )
     else if( hostApi < 0 || hostApi >= hostApisCount_ )
     {
         info = NULL;
-        
+
         PA_LOGAPI(("Pa_GetHostApiInfo returned:\n" ));
         PA_LOGAPI(("\tPaHostApiInfo*: NULL [ hostApi out of range ]\n" ));
 
@@ -686,7 +727,7 @@ PaDeviceIndex Pa_GetDefaultOutputDevice( void )
 {
     PaHostApiIndex hostApi;
     PaDeviceIndex result;
-    
+
     PA_LOGAPI_ENTER( "Pa_GetDefaultOutputDevice" );
 
     hostApi = Pa_GetDefaultHostApi();
@@ -770,7 +811,7 @@ static int SampleFormatIsValid( PaSampleFormat format )
     ValidateOpenStreamParameters() checks that parameters to Pa_OpenStream()
     conform to the expected values as described below. This function is
     also designed to be used with the proposed Pa_IsFormatSupported() function.
-    
+
     There are basically two types of validation that could be performed:
     Generic conformance validation, and device capability mismatch
     validation. This function performs only generic conformance validation.
@@ -779,21 +820,21 @@ static int SampleFormatIsValid( PaSampleFormat format )
     combinations of parameters - for example, even if the sampleRate
     seems ok, it might not be for a duplex stream - we have no way of
     checking this in an API-neutral way, so we don't try.
- 
+
     On success the function returns PaNoError and fills in hostApi,
     hostApiInputDeviceID, and hostApiOutputDeviceID fields. On failure
     the function returns an error code indicating the first encountered
     parameter error.
- 
- 
+
+
     If ValidateOpenStreamParameters() returns paNoError, the following
     assertions are guaranteed to be true.
- 
+
     - at least one of inputParameters & outputParmeters is valid (not NULL)
 
     - if inputParameters & outputParameters are both valid, that
         inputParameters->device & outputParameters->device  both use the same host api
- 
+
     PaDeviceIndex inputParameters->device
         - is within range (0 to Pa_GetDeviceCount-1) Or:
         - is paUseHostApiSpecificDeviceSpecification and
@@ -803,30 +844,30 @@ static int SampleFormatIsValid( PaSampleFormat format )
     int inputParameters->channelCount
         - if inputParameters->device is not paUseHostApiSpecificDeviceSpecification, channelCount is > 0
         - upper bound is NOT validated against device capabilities
- 
+
     PaSampleFormat inputParameters->sampleFormat
         - is one of the sample formats defined in portaudio.h
 
     void *inputParameters->hostApiSpecificStreamInfo
         - if supplied its hostApi field matches the input device's host Api
- 
+
     PaDeviceIndex outputParmeters->device
         - is within range (0 to Pa_GetDeviceCount-1)
- 
+
     int outputParmeters->channelCount
         - if inputDevice is valid, channelCount is > 0
         - upper bound is NOT validated against device capabilities
- 
+
     PaSampleFormat outputParmeters->sampleFormat
         - is one of the sample formats defined in portaudio.h
-        
+
     void *outputParmeters->hostApiSpecificStreamInfo
         - if supplied its hostApi field matches the output device's host Api
- 
+
     double sampleRate
         - is not an 'absurd' rate (less than 1000. or greater than 384000.)
         - sampleRate is NOT validated against device capabilities
- 
+
     PaStreamFlags streamFlags
         - unused platform neutral flags are zero
         - paNeverDropInput is only used for full-duplex callback streams with
@@ -953,7 +994,7 @@ static PaError ValidateOpenStreamParameters(
                         != (*hostApi)->info.type )
                     return paIncompatibleHostApiSpecificStreamInfo;
             }
-        }   
+        }
 
         if( (inputParameters != NULL) && (outputParameters != NULL) )
         {
@@ -962,8 +1003,8 @@ static PaError ValidateOpenStreamParameters(
                 return paBadIODeviceCombination;
         }
     }
-    
-    
+
+
     /* Check for absurd sample rates. */
     if( (sampleRate < 1000.0) || (sampleRate > 384000.0) )
         return paInvalidSampleRate;
@@ -985,7 +1026,7 @@ static PaError ValidateOpenStreamParameters(
         if( framesPerBuffer != paFramesPerBufferUnspecified )
             return paInvalidFlag;
     }
-    
+
     return paNoError;
 }
 
@@ -1025,7 +1066,7 @@ PaError Pa_IsFormatSupported( const PaStreamParameters *inputParameters,
         PA_LOGAPI(("\tPaTime outputParameters->suggestedLatency: %f\n", outputParameters->suggestedLatency ));
         PA_LOGAPI(("\tvoid *outputParameters->hostApiSpecificStreamInfo: 0x%p\n", outputParameters->hostApiSpecificStreamInfo ));
     }
-    
+
     PA_LOGAPI(("\tdouble sampleRate: %g\n", sampleRate ));
 #endif
 
@@ -1048,7 +1089,7 @@ PaError Pa_IsFormatSupported( const PaStreamParameters *inputParameters,
         PA_LOGAPI_EXIT_PAERROR( "Pa_IsFormatSupported", result );
         return result;
     }
-    
+
 
     if( inputParameters )
     {
@@ -1135,7 +1176,7 @@ PaError Pa_OpenStream( PaStream** stream,
         PA_LOGAPI(("\tPaTime outputParameters->suggestedLatency: %f\n", outputParameters->suggestedLatency ));
         PA_LOGAPI(("\tvoid *outputParameters->hostApiSpecificStreamInfo: 0x%p\n", outputParameters->hostApiSpecificStreamInfo ));
     }
-    
+
     PA_LOGAPI(("\tdouble sampleRate: %g\n", sampleRate ));
     PA_LOGAPI(("\tunsigned long framesPerBuffer: %d\n", framesPerBuffer ));
     PA_LOGAPI(("\tPaStreamFlags streamFlags: 0x%x\n", streamFlags ));
@@ -1182,7 +1223,7 @@ PaError Pa_OpenStream( PaStream** stream,
         PA_LOGAPI(("\tPaError: %d ( %s )\n", result, Pa_GetErrorText( result ) ));
         return result;
     }
-    
+
 
     if( inputParameters )
     {
@@ -1256,8 +1297,8 @@ PaError Pa_OpenDefaultStream( PaStream** stream,
     {
         hostApiInputParameters.device = Pa_GetDefaultInputDevice();
 		if( hostApiInputParameters.device == paNoDevice )
-			return paDeviceUnavailable; 
-	
+			return paDeviceUnavailable;
+
         hostApiInputParameters.channelCount = inputChannelCount;
         hostApiInputParameters.sampleFormat = sampleFormat;
         /* defaultHighInputLatency is used below instead of
@@ -1265,7 +1306,7 @@ PaError Pa_OpenDefaultStream( PaStream** stream,
            stream to work reliably than it is for it to work with the lowest
            latency.
          */
-        hostApiInputParameters.suggestedLatency = 
+        hostApiInputParameters.suggestedLatency =
              Pa_GetDeviceInfo( hostApiInputParameters.device )->defaultHighInputLatency;
         hostApiInputParameters.hostApiSpecificStreamInfo = NULL;
         hostApiInputParametersPtr = &hostApiInputParameters;
@@ -1279,7 +1320,7 @@ PaError Pa_OpenDefaultStream( PaStream** stream,
     {
         hostApiOutputParameters.device = Pa_GetDefaultOutputDevice();
 		if( hostApiOutputParameters.device == paNoDevice )
-			return paDeviceUnavailable; 
+			return paDeviceUnavailable;
 
         hostApiOutputParameters.channelCount = outputChannelCount;
         hostApiOutputParameters.sampleFormat = sampleFormat;
@@ -1663,7 +1704,7 @@ PaError Pa_WriteStream( PaStream* stream,
             else if( result == 1 )
             {
                 result = paStreamIsStopped;
-            }  
+            }
         }
     }
 
diff --git a/src/common/pa_gitrevision.h b/src/common/pa_gitrevision.h
new file mode 100644
index 0000000..2a6cfca
--- /dev/null
+++ b/src/common/pa_gitrevision.h
@@ -0,0 +1 @@
+#define PA_GIT_REVISION 396fe4b6699ae929d3a685b3ef8a7e97396139a4
diff --git a/src/common/pa_hostapi.h b/src/common/pa_hostapi.h
index d38b8fe..54b527e 100644
--- a/src/common/pa_hostapi.h
+++ b/src/common/pa_hostapi.h
@@ -1,7 +1,7 @@
 #ifndef PA_HOSTAPI_H
 #define PA_HOSTAPI_H
 /*
- * $Id: pa_hostapi.h 1880 2012-12-04 18:39:48Z rbencina $
+ * $Id$
  * Portable Audio I/O Library
  * host api representation
  *
diff --git a/src/common/pa_process.c b/src/common/pa_process.c
index f6052d1..0faf841 100644
--- a/src/common/pa_process.c
+++ b/src/common/pa_process.c
@@ -1,5 +1,5 @@
 /*
- * $Id: pa_process.c 1913 2013-11-18 11:42:27Z gineera $
+ * $Id$
  * Portable Audio I/O Library
  * streamCallback <-> host buffer processing adapter
  *
@@ -744,7 +744,7 @@ static unsigned long NonAdaptingProcess( PaUtilBufferProcessor *bp,
                     destChannelStrideBytes = bp->bytesPerUserInputSample;
 
                     /* process host buffer directly, or use temp buffer if formats differ or host buffer non-interleaved,
-                     * or if the number of channels differs between the host (set in stride) and the user */
+                     * or if num channels differs between the host (set in stride) and the user (eg with some Alsa hw:) */
                     if( bp->userInputSampleFormatIsEqualToHost && bp->hostInputIsInterleaved
                         && bp->hostInputChannels[0][0].data && bp->inputChannelCount == hostInputChannels[0].stride )
                     {
@@ -834,8 +834,10 @@ static unsigned long NonAdaptingProcess( PaUtilBufferProcessor *bp,
             {
                 if( bp->userOutputIsInterleaved )
                 {
-                    /* process host buffer directly, or use temp buffer if formats differ or host buffer non-interleaved */
-                    if( bp->userOutputSampleFormatIsEqualToHost && bp->hostOutputIsInterleaved )
+                    /* process host buffer directly, or use temp buffer if formats differ or host buffer non-interleaved,
+                     * or if num channels differs between the host (set in stride) and the user (eg with some Alsa hw:) */
+                    if( bp->userOutputSampleFormatIsEqualToHost && bp->hostOutputIsInterleaved
+                          && bp->outputChannelCount == hostOutputChannels[0].stride )
                     {
                         userOutput = hostOutputChannels[0].data;
                         skipOutputConvert = 1;
diff --git a/src/common/pa_process.h b/src/common/pa_process.h
index 4d5f56a..37b91d7 100644
--- a/src/common/pa_process.h
+++ b/src/common/pa_process.h
@@ -1,7 +1,7 @@
 #ifndef PA_PROCESS_H
 #define PA_PROCESS_H
 /*
- * $Id: pa_process.h 1668 2011-05-02 17:07:11Z rossb $
+ * $Id$
  * Portable Audio I/O Library callback buffer processing adapters
  *
  * Based on the Open Source API proposed by Ross Bencina
diff --git a/src/common/pa_ringbuffer.c b/src/common/pa_ringbuffer.c
index 19c9149..93b3e43 100644
--- a/src/common/pa_ringbuffer.c
+++ b/src/common/pa_ringbuffer.c
@@ -1,5 +1,5 @@
 /*
- * $Id: pa_ringbuffer.c 1738 2011-08-18 11:47:28Z rossb $
+ * $Id$
  * Portable Audio I/O Library
  * Ring Buffer utility.
  *
diff --git a/src/common/pa_ringbuffer.h b/src/common/pa_ringbuffer.h
index 0cab3a5..9edba0d 100644
--- a/src/common/pa_ringbuffer.h
+++ b/src/common/pa_ringbuffer.h
@@ -1,7 +1,7 @@
 #ifndef PA_RINGBUFFER_H
 #define PA_RINGBUFFER_H
 /*
- * $Id: pa_ringbuffer.h 1873 2012-10-07 19:00:11Z philburk $
+ * $Id$
  * Portable Audio I/O Library
  * Ring Buffer utility.
  *
diff --git a/src/common/pa_stream.c b/src/common/pa_stream.c
index ea91821..03a0ee6 100644
--- a/src/common/pa_stream.c
+++ b/src/common/pa_stream.c
@@ -1,5 +1,5 @@
 /*
- * $Id: pa_stream.c 1339 2008-02-15 07:50:33Z rossb $
+ * $Id$
  * Portable Audio I/O Library
  * stream interface
  *
diff --git a/src/common/pa_stream.h b/src/common/pa_stream.h
index 8d707b7..678e2ad 100644
--- a/src/common/pa_stream.h
+++ b/src/common/pa_stream.h
@@ -1,7 +1,7 @@
 #ifndef PA_STREAM_H
 #define PA_STREAM_H
 /*
- * $Id: pa_stream.h 1339 2008-02-15 07:50:33Z rossb $
+ * $Id$
  * Portable Audio I/O Library
  * stream interface
  *
diff --git a/src/common/pa_trace.c b/src/common/pa_trace.c
index 6a41cbb..818abff 100644
--- a/src/common/pa_trace.c
+++ b/src/common/pa_trace.c
@@ -1,5 +1,5 @@
 /*
- * $Id: pa_trace.c 1916 2014-01-17 03:45:15Z philburk $
+ * $Id$
  * Portable Audio I/O Library Trace Facility
  * Store trace information in real-time for later printing.
  *
diff --git a/src/common/pa_trace.h b/src/common/pa_trace.h
index 612dbf3..6dfaeb7 100644
--- a/src/common/pa_trace.h
+++ b/src/common/pa_trace.h
@@ -1,7 +1,7 @@
 #ifndef PA_TRACE_H
 #define PA_TRACE_H
 /*
- * $Id: pa_trace.h 1812 2012-02-14 09:32:57Z robiwan $
+ * $Id$
  * Portable Audio I/O Library Trace Facility
  * Store trace information in real-time for later printing.
  *
diff --git a/src/common/pa_util.h b/src/common/pa_util.h
index c454ea7..ad5dac5 100644
--- a/src/common/pa_util.h
+++ b/src/common/pa_util.h
@@ -1,7 +1,7 @@
 #ifndef PA_UTIL_H
 #define PA_UTIL_H
 /*
- * $Id: pa_util.h 1584 2011-02-02 18:58:17Z rossb $
+ * $Id$
  * Portable Audio I/O Library implementation utilities header
  * common implementation utilities and interfaces
  *
diff --git a/src/hostapi/alsa/pa_linux_alsa.c b/src/hostapi/alsa/pa_linux_alsa.c
index ad63837..584cde8 100644
--- a/src/hostapi/alsa/pa_linux_alsa.c
+++ b/src/hostapi/alsa/pa_linux_alsa.c
@@ -1,5 +1,5 @@
 /*
- * $Id: pa_linux_alsa.c 1911 2013-10-17 12:44:09Z gineera $
+ * $Id$
  * PortAudio Portable Real-Time Audio Library
  * Latest Version at: http://www.portaudio.com
  * ALSA implementation by Joshua Haberman and Arve Knudsen
@@ -3805,8 +3805,23 @@ static PaError PaAlsaStream_WaitForFrames( PaAlsaStream *self, unsigned long *fr
             totalFds += self->playback.nfds;
         }
 
+#ifdef PTHREAD_CANCELED
+        if( self->callbackMode )
+        {
+            /* To allow 'Abort' to terminate the callback thread, enable cancelability just for poll() (& disable after) */
+            pthread_setcancelstate( PTHREAD_CANCEL_ENABLE, NULL );
+        }
+#endif
+
         pollResults = poll( self->pfds, totalFds, pollTimeout );
 
+#ifdef PTHREAD_CANCELED
+        if( self->callbackMode )
+        {
+            pthread_setcancelstate( PTHREAD_CANCEL_DISABLE, NULL );
+        }
+#endif
+
         if( pollResults < 0 )
         {
             /*  XXX: Depend on preprocessor condition? */
@@ -4175,12 +4190,18 @@ static void *CallbackThreadFunc( void *userData )
     int streamStarted = 0;
 
     assert( stream );
+    /* Not implemented */
+    assert( !stream->primeBuffers );
 
     /* Execute OnExit when exiting */
     pthread_cleanup_push( &OnExit, stream );
-
-    /* Not implemented */
-    assert( !stream->primeBuffers );
+#ifdef PTHREAD_CANCELED
+    /* 'Abort' will use thread cancellation to terminate the callback thread, but the Alsa-lib functions
+     * are NOT cancel-safe, (and can end up in an inconsistent state).  So, disable cancelability for
+     * the thread here, and just re-enable it for the poll() in PaAlsaStream_WaitForFrames(). */
+    pthread_testcancel();
+    pthread_setcancelstate( PTHREAD_CANCEL_DISABLE, NULL );
+#endif
 
     /* @concern StreamStart If the output is being primed the output pcm needs to be prepared, otherwise the
      * stream is started immediately. The latter involves signaling the waiting main thread.
@@ -4265,10 +4286,6 @@ static void *CallbackThreadFunc( void *userData )
         {
             xrun = 0;
 
-#ifdef PTHREAD_CANCELED
-           pthread_testcancel();
-#endif
-
             /** @concern Xruns Under/overflows are to be reported to the callback */
             if( stream->underrun > 0.0 )
             {
@@ -4299,11 +4316,12 @@ static void *CallbackThreadFunc( void *userData )
 #if 0
             CallbackUpdate( &stream->threading );
 #endif
+
             CalculateTimeInfo( stream, &timeInfo );
             PaUtil_BeginBufferProcessing( &stream->bufferProcessor, &timeInfo, cbFlags );
             cbFlags = 0;
 
-            /* CPU load measurement should include processing activivity external to the stream callback */
+            /* CPU load measurement should include processing activity external to the stream callback */
             PaUtil_BeginCpuLoadMeasurement( &stream->cpuLoadMeasurer );
 
             framesGot = framesAvail;
@@ -4334,7 +4352,6 @@ static void *CallbackThreadFunc( void *userData )
             {
                 /* Go back to polling for more frames */
                 break;
-
             }
 
             if( paContinue != callbackResult )
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 <fredg at salemradiolabs.com>
- * Copyright (c) 2005,2006 Ludwig Schwardt <schwardt at sun.ac.za>
- * Copyright (c) 2011 Eliot Blennerhassett <eblennerhassett at audioscience.com>
- *
- * 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.
-
- <h3>Overview</h3>
-
- 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
-
- <h3>Implementation strategy</h3>
-
- *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 <unistd.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>          /* strlen() */
-#include <pthread.h>         /* pthreads and friends */
-#include <assert.h>          /* assert */
-#include <math.h>            /* ceil, floor */
-
-#include <asihpi/hpi.h>      /* 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 <fredg at salemradiolabs.com>
+ * Copyright (c) 2005,2006 Ludwig Schwardt <schwardt at sun.ac.za>
+ * Copyright (c) 2011 Eliot Blennerhassett <eblennerhassett at audioscience.com>
+ *
+ * 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.
+
+ <h3>Overview</h3>
+
+ 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
+
+ <h3>Implementation strategy</h3>
+
+ *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 <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>          /* strlen() */
+#include <pthread.h>         /* pthreads and friends */
+#include <assert.h>          /* assert */
+#include <math.h>            /* ceil, floor */
+
+#include <asihpi/hpi.h>      /* 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;
+}
diff --git a/src/hostapi/asio/pa_asio.cpp b/src/hostapi/asio/pa_asio.cpp
index f3a16a7..f230d87 100644
--- a/src/hostapi/asio/pa_asio.cpp
+++ b/src/hostapi/asio/pa_asio.cpp
@@ -1,5 +1,5 @@
 /*
- * $Id: pa_asio.cpp 1890 2013-05-02 01:06:01Z rbencina $
+ * $Id$
  * Portable Audio I/O Library for ASIO Drivers
  *
  * Author: Stephane Letz
diff --git a/src/hostapi/coreaudio/pa_mac_core.c b/src/hostapi/coreaudio/pa_mac_core.c
index 14632d9..257e9de 100644
--- a/src/hostapi/coreaudio/pa_mac_core.c
+++ b/src/hostapi/coreaudio/pa_mac_core.c
@@ -125,83 +125,78 @@ static bool ensureChannelNameSize( int size )
  */
 const char *PaMacCore_GetChannelName( int device, int channelIndex, bool input )
 {
-   struct PaUtilHostApiRepresentation *hostApi;
-   PaError err;
-   OSStatus error;
-   err = PaUtil_GetHostApiRepresentation( &hostApi, paCoreAudio );
-   assert(err == paNoError);
-   if( err != paNoError )
-      return NULL;
-   PaMacAUHAL *macCoreHostApi = (PaMacAUHAL*)hostApi;
-   AudioDeviceID hostApiDevice = macCoreHostApi->devIds[device];
-
-   UInt32 size = 0;
-
-   error = AudioDeviceGetPropertyInfo( hostApiDevice,
-                                       channelIndex + 1,
-                                       input,
-                                       kAudioDevicePropertyChannelName,
-                                       &size,
-                                       NULL );
-   if( error ) {
-      //try the CFString
-      CFStringRef name;
-      bool isDeviceName = false;
-      size = sizeof( name );
-      error = AudioDeviceGetProperty( hostApiDevice,
-                                      channelIndex + 1,
-                                      input,
-                                      kAudioDevicePropertyChannelNameCFString,
-                                      &size,
-                                      &name );
-      if( error ) { //as a last-ditch effort, get the device name. Later we'll append the channel number.
-         size = sizeof( name );
-         error = AudioDeviceGetProperty( hostApiDevice,
-                                      channelIndex + 1,
-                                      input,
-                                      kAudioDevicePropertyDeviceNameCFString,
-                                      &size,
-                                      &name );
-         if( error )
-            return NULL;
-         isDeviceName = true;
-      }
-      if( isDeviceName ) {
-         name = CFStringCreateWithFormat( NULL, NULL, CFSTR( "%@: %d"), name, channelIndex + 1 );
-      }
-
-      CFIndex length = CFStringGetLength(name);
-      while( ensureChannelNameSize( length * sizeof(UniChar) + 1 ) ) {
-         if( CFStringGetCString( name, channelName, channelNameSize, kCFStringEncodingUTF8 ) ) {
-            if( isDeviceName )
-               CFRelease( name );
-            return channelName;
-         }
-         if( length == 0 )
-            ++length;
-         length *= 2;
-      }
-      if( isDeviceName )
-         CFRelease( name );
-      return NULL;
-   }
-
-   //continue with C string:
-   if( !ensureChannelNameSize( size ) )
-      return NULL;
-
-   error = AudioDeviceGetProperty( hostApiDevice,
-                                   channelIndex + 1,
-                                   input,
-                                   kAudioDevicePropertyChannelName,
-                                   &size,
-                                   channelName );
-
-   if( error ) {
-      ERR( error );
-      return NULL;
-   }
-   return channelName;
+	struct PaUtilHostApiRepresentation *hostApi;
+	PaError err;
+	OSStatus error;
+	err = PaUtil_GetHostApiRepresentation( &hostApi, paCoreAudio );
+	assert(err == paNoError);
+	if( err != paNoError )
+		return NULL;
+	PaMacAUHAL *macCoreHostApi = (PaMacAUHAL*)hostApi;
+	AudioDeviceID hostApiDevice = macCoreHostApi->devIds[device];
+	CFStringRef nameRef;
+	
+	/* First try with CFString */
+	UInt32 size = sizeof(nameRef);
+	error = AudioDeviceGetProperty( hostApiDevice,
+								   channelIndex + 1,
+								   input,
+								   kAudioDevicePropertyChannelNameCFString,
+								   &size,
+								   &nameRef );
+	if( error )
+	{
+		/* try the C String */
+		size = 0;
+		error = AudioDeviceGetPropertyInfo( hostApiDevice,
+										   channelIndex + 1,
+										   input,
+										   kAudioDevicePropertyChannelName,
+										   &size,
+										   NULL);
+		if( !error )
+		{
+			if( !ensureChannelNameSize( size ) )
+				return NULL;
+			
+			error = AudioDeviceGetProperty( hostApiDevice,
+										   channelIndex + 1,
+										   input,
+										   kAudioDevicePropertyChannelName,
+										   &size,
+										   channelName );
+			
+			
+			if( !error )
+				return channelName;
+		}
+		
+		/* as a last-ditch effort, we use the device name and append the channel number. */
+		nameRef = CFStringCreateWithFormat( NULL, NULL, CFSTR( "%s: %d"), hostApi->deviceInfos[device]->name, channelIndex + 1 );
+		
+		
+		size = CFStringGetMaximumSizeForEncoding(CFStringGetLength(nameRef), kCFStringEncodingUTF8);;
+		if( !ensureChannelNameSize( size ) )
+		{
+			CFRelease( nameRef );
+			return NULL;
+		}
+		CFStringGetCString( nameRef, channelName, size+1, kCFStringEncodingUTF8 );
+		CFRelease( nameRef );
+	}
+	else
+	{
+		size = CFStringGetMaximumSizeForEncoding(CFStringGetLength(nameRef), kCFStringEncodingUTF8);;
+		if( !ensureChannelNameSize( size ) )
+		{
+			CFRelease( nameRef );
+			return NULL;
+		}
+		CFStringGetCString( nameRef, channelName, size+1, kCFStringEncodingUTF8 );
+		CFRelease( nameRef );
+	}
+	
+	return channelName;
 }
 
     
@@ -312,7 +307,7 @@ static PaError OpenAndSetupOneAudioUnit(
 
 /* for setting errors. */
 #define PA_AUHAL_SET_LAST_HOST_ERROR( errorCode, errorText ) \
-    PaUtil_SetLastHostErrorInfo( paInDevelopment, errorCode, errorText )
+    PaUtil_SetLastHostErrorInfo( paCoreAudio, errorCode, errorText )
 
 /*
  * Callback called when starting or stopping a stream.
@@ -657,6 +652,7 @@ static PaError InitializeDeviceInfo( PaMacAUHAL *auhalHostApi,
     Float64 sampleRate;
     char *name;
     PaError err = paNoError;
+	CFStringRef nameRef;
     UInt32 propSize;
 
     VVDBUG(("InitializeDeviceInfo(): macCoreDeviceId=%ld\n", macCoreDeviceId));
@@ -665,18 +661,37 @@ static PaError InitializeDeviceInfo( PaMacAUHAL *auhalHostApi,
 
     deviceInfo->structVersion = 2;
     deviceInfo->hostApi = hostApiIndex;
-
-    /* Get the device name.  Fail if we can't get it. */
-    err = ERR(AudioDeviceGetPropertyInfo(macCoreDeviceId, 0, 0, kAudioDevicePropertyDeviceName, &propSize, NULL));
-    if (err)
-        return err;
-
-    name = PaUtil_GroupAllocateMemory(auhalHostApi->allocations,propSize);
-    if ( !name )
-        return paInsufficientMemory;
-    err = ERR(AudioDeviceGetProperty(macCoreDeviceId, 0, 0, kAudioDevicePropertyDeviceName, &propSize, name));
+  
+    /* Get the device name using CFString */
+	propSize = sizeof(nameRef);
+    err = ERR(AudioDeviceGetProperty(macCoreDeviceId, 0, 0, kAudioDevicePropertyDeviceNameCFString, &propSize, &nameRef));
     if (err)
-        return err;
+    {
+		/* Get the device name using c string.  Fail if we can't get it. */
+		err = ERR(AudioDeviceGetPropertyInfo(macCoreDeviceId, 0, 0, kAudioDevicePropertyDeviceName, &propSize, NULL));
+		if (err)
+			return err;
+
+		name = PaUtil_GroupAllocateMemory(auhalHostApi->allocations,propSize+1);
+		if ( !name )
+			return paInsufficientMemory;
+		err = ERR(AudioDeviceGetProperty(macCoreDeviceId, 0, 0, kAudioDevicePropertyDeviceName, &propSize, name));
+		if (err)
+			return err;
+	}
+	else
+	{
+		/* valid CFString so we just allocate a c string big enough to contain the data */
+		propSize = CFStringGetMaximumSizeForEncoding(CFStringGetLength(nameRef), kCFStringEncodingUTF8);
+		name = PaUtil_GroupAllocateMemory(auhalHostApi->allocations, propSize+1);
+		if ( !name )
+		{
+			CFRelease(nameRef);
+			return paInsufficientMemory;
+		}
+		CFStringGetCString(nameRef, name, propSize+1, kCFStringEncodingUTF8);
+		CFRelease(nameRef);
+	}
     deviceInfo->name = name;
 
     /* Try to get the default sample rate.  Don't fail if we can't get this. */
@@ -1906,14 +1921,13 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
         
        /*
         * If input and output devs are different or we are doing SR conversion,
-        * we also need a
-        * ring buffer to store inpt data while waiting for output
-        * data.
+        * we also need a ring buffer to store input data while waiting for
+        * output data.
         */
        if( (stream->outputUnit && (stream->inputUnit != stream->outputUnit))
            || stream->inputSRConverter )
        {
-          /* May want the ringSize ot initial position in
+          /* May want the ringSize or initial position in
              ring buffer to depend somewhat on sample rate change */
 
           void *data;
@@ -1936,7 +1950,15 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
           }
 
           /* now we can initialize the ring buffer */
-          PaUtil_InitializeRingBuffer( &stream->inputRingBuffer, szfl*inputParameters->channelCount, ringSize, data ) ;
+          result = PaUtil_InitializeRingBuffer( &stream->inputRingBuffer, szfl*inputParameters->channelCount, ringSize, data );
+          if( result != 0 )
+          {
+              /* The only reason this should fail is if ringSize is not a power of 2, which we do not anticipate happening. */
+              result = paUnanticipatedHostError;
+              free(data);
+              goto error;
+          }
+
           /* advance the read point a little, so we are reading from the
              middle of the buffer */
           if( stream->outputUnit )
@@ -1958,12 +1980,11 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
                                          stream->outputFramesPerBuffer,
                                          sampleRate );
        result = initializeBlioRingBuffers( &stream->blio,
-              inputParameters?inputParameters->sampleFormat:0 ,
-              outputParameters?outputParameters->sampleFormat:0 ,
-              MAX(stream->inputFramesPerBuffer,stream->outputFramesPerBuffer),
+              inputParameters ? inputParameters->sampleFormat : 0,
+              outputParameters ? outputParameters->sampleFormat : 0,
               ringSize,
-              inputParameters?inputChannelCount:0 ,
-              outputParameters?outputChannelCount:0 ) ;
+              inputParameters ? inputChannelCount : 0,
+              outputParameters ? outputChannelCount : 0 ) ;
        if( result != paNoError )
           goto error;
         
@@ -2262,9 +2283,10 @@ static OSStatus AudioIOProc( void *inRefCon,
                     INPUT_ELEMENT,
                     inNumberFrames,
                     &stream->inputAudioBufferList );
-      /* FEEDBACK: I'm not sure what to do when this call fails. There's nothing in the PA API to
-       * do about failures in the callback system. */
-      assert( !err );
+      if(err != noErr)
+      {
+        goto stop_stream;
+      }
 
       PaUtil_SetInputFrameCount( &(stream->bufferProcessor), frames );
       PaUtil_SetInterleavedInputChannels( &(stream->bufferProcessor),
@@ -2344,7 +2366,7 @@ static OSStatus AudioIOProc( void *inRefCon,
                              &size,
                              (void *)&data );
                if( err == RING_BUFFER_EMPTY )
-               { /*the ring buffer callback underflowed */
+               { /* the ring buffer callback underflowed */
                   err = 0;
                   bzero( ((char *)data) + size, sizeof(data)-size );
                   /* The ring buffer can underflow normally when the stream is stopping.
@@ -2355,8 +2377,11 @@ static OSStatus AudioIOProc( void *inRefCon,
                   }
                }
                ERR( err );
-               assert( !err );
-               
+               if(err != noErr)
+               {
+                 goto stop_stream;
+               }
+
                PaUtil_SetInputFrameCount( &(stream->bufferProcessor), frames );
                PaUtil_SetInterleavedInputChannels( &(stream->bufferProcessor),
                                    0,
@@ -2462,9 +2487,12 @@ static OSStatus AudioIOProc( void *inRefCon,
          if( err == -10874 )
             inNumberFrames /= 2;
       } while( err == -10874 && inNumberFrames > 1 );
-      /* FEEDBACK: I'm not sure what to do when this call fails */
       ERR( err );
-      assert( !err );
+      if(err != noErr)
+      {
+          goto stop_stream;
+      }
+
       if( stream->inputSRConverter || stream->outputUnit )
       {
          /* If this is duplex or we use a converter, put the data
@@ -2507,11 +2535,11 @@ static OSStatus AudioIOProc( void *inRefCon,
           * chunks, and let the BufferProcessor deal with the rest.
           *
           */
-         /*This might be too big or small depending on SR conversion*/
+         /* This might be too big or small depending on SR conversion. */
          float data[ chan * inNumberFrames ];
          OSStatus err;
          do
-         { /*Run the buffer processor until we are out of data*/
+         { /* Run the buffer processor until we are out of data. */
             UInt32 size;
             long f;
 
@@ -2524,7 +2552,11 @@ static OSStatus AudioIOProc( void *inRefCon,
                           (void *)data );
             if( err != RING_BUFFER_EMPTY )
                ERR( err );
-            assert( err == 0 || err == RING_BUFFER_EMPTY );
+            if( err != noErr && err != RING_BUFFER_EMPTY )
+            {
+                goto stop_stream;
+            }
+
 
             f = size / ( chan * sizeof(float) );
             PaUtil_SetInputFrameCount( &(stream->bufferProcessor), f );
@@ -2547,23 +2579,23 @@ static OSStatus AudioIOProc( void *inRefCon,
       }
    }
 
-   switch( callbackResult )
-   {
-   case paContinue: break;
-   case paComplete:
-   case paAbort:
-      stream->state = CALLBACK_STOPPED ;
-      if( stream->outputUnit )
-         AudioOutputUnitStop(stream->outputUnit);
-      if( stream->inputUnit )
-         AudioOutputUnitStop(stream->inputUnit);
-      break;
-   }
+    // Should we return successfully or fall through to stopping the stream?
+    if( callbackResult == paContinue )
+    {
+        PaUtil_EndCpuLoadMeasurement( &stream->cpuLoadMeasurer, framesProcessed );
+        return noErr;
+    }
 
-   PaUtil_EndCpuLoadMeasurement( &stream->cpuLoadMeasurer, framesProcessed );
-   return noErr;
-}
+stop_stream:
+    stream->state = CALLBACK_STOPPED ;
+    if( stream->outputUnit )
+        AudioOutputUnitStop(stream->outputUnit);
+    if( stream->inputUnit )
+        AudioOutputUnitStop(stream->inputUnit);
 
+    PaUtil_EndCpuLoadMeasurement( &stream->cpuLoadMeasurer, framesProcessed );
+    return noErr;
+}
 
 /*
     When CloseStream() is called, the multi-api layer ensures that
@@ -2692,18 +2724,10 @@ static ComponentResult BlockWhileAudioUnitIsRunning( AudioUnit audioUnit, AudioU
     return noErr;
 }
 
-static PaError StopStream( PaStream *s )
+static PaError FinishStoppingStream( PaMacCoreStream *stream )
 {
-    PaMacCoreStream *stream = (PaMacCoreStream*)s;
     OSStatus result = noErr;
     PaError paErr;
-    VVDBUG(("StopStream()\n"));
-
-    VDBUG( ("Waiting for BLIO.\n") );
-    waitUntilBlioWriteBufferIsFlushed( &stream->blio );
-    VDBUG( ( "Stopping stream.\n" ) );
-
-    stream->state = STOPPING;
 
 #define ERR_WRAP(mac_err) do { result = mac_err ; if ( result != noErr ) return ERR(result) ; } while(0)
     /* -- stop and reset -- */
@@ -2755,12 +2779,34 @@ static PaError StopStream( PaStream *s )
 #undef ERR_WRAP
 }
 
+/* Block until buffer is empty then stop the stream. */
+static PaError StopStream( PaStream *s )
+{
+    PaError paErr;
+    PaMacCoreStream *stream = (PaMacCoreStream*)s;
+    VVDBUG(("StopStream()\n"));
+
+    /* Tell WriteStream to stop filling the buffer. */
+    stream->state = STOPPING;
+
+    if( stream->userOutChan > 0 ) /* Does this stream do output? */
+    {
+        size_t maxHostFrames = MAX( stream->inputFramesPerBuffer, stream->outputFramesPerBuffer );
+        VDBUG( ("Waiting for write buffer to be drained.\n") );
+        paErr = waitUntilBlioWriteBufferIsEmpty( &stream->blio, stream->sampleRate,
+                                                maxHostFrames );
+        VDBUG( ( "waitUntilBlioWriteBufferIsEmpty returned %d\n", paErr ) );
+    }
+    return FinishStoppingStream( stream );
+}
+
+/* Immediately stop the stream. */
 static PaError AbortStream( PaStream *s )
 {
-    VVDBUG(("AbortStream()->StopStream()\n"));
-    VDBUG( ( "Aborting stream.\n" ) );
-    /* We have nothing faster than StopStream. */
-    return StopStream(s);
+    PaMacCoreStream *stream = (PaMacCoreStream*)s;
+    VDBUG( ( "AbortStream()\n" ) );
+    stream->state = STOPPING;
+    return FinishStoppingStream( stream );
 }
 
 
diff --git a/src/hostapi/coreaudio/pa_mac_core_blocking.c b/src/hostapi/coreaudio/pa_mac_core_blocking.c
index 606a569..679c6ba 100644
--- a/src/hostapi/coreaudio/pa_mac_core_blocking.c
+++ b/src/hostapi/coreaudio/pa_mac_core_blocking.c
@@ -1,593 +1,637 @@
-/*
- * Implementation of the PortAudio API for Apple AUHAL
- *
- * PortAudio Portable Real-Time Audio Library
- * Latest Version at: http://www.portaudio.com
- *
- * Written by Bjorn Roche of XO Audio LLC, from PA skeleton code.
- * Portions copied from code by Dominic Mazzoni (who wrote a HAL implementation)
- *
- * Dominic's code was based on code by Phil Burk, Darren Gibbs,
- * Gord Peters, Stephane Letz, and Greg Pfiel.
- *
- * The following people also deserve acknowledgements:
- *
- * Olivier Tristan for feedback and testing
- * Glenn Zelniker and Z-Systems engineering for sponsoring the Blocking I/O
- * interface.
- * 
- *
- * Based on the Open Source API proposed by Ross Bencina
- * Copyright (c) 1999-2002 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 hostapi_src
-
- This file contains the implementation
- required for blocking I/O. It is separated from pa_mac_core.c simply to ease
- development.
-*/
-
-#include "pa_mac_core_blocking.h"
-#include "pa_mac_core_internal.h"
-#include <assert.h>
-#ifdef MOSX_USE_NON_ATOMIC_FLAG_BITS
-# define OSAtomicOr32( a, b ) ( (*(b)) |= (a) )
-# define OSAtomicAnd32( a, b ) ( (*(b)) &= (a) )
-#else
-# include <libkern/OSAtomic.h>
-#endif
-
-/*
- * This function determines the size of a particular sample format.
- * if the format is not recognized, this returns zero.
- */
-static size_t computeSampleSizeFromFormat( PaSampleFormat format )
-{
-   switch( format & (~paNonInterleaved) ) {
-   case paFloat32: return 4;
-   case paInt32: return 4;
-   case paInt24: return 3;
-   case paInt16: return 2;
-   case paInt8: case paUInt8: return 1;
-   default: return 0;
-   }
-}
-/*
- * Same as computeSampleSizeFromFormat, except that if
- * the size is not a power of two, it returns the next power of two up
- */
-static size_t computeSampleSizeFromFormatPow2( PaSampleFormat format )
-{
-   switch( format & (~paNonInterleaved) ) {
-   case paFloat32: return 4;
-   case paInt32: return 4;
-   case paInt24: return 4;
-   case paInt16: return 2;
-   case paInt8: case paUInt8: return 1;
-   default: return 0;
-   }
-}
-
-
-
-/*
- * Functions for initializing, resetting, and destroying BLIO structures.
- *
- */
-
-/* This should be called with the relevant info when initializing a stream for
-   callback. */
-PaError initializeBlioRingBuffers(
-                                       PaMacBlio *blio,
-                                       PaSampleFormat inputSampleFormat,
-                                       PaSampleFormat outputSampleFormat,
-                                       size_t framesPerBuffer,
-                                       long ringBufferSize,
-                                       int inChan,
-                                       int outChan )
-{
-   void *data;
-   int result;
-   OSStatus err;
-
-   /* zeroify things */
-   bzero( blio, sizeof( PaMacBlio ) );
-   /* this is redundant, but the buffers are used to check
-      if the bufffers have been initialized, so we do it explicitly. */
-   blio->inputRingBuffer.buffer = NULL;
-   blio->outputRingBuffer.buffer = NULL;
-
-   /* initialize simple data */
-   blio->ringBufferFrames = ringBufferSize;
-   blio->inputSampleFormat = inputSampleFormat;
-   blio->inputSampleSizeActual = computeSampleSizeFromFormat(inputSampleFormat);
-   blio->inputSampleSizePow2 = computeSampleSizeFromFormatPow2(inputSampleFormat);
-   blio->outputSampleFormat = outputSampleFormat;
-   blio->outputSampleSizeActual = computeSampleSizeFromFormat(outputSampleFormat);
-   blio->outputSampleSizePow2 = computeSampleSizeFromFormatPow2(outputSampleFormat);
-
-   blio->framesPerBuffer = framesPerBuffer;
-   blio->inChan = inChan;
-   blio->outChan = outChan;
-   blio->statusFlags = 0;
-   blio->errors = paNoError;
-#ifdef PA_MAC_BLIO_MUTEX
-   blio->isInputEmpty = false;
-   blio->isOutputFull = false;
-#endif
-
-   /* setup ring buffers */
-#ifdef PA_MAC_BLIO_MUTEX
-   result = PaMacCore_SetUnixError( pthread_mutex_init(&(blio->inputMutex),NULL), 0 );
-   if( result )
-      goto error;
-   result = UNIX_ERR( pthread_cond_init( &(blio->inputCond), NULL ) );
-   if( result )
-      goto error;
-   result = UNIX_ERR( pthread_mutex_init(&(blio->outputMutex),NULL) );
-   if( result )
-      goto error;
-   result = UNIX_ERR( pthread_cond_init( &(blio->outputCond), NULL ) );
-#endif
-   if( inChan ) {
-      data = calloc( ringBufferSize, blio->inputSampleSizePow2*inChan );
-      if( !data )
-      {
-         result = paInsufficientMemory;
-         goto error;
-      }
-
-      err = PaUtil_InitializeRingBuffer(
-            &blio->inputRingBuffer,
-            1, ringBufferSize*blio->inputSampleSizePow2*inChan,
-            data );
-      assert( !err );
-   }
-   if( outChan ) {
-      data = calloc( ringBufferSize, blio->outputSampleSizePow2*outChan );
-      if( !data )
-      {
-         result = paInsufficientMemory;
-         goto error;
-      }
-
-      err = PaUtil_InitializeRingBuffer(
-            &blio->outputRingBuffer,
-            1, ringBufferSize*blio->outputSampleSizePow2*outChan,
-            data );
-      assert( !err );
-   }
-
-   result = resetBlioRingBuffers( blio );
-   if( result )
-      goto error;
-
-   return 0;
-
- error:
-   destroyBlioRingBuffers( blio );
-   return result;
-}
-
-#ifdef PA_MAC_BLIO_MUTEX
-PaError blioSetIsInputEmpty( PaMacBlio *blio, bool isEmpty )
-{
-   PaError result = paNoError;
-   if( isEmpty == blio->isInputEmpty )
-      goto done;
-
-   /* we need to update the value. Here's what we do:
-    * - Lock the mutex, so noone else can write.
-    * - update the value.
-    * - unlock.
-    * - broadcast to all listeners.
-    */
-   result = UNIX_ERR( pthread_mutex_lock( &blio->inputMutex ) );
-   if( result )
-      goto done;
-   blio->isInputEmpty = isEmpty;
-   result = UNIX_ERR( pthread_mutex_unlock( &blio->inputMutex ) );
-   if( result )
-      goto done;
-   result = UNIX_ERR( pthread_cond_broadcast( &blio->inputCond ) );
-   if( result )
-      goto done;
-
- done:
-   return result;
-}
-PaError blioSetIsOutputFull( PaMacBlio *blio, bool isFull )
-{
-   PaError result = paNoError;
-   if( isFull == blio->isOutputFull )
-      goto done;
-
-   /* we need to update the value. Here's what we do:
-    * - Lock the mutex, so noone else can write.
-    * - update the value.
-    * - unlock.
-    * - broadcast to all listeners.
-    */
-   result = UNIX_ERR( pthread_mutex_lock( &blio->outputMutex ) );
-   if( result )
-      goto done;
-   blio->isOutputFull = isFull;
-   result = UNIX_ERR( pthread_mutex_unlock( &blio->outputMutex ) );
-   if( result )
-      goto done;
-   result = UNIX_ERR( pthread_cond_broadcast( &blio->outputCond ) );
-   if( result )
-      goto done;
-
- done:
-   return result;
-}
-#endif
-
-/* This should be called after stopping or aborting the stream, so that on next
-   start, the buffers will be ready. */
-PaError resetBlioRingBuffers( PaMacBlio *blio )
-{
-#ifdef PA_MAC__BLIO_MUTEX
-   int result;
-#endif
-   blio->statusFlags = 0;
-   if( blio->outputRingBuffer.buffer ) {
-      PaUtil_FlushRingBuffer( &blio->outputRingBuffer );
-      bzero( blio->outputRingBuffer.buffer,
-             blio->outputRingBuffer.bufferSize );
-      /* Advance buffer */
-      PaUtil_AdvanceRingBufferWriteIndex( &blio->outputRingBuffer, blio->ringBufferFrames*blio->outputSampleSizeActual*blio->outChan );
-      //PaUtil_AdvanceRingBufferWriteIndex( &blio->outputRingBuffer, blio->outputRingBuffer.bufferSize );
-
-      /* Update isOutputFull. */
-#ifdef PA_MAC__BLIO_MUTEX
-      result = blioSetIsOutputFull( blio, toAdvance == blio->outputRingBuffer.bufferSize );
-      if( result )
-         goto error;
-#endif
-/*
-      printf( "------%d\n" ,  blio->framesPerBuffer );
-      printf( "------%d\n" ,  blio->outChan );
-      printf( "------%d\n" ,  blio->outputSampleSize );
-      printf( "------%d\n" ,  blio->framesPerBuffer*blio->outChan*blio->outputSampleSize );
-*/
-   }
-   if( blio->inputRingBuffer.buffer ) {
-      PaUtil_FlushRingBuffer( &blio->inputRingBuffer );
-      bzero( blio->inputRingBuffer.buffer,
-             blio->inputRingBuffer.bufferSize );
-      /* Update isInputEmpty. */
-#ifdef PA_MAC__BLIO_MUTEX
-      result = blioSetIsInputEmpty( blio, true );
-      if( result )
-         goto error;
-#endif
-   }
-   return paNoError;
-#ifdef PA_MAC__BLIO_MUTEX
- error:
-   return result;
-#endif
-}
-
-/*This should be called when you are done with the blio. It can safely be called
-  multiple times if there are no exceptions. */
-PaError destroyBlioRingBuffers( PaMacBlio *blio )
-{
-   PaError result = paNoError;
-   if( blio->inputRingBuffer.buffer ) {
-      free( blio->inputRingBuffer.buffer );
-#ifdef PA_MAC__BLIO_MUTEX
-      result = UNIX_ERR( pthread_mutex_destroy( & blio->inputMutex ) );
-      if( result ) return result;
-      result = UNIX_ERR( pthread_cond_destroy( & blio->inputCond ) );
-      if( result ) return result;
-#endif
-   }
-   blio->inputRingBuffer.buffer = NULL;
-   if( blio->outputRingBuffer.buffer ) {
-      free( blio->outputRingBuffer.buffer );
-#ifdef PA_MAC__BLIO_MUTEX
-      result = UNIX_ERR( pthread_mutex_destroy( & blio->outputMutex ) );
-      if( result ) return result;
-      result = UNIX_ERR( pthread_cond_destroy( & blio->outputCond ) );
-      if( result ) return result;
-#endif
-   }
-   blio->outputRingBuffer.buffer = NULL;
-
-   return result;
-}
-
-/*
- * this is the BlioCallback function. It expects to recieve a PaMacBlio Object
- * pointer as userData.
- *
- */
-int BlioCallback( const void *input, void *output, unsigned long frameCount,
-	const PaStreamCallbackTimeInfo* timeInfo,
-        PaStreamCallbackFlags statusFlags,
-        void *userData )
-{
-   PaMacBlio *blio = (PaMacBlio*)userData;
-   long avail;
-   long toRead;
-   long toWrite;
-   long read;
-   long written;
-
-   /* set flags returned by OS: */
-   OSAtomicOr32( statusFlags, &blio->statusFlags ) ;
-
-   /* --- Handle Input Buffer --- */
-   if( blio->inChan ) {
-      avail = PaUtil_GetRingBufferWriteAvailable( &blio->inputRingBuffer );
-
-      /* check for underflow */
-      if( avail < frameCount * blio->inputSampleSizeActual * blio->inChan )
-      {
-         OSAtomicOr32( paInputOverflow, &blio->statusFlags );
-      }
-      toRead = MIN( avail, frameCount * blio->inputSampleSizeActual * blio->inChan );
-
-      /* copy the data */
-      /*printf( "reading %d\n", toRead );*/
-      read = PaUtil_WriteRingBuffer( &blio->inputRingBuffer, input, toRead );
-      assert( toRead == read );
-#ifdef PA_MAC__BLIO_MUTEX
-      /* Priority inversion. See notes below. */
-      blioSetIsInputEmpty( blio, false );
-#endif
-   }
-
-
-   /* --- Handle Output Buffer --- */
-   if( blio->outChan ) {
-      avail = PaUtil_GetRingBufferReadAvailable( &blio->outputRingBuffer );
-
-      /* check for underflow */
-      if( avail < frameCount * blio->outputSampleSizeActual * blio->outChan )
-         OSAtomicOr32( paOutputUnderflow, &blio->statusFlags );
-
-      toWrite = MIN( avail, frameCount * blio->outputSampleSizeActual * blio->outChan );
-
-      if( toWrite != frameCount * blio->outputSampleSizeActual * blio->outChan )
-         bzero( ((char *)output)+toWrite,
-                frameCount * blio->outputSampleSizeActual * blio->outChan - toWrite );
-      /* copy the data */
-      /*printf( "writing %d\n", toWrite );*/
-      written = PaUtil_ReadRingBuffer( &blio->outputRingBuffer, output, toWrite );
-      assert( toWrite == written );
-#ifdef PA_MAC__BLIO_MUTEX
-      /* We have a priority inversion here. However, we will only have to
-         wait if this was true and is now false, which means we've got
-         some room in the buffer.
-         Hopefully problems will be minimized. */
-      blioSetIsOutputFull( blio, false );
-#endif
-   }
-
-   return paContinue;
-}
-
-PaError ReadStream( PaStream* stream,
-                           void *buffer,
-                           unsigned long frames )
-{
-    PaMacBlio *blio = & ((PaMacCoreStream*)stream) -> blio;
-    char *cbuf = (char *) buffer;
-    PaError ret = paNoError;
-    VVDBUG(("ReadStream()\n"));
-
-    while( frames > 0 ) {
-       long avail;
-       long toRead;
-       do {
-          avail = PaUtil_GetRingBufferReadAvailable( &blio->inputRingBuffer );
-/*
-          printf( "Read Buffer is %%%g full: %ld of %ld.\n",
-                  100 * (float)avail / (float) blio->inputRingBuffer.bufferSize,
-                  avail, blio->inputRingBuffer.bufferSize );
-*/
-          if( avail == 0 ) {
-#ifdef PA_MAC_BLIO_MUTEX
-             /**block when empty*/
-             ret = UNIX_ERR( pthread_mutex_lock( &blio->inputMutex ) );
-             if( ret )
-                return ret;
-             while( blio->isInputEmpty ) {
-                ret = UNIX_ERR( pthread_cond_wait( &blio->inputCond, &blio->inputMutex ) );
-                if( ret )
-                   return ret;
-             }
-             ret = UNIX_ERR( pthread_mutex_unlock( &blio->inputMutex ) );
-             if( ret )
-                return ret;
-#else
-             Pa_Sleep( PA_MAC_BLIO_BUSY_WAIT_SLEEP_INTERVAL );
-#endif
-          }
-       } while( avail == 0 );
-       toRead = MIN( avail, frames * blio->inputSampleSizeActual * blio->inChan );
-       toRead -= toRead % blio->inputSampleSizeActual * blio->inChan ;
-       PaUtil_ReadRingBuffer( &blio->inputRingBuffer, (void *)cbuf, toRead );
-       cbuf += toRead;
-       frames -= toRead / ( blio->inputSampleSizeActual * blio->inChan );
-
-       if( toRead == avail ) {
-#ifdef PA_MAC_BLIO_MUTEX
-          /* we just emptied the buffer, so we need to mark it as empty. */
-          ret = blioSetIsInputEmpty( blio, true );
-          if( ret )
-             return ret;
-          /* of course, in the meantime, the callback may have put some sats
-             in, so
-             so check for that, too, to avoid a race condition. */
-          if( PaUtil_GetRingBufferReadAvailable( &blio->inputRingBuffer ) ) {
-             blioSetIsInputEmpty( blio, false );
-             if( ret )
-                return ret;
-          }
-#endif
-       }
-    }
-
-    /*   Report either paNoError or paInputOverflowed. */
-    /*   may also want to report other errors, but this is non-standard. */
-    ret = blio->statusFlags & paInputOverflow;
-
-    /* report underflow only once: */
-    if( ret ) {
-       OSAtomicAnd32( (uint32_t)(~paInputOverflow), &blio->statusFlags );
-       ret = paInputOverflowed;
-    }
-
-    return ret;
-}
-
-
-PaError WriteStream( PaStream* stream,
-                            const void *buffer,
-                            unsigned long frames )
-{
-    PaMacBlio *blio = & ((PaMacCoreStream*)stream) -> blio;
-    char *cbuf = (char *) buffer;
-    PaError ret = paNoError;
-    VVDBUG(("WriteStream()\n"));
-
-    while( frames > 0 ) {
-       long avail = 0;
-       long toWrite;
-
-       do {
-          avail = PaUtil_GetRingBufferWriteAvailable( &blio->outputRingBuffer );
-/*
-          printf( "Write Buffer is %%%g full: %ld of %ld.\n",
-                  100 - 100 * (float)avail / (float) blio->outputRingBuffer.bufferSize,
-                  avail, blio->outputRingBuffer.bufferSize );
-*/
-          if( avail == 0 ) {
-#ifdef PA_MAC_BLIO_MUTEX
-             /*block while full*/
-             ret = UNIX_ERR( pthread_mutex_lock( &blio->outputMutex ) );
-             if( ret )
-                return ret;
-             while( blio->isOutputFull ) {
-                ret = UNIX_ERR( pthread_cond_wait( &blio->outputCond, &blio->outputMutex ) );
-                if( ret )
-                   return ret;
-             }
-             ret = UNIX_ERR( pthread_mutex_unlock( &blio->outputMutex ) );
-             if( ret )
-                return ret;
-#else
-             Pa_Sleep( PA_MAC_BLIO_BUSY_WAIT_SLEEP_INTERVAL );
-#endif
-          }
-       } while( avail == 0 );
-
-       toWrite = MIN( avail, frames * blio->outputSampleSizeActual * blio->outChan );
-       toWrite -= toWrite % blio->outputSampleSizeActual * blio->outChan ;
-       PaUtil_WriteRingBuffer( &blio->outputRingBuffer, (void *)cbuf, toWrite );
-       cbuf += toWrite;
-       frames -= toWrite / ( blio->outputSampleSizeActual * blio->outChan );
-
-#ifdef PA_MAC_BLIO_MUTEX
-       if( toWrite == avail ) {
-          /* we just filled up the buffer, so we need to mark it as filled. */
-          ret = blioSetIsOutputFull( blio, true );
-          if( ret )
-             return ret;
-          /* of course, in the meantime, we may have emptied the buffer, so
-             so check for that, too, to avoid a race condition. */
-          if( PaUtil_GetRingBufferWriteAvailable( &blio->outputRingBuffer ) ) {
-             blioSetIsOutputFull( blio, false );
-             if( ret )
-                return ret;
-          }
-       }
-#endif
-    }
-
-    /*   Report either paNoError or paOutputUnderflowed. */
-    /*   may also want to report other errors, but this is non-standard. */
-    ret = blio->statusFlags & paOutputUnderflow;
-
-    /* report underflow only once: */
-    if( ret ) {
-      OSAtomicAnd32( (uint32_t)(~paOutputUnderflow), &blio->statusFlags );
-      ret = paOutputUnderflowed;
-    }
-
-    return ret;
-}
-
-/*
- *
- */
-void waitUntilBlioWriteBufferIsFlushed( PaMacBlio *blio )
-{
-    if( blio->outputRingBuffer.buffer ) {
-       long avail = PaUtil_GetRingBufferWriteAvailable( &blio->outputRingBuffer );
-       while( avail != blio->outputRingBuffer.bufferSize ) {
-          if( avail == 0 )
-             Pa_Sleep( PA_MAC_BLIO_BUSY_WAIT_SLEEP_INTERVAL );
-          avail = PaUtil_GetRingBufferWriteAvailable( &blio->outputRingBuffer );
-       }
-    }
-}
-
-
-signed long GetStreamReadAvailable( PaStream* stream )
-{
-    PaMacBlio *blio = & ((PaMacCoreStream*)stream) -> blio;
-    VVDBUG(("GetStreamReadAvailable()\n"));
-
-    return PaUtil_GetRingBufferReadAvailable( &blio->inputRingBuffer )
-                         / ( blio->inputSampleSizeActual * blio->inChan );
-}
-
-
-signed long GetStreamWriteAvailable( PaStream* stream )
-{
-    PaMacBlio *blio = & ((PaMacCoreStream*)stream) -> blio;
-    VVDBUG(("GetStreamWriteAvailable()\n"));
-
-    return PaUtil_GetRingBufferWriteAvailable( &blio->outputRingBuffer )
-                         / ( blio->outputSampleSizeActual * blio->outChan );
-}
-
+/*
+ * Implementation of the PortAudio API for Apple AUHAL
+ *
+ * PortAudio Portable Real-Time Audio Library
+ * Latest Version at: http://www.portaudio.com
+ *
+ * Written by Bjorn Roche of XO Audio LLC, from PA skeleton code.
+ * Portions copied from code by Dominic Mazzoni (who wrote a HAL implementation)
+ *
+ * Dominic's code was based on code by Phil Burk, Darren Gibbs,
+ * Gord Peters, Stephane Letz, and Greg Pfiel.
+ *
+ * The following people also deserve acknowledgements:
+ *
+ * Olivier Tristan for feedback and testing
+ * Glenn Zelniker and Z-Systems engineering for sponsoring the Blocking I/O
+ * interface.
+ * 
+ *
+ * Based on the Open Source API proposed by Ross Bencina
+ * Copyright (c) 1999-2002 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 hostapi_src
+
+ This file contains the implementation
+ required for blocking I/O. It is separated from pa_mac_core.c simply to ease
+ development.
+*/
+
+#include "pa_mac_core_blocking.h"
+#include "pa_mac_core_internal.h"
+#include <assert.h>
+#ifdef MOSX_USE_NON_ATOMIC_FLAG_BITS
+# define OSAtomicOr32( a, b ) ( (*(b)) |= (a) )
+# define OSAtomicAnd32( a, b ) ( (*(b)) &= (a) )
+#else
+# include <libkern/OSAtomic.h>
+#endif
+
+/*
+ * This function determines the size of a particular sample format.
+ * if the format is not recognized, this returns zero.
+ */
+static size_t computeSampleSizeFromFormat( PaSampleFormat format )
+{
+   switch( format & (~paNonInterleaved) ) {
+   case paFloat32: return 4;
+   case paInt32: return 4;
+   case paInt24: return 3;
+   case paInt16: return 2;
+   case paInt8: case paUInt8: return 1;
+   default: return 0;
+   }
+}
+/*
+ * Same as computeSampleSizeFromFormat, except that if
+ * the size is not a power of two, it returns the next power of two up
+ */
+static size_t computeSampleSizeFromFormatPow2( PaSampleFormat format )
+{
+   switch( format & (~paNonInterleaved) ) {
+   case paFloat32: return 4;
+   case paInt32: return 4;
+   case paInt24: return 4;
+   case paInt16: return 2;
+   case paInt8: case paUInt8: return 1;
+   default: return 0;
+   }
+}
+
+
+
+/*
+ * Functions for initializing, resetting, and destroying BLIO structures.
+ *
+ */
+
+/**
+ * This should be called with the relevant info when initializing a stream for callback.
+ *
+ * @param ringBufferSizeInFrames must be a power of 2
+ */
+PaError initializeBlioRingBuffers(
+                                       PaMacBlio *blio,
+                                       PaSampleFormat inputSampleFormat,
+                                       PaSampleFormat outputSampleFormat,
+                                       long ringBufferSizeInFrames,
+                                       int inChan,
+                                       int outChan )
+{
+   void *data;
+   int result;
+   OSStatus err;
+
+   /* zeroify things */
+   bzero( blio, sizeof( PaMacBlio ) );
+   /* this is redundant, but the buffers are used to check
+      if the buffers have been initialized, so we do it explicitly. */
+   blio->inputRingBuffer.buffer = NULL;
+   blio->outputRingBuffer.buffer = NULL;
+
+   /* initialize simple data */
+   blio->ringBufferFrames = ringBufferSizeInFrames;
+   blio->inputSampleFormat = inputSampleFormat;
+   blio->inputSampleSizeActual = computeSampleSizeFromFormat(inputSampleFormat);
+   blio->inputSampleSizePow2 = computeSampleSizeFromFormatPow2(inputSampleFormat); // FIXME: WHY?
+   blio->outputSampleFormat = outputSampleFormat;
+   blio->outputSampleSizeActual = computeSampleSizeFromFormat(outputSampleFormat);
+   blio->outputSampleSizePow2 = computeSampleSizeFromFormatPow2(outputSampleFormat);
+
+   blio->inChan = inChan;
+   blio->outChan = outChan;
+   blio->statusFlags = 0;
+   blio->errors = paNoError;
+#ifdef PA_MAC_BLIO_MUTEX
+   blio->isInputEmpty = false;
+   blio->isOutputFull = false;
+#endif
+
+   /* setup ring buffers */
+#ifdef PA_MAC_BLIO_MUTEX
+   result = PaMacCore_SetUnixError( pthread_mutex_init(&(blio->inputMutex),NULL), 0 );
+   if( result )
+      goto error;
+   result = UNIX_ERR( pthread_cond_init( &(blio->inputCond), NULL ) );
+   if( result )
+      goto error;
+   result = UNIX_ERR( pthread_mutex_init(&(blio->outputMutex),NULL) );
+   if( result )
+      goto error;
+   result = UNIX_ERR( pthread_cond_init( &(blio->outputCond), NULL ) );
+#endif
+   if( inChan ) {
+      data = calloc( ringBufferSizeInFrames, blio->inputSampleSizePow2 * inChan );
+      if( !data )
+      {
+         result = paInsufficientMemory;
+         goto error;
+      }
+
+      err = PaUtil_InitializeRingBuffer(
+            &blio->inputRingBuffer,
+            blio->inputSampleSizePow2 * inChan,
+            ringBufferSizeInFrames,
+            data );
+      assert( !err );
+   }
+   if( outChan ) {
+      data = calloc( ringBufferSizeInFrames, blio->outputSampleSizePow2 * outChan );
+      if( !data )
+      {
+         result = paInsufficientMemory;
+         goto error;
+      }
+
+      err = PaUtil_InitializeRingBuffer(
+            &blio->outputRingBuffer,
+            blio->outputSampleSizePow2 * outChan,
+            ringBufferSizeInFrames,
+            data );
+      assert( !err );
+   }
+
+   result = resetBlioRingBuffers( blio );
+   if( result )
+      goto error;
+
+   return 0;
+
+ error:
+   destroyBlioRingBuffers( blio );
+   return result;
+}
+
+#ifdef PA_MAC_BLIO_MUTEX
+PaError blioSetIsInputEmpty( PaMacBlio *blio, bool isEmpty )
+{
+   PaError result = paNoError;
+   if( isEmpty == blio->isInputEmpty )
+      goto done;
+
+   /* we need to update the value. Here's what we do:
+    * - Lock the mutex, so noone else can write.
+    * - update the value.
+    * - unlock.
+    * - broadcast to all listeners.
+    */
+   result = UNIX_ERR( pthread_mutex_lock( &blio->inputMutex ) );
+   if( result )
+      goto done;
+   blio->isInputEmpty = isEmpty;
+   result = UNIX_ERR( pthread_mutex_unlock( &blio->inputMutex ) );
+   if( result )
+      goto done;
+   result = UNIX_ERR( pthread_cond_broadcast( &blio->inputCond ) );
+   if( result )
+      goto done;
+
+ done:
+   return result;
+}
+PaError blioSetIsOutputFull( PaMacBlio *blio, bool isFull )
+{
+   PaError result = paNoError;
+   if( isFull == blio->isOutputFull )
+      goto done;
+
+   /* we need to update the value. Here's what we do:
+    * - Lock the mutex, so noone else can write.
+    * - update the value.
+    * - unlock.
+    * - broadcast to all listeners.
+    */
+   result = UNIX_ERR( pthread_mutex_lock( &blio->outputMutex ) );
+   if( result )
+      goto done;
+   blio->isOutputFull = isFull;
+   result = UNIX_ERR( pthread_mutex_unlock( &blio->outputMutex ) );
+   if( result )
+      goto done;
+   result = UNIX_ERR( pthread_cond_broadcast( &blio->outputCond ) );
+   if( result )
+      goto done;
+
+ done:
+   return result;
+}
+#endif
+
+/* This should be called after stopping or aborting the stream, so that on next
+   start, the buffers will be ready. */
+PaError resetBlioRingBuffers( PaMacBlio *blio )
+{
+#ifdef PA_MAC__BLIO_MUTEX
+   int result;
+#endif
+   blio->statusFlags = 0;
+   if( blio->outputRingBuffer.buffer ) {
+       PaUtil_FlushRingBuffer( &blio->outputRingBuffer );
+       /* Fill the buffer with zeros. */
+       bzero( blio->outputRingBuffer.buffer,
+             blio->outputRingBuffer.bufferSize * blio->outputRingBuffer.elementSizeBytes );
+       PaUtil_AdvanceRingBufferWriteIndex( &blio->outputRingBuffer, blio->ringBufferFrames );
+
+      /* Update isOutputFull. */
+#ifdef PA_MAC__BLIO_MUTEX
+      result = blioSetIsOutputFull( blio, toAdvance == blio->outputRingBuffer.bufferSize );
+      if( result )
+         goto error;
+#endif
+/*
+      printf( "------%d\n" ,  blio->outChan );
+      printf( "------%d\n" ,  blio->outputSampleSize );
+*/
+   }
+   if( blio->inputRingBuffer.buffer ) {
+      PaUtil_FlushRingBuffer( &blio->inputRingBuffer );
+      bzero( blio->inputRingBuffer.buffer,
+             blio->inputRingBuffer.bufferSize * blio->inputRingBuffer.elementSizeBytes );
+      /* Update isInputEmpty. */
+#ifdef PA_MAC__BLIO_MUTEX
+      result = blioSetIsInputEmpty( blio, true );
+      if( result )
+         goto error;
+#endif
+   }
+   return paNoError;
+#ifdef PA_MAC__BLIO_MUTEX
+ error:
+   return result;
+#endif
+}
+
+/*This should be called when you are done with the blio. It can safely be called
+  multiple times if there are no exceptions. */
+PaError destroyBlioRingBuffers( PaMacBlio *blio )
+{
+   PaError result = paNoError;
+   if( blio->inputRingBuffer.buffer ) {
+      free( blio->inputRingBuffer.buffer );
+#ifdef PA_MAC__BLIO_MUTEX
+      result = UNIX_ERR( pthread_mutex_destroy( & blio->inputMutex ) );
+      if( result ) return result;
+      result = UNIX_ERR( pthread_cond_destroy( & blio->inputCond ) );
+      if( result ) return result;
+#endif
+   }
+   blio->inputRingBuffer.buffer = NULL;
+   if( blio->outputRingBuffer.buffer ) {
+      free( blio->outputRingBuffer.buffer );
+#ifdef PA_MAC__BLIO_MUTEX
+      result = UNIX_ERR( pthread_mutex_destroy( & blio->outputMutex ) );
+      if( result ) return result;
+      result = UNIX_ERR( pthread_cond_destroy( & blio->outputCond ) );
+      if( result ) return result;
+#endif
+   }
+   blio->outputRingBuffer.buffer = NULL;
+
+   return result;
+}
+
+/*
+ * this is the BlioCallback function. It expects to recieve a PaMacBlio Object
+ * pointer as userData.
+ *
+ */
+int BlioCallback( const void *input, void *output, unsigned long frameCount,
+	const PaStreamCallbackTimeInfo* timeInfo,
+        PaStreamCallbackFlags statusFlags,
+        void *userData )
+{
+   PaMacBlio *blio = (PaMacBlio*)userData;
+   ring_buffer_size_t framesAvailable;
+   ring_buffer_size_t framesToTransfer;
+   ring_buffer_size_t framesTransferred;
+
+   /* set flags returned by OS: */
+   OSAtomicOr32( statusFlags, &blio->statusFlags ) ;
+
+   /* --- Handle Input Buffer --- */
+   if( blio->inChan ) {
+      framesAvailable = PaUtil_GetRingBufferWriteAvailable( &blio->inputRingBuffer );
+
+      /* check for underflow */
+      if( framesAvailable < frameCount )
+      {
+          OSAtomicOr32( paInputOverflow, &blio->statusFlags );
+          framesToTransfer = framesAvailable;
+      }
+      else
+      {
+          framesToTransfer = (ring_buffer_size_t)frameCount;
+      }
+
+      /* Copy the data from the audio input to the application ring buffer. */
+      /*printf( "reading %d\n", toRead );*/
+      framesTransferred = PaUtil_WriteRingBuffer( &blio->inputRingBuffer, input, framesToTransfer );
+      assert( framesToTransfer == framesTransferred );
+#ifdef PA_MAC__BLIO_MUTEX
+      /* Priority inversion. See notes below. */
+      blioSetIsInputEmpty( blio, false );
+#endif
+   }
+
+
+   /* --- Handle Output Buffer --- */
+   if( blio->outChan ) {
+      framesAvailable = PaUtil_GetRingBufferReadAvailable( &blio->outputRingBuffer );
+
+      /* check for underflow */
+      if( framesAvailable < frameCount )
+      {
+          /* zero out the end of the output buffer that we do not have data for */
+          framesToTransfer = framesAvailable;
+
+          size_t bytesPerFrame = blio->outputSampleSizeActual * blio->outChan;
+          size_t offsetInBytes = framesToTransfer * bytesPerFrame;
+          size_t countInBytes = (frameCount - framesToTransfer) * bytesPerFrame;
+          bzero( ((char *)output) + offsetInBytes, countInBytes );
+
+          OSAtomicOr32( paOutputUnderflow, &blio->statusFlags );
+          framesToTransfer = framesAvailable;
+      }
+      else
+      {
+          framesToTransfer = (ring_buffer_size_t)frameCount;
+      }
+
+      /* copy the data */
+      /*printf( "writing %d\n", toWrite );*/
+      framesTransferred = PaUtil_ReadRingBuffer( &blio->outputRingBuffer, output, framesToTransfer );
+      assert( framesToTransfer == framesTransferred );
+#ifdef PA_MAC__BLIO_MUTEX
+      /* We have a priority inversion here. However, we will only have to
+         wait if this was true and is now false, which means we've got
+         some room in the buffer.
+         Hopefully problems will be minimized. */
+      blioSetIsOutputFull( blio, false );
+#endif
+   }
+
+   return paContinue;
+}
+
+PaError ReadStream( PaStream* stream,
+                           void *buffer,
+                           unsigned long framesRequested )
+{
+    PaMacBlio *blio = & ((PaMacCoreStream*)stream) -> blio;
+    char *cbuf = (char *) buffer;
+    PaError ret = paNoError;
+    VVDBUG(("ReadStream()\n"));
+
+    while( framesRequested > 0 ) {
+       ring_buffer_size_t framesAvailable;
+       ring_buffer_size_t framesToTransfer;
+       ring_buffer_size_t framesTransferred;
+       do {
+          framesAvailable = PaUtil_GetRingBufferReadAvailable( &blio->inputRingBuffer );
+/*
+          printf( "Read Buffer is %%%g full: %ld of %ld.\n",
+                  100 * (float)avail / (float) blio->inputRingBuffer.bufferSize,
+                  framesAvailable, blio->inputRingBuffer.bufferSize );
+*/
+          if( framesAvailable == 0 ) {
+#ifdef PA_MAC_BLIO_MUTEX
+             /**block when empty*/
+             ret = UNIX_ERR( pthread_mutex_lock( &blio->inputMutex ) );
+             if( ret )
+                return ret;
+             while( blio->isInputEmpty ) {
+                ret = UNIX_ERR( pthread_cond_wait( &blio->inputCond, &blio->inputMutex ) );
+                if( ret )
+                   return ret;
+             }
+             ret = UNIX_ERR( pthread_mutex_unlock( &blio->inputMutex ) );
+             if( ret )
+                return ret;
+#else
+             Pa_Sleep( PA_MAC_BLIO_BUSY_WAIT_SLEEP_INTERVAL );
+#endif
+          }
+       } while( framesAvailable == 0 );
+       framesToTransfer = (ring_buffer_size_t) MIN( framesAvailable, framesRequested );
+       framesTransferred = PaUtil_ReadRingBuffer( &blio->inputRingBuffer, (void *)cbuf, framesToTransfer );
+       cbuf += framesTransferred * blio->inputSampleSizeActual * blio->inChan;
+       framesRequested -= framesTransferred;
+
+       if( framesToTransfer == framesAvailable ) {
+#ifdef PA_MAC_BLIO_MUTEX
+          /* we just emptied the buffer, so we need to mark it as empty. */
+          ret = blioSetIsInputEmpty( blio, true );
+          if( ret )
+             return ret;
+          /* of course, in the meantime, the callback may have put some sats
+             in, so
+             so check for that, too, to avoid a race condition. */
+          /* FIXME - this does not seem to fix any race condition. */
+          if( PaUtil_GetRingBufferReadAvailable( &blio->inputRingBuffer ) ) {
+             blioSetIsInputEmpty( blio, false );
+             /* FIXME - why check? ret has not been set? */
+             if( ret )
+                return ret;
+          }
+#endif
+       }
+    }
+
+    /*   Report either paNoError or paInputOverflowed. */
+    /*   may also want to report other errors, but this is non-standard. */
+    /* FIXME should not clobber ret, use if(blio->statusFlags & paInputOverflow) */
+    ret = blio->statusFlags & paInputOverflow;
+
+    /* report underflow only once: */
+    if( ret ) {
+       OSAtomicAnd32( (uint32_t)(~paInputOverflow), &blio->statusFlags );
+       ret = paInputOverflowed;
+    }
+
+    return ret;
+}
+
+
+PaError WriteStream( PaStream* stream,
+                            const void *buffer,
+                            unsigned long framesRequested )
+{
+    PaMacCoreStream *macStream = (PaMacCoreStream*)stream;
+    PaMacBlio *blio = &macStream->blio;
+    char *cbuf = (char *) buffer;
+    PaError ret = paNoError;
+    VVDBUG(("WriteStream()\n"));
+
+    while( framesRequested > 0 && macStream->state != STOPPING ) {
+        ring_buffer_size_t framesAvailable;
+        ring_buffer_size_t framesToTransfer;
+        ring_buffer_size_t framesTransferred;
+
+       do {
+          framesAvailable = PaUtil_GetRingBufferWriteAvailable( &blio->outputRingBuffer );
+/*
+          printf( "Write Buffer is %%%g full: %ld of %ld.\n",
+                  100 - 100 * (float)avail / (float) blio->outputRingBuffer.bufferSize,
+                  framesAvailable, blio->outputRingBuffer.bufferSize );
+*/
+          if( framesAvailable == 0 ) {
+#ifdef PA_MAC_BLIO_MUTEX
+             /*block while full*/
+             ret = UNIX_ERR( pthread_mutex_lock( &blio->outputMutex ) );
+             if( ret )
+                return ret;
+             while( blio->isOutputFull ) {
+                ret = UNIX_ERR( pthread_cond_wait( &blio->outputCond, &blio->outputMutex ) );
+                if( ret )
+                   return ret;
+             }
+             ret = UNIX_ERR( pthread_mutex_unlock( &blio->outputMutex ) );
+             if( ret )
+                return ret;
+#else
+             Pa_Sleep( PA_MAC_BLIO_BUSY_WAIT_SLEEP_INTERVAL );
+#endif
+          }
+       } while( framesAvailable == 0 && macStream->state != STOPPING );
+
+       if( macStream->state == STOPPING )
+       {
+           break;
+       }
+
+       framesToTransfer = MIN( framesAvailable, framesRequested );
+       framesTransferred = PaUtil_WriteRingBuffer( &blio->outputRingBuffer, (void *)cbuf, framesToTransfer );
+       cbuf += framesTransferred * blio->outputSampleSizeActual * blio->outChan;
+       framesRequested -= framesTransferred;
+
+#ifdef PA_MAC_BLIO_MUTEX
+       if( framesToTransfer == framesAvailable ) {
+          /* we just filled up the buffer, so we need to mark it as filled. */
+          ret = blioSetIsOutputFull( blio, true );
+          if( ret )
+             return ret;
+          /* of course, in the meantime, we may have emptied the buffer, so
+             so check for that, too, to avoid a race condition. */
+          if( PaUtil_GetRingBufferWriteAvailable( &blio->outputRingBuffer ) ) {
+             blioSetIsOutputFull( blio, false );
+              /* FIXME remove or review this code, does not fix race, ret not set! */
+             if( ret )
+                return ret;
+          }
+       }
+#endif
+    }
+
+    if ( macStream->state == STOPPING )
+    {
+        ret = paInternalError;
+    }
+    else if (ret == paNoError )
+    {
+        /*   Test for underflow. */
+        ret = blio->statusFlags & paOutputUnderflow;
+
+        /* report underflow only once: */
+        if( ret )
+        {
+            OSAtomicAnd32( (uint32_t)(~paOutputUnderflow), &blio->statusFlags );
+            ret = paOutputUnderflowed;
+        }
+    }
+
+    return ret;
+}
+
+/*
+ * Wait until the data in the buffer has finished playing.
+ */
+PaError waitUntilBlioWriteBufferIsEmpty( PaMacBlio *blio, double sampleRate,
+                                        size_t framesPerBuffer )
+{
+    PaError result = paNoError;
+    if( blio->outputRingBuffer.buffer ) {
+        ring_buffer_size_t framesLeft = PaUtil_GetRingBufferReadAvailable( &blio->outputRingBuffer );
+
+        /* Calculate when we should give up waiting. To be safe wait for two extra periods. */
+        PaTime now = PaUtil_GetTime();
+        PaTime startTime = now;
+        PaTime timeoutTime = startTime + (framesLeft + (2 * framesPerBuffer)) / sampleRate;
+
+        long msecPerBuffer = 1 + (long)( 1000.0 * framesPerBuffer / sampleRate);
+        while( framesLeft > 0 && now < timeoutTime ) {
+            VDBUG(( "waitUntilBlioWriteBufferIsFlushed: framesLeft = %d, framesPerBuffer = %ld\n",
+                  framesLeft, framesPerBuffer ));
+            Pa_Sleep( msecPerBuffer );
+            framesLeft = PaUtil_GetRingBufferReadAvailable( &blio->outputRingBuffer );
+            now = PaUtil_GetTime();
+        }
+
+        if( framesLeft > 0 )
+        {
+            VDBUG(( "waitUntilBlioWriteBufferIsFlushed: TIMED OUT - framesLeft = %d\n", framesLeft ));
+            result = paTimedOut;
+        }
+    }
+    return result;
+}
+
+signed long GetStreamReadAvailable( PaStream* stream )
+{
+    PaMacBlio *blio = & ((PaMacCoreStream*)stream) -> blio;
+    VVDBUG(("GetStreamReadAvailable()\n"));
+
+    return PaUtil_GetRingBufferReadAvailable( &blio->inputRingBuffer );
+}
+
+
+signed long GetStreamWriteAvailable( PaStream* stream )
+{
+    PaMacBlio *blio = & ((PaMacCoreStream*)stream) -> blio;
+    VVDBUG(("GetStreamWriteAvailable()\n"));
+
+    return PaUtil_GetRingBufferWriteAvailable( &blio->outputRingBuffer );
+}
+
diff --git a/src/hostapi/coreaudio/pa_mac_core_blocking.h b/src/hostapi/coreaudio/pa_mac_core_blocking.h
index 971223b..c994f09 100644
--- a/src/hostapi/coreaudio/pa_mac_core_blocking.h
+++ b/src/hostapi/coreaudio/pa_mac_core_blocking.h
@@ -1,136 +1,134 @@
-/*
- * Internal blocking interfaces for PortAudio Apple AUHAL implementation
- *
- * PortAudio Portable Real-Time Audio Library
- * Latest Version at: http://www.portaudio.com
- *
- * Written by Bjorn Roche of XO Audio LLC, from PA skeleton code.
- * Portions copied from code by Dominic Mazzoni (who wrote a HAL implementation)
- *
- * Dominic's code was based on code by Phil Burk, Darren Gibbs,
- * Gord Peters, Stephane Letz, and Greg Pfiel.
- *
- * The following people also deserve acknowledgements:
- *
- * Olivier Tristan for feedback and testing
- * Glenn Zelniker and Z-Systems engineering for sponsoring the Blocking I/O
- * interface.
- * 
- *
- * Based on the Open Source API proposed by Ross Bencina
- * Copyright (c) 1999-2002 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 hostapi_src
-*/
-
-#ifndef PA_MAC_CORE_BLOCKING_H_
-#define PA_MAC_CORE_BLOCKING_H_
-
-#include "pa_ringbuffer.h"
-#include "portaudio.h"
-#include "pa_mac_core_utilities.h"
-
-/*
- * Number of miliseconds to busy wait whil waiting for data in blocking calls.
- */
-#define PA_MAC_BLIO_BUSY_WAIT_SLEEP_INTERVAL (5)
-/*
- * Define exactly one of these blocking methods
- * PA_MAC_BLIO_MUTEX is not actively maintained.
- */
-#define PA_MAC_BLIO_BUSY_WAIT
-/*
-#define PA_MAC_BLIO_MUTEX
-*/
-
-typedef struct {
-    PaUtilRingBuffer inputRingBuffer;
-    PaUtilRingBuffer outputRingBuffer;
-    size_t ringBufferFrames;
-    PaSampleFormat inputSampleFormat;
-    size_t inputSampleSizeActual;
-    size_t inputSampleSizePow2;
-    PaSampleFormat outputSampleFormat;
-    size_t outputSampleSizeActual;
-    size_t outputSampleSizePow2;
-
-    size_t framesPerBuffer;
-
-    int inChan;
-    int outChan;
-
-    //PaStreamCallbackFlags statusFlags;
-    uint32_t statusFlags;
-    PaError errors;
-
-    /* Here we handle blocking, using condition variables. */
-#ifdef  PA_MAC_BLIO_MUTEX
-    volatile bool isInputEmpty;
-    pthread_mutex_t inputMutex;
-    pthread_cond_t inputCond;
-
-    volatile bool isOutputFull;
-    pthread_mutex_t outputMutex;
-    pthread_cond_t outputCond;
-#endif
-}
-PaMacBlio;
-
-/*
- * These functions operate on condition and related variables.
- */
-
-PaError initializeBlioRingBuffers(
-                                       PaMacBlio *blio,
-                                       PaSampleFormat inputSampleFormat,
-                                       PaSampleFormat outputSampleFormat,
-                                       size_t framesPerBuffer,
-                                       long ringBufferSize,
-                                       int inChan,
-                                       int outChan );
-PaError destroyBlioRingBuffers( PaMacBlio *blio );
-PaError resetBlioRingBuffers( PaMacBlio *blio );
-
-int BlioCallback(
-        const void *input, void *output,
-        unsigned long frameCount,
-        const PaStreamCallbackTimeInfo* timeInfo,
-        PaStreamCallbackFlags statusFlags,
-        void *userData );
-
-void waitUntilBlioWriteBufferIsFlushed( PaMacBlio *blio );
-
-#endif /*PA_MAC_CORE_BLOCKING_H_*/
+/*
+ * Internal blocking interfaces for PortAudio Apple AUHAL implementation
+ *
+ * PortAudio Portable Real-Time Audio Library
+ * Latest Version at: http://www.portaudio.com
+ *
+ * Written by Bjorn Roche of XO Audio LLC, from PA skeleton code.
+ * Portions copied from code by Dominic Mazzoni (who wrote a HAL implementation)
+ *
+ * Dominic's code was based on code by Phil Burk, Darren Gibbs,
+ * Gord Peters, Stephane Letz, and Greg Pfiel.
+ *
+ * The following people also deserve acknowledgements:
+ *
+ * Olivier Tristan for feedback and testing
+ * Glenn Zelniker and Z-Systems engineering for sponsoring the Blocking I/O
+ * interface.
+ * 
+ *
+ * Based on the Open Source API proposed by Ross Bencina
+ * Copyright (c) 1999-2002 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 hostapi_src
+*/
+
+#ifndef PA_MAC_CORE_BLOCKING_H_
+#define PA_MAC_CORE_BLOCKING_H_
+
+#include "pa_ringbuffer.h"
+#include "portaudio.h"
+#include "pa_mac_core_utilities.h"
+
+/*
+ * Number of milliseconds to busy wait while waiting for data in blocking calls.
+ */
+#define PA_MAC_BLIO_BUSY_WAIT_SLEEP_INTERVAL (5)
+/*
+ * Define exactly one of these blocking methods
+ * PA_MAC_BLIO_MUTEX is not actively maintained.
+ */
+#define PA_MAC_BLIO_BUSY_WAIT
+/*
+#define PA_MAC_BLIO_MUTEX
+*/
+
+typedef struct {
+    PaUtilRingBuffer inputRingBuffer;
+    PaUtilRingBuffer outputRingBuffer;
+    ring_buffer_size_t ringBufferFrames;
+    PaSampleFormat inputSampleFormat;
+    size_t inputSampleSizeActual;
+    size_t inputSampleSizePow2;
+    PaSampleFormat outputSampleFormat;
+    size_t outputSampleSizeActual;
+    size_t outputSampleSizePow2;
+
+    int inChan;
+    int outChan;
+
+    //PaStreamCallbackFlags statusFlags;
+    uint32_t statusFlags;
+    PaError errors;
+
+    /* Here we handle blocking, using condition variables. */
+#ifdef  PA_MAC_BLIO_MUTEX
+    volatile bool isInputEmpty;
+    pthread_mutex_t inputMutex;
+    pthread_cond_t inputCond;
+
+    volatile bool isOutputFull;
+    pthread_mutex_t outputMutex;
+    pthread_cond_t outputCond;
+#endif
+}
+PaMacBlio;
+
+/*
+ * These functions operate on condition and related variables.
+ */
+
+PaError initializeBlioRingBuffers(
+                                       PaMacBlio *blio,
+                                       PaSampleFormat inputSampleFormat,
+                                       PaSampleFormat outputSampleFormat,
+                                       long ringBufferSizeInFrames,
+                                       int inChan,
+                                       int outChan );
+PaError destroyBlioRingBuffers( PaMacBlio *blio );
+PaError resetBlioRingBuffers( PaMacBlio *blio );
+
+int BlioCallback(
+        const void *input, void *output,
+        unsigned long frameCount,
+        const PaStreamCallbackTimeInfo* timeInfo,
+        PaStreamCallbackFlags statusFlags,
+        void *userData );
+
+PaError waitUntilBlioWriteBufferIsEmpty( PaMacBlio *blio, double sampleRate,
+                                        size_t framesPerBuffer );
+
+#endif /*PA_MAC_CORE_BLOCKING_H_*/
diff --git a/src/hostapi/coreaudio/pa_mac_core_old.c b/src/hostapi/coreaudio/pa_mac_core_old.c
index 4ef8954..0e9b357 100644
--- a/src/hostapi/coreaudio/pa_mac_core_old.c
+++ b/src/hostapi/coreaudio/pa_mac_core_old.c
@@ -1,5 +1,5 @@
 /*
- * $Id: pa_mac_core_old.c 1083 2006-08-23 07:30:49Z rossb $
+ * $Id$
  * pa_mac_core.c
  * Implementation of PortAudio for Mac OS X CoreAudio       
  *                                                                                         
diff --git a/src/hostapi/dsound/pa_win_ds.c b/src/hostapi/dsound/pa_win_ds.c
index 98afb5c..35fac5f 100644
--- a/src/hostapi/dsound/pa_win_ds.c
+++ b/src/hostapi/dsound/pa_win_ds.c
@@ -1,5 +1,5 @@
 /*
- * $Id: pa_win_ds.c 1877 2012-11-10 02:55:20Z rbencina $
+ * $Id$
  * Portable Audio I/O Library DirectSound implementation
  *
  * Authors: Phil Burk, Robert Marsanyi & Ross Bencina
@@ -208,9 +208,9 @@ static signed long GetStreamWriteAvailable( PaStream* stream );
     PaUtil_SetLastHostErrorInfo( paDirectSound, hr, "DirectSound error" )
 
 /************************************************* DX Prototypes **********/
-static BOOL CALLBACK CollectGUIDsProcA(LPGUID lpGUID,
-                                     LPCSTR lpszDesc,
-                                     LPCSTR lpszDrvName,
+static BOOL CALLBACK CollectGUIDsProcW(LPGUID lpGUID,
+                                     LPCWSTR lpszDesc,
+                                     LPCWSTR lpszDrvName,
                                      LPVOID lpContext );
 
 /************************************************************************************/
@@ -318,30 +318,43 @@ typedef struct PaWinDsStream
  */
 static double PaWinDS_GetMinSystemLatencySeconds( void )
 {
+/*
+NOTE: GetVersionEx() is deprecated as of Windows 8.1 and can not be used to reliably detect
+versions of Windows higher than Windows 8 (due to manifest requirements for reporting higher versions).
+Microsoft recommends switching to VerifyVersionInfo (available on Win 2k and later), however GetVersionEx
+is is faster, for now we just disable the deprecation warning.
+See: https://msdn.microsoft.com/en-us/library/windows/desktop/ms724451(v=vs.85).aspx
+See: http://www.codeproject.com/Articles/678606/Part-Overcoming-Windows-s-deprecation-of-GetVe
+*/
+#pragma warning (disable : 4996) /* use of GetVersionEx */
+
     double minLatencySeconds;
     /* Set minimal latency based on whether NT or other OS.
      * NT has higher latency.
      */
+
     OSVERSIONINFO osvi;
-	osvi.dwOSVersionInfoSize = sizeof( osvi );
-	GetVersionEx( &osvi );
+    osvi.dwOSVersionInfoSize = sizeof( osvi );
+    GetVersionEx( &osvi );
     DBUG(("PA - PlatformId = 0x%x\n", osvi.dwPlatformId ));
     DBUG(("PA - MajorVersion = 0x%x\n", osvi.dwMajorVersion ));
     DBUG(("PA - MinorVersion = 0x%x\n", osvi.dwMinorVersion ));
     /* Check for NT */
-	if( (osvi.dwMajorVersion == 4) && (osvi.dwPlatformId == 2) )
-	{
-		minLatencySeconds = PA_DS_WIN_NT_DEFAULT_LATENCY_;
-	}
-	else if(osvi.dwMajorVersion >= 5)
-	{
-		minLatencySeconds = PA_DS_WIN_WDM_DEFAULT_LATENCY_;
-	}
-	else
-	{
-		minLatencySeconds = PA_DS_WIN_9X_DEFAULT_LATENCY_;
-	}
+    if( (osvi.dwMajorVersion == 4) && (osvi.dwPlatformId == 2) )
+    {
+        minLatencySeconds = PA_DS_WIN_NT_DEFAULT_LATENCY_;
+    }
+    else if(osvi.dwMajorVersion >= 5)
+    {
+        minLatencySeconds = PA_DS_WIN_WDM_DEFAULT_LATENCY_;
+    }
+    else
+    {
+        minLatencySeconds = PA_DS_WIN_9X_DEFAULT_LATENCY_;
+    }
     return minLatencySeconds;
+
+#pragma warning (default : 4996)
 }
 
 
@@ -385,20 +398,35 @@ static double PaWinDs_GetMinLatencySeconds( double sampleRate )
 
 
 /************************************************************************************
-** Duplicate the input string using the allocations allocator.
+** Duplicate and convert the input string using the group allocations allocator.
 ** A NULL string is converted to a zero length string.
 ** If memory cannot be allocated, NULL is returned.
 **/
-static char *DuplicateDeviceNameString( PaUtilAllocationGroup *allocations, const char* src )
+static char *DuplicateDeviceNameString( PaUtilAllocationGroup *allocations, const wchar_t* src )
 {
     char *result = 0;
     
     if( src != NULL )
     {
-        size_t len = strlen(src);
+#if !defined(_UNICODE) && !defined(UNICODE)
+        size_t len = WideCharToMultiByte(CP_ACP, 0, src, -1, NULL, 0, NULL, NULL);
+
         result = (char*)PaUtil_GroupAllocateMemory( allocations, (long)(len + 1) );
-        if( result )
-            memcpy( (void *) result, src, len+1 );
+        if( result ) {
+            if (WideCharToMultiByte(CP_ACP, 0, src, -1, result, (int)len, NULL, NULL) == 0) {
+                result = 0;
+            }
+        }
+#else
+        size_t len = WideCharToMultiByte(CP_UTF8, 0, src, -1, NULL, 0, NULL, NULL);
+
+        result = (char*)PaUtil_GroupAllocateMemory( allocations, (long)(len + 1) );
+        if( result ) {
+            if (WideCharToMultiByte(CP_UTF8, 0, src, -1, result, (int)len, NULL, NULL) == 0) {
+                result = 0;
+            }
+        }
+#endif
     }
     else
     {
@@ -513,9 +541,9 @@ static PaError TerminateDSDeviceNameAndGUIDVector( DSDeviceNameAndGUIDVector *gu
 /************************************************************************************
 ** Collect preliminary device information during DirectSound enumeration 
 */
-static BOOL CALLBACK CollectGUIDsProcA(LPGUID lpGUID,
-                                     LPCSTR lpszDesc,
-                                     LPCSTR lpszDrvName,
+static BOOL CALLBACK CollectGUIDsProcW(LPGUID lpGUID,
+                                     LPCWSTR lpszDesc,
+                                     LPCWSTR lpszDrvName,
                                      LPVOID lpContext )
 {
     DSDeviceNameAndGUIDVector *namesAndGUIDs = (DSDeviceNameAndGUIDVector*)lpContext;
@@ -938,7 +966,7 @@ static PaError AddOutputDeviceInfoFromDirectSound(
                     }
                     else
                     {
-	                    deviceInfo->defaultSampleRate = caps.dwMaxSecondarySampleRate;
+                        deviceInfo->defaultSampleRate = caps.dwMaxSecondarySampleRate;
                     }
                 }
                 else if( (caps.dwMinSecondarySampleRate < 1000.0) && (caps.dwMaxSecondarySampleRate > 50000.0) )
@@ -1211,9 +1239,9 @@ PaError PaWinDs_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiInde
     if( result != paNoError )
         goto error;
 
-    paWinDsDSoundEntryPoints.DirectSoundCaptureEnumerateA( (LPDSENUMCALLBACKA)CollectGUIDsProcA, (void *)&deviceNamesAndGUIDs.inputNamesAndGUIDs );
+    paWinDsDSoundEntryPoints.DirectSoundCaptureEnumerateW( (LPDSENUMCALLBACKW)CollectGUIDsProcW, (void *)&deviceNamesAndGUIDs.inputNamesAndGUIDs );
 
-    paWinDsDSoundEntryPoints.DirectSoundEnumerateA( (LPDSENUMCALLBACKA)CollectGUIDsProcA, (void *)&deviceNamesAndGUIDs.outputNamesAndGUIDs );
+    paWinDsDSoundEntryPoints.DirectSoundEnumerateW( (LPDSENUMCALLBACKW)CollectGUIDsProcW, (void *)&deviceNamesAndGUIDs.outputNamesAndGUIDs );
 
     if( deviceNamesAndGUIDs.inputNamesAndGUIDs.enumerationError != paNoError )
     {
@@ -1347,13 +1375,13 @@ static PaError ValidateWinDirectSoundSpecificStreamInfo(
         const PaStreamParameters *streamParameters,
         const PaWinDirectSoundStreamInfo *streamInfo )
 {
-	if( streamInfo )
-	{
-	    if( streamInfo->size != sizeof( PaWinDirectSoundStreamInfo )
-	            || streamInfo->version != 2 )
-	    {
-	        return paIncompatibleHostApiSpecificStreamInfo;
-	    }
+    if( streamInfo )
+    {
+        if( streamInfo->size != sizeof( PaWinDirectSoundStreamInfo )
+                || streamInfo->version != 2 )
+        {
+            return paIncompatibleHostApiSpecificStreamInfo;
+        }
 
         if( streamInfo->flags & paWinDirectSoundUseLowLevelLatencyParameters )
         {
@@ -1361,9 +1389,9 @@ static PaError ValidateWinDirectSoundSpecificStreamInfo(
                 return paIncompatibleHostApiSpecificStreamInfo;
 
         }
-	}
+    }
 
-	return paNoError;
+    return paNoError;
 }
 
 /***********************************************************************************/
@@ -1400,8 +1428,8 @@ static PaError IsFormatSupported( struct PaUtilHostApiRepresentation *hostApi,
 
         /* validate inputStreamInfo */
         inputStreamInfo = (PaWinDirectSoundStreamInfo*)inputParameters->hostApiSpecificStreamInfo;
-		result = ValidateWinDirectSoundSpecificStreamInfo( inputParameters, inputStreamInfo );
-		if( result != paNoError ) return result;
+        result = ValidateWinDirectSoundSpecificStreamInfo( inputParameters, inputStreamInfo );
+        if( result != paNoError ) return result;
     }
     else
     {
@@ -1429,8 +1457,8 @@ static PaError IsFormatSupported( struct PaUtilHostApiRepresentation *hostApi,
 
         /* validate outputStreamInfo */
         outputStreamInfo = (PaWinDirectSoundStreamInfo*)outputParameters->hostApiSpecificStreamInfo;
-		result = ValidateWinDirectSoundSpecificStreamInfo( outputParameters, outputStreamInfo );
-		if( result != paNoError ) return result;
+        result = ValidateWinDirectSoundSpecificStreamInfo( outputParameters, outputStreamInfo );
+        if( result != paNoError ) return result;
     }
     else
     {
@@ -1887,8 +1915,8 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
             
         /* validate hostApiSpecificStreamInfo */
         inputStreamInfo = (PaWinDirectSoundStreamInfo*)inputParameters->hostApiSpecificStreamInfo;
-		result = ValidateWinDirectSoundSpecificStreamInfo( inputParameters, inputStreamInfo );
-		if( result != paNoError ) return result;
+        result = ValidateWinDirectSoundSpecificStreamInfo( inputParameters, inputStreamInfo );
+        if( result != paNoError ) return result;
 
         if( inputStreamInfo && inputStreamInfo->flags & paWinDirectSoundUseLowLevelLatencyParameters )
             userRequestedHostInputBufferSizeFrames = inputStreamInfo->framesPerBuffer;
@@ -1901,7 +1929,7 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
     else
     {
         inputChannelCount = 0;
-		inputSampleFormat = 0;
+        inputSampleFormat = 0;
         suggestedInputLatencyFrames = 0;
     }
 
@@ -1927,8 +1955,8 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
 
         /* validate hostApiSpecificStreamInfo */
         outputStreamInfo = (PaWinDirectSoundStreamInfo*)outputParameters->hostApiSpecificStreamInfo;
-		result = ValidateWinDirectSoundSpecificStreamInfo( outputParameters, outputStreamInfo );
-		if( result != paNoError ) return result;   
+        result = ValidateWinDirectSoundSpecificStreamInfo( outputParameters, outputStreamInfo );
+        if( result != paNoError ) return result;   
 
         if( outputStreamInfo && outputStreamInfo->flags & paWinDirectSoundUseLowLevelLatencyParameters )
             userRequestedHostOutputBufferSizeFrames = outputStreamInfo->framesPerBuffer;
@@ -1941,7 +1969,7 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
     else
     {
         outputChannelCount = 0;
-		outputSampleFormat = 0;
+        outputSampleFormat = 0;
         suggestedOutputLatencyFrames = 0;
     }
 
@@ -2022,10 +2050,10 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
         hostInputSampleFormat =
             PaUtil_SelectClosestAvailableFormat( nativeInputFormats, inputParameters->sampleFormat );
     }
-	else
-	{
-		hostInputSampleFormat = 0;
-	}
+    else
+    {
+        hostInputSampleFormat = 0;
+    }
 
     if( outputParameters )
     {
@@ -2037,9 +2065,9 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
             PaUtil_SelectClosestAvailableFormat( nativeOutputFormats, outputParameters->sampleFormat );
     }
     else
-	{
-		hostOutputSampleFormat = 0;
-	}
+    {
+        hostOutputSampleFormat = 0;
+    }
 
     result =  PaUtil_InitializeBufferProcessor( &stream->bufferProcessor,
                     inputChannelCount, inputSampleFormat, hostInputSampleFormat,
@@ -2082,7 +2110,7 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
 #endif
 
 #ifndef PA_WIN_DS_USE_WMME_TIMER
-		stream->processingThreadCompleted = CreateEvent( NULL, /* bManualReset = */ TRUE, /* bInitialState = */ FALSE, NULL );
+        stream->processingThreadCompleted = CreateEvent( NULL, /* bManualReset = */ TRUE, /* bInitialState = */ FALSE, NULL );
         if( stream->processingThreadCompleted == NULL )
         {
             result = paUnanticipatedHostError;
@@ -2482,8 +2510,8 @@ static int TimeSlice( PaWinDsStream *stream )
         framesToXfer = numOutFramesReady = bytesEmpty / stream->outputFrameSizeBytes;
 
         /* Check for underflow */
-		/* FIXME QueryOutputSpace should not adjust underflow count as a side effect. 
-			A query function should be a const operator on the stream and return a flag on underflow. */
+        /* FIXME QueryOutputSpace should not adjust underflow count as a side effect. 
+            A query function should be a const operator on the stream and return a flag on underflow. */
         if( stream->outputUnderflowCount != previousUnderflowCount )
             stream->callbackFlags |= paOutputUnderflow;
 
@@ -2548,8 +2576,8 @@ static int TimeSlice( PaWinDsStream *stream )
         if( stream->bufferProcessor.outputChannelCount > 0 )
         {
             /*
-			We don't currently add outputLatency here because it appears to produce worse
-			results than not adding it. Need to do more testing to verify this.
+            We don't currently add outputLatency here because it appears to produce worse
+            results than not adding it. Need to do more testing to verify this.
             */
             /* timeInfo.outputBufferDacTime = timeInfo.currentTime + outputLatency; */
             timeInfo.outputBufferDacTime = timeInfo.currentTime;
@@ -2798,7 +2826,7 @@ static PaError CloseStream( PaStream* s )
 #endif
 
 #ifndef PA_WIN_DS_USE_WMME_TIMER
-	CloseHandle( stream->processingThreadCompleted );
+    CloseHandle( stream->processingThreadCompleted );
 #endif
 
     // Cleanup the sound buffers
@@ -2896,7 +2924,7 @@ static PaError StartStream( PaStream *s )
     ResetEvent( stream->processingCompleted );
 
 #ifndef PA_WIN_DS_USE_WMME_TIMER
-	ResetEvent( stream->processingThreadCompleted );
+    ResetEvent( stream->processingThreadCompleted );
 #endif
 
     if( stream->bufferProcessor.inputChannelCount > 0 )
@@ -3006,9 +3034,9 @@ static PaError StartStream( PaStream *s )
             goto error;
         }
 #else
-		/* Create processing thread which calls TimerCallback */
+        /* Create processing thread which calls TimerCallback */
 
-		stream->processingThread = CREATE_THREAD( 0, 0, ProcessingThreadProc, stream, 0, &stream->processingThreadId );
+        stream->processingThread = CREATE_THREAD( 0, 0, ProcessingThreadProc, stream, 0, &stream->processingThreadId );
         if( !stream->processingThread )
         {
             result = paUnanticipatedHostError;
@@ -3078,8 +3106,8 @@ static PaError StopStream( PaStream *s )
 #else
     if( stream->processingThread )
     {
-		if( WaitForSingleObject( stream->processingThreadCompleted, 30*100 ) == WAIT_TIMEOUT )
-			return paUnanticipatedHostError;
+        if( WaitForSingleObject( stream->processingThreadCompleted, 30*100 ) == WAIT_TIMEOUT )
+            return paUnanticipatedHostError;
 
 #ifdef CLOSE_THREAD_HANDLE
         CloseHandle( stream->processingThread ); /* Delete thread. */
diff --git a/src/hostapi/jack/pa_jack.c b/src/hostapi/jack/pa_jack.c
index 2a5dd33..a800f8e 100644
--- a/src/hostapi/jack/pa_jack.c
+++ b/src/hostapi/jack/pa_jack.c
@@ -1,5 +1,5 @@
 /*
- * $Id: pa_jack.c 1912 2013-11-15 12:27:07Z gineera $
+ * $Id$
  * PortAudio Portable Real-Time Audio Library
  * Latest Version at: http://www.portaudio.com
  * JACK Implementation by Joshua Haberman
diff --git a/src/hostapi/oss/pa_unix_oss.c b/src/hostapi/oss/pa_unix_oss.c
index 96e8a4e..51e9630 100644
--- a/src/hostapi/oss/pa_unix_oss.c
+++ b/src/hostapi/oss/pa_unix_oss.c
@@ -1,5 +1,5 @@
 /*
- * $Id: pa_unix_oss.c 1894 2013-06-08 19:30:41Z gineera $
+ * $Id$
  * PortAudio Portable Real-Time Audio Library
  * Latest Version at: http://www.portaudio.com
  * OSS implementation by:
diff --git a/src/hostapi/skeleton/pa_hostapi_skeleton.c b/src/hostapi/skeleton/pa_hostapi_skeleton.c
index 24eb450..6edc22c 100644
--- a/src/hostapi/skeleton/pa_hostapi_skeleton.c
+++ b/src/hostapi/skeleton/pa_hostapi_skeleton.c
@@ -1,5 +1,5 @@
 /*
- * $Id: pa_hostapi_skeleton.c 1668 2011-05-02 17:07:11Z rossb $
+ * $Id$
  * Portable Audio I/O Library skeleton implementation
  * demonstrates how to use the common functions to implement support
  * for a host API
diff --git a/src/hostapi/wasapi/mingw-include/AudioSessionTypes.h b/src/hostapi/wasapi/mingw-include/AudioSessionTypes.h
deleted file mode 100644
index 100111a..0000000
--- a/src/hostapi/wasapi/mingw-include/AudioSessionTypes.h
+++ /dev/null
@@ -1,94 +0,0 @@
-//
-// AudioSessionTypes.h -- Copyright Microsoft Corporation, All Rights Reserved.
-//
-// Description: Type definitions used by the audio session manager RPC/COM interfaces
-//
-#pragma once
-
-#ifndef __AUDIOSESSIONTYPES__
-#define __AUDIOSESSIONTYPES__
-
-#if defined(__midl)
-#define MIDL_SIZE_IS(x) [size_is(x)]
-#define MIDL_STRING [string]
-#define MIDL_ANYSIZE_ARRAY
-#else   // !defined(__midl)
-#define MIDL_SIZE_IS(x)
-#define MIDL_STRING
-#define MIDL_ANYSIZE_ARRAY ANYSIZE_ARRAY
-#endif  // defined(__midl)
-
-//-------------------------------------------------------------------------
-// Description: AudioClient share mode
-//                                   
-//     AUDCLNT_SHAREMODE_SHARED -    The device will be opened in shared mode and use the 
-//                                   WAS format.
-//     AUDCLNT_SHAREMODE_EXCLUSIVE - The device will be opened in exclusive mode and use the 
-//                                   application specified format.
-//
-typedef enum _AUDCLNT_SHAREMODE
-{ 
-    AUDCLNT_SHAREMODE_SHARED, 
-    AUDCLNT_SHAREMODE_EXCLUSIVE 
-} AUDCLNT_SHAREMODE;
-
-//-------------------------------------------------------------------------
-// Description: AudioClient stream flags
-// 
-// Can be a combination of AUDCLNT_STREAMFLAGS and AUDCLNT_SYSFXFLAGS:
-// 
-// AUDCLNT_STREAMFLAGS (this group of flags uses the high word, w/exception of high-bit which is reserved, 0x7FFF0000):
-//                                  
-//     AUDCLNT_STREAMFLAGS_CROSSPROCESS - Audio policy control for this stream will be shared with 
-//                                        with other process sessions that use the same audio session 
-//                                        GUID.
-//     AUDCLNT_STREAMFLAGS_LOOPBACK -     Initializes a renderer endpoint for a loopback audio application. 
-//                                        In this mode, a capture stream will be opened on the specified 
-//                                        renderer endpoint. Shared mode and a renderer endpoint is required.
-//                                        Otherwise the IAudioClient::Initialize call will fail. If the 
-//                                        initialize is successful, a capture stream will be available 
-//                                        from the IAudioClient object.
-//
-//     AUDCLNT_STREAMFLAGS_EVENTCALLBACK - An exclusive mode client will supply an event handle that will be
-//                                         signaled when an IRP completes (or a waveRT buffer completes) telling
-//                                         it to fill the next buffer
-//
-//     AUDCLNT_STREAMFLAGS_NOPERSIST -    Session state will not be persisted
-//
-// AUDCLNT_SYSFXFLAGS (these flags use low word 0x0000FFFF):
-//
-//     none defined currently
-//
-#define AUDCLNT_STREAMFLAGS_CROSSPROCESS  0x00010000
-#define AUDCLNT_STREAMFLAGS_LOOPBACK      0x00020000
-#define AUDCLNT_STREAMFLAGS_EVENTCALLBACK 0x00040000
-#define AUDCLNT_STREAMFLAGS_NOPERSIST     0x00080000
-
-//-------------------------------------------------------------------------
-// Description: Device share mode - sharing mode for the audio device.
-//
-//      DeviceShared - The device can be shared with other processes.
-//      DeviceExclusive - The device will only be used by this process.
-//
-typedef enum _DeviceShareMode
-{ 
-    DeviceShared, 
-    DeviceExclusive 
-} DeviceShareMode;
-
-
-//-------------------------------------------------------------------------
-// Description: AudioSession State.
-//
-//      AudioSessionStateInactive - The session has no active audio streams.
-//      AudioSessionStateActive - The session has active audio streams.
-//      AudioSessionStateExpired - The session is dormant.
-typedef enum _AudioSessionState
-{
-    AudioSessionStateInactive = 0,
-    AudioSessionStateActive = 1,
-    AudioSessionStateExpired = 2
-} AudioSessionState;
-
-#endif
-
diff --git a/src/hostapi/wasapi/mingw-include/FunctionDiscoveryKeys_devpkey.h b/src/hostapi/wasapi/mingw-include/FunctionDiscoveryKeys_devpkey.h
deleted file mode 100644
index f015eae..0000000
--- a/src/hostapi/wasapi/mingw-include/FunctionDiscoveryKeys_devpkey.h
+++ /dev/null
@@ -1,186 +0,0 @@
-
-/*++
-
-Copyright (c) Microsoft Corporation.  All rights reserved.
-
-Module Name:
-
-    devpkey.h
-
-Abstract:
-
-    Defines property keys for the Plug and Play Device Property API.
-
-Author:
-
-    Jim Cavalaris (jamesca) 10-14-2003
-
-Environment:
-
-    User-mode only.
-
-Revision History:
-
-    14-October-2003     jamesca
-
-        Creation and initial implementation.
-
-    20-June-2006        dougb
-
-        Copied Jim's version replaced "DEFINE_DEVPROPKEY(DEVPKEY_" with "DEFINE_PROPERTYKEY(PKEY_"
-    
---*/
-
-//#include <devpropdef.h>
-
-//
-// _NAME
-//
-
-DEFINE_PROPERTYKEY(PKEY_NAME,                          0xb725f130, 0x47ef, 0x101a, 0xa5, 0xf1, 0x02, 0x60, 0x8c, 0x9e, 0xeb, 0xac, 10);    // DEVPROP_TYPE_STRING
-
-//
-// Device properties
-// These PKEYs correspond to the old setupapi SPDRP_XXX properties
-//
-DEFINE_PROPERTYKEY(PKEY_Device_DeviceDesc,             0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 2);     // DEVPROP_TYPE_STRING
-DEFINE_PROPERTYKEY(PKEY_Device_HardwareIds,            0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 3);     // DEVPROP_TYPE_STRING_LIST
-DEFINE_PROPERTYKEY(PKEY_Device_CompatibleIds,          0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 4);     // DEVPROP_TYPE_STRING_LIST
-DEFINE_PROPERTYKEY(PKEY_Device_Service,                0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 6);     // DEVPROP_TYPE_STRING
-DEFINE_PROPERTYKEY(PKEY_Device_Class,                  0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 9);     // DEVPROP_TYPE_STRING
-DEFINE_PROPERTYKEY(PKEY_Device_ClassGuid,              0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 10);    // DEVPROP_TYPE_GUID
-DEFINE_PROPERTYKEY(PKEY_Device_Driver,                 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 11);    // DEVPROP_TYPE_STRING
-DEFINE_PROPERTYKEY(PKEY_Device_ConfigFlags,            0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 12);    // DEVPROP_TYPE_UINT32
-DEFINE_PROPERTYKEY(PKEY_Device_Manufacturer,           0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 13);    // DEVPROP_TYPE_STRING
-DEFINE_PROPERTYKEY(PKEY_Device_FriendlyName,           0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 14);    // DEVPROP_TYPE_STRING
-DEFINE_PROPERTYKEY(PKEY_Device_LocationInfo,           0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 15);    // DEVPROP_TYPE_STRING
-DEFINE_PROPERTYKEY(PKEY_Device_PDOName,                0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 16);    // DEVPROP_TYPE_STRING
-DEFINE_PROPERTYKEY(PKEY_Device_Capabilities,           0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 17);    // DEVPROP_TYPE_UNINT32
-DEFINE_PROPERTYKEY(PKEY_Device_UINumber,               0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 18);    // DEVPROP_TYPE_STRING
-DEFINE_PROPERTYKEY(PKEY_Device_UpperFilters,           0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 19);    // DEVPROP_TYPE_STRING_LIST
-DEFINE_PROPERTYKEY(PKEY_Device_LowerFilters,           0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 20);    // DEVPROP_TYPE_STRING_LIST
-DEFINE_PROPERTYKEY(PKEY_Device_BusTypeGuid,            0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 21);    // DEVPROP_TYPE_GUID
-DEFINE_PROPERTYKEY(PKEY_Device_LegacyBusType,          0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 22);    // DEVPROP_TYPE_UINT32
-DEFINE_PROPERTYKEY(PKEY_Device_BusNumber,              0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 23);    // DEVPROP_TYPE_UINT32
-DEFINE_PROPERTYKEY(PKEY_Device_EnumeratorName,         0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 24);    // DEVPROP_TYPE_STRING
-DEFINE_PROPERTYKEY(PKEY_Device_Security,               0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 25);    // DEVPROP_TYPE_SECURITY_DESCRIPTOR
-DEFINE_PROPERTYKEY(PKEY_Device_SecuritySDS,            0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 26);    // DEVPROP_TYPE_SECURITY_DESCRIPTOR_STRING
-DEFINE_PROPERTYKEY(PKEY_Device_DevType,                0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 27);    // DEVPROP_TYPE_UINT32
-DEFINE_PROPERTYKEY(PKEY_Device_Exclusive,              0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 28);    // DEVPROP_TYPE_UINT32
-DEFINE_PROPERTYKEY(PKEY_Device_Characteristics,        0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 29);    // DEVPROP_TYPE_UINT32
-DEFINE_PROPERTYKEY(PKEY_Device_Address,                0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 30);    // DEVPROP_TYPE_UINT32
-DEFINE_PROPERTYKEY(PKEY_Device_UINumberDescFormat,     0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 31);    // DEVPROP_TYPE_STRING
-DEFINE_PROPERTYKEY(PKEY_Device_PowerData,              0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 32);    // DEVPROP_TYPE_BINARY
-DEFINE_PROPERTYKEY(PKEY_Device_RemovalPolicy,          0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 33);    // DEVPROP_TYPE_UINT32
-DEFINE_PROPERTYKEY(PKEY_Device_RemovalPolicyDefault,   0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 34);    // DEVPROP_TYPE_UINT32
-DEFINE_PROPERTYKEY(PKEY_Device_RemovalPolicyOverride,  0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 35);    // DEVPROP_TYPE_UINT32
-DEFINE_PROPERTYKEY(PKEY_Device_InstallState,           0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 36);    // DEVPROP_TYPE_UINT32
-DEFINE_PROPERTYKEY(PKEY_Device_LocationPaths,          0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 37);    // DEVPROP_TYPE_STRING_LIST
-
-//
-// Device properties
-// These PKEYs correspond to a device's status and problem code
-//
-DEFINE_PROPERTYKEY(PKEY_Device_DevNodeStatus,          0x4340a6c5, 0x93fa, 0x4706, 0x97, 0x2c, 0x7b, 0x64, 0x80, 0x08, 0xa5, 0xa7, 2);     // DEVPROP_TYPE_UINT32
-DEFINE_PROPERTYKEY(PKEY_Device_ProblemCode,            0x4340a6c5, 0x93fa, 0x4706, 0x97, 0x2c, 0x7b, 0x64, 0x80, 0x08, 0xa5, 0xa7, 3);     // DEVPROP_TYPE_UINT32
-
-//
-// Device properties
-// These PKEYs correspond to device relations
-//
-DEFINE_PROPERTYKEY(PKEY_Device_EjectionRelations,      0x4340a6c5, 0x93fa, 0x4706, 0x97, 0x2c, 0x7b, 0x64, 0x80, 0x08, 0xa5, 0xa7, 4);     // DEVPROP_TYPE_STRING_LIST
-DEFINE_PROPERTYKEY(PKEY_Device_RemovalRelations,       0x4340a6c5, 0x93fa, 0x4706, 0x97, 0x2c, 0x7b, 0x64, 0x80, 0x08, 0xa5, 0xa7, 5);     // DEVPROP_TYPE_STRING_LIST
-DEFINE_PROPERTYKEY(PKEY_Device_PowerRelations,         0x4340a6c5, 0x93fa, 0x4706, 0x97, 0x2c, 0x7b, 0x64, 0x80, 0x08, 0xa5, 0xa7, 6);     // DEVPROP_TYPE_STRING_LIST
-DEFINE_PROPERTYKEY(PKEY_Device_BusRelations,           0x4340a6c5, 0x93fa, 0x4706, 0x97, 0x2c, 0x7b, 0x64, 0x80, 0x08, 0xa5, 0xa7, 7);     // DEVPROP_TYPE_STRING_LIST
-DEFINE_PROPERTYKEY(PKEY_Device_Parent,                 0x4340a6c5, 0x93fa, 0x4706, 0x97, 0x2c, 0x7b, 0x64, 0x80, 0x08, 0xa5, 0xa7, 8);     // DEVPROP_TYPE_STRING
-DEFINE_PROPERTYKEY(PKEY_Device_Children,               0x4340a6c5, 0x93fa, 0x4706, 0x97, 0x2c, 0x7b, 0x64, 0x80, 0x08, 0xa5, 0xa7, 9);     // DEVPROP_TYPE_STRING_LIST
-DEFINE_PROPERTYKEY(PKEY_Device_Siblings,               0x4340a6c5, 0x93fa, 0x4706, 0x97, 0x2c, 0x7b, 0x64, 0x80, 0x08, 0xa5, 0xa7, 10);    // DEVPROP_TYPE_STRING_LIST
-
-//
-// Other Device properties
-//
-DEFINE_PROPERTYKEY(PKEY_Device_Reported,               0x80497100, 0x8c73, 0x48b9, 0xaa, 0xd9, 0xce, 0x38, 0x7e, 0x19, 0xc5, 0x6e, 2);     // DEVPROP_TYPE_BOOLEAN
-DEFINE_PROPERTYKEY(PKEY_Device_Legacy,                 0x80497100, 0x8c73, 0x48b9, 0xaa, 0xd9, 0xce, 0x38, 0x7e, 0x19, 0xc5, 0x6e, 3);     // DEVPROP_TYPE_BOOLEAN
-DEFINE_PROPERTYKEY(PKEY_Device_InstanceId,             0x78c34fc8, 0x104a, 0x4aca, 0x9e, 0xa4, 0x52, 0x4d, 0x52, 0x99, 0x6e, 0x57, 256);   // DEVPROP_TYPE_STRING
-DEFINE_PROPERTYKEY(PKEY_Numa_Proximity_Domain,         0x540b947e, 0x8b40, 0x45bc, 0xa8, 0xa2, 0x6a, 0x0b, 0x89, 0x4c, 0xbd, 0xa2, 1);     // DEVPROP_TYPE_UINT32
-
-//
-// Device driver properties
-//
-DEFINE_PROPERTYKEY(PKEY_Device_DriverDate,             0xa8b865dd, 0x2e3d, 0x4094, 0xad, 0x97, 0xe5, 0x93, 0xa7, 0xc, 0x75, 0xd6, 2);      // DEVPROP_TYPE_FILETIME
-DEFINE_PROPERTYKEY(PKEY_Device_DriverVersion,          0xa8b865dd, 0x2e3d, 0x4094, 0xad, 0x97, 0xe5, 0x93, 0xa7, 0xc, 0x75, 0xd6, 3);      // DEVPROP_TYPE_STRING
-DEFINE_PROPERTYKEY(PKEY_Device_DriverDesc,             0xa8b865dd, 0x2e3d, 0x4094, 0xad, 0x97, 0xe5, 0x93, 0xa7, 0xc, 0x75, 0xd6, 4);      // DEVPROP_TYPE_STRING
-DEFINE_PROPERTYKEY(PKEY_Device_DriverInfPath,          0xa8b865dd, 0x2e3d, 0x4094, 0xad, 0x97, 0xe5, 0x93, 0xa7, 0xc, 0x75, 0xd6, 5);      // DEVPROP_TYPE_STRING
-DEFINE_PROPERTYKEY(PKEY_Device_DriverInfSection,       0xa8b865dd, 0x2e3d, 0x4094, 0xad, 0x97, 0xe5, 0x93, 0xa7, 0xc, 0x75, 0xd6, 6);      // DEVPROP_TYPE_STRING
-DEFINE_PROPERTYKEY(PKEY_Device_DriverInfSectionExt,    0xa8b865dd, 0x2e3d, 0x4094, 0xad, 0x97, 0xe5, 0x93, 0xa7, 0xc, 0x75, 0xd6, 7);      // DEVPROP_TYPE_STRING
-DEFINE_PROPERTYKEY(PKEY_Device_MatchingDeviceId,       0xa8b865dd, 0x2e3d, 0x4094, 0xad, 0x97, 0xe5, 0x93, 0xa7, 0xc, 0x75, 0xd6, 8);      // DEVPROP_TYPE_STRING
-DEFINE_PROPERTYKEY(PKEY_Device_DriverProvider,         0xa8b865dd, 0x2e3d, 0x4094, 0xad, 0x97, 0xe5, 0x93, 0xa7, 0xc, 0x75, 0xd6, 9);      // DEVPROP_TYPE_STRING
-DEFINE_PROPERTYKEY(PKEY_Device_DriverPropPageProvider, 0xa8b865dd, 0x2e3d, 0x4094, 0xad, 0x97, 0xe5, 0x93, 0xa7, 0xc, 0x75, 0xd6, 10);     // DEVPROP_TYPE_STRING
-DEFINE_PROPERTYKEY(PKEY_Device_DriverCoInstallers,     0xa8b865dd, 0x2e3d, 0x4094, 0xad, 0x97, 0xe5, 0x93, 0xa7, 0xc, 0x75, 0xd6, 11);     // DEVPROP_TYPE_STRING_LIST
-DEFINE_PROPERTYKEY(PKEY_Device_ResourcePickerTags,     0xa8b865dd, 0x2e3d, 0x4094, 0xad, 0x97, 0xe5, 0x93, 0xa7, 0xc, 0x75, 0xd6, 12);     // DEVPROP_TYPE_STRING
-DEFINE_PROPERTYKEY(PKEY_Device_ResourcePickerExceptions, 0xa8b865dd, 0x2e3d, 0x4094, 0xad, 0x97, 0xe5, 0x93, 0xa7, 0xc, 0x75, 0xd6, 13); // DEVPROP_TYPE_STRING
-DEFINE_PROPERTYKEY(PKEY_Device_DriverRank,             0xa8b865dd, 0x2e3d, 0x4094, 0xad, 0x97, 0xe5, 0x93, 0xa7, 0xc, 0x75, 0xd6, 14);     // DEVPROP_TYPE_UINT32
-DEFINE_PROPERTYKEY(PKEY_Device_DriverLogoLevel,        0xa8b865dd, 0x2e3d, 0x4094, 0xad, 0x97, 0xe5, 0x93, 0xa7, 0xc, 0x75, 0xd6, 15);     // DEVPROP_TYPE_UINT32
-DEFINE_PROPERTYKEY(PKEY_Device_NoConnectSound,         0xa8b865dd, 0x2e3d, 0x4094, 0xad, 0x97, 0xe5, 0x93, 0xa7, 0xc, 0x75, 0xd6, 17);     // DEVPROP_TYPE_BOOLEAN
-DEFINE_PROPERTYKEY(PKEY_Device_GenericDriverInstalled, 0xa8b865dd, 0x2e3d, 0x4094, 0xad, 0x97, 0xe5, 0x93, 0xa7, 0xc, 0x75, 0xd6, 18);     // DEVPROP_TYPE_BOOLEAN
-
-
-//
-// Device properties that were set by the driver package that was installed
-// on the device.
-//
-DEFINE_PROPERTYKEY(PKEY_DrvPkg_Model,                  0xcf73bb51, 0x3abf, 0x44a2, 0x85, 0xe0, 0x9a, 0x3d, 0xc7, 0xa1, 0x21, 0x32, 2);     // DEVPROP_TYPE_STRING
-DEFINE_PROPERTYKEY(PKEY_DrvPkg_VendorWebSite,          0xcf73bb51, 0x3abf, 0x44a2, 0x85, 0xe0, 0x9a, 0x3d, 0xc7, 0xa1, 0x21, 0x32, 3);     // DEVPROP_TYPE_STRING
-DEFINE_PROPERTYKEY(PKEY_DrvPkg_DetailedDescription,    0xcf73bb51, 0x3abf, 0x44a2, 0x85, 0xe0, 0x9a, 0x3d, 0xc7, 0xa1, 0x21, 0x32, 4);     // DEVPROP_TYPE_STRING
-DEFINE_PROPERTYKEY(PKEY_DrvPkg_DocumentationLink,      0xcf73bb51, 0x3abf, 0x44a2, 0x85, 0xe0, 0x9a, 0x3d, 0xc7, 0xa1, 0x21, 0x32, 5);     // DEVPROP_TYPE_STRING
-DEFINE_PROPERTYKEY(PKEY_DrvPkg_Icon,                   0xcf73bb51, 0x3abf, 0x44a2, 0x85, 0xe0, 0x9a, 0x3d, 0xc7, 0xa1, 0x21, 0x32, 6);     // DEVPROP_TYPE_STRING_LIST
-DEFINE_PROPERTYKEY(PKEY_DrvPkg_BrandingIcon,           0xcf73bb51, 0x3abf, 0x44a2, 0x85, 0xe0, 0x9a, 0x3d, 0xc7, 0xa1, 0x21, 0x32, 7);     // DEVPROP_TYPE_STRING_LIST
-
-//
-// Device setup class properties
-// These PKEYs correspond to the old setupapi SPCRP_XXX properties
-//
-DEFINE_PROPERTYKEY(PKEY_DeviceClass_UpperFilters,      0x4321918b, 0xf69e, 0x470d, 0xa5, 0xde, 0x4d, 0x88, 0xc7, 0x5a, 0xd2, 0x4b, 19);    // DEVPROP_TYPE_STRING_LIST
-DEFINE_PROPERTYKEY(PKEY_DeviceClass_LowerFilters,      0x4321918b, 0xf69e, 0x470d, 0xa5, 0xde, 0x4d, 0x88, 0xc7, 0x5a, 0xd2, 0x4b, 20);    // DEVPROP_TYPE_STRING_LIST
-DEFINE_PROPERTYKEY(PKEY_DeviceClass_Security,          0x4321918b, 0xf69e, 0x470d, 0xa5, 0xde, 0x4d, 0x88, 0xc7, 0x5a, 0xd2, 0x4b, 25);    // DEVPROP_TYPE_SECURITY_DESCRIPTOR
-DEFINE_PROPERTYKEY(PKEY_DeviceClass_SecuritySDS,       0x4321918b, 0xf69e, 0x470d, 0xa5, 0xde, 0x4d, 0x88, 0xc7, 0x5a, 0xd2, 0x4b, 26);    // DEVPROP_TYPE_SECURITY_DESCRIPTOR_STRING
-DEFINE_PROPERTYKEY(PKEY_DeviceClass_DevType,           0x4321918b, 0xf69e, 0x470d, 0xa5, 0xde, 0x4d, 0x88, 0xc7, 0x5a, 0xd2, 0x4b, 27);    // DEVPROP_TYPE_UINT32
-DEFINE_PROPERTYKEY(PKEY_DeviceClass_Exclusive,         0x4321918b, 0xf69e, 0x470d, 0xa5, 0xde, 0x4d, 0x88, 0xc7, 0x5a, 0xd2, 0x4b, 28);    // DEVPROP_TYPE_UINT32
-DEFINE_PROPERTYKEY(PKEY_DeviceClass_Characteristics,   0x4321918b, 0xf69e, 0x470d, 0xa5, 0xde, 0x4d, 0x88, 0xc7, 0x5a, 0xd2, 0x4b, 29);    // DEVPROP_TYPE_UINT32
-
-//
-// Device setup class properties
-// These PKEYs correspond to registry values under the device class GUID key
-//
-DEFINE_PROPERTYKEY(PKEY_DeviceClass_Name,              0x259abffc, 0x50a7, 0x47ce, 0xaf, 0x8, 0x68, 0xc9, 0xa7, 0xd7, 0x33, 0x66, 2);  // DEVPROP_TYPE_STRING
-DEFINE_PROPERTYKEY(PKEY_DeviceClass_ClassName,         0x259abffc, 0x50a7, 0x47ce, 0xaf, 0x8, 0x68, 0xc9, 0xa7, 0xd7, 0x33, 0x66, 3);  // DEVPROP_TYPE_STRING
-DEFINE_PROPERTYKEY(PKEY_DeviceClass_Icon,              0x259abffc, 0x50a7, 0x47ce, 0xaf, 0x8, 0x68, 0xc9, 0xa7, 0xd7, 0x33, 0x66, 4);  // DEVPROP_TYPE_STRING
-DEFINE_PROPERTYKEY(PKEY_DeviceClass_ClassInstaller,    0x259abffc, 0x50a7, 0x47ce, 0xaf, 0x8, 0x68, 0xc9, 0xa7, 0xd7, 0x33, 0x66, 5);  // DEVPROP_TYPE_STRING
-DEFINE_PROPERTYKEY(PKEY_DeviceClass_PropPageProvider,  0x259abffc, 0x50a7, 0x47ce, 0xaf, 0x8, 0x68, 0xc9, 0xa7, 0xd7, 0x33, 0x66, 6);  // DEVPROP_TYPE_STRING
-DEFINE_PROPERTYKEY(PKEY_DeviceClass_NoInstallClass,    0x259abffc, 0x50a7, 0x47ce, 0xaf, 0x8, 0x68, 0xc9, 0xa7, 0xd7, 0x33, 0x66, 7);  // DEVPROP_TYPE_BOOLEAN
-DEFINE_PROPERTYKEY(PKEY_DeviceClass_NoDisplayClass,    0x259abffc, 0x50a7, 0x47ce, 0xaf, 0x8, 0x68, 0xc9, 0xa7, 0xd7, 0x33, 0x66, 8);  // DEVPROP_TYPE_BOOLEAN
-DEFINE_PROPERTYKEY(PKEY_DeviceClass_SilentInstall,     0x259abffc, 0x50a7, 0x47ce, 0xaf, 0x8, 0x68, 0xc9, 0xa7, 0xd7, 0x33, 0x66, 9);  // DEVPROP_TYPE_BOOLEAN
-DEFINE_PROPERTYKEY(PKEY_DeviceClass_NoUseClass,        0x259abffc, 0x50a7, 0x47ce, 0xaf, 0x8, 0x68, 0xc9, 0xa7, 0xd7, 0x33, 0x66, 10); // DEVPROP_TYPE_BOOLEAN
-DEFINE_PROPERTYKEY(PKEY_DeviceClass_DefaultService,    0x259abffc, 0x50a7, 0x47ce, 0xaf, 0x8, 0x68, 0xc9, 0xa7, 0xd7, 0x33, 0x66, 11); // DEVPROP_TYPE_STRING
-DEFINE_PROPERTYKEY(PKEY_DeviceClass_IconPath,          0x259abffc, 0x50a7, 0x47ce, 0xaf, 0x8, 0x68, 0xc9, 0xa7, 0xd7, 0x33, 0x66, 12); // DEVPROP_TYPE_STRING_LIST
-
-//
-// Other Device setup class properties
-//
-DEFINE_PROPERTYKEY(PKEY_DeviceClass_ClassCoInstallers, 0x713d1703, 0xa2e2, 0x49f5, 0x92, 0x14, 0x56, 0x47, 0x2e, 0xf3, 0xda, 0x5c, 2); // DEVPROP_TYPE_STRING_LIST
-
-//
-// Device interface properties
-//
-DEFINE_PROPERTYKEY(PKEY_DeviceInterface_FriendlyName,  0x026e516e, 0xb814, 0x414b, 0x83, 0xcd, 0x85, 0x6d, 0x6f, 0xef, 0x48, 0x22, 2); // DEVPROP_TYPE_STRING
-DEFINE_PROPERTYKEY(PKEY_DeviceInterface_Enabled,       0x026e516e, 0xb814, 0x414b, 0x83, 0xcd, 0x85, 0x6d, 0x6f, 0xef, 0x48, 0x22, 3); // DEVPROP_TYPE_BOOLEAN
-DEFINE_PROPERTYKEY(PKEY_DeviceInterface_ClassGuid,     0x026e516e, 0xb814, 0x414b, 0x83, 0xcd, 0x85, 0x6d, 0x6f, 0xef, 0x48, 0x22, 4); // DEVPROP_TYPE_GUID
-
-//
-// Device interface class properties
-//
-DEFINE_PROPERTYKEY(PKEY_DeviceInterfaceClass_DefaultInterface,  0x14c83a99, 0x0b3f, 0x44b7, 0xbe, 0x4c, 0xa1, 0x78, 0xd3, 0x99, 0x05, 0x64, 2); // DEVPROP_TYPE_STRING
-
-
-
-
diff --git a/src/hostapi/wasapi/mingw-include/audioclient.h b/src/hostapi/wasapi/mingw-include/audioclient.h
index 3328c9d..bf77baf 100644
--- a/src/hostapi/wasapi/mingw-include/audioclient.h
+++ b/src/hostapi/wasapi/mingw-include/audioclient.h
@@ -1,1177 +1,1177 @@
-
-
-/* this ALWAYS GENERATED file contains the definitions for the interfaces */
-
-
- /* File created by MIDL compiler version 7.00.0499 */
-/* Compiler settings for audioclient.idl:
-    Oicf, W1, Zp8, env=Win32 (32b run)
-    protocol : dce , ms_ext, c_ext, robust
-    error checks: allocation ref bounds_check enum stub_data 
-    VC __declspec() decoration level: 
-         __declspec(uuid()), __declspec(selectany), __declspec(novtable)
-         DECLSPEC_UUID(), MIDL_INTERFACE()
-*/
-//@@MIDL_FILE_HEADING(  )
-
-#pragma warning( disable: 4049 )  /* more than 64k source lines */
-
-
-/* verify that the <rpcndr.h> version is high enough to compile this file*/
-#ifndef __REQUIRED_RPCNDR_H_VERSION__
-#define __REQUIRED_RPCNDR_H_VERSION__ 500
-#endif
-
-/* verify that the <rpcsal.h> version is high enough to compile this file*/
-#ifndef __REQUIRED_RPCSAL_H_VERSION__
-#define __REQUIRED_RPCSAL_H_VERSION__ 100
-#endif
-
-#include "rpc.h"
-#include "rpcndr.h"
-
-#ifndef __RPCNDR_H_VERSION__
-#error this stub requires an updated version of <rpcndr.h>
-#endif // __RPCNDR_H_VERSION__
-
-#ifndef COM_NO_WINDOWS_H
-#include "windows.h"
-#include "ole2.h"
-#endif /*COM_NO_WINDOWS_H*/
-
-#ifndef __audioclient_h__
-#define __audioclient_h__
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-#pragma once
-#endif
-
-/* Forward Declarations */ 
-
-#ifndef __IAudioClient_FWD_DEFINED__
-#define __IAudioClient_FWD_DEFINED__
-typedef interface IAudioClient IAudioClient;
-#endif 	/* __IAudioClient_FWD_DEFINED__ */
-
-
-#ifndef __IAudioRenderClient_FWD_DEFINED__
-#define __IAudioRenderClient_FWD_DEFINED__
-typedef interface IAudioRenderClient IAudioRenderClient;
-#endif 	/* __IAudioRenderClient_FWD_DEFINED__ */
-
-
-#ifndef __IAudioCaptureClient_FWD_DEFINED__
-#define __IAudioCaptureClient_FWD_DEFINED__
-typedef interface IAudioCaptureClient IAudioCaptureClient;
-#endif 	/* __IAudioCaptureClient_FWD_DEFINED__ */
-
-
-#ifndef __IAudioClock_FWD_DEFINED__
-#define __IAudioClock_FWD_DEFINED__
-typedef interface IAudioClock IAudioClock;
-#endif 	/* __IAudioClock_FWD_DEFINED__ */
-
-
-#ifndef __ISimpleAudioVolume_FWD_DEFINED__
-#define __ISimpleAudioVolume_FWD_DEFINED__
-typedef interface ISimpleAudioVolume ISimpleAudioVolume;
-#endif 	/* __ISimpleAudioVolume_FWD_DEFINED__ */
-
-
-#ifndef __IAudioStreamVolume_FWD_DEFINED__
-#define __IAudioStreamVolume_FWD_DEFINED__
-typedef interface IAudioStreamVolume IAudioStreamVolume;
-#endif 	/* __IAudioStreamVolume_FWD_DEFINED__ */
-
-
-#ifndef __IChannelAudioVolume_FWD_DEFINED__
-#define __IChannelAudioVolume_FWD_DEFINED__
-typedef interface IChannelAudioVolume IChannelAudioVolume;
-#endif 	/* __IChannelAudioVolume_FWD_DEFINED__ */
-
-
-/* header files for imported files */
-#include "wtypes.h"
-#include "unknwn.h"
-#include "AudioSessionTypes.h"
-
-#ifdef __cplusplus
-extern "C"{
-#endif 
-
-
-/* interface __MIDL_itf_audioclient_0000_0000 */
-/* [local] */ 
-
-#if 0
-typedef /* [hidden][restricted] */ struct WAVEFORMATEX
-    {
-    WORD wFormatTag;
-    WORD nChannels;
-    DWORD nSamplesPerSec;
-    DWORD nAvgBytesPerSec;
-    WORD nBlockAlign;
-    WORD wBitsPerSample;
-    WORD cbSize;
-    } 	WAVEFORMATEX;
-
-#else
-#include <mmreg.h>
-#endif
-#if 0
-typedef /* [hidden][restricted] */ LONGLONG REFERENCE_TIME;
-
-#else
-#define _IKsControl_
-#include <ks.h>
-#include <ksmedia.h>
-#endif
-
-enum _AUDCLNT_BUFFERFLAGS
-    {	AUDCLNT_BUFFERFLAGS_DATA_DISCONTINUITY	= 0x1,
-	AUDCLNT_BUFFERFLAGS_SILENT	= 0x2,
-	AUDCLNT_BUFFERFLAGS_TIMESTAMP_ERROR	= 0x4
-    } ;
-
-
-extern RPC_IF_HANDLE __MIDL_itf_audioclient_0000_0000_v0_0_c_ifspec;
-extern RPC_IF_HANDLE __MIDL_itf_audioclient_0000_0000_v0_0_s_ifspec;
-
-#ifndef __IAudioClient_INTERFACE_DEFINED__
-#define __IAudioClient_INTERFACE_DEFINED__
-
-/* interface IAudioClient */
-/* [local][unique][uuid][object] */ 
-
-
-EXTERN_C const IID IID_IAudioClient;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("1CB9AD4C-DBFA-4c32-B178-C2F568A703B2")
-    IAudioClient : public IUnknown
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE Initialize( 
-            /* [in] */ 
-            __in  AUDCLNT_SHAREMODE ShareMode,
-            /* [in] */ 
-            __in  DWORD StreamFlags,
-            /* [in] */ 
-            __in  REFERENCE_TIME hnsBufferDuration,
-            /* [in] */ 
-            __in  REFERENCE_TIME hnsPeriodicity,
-            /* [in] */ 
-            __in  const WAVEFORMATEX *pFormat,
-            /* [in] */ 
-            __in_opt  LPCGUID AudioSessionGuid) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetBufferSize( 
-            /* [out] */ 
-            __out  UINT32 *pNumBufferFrames) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetStreamLatency( 
-            /* [out] */ 
-            __out  REFERENCE_TIME *phnsLatency) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetCurrentPadding( 
-            /* [out] */ 
-            __out  UINT32 *pNumPaddingFrames) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE IsFormatSupported( 
-            /* [in] */ 
-            __in  AUDCLNT_SHAREMODE ShareMode,
-            /* [in] */ 
-            __in  const WAVEFORMATEX *pFormat,
-            /* [unique][out] */ 
-            __out_opt  WAVEFORMATEX **ppClosestMatch) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetMixFormat( 
-            /* [out] */ 
-            __out  WAVEFORMATEX **ppDeviceFormat) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetDevicePeriod( 
-            /* [out] */ 
-            __out_opt  REFERENCE_TIME *phnsDefaultDevicePeriod,
-            /* [out] */ 
-            __out_opt  REFERENCE_TIME *phnsMinimumDevicePeriod) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE Start( void) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE Stop( void) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE Reset( void) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE SetEventHandle( 
-            /* [in] */ HANDLE eventHandle) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetService( 
-            /* [in] */ 
-            __in  REFIID riid,
-            /* [iid_is][out] */ 
-            __out  void **ppv) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IAudioClientVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IAudioClient * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IAudioClient * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IAudioClient * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *Initialize )( 
-            IAudioClient * This,
-            /* [in] */ 
-            __in  AUDCLNT_SHAREMODE ShareMode,
-            /* [in] */ 
-            __in  DWORD StreamFlags,
-            /* [in] */ 
-            __in  REFERENCE_TIME hnsBufferDuration,
-            /* [in] */ 
-            __in  REFERENCE_TIME hnsPeriodicity,
-            /* [in] */ 
-            __in  const WAVEFORMATEX *pFormat,
-            /* [in] */ 
-            __in_opt  LPCGUID AudioSessionGuid);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetBufferSize )( 
-            IAudioClient * This,
-            /* [out] */ 
-            __out  UINT32 *pNumBufferFrames);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetStreamLatency )( 
-            IAudioClient * This,
-            /* [out] */ 
-            __out  REFERENCE_TIME *phnsLatency);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetCurrentPadding )( 
-            IAudioClient * This,
-            /* [out] */ 
-            __out  UINT32 *pNumPaddingFrames);
-        
-        HRESULT ( STDMETHODCALLTYPE *IsFormatSupported )( 
-            IAudioClient * This,
-            /* [in] */ 
-            __in  AUDCLNT_SHAREMODE ShareMode,
-            /* [in] */ 
-            __in  const WAVEFORMATEX *pFormat,
-            /* [unique][out] */ 
-            __out_opt  WAVEFORMATEX **ppClosestMatch);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetMixFormat )( 
-            IAudioClient * This,
-            /* [out] */ 
-            __out  WAVEFORMATEX **ppDeviceFormat);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetDevicePeriod )( 
-            IAudioClient * This,
-            /* [out] */ 
-            __out_opt  REFERENCE_TIME *phnsDefaultDevicePeriod,
-            /* [out] */ 
-            __out_opt  REFERENCE_TIME *phnsMinimumDevicePeriod);
-        
-        HRESULT ( STDMETHODCALLTYPE *Start )( 
-            IAudioClient * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *Stop )( 
-            IAudioClient * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *Reset )( 
-            IAudioClient * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *SetEventHandle )( 
-            IAudioClient * This,
-            /* [in] */ HANDLE eventHandle);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetService )( 
-            IAudioClient * This,
-            /* [in] */ 
-            __in  REFIID riid,
-            /* [iid_is][out] */ 
-            __out  void **ppv);
-        
-        END_INTERFACE
-    } IAudioClientVtbl;
-
-    interface IAudioClient
-    {
-        CONST_VTBL struct IAudioClientVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IAudioClient_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IAudioClient_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IAudioClient_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IAudioClient_Initialize(This,ShareMode,StreamFlags,hnsBufferDuration,hnsPeriodicity,pFormat,AudioSessionGuid)	\
-    ( (This)->lpVtbl -> Initialize(This,ShareMode,StreamFlags,hnsBufferDuration,hnsPeriodicity,pFormat,AudioSessionGuid) ) 
-
-#define IAudioClient_GetBufferSize(This,pNumBufferFrames)	\
-    ( (This)->lpVtbl -> GetBufferSize(This,pNumBufferFrames) ) 
-
-#define IAudioClient_GetStreamLatency(This,phnsLatency)	\
-    ( (This)->lpVtbl -> GetStreamLatency(This,phnsLatency) ) 
-
-#define IAudioClient_GetCurrentPadding(This,pNumPaddingFrames)	\
-    ( (This)->lpVtbl -> GetCurrentPadding(This,pNumPaddingFrames) ) 
-
-#define IAudioClient_IsFormatSupported(This,ShareMode,pFormat,ppClosestMatch)	\
-    ( (This)->lpVtbl -> IsFormatSupported(This,ShareMode,pFormat,ppClosestMatch) ) 
-
-#define IAudioClient_GetMixFormat(This,ppDeviceFormat)	\
-    ( (This)->lpVtbl -> GetMixFormat(This,ppDeviceFormat) ) 
-
-#define IAudioClient_GetDevicePeriod(This,phnsDefaultDevicePeriod,phnsMinimumDevicePeriod)	\
-    ( (This)->lpVtbl -> GetDevicePeriod(This,phnsDefaultDevicePeriod,phnsMinimumDevicePeriod) ) 
-
-#define IAudioClient_Start(This)	\
-    ( (This)->lpVtbl -> Start(This) ) 
-
-#define IAudioClient_Stop(This)	\
-    ( (This)->lpVtbl -> Stop(This) ) 
-
-#define IAudioClient_Reset(This)	\
-    ( (This)->lpVtbl -> Reset(This) ) 
-
-#define IAudioClient_SetEventHandle(This,eventHandle)	\
-    ( (This)->lpVtbl -> SetEventHandle(This,eventHandle) ) 
-
-#define IAudioClient_GetService(This,riid,ppv)	\
-    ( (This)->lpVtbl -> GetService(This,riid,ppv) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IAudioClient_INTERFACE_DEFINED__ */
-
-
-#ifndef __IAudioRenderClient_INTERFACE_DEFINED__
-#define __IAudioRenderClient_INTERFACE_DEFINED__
-
-/* interface IAudioRenderClient */
-/* [local][unique][helpstring][uuid][object] */ 
-
-
-EXTERN_C const IID IID_IAudioRenderClient;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("F294ACFC-3146-4483-A7BF-ADDCA7C260E2")
-    IAudioRenderClient : public IUnknown
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE GetBuffer( 
-            /* [in] */ 
-            __in  UINT32 NumFramesRequested,
-            /* [out] */ 
-            __out  BYTE **ppData) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE ReleaseBuffer( 
-            /* [in] */ 
-            __in  UINT32 NumFramesWritten,
-            /* [in] */ 
-            __in  DWORD dwFlags) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IAudioRenderClientVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IAudioRenderClient * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IAudioRenderClient * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IAudioRenderClient * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetBuffer )( 
-            IAudioRenderClient * This,
-            /* [in] */ 
-            __in  UINT32 NumFramesRequested,
-            /* [out] */ 
-            __out  BYTE **ppData);
-        
-        HRESULT ( STDMETHODCALLTYPE *ReleaseBuffer )( 
-            IAudioRenderClient * This,
-            /* [in] */ 
-            __in  UINT32 NumFramesWritten,
-            /* [in] */ 
-            __in  DWORD dwFlags);
-        
-        END_INTERFACE
-    } IAudioRenderClientVtbl;
-
-    interface IAudioRenderClient
-    {
-        CONST_VTBL struct IAudioRenderClientVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IAudioRenderClient_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IAudioRenderClient_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IAudioRenderClient_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IAudioRenderClient_GetBuffer(This,NumFramesRequested,ppData)	\
-    ( (This)->lpVtbl -> GetBuffer(This,NumFramesRequested,ppData) ) 
-
-#define IAudioRenderClient_ReleaseBuffer(This,NumFramesWritten,dwFlags)	\
-    ( (This)->lpVtbl -> ReleaseBuffer(This,NumFramesWritten,dwFlags) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IAudioRenderClient_INTERFACE_DEFINED__ */
-
-
-#ifndef __IAudioCaptureClient_INTERFACE_DEFINED__
-#define __IAudioCaptureClient_INTERFACE_DEFINED__
-
-/* interface IAudioCaptureClient */
-/* [local][unique][helpstring][uuid][object] */ 
-
-
-EXTERN_C const IID IID_IAudioCaptureClient;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("C8ADBD64-E71E-48a0-A4DE-185C395CD317")
-    IAudioCaptureClient : public IUnknown
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE GetBuffer( 
-            /* [out] */ 
-            __out  BYTE **ppData,
-            /* [out] */ 
-            __out  UINT32 *pNumFramesToRead,
-            /* [out] */ 
-            __out  DWORD *pdwFlags,
-            /* [unique][out] */ 
-            __out_opt  UINT64 *pu64DevicePosition,
-            /* [unique][out] */ 
-            __out_opt  UINT64 *pu64QPCPosition) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE ReleaseBuffer( 
-            /* [in] */ 
-            __in  UINT32 NumFramesRead) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetNextPacketSize( 
-            /* [out] */ 
-            __out  UINT32 *pNumFramesInNextPacket) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IAudioCaptureClientVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IAudioCaptureClient * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IAudioCaptureClient * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IAudioCaptureClient * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetBuffer )( 
-            IAudioCaptureClient * This,
-            /* [out] */ 
-            __out  BYTE **ppData,
-            /* [out] */ 
-            __out  UINT32 *pNumFramesToRead,
-            /* [out] */ 
-            __out  DWORD *pdwFlags,
-            /* [unique][out] */ 
-            __out_opt  UINT64 *pu64DevicePosition,
-            /* [unique][out] */ 
-            __out_opt  UINT64 *pu64QPCPosition);
-        
-        HRESULT ( STDMETHODCALLTYPE *ReleaseBuffer )( 
-            IAudioCaptureClient * This,
-            /* [in] */ 
-            __in  UINT32 NumFramesRead);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetNextPacketSize )( 
-            IAudioCaptureClient * This,
-            /* [out] */ 
-            __out  UINT32 *pNumFramesInNextPacket);
-        
-        END_INTERFACE
-    } IAudioCaptureClientVtbl;
-
-    interface IAudioCaptureClient
-    {
-        CONST_VTBL struct IAudioCaptureClientVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IAudioCaptureClient_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IAudioCaptureClient_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IAudioCaptureClient_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IAudioCaptureClient_GetBuffer(This,ppData,pNumFramesToRead,pdwFlags,pu64DevicePosition,pu64QPCPosition)	\
-    ( (This)->lpVtbl -> GetBuffer(This,ppData,pNumFramesToRead,pdwFlags,pu64DevicePosition,pu64QPCPosition) ) 
-
-#define IAudioCaptureClient_ReleaseBuffer(This,NumFramesRead)	\
-    ( (This)->lpVtbl -> ReleaseBuffer(This,NumFramesRead) ) 
-
-#define IAudioCaptureClient_GetNextPacketSize(This,pNumFramesInNextPacket)	\
-    ( (This)->lpVtbl -> GetNextPacketSize(This,pNumFramesInNextPacket) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IAudioCaptureClient_INTERFACE_DEFINED__ */
-
-
-/* interface __MIDL_itf_audioclient_0000_0003 */
-/* [local] */ 
-
-#define AUDIOCLOCK_CHARACTERISTIC_FIXED_FREQ  0x00000001
-
-
-extern RPC_IF_HANDLE __MIDL_itf_audioclient_0000_0003_v0_0_c_ifspec;
-extern RPC_IF_HANDLE __MIDL_itf_audioclient_0000_0003_v0_0_s_ifspec;
-
-#ifndef __IAudioClock_INTERFACE_DEFINED__
-#define __IAudioClock_INTERFACE_DEFINED__
-
-/* interface IAudioClock */
-/* [local][unique][uuid][object] */ 
-
-
-EXTERN_C const IID IID_IAudioClock;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("CD63314F-3FBA-4a1b-812C-EF96358728E7")
-    IAudioClock : public IUnknown
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE GetFrequency( 
-            /* [out] */ 
-            __out  UINT64 *pu64Frequency) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetPosition( 
-            /* [out] */ 
-            __out  UINT64 *pu64Position,
-            /* [unique][out] */ 
-            __out_opt  UINT64 *pu64QPCPosition) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetCharacteristics( 
-            /* [out] */ 
-            __out  DWORD *pdwCharacteristics) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IAudioClockVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IAudioClock * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IAudioClock * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IAudioClock * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetFrequency )( 
-            IAudioClock * This,
-            /* [out] */ 
-            __out  UINT64 *pu64Frequency);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetPosition )( 
-            IAudioClock * This,
-            /* [out] */ 
-            __out  UINT64 *pu64Position,
-            /* [unique][out] */ 
-            __out_opt  UINT64 *pu64QPCPosition);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetCharacteristics )( 
-            IAudioClock * This,
-            /* [out] */ 
-            __out  DWORD *pdwCharacteristics);
-        
-        END_INTERFACE
-    } IAudioClockVtbl;
-
-    interface IAudioClock
-    {
-        CONST_VTBL struct IAudioClockVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IAudioClock_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IAudioClock_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IAudioClock_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IAudioClock_GetFrequency(This,pu64Frequency)	\
-    ( (This)->lpVtbl -> GetFrequency(This,pu64Frequency) ) 
-
-#define IAudioClock_GetPosition(This,pu64Position,pu64QPCPosition)	\
-    ( (This)->lpVtbl -> GetPosition(This,pu64Position,pu64QPCPosition) ) 
-
-#define IAudioClock_GetCharacteristics(This,pdwCharacteristics)	\
-    ( (This)->lpVtbl -> GetCharacteristics(This,pdwCharacteristics) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IAudioClock_INTERFACE_DEFINED__ */
-
-
-#ifndef __ISimpleAudioVolume_INTERFACE_DEFINED__
-#define __ISimpleAudioVolume_INTERFACE_DEFINED__
-
-/* interface ISimpleAudioVolume */
-/* [local][unique][uuid][object] */ 
-
-
-EXTERN_C const IID IID_ISimpleAudioVolume;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("87CE5498-68D6-44E5-9215-6DA47EF883D8")
-    ISimpleAudioVolume : public IUnknown
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE SetMasterVolume( 
-            /* [in] */ 
-            __in  float fLevel,
-            /* [unique][in] */ LPCGUID EventContext) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetMasterVolume( 
-            /* [out] */ 
-            __out  float *pfLevel) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE SetMute( 
-            /* [in] */ 
-            __in  const BOOL bMute,
-            /* [unique][in] */ LPCGUID EventContext) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetMute( 
-            /* [out] */ 
-            __out  BOOL *pbMute) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct ISimpleAudioVolumeVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            ISimpleAudioVolume * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            ISimpleAudioVolume * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            ISimpleAudioVolume * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *SetMasterVolume )( 
-            ISimpleAudioVolume * This,
-            /* [in] */ 
-            __in  float fLevel,
-            /* [unique][in] */ LPCGUID EventContext);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetMasterVolume )( 
-            ISimpleAudioVolume * This,
-            /* [out] */ 
-            __out  float *pfLevel);
-        
-        HRESULT ( STDMETHODCALLTYPE *SetMute )( 
-            ISimpleAudioVolume * This,
-            /* [in] */ 
-            __in  const BOOL bMute,
-            /* [unique][in] */ LPCGUID EventContext);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetMute )( 
-            ISimpleAudioVolume * This,
-            /* [out] */ 
-            __out  BOOL *pbMute);
-        
-        END_INTERFACE
-    } ISimpleAudioVolumeVtbl;
-
-    interface ISimpleAudioVolume
-    {
-        CONST_VTBL struct ISimpleAudioVolumeVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define ISimpleAudioVolume_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define ISimpleAudioVolume_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define ISimpleAudioVolume_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define ISimpleAudioVolume_SetMasterVolume(This,fLevel,EventContext)	\
-    ( (This)->lpVtbl -> SetMasterVolume(This,fLevel,EventContext) ) 
-
-#define ISimpleAudioVolume_GetMasterVolume(This,pfLevel)	\
-    ( (This)->lpVtbl -> GetMasterVolume(This,pfLevel) ) 
-
-#define ISimpleAudioVolume_SetMute(This,bMute,EventContext)	\
-    ( (This)->lpVtbl -> SetMute(This,bMute,EventContext) ) 
-
-#define ISimpleAudioVolume_GetMute(This,pbMute)	\
-    ( (This)->lpVtbl -> GetMute(This,pbMute) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __ISimpleAudioVolume_INTERFACE_DEFINED__ */
-
-
-#ifndef __IAudioStreamVolume_INTERFACE_DEFINED__
-#define __IAudioStreamVolume_INTERFACE_DEFINED__
-
-/* interface IAudioStreamVolume */
-/* [local][unique][uuid][object] */ 
-
-
-EXTERN_C const IID IID_IAudioStreamVolume;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("93014887-242D-4068-8A15-CF5E93B90FE3")
-    IAudioStreamVolume : public IUnknown
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE GetChannelCount( 
-            /* [out] */ 
-            __out  UINT32 *pdwCount) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE SetChannelVolume( 
-            /* [in] */ 
-            __in  UINT32 dwIndex,
-            /* [in] */ 
-            __in  const float fLevel) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetChannelVolume( 
-            /* [in] */ 
-            __in  UINT32 dwIndex,
-            /* [out] */ 
-            __out  float *pfLevel) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE SetAllVolumes( 
-            /* [in] */ 
-            __in  UINT32 dwCount,
-            /* [size_is][in] */ 
-            __in_ecount(dwCount)  const float *pfVolumes) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetAllVolumes( 
-            /* [in] */ 
-            __in  UINT32 dwCount,
-            /* [size_is][out] */ 
-            __out_ecount(dwCount)  float *pfVolumes) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IAudioStreamVolumeVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IAudioStreamVolume * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IAudioStreamVolume * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IAudioStreamVolume * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetChannelCount )( 
-            IAudioStreamVolume * This,
-            /* [out] */ 
-            __out  UINT32 *pdwCount);
-        
-        HRESULT ( STDMETHODCALLTYPE *SetChannelVolume )( 
-            IAudioStreamVolume * This,
-            /* [in] */ 
-            __in  UINT32 dwIndex,
-            /* [in] */ 
-            __in  const float fLevel);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetChannelVolume )( 
-            IAudioStreamVolume * This,
-            /* [in] */ 
-            __in  UINT32 dwIndex,
-            /* [out] */ 
-            __out  float *pfLevel);
-        
-        HRESULT ( STDMETHODCALLTYPE *SetAllVolumes )( 
-            IAudioStreamVolume * This,
-            /* [in] */ 
-            __in  UINT32 dwCount,
-            /* [size_is][in] */ 
-            __in_ecount(dwCount)  const float *pfVolumes);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetAllVolumes )( 
-            IAudioStreamVolume * This,
-            /* [in] */ 
-            __in  UINT32 dwCount,
-            /* [size_is][out] */ 
-            __out_ecount(dwCount)  float *pfVolumes);
-        
-        END_INTERFACE
-    } IAudioStreamVolumeVtbl;
-
-    interface IAudioStreamVolume
-    {
-        CONST_VTBL struct IAudioStreamVolumeVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IAudioStreamVolume_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IAudioStreamVolume_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IAudioStreamVolume_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IAudioStreamVolume_GetChannelCount(This,pdwCount)	\
-    ( (This)->lpVtbl -> GetChannelCount(This,pdwCount) ) 
-
-#define IAudioStreamVolume_SetChannelVolume(This,dwIndex,fLevel)	\
-    ( (This)->lpVtbl -> SetChannelVolume(This,dwIndex,fLevel) ) 
-
-#define IAudioStreamVolume_GetChannelVolume(This,dwIndex,pfLevel)	\
-    ( (This)->lpVtbl -> GetChannelVolume(This,dwIndex,pfLevel) ) 
-
-#define IAudioStreamVolume_SetAllVolumes(This,dwCount,pfVolumes)	\
-    ( (This)->lpVtbl -> SetAllVolumes(This,dwCount,pfVolumes) ) 
-
-#define IAudioStreamVolume_GetAllVolumes(This,dwCount,pfVolumes)	\
-    ( (This)->lpVtbl -> GetAllVolumes(This,dwCount,pfVolumes) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IAudioStreamVolume_INTERFACE_DEFINED__ */
-
-
-#ifndef __IChannelAudioVolume_INTERFACE_DEFINED__
-#define __IChannelAudioVolume_INTERFACE_DEFINED__
-
-/* interface IChannelAudioVolume */
-/* [local][unique][uuid][object] */ 
-
-
-EXTERN_C const IID IID_IChannelAudioVolume;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("1C158861-B533-4B30-B1CF-E853E51C59B8")
-    IChannelAudioVolume : public IUnknown
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE GetChannelCount( 
-            /* [out] */ 
-            __out  UINT32 *pdwCount) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE SetChannelVolume( 
-            /* [in] */ 
-            __in  UINT32 dwIndex,
-            /* [in] */ 
-            __in  const float fLevel,
-            /* [unique][in] */ LPCGUID EventContext) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetChannelVolume( 
-            /* [in] */ 
-            __in  UINT32 dwIndex,
-            /* [out] */ 
-            __out  float *pfLevel) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE SetAllVolumes( 
-            /* [in] */ 
-            __in  UINT32 dwCount,
-            /* [size_is][in] */ 
-            __in_ecount(dwCount)  const float *pfVolumes,
-            /* [unique][in] */ LPCGUID EventContext) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetAllVolumes( 
-            /* [in] */ 
-            __in  UINT32 dwCount,
-            /* [size_is][out] */ 
-            __out_ecount(dwCount)  float *pfVolumes) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IChannelAudioVolumeVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IChannelAudioVolume * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IChannelAudioVolume * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IChannelAudioVolume * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetChannelCount )( 
-            IChannelAudioVolume * This,
-            /* [out] */ 
-            __out  UINT32 *pdwCount);
-        
-        HRESULT ( STDMETHODCALLTYPE *SetChannelVolume )( 
-            IChannelAudioVolume * This,
-            /* [in] */ 
-            __in  UINT32 dwIndex,
-            /* [in] */ 
-            __in  const float fLevel,
-            /* [unique][in] */ LPCGUID EventContext);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetChannelVolume )( 
-            IChannelAudioVolume * This,
-            /* [in] */ 
-            __in  UINT32 dwIndex,
-            /* [out] */ 
-            __out  float *pfLevel);
-        
-        HRESULT ( STDMETHODCALLTYPE *SetAllVolumes )( 
-            IChannelAudioVolume * This,
-            /* [in] */ 
-            __in  UINT32 dwCount,
-            /* [size_is][in] */ 
-            __in_ecount(dwCount)  const float *pfVolumes,
-            /* [unique][in] */ LPCGUID EventContext);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetAllVolumes )( 
-            IChannelAudioVolume * This,
-            /* [in] */ 
-            __in  UINT32 dwCount,
-            /* [size_is][out] */ 
-            __out_ecount(dwCount)  float *pfVolumes);
-        
-        END_INTERFACE
-    } IChannelAudioVolumeVtbl;
-
-    interface IChannelAudioVolume
-    {
-        CONST_VTBL struct IChannelAudioVolumeVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IChannelAudioVolume_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IChannelAudioVolume_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IChannelAudioVolume_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IChannelAudioVolume_GetChannelCount(This,pdwCount)	\
-    ( (This)->lpVtbl -> GetChannelCount(This,pdwCount) ) 
-
-#define IChannelAudioVolume_SetChannelVolume(This,dwIndex,fLevel,EventContext)	\
-    ( (This)->lpVtbl -> SetChannelVolume(This,dwIndex,fLevel,EventContext) ) 
-
-#define IChannelAudioVolume_GetChannelVolume(This,dwIndex,pfLevel)	\
-    ( (This)->lpVtbl -> GetChannelVolume(This,dwIndex,pfLevel) ) 
-
-#define IChannelAudioVolume_SetAllVolumes(This,dwCount,pfVolumes,EventContext)	\
-    ( (This)->lpVtbl -> SetAllVolumes(This,dwCount,pfVolumes,EventContext) ) 
-
-#define IChannelAudioVolume_GetAllVolumes(This,dwCount,pfVolumes)	\
-    ( (This)->lpVtbl -> GetAllVolumes(This,dwCount,pfVolumes) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IChannelAudioVolume_INTERFACE_DEFINED__ */
-
-
-/* interface __MIDL_itf_audioclient_0000_0007 */
-/* [local] */ 
-
-#define FACILITY_AUDCLNT 0x889
-#define AUDCLNT_ERR(n) MAKE_HRESULT(SEVERITY_ERROR, FACILITY_AUDCLNT, n)
-#define AUDCLNT_SUCCESS(n) MAKE_SCODE(SEVERITY_SUCCESS, FACILITY_AUDCLNT, n)
-#define AUDCLNT_E_NOT_INITIALIZED            AUDCLNT_ERR(0x001)
-#define AUDCLNT_E_ALREADY_INITIALIZED        AUDCLNT_ERR(0x002)
-#define AUDCLNT_E_WRONG_ENDPOINT_TYPE        AUDCLNT_ERR(0x003)
-#define AUDCLNT_E_DEVICE_INVALIDATED         AUDCLNT_ERR(0x004)
-#define AUDCLNT_E_NOT_STOPPED                AUDCLNT_ERR(0x005)
-#define AUDCLNT_E_BUFFER_TOO_LARGE           AUDCLNT_ERR(0x006)
-#define AUDCLNT_E_OUT_OF_ORDER               AUDCLNT_ERR(0x007)
-#define AUDCLNT_E_UNSUPPORTED_FORMAT         AUDCLNT_ERR(0x008)
-#define AUDCLNT_E_INVALID_SIZE               AUDCLNT_ERR(0x009)
-#define AUDCLNT_E_DEVICE_IN_USE              AUDCLNT_ERR(0x00a)
-#define AUDCLNT_E_BUFFER_OPERATION_PENDING   AUDCLNT_ERR(0x00b)
-#define AUDCLNT_E_THREAD_NOT_REGISTERED      AUDCLNT_ERR(0x00c)
-#define AUDCLNT_E_EXCLUSIVE_MODE_NOT_ALLOWED AUDCLNT_ERR(0x00e)
-#define AUDCLNT_E_ENDPOINT_CREATE_FAILED     AUDCLNT_ERR(0x00f)
-#define AUDCLNT_E_SERVICE_NOT_RUNNING        AUDCLNT_ERR(0x010)
-#define AUDCLNT_E_EVENTHANDLE_NOT_EXPECTED     AUDCLNT_ERR(0x011)
-#define AUDCLNT_E_EXCLUSIVE_MODE_ONLY          AUDCLNT_ERR(0x012)
-#define AUDCLNT_E_BUFDURATION_PERIOD_NOT_EQUAL AUDCLNT_ERR(0x013)
-#define AUDCLNT_E_EVENTHANDLE_NOT_SET          AUDCLNT_ERR(0x014)
-#define AUDCLNT_E_INCORRECT_BUFFER_SIZE        AUDCLNT_ERR(0x015)
-#define AUDCLNT_E_BUFFER_SIZE_ERROR            AUDCLNT_ERR(0x016)
-#define AUDCLNT_E_CPUUSAGE_EXCEEDED            AUDCLNT_ERR(0x017)
-#define AUDCLNT_S_BUFFER_EMPTY              AUDCLNT_SUCCESS(0x001)
-#define AUDCLNT_S_THREAD_ALREADY_REGISTERED AUDCLNT_SUCCESS(0x002)
-#define AUDCLNT_S_POSITION_STALLED		   AUDCLNT_SUCCESS(0x003)
-
-
-extern RPC_IF_HANDLE __MIDL_itf_audioclient_0000_0007_v0_0_c_ifspec;
-extern RPC_IF_HANDLE __MIDL_itf_audioclient_0000_0007_v0_0_s_ifspec;
-
-/* Additional Prototypes for ALL interfaces */
-
-/* end of Additional Prototypes */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
-
-
+
+
+/* this ALWAYS GENERATED file contains the definitions for the interfaces */
+
+
+ /* File created by MIDL compiler version 7.00.0499 */
+/* Compiler settings for audioclient.idl:
+    Oicf, W1, Zp8, env=Win32 (32b run)
+    protocol : dce , ms_ext, c_ext, robust
+    error checks: allocation ref bounds_check enum stub_data 
+    VC __declspec() decoration level: 
+         __declspec(uuid()), __declspec(selectany), __declspec(novtable)
+         DECLSPEC_UUID(), MIDL_INTERFACE()
+*/
+//@@MIDL_FILE_HEADING(  )
+
+#pragma warning( disable: 4049 )  /* more than 64k source lines */
+
+
+/* verify that the <rpcndr.h> version is high enough to compile this file*/
+#ifndef __REQUIRED_RPCNDR_H_VERSION__
+#define __REQUIRED_RPCNDR_H_VERSION__ 500
+#endif
+
+/* verify that the <rpcsal.h> version is high enough to compile this file*/
+#ifndef __REQUIRED_RPCSAL_H_VERSION__
+#define __REQUIRED_RPCSAL_H_VERSION__ 100
+#endif
+
+#include "rpc.h"
+#include "rpcndr.h"
+
+#ifndef __RPCNDR_H_VERSION__
+#error this stub requires an updated version of <rpcndr.h>
+#endif // __RPCNDR_H_VERSION__
+
+#ifndef COM_NO_WINDOWS_H
+#include "windows.h"
+#include "ole2.h"
+#endif /*COM_NO_WINDOWS_H*/
+
+#ifndef __audioclient_h__
+#define __audioclient_h__
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+#pragma once
+#endif
+
+/* Forward Declarations */ 
+
+#ifndef __IAudioClient_FWD_DEFINED__
+#define __IAudioClient_FWD_DEFINED__
+typedef interface IAudioClient IAudioClient;
+#endif 	/* __IAudioClient_FWD_DEFINED__ */
+
+
+#ifndef __IAudioRenderClient_FWD_DEFINED__
+#define __IAudioRenderClient_FWD_DEFINED__
+typedef interface IAudioRenderClient IAudioRenderClient;
+#endif 	/* __IAudioRenderClient_FWD_DEFINED__ */
+
+
+#ifndef __IAudioCaptureClient_FWD_DEFINED__
+#define __IAudioCaptureClient_FWD_DEFINED__
+typedef interface IAudioCaptureClient IAudioCaptureClient;
+#endif 	/* __IAudioCaptureClient_FWD_DEFINED__ */
+
+
+#ifndef __IAudioClock_FWD_DEFINED__
+#define __IAudioClock_FWD_DEFINED__
+typedef interface IAudioClock IAudioClock;
+#endif 	/* __IAudioClock_FWD_DEFINED__ */
+
+
+#ifndef __ISimpleAudioVolume_FWD_DEFINED__
+#define __ISimpleAudioVolume_FWD_DEFINED__
+typedef interface ISimpleAudioVolume ISimpleAudioVolume;
+#endif 	/* __ISimpleAudioVolume_FWD_DEFINED__ */
+
+
+#ifndef __IAudioStreamVolume_FWD_DEFINED__
+#define __IAudioStreamVolume_FWD_DEFINED__
+typedef interface IAudioStreamVolume IAudioStreamVolume;
+#endif 	/* __IAudioStreamVolume_FWD_DEFINED__ */
+
+
+#ifndef __IChannelAudioVolume_FWD_DEFINED__
+#define __IChannelAudioVolume_FWD_DEFINED__
+typedef interface IChannelAudioVolume IChannelAudioVolume;
+#endif 	/* __IChannelAudioVolume_FWD_DEFINED__ */
+
+
+/* header files for imported files */
+#include "wtypes.h"
+#include "unknwn.h"
+#include "AudioSessionTypes.h"
+
+#ifdef __cplusplus
+extern "C"{
+#endif 
+
+
+/* interface __MIDL_itf_audioclient_0000_0000 */
+/* [local] */ 
+
+#if 0
+typedef /* [hidden][restricted] */ struct WAVEFORMATEX
+    {
+    WORD wFormatTag;
+    WORD nChannels;
+    DWORD nSamplesPerSec;
+    DWORD nAvgBytesPerSec;
+    WORD nBlockAlign;
+    WORD wBitsPerSample;
+    WORD cbSize;
+    } 	WAVEFORMATEX;
+
+#else
+#include <mmreg.h>
+#endif
+#if 0
+typedef /* [hidden][restricted] */ LONGLONG REFERENCE_TIME;
+
+#else
+#define _IKsControl_
+#include <ks.h>
+#include <ksmedia.h>
+#endif
+
+enum _AUDCLNT_BUFFERFLAGS
+    {	AUDCLNT_BUFFERFLAGS_DATA_DISCONTINUITY	= 0x1,
+	AUDCLNT_BUFFERFLAGS_SILENT	= 0x2,
+	AUDCLNT_BUFFERFLAGS_TIMESTAMP_ERROR	= 0x4
+    } ;
+
+
+extern RPC_IF_HANDLE __MIDL_itf_audioclient_0000_0000_v0_0_c_ifspec;
+extern RPC_IF_HANDLE __MIDL_itf_audioclient_0000_0000_v0_0_s_ifspec;
+
+#ifndef __IAudioClient_INTERFACE_DEFINED__
+#define __IAudioClient_INTERFACE_DEFINED__
+
+/* interface IAudioClient */
+/* [local][unique][uuid][object] */ 
+
+
+EXTERN_C const IID IID_IAudioClient;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("1CB9AD4C-DBFA-4c32-B178-C2F568A703B2")
+    IAudioClient : public IUnknown
+    {
+    public:
+        virtual HRESULT STDMETHODCALLTYPE Initialize( 
+            /* [in] */ 
+            __in  AUDCLNT_SHAREMODE ShareMode,
+            /* [in] */ 
+            __in  DWORD StreamFlags,
+            /* [in] */ 
+            __in  REFERENCE_TIME hnsBufferDuration,
+            /* [in] */ 
+            __in  REFERENCE_TIME hnsPeriodicity,
+            /* [in] */ 
+            __in  const WAVEFORMATEX *pFormat,
+            /* [in] */ 
+            __in_opt  LPCGUID AudioSessionGuid) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE GetBufferSize( 
+            /* [out] */ 
+            __out  UINT32 *pNumBufferFrames) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE GetStreamLatency( 
+            /* [out] */ 
+            __out  REFERENCE_TIME *phnsLatency) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE GetCurrentPadding( 
+            /* [out] */ 
+            __out  UINT32 *pNumPaddingFrames) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE IsFormatSupported( 
+            /* [in] */ 
+            __in  AUDCLNT_SHAREMODE ShareMode,
+            /* [in] */ 
+            __in  const WAVEFORMATEX *pFormat,
+            /* [unique][out] */ 
+            __out_opt  WAVEFORMATEX **ppClosestMatch) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE GetMixFormat( 
+            /* [out] */ 
+            __out  WAVEFORMATEX **ppDeviceFormat) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE GetDevicePeriod( 
+            /* [out] */ 
+            __out_opt  REFERENCE_TIME *phnsDefaultDevicePeriod,
+            /* [out] */ 
+            __out_opt  REFERENCE_TIME *phnsMinimumDevicePeriod) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE Start( void) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE Stop( void) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE Reset( void) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE SetEventHandle( 
+            /* [in] */ HANDLE eventHandle) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE GetService( 
+            /* [in] */ 
+            __in  REFIID riid,
+            /* [iid_is][out] */ 
+            __out  void **ppv) = 0;
+        
+    };
+    
+#else 	/* C style interface */
+
+    typedef struct IAudioClientVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            IAudioClient * This,
+            /* [in] */ REFIID riid,
+            /* [iid_is][out] */ 
+            __RPC__deref_out  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            IAudioClient * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            IAudioClient * This);
+        
+        HRESULT ( STDMETHODCALLTYPE *Initialize )( 
+            IAudioClient * This,
+            /* [in] */ 
+            __in  AUDCLNT_SHAREMODE ShareMode,
+            /* [in] */ 
+            __in  DWORD StreamFlags,
+            /* [in] */ 
+            __in  REFERENCE_TIME hnsBufferDuration,
+            /* [in] */ 
+            __in  REFERENCE_TIME hnsPeriodicity,
+            /* [in] */ 
+            __in  const WAVEFORMATEX *pFormat,
+            /* [in] */ 
+            __in_opt  LPCGUID AudioSessionGuid);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetBufferSize )( 
+            IAudioClient * This,
+            /* [out] */ 
+            __out  UINT32 *pNumBufferFrames);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetStreamLatency )( 
+            IAudioClient * This,
+            /* [out] */ 
+            __out  REFERENCE_TIME *phnsLatency);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetCurrentPadding )( 
+            IAudioClient * This,
+            /* [out] */ 
+            __out  UINT32 *pNumPaddingFrames);
+        
+        HRESULT ( STDMETHODCALLTYPE *IsFormatSupported )( 
+            IAudioClient * This,
+            /* [in] */ 
+            __in  AUDCLNT_SHAREMODE ShareMode,
+            /* [in] */ 
+            __in  const WAVEFORMATEX *pFormat,
+            /* [unique][out] */ 
+            __out_opt  WAVEFORMATEX **ppClosestMatch);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetMixFormat )( 
+            IAudioClient * This,
+            /* [out] */ 
+            __out  WAVEFORMATEX **ppDeviceFormat);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetDevicePeriod )( 
+            IAudioClient * This,
+            /* [out] */ 
+            __out_opt  REFERENCE_TIME *phnsDefaultDevicePeriod,
+            /* [out] */ 
+            __out_opt  REFERENCE_TIME *phnsMinimumDevicePeriod);
+        
+        HRESULT ( STDMETHODCALLTYPE *Start )( 
+            IAudioClient * This);
+        
+        HRESULT ( STDMETHODCALLTYPE *Stop )( 
+            IAudioClient * This);
+        
+        HRESULT ( STDMETHODCALLTYPE *Reset )( 
+            IAudioClient * This);
+        
+        HRESULT ( STDMETHODCALLTYPE *SetEventHandle )( 
+            IAudioClient * This,
+            /* [in] */ HANDLE eventHandle);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetService )( 
+            IAudioClient * This,
+            /* [in] */ 
+            __in  REFIID riid,
+            /* [iid_is][out] */ 
+            __out  void **ppv);
+        
+        END_INTERFACE
+    } IAudioClientVtbl;
+
+    interface IAudioClient
+    {
+        CONST_VTBL struct IAudioClientVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define IAudioClient_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define IAudioClient_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define IAudioClient_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define IAudioClient_Initialize(This,ShareMode,StreamFlags,hnsBufferDuration,hnsPeriodicity,pFormat,AudioSessionGuid)	\
+    ( (This)->lpVtbl -> Initialize(This,ShareMode,StreamFlags,hnsBufferDuration,hnsPeriodicity,pFormat,AudioSessionGuid) ) 
+
+#define IAudioClient_GetBufferSize(This,pNumBufferFrames)	\
+    ( (This)->lpVtbl -> GetBufferSize(This,pNumBufferFrames) ) 
+
+#define IAudioClient_GetStreamLatency(This,phnsLatency)	\
+    ( (This)->lpVtbl -> GetStreamLatency(This,phnsLatency) ) 
+
+#define IAudioClient_GetCurrentPadding(This,pNumPaddingFrames)	\
+    ( (This)->lpVtbl -> GetCurrentPadding(This,pNumPaddingFrames) ) 
+
+#define IAudioClient_IsFormatSupported(This,ShareMode,pFormat,ppClosestMatch)	\
+    ( (This)->lpVtbl -> IsFormatSupported(This,ShareMode,pFormat,ppClosestMatch) ) 
+
+#define IAudioClient_GetMixFormat(This,ppDeviceFormat)	\
+    ( (This)->lpVtbl -> GetMixFormat(This,ppDeviceFormat) ) 
+
+#define IAudioClient_GetDevicePeriod(This,phnsDefaultDevicePeriod,phnsMinimumDevicePeriod)	\
+    ( (This)->lpVtbl -> GetDevicePeriod(This,phnsDefaultDevicePeriod,phnsMinimumDevicePeriod) ) 
+
+#define IAudioClient_Start(This)	\
+    ( (This)->lpVtbl -> Start(This) ) 
+
+#define IAudioClient_Stop(This)	\
+    ( (This)->lpVtbl -> Stop(This) ) 
+
+#define IAudioClient_Reset(This)	\
+    ( (This)->lpVtbl -> Reset(This) ) 
+
+#define IAudioClient_SetEventHandle(This,eventHandle)	\
+    ( (This)->lpVtbl -> SetEventHandle(This,eventHandle) ) 
+
+#define IAudioClient_GetService(This,riid,ppv)	\
+    ( (This)->lpVtbl -> GetService(This,riid,ppv) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __IAudioClient_INTERFACE_DEFINED__ */
+
+
+#ifndef __IAudioRenderClient_INTERFACE_DEFINED__
+#define __IAudioRenderClient_INTERFACE_DEFINED__
+
+/* interface IAudioRenderClient */
+/* [local][unique][helpstring][uuid][object] */ 
+
+
+EXTERN_C const IID IID_IAudioRenderClient;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("F294ACFC-3146-4483-A7BF-ADDCA7C260E2")
+    IAudioRenderClient : public IUnknown
+    {
+    public:
+        virtual HRESULT STDMETHODCALLTYPE GetBuffer( 
+            /* [in] */ 
+            __in  UINT32 NumFramesRequested,
+            /* [out] */ 
+            __out  BYTE **ppData) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE ReleaseBuffer( 
+            /* [in] */ 
+            __in  UINT32 NumFramesWritten,
+            /* [in] */ 
+            __in  DWORD dwFlags) = 0;
+        
+    };
+    
+#else 	/* C style interface */
+
+    typedef struct IAudioRenderClientVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            IAudioRenderClient * This,
+            /* [in] */ REFIID riid,
+            /* [iid_is][out] */ 
+            __RPC__deref_out  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            IAudioRenderClient * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            IAudioRenderClient * This);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetBuffer )( 
+            IAudioRenderClient * This,
+            /* [in] */ 
+            __in  UINT32 NumFramesRequested,
+            /* [out] */ 
+            __out  BYTE **ppData);
+        
+        HRESULT ( STDMETHODCALLTYPE *ReleaseBuffer )( 
+            IAudioRenderClient * This,
+            /* [in] */ 
+            __in  UINT32 NumFramesWritten,
+            /* [in] */ 
+            __in  DWORD dwFlags);
+        
+        END_INTERFACE
+    } IAudioRenderClientVtbl;
+
+    interface IAudioRenderClient
+    {
+        CONST_VTBL struct IAudioRenderClientVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define IAudioRenderClient_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define IAudioRenderClient_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define IAudioRenderClient_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define IAudioRenderClient_GetBuffer(This,NumFramesRequested,ppData)	\
+    ( (This)->lpVtbl -> GetBuffer(This,NumFramesRequested,ppData) ) 
+
+#define IAudioRenderClient_ReleaseBuffer(This,NumFramesWritten,dwFlags)	\
+    ( (This)->lpVtbl -> ReleaseBuffer(This,NumFramesWritten,dwFlags) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __IAudioRenderClient_INTERFACE_DEFINED__ */
+
+
+#ifndef __IAudioCaptureClient_INTERFACE_DEFINED__
+#define __IAudioCaptureClient_INTERFACE_DEFINED__
+
+/* interface IAudioCaptureClient */
+/* [local][unique][helpstring][uuid][object] */ 
+
+
+EXTERN_C const IID IID_IAudioCaptureClient;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("C8ADBD64-E71E-48a0-A4DE-185C395CD317")
+    IAudioCaptureClient : public IUnknown
+    {
+    public:
+        virtual HRESULT STDMETHODCALLTYPE GetBuffer( 
+            /* [out] */ 
+            __out  BYTE **ppData,
+            /* [out] */ 
+            __out  UINT32 *pNumFramesToRead,
+            /* [out] */ 
+            __out  DWORD *pdwFlags,
+            /* [unique][out] */ 
+            __out_opt  UINT64 *pu64DevicePosition,
+            /* [unique][out] */ 
+            __out_opt  UINT64 *pu64QPCPosition) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE ReleaseBuffer( 
+            /* [in] */ 
+            __in  UINT32 NumFramesRead) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE GetNextPacketSize( 
+            /* [out] */ 
+            __out  UINT32 *pNumFramesInNextPacket) = 0;
+        
+    };
+    
+#else 	/* C style interface */
+
+    typedef struct IAudioCaptureClientVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            IAudioCaptureClient * This,
+            /* [in] */ REFIID riid,
+            /* [iid_is][out] */ 
+            __RPC__deref_out  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            IAudioCaptureClient * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            IAudioCaptureClient * This);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetBuffer )( 
+            IAudioCaptureClient * This,
+            /* [out] */ 
+            __out  BYTE **ppData,
+            /* [out] */ 
+            __out  UINT32 *pNumFramesToRead,
+            /* [out] */ 
+            __out  DWORD *pdwFlags,
+            /* [unique][out] */ 
+            __out_opt  UINT64 *pu64DevicePosition,
+            /* [unique][out] */ 
+            __out_opt  UINT64 *pu64QPCPosition);
+        
+        HRESULT ( STDMETHODCALLTYPE *ReleaseBuffer )( 
+            IAudioCaptureClient * This,
+            /* [in] */ 
+            __in  UINT32 NumFramesRead);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetNextPacketSize )( 
+            IAudioCaptureClient * This,
+            /* [out] */ 
+            __out  UINT32 *pNumFramesInNextPacket);
+        
+        END_INTERFACE
+    } IAudioCaptureClientVtbl;
+
+    interface IAudioCaptureClient
+    {
+        CONST_VTBL struct IAudioCaptureClientVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define IAudioCaptureClient_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define IAudioCaptureClient_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define IAudioCaptureClient_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define IAudioCaptureClient_GetBuffer(This,ppData,pNumFramesToRead,pdwFlags,pu64DevicePosition,pu64QPCPosition)	\
+    ( (This)->lpVtbl -> GetBuffer(This,ppData,pNumFramesToRead,pdwFlags,pu64DevicePosition,pu64QPCPosition) ) 
+
+#define IAudioCaptureClient_ReleaseBuffer(This,NumFramesRead)	\
+    ( (This)->lpVtbl -> ReleaseBuffer(This,NumFramesRead) ) 
+
+#define IAudioCaptureClient_GetNextPacketSize(This,pNumFramesInNextPacket)	\
+    ( (This)->lpVtbl -> GetNextPacketSize(This,pNumFramesInNextPacket) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __IAudioCaptureClient_INTERFACE_DEFINED__ */
+
+
+/* interface __MIDL_itf_audioclient_0000_0003 */
+/* [local] */ 
+
+#define AUDIOCLOCK_CHARACTERISTIC_FIXED_FREQ  0x00000001
+
+
+extern RPC_IF_HANDLE __MIDL_itf_audioclient_0000_0003_v0_0_c_ifspec;
+extern RPC_IF_HANDLE __MIDL_itf_audioclient_0000_0003_v0_0_s_ifspec;
+
+#ifndef __IAudioClock_INTERFACE_DEFINED__
+#define __IAudioClock_INTERFACE_DEFINED__
+
+/* interface IAudioClock */
+/* [local][unique][uuid][object] */ 
+
+
+EXTERN_C const IID IID_IAudioClock;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("CD63314F-3FBA-4a1b-812C-EF96358728E7")
+    IAudioClock : public IUnknown
+    {
+    public:
+        virtual HRESULT STDMETHODCALLTYPE GetFrequency( 
+            /* [out] */ 
+            __out  UINT64 *pu64Frequency) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE GetPosition( 
+            /* [out] */ 
+            __out  UINT64 *pu64Position,
+            /* [unique][out] */ 
+            __out_opt  UINT64 *pu64QPCPosition) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE GetCharacteristics( 
+            /* [out] */ 
+            __out  DWORD *pdwCharacteristics) = 0;
+        
+    };
+    
+#else 	/* C style interface */
+
+    typedef struct IAudioClockVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            IAudioClock * This,
+            /* [in] */ REFIID riid,
+            /* [iid_is][out] */ 
+            __RPC__deref_out  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            IAudioClock * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            IAudioClock * This);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetFrequency )( 
+            IAudioClock * This,
+            /* [out] */ 
+            __out  UINT64 *pu64Frequency);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetPosition )( 
+            IAudioClock * This,
+            /* [out] */ 
+            __out  UINT64 *pu64Position,
+            /* [unique][out] */ 
+            __out_opt  UINT64 *pu64QPCPosition);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetCharacteristics )( 
+            IAudioClock * This,
+            /* [out] */ 
+            __out  DWORD *pdwCharacteristics);
+        
+        END_INTERFACE
+    } IAudioClockVtbl;
+
+    interface IAudioClock
+    {
+        CONST_VTBL struct IAudioClockVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define IAudioClock_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define IAudioClock_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define IAudioClock_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define IAudioClock_GetFrequency(This,pu64Frequency)	\
+    ( (This)->lpVtbl -> GetFrequency(This,pu64Frequency) ) 
+
+#define IAudioClock_GetPosition(This,pu64Position,pu64QPCPosition)	\
+    ( (This)->lpVtbl -> GetPosition(This,pu64Position,pu64QPCPosition) ) 
+
+#define IAudioClock_GetCharacteristics(This,pdwCharacteristics)	\
+    ( (This)->lpVtbl -> GetCharacteristics(This,pdwCharacteristics) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __IAudioClock_INTERFACE_DEFINED__ */
+
+
+#ifndef __ISimpleAudioVolume_INTERFACE_DEFINED__
+#define __ISimpleAudioVolume_INTERFACE_DEFINED__
+
+/* interface ISimpleAudioVolume */
+/* [local][unique][uuid][object] */ 
+
+
+EXTERN_C const IID IID_ISimpleAudioVolume;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("87CE5498-68D6-44E5-9215-6DA47EF883D8")
+    ISimpleAudioVolume : public IUnknown
+    {
+    public:
+        virtual HRESULT STDMETHODCALLTYPE SetMasterVolume( 
+            /* [in] */ 
+            __in  float fLevel,
+            /* [unique][in] */ LPCGUID EventContext) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE GetMasterVolume( 
+            /* [out] */ 
+            __out  float *pfLevel) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE SetMute( 
+            /* [in] */ 
+            __in  const BOOL bMute,
+            /* [unique][in] */ LPCGUID EventContext) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE GetMute( 
+            /* [out] */ 
+            __out  BOOL *pbMute) = 0;
+        
+    };
+    
+#else 	/* C style interface */
+
+    typedef struct ISimpleAudioVolumeVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            ISimpleAudioVolume * This,
+            /* [in] */ REFIID riid,
+            /* [iid_is][out] */ 
+            __RPC__deref_out  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            ISimpleAudioVolume * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            ISimpleAudioVolume * This);
+        
+        HRESULT ( STDMETHODCALLTYPE *SetMasterVolume )( 
+            ISimpleAudioVolume * This,
+            /* [in] */ 
+            __in  float fLevel,
+            /* [unique][in] */ LPCGUID EventContext);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetMasterVolume )( 
+            ISimpleAudioVolume * This,
+            /* [out] */ 
+            __out  float *pfLevel);
+        
+        HRESULT ( STDMETHODCALLTYPE *SetMute )( 
+            ISimpleAudioVolume * This,
+            /* [in] */ 
+            __in  const BOOL bMute,
+            /* [unique][in] */ LPCGUID EventContext);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetMute )( 
+            ISimpleAudioVolume * This,
+            /* [out] */ 
+            __out  BOOL *pbMute);
+        
+        END_INTERFACE
+    } ISimpleAudioVolumeVtbl;
+
+    interface ISimpleAudioVolume
+    {
+        CONST_VTBL struct ISimpleAudioVolumeVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define ISimpleAudioVolume_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define ISimpleAudioVolume_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define ISimpleAudioVolume_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define ISimpleAudioVolume_SetMasterVolume(This,fLevel,EventContext)	\
+    ( (This)->lpVtbl -> SetMasterVolume(This,fLevel,EventContext) ) 
+
+#define ISimpleAudioVolume_GetMasterVolume(This,pfLevel)	\
+    ( (This)->lpVtbl -> GetMasterVolume(This,pfLevel) ) 
+
+#define ISimpleAudioVolume_SetMute(This,bMute,EventContext)	\
+    ( (This)->lpVtbl -> SetMute(This,bMute,EventContext) ) 
+
+#define ISimpleAudioVolume_GetMute(This,pbMute)	\
+    ( (This)->lpVtbl -> GetMute(This,pbMute) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __ISimpleAudioVolume_INTERFACE_DEFINED__ */
+
+
+#ifndef __IAudioStreamVolume_INTERFACE_DEFINED__
+#define __IAudioStreamVolume_INTERFACE_DEFINED__
+
+/* interface IAudioStreamVolume */
+/* [local][unique][uuid][object] */ 
+
+
+EXTERN_C const IID IID_IAudioStreamVolume;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("93014887-242D-4068-8A15-CF5E93B90FE3")
+    IAudioStreamVolume : public IUnknown
+    {
+    public:
+        virtual HRESULT STDMETHODCALLTYPE GetChannelCount( 
+            /* [out] */ 
+            __out  UINT32 *pdwCount) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE SetChannelVolume( 
+            /* [in] */ 
+            __in  UINT32 dwIndex,
+            /* [in] */ 
+            __in  const float fLevel) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE GetChannelVolume( 
+            /* [in] */ 
+            __in  UINT32 dwIndex,
+            /* [out] */ 
+            __out  float *pfLevel) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE SetAllVolumes( 
+            /* [in] */ 
+            __in  UINT32 dwCount,
+            /* [size_is][in] */ 
+            __in_ecount(dwCount)  const float *pfVolumes) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE GetAllVolumes( 
+            /* [in] */ 
+            __in  UINT32 dwCount,
+            /* [size_is][out] */ 
+            __out_ecount(dwCount)  float *pfVolumes) = 0;
+        
+    };
+    
+#else 	/* C style interface */
+
+    typedef struct IAudioStreamVolumeVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            IAudioStreamVolume * This,
+            /* [in] */ REFIID riid,
+            /* [iid_is][out] */ 
+            __RPC__deref_out  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            IAudioStreamVolume * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            IAudioStreamVolume * This);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetChannelCount )( 
+            IAudioStreamVolume * This,
+            /* [out] */ 
+            __out  UINT32 *pdwCount);
+        
+        HRESULT ( STDMETHODCALLTYPE *SetChannelVolume )( 
+            IAudioStreamVolume * This,
+            /* [in] */ 
+            __in  UINT32 dwIndex,
+            /* [in] */ 
+            __in  const float fLevel);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetChannelVolume )( 
+            IAudioStreamVolume * This,
+            /* [in] */ 
+            __in  UINT32 dwIndex,
+            /* [out] */ 
+            __out  float *pfLevel);
+        
+        HRESULT ( STDMETHODCALLTYPE *SetAllVolumes )( 
+            IAudioStreamVolume * This,
+            /* [in] */ 
+            __in  UINT32 dwCount,
+            /* [size_is][in] */ 
+            __in_ecount(dwCount)  const float *pfVolumes);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetAllVolumes )( 
+            IAudioStreamVolume * This,
+            /* [in] */ 
+            __in  UINT32 dwCount,
+            /* [size_is][out] */ 
+            __out_ecount(dwCount)  float *pfVolumes);
+        
+        END_INTERFACE
+    } IAudioStreamVolumeVtbl;
+
+    interface IAudioStreamVolume
+    {
+        CONST_VTBL struct IAudioStreamVolumeVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define IAudioStreamVolume_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define IAudioStreamVolume_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define IAudioStreamVolume_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define IAudioStreamVolume_GetChannelCount(This,pdwCount)	\
+    ( (This)->lpVtbl -> GetChannelCount(This,pdwCount) ) 
+
+#define IAudioStreamVolume_SetChannelVolume(This,dwIndex,fLevel)	\
+    ( (This)->lpVtbl -> SetChannelVolume(This,dwIndex,fLevel) ) 
+
+#define IAudioStreamVolume_GetChannelVolume(This,dwIndex,pfLevel)	\
+    ( (This)->lpVtbl -> GetChannelVolume(This,dwIndex,pfLevel) ) 
+
+#define IAudioStreamVolume_SetAllVolumes(This,dwCount,pfVolumes)	\
+    ( (This)->lpVtbl -> SetAllVolumes(This,dwCount,pfVolumes) ) 
+
+#define IAudioStreamVolume_GetAllVolumes(This,dwCount,pfVolumes)	\
+    ( (This)->lpVtbl -> GetAllVolumes(This,dwCount,pfVolumes) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __IAudioStreamVolume_INTERFACE_DEFINED__ */
+
+
+#ifndef __IChannelAudioVolume_INTERFACE_DEFINED__
+#define __IChannelAudioVolume_INTERFACE_DEFINED__
+
+/* interface IChannelAudioVolume */
+/* [local][unique][uuid][object] */ 
+
+
+EXTERN_C const IID IID_IChannelAudioVolume;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("1C158861-B533-4B30-B1CF-E853E51C59B8")
+    IChannelAudioVolume : public IUnknown
+    {
+    public:
+        virtual HRESULT STDMETHODCALLTYPE GetChannelCount( 
+            /* [out] */ 
+            __out  UINT32 *pdwCount) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE SetChannelVolume( 
+            /* [in] */ 
+            __in  UINT32 dwIndex,
+            /* [in] */ 
+            __in  const float fLevel,
+            /* [unique][in] */ LPCGUID EventContext) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE GetChannelVolume( 
+            /* [in] */ 
+            __in  UINT32 dwIndex,
+            /* [out] */ 
+            __out  float *pfLevel) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE SetAllVolumes( 
+            /* [in] */ 
+            __in  UINT32 dwCount,
+            /* [size_is][in] */ 
+            __in_ecount(dwCount)  const float *pfVolumes,
+            /* [unique][in] */ LPCGUID EventContext) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE GetAllVolumes( 
+            /* [in] */ 
+            __in  UINT32 dwCount,
+            /* [size_is][out] */ 
+            __out_ecount(dwCount)  float *pfVolumes) = 0;
+        
+    };
+    
+#else 	/* C style interface */
+
+    typedef struct IChannelAudioVolumeVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            IChannelAudioVolume * This,
+            /* [in] */ REFIID riid,
+            /* [iid_is][out] */ 
+            __RPC__deref_out  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            IChannelAudioVolume * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            IChannelAudioVolume * This);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetChannelCount )( 
+            IChannelAudioVolume * This,
+            /* [out] */ 
+            __out  UINT32 *pdwCount);
+        
+        HRESULT ( STDMETHODCALLTYPE *SetChannelVolume )( 
+            IChannelAudioVolume * This,
+            /* [in] */ 
+            __in  UINT32 dwIndex,
+            /* [in] */ 
+            __in  const float fLevel,
+            /* [unique][in] */ LPCGUID EventContext);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetChannelVolume )( 
+            IChannelAudioVolume * This,
+            /* [in] */ 
+            __in  UINT32 dwIndex,
+            /* [out] */ 
+            __out  float *pfLevel);
+        
+        HRESULT ( STDMETHODCALLTYPE *SetAllVolumes )( 
+            IChannelAudioVolume * This,
+            /* [in] */ 
+            __in  UINT32 dwCount,
+            /* [size_is][in] */ 
+            __in_ecount(dwCount)  const float *pfVolumes,
+            /* [unique][in] */ LPCGUID EventContext);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetAllVolumes )( 
+            IChannelAudioVolume * This,
+            /* [in] */ 
+            __in  UINT32 dwCount,
+            /* [size_is][out] */ 
+            __out_ecount(dwCount)  float *pfVolumes);
+        
+        END_INTERFACE
+    } IChannelAudioVolumeVtbl;
+
+    interface IChannelAudioVolume
+    {
+        CONST_VTBL struct IChannelAudioVolumeVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define IChannelAudioVolume_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define IChannelAudioVolume_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define IChannelAudioVolume_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define IChannelAudioVolume_GetChannelCount(This,pdwCount)	\
+    ( (This)->lpVtbl -> GetChannelCount(This,pdwCount) ) 
+
+#define IChannelAudioVolume_SetChannelVolume(This,dwIndex,fLevel,EventContext)	\
+    ( (This)->lpVtbl -> SetChannelVolume(This,dwIndex,fLevel,EventContext) ) 
+
+#define IChannelAudioVolume_GetChannelVolume(This,dwIndex,pfLevel)	\
+    ( (This)->lpVtbl -> GetChannelVolume(This,dwIndex,pfLevel) ) 
+
+#define IChannelAudioVolume_SetAllVolumes(This,dwCount,pfVolumes,EventContext)	\
+    ( (This)->lpVtbl -> SetAllVolumes(This,dwCount,pfVolumes,EventContext) ) 
+
+#define IChannelAudioVolume_GetAllVolumes(This,dwCount,pfVolumes)	\
+    ( (This)->lpVtbl -> GetAllVolumes(This,dwCount,pfVolumes) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __IChannelAudioVolume_INTERFACE_DEFINED__ */
+
+
+/* interface __MIDL_itf_audioclient_0000_0007 */
+/* [local] */ 
+
+#define FACILITY_AUDCLNT 0x889
+#define AUDCLNT_ERR(n) MAKE_HRESULT(SEVERITY_ERROR, FACILITY_AUDCLNT, n)
+#define AUDCLNT_SUCCESS(n) MAKE_SCODE(SEVERITY_SUCCESS, FACILITY_AUDCLNT, n)
+#define AUDCLNT_E_NOT_INITIALIZED            AUDCLNT_ERR(0x001)
+#define AUDCLNT_E_ALREADY_INITIALIZED        AUDCLNT_ERR(0x002)
+#define AUDCLNT_E_WRONG_ENDPOINT_TYPE        AUDCLNT_ERR(0x003)
+#define AUDCLNT_E_DEVICE_INVALIDATED         AUDCLNT_ERR(0x004)
+#define AUDCLNT_E_NOT_STOPPED                AUDCLNT_ERR(0x005)
+#define AUDCLNT_E_BUFFER_TOO_LARGE           AUDCLNT_ERR(0x006)
+#define AUDCLNT_E_OUT_OF_ORDER               AUDCLNT_ERR(0x007)
+#define AUDCLNT_E_UNSUPPORTED_FORMAT         AUDCLNT_ERR(0x008)
+#define AUDCLNT_E_INVALID_SIZE               AUDCLNT_ERR(0x009)
+#define AUDCLNT_E_DEVICE_IN_USE              AUDCLNT_ERR(0x00a)
+#define AUDCLNT_E_BUFFER_OPERATION_PENDING   AUDCLNT_ERR(0x00b)
+#define AUDCLNT_E_THREAD_NOT_REGISTERED      AUDCLNT_ERR(0x00c)
+#define AUDCLNT_E_EXCLUSIVE_MODE_NOT_ALLOWED AUDCLNT_ERR(0x00e)
+#define AUDCLNT_E_ENDPOINT_CREATE_FAILED     AUDCLNT_ERR(0x00f)
+#define AUDCLNT_E_SERVICE_NOT_RUNNING        AUDCLNT_ERR(0x010)
+#define AUDCLNT_E_EVENTHANDLE_NOT_EXPECTED     AUDCLNT_ERR(0x011)
+#define AUDCLNT_E_EXCLUSIVE_MODE_ONLY          AUDCLNT_ERR(0x012)
+#define AUDCLNT_E_BUFDURATION_PERIOD_NOT_EQUAL AUDCLNT_ERR(0x013)
+#define AUDCLNT_E_EVENTHANDLE_NOT_SET          AUDCLNT_ERR(0x014)
+#define AUDCLNT_E_INCORRECT_BUFFER_SIZE        AUDCLNT_ERR(0x015)
+#define AUDCLNT_E_BUFFER_SIZE_ERROR            AUDCLNT_ERR(0x016)
+#define AUDCLNT_E_CPUUSAGE_EXCEEDED            AUDCLNT_ERR(0x017)
+#define AUDCLNT_S_BUFFER_EMPTY              AUDCLNT_SUCCESS(0x001)
+#define AUDCLNT_S_THREAD_ALREADY_REGISTERED AUDCLNT_SUCCESS(0x002)
+#define AUDCLNT_S_POSITION_STALLED		   AUDCLNT_SUCCESS(0x003)
+
+
+extern RPC_IF_HANDLE __MIDL_itf_audioclient_0000_0007_v0_0_c_ifspec;
+extern RPC_IF_HANDLE __MIDL_itf_audioclient_0000_0007_v0_0_s_ifspec;
+
+/* Additional Prototypes for ALL interfaces */
+
+/* end of Additional Prototypes */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+
+
diff --git a/src/hostapi/wasapi/mingw-include/devicetopology.h b/src/hostapi/wasapi/mingw-include/devicetopology.h
index 1002ba0..7a1f75c 100644
--- a/src/hostapi/wasapi/mingw-include/devicetopology.h
+++ b/src/hostapi/wasapi/mingw-include/devicetopology.h
@@ -1,3275 +1,3275 @@
-
-
-/* this ALWAYS GENERATED file contains the definitions for the interfaces */
-
-
- /* File created by MIDL compiler version 7.00.0499 */
-/* Compiler settings for devicetopology.idl:
-    Oicf, W1, Zp8, env=Win32 (32b run)
-    protocol : dce , ms_ext, c_ext, robust
-    error checks: allocation ref bounds_check enum stub_data 
-    VC __declspec() decoration level: 
-         __declspec(uuid()), __declspec(selectany), __declspec(novtable)
-         DECLSPEC_UUID(), MIDL_INTERFACE()
-*/
-//@@MIDL_FILE_HEADING(  )
-
-#pragma warning( disable: 4049 )  /* more than 64k source lines */
-
-
-/* verify that the <rpcndr.h> version is high enough to compile this file*/
-#ifndef __REQUIRED_RPCNDR_H_VERSION__
-#define __REQUIRED_RPCNDR_H_VERSION__ 500
-#endif
-
-/* verify that the <rpcsal.h> version is high enough to compile this file*/
-#ifndef __REQUIRED_RPCSAL_H_VERSION__
-#define __REQUIRED_RPCSAL_H_VERSION__ 100
-#endif
-
-#include "rpc.h"
-#include "rpcndr.h"
-
-#ifndef __RPCNDR_H_VERSION__
-#error this stub requires an updated version of <rpcndr.h>
-#endif // __RPCNDR_H_VERSION__
-
-#ifndef COM_NO_WINDOWS_H
-#include "windows.h"
-#include "ole2.h"
-#endif /*COM_NO_WINDOWS_H*/
-
-#ifndef __devicetopology_h__
-#define __devicetopology_h__
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-#pragma once
-#endif
-
-/* Forward Declarations */ 
-
-#ifndef __IKsControl_FWD_DEFINED__
-#define __IKsControl_FWD_DEFINED__
-typedef interface IKsControl IKsControl;
-#endif 	/* __IKsControl_FWD_DEFINED__ */
-
-
-#ifndef __IPerChannelDbLevel_FWD_DEFINED__
-#define __IPerChannelDbLevel_FWD_DEFINED__
-typedef interface IPerChannelDbLevel IPerChannelDbLevel;
-#endif 	/* __IPerChannelDbLevel_FWD_DEFINED__ */
-
-
-#ifndef __IAudioVolumeLevel_FWD_DEFINED__
-#define __IAudioVolumeLevel_FWD_DEFINED__
-typedef interface IAudioVolumeLevel IAudioVolumeLevel;
-#endif 	/* __IAudioVolumeLevel_FWD_DEFINED__ */
-
-
-#ifndef __IAudioChannelConfig_FWD_DEFINED__
-#define __IAudioChannelConfig_FWD_DEFINED__
-typedef interface IAudioChannelConfig IAudioChannelConfig;
-#endif 	/* __IAudioChannelConfig_FWD_DEFINED__ */
-
-
-#ifndef __IAudioLoudness_FWD_DEFINED__
-#define __IAudioLoudness_FWD_DEFINED__
-typedef interface IAudioLoudness IAudioLoudness;
-#endif 	/* __IAudioLoudness_FWD_DEFINED__ */
-
-
-#ifndef __IAudioInputSelector_FWD_DEFINED__
-#define __IAudioInputSelector_FWD_DEFINED__
-typedef interface IAudioInputSelector IAudioInputSelector;
-#endif 	/* __IAudioInputSelector_FWD_DEFINED__ */
-
-
-#ifndef __IAudioOutputSelector_FWD_DEFINED__
-#define __IAudioOutputSelector_FWD_DEFINED__
-typedef interface IAudioOutputSelector IAudioOutputSelector;
-#endif 	/* __IAudioOutputSelector_FWD_DEFINED__ */
-
-
-#ifndef __IAudioMute_FWD_DEFINED__
-#define __IAudioMute_FWD_DEFINED__
-typedef interface IAudioMute IAudioMute;
-#endif 	/* __IAudioMute_FWD_DEFINED__ */
-
-
-#ifndef __IAudioBass_FWD_DEFINED__
-#define __IAudioBass_FWD_DEFINED__
-typedef interface IAudioBass IAudioBass;
-#endif 	/* __IAudioBass_FWD_DEFINED__ */
-
-
-#ifndef __IAudioMidrange_FWD_DEFINED__
-#define __IAudioMidrange_FWD_DEFINED__
-typedef interface IAudioMidrange IAudioMidrange;
-#endif 	/* __IAudioMidrange_FWD_DEFINED__ */
-
-
-#ifndef __IAudioTreble_FWD_DEFINED__
-#define __IAudioTreble_FWD_DEFINED__
-typedef interface IAudioTreble IAudioTreble;
-#endif 	/* __IAudioTreble_FWD_DEFINED__ */
-
-
-#ifndef __IAudioAutoGainControl_FWD_DEFINED__
-#define __IAudioAutoGainControl_FWD_DEFINED__
-typedef interface IAudioAutoGainControl IAudioAutoGainControl;
-#endif 	/* __IAudioAutoGainControl_FWD_DEFINED__ */
-
-
-#ifndef __IAudioPeakMeter_FWD_DEFINED__
-#define __IAudioPeakMeter_FWD_DEFINED__
-typedef interface IAudioPeakMeter IAudioPeakMeter;
-#endif 	/* __IAudioPeakMeter_FWD_DEFINED__ */
-
-
-#ifndef __IDeviceSpecificProperty_FWD_DEFINED__
-#define __IDeviceSpecificProperty_FWD_DEFINED__
-typedef interface IDeviceSpecificProperty IDeviceSpecificProperty;
-#endif 	/* __IDeviceSpecificProperty_FWD_DEFINED__ */
-
-
-#ifndef __IKsFormatSupport_FWD_DEFINED__
-#define __IKsFormatSupport_FWD_DEFINED__
-typedef interface IKsFormatSupport IKsFormatSupport;
-#endif 	/* __IKsFormatSupport_FWD_DEFINED__ */
-
-
-#ifndef __IKsJackDescription_FWD_DEFINED__
-#define __IKsJackDescription_FWD_DEFINED__
-typedef interface IKsJackDescription IKsJackDescription;
-#endif 	/* __IKsJackDescription_FWD_DEFINED__ */
-
-
-#ifndef __IPartsList_FWD_DEFINED__
-#define __IPartsList_FWD_DEFINED__
-typedef interface IPartsList IPartsList;
-#endif 	/* __IPartsList_FWD_DEFINED__ */
-
-
-#ifndef __IPart_FWD_DEFINED__
-#define __IPart_FWD_DEFINED__
-typedef interface IPart IPart;
-#endif 	/* __IPart_FWD_DEFINED__ */
-
-
-#ifndef __IConnector_FWD_DEFINED__
-#define __IConnector_FWD_DEFINED__
-typedef interface IConnector IConnector;
-#endif 	/* __IConnector_FWD_DEFINED__ */
-
-
-#ifndef __ISubunit_FWD_DEFINED__
-#define __ISubunit_FWD_DEFINED__
-typedef interface ISubunit ISubunit;
-#endif 	/* __ISubunit_FWD_DEFINED__ */
-
-
-#ifndef __IControlInterface_FWD_DEFINED__
-#define __IControlInterface_FWD_DEFINED__
-typedef interface IControlInterface IControlInterface;
-#endif 	/* __IControlInterface_FWD_DEFINED__ */
-
-
-#ifndef __IControlChangeNotify_FWD_DEFINED__
-#define __IControlChangeNotify_FWD_DEFINED__
-typedef interface IControlChangeNotify IControlChangeNotify;
-#endif 	/* __IControlChangeNotify_FWD_DEFINED__ */
-
-
-#ifndef __IDeviceTopology_FWD_DEFINED__
-#define __IDeviceTopology_FWD_DEFINED__
-typedef interface IDeviceTopology IDeviceTopology;
-#endif 	/* __IDeviceTopology_FWD_DEFINED__ */
-
-
-#ifndef __DeviceTopology_FWD_DEFINED__
-#define __DeviceTopology_FWD_DEFINED__
-
-#ifdef __cplusplus
-typedef class DeviceTopology DeviceTopology;
-#else
-typedef struct DeviceTopology DeviceTopology;
-#endif /* __cplusplus */
-
-#endif 	/* __DeviceTopology_FWD_DEFINED__ */
-
-
-#ifndef __IPartsList_FWD_DEFINED__
-#define __IPartsList_FWD_DEFINED__
-typedef interface IPartsList IPartsList;
-#endif 	/* __IPartsList_FWD_DEFINED__ */
-
-
-#ifndef __IPerChannelDbLevel_FWD_DEFINED__
-#define __IPerChannelDbLevel_FWD_DEFINED__
-typedef interface IPerChannelDbLevel IPerChannelDbLevel;
-#endif 	/* __IPerChannelDbLevel_FWD_DEFINED__ */
-
-
-#ifndef __IAudioVolumeLevel_FWD_DEFINED__
-#define __IAudioVolumeLevel_FWD_DEFINED__
-typedef interface IAudioVolumeLevel IAudioVolumeLevel;
-#endif 	/* __IAudioVolumeLevel_FWD_DEFINED__ */
-
-
-#ifndef __IAudioLoudness_FWD_DEFINED__
-#define __IAudioLoudness_FWD_DEFINED__
-typedef interface IAudioLoudness IAudioLoudness;
-#endif 	/* __IAudioLoudness_FWD_DEFINED__ */
-
-
-#ifndef __IAudioInputSelector_FWD_DEFINED__
-#define __IAudioInputSelector_FWD_DEFINED__
-typedef interface IAudioInputSelector IAudioInputSelector;
-#endif 	/* __IAudioInputSelector_FWD_DEFINED__ */
-
-
-#ifndef __IAudioMute_FWD_DEFINED__
-#define __IAudioMute_FWD_DEFINED__
-typedef interface IAudioMute IAudioMute;
-#endif 	/* __IAudioMute_FWD_DEFINED__ */
-
-
-#ifndef __IAudioBass_FWD_DEFINED__
-#define __IAudioBass_FWD_DEFINED__
-typedef interface IAudioBass IAudioBass;
-#endif 	/* __IAudioBass_FWD_DEFINED__ */
-
-
-#ifndef __IAudioMidrange_FWD_DEFINED__
-#define __IAudioMidrange_FWD_DEFINED__
-typedef interface IAudioMidrange IAudioMidrange;
-#endif 	/* __IAudioMidrange_FWD_DEFINED__ */
-
-
-#ifndef __IAudioTreble_FWD_DEFINED__
-#define __IAudioTreble_FWD_DEFINED__
-typedef interface IAudioTreble IAudioTreble;
-#endif 	/* __IAudioTreble_FWD_DEFINED__ */
-
-
-#ifndef __IAudioAutoGainControl_FWD_DEFINED__
-#define __IAudioAutoGainControl_FWD_DEFINED__
-typedef interface IAudioAutoGainControl IAudioAutoGainControl;
-#endif 	/* __IAudioAutoGainControl_FWD_DEFINED__ */
-
-
-#ifndef __IAudioOutputSelector_FWD_DEFINED__
-#define __IAudioOutputSelector_FWD_DEFINED__
-typedef interface IAudioOutputSelector IAudioOutputSelector;
-#endif 	/* __IAudioOutputSelector_FWD_DEFINED__ */
-
-
-#ifndef __IAudioPeakMeter_FWD_DEFINED__
-#define __IAudioPeakMeter_FWD_DEFINED__
-typedef interface IAudioPeakMeter IAudioPeakMeter;
-#endif 	/* __IAudioPeakMeter_FWD_DEFINED__ */
-
-
-#ifndef __IDeviceSpecificProperty_FWD_DEFINED__
-#define __IDeviceSpecificProperty_FWD_DEFINED__
-typedef interface IDeviceSpecificProperty IDeviceSpecificProperty;
-#endif 	/* __IDeviceSpecificProperty_FWD_DEFINED__ */
-
-
-#ifndef __IKsFormatSupport_FWD_DEFINED__
-#define __IKsFormatSupport_FWD_DEFINED__
-typedef interface IKsFormatSupport IKsFormatSupport;
-#endif 	/* __IKsFormatSupport_FWD_DEFINED__ */
-
-
-/* header files for imported files */
-#include "oaidl.h"
-#include "ocidl.h"
-#include "propidl.h"
-
-#ifdef __cplusplus
-extern "C"{
-#endif 
-
-
-/* interface __MIDL_itf_devicetopology_0000_0000 */
-/* [local] */ 
-
-#define E_NOTFOUND HRESULT_FROM_WIN32(ERROR_NOT_FOUND)
-//
-//   Flag for clients of IControlChangeNotify::OnNotify to allow those clients to identify hardware initiated notifications
-//
-#define DEVTOPO_HARDWARE_INITIATED_EVENTCONTEXT 'draH'
-/* E2C2E9DE-09B1-4B04-84E5-07931225EE04 */
-DEFINE_GUID(EVENTCONTEXT_VOLUMESLIDER, 0xE2C2E9DE,0x09B1,0x4B04,0x84, 0xE5, 0x07, 0x93, 0x12, 0x25, 0xEE, 0x04);
-#define _IKsControl_
-#include "ks.h"
-#include "ksmedia.h"
-#ifndef _KS_
-typedef /* [public] */ struct __MIDL___MIDL_itf_devicetopology_0000_0000_0001
-    {
-    ULONG FormatSize;
-    ULONG Flags;
-    ULONG SampleSize;
-    ULONG Reserved;
-    GUID MajorFormat;
-    GUID SubFormat;
-    GUID Specifier;
-    } 	KSDATAFORMAT;
-
-typedef struct __MIDL___MIDL_itf_devicetopology_0000_0000_0001 *PKSDATAFORMAT;
-
-typedef /* [public][public][public][public][public][public][public][public][public][public] */ struct __MIDL___MIDL_itf_devicetopology_0000_0000_0002
-    {
-    union 
-        {
-        struct 
-            {
-            GUID Set;
-            ULONG Id;
-            ULONG Flags;
-            } 	;
-        LONGLONG Alignment;
-        } 	;
-    } 	KSIDENTIFIER;
-
-typedef struct __MIDL___MIDL_itf_devicetopology_0000_0000_0002 *PKSIDENTIFIER;
-
-typedef /* [public][public][public][public] */ 
-enum __MIDL___MIDL_itf_devicetopology_0000_0000_0005
-    {	ePcxChanMap_FL_FR	= 0,
-	ePcxChanMap_FC_LFE	= ( ePcxChanMap_FL_FR + 1 ) ,
-	ePcxChanMap_BL_BR	= ( ePcxChanMap_FC_LFE + 1 ) ,
-	ePcxChanMap_FLC_FRC	= ( ePcxChanMap_BL_BR + 1 ) ,
-	ePcxChanMap_SL_SR	= ( ePcxChanMap_FLC_FRC + 1 ) ,
-	ePcxChanMap_Unknown	= ( ePcxChanMap_SL_SR + 1 ) 
-    } 	EChannelMapping;
-
-typedef /* [public][public][public][public] */ 
-enum __MIDL___MIDL_itf_devicetopology_0000_0000_0006
-    {	eConnTypeUnknown	= 0,
-	eConnTypeEighth	= ( eConnTypeUnknown + 1 ) ,
-	eConnTypeQuarter	= ( eConnTypeEighth + 1 ) ,
-	eConnTypeAtapiInternal	= ( eConnTypeQuarter + 1 ) ,
-	eConnTypeRCA	= ( eConnTypeAtapiInternal + 1 ) ,
-	eConnTypeOptical	= ( eConnTypeRCA + 1 ) ,
-	eConnTypeOtherDigital	= ( eConnTypeOptical + 1 ) ,
-	eConnTypeOtherAnalog	= ( eConnTypeOtherDigital + 1 ) ,
-	eConnTypeMultichannelAnalogDIN	= ( eConnTypeOtherAnalog + 1 ) ,
-	eConnTypeXlrProfessional	= ( eConnTypeMultichannelAnalogDIN + 1 ) ,
-	eConnTypeRJ11Modem	= ( eConnTypeXlrProfessional + 1 ) ,
-	eConnTypeCombination	= ( eConnTypeRJ11Modem + 1 ) 
-    } 	EPcxConnectionType;
-
-typedef /* [public][public][public][public] */ 
-enum __MIDL___MIDL_itf_devicetopology_0000_0000_0007
-    {	eGeoLocRear	= 0x1,
-	eGeoLocFront	= ( eGeoLocRear + 1 ) ,
-	eGeoLocLeft	= ( eGeoLocFront + 1 ) ,
-	eGeoLocRight	= ( eGeoLocLeft + 1 ) ,
-	eGeoLocTop	= ( eGeoLocRight + 1 ) ,
-	eGeoLocBottom	= ( eGeoLocTop + 1 ) ,
-	eGeoLocRearOPanel	= ( eGeoLocBottom + 1 ) ,
-	eGeoLocRiser	= ( eGeoLocRearOPanel + 1 ) ,
-	eGeoLocInsideMobileLid	= ( eGeoLocRiser + 1 ) ,
-	eGeoLocDrivebay	= ( eGeoLocInsideMobileLid + 1 ) ,
-	eGeoLocHDMI	= ( eGeoLocDrivebay + 1 ) ,
-	eGeoLocOutsideMobileLid	= ( eGeoLocHDMI + 1 ) ,
-	eGeoLocATAPI	= ( eGeoLocOutsideMobileLid + 1 ) ,
-	eGeoLocReserved5	= ( eGeoLocATAPI + 1 ) ,
-	eGeoLocReserved6	= ( eGeoLocReserved5 + 1 ) 
-    } 	EPcxGeoLocation;
-
-typedef /* [public][public][public][public] */ 
-enum __MIDL___MIDL_itf_devicetopology_0000_0000_0008
-    {	eGenLocPrimaryBox	= 0,
-	eGenLocInternal	= ( eGenLocPrimaryBox + 1 ) ,
-	eGenLocSeperate	= ( eGenLocInternal + 1 ) ,
-	eGenLocOther	= ( eGenLocSeperate + 1 ) 
-    } 	EPcxGenLocation;
-
-typedef /* [public][public][public][public] */ 
-enum __MIDL___MIDL_itf_devicetopology_0000_0000_0009
-    {	ePortConnJack	= 0,
-	ePortConnIntegratedDevice	= ( ePortConnJack + 1 ) ,
-	ePortConnBothIntegratedAndJack	= ( ePortConnIntegratedDevice + 1 ) ,
-	ePortConnUnknown	= ( ePortConnBothIntegratedAndJack + 1 ) 
-    } 	EPxcPortConnection;
-
-typedef /* [public][public] */ struct __MIDL___MIDL_itf_devicetopology_0000_0000_0010
-    {
-    EChannelMapping ChannelMapping;
-    COLORREF Color;
-    EPcxConnectionType ConnectionType;
-    EPcxGeoLocation GeoLocation;
-    EPcxGenLocation GenLocation;
-    EPxcPortConnection PortConnection;
-    BOOL IsConnected;
-    } 	KSJACK_DESCRIPTION;
-
-typedef struct __MIDL___MIDL_itf_devicetopology_0000_0000_0010 *PKSJACK_DESCRIPTION;
-
-typedef KSIDENTIFIER KSPROPERTY;
-
-typedef KSIDENTIFIER *PKSPROPERTY;
-
-typedef KSIDENTIFIER KSMETHOD;
-
-typedef KSIDENTIFIER *PKSMETHOD;
-
-typedef KSIDENTIFIER KSEVENT;
-
-typedef KSIDENTIFIER *PKSEVENT;
-
-#endif
-
-
-
-
-
-
-
-
-typedef /* [public][public] */ 
-enum __MIDL___MIDL_itf_devicetopology_0000_0000_0011
-    {	In	= 0,
-	Out	= ( In + 1 ) 
-    } 	DataFlow;
-
-typedef /* [public][public] */ 
-enum __MIDL___MIDL_itf_devicetopology_0000_0000_0012
-    {	Connector	= 0,
-	Subunit	= ( Connector + 1 ) 
-    } 	PartType;
-
-#define PARTTYPE_FLAG_CONNECTOR 0x00010000
-#define PARTTYPE_FLAG_SUBUNIT   0x00020000
-#define PARTTYPE_MASK           0x00030000
-#define PARTID_MASK             0x0000ffff
-typedef /* [public][public] */ 
-enum __MIDL___MIDL_itf_devicetopology_0000_0000_0013
-    {	Unknown_Connector	= 0,
-	Physical_Internal	= ( Unknown_Connector + 1 ) ,
-	Physical_External	= ( Physical_Internal + 1 ) ,
-	Software_IO	= ( Physical_External + 1 ) ,
-	Software_Fixed	= ( Software_IO + 1 ) ,
-	Network	= ( Software_Fixed + 1 ) 
-    } 	ConnectorType;
-
-
-
-extern RPC_IF_HANDLE __MIDL_itf_devicetopology_0000_0000_v0_0_c_ifspec;
-extern RPC_IF_HANDLE __MIDL_itf_devicetopology_0000_0000_v0_0_s_ifspec;
-
-#ifndef __IKsControl_INTERFACE_DEFINED__
-#define __IKsControl_INTERFACE_DEFINED__
-
-/* interface IKsControl */
-/* [unique][helpstring][nonextensible][uuid][local][object] */ 
-
-
-EXTERN_C const IID IID_IKsControl;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("28F54685-06FD-11D2-B27A-00A0C9223196")
-    IKsControl : public IUnknown
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE KsProperty( 
-            /* [in] */ PKSPROPERTY Property,
-            /* [in] */ ULONG PropertyLength,
-            /* [out][in] */ void *PropertyData,
-            /* [in] */ ULONG DataLength,
-            /* [out] */ ULONG *BytesReturned) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE KsMethod( 
-            /* [in] */ PKSMETHOD Method,
-            /* [in] */ ULONG MethodLength,
-            /* [out][in] */ void *MethodData,
-            /* [in] */ ULONG DataLength,
-            /* [out] */ ULONG *BytesReturned) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE KsEvent( 
-            /* [in] */ PKSEVENT Event,
-            /* [in] */ ULONG EventLength,
-            /* [out][in] */ void *EventData,
-            /* [in] */ ULONG DataLength,
-            /* [out] */ ULONG *BytesReturned) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IKsControlVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IKsControl * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IKsControl * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IKsControl * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *KsProperty )( 
-            IKsControl * This,
-            /* [in] */ PKSPROPERTY Property,
-            /* [in] */ ULONG PropertyLength,
-            /* [out][in] */ void *PropertyData,
-            /* [in] */ ULONG DataLength,
-            /* [out] */ ULONG *BytesReturned);
-        
-        HRESULT ( STDMETHODCALLTYPE *KsMethod )( 
-            IKsControl * This,
-            /* [in] */ PKSMETHOD Method,
-            /* [in] */ ULONG MethodLength,
-            /* [out][in] */ void *MethodData,
-            /* [in] */ ULONG DataLength,
-            /* [out] */ ULONG *BytesReturned);
-        
-        HRESULT ( STDMETHODCALLTYPE *KsEvent )( 
-            IKsControl * This,
-            /* [in] */ PKSEVENT Event,
-            /* [in] */ ULONG EventLength,
-            /* [out][in] */ void *EventData,
-            /* [in] */ ULONG DataLength,
-            /* [out] */ ULONG *BytesReturned);
-        
-        END_INTERFACE
-    } IKsControlVtbl;
-
-    interface IKsControl
-    {
-        CONST_VTBL struct IKsControlVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IKsControl_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IKsControl_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IKsControl_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IKsControl_KsProperty(This,Property,PropertyLength,PropertyData,DataLength,BytesReturned)	\
-    ( (This)->lpVtbl -> KsProperty(This,Property,PropertyLength,PropertyData,DataLength,BytesReturned) ) 
-
-#define IKsControl_KsMethod(This,Method,MethodLength,MethodData,DataLength,BytesReturned)	\
-    ( (This)->lpVtbl -> KsMethod(This,Method,MethodLength,MethodData,DataLength,BytesReturned) ) 
-
-#define IKsControl_KsEvent(This,Event,EventLength,EventData,DataLength,BytesReturned)	\
-    ( (This)->lpVtbl -> KsEvent(This,Event,EventLength,EventData,DataLength,BytesReturned) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IKsControl_INTERFACE_DEFINED__ */
-
-
-#ifndef __IPerChannelDbLevel_INTERFACE_DEFINED__
-#define __IPerChannelDbLevel_INTERFACE_DEFINED__
-
-/* interface IPerChannelDbLevel */
-/* [unique][helpstring][nonextensible][uuid][local][object] */ 
-
-
-EXTERN_C const IID IID_IPerChannelDbLevel;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("C2F8E001-F205-4BC9-99BC-C13B1E048CCB")
-    IPerChannelDbLevel : public IUnknown
-    {
-    public:
-        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetChannelCount( 
-            /* [out] */ 
-            __out  UINT *pcChannels) = 0;
-        
-        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetLevelRange( 
-            /* [in] */ 
-            __in  UINT nChannel,
-            /* [out] */ 
-            __out  float *pfMinLevelDB,
-            /* [out] */ 
-            __out  float *pfMaxLevelDB,
-            /* [out] */ 
-            __out  float *pfStepping) = 0;
-        
-        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetLevel( 
-            /* [in] */ 
-            __in  UINT nChannel,
-            /* [out] */ 
-            __out  float *pfLevelDB) = 0;
-        
-        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE SetLevel( 
-            /* [in] */ 
-            __in  UINT nChannel,
-            /* [in] */ 
-            __in  float fLevelDB,
-            /* [unique][in] */ 
-            __in_opt  LPCGUID pguidEventContext) = 0;
-        
-        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE SetLevelUniform( 
-            /* [in] */ 
-            __in  float fLevelDB,
-            /* [unique][in] */ 
-            __in_opt  LPCGUID pguidEventContext) = 0;
-        
-        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE SetLevelAllChannels( 
-            /* [size_is][in] */ 
-            __in_ecount(cChannels)  float aLevelsDB[  ],
-            /* [in] */ 
-            __in  ULONG cChannels,
-            /* [unique][in] */ 
-            __in_opt  LPCGUID pguidEventContext) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IPerChannelDbLevelVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IPerChannelDbLevel * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IPerChannelDbLevel * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IPerChannelDbLevel * This);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetChannelCount )( 
-            IPerChannelDbLevel * This,
-            /* [out] */ 
-            __out  UINT *pcChannels);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetLevelRange )( 
-            IPerChannelDbLevel * This,
-            /* [in] */ 
-            __in  UINT nChannel,
-            /* [out] */ 
-            __out  float *pfMinLevelDB,
-            /* [out] */ 
-            __out  float *pfMaxLevelDB,
-            /* [out] */ 
-            __out  float *pfStepping);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetLevel )( 
-            IPerChannelDbLevel * This,
-            /* [in] */ 
-            __in  UINT nChannel,
-            /* [out] */ 
-            __out  float *pfLevelDB);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *SetLevel )( 
-            IPerChannelDbLevel * This,
-            /* [in] */ 
-            __in  UINT nChannel,
-            /* [in] */ 
-            __in  float fLevelDB,
-            /* [unique][in] */ 
-            __in_opt  LPCGUID pguidEventContext);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *SetLevelUniform )( 
-            IPerChannelDbLevel * This,
-            /* [in] */ 
-            __in  float fLevelDB,
-            /* [unique][in] */ 
-            __in_opt  LPCGUID pguidEventContext);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *SetLevelAllChannels )( 
-            IPerChannelDbLevel * This,
-            /* [size_is][in] */ 
-            __in_ecount(cChannels)  float aLevelsDB[  ],
-            /* [in] */ 
-            __in  ULONG cChannels,
-            /* [unique][in] */ 
-            __in_opt  LPCGUID pguidEventContext);
-        
-        END_INTERFACE
-    } IPerChannelDbLevelVtbl;
-
-    interface IPerChannelDbLevel
-    {
-        CONST_VTBL struct IPerChannelDbLevelVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IPerChannelDbLevel_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IPerChannelDbLevel_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IPerChannelDbLevel_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IPerChannelDbLevel_GetChannelCount(This,pcChannels)	\
-    ( (This)->lpVtbl -> GetChannelCount(This,pcChannels) ) 
-
-#define IPerChannelDbLevel_GetLevelRange(This,nChannel,pfMinLevelDB,pfMaxLevelDB,pfStepping)	\
-    ( (This)->lpVtbl -> GetLevelRange(This,nChannel,pfMinLevelDB,pfMaxLevelDB,pfStepping) ) 
-
-#define IPerChannelDbLevel_GetLevel(This,nChannel,pfLevelDB)	\
-    ( (This)->lpVtbl -> GetLevel(This,nChannel,pfLevelDB) ) 
-
-#define IPerChannelDbLevel_SetLevel(This,nChannel,fLevelDB,pguidEventContext)	\
-    ( (This)->lpVtbl -> SetLevel(This,nChannel,fLevelDB,pguidEventContext) ) 
-
-#define IPerChannelDbLevel_SetLevelUniform(This,fLevelDB,pguidEventContext)	\
-    ( (This)->lpVtbl -> SetLevelUniform(This,fLevelDB,pguidEventContext) ) 
-
-#define IPerChannelDbLevel_SetLevelAllChannels(This,aLevelsDB,cChannels,pguidEventContext)	\
-    ( (This)->lpVtbl -> SetLevelAllChannels(This,aLevelsDB,cChannels,pguidEventContext) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IPerChannelDbLevel_INTERFACE_DEFINED__ */
-
-
-#ifndef __IAudioVolumeLevel_INTERFACE_DEFINED__
-#define __IAudioVolumeLevel_INTERFACE_DEFINED__
-
-/* interface IAudioVolumeLevel */
-/* [unique][helpstring][nonextensible][uuid][local][object] */ 
-
-
-EXTERN_C const IID IID_IAudioVolumeLevel;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("7FB7B48F-531D-44A2-BCB3-5AD5A134B3DC")
-    IAudioVolumeLevel : public IPerChannelDbLevel
-    {
-    public:
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IAudioVolumeLevelVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IAudioVolumeLevel * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IAudioVolumeLevel * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IAudioVolumeLevel * This);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetChannelCount )( 
-            IAudioVolumeLevel * This,
-            /* [out] */ 
-            __out  UINT *pcChannels);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetLevelRange )( 
-            IAudioVolumeLevel * This,
-            /* [in] */ 
-            __in  UINT nChannel,
-            /* [out] */ 
-            __out  float *pfMinLevelDB,
-            /* [out] */ 
-            __out  float *pfMaxLevelDB,
-            /* [out] */ 
-            __out  float *pfStepping);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetLevel )( 
-            IAudioVolumeLevel * This,
-            /* [in] */ 
-            __in  UINT nChannel,
-            /* [out] */ 
-            __out  float *pfLevelDB);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *SetLevel )( 
-            IAudioVolumeLevel * This,
-            /* [in] */ 
-            __in  UINT nChannel,
-            /* [in] */ 
-            __in  float fLevelDB,
-            /* [unique][in] */ 
-            __in_opt  LPCGUID pguidEventContext);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *SetLevelUniform )( 
-            IAudioVolumeLevel * This,
-            /* [in] */ 
-            __in  float fLevelDB,
-            /* [unique][in] */ 
-            __in_opt  LPCGUID pguidEventContext);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *SetLevelAllChannels )( 
-            IAudioVolumeLevel * This,
-            /* [size_is][in] */ 
-            __in_ecount(cChannels)  float aLevelsDB[  ],
-            /* [in] */ 
-            __in  ULONG cChannels,
-            /* [unique][in] */ 
-            __in_opt  LPCGUID pguidEventContext);
-        
-        END_INTERFACE
-    } IAudioVolumeLevelVtbl;
-
-    interface IAudioVolumeLevel
-    {
-        CONST_VTBL struct IAudioVolumeLevelVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IAudioVolumeLevel_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IAudioVolumeLevel_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IAudioVolumeLevel_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IAudioVolumeLevel_GetChannelCount(This,pcChannels)	\
-    ( (This)->lpVtbl -> GetChannelCount(This,pcChannels) ) 
-
-#define IAudioVolumeLevel_GetLevelRange(This,nChannel,pfMinLevelDB,pfMaxLevelDB,pfStepping)	\
-    ( (This)->lpVtbl -> GetLevelRange(This,nChannel,pfMinLevelDB,pfMaxLevelDB,pfStepping) ) 
-
-#define IAudioVolumeLevel_GetLevel(This,nChannel,pfLevelDB)	\
-    ( (This)->lpVtbl -> GetLevel(This,nChannel,pfLevelDB) ) 
-
-#define IAudioVolumeLevel_SetLevel(This,nChannel,fLevelDB,pguidEventContext)	\
-    ( (This)->lpVtbl -> SetLevel(This,nChannel,fLevelDB,pguidEventContext) ) 
-
-#define IAudioVolumeLevel_SetLevelUniform(This,fLevelDB,pguidEventContext)	\
-    ( (This)->lpVtbl -> SetLevelUniform(This,fLevelDB,pguidEventContext) ) 
-
-#define IAudioVolumeLevel_SetLevelAllChannels(This,aLevelsDB,cChannels,pguidEventContext)	\
-    ( (This)->lpVtbl -> SetLevelAllChannels(This,aLevelsDB,cChannels,pguidEventContext) ) 
-
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IAudioVolumeLevel_INTERFACE_DEFINED__ */
-
-
-#ifndef __IAudioChannelConfig_INTERFACE_DEFINED__
-#define __IAudioChannelConfig_INTERFACE_DEFINED__
-
-/* interface IAudioChannelConfig */
-/* [unique][helpstring][nonextensible][uuid][local][object] */ 
-
-
-EXTERN_C const IID IID_IAudioChannelConfig;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("BB11C46F-EC28-493C-B88A-5DB88062CE98")
-    IAudioChannelConfig : public IUnknown
-    {
-    public:
-        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE SetChannelConfig( 
-            /* [in] */ DWORD dwConfig,
-            /* [unique][in] */ 
-            __in_opt  LPCGUID pguidEventContext) = 0;
-        
-        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetChannelConfig( 
-            /* [retval][out] */ DWORD *pdwConfig) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IAudioChannelConfigVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IAudioChannelConfig * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IAudioChannelConfig * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IAudioChannelConfig * This);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *SetChannelConfig )( 
-            IAudioChannelConfig * This,
-            /* [in] */ DWORD dwConfig,
-            /* [unique][in] */ 
-            __in_opt  LPCGUID pguidEventContext);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetChannelConfig )( 
-            IAudioChannelConfig * This,
-            /* [retval][out] */ DWORD *pdwConfig);
-        
-        END_INTERFACE
-    } IAudioChannelConfigVtbl;
-
-    interface IAudioChannelConfig
-    {
-        CONST_VTBL struct IAudioChannelConfigVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IAudioChannelConfig_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IAudioChannelConfig_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IAudioChannelConfig_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IAudioChannelConfig_SetChannelConfig(This,dwConfig,pguidEventContext)	\
-    ( (This)->lpVtbl -> SetChannelConfig(This,dwConfig,pguidEventContext) ) 
-
-#define IAudioChannelConfig_GetChannelConfig(This,pdwConfig)	\
-    ( (This)->lpVtbl -> GetChannelConfig(This,pdwConfig) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IAudioChannelConfig_INTERFACE_DEFINED__ */
-
-
-#ifndef __IAudioLoudness_INTERFACE_DEFINED__
-#define __IAudioLoudness_INTERFACE_DEFINED__
-
-/* interface IAudioLoudness */
-/* [unique][helpstring][nonextensible][uuid][local][object] */ 
-
-
-EXTERN_C const IID IID_IAudioLoudness;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("7D8B1437-DD53-4350-9C1B-1EE2890BD938")
-    IAudioLoudness : public IUnknown
-    {
-    public:
-        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetEnabled( 
-            /* [out] */ 
-            __out  BOOL *pbEnabled) = 0;
-        
-        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE SetEnabled( 
-            /* [in] */ 
-            __in  BOOL bEnable,
-            /* [unique][in] */ 
-            __in_opt  LPCGUID pguidEventContext) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IAudioLoudnessVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IAudioLoudness * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IAudioLoudness * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IAudioLoudness * This);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetEnabled )( 
-            IAudioLoudness * This,
-            /* [out] */ 
-            __out  BOOL *pbEnabled);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *SetEnabled )( 
-            IAudioLoudness * This,
-            /* [in] */ 
-            __in  BOOL bEnable,
-            /* [unique][in] */ 
-            __in_opt  LPCGUID pguidEventContext);
-        
-        END_INTERFACE
-    } IAudioLoudnessVtbl;
-
-    interface IAudioLoudness
-    {
-        CONST_VTBL struct IAudioLoudnessVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IAudioLoudness_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IAudioLoudness_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IAudioLoudness_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IAudioLoudness_GetEnabled(This,pbEnabled)	\
-    ( (This)->lpVtbl -> GetEnabled(This,pbEnabled) ) 
-
-#define IAudioLoudness_SetEnabled(This,bEnable,pguidEventContext)	\
-    ( (This)->lpVtbl -> SetEnabled(This,bEnable,pguidEventContext) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IAudioLoudness_INTERFACE_DEFINED__ */
-
-
-#ifndef __IAudioInputSelector_INTERFACE_DEFINED__
-#define __IAudioInputSelector_INTERFACE_DEFINED__
-
-/* interface IAudioInputSelector */
-/* [unique][helpstring][nonextensible][uuid][local][object] */ 
-
-
-EXTERN_C const IID IID_IAudioInputSelector;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("4F03DC02-5E6E-4653-8F72-A030C123D598")
-    IAudioInputSelector : public IUnknown
-    {
-    public:
-        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetSelection( 
-            /* [out] */ 
-            __out  UINT *pnIdSelected) = 0;
-        
-        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE SetSelection( 
-            /* [in] */ 
-            __in  UINT nIdSelect,
-            /* [unique][in] */ 
-            __in_opt  LPCGUID pguidEventContext) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IAudioInputSelectorVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IAudioInputSelector * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IAudioInputSelector * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IAudioInputSelector * This);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetSelection )( 
-            IAudioInputSelector * This,
-            /* [out] */ 
-            __out  UINT *pnIdSelected);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *SetSelection )( 
-            IAudioInputSelector * This,
-            /* [in] */ 
-            __in  UINT nIdSelect,
-            /* [unique][in] */ 
-            __in_opt  LPCGUID pguidEventContext);
-        
-        END_INTERFACE
-    } IAudioInputSelectorVtbl;
-
-    interface IAudioInputSelector
-    {
-        CONST_VTBL struct IAudioInputSelectorVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IAudioInputSelector_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IAudioInputSelector_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IAudioInputSelector_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IAudioInputSelector_GetSelection(This,pnIdSelected)	\
-    ( (This)->lpVtbl -> GetSelection(This,pnIdSelected) ) 
-
-#define IAudioInputSelector_SetSelection(This,nIdSelect,pguidEventContext)	\
-    ( (This)->lpVtbl -> SetSelection(This,nIdSelect,pguidEventContext) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IAudioInputSelector_INTERFACE_DEFINED__ */
-
-
-#ifndef __IAudioOutputSelector_INTERFACE_DEFINED__
-#define __IAudioOutputSelector_INTERFACE_DEFINED__
-
-/* interface IAudioOutputSelector */
-/* [unique][helpstring][nonextensible][uuid][local][object] */ 
-
-
-EXTERN_C const IID IID_IAudioOutputSelector;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("BB515F69-94A7-429e-8B9C-271B3F11A3AB")
-    IAudioOutputSelector : public IUnknown
-    {
-    public:
-        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetSelection( 
-            /* [out] */ 
-            __out  UINT *pnIdSelected) = 0;
-        
-        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE SetSelection( 
-            /* [in] */ 
-            __in  UINT nIdSelect,
-            /* [unique][in] */ 
-            __in_opt  LPCGUID pguidEventContext) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IAudioOutputSelectorVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IAudioOutputSelector * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IAudioOutputSelector * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IAudioOutputSelector * This);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetSelection )( 
-            IAudioOutputSelector * This,
-            /* [out] */ 
-            __out  UINT *pnIdSelected);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *SetSelection )( 
-            IAudioOutputSelector * This,
-            /* [in] */ 
-            __in  UINT nIdSelect,
-            /* [unique][in] */ 
-            __in_opt  LPCGUID pguidEventContext);
-        
-        END_INTERFACE
-    } IAudioOutputSelectorVtbl;
-
-    interface IAudioOutputSelector
-    {
-        CONST_VTBL struct IAudioOutputSelectorVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IAudioOutputSelector_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IAudioOutputSelector_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IAudioOutputSelector_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IAudioOutputSelector_GetSelection(This,pnIdSelected)	\
-    ( (This)->lpVtbl -> GetSelection(This,pnIdSelected) ) 
-
-#define IAudioOutputSelector_SetSelection(This,nIdSelect,pguidEventContext)	\
-    ( (This)->lpVtbl -> SetSelection(This,nIdSelect,pguidEventContext) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IAudioOutputSelector_INTERFACE_DEFINED__ */
-
-
-#ifndef __IAudioMute_INTERFACE_DEFINED__
-#define __IAudioMute_INTERFACE_DEFINED__
-
-/* interface IAudioMute */
-/* [unique][helpstring][nonextensible][uuid][local][object] */ 
-
-
-EXTERN_C const IID IID_IAudioMute;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("DF45AEEA-B74A-4B6B-AFAD-2366B6AA012E")
-    IAudioMute : public IUnknown
-    {
-    public:
-        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE SetMute( 
-            /* [in] */ 
-            __in  BOOL bMuted,
-            /* [unique][in] */ 
-            __in_opt  LPCGUID pguidEventContext) = 0;
-        
-        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetMute( 
-            /* [out] */ 
-            __out  BOOL *pbMuted) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IAudioMuteVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IAudioMute * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IAudioMute * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IAudioMute * This);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *SetMute )( 
-            IAudioMute * This,
-            /* [in] */ 
-            __in  BOOL bMuted,
-            /* [unique][in] */ 
-            __in_opt  LPCGUID pguidEventContext);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetMute )( 
-            IAudioMute * This,
-            /* [out] */ 
-            __out  BOOL *pbMuted);
-        
-        END_INTERFACE
-    } IAudioMuteVtbl;
-
-    interface IAudioMute
-    {
-        CONST_VTBL struct IAudioMuteVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IAudioMute_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IAudioMute_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IAudioMute_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IAudioMute_SetMute(This,bMuted,pguidEventContext)	\
-    ( (This)->lpVtbl -> SetMute(This,bMuted,pguidEventContext) ) 
-
-#define IAudioMute_GetMute(This,pbMuted)	\
-    ( (This)->lpVtbl -> GetMute(This,pbMuted) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IAudioMute_INTERFACE_DEFINED__ */
-
-
-#ifndef __IAudioBass_INTERFACE_DEFINED__
-#define __IAudioBass_INTERFACE_DEFINED__
-
-/* interface IAudioBass */
-/* [unique][helpstring][nonextensible][uuid][local][object] */ 
-
-
-EXTERN_C const IID IID_IAudioBass;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("A2B1A1D9-4DB3-425D-A2B2-BD335CB3E2E5")
-    IAudioBass : public IPerChannelDbLevel
-    {
-    public:
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IAudioBassVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IAudioBass * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IAudioBass * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IAudioBass * This);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetChannelCount )( 
-            IAudioBass * This,
-            /* [out] */ 
-            __out  UINT *pcChannels);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetLevelRange )( 
-            IAudioBass * This,
-            /* [in] */ 
-            __in  UINT nChannel,
-            /* [out] */ 
-            __out  float *pfMinLevelDB,
-            /* [out] */ 
-            __out  float *pfMaxLevelDB,
-            /* [out] */ 
-            __out  float *pfStepping);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetLevel )( 
-            IAudioBass * This,
-            /* [in] */ 
-            __in  UINT nChannel,
-            /* [out] */ 
-            __out  float *pfLevelDB);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *SetLevel )( 
-            IAudioBass * This,
-            /* [in] */ 
-            __in  UINT nChannel,
-            /* [in] */ 
-            __in  float fLevelDB,
-            /* [unique][in] */ 
-            __in_opt  LPCGUID pguidEventContext);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *SetLevelUniform )( 
-            IAudioBass * This,
-            /* [in] */ 
-            __in  float fLevelDB,
-            /* [unique][in] */ 
-            __in_opt  LPCGUID pguidEventContext);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *SetLevelAllChannels )( 
-            IAudioBass * This,
-            /* [size_is][in] */ 
-            __in_ecount(cChannels)  float aLevelsDB[  ],
-            /* [in] */ 
-            __in  ULONG cChannels,
-            /* [unique][in] */ 
-            __in_opt  LPCGUID pguidEventContext);
-        
-        END_INTERFACE
-    } IAudioBassVtbl;
-
-    interface IAudioBass
-    {
-        CONST_VTBL struct IAudioBassVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IAudioBass_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IAudioBass_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IAudioBass_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IAudioBass_GetChannelCount(This,pcChannels)	\
-    ( (This)->lpVtbl -> GetChannelCount(This,pcChannels) ) 
-
-#define IAudioBass_GetLevelRange(This,nChannel,pfMinLevelDB,pfMaxLevelDB,pfStepping)	\
-    ( (This)->lpVtbl -> GetLevelRange(This,nChannel,pfMinLevelDB,pfMaxLevelDB,pfStepping) ) 
-
-#define IAudioBass_GetLevel(This,nChannel,pfLevelDB)	\
-    ( (This)->lpVtbl -> GetLevel(This,nChannel,pfLevelDB) ) 
-
-#define IAudioBass_SetLevel(This,nChannel,fLevelDB,pguidEventContext)	\
-    ( (This)->lpVtbl -> SetLevel(This,nChannel,fLevelDB,pguidEventContext) ) 
-
-#define IAudioBass_SetLevelUniform(This,fLevelDB,pguidEventContext)	\
-    ( (This)->lpVtbl -> SetLevelUniform(This,fLevelDB,pguidEventContext) ) 
-
-#define IAudioBass_SetLevelAllChannels(This,aLevelsDB,cChannels,pguidEventContext)	\
-    ( (This)->lpVtbl -> SetLevelAllChannels(This,aLevelsDB,cChannels,pguidEventContext) ) 
-
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IAudioBass_INTERFACE_DEFINED__ */
-
-
-#ifndef __IAudioMidrange_INTERFACE_DEFINED__
-#define __IAudioMidrange_INTERFACE_DEFINED__
-
-/* interface IAudioMidrange */
-/* [unique][helpstring][nonextensible][uuid][local][object] */ 
-
-
-EXTERN_C const IID IID_IAudioMidrange;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("5E54B6D7-B44B-40D9-9A9E-E691D9CE6EDF")
-    IAudioMidrange : public IPerChannelDbLevel
-    {
-    public:
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IAudioMidrangeVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IAudioMidrange * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IAudioMidrange * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IAudioMidrange * This);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetChannelCount )( 
-            IAudioMidrange * This,
-            /* [out] */ 
-            __out  UINT *pcChannels);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetLevelRange )( 
-            IAudioMidrange * This,
-            /* [in] */ 
-            __in  UINT nChannel,
-            /* [out] */ 
-            __out  float *pfMinLevelDB,
-            /* [out] */ 
-            __out  float *pfMaxLevelDB,
-            /* [out] */ 
-            __out  float *pfStepping);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetLevel )( 
-            IAudioMidrange * This,
-            /* [in] */ 
-            __in  UINT nChannel,
-            /* [out] */ 
-            __out  float *pfLevelDB);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *SetLevel )( 
-            IAudioMidrange * This,
-            /* [in] */ 
-            __in  UINT nChannel,
-            /* [in] */ 
-            __in  float fLevelDB,
-            /* [unique][in] */ 
-            __in_opt  LPCGUID pguidEventContext);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *SetLevelUniform )( 
-            IAudioMidrange * This,
-            /* [in] */ 
-            __in  float fLevelDB,
-            /* [unique][in] */ 
-            __in_opt  LPCGUID pguidEventContext);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *SetLevelAllChannels )( 
-            IAudioMidrange * This,
-            /* [size_is][in] */ 
-            __in_ecount(cChannels)  float aLevelsDB[  ],
-            /* [in] */ 
-            __in  ULONG cChannels,
-            /* [unique][in] */ 
-            __in_opt  LPCGUID pguidEventContext);
-        
-        END_INTERFACE
-    } IAudioMidrangeVtbl;
-
-    interface IAudioMidrange
-    {
-        CONST_VTBL struct IAudioMidrangeVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IAudioMidrange_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IAudioMidrange_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IAudioMidrange_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IAudioMidrange_GetChannelCount(This,pcChannels)	\
-    ( (This)->lpVtbl -> GetChannelCount(This,pcChannels) ) 
-
-#define IAudioMidrange_GetLevelRange(This,nChannel,pfMinLevelDB,pfMaxLevelDB,pfStepping)	\
-    ( (This)->lpVtbl -> GetLevelRange(This,nChannel,pfMinLevelDB,pfMaxLevelDB,pfStepping) ) 
-
-#define IAudioMidrange_GetLevel(This,nChannel,pfLevelDB)	\
-    ( (This)->lpVtbl -> GetLevel(This,nChannel,pfLevelDB) ) 
-
-#define IAudioMidrange_SetLevel(This,nChannel,fLevelDB,pguidEventContext)	\
-    ( (This)->lpVtbl -> SetLevel(This,nChannel,fLevelDB,pguidEventContext) ) 
-
-#define IAudioMidrange_SetLevelUniform(This,fLevelDB,pguidEventContext)	\
-    ( (This)->lpVtbl -> SetLevelUniform(This,fLevelDB,pguidEventContext) ) 
-
-#define IAudioMidrange_SetLevelAllChannels(This,aLevelsDB,cChannels,pguidEventContext)	\
-    ( (This)->lpVtbl -> SetLevelAllChannels(This,aLevelsDB,cChannels,pguidEventContext) ) 
-
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IAudioMidrange_INTERFACE_DEFINED__ */
-
-
-#ifndef __IAudioTreble_INTERFACE_DEFINED__
-#define __IAudioTreble_INTERFACE_DEFINED__
-
-/* interface IAudioTreble */
-/* [unique][helpstring][nonextensible][uuid][local][object] */ 
-
-
-EXTERN_C const IID IID_IAudioTreble;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("0A717812-694E-4907-B74B-BAFA5CFDCA7B")
-    IAudioTreble : public IPerChannelDbLevel
-    {
-    public:
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IAudioTrebleVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IAudioTreble * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IAudioTreble * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IAudioTreble * This);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetChannelCount )( 
-            IAudioTreble * This,
-            /* [out] */ 
-            __out  UINT *pcChannels);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetLevelRange )( 
-            IAudioTreble * This,
-            /* [in] */ 
-            __in  UINT nChannel,
-            /* [out] */ 
-            __out  float *pfMinLevelDB,
-            /* [out] */ 
-            __out  float *pfMaxLevelDB,
-            /* [out] */ 
-            __out  float *pfStepping);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetLevel )( 
-            IAudioTreble * This,
-            /* [in] */ 
-            __in  UINT nChannel,
-            /* [out] */ 
-            __out  float *pfLevelDB);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *SetLevel )( 
-            IAudioTreble * This,
-            /* [in] */ 
-            __in  UINT nChannel,
-            /* [in] */ 
-            __in  float fLevelDB,
-            /* [unique][in] */ 
-            __in_opt  LPCGUID pguidEventContext);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *SetLevelUniform )( 
-            IAudioTreble * This,
-            /* [in] */ 
-            __in  float fLevelDB,
-            /* [unique][in] */ 
-            __in_opt  LPCGUID pguidEventContext);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *SetLevelAllChannels )( 
-            IAudioTreble * This,
-            /* [size_is][in] */ 
-            __in_ecount(cChannels)  float aLevelsDB[  ],
-            /* [in] */ 
-            __in  ULONG cChannels,
-            /* [unique][in] */ 
-            __in_opt  LPCGUID pguidEventContext);
-        
-        END_INTERFACE
-    } IAudioTrebleVtbl;
-
-    interface IAudioTreble
-    {
-        CONST_VTBL struct IAudioTrebleVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IAudioTreble_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IAudioTreble_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IAudioTreble_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IAudioTreble_GetChannelCount(This,pcChannels)	\
-    ( (This)->lpVtbl -> GetChannelCount(This,pcChannels) ) 
-
-#define IAudioTreble_GetLevelRange(This,nChannel,pfMinLevelDB,pfMaxLevelDB,pfStepping)	\
-    ( (This)->lpVtbl -> GetLevelRange(This,nChannel,pfMinLevelDB,pfMaxLevelDB,pfStepping) ) 
-
-#define IAudioTreble_GetLevel(This,nChannel,pfLevelDB)	\
-    ( (This)->lpVtbl -> GetLevel(This,nChannel,pfLevelDB) ) 
-
-#define IAudioTreble_SetLevel(This,nChannel,fLevelDB,pguidEventContext)	\
-    ( (This)->lpVtbl -> SetLevel(This,nChannel,fLevelDB,pguidEventContext) ) 
-
-#define IAudioTreble_SetLevelUniform(This,fLevelDB,pguidEventContext)	\
-    ( (This)->lpVtbl -> SetLevelUniform(This,fLevelDB,pguidEventContext) ) 
-
-#define IAudioTreble_SetLevelAllChannels(This,aLevelsDB,cChannels,pguidEventContext)	\
-    ( (This)->lpVtbl -> SetLevelAllChannels(This,aLevelsDB,cChannels,pguidEventContext) ) 
-
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IAudioTreble_INTERFACE_DEFINED__ */
-
-
-#ifndef __IAudioAutoGainControl_INTERFACE_DEFINED__
-#define __IAudioAutoGainControl_INTERFACE_DEFINED__
-
-/* interface IAudioAutoGainControl */
-/* [unique][helpstring][nonextensible][uuid][local][object] */ 
-
-
-EXTERN_C const IID IID_IAudioAutoGainControl;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("85401FD4-6DE4-4b9d-9869-2D6753A82F3C")
-    IAudioAutoGainControl : public IUnknown
-    {
-    public:
-        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetEnabled( 
-            /* [out] */ 
-            __out  BOOL *pbEnabled) = 0;
-        
-        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE SetEnabled( 
-            /* [in] */ 
-            __in  BOOL bEnable,
-            /* [unique][in] */ 
-            __in_opt  LPCGUID pguidEventContext) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IAudioAutoGainControlVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IAudioAutoGainControl * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IAudioAutoGainControl * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IAudioAutoGainControl * This);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetEnabled )( 
-            IAudioAutoGainControl * This,
-            /* [out] */ 
-            __out  BOOL *pbEnabled);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *SetEnabled )( 
-            IAudioAutoGainControl * This,
-            /* [in] */ 
-            __in  BOOL bEnable,
-            /* [unique][in] */ 
-            __in_opt  LPCGUID pguidEventContext);
-        
-        END_INTERFACE
-    } IAudioAutoGainControlVtbl;
-
-    interface IAudioAutoGainControl
-    {
-        CONST_VTBL struct IAudioAutoGainControlVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IAudioAutoGainControl_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IAudioAutoGainControl_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IAudioAutoGainControl_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IAudioAutoGainControl_GetEnabled(This,pbEnabled)	\
-    ( (This)->lpVtbl -> GetEnabled(This,pbEnabled) ) 
-
-#define IAudioAutoGainControl_SetEnabled(This,bEnable,pguidEventContext)	\
-    ( (This)->lpVtbl -> SetEnabled(This,bEnable,pguidEventContext) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IAudioAutoGainControl_INTERFACE_DEFINED__ */
-
-
-#ifndef __IAudioPeakMeter_INTERFACE_DEFINED__
-#define __IAudioPeakMeter_INTERFACE_DEFINED__
-
-/* interface IAudioPeakMeter */
-/* [unique][helpstring][nonextensible][uuid][local][object] */ 
-
-
-EXTERN_C const IID IID_IAudioPeakMeter;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("DD79923C-0599-45e0-B8B6-C8DF7DB6E796")
-    IAudioPeakMeter : public IUnknown
-    {
-    public:
-        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetChannelCount( 
-            /* [out] */ 
-            __out  UINT *pcChannels) = 0;
-        
-        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetLevel( 
-            /* [in] */ 
-            __in  UINT nChannel,
-            /* [out] */ 
-            __out  float *pfLevel) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IAudioPeakMeterVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IAudioPeakMeter * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IAudioPeakMeter * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IAudioPeakMeter * This);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetChannelCount )( 
-            IAudioPeakMeter * This,
-            /* [out] */ 
-            __out  UINT *pcChannels);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetLevel )( 
-            IAudioPeakMeter * This,
-            /* [in] */ 
-            __in  UINT nChannel,
-            /* [out] */ 
-            __out  float *pfLevel);
-        
-        END_INTERFACE
-    } IAudioPeakMeterVtbl;
-
-    interface IAudioPeakMeter
-    {
-        CONST_VTBL struct IAudioPeakMeterVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IAudioPeakMeter_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IAudioPeakMeter_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IAudioPeakMeter_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IAudioPeakMeter_GetChannelCount(This,pcChannels)	\
-    ( (This)->lpVtbl -> GetChannelCount(This,pcChannels) ) 
-
-#define IAudioPeakMeter_GetLevel(This,nChannel,pfLevel)	\
-    ( (This)->lpVtbl -> GetLevel(This,nChannel,pfLevel) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IAudioPeakMeter_INTERFACE_DEFINED__ */
-
-
-#ifndef __IDeviceSpecificProperty_INTERFACE_DEFINED__
-#define __IDeviceSpecificProperty_INTERFACE_DEFINED__
-
-/* interface IDeviceSpecificProperty */
-/* [unique][helpstring][nonextensible][uuid][local][object] */ 
-
-
-EXTERN_C const IID IID_IDeviceSpecificProperty;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("3B22BCBF-2586-4af0-8583-205D391B807C")
-    IDeviceSpecificProperty : public IUnknown
-    {
-    public:
-        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetType( 
-            /* [out] */ 
-            __deref_out  VARTYPE *pVType) = 0;
-        
-        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetValue( 
-            /* [out] */ 
-            __out  void *pvValue,
-            /* [out][in] */ 
-            __inout  DWORD *pcbValue) = 0;
-        
-        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE SetValue( 
-            /* [in] */ 
-            __in  void *pvValue,
-            /* [in] */ DWORD cbValue,
-            /* [unique][in] */ 
-            __in_opt  LPCGUID pguidEventContext) = 0;
-        
-        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE Get4BRange( 
-            /* [out] */ 
-            __deref_out  LONG *plMin,
-            /* [out] */ 
-            __deref_out  LONG *plMax,
-            /* [out] */ 
-            __deref_out  LONG *plStepping) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IDeviceSpecificPropertyVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IDeviceSpecificProperty * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IDeviceSpecificProperty * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IDeviceSpecificProperty * This);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetType )( 
-            IDeviceSpecificProperty * This,
-            /* [out] */ 
-            __deref_out  VARTYPE *pVType);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetValue )( 
-            IDeviceSpecificProperty * This,
-            /* [out] */ 
-            __out  void *pvValue,
-            /* [out][in] */ 
-            __inout  DWORD *pcbValue);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *SetValue )( 
-            IDeviceSpecificProperty * This,
-            /* [in] */ 
-            __in  void *pvValue,
-            /* [in] */ DWORD cbValue,
-            /* [unique][in] */ 
-            __in_opt  LPCGUID pguidEventContext);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *Get4BRange )( 
-            IDeviceSpecificProperty * This,
-            /* [out] */ 
-            __deref_out  LONG *plMin,
-            /* [out] */ 
-            __deref_out  LONG *plMax,
-            /* [out] */ 
-            __deref_out  LONG *plStepping);
-        
-        END_INTERFACE
-    } IDeviceSpecificPropertyVtbl;
-
-    interface IDeviceSpecificProperty
-    {
-        CONST_VTBL struct IDeviceSpecificPropertyVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IDeviceSpecificProperty_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IDeviceSpecificProperty_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IDeviceSpecificProperty_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IDeviceSpecificProperty_GetType(This,pVType)	\
-    ( (This)->lpVtbl -> GetType(This,pVType) ) 
-
-#define IDeviceSpecificProperty_GetValue(This,pvValue,pcbValue)	\
-    ( (This)->lpVtbl -> GetValue(This,pvValue,pcbValue) ) 
-
-#define IDeviceSpecificProperty_SetValue(This,pvValue,cbValue,pguidEventContext)	\
-    ( (This)->lpVtbl -> SetValue(This,pvValue,cbValue,pguidEventContext) ) 
-
-#define IDeviceSpecificProperty_Get4BRange(This,plMin,plMax,plStepping)	\
-    ( (This)->lpVtbl -> Get4BRange(This,plMin,plMax,plStepping) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IDeviceSpecificProperty_INTERFACE_DEFINED__ */
-
-
-#ifndef __IKsFormatSupport_INTERFACE_DEFINED__
-#define __IKsFormatSupport_INTERFACE_DEFINED__
-
-/* interface IKsFormatSupport */
-/* [unique][helpstring][nonextensible][uuid][local][object] */ 
-
-
-EXTERN_C const IID IID_IKsFormatSupport;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("3CB4A69D-BB6F-4D2B-95B7-452D2C155DB5")
-    IKsFormatSupport : public IUnknown
-    {
-    public:
-        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE IsFormatSupported( 
-            /* [size_is][in] */ PKSDATAFORMAT pKsFormat,
-            /* [in] */ 
-            __in  DWORD cbFormat,
-            /* [out] */ 
-            __out  BOOL *pbSupported) = 0;
-        
-        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetDevicePreferredFormat( 
-            /* [out] */ PKSDATAFORMAT *ppKsFormat) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IKsFormatSupportVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IKsFormatSupport * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IKsFormatSupport * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IKsFormatSupport * This);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *IsFormatSupported )( 
-            IKsFormatSupport * This,
-            /* [size_is][in] */ PKSDATAFORMAT pKsFormat,
-            /* [in] */ 
-            __in  DWORD cbFormat,
-            /* [out] */ 
-            __out  BOOL *pbSupported);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetDevicePreferredFormat )( 
-            IKsFormatSupport * This,
-            /* [out] */ PKSDATAFORMAT *ppKsFormat);
-        
-        END_INTERFACE
-    } IKsFormatSupportVtbl;
-
-    interface IKsFormatSupport
-    {
-        CONST_VTBL struct IKsFormatSupportVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IKsFormatSupport_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IKsFormatSupport_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IKsFormatSupport_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IKsFormatSupport_IsFormatSupported(This,pKsFormat,cbFormat,pbSupported)	\
-    ( (This)->lpVtbl -> IsFormatSupported(This,pKsFormat,cbFormat,pbSupported) ) 
-
-#define IKsFormatSupport_GetDevicePreferredFormat(This,ppKsFormat)	\
-    ( (This)->lpVtbl -> GetDevicePreferredFormat(This,ppKsFormat) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IKsFormatSupport_INTERFACE_DEFINED__ */
-
-
-#ifndef __IKsJackDescription_INTERFACE_DEFINED__
-#define __IKsJackDescription_INTERFACE_DEFINED__
-
-/* interface IKsJackDescription */
-/* [unique][helpstring][nonextensible][uuid][local][object] */ 
-
-
-EXTERN_C const IID IID_IKsJackDescription;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("4509F757-2D46-4637-8E62-CE7DB944F57B")
-    IKsJackDescription : public IUnknown
-    {
-    public:
-        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetJackCount( 
-            /* [out] */ 
-            __out  UINT *pcJacks) = 0;
-        
-        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetJackDescription( 
-            /* [in] */ UINT nJack,
-            /* [out] */ 
-            __out  KSJACK_DESCRIPTION *pDescription) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IKsJackDescriptionVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IKsJackDescription * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IKsJackDescription * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IKsJackDescription * This);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetJackCount )( 
-            IKsJackDescription * This,
-            /* [out] */ 
-            __out  UINT *pcJacks);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetJackDescription )( 
-            IKsJackDescription * This,
-            /* [in] */ UINT nJack,
-            /* [out] */ 
-            __out  KSJACK_DESCRIPTION *pDescription);
-        
-        END_INTERFACE
-    } IKsJackDescriptionVtbl;
-
-    interface IKsJackDescription
-    {
-        CONST_VTBL struct IKsJackDescriptionVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IKsJackDescription_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IKsJackDescription_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IKsJackDescription_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IKsJackDescription_GetJackCount(This,pcJacks)	\
-    ( (This)->lpVtbl -> GetJackCount(This,pcJacks) ) 
-
-#define IKsJackDescription_GetJackDescription(This,nJack,pDescription)	\
-    ( (This)->lpVtbl -> GetJackDescription(This,nJack,pDescription) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IKsJackDescription_INTERFACE_DEFINED__ */
-
-
-#ifndef __IPartsList_INTERFACE_DEFINED__
-#define __IPartsList_INTERFACE_DEFINED__
-
-/* interface IPartsList */
-/* [object][unique][helpstring][uuid][local] */ 
-
-
-EXTERN_C const IID IID_IPartsList;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("6DAA848C-5EB0-45CC-AEA5-998A2CDA1FFB")
-    IPartsList : public IUnknown
-    {
-    public:
-        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetCount( 
-            /* [out] */ 
-            __out  UINT *pCount) = 0;
-        
-        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetPart( 
-            /* [in] */ 
-            __in  UINT nIndex,
-            /* [out] */ 
-            __out  IPart **ppPart) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IPartsListVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IPartsList * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IPartsList * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IPartsList * This);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetCount )( 
-            IPartsList * This,
-            /* [out] */ 
-            __out  UINT *pCount);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetPart )( 
-            IPartsList * This,
-            /* [in] */ 
-            __in  UINT nIndex,
-            /* [out] */ 
-            __out  IPart **ppPart);
-        
-        END_INTERFACE
-    } IPartsListVtbl;
-
-    interface IPartsList
-    {
-        CONST_VTBL struct IPartsListVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IPartsList_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IPartsList_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IPartsList_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IPartsList_GetCount(This,pCount)	\
-    ( (This)->lpVtbl -> GetCount(This,pCount) ) 
-
-#define IPartsList_GetPart(This,nIndex,ppPart)	\
-    ( (This)->lpVtbl -> GetPart(This,nIndex,ppPart) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IPartsList_INTERFACE_DEFINED__ */
-
-
-#ifndef __IPart_INTERFACE_DEFINED__
-#define __IPart_INTERFACE_DEFINED__
-
-/* interface IPart */
-/* [object][unique][helpstring][uuid][local] */ 
-
-
-EXTERN_C const IID IID_IPart;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("AE2DE0E4-5BCA-4F2D-AA46-5D13F8FDB3A9")
-    IPart : public IUnknown
-    {
-    public:
-        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetName( 
-            /* [out] */ 
-            __deref_out  LPWSTR *ppwstrName) = 0;
-        
-        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetLocalId( 
-            /* [out] */ 
-            __out  UINT *pnId) = 0;
-        
-        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetGlobalId( 
-            /* [out] */ 
-            __deref_out  LPWSTR *ppwstrGlobalId) = 0;
-        
-        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetPartType( 
-            /* [out] */ 
-            __out  PartType *pPartType) = 0;
-        
-        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetSubType( 
-            /* [out] */ GUID *pSubType) = 0;
-        
-        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetControlInterfaceCount( 
-            /* [out] */ 
-            __out  UINT *pCount) = 0;
-        
-        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetControlInterface( 
-            /* [in] */ 
-            __in  UINT nIndex,
-            /* [out] */ 
-            __out  IControlInterface **ppInterfaceDesc) = 0;
-        
-        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE EnumPartsIncoming( 
-            /* [out] */ 
-            __out  IPartsList **ppParts) = 0;
-        
-        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE EnumPartsOutgoing( 
-            /* [out] */ 
-            __out  IPartsList **ppParts) = 0;
-        
-        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetTopologyObject( 
-            /* [out] */ 
-            __out  IDeviceTopology **ppTopology) = 0;
-        
-        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE Activate( 
-            /* [in] */ 
-            __in  DWORD dwClsContext,
-            /* [in] */ 
-            __in  REFIID refiid,
-            /* [iid_is][out] */ 
-            __out_opt  void **ppvObject) = 0;
-        
-        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE RegisterControlChangeCallback( 
-            /* [in] */ 
-            __in  REFGUID riid,
-            /* [in] */ 
-            __in  IControlChangeNotify *pNotify) = 0;
-        
-        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE UnregisterControlChangeCallback( 
-            /* [in] */ 
-            __in  IControlChangeNotify *pNotify) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IPartVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IPart * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IPart * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IPart * This);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetName )( 
-            IPart * This,
-            /* [out] */ 
-            __deref_out  LPWSTR *ppwstrName);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetLocalId )( 
-            IPart * This,
-            /* [out] */ 
-            __out  UINT *pnId);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetGlobalId )( 
-            IPart * This,
-            /* [out] */ 
-            __deref_out  LPWSTR *ppwstrGlobalId);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetPartType )( 
-            IPart * This,
-            /* [out] */ 
-            __out  PartType *pPartType);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetSubType )( 
-            IPart * This,
-            /* [out] */ GUID *pSubType);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetControlInterfaceCount )( 
-            IPart * This,
-            /* [out] */ 
-            __out  UINT *pCount);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetControlInterface )( 
-            IPart * This,
-            /* [in] */ 
-            __in  UINT nIndex,
-            /* [out] */ 
-            __out  IControlInterface **ppInterfaceDesc);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *EnumPartsIncoming )( 
-            IPart * This,
-            /* [out] */ 
-            __out  IPartsList **ppParts);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *EnumPartsOutgoing )( 
-            IPart * This,
-            /* [out] */ 
-            __out  IPartsList **ppParts);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetTopologyObject )( 
-            IPart * This,
-            /* [out] */ 
-            __out  IDeviceTopology **ppTopology);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *Activate )( 
-            IPart * This,
-            /* [in] */ 
-            __in  DWORD dwClsContext,
-            /* [in] */ 
-            __in  REFIID refiid,
-            /* [iid_is][out] */ 
-            __out_opt  void **ppvObject);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *RegisterControlChangeCallback )( 
-            IPart * This,
-            /* [in] */ 
-            __in  REFGUID riid,
-            /* [in] */ 
-            __in  IControlChangeNotify *pNotify);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *UnregisterControlChangeCallback )( 
-            IPart * This,
-            /* [in] */ 
-            __in  IControlChangeNotify *pNotify);
-        
-        END_INTERFACE
-    } IPartVtbl;
-
-    interface IPart
-    {
-        CONST_VTBL struct IPartVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IPart_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IPart_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IPart_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IPart_GetName(This,ppwstrName)	\
-    ( (This)->lpVtbl -> GetName(This,ppwstrName) ) 
-
-#define IPart_GetLocalId(This,pnId)	\
-    ( (This)->lpVtbl -> GetLocalId(This,pnId) ) 
-
-#define IPart_GetGlobalId(This,ppwstrGlobalId)	\
-    ( (This)->lpVtbl -> GetGlobalId(This,ppwstrGlobalId) ) 
-
-#define IPart_GetPartType(This,pPartType)	\
-    ( (This)->lpVtbl -> GetPartType(This,pPartType) ) 
-
-#define IPart_GetSubType(This,pSubType)	\
-    ( (This)->lpVtbl -> GetSubType(This,pSubType) ) 
-
-#define IPart_GetControlInterfaceCount(This,pCount)	\
-    ( (This)->lpVtbl -> GetControlInterfaceCount(This,pCount) ) 
-
-#define IPart_GetControlInterface(This,nIndex,ppInterfaceDesc)	\
-    ( (This)->lpVtbl -> GetControlInterface(This,nIndex,ppInterfaceDesc) ) 
-
-#define IPart_EnumPartsIncoming(This,ppParts)	\
-    ( (This)->lpVtbl -> EnumPartsIncoming(This,ppParts) ) 
-
-#define IPart_EnumPartsOutgoing(This,ppParts)	\
-    ( (This)->lpVtbl -> EnumPartsOutgoing(This,ppParts) ) 
-
-#define IPart_GetTopologyObject(This,ppTopology)	\
-    ( (This)->lpVtbl -> GetTopologyObject(This,ppTopology) ) 
-
-#define IPart_Activate(This,dwClsContext,refiid,ppvObject)	\
-    ( (This)->lpVtbl -> Activate(This,dwClsContext,refiid,ppvObject) ) 
-
-#define IPart_RegisterControlChangeCallback(This,riid,pNotify)	\
-    ( (This)->lpVtbl -> RegisterControlChangeCallback(This,riid,pNotify) ) 
-
-#define IPart_UnregisterControlChangeCallback(This,pNotify)	\
-    ( (This)->lpVtbl -> UnregisterControlChangeCallback(This,pNotify) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IPart_INTERFACE_DEFINED__ */
-
-
-#ifndef __IConnector_INTERFACE_DEFINED__
-#define __IConnector_INTERFACE_DEFINED__
-
-/* interface IConnector */
-/* [object][unique][helpstring][uuid][local] */ 
-
-
-EXTERN_C const IID IID_IConnector;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("9c2c4058-23f5-41de-877a-df3af236a09e")
-    IConnector : public IUnknown
-    {
-    public:
-        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetType( 
-            /* [out] */ 
-            __out  ConnectorType *pType) = 0;
-        
-        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetDataFlow( 
-            /* [out] */ 
-            __out  DataFlow *pFlow) = 0;
-        
-        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ConnectTo( 
-            /* [in] */ 
-            __in  IConnector *pConnectTo) = 0;
-        
-        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE Disconnect( void) = 0;
-        
-        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE IsConnected( 
-            /* [out] */ 
-            __out  BOOL *pbConnected) = 0;
-        
-        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetConnectedTo( 
-            /* [out] */ 
-            __out  IConnector **ppConTo) = 0;
-        
-        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetConnectorIdConnectedTo( 
-            /* [out] */ 
-            __deref_out  LPWSTR *ppwstrConnectorId) = 0;
-        
-        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetDeviceIdConnectedTo( 
-            /* [out] */ 
-            __deref_out  LPWSTR *ppwstrDeviceId) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IConnectorVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IConnector * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IConnector * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IConnector * This);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetType )( 
-            IConnector * This,
-            /* [out] */ 
-            __out  ConnectorType *pType);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetDataFlow )( 
-            IConnector * This,
-            /* [out] */ 
-            __out  DataFlow *pFlow);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *ConnectTo )( 
-            IConnector * This,
-            /* [in] */ 
-            __in  IConnector *pConnectTo);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *Disconnect )( 
-            IConnector * This);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *IsConnected )( 
-            IConnector * This,
-            /* [out] */ 
-            __out  BOOL *pbConnected);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetConnectedTo )( 
-            IConnector * This,
-            /* [out] */ 
-            __out  IConnector **ppConTo);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetConnectorIdConnectedTo )( 
-            IConnector * This,
-            /* [out] */ 
-            __deref_out  LPWSTR *ppwstrConnectorId);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetDeviceIdConnectedTo )( 
-            IConnector * This,
-            /* [out] */ 
-            __deref_out  LPWSTR *ppwstrDeviceId);
-        
-        END_INTERFACE
-    } IConnectorVtbl;
-
-    interface IConnector
-    {
-        CONST_VTBL struct IConnectorVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IConnector_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IConnector_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IConnector_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IConnector_GetType(This,pType)	\
-    ( (This)->lpVtbl -> GetType(This,pType) ) 
-
-#define IConnector_GetDataFlow(This,pFlow)	\
-    ( (This)->lpVtbl -> GetDataFlow(This,pFlow) ) 
-
-#define IConnector_ConnectTo(This,pConnectTo)	\
-    ( (This)->lpVtbl -> ConnectTo(This,pConnectTo) ) 
-
-#define IConnector_Disconnect(This)	\
-    ( (This)->lpVtbl -> Disconnect(This) ) 
-
-#define IConnector_IsConnected(This,pbConnected)	\
-    ( (This)->lpVtbl -> IsConnected(This,pbConnected) ) 
-
-#define IConnector_GetConnectedTo(This,ppConTo)	\
-    ( (This)->lpVtbl -> GetConnectedTo(This,ppConTo) ) 
-
-#define IConnector_GetConnectorIdConnectedTo(This,ppwstrConnectorId)	\
-    ( (This)->lpVtbl -> GetConnectorIdConnectedTo(This,ppwstrConnectorId) ) 
-
-#define IConnector_GetDeviceIdConnectedTo(This,ppwstrDeviceId)	\
-    ( (This)->lpVtbl -> GetDeviceIdConnectedTo(This,ppwstrDeviceId) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IConnector_INTERFACE_DEFINED__ */
-
-
-#ifndef __ISubunit_INTERFACE_DEFINED__
-#define __ISubunit_INTERFACE_DEFINED__
-
-/* interface ISubunit */
-/* [object][unique][helpstring][uuid][local] */ 
-
-
-EXTERN_C const IID IID_ISubunit;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("82149A85-DBA6-4487-86BB-EA8F7FEFCC71")
-    ISubunit : public IUnknown
-    {
-    public:
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct ISubunitVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            ISubunit * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            ISubunit * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            ISubunit * This);
-        
-        END_INTERFACE
-    } ISubunitVtbl;
-
-    interface ISubunit
-    {
-        CONST_VTBL struct ISubunitVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define ISubunit_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define ISubunit_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define ISubunit_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __ISubunit_INTERFACE_DEFINED__ */
-
-
-#ifndef __IControlInterface_INTERFACE_DEFINED__
-#define __IControlInterface_INTERFACE_DEFINED__
-
-/* interface IControlInterface */
-/* [object][unique][helpstring][uuid][local] */ 
-
-
-EXTERN_C const IID IID_IControlInterface;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("45d37c3f-5140-444a-ae24-400789f3cbf3")
-    IControlInterface : public IUnknown
-    {
-    public:
-        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetName( 
-            /* [out] */ 
-            __deref_out  LPWSTR *ppwstrName) = 0;
-        
-        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetIID( 
-            /* [out] */ 
-            __out  GUID *pIID) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IControlInterfaceVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IControlInterface * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IControlInterface * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IControlInterface * This);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetName )( 
-            IControlInterface * This,
-            /* [out] */ 
-            __deref_out  LPWSTR *ppwstrName);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetIID )( 
-            IControlInterface * This,
-            /* [out] */ 
-            __out  GUID *pIID);
-        
-        END_INTERFACE
-    } IControlInterfaceVtbl;
-
-    interface IControlInterface
-    {
-        CONST_VTBL struct IControlInterfaceVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IControlInterface_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IControlInterface_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IControlInterface_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IControlInterface_GetName(This,ppwstrName)	\
-    ( (This)->lpVtbl -> GetName(This,ppwstrName) ) 
-
-#define IControlInterface_GetIID(This,pIID)	\
-    ( (This)->lpVtbl -> GetIID(This,pIID) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IControlInterface_INTERFACE_DEFINED__ */
-
-
-#ifndef __IControlChangeNotify_INTERFACE_DEFINED__
-#define __IControlChangeNotify_INTERFACE_DEFINED__
-
-/* interface IControlChangeNotify */
-/* [unique][helpstring][nonextensible][uuid][local][object] */ 
-
-
-EXTERN_C const IID IID_IControlChangeNotify;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("A09513ED-C709-4d21-BD7B-5F34C47F3947")
-    IControlChangeNotify : public IUnknown
-    {
-    public:
-        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE OnNotify( 
-            /* [in] */ 
-            __in  DWORD dwSenderProcessId,
-            /* [unique][in] */ 
-            __in_opt  LPCGUID pguidEventContext) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IControlChangeNotifyVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IControlChangeNotify * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IControlChangeNotify * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IControlChangeNotify * This);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *OnNotify )( 
-            IControlChangeNotify * This,
-            /* [in] */ 
-            __in  DWORD dwSenderProcessId,
-            /* [unique][in] */ 
-            __in_opt  LPCGUID pguidEventContext);
-        
-        END_INTERFACE
-    } IControlChangeNotifyVtbl;
-
-    interface IControlChangeNotify
-    {
-        CONST_VTBL struct IControlChangeNotifyVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IControlChangeNotify_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IControlChangeNotify_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IControlChangeNotify_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IControlChangeNotify_OnNotify(This,dwSenderProcessId,pguidEventContext)	\
-    ( (This)->lpVtbl -> OnNotify(This,dwSenderProcessId,pguidEventContext) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IControlChangeNotify_INTERFACE_DEFINED__ */
-
-
-#ifndef __IDeviceTopology_INTERFACE_DEFINED__
-#define __IDeviceTopology_INTERFACE_DEFINED__
-
-/* interface IDeviceTopology */
-/* [unique][helpstring][nonextensible][uuid][local][object] */ 
-
-
-EXTERN_C const IID IID_IDeviceTopology;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("2A07407E-6497-4A18-9787-32F79BD0D98F")
-    IDeviceTopology : public IUnknown
-    {
-    public:
-        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetConnectorCount( 
-            /* [out] */ 
-            __out  UINT *pCount) = 0;
-        
-        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetConnector( 
-            /* [in] */ 
-            __in  UINT nIndex,
-            /* [out] */ 
-            __out  IConnector **ppConnector) = 0;
-        
-        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetSubunitCount( 
-            /* [out] */ 
-            __out  UINT *pCount) = 0;
-        
-        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetSubunit( 
-            /* [in] */ 
-            __in  UINT nIndex,
-            /* [out] */ 
-            __deref_out  ISubunit **ppSubunit) = 0;
-        
-        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetPartById( 
-            /* [in] */ 
-            __in  UINT nId,
-            /* [out] */ 
-            __deref_out  IPart **ppPart) = 0;
-        
-        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetDeviceId( 
-            /* [out] */ 
-            __deref_out  LPWSTR *ppwstrDeviceId) = 0;
-        
-        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetSignalPath( 
-            /* [in] */ 
-            __in  IPart *pIPartFrom,
-            /* [in] */ 
-            __in  IPart *pIPartTo,
-            /* [in] */ 
-            __in  BOOL bRejectMixedPaths,
-            /* [out] */ 
-            __deref_out  IPartsList **ppParts) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IDeviceTopologyVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IDeviceTopology * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IDeviceTopology * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IDeviceTopology * This);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetConnectorCount )( 
-            IDeviceTopology * This,
-            /* [out] */ 
-            __out  UINT *pCount);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetConnector )( 
-            IDeviceTopology * This,
-            /* [in] */ 
-            __in  UINT nIndex,
-            /* [out] */ 
-            __out  IConnector **ppConnector);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetSubunitCount )( 
-            IDeviceTopology * This,
-            /* [out] */ 
-            __out  UINT *pCount);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetSubunit )( 
-            IDeviceTopology * This,
-            /* [in] */ 
-            __in  UINT nIndex,
-            /* [out] */ 
-            __deref_out  ISubunit **ppSubunit);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetPartById )( 
-            IDeviceTopology * This,
-            /* [in] */ 
-            __in  UINT nId,
-            /* [out] */ 
-            __deref_out  IPart **ppPart);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetDeviceId )( 
-            IDeviceTopology * This,
-            /* [out] */ 
-            __deref_out  LPWSTR *ppwstrDeviceId);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetSignalPath )( 
-            IDeviceTopology * This,
-            /* [in] */ 
-            __in  IPart *pIPartFrom,
-            /* [in] */ 
-            __in  IPart *pIPartTo,
-            /* [in] */ 
-            __in  BOOL bRejectMixedPaths,
-            /* [out] */ 
-            __deref_out  IPartsList **ppParts);
-        
-        END_INTERFACE
-    } IDeviceTopologyVtbl;
-
-    interface IDeviceTopology
-    {
-        CONST_VTBL struct IDeviceTopologyVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IDeviceTopology_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IDeviceTopology_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IDeviceTopology_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IDeviceTopology_GetConnectorCount(This,pCount)	\
-    ( (This)->lpVtbl -> GetConnectorCount(This,pCount) ) 
-
-#define IDeviceTopology_GetConnector(This,nIndex,ppConnector)	\
-    ( (This)->lpVtbl -> GetConnector(This,nIndex,ppConnector) ) 
-
-#define IDeviceTopology_GetSubunitCount(This,pCount)	\
-    ( (This)->lpVtbl -> GetSubunitCount(This,pCount) ) 
-
-#define IDeviceTopology_GetSubunit(This,nIndex,ppSubunit)	\
-    ( (This)->lpVtbl -> GetSubunit(This,nIndex,ppSubunit) ) 
-
-#define IDeviceTopology_GetPartById(This,nId,ppPart)	\
-    ( (This)->lpVtbl -> GetPartById(This,nId,ppPart) ) 
-
-#define IDeviceTopology_GetDeviceId(This,ppwstrDeviceId)	\
-    ( (This)->lpVtbl -> GetDeviceId(This,ppwstrDeviceId) ) 
-
-#define IDeviceTopology_GetSignalPath(This,pIPartFrom,pIPartTo,bRejectMixedPaths,ppParts)	\
-    ( (This)->lpVtbl -> GetSignalPath(This,pIPartFrom,pIPartTo,bRejectMixedPaths,ppParts) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IDeviceTopology_INTERFACE_DEFINED__ */
-
-
-
-#ifndef __DevTopologyLib_LIBRARY_DEFINED__
-#define __DevTopologyLib_LIBRARY_DEFINED__
-
-/* library DevTopologyLib */
-/* [helpstring][version][uuid] */ 
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-EXTERN_C const IID LIBID_DevTopologyLib;
-
-EXTERN_C const CLSID CLSID_DeviceTopology;
-
-#ifdef __cplusplus
-
-class DECLSPEC_UUID("1DF639D0-5EC1-47AA-9379-828DC1AA8C59")
-DeviceTopology;
-#endif
-#endif /* __DevTopologyLib_LIBRARY_DEFINED__ */
-
-/* Additional Prototypes for ALL interfaces */
-
-/* end of Additional Prototypes */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
-
-
+
+
+/* this ALWAYS GENERATED file contains the definitions for the interfaces */
+
+
+ /* File created by MIDL compiler version 7.00.0499 */
+/* Compiler settings for devicetopology.idl:
+    Oicf, W1, Zp8, env=Win32 (32b run)
+    protocol : dce , ms_ext, c_ext, robust
+    error checks: allocation ref bounds_check enum stub_data 
+    VC __declspec() decoration level: 
+         __declspec(uuid()), __declspec(selectany), __declspec(novtable)
+         DECLSPEC_UUID(), MIDL_INTERFACE()
+*/
+//@@MIDL_FILE_HEADING(  )
+
+#pragma warning( disable: 4049 )  /* more than 64k source lines */
+
+
+/* verify that the <rpcndr.h> version is high enough to compile this file*/
+#ifndef __REQUIRED_RPCNDR_H_VERSION__
+#define __REQUIRED_RPCNDR_H_VERSION__ 500
+#endif
+
+/* verify that the <rpcsal.h> version is high enough to compile this file*/
+#ifndef __REQUIRED_RPCSAL_H_VERSION__
+#define __REQUIRED_RPCSAL_H_VERSION__ 100
+#endif
+
+#include "rpc.h"
+#include "rpcndr.h"
+
+#ifndef __RPCNDR_H_VERSION__
+#error this stub requires an updated version of <rpcndr.h>
+#endif // __RPCNDR_H_VERSION__
+
+#ifndef COM_NO_WINDOWS_H
+#include "windows.h"
+#include "ole2.h"
+#endif /*COM_NO_WINDOWS_H*/
+
+#ifndef __devicetopology_h__
+#define __devicetopology_h__
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+#pragma once
+#endif
+
+/* Forward Declarations */ 
+
+#ifndef __IKsControl_FWD_DEFINED__
+#define __IKsControl_FWD_DEFINED__
+typedef interface IKsControl IKsControl;
+#endif 	/* __IKsControl_FWD_DEFINED__ */
+
+
+#ifndef __IPerChannelDbLevel_FWD_DEFINED__
+#define __IPerChannelDbLevel_FWD_DEFINED__
+typedef interface IPerChannelDbLevel IPerChannelDbLevel;
+#endif 	/* __IPerChannelDbLevel_FWD_DEFINED__ */
+
+
+#ifndef __IAudioVolumeLevel_FWD_DEFINED__
+#define __IAudioVolumeLevel_FWD_DEFINED__
+typedef interface IAudioVolumeLevel IAudioVolumeLevel;
+#endif 	/* __IAudioVolumeLevel_FWD_DEFINED__ */
+
+
+#ifndef __IAudioChannelConfig_FWD_DEFINED__
+#define __IAudioChannelConfig_FWD_DEFINED__
+typedef interface IAudioChannelConfig IAudioChannelConfig;
+#endif 	/* __IAudioChannelConfig_FWD_DEFINED__ */
+
+
+#ifndef __IAudioLoudness_FWD_DEFINED__
+#define __IAudioLoudness_FWD_DEFINED__
+typedef interface IAudioLoudness IAudioLoudness;
+#endif 	/* __IAudioLoudness_FWD_DEFINED__ */
+
+
+#ifndef __IAudioInputSelector_FWD_DEFINED__
+#define __IAudioInputSelector_FWD_DEFINED__
+typedef interface IAudioInputSelector IAudioInputSelector;
+#endif 	/* __IAudioInputSelector_FWD_DEFINED__ */
+
+
+#ifndef __IAudioOutputSelector_FWD_DEFINED__
+#define __IAudioOutputSelector_FWD_DEFINED__
+typedef interface IAudioOutputSelector IAudioOutputSelector;
+#endif 	/* __IAudioOutputSelector_FWD_DEFINED__ */
+
+
+#ifndef __IAudioMute_FWD_DEFINED__
+#define __IAudioMute_FWD_DEFINED__
+typedef interface IAudioMute IAudioMute;
+#endif 	/* __IAudioMute_FWD_DEFINED__ */
+
+
+#ifndef __IAudioBass_FWD_DEFINED__
+#define __IAudioBass_FWD_DEFINED__
+typedef interface IAudioBass IAudioBass;
+#endif 	/* __IAudioBass_FWD_DEFINED__ */
+
+
+#ifndef __IAudioMidrange_FWD_DEFINED__
+#define __IAudioMidrange_FWD_DEFINED__
+typedef interface IAudioMidrange IAudioMidrange;
+#endif 	/* __IAudioMidrange_FWD_DEFINED__ */
+
+
+#ifndef __IAudioTreble_FWD_DEFINED__
+#define __IAudioTreble_FWD_DEFINED__
+typedef interface IAudioTreble IAudioTreble;
+#endif 	/* __IAudioTreble_FWD_DEFINED__ */
+
+
+#ifndef __IAudioAutoGainControl_FWD_DEFINED__
+#define __IAudioAutoGainControl_FWD_DEFINED__
+typedef interface IAudioAutoGainControl IAudioAutoGainControl;
+#endif 	/* __IAudioAutoGainControl_FWD_DEFINED__ */
+
+
+#ifndef __IAudioPeakMeter_FWD_DEFINED__
+#define __IAudioPeakMeter_FWD_DEFINED__
+typedef interface IAudioPeakMeter IAudioPeakMeter;
+#endif 	/* __IAudioPeakMeter_FWD_DEFINED__ */
+
+
+#ifndef __IDeviceSpecificProperty_FWD_DEFINED__
+#define __IDeviceSpecificProperty_FWD_DEFINED__
+typedef interface IDeviceSpecificProperty IDeviceSpecificProperty;
+#endif 	/* __IDeviceSpecificProperty_FWD_DEFINED__ */
+
+
+#ifndef __IKsFormatSupport_FWD_DEFINED__
+#define __IKsFormatSupport_FWD_DEFINED__
+typedef interface IKsFormatSupport IKsFormatSupport;
+#endif 	/* __IKsFormatSupport_FWD_DEFINED__ */
+
+
+#ifndef __IKsJackDescription_FWD_DEFINED__
+#define __IKsJackDescription_FWD_DEFINED__
+typedef interface IKsJackDescription IKsJackDescription;
+#endif 	/* __IKsJackDescription_FWD_DEFINED__ */
+
+
+#ifndef __IPartsList_FWD_DEFINED__
+#define __IPartsList_FWD_DEFINED__
+typedef interface IPartsList IPartsList;
+#endif 	/* __IPartsList_FWD_DEFINED__ */
+
+
+#ifndef __IPart_FWD_DEFINED__
+#define __IPart_FWD_DEFINED__
+typedef interface IPart IPart;
+#endif 	/* __IPart_FWD_DEFINED__ */
+
+
+#ifndef __IConnector_FWD_DEFINED__
+#define __IConnector_FWD_DEFINED__
+typedef interface IConnector IConnector;
+#endif 	/* __IConnector_FWD_DEFINED__ */
+
+
+#ifndef __ISubunit_FWD_DEFINED__
+#define __ISubunit_FWD_DEFINED__
+typedef interface ISubunit ISubunit;
+#endif 	/* __ISubunit_FWD_DEFINED__ */
+
+
+#ifndef __IControlInterface_FWD_DEFINED__
+#define __IControlInterface_FWD_DEFINED__
+typedef interface IControlInterface IControlInterface;
+#endif 	/* __IControlInterface_FWD_DEFINED__ */
+
+
+#ifndef __IControlChangeNotify_FWD_DEFINED__
+#define __IControlChangeNotify_FWD_DEFINED__
+typedef interface IControlChangeNotify IControlChangeNotify;
+#endif 	/* __IControlChangeNotify_FWD_DEFINED__ */
+
+
+#ifndef __IDeviceTopology_FWD_DEFINED__
+#define __IDeviceTopology_FWD_DEFINED__
+typedef interface IDeviceTopology IDeviceTopology;
+#endif 	/* __IDeviceTopology_FWD_DEFINED__ */
+
+
+#ifndef __DeviceTopology_FWD_DEFINED__
+#define __DeviceTopology_FWD_DEFINED__
+
+#ifdef __cplusplus
+typedef class DeviceTopology DeviceTopology;
+#else
+typedef struct DeviceTopology DeviceTopology;
+#endif /* __cplusplus */
+
+#endif 	/* __DeviceTopology_FWD_DEFINED__ */
+
+
+#ifndef __IPartsList_FWD_DEFINED__
+#define __IPartsList_FWD_DEFINED__
+typedef interface IPartsList IPartsList;
+#endif 	/* __IPartsList_FWD_DEFINED__ */
+
+
+#ifndef __IPerChannelDbLevel_FWD_DEFINED__
+#define __IPerChannelDbLevel_FWD_DEFINED__
+typedef interface IPerChannelDbLevel IPerChannelDbLevel;
+#endif 	/* __IPerChannelDbLevel_FWD_DEFINED__ */
+
+
+#ifndef __IAudioVolumeLevel_FWD_DEFINED__
+#define __IAudioVolumeLevel_FWD_DEFINED__
+typedef interface IAudioVolumeLevel IAudioVolumeLevel;
+#endif 	/* __IAudioVolumeLevel_FWD_DEFINED__ */
+
+
+#ifndef __IAudioLoudness_FWD_DEFINED__
+#define __IAudioLoudness_FWD_DEFINED__
+typedef interface IAudioLoudness IAudioLoudness;
+#endif 	/* __IAudioLoudness_FWD_DEFINED__ */
+
+
+#ifndef __IAudioInputSelector_FWD_DEFINED__
+#define __IAudioInputSelector_FWD_DEFINED__
+typedef interface IAudioInputSelector IAudioInputSelector;
+#endif 	/* __IAudioInputSelector_FWD_DEFINED__ */
+
+
+#ifndef __IAudioMute_FWD_DEFINED__
+#define __IAudioMute_FWD_DEFINED__
+typedef interface IAudioMute IAudioMute;
+#endif 	/* __IAudioMute_FWD_DEFINED__ */
+
+
+#ifndef __IAudioBass_FWD_DEFINED__
+#define __IAudioBass_FWD_DEFINED__
+typedef interface IAudioBass IAudioBass;
+#endif 	/* __IAudioBass_FWD_DEFINED__ */
+
+
+#ifndef __IAudioMidrange_FWD_DEFINED__
+#define __IAudioMidrange_FWD_DEFINED__
+typedef interface IAudioMidrange IAudioMidrange;
+#endif 	/* __IAudioMidrange_FWD_DEFINED__ */
+
+
+#ifndef __IAudioTreble_FWD_DEFINED__
+#define __IAudioTreble_FWD_DEFINED__
+typedef interface IAudioTreble IAudioTreble;
+#endif 	/* __IAudioTreble_FWD_DEFINED__ */
+
+
+#ifndef __IAudioAutoGainControl_FWD_DEFINED__
+#define __IAudioAutoGainControl_FWD_DEFINED__
+typedef interface IAudioAutoGainControl IAudioAutoGainControl;
+#endif 	/* __IAudioAutoGainControl_FWD_DEFINED__ */
+
+
+#ifndef __IAudioOutputSelector_FWD_DEFINED__
+#define __IAudioOutputSelector_FWD_DEFINED__
+typedef interface IAudioOutputSelector IAudioOutputSelector;
+#endif 	/* __IAudioOutputSelector_FWD_DEFINED__ */
+
+
+#ifndef __IAudioPeakMeter_FWD_DEFINED__
+#define __IAudioPeakMeter_FWD_DEFINED__
+typedef interface IAudioPeakMeter IAudioPeakMeter;
+#endif 	/* __IAudioPeakMeter_FWD_DEFINED__ */
+
+
+#ifndef __IDeviceSpecificProperty_FWD_DEFINED__
+#define __IDeviceSpecificProperty_FWD_DEFINED__
+typedef interface IDeviceSpecificProperty IDeviceSpecificProperty;
+#endif 	/* __IDeviceSpecificProperty_FWD_DEFINED__ */
+
+
+#ifndef __IKsFormatSupport_FWD_DEFINED__
+#define __IKsFormatSupport_FWD_DEFINED__
+typedef interface IKsFormatSupport IKsFormatSupport;
+#endif 	/* __IKsFormatSupport_FWD_DEFINED__ */
+
+
+/* header files for imported files */
+#include "oaidl.h"
+#include "ocidl.h"
+#include "propidl.h"
+
+#ifdef __cplusplus
+extern "C"{
+#endif 
+
+
+/* interface __MIDL_itf_devicetopology_0000_0000 */
+/* [local] */ 
+
+#define E_NOTFOUND HRESULT_FROM_WIN32(ERROR_NOT_FOUND)
+//
+//   Flag for clients of IControlChangeNotify::OnNotify to allow those clients to identify hardware initiated notifications
+//
+#define DEVTOPO_HARDWARE_INITIATED_EVENTCONTEXT 'draH'
+/* E2C2E9DE-09B1-4B04-84E5-07931225EE04 */
+DEFINE_GUID(EVENTCONTEXT_VOLUMESLIDER, 0xE2C2E9DE,0x09B1,0x4B04,0x84, 0xE5, 0x07, 0x93, 0x12, 0x25, 0xEE, 0x04);
+#define _IKsControl_
+#include "ks.h"
+#include "ksmedia.h"
+#ifndef _KS_
+typedef /* [public] */ struct __MIDL___MIDL_itf_devicetopology_0000_0000_0001
+    {
+    ULONG FormatSize;
+    ULONG Flags;
+    ULONG SampleSize;
+    ULONG Reserved;
+    GUID MajorFormat;
+    GUID SubFormat;
+    GUID Specifier;
+    } 	KSDATAFORMAT;
+
+typedef struct __MIDL___MIDL_itf_devicetopology_0000_0000_0001 *PKSDATAFORMAT;
+
+typedef /* [public][public][public][public][public][public][public][public][public][public] */ struct __MIDL___MIDL_itf_devicetopology_0000_0000_0002
+    {
+    union 
+        {
+        struct 
+            {
+            GUID Set;
+            ULONG Id;
+            ULONG Flags;
+            } 	;
+        LONGLONG Alignment;
+        } 	;
+    } 	KSIDENTIFIER;
+
+typedef struct __MIDL___MIDL_itf_devicetopology_0000_0000_0002 *PKSIDENTIFIER;
+
+typedef /* [public][public][public][public] */ 
+enum __MIDL___MIDL_itf_devicetopology_0000_0000_0005
+    {	ePcxChanMap_FL_FR	= 0,
+	ePcxChanMap_FC_LFE	= ( ePcxChanMap_FL_FR + 1 ) ,
+	ePcxChanMap_BL_BR	= ( ePcxChanMap_FC_LFE + 1 ) ,
+	ePcxChanMap_FLC_FRC	= ( ePcxChanMap_BL_BR + 1 ) ,
+	ePcxChanMap_SL_SR	= ( ePcxChanMap_FLC_FRC + 1 ) ,
+	ePcxChanMap_Unknown	= ( ePcxChanMap_SL_SR + 1 ) 
+    } 	EChannelMapping;
+
+typedef /* [public][public][public][public] */ 
+enum __MIDL___MIDL_itf_devicetopology_0000_0000_0006
+    {	eConnTypeUnknown	= 0,
+	eConnTypeEighth	= ( eConnTypeUnknown + 1 ) ,
+	eConnTypeQuarter	= ( eConnTypeEighth + 1 ) ,
+	eConnTypeAtapiInternal	= ( eConnTypeQuarter + 1 ) ,
+	eConnTypeRCA	= ( eConnTypeAtapiInternal + 1 ) ,
+	eConnTypeOptical	= ( eConnTypeRCA + 1 ) ,
+	eConnTypeOtherDigital	= ( eConnTypeOptical + 1 ) ,
+	eConnTypeOtherAnalog	= ( eConnTypeOtherDigital + 1 ) ,
+	eConnTypeMultichannelAnalogDIN	= ( eConnTypeOtherAnalog + 1 ) ,
+	eConnTypeXlrProfessional	= ( eConnTypeMultichannelAnalogDIN + 1 ) ,
+	eConnTypeRJ11Modem	= ( eConnTypeXlrProfessional + 1 ) ,
+	eConnTypeCombination	= ( eConnTypeRJ11Modem + 1 ) 
+    } 	EPcxConnectionType;
+
+typedef /* [public][public][public][public] */ 
+enum __MIDL___MIDL_itf_devicetopology_0000_0000_0007
+    {	eGeoLocRear	= 0x1,
+	eGeoLocFront	= ( eGeoLocRear + 1 ) ,
+	eGeoLocLeft	= ( eGeoLocFront + 1 ) ,
+	eGeoLocRight	= ( eGeoLocLeft + 1 ) ,
+	eGeoLocTop	= ( eGeoLocRight + 1 ) ,
+	eGeoLocBottom	= ( eGeoLocTop + 1 ) ,
+	eGeoLocRearOPanel	= ( eGeoLocBottom + 1 ) ,
+	eGeoLocRiser	= ( eGeoLocRearOPanel + 1 ) ,
+	eGeoLocInsideMobileLid	= ( eGeoLocRiser + 1 ) ,
+	eGeoLocDrivebay	= ( eGeoLocInsideMobileLid + 1 ) ,
+	eGeoLocHDMI	= ( eGeoLocDrivebay + 1 ) ,
+	eGeoLocOutsideMobileLid	= ( eGeoLocHDMI + 1 ) ,
+	eGeoLocATAPI	= ( eGeoLocOutsideMobileLid + 1 ) ,
+	eGeoLocReserved5	= ( eGeoLocATAPI + 1 ) ,
+	eGeoLocReserved6	= ( eGeoLocReserved5 + 1 ) 
+    } 	EPcxGeoLocation;
+
+typedef /* [public][public][public][public] */ 
+enum __MIDL___MIDL_itf_devicetopology_0000_0000_0008
+    {	eGenLocPrimaryBox	= 0,
+	eGenLocInternal	= ( eGenLocPrimaryBox + 1 ) ,
+	eGenLocSeperate	= ( eGenLocInternal + 1 ) ,
+	eGenLocOther	= ( eGenLocSeperate + 1 ) 
+    } 	EPcxGenLocation;
+
+typedef /* [public][public][public][public] */ 
+enum __MIDL___MIDL_itf_devicetopology_0000_0000_0009
+    {	ePortConnJack	= 0,
+	ePortConnIntegratedDevice	= ( ePortConnJack + 1 ) ,
+	ePortConnBothIntegratedAndJack	= ( ePortConnIntegratedDevice + 1 ) ,
+	ePortConnUnknown	= ( ePortConnBothIntegratedAndJack + 1 ) 
+    } 	EPxcPortConnection;
+
+typedef /* [public][public] */ struct __MIDL___MIDL_itf_devicetopology_0000_0000_0010
+    {
+    EChannelMapping ChannelMapping;
+    COLORREF Color;
+    EPcxConnectionType ConnectionType;
+    EPcxGeoLocation GeoLocation;
+    EPcxGenLocation GenLocation;
+    EPxcPortConnection PortConnection;
+    BOOL IsConnected;
+    } 	KSJACK_DESCRIPTION;
+
+typedef struct __MIDL___MIDL_itf_devicetopology_0000_0000_0010 *PKSJACK_DESCRIPTION;
+
+typedef KSIDENTIFIER KSPROPERTY;
+
+typedef KSIDENTIFIER *PKSPROPERTY;
+
+typedef KSIDENTIFIER KSMETHOD;
+
+typedef KSIDENTIFIER *PKSMETHOD;
+
+typedef KSIDENTIFIER KSEVENT;
+
+typedef KSIDENTIFIER *PKSEVENT;
+
+#endif
+
+
+
+
+
+
+
+
+typedef /* [public][public] */ 
+enum __MIDL___MIDL_itf_devicetopology_0000_0000_0011
+    {	In	= 0,
+	Out	= ( In + 1 ) 
+    } 	DataFlow;
+
+typedef /* [public][public] */ 
+enum __MIDL___MIDL_itf_devicetopology_0000_0000_0012
+    {	Connector	= 0,
+	Subunit	= ( Connector + 1 ) 
+    } 	PartType;
+
+#define PARTTYPE_FLAG_CONNECTOR 0x00010000
+#define PARTTYPE_FLAG_SUBUNIT   0x00020000
+#define PARTTYPE_MASK           0x00030000
+#define PARTID_MASK             0x0000ffff
+typedef /* [public][public] */ 
+enum __MIDL___MIDL_itf_devicetopology_0000_0000_0013
+    {	Unknown_Connector	= 0,
+	Physical_Internal	= ( Unknown_Connector + 1 ) ,
+	Physical_External	= ( Physical_Internal + 1 ) ,
+	Software_IO	= ( Physical_External + 1 ) ,
+	Software_Fixed	= ( Software_IO + 1 ) ,
+	Network	= ( Software_Fixed + 1 ) 
+    } 	ConnectorType;
+
+
+
+extern RPC_IF_HANDLE __MIDL_itf_devicetopology_0000_0000_v0_0_c_ifspec;
+extern RPC_IF_HANDLE __MIDL_itf_devicetopology_0000_0000_v0_0_s_ifspec;
+
+#ifndef __IKsControl_INTERFACE_DEFINED__
+#define __IKsControl_INTERFACE_DEFINED__
+
+/* interface IKsControl */
+/* [unique][helpstring][nonextensible][uuid][local][object] */ 
+
+
+EXTERN_C const IID IID_IKsControl;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("28F54685-06FD-11D2-B27A-00A0C9223196")
+    IKsControl : public IUnknown
+    {
+    public:
+        virtual HRESULT STDMETHODCALLTYPE KsProperty( 
+            /* [in] */ PKSPROPERTY Property,
+            /* [in] */ ULONG PropertyLength,
+            /* [out][in] */ void *PropertyData,
+            /* [in] */ ULONG DataLength,
+            /* [out] */ ULONG *BytesReturned) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE KsMethod( 
+            /* [in] */ PKSMETHOD Method,
+            /* [in] */ ULONG MethodLength,
+            /* [out][in] */ void *MethodData,
+            /* [in] */ ULONG DataLength,
+            /* [out] */ ULONG *BytesReturned) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE KsEvent( 
+            /* [in] */ PKSEVENT Event,
+            /* [in] */ ULONG EventLength,
+            /* [out][in] */ void *EventData,
+            /* [in] */ ULONG DataLength,
+            /* [out] */ ULONG *BytesReturned) = 0;
+        
+    };
+    
+#else 	/* C style interface */
+
+    typedef struct IKsControlVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            IKsControl * This,
+            /* [in] */ REFIID riid,
+            /* [iid_is][out] */ 
+            __RPC__deref_out  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            IKsControl * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            IKsControl * This);
+        
+        HRESULT ( STDMETHODCALLTYPE *KsProperty )( 
+            IKsControl * This,
+            /* [in] */ PKSPROPERTY Property,
+            /* [in] */ ULONG PropertyLength,
+            /* [out][in] */ void *PropertyData,
+            /* [in] */ ULONG DataLength,
+            /* [out] */ ULONG *BytesReturned);
+        
+        HRESULT ( STDMETHODCALLTYPE *KsMethod )( 
+            IKsControl * This,
+            /* [in] */ PKSMETHOD Method,
+            /* [in] */ ULONG MethodLength,
+            /* [out][in] */ void *MethodData,
+            /* [in] */ ULONG DataLength,
+            /* [out] */ ULONG *BytesReturned);
+        
+        HRESULT ( STDMETHODCALLTYPE *KsEvent )( 
+            IKsControl * This,
+            /* [in] */ PKSEVENT Event,
+            /* [in] */ ULONG EventLength,
+            /* [out][in] */ void *EventData,
+            /* [in] */ ULONG DataLength,
+            /* [out] */ ULONG *BytesReturned);
+        
+        END_INTERFACE
+    } IKsControlVtbl;
+
+    interface IKsControl
+    {
+        CONST_VTBL struct IKsControlVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define IKsControl_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define IKsControl_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define IKsControl_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define IKsControl_KsProperty(This,Property,PropertyLength,PropertyData,DataLength,BytesReturned)	\
+    ( (This)->lpVtbl -> KsProperty(This,Property,PropertyLength,PropertyData,DataLength,BytesReturned) ) 
+
+#define IKsControl_KsMethod(This,Method,MethodLength,MethodData,DataLength,BytesReturned)	\
+    ( (This)->lpVtbl -> KsMethod(This,Method,MethodLength,MethodData,DataLength,BytesReturned) ) 
+
+#define IKsControl_KsEvent(This,Event,EventLength,EventData,DataLength,BytesReturned)	\
+    ( (This)->lpVtbl -> KsEvent(This,Event,EventLength,EventData,DataLength,BytesReturned) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __IKsControl_INTERFACE_DEFINED__ */
+
+
+#ifndef __IPerChannelDbLevel_INTERFACE_DEFINED__
+#define __IPerChannelDbLevel_INTERFACE_DEFINED__
+
+/* interface IPerChannelDbLevel */
+/* [unique][helpstring][nonextensible][uuid][local][object] */ 
+
+
+EXTERN_C const IID IID_IPerChannelDbLevel;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("C2F8E001-F205-4BC9-99BC-C13B1E048CCB")
+    IPerChannelDbLevel : public IUnknown
+    {
+    public:
+        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetChannelCount( 
+            /* [out] */ 
+            __out  UINT *pcChannels) = 0;
+        
+        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetLevelRange( 
+            /* [in] */ 
+            __in  UINT nChannel,
+            /* [out] */ 
+            __out  float *pfMinLevelDB,
+            /* [out] */ 
+            __out  float *pfMaxLevelDB,
+            /* [out] */ 
+            __out  float *pfStepping) = 0;
+        
+        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetLevel( 
+            /* [in] */ 
+            __in  UINT nChannel,
+            /* [out] */ 
+            __out  float *pfLevelDB) = 0;
+        
+        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE SetLevel( 
+            /* [in] */ 
+            __in  UINT nChannel,
+            /* [in] */ 
+            __in  float fLevelDB,
+            /* [unique][in] */ 
+            __in_opt  LPCGUID pguidEventContext) = 0;
+        
+        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE SetLevelUniform( 
+            /* [in] */ 
+            __in  float fLevelDB,
+            /* [unique][in] */ 
+            __in_opt  LPCGUID pguidEventContext) = 0;
+        
+        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE SetLevelAllChannels( 
+            /* [size_is][in] */ 
+            __in_ecount(cChannels)  float aLevelsDB[  ],
+            /* [in] */ 
+            __in  ULONG cChannels,
+            /* [unique][in] */ 
+            __in_opt  LPCGUID pguidEventContext) = 0;
+        
+    };
+    
+#else 	/* C style interface */
+
+    typedef struct IPerChannelDbLevelVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            IPerChannelDbLevel * This,
+            /* [in] */ REFIID riid,
+            /* [iid_is][out] */ 
+            __RPC__deref_out  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            IPerChannelDbLevel * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            IPerChannelDbLevel * This);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetChannelCount )( 
+            IPerChannelDbLevel * This,
+            /* [out] */ 
+            __out  UINT *pcChannels);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetLevelRange )( 
+            IPerChannelDbLevel * This,
+            /* [in] */ 
+            __in  UINT nChannel,
+            /* [out] */ 
+            __out  float *pfMinLevelDB,
+            /* [out] */ 
+            __out  float *pfMaxLevelDB,
+            /* [out] */ 
+            __out  float *pfStepping);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetLevel )( 
+            IPerChannelDbLevel * This,
+            /* [in] */ 
+            __in  UINT nChannel,
+            /* [out] */ 
+            __out  float *pfLevelDB);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *SetLevel )( 
+            IPerChannelDbLevel * This,
+            /* [in] */ 
+            __in  UINT nChannel,
+            /* [in] */ 
+            __in  float fLevelDB,
+            /* [unique][in] */ 
+            __in_opt  LPCGUID pguidEventContext);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *SetLevelUniform )( 
+            IPerChannelDbLevel * This,
+            /* [in] */ 
+            __in  float fLevelDB,
+            /* [unique][in] */ 
+            __in_opt  LPCGUID pguidEventContext);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *SetLevelAllChannels )( 
+            IPerChannelDbLevel * This,
+            /* [size_is][in] */ 
+            __in_ecount(cChannels)  float aLevelsDB[  ],
+            /* [in] */ 
+            __in  ULONG cChannels,
+            /* [unique][in] */ 
+            __in_opt  LPCGUID pguidEventContext);
+        
+        END_INTERFACE
+    } IPerChannelDbLevelVtbl;
+
+    interface IPerChannelDbLevel
+    {
+        CONST_VTBL struct IPerChannelDbLevelVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define IPerChannelDbLevel_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define IPerChannelDbLevel_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define IPerChannelDbLevel_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define IPerChannelDbLevel_GetChannelCount(This,pcChannels)	\
+    ( (This)->lpVtbl -> GetChannelCount(This,pcChannels) ) 
+
+#define IPerChannelDbLevel_GetLevelRange(This,nChannel,pfMinLevelDB,pfMaxLevelDB,pfStepping)	\
+    ( (This)->lpVtbl -> GetLevelRange(This,nChannel,pfMinLevelDB,pfMaxLevelDB,pfStepping) ) 
+
+#define IPerChannelDbLevel_GetLevel(This,nChannel,pfLevelDB)	\
+    ( (This)->lpVtbl -> GetLevel(This,nChannel,pfLevelDB) ) 
+
+#define IPerChannelDbLevel_SetLevel(This,nChannel,fLevelDB,pguidEventContext)	\
+    ( (This)->lpVtbl -> SetLevel(This,nChannel,fLevelDB,pguidEventContext) ) 
+
+#define IPerChannelDbLevel_SetLevelUniform(This,fLevelDB,pguidEventContext)	\
+    ( (This)->lpVtbl -> SetLevelUniform(This,fLevelDB,pguidEventContext) ) 
+
+#define IPerChannelDbLevel_SetLevelAllChannels(This,aLevelsDB,cChannels,pguidEventContext)	\
+    ( (This)->lpVtbl -> SetLevelAllChannels(This,aLevelsDB,cChannels,pguidEventContext) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __IPerChannelDbLevel_INTERFACE_DEFINED__ */
+
+
+#ifndef __IAudioVolumeLevel_INTERFACE_DEFINED__
+#define __IAudioVolumeLevel_INTERFACE_DEFINED__
+
+/* interface IAudioVolumeLevel */
+/* [unique][helpstring][nonextensible][uuid][local][object] */ 
+
+
+EXTERN_C const IID IID_IAudioVolumeLevel;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("7FB7B48F-531D-44A2-BCB3-5AD5A134B3DC")
+    IAudioVolumeLevel : public IPerChannelDbLevel
+    {
+    public:
+    };
+    
+#else 	/* C style interface */
+
+    typedef struct IAudioVolumeLevelVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            IAudioVolumeLevel * This,
+            /* [in] */ REFIID riid,
+            /* [iid_is][out] */ 
+            __RPC__deref_out  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            IAudioVolumeLevel * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            IAudioVolumeLevel * This);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetChannelCount )( 
+            IAudioVolumeLevel * This,
+            /* [out] */ 
+            __out  UINT *pcChannels);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetLevelRange )( 
+            IAudioVolumeLevel * This,
+            /* [in] */ 
+            __in  UINT nChannel,
+            /* [out] */ 
+            __out  float *pfMinLevelDB,
+            /* [out] */ 
+            __out  float *pfMaxLevelDB,
+            /* [out] */ 
+            __out  float *pfStepping);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetLevel )( 
+            IAudioVolumeLevel * This,
+            /* [in] */ 
+            __in  UINT nChannel,
+            /* [out] */ 
+            __out  float *pfLevelDB);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *SetLevel )( 
+            IAudioVolumeLevel * This,
+            /* [in] */ 
+            __in  UINT nChannel,
+            /* [in] */ 
+            __in  float fLevelDB,
+            /* [unique][in] */ 
+            __in_opt  LPCGUID pguidEventContext);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *SetLevelUniform )( 
+            IAudioVolumeLevel * This,
+            /* [in] */ 
+            __in  float fLevelDB,
+            /* [unique][in] */ 
+            __in_opt  LPCGUID pguidEventContext);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *SetLevelAllChannels )( 
+            IAudioVolumeLevel * This,
+            /* [size_is][in] */ 
+            __in_ecount(cChannels)  float aLevelsDB[  ],
+            /* [in] */ 
+            __in  ULONG cChannels,
+            /* [unique][in] */ 
+            __in_opt  LPCGUID pguidEventContext);
+        
+        END_INTERFACE
+    } IAudioVolumeLevelVtbl;
+
+    interface IAudioVolumeLevel
+    {
+        CONST_VTBL struct IAudioVolumeLevelVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define IAudioVolumeLevel_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define IAudioVolumeLevel_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define IAudioVolumeLevel_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define IAudioVolumeLevel_GetChannelCount(This,pcChannels)	\
+    ( (This)->lpVtbl -> GetChannelCount(This,pcChannels) ) 
+
+#define IAudioVolumeLevel_GetLevelRange(This,nChannel,pfMinLevelDB,pfMaxLevelDB,pfStepping)	\
+    ( (This)->lpVtbl -> GetLevelRange(This,nChannel,pfMinLevelDB,pfMaxLevelDB,pfStepping) ) 
+
+#define IAudioVolumeLevel_GetLevel(This,nChannel,pfLevelDB)	\
+    ( (This)->lpVtbl -> GetLevel(This,nChannel,pfLevelDB) ) 
+
+#define IAudioVolumeLevel_SetLevel(This,nChannel,fLevelDB,pguidEventContext)	\
+    ( (This)->lpVtbl -> SetLevel(This,nChannel,fLevelDB,pguidEventContext) ) 
+
+#define IAudioVolumeLevel_SetLevelUniform(This,fLevelDB,pguidEventContext)	\
+    ( (This)->lpVtbl -> SetLevelUniform(This,fLevelDB,pguidEventContext) ) 
+
+#define IAudioVolumeLevel_SetLevelAllChannels(This,aLevelsDB,cChannels,pguidEventContext)	\
+    ( (This)->lpVtbl -> SetLevelAllChannels(This,aLevelsDB,cChannels,pguidEventContext) ) 
+
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __IAudioVolumeLevel_INTERFACE_DEFINED__ */
+
+
+#ifndef __IAudioChannelConfig_INTERFACE_DEFINED__
+#define __IAudioChannelConfig_INTERFACE_DEFINED__
+
+/* interface IAudioChannelConfig */
+/* [unique][helpstring][nonextensible][uuid][local][object] */ 
+
+
+EXTERN_C const IID IID_IAudioChannelConfig;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("BB11C46F-EC28-493C-B88A-5DB88062CE98")
+    IAudioChannelConfig : public IUnknown
+    {
+    public:
+        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE SetChannelConfig( 
+            /* [in] */ DWORD dwConfig,
+            /* [unique][in] */ 
+            __in_opt  LPCGUID pguidEventContext) = 0;
+        
+        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetChannelConfig( 
+            /* [retval][out] */ DWORD *pdwConfig) = 0;
+        
+    };
+    
+#else 	/* C style interface */
+
+    typedef struct IAudioChannelConfigVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            IAudioChannelConfig * This,
+            /* [in] */ REFIID riid,
+            /* [iid_is][out] */ 
+            __RPC__deref_out  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            IAudioChannelConfig * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            IAudioChannelConfig * This);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *SetChannelConfig )( 
+            IAudioChannelConfig * This,
+            /* [in] */ DWORD dwConfig,
+            /* [unique][in] */ 
+            __in_opt  LPCGUID pguidEventContext);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetChannelConfig )( 
+            IAudioChannelConfig * This,
+            /* [retval][out] */ DWORD *pdwConfig);
+        
+        END_INTERFACE
+    } IAudioChannelConfigVtbl;
+
+    interface IAudioChannelConfig
+    {
+        CONST_VTBL struct IAudioChannelConfigVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define IAudioChannelConfig_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define IAudioChannelConfig_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define IAudioChannelConfig_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define IAudioChannelConfig_SetChannelConfig(This,dwConfig,pguidEventContext)	\
+    ( (This)->lpVtbl -> SetChannelConfig(This,dwConfig,pguidEventContext) ) 
+
+#define IAudioChannelConfig_GetChannelConfig(This,pdwConfig)	\
+    ( (This)->lpVtbl -> GetChannelConfig(This,pdwConfig) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __IAudioChannelConfig_INTERFACE_DEFINED__ */
+
+
+#ifndef __IAudioLoudness_INTERFACE_DEFINED__
+#define __IAudioLoudness_INTERFACE_DEFINED__
+
+/* interface IAudioLoudness */
+/* [unique][helpstring][nonextensible][uuid][local][object] */ 
+
+
+EXTERN_C const IID IID_IAudioLoudness;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("7D8B1437-DD53-4350-9C1B-1EE2890BD938")
+    IAudioLoudness : public IUnknown
+    {
+    public:
+        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetEnabled( 
+            /* [out] */ 
+            __out  BOOL *pbEnabled) = 0;
+        
+        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE SetEnabled( 
+            /* [in] */ 
+            __in  BOOL bEnable,
+            /* [unique][in] */ 
+            __in_opt  LPCGUID pguidEventContext) = 0;
+        
+    };
+    
+#else 	/* C style interface */
+
+    typedef struct IAudioLoudnessVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            IAudioLoudness * This,
+            /* [in] */ REFIID riid,
+            /* [iid_is][out] */ 
+            __RPC__deref_out  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            IAudioLoudness * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            IAudioLoudness * This);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetEnabled )( 
+            IAudioLoudness * This,
+            /* [out] */ 
+            __out  BOOL *pbEnabled);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *SetEnabled )( 
+            IAudioLoudness * This,
+            /* [in] */ 
+            __in  BOOL bEnable,
+            /* [unique][in] */ 
+            __in_opt  LPCGUID pguidEventContext);
+        
+        END_INTERFACE
+    } IAudioLoudnessVtbl;
+
+    interface IAudioLoudness
+    {
+        CONST_VTBL struct IAudioLoudnessVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define IAudioLoudness_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define IAudioLoudness_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define IAudioLoudness_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define IAudioLoudness_GetEnabled(This,pbEnabled)	\
+    ( (This)->lpVtbl -> GetEnabled(This,pbEnabled) ) 
+
+#define IAudioLoudness_SetEnabled(This,bEnable,pguidEventContext)	\
+    ( (This)->lpVtbl -> SetEnabled(This,bEnable,pguidEventContext) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __IAudioLoudness_INTERFACE_DEFINED__ */
+
+
+#ifndef __IAudioInputSelector_INTERFACE_DEFINED__
+#define __IAudioInputSelector_INTERFACE_DEFINED__
+
+/* interface IAudioInputSelector */
+/* [unique][helpstring][nonextensible][uuid][local][object] */ 
+
+
+EXTERN_C const IID IID_IAudioInputSelector;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("4F03DC02-5E6E-4653-8F72-A030C123D598")
+    IAudioInputSelector : public IUnknown
+    {
+    public:
+        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetSelection( 
+            /* [out] */ 
+            __out  UINT *pnIdSelected) = 0;
+        
+        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE SetSelection( 
+            /* [in] */ 
+            __in  UINT nIdSelect,
+            /* [unique][in] */ 
+            __in_opt  LPCGUID pguidEventContext) = 0;
+        
+    };
+    
+#else 	/* C style interface */
+
+    typedef struct IAudioInputSelectorVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            IAudioInputSelector * This,
+            /* [in] */ REFIID riid,
+            /* [iid_is][out] */ 
+            __RPC__deref_out  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            IAudioInputSelector * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            IAudioInputSelector * This);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetSelection )( 
+            IAudioInputSelector * This,
+            /* [out] */ 
+            __out  UINT *pnIdSelected);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *SetSelection )( 
+            IAudioInputSelector * This,
+            /* [in] */ 
+            __in  UINT nIdSelect,
+            /* [unique][in] */ 
+            __in_opt  LPCGUID pguidEventContext);
+        
+        END_INTERFACE
+    } IAudioInputSelectorVtbl;
+
+    interface IAudioInputSelector
+    {
+        CONST_VTBL struct IAudioInputSelectorVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define IAudioInputSelector_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define IAudioInputSelector_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define IAudioInputSelector_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define IAudioInputSelector_GetSelection(This,pnIdSelected)	\
+    ( (This)->lpVtbl -> GetSelection(This,pnIdSelected) ) 
+
+#define IAudioInputSelector_SetSelection(This,nIdSelect,pguidEventContext)	\
+    ( (This)->lpVtbl -> SetSelection(This,nIdSelect,pguidEventContext) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __IAudioInputSelector_INTERFACE_DEFINED__ */
+
+
+#ifndef __IAudioOutputSelector_INTERFACE_DEFINED__
+#define __IAudioOutputSelector_INTERFACE_DEFINED__
+
+/* interface IAudioOutputSelector */
+/* [unique][helpstring][nonextensible][uuid][local][object] */ 
+
+
+EXTERN_C const IID IID_IAudioOutputSelector;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("BB515F69-94A7-429e-8B9C-271B3F11A3AB")
+    IAudioOutputSelector : public IUnknown
+    {
+    public:
+        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetSelection( 
+            /* [out] */ 
+            __out  UINT *pnIdSelected) = 0;
+        
+        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE SetSelection( 
+            /* [in] */ 
+            __in  UINT nIdSelect,
+            /* [unique][in] */ 
+            __in_opt  LPCGUID pguidEventContext) = 0;
+        
+    };
+    
+#else 	/* C style interface */
+
+    typedef struct IAudioOutputSelectorVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            IAudioOutputSelector * This,
+            /* [in] */ REFIID riid,
+            /* [iid_is][out] */ 
+            __RPC__deref_out  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            IAudioOutputSelector * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            IAudioOutputSelector * This);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetSelection )( 
+            IAudioOutputSelector * This,
+            /* [out] */ 
+            __out  UINT *pnIdSelected);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *SetSelection )( 
+            IAudioOutputSelector * This,
+            /* [in] */ 
+            __in  UINT nIdSelect,
+            /* [unique][in] */ 
+            __in_opt  LPCGUID pguidEventContext);
+        
+        END_INTERFACE
+    } IAudioOutputSelectorVtbl;
+
+    interface IAudioOutputSelector
+    {
+        CONST_VTBL struct IAudioOutputSelectorVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define IAudioOutputSelector_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define IAudioOutputSelector_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define IAudioOutputSelector_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define IAudioOutputSelector_GetSelection(This,pnIdSelected)	\
+    ( (This)->lpVtbl -> GetSelection(This,pnIdSelected) ) 
+
+#define IAudioOutputSelector_SetSelection(This,nIdSelect,pguidEventContext)	\
+    ( (This)->lpVtbl -> SetSelection(This,nIdSelect,pguidEventContext) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __IAudioOutputSelector_INTERFACE_DEFINED__ */
+
+
+#ifndef __IAudioMute_INTERFACE_DEFINED__
+#define __IAudioMute_INTERFACE_DEFINED__
+
+/* interface IAudioMute */
+/* [unique][helpstring][nonextensible][uuid][local][object] */ 
+
+
+EXTERN_C const IID IID_IAudioMute;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("DF45AEEA-B74A-4B6B-AFAD-2366B6AA012E")
+    IAudioMute : public IUnknown
+    {
+    public:
+        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE SetMute( 
+            /* [in] */ 
+            __in  BOOL bMuted,
+            /* [unique][in] */ 
+            __in_opt  LPCGUID pguidEventContext) = 0;
+        
+        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetMute( 
+            /* [out] */ 
+            __out  BOOL *pbMuted) = 0;
+        
+    };
+    
+#else 	/* C style interface */
+
+    typedef struct IAudioMuteVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            IAudioMute * This,
+            /* [in] */ REFIID riid,
+            /* [iid_is][out] */ 
+            __RPC__deref_out  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            IAudioMute * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            IAudioMute * This);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *SetMute )( 
+            IAudioMute * This,
+            /* [in] */ 
+            __in  BOOL bMuted,
+            /* [unique][in] */ 
+            __in_opt  LPCGUID pguidEventContext);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetMute )( 
+            IAudioMute * This,
+            /* [out] */ 
+            __out  BOOL *pbMuted);
+        
+        END_INTERFACE
+    } IAudioMuteVtbl;
+
+    interface IAudioMute
+    {
+        CONST_VTBL struct IAudioMuteVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define IAudioMute_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define IAudioMute_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define IAudioMute_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define IAudioMute_SetMute(This,bMuted,pguidEventContext)	\
+    ( (This)->lpVtbl -> SetMute(This,bMuted,pguidEventContext) ) 
+
+#define IAudioMute_GetMute(This,pbMuted)	\
+    ( (This)->lpVtbl -> GetMute(This,pbMuted) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __IAudioMute_INTERFACE_DEFINED__ */
+
+
+#ifndef __IAudioBass_INTERFACE_DEFINED__
+#define __IAudioBass_INTERFACE_DEFINED__
+
+/* interface IAudioBass */
+/* [unique][helpstring][nonextensible][uuid][local][object] */ 
+
+
+EXTERN_C const IID IID_IAudioBass;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("A2B1A1D9-4DB3-425D-A2B2-BD335CB3E2E5")
+    IAudioBass : public IPerChannelDbLevel
+    {
+    public:
+    };
+    
+#else 	/* C style interface */
+
+    typedef struct IAudioBassVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            IAudioBass * This,
+            /* [in] */ REFIID riid,
+            /* [iid_is][out] */ 
+            __RPC__deref_out  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            IAudioBass * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            IAudioBass * This);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetChannelCount )( 
+            IAudioBass * This,
+            /* [out] */ 
+            __out  UINT *pcChannels);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetLevelRange )( 
+            IAudioBass * This,
+            /* [in] */ 
+            __in  UINT nChannel,
+            /* [out] */ 
+            __out  float *pfMinLevelDB,
+            /* [out] */ 
+            __out  float *pfMaxLevelDB,
+            /* [out] */ 
+            __out  float *pfStepping);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetLevel )( 
+            IAudioBass * This,
+            /* [in] */ 
+            __in  UINT nChannel,
+            /* [out] */ 
+            __out  float *pfLevelDB);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *SetLevel )( 
+            IAudioBass * This,
+            /* [in] */ 
+            __in  UINT nChannel,
+            /* [in] */ 
+            __in  float fLevelDB,
+            /* [unique][in] */ 
+            __in_opt  LPCGUID pguidEventContext);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *SetLevelUniform )( 
+            IAudioBass * This,
+            /* [in] */ 
+            __in  float fLevelDB,
+            /* [unique][in] */ 
+            __in_opt  LPCGUID pguidEventContext);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *SetLevelAllChannels )( 
+            IAudioBass * This,
+            /* [size_is][in] */ 
+            __in_ecount(cChannels)  float aLevelsDB[  ],
+            /* [in] */ 
+            __in  ULONG cChannels,
+            /* [unique][in] */ 
+            __in_opt  LPCGUID pguidEventContext);
+        
+        END_INTERFACE
+    } IAudioBassVtbl;
+
+    interface IAudioBass
+    {
+        CONST_VTBL struct IAudioBassVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define IAudioBass_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define IAudioBass_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define IAudioBass_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define IAudioBass_GetChannelCount(This,pcChannels)	\
+    ( (This)->lpVtbl -> GetChannelCount(This,pcChannels) ) 
+
+#define IAudioBass_GetLevelRange(This,nChannel,pfMinLevelDB,pfMaxLevelDB,pfStepping)	\
+    ( (This)->lpVtbl -> GetLevelRange(This,nChannel,pfMinLevelDB,pfMaxLevelDB,pfStepping) ) 
+
+#define IAudioBass_GetLevel(This,nChannel,pfLevelDB)	\
+    ( (This)->lpVtbl -> GetLevel(This,nChannel,pfLevelDB) ) 
+
+#define IAudioBass_SetLevel(This,nChannel,fLevelDB,pguidEventContext)	\
+    ( (This)->lpVtbl -> SetLevel(This,nChannel,fLevelDB,pguidEventContext) ) 
+
+#define IAudioBass_SetLevelUniform(This,fLevelDB,pguidEventContext)	\
+    ( (This)->lpVtbl -> SetLevelUniform(This,fLevelDB,pguidEventContext) ) 
+
+#define IAudioBass_SetLevelAllChannels(This,aLevelsDB,cChannels,pguidEventContext)	\
+    ( (This)->lpVtbl -> SetLevelAllChannels(This,aLevelsDB,cChannels,pguidEventContext) ) 
+
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __IAudioBass_INTERFACE_DEFINED__ */
+
+
+#ifndef __IAudioMidrange_INTERFACE_DEFINED__
+#define __IAudioMidrange_INTERFACE_DEFINED__
+
+/* interface IAudioMidrange */
+/* [unique][helpstring][nonextensible][uuid][local][object] */ 
+
+
+EXTERN_C const IID IID_IAudioMidrange;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("5E54B6D7-B44B-40D9-9A9E-E691D9CE6EDF")
+    IAudioMidrange : public IPerChannelDbLevel
+    {
+    public:
+    };
+    
+#else 	/* C style interface */
+
+    typedef struct IAudioMidrangeVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            IAudioMidrange * This,
+            /* [in] */ REFIID riid,
+            /* [iid_is][out] */ 
+            __RPC__deref_out  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            IAudioMidrange * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            IAudioMidrange * This);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetChannelCount )( 
+            IAudioMidrange * This,
+            /* [out] */ 
+            __out  UINT *pcChannels);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetLevelRange )( 
+            IAudioMidrange * This,
+            /* [in] */ 
+            __in  UINT nChannel,
+            /* [out] */ 
+            __out  float *pfMinLevelDB,
+            /* [out] */ 
+            __out  float *pfMaxLevelDB,
+            /* [out] */ 
+            __out  float *pfStepping);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetLevel )( 
+            IAudioMidrange * This,
+            /* [in] */ 
+            __in  UINT nChannel,
+            /* [out] */ 
+            __out  float *pfLevelDB);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *SetLevel )( 
+            IAudioMidrange * This,
+            /* [in] */ 
+            __in  UINT nChannel,
+            /* [in] */ 
+            __in  float fLevelDB,
+            /* [unique][in] */ 
+            __in_opt  LPCGUID pguidEventContext);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *SetLevelUniform )( 
+            IAudioMidrange * This,
+            /* [in] */ 
+            __in  float fLevelDB,
+            /* [unique][in] */ 
+            __in_opt  LPCGUID pguidEventContext);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *SetLevelAllChannels )( 
+            IAudioMidrange * This,
+            /* [size_is][in] */ 
+            __in_ecount(cChannels)  float aLevelsDB[  ],
+            /* [in] */ 
+            __in  ULONG cChannels,
+            /* [unique][in] */ 
+            __in_opt  LPCGUID pguidEventContext);
+        
+        END_INTERFACE
+    } IAudioMidrangeVtbl;
+
+    interface IAudioMidrange
+    {
+        CONST_VTBL struct IAudioMidrangeVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define IAudioMidrange_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define IAudioMidrange_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define IAudioMidrange_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define IAudioMidrange_GetChannelCount(This,pcChannels)	\
+    ( (This)->lpVtbl -> GetChannelCount(This,pcChannels) ) 
+
+#define IAudioMidrange_GetLevelRange(This,nChannel,pfMinLevelDB,pfMaxLevelDB,pfStepping)	\
+    ( (This)->lpVtbl -> GetLevelRange(This,nChannel,pfMinLevelDB,pfMaxLevelDB,pfStepping) ) 
+
+#define IAudioMidrange_GetLevel(This,nChannel,pfLevelDB)	\
+    ( (This)->lpVtbl -> GetLevel(This,nChannel,pfLevelDB) ) 
+
+#define IAudioMidrange_SetLevel(This,nChannel,fLevelDB,pguidEventContext)	\
+    ( (This)->lpVtbl -> SetLevel(This,nChannel,fLevelDB,pguidEventContext) ) 
+
+#define IAudioMidrange_SetLevelUniform(This,fLevelDB,pguidEventContext)	\
+    ( (This)->lpVtbl -> SetLevelUniform(This,fLevelDB,pguidEventContext) ) 
+
+#define IAudioMidrange_SetLevelAllChannels(This,aLevelsDB,cChannels,pguidEventContext)	\
+    ( (This)->lpVtbl -> SetLevelAllChannels(This,aLevelsDB,cChannels,pguidEventContext) ) 
+
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __IAudioMidrange_INTERFACE_DEFINED__ */
+
+
+#ifndef __IAudioTreble_INTERFACE_DEFINED__
+#define __IAudioTreble_INTERFACE_DEFINED__
+
+/* interface IAudioTreble */
+/* [unique][helpstring][nonextensible][uuid][local][object] */ 
+
+
+EXTERN_C const IID IID_IAudioTreble;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("0A717812-694E-4907-B74B-BAFA5CFDCA7B")
+    IAudioTreble : public IPerChannelDbLevel
+    {
+    public:
+    };
+    
+#else 	/* C style interface */
+
+    typedef struct IAudioTrebleVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            IAudioTreble * This,
+            /* [in] */ REFIID riid,
+            /* [iid_is][out] */ 
+            __RPC__deref_out  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            IAudioTreble * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            IAudioTreble * This);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetChannelCount )( 
+            IAudioTreble * This,
+            /* [out] */ 
+            __out  UINT *pcChannels);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetLevelRange )( 
+            IAudioTreble * This,
+            /* [in] */ 
+            __in  UINT nChannel,
+            /* [out] */ 
+            __out  float *pfMinLevelDB,
+            /* [out] */ 
+            __out  float *pfMaxLevelDB,
+            /* [out] */ 
+            __out  float *pfStepping);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetLevel )( 
+            IAudioTreble * This,
+            /* [in] */ 
+            __in  UINT nChannel,
+            /* [out] */ 
+            __out  float *pfLevelDB);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *SetLevel )( 
+            IAudioTreble * This,
+            /* [in] */ 
+            __in  UINT nChannel,
+            /* [in] */ 
+            __in  float fLevelDB,
+            /* [unique][in] */ 
+            __in_opt  LPCGUID pguidEventContext);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *SetLevelUniform )( 
+            IAudioTreble * This,
+            /* [in] */ 
+            __in  float fLevelDB,
+            /* [unique][in] */ 
+            __in_opt  LPCGUID pguidEventContext);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *SetLevelAllChannels )( 
+            IAudioTreble * This,
+            /* [size_is][in] */ 
+            __in_ecount(cChannels)  float aLevelsDB[  ],
+            /* [in] */ 
+            __in  ULONG cChannels,
+            /* [unique][in] */ 
+            __in_opt  LPCGUID pguidEventContext);
+        
+        END_INTERFACE
+    } IAudioTrebleVtbl;
+
+    interface IAudioTreble
+    {
+        CONST_VTBL struct IAudioTrebleVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define IAudioTreble_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define IAudioTreble_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define IAudioTreble_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define IAudioTreble_GetChannelCount(This,pcChannels)	\
+    ( (This)->lpVtbl -> GetChannelCount(This,pcChannels) ) 
+
+#define IAudioTreble_GetLevelRange(This,nChannel,pfMinLevelDB,pfMaxLevelDB,pfStepping)	\
+    ( (This)->lpVtbl -> GetLevelRange(This,nChannel,pfMinLevelDB,pfMaxLevelDB,pfStepping) ) 
+
+#define IAudioTreble_GetLevel(This,nChannel,pfLevelDB)	\
+    ( (This)->lpVtbl -> GetLevel(This,nChannel,pfLevelDB) ) 
+
+#define IAudioTreble_SetLevel(This,nChannel,fLevelDB,pguidEventContext)	\
+    ( (This)->lpVtbl -> SetLevel(This,nChannel,fLevelDB,pguidEventContext) ) 
+
+#define IAudioTreble_SetLevelUniform(This,fLevelDB,pguidEventContext)	\
+    ( (This)->lpVtbl -> SetLevelUniform(This,fLevelDB,pguidEventContext) ) 
+
+#define IAudioTreble_SetLevelAllChannels(This,aLevelsDB,cChannels,pguidEventContext)	\
+    ( (This)->lpVtbl -> SetLevelAllChannels(This,aLevelsDB,cChannels,pguidEventContext) ) 
+
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __IAudioTreble_INTERFACE_DEFINED__ */
+
+
+#ifndef __IAudioAutoGainControl_INTERFACE_DEFINED__
+#define __IAudioAutoGainControl_INTERFACE_DEFINED__
+
+/* interface IAudioAutoGainControl */
+/* [unique][helpstring][nonextensible][uuid][local][object] */ 
+
+
+EXTERN_C const IID IID_IAudioAutoGainControl;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("85401FD4-6DE4-4b9d-9869-2D6753A82F3C")
+    IAudioAutoGainControl : public IUnknown
+    {
+    public:
+        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetEnabled( 
+            /* [out] */ 
+            __out  BOOL *pbEnabled) = 0;
+        
+        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE SetEnabled( 
+            /* [in] */ 
+            __in  BOOL bEnable,
+            /* [unique][in] */ 
+            __in_opt  LPCGUID pguidEventContext) = 0;
+        
+    };
+    
+#else 	/* C style interface */
+
+    typedef struct IAudioAutoGainControlVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            IAudioAutoGainControl * This,
+            /* [in] */ REFIID riid,
+            /* [iid_is][out] */ 
+            __RPC__deref_out  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            IAudioAutoGainControl * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            IAudioAutoGainControl * This);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetEnabled )( 
+            IAudioAutoGainControl * This,
+            /* [out] */ 
+            __out  BOOL *pbEnabled);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *SetEnabled )( 
+            IAudioAutoGainControl * This,
+            /* [in] */ 
+            __in  BOOL bEnable,
+            /* [unique][in] */ 
+            __in_opt  LPCGUID pguidEventContext);
+        
+        END_INTERFACE
+    } IAudioAutoGainControlVtbl;
+
+    interface IAudioAutoGainControl
+    {
+        CONST_VTBL struct IAudioAutoGainControlVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define IAudioAutoGainControl_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define IAudioAutoGainControl_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define IAudioAutoGainControl_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define IAudioAutoGainControl_GetEnabled(This,pbEnabled)	\
+    ( (This)->lpVtbl -> GetEnabled(This,pbEnabled) ) 
+
+#define IAudioAutoGainControl_SetEnabled(This,bEnable,pguidEventContext)	\
+    ( (This)->lpVtbl -> SetEnabled(This,bEnable,pguidEventContext) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __IAudioAutoGainControl_INTERFACE_DEFINED__ */
+
+
+#ifndef __IAudioPeakMeter_INTERFACE_DEFINED__
+#define __IAudioPeakMeter_INTERFACE_DEFINED__
+
+/* interface IAudioPeakMeter */
+/* [unique][helpstring][nonextensible][uuid][local][object] */ 
+
+
+EXTERN_C const IID IID_IAudioPeakMeter;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("DD79923C-0599-45e0-B8B6-C8DF7DB6E796")
+    IAudioPeakMeter : public IUnknown
+    {
+    public:
+        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetChannelCount( 
+            /* [out] */ 
+            __out  UINT *pcChannels) = 0;
+        
+        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetLevel( 
+            /* [in] */ 
+            __in  UINT nChannel,
+            /* [out] */ 
+            __out  float *pfLevel) = 0;
+        
+    };
+    
+#else 	/* C style interface */
+
+    typedef struct IAudioPeakMeterVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            IAudioPeakMeter * This,
+            /* [in] */ REFIID riid,
+            /* [iid_is][out] */ 
+            __RPC__deref_out  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            IAudioPeakMeter * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            IAudioPeakMeter * This);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetChannelCount )( 
+            IAudioPeakMeter * This,
+            /* [out] */ 
+            __out  UINT *pcChannels);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetLevel )( 
+            IAudioPeakMeter * This,
+            /* [in] */ 
+            __in  UINT nChannel,
+            /* [out] */ 
+            __out  float *pfLevel);
+        
+        END_INTERFACE
+    } IAudioPeakMeterVtbl;
+
+    interface IAudioPeakMeter
+    {
+        CONST_VTBL struct IAudioPeakMeterVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define IAudioPeakMeter_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define IAudioPeakMeter_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define IAudioPeakMeter_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define IAudioPeakMeter_GetChannelCount(This,pcChannels)	\
+    ( (This)->lpVtbl -> GetChannelCount(This,pcChannels) ) 
+
+#define IAudioPeakMeter_GetLevel(This,nChannel,pfLevel)	\
+    ( (This)->lpVtbl -> GetLevel(This,nChannel,pfLevel) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __IAudioPeakMeter_INTERFACE_DEFINED__ */
+
+
+#ifndef __IDeviceSpecificProperty_INTERFACE_DEFINED__
+#define __IDeviceSpecificProperty_INTERFACE_DEFINED__
+
+/* interface IDeviceSpecificProperty */
+/* [unique][helpstring][nonextensible][uuid][local][object] */ 
+
+
+EXTERN_C const IID IID_IDeviceSpecificProperty;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("3B22BCBF-2586-4af0-8583-205D391B807C")
+    IDeviceSpecificProperty : public IUnknown
+    {
+    public:
+        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetType( 
+            /* [out] */ 
+            __deref_out  VARTYPE *pVType) = 0;
+        
+        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetValue( 
+            /* [out] */ 
+            __out  void *pvValue,
+            /* [out][in] */ 
+            __inout  DWORD *pcbValue) = 0;
+        
+        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE SetValue( 
+            /* [in] */ 
+            __in  void *pvValue,
+            /* [in] */ DWORD cbValue,
+            /* [unique][in] */ 
+            __in_opt  LPCGUID pguidEventContext) = 0;
+        
+        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE Get4BRange( 
+            /* [out] */ 
+            __deref_out  LONG *plMin,
+            /* [out] */ 
+            __deref_out  LONG *plMax,
+            /* [out] */ 
+            __deref_out  LONG *plStepping) = 0;
+        
+    };
+    
+#else 	/* C style interface */
+
+    typedef struct IDeviceSpecificPropertyVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            IDeviceSpecificProperty * This,
+            /* [in] */ REFIID riid,
+            /* [iid_is][out] */ 
+            __RPC__deref_out  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            IDeviceSpecificProperty * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            IDeviceSpecificProperty * This);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetType )( 
+            IDeviceSpecificProperty * This,
+            /* [out] */ 
+            __deref_out  VARTYPE *pVType);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetValue )( 
+            IDeviceSpecificProperty * This,
+            /* [out] */ 
+            __out  void *pvValue,
+            /* [out][in] */ 
+            __inout  DWORD *pcbValue);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *SetValue )( 
+            IDeviceSpecificProperty * This,
+            /* [in] */ 
+            __in  void *pvValue,
+            /* [in] */ DWORD cbValue,
+            /* [unique][in] */ 
+            __in_opt  LPCGUID pguidEventContext);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *Get4BRange )( 
+            IDeviceSpecificProperty * This,
+            /* [out] */ 
+            __deref_out  LONG *plMin,
+            /* [out] */ 
+            __deref_out  LONG *plMax,
+            /* [out] */ 
+            __deref_out  LONG *plStepping);
+        
+        END_INTERFACE
+    } IDeviceSpecificPropertyVtbl;
+
+    interface IDeviceSpecificProperty
+    {
+        CONST_VTBL struct IDeviceSpecificPropertyVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define IDeviceSpecificProperty_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define IDeviceSpecificProperty_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define IDeviceSpecificProperty_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define IDeviceSpecificProperty_GetType(This,pVType)	\
+    ( (This)->lpVtbl -> GetType(This,pVType) ) 
+
+#define IDeviceSpecificProperty_GetValue(This,pvValue,pcbValue)	\
+    ( (This)->lpVtbl -> GetValue(This,pvValue,pcbValue) ) 
+
+#define IDeviceSpecificProperty_SetValue(This,pvValue,cbValue,pguidEventContext)	\
+    ( (This)->lpVtbl -> SetValue(This,pvValue,cbValue,pguidEventContext) ) 
+
+#define IDeviceSpecificProperty_Get4BRange(This,plMin,plMax,plStepping)	\
+    ( (This)->lpVtbl -> Get4BRange(This,plMin,plMax,plStepping) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __IDeviceSpecificProperty_INTERFACE_DEFINED__ */
+
+
+#ifndef __IKsFormatSupport_INTERFACE_DEFINED__
+#define __IKsFormatSupport_INTERFACE_DEFINED__
+
+/* interface IKsFormatSupport */
+/* [unique][helpstring][nonextensible][uuid][local][object] */ 
+
+
+EXTERN_C const IID IID_IKsFormatSupport;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("3CB4A69D-BB6F-4D2B-95B7-452D2C155DB5")
+    IKsFormatSupport : public IUnknown
+    {
+    public:
+        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE IsFormatSupported( 
+            /* [size_is][in] */ PKSDATAFORMAT pKsFormat,
+            /* [in] */ 
+            __in  DWORD cbFormat,
+            /* [out] */ 
+            __out  BOOL *pbSupported) = 0;
+        
+        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetDevicePreferredFormat( 
+            /* [out] */ PKSDATAFORMAT *ppKsFormat) = 0;
+        
+    };
+    
+#else 	/* C style interface */
+
+    typedef struct IKsFormatSupportVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            IKsFormatSupport * This,
+            /* [in] */ REFIID riid,
+            /* [iid_is][out] */ 
+            __RPC__deref_out  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            IKsFormatSupport * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            IKsFormatSupport * This);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *IsFormatSupported )( 
+            IKsFormatSupport * This,
+            /* [size_is][in] */ PKSDATAFORMAT pKsFormat,
+            /* [in] */ 
+            __in  DWORD cbFormat,
+            /* [out] */ 
+            __out  BOOL *pbSupported);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetDevicePreferredFormat )( 
+            IKsFormatSupport * This,
+            /* [out] */ PKSDATAFORMAT *ppKsFormat);
+        
+        END_INTERFACE
+    } IKsFormatSupportVtbl;
+
+    interface IKsFormatSupport
+    {
+        CONST_VTBL struct IKsFormatSupportVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define IKsFormatSupport_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define IKsFormatSupport_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define IKsFormatSupport_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define IKsFormatSupport_IsFormatSupported(This,pKsFormat,cbFormat,pbSupported)	\
+    ( (This)->lpVtbl -> IsFormatSupported(This,pKsFormat,cbFormat,pbSupported) ) 
+
+#define IKsFormatSupport_GetDevicePreferredFormat(This,ppKsFormat)	\
+    ( (This)->lpVtbl -> GetDevicePreferredFormat(This,ppKsFormat) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __IKsFormatSupport_INTERFACE_DEFINED__ */
+
+
+#ifndef __IKsJackDescription_INTERFACE_DEFINED__
+#define __IKsJackDescription_INTERFACE_DEFINED__
+
+/* interface IKsJackDescription */
+/* [unique][helpstring][nonextensible][uuid][local][object] */ 
+
+
+EXTERN_C const IID IID_IKsJackDescription;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("4509F757-2D46-4637-8E62-CE7DB944F57B")
+    IKsJackDescription : public IUnknown
+    {
+    public:
+        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetJackCount( 
+            /* [out] */ 
+            __out  UINT *pcJacks) = 0;
+        
+        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetJackDescription( 
+            /* [in] */ UINT nJack,
+            /* [out] */ 
+            __out  KSJACK_DESCRIPTION *pDescription) = 0;
+        
+    };
+    
+#else 	/* C style interface */
+
+    typedef struct IKsJackDescriptionVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            IKsJackDescription * This,
+            /* [in] */ REFIID riid,
+            /* [iid_is][out] */ 
+            __RPC__deref_out  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            IKsJackDescription * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            IKsJackDescription * This);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetJackCount )( 
+            IKsJackDescription * This,
+            /* [out] */ 
+            __out  UINT *pcJacks);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetJackDescription )( 
+            IKsJackDescription * This,
+            /* [in] */ UINT nJack,
+            /* [out] */ 
+            __out  KSJACK_DESCRIPTION *pDescription);
+        
+        END_INTERFACE
+    } IKsJackDescriptionVtbl;
+
+    interface IKsJackDescription
+    {
+        CONST_VTBL struct IKsJackDescriptionVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define IKsJackDescription_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define IKsJackDescription_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define IKsJackDescription_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define IKsJackDescription_GetJackCount(This,pcJacks)	\
+    ( (This)->lpVtbl -> GetJackCount(This,pcJacks) ) 
+
+#define IKsJackDescription_GetJackDescription(This,nJack,pDescription)	\
+    ( (This)->lpVtbl -> GetJackDescription(This,nJack,pDescription) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __IKsJackDescription_INTERFACE_DEFINED__ */
+
+
+#ifndef __IPartsList_INTERFACE_DEFINED__
+#define __IPartsList_INTERFACE_DEFINED__
+
+/* interface IPartsList */
+/* [object][unique][helpstring][uuid][local] */ 
+
+
+EXTERN_C const IID IID_IPartsList;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("6DAA848C-5EB0-45CC-AEA5-998A2CDA1FFB")
+    IPartsList : public IUnknown
+    {
+    public:
+        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetCount( 
+            /* [out] */ 
+            __out  UINT *pCount) = 0;
+        
+        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetPart( 
+            /* [in] */ 
+            __in  UINT nIndex,
+            /* [out] */ 
+            __out  IPart **ppPart) = 0;
+        
+    };
+    
+#else 	/* C style interface */
+
+    typedef struct IPartsListVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            IPartsList * This,
+            /* [in] */ REFIID riid,
+            /* [iid_is][out] */ 
+            __RPC__deref_out  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            IPartsList * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            IPartsList * This);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetCount )( 
+            IPartsList * This,
+            /* [out] */ 
+            __out  UINT *pCount);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetPart )( 
+            IPartsList * This,
+            /* [in] */ 
+            __in  UINT nIndex,
+            /* [out] */ 
+            __out  IPart **ppPart);
+        
+        END_INTERFACE
+    } IPartsListVtbl;
+
+    interface IPartsList
+    {
+        CONST_VTBL struct IPartsListVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define IPartsList_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define IPartsList_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define IPartsList_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define IPartsList_GetCount(This,pCount)	\
+    ( (This)->lpVtbl -> GetCount(This,pCount) ) 
+
+#define IPartsList_GetPart(This,nIndex,ppPart)	\
+    ( (This)->lpVtbl -> GetPart(This,nIndex,ppPart) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __IPartsList_INTERFACE_DEFINED__ */
+
+
+#ifndef __IPart_INTERFACE_DEFINED__
+#define __IPart_INTERFACE_DEFINED__
+
+/* interface IPart */
+/* [object][unique][helpstring][uuid][local] */ 
+
+
+EXTERN_C const IID IID_IPart;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("AE2DE0E4-5BCA-4F2D-AA46-5D13F8FDB3A9")
+    IPart : public IUnknown
+    {
+    public:
+        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetName( 
+            /* [out] */ 
+            __deref_out  LPWSTR *ppwstrName) = 0;
+        
+        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetLocalId( 
+            /* [out] */ 
+            __out  UINT *pnId) = 0;
+        
+        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetGlobalId( 
+            /* [out] */ 
+            __deref_out  LPWSTR *ppwstrGlobalId) = 0;
+        
+        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetPartType( 
+            /* [out] */ 
+            __out  PartType *pPartType) = 0;
+        
+        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetSubType( 
+            /* [out] */ GUID *pSubType) = 0;
+        
+        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetControlInterfaceCount( 
+            /* [out] */ 
+            __out  UINT *pCount) = 0;
+        
+        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetControlInterface( 
+            /* [in] */ 
+            __in  UINT nIndex,
+            /* [out] */ 
+            __out  IControlInterface **ppInterfaceDesc) = 0;
+        
+        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE EnumPartsIncoming( 
+            /* [out] */ 
+            __out  IPartsList **ppParts) = 0;
+        
+        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE EnumPartsOutgoing( 
+            /* [out] */ 
+            __out  IPartsList **ppParts) = 0;
+        
+        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetTopologyObject( 
+            /* [out] */ 
+            __out  IDeviceTopology **ppTopology) = 0;
+        
+        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE Activate( 
+            /* [in] */ 
+            __in  DWORD dwClsContext,
+            /* [in] */ 
+            __in  REFIID refiid,
+            /* [iid_is][out] */ 
+            __out_opt  void **ppvObject) = 0;
+        
+        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE RegisterControlChangeCallback( 
+            /* [in] */ 
+            __in  REFGUID riid,
+            /* [in] */ 
+            __in  IControlChangeNotify *pNotify) = 0;
+        
+        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE UnregisterControlChangeCallback( 
+            /* [in] */ 
+            __in  IControlChangeNotify *pNotify) = 0;
+        
+    };
+    
+#else 	/* C style interface */
+
+    typedef struct IPartVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            IPart * This,
+            /* [in] */ REFIID riid,
+            /* [iid_is][out] */ 
+            __RPC__deref_out  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            IPart * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            IPart * This);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetName )( 
+            IPart * This,
+            /* [out] */ 
+            __deref_out  LPWSTR *ppwstrName);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetLocalId )( 
+            IPart * This,
+            /* [out] */ 
+            __out  UINT *pnId);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetGlobalId )( 
+            IPart * This,
+            /* [out] */ 
+            __deref_out  LPWSTR *ppwstrGlobalId);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetPartType )( 
+            IPart * This,
+            /* [out] */ 
+            __out  PartType *pPartType);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetSubType )( 
+            IPart * This,
+            /* [out] */ GUID *pSubType);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetControlInterfaceCount )( 
+            IPart * This,
+            /* [out] */ 
+            __out  UINT *pCount);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetControlInterface )( 
+            IPart * This,
+            /* [in] */ 
+            __in  UINT nIndex,
+            /* [out] */ 
+            __out  IControlInterface **ppInterfaceDesc);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *EnumPartsIncoming )( 
+            IPart * This,
+            /* [out] */ 
+            __out  IPartsList **ppParts);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *EnumPartsOutgoing )( 
+            IPart * This,
+            /* [out] */ 
+            __out  IPartsList **ppParts);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetTopologyObject )( 
+            IPart * This,
+            /* [out] */ 
+            __out  IDeviceTopology **ppTopology);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *Activate )( 
+            IPart * This,
+            /* [in] */ 
+            __in  DWORD dwClsContext,
+            /* [in] */ 
+            __in  REFIID refiid,
+            /* [iid_is][out] */ 
+            __out_opt  void **ppvObject);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *RegisterControlChangeCallback )( 
+            IPart * This,
+            /* [in] */ 
+            __in  REFGUID riid,
+            /* [in] */ 
+            __in  IControlChangeNotify *pNotify);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *UnregisterControlChangeCallback )( 
+            IPart * This,
+            /* [in] */ 
+            __in  IControlChangeNotify *pNotify);
+        
+        END_INTERFACE
+    } IPartVtbl;
+
+    interface IPart
+    {
+        CONST_VTBL struct IPartVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define IPart_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define IPart_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define IPart_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define IPart_GetName(This,ppwstrName)	\
+    ( (This)->lpVtbl -> GetName(This,ppwstrName) ) 
+
+#define IPart_GetLocalId(This,pnId)	\
+    ( (This)->lpVtbl -> GetLocalId(This,pnId) ) 
+
+#define IPart_GetGlobalId(This,ppwstrGlobalId)	\
+    ( (This)->lpVtbl -> GetGlobalId(This,ppwstrGlobalId) ) 
+
+#define IPart_GetPartType(This,pPartType)	\
+    ( (This)->lpVtbl -> GetPartType(This,pPartType) ) 
+
+#define IPart_GetSubType(This,pSubType)	\
+    ( (This)->lpVtbl -> GetSubType(This,pSubType) ) 
+
+#define IPart_GetControlInterfaceCount(This,pCount)	\
+    ( (This)->lpVtbl -> GetControlInterfaceCount(This,pCount) ) 
+
+#define IPart_GetControlInterface(This,nIndex,ppInterfaceDesc)	\
+    ( (This)->lpVtbl -> GetControlInterface(This,nIndex,ppInterfaceDesc) ) 
+
+#define IPart_EnumPartsIncoming(This,ppParts)	\
+    ( (This)->lpVtbl -> EnumPartsIncoming(This,ppParts) ) 
+
+#define IPart_EnumPartsOutgoing(This,ppParts)	\
+    ( (This)->lpVtbl -> EnumPartsOutgoing(This,ppParts) ) 
+
+#define IPart_GetTopologyObject(This,ppTopology)	\
+    ( (This)->lpVtbl -> GetTopologyObject(This,ppTopology) ) 
+
+#define IPart_Activate(This,dwClsContext,refiid,ppvObject)	\
+    ( (This)->lpVtbl -> Activate(This,dwClsContext,refiid,ppvObject) ) 
+
+#define IPart_RegisterControlChangeCallback(This,riid,pNotify)	\
+    ( (This)->lpVtbl -> RegisterControlChangeCallback(This,riid,pNotify) ) 
+
+#define IPart_UnregisterControlChangeCallback(This,pNotify)	\
+    ( (This)->lpVtbl -> UnregisterControlChangeCallback(This,pNotify) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __IPart_INTERFACE_DEFINED__ */
+
+
+#ifndef __IConnector_INTERFACE_DEFINED__
+#define __IConnector_INTERFACE_DEFINED__
+
+/* interface IConnector */
+/* [object][unique][helpstring][uuid][local] */ 
+
+
+EXTERN_C const IID IID_IConnector;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("9c2c4058-23f5-41de-877a-df3af236a09e")
+    IConnector : public IUnknown
+    {
+    public:
+        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetType( 
+            /* [out] */ 
+            __out  ConnectorType *pType) = 0;
+        
+        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetDataFlow( 
+            /* [out] */ 
+            __out  DataFlow *pFlow) = 0;
+        
+        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ConnectTo( 
+            /* [in] */ 
+            __in  IConnector *pConnectTo) = 0;
+        
+        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE Disconnect( void) = 0;
+        
+        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE IsConnected( 
+            /* [out] */ 
+            __out  BOOL *pbConnected) = 0;
+        
+        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetConnectedTo( 
+            /* [out] */ 
+            __out  IConnector **ppConTo) = 0;
+        
+        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetConnectorIdConnectedTo( 
+            /* [out] */ 
+            __deref_out  LPWSTR *ppwstrConnectorId) = 0;
+        
+        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetDeviceIdConnectedTo( 
+            /* [out] */ 
+            __deref_out  LPWSTR *ppwstrDeviceId) = 0;
+        
+    };
+    
+#else 	/* C style interface */
+
+    typedef struct IConnectorVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            IConnector * This,
+            /* [in] */ REFIID riid,
+            /* [iid_is][out] */ 
+            __RPC__deref_out  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            IConnector * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            IConnector * This);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetType )( 
+            IConnector * This,
+            /* [out] */ 
+            __out  ConnectorType *pType);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetDataFlow )( 
+            IConnector * This,
+            /* [out] */ 
+            __out  DataFlow *pFlow);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *ConnectTo )( 
+            IConnector * This,
+            /* [in] */ 
+            __in  IConnector *pConnectTo);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *Disconnect )( 
+            IConnector * This);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *IsConnected )( 
+            IConnector * This,
+            /* [out] */ 
+            __out  BOOL *pbConnected);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetConnectedTo )( 
+            IConnector * This,
+            /* [out] */ 
+            __out  IConnector **ppConTo);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetConnectorIdConnectedTo )( 
+            IConnector * This,
+            /* [out] */ 
+            __deref_out  LPWSTR *ppwstrConnectorId);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetDeviceIdConnectedTo )( 
+            IConnector * This,
+            /* [out] */ 
+            __deref_out  LPWSTR *ppwstrDeviceId);
+        
+        END_INTERFACE
+    } IConnectorVtbl;
+
+    interface IConnector
+    {
+        CONST_VTBL struct IConnectorVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define IConnector_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define IConnector_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define IConnector_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define IConnector_GetType(This,pType)	\
+    ( (This)->lpVtbl -> GetType(This,pType) ) 
+
+#define IConnector_GetDataFlow(This,pFlow)	\
+    ( (This)->lpVtbl -> GetDataFlow(This,pFlow) ) 
+
+#define IConnector_ConnectTo(This,pConnectTo)	\
+    ( (This)->lpVtbl -> ConnectTo(This,pConnectTo) ) 
+
+#define IConnector_Disconnect(This)	\
+    ( (This)->lpVtbl -> Disconnect(This) ) 
+
+#define IConnector_IsConnected(This,pbConnected)	\
+    ( (This)->lpVtbl -> IsConnected(This,pbConnected) ) 
+
+#define IConnector_GetConnectedTo(This,ppConTo)	\
+    ( (This)->lpVtbl -> GetConnectedTo(This,ppConTo) ) 
+
+#define IConnector_GetConnectorIdConnectedTo(This,ppwstrConnectorId)	\
+    ( (This)->lpVtbl -> GetConnectorIdConnectedTo(This,ppwstrConnectorId) ) 
+
+#define IConnector_GetDeviceIdConnectedTo(This,ppwstrDeviceId)	\
+    ( (This)->lpVtbl -> GetDeviceIdConnectedTo(This,ppwstrDeviceId) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __IConnector_INTERFACE_DEFINED__ */
+
+
+#ifndef __ISubunit_INTERFACE_DEFINED__
+#define __ISubunit_INTERFACE_DEFINED__
+
+/* interface ISubunit */
+/* [object][unique][helpstring][uuid][local] */ 
+
+
+EXTERN_C const IID IID_ISubunit;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("82149A85-DBA6-4487-86BB-EA8F7FEFCC71")
+    ISubunit : public IUnknown
+    {
+    public:
+    };
+    
+#else 	/* C style interface */
+
+    typedef struct ISubunitVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            ISubunit * This,
+            /* [in] */ REFIID riid,
+            /* [iid_is][out] */ 
+            __RPC__deref_out  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            ISubunit * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            ISubunit * This);
+        
+        END_INTERFACE
+    } ISubunitVtbl;
+
+    interface ISubunit
+    {
+        CONST_VTBL struct ISubunitVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define ISubunit_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define ISubunit_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define ISubunit_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __ISubunit_INTERFACE_DEFINED__ */
+
+
+#ifndef __IControlInterface_INTERFACE_DEFINED__
+#define __IControlInterface_INTERFACE_DEFINED__
+
+/* interface IControlInterface */
+/* [object][unique][helpstring][uuid][local] */ 
+
+
+EXTERN_C const IID IID_IControlInterface;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("45d37c3f-5140-444a-ae24-400789f3cbf3")
+    IControlInterface : public IUnknown
+    {
+    public:
+        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetName( 
+            /* [out] */ 
+            __deref_out  LPWSTR *ppwstrName) = 0;
+        
+        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetIID( 
+            /* [out] */ 
+            __out  GUID *pIID) = 0;
+        
+    };
+    
+#else 	/* C style interface */
+
+    typedef struct IControlInterfaceVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            IControlInterface * This,
+            /* [in] */ REFIID riid,
+            /* [iid_is][out] */ 
+            __RPC__deref_out  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            IControlInterface * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            IControlInterface * This);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetName )( 
+            IControlInterface * This,
+            /* [out] */ 
+            __deref_out  LPWSTR *ppwstrName);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetIID )( 
+            IControlInterface * This,
+            /* [out] */ 
+            __out  GUID *pIID);
+        
+        END_INTERFACE
+    } IControlInterfaceVtbl;
+
+    interface IControlInterface
+    {
+        CONST_VTBL struct IControlInterfaceVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define IControlInterface_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define IControlInterface_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define IControlInterface_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define IControlInterface_GetName(This,ppwstrName)	\
+    ( (This)->lpVtbl -> GetName(This,ppwstrName) ) 
+
+#define IControlInterface_GetIID(This,pIID)	\
+    ( (This)->lpVtbl -> GetIID(This,pIID) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __IControlInterface_INTERFACE_DEFINED__ */
+
+
+#ifndef __IControlChangeNotify_INTERFACE_DEFINED__
+#define __IControlChangeNotify_INTERFACE_DEFINED__
+
+/* interface IControlChangeNotify */
+/* [unique][helpstring][nonextensible][uuid][local][object] */ 
+
+
+EXTERN_C const IID IID_IControlChangeNotify;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("A09513ED-C709-4d21-BD7B-5F34C47F3947")
+    IControlChangeNotify : public IUnknown
+    {
+    public:
+        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE OnNotify( 
+            /* [in] */ 
+            __in  DWORD dwSenderProcessId,
+            /* [unique][in] */ 
+            __in_opt  LPCGUID pguidEventContext) = 0;
+        
+    };
+    
+#else 	/* C style interface */
+
+    typedef struct IControlChangeNotifyVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            IControlChangeNotify * This,
+            /* [in] */ REFIID riid,
+            /* [iid_is][out] */ 
+            __RPC__deref_out  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            IControlChangeNotify * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            IControlChangeNotify * This);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *OnNotify )( 
+            IControlChangeNotify * This,
+            /* [in] */ 
+            __in  DWORD dwSenderProcessId,
+            /* [unique][in] */ 
+            __in_opt  LPCGUID pguidEventContext);
+        
+        END_INTERFACE
+    } IControlChangeNotifyVtbl;
+
+    interface IControlChangeNotify
+    {
+        CONST_VTBL struct IControlChangeNotifyVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define IControlChangeNotify_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define IControlChangeNotify_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define IControlChangeNotify_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define IControlChangeNotify_OnNotify(This,dwSenderProcessId,pguidEventContext)	\
+    ( (This)->lpVtbl -> OnNotify(This,dwSenderProcessId,pguidEventContext) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __IControlChangeNotify_INTERFACE_DEFINED__ */
+
+
+#ifndef __IDeviceTopology_INTERFACE_DEFINED__
+#define __IDeviceTopology_INTERFACE_DEFINED__
+
+/* interface IDeviceTopology */
+/* [unique][helpstring][nonextensible][uuid][local][object] */ 
+
+
+EXTERN_C const IID IID_IDeviceTopology;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("2A07407E-6497-4A18-9787-32F79BD0D98F")
+    IDeviceTopology : public IUnknown
+    {
+    public:
+        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetConnectorCount( 
+            /* [out] */ 
+            __out  UINT *pCount) = 0;
+        
+        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetConnector( 
+            /* [in] */ 
+            __in  UINT nIndex,
+            /* [out] */ 
+            __out  IConnector **ppConnector) = 0;
+        
+        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetSubunitCount( 
+            /* [out] */ 
+            __out  UINT *pCount) = 0;
+        
+        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetSubunit( 
+            /* [in] */ 
+            __in  UINT nIndex,
+            /* [out] */ 
+            __deref_out  ISubunit **ppSubunit) = 0;
+        
+        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetPartById( 
+            /* [in] */ 
+            __in  UINT nId,
+            /* [out] */ 
+            __deref_out  IPart **ppPart) = 0;
+        
+        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetDeviceId( 
+            /* [out] */ 
+            __deref_out  LPWSTR *ppwstrDeviceId) = 0;
+        
+        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetSignalPath( 
+            /* [in] */ 
+            __in  IPart *pIPartFrom,
+            /* [in] */ 
+            __in  IPart *pIPartTo,
+            /* [in] */ 
+            __in  BOOL bRejectMixedPaths,
+            /* [out] */ 
+            __deref_out  IPartsList **ppParts) = 0;
+        
+    };
+    
+#else 	/* C style interface */
+
+    typedef struct IDeviceTopologyVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            IDeviceTopology * This,
+            /* [in] */ REFIID riid,
+            /* [iid_is][out] */ 
+            __RPC__deref_out  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            IDeviceTopology * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            IDeviceTopology * This);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetConnectorCount )( 
+            IDeviceTopology * This,
+            /* [out] */ 
+            __out  UINT *pCount);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetConnector )( 
+            IDeviceTopology * This,
+            /* [in] */ 
+            __in  UINT nIndex,
+            /* [out] */ 
+            __out  IConnector **ppConnector);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetSubunitCount )( 
+            IDeviceTopology * This,
+            /* [out] */ 
+            __out  UINT *pCount);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetSubunit )( 
+            IDeviceTopology * This,
+            /* [in] */ 
+            __in  UINT nIndex,
+            /* [out] */ 
+            __deref_out  ISubunit **ppSubunit);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetPartById )( 
+            IDeviceTopology * This,
+            /* [in] */ 
+            __in  UINT nId,
+            /* [out] */ 
+            __deref_out  IPart **ppPart);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetDeviceId )( 
+            IDeviceTopology * This,
+            /* [out] */ 
+            __deref_out  LPWSTR *ppwstrDeviceId);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetSignalPath )( 
+            IDeviceTopology * This,
+            /* [in] */ 
+            __in  IPart *pIPartFrom,
+            /* [in] */ 
+            __in  IPart *pIPartTo,
+            /* [in] */ 
+            __in  BOOL bRejectMixedPaths,
+            /* [out] */ 
+            __deref_out  IPartsList **ppParts);
+        
+        END_INTERFACE
+    } IDeviceTopologyVtbl;
+
+    interface IDeviceTopology
+    {
+        CONST_VTBL struct IDeviceTopologyVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define IDeviceTopology_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define IDeviceTopology_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define IDeviceTopology_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define IDeviceTopology_GetConnectorCount(This,pCount)	\
+    ( (This)->lpVtbl -> GetConnectorCount(This,pCount) ) 
+
+#define IDeviceTopology_GetConnector(This,nIndex,ppConnector)	\
+    ( (This)->lpVtbl -> GetConnector(This,nIndex,ppConnector) ) 
+
+#define IDeviceTopology_GetSubunitCount(This,pCount)	\
+    ( (This)->lpVtbl -> GetSubunitCount(This,pCount) ) 
+
+#define IDeviceTopology_GetSubunit(This,nIndex,ppSubunit)	\
+    ( (This)->lpVtbl -> GetSubunit(This,nIndex,ppSubunit) ) 
+
+#define IDeviceTopology_GetPartById(This,nId,ppPart)	\
+    ( (This)->lpVtbl -> GetPartById(This,nId,ppPart) ) 
+
+#define IDeviceTopology_GetDeviceId(This,ppwstrDeviceId)	\
+    ( (This)->lpVtbl -> GetDeviceId(This,ppwstrDeviceId) ) 
+
+#define IDeviceTopology_GetSignalPath(This,pIPartFrom,pIPartTo,bRejectMixedPaths,ppParts)	\
+    ( (This)->lpVtbl -> GetSignalPath(This,pIPartFrom,pIPartTo,bRejectMixedPaths,ppParts) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __IDeviceTopology_INTERFACE_DEFINED__ */
+
+
+
+#ifndef __DevTopologyLib_LIBRARY_DEFINED__
+#define __DevTopologyLib_LIBRARY_DEFINED__
+
+/* library DevTopologyLib */
+/* [helpstring][version][uuid] */ 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+EXTERN_C const IID LIBID_DevTopologyLib;
+
+EXTERN_C const CLSID CLSID_DeviceTopology;
+
+#ifdef __cplusplus
+
+class DECLSPEC_UUID("1DF639D0-5EC1-47AA-9379-828DC1AA8C59")
+DeviceTopology;
+#endif
+#endif /* __DevTopologyLib_LIBRARY_DEFINED__ */
+
+/* Additional Prototypes for ALL interfaces */
+
+/* end of Additional Prototypes */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+
+
diff --git a/src/hostapi/wasapi/mingw-include/endpointvolume.h b/src/hostapi/wasapi/mingw-include/endpointvolume.h
index 095f18f..81155d7 100644
--- a/src/hostapi/wasapi/mingw-include/endpointvolume.h
+++ b/src/hostapi/wasapi/mingw-include/endpointvolume.h
@@ -1,620 +1,620 @@
-
-
-/* this ALWAYS GENERATED file contains the definitions for the interfaces */
-
-
- /* File created by MIDL compiler version 7.00.0499 */
-/* Compiler settings for endpointvolume.idl:
-    Oicf, W1, Zp8, env=Win32 (32b run)
-    protocol : dce , ms_ext, c_ext, robust
-    error checks: allocation ref bounds_check enum stub_data 
-    VC __declspec() decoration level: 
-         __declspec(uuid()), __declspec(selectany), __declspec(novtable)
-         DECLSPEC_UUID(), MIDL_INTERFACE()
-*/
-//@@MIDL_FILE_HEADING(  )
-
-#pragma warning( disable: 4049 )  /* more than 64k source lines */
-
-
-/* verify that the <rpcndr.h> version is high enough to compile this file*/
-#ifndef __REQUIRED_RPCNDR_H_VERSION__
-#define __REQUIRED_RPCNDR_H_VERSION__ 500
-#endif
-
-/* verify that the <rpcsal.h> version is high enough to compile this file*/
-#ifndef __REQUIRED_RPCSAL_H_VERSION__
-#define __REQUIRED_RPCSAL_H_VERSION__ 100
-#endif
-
-#include "rpc.h"
-#include "rpcndr.h"
-
-#ifndef __RPCNDR_H_VERSION__
-#error this stub requires an updated version of <rpcndr.h>
-#endif // __RPCNDR_H_VERSION__
-
-#ifndef COM_NO_WINDOWS_H
-#include "windows.h"
-#include "ole2.h"
-#endif /*COM_NO_WINDOWS_H*/
-
-#ifndef __endpointvolume_h__
-#define __endpointvolume_h__
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-#pragma once
-#endif
-
-/* Forward Declarations */ 
-
-#ifndef __IAudioEndpointVolumeCallback_FWD_DEFINED__
-#define __IAudioEndpointVolumeCallback_FWD_DEFINED__
-typedef interface IAudioEndpointVolumeCallback IAudioEndpointVolumeCallback;
-#endif 	/* __IAudioEndpointVolumeCallback_FWD_DEFINED__ */
-
-
-#ifndef __IAudioEndpointVolume_FWD_DEFINED__
-#define __IAudioEndpointVolume_FWD_DEFINED__
-typedef interface IAudioEndpointVolume IAudioEndpointVolume;
-#endif 	/* __IAudioEndpointVolume_FWD_DEFINED__ */
-
-
-#ifndef __IAudioMeterInformation_FWD_DEFINED__
-#define __IAudioMeterInformation_FWD_DEFINED__
-typedef interface IAudioMeterInformation IAudioMeterInformation;
-#endif 	/* __IAudioMeterInformation_FWD_DEFINED__ */
-
-
-/* header files for imported files */
-#include "unknwn.h"
-#include "devicetopology.h"
-
-#ifdef __cplusplus
-extern "C"{
-#endif 
-
-
-/* interface __MIDL_itf_endpointvolume_0000_0000 */
-/* [local] */ 
-
-typedef struct AUDIO_VOLUME_NOTIFICATION_DATA
-    {
-    GUID guidEventContext;
-    BOOL bMuted;
-    float fMasterVolume;
-    UINT nChannels;
-    float afChannelVolumes[ 1 ];
-    } 	AUDIO_VOLUME_NOTIFICATION_DATA;
-
-typedef struct AUDIO_VOLUME_NOTIFICATION_DATA *PAUDIO_VOLUME_NOTIFICATION_DATA;
-
-#define   ENDPOINT_HARDWARE_SUPPORT_VOLUME    0x00000001
-#define   ENDPOINT_HARDWARE_SUPPORT_MUTE      0x00000002
-#define   ENDPOINT_HARDWARE_SUPPORT_METER     0x00000004
-
-
-extern RPC_IF_HANDLE __MIDL_itf_endpointvolume_0000_0000_v0_0_c_ifspec;
-extern RPC_IF_HANDLE __MIDL_itf_endpointvolume_0000_0000_v0_0_s_ifspec;
-
-#ifndef __IAudioEndpointVolumeCallback_INTERFACE_DEFINED__
-#define __IAudioEndpointVolumeCallback_INTERFACE_DEFINED__
-
-/* interface IAudioEndpointVolumeCallback */
-/* [unique][helpstring][nonextensible][uuid][local][object] */ 
-
-
-EXTERN_C const IID IID_IAudioEndpointVolumeCallback;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("657804FA-D6AD-4496-8A60-352752AF4F89")
-    IAudioEndpointVolumeCallback : public IUnknown
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE OnNotify( 
-            PAUDIO_VOLUME_NOTIFICATION_DATA pNotify) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IAudioEndpointVolumeCallbackVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IAudioEndpointVolumeCallback * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IAudioEndpointVolumeCallback * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IAudioEndpointVolumeCallback * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *OnNotify )( 
-            IAudioEndpointVolumeCallback * This,
-            PAUDIO_VOLUME_NOTIFICATION_DATA pNotify);
-        
-        END_INTERFACE
-    } IAudioEndpointVolumeCallbackVtbl;
-
-    interface IAudioEndpointVolumeCallback
-    {
-        CONST_VTBL struct IAudioEndpointVolumeCallbackVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IAudioEndpointVolumeCallback_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IAudioEndpointVolumeCallback_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IAudioEndpointVolumeCallback_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IAudioEndpointVolumeCallback_OnNotify(This,pNotify)	\
-    ( (This)->lpVtbl -> OnNotify(This,pNotify) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IAudioEndpointVolumeCallback_INTERFACE_DEFINED__ */
-
-
-#ifndef __IAudioEndpointVolume_INTERFACE_DEFINED__
-#define __IAudioEndpointVolume_INTERFACE_DEFINED__
-
-/* interface IAudioEndpointVolume */
-/* [unique][helpstring][nonextensible][uuid][local][object] */ 
-
-
-EXTERN_C const IID IID_IAudioEndpointVolume;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("5CDF2C82-841E-4546-9722-0CF74078229A")
-    IAudioEndpointVolume : public IUnknown
-    {
-    public:
-        virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE RegisterControlChangeNotify( 
-            /* [in] */ 
-            __in  IAudioEndpointVolumeCallback *pNotify) = 0;
-        
-        virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE UnregisterControlChangeNotify( 
-            /* [in] */ 
-            __in  IAudioEndpointVolumeCallback *pNotify) = 0;
-        
-        virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetChannelCount( 
-            /* [out] */ 
-            __out  UINT *pnChannelCount) = 0;
-        
-        virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE SetMasterVolumeLevel( 
-            /* [in] */ 
-            __in  float fLevelDB,
-            /* [unique][in] */ LPCGUID pguidEventContext) = 0;
-        
-        virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE SetMasterVolumeLevelScalar( 
-            /* [in] */ 
-            __in  float fLevel,
-            /* [unique][in] */ LPCGUID pguidEventContext) = 0;
-        
-        virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetMasterVolumeLevel( 
-            /* [out] */ 
-            __out  float *pfLevelDB) = 0;
-        
-        virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetMasterVolumeLevelScalar( 
-            /* [out] */ 
-            __out  float *pfLevel) = 0;
-        
-        virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE SetChannelVolumeLevel( 
-            /* [in] */ 
-            __in  UINT nChannel,
-            float fLevelDB,
-            /* [unique][in] */ LPCGUID pguidEventContext) = 0;
-        
-        virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE SetChannelVolumeLevelScalar( 
-            /* [in] */ 
-            __in  UINT nChannel,
-            float fLevel,
-            /* [unique][in] */ LPCGUID pguidEventContext) = 0;
-        
-        virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetChannelVolumeLevel( 
-            /* [in] */ 
-            __in  UINT nChannel,
-            /* [out] */ 
-            __out  float *pfLevelDB) = 0;
-        
-        virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetChannelVolumeLevelScalar( 
-            /* [in] */ 
-            __in  UINT nChannel,
-            /* [out] */ 
-            __out  float *pfLevel) = 0;
-        
-        virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE SetMute( 
-            /* [in] */ 
-            __in  BOOL bMute,
-            /* [unique][in] */ LPCGUID pguidEventContext) = 0;
-        
-        virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetMute( 
-            /* [out] */ 
-            __out  BOOL *pbMute) = 0;
-        
-        virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetVolumeStepInfo( 
-            /* [out] */ 
-            __out  UINT *pnStep,
-            /* [out] */ 
-            __out  UINT *pnStepCount) = 0;
-        
-        virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE VolumeStepUp( 
-            /* [unique][in] */ LPCGUID pguidEventContext) = 0;
-        
-        virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE VolumeStepDown( 
-            /* [unique][in] */ LPCGUID pguidEventContext) = 0;
-        
-        virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE QueryHardwareSupport( 
-            /* [out] */ 
-            __out  DWORD *pdwHardwareSupportMask) = 0;
-        
-        virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetVolumeRange( 
-            /* [out] */ 
-            __out  float *pflVolumeMindB,
-            /* [out] */ 
-            __out  float *pflVolumeMaxdB,
-            /* [out] */ 
-            __out  float *pflVolumeIncrementdB) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IAudioEndpointVolumeVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IAudioEndpointVolume * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IAudioEndpointVolume * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IAudioEndpointVolume * This);
-        
-        /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *RegisterControlChangeNotify )( 
-            IAudioEndpointVolume * This,
-            /* [in] */ 
-            __in  IAudioEndpointVolumeCallback *pNotify);
-        
-        /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *UnregisterControlChangeNotify )( 
-            IAudioEndpointVolume * This,
-            /* [in] */ 
-            __in  IAudioEndpointVolumeCallback *pNotify);
-        
-        /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetChannelCount )( 
-            IAudioEndpointVolume * This,
-            /* [out] */ 
-            __out  UINT *pnChannelCount);
-        
-        /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *SetMasterVolumeLevel )( 
-            IAudioEndpointVolume * This,
-            /* [in] */ 
-            __in  float fLevelDB,
-            /* [unique][in] */ LPCGUID pguidEventContext);
-        
-        /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *SetMasterVolumeLevelScalar )( 
-            IAudioEndpointVolume * This,
-            /* [in] */ 
-            __in  float fLevel,
-            /* [unique][in] */ LPCGUID pguidEventContext);
-        
-        /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetMasterVolumeLevel )( 
-            IAudioEndpointVolume * This,
-            /* [out] */ 
-            __out  float *pfLevelDB);
-        
-        /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetMasterVolumeLevelScalar )( 
-            IAudioEndpointVolume * This,
-            /* [out] */ 
-            __out  float *pfLevel);
-        
-        /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *SetChannelVolumeLevel )( 
-            IAudioEndpointVolume * This,
-            /* [in] */ 
-            __in  UINT nChannel,
-            float fLevelDB,
-            /* [unique][in] */ LPCGUID pguidEventContext);
-        
-        /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *SetChannelVolumeLevelScalar )( 
-            IAudioEndpointVolume * This,
-            /* [in] */ 
-            __in  UINT nChannel,
-            float fLevel,
-            /* [unique][in] */ LPCGUID pguidEventContext);
-        
-        /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetChannelVolumeLevel )( 
-            IAudioEndpointVolume * This,
-            /* [in] */ 
-            __in  UINT nChannel,
-            /* [out] */ 
-            __out  float *pfLevelDB);
-        
-        /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetChannelVolumeLevelScalar )( 
-            IAudioEndpointVolume * This,
-            /* [in] */ 
-            __in  UINT nChannel,
-            /* [out] */ 
-            __out  float *pfLevel);
-        
-        /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *SetMute )( 
-            IAudioEndpointVolume * This,
-            /* [in] */ 
-            __in  BOOL bMute,
-            /* [unique][in] */ LPCGUID pguidEventContext);
-        
-        /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetMute )( 
-            IAudioEndpointVolume * This,
-            /* [out] */ 
-            __out  BOOL *pbMute);
-        
-        /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetVolumeStepInfo )( 
-            IAudioEndpointVolume * This,
-            /* [out] */ 
-            __out  UINT *pnStep,
-            /* [out] */ 
-            __out  UINT *pnStepCount);
-        
-        /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *VolumeStepUp )( 
-            IAudioEndpointVolume * This,
-            /* [unique][in] */ LPCGUID pguidEventContext);
-        
-        /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *VolumeStepDown )( 
-            IAudioEndpointVolume * This,
-            /* [unique][in] */ LPCGUID pguidEventContext);
-        
-        /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *QueryHardwareSupport )( 
-            IAudioEndpointVolume * This,
-            /* [out] */ 
-            __out  DWORD *pdwHardwareSupportMask);
-        
-        /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetVolumeRange )( 
-            IAudioEndpointVolume * This,
-            /* [out] */ 
-            __out  float *pflVolumeMindB,
-            /* [out] */ 
-            __out  float *pflVolumeMaxdB,
-            /* [out] */ 
-            __out  float *pflVolumeIncrementdB);
-        
-        END_INTERFACE
-    } IAudioEndpointVolumeVtbl;
-
-    interface IAudioEndpointVolume
-    {
-        CONST_VTBL struct IAudioEndpointVolumeVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IAudioEndpointVolume_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IAudioEndpointVolume_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IAudioEndpointVolume_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IAudioEndpointVolume_RegisterControlChangeNotify(This,pNotify)	\
-    ( (This)->lpVtbl -> RegisterControlChangeNotify(This,pNotify) ) 
-
-#define IAudioEndpointVolume_UnregisterControlChangeNotify(This,pNotify)	\
-    ( (This)->lpVtbl -> UnregisterControlChangeNotify(This,pNotify) ) 
-
-#define IAudioEndpointVolume_GetChannelCount(This,pnChannelCount)	\
-    ( (This)->lpVtbl -> GetChannelCount(This,pnChannelCount) ) 
-
-#define IAudioEndpointVolume_SetMasterVolumeLevel(This,fLevelDB,pguidEventContext)	\
-    ( (This)->lpVtbl -> SetMasterVolumeLevel(This,fLevelDB,pguidEventContext) ) 
-
-#define IAudioEndpointVolume_SetMasterVolumeLevelScalar(This,fLevel,pguidEventContext)	\
-    ( (This)->lpVtbl -> SetMasterVolumeLevelScalar(This,fLevel,pguidEventContext) ) 
-
-#define IAudioEndpointVolume_GetMasterVolumeLevel(This,pfLevelDB)	\
-    ( (This)->lpVtbl -> GetMasterVolumeLevel(This,pfLevelDB) ) 
-
-#define IAudioEndpointVolume_GetMasterVolumeLevelScalar(This,pfLevel)	\
-    ( (This)->lpVtbl -> GetMasterVolumeLevelScalar(This,pfLevel) ) 
-
-#define IAudioEndpointVolume_SetChannelVolumeLevel(This,nChannel,fLevelDB,pguidEventContext)	\
-    ( (This)->lpVtbl -> SetChannelVolumeLevel(This,nChannel,fLevelDB,pguidEventContext) ) 
-
-#define IAudioEndpointVolume_SetChannelVolumeLevelScalar(This,nChannel,fLevel,pguidEventContext)	\
-    ( (This)->lpVtbl -> SetChannelVolumeLevelScalar(This,nChannel,fLevel,pguidEventContext) ) 
-
-#define IAudioEndpointVolume_GetChannelVolumeLevel(This,nChannel,pfLevelDB)	\
-    ( (This)->lpVtbl -> GetChannelVolumeLevel(This,nChannel,pfLevelDB) ) 
-
-#define IAudioEndpointVolume_GetChannelVolumeLevelScalar(This,nChannel,pfLevel)	\
-    ( (This)->lpVtbl -> GetChannelVolumeLevelScalar(This,nChannel,pfLevel) ) 
-
-#define IAudioEndpointVolume_SetMute(This,bMute,pguidEventContext)	\
-    ( (This)->lpVtbl -> SetMute(This,bMute,pguidEventContext) ) 
-
-#define IAudioEndpointVolume_GetMute(This,pbMute)	\
-    ( (This)->lpVtbl -> GetMute(This,pbMute) ) 
-
-#define IAudioEndpointVolume_GetVolumeStepInfo(This,pnStep,pnStepCount)	\
-    ( (This)->lpVtbl -> GetVolumeStepInfo(This,pnStep,pnStepCount) ) 
-
-#define IAudioEndpointVolume_VolumeStepUp(This,pguidEventContext)	\
-    ( (This)->lpVtbl -> VolumeStepUp(This,pguidEventContext) ) 
-
-#define IAudioEndpointVolume_VolumeStepDown(This,pguidEventContext)	\
-    ( (This)->lpVtbl -> VolumeStepDown(This,pguidEventContext) ) 
-
-#define IAudioEndpointVolume_QueryHardwareSupport(This,pdwHardwareSupportMask)	\
-    ( (This)->lpVtbl -> QueryHardwareSupport(This,pdwHardwareSupportMask) ) 
-
-#define IAudioEndpointVolume_GetVolumeRange(This,pflVolumeMindB,pflVolumeMaxdB,pflVolumeIncrementdB)	\
-    ( (This)->lpVtbl -> GetVolumeRange(This,pflVolumeMindB,pflVolumeMaxdB,pflVolumeIncrementdB) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IAudioEndpointVolume_INTERFACE_DEFINED__ */
-
-
-#ifndef __IAudioMeterInformation_INTERFACE_DEFINED__
-#define __IAudioMeterInformation_INTERFACE_DEFINED__
-
-/* interface IAudioMeterInformation */
-/* [unique][helpstring][nonextensible][uuid][local][object] */ 
-
-
-EXTERN_C const IID IID_IAudioMeterInformation;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("C02216F6-8C67-4B5B-9D00-D008E73E0064")
-    IAudioMeterInformation : public IUnknown
-    {
-    public:
-        virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetPeakValue( 
-            /* [out] */ float *pfPeak) = 0;
-        
-        virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetMeteringChannelCount( 
-            /* [out] */ 
-            __out  UINT *pnChannelCount) = 0;
-        
-        virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetChannelsPeakValues( 
-            /* [in] */ UINT32 u32ChannelCount,
-            /* [size_is][out] */ float *afPeakValues) = 0;
-        
-        virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE QueryHardwareSupport( 
-            /* [out] */ 
-            __out  DWORD *pdwHardwareSupportMask) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IAudioMeterInformationVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IAudioMeterInformation * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IAudioMeterInformation * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IAudioMeterInformation * This);
-        
-        /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetPeakValue )( 
-            IAudioMeterInformation * This,
-            /* [out] */ float *pfPeak);
-        
-        /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetMeteringChannelCount )( 
-            IAudioMeterInformation * This,
-            /* [out] */ 
-            __out  UINT *pnChannelCount);
-        
-        /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetChannelsPeakValues )( 
-            IAudioMeterInformation * This,
-            /* [in] */ UINT32 u32ChannelCount,
-            /* [size_is][out] */ float *afPeakValues);
-        
-        /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *QueryHardwareSupport )( 
-            IAudioMeterInformation * This,
-            /* [out] */ 
-            __out  DWORD *pdwHardwareSupportMask);
-        
-        END_INTERFACE
-    } IAudioMeterInformationVtbl;
-
-    interface IAudioMeterInformation
-    {
-        CONST_VTBL struct IAudioMeterInformationVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IAudioMeterInformation_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IAudioMeterInformation_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IAudioMeterInformation_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IAudioMeterInformation_GetPeakValue(This,pfPeak)	\
-    ( (This)->lpVtbl -> GetPeakValue(This,pfPeak) ) 
-
-#define IAudioMeterInformation_GetMeteringChannelCount(This,pnChannelCount)	\
-    ( (This)->lpVtbl -> GetMeteringChannelCount(This,pnChannelCount) ) 
-
-#define IAudioMeterInformation_GetChannelsPeakValues(This,u32ChannelCount,afPeakValues)	\
-    ( (This)->lpVtbl -> GetChannelsPeakValues(This,u32ChannelCount,afPeakValues) ) 
-
-#define IAudioMeterInformation_QueryHardwareSupport(This,pdwHardwareSupportMask)	\
-    ( (This)->lpVtbl -> QueryHardwareSupport(This,pdwHardwareSupportMask) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IAudioMeterInformation_INTERFACE_DEFINED__ */
-
-
-/* Additional Prototypes for ALL interfaces */
-
-/* end of Additional Prototypes */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
-
-
+
+
+/* this ALWAYS GENERATED file contains the definitions for the interfaces */
+
+
+ /* File created by MIDL compiler version 7.00.0499 */
+/* Compiler settings for endpointvolume.idl:
+    Oicf, W1, Zp8, env=Win32 (32b run)
+    protocol : dce , ms_ext, c_ext, robust
+    error checks: allocation ref bounds_check enum stub_data 
+    VC __declspec() decoration level: 
+         __declspec(uuid()), __declspec(selectany), __declspec(novtable)
+         DECLSPEC_UUID(), MIDL_INTERFACE()
+*/
+//@@MIDL_FILE_HEADING(  )
+
+#pragma warning( disable: 4049 )  /* more than 64k source lines */
+
+
+/* verify that the <rpcndr.h> version is high enough to compile this file*/
+#ifndef __REQUIRED_RPCNDR_H_VERSION__
+#define __REQUIRED_RPCNDR_H_VERSION__ 500
+#endif
+
+/* verify that the <rpcsal.h> version is high enough to compile this file*/
+#ifndef __REQUIRED_RPCSAL_H_VERSION__
+#define __REQUIRED_RPCSAL_H_VERSION__ 100
+#endif
+
+#include "rpc.h"
+#include "rpcndr.h"
+
+#ifndef __RPCNDR_H_VERSION__
+#error this stub requires an updated version of <rpcndr.h>
+#endif // __RPCNDR_H_VERSION__
+
+#ifndef COM_NO_WINDOWS_H
+#include "windows.h"
+#include "ole2.h"
+#endif /*COM_NO_WINDOWS_H*/
+
+#ifndef __endpointvolume_h__
+#define __endpointvolume_h__
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+#pragma once
+#endif
+
+/* Forward Declarations */ 
+
+#ifndef __IAudioEndpointVolumeCallback_FWD_DEFINED__
+#define __IAudioEndpointVolumeCallback_FWD_DEFINED__
+typedef interface IAudioEndpointVolumeCallback IAudioEndpointVolumeCallback;
+#endif 	/* __IAudioEndpointVolumeCallback_FWD_DEFINED__ */
+
+
+#ifndef __IAudioEndpointVolume_FWD_DEFINED__
+#define __IAudioEndpointVolume_FWD_DEFINED__
+typedef interface IAudioEndpointVolume IAudioEndpointVolume;
+#endif 	/* __IAudioEndpointVolume_FWD_DEFINED__ */
+
+
+#ifndef __IAudioMeterInformation_FWD_DEFINED__
+#define __IAudioMeterInformation_FWD_DEFINED__
+typedef interface IAudioMeterInformation IAudioMeterInformation;
+#endif 	/* __IAudioMeterInformation_FWD_DEFINED__ */
+
+
+/* header files for imported files */
+#include "unknwn.h"
+#include "devicetopology.h"
+
+#ifdef __cplusplus
+extern "C"{
+#endif 
+
+
+/* interface __MIDL_itf_endpointvolume_0000_0000 */
+/* [local] */ 
+
+typedef struct AUDIO_VOLUME_NOTIFICATION_DATA
+    {
+    GUID guidEventContext;
+    BOOL bMuted;
+    float fMasterVolume;
+    UINT nChannels;
+    float afChannelVolumes[ 1 ];
+    } 	AUDIO_VOLUME_NOTIFICATION_DATA;
+
+typedef struct AUDIO_VOLUME_NOTIFICATION_DATA *PAUDIO_VOLUME_NOTIFICATION_DATA;
+
+#define   ENDPOINT_HARDWARE_SUPPORT_VOLUME    0x00000001
+#define   ENDPOINT_HARDWARE_SUPPORT_MUTE      0x00000002
+#define   ENDPOINT_HARDWARE_SUPPORT_METER     0x00000004
+
+
+extern RPC_IF_HANDLE __MIDL_itf_endpointvolume_0000_0000_v0_0_c_ifspec;
+extern RPC_IF_HANDLE __MIDL_itf_endpointvolume_0000_0000_v0_0_s_ifspec;
+
+#ifndef __IAudioEndpointVolumeCallback_INTERFACE_DEFINED__
+#define __IAudioEndpointVolumeCallback_INTERFACE_DEFINED__
+
+/* interface IAudioEndpointVolumeCallback */
+/* [unique][helpstring][nonextensible][uuid][local][object] */ 
+
+
+EXTERN_C const IID IID_IAudioEndpointVolumeCallback;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("657804FA-D6AD-4496-8A60-352752AF4F89")
+    IAudioEndpointVolumeCallback : public IUnknown
+    {
+    public:
+        virtual HRESULT STDMETHODCALLTYPE OnNotify( 
+            PAUDIO_VOLUME_NOTIFICATION_DATA pNotify) = 0;
+        
+    };
+    
+#else 	/* C style interface */
+
+    typedef struct IAudioEndpointVolumeCallbackVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            IAudioEndpointVolumeCallback * This,
+            /* [in] */ REFIID riid,
+            /* [iid_is][out] */ 
+            __RPC__deref_out  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            IAudioEndpointVolumeCallback * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            IAudioEndpointVolumeCallback * This);
+        
+        HRESULT ( STDMETHODCALLTYPE *OnNotify )( 
+            IAudioEndpointVolumeCallback * This,
+            PAUDIO_VOLUME_NOTIFICATION_DATA pNotify);
+        
+        END_INTERFACE
+    } IAudioEndpointVolumeCallbackVtbl;
+
+    interface IAudioEndpointVolumeCallback
+    {
+        CONST_VTBL struct IAudioEndpointVolumeCallbackVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define IAudioEndpointVolumeCallback_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define IAudioEndpointVolumeCallback_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define IAudioEndpointVolumeCallback_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define IAudioEndpointVolumeCallback_OnNotify(This,pNotify)	\
+    ( (This)->lpVtbl -> OnNotify(This,pNotify) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __IAudioEndpointVolumeCallback_INTERFACE_DEFINED__ */
+
+
+#ifndef __IAudioEndpointVolume_INTERFACE_DEFINED__
+#define __IAudioEndpointVolume_INTERFACE_DEFINED__
+
+/* interface IAudioEndpointVolume */
+/* [unique][helpstring][nonextensible][uuid][local][object] */ 
+
+
+EXTERN_C const IID IID_IAudioEndpointVolume;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("5CDF2C82-841E-4546-9722-0CF74078229A")
+    IAudioEndpointVolume : public IUnknown
+    {
+    public:
+        virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE RegisterControlChangeNotify( 
+            /* [in] */ 
+            __in  IAudioEndpointVolumeCallback *pNotify) = 0;
+        
+        virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE UnregisterControlChangeNotify( 
+            /* [in] */ 
+            __in  IAudioEndpointVolumeCallback *pNotify) = 0;
+        
+        virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetChannelCount( 
+            /* [out] */ 
+            __out  UINT *pnChannelCount) = 0;
+        
+        virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE SetMasterVolumeLevel( 
+            /* [in] */ 
+            __in  float fLevelDB,
+            /* [unique][in] */ LPCGUID pguidEventContext) = 0;
+        
+        virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE SetMasterVolumeLevelScalar( 
+            /* [in] */ 
+            __in  float fLevel,
+            /* [unique][in] */ LPCGUID pguidEventContext) = 0;
+        
+        virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetMasterVolumeLevel( 
+            /* [out] */ 
+            __out  float *pfLevelDB) = 0;
+        
+        virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetMasterVolumeLevelScalar( 
+            /* [out] */ 
+            __out  float *pfLevel) = 0;
+        
+        virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE SetChannelVolumeLevel( 
+            /* [in] */ 
+            __in  UINT nChannel,
+            float fLevelDB,
+            /* [unique][in] */ LPCGUID pguidEventContext) = 0;
+        
+        virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE SetChannelVolumeLevelScalar( 
+            /* [in] */ 
+            __in  UINT nChannel,
+            float fLevel,
+            /* [unique][in] */ LPCGUID pguidEventContext) = 0;
+        
+        virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetChannelVolumeLevel( 
+            /* [in] */ 
+            __in  UINT nChannel,
+            /* [out] */ 
+            __out  float *pfLevelDB) = 0;
+        
+        virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetChannelVolumeLevelScalar( 
+            /* [in] */ 
+            __in  UINT nChannel,
+            /* [out] */ 
+            __out  float *pfLevel) = 0;
+        
+        virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE SetMute( 
+            /* [in] */ 
+            __in  BOOL bMute,
+            /* [unique][in] */ LPCGUID pguidEventContext) = 0;
+        
+        virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetMute( 
+            /* [out] */ 
+            __out  BOOL *pbMute) = 0;
+        
+        virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetVolumeStepInfo( 
+            /* [out] */ 
+            __out  UINT *pnStep,
+            /* [out] */ 
+            __out  UINT *pnStepCount) = 0;
+        
+        virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE VolumeStepUp( 
+            /* [unique][in] */ LPCGUID pguidEventContext) = 0;
+        
+        virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE VolumeStepDown( 
+            /* [unique][in] */ LPCGUID pguidEventContext) = 0;
+        
+        virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE QueryHardwareSupport( 
+            /* [out] */ 
+            __out  DWORD *pdwHardwareSupportMask) = 0;
+        
+        virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetVolumeRange( 
+            /* [out] */ 
+            __out  float *pflVolumeMindB,
+            /* [out] */ 
+            __out  float *pflVolumeMaxdB,
+            /* [out] */ 
+            __out  float *pflVolumeIncrementdB) = 0;
+        
+    };
+    
+#else 	/* C style interface */
+
+    typedef struct IAudioEndpointVolumeVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            IAudioEndpointVolume * This,
+            /* [in] */ REFIID riid,
+            /* [iid_is][out] */ 
+            __RPC__deref_out  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            IAudioEndpointVolume * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            IAudioEndpointVolume * This);
+        
+        /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *RegisterControlChangeNotify )( 
+            IAudioEndpointVolume * This,
+            /* [in] */ 
+            __in  IAudioEndpointVolumeCallback *pNotify);
+        
+        /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *UnregisterControlChangeNotify )( 
+            IAudioEndpointVolume * This,
+            /* [in] */ 
+            __in  IAudioEndpointVolumeCallback *pNotify);
+        
+        /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetChannelCount )( 
+            IAudioEndpointVolume * This,
+            /* [out] */ 
+            __out  UINT *pnChannelCount);
+        
+        /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *SetMasterVolumeLevel )( 
+            IAudioEndpointVolume * This,
+            /* [in] */ 
+            __in  float fLevelDB,
+            /* [unique][in] */ LPCGUID pguidEventContext);
+        
+        /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *SetMasterVolumeLevelScalar )( 
+            IAudioEndpointVolume * This,
+            /* [in] */ 
+            __in  float fLevel,
+            /* [unique][in] */ LPCGUID pguidEventContext);
+        
+        /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetMasterVolumeLevel )( 
+            IAudioEndpointVolume * This,
+            /* [out] */ 
+            __out  float *pfLevelDB);
+        
+        /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetMasterVolumeLevelScalar )( 
+            IAudioEndpointVolume * This,
+            /* [out] */ 
+            __out  float *pfLevel);
+        
+        /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *SetChannelVolumeLevel )( 
+            IAudioEndpointVolume * This,
+            /* [in] */ 
+            __in  UINT nChannel,
+            float fLevelDB,
+            /* [unique][in] */ LPCGUID pguidEventContext);
+        
+        /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *SetChannelVolumeLevelScalar )( 
+            IAudioEndpointVolume * This,
+            /* [in] */ 
+            __in  UINT nChannel,
+            float fLevel,
+            /* [unique][in] */ LPCGUID pguidEventContext);
+        
+        /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetChannelVolumeLevel )( 
+            IAudioEndpointVolume * This,
+            /* [in] */ 
+            __in  UINT nChannel,
+            /* [out] */ 
+            __out  float *pfLevelDB);
+        
+        /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetChannelVolumeLevelScalar )( 
+            IAudioEndpointVolume * This,
+            /* [in] */ 
+            __in  UINT nChannel,
+            /* [out] */ 
+            __out  float *pfLevel);
+        
+        /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *SetMute )( 
+            IAudioEndpointVolume * This,
+            /* [in] */ 
+            __in  BOOL bMute,
+            /* [unique][in] */ LPCGUID pguidEventContext);
+        
+        /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetMute )( 
+            IAudioEndpointVolume * This,
+            /* [out] */ 
+            __out  BOOL *pbMute);
+        
+        /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetVolumeStepInfo )( 
+            IAudioEndpointVolume * This,
+            /* [out] */ 
+            __out  UINT *pnStep,
+            /* [out] */ 
+            __out  UINT *pnStepCount);
+        
+        /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *VolumeStepUp )( 
+            IAudioEndpointVolume * This,
+            /* [unique][in] */ LPCGUID pguidEventContext);
+        
+        /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *VolumeStepDown )( 
+            IAudioEndpointVolume * This,
+            /* [unique][in] */ LPCGUID pguidEventContext);
+        
+        /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *QueryHardwareSupport )( 
+            IAudioEndpointVolume * This,
+            /* [out] */ 
+            __out  DWORD *pdwHardwareSupportMask);
+        
+        /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetVolumeRange )( 
+            IAudioEndpointVolume * This,
+            /* [out] */ 
+            __out  float *pflVolumeMindB,
+            /* [out] */ 
+            __out  float *pflVolumeMaxdB,
+            /* [out] */ 
+            __out  float *pflVolumeIncrementdB);
+        
+        END_INTERFACE
+    } IAudioEndpointVolumeVtbl;
+
+    interface IAudioEndpointVolume
+    {
+        CONST_VTBL struct IAudioEndpointVolumeVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define IAudioEndpointVolume_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define IAudioEndpointVolume_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define IAudioEndpointVolume_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define IAudioEndpointVolume_RegisterControlChangeNotify(This,pNotify)	\
+    ( (This)->lpVtbl -> RegisterControlChangeNotify(This,pNotify) ) 
+
+#define IAudioEndpointVolume_UnregisterControlChangeNotify(This,pNotify)	\
+    ( (This)->lpVtbl -> UnregisterControlChangeNotify(This,pNotify) ) 
+
+#define IAudioEndpointVolume_GetChannelCount(This,pnChannelCount)	\
+    ( (This)->lpVtbl -> GetChannelCount(This,pnChannelCount) ) 
+
+#define IAudioEndpointVolume_SetMasterVolumeLevel(This,fLevelDB,pguidEventContext)	\
+    ( (This)->lpVtbl -> SetMasterVolumeLevel(This,fLevelDB,pguidEventContext) ) 
+
+#define IAudioEndpointVolume_SetMasterVolumeLevelScalar(This,fLevel,pguidEventContext)	\
+    ( (This)->lpVtbl -> SetMasterVolumeLevelScalar(This,fLevel,pguidEventContext) ) 
+
+#define IAudioEndpointVolume_GetMasterVolumeLevel(This,pfLevelDB)	\
+    ( (This)->lpVtbl -> GetMasterVolumeLevel(This,pfLevelDB) ) 
+
+#define IAudioEndpointVolume_GetMasterVolumeLevelScalar(This,pfLevel)	\
+    ( (This)->lpVtbl -> GetMasterVolumeLevelScalar(This,pfLevel) ) 
+
+#define IAudioEndpointVolume_SetChannelVolumeLevel(This,nChannel,fLevelDB,pguidEventContext)	\
+    ( (This)->lpVtbl -> SetChannelVolumeLevel(This,nChannel,fLevelDB,pguidEventContext) ) 
+
+#define IAudioEndpointVolume_SetChannelVolumeLevelScalar(This,nChannel,fLevel,pguidEventContext)	\
+    ( (This)->lpVtbl -> SetChannelVolumeLevelScalar(This,nChannel,fLevel,pguidEventContext) ) 
+
+#define IAudioEndpointVolume_GetChannelVolumeLevel(This,nChannel,pfLevelDB)	\
+    ( (This)->lpVtbl -> GetChannelVolumeLevel(This,nChannel,pfLevelDB) ) 
+
+#define IAudioEndpointVolume_GetChannelVolumeLevelScalar(This,nChannel,pfLevel)	\
+    ( (This)->lpVtbl -> GetChannelVolumeLevelScalar(This,nChannel,pfLevel) ) 
+
+#define IAudioEndpointVolume_SetMute(This,bMute,pguidEventContext)	\
+    ( (This)->lpVtbl -> SetMute(This,bMute,pguidEventContext) ) 
+
+#define IAudioEndpointVolume_GetMute(This,pbMute)	\
+    ( (This)->lpVtbl -> GetMute(This,pbMute) ) 
+
+#define IAudioEndpointVolume_GetVolumeStepInfo(This,pnStep,pnStepCount)	\
+    ( (This)->lpVtbl -> GetVolumeStepInfo(This,pnStep,pnStepCount) ) 
+
+#define IAudioEndpointVolume_VolumeStepUp(This,pguidEventContext)	\
+    ( (This)->lpVtbl -> VolumeStepUp(This,pguidEventContext) ) 
+
+#define IAudioEndpointVolume_VolumeStepDown(This,pguidEventContext)	\
+    ( (This)->lpVtbl -> VolumeStepDown(This,pguidEventContext) ) 
+
+#define IAudioEndpointVolume_QueryHardwareSupport(This,pdwHardwareSupportMask)	\
+    ( (This)->lpVtbl -> QueryHardwareSupport(This,pdwHardwareSupportMask) ) 
+
+#define IAudioEndpointVolume_GetVolumeRange(This,pflVolumeMindB,pflVolumeMaxdB,pflVolumeIncrementdB)	\
+    ( (This)->lpVtbl -> GetVolumeRange(This,pflVolumeMindB,pflVolumeMaxdB,pflVolumeIncrementdB) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __IAudioEndpointVolume_INTERFACE_DEFINED__ */
+
+
+#ifndef __IAudioMeterInformation_INTERFACE_DEFINED__
+#define __IAudioMeterInformation_INTERFACE_DEFINED__
+
+/* interface IAudioMeterInformation */
+/* [unique][helpstring][nonextensible][uuid][local][object] */ 
+
+
+EXTERN_C const IID IID_IAudioMeterInformation;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("C02216F6-8C67-4B5B-9D00-D008E73E0064")
+    IAudioMeterInformation : public IUnknown
+    {
+    public:
+        virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetPeakValue( 
+            /* [out] */ float *pfPeak) = 0;
+        
+        virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetMeteringChannelCount( 
+            /* [out] */ 
+            __out  UINT *pnChannelCount) = 0;
+        
+        virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetChannelsPeakValues( 
+            /* [in] */ UINT32 u32ChannelCount,
+            /* [size_is][out] */ float *afPeakValues) = 0;
+        
+        virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE QueryHardwareSupport( 
+            /* [out] */ 
+            __out  DWORD *pdwHardwareSupportMask) = 0;
+        
+    };
+    
+#else 	/* C style interface */
+
+    typedef struct IAudioMeterInformationVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            IAudioMeterInformation * This,
+            /* [in] */ REFIID riid,
+            /* [iid_is][out] */ 
+            __RPC__deref_out  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            IAudioMeterInformation * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            IAudioMeterInformation * This);
+        
+        /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetPeakValue )( 
+            IAudioMeterInformation * This,
+            /* [out] */ float *pfPeak);
+        
+        /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetMeteringChannelCount )( 
+            IAudioMeterInformation * This,
+            /* [out] */ 
+            __out  UINT *pnChannelCount);
+        
+        /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetChannelsPeakValues )( 
+            IAudioMeterInformation * This,
+            /* [in] */ UINT32 u32ChannelCount,
+            /* [size_is][out] */ float *afPeakValues);
+        
+        /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *QueryHardwareSupport )( 
+            IAudioMeterInformation * This,
+            /* [out] */ 
+            __out  DWORD *pdwHardwareSupportMask);
+        
+        END_INTERFACE
+    } IAudioMeterInformationVtbl;
+
+    interface IAudioMeterInformation
+    {
+        CONST_VTBL struct IAudioMeterInformationVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define IAudioMeterInformation_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define IAudioMeterInformation_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define IAudioMeterInformation_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define IAudioMeterInformation_GetPeakValue(This,pfPeak)	\
+    ( (This)->lpVtbl -> GetPeakValue(This,pfPeak) ) 
+
+#define IAudioMeterInformation_GetMeteringChannelCount(This,pnChannelCount)	\
+    ( (This)->lpVtbl -> GetMeteringChannelCount(This,pnChannelCount) ) 
+
+#define IAudioMeterInformation_GetChannelsPeakValues(This,u32ChannelCount,afPeakValues)	\
+    ( (This)->lpVtbl -> GetChannelsPeakValues(This,u32ChannelCount,afPeakValues) ) 
+
+#define IAudioMeterInformation_QueryHardwareSupport(This,pdwHardwareSupportMask)	\
+    ( (This)->lpVtbl -> QueryHardwareSupport(This,pdwHardwareSupportMask) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __IAudioMeterInformation_INTERFACE_DEFINED__ */
+
+
+/* Additional Prototypes for ALL interfaces */
+
+/* end of Additional Prototypes */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+
+
diff --git a/src/hostapi/wasapi/mingw-include/functiondiscoverykeys.h b/src/hostapi/wasapi/mingw-include/functiondiscoverykeys.h
index a298e4d..7e07292 100644
--- a/src/hostapi/wasapi/mingw-include/functiondiscoverykeys.h
+++ b/src/hostapi/wasapi/mingw-include/functiondiscoverykeys.h
@@ -1,255 +1,255 @@
-#pragma once
-
-#if __GNUC__ >=3
-#pragma GCC system_header
-#endif
-
-#ifndef DEFINE_API_PKEY
-#include <propkey.h>
-#endif
-
-#include <FunctionDiscoveryKeys_devpkey.h>
-
-// FMTID_FD = {904b03a2-471d-423c-a584-f3483238a146}
-DEFINE_GUID(FMTID_FD, 0x904b03a2, 0x471d, 0x423c, 0xa5, 0x84, 0xf3, 0x48, 0x32, 0x38, 0xa1, 0x46);
-DEFINE_API_PKEY(PKEY_FD_Visibility, VisibilityFlags, 0x904b03a2, 0x471d, 0x423c, 0xa5, 0x84, 0xf3, 0x48, 0x32, 0x38, 0xa1, 0x46, 0x00000001); //    VT_UINT
-#define FD_Visibility_Default   0
-#define FD_Visibility_Hidden    1
-
-// FMTID_Device = {78C34FC8-104A-4aca-9EA4-524D52996E57}
-DEFINE_GUID(FMTID_Device, 0x78c34fc8, 0x104a, 0x4aca, 0x9e, 0xa4, 0x52, 0x4d, 0x52, 0x99, 0x6e, 0x57);
-
-DEFINE_API_PKEY(PKEY_Device_NotPresent,     DeviceNotPresent   , 0x904b03a2, 0x471d, 0x423c, 0xa5, 0x84, 0xf3, 0x48, 0x32, 0x38, 0xa1, 0x46, 0x00000002); //    VT_UINT
-DEFINE_API_PKEY(PKEY_Device_QueueSize,      DeviceQueueSize    , 0x78c34fc8, 0x104a, 0x4aca, 0x9e, 0xa4, 0x52, 0x4d, 0x52, 0x99, 0x6e, 0x57, 0x00000024); //    VT_UI4
-DEFINE_API_PKEY(PKEY_Device_Status,         DeviceStatus       , 0x78c34fc8, 0x104a, 0x4aca, 0x9e, 0xa4, 0x52, 0x4d, 0x52, 0x99, 0x6e, 0x57, 0x00000025); //    VT_LPWSTR
-DEFINE_API_PKEY(PKEY_Device_Comment,        DeviceComment      , 0x78c34fc8, 0x104a, 0x4aca, 0x9e, 0xa4, 0x52, 0x4d, 0x52, 0x99, 0x6e, 0x57, 0x00000026); //    VT_LPWSTR
-DEFINE_API_PKEY(PKEY_Device_Model,          DeviceModel        , 0x78c34fc8, 0x104a, 0x4aca, 0x9e, 0xa4, 0x52, 0x4d, 0x52, 0x99, 0x6e, 0x57, 0x00000027); //    VT_LPWSTR
-
-//  Name:     System.Device.BIOSVersion -- PKEY_Device_BIOSVersion
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)  Legacy code may treat this as VT_BSTR.
-//  FormatID: EAEE7F1D-6A33-44D1-9441-5F46DEF23198, 9
-DEFINE_PROPERTYKEY(PKEY_Device_BIOSVersion, 0xEAEE7F1D, 0x6A33, 0x44D1, 0x94, 0x41, 0x5F, 0x46, 0xDE, 0xF2, 0x31, 0x98, 9);
-
-DEFINE_API_PKEY(PKEY_Write_Time,            WriteTime          , 0xf53b7e1c, 0x77e0, 0x4450, 0x8c, 0x5f, 0xa7, 0x6c, 0xc7, 0xfd, 0xe0, 0x58, 0x00000100); //    VT_FILETIME
-
-#ifdef FD_XP
-DEFINE_API_PKEY(PKEY_Device_InstanceId, DeviceInstanceId   , 0x78c34fc8, 0x104a, 0x4aca, 0x9e, 0xa4, 0x52, 0x4d, 0x52, 0x99, 0x6e, 0x57, 0x00000100); //    VT_LPWSTR
-#endif
-DEFINE_API_PKEY(PKEY_Device_Interface,  DeviceInterface    , 0x78c34fc8, 0x104a, 0x4aca, 0x9e, 0xa4, 0x52, 0x4d, 0x52, 0x99, 0x6e, 0x57, 0x00000101); //    VT_CLSID
-
-DEFINE_API_PKEY(PKEY_ExposedIIDs,           ExposedIIDs       , 0x78c34fc8, 0x104a, 0x4aca, 0x9e, 0xa4, 0x52, 0x4d, 0x52, 0x99, 0x6e, 0x57, 0x00003002); //  VT_VECTOR | VT_CLSID
-DEFINE_API_PKEY(PKEY_ExposedCLSIDs,         ExposedCLSIDs     , 0x78c34fc8, 0x104a, 0x4aca, 0x9e, 0xa4, 0x52, 0x4d, 0x52, 0x99, 0x6e, 0x57, 0x00003003); //  VT_VECTOR | VT_CLSID
-DEFINE_API_PKEY(PKEY_InstanceValidatorClsid,InstanceValidator , 0x78c34fc8, 0x104a, 0x4aca, 0x9e, 0xa4, 0x52, 0x4d, 0x52, 0x99, 0x6e, 0x57, 0x00003004); // VT_CLSID
-
-// FMTID_WSD = {92506491-FF95-4724-A05A-5B81885A7C92}
-DEFINE_GUID(FMTID_WSD, 0x92506491, 0xFF95, 0x4724, 0xA0, 0x5A, 0x5B, 0x81, 0x88, 0x5A, 0x7C, 0x92);
-
-DEFINE_API_PKEY(PKEY_WSD_AddressURI, WSD_AddressURI, 0x92506491, 0xFF95, 0x4724, 0xA0, 0x5A, 0x5B, 0x81, 0x88, 0x5A, 0x7C, 0x92, 0x00001000);   // VT_LPWSTR
-DEFINE_API_PKEY(PKEY_WSD_Types, WSD_Types, 0x92506491, 0xFF95, 0x4724, 0xA0, 0x5A, 0x5B, 0x81, 0x88, 0x5A, 0x7C, 0x92, 0x00001001); // VT_LPWSTR
-DEFINE_API_PKEY(PKEY_WSD_Scopes, WSD_Scopes, 0x92506491, 0xFF95, 0x4724, 0xA0, 0x5A, 0x5B, 0x81, 0x88, 0x5A, 0x7C, 0x92, 0x00001002);   // VT_LPWSTR
-DEFINE_API_PKEY(PKEY_WSD_MetadataVersion, WSD_MetadataVersion, 0x92506491, 0xFF95, 0x4724, 0xA0, 0x5A, 0x5B, 0x81, 0x88, 0x5A, 0x7C, 0x92, 0x00001003); //VT_UI8
-DEFINE_API_PKEY(PKEY_WSD_AppSeqInstanceID, WSD_AppSeqInstanceID, 0x92506491, 0xFF95, 0x4724, 0xA0, 0x5A, 0x5B, 0x81, 0x88, 0x5A, 0x7C, 0x92, 0x00001004);   // VT_UI8
-DEFINE_API_PKEY(PKEY_WSD_AppSeqSessionID, WSD_AppSeqSessionID, 0x92506491, 0xFF95, 0x4724, 0xA0, 0x5A, 0x5B, 0x81, 0x88, 0x5A, 0x7C, 0x92, 0x00001005); // VT_LPWSTR
-DEFINE_API_PKEY(PKEY_WSD_AppSeqMessageNumber, WSD_AppSeqMessageNumber, 0x92506491, 0xFF95, 0x4724, 0xA0, 0x5A, 0x5B, 0x81, 0x88, 0x5A, 0x7C, 0x92, 0x00001006); // VT_UI8
-DEFINE_API_PKEY(PKEY_WSD_XAddrs, WSD_XAddrs, 0x92506491, 0xFF95, 0x4724, 0xA0, 0x5A, 0x5B, 0x81, 0x88, 0x5A, 0x7C, 0x92, 0x00002000); // VT_LPWSTR or VT_VECTOR | VT_LPWSTR
-
-DEFINE_API_PKEY(PKEY_WSD_MetadataClean, WSD_MetadataClean, 0x92506491, 0xFF95, 0x4724, 0xA0, 0x5A, 0x5B, 0x81, 0x88, 0x5A, 0x7C, 0x92, 0x00000001);   // VT_BOOL
-DEFINE_API_PKEY(PKEY_WSD_ServiceInfo, WSD_ServiceInfo, 0x92506491, 0xFF95, 0x4724, 0xA0, 0x5A, 0x5B, 0x81, 0x88, 0x5A, 0x7C, 0x92, 0x00000002);   // VT_VECTOR|VT_VARIANT (variants are VT_UNKNOWN)
-
-DEFINE_API_PKEY(PKEY_PUBSVCS_TYPE, PUBSVCS_TYPE, 0xF1B88AD3, 0x109C, 0x4FD2, 0xBA, 0x3F, 0x53, 0x5A, 0x76, 0x5F, 0x82, 0xF4, 0x00005001); // VT_LPWSTR
-DEFINE_API_PKEY(PKEY_PUBSVCS_SCOPE, PUBSVCS_SCOPE, 0x2AE2B567, 0xEECB, 0x4A3E, 0xB7, 0x53, 0x54, 0xC7, 0x25, 0x49, 0x43, 0x66, 0x00005002);   // VT_LPWSTR | VT_VECTOR
-DEFINE_API_PKEY(PKEY_PUBSVCS_METADATA, PUBSVCS_METADATA, 0x63C6D5B8, 0xF73A, 0x4ACA, 0x96, 0x7E, 0x0C, 0xC7, 0x87, 0xE0, 0xB5, 0x59, 0x00005003); // VT_LPWSTR
-DEFINE_API_PKEY(PKEY_PUBSVCS_METADATA_VERSION, PUBSVCS_METADATA_VERSION, 0xC0C96C15, 0x1823, 0x4E5B, 0x93, 0x48, 0xE8, 0x25, 0x19, 0x92, 0x3F, 0x04, 0x00005004); // VT_UI8
-DEFINE_API_PKEY(PKEY_PUBSVCS_NETWORK_PROFILES_ALLOWED, PUBSVCS_NETWORK_PROFILES_ALLOWED, 0x63C6D5B8, 0xF73A, 0x4ACA, 0x96, 0x7E, 0x0C, 0xC7, 0x87, 0xE0, 0xB5, 0x59, 0x00005005); // VT_VECTOR | VT_LPWSTR
-DEFINE_API_PKEY(PKEY_PUBSVCS_NETWORK_PROFILES_DENIED, PUBSVCS_NETWORK_PROFILES_DENIED, 0x63C6D5B8, 0xF73A, 0x4ACA, 0x96, 0x7E, 0x0C, 0xC7, 0x87, 0xE0, 0xB5, 0x59, 0x00005006); // VT_VECTOR | VT_LPWSTR
-DEFINE_API_PKEY(PKEY_PUBSVCS_NETWORK_PROFILES_DEFAULT, PUBSVCS_NETWORK_PROFILES_DEFAULT, 0x63C6D5B8, 0xF73A, 0x4ACA, 0x96, 0x7E, 0x0C, 0xC7, 0x87, 0xE0, 0xB5, 0x59, 0x00005007); // VT_BOOL
-
-// FMTID_PNPX = {656A3BB3-ECC0-43FD-8477-4AE0404A96CD}
-DEFINE_GUID(FMTID_PNPX, 0x656A3BB3, 0xECC0, 0x43FD, 0x84, 0x77, 0x4A, 0xE0, 0x40, 0x4A, 0x96, 0xCD);
-        // from Discovery messages
-DEFINE_PROPERTYKEY(PKEY_PNPX_GlobalIdentity, 0x656A3BB3, 0xECC0, 0x43FD, 0x84, 0x77, 0x4A, 0xE0, 0x40, 0x4A, 0x96, 0xCD, 0x00001000);   // VT_LPWSTR
-DEFINE_PROPERTYKEY(PKEY_PNPX_Types, 0x656A3BB3, 0xECC0, 0x43FD, 0x84, 0x77, 0x4A, 0xE0, 0x40, 0x4A, 0x96, 0xCD, 0x00001001);   // VT_LPWSTR | VT_VECTOR
-DEFINE_PROPERTYKEY(PKEY_PNPX_Scopes, 0x656A3BB3, 0xECC0, 0x43FD, 0x84, 0x77, 0x4A, 0xE0, 0x40, 0x4A, 0x96, 0xCD, 0x00001002);   // VT_LPWSTR | VT_VECTOR
-DEFINE_PROPERTYKEY(PKEY_PNPX_XAddrs, 0x656A3BB3, 0xECC0, 0x43FD, 0x84, 0x77, 0x4A, 0xE0, 0x40, 0x4A, 0x96, 0xCD, 0x00001003);   // VT_LPWSTR | VT_VECTOR
-DEFINE_PROPERTYKEY(PKEY_PNPX_MetadataVersion, 0x656A3BB3, 0xECC0, 0x43FD, 0x84, 0x77, 0x4A, 0xE0, 0x40, 0x4A, 0x96, 0xCD, 0x00001004);   // VT_UI8
-DEFINE_PROPERTYKEY(PKEY_PNPX_ID, 0x656A3BB3, 0xECC0, 0x43FD, 0x84, 0x77, 0x4A, 0xE0, 0x40, 0x4A, 0x96, 0xCD, 0x00001005);   // VT_LPWSTR
-DEFINE_PROPERTYKEY(PKEY_PNPX_RootProxy, 0x656A3BB3, 0xECC0, 0x43FD, 0x84, 0x77, 0x4A, 0xE0, 0x40, 0x4A, 0x96, 0xCD, 0x00001006);   // VT_BOOL
-
-        // for Directed Discovery
-DEFINE_PROPERTYKEY(PKEY_PNPX_RemoteAddress, 0x656A3BB3, 0xECC0, 0x43FD, 0x84, 0x77, 0x4A, 0xE0, 0x40, 0x4A, 0x96, 0xCD, 0x00001006);   // VT_LPWSTR
-
-        // from ThisModel metadata
-DEFINE_PROPERTYKEY(PKEY_PNPX_Manufacturer, 0x656A3BB3, 0xECC0, 0x43FD, 0x84, 0x77, 0x4A, 0xE0, 0x40, 0x4A, 0x96, 0xCD, 0x00002000);   // VT_LPWSTR (localizable)
-DEFINE_PROPERTYKEY(PKEY_PNPX_ManufacturerUrl, 0x656A3BB3, 0xECC0, 0x43FD, 0x84, 0x77, 0x4A, 0xE0, 0x40, 0x4A, 0x96, 0xCD, 0x00002001);   // VT_LPWSTR
-DEFINE_PROPERTYKEY(PKEY_PNPX_ModelName, 0x656A3BB3, 0xECC0, 0x43FD, 0x84, 0x77, 0x4A, 0xE0, 0x40, 0x4A, 0x96, 0xCD, 0x00002002);   // VT_LPWSTR (localizable)
-DEFINE_PROPERTYKEY(PKEY_PNPX_ModelNumber, 0x656A3BB3, 0xECC0, 0x43FD, 0x84, 0x77, 0x4A, 0xE0, 0x40, 0x4A, 0x96, 0xCD, 0x00002003);   // VT_LPWSTR
-DEFINE_PROPERTYKEY(PKEY_PNPX_ModelUrl, 0x656A3BB3, 0xECC0, 0x43FD, 0x84, 0x77, 0x4A, 0xE0, 0x40, 0x4A, 0x96, 0xCD, 0x00002004);   // VT_LPWSTR
-DEFINE_PROPERTYKEY(PKEY_PNPX_Upc, 0x656A3BB3, 0xECC0, 0x43FD, 0x84, 0x77, 0x4A, 0xE0, 0x40, 0x4A, 0x96, 0xCD, 0x00002005);   // VT_LPWSTR
-DEFINE_PROPERTYKEY(PKEY_PNPX_PresentationUrl, 0x656A3BB3, 0xECC0, 0x43FD, 0x84, 0x77, 0x4A, 0xE0, 0x40, 0x4A, 0x96, 0xCD, 0x00002006);   // VT_LPWSTR
-        // from ThisDevice metadata
-DEFINE_PROPERTYKEY(PKEY_PNPX_FriendlyName, 0x656A3BB3, 0xECC0, 0x43FD, 0x84, 0x77, 0x4A, 0xE0, 0x40, 0x4A, 0x96, 0xCD, 0x00003000);   // VT_LPWSTR (localizable)
-DEFINE_PROPERTYKEY(PKEY_PNPX_FirmwareVersion, 0x656A3BB3, 0xECC0, 0x43FD, 0x84, 0x77, 0x4A, 0xE0, 0x40, 0x4A, 0x96, 0xCD, 0x00003001);   // VT_LPWSTR
-DEFINE_PROPERTYKEY(PKEY_PNPX_SerialNumber, 0x656A3BB3, 0xECC0, 0x43FD, 0x84, 0x77, 0x4A, 0xE0, 0x40, 0x4A, 0x96, 0xCD, 0x00003002);   // VT_LPWSTR
-DEFINE_PROPERTYKEY(PKEY_PNPX_DeviceCategory, 0x656A3BB3, 0xECC0, 0x43FD, 0x84, 0x77, 0x4A, 0xE0, 0x40, 0x4A, 0x96, 0xCD, 0x00003004);   // VT_LPWSTR | VT_VECTOR
-        // DeviceCategory values
-#define PNPX_DEVICECATEGORY_COMPUTER                            L"Computers"
-#define PNPX_DEVICECATEGORY_INPUTDEVICE                         L"Input"
-#define PNPX_DEVICECATEGORY_PRINTER                             L"Printers"
-#define PNPX_DEVICECATEGORY_SCANNER                             L"Scanners"
-#define PNPX_DEVICECATEGORY_FAX                                 L"FAX"
-#define PNPX_DEVICECATEGORY_MFP                                 L"MFP"
-#define PNPX_DEVICECATEGORY_CAMERA                              L"Cameras"
-#define PNPX_DEVICECATEGORY_STORAGE                             L"Storage"
-#define PNPX_DEVICECATEGORY_NETWORK_INFRASTRUCTURE              L"NetworkInfrastructure"
-#define PNPX_DEVICECATEGORY_DISPLAYS                            L"Displays"
-#define PNPX_DEVICECATEGORY_MULTIMEDIA_DEVICE                   L"MediaDevices"
-#define PNPX_DEVICECATEGORY_GAMING_DEVICE                       L"Gaming"
-#define PNPX_DEVICECATEGORY_TELEPHONE                           L"Phones"
-#define PNPX_DEVICECATEGORY_HOME_AUTOMATION_SYSTEM              L"HomeAutomation"
-#define PNPX_DEVICECATEGORY_HOME_SECURITY_SYSTEM                L"HomeSecurity"
-#define PNPX_DEVICECATEGORY_OTHER                               L"Other"
-DEFINE_PROPERTYKEY(PKEY_PNPX_DeviceCategory_Desc, 0x656A3BB3, 0xECC0, 0x43FD, 0x84, 0x77, 0x4A, 0xE0, 0x40, 0x4A, 0x96, 0xCD, 0x00003005);   // VT_LPWSTR | VT_VECTOR
-
-DEFINE_PROPERTYKEY(PKEY_PNPX_PhysicalAddress, 0x656A3BB3, 0xECC0, 0x43FD, 0x84, 0x77, 0x4A, 0xE0, 0x40, 0x4A, 0x96, 0xCD, 0x00003006);   // VT_UI1 | VT_VECTOR
-DEFINE_PROPERTYKEY(PKEY_PNPX_NetworkInterfaceLuid, 0x656A3BB3, 0xECC0, 0x43FD, 0x84, 0x77, 0x4A, 0xE0, 0x40, 0x4A, 0x96, 0xCD, 0x00003007);   // VT_UI8
-DEFINE_PROPERTYKEY(PKEY_PNPX_NetworkInterfaceGuid, 0x656A3BB3, 0xECC0, 0x43FD, 0x84, 0x77, 0x4A, 0xE0, 0x40, 0x4A, 0x96, 0xCD, 0x00003008);   // VT_LPWSTR
-DEFINE_PROPERTYKEY(PKEY_PNPX_IpAddress, 0x656A3BB3, 0xECC0, 0x43FD, 0x84, 0x77, 0x4A, 0xE0, 0x40, 0x4A, 0x96, 0xCD, 0x00003009);   // VT_LPWSTR | VT_VECTOR
-        // from Relationship metadata
-DEFINE_PROPERTYKEY(PKEY_PNPX_ServiceAddress, 0x656A3BB3, 0xECC0, 0x43FD, 0x84, 0x77, 0x4A, 0xE0, 0x40, 0x4A, 0x96, 0xCD, 0x00004000);   // VT_LPWSTR | VT_VECTOR
-DEFINE_PROPERTYKEY(PKEY_PNPX_ServiceId, 0x656A3BB3, 0xECC0, 0x43FD, 0x84, 0x77, 0x4A, 0xE0, 0x40, 0x4A, 0x96, 0xCD, 0x00004001);   // VT_LPWSTR
-DEFINE_PROPERTYKEY(PKEY_PNPX_ServiceTypes, 0x656A3BB3, 0xECC0, 0x43FD, 0x84, 0x77, 0x4A, 0xE0, 0x40, 0x4A, 0x96, 0xCD, 0x00004002);   // VT_LPWSTR | VT_VECTOR
-        // Association DB PKEYs
-DEFINE_API_PKEY(PKEY_PNPX_Devnode, PnPXDevNode, 0x656A3BB3, 0xECC0, 0x43FD, 0x84, 0x77, 0x4A, 0xE0, 0x40, 0x4A, 0x96, 0xCD, 0x00000001); // VT_BOOL
-DEFINE_API_PKEY(PKEY_PNPX_AssociationState, AssociationState, 0x656A3BB3, 0xECC0, 0x43FD, 0x84, 0x77, 0x4A, 0xE0, 0x40, 0x4A, 0x96, 0xCD, 0x00000002); // VT_UINT
-DEFINE_API_PKEY(PKEY_PNPX_AssociatedInstanceId, AssociatedInstanceId, 0x656A3BB3, 0xECC0, 0x43FD, 0x84, 0x77, 0x4A, 0xE0, 0x40, 0x4A, 0x96, 0xCD, 0x00000003); // VT_LPWSTR
-        // for Computer Discovery
-DEFINE_PROPERTYKEY(PKEY_PNPX_DomainName, 0x656A3BB3, 0xECC0, 0x43FD, 0x84, 0x77, 0x4A, 0xE0, 0x40, 0x4A, 0x96, 0xCD, 0x00005000);   // VT_LPWSTR
-// Use PKEY_ComputerName (propkey.h) DEFINE_PROPERTYKEY(PKEY_PNPX_MachineName, 0x656A3BB3, 0xECC0, 0x43FD, 0x84, 0x77, 0x4A, 0xE0, 0x40, 0x4A, 0x96, 0xCD, 0x00005001);   // VT_LPWSTR
-DEFINE_PROPERTYKEY(PKEY_PNPX_ShareName, 0x656A3BB3, 0xECC0, 0x43FD, 0x84, 0x77, 0x4A, 0xE0, 0x40, 0x4A, 0x96, 0xCD, 0x00005002);   // VT_LPWSTR
-
-    // SSDP Provider custom properties
-DEFINE_PROPERTYKEY(PKEY_SSDP_AltLocationInfo, 0x656A3BB3, 0xECC0, 0x43FD, 0x84, 0x77, 0x4A, 0xE0, 0x40, 0x4A, 0x96, 0xCD, 0x00006000);   // VT_LPWSTR
-DEFINE_PROPERTYKEY(PKEY_SSDP_DevLifeTime, 0x656A3BB3, 0xECC0, 0x43FD, 0x84, 0x77, 0x4A, 0xE0, 0x40, 0x4A, 0x96, 0xCD, 0x00006001);   // VT_UI4
-DEFINE_PROPERTYKEY(PKEY_SSDP_NetworkInterface, 0x656A3BB3, 0xECC0, 0x43FD, 0x84, 0x77, 0x4A, 0xE0, 0x40, 0x4A, 0x96, 0xCD, 0x00006002);   // VT_BOOL
-
-// FMTID_PNPXDynamicProperty = {4FC5077E-B686-44BE-93E3-86CAFE368CCD}
-DEFINE_GUID(FMTID_PNPXDynamicProperty, 0x4FC5077E, 0xB686, 0x44BE, 0x93, 0xE3, 0x86, 0xCA, 0xFE, 0x36, 0x8C, 0xCD);
-
-DEFINE_PROPERTYKEY(PKEY_PNPX_Installable, 0x4FC5077E, 0xB686, 0x44BE, 0x93, 0xE3, 0x86, 0xCA, 0xFE, 0x36, 0x8C, 0xCD, 0x00000001); // VT_BOOL
-DEFINE_PROPERTYKEY(PKEY_PNPX_Associated, 0x4FC5077E, 0xB686, 0x44BE, 0x93, 0xE3, 0x86, 0xCA, 0xFE, 0x36, 0x8C, 0xCD, 0x00000002); // VT_BOOL
-// PKEY_PNPX_Installed to be deprecated in Longhorn Server timeframe
-// this PKEY really represents Associated state
-#define PKEY_PNPX_Installed PKEY_PNPX_Associated    // Deprecated! Please use PKEY_PNPX_Associated
-DEFINE_PROPERTYKEY(PKEY_PNPX_CompatibleTypes, 0x4FC5077E, 0xB686, 0x44BE, 0x93, 0xE3, 0x86, 0xCA, 0xFE, 0x36, 0x8C, 0xCD, 0x00000003); // VT_LPWSTR | VT_VECTOR
-
-    // WNET Provider properties
-DEFINE_PROPERTYKEY(PKEY_WNET_Scope, 0xdebda43a, 0x37b3, 0x4383, 0x91, 0xE7, 0x44, 0x98, 0xda, 0x29, 0x95, 0xab, 0x00000001); // VT_UINT
-DEFINE_PROPERTYKEY(PKEY_WNET_Type, 0xdebda43a, 0x37b3, 0x4383, 0x91, 0xE7, 0x44, 0x98, 0xda, 0x29, 0x95, 0xab, 0x00000002); // VT_UINT
-DEFINE_PROPERTYKEY(PKEY_WNET_DisplayType, 0xdebda43a, 0x37b3, 0x4383, 0x91, 0xE7, 0x44, 0x98, 0xda, 0x29, 0x95, 0xab, 0x00000003); // VT_UINT
-DEFINE_PROPERTYKEY(PKEY_WNET_Usage, 0xdebda43a, 0x37b3, 0x4383, 0x91, 0xE7, 0x44, 0x98, 0xda, 0x29, 0x95, 0xab, 0x00000004); // VT_UINT
-DEFINE_PROPERTYKEY(PKEY_WNET_LocalName, 0xdebda43a, 0x37b3, 0x4383, 0x91, 0xE7, 0x44, 0x98, 0xda, 0x29, 0x95, 0xab, 0x00000005); // VT_LPWSTR
-DEFINE_PROPERTYKEY(PKEY_WNET_RemoteName, 0xdebda43a, 0x37b3, 0x4383, 0x91, 0xE7, 0x44, 0x98, 0xda, 0x29, 0x95, 0xab, 0x00000006); // VT_LPWSTR
-DEFINE_PROPERTYKEY(PKEY_WNET_Comment, 0xdebda43a, 0x37b3, 0x4383, 0x91, 0xE7, 0x44, 0x98, 0xda, 0x29, 0x95, 0xab, 0x00000007); // VT_LPWSTR
-DEFINE_PROPERTYKEY(PKEY_WNET_Provider, 0xdebda43a, 0x37b3, 0x4383, 0x91, 0xE7, 0x44, 0x98, 0xda, 0x29, 0x95, 0xab, 0x00000008); // VT_LPWSTR
-
-
-    // WCN Provider properties
-
-DEFINE_PROPERTYKEY(PKEY_WCN_Version, 0x88190b80, 0x4684, 0x11da, 0xa2, 0x6a, 0x00, 0x02, 0xb3, 0x98, 0x8e, 0x81, 0x00000001); // VT_UI1
-DEFINE_PROPERTYKEY(PKEY_WCN_RequestType, 0x88190b81, 0x4684, 0x11da, 0xa2, 0x6a, 0x00, 0x02, 0xb3, 0x98, 0x8e, 0x81, 0x00000002); // VT_INT
-DEFINE_PROPERTYKEY(PKEY_WCN_AuthType, 0x88190b82, 0x4684, 0x11da, 0xa2, 0x6a, 0x00, 0x02, 0xb3, 0x98, 0x8e, 0x81, 0x00000003); // VT_INT
-DEFINE_PROPERTYKEY(PKEY_WCN_EncryptType, 0x88190b83, 0x4684, 0x11da, 0xa2, 0x6a, 0x00, 0x02, 0xb3, 0x98, 0x8e, 0x81, 0x00000004); // VT_INT
-DEFINE_PROPERTYKEY(PKEY_WCN_ConnType, 0x88190b84, 0x4684, 0x11da, 0xa2, 0x6a, 0x00, 0x02, 0xb3, 0x98, 0x8e, 0x81, 0x00000005); // VT_INT
-DEFINE_PROPERTYKEY(PKEY_WCN_ConfigMethods, 0x88190b85, 0x4684, 0x11da, 0xa2, 0x6a, 0x00, 0x02, 0xb3, 0x98, 0x8e, 0x81, 0x00000006); // VT_INT
-// map WCN DeviceType to PKEY_PNPX_DeviceCategory
-//DEFINE_PROPERTYKEY(PKEY_WCN_DeviceType, 0x88190b86, 0x4684, 0x11da, 0xa2, 0x6a, 0x00, 0x02, 0xb3, 0x98, 0x8e, 0x81, 0x00000007); // VT_INT
-DEFINE_PROPERTYKEY(PKEY_WCN_RfBand, 0x88190b87, 0x4684, 0x11da, 0xa2, 0x6a, 0x00, 0x02, 0xb3, 0x98, 0x8e, 0x81, 0x00000008); // VT_INT
-DEFINE_PROPERTYKEY(PKEY_WCN_AssocState, 0x88190b88, 0x4684, 0x11da, 0xa2, 0x6a, 0x00, 0x02, 0xb3, 0x98, 0x8e, 0x81, 0x00000009); // VT_INT
-DEFINE_PROPERTYKEY(PKEY_WCN_ConfigError, 0x88190b89, 0x4684, 0x11da, 0xa2, 0x6a, 0x00, 0x02, 0xb3, 0x98, 0x8e, 0x81, 0x0000000a); // VT_INT
-DEFINE_PROPERTYKEY(PKEY_WCN_ConfigState, 0x88190b89, 0x4684, 0x11da, 0xa2, 0x6a, 0x00, 0x02, 0xb3, 0x98, 0x8e, 0x81, 0x0000000b); // VT_UI1
-DEFINE_PROPERTYKEY(PKEY_WCN_DevicePasswordId, 0x88190b89, 0x4684, 0x11da, 0xa2, 0x6a, 0x00, 0x02, 0xb3, 0x98, 0x8e, 0x81, 0x0000000c); // VT_INT
-DEFINE_PROPERTYKEY(PKEY_WCN_OSVersion, 0x88190b89, 0x4684, 0x11da, 0xa2, 0x6a, 0x00, 0x02, 0xb3, 0x98, 0x8e, 0x81, 0x0000000d); // VT_UINT
-DEFINE_PROPERTYKEY(PKEY_WCN_VendorExtension, 0x88190b8a, 0x4684, 0x11da, 0xa2, 0x6a, 0x00, 0x02, 0xb3, 0x98, 0x8e, 0x81, 0x0000000e); // VT_UI1 | VT_VECTOR
-DEFINE_PROPERTYKEY(PKEY_WCN_RegistrarType, 0x88190b8b, 0x4684, 0x11da, 0xa2, 0x6a, 0x00, 0x02, 0xb3, 0x98, 0x8e, 0x81, 0x0000000f); // VT_INT
-
-//-----------------------------------------------------------------------------
-// DriverPackage properties
-
-#define PKEY_DriverPackage_Model                PKEY_DrvPkg_Model
-#define PKEY_DriverPackage_VendorWebSite        PKEY_DrvPkg_VendorWebSite
-#define PKEY_DriverPackage_DetailedDescription  PKEY_DrvPkg_DetailedDescription
-#define PKEY_DriverPackage_DocumentationLink    PKEY_DrvPkg_DocumentationLink
-#define PKEY_DriverPackage_Icon                 PKEY_DrvPkg_Icon
-#define PKEY_DriverPackage_BrandingIcon         PKEY_DrvPkg_BrandingIcon
-
-//-----------------------------------------------------------------------------
-// Hardware properties
-
-DEFINE_PROPERTYKEY(PKEY_Hardware_Devinst, 0x5EAF3EF2, 0xE0CA, 0x4598, 0xBF, 0x06, 0x71, 0xED, 0x1D, 0x9D, 0xD9, 0x53, 4097);
-
-//  Name:     System.Hardware.DisplayAttribute -- PKEY_Hardware_DisplayAttribute
-//  Type:     Unspecified -- VT_NULL
-//  FormatID: 5EAF3EF2-E0CA-4598-BF06-71ED1D9DD953, 5
-DEFINE_PROPERTYKEY(PKEY_Hardware_DisplayAttribute, 0x5EAF3EF2, 0xE0CA, 0x4598, 0xBF, 0x06, 0x71, 0xED, 0x1D, 0x9D, 0xD9, 0x53, 5);
-
-//  Name:     System.Hardware.DriverDate -- PKEY_Hardware_DriverDate
-//  Type:     Unspecified -- VT_NULL
-//  FormatID: 5EAF3EF2-E0CA-4598-BF06-71ED1D9DD953, 11
-DEFINE_PROPERTYKEY(PKEY_Hardware_DriverDate, 0x5EAF3EF2, 0xE0CA, 0x4598, 0xBF, 0x06, 0x71, 0xED, 0x1D, 0x9D, 0xD9, 0x53, 11);
-
-//  Name:     System.Hardware.DriverProvider -- PKEY_Hardware_DriverProvider
-//  Type:     Unspecified -- VT_NULL
-//  FormatID: 5EAF3EF2-E0CA-4598-BF06-71ED1D9DD953, 10
-DEFINE_PROPERTYKEY(PKEY_Hardware_DriverProvider, 0x5EAF3EF2, 0xE0CA, 0x4598, 0xBF, 0x06, 0x71, 0xED, 0x1D, 0x9D, 0xD9, 0x53, 10);
-
-//  Name:     System.Hardware.DriverVersion -- PKEY_Hardware_DriverVersion
-//  Type:     Unspecified -- VT_NULL
-//  FormatID: 5EAF3EF2-E0CA-4598-BF06-71ED1D9DD953, 9
-DEFINE_PROPERTYKEY(PKEY_Hardware_DriverVersion, 0x5EAF3EF2, 0xE0CA, 0x4598, 0xBF, 0x06, 0x71, 0xED, 0x1D, 0x9D, 0xD9, 0x53, 9);
-
-//  Name:     System.Hardware.Function -- PKEY_Hardware_Function
-//  Type:     Unspecified -- VT_NULL
-//  FormatID: 5EAF3EF2-E0CA-4598-BF06-71ED1D9DD953, 4099
-DEFINE_PROPERTYKEY(PKEY_Hardware_Function, 0x5EAF3EF2, 0xE0CA, 0x4598, 0xBF, 0x06, 0x71, 0xED, 0x1D, 0x9D, 0xD9, 0x53, 4099);
-
-//  Name:     System.Hardware.Icon -- PKEY_Hardware_Icon
-//  Type:     Unspecified -- VT_NULL
-//  FormatID: 5EAF3EF2-E0CA-4598-BF06-71ED1D9DD953, 3
-DEFINE_PROPERTYKEY(PKEY_Hardware_Icon, 0x5EAF3EF2, 0xE0CA, 0x4598, 0xBF, 0x06, 0x71, 0xED, 0x1D, 0x9D, 0xD9, 0x53, 3);
-
-//  Name:     System.Hardware.Image -- PKEY_Hardware_Image
-//  Type:     Unspecified -- VT_NULL
-//  FormatID: 5EAF3EF2-E0CA-4598-BF06-71ED1D9DD953, 4098
-DEFINE_PROPERTYKEY(PKEY_Hardware_Image, 0x5EAF3EF2, 0xE0CA, 0x4598, 0xBF, 0x06, 0x71, 0xED, 0x1D, 0x9D, 0xD9, 0x53, 4098);
-
-//  Name:     System.Hardware.Manufacturer -- PKEY_Hardware_Manufacturer
-//  Type:     Unspecified -- VT_NULL
-//  FormatID: 5EAF3EF2-E0CA-4598-BF06-71ED1D9DD953, 6
-DEFINE_PROPERTYKEY(PKEY_Hardware_Manufacturer, 0x5EAF3EF2, 0xE0CA, 0x4598, 0xBF, 0x06, 0x71, 0xED, 0x1D, 0x9D, 0xD9, 0x53, 6);
-
-//  Name:     System.Hardware.Model -- PKEY_Hardware_Model
-//  Type:     Unspecified -- VT_NULL
-//  FormatID: 5EAF3EF2-E0CA-4598-BF06-71ED1D9DD953, 7
-DEFINE_PROPERTYKEY(PKEY_Hardware_Model, 0x5EAF3EF2, 0xE0CA, 0x4598, 0xBF, 0x06, 0x71, 0xED, 0x1D, 0x9D, 0xD9, 0x53, 7);
-
-//  Name:     System.Hardware.Name -- PKEY_Hardware_Name
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 5EAF3EF2-E0CA-4598-BF06-71ED1D9DD953, 2
-DEFINE_PROPERTYKEY(PKEY_Hardware_Name, 0x5EAF3EF2, 0xE0CA, 0x4598, 0xBF, 0x06, 0x71, 0xED, 0x1D, 0x9D, 0xD9, 0x53, 2);
-
-//  Name:     System.Hardware.SerialNumber -- PKEY_Hardware_SerialNumber
-//  Type:     Unspecified -- VT_NULL
-//  FormatID: 5EAF3EF2-E0CA-4598-BF06-71ED1D9DD953, 8
-DEFINE_PROPERTYKEY(PKEY_Hardware_SerialNumber, 0x5EAF3EF2, 0xE0CA, 0x4598, 0xBF, 0x06, 0x71, 0xED, 0x1D, 0x9D, 0xD9, 0x53, 8);
-
-//  Name:     System.Hardware.ShellAttributes -- PKEY_Hardware_ShellAttributes
-//  Type:     Unspecified -- VT_NULL
-//  FormatID: 5EAF3EF2-E0CA-4598-BF06-71ED1D9DD953, 4100
-DEFINE_PROPERTYKEY(PKEY_Hardware_ShellAttributes, 0x5EAF3EF2, 0xE0CA, 0x4598, 0xBF, 0x06, 0x71, 0xED, 0x1D, 0x9D, 0xD9, 0x53, 4100);
-
-//  Name:     System.Hardware.Status -- PKEY_Hardware_Status
-//  Type:     Unspecified -- VT_NULL
-//  FormatID: 5EAF3EF2-E0CA-4598-BF06-71ED1D9DD953, 4096
-DEFINE_PROPERTYKEY(PKEY_Hardware_Status, 0x5EAF3EF2, 0xE0CA, 0x4598, 0xBF, 0x06, 0x71, 0xED, 0x1D, 0x9D, 0xD9, 0x53, 4096);
-
-
+#pragma once
+
+#if __GNUC__ >=3
+#pragma GCC system_header
+#endif
+
+#ifndef DEFINE_API_PKEY
+#include <propkey.h>
+#endif
+
+#include <FunctionDiscoveryKeys_devpkey.h>
+
+// FMTID_FD = {904b03a2-471d-423c-a584-f3483238a146}
+DEFINE_GUID(FMTID_FD, 0x904b03a2, 0x471d, 0x423c, 0xa5, 0x84, 0xf3, 0x48, 0x32, 0x38, 0xa1, 0x46);
+DEFINE_API_PKEY(PKEY_FD_Visibility, VisibilityFlags, 0x904b03a2, 0x471d, 0x423c, 0xa5, 0x84, 0xf3, 0x48, 0x32, 0x38, 0xa1, 0x46, 0x00000001); //    VT_UINT
+#define FD_Visibility_Default   0
+#define FD_Visibility_Hidden    1
+
+// FMTID_Device = {78C34FC8-104A-4aca-9EA4-524D52996E57}
+DEFINE_GUID(FMTID_Device, 0x78c34fc8, 0x104a, 0x4aca, 0x9e, 0xa4, 0x52, 0x4d, 0x52, 0x99, 0x6e, 0x57);
+
+DEFINE_API_PKEY(PKEY_Device_NotPresent,     DeviceNotPresent   , 0x904b03a2, 0x471d, 0x423c, 0xa5, 0x84, 0xf3, 0x48, 0x32, 0x38, 0xa1, 0x46, 0x00000002); //    VT_UINT
+DEFINE_API_PKEY(PKEY_Device_QueueSize,      DeviceQueueSize    , 0x78c34fc8, 0x104a, 0x4aca, 0x9e, 0xa4, 0x52, 0x4d, 0x52, 0x99, 0x6e, 0x57, 0x00000024); //    VT_UI4
+DEFINE_API_PKEY(PKEY_Device_Status,         DeviceStatus       , 0x78c34fc8, 0x104a, 0x4aca, 0x9e, 0xa4, 0x52, 0x4d, 0x52, 0x99, 0x6e, 0x57, 0x00000025); //    VT_LPWSTR
+DEFINE_API_PKEY(PKEY_Device_Comment,        DeviceComment      , 0x78c34fc8, 0x104a, 0x4aca, 0x9e, 0xa4, 0x52, 0x4d, 0x52, 0x99, 0x6e, 0x57, 0x00000026); //    VT_LPWSTR
+DEFINE_API_PKEY(PKEY_Device_Model,          DeviceModel        , 0x78c34fc8, 0x104a, 0x4aca, 0x9e, 0xa4, 0x52, 0x4d, 0x52, 0x99, 0x6e, 0x57, 0x00000027); //    VT_LPWSTR
+
+//  Name:     System.Device.BIOSVersion -- PKEY_Device_BIOSVersion
+//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)  Legacy code may treat this as VT_BSTR.
+//  FormatID: EAEE7F1D-6A33-44D1-9441-5F46DEF23198, 9
+DEFINE_PROPERTYKEY(PKEY_Device_BIOSVersion, 0xEAEE7F1D, 0x6A33, 0x44D1, 0x94, 0x41, 0x5F, 0x46, 0xDE, 0xF2, 0x31, 0x98, 9);
+
+DEFINE_API_PKEY(PKEY_Write_Time,            WriteTime          , 0xf53b7e1c, 0x77e0, 0x4450, 0x8c, 0x5f, 0xa7, 0x6c, 0xc7, 0xfd, 0xe0, 0x58, 0x00000100); //    VT_FILETIME
+
+#ifdef FD_XP
+DEFINE_API_PKEY(PKEY_Device_InstanceId, DeviceInstanceId   , 0x78c34fc8, 0x104a, 0x4aca, 0x9e, 0xa4, 0x52, 0x4d, 0x52, 0x99, 0x6e, 0x57, 0x00000100); //    VT_LPWSTR
+#endif
+DEFINE_API_PKEY(PKEY_Device_Interface,  DeviceInterface    , 0x78c34fc8, 0x104a, 0x4aca, 0x9e, 0xa4, 0x52, 0x4d, 0x52, 0x99, 0x6e, 0x57, 0x00000101); //    VT_CLSID
+
+DEFINE_API_PKEY(PKEY_ExposedIIDs,           ExposedIIDs       , 0x78c34fc8, 0x104a, 0x4aca, 0x9e, 0xa4, 0x52, 0x4d, 0x52, 0x99, 0x6e, 0x57, 0x00003002); //  VT_VECTOR | VT_CLSID
+DEFINE_API_PKEY(PKEY_ExposedCLSIDs,         ExposedCLSIDs     , 0x78c34fc8, 0x104a, 0x4aca, 0x9e, 0xa4, 0x52, 0x4d, 0x52, 0x99, 0x6e, 0x57, 0x00003003); //  VT_VECTOR | VT_CLSID
+DEFINE_API_PKEY(PKEY_InstanceValidatorClsid,InstanceValidator , 0x78c34fc8, 0x104a, 0x4aca, 0x9e, 0xa4, 0x52, 0x4d, 0x52, 0x99, 0x6e, 0x57, 0x00003004); // VT_CLSID
+
+// FMTID_WSD = {92506491-FF95-4724-A05A-5B81885A7C92}
+DEFINE_GUID(FMTID_WSD, 0x92506491, 0xFF95, 0x4724, 0xA0, 0x5A, 0x5B, 0x81, 0x88, 0x5A, 0x7C, 0x92);
+
+DEFINE_API_PKEY(PKEY_WSD_AddressURI, WSD_AddressURI, 0x92506491, 0xFF95, 0x4724, 0xA0, 0x5A, 0x5B, 0x81, 0x88, 0x5A, 0x7C, 0x92, 0x00001000);   // VT_LPWSTR
+DEFINE_API_PKEY(PKEY_WSD_Types, WSD_Types, 0x92506491, 0xFF95, 0x4724, 0xA0, 0x5A, 0x5B, 0x81, 0x88, 0x5A, 0x7C, 0x92, 0x00001001); // VT_LPWSTR
+DEFINE_API_PKEY(PKEY_WSD_Scopes, WSD_Scopes, 0x92506491, 0xFF95, 0x4724, 0xA0, 0x5A, 0x5B, 0x81, 0x88, 0x5A, 0x7C, 0x92, 0x00001002);   // VT_LPWSTR
+DEFINE_API_PKEY(PKEY_WSD_MetadataVersion, WSD_MetadataVersion, 0x92506491, 0xFF95, 0x4724, 0xA0, 0x5A, 0x5B, 0x81, 0x88, 0x5A, 0x7C, 0x92, 0x00001003); //VT_UI8
+DEFINE_API_PKEY(PKEY_WSD_AppSeqInstanceID, WSD_AppSeqInstanceID, 0x92506491, 0xFF95, 0x4724, 0xA0, 0x5A, 0x5B, 0x81, 0x88, 0x5A, 0x7C, 0x92, 0x00001004);   // VT_UI8
+DEFINE_API_PKEY(PKEY_WSD_AppSeqSessionID, WSD_AppSeqSessionID, 0x92506491, 0xFF95, 0x4724, 0xA0, 0x5A, 0x5B, 0x81, 0x88, 0x5A, 0x7C, 0x92, 0x00001005); // VT_LPWSTR
+DEFINE_API_PKEY(PKEY_WSD_AppSeqMessageNumber, WSD_AppSeqMessageNumber, 0x92506491, 0xFF95, 0x4724, 0xA0, 0x5A, 0x5B, 0x81, 0x88, 0x5A, 0x7C, 0x92, 0x00001006); // VT_UI8
+DEFINE_API_PKEY(PKEY_WSD_XAddrs, WSD_XAddrs, 0x92506491, 0xFF95, 0x4724, 0xA0, 0x5A, 0x5B, 0x81, 0x88, 0x5A, 0x7C, 0x92, 0x00002000); // VT_LPWSTR or VT_VECTOR | VT_LPWSTR
+
+DEFINE_API_PKEY(PKEY_WSD_MetadataClean, WSD_MetadataClean, 0x92506491, 0xFF95, 0x4724, 0xA0, 0x5A, 0x5B, 0x81, 0x88, 0x5A, 0x7C, 0x92, 0x00000001);   // VT_BOOL
+DEFINE_API_PKEY(PKEY_WSD_ServiceInfo, WSD_ServiceInfo, 0x92506491, 0xFF95, 0x4724, 0xA0, 0x5A, 0x5B, 0x81, 0x88, 0x5A, 0x7C, 0x92, 0x00000002);   // VT_VECTOR|VT_VARIANT (variants are VT_UNKNOWN)
+
+DEFINE_API_PKEY(PKEY_PUBSVCS_TYPE, PUBSVCS_TYPE, 0xF1B88AD3, 0x109C, 0x4FD2, 0xBA, 0x3F, 0x53, 0x5A, 0x76, 0x5F, 0x82, 0xF4, 0x00005001); // VT_LPWSTR
+DEFINE_API_PKEY(PKEY_PUBSVCS_SCOPE, PUBSVCS_SCOPE, 0x2AE2B567, 0xEECB, 0x4A3E, 0xB7, 0x53, 0x54, 0xC7, 0x25, 0x49, 0x43, 0x66, 0x00005002);   // VT_LPWSTR | VT_VECTOR
+DEFINE_API_PKEY(PKEY_PUBSVCS_METADATA, PUBSVCS_METADATA, 0x63C6D5B8, 0xF73A, 0x4ACA, 0x96, 0x7E, 0x0C, 0xC7, 0x87, 0xE0, 0xB5, 0x59, 0x00005003); // VT_LPWSTR
+DEFINE_API_PKEY(PKEY_PUBSVCS_METADATA_VERSION, PUBSVCS_METADATA_VERSION, 0xC0C96C15, 0x1823, 0x4E5B, 0x93, 0x48, 0xE8, 0x25, 0x19, 0x92, 0x3F, 0x04, 0x00005004); // VT_UI8
+DEFINE_API_PKEY(PKEY_PUBSVCS_NETWORK_PROFILES_ALLOWED, PUBSVCS_NETWORK_PROFILES_ALLOWED, 0x63C6D5B8, 0xF73A, 0x4ACA, 0x96, 0x7E, 0x0C, 0xC7, 0x87, 0xE0, 0xB5, 0x59, 0x00005005); // VT_VECTOR | VT_LPWSTR
+DEFINE_API_PKEY(PKEY_PUBSVCS_NETWORK_PROFILES_DENIED, PUBSVCS_NETWORK_PROFILES_DENIED, 0x63C6D5B8, 0xF73A, 0x4ACA, 0x96, 0x7E, 0x0C, 0xC7, 0x87, 0xE0, 0xB5, 0x59, 0x00005006); // VT_VECTOR | VT_LPWSTR
+DEFINE_API_PKEY(PKEY_PUBSVCS_NETWORK_PROFILES_DEFAULT, PUBSVCS_NETWORK_PROFILES_DEFAULT, 0x63C6D5B8, 0xF73A, 0x4ACA, 0x96, 0x7E, 0x0C, 0xC7, 0x87, 0xE0, 0xB5, 0x59, 0x00005007); // VT_BOOL
+
+// FMTID_PNPX = {656A3BB3-ECC0-43FD-8477-4AE0404A96CD}
+DEFINE_GUID(FMTID_PNPX, 0x656A3BB3, 0xECC0, 0x43FD, 0x84, 0x77, 0x4A, 0xE0, 0x40, 0x4A, 0x96, 0xCD);
+        // from Discovery messages
+DEFINE_PROPERTYKEY(PKEY_PNPX_GlobalIdentity, 0x656A3BB3, 0xECC0, 0x43FD, 0x84, 0x77, 0x4A, 0xE0, 0x40, 0x4A, 0x96, 0xCD, 0x00001000);   // VT_LPWSTR
+DEFINE_PROPERTYKEY(PKEY_PNPX_Types, 0x656A3BB3, 0xECC0, 0x43FD, 0x84, 0x77, 0x4A, 0xE0, 0x40, 0x4A, 0x96, 0xCD, 0x00001001);   // VT_LPWSTR | VT_VECTOR
+DEFINE_PROPERTYKEY(PKEY_PNPX_Scopes, 0x656A3BB3, 0xECC0, 0x43FD, 0x84, 0x77, 0x4A, 0xE0, 0x40, 0x4A, 0x96, 0xCD, 0x00001002);   // VT_LPWSTR | VT_VECTOR
+DEFINE_PROPERTYKEY(PKEY_PNPX_XAddrs, 0x656A3BB3, 0xECC0, 0x43FD, 0x84, 0x77, 0x4A, 0xE0, 0x40, 0x4A, 0x96, 0xCD, 0x00001003);   // VT_LPWSTR | VT_VECTOR
+DEFINE_PROPERTYKEY(PKEY_PNPX_MetadataVersion, 0x656A3BB3, 0xECC0, 0x43FD, 0x84, 0x77, 0x4A, 0xE0, 0x40, 0x4A, 0x96, 0xCD, 0x00001004);   // VT_UI8
+DEFINE_PROPERTYKEY(PKEY_PNPX_ID, 0x656A3BB3, 0xECC0, 0x43FD, 0x84, 0x77, 0x4A, 0xE0, 0x40, 0x4A, 0x96, 0xCD, 0x00001005);   // VT_LPWSTR
+DEFINE_PROPERTYKEY(PKEY_PNPX_RootProxy, 0x656A3BB3, 0xECC0, 0x43FD, 0x84, 0x77, 0x4A, 0xE0, 0x40, 0x4A, 0x96, 0xCD, 0x00001006);   // VT_BOOL
+
+        // for Directed Discovery
+DEFINE_PROPERTYKEY(PKEY_PNPX_RemoteAddress, 0x656A3BB3, 0xECC0, 0x43FD, 0x84, 0x77, 0x4A, 0xE0, 0x40, 0x4A, 0x96, 0xCD, 0x00001006);   // VT_LPWSTR
+
+        // from ThisModel metadata
+DEFINE_PROPERTYKEY(PKEY_PNPX_Manufacturer, 0x656A3BB3, 0xECC0, 0x43FD, 0x84, 0x77, 0x4A, 0xE0, 0x40, 0x4A, 0x96, 0xCD, 0x00002000);   // VT_LPWSTR (localizable)
+DEFINE_PROPERTYKEY(PKEY_PNPX_ManufacturerUrl, 0x656A3BB3, 0xECC0, 0x43FD, 0x84, 0x77, 0x4A, 0xE0, 0x40, 0x4A, 0x96, 0xCD, 0x00002001);   // VT_LPWSTR
+DEFINE_PROPERTYKEY(PKEY_PNPX_ModelName, 0x656A3BB3, 0xECC0, 0x43FD, 0x84, 0x77, 0x4A, 0xE0, 0x40, 0x4A, 0x96, 0xCD, 0x00002002);   // VT_LPWSTR (localizable)
+DEFINE_PROPERTYKEY(PKEY_PNPX_ModelNumber, 0x656A3BB3, 0xECC0, 0x43FD, 0x84, 0x77, 0x4A, 0xE0, 0x40, 0x4A, 0x96, 0xCD, 0x00002003);   // VT_LPWSTR
+DEFINE_PROPERTYKEY(PKEY_PNPX_ModelUrl, 0x656A3BB3, 0xECC0, 0x43FD, 0x84, 0x77, 0x4A, 0xE0, 0x40, 0x4A, 0x96, 0xCD, 0x00002004);   // VT_LPWSTR
+DEFINE_PROPERTYKEY(PKEY_PNPX_Upc, 0x656A3BB3, 0xECC0, 0x43FD, 0x84, 0x77, 0x4A, 0xE0, 0x40, 0x4A, 0x96, 0xCD, 0x00002005);   // VT_LPWSTR
+DEFINE_PROPERTYKEY(PKEY_PNPX_PresentationUrl, 0x656A3BB3, 0xECC0, 0x43FD, 0x84, 0x77, 0x4A, 0xE0, 0x40, 0x4A, 0x96, 0xCD, 0x00002006);   // VT_LPWSTR
+        // from ThisDevice metadata
+DEFINE_PROPERTYKEY(PKEY_PNPX_FriendlyName, 0x656A3BB3, 0xECC0, 0x43FD, 0x84, 0x77, 0x4A, 0xE0, 0x40, 0x4A, 0x96, 0xCD, 0x00003000);   // VT_LPWSTR (localizable)
+DEFINE_PROPERTYKEY(PKEY_PNPX_FirmwareVersion, 0x656A3BB3, 0xECC0, 0x43FD, 0x84, 0x77, 0x4A, 0xE0, 0x40, 0x4A, 0x96, 0xCD, 0x00003001);   // VT_LPWSTR
+DEFINE_PROPERTYKEY(PKEY_PNPX_SerialNumber, 0x656A3BB3, 0xECC0, 0x43FD, 0x84, 0x77, 0x4A, 0xE0, 0x40, 0x4A, 0x96, 0xCD, 0x00003002);   // VT_LPWSTR
+DEFINE_PROPERTYKEY(PKEY_PNPX_DeviceCategory, 0x656A3BB3, 0xECC0, 0x43FD, 0x84, 0x77, 0x4A, 0xE0, 0x40, 0x4A, 0x96, 0xCD, 0x00003004);   // VT_LPWSTR | VT_VECTOR
+        // DeviceCategory values
+#define PNPX_DEVICECATEGORY_COMPUTER                            L"Computers"
+#define PNPX_DEVICECATEGORY_INPUTDEVICE                         L"Input"
+#define PNPX_DEVICECATEGORY_PRINTER                             L"Printers"
+#define PNPX_DEVICECATEGORY_SCANNER                             L"Scanners"
+#define PNPX_DEVICECATEGORY_FAX                                 L"FAX"
+#define PNPX_DEVICECATEGORY_MFP                                 L"MFP"
+#define PNPX_DEVICECATEGORY_CAMERA                              L"Cameras"
+#define PNPX_DEVICECATEGORY_STORAGE                             L"Storage"
+#define PNPX_DEVICECATEGORY_NETWORK_INFRASTRUCTURE              L"NetworkInfrastructure"
+#define PNPX_DEVICECATEGORY_DISPLAYS                            L"Displays"
+#define PNPX_DEVICECATEGORY_MULTIMEDIA_DEVICE                   L"MediaDevices"
+#define PNPX_DEVICECATEGORY_GAMING_DEVICE                       L"Gaming"
+#define PNPX_DEVICECATEGORY_TELEPHONE                           L"Phones"
+#define PNPX_DEVICECATEGORY_HOME_AUTOMATION_SYSTEM              L"HomeAutomation"
+#define PNPX_DEVICECATEGORY_HOME_SECURITY_SYSTEM                L"HomeSecurity"
+#define PNPX_DEVICECATEGORY_OTHER                               L"Other"
+DEFINE_PROPERTYKEY(PKEY_PNPX_DeviceCategory_Desc, 0x656A3BB3, 0xECC0, 0x43FD, 0x84, 0x77, 0x4A, 0xE0, 0x40, 0x4A, 0x96, 0xCD, 0x00003005);   // VT_LPWSTR | VT_VECTOR
+
+DEFINE_PROPERTYKEY(PKEY_PNPX_PhysicalAddress, 0x656A3BB3, 0xECC0, 0x43FD, 0x84, 0x77, 0x4A, 0xE0, 0x40, 0x4A, 0x96, 0xCD, 0x00003006);   // VT_UI1 | VT_VECTOR
+DEFINE_PROPERTYKEY(PKEY_PNPX_NetworkInterfaceLuid, 0x656A3BB3, 0xECC0, 0x43FD, 0x84, 0x77, 0x4A, 0xE0, 0x40, 0x4A, 0x96, 0xCD, 0x00003007);   // VT_UI8
+DEFINE_PROPERTYKEY(PKEY_PNPX_NetworkInterfaceGuid, 0x656A3BB3, 0xECC0, 0x43FD, 0x84, 0x77, 0x4A, 0xE0, 0x40, 0x4A, 0x96, 0xCD, 0x00003008);   // VT_LPWSTR
+DEFINE_PROPERTYKEY(PKEY_PNPX_IpAddress, 0x656A3BB3, 0xECC0, 0x43FD, 0x84, 0x77, 0x4A, 0xE0, 0x40, 0x4A, 0x96, 0xCD, 0x00003009);   // VT_LPWSTR | VT_VECTOR
+        // from Relationship metadata
+DEFINE_PROPERTYKEY(PKEY_PNPX_ServiceAddress, 0x656A3BB3, 0xECC0, 0x43FD, 0x84, 0x77, 0x4A, 0xE0, 0x40, 0x4A, 0x96, 0xCD, 0x00004000);   // VT_LPWSTR | VT_VECTOR
+DEFINE_PROPERTYKEY(PKEY_PNPX_ServiceId, 0x656A3BB3, 0xECC0, 0x43FD, 0x84, 0x77, 0x4A, 0xE0, 0x40, 0x4A, 0x96, 0xCD, 0x00004001);   // VT_LPWSTR
+DEFINE_PROPERTYKEY(PKEY_PNPX_ServiceTypes, 0x656A3BB3, 0xECC0, 0x43FD, 0x84, 0x77, 0x4A, 0xE0, 0x40, 0x4A, 0x96, 0xCD, 0x00004002);   // VT_LPWSTR | VT_VECTOR
+        // Association DB PKEYs
+DEFINE_API_PKEY(PKEY_PNPX_Devnode, PnPXDevNode, 0x656A3BB3, 0xECC0, 0x43FD, 0x84, 0x77, 0x4A, 0xE0, 0x40, 0x4A, 0x96, 0xCD, 0x00000001); // VT_BOOL
+DEFINE_API_PKEY(PKEY_PNPX_AssociationState, AssociationState, 0x656A3BB3, 0xECC0, 0x43FD, 0x84, 0x77, 0x4A, 0xE0, 0x40, 0x4A, 0x96, 0xCD, 0x00000002); // VT_UINT
+DEFINE_API_PKEY(PKEY_PNPX_AssociatedInstanceId, AssociatedInstanceId, 0x656A3BB3, 0xECC0, 0x43FD, 0x84, 0x77, 0x4A, 0xE0, 0x40, 0x4A, 0x96, 0xCD, 0x00000003); // VT_LPWSTR
+        // for Computer Discovery
+DEFINE_PROPERTYKEY(PKEY_PNPX_DomainName, 0x656A3BB3, 0xECC0, 0x43FD, 0x84, 0x77, 0x4A, 0xE0, 0x40, 0x4A, 0x96, 0xCD, 0x00005000);   // VT_LPWSTR
+// Use PKEY_ComputerName (propkey.h) DEFINE_PROPERTYKEY(PKEY_PNPX_MachineName, 0x656A3BB3, 0xECC0, 0x43FD, 0x84, 0x77, 0x4A, 0xE0, 0x40, 0x4A, 0x96, 0xCD, 0x00005001);   // VT_LPWSTR
+DEFINE_PROPERTYKEY(PKEY_PNPX_ShareName, 0x656A3BB3, 0xECC0, 0x43FD, 0x84, 0x77, 0x4A, 0xE0, 0x40, 0x4A, 0x96, 0xCD, 0x00005002);   // VT_LPWSTR
+
+    // SSDP Provider custom properties
+DEFINE_PROPERTYKEY(PKEY_SSDP_AltLocationInfo, 0x656A3BB3, 0xECC0, 0x43FD, 0x84, 0x77, 0x4A, 0xE0, 0x40, 0x4A, 0x96, 0xCD, 0x00006000);   // VT_LPWSTR
+DEFINE_PROPERTYKEY(PKEY_SSDP_DevLifeTime, 0x656A3BB3, 0xECC0, 0x43FD, 0x84, 0x77, 0x4A, 0xE0, 0x40, 0x4A, 0x96, 0xCD, 0x00006001);   // VT_UI4
+DEFINE_PROPERTYKEY(PKEY_SSDP_NetworkInterface, 0x656A3BB3, 0xECC0, 0x43FD, 0x84, 0x77, 0x4A, 0xE0, 0x40, 0x4A, 0x96, 0xCD, 0x00006002);   // VT_BOOL
+
+// FMTID_PNPXDynamicProperty = {4FC5077E-B686-44BE-93E3-86CAFE368CCD}
+DEFINE_GUID(FMTID_PNPXDynamicProperty, 0x4FC5077E, 0xB686, 0x44BE, 0x93, 0xE3, 0x86, 0xCA, 0xFE, 0x36, 0x8C, 0xCD);
+
+DEFINE_PROPERTYKEY(PKEY_PNPX_Installable, 0x4FC5077E, 0xB686, 0x44BE, 0x93, 0xE3, 0x86, 0xCA, 0xFE, 0x36, 0x8C, 0xCD, 0x00000001); // VT_BOOL
+DEFINE_PROPERTYKEY(PKEY_PNPX_Associated, 0x4FC5077E, 0xB686, 0x44BE, 0x93, 0xE3, 0x86, 0xCA, 0xFE, 0x36, 0x8C, 0xCD, 0x00000002); // VT_BOOL
+// PKEY_PNPX_Installed to be deprecated in Longhorn Server timeframe
+// this PKEY really represents Associated state
+#define PKEY_PNPX_Installed PKEY_PNPX_Associated    // Deprecated! Please use PKEY_PNPX_Associated
+DEFINE_PROPERTYKEY(PKEY_PNPX_CompatibleTypes, 0x4FC5077E, 0xB686, 0x44BE, 0x93, 0xE3, 0x86, 0xCA, 0xFE, 0x36, 0x8C, 0xCD, 0x00000003); // VT_LPWSTR | VT_VECTOR
+
+    // WNET Provider properties
+DEFINE_PROPERTYKEY(PKEY_WNET_Scope, 0xdebda43a, 0x37b3, 0x4383, 0x91, 0xE7, 0x44, 0x98, 0xda, 0x29, 0x95, 0xab, 0x00000001); // VT_UINT
+DEFINE_PROPERTYKEY(PKEY_WNET_Type, 0xdebda43a, 0x37b3, 0x4383, 0x91, 0xE7, 0x44, 0x98, 0xda, 0x29, 0x95, 0xab, 0x00000002); // VT_UINT
+DEFINE_PROPERTYKEY(PKEY_WNET_DisplayType, 0xdebda43a, 0x37b3, 0x4383, 0x91, 0xE7, 0x44, 0x98, 0xda, 0x29, 0x95, 0xab, 0x00000003); // VT_UINT
+DEFINE_PROPERTYKEY(PKEY_WNET_Usage, 0xdebda43a, 0x37b3, 0x4383, 0x91, 0xE7, 0x44, 0x98, 0xda, 0x29, 0x95, 0xab, 0x00000004); // VT_UINT
+DEFINE_PROPERTYKEY(PKEY_WNET_LocalName, 0xdebda43a, 0x37b3, 0x4383, 0x91, 0xE7, 0x44, 0x98, 0xda, 0x29, 0x95, 0xab, 0x00000005); // VT_LPWSTR
+DEFINE_PROPERTYKEY(PKEY_WNET_RemoteName, 0xdebda43a, 0x37b3, 0x4383, 0x91, 0xE7, 0x44, 0x98, 0xda, 0x29, 0x95, 0xab, 0x00000006); // VT_LPWSTR
+DEFINE_PROPERTYKEY(PKEY_WNET_Comment, 0xdebda43a, 0x37b3, 0x4383, 0x91, 0xE7, 0x44, 0x98, 0xda, 0x29, 0x95, 0xab, 0x00000007); // VT_LPWSTR
+DEFINE_PROPERTYKEY(PKEY_WNET_Provider, 0xdebda43a, 0x37b3, 0x4383, 0x91, 0xE7, 0x44, 0x98, 0xda, 0x29, 0x95, 0xab, 0x00000008); // VT_LPWSTR
+
+
+    // WCN Provider properties
+
+DEFINE_PROPERTYKEY(PKEY_WCN_Version, 0x88190b80, 0x4684, 0x11da, 0xa2, 0x6a, 0x00, 0x02, 0xb3, 0x98, 0x8e, 0x81, 0x00000001); // VT_UI1
+DEFINE_PROPERTYKEY(PKEY_WCN_RequestType, 0x88190b81, 0x4684, 0x11da, 0xa2, 0x6a, 0x00, 0x02, 0xb3, 0x98, 0x8e, 0x81, 0x00000002); // VT_INT
+DEFINE_PROPERTYKEY(PKEY_WCN_AuthType, 0x88190b82, 0x4684, 0x11da, 0xa2, 0x6a, 0x00, 0x02, 0xb3, 0x98, 0x8e, 0x81, 0x00000003); // VT_INT
+DEFINE_PROPERTYKEY(PKEY_WCN_EncryptType, 0x88190b83, 0x4684, 0x11da, 0xa2, 0x6a, 0x00, 0x02, 0xb3, 0x98, 0x8e, 0x81, 0x00000004); // VT_INT
+DEFINE_PROPERTYKEY(PKEY_WCN_ConnType, 0x88190b84, 0x4684, 0x11da, 0xa2, 0x6a, 0x00, 0x02, 0xb3, 0x98, 0x8e, 0x81, 0x00000005); // VT_INT
+DEFINE_PROPERTYKEY(PKEY_WCN_ConfigMethods, 0x88190b85, 0x4684, 0x11da, 0xa2, 0x6a, 0x00, 0x02, 0xb3, 0x98, 0x8e, 0x81, 0x00000006); // VT_INT
+// map WCN DeviceType to PKEY_PNPX_DeviceCategory
+//DEFINE_PROPERTYKEY(PKEY_WCN_DeviceType, 0x88190b86, 0x4684, 0x11da, 0xa2, 0x6a, 0x00, 0x02, 0xb3, 0x98, 0x8e, 0x81, 0x00000007); // VT_INT
+DEFINE_PROPERTYKEY(PKEY_WCN_RfBand, 0x88190b87, 0x4684, 0x11da, 0xa2, 0x6a, 0x00, 0x02, 0xb3, 0x98, 0x8e, 0x81, 0x00000008); // VT_INT
+DEFINE_PROPERTYKEY(PKEY_WCN_AssocState, 0x88190b88, 0x4684, 0x11da, 0xa2, 0x6a, 0x00, 0x02, 0xb3, 0x98, 0x8e, 0x81, 0x00000009); // VT_INT
+DEFINE_PROPERTYKEY(PKEY_WCN_ConfigError, 0x88190b89, 0x4684, 0x11da, 0xa2, 0x6a, 0x00, 0x02, 0xb3, 0x98, 0x8e, 0x81, 0x0000000a); // VT_INT
+DEFINE_PROPERTYKEY(PKEY_WCN_ConfigState, 0x88190b89, 0x4684, 0x11da, 0xa2, 0x6a, 0x00, 0x02, 0xb3, 0x98, 0x8e, 0x81, 0x0000000b); // VT_UI1
+DEFINE_PROPERTYKEY(PKEY_WCN_DevicePasswordId, 0x88190b89, 0x4684, 0x11da, 0xa2, 0x6a, 0x00, 0x02, 0xb3, 0x98, 0x8e, 0x81, 0x0000000c); // VT_INT
+DEFINE_PROPERTYKEY(PKEY_WCN_OSVersion, 0x88190b89, 0x4684, 0x11da, 0xa2, 0x6a, 0x00, 0x02, 0xb3, 0x98, 0x8e, 0x81, 0x0000000d); // VT_UINT
+DEFINE_PROPERTYKEY(PKEY_WCN_VendorExtension, 0x88190b8a, 0x4684, 0x11da, 0xa2, 0x6a, 0x00, 0x02, 0xb3, 0x98, 0x8e, 0x81, 0x0000000e); // VT_UI1 | VT_VECTOR
+DEFINE_PROPERTYKEY(PKEY_WCN_RegistrarType, 0x88190b8b, 0x4684, 0x11da, 0xa2, 0x6a, 0x00, 0x02, 0xb3, 0x98, 0x8e, 0x81, 0x0000000f); // VT_INT
+
+//-----------------------------------------------------------------------------
+// DriverPackage properties
+
+#define PKEY_DriverPackage_Model                PKEY_DrvPkg_Model
+#define PKEY_DriverPackage_VendorWebSite        PKEY_DrvPkg_VendorWebSite
+#define PKEY_DriverPackage_DetailedDescription  PKEY_DrvPkg_DetailedDescription
+#define PKEY_DriverPackage_DocumentationLink    PKEY_DrvPkg_DocumentationLink
+#define PKEY_DriverPackage_Icon                 PKEY_DrvPkg_Icon
+#define PKEY_DriverPackage_BrandingIcon         PKEY_DrvPkg_BrandingIcon
+
+//-----------------------------------------------------------------------------
+// Hardware properties
+
+DEFINE_PROPERTYKEY(PKEY_Hardware_Devinst, 0x5EAF3EF2, 0xE0CA, 0x4598, 0xBF, 0x06, 0x71, 0xED, 0x1D, 0x9D, 0xD9, 0x53, 4097);
+
+//  Name:     System.Hardware.DisplayAttribute -- PKEY_Hardware_DisplayAttribute
+//  Type:     Unspecified -- VT_NULL
+//  FormatID: 5EAF3EF2-E0CA-4598-BF06-71ED1D9DD953, 5
+DEFINE_PROPERTYKEY(PKEY_Hardware_DisplayAttribute, 0x5EAF3EF2, 0xE0CA, 0x4598, 0xBF, 0x06, 0x71, 0xED, 0x1D, 0x9D, 0xD9, 0x53, 5);
+
+//  Name:     System.Hardware.DriverDate -- PKEY_Hardware_DriverDate
+//  Type:     Unspecified -- VT_NULL
+//  FormatID: 5EAF3EF2-E0CA-4598-BF06-71ED1D9DD953, 11
+DEFINE_PROPERTYKEY(PKEY_Hardware_DriverDate, 0x5EAF3EF2, 0xE0CA, 0x4598, 0xBF, 0x06, 0x71, 0xED, 0x1D, 0x9D, 0xD9, 0x53, 11);
+
+//  Name:     System.Hardware.DriverProvider -- PKEY_Hardware_DriverProvider
+//  Type:     Unspecified -- VT_NULL
+//  FormatID: 5EAF3EF2-E0CA-4598-BF06-71ED1D9DD953, 10
+DEFINE_PROPERTYKEY(PKEY_Hardware_DriverProvider, 0x5EAF3EF2, 0xE0CA, 0x4598, 0xBF, 0x06, 0x71, 0xED, 0x1D, 0x9D, 0xD9, 0x53, 10);
+
+//  Name:     System.Hardware.DriverVersion -- PKEY_Hardware_DriverVersion
+//  Type:     Unspecified -- VT_NULL
+//  FormatID: 5EAF3EF2-E0CA-4598-BF06-71ED1D9DD953, 9
+DEFINE_PROPERTYKEY(PKEY_Hardware_DriverVersion, 0x5EAF3EF2, 0xE0CA, 0x4598, 0xBF, 0x06, 0x71, 0xED, 0x1D, 0x9D, 0xD9, 0x53, 9);
+
+//  Name:     System.Hardware.Function -- PKEY_Hardware_Function
+//  Type:     Unspecified -- VT_NULL
+//  FormatID: 5EAF3EF2-E0CA-4598-BF06-71ED1D9DD953, 4099
+DEFINE_PROPERTYKEY(PKEY_Hardware_Function, 0x5EAF3EF2, 0xE0CA, 0x4598, 0xBF, 0x06, 0x71, 0xED, 0x1D, 0x9D, 0xD9, 0x53, 4099);
+
+//  Name:     System.Hardware.Icon -- PKEY_Hardware_Icon
+//  Type:     Unspecified -- VT_NULL
+//  FormatID: 5EAF3EF2-E0CA-4598-BF06-71ED1D9DD953, 3
+DEFINE_PROPERTYKEY(PKEY_Hardware_Icon, 0x5EAF3EF2, 0xE0CA, 0x4598, 0xBF, 0x06, 0x71, 0xED, 0x1D, 0x9D, 0xD9, 0x53, 3);
+
+//  Name:     System.Hardware.Image -- PKEY_Hardware_Image
+//  Type:     Unspecified -- VT_NULL
+//  FormatID: 5EAF3EF2-E0CA-4598-BF06-71ED1D9DD953, 4098
+DEFINE_PROPERTYKEY(PKEY_Hardware_Image, 0x5EAF3EF2, 0xE0CA, 0x4598, 0xBF, 0x06, 0x71, 0xED, 0x1D, 0x9D, 0xD9, 0x53, 4098);
+
+//  Name:     System.Hardware.Manufacturer -- PKEY_Hardware_Manufacturer
+//  Type:     Unspecified -- VT_NULL
+//  FormatID: 5EAF3EF2-E0CA-4598-BF06-71ED1D9DD953, 6
+DEFINE_PROPERTYKEY(PKEY_Hardware_Manufacturer, 0x5EAF3EF2, 0xE0CA, 0x4598, 0xBF, 0x06, 0x71, 0xED, 0x1D, 0x9D, 0xD9, 0x53, 6);
+
+//  Name:     System.Hardware.Model -- PKEY_Hardware_Model
+//  Type:     Unspecified -- VT_NULL
+//  FormatID: 5EAF3EF2-E0CA-4598-BF06-71ED1D9DD953, 7
+DEFINE_PROPERTYKEY(PKEY_Hardware_Model, 0x5EAF3EF2, 0xE0CA, 0x4598, 0xBF, 0x06, 0x71, 0xED, 0x1D, 0x9D, 0xD9, 0x53, 7);
+
+//  Name:     System.Hardware.Name -- PKEY_Hardware_Name
+//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
+//  FormatID: 5EAF3EF2-E0CA-4598-BF06-71ED1D9DD953, 2
+DEFINE_PROPERTYKEY(PKEY_Hardware_Name, 0x5EAF3EF2, 0xE0CA, 0x4598, 0xBF, 0x06, 0x71, 0xED, 0x1D, 0x9D, 0xD9, 0x53, 2);
+
+//  Name:     System.Hardware.SerialNumber -- PKEY_Hardware_SerialNumber
+//  Type:     Unspecified -- VT_NULL
+//  FormatID: 5EAF3EF2-E0CA-4598-BF06-71ED1D9DD953, 8
+DEFINE_PROPERTYKEY(PKEY_Hardware_SerialNumber, 0x5EAF3EF2, 0xE0CA, 0x4598, 0xBF, 0x06, 0x71, 0xED, 0x1D, 0x9D, 0xD9, 0x53, 8);
+
+//  Name:     System.Hardware.ShellAttributes -- PKEY_Hardware_ShellAttributes
+//  Type:     Unspecified -- VT_NULL
+//  FormatID: 5EAF3EF2-E0CA-4598-BF06-71ED1D9DD953, 4100
+DEFINE_PROPERTYKEY(PKEY_Hardware_ShellAttributes, 0x5EAF3EF2, 0xE0CA, 0x4598, 0xBF, 0x06, 0x71, 0xED, 0x1D, 0x9D, 0xD9, 0x53, 4100);
+
+//  Name:     System.Hardware.Status -- PKEY_Hardware_Status
+//  Type:     Unspecified -- VT_NULL
+//  FormatID: 5EAF3EF2-E0CA-4598-BF06-71ED1D9DD953, 4096
+DEFINE_PROPERTYKEY(PKEY_Hardware_Status, 0x5EAF3EF2, 0xE0CA, 0x4598, 0xBF, 0x06, 0x71, 0xED, 0x1D, 0x9D, 0xD9, 0x53, 4096);
+
+
diff --git a/src/hostapi/wasapi/mingw-include/ksmedia.h b/src/hostapi/wasapi/mingw-include/ksmedia.h
index 09729ba..f029b01 100644
--- a/src/hostapi/wasapi/mingw-include/ksmedia.h
+++ b/src/hostapi/wasapi/mingw-include/ksmedia.h
@@ -417,11 +417,11 @@ DEFINE_GUIDSTRUCT("6994AD04-93EF-11D0-A3CC-00A0C9223196",KSCATEGORY_AUDIO);
 DEFINE_GUIDSTRUCT("6994AD05-93EF-11D0-A3CC-00A0C9223196",KSCATEGORY_VIDEO);
 #define KSCATEGORY_VIDEO DEFINE_GUIDNAMED(KSCATEGORY_VIDEO)
 
-/* Added for Vista and later */
-#define STATIC_KSCATEGORY_REALTIME \
-    0xEB115FFCL, 0x10C8, 0x4964, 0x83, 0x1D, 0x6D, 0xCB, 0x02, 0xE6, 0xF2, 0x3F
-DEFINE_GUIDSTRUCT("EB115FFC-10C8-4964-831D-6DCB02E6F23F", KSCATEGORY_REALTIME);
-#define KSCATEGORY_REALTIME DEFINE_GUIDNAMED(KSCATEGORY_REALTIME)
+/* Added for Vista and later */
+#define STATIC_KSCATEGORY_REALTIME \
+    0xEB115FFCL, 0x10C8, 0x4964, 0x83, 0x1D, 0x6D, 0xCB, 0x02, 0xE6, 0xF2, 0x3F
+DEFINE_GUIDSTRUCT("EB115FFC-10C8-4964-831D-6DCB02E6F23F", KSCATEGORY_REALTIME);
+#define KSCATEGORY_REALTIME DEFINE_GUIDNAMED(KSCATEGORY_REALTIME)
 
 #define STATIC_KSCATEGORY_TEXT						\
 	0x6994AD06L,0x93EF,0x11D0,0xA3,0xCC,0x00,0xA0,0xC9,0x22,0x31,0x96
diff --git a/src/hostapi/wasapi/mingw-include/mmdeviceapi.h b/src/hostapi/wasapi/mingw-include/mmdeviceapi.h
index c1e7925..a75e475 100644
--- a/src/hostapi/wasapi/mingw-include/mmdeviceapi.h
+++ b/src/hostapi/wasapi/mingw-include/mmdeviceapi.h
@@ -1,929 +1,929 @@
-
-
-/* this ALWAYS GENERATED file contains the definitions for the interfaces */
-
-
- /* File created by MIDL compiler version 7.00.0499 */
-/* Compiler settings for mmdeviceapi.idl:
-    Oicf, W1, Zp8, env=Win32 (32b run)
-    protocol : dce , ms_ext, c_ext, robust
-    error checks: allocation ref bounds_check enum stub_data 
-    VC __declspec() decoration level: 
-         __declspec(uuid()), __declspec(selectany), __declspec(novtable)
-         DECLSPEC_UUID(), MIDL_INTERFACE()
-*/
-//@@MIDL_FILE_HEADING(  )
-
-#pragma warning( disable: 4049 )  /* more than 64k source lines */
-
-
-/* verify that the <rpcndr.h> version is high enough to compile this file*/
-#ifndef __REQUIRED_RPCNDR_H_VERSION__
-#define __REQUIRED_RPCNDR_H_VERSION__ 500
-#endif
-
-/* verify that the <rpcsal.h> version is high enough to compile this file*/
-#ifndef __REQUIRED_RPCSAL_H_VERSION__
-#define __REQUIRED_RPCSAL_H_VERSION__ 100
-#endif
-
-#include "rpc.h"
-#include "rpcndr.h"
-
-#ifndef __RPCNDR_H_VERSION__
-#error this stub requires an updated version of <rpcndr.h>
-#endif // __RPCNDR_H_VERSION__
-
-#ifndef COM_NO_WINDOWS_H
-#include "windows.h"
-#include "ole2.h"
-#endif /*COM_NO_WINDOWS_H*/
-
-#ifndef __mmdeviceapi_h__
-#define __mmdeviceapi_h__
-
-#if __GNUC__ >=3
-#pragma GCC system_header
-#endif
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-#pragma once
-#endif
-
-/* Forward Declarations */ 
-
-#ifndef __IMMNotificationClient_FWD_DEFINED__
-#define __IMMNotificationClient_FWD_DEFINED__
-typedef interface IMMNotificationClient IMMNotificationClient;
-#endif 	/* __IMMNotificationClient_FWD_DEFINED__ */
-
-
-#ifndef __IMMDevice_FWD_DEFINED__
-#define __IMMDevice_FWD_DEFINED__
-typedef interface IMMDevice IMMDevice;
-#endif 	/* __IMMDevice_FWD_DEFINED__ */
-
-
-#ifndef __IMMDeviceCollection_FWD_DEFINED__
-#define __IMMDeviceCollection_FWD_DEFINED__
-typedef interface IMMDeviceCollection IMMDeviceCollection;
-#endif 	/* __IMMDeviceCollection_FWD_DEFINED__ */
-
-
-#ifndef __IMMEndpoint_FWD_DEFINED__
-#define __IMMEndpoint_FWD_DEFINED__
-typedef interface IMMEndpoint IMMEndpoint;
-#endif 	/* __IMMEndpoint_FWD_DEFINED__ */
-
-
-#ifndef __IMMDeviceEnumerator_FWD_DEFINED__
-#define __IMMDeviceEnumerator_FWD_DEFINED__
-typedef interface IMMDeviceEnumerator IMMDeviceEnumerator;
-#endif 	/* __IMMDeviceEnumerator_FWD_DEFINED__ */
-
-
-#ifndef __IMMDeviceActivator_FWD_DEFINED__
-#define __IMMDeviceActivator_FWD_DEFINED__
-typedef interface IMMDeviceActivator IMMDeviceActivator;
-#endif 	/* __IMMDeviceActivator_FWD_DEFINED__ */
-
-
-#ifndef __MMDeviceEnumerator_FWD_DEFINED__
-#define __MMDeviceEnumerator_FWD_DEFINED__
-
-#ifdef __cplusplus
-typedef class MMDeviceEnumerator MMDeviceEnumerator;
-#else
-typedef struct MMDeviceEnumerator MMDeviceEnumerator;
-#endif /* __cplusplus */
-
-#endif 	/* __MMDeviceEnumerator_FWD_DEFINED__ */
-
-
-/* header files for imported files */
-#include "unknwn.h"
-#include "propsys.h"
-
-#ifdef __cplusplus
-extern "C"{
-#endif 
-
-
-/* interface __MIDL_itf_mmdeviceapi_0000_0000 */
-/* [local] */ 
-
-#define E_NOTFOUND HRESULT_FROM_WIN32(ERROR_NOT_FOUND)
-#define E_UNSUPPORTED_TYPE HRESULT_FROM_WIN32(ERROR_UNSUPPORTED_TYPE)
-#define DEVICE_STATE_ACTIVE      0x00000001
-#define DEVICE_STATE_DISABLED    0x00000002
-#define DEVICE_STATE_NOTPRESENT  0x00000004
-#define DEVICE_STATE_UNPLUGGED   0x00000008
-#define DEVICE_STATEMASK_ALL     0x0000000f
-#ifdef DEFINE_PROPERTYKEY
-#undef DEFINE_PROPERTYKEY
-#endif
-#ifdef INITGUID
-#define DEFINE_PROPERTYKEY(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8, pid) EXTERN_C const PROPERTYKEY name = { { l, w1, w2, { b1, b2,  b3,  b4,  b5,  b6,  b7,  b8 } }, pid }
-#else
-#define DEFINE_PROPERTYKEY(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8, pid) EXTERN_C const PROPERTYKEY name
-#endif // INITGUID
-DEFINE_PROPERTYKEY(PKEY_AudioEndpoint_FormFactor, 0x1da5d803, 0xd492, 0x4edd, 0x8c, 0x23, 0xe0, 0xc0, 0xff, 0xee, 0x7f, 0x0e, 0); 
-DEFINE_PROPERTYKEY(PKEY_AudioEndpoint_ControlPanelPageProvider, 0x1da5d803, 0xd492, 0x4edd, 0x8c, 0x23, 0xe0, 0xc0, 0xff, 0xee, 0x7f, 0x0e, 1); 
-DEFINE_PROPERTYKEY(PKEY_AudioEndpoint_Association, 0x1da5d803, 0xd492, 0x4edd, 0x8c, 0x23, 0xe0, 0xc0, 0xff, 0xee, 0x7f, 0x0e, 2);
-DEFINE_PROPERTYKEY(PKEY_AudioEndpoint_PhysicalSpeakers, 0x1da5d803, 0xd492, 0x4edd, 0x8c, 0x23, 0xe0, 0xc0, 0xff, 0xee, 0x7f, 0x0e, 3);
-DEFINE_PROPERTYKEY(PKEY_AudioEndpoint_GUID, 0x1da5d803, 0xd492, 0x4edd, 0x8c, 0x23, 0xe0, 0xc0, 0xff, 0xee, 0x7f, 0x0e, 4);
-DEFINE_PROPERTYKEY(PKEY_AudioEndpoint_Disable_SysFx, 0x1da5d803, 0xd492, 0x4edd, 0x8c, 0x23, 0xe0, 0xc0, 0xff, 0xee, 0x7f, 0x0e, 5);
-#define ENDPOINT_SYSFX_ENABLED          0x00000000  // System Effects are enabled.
-#define ENDPOINT_SYSFX_DISABLED         0x00000001  // System Effects are disabled.
-DEFINE_PROPERTYKEY(PKEY_AudioEndpoint_FullRangeSpeakers, 0x1da5d803, 0xd492, 0x4edd, 0x8c, 0x23, 0xe0, 0xc0, 0xff, 0xee, 0x7f, 0x0e, 6);
-DEFINE_PROPERTYKEY(PKEY_AudioEngine_DeviceFormat, 0xf19f064d, 0x82c, 0x4e27, 0xbc, 0x73, 0x68, 0x82, 0xa1, 0xbb, 0x8e, 0x4c, 0); 
-typedef struct tagDIRECTX_AUDIO_ACTIVATION_PARAMS
-    {
-    DWORD cbDirectXAudioActivationParams;
-    GUID guidAudioSession;
-    DWORD dwAudioStreamFlags;
-    } 	DIRECTX_AUDIO_ACTIVATION_PARAMS;
-
-typedef struct tagDIRECTX_AUDIO_ACTIVATION_PARAMS *PDIRECTX_AUDIO_ACTIVATION_PARAMS;
-
-typedef /* [public][public][public][public][public] */ 
-enum __MIDL___MIDL_itf_mmdeviceapi_0000_0000_0001
-    {	eRender	= 0,
-	eCapture	= ( eRender + 1 ) ,
-	eAll	= ( eCapture + 1 ) ,
-	EDataFlow_enum_count	= ( eAll + 1 ) 
-    } 	EDataFlow;
-
-typedef /* [public][public][public] */ 
-enum __MIDL___MIDL_itf_mmdeviceapi_0000_0000_0002
-    {	eConsole	= 0,
-	eMultimedia	= ( eConsole + 1 ) ,
-	eCommunications	= ( eMultimedia + 1 ) ,
-	ERole_enum_count	= ( eCommunications + 1 ) 
-    } 	ERole;
-
-typedef /* [public] */ 
-enum __MIDL___MIDL_itf_mmdeviceapi_0000_0000_0003
-    {	RemoteNetworkDevice	= 0,
-	Speakers	= ( RemoteNetworkDevice + 1 ) ,
-	LineLevel	= ( Speakers + 1 ) ,
-	Headphones	= ( LineLevel + 1 ) ,
-	Microphone	= ( Headphones + 1 ) ,
-	Headset	= ( Microphone + 1 ) ,
-	Handset	= ( Headset + 1 ) ,
-	UnknownDigitalPassthrough	= ( Handset + 1 ) ,
-	SPDIF	= ( UnknownDigitalPassthrough + 1 ) ,
-	HDMI	= ( SPDIF + 1 ) ,
-	UnknownFormFactor	= ( HDMI + 1 ) 
-    } 	EndpointFormFactor;
-
-
-
-extern RPC_IF_HANDLE __MIDL_itf_mmdeviceapi_0000_0000_v0_0_c_ifspec;
-extern RPC_IF_HANDLE __MIDL_itf_mmdeviceapi_0000_0000_v0_0_s_ifspec;
-
-#ifndef __IMMNotificationClient_INTERFACE_DEFINED__
-#define __IMMNotificationClient_INTERFACE_DEFINED__
-
-/* interface IMMNotificationClient */
-/* [unique][helpstring][nonextensible][uuid][local][object] */ 
-
-
-EXTERN_C const IID IID_IMMNotificationClient;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("7991EEC9-7E89-4D85-8390-6C703CEC60C0")
-    IMMNotificationClient : public IUnknown
-    {
-    public:
-        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE OnDeviceStateChanged( 
-            /* [in] */ 
-            __in  LPCWSTR pwstrDeviceId,
-            /* [in] */ 
-            __in  DWORD dwNewState) = 0;
-        
-        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE OnDeviceAdded( 
-            /* [in] */ 
-            __in  LPCWSTR pwstrDeviceId) = 0;
-        
-        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE OnDeviceRemoved( 
-            /* [in] */ 
-            __in  LPCWSTR pwstrDeviceId) = 0;
-        
-        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE OnDefaultDeviceChanged( 
-            /* [in] */ 
-            __in  EDataFlow flow,
-            /* [in] */ 
-            __in  ERole role,
-            /* [in] */ 
-            __in  LPCWSTR pwstrDefaultDeviceId) = 0;
-        
-        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE OnPropertyValueChanged( 
-            /* [in] */ 
-            __in  LPCWSTR pwstrDeviceId,
-            /* [in] */ 
-            __in  const PROPERTYKEY key) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IMMNotificationClientVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IMMNotificationClient * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IMMNotificationClient * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IMMNotificationClient * This);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *OnDeviceStateChanged )( 
-            IMMNotificationClient * This,
-            /* [in] */ 
-            __in  LPCWSTR pwstrDeviceId,
-            /* [in] */ 
-            __in  DWORD dwNewState);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *OnDeviceAdded )( 
-            IMMNotificationClient * This,
-            /* [in] */ 
-            __in  LPCWSTR pwstrDeviceId);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *OnDeviceRemoved )( 
-            IMMNotificationClient * This,
-            /* [in] */ 
-            __in  LPCWSTR pwstrDeviceId);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *OnDefaultDeviceChanged )( 
-            IMMNotificationClient * This,
-            /* [in] */ 
-            __in  EDataFlow flow,
-            /* [in] */ 
-            __in  ERole role,
-            /* [in] */ 
-            __in  LPCWSTR pwstrDefaultDeviceId);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *OnPropertyValueChanged )( 
-            IMMNotificationClient * This,
-            /* [in] */ 
-            __in  LPCWSTR pwstrDeviceId,
-            /* [in] */ 
-            __in  const PROPERTYKEY key);
-        
-        END_INTERFACE
-    } IMMNotificationClientVtbl;
-
-    interface IMMNotificationClient
-    {
-        CONST_VTBL struct IMMNotificationClientVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IMMNotificationClient_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IMMNotificationClient_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IMMNotificationClient_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IMMNotificationClient_OnDeviceStateChanged(This,pwstrDeviceId,dwNewState)	\
-    ( (This)->lpVtbl -> OnDeviceStateChanged(This,pwstrDeviceId,dwNewState) ) 
-
-#define IMMNotificationClient_OnDeviceAdded(This,pwstrDeviceId)	\
-    ( (This)->lpVtbl -> OnDeviceAdded(This,pwstrDeviceId) ) 
-
-#define IMMNotificationClient_OnDeviceRemoved(This,pwstrDeviceId)	\
-    ( (This)->lpVtbl -> OnDeviceRemoved(This,pwstrDeviceId) ) 
-
-#define IMMNotificationClient_OnDefaultDeviceChanged(This,flow,role,pwstrDefaultDeviceId)	\
-    ( (This)->lpVtbl -> OnDefaultDeviceChanged(This,flow,role,pwstrDefaultDeviceId) ) 
-
-#define IMMNotificationClient_OnPropertyValueChanged(This,pwstrDeviceId,key)	\
-    ( (This)->lpVtbl -> OnPropertyValueChanged(This,pwstrDeviceId,key) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IMMNotificationClient_INTERFACE_DEFINED__ */
-
-
-#ifndef __IMMDevice_INTERFACE_DEFINED__
-#define __IMMDevice_INTERFACE_DEFINED__
-
-/* interface IMMDevice */
-/* [unique][helpstring][nonextensible][uuid][local][object] */ 
-
-
-EXTERN_C const IID IID_IMMDevice;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("D666063F-1587-4E43-81F1-B948E807363F")
-    IMMDevice : public IUnknown
-    {
-    public:
-        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE Activate( 
-            /* [in] */ 
-            __in  REFIID iid,
-            /* [in] */ 
-            __in  DWORD dwClsCtx,
-            /* [unique][in] */ 
-            __in_opt  PROPVARIANT *pActivationParams,
-            /* [iid_is][out] */ 
-            __out  void **ppInterface) = 0;
-        
-        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE OpenPropertyStore( 
-            /* [in] */ 
-            __in  DWORD stgmAccess,
-            /* [out] */ 
-            __out  IPropertyStore **ppProperties) = 0;
-        
-        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetId( 
-            /* [out] */ 
-            __deref_out  LPWSTR *ppstrId) = 0;
-        
-        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetState( 
-            /* [out] */ 
-            __out  DWORD *pdwState) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IMMDeviceVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IMMDevice * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IMMDevice * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IMMDevice * This);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *Activate )( 
-            IMMDevice * This,
-            /* [in] */ 
-            __in  REFIID iid,
-            /* [in] */ 
-            __in  DWORD dwClsCtx,
-            /* [unique][in] */ 
-            __in_opt  PROPVARIANT *pActivationParams,
-            /* [iid_is][out] */ 
-            __out  void **ppInterface);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *OpenPropertyStore )( 
-            IMMDevice * This,
-            /* [in] */ 
-            __in  DWORD stgmAccess,
-            /* [out] */ 
-            __out  IPropertyStore **ppProperties);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetId )( 
-            IMMDevice * This,
-            /* [out] */ 
-            __deref_out  LPWSTR *ppstrId);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetState )( 
-            IMMDevice * This,
-            /* [out] */ 
-            __out  DWORD *pdwState);
-        
-        END_INTERFACE
-    } IMMDeviceVtbl;
-
-    interface IMMDevice
-    {
-        CONST_VTBL struct IMMDeviceVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IMMDevice_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IMMDevice_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IMMDevice_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IMMDevice_Activate(This,iid,dwClsCtx,pActivationParams,ppInterface)	\
-    ( (This)->lpVtbl -> Activate(This,iid,dwClsCtx,pActivationParams,ppInterface) ) 
-
-#define IMMDevice_OpenPropertyStore(This,stgmAccess,ppProperties)	\
-    ( (This)->lpVtbl -> OpenPropertyStore(This,stgmAccess,ppProperties) ) 
-
-#define IMMDevice_GetId(This,ppstrId)	\
-    ( (This)->lpVtbl -> GetId(This,ppstrId) ) 
-
-#define IMMDevice_GetState(This,pdwState)	\
-    ( (This)->lpVtbl -> GetState(This,pdwState) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IMMDevice_INTERFACE_DEFINED__ */
-
-
-#ifndef __IMMDeviceCollection_INTERFACE_DEFINED__
-#define __IMMDeviceCollection_INTERFACE_DEFINED__
-
-/* interface IMMDeviceCollection */
-/* [unique][helpstring][nonextensible][uuid][local][object] */ 
-
-
-EXTERN_C const IID IID_IMMDeviceCollection;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("0BD7A1BE-7A1A-44DB-8397-CC5392387B5E")
-    IMMDeviceCollection : public IUnknown
-    {
-    public:
-        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetCount( 
-            /* [out] */ 
-            __out  UINT *pcDevices) = 0;
-        
-        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE Item( 
-            /* [in] */ 
-            __in  UINT nDevice,
-            /* [out] */ 
-            __out  IMMDevice **ppDevice) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IMMDeviceCollectionVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IMMDeviceCollection * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IMMDeviceCollection * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IMMDeviceCollection * This);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetCount )( 
-            IMMDeviceCollection * This,
-            /* [out] */ 
-            __out  UINT *pcDevices);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *Item )( 
-            IMMDeviceCollection * This,
-            /* [in] */ 
-            __in  UINT nDevice,
-            /* [out] */ 
-            __out  IMMDevice **ppDevice);
-        
-        END_INTERFACE
-    } IMMDeviceCollectionVtbl;
-
-    interface IMMDeviceCollection
-    {
-        CONST_VTBL struct IMMDeviceCollectionVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IMMDeviceCollection_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IMMDeviceCollection_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IMMDeviceCollection_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IMMDeviceCollection_GetCount(This,pcDevices)	\
-    ( (This)->lpVtbl -> GetCount(This,pcDevices) ) 
-
-#define IMMDeviceCollection_Item(This,nDevice,ppDevice)	\
-    ( (This)->lpVtbl -> Item(This,nDevice,ppDevice) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IMMDeviceCollection_INTERFACE_DEFINED__ */
-
-
-#ifndef __IMMEndpoint_INTERFACE_DEFINED__
-#define __IMMEndpoint_INTERFACE_DEFINED__
-
-/* interface IMMEndpoint */
-/* [unique][helpstring][nonextensible][uuid][local][object] */ 
-
-
-EXTERN_C const IID IID_IMMEndpoint;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("1BE09788-6894-4089-8586-9A2A6C265AC5")
-    IMMEndpoint : public IUnknown
-    {
-    public:
-        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetDataFlow( 
-            /* [out] */ 
-            __out  EDataFlow *pDataFlow) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IMMEndpointVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IMMEndpoint * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IMMEndpoint * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IMMEndpoint * This);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetDataFlow )( 
-            IMMEndpoint * This,
-            /* [out] */ 
-            __out  EDataFlow *pDataFlow);
-        
-        END_INTERFACE
-    } IMMEndpointVtbl;
-
-    interface IMMEndpoint
-    {
-        CONST_VTBL struct IMMEndpointVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IMMEndpoint_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IMMEndpoint_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IMMEndpoint_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IMMEndpoint_GetDataFlow(This,pDataFlow)	\
-    ( (This)->lpVtbl -> GetDataFlow(This,pDataFlow) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IMMEndpoint_INTERFACE_DEFINED__ */
-
-
-#ifndef __IMMDeviceEnumerator_INTERFACE_DEFINED__
-#define __IMMDeviceEnumerator_INTERFACE_DEFINED__
-
-/* interface IMMDeviceEnumerator */
-/* [unique][helpstring][nonextensible][uuid][local][object] */ 
-
-
-EXTERN_C const IID IID_IMMDeviceEnumerator;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("A95664D2-9614-4F35-A746-DE8DB63617E6")
-    IMMDeviceEnumerator : public IUnknown
-    {
-    public:
-        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE EnumAudioEndpoints( 
-            /* [in] */ 
-            __in  EDataFlow dataFlow,
-            /* [in] */ 
-            __in  DWORD dwStateMask,
-            /* [out] */ 
-            __out  IMMDeviceCollection **ppDevices) = 0;
-        
-        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetDefaultAudioEndpoint( 
-            /* [in] */ 
-            __in  EDataFlow dataFlow,
-            /* [in] */ 
-            __in  ERole role,
-            /* [out] */ 
-            __out  IMMDevice **ppEndpoint) = 0;
-        
-        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetDevice( 
-            /*  */ 
-            __in  LPCWSTR pwstrId,
-            /* [out] */ 
-            __out  IMMDevice **ppDevice) = 0;
-        
-        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE RegisterEndpointNotificationCallback( 
-            /* [in] */ 
-            __in  IMMNotificationClient *pClient) = 0;
-        
-        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE UnregisterEndpointNotificationCallback( 
-            /* [in] */ 
-            __in  IMMNotificationClient *pClient) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IMMDeviceEnumeratorVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IMMDeviceEnumerator * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IMMDeviceEnumerator * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IMMDeviceEnumerator * This);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *EnumAudioEndpoints )( 
-            IMMDeviceEnumerator * This,
-            /* [in] */ 
-            __in  EDataFlow dataFlow,
-            /* [in] */ 
-            __in  DWORD dwStateMask,
-            /* [out] */ 
-            __out  IMMDeviceCollection **ppDevices);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetDefaultAudioEndpoint )( 
-            IMMDeviceEnumerator * This,
-            /* [in] */ 
-            __in  EDataFlow dataFlow,
-            /* [in] */ 
-            __in  ERole role,
-            /* [out] */ 
-            __out  IMMDevice **ppEndpoint);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetDevice )( 
-            IMMDeviceEnumerator * This,
-            /*  */ 
-            __in  LPCWSTR pwstrId,
-            /* [out] */ 
-            __out  IMMDevice **ppDevice);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *RegisterEndpointNotificationCallback )( 
-            IMMDeviceEnumerator * This,
-            /* [in] */ 
-            __in  IMMNotificationClient *pClient);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *UnregisterEndpointNotificationCallback )( 
-            IMMDeviceEnumerator * This,
-            /* [in] */ 
-            __in  IMMNotificationClient *pClient);
-        
-        END_INTERFACE
-    } IMMDeviceEnumeratorVtbl;
-
-    interface IMMDeviceEnumerator
-    {
-        CONST_VTBL struct IMMDeviceEnumeratorVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IMMDeviceEnumerator_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IMMDeviceEnumerator_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IMMDeviceEnumerator_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IMMDeviceEnumerator_EnumAudioEndpoints(This,dataFlow,dwStateMask,ppDevices)	\
-    ( (This)->lpVtbl -> EnumAudioEndpoints(This,dataFlow,dwStateMask,ppDevices) ) 
-
-#define IMMDeviceEnumerator_GetDefaultAudioEndpoint(This,dataFlow,role,ppEndpoint)	\
-    ( (This)->lpVtbl -> GetDefaultAudioEndpoint(This,dataFlow,role,ppEndpoint) ) 
-
-#define IMMDeviceEnumerator_GetDevice(This,pwstrId,ppDevice)	\
-    ( (This)->lpVtbl -> GetDevice(This,pwstrId,ppDevice) ) 
-
-#define IMMDeviceEnumerator_RegisterEndpointNotificationCallback(This,pClient)	\
-    ( (This)->lpVtbl -> RegisterEndpointNotificationCallback(This,pClient) ) 
-
-#define IMMDeviceEnumerator_UnregisterEndpointNotificationCallback(This,pClient)	\
-    ( (This)->lpVtbl -> UnregisterEndpointNotificationCallback(This,pClient) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IMMDeviceEnumerator_INTERFACE_DEFINED__ */
-
-
-#ifndef __IMMDeviceActivator_INTERFACE_DEFINED__
-#define __IMMDeviceActivator_INTERFACE_DEFINED__
-
-/* interface IMMDeviceActivator */
-/* [unique][helpstring][nonextensible][uuid][local][object] */ 
-
-
-EXTERN_C const IID IID_IMMDeviceActivator;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("3B0D0EA4-D0A9-4B0E-935B-09516746FAC0")
-    IMMDeviceActivator : public IUnknown
-    {
-    public:
-        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE Activate( 
-            /* [in] */ 
-            __in  REFIID iid,
-            /* [in] */ 
-            __in  IMMDevice *pDevice,
-            /* [in] */ 
-            __in_opt  PROPVARIANT *pActivationParams,
-            /* [iid_is][out] */ 
-            __out  void **ppInterface) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IMMDeviceActivatorVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IMMDeviceActivator * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IMMDeviceActivator * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IMMDeviceActivator * This);
-        
-        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *Activate )( 
-            IMMDeviceActivator * This,
-            /* [in] */ 
-            __in  REFIID iid,
-            /* [in] */ 
-            __in  IMMDevice *pDevice,
-            /* [in] */ 
-            __in_opt  PROPVARIANT *pActivationParams,
-            /* [iid_is][out] */ 
-            __out  void **ppInterface);
-        
-        END_INTERFACE
-    } IMMDeviceActivatorVtbl;
-
-    interface IMMDeviceActivator
-    {
-        CONST_VTBL struct IMMDeviceActivatorVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IMMDeviceActivator_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IMMDeviceActivator_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IMMDeviceActivator_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IMMDeviceActivator_Activate(This,iid,pDevice,pActivationParams,ppInterface)	\
-    ( (This)->lpVtbl -> Activate(This,iid,pDevice,pActivationParams,ppInterface) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IMMDeviceActivator_INTERFACE_DEFINED__ */
-
-
-/* interface __MIDL_itf_mmdeviceapi_0000_0006 */
-/* [local] */ 
-
-typedef /* [public] */ struct __MIDL___MIDL_itf_mmdeviceapi_0000_0006_0001
-    {
-    LPARAM AddPageParam;
-    IMMDevice *pEndpoint;
-    IMMDevice *pPnpInterface;
-    IMMDevice *pPnpDevnode;
-    } 	AudioExtensionParams;
-
-
-
-extern RPC_IF_HANDLE __MIDL_itf_mmdeviceapi_0000_0006_v0_0_c_ifspec;
-extern RPC_IF_HANDLE __MIDL_itf_mmdeviceapi_0000_0006_v0_0_s_ifspec;
-
-
-#ifndef __MMDeviceAPILib_LIBRARY_DEFINED__
-#define __MMDeviceAPILib_LIBRARY_DEFINED__
-
-/* library MMDeviceAPILib */
-/* [helpstring][version][uuid] */ 
-
-
-EXTERN_C const IID LIBID_MMDeviceAPILib;
-
-EXTERN_C const CLSID CLSID_MMDeviceEnumerator;
-
-#ifdef __cplusplus
-
-class DECLSPEC_UUID("BCDE0395-E52F-467C-8E3D-C4579291692E")
-MMDeviceEnumerator;
-#endif
-#endif /* __MMDeviceAPILib_LIBRARY_DEFINED__ */
-
-/* Additional Prototypes for ALL interfaces */
-
-/* end of Additional Prototypes */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
-
-
+
+
+/* this ALWAYS GENERATED file contains the definitions for the interfaces */
+
+
+ /* File created by MIDL compiler version 7.00.0499 */
+/* Compiler settings for mmdeviceapi.idl:
+    Oicf, W1, Zp8, env=Win32 (32b run)
+    protocol : dce , ms_ext, c_ext, robust
+    error checks: allocation ref bounds_check enum stub_data 
+    VC __declspec() decoration level: 
+         __declspec(uuid()), __declspec(selectany), __declspec(novtable)
+         DECLSPEC_UUID(), MIDL_INTERFACE()
+*/
+//@@MIDL_FILE_HEADING(  )
+
+#pragma warning( disable: 4049 )  /* more than 64k source lines */
+
+
+/* verify that the <rpcndr.h> version is high enough to compile this file*/
+#ifndef __REQUIRED_RPCNDR_H_VERSION__
+#define __REQUIRED_RPCNDR_H_VERSION__ 500
+#endif
+
+/* verify that the <rpcsal.h> version is high enough to compile this file*/
+#ifndef __REQUIRED_RPCSAL_H_VERSION__
+#define __REQUIRED_RPCSAL_H_VERSION__ 100
+#endif
+
+#include "rpc.h"
+#include "rpcndr.h"
+
+#ifndef __RPCNDR_H_VERSION__
+#error this stub requires an updated version of <rpcndr.h>
+#endif // __RPCNDR_H_VERSION__
+
+#ifndef COM_NO_WINDOWS_H
+#include "windows.h"
+#include "ole2.h"
+#endif /*COM_NO_WINDOWS_H*/
+
+#ifndef __mmdeviceapi_h__
+#define __mmdeviceapi_h__
+
+#if __GNUC__ >=3
+#pragma GCC system_header
+#endif
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+#pragma once
+#endif
+
+/* Forward Declarations */ 
+
+#ifndef __IMMNotificationClient_FWD_DEFINED__
+#define __IMMNotificationClient_FWD_DEFINED__
+typedef interface IMMNotificationClient IMMNotificationClient;
+#endif 	/* __IMMNotificationClient_FWD_DEFINED__ */
+
+
+#ifndef __IMMDevice_FWD_DEFINED__
+#define __IMMDevice_FWD_DEFINED__
+typedef interface IMMDevice IMMDevice;
+#endif 	/* __IMMDevice_FWD_DEFINED__ */
+
+
+#ifndef __IMMDeviceCollection_FWD_DEFINED__
+#define __IMMDeviceCollection_FWD_DEFINED__
+typedef interface IMMDeviceCollection IMMDeviceCollection;
+#endif 	/* __IMMDeviceCollection_FWD_DEFINED__ */
+
+
+#ifndef __IMMEndpoint_FWD_DEFINED__
+#define __IMMEndpoint_FWD_DEFINED__
+typedef interface IMMEndpoint IMMEndpoint;
+#endif 	/* __IMMEndpoint_FWD_DEFINED__ */
+
+
+#ifndef __IMMDeviceEnumerator_FWD_DEFINED__
+#define __IMMDeviceEnumerator_FWD_DEFINED__
+typedef interface IMMDeviceEnumerator IMMDeviceEnumerator;
+#endif 	/* __IMMDeviceEnumerator_FWD_DEFINED__ */
+
+
+#ifndef __IMMDeviceActivator_FWD_DEFINED__
+#define __IMMDeviceActivator_FWD_DEFINED__
+typedef interface IMMDeviceActivator IMMDeviceActivator;
+#endif 	/* __IMMDeviceActivator_FWD_DEFINED__ */
+
+
+#ifndef __MMDeviceEnumerator_FWD_DEFINED__
+#define __MMDeviceEnumerator_FWD_DEFINED__
+
+#ifdef __cplusplus
+typedef class MMDeviceEnumerator MMDeviceEnumerator;
+#else
+typedef struct MMDeviceEnumerator MMDeviceEnumerator;
+#endif /* __cplusplus */
+
+#endif 	/* __MMDeviceEnumerator_FWD_DEFINED__ */
+
+
+/* header files for imported files */
+#include "unknwn.h"
+#include "propsys.h"
+
+#ifdef __cplusplus
+extern "C"{
+#endif 
+
+
+/* interface __MIDL_itf_mmdeviceapi_0000_0000 */
+/* [local] */ 
+
+#define E_NOTFOUND HRESULT_FROM_WIN32(ERROR_NOT_FOUND)
+#define E_UNSUPPORTED_TYPE HRESULT_FROM_WIN32(ERROR_UNSUPPORTED_TYPE)
+#define DEVICE_STATE_ACTIVE      0x00000001
+#define DEVICE_STATE_DISABLED    0x00000002
+#define DEVICE_STATE_NOTPRESENT  0x00000004
+#define DEVICE_STATE_UNPLUGGED   0x00000008
+#define DEVICE_STATEMASK_ALL     0x0000000f
+#ifdef DEFINE_PROPERTYKEY
+#undef DEFINE_PROPERTYKEY
+#endif
+#ifdef INITGUID
+#define DEFINE_PROPERTYKEY(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8, pid) EXTERN_C const PROPERTYKEY name = { { l, w1, w2, { b1, b2,  b3,  b4,  b5,  b6,  b7,  b8 } }, pid }
+#else
+#define DEFINE_PROPERTYKEY(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8, pid) EXTERN_C const PROPERTYKEY name
+#endif // INITGUID
+DEFINE_PROPERTYKEY(PKEY_AudioEndpoint_FormFactor, 0x1da5d803, 0xd492, 0x4edd, 0x8c, 0x23, 0xe0, 0xc0, 0xff, 0xee, 0x7f, 0x0e, 0); 
+DEFINE_PROPERTYKEY(PKEY_AudioEndpoint_ControlPanelPageProvider, 0x1da5d803, 0xd492, 0x4edd, 0x8c, 0x23, 0xe0, 0xc0, 0xff, 0xee, 0x7f, 0x0e, 1); 
+DEFINE_PROPERTYKEY(PKEY_AudioEndpoint_Association, 0x1da5d803, 0xd492, 0x4edd, 0x8c, 0x23, 0xe0, 0xc0, 0xff, 0xee, 0x7f, 0x0e, 2);
+DEFINE_PROPERTYKEY(PKEY_AudioEndpoint_PhysicalSpeakers, 0x1da5d803, 0xd492, 0x4edd, 0x8c, 0x23, 0xe0, 0xc0, 0xff, 0xee, 0x7f, 0x0e, 3);
+DEFINE_PROPERTYKEY(PKEY_AudioEndpoint_GUID, 0x1da5d803, 0xd492, 0x4edd, 0x8c, 0x23, 0xe0, 0xc0, 0xff, 0xee, 0x7f, 0x0e, 4);
+DEFINE_PROPERTYKEY(PKEY_AudioEndpoint_Disable_SysFx, 0x1da5d803, 0xd492, 0x4edd, 0x8c, 0x23, 0xe0, 0xc0, 0xff, 0xee, 0x7f, 0x0e, 5);
+#define ENDPOINT_SYSFX_ENABLED          0x00000000  // System Effects are enabled.
+#define ENDPOINT_SYSFX_DISABLED         0x00000001  // System Effects are disabled.
+DEFINE_PROPERTYKEY(PKEY_AudioEndpoint_FullRangeSpeakers, 0x1da5d803, 0xd492, 0x4edd, 0x8c, 0x23, 0xe0, 0xc0, 0xff, 0xee, 0x7f, 0x0e, 6);
+DEFINE_PROPERTYKEY(PKEY_AudioEngine_DeviceFormat, 0xf19f064d, 0x82c, 0x4e27, 0xbc, 0x73, 0x68, 0x82, 0xa1, 0xbb, 0x8e, 0x4c, 0); 
+typedef struct tagDIRECTX_AUDIO_ACTIVATION_PARAMS
+    {
+    DWORD cbDirectXAudioActivationParams;
+    GUID guidAudioSession;
+    DWORD dwAudioStreamFlags;
+    } 	DIRECTX_AUDIO_ACTIVATION_PARAMS;
+
+typedef struct tagDIRECTX_AUDIO_ACTIVATION_PARAMS *PDIRECTX_AUDIO_ACTIVATION_PARAMS;
+
+typedef /* [public][public][public][public][public] */ 
+enum __MIDL___MIDL_itf_mmdeviceapi_0000_0000_0001
+    {	eRender	= 0,
+	eCapture	= ( eRender + 1 ) ,
+	eAll	= ( eCapture + 1 ) ,
+	EDataFlow_enum_count	= ( eAll + 1 ) 
+    } 	EDataFlow;
+
+typedef /* [public][public][public] */ 
+enum __MIDL___MIDL_itf_mmdeviceapi_0000_0000_0002
+    {	eConsole	= 0,
+	eMultimedia	= ( eConsole + 1 ) ,
+	eCommunications	= ( eMultimedia + 1 ) ,
+	ERole_enum_count	= ( eCommunications + 1 ) 
+    } 	ERole;
+
+typedef /* [public] */ 
+enum __MIDL___MIDL_itf_mmdeviceapi_0000_0000_0003
+    {	RemoteNetworkDevice	= 0,
+	Speakers	= ( RemoteNetworkDevice + 1 ) ,
+	LineLevel	= ( Speakers + 1 ) ,
+	Headphones	= ( LineLevel + 1 ) ,
+	Microphone	= ( Headphones + 1 ) ,
+	Headset	= ( Microphone + 1 ) ,
+	Handset	= ( Headset + 1 ) ,
+	UnknownDigitalPassthrough	= ( Handset + 1 ) ,
+	SPDIF	= ( UnknownDigitalPassthrough + 1 ) ,
+	HDMI	= ( SPDIF + 1 ) ,
+	UnknownFormFactor	= ( HDMI + 1 ) 
+    } 	EndpointFormFactor;
+
+
+
+extern RPC_IF_HANDLE __MIDL_itf_mmdeviceapi_0000_0000_v0_0_c_ifspec;
+extern RPC_IF_HANDLE __MIDL_itf_mmdeviceapi_0000_0000_v0_0_s_ifspec;
+
+#ifndef __IMMNotificationClient_INTERFACE_DEFINED__
+#define __IMMNotificationClient_INTERFACE_DEFINED__
+
+/* interface IMMNotificationClient */
+/* [unique][helpstring][nonextensible][uuid][local][object] */ 
+
+
+EXTERN_C const IID IID_IMMNotificationClient;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("7991EEC9-7E89-4D85-8390-6C703CEC60C0")
+    IMMNotificationClient : public IUnknown
+    {
+    public:
+        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE OnDeviceStateChanged( 
+            /* [in] */ 
+            __in  LPCWSTR pwstrDeviceId,
+            /* [in] */ 
+            __in  DWORD dwNewState) = 0;
+        
+        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE OnDeviceAdded( 
+            /* [in] */ 
+            __in  LPCWSTR pwstrDeviceId) = 0;
+        
+        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE OnDeviceRemoved( 
+            /* [in] */ 
+            __in  LPCWSTR pwstrDeviceId) = 0;
+        
+        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE OnDefaultDeviceChanged( 
+            /* [in] */ 
+            __in  EDataFlow flow,
+            /* [in] */ 
+            __in  ERole role,
+            /* [in] */ 
+            __in  LPCWSTR pwstrDefaultDeviceId) = 0;
+        
+        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE OnPropertyValueChanged( 
+            /* [in] */ 
+            __in  LPCWSTR pwstrDeviceId,
+            /* [in] */ 
+            __in  const PROPERTYKEY key) = 0;
+        
+    };
+    
+#else 	/* C style interface */
+
+    typedef struct IMMNotificationClientVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            IMMNotificationClient * This,
+            /* [in] */ REFIID riid,
+            /* [iid_is][out] */ 
+            __RPC__deref_out  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            IMMNotificationClient * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            IMMNotificationClient * This);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *OnDeviceStateChanged )( 
+            IMMNotificationClient * This,
+            /* [in] */ 
+            __in  LPCWSTR pwstrDeviceId,
+            /* [in] */ 
+            __in  DWORD dwNewState);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *OnDeviceAdded )( 
+            IMMNotificationClient * This,
+            /* [in] */ 
+            __in  LPCWSTR pwstrDeviceId);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *OnDeviceRemoved )( 
+            IMMNotificationClient * This,
+            /* [in] */ 
+            __in  LPCWSTR pwstrDeviceId);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *OnDefaultDeviceChanged )( 
+            IMMNotificationClient * This,
+            /* [in] */ 
+            __in  EDataFlow flow,
+            /* [in] */ 
+            __in  ERole role,
+            /* [in] */ 
+            __in  LPCWSTR pwstrDefaultDeviceId);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *OnPropertyValueChanged )( 
+            IMMNotificationClient * This,
+            /* [in] */ 
+            __in  LPCWSTR pwstrDeviceId,
+            /* [in] */ 
+            __in  const PROPERTYKEY key);
+        
+        END_INTERFACE
+    } IMMNotificationClientVtbl;
+
+    interface IMMNotificationClient
+    {
+        CONST_VTBL struct IMMNotificationClientVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define IMMNotificationClient_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define IMMNotificationClient_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define IMMNotificationClient_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define IMMNotificationClient_OnDeviceStateChanged(This,pwstrDeviceId,dwNewState)	\
+    ( (This)->lpVtbl -> OnDeviceStateChanged(This,pwstrDeviceId,dwNewState) ) 
+
+#define IMMNotificationClient_OnDeviceAdded(This,pwstrDeviceId)	\
+    ( (This)->lpVtbl -> OnDeviceAdded(This,pwstrDeviceId) ) 
+
+#define IMMNotificationClient_OnDeviceRemoved(This,pwstrDeviceId)	\
+    ( (This)->lpVtbl -> OnDeviceRemoved(This,pwstrDeviceId) ) 
+
+#define IMMNotificationClient_OnDefaultDeviceChanged(This,flow,role,pwstrDefaultDeviceId)	\
+    ( (This)->lpVtbl -> OnDefaultDeviceChanged(This,flow,role,pwstrDefaultDeviceId) ) 
+
+#define IMMNotificationClient_OnPropertyValueChanged(This,pwstrDeviceId,key)	\
+    ( (This)->lpVtbl -> OnPropertyValueChanged(This,pwstrDeviceId,key) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __IMMNotificationClient_INTERFACE_DEFINED__ */
+
+
+#ifndef __IMMDevice_INTERFACE_DEFINED__
+#define __IMMDevice_INTERFACE_DEFINED__
+
+/* interface IMMDevice */
+/* [unique][helpstring][nonextensible][uuid][local][object] */ 
+
+
+EXTERN_C const IID IID_IMMDevice;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("D666063F-1587-4E43-81F1-B948E807363F")
+    IMMDevice : public IUnknown
+    {
+    public:
+        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE Activate( 
+            /* [in] */ 
+            __in  REFIID iid,
+            /* [in] */ 
+            __in  DWORD dwClsCtx,
+            /* [unique][in] */ 
+            __in_opt  PROPVARIANT *pActivationParams,
+            /* [iid_is][out] */ 
+            __out  void **ppInterface) = 0;
+        
+        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE OpenPropertyStore( 
+            /* [in] */ 
+            __in  DWORD stgmAccess,
+            /* [out] */ 
+            __out  IPropertyStore **ppProperties) = 0;
+        
+        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetId( 
+            /* [out] */ 
+            __deref_out  LPWSTR *ppstrId) = 0;
+        
+        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetState( 
+            /* [out] */ 
+            __out  DWORD *pdwState) = 0;
+        
+    };
+    
+#else 	/* C style interface */
+
+    typedef struct IMMDeviceVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            IMMDevice * This,
+            /* [in] */ REFIID riid,
+            /* [iid_is][out] */ 
+            __RPC__deref_out  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            IMMDevice * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            IMMDevice * This);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *Activate )( 
+            IMMDevice * This,
+            /* [in] */ 
+            __in  REFIID iid,
+            /* [in] */ 
+            __in  DWORD dwClsCtx,
+            /* [unique][in] */ 
+            __in_opt  PROPVARIANT *pActivationParams,
+            /* [iid_is][out] */ 
+            __out  void **ppInterface);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *OpenPropertyStore )( 
+            IMMDevice * This,
+            /* [in] */ 
+            __in  DWORD stgmAccess,
+            /* [out] */ 
+            __out  IPropertyStore **ppProperties);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetId )( 
+            IMMDevice * This,
+            /* [out] */ 
+            __deref_out  LPWSTR *ppstrId);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetState )( 
+            IMMDevice * This,
+            /* [out] */ 
+            __out  DWORD *pdwState);
+        
+        END_INTERFACE
+    } IMMDeviceVtbl;
+
+    interface IMMDevice
+    {
+        CONST_VTBL struct IMMDeviceVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define IMMDevice_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define IMMDevice_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define IMMDevice_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define IMMDevice_Activate(This,iid,dwClsCtx,pActivationParams,ppInterface)	\
+    ( (This)->lpVtbl -> Activate(This,iid,dwClsCtx,pActivationParams,ppInterface) ) 
+
+#define IMMDevice_OpenPropertyStore(This,stgmAccess,ppProperties)	\
+    ( (This)->lpVtbl -> OpenPropertyStore(This,stgmAccess,ppProperties) ) 
+
+#define IMMDevice_GetId(This,ppstrId)	\
+    ( (This)->lpVtbl -> GetId(This,ppstrId) ) 
+
+#define IMMDevice_GetState(This,pdwState)	\
+    ( (This)->lpVtbl -> GetState(This,pdwState) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __IMMDevice_INTERFACE_DEFINED__ */
+
+
+#ifndef __IMMDeviceCollection_INTERFACE_DEFINED__
+#define __IMMDeviceCollection_INTERFACE_DEFINED__
+
+/* interface IMMDeviceCollection */
+/* [unique][helpstring][nonextensible][uuid][local][object] */ 
+
+
+EXTERN_C const IID IID_IMMDeviceCollection;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("0BD7A1BE-7A1A-44DB-8397-CC5392387B5E")
+    IMMDeviceCollection : public IUnknown
+    {
+    public:
+        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetCount( 
+            /* [out] */ 
+            __out  UINT *pcDevices) = 0;
+        
+        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE Item( 
+            /* [in] */ 
+            __in  UINT nDevice,
+            /* [out] */ 
+            __out  IMMDevice **ppDevice) = 0;
+        
+    };
+    
+#else 	/* C style interface */
+
+    typedef struct IMMDeviceCollectionVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            IMMDeviceCollection * This,
+            /* [in] */ REFIID riid,
+            /* [iid_is][out] */ 
+            __RPC__deref_out  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            IMMDeviceCollection * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            IMMDeviceCollection * This);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetCount )( 
+            IMMDeviceCollection * This,
+            /* [out] */ 
+            __out  UINT *pcDevices);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *Item )( 
+            IMMDeviceCollection * This,
+            /* [in] */ 
+            __in  UINT nDevice,
+            /* [out] */ 
+            __out  IMMDevice **ppDevice);
+        
+        END_INTERFACE
+    } IMMDeviceCollectionVtbl;
+
+    interface IMMDeviceCollection
+    {
+        CONST_VTBL struct IMMDeviceCollectionVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define IMMDeviceCollection_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define IMMDeviceCollection_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define IMMDeviceCollection_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define IMMDeviceCollection_GetCount(This,pcDevices)	\
+    ( (This)->lpVtbl -> GetCount(This,pcDevices) ) 
+
+#define IMMDeviceCollection_Item(This,nDevice,ppDevice)	\
+    ( (This)->lpVtbl -> Item(This,nDevice,ppDevice) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __IMMDeviceCollection_INTERFACE_DEFINED__ */
+
+
+#ifndef __IMMEndpoint_INTERFACE_DEFINED__
+#define __IMMEndpoint_INTERFACE_DEFINED__
+
+/* interface IMMEndpoint */
+/* [unique][helpstring][nonextensible][uuid][local][object] */ 
+
+
+EXTERN_C const IID IID_IMMEndpoint;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("1BE09788-6894-4089-8586-9A2A6C265AC5")
+    IMMEndpoint : public IUnknown
+    {
+    public:
+        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetDataFlow( 
+            /* [out] */ 
+            __out  EDataFlow *pDataFlow) = 0;
+        
+    };
+    
+#else 	/* C style interface */
+
+    typedef struct IMMEndpointVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            IMMEndpoint * This,
+            /* [in] */ REFIID riid,
+            /* [iid_is][out] */ 
+            __RPC__deref_out  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            IMMEndpoint * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            IMMEndpoint * This);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetDataFlow )( 
+            IMMEndpoint * This,
+            /* [out] */ 
+            __out  EDataFlow *pDataFlow);
+        
+        END_INTERFACE
+    } IMMEndpointVtbl;
+
+    interface IMMEndpoint
+    {
+        CONST_VTBL struct IMMEndpointVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define IMMEndpoint_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define IMMEndpoint_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define IMMEndpoint_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define IMMEndpoint_GetDataFlow(This,pDataFlow)	\
+    ( (This)->lpVtbl -> GetDataFlow(This,pDataFlow) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __IMMEndpoint_INTERFACE_DEFINED__ */
+
+
+#ifndef __IMMDeviceEnumerator_INTERFACE_DEFINED__
+#define __IMMDeviceEnumerator_INTERFACE_DEFINED__
+
+/* interface IMMDeviceEnumerator */
+/* [unique][helpstring][nonextensible][uuid][local][object] */ 
+
+
+EXTERN_C const IID IID_IMMDeviceEnumerator;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("A95664D2-9614-4F35-A746-DE8DB63617E6")
+    IMMDeviceEnumerator : public IUnknown
+    {
+    public:
+        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE EnumAudioEndpoints( 
+            /* [in] */ 
+            __in  EDataFlow dataFlow,
+            /* [in] */ 
+            __in  DWORD dwStateMask,
+            /* [out] */ 
+            __out  IMMDeviceCollection **ppDevices) = 0;
+        
+        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetDefaultAudioEndpoint( 
+            /* [in] */ 
+            __in  EDataFlow dataFlow,
+            /* [in] */ 
+            __in  ERole role,
+            /* [out] */ 
+            __out  IMMDevice **ppEndpoint) = 0;
+        
+        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetDevice( 
+            /*  */ 
+            __in  LPCWSTR pwstrId,
+            /* [out] */ 
+            __out  IMMDevice **ppDevice) = 0;
+        
+        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE RegisterEndpointNotificationCallback( 
+            /* [in] */ 
+            __in  IMMNotificationClient *pClient) = 0;
+        
+        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE UnregisterEndpointNotificationCallback( 
+            /* [in] */ 
+            __in  IMMNotificationClient *pClient) = 0;
+        
+    };
+    
+#else 	/* C style interface */
+
+    typedef struct IMMDeviceEnumeratorVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            IMMDeviceEnumerator * This,
+            /* [in] */ REFIID riid,
+            /* [iid_is][out] */ 
+            __RPC__deref_out  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            IMMDeviceEnumerator * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            IMMDeviceEnumerator * This);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *EnumAudioEndpoints )( 
+            IMMDeviceEnumerator * This,
+            /* [in] */ 
+            __in  EDataFlow dataFlow,
+            /* [in] */ 
+            __in  DWORD dwStateMask,
+            /* [out] */ 
+            __out  IMMDeviceCollection **ppDevices);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetDefaultAudioEndpoint )( 
+            IMMDeviceEnumerator * This,
+            /* [in] */ 
+            __in  EDataFlow dataFlow,
+            /* [in] */ 
+            __in  ERole role,
+            /* [out] */ 
+            __out  IMMDevice **ppEndpoint);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetDevice )( 
+            IMMDeviceEnumerator * This,
+            /*  */ 
+            __in  LPCWSTR pwstrId,
+            /* [out] */ 
+            __out  IMMDevice **ppDevice);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *RegisterEndpointNotificationCallback )( 
+            IMMDeviceEnumerator * This,
+            /* [in] */ 
+            __in  IMMNotificationClient *pClient);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *UnregisterEndpointNotificationCallback )( 
+            IMMDeviceEnumerator * This,
+            /* [in] */ 
+            __in  IMMNotificationClient *pClient);
+        
+        END_INTERFACE
+    } IMMDeviceEnumeratorVtbl;
+
+    interface IMMDeviceEnumerator
+    {
+        CONST_VTBL struct IMMDeviceEnumeratorVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define IMMDeviceEnumerator_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define IMMDeviceEnumerator_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define IMMDeviceEnumerator_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define IMMDeviceEnumerator_EnumAudioEndpoints(This,dataFlow,dwStateMask,ppDevices)	\
+    ( (This)->lpVtbl -> EnumAudioEndpoints(This,dataFlow,dwStateMask,ppDevices) ) 
+
+#define IMMDeviceEnumerator_GetDefaultAudioEndpoint(This,dataFlow,role,ppEndpoint)	\
+    ( (This)->lpVtbl -> GetDefaultAudioEndpoint(This,dataFlow,role,ppEndpoint) ) 
+
+#define IMMDeviceEnumerator_GetDevice(This,pwstrId,ppDevice)	\
+    ( (This)->lpVtbl -> GetDevice(This,pwstrId,ppDevice) ) 
+
+#define IMMDeviceEnumerator_RegisterEndpointNotificationCallback(This,pClient)	\
+    ( (This)->lpVtbl -> RegisterEndpointNotificationCallback(This,pClient) ) 
+
+#define IMMDeviceEnumerator_UnregisterEndpointNotificationCallback(This,pClient)	\
+    ( (This)->lpVtbl -> UnregisterEndpointNotificationCallback(This,pClient) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __IMMDeviceEnumerator_INTERFACE_DEFINED__ */
+
+
+#ifndef __IMMDeviceActivator_INTERFACE_DEFINED__
+#define __IMMDeviceActivator_INTERFACE_DEFINED__
+
+/* interface IMMDeviceActivator */
+/* [unique][helpstring][nonextensible][uuid][local][object] */ 
+
+
+EXTERN_C const IID IID_IMMDeviceActivator;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("3B0D0EA4-D0A9-4B0E-935B-09516746FAC0")
+    IMMDeviceActivator : public IUnknown
+    {
+    public:
+        virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE Activate( 
+            /* [in] */ 
+            __in  REFIID iid,
+            /* [in] */ 
+            __in  IMMDevice *pDevice,
+            /* [in] */ 
+            __in_opt  PROPVARIANT *pActivationParams,
+            /* [iid_is][out] */ 
+            __out  void **ppInterface) = 0;
+        
+    };
+    
+#else 	/* C style interface */
+
+    typedef struct IMMDeviceActivatorVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            IMMDeviceActivator * This,
+            /* [in] */ REFIID riid,
+            /* [iid_is][out] */ 
+            __RPC__deref_out  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            IMMDeviceActivator * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            IMMDeviceActivator * This);
+        
+        /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *Activate )( 
+            IMMDeviceActivator * This,
+            /* [in] */ 
+            __in  REFIID iid,
+            /* [in] */ 
+            __in  IMMDevice *pDevice,
+            /* [in] */ 
+            __in_opt  PROPVARIANT *pActivationParams,
+            /* [iid_is][out] */ 
+            __out  void **ppInterface);
+        
+        END_INTERFACE
+    } IMMDeviceActivatorVtbl;
+
+    interface IMMDeviceActivator
+    {
+        CONST_VTBL struct IMMDeviceActivatorVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define IMMDeviceActivator_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define IMMDeviceActivator_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define IMMDeviceActivator_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define IMMDeviceActivator_Activate(This,iid,pDevice,pActivationParams,ppInterface)	\
+    ( (This)->lpVtbl -> Activate(This,iid,pDevice,pActivationParams,ppInterface) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __IMMDeviceActivator_INTERFACE_DEFINED__ */
+
+
+/* interface __MIDL_itf_mmdeviceapi_0000_0006 */
+/* [local] */ 
+
+typedef /* [public] */ struct __MIDL___MIDL_itf_mmdeviceapi_0000_0006_0001
+    {
+    LPARAM AddPageParam;
+    IMMDevice *pEndpoint;
+    IMMDevice *pPnpInterface;
+    IMMDevice *pPnpDevnode;
+    } 	AudioExtensionParams;
+
+
+
+extern RPC_IF_HANDLE __MIDL_itf_mmdeviceapi_0000_0006_v0_0_c_ifspec;
+extern RPC_IF_HANDLE __MIDL_itf_mmdeviceapi_0000_0006_v0_0_s_ifspec;
+
+
+#ifndef __MMDeviceAPILib_LIBRARY_DEFINED__
+#define __MMDeviceAPILib_LIBRARY_DEFINED__
+
+/* library MMDeviceAPILib */
+/* [helpstring][version][uuid] */ 
+
+
+EXTERN_C const IID LIBID_MMDeviceAPILib;
+
+EXTERN_C const CLSID CLSID_MMDeviceEnumerator;
+
+#ifdef __cplusplus
+
+class DECLSPEC_UUID("BCDE0395-E52F-467C-8E3D-C4579291692E")
+MMDeviceEnumerator;
+#endif
+#endif /* __MMDeviceAPILib_LIBRARY_DEFINED__ */
+
+/* Additional Prototypes for ALL interfaces */
+
+/* end of Additional Prototypes */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+
+
diff --git a/src/hostapi/wasapi/mingw-include/propidl.h b/src/hostapi/wasapi/mingw-include/propidl.h
deleted file mode 100644
index 7efbfcd..0000000
--- a/src/hostapi/wasapi/mingw-include/propidl.h
+++ /dev/null
@@ -1,1275 +0,0 @@
-
-
-/* this ALWAYS GENERATED file contains the definitions for the interfaces */
-
-
- /* File created by MIDL compiler version 7.00.0499 */
-/* Compiler settings for propidl.idl:
-    Oicf, W1, Zp8, env=Win32 (32b run)
-    protocol : dce , ms_ext, c_ext, robust
-    error checks: allocation ref bounds_check enum stub_data
-    VC __declspec() decoration level:
-         __declspec(uuid()), __declspec(selectany), __declspec(novtable)
-         DECLSPEC_UUID(), MIDL_INTERFACE()
-*/
-//@@MIDL_FILE_HEADING(  )
-
-#pragma warning( disable: 4049 )  /* more than 64k source lines */
-
-
-/* verify that the <rpcndr.h> version is high enough to compile this file*/
-#ifndef __REQUIRED_RPCNDR_H_VERSION__
-#define __REQUIRED_RPCNDR_H_VERSION__ 500
-#endif
-
-/* verify that the <rpcsal.h> version is high enough to compile this file*/
-#ifndef __REQUIRED_RPCSAL_H_VERSION__
-#define __REQUIRED_RPCSAL_H_VERSION__ 100
-#endif
-
-#include "rpc.h"
-#include "rpcndr.h"
-
-#ifndef __RPCNDR_H_VERSION__
-#error this stub requires an updated version of <rpcndr.h>
-#endif // __RPCNDR_H_VERSION__
-
-#ifndef COM_NO_WINDOWS_H
-#include "windows.h"
-#include "ole2.h"
-#endif /*COM_NO_WINDOWS_H*/
-
-#ifndef __propidl_h__
-#define __propidl_h__
-
-#if __GNUC__ >=3
-#pragma GCC system_header
-#endif
-
-#define interface struct
-#include "sal.h"
-#include "rpcsal.h"
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-#pragma once
-#endif
-
-/* Forward Declarations */
-
-#ifndef __IPropertyStorage_FWD_DEFINED__
-#define __IPropertyStorage_FWD_DEFINED__
-typedef interface IPropertyStorage IPropertyStorage;
-#endif 	/* __IPropertyStorage_FWD_DEFINED__ */
-
-
-#ifndef __IPropertySetStorage_FWD_DEFINED__
-#define __IPropertySetStorage_FWD_DEFINED__
-typedef interface IPropertySetStorage IPropertySetStorage;
-#endif 	/* __IPropertySetStorage_FWD_DEFINED__ */
-
-
-#ifndef __IEnumSTATPROPSTG_FWD_DEFINED__
-#define __IEnumSTATPROPSTG_FWD_DEFINED__
-typedef interface IEnumSTATPROPSTG IEnumSTATPROPSTG;
-#endif 	/* __IEnumSTATPROPSTG_FWD_DEFINED__ */
-
-
-#ifndef __IEnumSTATPROPSETSTG_FWD_DEFINED__
-#define __IEnumSTATPROPSETSTG_FWD_DEFINED__
-typedef interface IEnumSTATPROPSETSTG IEnumSTATPROPSETSTG;
-#endif 	/* __IEnumSTATPROPSETSTG_FWD_DEFINED__ */
-
-
-/* header files for imported files */
-#include "objidl.h"
-#include "oaidl.h"
-
-#ifdef __cplusplus
-extern "C"{
-#endif
-
-
-/* interface __MIDL_itf_propidl_0000_0000 */
-/* [local] */
-
-//+-------------------------------------------------------------------------
-//
-//  Microsoft Windows
-//  Copyright (c) Microsoft Corporation. All rights reserved.
-//
-//--------------------------------------------------------------------------
-#if ( _MSC_VER >= 800 )
-#if _MSC_VER >= 1200
-#pragma warning(push)
-#endif
-#pragma warning(disable:4201)    /* Nameless struct/union */
-#pragma warning(disable:4237)    /* obsolete member named 'bool' */
-#endif
-#if ( _MSC_VER >= 1020 )
-#pragma once
-#endif
-
-
-
-typedef struct tagVersionedStream
-    {
-    GUID guidVersion;
-    IStream *pStream;
-    } 	VERSIONEDSTREAM;
-
-typedef struct tagVersionedStream *LPVERSIONEDSTREAM;
-
-
-// Flags for IPropertySetStorage::Create
-#define	PROPSETFLAG_DEFAULT	( 0 )
-
-#define	PROPSETFLAG_NONSIMPLE	( 1 )
-
-#define	PROPSETFLAG_ANSI	( 2 )
-
-//   (This flag is only supported on StgCreatePropStg & StgOpenPropStg
-#define	PROPSETFLAG_UNBUFFERED	( 4 )
-
-//   (This flag causes a version-1 property set to be created
-#define	PROPSETFLAG_CASE_SENSITIVE	( 8 )
-
-
-// Flags for the reservied PID_BEHAVIOR property
-#define	PROPSET_BEHAVIOR_CASE_SENSITIVE	( 1 )
-
-#ifdef MIDL_PASS
-// This is the PROPVARIANT definition for marshaling.
-typedef struct tag_inner_PROPVARIANT PROPVARIANT;
-
-#else
-// This is the standard C layout of the PROPVARIANT.
-typedef struct tagPROPVARIANT PROPVARIANT;
-#endif
-typedef struct tagCAC
-    {
-    ULONG cElems;
-    CHAR *pElems;
-    } 	CAC;
-#ifdef WIN64
-typedef struct tagCAUB
-    {
-    ULONG cElems;
-    UCHAR *pElems;
-    } 	CAUB;
-
-typedef struct tagCAI
-    {
-    ULONG cElems;
-    SHORT *pElems;
-    } 	CAI;
-
-typedef struct tagCAUI
-    {
-    ULONG cElems;
-    USHORT *pElems;
-    } 	CAUI;
-
-typedef struct tagCAL
-    {
-    ULONG cElems;
-    LONG *pElems;
-    } 	CAL;
-
-typedef struct tagCAUL
-    {
-    ULONG cElems;
-    ULONG *pElems;
-    } 	CAUL;
-
-typedef struct tagCAFLT
-    {
-    ULONG cElems;
-    FLOAT *pElems;
-    } 	CAFLT;
-
-typedef struct tagCADBL
-    {
-    ULONG cElems;
-    DOUBLE *pElems;
-    } 	CADBL;
-
-typedef struct tagCACY
-    {
-    ULONG cElems;
-    CY *pElems;
-    } 	CACY;
-
-typedef struct tagCADATE
-    {
-    ULONG cElems;
-    DATE *pElems;
-    } 	CADATE;
-
-typedef struct tagCABSTR
-    {
-    ULONG cElems;
-    BSTR *pElems;
-    } 	CABSTR;
-
-typedef struct tagCABSTRBLOB
-    {
-    ULONG cElems;
-    BSTRBLOB *pElems;
-    } 	CABSTRBLOB;
-
-typedef struct tagCABOOL
-    {
-    ULONG cElems;
-    VARIANT_BOOL *pElems;
-    } 	CABOOL;
-
-typedef struct tagCASCODE
-    {
-    ULONG cElems;
-    SCODE *pElems;
-    } 	CASCODE;
-
-typedef struct tagCAPROPVARIANT
-    {
-    ULONG cElems;
-    PROPVARIANT *pElems;
-    } 	CAPROPVARIANT;
-
-typedef struct tagCAH
-    {
-    ULONG cElems;
-    LARGE_INTEGER *pElems;
-    } 	CAH;
-
-typedef struct tagCAUH
-    {
-    ULONG cElems;
-    ULARGE_INTEGER *pElems;
-    } 	CAUH;
-
-typedef struct tagCALPSTR
-    {
-    ULONG cElems;
-    LPSTR *pElems;
-    } 	CALPSTR;
-
-typedef struct tagCALPWSTR
-    {
-    ULONG cElems;
-    LPWSTR *pElems;
-    } 	CALPWSTR;
-
-typedef struct tagCAFILETIME
-    {
-    ULONG cElems;
-    FILETIME *pElems;
-    } 	CAFILETIME;
-
-typedef struct tagCACLIPDATA
-    {
-    ULONG cElems;
-    CLIPDATA *pElems;
-    } 	CACLIPDATA;
-
-typedef struct tagCACLSID
-    {
-    ULONG cElems;
-    CLSID *pElems;
-    } 	CACLSID;
-#endif
-#ifdef MIDL_PASS
-// This is the PROPVARIANT padding layout for marshaling.
-typedef BYTE PROPVAR_PAD1;
-
-typedef BYTE PROPVAR_PAD2;
-
-typedef ULONG PROPVAR_PAD3;
-
-#else
-// This is the standard C layout of the structure.
-typedef WORD PROPVAR_PAD1;
-typedef WORD PROPVAR_PAD2;
-typedef WORD PROPVAR_PAD3;
-#define tag_inner_PROPVARIANT
-#endif
-#ifdef WIN64
-#ifndef MIDL_PASS
-struct tagPROPVARIANT {
-  union {
-#endif
-struct tag_inner_PROPVARIANT
-    {
-    VARTYPE vt;
-    PROPVAR_PAD1 wReserved1;
-    PROPVAR_PAD2 wReserved2;
-    PROPVAR_PAD3 wReserved3;
-    /* [switch_type] */ union
-        {
-         /* Empty union arm */
-        CHAR cVal;
-        UCHAR bVal;
-        SHORT iVal;
-        USHORT uiVal;
-        LONG lVal;
-        ULONG ulVal;
-        INT intVal;
-        UINT uintVal;
-        LARGE_INTEGER hVal;
-        ULARGE_INTEGER uhVal;
-        FLOAT fltVal;
-        DOUBLE dblVal;
-        VARIANT_BOOL boolVal;
-        //_VARIANT_BOOL bool;
-        SCODE scode;
-        CY cyVal;
-        DATE date;
-        FILETIME filetime;
-        CLSID *puuid;
-        CLIPDATA *pclipdata;
-        BSTR bstrVal;
-        BSTRBLOB bstrblobVal;
-        BLOB blob;
-        LPSTR pszVal;
-        LPWSTR pwszVal;
-        IUnknown *punkVal;
-        IDispatch *pdispVal;
-        IStream *pStream;
-        IStorage *pStorage;
-        LPVERSIONEDSTREAM pVersionedStream;
-        LPSAFEARRAY parray;
-        CAC cac;
-        CAUB caub;
-        CAI cai;
-        CAUI caui;
-        CAL cal;
-        CAUL caul;
-        CAH cah;
-        CAUH cauh;
-        CAFLT caflt;
-        CADBL cadbl;
-        CABOOL cabool;
-        CASCODE cascode;
-        CACY cacy;
-        CADATE cadate;
-        CAFILETIME cafiletime;
-        CACLSID cauuid;
-        CACLIPDATA caclipdata;
-        CABSTR cabstr;
-        CABSTRBLOB cabstrblob;
-        CALPSTR calpstr;
-        CALPWSTR calpwstr;
-        CAPROPVARIANT capropvar;
-        CHAR *pcVal;
-        UCHAR *pbVal;
-        SHORT *piVal;
-        USHORT *puiVal;
-        LONG *plVal;
-        ULONG *pulVal;
-        INT *pintVal;
-        UINT *puintVal;
-        FLOAT *pfltVal;
-        DOUBLE *pdblVal;
-        VARIANT_BOOL *pboolVal;
-        DECIMAL *pdecVal;
-        SCODE *pscode;
-        CY *pcyVal;
-        DATE *pdate;
-        BSTR *pbstrVal;
-        IUnknown **ppunkVal;
-        IDispatch **ppdispVal;
-        LPSAFEARRAY *pparray;
-        PROPVARIANT *pvarVal;
-        } 	;
-    } ;
-#ifndef MIDL_PASS
-    DECIMAL decVal;
-  };
-};
-#endif
-#endif
-#ifdef MIDL_PASS
-// This is the LPPROPVARIANT definition for marshaling.
-typedef struct tag_inner_PROPVARIANT *LPPROPVARIANT;
-
-typedef const PROPVARIANT *REFPROPVARIANT;
-
-#else
-
-// This is the standard C layout of the PROPVARIANT.
-#ifdef WIN64
-typedef struct tagPROPVARIANT * LPPROPVARIANT;
-#endif
-
-#ifndef _REFPROPVARIANT_DEFINED
-#define _REFPROPVARIANT_DEFINED
-#ifdef __cplusplus
-#define REFPROPVARIANT const PROPVARIANT &
-#else
-#define REFPROPVARIANT const PROPVARIANT * __MIDL_CONST
-#endif
-#endif
-
-#endif // MIDL_PASS
-
-// Reserved global Property IDs
-#define	PID_DICTIONARY	( 0 )
-
-#define	PID_CODEPAGE	( 0x1 )
-
-#define	PID_FIRST_USABLE	( 0x2 )
-
-#define	PID_FIRST_NAME_DEFAULT	( 0xfff )
-
-#define	PID_LOCALE	( 0x80000000 )
-
-#define	PID_MODIFY_TIME	( 0x80000001 )
-
-#define	PID_SECURITY	( 0x80000002 )
-
-#define	PID_BEHAVIOR	( 0x80000003 )
-
-#define	PID_ILLEGAL	( 0xffffffff )
-
-// Range which is read-only to downlevel implementations
-#define	PID_MIN_READONLY	( 0x80000000 )
-
-#define	PID_MAX_READONLY	( 0xbfffffff )
-
-// Property IDs for the DiscardableInformation Property Set
-
-#define PIDDI_THUMBNAIL          0x00000002L // VT_BLOB
-
-// Property IDs for the SummaryInformation Property Set
-
-#define PIDSI_TITLE               0x00000002L  // VT_LPSTR
-#define PIDSI_SUBJECT             0x00000003L  // VT_LPSTR
-#define PIDSI_AUTHOR              0x00000004L  // VT_LPSTR
-#define PIDSI_KEYWORDS            0x00000005L  // VT_LPSTR
-#define PIDSI_COMMENTS            0x00000006L  // VT_LPSTR
-#define PIDSI_TEMPLATE            0x00000007L  // VT_LPSTR
-#define PIDSI_LASTAUTHOR          0x00000008L  // VT_LPSTR
-#define PIDSI_REVNUMBER           0x00000009L  // VT_LPSTR
-#define PIDSI_EDITTIME            0x0000000aL  // VT_FILETIME (UTC)
-#define PIDSI_LASTPRINTED         0x0000000bL  // VT_FILETIME (UTC)
-#define PIDSI_CREATE_DTM          0x0000000cL  // VT_FILETIME (UTC)
-#define PIDSI_LASTSAVE_DTM        0x0000000dL  // VT_FILETIME (UTC)
-#define PIDSI_PAGECOUNT           0x0000000eL  // VT_I4
-#define PIDSI_WORDCOUNT           0x0000000fL  // VT_I4
-#define PIDSI_CHARCOUNT           0x00000010L  // VT_I4
-#define PIDSI_THUMBNAIL           0x00000011L  // VT_CF
-#define PIDSI_APPNAME             0x00000012L  // VT_LPSTR
-#define PIDSI_DOC_SECURITY        0x00000013L  // VT_I4
-
-// Property IDs for the DocSummaryInformation Property Set
-
-#define PIDDSI_CATEGORY          0x00000002 // VT_LPSTR
-#define PIDDSI_PRESFORMAT        0x00000003 // VT_LPSTR
-#define PIDDSI_BYTECOUNT         0x00000004 // VT_I4
-#define PIDDSI_LINECOUNT         0x00000005 // VT_I4
-#define PIDDSI_PARCOUNT          0x00000006 // VT_I4
-#define PIDDSI_SLIDECOUNT        0x00000007 // VT_I4
-#define PIDDSI_NOTECOUNT         0x00000008 // VT_I4
-#define PIDDSI_HIDDENCOUNT       0x00000009 // VT_I4
-#define PIDDSI_MMCLIPCOUNT       0x0000000A // VT_I4
-#define PIDDSI_SCALE             0x0000000B // VT_BOOL
-#define PIDDSI_HEADINGPAIR       0x0000000C // VT_VARIANT | VT_VECTOR
-#define PIDDSI_DOCPARTS          0x0000000D // VT_LPSTR | VT_VECTOR
-#define PIDDSI_MANAGER           0x0000000E // VT_LPSTR
-#define PIDDSI_COMPANY           0x0000000F // VT_LPSTR
-#define PIDDSI_LINKSDIRTY        0x00000010 // VT_BOOL
-
-
-//  FMTID_MediaFileSummaryInfo - Property IDs
-
-#define PIDMSI_EDITOR                   0x00000002L  // VT_LPWSTR
-#define PIDMSI_SUPPLIER                 0x00000003L  // VT_LPWSTR
-#define PIDMSI_SOURCE                   0x00000004L  // VT_LPWSTR
-#define PIDMSI_SEQUENCE_NO              0x00000005L  // VT_LPWSTR
-#define PIDMSI_PROJECT                  0x00000006L  // VT_LPWSTR
-#define PIDMSI_STATUS                   0x00000007L  // VT_UI4
-#define PIDMSI_OWNER                    0x00000008L  // VT_LPWSTR
-#define PIDMSI_RATING                   0x00000009L  // VT_LPWSTR
-#define PIDMSI_PRODUCTION               0x0000000AL  // VT_FILETIME (UTC)
-#define PIDMSI_COPYRIGHT                0x0000000BL  // VT_LPWSTR
-
-//  PIDMSI_STATUS value definitions
-
-enum PIDMSI_STATUS_VALUE
-    {	PIDMSI_STATUS_NORMAL	= 0,
-	PIDMSI_STATUS_NEW	= ( PIDMSI_STATUS_NORMAL + 1 ) ,
-	PIDMSI_STATUS_PRELIM	= ( PIDMSI_STATUS_NEW + 1 ) ,
-	PIDMSI_STATUS_DRAFT	= ( PIDMSI_STATUS_PRELIM + 1 ) ,
-	PIDMSI_STATUS_INPROGRESS	= ( PIDMSI_STATUS_DRAFT + 1 ) ,
-	PIDMSI_STATUS_EDIT	= ( PIDMSI_STATUS_INPROGRESS + 1 ) ,
-	PIDMSI_STATUS_REVIEW	= ( PIDMSI_STATUS_EDIT + 1 ) ,
-	PIDMSI_STATUS_PROOF	= ( PIDMSI_STATUS_REVIEW + 1 ) ,
-	PIDMSI_STATUS_FINAL	= ( PIDMSI_STATUS_PROOF + 1 ) ,
-	PIDMSI_STATUS_OTHER	= 0x7fff
-    } ;
-#define	PRSPEC_INVALID	( 0xffffffff )
-
-#define	PRSPEC_LPWSTR	( 0 )
-
-#define	PRSPEC_PROPID	( 1 )
-
-#ifdef WIN64
-typedef struct tagPROPSPEC
-    {
-    ULONG ulKind;
-    /* [switch_type] */ union
-        {
-        PROPID propid;
-        LPOLESTR lpwstr;
-         /* Empty union arm */
-        } 	;
-    } 	PROPSPEC;
-
-typedef struct tagSTATPROPSTG
-    {
-    LPOLESTR lpwstrName;
-    PROPID propid;
-    VARTYPE vt;
-    } 	STATPROPSTG;
-#endif
-
-// Macros for parsing the OS Version of the Property Set Header
-#define PROPSETHDR_OSVER_KIND(dwOSVer)      HIWORD( (dwOSVer) )
-#define PROPSETHDR_OSVER_MAJOR(dwOSVer)     LOBYTE(LOWORD( (dwOSVer) ))
-#define PROPSETHDR_OSVER_MINOR(dwOSVer)     HIBYTE(LOWORD( (dwOSVer) ))
-#define PROPSETHDR_OSVERSION_UNKNOWN        0xFFFFFFFF
-#ifdef WIN64
-typedef struct tagSTATPROPSETSTG
-    {
-    FMTID fmtid;
-    CLSID clsid;
-    DWORD grfFlags;
-    FILETIME mtime;
-    FILETIME ctime;
-    FILETIME atime;
-    DWORD dwOSVersion;
-    } 	STATPROPSETSTG;
-#endif
-
-
-extern RPC_IF_HANDLE __MIDL_itf_propidl_0000_0000_v0_0_c_ifspec;
-extern RPC_IF_HANDLE __MIDL_itf_propidl_0000_0000_v0_0_s_ifspec;
-
-#ifndef __IPropertyStorage_INTERFACE_DEFINED__
-#define __IPropertyStorage_INTERFACE_DEFINED__
-
-/* interface IPropertyStorage */
-/* [unique][uuid][object] */
-
-
-EXTERN_C const IID IID_IPropertyStorage;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
-    MIDL_INTERFACE("00000138-0000-0000-C000-000000000046")
-    IPropertyStorage : public IUnknown
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE ReadMultiple(
-            /* [in] */ ULONG cpspec,
-            /* [size_is][in] */ __RPC__in_ecount_full(cpspec) const PROPSPEC rgpspec[  ],
-            /* [size_is][out] */ __RPC__out_ecount_full(cpspec) PROPVARIANT rgpropvar[  ]) = 0;
-
-        virtual HRESULT STDMETHODCALLTYPE WriteMultiple(
-            /* [in] */ ULONG cpspec,
-            /* [size_is][in] */ __RPC__in_ecount_full(cpspec) const PROPSPEC rgpspec[  ],
-            /* [size_is][in] */ __RPC__in_ecount_full(cpspec) const PROPVARIANT rgpropvar[  ],
-            /* [in] */ PROPID propidNameFirst) = 0;
-
-        virtual HRESULT STDMETHODCALLTYPE DeleteMultiple(
-            /* [in] */ ULONG cpspec,
-            /* [size_is][in] */ __RPC__in_ecount_full(cpspec) const PROPSPEC rgpspec[  ]) = 0;
-
-        virtual HRESULT STDMETHODCALLTYPE ReadPropertyNames(
-            /* [in] */ ULONG cpropid,
-            /* [size_is][in] */ __RPC__in_ecount_full(cpropid) const PROPID rgpropid[  ],
-            /* [size_is][out] */ __RPC__out_ecount_full(cpropid) LPOLESTR rglpwstrName[  ]) = 0;
-
-        virtual HRESULT STDMETHODCALLTYPE WritePropertyNames(
-            /* [in] */ ULONG cpropid,
-            /* [size_is][in] */ __RPC__in_ecount_full(cpropid) const PROPID rgpropid[  ],
-            /* [size_is][in] */ __RPC__in_ecount_full(cpropid) const LPOLESTR rglpwstrName[  ]) = 0;
-
-        virtual HRESULT STDMETHODCALLTYPE DeletePropertyNames(
-            /* [in] */ ULONG cpropid,
-            /* [size_is][in] */ __RPC__in_ecount_full(cpropid) const PROPID rgpropid[  ]) = 0;
-
-        virtual HRESULT STDMETHODCALLTYPE Commit(
-            /* [in] */ DWORD grfCommitFlags) = 0;
-
-        virtual HRESULT STDMETHODCALLTYPE Revert( void) = 0;
-
-        virtual HRESULT STDMETHODCALLTYPE Enum(
-            /* [out] */ __RPC__deref_out_opt IEnumSTATPROPSTG **ppenum) = 0;
-
-        virtual HRESULT STDMETHODCALLTYPE SetTimes(
-            /* [in] */ __RPC__in const FILETIME *pctime,
-            /* [in] */ __RPC__in const FILETIME *patime,
-            /* [in] */ __RPC__in const FILETIME *pmtime) = 0;
-
-        virtual HRESULT STDMETHODCALLTYPE SetClass(
-            /* [in] */ __RPC__in REFCLSID clsid) = 0;
-
-        virtual HRESULT STDMETHODCALLTYPE Stat(
-            /* [out] */ __RPC__out STATPROPSETSTG *pstatpsstg) = 0;
-
-    };
-
-#else 	/* C style interface */
-
-//    typedef struct IPropertyStorageVtbl
-//    {
-//        BEGIN_INTERFACE
-//
-//        HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
-//            IPropertyStorage * This,
-//            /* [in] */ __RPC__in REFIID riid,
-//            /* [iid_is][out] */
-//            __RPC__deref_out  void **ppvObject);
-//
-//        ULONG ( STDMETHODCALLTYPE *AddRef )(
-//            IPropertyStorage * This);
-//
-//        ULONG ( STDMETHODCALLTYPE *Release )(
-//            IPropertyStorage * This);
-//
-//        HRESULT ( STDMETHODCALLTYPE *ReadMultiple )(
-//            IPropertyStorage * This,
-//            /* [in] */ ULONG cpspec,
-//            /* [size_is][in] */ __RPC__in_ecount_full(cpspec) const PROPSPEC rgpspec[  ],
-//            /* [size_is][out] */ __RPC__out_ecount_full(cpspec) PROPVARIANT rgpropvar[  ]);
-//
-//        HRESULT ( STDMETHODCALLTYPE *WriteMultiple )(
-//            IPropertyStorage * This,
-//            /* [in] */ ULONG cpspec,
-//            /* [size_is][in] */ __RPC__in_ecount_full(cpspec) const PROPSPEC rgpspec[  ],
-//            /* [size_is][in] */ __RPC__in_ecount_full(cpspec) const PROPVARIANT rgpropvar[  ],
-//            /* [in] */ PROPID propidNameFirst);
-//
-//        HRESULT ( STDMETHODCALLTYPE *DeleteMultiple )(
-//            IPropertyStorage * This,
-//            /* [in] */ ULONG cpspec,
-//            /* [size_is][in] */ __RPC__in_ecount_full(cpspec) const PROPSPEC rgpspec[  ]);
-//
-//        HRESULT ( STDMETHODCALLTYPE *ReadPropertyNames )(
-//            IPropertyStorage * This,
-//            /* [in] */ ULONG cpropid,
-//            /* [size_is][in] */ __RPC__in_ecount_full(cpropid) const PROPID rgpropid[  ],
-//            /* [size_is][out] */ __RPC__out_ecount_full(cpropid) LPOLESTR rglpwstrName[  ]);
-//
-//        HRESULT ( STDMETHODCALLTYPE *WritePropertyNames )(
-//            IPropertyStorage * This,
-//            /* [in] */ ULONG cpropid,
-//            /* [size_is][in] */ __RPC__in_ecount_full(cpropid) const PROPID rgpropid[  ],
-//            /* [size_is][in] */ __RPC__in_ecount_full(cpropid) const LPOLESTR rglpwstrName[  ]);
-//
-//        HRESULT ( STDMETHODCALLTYPE *DeletePropertyNames )(
-//            IPropertyStorage * This,
-//            /* [in] */ ULONG cpropid,
-//            /* [size_is][in] */ __RPC__in_ecount_full(cpropid) const PROPID rgpropid[  ]);
-//
-//        HRESULT ( STDMETHODCALLTYPE *Commit )(
-//            IPropertyStorage * This,
-//            /* [in] */ DWORD grfCommitFlags);
-//
-//        HRESULT ( STDMETHODCALLTYPE *Revert )(
-//            IPropertyStorage * This);
-//
-//        HRESULT ( STDMETHODCALLTYPE *Enum )(
-//            IPropertyStorage * This,
-//            /* [out] */ __RPC__deref_out_opt IEnumSTATPROPSTG **ppenum);
-//
-//        HRESULT ( STDMETHODCALLTYPE *SetTimes )(
-//            IPropertyStorage * This,
-//            /* [in] */ __RPC__in const FILETIME *pctime,
-//            /* [in] */ __RPC__in const FILETIME *patime,
-//            /* [in] */ __RPC__in const FILETIME *pmtime);
-//
-//        HRESULT ( STDMETHODCALLTYPE *SetClass )(
-//            IPropertyStorage * This,
-//            /* [in] */ __RPC__in REFCLSID clsid);
-//
-//        HRESULT ( STDMETHODCALLTYPE *Stat )(
-//            IPropertyStorage * This,
-//            /* [out] */ __RPC__out STATPROPSETSTG *pstatpsstg);
-//
-//        END_INTERFACE
-//    } IPropertyStorageVtbl;
-//
-//    interface IPropertyStorage
-//    {
-//        CONST_VTBL struct IPropertyStorageVtbl *lpVtbl;
-//    };
-
-
-
-#ifdef COBJMACROS
-
-
-#define IPropertyStorage_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
-
-#define IPropertyStorage_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) )
-
-#define IPropertyStorage_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) )
-
-
-#define IPropertyStorage_ReadMultiple(This,cpspec,rgpspec,rgpropvar)	\
-    ( (This)->lpVtbl -> ReadMultiple(This,cpspec,rgpspec,rgpropvar) )
-
-#define IPropertyStorage_WriteMultiple(This,cpspec,rgpspec,rgpropvar,propidNameFirst)	\
-    ( (This)->lpVtbl -> WriteMultiple(This,cpspec,rgpspec,rgpropvar,propidNameFirst) )
-
-#define IPropertyStorage_DeleteMultiple(This,cpspec,rgpspec)	\
-    ( (This)->lpVtbl -> DeleteMultiple(This,cpspec,rgpspec) )
-
-#define IPropertyStorage_ReadPropertyNames(This,cpropid,rgpropid,rglpwstrName)	\
-    ( (This)->lpVtbl -> ReadPropertyNames(This,cpropid,rgpropid,rglpwstrName) )
-
-#define IPropertyStorage_WritePropertyNames(This,cpropid,rgpropid,rglpwstrName)	\
-    ( (This)->lpVtbl -> WritePropertyNames(This,cpropid,rgpropid,rglpwstrName) )
-
-#define IPropertyStorage_DeletePropertyNames(This,cpropid,rgpropid)	\
-    ( (This)->lpVtbl -> DeletePropertyNames(This,cpropid,rgpropid) )
-
-#define IPropertyStorage_Commit(This,grfCommitFlags)	\
-    ( (This)->lpVtbl -> Commit(This,grfCommitFlags) )
-
-#define IPropertyStorage_Revert(This)	\
-    ( (This)->lpVtbl -> Revert(This) )
-
-#define IPropertyStorage_Enum(This,ppenum)	\
-    ( (This)->lpVtbl -> Enum(This,ppenum) )
-
-#define IPropertyStorage_SetTimes(This,pctime,patime,pmtime)	\
-    ( (This)->lpVtbl -> SetTimes(This,pctime,patime,pmtime) )
-
-#define IPropertyStorage_SetClass(This,clsid)	\
-    ( (This)->lpVtbl -> SetClass(This,clsid) )
-
-#define IPropertyStorage_Stat(This,pstatpsstg)	\
-    ( (This)->lpVtbl -> Stat(This,pstatpsstg) )
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IPropertyStorage_INTERFACE_DEFINED__ */
-
-
-#ifndef __IPropertySetStorage_INTERFACE_DEFINED__
-#define __IPropertySetStorage_INTERFACE_DEFINED__
-
-/* interface IPropertySetStorage */
-/* [unique][uuid][object] */
-
-typedef /* [unique] */  __RPC_unique_pointer IPropertySetStorage *LPPROPERTYSETSTORAGE;
-
-
-EXTERN_C const IID IID_IPropertySetStorage;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
-    MIDL_INTERFACE("0000013A-0000-0000-C000-000000000046")
-    IPropertySetStorage : public IUnknown
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE Create(
-            /* [in] */ __RPC__in REFFMTID rfmtid,
-            /* [unique][in] */ __RPC__in_opt const CLSID *pclsid,
-            /* [in] */ DWORD grfFlags,
-            /* [in] */ DWORD grfMode,
-            /* [out] */ __RPC__deref_out_opt IPropertyStorage **ppprstg) = 0;
-
-        virtual HRESULT STDMETHODCALLTYPE Open(
-            /* [in] */ __RPC__in REFFMTID rfmtid,
-            /* [in] */ DWORD grfMode,
-            /* [out] */ __RPC__deref_out_opt IPropertyStorage **ppprstg) = 0;
-
-        virtual HRESULT STDMETHODCALLTYPE Delete(
-            /* [in] */ __RPC__in REFFMTID rfmtid) = 0;
-
-        virtual HRESULT STDMETHODCALLTYPE Enum(
-            /* [out] */ __RPC__deref_out_opt IEnumSTATPROPSETSTG **ppenum) = 0;
-
-    };
-
-#else 	/* C style interface */
-
-//    typedef struct IPropertySetStorageVtbl
-//    {
-//        BEGIN_INTERFACE
-//
-//        HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
-//            IPropertySetStorage * This,
-//            /* [in] */ __RPC__in REFIID riid,
-//            /* [iid_is][out] */
-//            __RPC__deref_out  void **ppvObject);
-//
-//        ULONG ( STDMETHODCALLTYPE *AddRef )(
-//            IPropertySetStorage * This);
-//
-//        ULONG ( STDMETHODCALLTYPE *Release )(
-//            IPropertySetStorage * This);
-//
-//        HRESULT ( STDMETHODCALLTYPE *Create )(
-//            IPropertySetStorage * This,
-//            /* [in] */ __RPC__in REFFMTID rfmtid,
-//            /* [unique][in] */ __RPC__in_opt const CLSID *pclsid,
-//            /* [in] */ DWORD grfFlags,
-//            /* [in] */ DWORD grfMode,
-//            /* [out] */ __RPC__deref_out_opt IPropertyStorage **ppprstg);
-//
-//        HRESULT ( STDMETHODCALLTYPE *Open )(
-//            IPropertySetStorage * This,
-//            /* [in] */ __RPC__in REFFMTID rfmtid,
-//            /* [in] */ DWORD grfMode,
-//            /* [out] */ __RPC__deref_out_opt IPropertyStorage **ppprstg);
-//
-//        HRESULT ( STDMETHODCALLTYPE *Delete )(
-//            IPropertySetStorage * This,
-//            /* [in] */ __RPC__in REFFMTID rfmtid);
-//
-//        HRESULT ( STDMETHODCALLTYPE *Enum )(
-//            IPropertySetStorage * This,
-//            /* [out] */ __RPC__deref_out_opt IEnumSTATPROPSETSTG **ppenum);
-//
-//        END_INTERFACE
-//    } IPropertySetStorageVtbl;
-//
-//    interface IPropertySetStorage
-//    {
-//        CONST_VTBL struct IPropertySetStorageVtbl *lpVtbl;
-//    };
-
-
-
-#ifdef COBJMACROS
-
-
-#define IPropertySetStorage_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
-
-#define IPropertySetStorage_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) )
-
-#define IPropertySetStorage_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) )
-
-
-#define IPropertySetStorage_Create(This,rfmtid,pclsid,grfFlags,grfMode,ppprstg)	\
-    ( (This)->lpVtbl -> Create(This,rfmtid,pclsid,grfFlags,grfMode,ppprstg) )
-
-#define IPropertySetStorage_Open(This,rfmtid,grfMode,ppprstg)	\
-    ( (This)->lpVtbl -> Open(This,rfmtid,grfMode,ppprstg) )
-
-#define IPropertySetStorage_Delete(This,rfmtid)	\
-    ( (This)->lpVtbl -> Delete(This,rfmtid) )
-
-#define IPropertySetStorage_Enum(This,ppenum)	\
-    ( (This)->lpVtbl -> Enum(This,ppenum) )
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IPropertySetStorage_INTERFACE_DEFINED__ */
-
-
-#ifndef __IEnumSTATPROPSTG_INTERFACE_DEFINED__
-#define __IEnumSTATPROPSTG_INTERFACE_DEFINED__
-
-/* interface IEnumSTATPROPSTG */
-/* [unique][uuid][object] */
-
-//typedef /* [unique] */  __RPC_unique_pointer IEnumSTATPROPSTG *LPENUMSTATPROPSTG;
-
-
-EXTERN_C const IID IID_IEnumSTATPROPSTG;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
-    MIDL_INTERFACE("00000139-0000-0000-C000-000000000046")
-    IEnumSTATPROPSTG : public IUnknown
-    {
-    public:
-        virtual /* [local] */ HRESULT STDMETHODCALLTYPE Next(
-            /* [in] */ ULONG celt,
-            /* [length_is][size_is][out] */ STATPROPSTG *rgelt,
-            /* [out] */ ULONG *pceltFetched) = 0;
-
-        virtual HRESULT STDMETHODCALLTYPE Skip(
-            /* [in] */ ULONG celt) = 0;
-
-        virtual HRESULT STDMETHODCALLTYPE Reset( void) = 0;
-
-        virtual HRESULT STDMETHODCALLTYPE Clone(
-            /* [out] */ __RPC__deref_out_opt IEnumSTATPROPSTG **ppenum) = 0;
-
-    };
-
-#else 	/* C style interface */
-
-//    typedef struct IEnumSTATPROPSTGVtbl
-//    {
-//        BEGIN_INTERFACE
-//
-//        HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
-//            IEnumSTATPROPSTG * This,
-//            /* [in] */ __RPC__in REFIID riid,
-//            /* [iid_is][out] */
-//            __RPC__deref_out  void **ppvObject);
-//
-//        ULONG ( STDMETHODCALLTYPE *AddRef )(
-//            IEnumSTATPROPSTG * This);
-//
-//        ULONG ( STDMETHODCALLTYPE *Release )(
-//            IEnumSTATPROPSTG * This);
-//
-//        /* [local] */ HRESULT ( STDMETHODCALLTYPE *Next )(
-//            IEnumSTATPROPSTG * This,
-//            /* [in] */ ULONG celt,
-//            /* [length_is][size_is][out] */ STATPROPSTG *rgelt,
-//            /* [out] */ ULONG *pceltFetched);
-//
-//        HRESULT ( STDMETHODCALLTYPE *Skip )(
-//            IEnumSTATPROPSTG * This,
-//            /* [in] */ ULONG celt);
-//
-//        HRESULT ( STDMETHODCALLTYPE *Reset )(
-//            IEnumSTATPROPSTG * This);
-//
-//        HRESULT ( STDMETHODCALLTYPE *Clone )(
-//            IEnumSTATPROPSTG * This,
-//            /* [out] */ __RPC__deref_out_opt IEnumSTATPROPSTG **ppenum);
-//
-//        END_INTERFACE
-//    } IEnumSTATPROPSTGVtbl;
-//
-//    interface IEnumSTATPROPSTG
-//    {
-//        CONST_VTBL struct IEnumSTATPROPSTGVtbl *lpVtbl;
-//    };
-
-
-
-#ifdef COBJMACROS
-
-
-#define IEnumSTATPROPSTG_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
-
-#define IEnumSTATPROPSTG_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) )
-
-#define IEnumSTATPROPSTG_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) )
-
-
-#define IEnumSTATPROPSTG_Next(This,celt,rgelt,pceltFetched)	\
-    ( (This)->lpVtbl -> Next(This,celt,rgelt,pceltFetched) )
-
-#define IEnumSTATPROPSTG_Skip(This,celt)	\
-    ( (This)->lpVtbl -> Skip(This,celt) )
-
-#define IEnumSTATPROPSTG_Reset(This)	\
-    ( (This)->lpVtbl -> Reset(This) )
-
-#define IEnumSTATPROPSTG_Clone(This,ppenum)	\
-    ( (This)->lpVtbl -> Clone(This,ppenum) )
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-/* [call_as] */ HRESULT STDMETHODCALLTYPE IEnumSTATPROPSTG_RemoteNext_Proxy(
-    IEnumSTATPROPSTG * This,
-    /* [in] */ ULONG celt,
-    /* [length_is][size_is][out] */ __RPC__out_ecount_part(celt, *pceltFetched) STATPROPSTG *rgelt,
-    /* [out] */ __RPC__out ULONG *pceltFetched);
-
-
-void __RPC_STUB IEnumSTATPROPSTG_RemoteNext_Stub(
-    IRpcStubBuffer *This,
-    IRpcChannelBuffer *_pRpcChannelBuffer,
-    PRPC_MESSAGE _pRpcMessage,
-    DWORD *_pdwStubPhase);
-
-
-
-#endif 	/* __IEnumSTATPROPSTG_INTERFACE_DEFINED__ */
-
-
-#ifndef __IEnumSTATPROPSETSTG_INTERFACE_DEFINED__
-#define __IEnumSTATPROPSETSTG_INTERFACE_DEFINED__
-
-/* interface IEnumSTATPROPSETSTG */
-/* [unique][uuid][object] */
-
-typedef /* [unique] */  __RPC_unique_pointer IEnumSTATPROPSETSTG *LPENUMSTATPROPSETSTG;
-
-
-EXTERN_C const IID IID_IEnumSTATPROPSETSTG;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-
-    MIDL_INTERFACE("0000013B-0000-0000-C000-000000000046")
-    IEnumSTATPROPSETSTG : public IUnknown
-    {
-    public:
-        virtual /* [local] */ HRESULT STDMETHODCALLTYPE Next(
-            /* [in] */ ULONG celt,
-            /* [length_is][size_is][out] */ STATPROPSETSTG *rgelt,
-            /* [out] */ ULONG *pceltFetched) = 0;
-
-        virtual HRESULT STDMETHODCALLTYPE Skip(
-            /* [in] */ ULONG celt) = 0;
-
-        virtual HRESULT STDMETHODCALLTYPE Reset( void) = 0;
-
-        virtual HRESULT STDMETHODCALLTYPE Clone(
-            /* [out] */ __RPC__deref_out_opt IEnumSTATPROPSETSTG **ppenum) = 0;
-
-    };
-
-#else 	/* C style interface */
-
-//    typedef struct IEnumSTATPROPSETSTGVtbl
-//    {
-//        BEGIN_INTERFACE
-//
-//        HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
-//            IEnumSTATPROPSETSTG * This,
-//            /* [in] */ __RPC__in REFIID riid,
-//            /* [iid_is][out] */
-//            __RPC__deref_out  void **ppvObject);
-//
-//        ULONG ( STDMETHODCALLTYPE *AddRef )(
-//            IEnumSTATPROPSETSTG * This);
-//
-//        ULONG ( STDMETHODCALLTYPE *Release )(
-//            IEnumSTATPROPSETSTG * This);
-//
-//        /* [local] */ HRESULT ( STDMETHODCALLTYPE *Next )(
-//            IEnumSTATPROPSETSTG * This,
-//            /* [in] */ ULONG celt,
-//            /* [length_is][size_is][out] */ STATPROPSETSTG *rgelt,
-//            /* [out] */ ULONG *pceltFetched);
-//
-//        HRESULT ( STDMETHODCALLTYPE *Skip )(
-//            IEnumSTATPROPSETSTG * This,
-//            /* [in] */ ULONG celt);
-//
-//        HRESULT ( STDMETHODCALLTYPE *Reset )(
-//            IEnumSTATPROPSETSTG * This);
-//
-//        HRESULT ( STDMETHODCALLTYPE *Clone )(
-//            IEnumSTATPROPSETSTG * This,
-//            /* [out] */ __RPC__deref_out_opt IEnumSTATPROPSETSTG **ppenum);
-//
-//        END_INTERFACE
-//    } IEnumSTATPROPSETSTGVtbl;
-//
-//    interface IEnumSTATPROPSETSTG
-//    {
-//        CONST_VTBL struct IEnumSTATPROPSETSTGVtbl *lpVtbl;
-//    };
-
-
-
-#ifdef COBJMACROS
-
-
-#define IEnumSTATPROPSETSTG_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
-
-#define IEnumSTATPROPSETSTG_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) )
-
-#define IEnumSTATPROPSETSTG_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) )
-
-
-#define IEnumSTATPROPSETSTG_Next(This,celt,rgelt,pceltFetched)	\
-    ( (This)->lpVtbl -> Next(This,celt,rgelt,pceltFetched) )
-
-#define IEnumSTATPROPSETSTG_Skip(This,celt)	\
-    ( (This)->lpVtbl -> Skip(This,celt) )
-
-#define IEnumSTATPROPSETSTG_Reset(This)	\
-    ( (This)->lpVtbl -> Reset(This) )
-
-#define IEnumSTATPROPSETSTG_Clone(This,ppenum)	\
-    ( (This)->lpVtbl -> Clone(This,ppenum) )
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-/* [call_as] */ HRESULT STDMETHODCALLTYPE IEnumSTATPROPSETSTG_RemoteNext_Proxy(
-    IEnumSTATPROPSETSTG * This,
-    /* [in] */ ULONG celt,
-    /* [length_is][size_is][out] */ __RPC__out_ecount_part(celt, *pceltFetched) STATPROPSETSTG *rgelt,
-    /* [out] */ __RPC__out ULONG *pceltFetched);
-
-
-void __RPC_STUB IEnumSTATPROPSETSTG_RemoteNext_Stub(
-    IRpcStubBuffer *This,
-    IRpcChannelBuffer *_pRpcChannelBuffer,
-    PRPC_MESSAGE _pRpcMessage,
-    DWORD *_pdwStubPhase);
-
-
-
-#endif 	/* __IEnumSTATPROPSETSTG_INTERFACE_DEFINED__ */
-
-
-/* interface __MIDL_itf_propidl_0000_0004 */
-/* [local] */
-
-typedef /* [unique] */  __RPC_unique_pointer IPropertyStorage *LPPROPERTYSTORAGE;
-
-WINOLEAPI PropVariantCopy ( PROPVARIANT * pvarDest, const PROPVARIANT * pvarSrc );
-WINOLEAPI PropVariantClear ( PROPVARIANT * pvar );
-WINOLEAPI FreePropVariantArray ( ULONG cVariants, PROPVARIANT * rgvars );
-
-#define _PROPVARIANTINIT_DEFINED_
-#   ifdef __cplusplus
-inline void PropVariantInit ( PROPVARIANT * pvar )
-{
-    memset ( pvar, 0, sizeof(PROPVARIANT) );
-}
-#   else
-#   define PropVariantInit(pvar) memset ( (pvar), 0, sizeof(PROPVARIANT) )
-#   endif
-
-
-#ifndef _STGCREATEPROPSTG_DEFINED_
-WINOLEAPI StgCreatePropStg( IUnknown* pUnk, REFFMTID fmtid, const CLSID *pclsid, DWORD grfFlags, DWORD dwReserved, IPropertyStorage **ppPropStg );
-WINOLEAPI StgOpenPropStg( IUnknown* pUnk, REFFMTID fmtid, DWORD grfFlags, DWORD dwReserved, IPropertyStorage **ppPropStg );
-WINOLEAPI StgCreatePropSetStg( IStorage *pStorage, DWORD dwReserved, IPropertySetStorage **ppPropSetStg);
-
-#define CCH_MAX_PROPSTG_NAME    31
-__checkReturn WINOLEAPI FmtIdToPropStgName( const FMTID *pfmtid, __out_ecount(CCH_MAX_PROPSTG_NAME+1) LPOLESTR oszName );
-WINOLEAPI PropStgNameToFmtId( __in __nullterminated const LPOLESTR oszName, FMTID *pfmtid );
-#endif
-#ifndef _SERIALIZEDPROPERTYVALUE_DEFINED_
-#define _SERIALIZEDPROPERTYVALUE_DEFINED_
-typedef struct tagSERIALIZEDPROPERTYVALUE		// prop
-{
-    DWORD	dwType;
-    BYTE	rgb[1];
-} SERIALIZEDPROPERTYVALUE;
-#endif
-
-EXTERN_C SERIALIZEDPROPERTYVALUE* __stdcall
-StgConvertVariantToProperty(
-            __in const PROPVARIANT* pvar,
-            USHORT CodePage,
-            __out_bcount_opt(*pcb) SERIALIZEDPROPERTYVALUE* pprop,
-            __inout ULONG* pcb,
-            PROPID pid,
-            __reserved BOOLEAN fReserved,
-            __out_opt ULONG* pcIndirect);
-
-#ifdef __cplusplus
-class PMemoryAllocator;
-
-EXTERN_C BOOLEAN __stdcall
-StgConvertPropertyToVariant(
-            __in const SERIALIZEDPROPERTYVALUE* pprop,
-            USHORT CodePage,
-            __out PROPVARIANT* pvar,
-            __in PMemoryAllocator* pma);
-#endif
-#if _MSC_VER >= 1200
-#pragma warning(pop)
-#else
-#pragma warning(default:4201)    /* Nameless struct/union */
-#pragma warning(default:4237)    /* keywords bool, true, false, etc.. */
-#endif
-
-
-extern RPC_IF_HANDLE __MIDL_itf_propidl_0000_0004_v0_0_c_ifspec;
-extern RPC_IF_HANDLE __MIDL_itf_propidl_0000_0004_v0_0_s_ifspec;
-
-/* Additional Prototypes for ALL interfaces */
-
-unsigned long             __RPC_USER  BSTR_UserSize(     unsigned long *, unsigned long            , BSTR * );
-unsigned char * __RPC_USER  BSTR_UserMarshal(  unsigned long *, unsigned char *, BSTR * );
-unsigned char * __RPC_USER  BSTR_UserUnmarshal(unsigned long *, unsigned char *, BSTR * );
-void                      __RPC_USER  BSTR_UserFree(     unsigned long *, BSTR * );
-
-unsigned long             __RPC_USER  LPSAFEARRAY_UserSize(     unsigned long *, unsigned long            , LPSAFEARRAY * );
-unsigned char * __RPC_USER  LPSAFEARRAY_UserMarshal(  unsigned long *, unsigned char *, LPSAFEARRAY * );
-unsigned char * __RPC_USER  LPSAFEARRAY_UserUnmarshal(unsigned long *, unsigned char *, LPSAFEARRAY * );
-void                      __RPC_USER  LPSAFEARRAY_UserFree(     unsigned long *, LPSAFEARRAY * );
-
-unsigned long             __RPC_USER  BSTR_UserSize64(     unsigned long *, unsigned long            , BSTR * );
-unsigned char * __RPC_USER  BSTR_UserMarshal64(  unsigned long *, unsigned char *, BSTR * );
-unsigned char * __RPC_USER  BSTR_UserUnmarshal64(unsigned long *, unsigned char *, BSTR * );
-void                      __RPC_USER  BSTR_UserFree64(     unsigned long *, BSTR * );
-
-unsigned long             __RPC_USER  LPSAFEARRAY_UserSize64(     unsigned long *, unsigned long            , LPSAFEARRAY * );
-unsigned char * __RPC_USER  LPSAFEARRAY_UserMarshal64(  unsigned long *, unsigned char *, LPSAFEARRAY * );
-unsigned char * __RPC_USER  LPSAFEARRAY_UserUnmarshal64(unsigned long *, unsigned char *, LPSAFEARRAY * );
-void                      __RPC_USER  LPSAFEARRAY_UserFree64(     unsigned long *, LPSAFEARRAY * );
-
-/* [local] */ HRESULT STDMETHODCALLTYPE IEnumSTATPROPSTG_Next_Proxy(
-    IEnumSTATPROPSTG * This,
-    /* [in] */ ULONG celt,
-    /* [length_is][size_is][out] */ STATPROPSTG *rgelt,
-    /* [out] */ ULONG *pceltFetched);
-
-
-/* [call_as] */ HRESULT STDMETHODCALLTYPE IEnumSTATPROPSTG_Next_Stub(
-    IEnumSTATPROPSTG * This,
-    /* [in] */ ULONG celt,
-    /* [length_is][size_is][out] */ __RPC__out_ecount_part(celt, *pceltFetched) STATPROPSTG *rgelt,
-    /* [out] */ __RPC__out ULONG *pceltFetched);
-
-/* [local] */ HRESULT STDMETHODCALLTYPE IEnumSTATPROPSETSTG_Next_Proxy(
-    IEnumSTATPROPSETSTG * This,
-    /* [in] */ ULONG celt,
-    /* [length_is][size_is][out] */ STATPROPSETSTG *rgelt,
-    /* [out] */ ULONG *pceltFetched);
-
-
-/* [call_as] */ HRESULT STDMETHODCALLTYPE IEnumSTATPROPSETSTG_Next_Stub(
-    IEnumSTATPROPSETSTG * This,
-    /* [in] */ ULONG celt,
-    /* [length_is][size_is][out] */ __RPC__out_ecount_part(celt, *pceltFetched) STATPROPSETSTG *rgelt,
-    /* [out] */ __RPC__out ULONG *pceltFetched);
-
-
-
-/* end of Additional Prototypes */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
-
-
diff --git a/src/hostapi/wasapi/mingw-include/propkey.h b/src/hostapi/wasapi/mingw-include/propkey.h
deleted file mode 100644
index ea94fcf..0000000
--- a/src/hostapi/wasapi/mingw-include/propkey.h
+++ /dev/null
@@ -1,4274 +0,0 @@
-//===========================================================================
-//
-// Copyright (c) Microsoft Corporation. All rights reserved.
-//
-//===========================================================================
-
-
-#ifndef _INC_PROPKEY
-#define _INC_PROPKEY
-
-#ifndef DEFINE_API_PKEY
-#define DEFINE_API_PKEY(name, managed_name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8, pid) \
-        DEFINE_PROPERTYKEY(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8, pid)
-#endif
-
-#include <propkeydef.h>
-
-#ifndef _WIN32_IE
-#define _WIN32_IE 0x0501
-#else
-#if (_WIN32_IE < 0x0400) && defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0500)
-#error _WIN32_IE setting conflicts with _WIN32_WINNT setting
-#endif
-#endif
-
- 
-//-----------------------------------------------------------------------------
-// Audio properties
-
-//  Name:     System.Audio.ChannelCount -- PKEY_Audio_ChannelCount
-//  Type:     UInt32 -- VT_UI4
-//  FormatID: (FMTID_AudioSummaryInformation) 64440490-4C8B-11D1-8B70-080036B11A03, 7 (PIDASI_CHANNEL_COUNT)
-//
-//  Indicates the channel count for the audio file.  Values: 1 (mono), 2 (stereo).
-DEFINE_PROPERTYKEY(PKEY_Audio_ChannelCount, 0x64440490, 0x4C8B, 0x11D1, 0x8B, 0x70, 0x08, 0x00, 0x36, 0xB1, 0x1A, 0x03, 7);
-
-// Possible discrete values for PKEY_Audio_ChannelCount are:
-#define AUDIO_CHANNELCOUNT_MONO             1ul
-#define AUDIO_CHANNELCOUNT_STEREO           2ul
-
-//  Name:     System.Audio.Compression -- PKEY_Audio_Compression
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: (FMTID_AudioSummaryInformation) 64440490-4C8B-11D1-8B70-080036B11A03, 10 (PIDASI_COMPRESSION)
-//
-//  
-DEFINE_PROPERTYKEY(PKEY_Audio_Compression, 0x64440490, 0x4C8B, 0x11D1, 0x8B, 0x70, 0x08, 0x00, 0x36, 0xB1, 0x1A, 0x03, 10);
-
-//  Name:     System.Audio.EncodingBitrate -- PKEY_Audio_EncodingBitrate
-//  Type:     UInt32 -- VT_UI4
-//  FormatID: (FMTID_AudioSummaryInformation) 64440490-4C8B-11D1-8B70-080036B11A03, 4 (PIDASI_AVG_DATA_RATE)
-//
-//  Indicates the average data rate in Hz for the audio file in "bits per second".
-DEFINE_PROPERTYKEY(PKEY_Audio_EncodingBitrate, 0x64440490, 0x4C8B, 0x11D1, 0x8B, 0x70, 0x08, 0x00, 0x36, 0xB1, 0x1A, 0x03, 4);
-
-//  Name:     System.Audio.Format -- PKEY_Audio_Format
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)  Legacy code may treat this as VT_BSTR.
-//  FormatID: (FMTID_AudioSummaryInformation) 64440490-4C8B-11D1-8B70-080036B11A03, 2 (PIDASI_FORMAT)
-//
-//  Indicates the format of the audio file.
-DEFINE_PROPERTYKEY(PKEY_Audio_Format, 0x64440490, 0x4C8B, 0x11D1, 0x8B, 0x70, 0x08, 0x00, 0x36, 0xB1, 0x1A, 0x03, 2);
-
-//  Name:     System.Audio.IsVariableBitRate -- PKEY_Audio_IsVariableBitRate
-//  Type:     Boolean -- VT_BOOL
-//  FormatID: E6822FEE-8C17-4D62-823C-8E9CFCBD1D5C, 100
-DEFINE_PROPERTYKEY(PKEY_Audio_IsVariableBitRate, 0xE6822FEE, 0x8C17, 0x4D62, 0x82, 0x3C, 0x8E, 0x9C, 0xFC, 0xBD, 0x1D, 0x5C, 100);
-
-//  Name:     System.Audio.PeakValue -- PKEY_Audio_PeakValue
-//  Type:     UInt32 -- VT_UI4
-//  FormatID: 2579E5D0-1116-4084-BD9A-9B4F7CB4DF5E, 100
-DEFINE_PROPERTYKEY(PKEY_Audio_PeakValue, 0x2579E5D0, 0x1116, 0x4084, 0xBD, 0x9A, 0x9B, 0x4F, 0x7C, 0xB4, 0xDF, 0x5E, 100);
-
-//  Name:     System.Audio.SampleRate -- PKEY_Audio_SampleRate
-//  Type:     UInt32 -- VT_UI4
-//  FormatID: (FMTID_AudioSummaryInformation) 64440490-4C8B-11D1-8B70-080036B11A03, 5 (PIDASI_SAMPLE_RATE)
-//
-//  Indicates the audio sample rate for the audio file in "samples per second".
-DEFINE_PROPERTYKEY(PKEY_Audio_SampleRate, 0x64440490, 0x4C8B, 0x11D1, 0x8B, 0x70, 0x08, 0x00, 0x36, 0xB1, 0x1A, 0x03, 5);
-
-//  Name:     System.Audio.SampleSize -- PKEY_Audio_SampleSize
-//  Type:     UInt32 -- VT_UI4
-//  FormatID: (FMTID_AudioSummaryInformation) 64440490-4C8B-11D1-8B70-080036B11A03, 6 (PIDASI_SAMPLE_SIZE)
-//
-//  Indicates the audio sample size for the audio file in "bits per sample".
-DEFINE_PROPERTYKEY(PKEY_Audio_SampleSize, 0x64440490, 0x4C8B, 0x11D1, 0x8B, 0x70, 0x08, 0x00, 0x36, 0xB1, 0x1A, 0x03, 6);
-
-//  Name:     System.Audio.StreamName -- PKEY_Audio_StreamName
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: (FMTID_AudioSummaryInformation) 64440490-4C8B-11D1-8B70-080036B11A03, 9 (PIDASI_STREAM_NAME)
-//
-//  
-DEFINE_PROPERTYKEY(PKEY_Audio_StreamName, 0x64440490, 0x4C8B, 0x11D1, 0x8B, 0x70, 0x08, 0x00, 0x36, 0xB1, 0x1A, 0x03, 9);
-
-//  Name:     System.Audio.StreamNumber -- PKEY_Audio_StreamNumber
-//  Type:     UInt16 -- VT_UI2
-//  FormatID: (FMTID_AudioSummaryInformation) 64440490-4C8B-11D1-8B70-080036B11A03, 8 (PIDASI_STREAM_NUMBER)
-//
-//  
-DEFINE_PROPERTYKEY(PKEY_Audio_StreamNumber, 0x64440490, 0x4C8B, 0x11D1, 0x8B, 0x70, 0x08, 0x00, 0x36, 0xB1, 0x1A, 0x03, 8);
-
- 
- 
-//-----------------------------------------------------------------------------
-// Calendar properties
-
-//  Name:     System.Calendar.Duration -- PKEY_Calendar_Duration
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 293CA35A-09AA-4DD2-B180-1FE245728A52, 100
-//
-//  The duration as specified in a string.
-DEFINE_PROPERTYKEY(PKEY_Calendar_Duration, 0x293CA35A, 0x09AA, 0x4DD2, 0xB1, 0x80, 0x1F, 0xE2, 0x45, 0x72, 0x8A, 0x52, 100);
-
-//  Name:     System.Calendar.IsOnline -- PKEY_Calendar_IsOnline
-//  Type:     Boolean -- VT_BOOL
-//  FormatID: BFEE9149-E3E2-49A7-A862-C05988145CEC, 100
-//
-//  Identifies if the event is an online event.
-DEFINE_PROPERTYKEY(PKEY_Calendar_IsOnline, 0xBFEE9149, 0xE3E2, 0x49A7, 0xA8, 0x62, 0xC0, 0x59, 0x88, 0x14, 0x5C, 0xEC, 100);
-
-//  Name:     System.Calendar.IsRecurring -- PKEY_Calendar_IsRecurring
-//  Type:     Boolean -- VT_BOOL
-//  FormatID: 315B9C8D-80A9-4EF9-AE16-8E746DA51D70, 100
-DEFINE_PROPERTYKEY(PKEY_Calendar_IsRecurring, 0x315B9C8D, 0x80A9, 0x4EF9, 0xAE, 0x16, 0x8E, 0x74, 0x6D, 0xA5, 0x1D, 0x70, 100);
-
-//  Name:     System.Calendar.Location -- PKEY_Calendar_Location
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: F6272D18-CECC-40B1-B26A-3911717AA7BD, 100
-DEFINE_PROPERTYKEY(PKEY_Calendar_Location, 0xF6272D18, 0xCECC, 0x40B1, 0xB2, 0x6A, 0x39, 0x11, 0x71, 0x7A, 0xA7, 0xBD, 100);
-
-//  Name:     System.Calendar.OptionalAttendeeAddresses -- PKEY_Calendar_OptionalAttendeeAddresses
-//  Type:     Multivalue String -- VT_VECTOR | VT_LPWSTR  (For variants: VT_ARRAY | VT_BSTR)
-//  FormatID: D55BAE5A-3892-417A-A649-C6AC5AAAEAB3, 100
-DEFINE_PROPERTYKEY(PKEY_Calendar_OptionalAttendeeAddresses, 0xD55BAE5A, 0x3892, 0x417A, 0xA6, 0x49, 0xC6, 0xAC, 0x5A, 0xAA, 0xEA, 0xB3, 100);
-
-//  Name:     System.Calendar.OptionalAttendeeNames -- PKEY_Calendar_OptionalAttendeeNames
-//  Type:     Multivalue String -- VT_VECTOR | VT_LPWSTR  (For variants: VT_ARRAY | VT_BSTR)
-//  FormatID: 09429607-582D-437F-84C3-DE93A2B24C3C, 100
-DEFINE_PROPERTYKEY(PKEY_Calendar_OptionalAttendeeNames, 0x09429607, 0x582D, 0x437F, 0x84, 0xC3, 0xDE, 0x93, 0xA2, 0xB2, 0x4C, 0x3C, 100);
-
-//  Name:     System.Calendar.OrganizerAddress -- PKEY_Calendar_OrganizerAddress
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 744C8242-4DF5-456C-AB9E-014EFB9021E3, 100
-//
-//  Address of the organizer organizing the event.
-DEFINE_PROPERTYKEY(PKEY_Calendar_OrganizerAddress, 0x744C8242, 0x4DF5, 0x456C, 0xAB, 0x9E, 0x01, 0x4E, 0xFB, 0x90, 0x21, 0xE3, 100);
-
-//  Name:     System.Calendar.OrganizerName -- PKEY_Calendar_OrganizerName
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: AAA660F9-9865-458E-B484-01BC7FE3973E, 100
-//
-//  Name of the organizer organizing the event.
-DEFINE_PROPERTYKEY(PKEY_Calendar_OrganizerName, 0xAAA660F9, 0x9865, 0x458E, 0xB4, 0x84, 0x01, 0xBC, 0x7F, 0xE3, 0x97, 0x3E, 100);
-
-//  Name:     System.Calendar.ReminderTime -- PKEY_Calendar_ReminderTime
-//  Type:     DateTime -- VT_FILETIME  (For variants: VT_DATE)
-//  FormatID: 72FC5BA4-24F9-4011-9F3F-ADD27AFAD818, 100
-DEFINE_PROPERTYKEY(PKEY_Calendar_ReminderTime, 0x72FC5BA4, 0x24F9, 0x4011, 0x9F, 0x3F, 0xAD, 0xD2, 0x7A, 0xFA, 0xD8, 0x18, 100);
-
-//  Name:     System.Calendar.RequiredAttendeeAddresses -- PKEY_Calendar_RequiredAttendeeAddresses
-//  Type:     Multivalue String -- VT_VECTOR | VT_LPWSTR  (For variants: VT_ARRAY | VT_BSTR)
-//  FormatID: 0BA7D6C3-568D-4159-AB91-781A91FB71E5, 100
-DEFINE_PROPERTYKEY(PKEY_Calendar_RequiredAttendeeAddresses, 0x0BA7D6C3, 0x568D, 0x4159, 0xAB, 0x91, 0x78, 0x1A, 0x91, 0xFB, 0x71, 0xE5, 100);
-
-//  Name:     System.Calendar.RequiredAttendeeNames -- PKEY_Calendar_RequiredAttendeeNames
-//  Type:     Multivalue String -- VT_VECTOR | VT_LPWSTR  (For variants: VT_ARRAY | VT_BSTR)
-//  FormatID: B33AF30B-F552-4584-936C-CB93E5CDA29F, 100
-DEFINE_PROPERTYKEY(PKEY_Calendar_RequiredAttendeeNames, 0xB33AF30B, 0xF552, 0x4584, 0x93, 0x6C, 0xCB, 0x93, 0xE5, 0xCD, 0xA2, 0x9F, 100);
-
-//  Name:     System.Calendar.Resources -- PKEY_Calendar_Resources
-//  Type:     Multivalue String -- VT_VECTOR | VT_LPWSTR  (For variants: VT_ARRAY | VT_BSTR)
-//  FormatID: 00F58A38-C54B-4C40-8696-97235980EAE1, 100
-DEFINE_PROPERTYKEY(PKEY_Calendar_Resources, 0x00F58A38, 0xC54B, 0x4C40, 0x86, 0x96, 0x97, 0x23, 0x59, 0x80, 0xEA, 0xE1, 100);
-
-//  Name:     System.Calendar.ShowTimeAs -- PKEY_Calendar_ShowTimeAs
-//  Type:     UInt16 -- VT_UI2
-//  FormatID: 5BF396D4-5EB2-466F-BDE9-2FB3F2361D6E, 100
-//
-//  
-DEFINE_PROPERTYKEY(PKEY_Calendar_ShowTimeAs, 0x5BF396D4, 0x5EB2, 0x466F, 0xBD, 0xE9, 0x2F, 0xB3, 0xF2, 0x36, 0x1D, 0x6E, 100);
-
-// Possible discrete values for PKEY_Calendar_ShowTimeAs are:
-#define CALENDAR_SHOWTIMEAS_FREE            0u
-#define CALENDAR_SHOWTIMEAS_TENTATIVE       1u
-#define CALENDAR_SHOWTIMEAS_BUSY            2u
-#define CALENDAR_SHOWTIMEAS_OOF             3u
-
-//  Name:     System.Calendar.ShowTimeAsText -- PKEY_Calendar_ShowTimeAsText
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 53DA57CF-62C0-45C4-81DE-7610BCEFD7F5, 100
-//  
-//  This is the user-friendly form of System.Calendar.ShowTimeAs.  Not intended to be parsed 
-//  programmatically.
-DEFINE_PROPERTYKEY(PKEY_Calendar_ShowTimeAsText, 0x53DA57CF, 0x62C0, 0x45C4, 0x81, 0xDE, 0x76, 0x10, 0xBC, 0xEF, 0xD7, 0xF5, 100);
- 
-//-----------------------------------------------------------------------------
-// Communication properties
-
-
-
-//  Name:     System.Communication.AccountName -- PKEY_Communication_AccountName
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD, 9
-//
-//  Account Name
-DEFINE_PROPERTYKEY(PKEY_Communication_AccountName, 0xE3E0584C, 0xB788, 0x4A5A, 0xBB, 0x20, 0x7F, 0x5A, 0x44, 0xC9, 0xAC, 0xDD, 9);
-
-//  Name:     System.Communication.Suffix -- PKEY_Communication_Suffix
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 807B653A-9E91-43EF-8F97-11CE04EE20C5, 100
-DEFINE_PROPERTYKEY(PKEY_Communication_Suffix, 0x807B653A, 0x9E91, 0x43EF, 0x8F, 0x97, 0x11, 0xCE, 0x04, 0xEE, 0x20, 0xC5, 100);
-
-//  Name:     System.Communication.TaskStatus -- PKEY_Communication_TaskStatus
-//  Type:     UInt16 -- VT_UI2
-//  FormatID: BE1A72C6-9A1D-46B7-AFE7-AFAF8CEF4999, 100
-DEFINE_PROPERTYKEY(PKEY_Communication_TaskStatus, 0xBE1A72C6, 0x9A1D, 0x46B7, 0xAF, 0xE7, 0xAF, 0xAF, 0x8C, 0xEF, 0x49, 0x99, 100);
-
-// Possible discrete values for PKEY_Communication_TaskStatus are:
-#define TASKSTATUS_NOTSTARTED               0u
-#define TASKSTATUS_INPROGRESS               1u
-#define TASKSTATUS_COMPLETE                 2u
-#define TASKSTATUS_WAITING                  3u
-#define TASKSTATUS_DEFERRED                 4u
-
-//  Name:     System.Communication.TaskStatusText -- PKEY_Communication_TaskStatusText
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: A6744477-C237-475B-A075-54F34498292A, 100
-//  
-//  This is the user-friendly form of System.Communication.TaskStatus.  Not intended to be parsed 
-//  programmatically.
-DEFINE_PROPERTYKEY(PKEY_Communication_TaskStatusText, 0xA6744477, 0xC237, 0x475B, 0xA0, 0x75, 0x54, 0xF3, 0x44, 0x98, 0x29, 0x2A, 100);
- 
-//-----------------------------------------------------------------------------
-// Computer properties
-
-
-
-//  Name:     System.Computer.DecoratedFreeSpace -- PKEY_Computer_DecoratedFreeSpace
-//  Type:     Multivalue UInt64 -- VT_VECTOR | VT_UI8  (For variants: VT_ARRAY | VT_UI8)
-//  FormatID: (FMTID_Volume) 9B174B35-40FF-11D2-A27E-00C04FC30871, 7  (Filesystem Volume Properties)
-//
-//  Free space and total space: "%s free of %s"
-DEFINE_PROPERTYKEY(PKEY_Computer_DecoratedFreeSpace, 0x9B174B35, 0x40FF, 0x11D2, 0xA2, 0x7E, 0x00, 0xC0, 0x4F, 0xC3, 0x08, 0x71, 7);
- 
-//-----------------------------------------------------------------------------
-// Contact properties
-
-
-
-//  Name:     System.Contact.Anniversary -- PKEY_Contact_Anniversary
-//  Type:     DateTime -- VT_FILETIME  (For variants: VT_DATE)
-//  FormatID: 9AD5BADB-CEA7-4470-A03D-B84E51B9949E, 100
-DEFINE_PROPERTYKEY(PKEY_Contact_Anniversary, 0x9AD5BADB, 0xCEA7, 0x4470, 0xA0, 0x3D, 0xB8, 0x4E, 0x51, 0xB9, 0x94, 0x9E, 100);
-
-//  Name:     System.Contact.AssistantName -- PKEY_Contact_AssistantName
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: CD102C9C-5540-4A88-A6F6-64E4981C8CD1, 100
-DEFINE_PROPERTYKEY(PKEY_Contact_AssistantName, 0xCD102C9C, 0x5540, 0x4A88, 0xA6, 0xF6, 0x64, 0xE4, 0x98, 0x1C, 0x8C, 0xD1, 100);
-
-//  Name:     System.Contact.AssistantTelephone -- PKEY_Contact_AssistantTelephone
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 9A93244D-A7AD-4FF8-9B99-45EE4CC09AF6, 100
-DEFINE_PROPERTYKEY(PKEY_Contact_AssistantTelephone, 0x9A93244D, 0xA7AD, 0x4FF8, 0x9B, 0x99, 0x45, 0xEE, 0x4C, 0xC0, 0x9A, 0xF6, 100);
-
-//  Name:     System.Contact.Birthday -- PKEY_Contact_Birthday
-//  Type:     DateTime -- VT_FILETIME  (For variants: VT_DATE)
-//  FormatID: 176DC63C-2688-4E89-8143-A347800F25E9, 47
-DEFINE_PROPERTYKEY(PKEY_Contact_Birthday, 0x176DC63C, 0x2688, 0x4E89, 0x81, 0x43, 0xA3, 0x47, 0x80, 0x0F, 0x25, 0xE9, 47);
-
-//  Name:     System.Contact.BusinessAddress -- PKEY_Contact_BusinessAddress
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 730FB6DD-CF7C-426B-A03F-BD166CC9EE24, 100
-DEFINE_PROPERTYKEY(PKEY_Contact_BusinessAddress, 0x730FB6DD, 0xCF7C, 0x426B, 0xA0, 0x3F, 0xBD, 0x16, 0x6C, 0xC9, 0xEE, 0x24, 100);
-
-//  Name:     System.Contact.BusinessAddressCity -- PKEY_Contact_BusinessAddressCity
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 402B5934-EC5A-48C3-93E6-85E86A2D934E, 100
-DEFINE_PROPERTYKEY(PKEY_Contact_BusinessAddressCity, 0x402B5934, 0xEC5A, 0x48C3, 0x93, 0xE6, 0x85, 0xE8, 0x6A, 0x2D, 0x93, 0x4E, 100);
-
-//  Name:     System.Contact.BusinessAddressCountry -- PKEY_Contact_BusinessAddressCountry
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: B0B87314-FCF6-4FEB-8DFF-A50DA6AF561C, 100
-DEFINE_PROPERTYKEY(PKEY_Contact_BusinessAddressCountry, 0xB0B87314, 0xFCF6, 0x4FEB, 0x8D, 0xFF, 0xA5, 0x0D, 0xA6, 0xAF, 0x56, 0x1C, 100);
-
-//  Name:     System.Contact.BusinessAddressPostalCode -- PKEY_Contact_BusinessAddressPostalCode
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: E1D4A09E-D758-4CD1-B6EC-34A8B5A73F80, 100
-DEFINE_PROPERTYKEY(PKEY_Contact_BusinessAddressPostalCode, 0xE1D4A09E, 0xD758, 0x4CD1, 0xB6, 0xEC, 0x34, 0xA8, 0xB5, 0xA7, 0x3F, 0x80, 100);
-
-//  Name:     System.Contact.BusinessAddressPostOfficeBox -- PKEY_Contact_BusinessAddressPostOfficeBox
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: BC4E71CE-17F9-48D5-BEE9-021DF0EA5409, 100
-DEFINE_PROPERTYKEY(PKEY_Contact_BusinessAddressPostOfficeBox, 0xBC4E71CE, 0x17F9, 0x48D5, 0xBE, 0xE9, 0x02, 0x1D, 0xF0, 0xEA, 0x54, 0x09, 100);
-
-//  Name:     System.Contact.BusinessAddressState -- PKEY_Contact_BusinessAddressState
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 446F787F-10C4-41CB-A6C4-4D0343551597, 100
-DEFINE_PROPERTYKEY(PKEY_Contact_BusinessAddressState, 0x446F787F, 0x10C4, 0x41CB, 0xA6, 0xC4, 0x4D, 0x03, 0x43, 0x55, 0x15, 0x97, 100);
-
-//  Name:     System.Contact.BusinessAddressStreet -- PKEY_Contact_BusinessAddressStreet
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: DDD1460F-C0BF-4553-8CE4-10433C908FB0, 100
-DEFINE_PROPERTYKEY(PKEY_Contact_BusinessAddressStreet, 0xDDD1460F, 0xC0BF, 0x4553, 0x8C, 0xE4, 0x10, 0x43, 0x3C, 0x90, 0x8F, 0xB0, 100);
-
-//  Name:     System.Contact.BusinessFaxNumber -- PKEY_Contact_BusinessFaxNumber
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 91EFF6F3-2E27-42CA-933E-7C999FBE310B, 100
-//
-//  Business fax number of the contact.
-DEFINE_PROPERTYKEY(PKEY_Contact_BusinessFaxNumber, 0x91EFF6F3, 0x2E27, 0x42CA, 0x93, 0x3E, 0x7C, 0x99, 0x9F, 0xBE, 0x31, 0x0B, 100);
-
-//  Name:     System.Contact.BusinessHomePage -- PKEY_Contact_BusinessHomePage
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 56310920-2491-4919-99CE-EADB06FAFDB2, 100
-DEFINE_PROPERTYKEY(PKEY_Contact_BusinessHomePage, 0x56310920, 0x2491, 0x4919, 0x99, 0xCE, 0xEA, 0xDB, 0x06, 0xFA, 0xFD, 0xB2, 100);
-
-//  Name:     System.Contact.BusinessTelephone -- PKEY_Contact_BusinessTelephone
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 6A15E5A0-0A1E-4CD7-BB8C-D2F1B0C929BC, 100
-DEFINE_PROPERTYKEY(PKEY_Contact_BusinessTelephone, 0x6A15E5A0, 0x0A1E, 0x4CD7, 0xBB, 0x8C, 0xD2, 0xF1, 0xB0, 0xC9, 0x29, 0xBC, 100);
-
-//  Name:     System.Contact.CallbackTelephone -- PKEY_Contact_CallbackTelephone
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: BF53D1C3-49E0-4F7F-8567-5A821D8AC542, 100
-DEFINE_PROPERTYKEY(PKEY_Contact_CallbackTelephone, 0xBF53D1C3, 0x49E0, 0x4F7F, 0x85, 0x67, 0x5A, 0x82, 0x1D, 0x8A, 0xC5, 0x42, 100);
-
-//  Name:     System.Contact.CarTelephone -- PKEY_Contact_CarTelephone
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 8FDC6DEA-B929-412B-BA90-397A257465FE, 100
-DEFINE_PROPERTYKEY(PKEY_Contact_CarTelephone, 0x8FDC6DEA, 0xB929, 0x412B, 0xBA, 0x90, 0x39, 0x7A, 0x25, 0x74, 0x65, 0xFE, 100);
-
-//  Name:     System.Contact.Children -- PKEY_Contact_Children
-//  Type:     Multivalue String -- VT_VECTOR | VT_LPWSTR  (For variants: VT_ARRAY | VT_BSTR)
-//  FormatID: D4729704-8EF1-43EF-9024-2BD381187FD5, 100
-DEFINE_PROPERTYKEY(PKEY_Contact_Children, 0xD4729704, 0x8EF1, 0x43EF, 0x90, 0x24, 0x2B, 0xD3, 0x81, 0x18, 0x7F, 0xD5, 100);
-
-//  Name:     System.Contact.CompanyMainTelephone -- PKEY_Contact_CompanyMainTelephone
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 8589E481-6040-473D-B171-7FA89C2708ED, 100
-DEFINE_PROPERTYKEY(PKEY_Contact_CompanyMainTelephone, 0x8589E481, 0x6040, 0x473D, 0xB1, 0x71, 0x7F, 0xA8, 0x9C, 0x27, 0x08, 0xED, 100);
-
-//  Name:     System.Contact.Department -- PKEY_Contact_Department
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: FC9F7306-FF8F-4D49-9FB6-3FFE5C0951EC, 100
-DEFINE_PROPERTYKEY(PKEY_Contact_Department, 0xFC9F7306, 0xFF8F, 0x4D49, 0x9F, 0xB6, 0x3F, 0xFE, 0x5C, 0x09, 0x51, 0xEC, 100);
-
-//  Name:     System.Contact.EmailAddress -- PKEY_Contact_EmailAddress
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: F8FA7FA3-D12B-4785-8A4E-691A94F7A3E7, 100
-DEFINE_PROPERTYKEY(PKEY_Contact_EmailAddress, 0xF8FA7FA3, 0xD12B, 0x4785, 0x8A, 0x4E, 0x69, 0x1A, 0x94, 0xF7, 0xA3, 0xE7, 100);
-
-//  Name:     System.Contact.EmailAddress2 -- PKEY_Contact_EmailAddress2
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 38965063-EDC8-4268-8491-B7723172CF29, 100
-DEFINE_PROPERTYKEY(PKEY_Contact_EmailAddress2, 0x38965063, 0xEDC8, 0x4268, 0x84, 0x91, 0xB7, 0x72, 0x31, 0x72, 0xCF, 0x29, 100);
-
-//  Name:     System.Contact.EmailAddress3 -- PKEY_Contact_EmailAddress3
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 644D37B4-E1B3-4BAD-B099-7E7C04966ACA, 100
-DEFINE_PROPERTYKEY(PKEY_Contact_EmailAddress3, 0x644D37B4, 0xE1B3, 0x4BAD, 0xB0, 0x99, 0x7E, 0x7C, 0x04, 0x96, 0x6A, 0xCA, 100);
-
-//  Name:     System.Contact.EmailAddresses -- PKEY_Contact_EmailAddresses
-//  Type:     Multivalue String -- VT_VECTOR | VT_LPWSTR  (For variants: VT_ARRAY | VT_BSTR)
-//  FormatID: 84D8F337-981D-44B3-9615-C7596DBA17E3, 100
-DEFINE_PROPERTYKEY(PKEY_Contact_EmailAddresses, 0x84D8F337, 0x981D, 0x44B3, 0x96, 0x15, 0xC7, 0x59, 0x6D, 0xBA, 0x17, 0xE3, 100);
-
-//  Name:     System.Contact.EmailName -- PKEY_Contact_EmailName
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: CC6F4F24-6083-4BD4-8754-674D0DE87AB8, 100
-DEFINE_PROPERTYKEY(PKEY_Contact_EmailName, 0xCC6F4F24, 0x6083, 0x4BD4, 0x87, 0x54, 0x67, 0x4D, 0x0D, 0xE8, 0x7A, 0xB8, 100);
-
-//  Name:     System.Contact.FileAsName -- PKEY_Contact_FileAsName
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: F1A24AA7-9CA7-40F6-89EC-97DEF9FFE8DB, 100
-DEFINE_PROPERTYKEY(PKEY_Contact_FileAsName, 0xF1A24AA7, 0x9CA7, 0x40F6, 0x89, 0xEC, 0x97, 0xDE, 0xF9, 0xFF, 0xE8, 0xDB, 100);
-
-//  Name:     System.Contact.FirstName -- PKEY_Contact_FirstName
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 14977844-6B49-4AAD-A714-A4513BF60460, 100
-DEFINE_PROPERTYKEY(PKEY_Contact_FirstName, 0x14977844, 0x6B49, 0x4AAD, 0xA7, 0x14, 0xA4, 0x51, 0x3B, 0xF6, 0x04, 0x60, 100);
-
-//  Name:     System.Contact.FullName -- PKEY_Contact_FullName
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 635E9051-50A5-4BA2-B9DB-4ED056C77296, 100
-DEFINE_PROPERTYKEY(PKEY_Contact_FullName, 0x635E9051, 0x50A5, 0x4BA2, 0xB9, 0xDB, 0x4E, 0xD0, 0x56, 0xC7, 0x72, 0x96, 100);
-
-//  Name:     System.Contact.Gender -- PKEY_Contact_Gender
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 3C8CEE58-D4F0-4CF9-B756-4E5D24447BCD, 100
-DEFINE_PROPERTYKEY(PKEY_Contact_Gender, 0x3C8CEE58, 0xD4F0, 0x4CF9, 0xB7, 0x56, 0x4E, 0x5D, 0x24, 0x44, 0x7B, 0xCD, 100);
-
-//  Name:     System.Contact.Hobbies -- PKEY_Contact_Hobbies
-//  Type:     Multivalue String -- VT_VECTOR | VT_LPWSTR  (For variants: VT_ARRAY | VT_BSTR)
-//  FormatID: 5DC2253F-5E11-4ADF-9CFE-910DD01E3E70, 100
-DEFINE_PROPERTYKEY(PKEY_Contact_Hobbies, 0x5DC2253F, 0x5E11, 0x4ADF, 0x9C, 0xFE, 0x91, 0x0D, 0xD0, 0x1E, 0x3E, 0x70, 100);
-
-//  Name:     System.Contact.HomeAddress -- PKEY_Contact_HomeAddress
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 98F98354-617A-46B8-8560-5B1B64BF1F89, 100
-DEFINE_PROPERTYKEY(PKEY_Contact_HomeAddress, 0x98F98354, 0x617A, 0x46B8, 0x85, 0x60, 0x5B, 0x1B, 0x64, 0xBF, 0x1F, 0x89, 100);
-
-//  Name:     System.Contact.HomeAddressCity -- PKEY_Contact_HomeAddressCity
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 176DC63C-2688-4E89-8143-A347800F25E9, 65
-DEFINE_PROPERTYKEY(PKEY_Contact_HomeAddressCity, 0x176DC63C, 0x2688, 0x4E89, 0x81, 0x43, 0xA3, 0x47, 0x80, 0x0F, 0x25, 0xE9, 65);
-
-//  Name:     System.Contact.HomeAddressCountry -- PKEY_Contact_HomeAddressCountry
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 08A65AA1-F4C9-43DD-9DDF-A33D8E7EAD85, 100
-DEFINE_PROPERTYKEY(PKEY_Contact_HomeAddressCountry, 0x08A65AA1, 0xF4C9, 0x43DD, 0x9D, 0xDF, 0xA3, 0x3D, 0x8E, 0x7E, 0xAD, 0x85, 100);
-
-//  Name:     System.Contact.HomeAddressPostalCode -- PKEY_Contact_HomeAddressPostalCode
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 8AFCC170-8A46-4B53-9EEE-90BAE7151E62, 100
-DEFINE_PROPERTYKEY(PKEY_Contact_HomeAddressPostalCode, 0x8AFCC170, 0x8A46, 0x4B53, 0x9E, 0xEE, 0x90, 0xBA, 0xE7, 0x15, 0x1E, 0x62, 100);
-
-//  Name:     System.Contact.HomeAddressPostOfficeBox -- PKEY_Contact_HomeAddressPostOfficeBox
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 7B9F6399-0A3F-4B12-89BD-4ADC51C918AF, 100
-DEFINE_PROPERTYKEY(PKEY_Contact_HomeAddressPostOfficeBox, 0x7B9F6399, 0x0A3F, 0x4B12, 0x89, 0xBD, 0x4A, 0xDC, 0x51, 0xC9, 0x18, 0xAF, 100);
-
-//  Name:     System.Contact.HomeAddressState -- PKEY_Contact_HomeAddressState
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: C89A23D0-7D6D-4EB8-87D4-776A82D493E5, 100
-DEFINE_PROPERTYKEY(PKEY_Contact_HomeAddressState, 0xC89A23D0, 0x7D6D, 0x4EB8, 0x87, 0xD4, 0x77, 0x6A, 0x82, 0xD4, 0x93, 0xE5, 100);
-
-//  Name:     System.Contact.HomeAddressStreet -- PKEY_Contact_HomeAddressStreet
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 0ADEF160-DB3F-4308-9A21-06237B16FA2A, 100
-DEFINE_PROPERTYKEY(PKEY_Contact_HomeAddressStreet, 0x0ADEF160, 0xDB3F, 0x4308, 0x9A, 0x21, 0x06, 0x23, 0x7B, 0x16, 0xFA, 0x2A, 100);
-
-//  Name:     System.Contact.HomeFaxNumber -- PKEY_Contact_HomeFaxNumber
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 660E04D6-81AB-4977-A09F-82313113AB26, 100
-DEFINE_PROPERTYKEY(PKEY_Contact_HomeFaxNumber, 0x660E04D6, 0x81AB, 0x4977, 0xA0, 0x9F, 0x82, 0x31, 0x31, 0x13, 0xAB, 0x26, 100);
-
-//  Name:     System.Contact.HomeTelephone -- PKEY_Contact_HomeTelephone
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 176DC63C-2688-4E89-8143-A347800F25E9, 20
-DEFINE_PROPERTYKEY(PKEY_Contact_HomeTelephone, 0x176DC63C, 0x2688, 0x4E89, 0x81, 0x43, 0xA3, 0x47, 0x80, 0x0F, 0x25, 0xE9, 20);
-
-//  Name:     System.Contact.IMAddress -- PKEY_Contact_IMAddress
-//  Type:     Multivalue String -- VT_VECTOR | VT_LPWSTR  (For variants: VT_ARRAY | VT_BSTR)
-//  FormatID: D68DBD8A-3374-4B81-9972-3EC30682DB3D, 100
-DEFINE_PROPERTYKEY(PKEY_Contact_IMAddress, 0xD68DBD8A, 0x3374, 0x4B81, 0x99, 0x72, 0x3E, 0xC3, 0x06, 0x82, 0xDB, 0x3D, 100);
-
-//  Name:     System.Contact.Initials -- PKEY_Contact_Initials
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: F3D8F40D-50CB-44A2-9718-40CB9119495D, 100
-DEFINE_PROPERTYKEY(PKEY_Contact_Initials, 0xF3D8F40D, 0x50CB, 0x44A2, 0x97, 0x18, 0x40, 0xCB, 0x91, 0x19, 0x49, 0x5D, 100);
-
-//  Name:     System.Contact.JA.CompanyNamePhonetic -- PKEY_Contact_JA_CompanyNamePhonetic
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 897B3694-FE9E-43E6-8066-260F590C0100, 2
-//  
-//  
-DEFINE_PROPERTYKEY(PKEY_Contact_JA_CompanyNamePhonetic, 0x897B3694, 0xFE9E, 0x43E6, 0x80, 0x66, 0x26, 0x0F, 0x59, 0x0C, 0x01, 0x00, 2);
-
-//  Name:     System.Contact.JA.FirstNamePhonetic -- PKEY_Contact_JA_FirstNamePhonetic
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 897B3694-FE9E-43E6-8066-260F590C0100, 3
-//  
-//  
-DEFINE_PROPERTYKEY(PKEY_Contact_JA_FirstNamePhonetic, 0x897B3694, 0xFE9E, 0x43E6, 0x80, 0x66, 0x26, 0x0F, 0x59, 0x0C, 0x01, 0x00, 3);
-
-//  Name:     System.Contact.JA.LastNamePhonetic -- PKEY_Contact_JA_LastNamePhonetic
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 897B3694-FE9E-43E6-8066-260F590C0100, 4
-//  
-//  
-DEFINE_PROPERTYKEY(PKEY_Contact_JA_LastNamePhonetic, 0x897B3694, 0xFE9E, 0x43E6, 0x80, 0x66, 0x26, 0x0F, 0x59, 0x0C, 0x01, 0x00, 4);
-
-//  Name:     System.Contact.JobTitle -- PKEY_Contact_JobTitle
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 176DC63C-2688-4E89-8143-A347800F25E9, 6
-DEFINE_PROPERTYKEY(PKEY_Contact_JobTitle, 0x176DC63C, 0x2688, 0x4E89, 0x81, 0x43, 0xA3, 0x47, 0x80, 0x0F, 0x25, 0xE9, 6);
-
-//  Name:     System.Contact.Label -- PKEY_Contact_Label
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 97B0AD89-DF49-49CC-834E-660974FD755B, 100
-DEFINE_PROPERTYKEY(PKEY_Contact_Label, 0x97B0AD89, 0xDF49, 0x49CC, 0x83, 0x4E, 0x66, 0x09, 0x74, 0xFD, 0x75, 0x5B, 100);
-
-//  Name:     System.Contact.LastName -- PKEY_Contact_LastName
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 8F367200-C270-457C-B1D4-E07C5BCD90C7, 100
-DEFINE_PROPERTYKEY(PKEY_Contact_LastName, 0x8F367200, 0xC270, 0x457C, 0xB1, 0xD4, 0xE0, 0x7C, 0x5B, 0xCD, 0x90, 0xC7, 100);
-
-//  Name:     System.Contact.MailingAddress -- PKEY_Contact_MailingAddress
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: C0AC206A-827E-4650-95AE-77E2BB74FCC9, 100
-DEFINE_PROPERTYKEY(PKEY_Contact_MailingAddress, 0xC0AC206A, 0x827E, 0x4650, 0x95, 0xAE, 0x77, 0xE2, 0xBB, 0x74, 0xFC, 0xC9, 100);
-
-//  Name:     System.Contact.MiddleName -- PKEY_Contact_MiddleName
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 176DC63C-2688-4E89-8143-A347800F25E9, 71
-DEFINE_PROPERTYKEY(PKEY_Contact_MiddleName, 0x176DC63C, 0x2688, 0x4E89, 0x81, 0x43, 0xA3, 0x47, 0x80, 0x0F, 0x25, 0xE9, 71);
-
-//  Name:     System.Contact.MobileTelephone -- PKEY_Contact_MobileTelephone
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 176DC63C-2688-4E89-8143-A347800F25E9, 35
-DEFINE_PROPERTYKEY(PKEY_Contact_MobileTelephone, 0x176DC63C, 0x2688, 0x4E89, 0x81, 0x43, 0xA3, 0x47, 0x80, 0x0F, 0x25, 0xE9, 35);
-
-//  Name:     System.Contact.NickName -- PKEY_Contact_NickName
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 176DC63C-2688-4E89-8143-A347800F25E9, 74
-DEFINE_PROPERTYKEY(PKEY_Contact_NickName, 0x176DC63C, 0x2688, 0x4E89, 0x81, 0x43, 0xA3, 0x47, 0x80, 0x0F, 0x25, 0xE9, 74);
-
-//  Name:     System.Contact.OfficeLocation -- PKEY_Contact_OfficeLocation
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 176DC63C-2688-4E89-8143-A347800F25E9, 7
-DEFINE_PROPERTYKEY(PKEY_Contact_OfficeLocation, 0x176DC63C, 0x2688, 0x4E89, 0x81, 0x43, 0xA3, 0x47, 0x80, 0x0F, 0x25, 0xE9, 7);
-
-//  Name:     System.Contact.OtherAddress -- PKEY_Contact_OtherAddress
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 508161FA-313B-43D5-83A1-C1ACCF68622C, 100
-DEFINE_PROPERTYKEY(PKEY_Contact_OtherAddress, 0x508161FA, 0x313B, 0x43D5, 0x83, 0xA1, 0xC1, 0xAC, 0xCF, 0x68, 0x62, 0x2C, 100);
-
-//  Name:     System.Contact.OtherAddressCity -- PKEY_Contact_OtherAddressCity
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 6E682923-7F7B-4F0C-A337-CFCA296687BF, 100
-DEFINE_PROPERTYKEY(PKEY_Contact_OtherAddressCity, 0x6E682923, 0x7F7B, 0x4F0C, 0xA3, 0x37, 0xCF, 0xCA, 0x29, 0x66, 0x87, 0xBF, 100);
-
-//  Name:     System.Contact.OtherAddressCountry -- PKEY_Contact_OtherAddressCountry
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 8F167568-0AAE-4322-8ED9-6055B7B0E398, 100
-DEFINE_PROPERTYKEY(PKEY_Contact_OtherAddressCountry, 0x8F167568, 0x0AAE, 0x4322, 0x8E, 0xD9, 0x60, 0x55, 0xB7, 0xB0, 0xE3, 0x98, 100);
-
-//  Name:     System.Contact.OtherAddressPostalCode -- PKEY_Contact_OtherAddressPostalCode
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 95C656C1-2ABF-4148-9ED3-9EC602E3B7CD, 100
-DEFINE_PROPERTYKEY(PKEY_Contact_OtherAddressPostalCode, 0x95C656C1, 0x2ABF, 0x4148, 0x9E, 0xD3, 0x9E, 0xC6, 0x02, 0xE3, 0xB7, 0xCD, 100);
-
-//  Name:     System.Contact.OtherAddressPostOfficeBox -- PKEY_Contact_OtherAddressPostOfficeBox
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 8B26EA41-058F-43F6-AECC-4035681CE977, 100
-DEFINE_PROPERTYKEY(PKEY_Contact_OtherAddressPostOfficeBox, 0x8B26EA41, 0x058F, 0x43F6, 0xAE, 0xCC, 0x40, 0x35, 0x68, 0x1C, 0xE9, 0x77, 100);
-
-//  Name:     System.Contact.OtherAddressState -- PKEY_Contact_OtherAddressState
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 71B377D6-E570-425F-A170-809FAE73E54E, 100
-DEFINE_PROPERTYKEY(PKEY_Contact_OtherAddressState, 0x71B377D6, 0xE570, 0x425F, 0xA1, 0x70, 0x80, 0x9F, 0xAE, 0x73, 0xE5, 0x4E, 100);
-
-//  Name:     System.Contact.OtherAddressStreet -- PKEY_Contact_OtherAddressStreet
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: FF962609-B7D6-4999-862D-95180D529AEA, 100
-DEFINE_PROPERTYKEY(PKEY_Contact_OtherAddressStreet, 0xFF962609, 0xB7D6, 0x4999, 0x86, 0x2D, 0x95, 0x18, 0x0D, 0x52, 0x9A, 0xEA, 100);
-
-//  Name:     System.Contact.PagerTelephone -- PKEY_Contact_PagerTelephone
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: D6304E01-F8F5-4F45-8B15-D024A6296789, 100
-DEFINE_PROPERTYKEY(PKEY_Contact_PagerTelephone, 0xD6304E01, 0xF8F5, 0x4F45, 0x8B, 0x15, 0xD0, 0x24, 0xA6, 0x29, 0x67, 0x89, 100);
-
-//  Name:     System.Contact.PersonalTitle -- PKEY_Contact_PersonalTitle
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 176DC63C-2688-4E89-8143-A347800F25E9, 69
-DEFINE_PROPERTYKEY(PKEY_Contact_PersonalTitle, 0x176DC63C, 0x2688, 0x4E89, 0x81, 0x43, 0xA3, 0x47, 0x80, 0x0F, 0x25, 0xE9, 69);
-
-//  Name:     System.Contact.PrimaryAddressCity -- PKEY_Contact_PrimaryAddressCity
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: C8EA94F0-A9E3-4969-A94B-9C62A95324E0, 100
-DEFINE_PROPERTYKEY(PKEY_Contact_PrimaryAddressCity, 0xC8EA94F0, 0xA9E3, 0x4969, 0xA9, 0x4B, 0x9C, 0x62, 0xA9, 0x53, 0x24, 0xE0, 100);
-
-//  Name:     System.Contact.PrimaryAddressCountry -- PKEY_Contact_PrimaryAddressCountry
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: E53D799D-0F3F-466E-B2FF-74634A3CB7A4, 100
-DEFINE_PROPERTYKEY(PKEY_Contact_PrimaryAddressCountry, 0xE53D799D, 0x0F3F, 0x466E, 0xB2, 0xFF, 0x74, 0x63, 0x4A, 0x3C, 0xB7, 0xA4, 100);
-
-//  Name:     System.Contact.PrimaryAddressPostalCode -- PKEY_Contact_PrimaryAddressPostalCode
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 18BBD425-ECFD-46EF-B612-7B4A6034EDA0, 100
-DEFINE_PROPERTYKEY(PKEY_Contact_PrimaryAddressPostalCode, 0x18BBD425, 0xECFD, 0x46EF, 0xB6, 0x12, 0x7B, 0x4A, 0x60, 0x34, 0xED, 0xA0, 100);
-
-//  Name:     System.Contact.PrimaryAddressPostOfficeBox -- PKEY_Contact_PrimaryAddressPostOfficeBox
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: DE5EF3C7-46E1-484E-9999-62C5308394C1, 100
-DEFINE_PROPERTYKEY(PKEY_Contact_PrimaryAddressPostOfficeBox, 0xDE5EF3C7, 0x46E1, 0x484E, 0x99, 0x99, 0x62, 0xC5, 0x30, 0x83, 0x94, 0xC1, 100);
-
-//  Name:     System.Contact.PrimaryAddressState -- PKEY_Contact_PrimaryAddressState
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: F1176DFE-7138-4640-8B4C-AE375DC70A6D, 100
-DEFINE_PROPERTYKEY(PKEY_Contact_PrimaryAddressState, 0xF1176DFE, 0x7138, 0x4640, 0x8B, 0x4C, 0xAE, 0x37, 0x5D, 0xC7, 0x0A, 0x6D, 100);
-
-//  Name:     System.Contact.PrimaryAddressStreet -- PKEY_Contact_PrimaryAddressStreet
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 63C25B20-96BE-488F-8788-C09C407AD812, 100
-DEFINE_PROPERTYKEY(PKEY_Contact_PrimaryAddressStreet, 0x63C25B20, 0x96BE, 0x488F, 0x87, 0x88, 0xC0, 0x9C, 0x40, 0x7A, 0xD8, 0x12, 100);
-
-//  Name:     System.Contact.PrimaryEmailAddress -- PKEY_Contact_PrimaryEmailAddress
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 176DC63C-2688-4E89-8143-A347800F25E9, 48
-DEFINE_PROPERTYKEY(PKEY_Contact_PrimaryEmailAddress, 0x176DC63C, 0x2688, 0x4E89, 0x81, 0x43, 0xA3, 0x47, 0x80, 0x0F, 0x25, 0xE9, 48);
-
-//  Name:     System.Contact.PrimaryTelephone -- PKEY_Contact_PrimaryTelephone
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 176DC63C-2688-4E89-8143-A347800F25E9, 25
-DEFINE_PROPERTYKEY(PKEY_Contact_PrimaryTelephone, 0x176DC63C, 0x2688, 0x4E89, 0x81, 0x43, 0xA3, 0x47, 0x80, 0x0F, 0x25, 0xE9, 25);
-
-//  Name:     System.Contact.Profession -- PKEY_Contact_Profession
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 7268AF55-1CE4-4F6E-A41F-B6E4EF10E4A9, 100
-DEFINE_PROPERTYKEY(PKEY_Contact_Profession, 0x7268AF55, 0x1CE4, 0x4F6E, 0xA4, 0x1F, 0xB6, 0xE4, 0xEF, 0x10, 0xE4, 0xA9, 100);
-
-//  Name:     System.Contact.SpouseName -- PKEY_Contact_SpouseName
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 9D2408B6-3167-422B-82B0-F583B7A7CFE3, 100
-DEFINE_PROPERTYKEY(PKEY_Contact_SpouseName, 0x9D2408B6, 0x3167, 0x422B, 0x82, 0xB0, 0xF5, 0x83, 0xB7, 0xA7, 0xCF, 0xE3, 100);
-
-//  Name:     System.Contact.Suffix -- PKEY_Contact_Suffix
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 176DC63C-2688-4E89-8143-A347800F25E9, 73
-DEFINE_PROPERTYKEY(PKEY_Contact_Suffix, 0x176DC63C, 0x2688, 0x4E89, 0x81, 0x43, 0xA3, 0x47, 0x80, 0x0F, 0x25, 0xE9, 73);
-
-//  Name:     System.Contact.TelexNumber -- PKEY_Contact_TelexNumber
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: C554493C-C1F7-40C1-A76C-EF8C0614003E, 100
-DEFINE_PROPERTYKEY(PKEY_Contact_TelexNumber, 0xC554493C, 0xC1F7, 0x40C1, 0xA7, 0x6C, 0xEF, 0x8C, 0x06, 0x14, 0x00, 0x3E, 100);
-
-//  Name:     System.Contact.TTYTDDTelephone -- PKEY_Contact_TTYTDDTelephone
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: AAF16BAC-2B55-45E6-9F6D-415EB94910DF, 100
-DEFINE_PROPERTYKEY(PKEY_Contact_TTYTDDTelephone, 0xAAF16BAC, 0x2B55, 0x45E6, 0x9F, 0x6D, 0x41, 0x5E, 0xB9, 0x49, 0x10, 0xDF, 100);
-
-//  Name:     System.Contact.WebPage -- PKEY_Contact_WebPage
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD, 18
-DEFINE_PROPERTYKEY(PKEY_Contact_WebPage, 0xE3E0584C, 0xB788, 0x4A5A, 0xBB, 0x20, 0x7F, 0x5A, 0x44, 0xC9, 0xAC, 0xDD, 18);
- 
-//-----------------------------------------------------------------------------
-// Core properties
-
-
-
-//  Name:     System.AcquisitionID -- PKEY_AcquisitionID
-//  Type:     Int32 -- VT_I4
-//  FormatID: 65A98875-3C80-40AB-ABBC-EFDAF77DBEE2, 100
-//
-//  Hash to determine acquisition session.
-DEFINE_PROPERTYKEY(PKEY_AcquisitionID, 0x65A98875, 0x3C80, 0x40AB, 0xAB, 0xBC, 0xEF, 0xDA, 0xF7, 0x7D, 0xBE, 0xE2, 100);
-
-//  Name:     System.ApplicationName -- PKEY_ApplicationName
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)  Legacy code may treat this as VT_LPSTR.
-//  FormatID: (FMTID_SummaryInformation) F29F85E0-4FF9-1068-AB91-08002B27B3D9, 18 (PIDSI_APPNAME)
-//
-//  
-DEFINE_PROPERTYKEY(PKEY_ApplicationName, 0xF29F85E0, 0x4FF9, 0x1068, 0xAB, 0x91, 0x08, 0x00, 0x2B, 0x27, 0xB3, 0xD9, 18);
-
-//  Name:     System.Author -- PKEY_Author
-//  Type:     Multivalue String -- VT_VECTOR | VT_LPWSTR  (For variants: VT_ARRAY | VT_BSTR)  Legacy code may treat this as VT_LPSTR.
-//  FormatID: (FMTID_SummaryInformation) F29F85E0-4FF9-1068-AB91-08002B27B3D9, 4 (PIDSI_AUTHOR)
-//
-//  
-DEFINE_PROPERTYKEY(PKEY_Author, 0xF29F85E0, 0x4FF9, 0x1068, 0xAB, 0x91, 0x08, 0x00, 0x2B, 0x27, 0xB3, 0xD9, 4);
-
-//  Name:     System.Capacity -- PKEY_Capacity
-//  Type:     UInt64 -- VT_UI8
-//  FormatID: (FMTID_Volume) 9B174B35-40FF-11D2-A27E-00C04FC30871, 3 (PID_VOLUME_CAPACITY)  (Filesystem Volume Properties)
-//
-//  The amount of total space in bytes.
-DEFINE_PROPERTYKEY(PKEY_Capacity, 0x9B174B35, 0x40FF, 0x11D2, 0xA2, 0x7E, 0x00, 0xC0, 0x4F, 0xC3, 0x08, 0x71, 3);
-
-//  Name:     System.Category -- PKEY_Category
-//  Type:     Multivalue String -- VT_VECTOR | VT_LPWSTR  (For variants: VT_ARRAY | VT_BSTR)
-//  FormatID: (FMTID_DocumentSummaryInformation) D5CDD502-2E9C-101B-9397-08002B2CF9AE, 2 (PIDDSI_CATEGORY)
-//
-//  Legacy code treats this as VT_LPSTR.
-DEFINE_PROPERTYKEY(PKEY_Category, 0xD5CDD502, 0x2E9C, 0x101B, 0x93, 0x97, 0x08, 0x00, 0x2B, 0x2C, 0xF9, 0xAE, 2);
-
-//  Name:     System.Comment -- PKEY_Comment
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)  Legacy code may treat this as VT_LPSTR.
-//  FormatID: (FMTID_SummaryInformation) F29F85E0-4FF9-1068-AB91-08002B27B3D9, 6 (PIDSI_COMMENTS)
-//
-//  Comments.
-DEFINE_PROPERTYKEY(PKEY_Comment, 0xF29F85E0, 0x4FF9, 0x1068, 0xAB, 0x91, 0x08, 0x00, 0x2B, 0x27, 0xB3, 0xD9, 6);
-
-//  Name:     System.Company -- PKEY_Company
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: (FMTID_DocumentSummaryInformation) D5CDD502-2E9C-101B-9397-08002B2CF9AE, 15 (PIDDSI_COMPANY)
-//
-//  The company or publisher.
-DEFINE_PROPERTYKEY(PKEY_Company, 0xD5CDD502, 0x2E9C, 0x101B, 0x93, 0x97, 0x08, 0x00, 0x2B, 0x2C, 0xF9, 0xAE, 15);
-
-//  Name:     System.ComputerName -- PKEY_ComputerName
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: (FMTID_ShellDetails) 28636AA6-953D-11D2-B5D6-00C04FD918D0, 5 (PID_COMPUTERNAME)
-//
-//  
-DEFINE_PROPERTYKEY(PKEY_ComputerName, 0x28636AA6, 0x953D, 0x11D2, 0xB5, 0xD6, 0x00, 0xC0, 0x4F, 0xD9, 0x18, 0xD0, 5);
-
-//  Name:     System.ContainedItems -- PKEY_ContainedItems
-//  Type:     Multivalue Guid -- VT_VECTOR | VT_CLSID  (For variants: VT_ARRAY | VT_CLSID)
-//  FormatID: (FMTID_ShellDetails) 28636AA6-953D-11D2-B5D6-00C04FD918D0, 29
-//  
-//  The list of type of items, this item contains. For example, this item contains urls, attachments etc.
-//  This is represented as a vector array of GUIDs where each GUID represents certain type.
-DEFINE_PROPERTYKEY(PKEY_ContainedItems, 0x28636AA6, 0x953D, 0x11D2, 0xB5, 0xD6, 0x00, 0xC0, 0x4F, 0xD9, 0x18, 0xD0, 29);
-
-//  Name:     System.ContentStatus -- PKEY_ContentStatus
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: (FMTID_DocumentSummaryInformation) D5CDD502-2E9C-101B-9397-08002B2CF9AE, 27
-DEFINE_PROPERTYKEY(PKEY_ContentStatus, 0xD5CDD502, 0x2E9C, 0x101B, 0x93, 0x97, 0x08, 0x00, 0x2B, 0x2C, 0xF9, 0xAE, 27);
-
-//  Name:     System.ContentType -- PKEY_ContentType
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: (FMTID_DocumentSummaryInformation) D5CDD502-2E9C-101B-9397-08002B2CF9AE, 26
-DEFINE_PROPERTYKEY(PKEY_ContentType, 0xD5CDD502, 0x2E9C, 0x101B, 0x93, 0x97, 0x08, 0x00, 0x2B, 0x2C, 0xF9, 0xAE, 26);
-
-//  Name:     System.Copyright -- PKEY_Copyright
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) 64440492-4C8B-11D1-8B70-080036B11A03, 11 (PIDMSI_COPYRIGHT)
-//
-//  
-DEFINE_PROPERTYKEY(PKEY_Copyright, 0x64440492, 0x4C8B, 0x11D1, 0x8B, 0x70, 0x08, 0x00, 0x36, 0xB1, 0x1A, 0x03, 11);
-
-//  Name:     System.DateAccessed -- PKEY_DateAccessed
-//  Type:     DateTime -- VT_FILETIME  (For variants: VT_DATE)
-//  FormatID: (FMTID_Storage) B725F130-47EF-101A-A5F1-02608C9EEBAC, 16 (PID_STG_ACCESSTIME)
-//
-//  The time of the last access to the item.  The Indexing Service friendly name is 'access'.
-DEFINE_PROPERTYKEY(PKEY_DateAccessed, 0xB725F130, 0x47EF, 0x101A, 0xA5, 0xF1, 0x02, 0x60, 0x8C, 0x9E, 0xEB, 0xAC, 16);
-
-//  Name:     System.DateAcquired -- PKEY_DateAcquired
-//  Type:     DateTime -- VT_FILETIME  (For variants: VT_DATE)
-//  FormatID: 2CBAA8F5-D81F-47CA-B17A-F8D822300131, 100
-//  
-//  The time the file entered the system via acquisition.  This is not the same as System.DateImported.
-//  Examples are when pictures are acquired from a camera, or when music is purchased online.
-DEFINE_PROPERTYKEY(PKEY_DateAcquired, 0x2CBAA8F5, 0xD81F, 0x47CA, 0xB1, 0x7A, 0xF8, 0xD8, 0x22, 0x30, 0x01, 0x31, 100);
-
-//  Name:     System.DateArchived -- PKEY_DateArchived
-//  Type:     DateTime -- VT_FILETIME  (For variants: VT_DATE)
-//  FormatID: 43F8D7B7-A444-4F87-9383-52271C9B915C, 100
-DEFINE_PROPERTYKEY(PKEY_DateArchived, 0x43F8D7B7, 0xA444, 0x4F87, 0x93, 0x83, 0x52, 0x27, 0x1C, 0x9B, 0x91, 0x5C, 100);
-
-//  Name:     System.DateCompleted -- PKEY_DateCompleted
-//  Type:     DateTime -- VT_FILETIME  (For variants: VT_DATE)
-//  FormatID: 72FAB781-ACDA-43E5-B155-B2434F85E678, 100
-DEFINE_PROPERTYKEY(PKEY_DateCompleted, 0x72FAB781, 0xACDA, 0x43E5, 0xB1, 0x55, 0xB2, 0x43, 0x4F, 0x85, 0xE6, 0x78, 100);
-
-//  Name:     System.DateCreated -- PKEY_DateCreated
-//  Type:     DateTime -- VT_FILETIME  (For variants: VT_DATE)
-//  FormatID: (FMTID_Storage) B725F130-47EF-101A-A5F1-02608C9EEBAC, 15 (PID_STG_CREATETIME)
-//
-//  The date and time the item was created. The Indexing Service friendly name is 'create'.
-DEFINE_PROPERTYKEY(PKEY_DateCreated, 0xB725F130, 0x47EF, 0x101A, 0xA5, 0xF1, 0x02, 0x60, 0x8C, 0x9E, 0xEB, 0xAC, 15);
-
-//  Name:     System.DateImported -- PKEY_DateImported
-//  Type:     DateTime -- VT_FILETIME  (For variants: VT_DATE)
-//  FormatID: (FMTID_ImageProperties) 14B81DA1-0135-4D31-96D9-6CBFC9671A99, 18258
-//
-//  The time the file is imported into a separate database.  This is not the same as System.DateAcquired.  (Eg, 2003:05:22 13:55:04)
-DEFINE_PROPERTYKEY(PKEY_DateImported, 0x14B81DA1, 0x0135, 0x4D31, 0x96, 0xD9, 0x6C, 0xBF, 0xC9, 0x67, 0x1A, 0x99, 18258);
-
-//  Name:     System.DateModified -- PKEY_DateModified
-//  Type:     DateTime -- VT_FILETIME  (For variants: VT_DATE)
-//  FormatID: (FMTID_Storage) B725F130-47EF-101A-A5F1-02608C9EEBAC, 14 (PID_STG_WRITETIME)
-//
-//  The date and time of the last write to the item. The Indexing Service friendly name is 'write'.
-DEFINE_PROPERTYKEY(PKEY_DateModified, 0xB725F130, 0x47EF, 0x101A, 0xA5, 0xF1, 0x02, 0x60, 0x8C, 0x9E, 0xEB, 0xAC, 14);
-
-//  Name:     System.DueDate -- PKEY_DueDate
-//  Type:     DateTime -- VT_FILETIME  (For variants: VT_DATE)
-//  FormatID: 3F8472B5-E0AF-4DB2-8071-C53FE76AE7CE, 100
-DEFINE_PROPERTYKEY(PKEY_DueDate, 0x3F8472B5, 0xE0AF, 0x4DB2, 0x80, 0x71, 0xC5, 0x3F, 0xE7, 0x6A, 0xE7, 0xCE, 100);
-
-//  Name:     System.EndDate -- PKEY_EndDate
-//  Type:     DateTime -- VT_FILETIME  (For variants: VT_DATE)
-//  FormatID: C75FAA05-96FD-49E7-9CB4-9F601082D553, 100
-DEFINE_PROPERTYKEY(PKEY_EndDate, 0xC75FAA05, 0x96FD, 0x49E7, 0x9C, 0xB4, 0x9F, 0x60, 0x10, 0x82, 0xD5, 0x53, 100);
-
-//  Name:     System.FileAllocationSize -- PKEY_FileAllocationSize
-//  Type:     UInt64 -- VT_UI8
-//  FormatID: (FMTID_Storage) B725F130-47EF-101A-A5F1-02608C9EEBAC, 18 (PID_STG_ALLOCSIZE)
-//
-//  
-DEFINE_PROPERTYKEY(PKEY_FileAllocationSize, 0xB725F130, 0x47EF, 0x101A, 0xA5, 0xF1, 0x02, 0x60, 0x8C, 0x9E, 0xEB, 0xAC, 18);
-
-//  Name:     System.FileAttributes -- PKEY_FileAttributes
-//  Type:     UInt32 -- VT_UI4
-//  FormatID: (FMTID_Storage) B725F130-47EF-101A-A5F1-02608C9EEBAC, 13 (PID_STG_ATTRIBUTES)
-//  
-//  This is the WIN32_FIND_DATA dwFileAttributes for the file-based item.
-DEFINE_PROPERTYKEY(PKEY_FileAttributes, 0xB725F130, 0x47EF, 0x101A, 0xA5, 0xF1, 0x02, 0x60, 0x8C, 0x9E, 0xEB, 0xAC, 13);
-
-//  Name:     System.FileCount -- PKEY_FileCount
-//  Type:     UInt64 -- VT_UI8
-//  FormatID: (FMTID_ShellDetails) 28636AA6-953D-11D2-B5D6-00C04FD918D0, 12
-//
-//  
-DEFINE_PROPERTYKEY(PKEY_FileCount, 0x28636AA6, 0x953D, 0x11D2, 0xB5, 0xD6, 0x00, 0xC0, 0x4F, 0xD9, 0x18, 0xD0, 12);
-
-//  Name:     System.FileDescription -- PKEY_FileDescription
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: (PSFMTID_VERSION) 0CEF7D53-FA64-11D1-A203-0000F81FEDEE, 3 (PIDVSI_FileDescription)
-//  
-//  This is a user-friendly description of the file.
-DEFINE_PROPERTYKEY(PKEY_FileDescription, 0x0CEF7D53, 0xFA64, 0x11D1, 0xA2, 0x03, 0x00, 0x00, 0xF8, 0x1F, 0xED, 0xEE, 3);
-
-//  Name:     System.FileExtension -- PKEY_FileExtension
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: E4F10A3C-49E6-405D-8288-A23BD4EEAA6C, 100
-//  
-//  This is the file extension of the file based item, including the leading period.  
-//  
-//  If System.FileName is VT_EMPTY, then this property should be too.  Otherwise, it should be derived
-//  appropriately by the data source from System.FileName.  If System.FileName does not have a file 
-//  extension, this value should be VT_EMPTY.
-//  
-//  To obtain the type of any item (including an item that is not a file), use System.ItemType.
-//  
-//  Example values:
-//  
-//      If the path is...                     The property value is...
-//      -----------------                     ------------------------
-//      "c:\foo\bar\hello.txt"                ".txt"
-//      "\\server\share\mydir\goodnews.doc"   ".doc"
-//      "\\server\share\numbers.xls"          ".xls"
-//      "\\server\share\folder"               VT_EMPTY
-//      "c:\foo\MyFolder"                     VT_EMPTY
-//      [desktop]                             VT_EMPTY
-DEFINE_PROPERTYKEY(PKEY_FileExtension, 0xE4F10A3C, 0x49E6, 0x405D, 0x82, 0x88, 0xA2, 0x3B, 0xD4, 0xEE, 0xAA, 0x6C, 100);
-
-//  Name:     System.FileFRN -- PKEY_FileFRN
-//  Type:     UInt64 -- VT_UI8
-//  FormatID: (FMTID_Storage) B725F130-47EF-101A-A5F1-02608C9EEBAC, 21 (PID_STG_FRN)
-//  
-//  This is the unique file ID, also known as the File Reference Number. For a given file, this is the same value
-//  as is found in the structure variable FILE_ID_BOTH_DIR_INFO.FileId, via GetFileInformationByHandleEx().
-DEFINE_PROPERTYKEY(PKEY_FileFRN, 0xB725F130, 0x47EF, 0x101A, 0xA5, 0xF1, 0x02, 0x60, 0x8C, 0x9E, 0xEB, 0xAC, 21);
-
-//  Name:     System.FileName -- PKEY_FileName
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 41CF5AE0-F75A-4806-BD87-59C7D9248EB9, 100
-//  
-//  This is the file name (including extension) of the file.
-//  
-//  It is possible that the item might not exist on a filesystem (ie, it may not be opened 
-//  using CreateFile).  Nonetheless, if the item is represented as a file from the logical sense 
-//  (and its name follows standard Win32 file-naming syntax), then the data source should emit this property.
-//  
-//  If an item is not a file, then the value for this property is VT_EMPTY.  See 
-//  System.ItemNameDisplay.
-//  
-//  This has the same value as System.ParsingName for items that are provided by the Shell's file folder.
-//  
-//  Example values:
-//  
-//      If the path is...                     The property value is...
-//      -----------------                     ------------------------
-//      "c:\foo\bar\hello.txt"                "hello.txt"
-//      "\\server\share\mydir\goodnews.doc"   "goodnews.doc"
-//      "\\server\share\numbers.xls"          "numbers.xls"
-//      "c:\foo\MyFolder"                     "MyFolder"
-//      (email message)                       VT_EMPTY
-//      (song on portable device)             "song.wma"
-DEFINE_PROPERTYKEY(PKEY_FileName, 0x41CF5AE0, 0xF75A, 0x4806, 0xBD, 0x87, 0x59, 0xC7, 0xD9, 0x24, 0x8E, 0xB9, 100);
-
-//  Name:     System.FileOwner -- PKEY_FileOwner
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: (FMTID_Misc) 9B174B34-40FF-11D2-A27E-00C04FC30871, 4 (PID_MISC_OWNER)
-//  
-//  This is the owner of the file, according to the file system.
-DEFINE_PROPERTYKEY(PKEY_FileOwner, 0x9B174B34, 0x40FF, 0x11D2, 0xA2, 0x7E, 0x00, 0xC0, 0x4F, 0xC3, 0x08, 0x71, 4);
-
-//  Name:     System.FileVersion -- PKEY_FileVersion
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: (PSFMTID_VERSION) 0CEF7D53-FA64-11D1-A203-0000F81FEDEE, 4 (PIDVSI_FileVersion)
-//
-//  
-DEFINE_PROPERTYKEY(PKEY_FileVersion, 0x0CEF7D53, 0xFA64, 0x11D1, 0xA2, 0x03, 0x00, 0x00, 0xF8, 0x1F, 0xED, 0xEE, 4);
-
-//  Name:     System.FindData -- PKEY_FindData
-//  Type:     Buffer -- VT_VECTOR | VT_UI1  (For variants: VT_ARRAY | VT_UI1)
-//  FormatID: (FMTID_ShellDetails) 28636AA6-953D-11D2-B5D6-00C04FD918D0, 0 (PID_FINDDATA)
-//
-//  WIN32_FIND_DATAW in buffer of bytes.
-DEFINE_PROPERTYKEY(PKEY_FindData, 0x28636AA6, 0x953D, 0x11D2, 0xB5, 0xD6, 0x00, 0xC0, 0x4F, 0xD9, 0x18, 0xD0, 0);
-
-//  Name:     System.FlagColor -- PKEY_FlagColor
-//  Type:     UInt16 -- VT_UI2
-//  FormatID: 67DF94DE-0CA7-4D6F-B792-053A3E4F03CF, 100
-//
-//  
-DEFINE_PROPERTYKEY(PKEY_FlagColor, 0x67DF94DE, 0x0CA7, 0x4D6F, 0xB7, 0x92, 0x05, 0x3A, 0x3E, 0x4F, 0x03, 0xCF, 100);
-
-// Possible discrete values for PKEY_FlagColor are:
-#define FLAGCOLOR_PURPLE                    1u
-#define FLAGCOLOR_ORANGE                    2u
-#define FLAGCOLOR_GREEN                     3u
-#define FLAGCOLOR_YELLOW                    4u
-#define FLAGCOLOR_BLUE                      5u
-#define FLAGCOLOR_RED                       6u
-
-//  Name:     System.FlagColorText -- PKEY_FlagColorText
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 45EAE747-8E2A-40AE-8CBF-CA52ABA6152A, 100
-//  
-//  This is the user-friendly form of System.FlagColor.  Not intended to be parsed 
-//  programmatically.
-DEFINE_PROPERTYKEY(PKEY_FlagColorText, 0x45EAE747, 0x8E2A, 0x40AE, 0x8C, 0xBF, 0xCA, 0x52, 0xAB, 0xA6, 0x15, 0x2A, 100);
-
-//  Name:     System.FlagStatus -- PKEY_FlagStatus
-//  Type:     Int32 -- VT_I4
-//  FormatID: E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD, 12
-//
-//  Status of Flag.  Values: (0=none 1=white 2=Red).  cdoPR_FLAG_STATUS
-DEFINE_PROPERTYKEY(PKEY_FlagStatus, 0xE3E0584C, 0xB788, 0x4A5A, 0xBB, 0x20, 0x7F, 0x5A, 0x44, 0xC9, 0xAC, 0xDD, 12);
-
-// Possible discrete values for PKEY_FlagStatus are:
-#define FLAGSTATUS_NOTFLAGGED               0l
-#define FLAGSTATUS_COMPLETED                1l
-#define FLAGSTATUS_FOLLOWUP                 2l
-
-//  Name:     System.FlagStatusText -- PKEY_FlagStatusText
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: DC54FD2E-189D-4871-AA01-08C2F57A4ABC, 100
-//  
-//  This is the user-friendly form of System.FlagStatus.  Not intended to be parsed 
-//  programmatically.
-DEFINE_PROPERTYKEY(PKEY_FlagStatusText, 0xDC54FD2E, 0x189D, 0x4871, 0xAA, 0x01, 0x08, 0xC2, 0xF5, 0x7A, 0x4A, 0xBC, 100);
-
-//  Name:     System.FreeSpace -- PKEY_FreeSpace
-//  Type:     UInt64 -- VT_UI8
-//  FormatID: (FMTID_Volume) 9B174B35-40FF-11D2-A27E-00C04FC30871, 2 (PID_VOLUME_FREE)  (Filesystem Volume Properties)
-//
-//  The amount of free space in bytes.
-DEFINE_PROPERTYKEY(PKEY_FreeSpace, 0x9B174B35, 0x40FF, 0x11D2, 0xA2, 0x7E, 0x00, 0xC0, 0x4F, 0xC3, 0x08, 0x71, 2);
-
-//  Name:     System.Identity -- PKEY_Identity
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: A26F4AFC-7346-4299-BE47-EB1AE613139F, 100
-DEFINE_PROPERTYKEY(PKEY_Identity, 0xA26F4AFC, 0x7346, 0x4299, 0xBE, 0x47, 0xEB, 0x1A, 0xE6, 0x13, 0x13, 0x9F, 100);
-
-//  Name:     System.Importance -- PKEY_Importance
-//  Type:     Int32 -- VT_I4
-//  FormatID: E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD, 11
-DEFINE_PROPERTYKEY(PKEY_Importance, 0xE3E0584C, 0xB788, 0x4A5A, 0xBB, 0x20, 0x7F, 0x5A, 0x44, 0xC9, 0xAC, 0xDD, 11);
-
-// Possible range of values for PKEY_Importance are:
-#define IMPORTANCE_LOW_MIN                  0l
-#define IMPORTANCE_LOW_SET                  1l
-#define IMPORTANCE_LOW_MAX                  1l
-
-#define IMPORTANCE_NORMAL_MIN               2l
-#define IMPORTANCE_NORMAL_SET               3l
-#define IMPORTANCE_NORMAL_MAX               4l
-
-#define IMPORTANCE_HIGH_MIN                 5l
-#define IMPORTANCE_HIGH_SET                 5l
-#define IMPORTANCE_HIGH_MAX                 5l
-
-
-//  Name:     System.ImportanceText -- PKEY_ImportanceText
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: A3B29791-7713-4E1D-BB40-17DB85F01831, 100
-//  
-//  This is the user-friendly form of System.Importance.  Not intended to be parsed 
-//  programmatically.
-DEFINE_PROPERTYKEY(PKEY_ImportanceText, 0xA3B29791, 0x7713, 0x4E1D, 0xBB, 0x40, 0x17, 0xDB, 0x85, 0xF0, 0x18, 0x31, 100);
-
-//  Name:     System.IsAttachment -- PKEY_IsAttachment
-//  Type:     Boolean -- VT_BOOL
-//  FormatID: F23F425C-71A1-4FA8-922F-678EA4A60408, 100
-//
-//  Identifies if this item is an attachment.
-DEFINE_PROPERTYKEY(PKEY_IsAttachment, 0xF23F425C, 0x71A1, 0x4FA8, 0x92, 0x2F, 0x67, 0x8E, 0xA4, 0xA6, 0x04, 0x08, 100);
-
-//  Name:     System.IsDeleted -- PKEY_IsDeleted
-//  Type:     Boolean -- VT_BOOL
-//  FormatID: 5CDA5FC8-33EE-4FF3-9094-AE7BD8868C4D, 100
-DEFINE_PROPERTYKEY(PKEY_IsDeleted, 0x5CDA5FC8, 0x33EE, 0x4FF3, 0x90, 0x94, 0xAE, 0x7B, 0xD8, 0x86, 0x8C, 0x4D, 100);
-
-//  Name:     System.IsFlagged -- PKEY_IsFlagged
-//  Type:     Boolean -- VT_BOOL
-//  FormatID: 5DA84765-E3FF-4278-86B0-A27967FBDD03, 100
-DEFINE_PROPERTYKEY(PKEY_IsFlagged, 0x5DA84765, 0xE3FF, 0x4278, 0x86, 0xB0, 0xA2, 0x79, 0x67, 0xFB, 0xDD, 0x03, 100);
-
-//  Name:     System.IsFlaggedComplete -- PKEY_IsFlaggedComplete
-//  Type:     Boolean -- VT_BOOL
-//  FormatID: A6F360D2-55F9-48DE-B909-620E090A647C, 100
-DEFINE_PROPERTYKEY(PKEY_IsFlaggedComplete, 0xA6F360D2, 0x55F9, 0x48DE, 0xB9, 0x09, 0x62, 0x0E, 0x09, 0x0A, 0x64, 0x7C, 100);
-
-//  Name:     System.IsIncomplete -- PKEY_IsIncomplete
-//  Type:     Boolean -- VT_BOOL
-//  FormatID: 346C8BD1-2E6A-4C45-89A4-61B78E8E700F, 100
-//
-//  Identifies if the message was not completely received for some error condition.
-DEFINE_PROPERTYKEY(PKEY_IsIncomplete, 0x346C8BD1, 0x2E6A, 0x4C45, 0x89, 0xA4, 0x61, 0xB7, 0x8E, 0x8E, 0x70, 0x0F, 100);
-
-//  Name:     System.IsRead -- PKEY_IsRead
-//  Type:     Boolean -- VT_BOOL
-//  FormatID: E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD, 10
-//
-//  Has the item been read?
-DEFINE_PROPERTYKEY(PKEY_IsRead, 0xE3E0584C, 0xB788, 0x4A5A, 0xBB, 0x20, 0x7F, 0x5A, 0x44, 0xC9, 0xAC, 0xDD, 10);
-
-//  Name:     System.IsSendToTarget -- PKEY_IsSendToTarget
-//  Type:     Boolean -- VT_BOOL
-//  FormatID: (FMTID_ShellDetails) 28636AA6-953D-11D2-B5D6-00C04FD918D0, 33
-//
-//  Provided by certain shell folders. Return TRUE if the folder is a valid Send To target.
-DEFINE_PROPERTYKEY(PKEY_IsSendToTarget, 0x28636AA6, 0x953D, 0x11D2, 0xB5, 0xD6, 0x00, 0xC0, 0x4F, 0xD9, 0x18, 0xD0, 33);
-
-//  Name:     System.IsShared -- PKEY_IsShared
-//  Type:     Boolean -- VT_BOOL
-//  FormatID: EF884C5B-2BFE-41BB-AAE5-76EEDF4F9902, 100
-//
-//  Is this item shared?
-DEFINE_PROPERTYKEY(PKEY_IsShared, 0xEF884C5B, 0x2BFE, 0x41BB, 0xAA, 0xE5, 0x76, 0xEE, 0xDF, 0x4F, 0x99, 0x02, 100);
-
-//  Name:     System.ItemAuthors -- PKEY_ItemAuthors
-//  Type:     Multivalue String -- VT_VECTOR | VT_LPWSTR  (For variants: VT_ARRAY | VT_BSTR)
-//  FormatID: D0A04F0A-462A-48A4-BB2F-3706E88DBD7D, 100
-//  
-//  This is the generic list of authors associated with an item. 
-//  
-//  For example, the artist name for a track is the item author.
-DEFINE_PROPERTYKEY(PKEY_ItemAuthors, 0xD0A04F0A, 0x462A, 0x48A4, 0xBB, 0x2F, 0x37, 0x06, 0xE8, 0x8D, 0xBD, 0x7D, 100);
-
-//  Name:     System.ItemDate -- PKEY_ItemDate
-//  Type:     DateTime -- VT_FILETIME  (For variants: VT_DATE)
-//  FormatID: F7DB74B4-4287-4103-AFBA-F1B13DCD75CF, 100
-//  
-//  This is the main date for an item. The date of interest. 
-//  
-//  For example, for photos this maps to System.Photo.DateTaken.
-DEFINE_PROPERTYKEY(PKEY_ItemDate, 0xF7DB74B4, 0x4287, 0x4103, 0xAF, 0xBA, 0xF1, 0xB1, 0x3D, 0xCD, 0x75, 0xCF, 100);
-
-//  Name:     System.ItemFolderNameDisplay -- PKEY_ItemFolderNameDisplay
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: (FMTID_Storage) B725F130-47EF-101A-A5F1-02608C9EEBAC, 2 (PID_STG_DIRECTORY)
-//  
-//  This is the user-friendly display name of the parent folder of an item.
-//  
-//  If System.ItemFolderPathDisplay is VT_EMPTY, then this property should be too.  Otherwise, it 
-//  should be derived appropriately by the data source from System.ItemFolderPathDisplay.
-//  
-//  Example values:
-//  
-//      If the path is...                     The property value is...
-//      -----------------                     ------------------------
-//      "c:\foo\bar\hello.txt"                "bar"
-//      "\\server\share\mydir\goodnews.doc"   "mydir"
-//      "\\server\share\numbers.xls"          "share"
-//      "c:\foo\MyFolder"                     "foo"
-//      "/Mailbox Account/Inbox/'Re: Hello!'" "Inbox"
-DEFINE_PROPERTYKEY(PKEY_ItemFolderNameDisplay, 0xB725F130, 0x47EF, 0x101A, 0xA5, 0xF1, 0x02, 0x60, 0x8C, 0x9E, 0xEB, 0xAC, 2);
-
-//  Name:     System.ItemFolderPathDisplay -- PKEY_ItemFolderPathDisplay
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD, 6
-//  
-//  This is the user-friendly display path of the parent folder of an item.
-//  
-//  If System.ItemPathDisplay is VT_EMPTY, then this property should be too.  Otherwise, it should 
-//  be derived appropriately by the data source from System.ItemPathDisplay.
-//  
-//  Example values:
-//  
-//      If the path is...                     The property value is...
-//      -----------------                     ------------------------
-//      "c:\foo\bar\hello.txt"                "c:\foo\bar"
-//      "\\server\share\mydir\goodnews.doc"   "\\server\share\mydir"
-//      "\\server\share\numbers.xls"          "\\server\share"
-//      "c:\foo\MyFolder"                     "c:\foo"
-//      "/Mailbox Account/Inbox/'Re: Hello!'" "/Mailbox Account/Inbox"
-DEFINE_PROPERTYKEY(PKEY_ItemFolderPathDisplay, 0xE3E0584C, 0xB788, 0x4A5A, 0xBB, 0x20, 0x7F, 0x5A, 0x44, 0xC9, 0xAC, 0xDD, 6);
-
-//  Name:     System.ItemFolderPathDisplayNarrow -- PKEY_ItemFolderPathDisplayNarrow
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: DABD30ED-0043-4789-A7F8-D013A4736622, 100
-//  
-//  This is the user-friendly display path of the parent folder of an item.  The format of the string
-//  should be tailored such that the folder name comes first, to optimize for a narrow viewing column.
-//  
-//  If the folder is a file folder, the value includes localized names if they are present.
-//  
-//  If System.ItemFolderPathDisplay is VT_EMPTY, then this property should be too.  Otherwise, it should
-//  be derived appropriately by the data source from System.ItemFolderPathDisplay.
-//  
-//  Example values:
-//  
-//      If the path is...                     The property value is...
-//      -----------------                     ------------------------
-//      "c:\foo\bar\hello.txt"                "bar (c:\foo)"
-//      "\\server\share\mydir\goodnews.doc"   "mydir (\\server\share)"
-//      "\\server\share\numbers.xls"          "share (\\server)"
-//      "c:\foo\MyFolder"                     "foo (c:\)"
-//      "/Mailbox Account/Inbox/'Re: Hello!'" "Inbox (/Mailbox Account)"
-DEFINE_PROPERTYKEY(PKEY_ItemFolderPathDisplayNarrow, 0xDABD30ED, 0x0043, 0x4789, 0xA7, 0xF8, 0xD0, 0x13, 0xA4, 0x73, 0x66, 0x22, 100);
-
-//  Name:     System.ItemName -- PKEY_ItemName
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 6B8DA074-3B5C-43BC-886F-0A2CDCE00B6F, 100
-//  
-//  This is the base-name of the System.ItemNameDisplay.
-//  
-//  If the item is a file this property
-//  includes the extension in all cases, and will be localized if a localized name is available.
-//  
-//  If the item is a message, then the value of this property does not include the forwarding or
-//  reply prefixes (see System.ItemNamePrefix).
-DEFINE_PROPERTYKEY(PKEY_ItemName, 0x6B8DA074, 0x3B5C, 0x43BC, 0x88, 0x6F, 0x0A, 0x2C, 0xDC, 0xE0, 0x0B, 0x6F, 100);
-
-//  Name:     System.ItemNameDisplay -- PKEY_ItemNameDisplay
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: (FMTID_Storage) B725F130-47EF-101A-A5F1-02608C9EEBAC, 10 (PID_STG_NAME)
-//  
-//  This is the display name in "most complete" form.  This is the best effort unique representation
-//  of the name of an item that makes sense for end users to read.  It is the concatentation of
-//  System.ItemNamePrefix and System.ItemName.
-//  
-//  If the item is a file this property
-//  includes the extension in all cases, and will be localized if a localized name is available.
-//  
-//  There are acceptable cases when System.FileName is not VT_EMPTY, yet the value of this property 
-//  is completely different.  Email messages are a key example.  If the item is an email message, 
-//  the item name is likely the subject.  In that case, the value must be the concatenation of the
-//  System.ItemNamePrefix and System.ItemName.  Since the value of System.ItemNamePrefix excludes
-//  any trailing whitespace, the concatenation must include a whitespace when generating System.ItemNameDisplay.
-//  
-//  Note that this property is not guaranteed to be unique, but the idea is to promote the most likely
-//  candidate that can be unique and also makes sense for end users. For example, for documents, you
-//  might think about using System.Title as the System.ItemNameDisplay, but in practice the title of
-//  the documents may not be useful or unique enough to be of value as the sole System.ItemNameDisplay.  
-//  Instead, providing the value of System.FileName as the value of System.ItemNameDisplay is a better
-//  candidate.  In Windows Mail, the emails are stored in the file system as .eml files and the 
-//  System.FileName for those files are not human-friendly as they contain GUIDs. In this example, 
-//  promoting System.Subject as System.ItemNameDisplay makes more sense.
-//  
-//  Compatibility notes:
-//  
-//  Shell folder implementations on Vista: use PKEY_ItemNameDisplay for the name column when
-//  you want Explorer to call ISF::GetDisplayNameOf(SHGDN_NORMAL) to get the value of the name. Use
-//  another PKEY (like PKEY_ItemName) when you want Explorer to call either the folder's property store or
-//  ISF2::GetDetailsEx in order to get the value of the name.
-//  
-//  Shell folder implementations on XP: the first column needs to be the name column, and Explorer
-//  will call ISF::GetDisplayNameOf to get the value of the name.  The PKEY/SCID does not matter.
-//  
-//  Example values:
-//  
-//      File:          "hello.txt"
-//      Message:       "Re: Let's talk about Tom's argyle socks!"
-//      Device folder: "song.wma"
-//      Folder:        "Documents"
-DEFINE_PROPERTYKEY(PKEY_ItemNameDisplay, 0xB725F130, 0x47EF, 0x101A, 0xA5, 0xF1, 0x02, 0x60, 0x8C, 0x9E, 0xEB, 0xAC, 10);
-
-//  Name:     System.ItemNamePrefix -- PKEY_ItemNamePrefix
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: D7313FF1-A77A-401C-8C99-3DBDD68ADD36, 100
-//  
-//  This is the prefix of an item, used for email messages.
-//  where the subject begins with "Re:" which is the prefix.
-//  
-//  If the item is a file, then the value of this property is VT_EMPTY.
-//  
-//  If the item is a message, then the value of this property is the forwarding or reply 
-//  prefixes (including delimiting colon, but no whitespace), or VT_EMPTY if there is no prefix.
-//  
-//  Example values:
-//  
-//  System.ItemNamePrefix    System.ItemName      System.ItemNameDisplay
-//  ---------------------    -------------------  ----------------------
-//  VT_EMPTY                 "Great day"          "Great day"
-//  "Re:"                    "Great day"          "Re: Great day"
-//  "Fwd: "                  "Monthly budget"     "Fwd: Monthly budget"
-//  VT_EMPTY                 "accounts.xls"       "accounts.xls"
-DEFINE_PROPERTYKEY(PKEY_ItemNamePrefix, 0xD7313FF1, 0xA77A, 0x401C, 0x8C, 0x99, 0x3D, 0xBD, 0xD6, 0x8A, 0xDD, 0x36, 100);
-
-//  Name:     System.ItemParticipants -- PKEY_ItemParticipants
-//  Type:     Multivalue String -- VT_VECTOR | VT_LPWSTR  (For variants: VT_ARRAY | VT_BSTR)
-//  FormatID: D4D0AA16-9948-41A4-AA85-D97FF9646993, 100
-//  
-//  This is the generic list of people associated with an item and who contributed 
-//  to the item. 
-//  
-//  For example, this is the combination of people in the To list, Cc list and 
-//  sender of an email message.
-DEFINE_PROPERTYKEY(PKEY_ItemParticipants, 0xD4D0AA16, 0x9948, 0x41A4, 0xAA, 0x85, 0xD9, 0x7F, 0xF9, 0x64, 0x69, 0x93, 100);
-
-//  Name:     System.ItemPathDisplay -- PKEY_ItemPathDisplay
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD, 7
-//  
-//  This is the user-friendly display path to the item.
-//  
-//  If the item is a file or folder this property
-//  includes the extension in all cases, and will be localized if a localized name is available.
-//  
-//  For other items,this is the user-friendly equivalent, assuming the item exists in hierarchical storage.
-//  
-//  Unlike System.ItemUrl, this property value does not include the URL scheme.
-//  
-//  To parse an item path, use System.ItemUrl or System.ParsingPath.  To reference shell 
-//  namespace items using shell APIs, use System.ParsingPath.
-//  
-//  Example values:
-//  
-//      If the path is...                     The property value is...
-//      -----------------                     ------------------------
-//      "c:\foo\bar\hello.txt"                "c:\foo\bar\hello.txt"
-//      "\\server\share\mydir\goodnews.doc"   "\\server\share\mydir\goodnews.doc"
-//      "\\server\share\numbers.xls"          "\\server\share\numbers.xls"
-//      "c:\foo\MyFolder"                     "c:\foo\MyFolder"
-//      "/Mailbox Account/Inbox/'Re: Hello!'" "/Mailbox Account/Inbox/'Re: Hello!'"
-DEFINE_PROPERTYKEY(PKEY_ItemPathDisplay, 0xE3E0584C, 0xB788, 0x4A5A, 0xBB, 0x20, 0x7F, 0x5A, 0x44, 0xC9, 0xAC, 0xDD, 7);
-
-//  Name:     System.ItemPathDisplayNarrow -- PKEY_ItemPathDisplayNarrow
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: (FMTID_ShellDetails) 28636AA6-953D-11D2-B5D6-00C04FD918D0, 8
-//  
-//  This is the user-friendly display path to the item. The format of the string should be 
-//  tailored such that the name comes first, to optimize for a narrow viewing column.
-//  
-//  If the item is a file, the value excludes the file extension, and includes localized names if they are present.
-//  If the item is a message, the value includes the System.ItemNamePrefix.
-//  
-//  To parse an item path, use System.ItemUrl or System.ParsingPath.
-//  
-//  Example values:
-//  
-//      If the path is...                     The property value is...
-//      -----------------                     ------------------------
-//      "c:\foo\bar\hello.txt"                "hello (c:\foo\bar)"
-//      "\\server\share\mydir\goodnews.doc"   "goodnews (\\server\share\mydir)"
-//      "\\server\share\folder"               "folder (\\server\share)"
-//      "c:\foo\MyFolder"                     "MyFolder (c:\foo)"
-//      "/Mailbox Account/Inbox/'Re: Hello!'" "Re: Hello! (/Mailbox Account/Inbox)"
-DEFINE_PROPERTYKEY(PKEY_ItemPathDisplayNarrow, 0x28636AA6, 0x953D, 0x11D2, 0xB5, 0xD6, 0x00, 0xC0, 0x4F, 0xD9, 0x18, 0xD0, 8);
-
-//  Name:     System.ItemType -- PKEY_ItemType
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: (FMTID_ShellDetails) 28636AA6-953D-11D2-B5D6-00C04FD918D0, 11
-//  
-//  This is the canonical type of the item and is intended to be programmatically
-//  parsed.
-//  
-//  If there is no canonical type, the value is VT_EMPTY.
-//  
-//  If the item is a file (ie, System.FileName is not VT_EMPTY), the value is the same as
-//  System.FileExtension.
-//  
-//  Use System.ItemTypeText when you want to display the type to end users in a view.  (If
-//   the item is a file, passing the System.ItemType value to PSFormatForDisplay will
-//   result in the same value as System.ItemTypeText.)
-//  
-//  Example values:
-//  
-//      If the path is...                     The property value is...
-//      -----------------                     ------------------------
-//      "c:\foo\bar\hello.txt"                ".txt"
-//      "\\server\share\mydir\goodnews.doc"   ".doc"
-//      "\\server\share\folder"               "Directory"
-//      "c:\foo\MyFolder"                     "Directory"
-//      [desktop]                             "Folder"
-//      "/Mailbox Account/Inbox/'Re: Hello!'" "MAPI/IPM.Message"
-DEFINE_PROPERTYKEY(PKEY_ItemType, 0x28636AA6, 0x953D, 0x11D2, 0xB5, 0xD6, 0x00, 0xC0, 0x4F, 0xD9, 0x18, 0xD0, 11);
-
-//  Name:     System.ItemTypeText -- PKEY_ItemTypeText
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: (FMTID_Storage) B725F130-47EF-101A-A5F1-02608C9EEBAC, 4 (PID_STG_STORAGETYPE)
-//  
-//  This is the user friendly type name of the item.  This is not intended to be
-//  programmatically parsed.
-//  
-//  If System.ItemType is VT_EMPTY, the value of this property is also VT_EMPTY.
-//  
-//  If the item is a file, the value of this property is the same as if you passed the 
-//  file's System.ItemType value to PSFormatForDisplay.
-//  
-//  This property should not be confused with System.Kind, where System.Kind is a high-level
-//  user friendly kind name. For example, for a document, System.Kind = "Document" and 
-//  System.Item.Type = ".doc" and System.Item.TypeText = "Microsoft Word Document"
-//  
-//  Example values:
-//  
-//      If the path is...                     The property value is...
-//      -----------------                     ------------------------
-//      "c:\foo\bar\hello.txt"                "Text File"
-//      "\\server\share\mydir\goodnews.doc"   "Microsoft Word Document"
-//      "\\server\share\folder"               "File Folder"
-//      "c:\foo\MyFolder"                     "File Folder"
-//      "/Mailbox Account/Inbox/'Re: Hello!'" "Outlook E-Mail Message"
-DEFINE_PROPERTYKEY(PKEY_ItemTypeText, 0xB725F130, 0x47EF, 0x101A, 0xA5, 0xF1, 0x02, 0x60, 0x8C, 0x9E, 0xEB, 0xAC, 4);
-
-//  Name:     System.ItemUrl -- PKEY_ItemUrl
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: (FMTID_Query) 49691C90-7E17-101A-A91C-08002B2ECDA9, 9 (PROPID_QUERY_VIRTUALPATH)
-//  
-//  This always represents a well formed URL that points to the item.  
-//  
-//  To reference shell namespace items using shell APIs, use System.ParsingPath.
-//  
-//  Example values:
-//  
-//      Files:    "file:///c:/foo/bar/hello.txt"
-//                "csc://{GUID}/..."
-//      Messages: "mapi://..."
-DEFINE_PROPERTYKEY(PKEY_ItemUrl, 0x49691C90, 0x7E17, 0x101A, 0xA9, 0x1C, 0x08, 0x00, 0x2B, 0x2E, 0xCD, 0xA9, 9);
-
-//  Name:     System.Keywords -- PKEY_Keywords
-//  Type:     Multivalue String -- VT_VECTOR | VT_LPWSTR  (For variants: VT_ARRAY | VT_BSTR)  Legacy code may treat this as VT_LPSTR.
-//  FormatID: (FMTID_SummaryInformation) F29F85E0-4FF9-1068-AB91-08002B27B3D9, 5 (PIDSI_KEYWORDS)
-//
-//  The keywords for the item.  Also referred to as tags.
-DEFINE_PROPERTYKEY(PKEY_Keywords, 0xF29F85E0, 0x4FF9, 0x1068, 0xAB, 0x91, 0x08, 0x00, 0x2B, 0x27, 0xB3, 0xD9, 5);
-
-//  Name:     System.Kind -- PKEY_Kind
-//  Type:     Multivalue String -- VT_VECTOR | VT_LPWSTR  (For variants: VT_ARRAY | VT_BSTR)
-//  FormatID: 1E3EE840-BC2B-476C-8237-2ACD1A839B22, 3
-//  
-//  System.Kind is used to map extensions to various .Search folders.
-//  Extensions are mapped to Kinds at HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Explorer\KindMap
-//  The list of kinds is not extensible.
-DEFINE_PROPERTYKEY(PKEY_Kind, 0x1E3EE840, 0xBC2B, 0x476C, 0x82, 0x37, 0x2A, 0xCD, 0x1A, 0x83, 0x9B, 0x22, 3);
-
-// Possible discrete values for PKEY_Kind are:
-#define KIND_CALENDAR                       L"calendar"
-#define KIND_COMMUNICATION                  L"communication"
-#define KIND_CONTACT                        L"contact"
-#define KIND_DOCUMENT                       L"document"
-#define KIND_EMAIL                          L"email"
-#define KIND_FEED                           L"feed"
-#define KIND_FOLDER                         L"folder"
-#define KIND_GAME                           L"game"
-#define KIND_INSTANTMESSAGE                 L"instantmessage"
-#define KIND_JOURNAL                        L"journal"
-#define KIND_LINK                           L"link"
-#define KIND_MOVIE                          L"movie"
-#define KIND_MUSIC                          L"music"
-#define KIND_NOTE                           L"note"
-#define KIND_PICTURE                        L"picture"
-#define KIND_PROGRAM                        L"program"
-#define KIND_RECORDEDTV                     L"recordedtv"
-#define KIND_SEARCHFOLDER                   L"searchfolder"
-#define KIND_TASK                           L"task"
-#define KIND_VIDEO                          L"video"
-#define KIND_WEBHISTORY                     L"webhistory"
-
-//  Name:     System.KindText -- PKEY_KindText
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: F04BEF95-C585-4197-A2B7-DF46FDC9EE6D, 100
-//  
-//  This is the user-friendly form of System.Kind.  Not intended to be parsed 
-//  programmatically.
-DEFINE_PROPERTYKEY(PKEY_KindText, 0xF04BEF95, 0xC585, 0x4197, 0xA2, 0xB7, 0xDF, 0x46, 0xFD, 0xC9, 0xEE, 0x6D, 100);
-
-//  Name:     System.Language -- PKEY_Language
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: (FMTID_DocumentSummaryInformation) D5CDD502-2E9C-101B-9397-08002B2CF9AE, 28
-//
-//  
-DEFINE_PROPERTYKEY(PKEY_Language, 0xD5CDD502, 0x2E9C, 0x101B, 0x93, 0x97, 0x08, 0x00, 0x2B, 0x2C, 0xF9, 0xAE, 28);
-
-//  Name:     System.MileageInformation -- PKEY_MileageInformation
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: FDF84370-031A-4ADD-9E91-0D775F1C6605, 100
-DEFINE_PROPERTYKEY(PKEY_MileageInformation, 0xFDF84370, 0x031A, 0x4ADD, 0x9E, 0x91, 0x0D, 0x77, 0x5F, 0x1C, 0x66, 0x05, 100);
-
-//  Name:     System.MIMEType -- PKEY_MIMEType
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 0B63E350-9CCC-11D0-BCDB-00805FCCCE04, 5
-//
-//  The MIME type.  Eg, for EML files: 'message/rfc822'.
-DEFINE_PROPERTYKEY(PKEY_MIMEType, 0x0B63E350, 0x9CCC, 0x11D0, 0xBC, 0xDB, 0x00, 0x80, 0x5F, 0xCC, 0xCE, 0x04, 5);
-
-//  Name:     System.Null -- PKEY_Null
-//  Type:     Null -- VT_NULL
-//  FormatID: 00000000-0000-0000-0000-000000000000, 0
-DEFINE_PROPERTYKEY(PKEY_Null, 0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0);
-
-//  Name:     System.OfflineAvailability -- PKEY_OfflineAvailability
-//  Type:     UInt32 -- VT_UI4
-//  FormatID: A94688B6-7D9F-4570-A648-E3DFC0AB2B3F, 100
-DEFINE_PROPERTYKEY(PKEY_OfflineAvailability, 0xA94688B6, 0x7D9F, 0x4570, 0xA6, 0x48, 0xE3, 0xDF, 0xC0, 0xAB, 0x2B, 0x3F, 100);
-
-// Possible discrete values for PKEY_OfflineAvailability are:
-#define OFFLINEAVAILABILITY_NOT_AVAILABLE   0ul
-#define OFFLINEAVAILABILITY_AVAILABLE       1ul
-#define OFFLINEAVAILABILITY_ALWAYS_AVAILABLE 2ul
-
-//  Name:     System.OfflineStatus -- PKEY_OfflineStatus
-//  Type:     UInt32 -- VT_UI4
-//  FormatID: 6D24888F-4718-4BDA-AFED-EA0FB4386CD8, 100
-DEFINE_PROPERTYKEY(PKEY_OfflineStatus, 0x6D24888F, 0x4718, 0x4BDA, 0xAF, 0xED, 0xEA, 0x0F, 0xB4, 0x38, 0x6C, 0xD8, 100);
-
-// Possible discrete values for PKEY_OfflineStatus are:
-#define OFFLINESTATUS_ONLINE                0ul
-#define OFFLINESTATUS_OFFLINE               1ul
-#define OFFLINESTATUS_OFFLINE_FORCED        2ul
-#define OFFLINESTATUS_OFFLINE_SLOW          3ul
-#define OFFLINESTATUS_OFFLINE_ERROR         4ul
-#define OFFLINESTATUS_OFFLINE_ITEM_VERSION_CONFLICT 5ul
-#define OFFLINESTATUS_OFFLINE_SUSPENDED     6ul
-
-//  Name:     System.OriginalFileName -- PKEY_OriginalFileName
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: (PSFMTID_VERSION) 0CEF7D53-FA64-11D1-A203-0000F81FEDEE, 6
-//  
-//  
-DEFINE_PROPERTYKEY(PKEY_OriginalFileName, 0x0CEF7D53, 0xFA64, 0x11D1, 0xA2, 0x03, 0x00, 0x00, 0xF8, 0x1F, 0xED, 0xEE, 6);
-
-//  Name:     System.ParentalRating -- PKEY_ParentalRating
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) 64440492-4C8B-11D1-8B70-080036B11A03, 21 (PIDMSI_PARENTAL_RATING)
-//
-//  
-DEFINE_PROPERTYKEY(PKEY_ParentalRating, 0x64440492, 0x4C8B, 0x11D1, 0x8B, 0x70, 0x08, 0x00, 0x36, 0xB1, 0x1A, 0x03, 21);
-
-//  Name:     System.ParentalRatingReason -- PKEY_ParentalRatingReason
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 10984E0A-F9F2-4321-B7EF-BAF195AF4319, 100
-DEFINE_PROPERTYKEY(PKEY_ParentalRatingReason, 0x10984E0A, 0xF9F2, 0x4321, 0xB7, 0xEF, 0xBA, 0xF1, 0x95, 0xAF, 0x43, 0x19, 100);
-
-//  Name:     System.ParentalRatingsOrganization -- PKEY_ParentalRatingsOrganization
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: A7FE0840-1344-46F0-8D37-52ED712A4BF9, 100
-DEFINE_PROPERTYKEY(PKEY_ParentalRatingsOrganization, 0xA7FE0840, 0x1344, 0x46F0, 0x8D, 0x37, 0x52, 0xED, 0x71, 0x2A, 0x4B, 0xF9, 100);
-
-//  Name:     System.ParsingBindContext -- PKEY_ParsingBindContext
-//  Type:     Any -- VT_NULL  Legacy code may treat this as VT_UNKNOWN.
-//  FormatID: DFB9A04D-362F-4CA3-B30B-0254B17B5B84, 100
-//  
-//  used to get the IBindCtx for an item for parsing
-DEFINE_PROPERTYKEY(PKEY_ParsingBindContext, 0xDFB9A04D, 0x362F, 0x4CA3, 0xB3, 0x0B, 0x02, 0x54, 0xB1, 0x7B, 0x5B, 0x84, 100);
-
-//  Name:     System.ParsingName -- PKEY_ParsingName
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: (FMTID_ShellDetails) 28636AA6-953D-11D2-B5D6-00C04FD918D0, 24
-//  
-//  The shell namespace name of an item relative to a parent folder.  This name may be passed to 
-//  IShellFolder::ParseDisplayName() of the parent shell folder.
-DEFINE_PROPERTYKEY(PKEY_ParsingName, 0x28636AA6, 0x953D, 0x11D2, 0xB5, 0xD6, 0x00, 0xC0, 0x4F, 0xD9, 0x18, 0xD0, 24);
-
-//  Name:     System.ParsingPath -- PKEY_ParsingPath
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: (FMTID_ShellDetails) 28636AA6-953D-11D2-B5D6-00C04FD918D0, 30
-//  
-//  This is the shell namespace path to the item.  This path may be passed to 
-//  SHParseDisplayName to parse the path to the correct shell folder.
-//  
-//  If the item is a file, the value is identical to System.ItemPathDisplay.
-//  
-//  If the item cannot be accessed through the shell namespace, this value is VT_EMPTY.
-DEFINE_PROPERTYKEY(PKEY_ParsingPath, 0x28636AA6, 0x953D, 0x11D2, 0xB5, 0xD6, 0x00, 0xC0, 0x4F, 0xD9, 0x18, 0xD0, 30);
-
-//  Name:     System.PerceivedType -- PKEY_PerceivedType
-//  Type:     Int32 -- VT_I4
-//  FormatID: (FMTID_ShellDetails) 28636AA6-953D-11D2-B5D6-00C04FD918D0, 9
-//
-//  The perceived type of a shell item, based upon its canonical type.
-DEFINE_PROPERTYKEY(PKEY_PerceivedType, 0x28636AA6, 0x953D, 0x11D2, 0xB5, 0xD6, 0x00, 0xC0, 0x4F, 0xD9, 0x18, 0xD0, 9);
-
-// For the enumerated values of PKEY_PerceivedType, see the PERCEIVED_TYPE_* values in shtypes.idl.
-
-//  Name:     System.PercentFull -- PKEY_PercentFull
-//  Type:     UInt32 -- VT_UI4
-//  FormatID: (FMTID_Volume) 9B174B35-40FF-11D2-A27E-00C04FC30871, 5  (Filesystem Volume Properties)
-//
-//  The amount filled as a percentage, multiplied by 100 (ie, the valid range is 0 through 100).
-DEFINE_PROPERTYKEY(PKEY_PercentFull, 0x9B174B35, 0x40FF, 0x11D2, 0xA2, 0x7E, 0x00, 0xC0, 0x4F, 0xC3, 0x08, 0x71, 5);
-
-//  Name:     System.Priority -- PKEY_Priority
-//  Type:     UInt16 -- VT_UI2
-//  FormatID: 9C1FCF74-2D97-41BA-B4AE-CB2E3661A6E4, 5
-//
-//  
-DEFINE_PROPERTYKEY(PKEY_Priority, 0x9C1FCF74, 0x2D97, 0x41BA, 0xB4, 0xAE, 0xCB, 0x2E, 0x36, 0x61, 0xA6, 0xE4, 5);
-
-// Possible discrete values for PKEY_Priority are:
-#define PRIORITY_PROP_LOW                   0u
-#define PRIORITY_PROP_NORMAL                1u
-#define PRIORITY_PROP_HIGH                  2u
-
-//  Name:     System.PriorityText -- PKEY_PriorityText
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: D98BE98B-B86B-4095-BF52-9D23B2E0A752, 100
-//  
-//  This is the user-friendly form of System.Priority.  Not intended to be parsed 
-//  programmatically.
-DEFINE_PROPERTYKEY(PKEY_PriorityText, 0xD98BE98B, 0xB86B, 0x4095, 0xBF, 0x52, 0x9D, 0x23, 0xB2, 0xE0, 0xA7, 0x52, 100);
-
-//  Name:     System.Project -- PKEY_Project
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 39A7F922-477C-48DE-8BC8-B28441E342E3, 100
-DEFINE_PROPERTYKEY(PKEY_Project, 0x39A7F922, 0x477C, 0x48DE, 0x8B, 0xC8, 0xB2, 0x84, 0x41, 0xE3, 0x42, 0xE3, 100);
-
-//  Name:     System.ProviderItemID -- PKEY_ProviderItemID
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: F21D9941-81F0-471A-ADEE-4E74B49217ED, 100
-//  
-//  
-DEFINE_PROPERTYKEY(PKEY_ProviderItemID, 0xF21D9941, 0x81F0, 0x471A, 0xAD, 0xEE, 0x4E, 0x74, 0xB4, 0x92, 0x17, 0xED, 100);
-
-//  Name:     System.Rating -- PKEY_Rating
-//  Type:     UInt32 -- VT_UI4
-//  FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) 64440492-4C8B-11D1-8B70-080036B11A03, 9 (PIDMSI_RATING)
-//  
-//  Indicates the users preference rating of an item on a scale of 0-99 (0 = unrated, 1-12 = One Star, 
-//  13-37 = Two Stars, 38-62 = Three Stars, 63-87 = Four Stars, 88-99 = Five Stars).
-DEFINE_PROPERTYKEY(PKEY_Rating, 0x64440492, 0x4C8B, 0x11D1, 0x8B, 0x70, 0x08, 0x00, 0x36, 0xB1, 0x1A, 0x03, 9);
-
-// Use the following constants to convert between visual stars and the ratings value:
-#define RATING_UNRATED_MIN                  0ul
-#define RATING_UNRATED_SET                  0ul
-#define RATING_UNRATED_MAX                  0ul
-
-#define RATING_ONE_STAR_MIN                 1ul
-#define RATING_ONE_STAR_SET                 1ul
-#define RATING_ONE_STAR_MAX                 12ul
-
-#define RATING_TWO_STARS_MIN                13ul
-#define RATING_TWO_STARS_SET                25ul
-#define RATING_TWO_STARS_MAX                37ul
-
-#define RATING_THREE_STARS_MIN              38ul
-#define RATING_THREE_STARS_SET              50ul
-#define RATING_THREE_STARS_MAX              62ul
-
-#define RATING_FOUR_STARS_MIN               63ul
-#define RATING_FOUR_STARS_SET               75ul
-#define RATING_FOUR_STARS_MAX               87ul
-
-#define RATING_FIVE_STARS_MIN               88ul
-#define RATING_FIVE_STARS_SET               99ul
-#define RATING_FIVE_STARS_MAX               99ul
-
-
-//  Name:     System.RatingText -- PKEY_RatingText
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 90197CA7-FD8F-4E8C-9DA3-B57E1E609295, 100
-//  
-//  This is the user-friendly form of System.Rating.  Not intended to be parsed 
-//  programmatically.
-DEFINE_PROPERTYKEY(PKEY_RatingText, 0x90197CA7, 0xFD8F, 0x4E8C, 0x9D, 0xA3, 0xB5, 0x7E, 0x1E, 0x60, 0x92, 0x95, 100);
-
-//  Name:     System.Sensitivity -- PKEY_Sensitivity
-//  Type:     UInt16 -- VT_UI2
-//  FormatID: F8D3F6AC-4874-42CB-BE59-AB454B30716A, 100
-//
-//  
-DEFINE_PROPERTYKEY(PKEY_Sensitivity, 0xF8D3F6AC, 0x4874, 0x42CB, 0xBE, 0x59, 0xAB, 0x45, 0x4B, 0x30, 0x71, 0x6A, 100);
-
-// Possible discrete values for PKEY_Sensitivity are:
-#define SENSITIVITY_PROP_NORMAL             0u
-#define SENSITIVITY_PROP_PERSONAL           1u
-#define SENSITIVITY_PROP_PRIVATE            2u
-#define SENSITIVITY_PROP_CONFIDENTIAL       3u
-
-//  Name:     System.SensitivityText -- PKEY_SensitivityText
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: D0C7F054-3F72-4725-8527-129A577CB269, 100
-//  
-//  This is the user-friendly form of System.Sensitivity.  Not intended to be parsed 
-//  programmatically.
-DEFINE_PROPERTYKEY(PKEY_SensitivityText, 0xD0C7F054, 0x3F72, 0x4725, 0x85, 0x27, 0x12, 0x9A, 0x57, 0x7C, 0xB2, 0x69, 100);
-
-//  Name:     System.SFGAOFlags -- PKEY_SFGAOFlags
-//  Type:     UInt32 -- VT_UI4
-//  FormatID: (FMTID_ShellDetails) 28636AA6-953D-11D2-B5D6-00C04FD918D0, 25
-//
-//  IShellFolder::GetAttributesOf flags, with SFGAO_PKEYSFGAOMASK attributes masked out.
-DEFINE_PROPERTYKEY(PKEY_SFGAOFlags, 0x28636AA6, 0x953D, 0x11D2, 0xB5, 0xD6, 0x00, 0xC0, 0x4F, 0xD9, 0x18, 0xD0, 25);
-
-//  Name:     System.SharedWith -- PKEY_SharedWith
-//  Type:     Multivalue String -- VT_VECTOR | VT_LPWSTR  (For variants: VT_ARRAY | VT_BSTR)
-//  FormatID: EF884C5B-2BFE-41BB-AAE5-76EEDF4F9902, 200
-//
-//  Who is the item shared with?
-DEFINE_PROPERTYKEY(PKEY_SharedWith, 0xEF884C5B, 0x2BFE, 0x41BB, 0xAA, 0xE5, 0x76, 0xEE, 0xDF, 0x4F, 0x99, 0x02, 200);
-
-//  Name:     System.ShareUserRating -- PKEY_ShareUserRating
-//  Type:     UInt32 -- VT_UI4
-//  FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) 64440492-4C8B-11D1-8B70-080036B11A03, 12 (PIDMSI_SHARE_USER_RATING)
-//
-//  
-DEFINE_PROPERTYKEY(PKEY_ShareUserRating, 0x64440492, 0x4C8B, 0x11D1, 0x8B, 0x70, 0x08, 0x00, 0x36, 0xB1, 0x1A, 0x03, 12);
-
-//  Name:     System.Shell.OmitFromView -- PKEY_Shell_OmitFromView
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: DE35258C-C695-4CBC-B982-38B0AD24CED0, 2
-//  
-//  Set this to a string value of 'True' to omit this item from shell views
-DEFINE_PROPERTYKEY(PKEY_Shell_OmitFromView, 0xDE35258C, 0xC695, 0x4CBC, 0xB9, 0x82, 0x38, 0xB0, 0xAD, 0x24, 0xCE, 0xD0, 2);
-
-//  Name:     System.SimpleRating -- PKEY_SimpleRating
-//  Type:     UInt32 -- VT_UI4
-//  FormatID: A09F084E-AD41-489F-8076-AA5BE3082BCA, 100
-//  
-//  Indicates the users preference rating of an item on a scale of 0-5 (0=unrated, 1=One Star, 2=Two Stars, 3=Three Stars,
-//  4=Four Stars, 5=Five Stars)
-DEFINE_PROPERTYKEY(PKEY_SimpleRating, 0xA09F084E, 0xAD41, 0x489F, 0x80, 0x76, 0xAA, 0x5B, 0xE3, 0x08, 0x2B, 0xCA, 100);
-
-//  Name:     System.Size -- PKEY_Size
-//  Type:     UInt64 -- VT_UI8
-//  FormatID: (FMTID_Storage) B725F130-47EF-101A-A5F1-02608C9EEBAC, 12 (PID_STG_SIZE)
-//
-//  
-DEFINE_PROPERTYKEY(PKEY_Size, 0xB725F130, 0x47EF, 0x101A, 0xA5, 0xF1, 0x02, 0x60, 0x8C, 0x9E, 0xEB, 0xAC, 12);
-
-//  Name:     System.SoftwareUsed -- PKEY_SoftwareUsed
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: (FMTID_ImageProperties) 14B81DA1-0135-4D31-96D9-6CBFC9671A99, 305
-//
-//  PropertyTagSoftwareUsed
-DEFINE_PROPERTYKEY(PKEY_SoftwareUsed, 0x14B81DA1, 0x0135, 0x4D31, 0x96, 0xD9, 0x6C, 0xBF, 0xC9, 0x67, 0x1A, 0x99, 305);
-
-//  Name:     System.SourceItem -- PKEY_SourceItem
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 668CDFA5-7A1B-4323-AE4B-E527393A1D81, 100
-DEFINE_PROPERTYKEY(PKEY_SourceItem, 0x668CDFA5, 0x7A1B, 0x4323, 0xAE, 0x4B, 0xE5, 0x27, 0x39, 0x3A, 0x1D, 0x81, 100);
-
-//  Name:     System.StartDate -- PKEY_StartDate
-//  Type:     DateTime -- VT_FILETIME  (For variants: VT_DATE)
-//  FormatID: 48FD6EC8-8A12-4CDF-A03E-4EC5A511EDDE, 100
-DEFINE_PROPERTYKEY(PKEY_StartDate, 0x48FD6EC8, 0x8A12, 0x4CDF, 0xA0, 0x3E, 0x4E, 0xC5, 0xA5, 0x11, 0xED, 0xDE, 100);
-
-//  Name:     System.Status -- PKEY_Status
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: (FMTID_IntSite) 000214A1-0000-0000-C000-000000000046, 9
-DEFINE_PROPERTYKEY(PKEY_Status, 0x000214A1, 0x0000, 0x0000, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 9);
-
-//  Name:     System.Subject -- PKEY_Subject
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: (FMTID_SummaryInformation) F29F85E0-4FF9-1068-AB91-08002B27B3D9, 3 (PIDSI_SUBJECT)
-//
-//  
-DEFINE_PROPERTYKEY(PKEY_Subject, 0xF29F85E0, 0x4FF9, 0x1068, 0xAB, 0x91, 0x08, 0x00, 0x2B, 0x27, 0xB3, 0xD9, 3);
-
-//  Name:     System.Thumbnail -- PKEY_Thumbnail
-//  Type:     Clipboard -- VT_CF
-//  FormatID: (FMTID_SummaryInformation) F29F85E0-4FF9-1068-AB91-08002B27B3D9, 17 (PIDSI_THUMBNAIL)
-//
-//  A data that represents the thumbnail in VT_CF format.
-DEFINE_PROPERTYKEY(PKEY_Thumbnail, 0xF29F85E0, 0x4FF9, 0x1068, 0xAB, 0x91, 0x08, 0x00, 0x2B, 0x27, 0xB3, 0xD9, 17);
-
-//  Name:     System.ThumbnailCacheId -- PKEY_ThumbnailCacheId
-//  Type:     UInt64 -- VT_UI8
-//  FormatID: 446D16B1-8DAD-4870-A748-402EA43D788C, 100
-//  
-//  Unique value that can be used as a key to cache thumbnails. The value changes when the name, volume, or data modified 
-//  of an item changes.
-DEFINE_PROPERTYKEY(PKEY_ThumbnailCacheId, 0x446D16B1, 0x8DAD, 0x4870, 0xA7, 0x48, 0x40, 0x2E, 0xA4, 0x3D, 0x78, 0x8C, 100);
-
-//  Name:     System.ThumbnailStream -- PKEY_ThumbnailStream
-//  Type:     Stream -- VT_STREAM
-//  FormatID: (FMTID_SummaryInformation) F29F85E0-4FF9-1068-AB91-08002B27B3D9, 27
-//
-//  Data that represents the thumbnail in VT_STREAM format that GDI+/WindowsCodecs supports (jpg, png, etc).
-DEFINE_PROPERTYKEY(PKEY_ThumbnailStream, 0xF29F85E0, 0x4FF9, 0x1068, 0xAB, 0x91, 0x08, 0x00, 0x2B, 0x27, 0xB3, 0xD9, 27);
-
-//  Name:     System.Title -- PKEY_Title
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)  Legacy code may treat this as VT_LPSTR.
-//  FormatID: (FMTID_SummaryInformation) F29F85E0-4FF9-1068-AB91-08002B27B3D9, 2 (PIDSI_TITLE)
-//
-//  Title of item.
-DEFINE_PROPERTYKEY(PKEY_Title, 0xF29F85E0, 0x4FF9, 0x1068, 0xAB, 0x91, 0x08, 0x00, 0x2B, 0x27, 0xB3, 0xD9, 2);
-
-//  Name:     System.TotalFileSize -- PKEY_TotalFileSize
-//  Type:     UInt64 -- VT_UI8
-//  FormatID: (FMTID_ShellDetails) 28636AA6-953D-11D2-B5D6-00C04FD918D0, 14
-//
-//  
-DEFINE_PROPERTYKEY(PKEY_TotalFileSize, 0x28636AA6, 0x953D, 0x11D2, 0xB5, 0xD6, 0x00, 0xC0, 0x4F, 0xD9, 0x18, 0xD0, 14);
-
-//  Name:     System.Trademarks -- PKEY_Trademarks
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: (PSFMTID_VERSION) 0CEF7D53-FA64-11D1-A203-0000F81FEDEE, 9 (PIDVSI_Trademarks)
-//
-//  
-DEFINE_PROPERTYKEY(PKEY_Trademarks, 0x0CEF7D53, 0xFA64, 0x11D1, 0xA2, 0x03, 0x00, 0x00, 0xF8, 0x1F, 0xED, 0xEE, 9);
- 
-//-----------------------------------------------------------------------------
-// Document properties
-
-
-
-//  Name:     System.Document.ByteCount -- PKEY_Document_ByteCount
-//  Type:     Int32 -- VT_I4
-//  FormatID: (FMTID_DocumentSummaryInformation) D5CDD502-2E9C-101B-9397-08002B2CF9AE, 4 (PIDDSI_BYTECOUNT)
-//
-//  
-DEFINE_PROPERTYKEY(PKEY_Document_ByteCount, 0xD5CDD502, 0x2E9C, 0x101B, 0x93, 0x97, 0x08, 0x00, 0x2B, 0x2C, 0xF9, 0xAE, 4);
-
-//  Name:     System.Document.CharacterCount -- PKEY_Document_CharacterCount
-//  Type:     Int32 -- VT_I4
-//  FormatID: (FMTID_SummaryInformation) F29F85E0-4FF9-1068-AB91-08002B27B3D9, 16 (PIDSI_CHARCOUNT)
-//
-//  
-DEFINE_PROPERTYKEY(PKEY_Document_CharacterCount, 0xF29F85E0, 0x4FF9, 0x1068, 0xAB, 0x91, 0x08, 0x00, 0x2B, 0x27, 0xB3, 0xD9, 16);
-
-//  Name:     System.Document.ClientID -- PKEY_Document_ClientID
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 276D7BB0-5B34-4FB0-AA4B-158ED12A1809, 100
-DEFINE_PROPERTYKEY(PKEY_Document_ClientID, 0x276D7BB0, 0x5B34, 0x4FB0, 0xAA, 0x4B, 0x15, 0x8E, 0xD1, 0x2A, 0x18, 0x09, 100);
-
-//  Name:     System.Document.Contributor -- PKEY_Document_Contributor
-//  Type:     Multivalue String -- VT_VECTOR | VT_LPWSTR  (For variants: VT_ARRAY | VT_BSTR)
-//  FormatID: F334115E-DA1B-4509-9B3D-119504DC7ABB, 100
-DEFINE_PROPERTYKEY(PKEY_Document_Contributor, 0xF334115E, 0xDA1B, 0x4509, 0x9B, 0x3D, 0x11, 0x95, 0x04, 0xDC, 0x7A, 0xBB, 100);
-
-//  Name:     System.Document.DateCreated -- PKEY_Document_DateCreated
-//  Type:     DateTime -- VT_FILETIME  (For variants: VT_DATE)
-//  FormatID: (FMTID_SummaryInformation) F29F85E0-4FF9-1068-AB91-08002B27B3D9, 12 (PIDSI_CREATE_DTM)
-//  
-//  This property is stored in the document, not obtained from the file system.
-DEFINE_PROPERTYKEY(PKEY_Document_DateCreated, 0xF29F85E0, 0x4FF9, 0x1068, 0xAB, 0x91, 0x08, 0x00, 0x2B, 0x27, 0xB3, 0xD9, 12);
-
-//  Name:     System.Document.DatePrinted -- PKEY_Document_DatePrinted
-//  Type:     DateTime -- VT_FILETIME  (For variants: VT_DATE)
-//  FormatID: (FMTID_SummaryInformation) F29F85E0-4FF9-1068-AB91-08002B27B3D9, 11 (PIDSI_LASTPRINTED)
-//
-//  Legacy name: "DocLastPrinted".
-DEFINE_PROPERTYKEY(PKEY_Document_DatePrinted, 0xF29F85E0, 0x4FF9, 0x1068, 0xAB, 0x91, 0x08, 0x00, 0x2B, 0x27, 0xB3, 0xD9, 11);
-
-//  Name:     System.Document.DateSaved -- PKEY_Document_DateSaved
-//  Type:     DateTime -- VT_FILETIME  (For variants: VT_DATE)
-//  FormatID: (FMTID_SummaryInformation) F29F85E0-4FF9-1068-AB91-08002B27B3D9, 13 (PIDSI_LASTSAVE_DTM)
-//
-//  Legacy name: "DocLastSavedTm".
-DEFINE_PROPERTYKEY(PKEY_Document_DateSaved, 0xF29F85E0, 0x4FF9, 0x1068, 0xAB, 0x91, 0x08, 0x00, 0x2B, 0x27, 0xB3, 0xD9, 13);
-
-//  Name:     System.Document.Division -- PKEY_Document_Division
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 1E005EE6-BF27-428B-B01C-79676ACD2870, 100
-DEFINE_PROPERTYKEY(PKEY_Document_Division, 0x1E005EE6, 0xBF27, 0x428B, 0xB0, 0x1C, 0x79, 0x67, 0x6A, 0xCD, 0x28, 0x70, 100);
-
-//  Name:     System.Document.DocumentID -- PKEY_Document_DocumentID
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: E08805C8-E395-40DF-80D2-54F0D6C43154, 100
-DEFINE_PROPERTYKEY(PKEY_Document_DocumentID, 0xE08805C8, 0xE395, 0x40DF, 0x80, 0xD2, 0x54, 0xF0, 0xD6, 0xC4, 0x31, 0x54, 100);
-
-//  Name:     System.Document.HiddenSlideCount -- PKEY_Document_HiddenSlideCount
-//  Type:     Int32 -- VT_I4
-//  FormatID: (FMTID_DocumentSummaryInformation) D5CDD502-2E9C-101B-9397-08002B2CF9AE, 9 (PIDDSI_HIDDENCOUNT)
-//
-//  
-DEFINE_PROPERTYKEY(PKEY_Document_HiddenSlideCount, 0xD5CDD502, 0x2E9C, 0x101B, 0x93, 0x97, 0x08, 0x00, 0x2B, 0x2C, 0xF9, 0xAE, 9);
-
-//  Name:     System.Document.LastAuthor -- PKEY_Document_LastAuthor
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: (FMTID_SummaryInformation) F29F85E0-4FF9-1068-AB91-08002B27B3D9, 8 (PIDSI_LASTAUTHOR)
-//
-//  
-DEFINE_PROPERTYKEY(PKEY_Document_LastAuthor, 0xF29F85E0, 0x4FF9, 0x1068, 0xAB, 0x91, 0x08, 0x00, 0x2B, 0x27, 0xB3, 0xD9, 8);
-
-//  Name:     System.Document.LineCount -- PKEY_Document_LineCount
-//  Type:     Int32 -- VT_I4
-//  FormatID: (FMTID_DocumentSummaryInformation) D5CDD502-2E9C-101B-9397-08002B2CF9AE, 5 (PIDDSI_LINECOUNT)
-//
-//  
-DEFINE_PROPERTYKEY(PKEY_Document_LineCount, 0xD5CDD502, 0x2E9C, 0x101B, 0x93, 0x97, 0x08, 0x00, 0x2B, 0x2C, 0xF9, 0xAE, 5);
-
-//  Name:     System.Document.Manager -- PKEY_Document_Manager
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: (FMTID_DocumentSummaryInformation) D5CDD502-2E9C-101B-9397-08002B2CF9AE, 14 (PIDDSI_MANAGER)
-//
-//  
-DEFINE_PROPERTYKEY(PKEY_Document_Manager, 0xD5CDD502, 0x2E9C, 0x101B, 0x93, 0x97, 0x08, 0x00, 0x2B, 0x2C, 0xF9, 0xAE, 14);
-
-//  Name:     System.Document.MultimediaClipCount -- PKEY_Document_MultimediaClipCount
-//  Type:     Int32 -- VT_I4
-//  FormatID: (FMTID_DocumentSummaryInformation) D5CDD502-2E9C-101B-9397-08002B2CF9AE, 10 (PIDDSI_MMCLIPCOUNT)
-//
-//  
-DEFINE_PROPERTYKEY(PKEY_Document_MultimediaClipCount, 0xD5CDD502, 0x2E9C, 0x101B, 0x93, 0x97, 0x08, 0x00, 0x2B, 0x2C, 0xF9, 0xAE, 10);
-
-//  Name:     System.Document.NoteCount -- PKEY_Document_NoteCount
-//  Type:     Int32 -- VT_I4
-//  FormatID: (FMTID_DocumentSummaryInformation) D5CDD502-2E9C-101B-9397-08002B2CF9AE, 8 (PIDDSI_NOTECOUNT)
-//
-//  
-DEFINE_PROPERTYKEY(PKEY_Document_NoteCount, 0xD5CDD502, 0x2E9C, 0x101B, 0x93, 0x97, 0x08, 0x00, 0x2B, 0x2C, 0xF9, 0xAE, 8);
-
-//  Name:     System.Document.PageCount -- PKEY_Document_PageCount
-//  Type:     Int32 -- VT_I4
-//  FormatID: (FMTID_SummaryInformation) F29F85E0-4FF9-1068-AB91-08002B27B3D9, 14 (PIDSI_PAGECOUNT)
-//
-//  
-DEFINE_PROPERTYKEY(PKEY_Document_PageCount, 0xF29F85E0, 0x4FF9, 0x1068, 0xAB, 0x91, 0x08, 0x00, 0x2B, 0x27, 0xB3, 0xD9, 14);
-
-//  Name:     System.Document.ParagraphCount -- PKEY_Document_ParagraphCount
-//  Type:     Int32 -- VT_I4
-//  FormatID: (FMTID_DocumentSummaryInformation) D5CDD502-2E9C-101B-9397-08002B2CF9AE, 6 (PIDDSI_PARCOUNT)
-//
-//  
-DEFINE_PROPERTYKEY(PKEY_Document_ParagraphCount, 0xD5CDD502, 0x2E9C, 0x101B, 0x93, 0x97, 0x08, 0x00, 0x2B, 0x2C, 0xF9, 0xAE, 6);
-
-//  Name:     System.Document.PresentationFormat -- PKEY_Document_PresentationFormat
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: (FMTID_DocumentSummaryInformation) D5CDD502-2E9C-101B-9397-08002B2CF9AE, 3 (PIDDSI_PRESFORMAT)
-//
-//  
-DEFINE_PROPERTYKEY(PKEY_Document_PresentationFormat, 0xD5CDD502, 0x2E9C, 0x101B, 0x93, 0x97, 0x08, 0x00, 0x2B, 0x2C, 0xF9, 0xAE, 3);
-
-//  Name:     System.Document.RevisionNumber -- PKEY_Document_RevisionNumber
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: (FMTID_SummaryInformation) F29F85E0-4FF9-1068-AB91-08002B27B3D9, 9 (PIDSI_REVNUMBER)
-//
-//  
-DEFINE_PROPERTYKEY(PKEY_Document_RevisionNumber, 0xF29F85E0, 0x4FF9, 0x1068, 0xAB, 0x91, 0x08, 0x00, 0x2B, 0x27, 0xB3, 0xD9, 9);
-
-//  Name:     System.Document.Security -- PKEY_Document_Security
-//  Type:     Int32 -- VT_I4
-//  FormatID: (FMTID_SummaryInformation) F29F85E0-4FF9-1068-AB91-08002B27B3D9, 19
-//
-//  Access control information, from SummaryInfo propset
-DEFINE_PROPERTYKEY(PKEY_Document_Security, 0xF29F85E0, 0x4FF9, 0x1068, 0xAB, 0x91, 0x08, 0x00, 0x2B, 0x27, 0xB3, 0xD9, 19);
-
-//  Name:     System.Document.SlideCount -- PKEY_Document_SlideCount
-//  Type:     Int32 -- VT_I4
-//  FormatID: (FMTID_DocumentSummaryInformation) D5CDD502-2E9C-101B-9397-08002B2CF9AE, 7 (PIDDSI_SLIDECOUNT)
-//
-//  
-DEFINE_PROPERTYKEY(PKEY_Document_SlideCount, 0xD5CDD502, 0x2E9C, 0x101B, 0x93, 0x97, 0x08, 0x00, 0x2B, 0x2C, 0xF9, 0xAE, 7);
-
-//  Name:     System.Document.Template -- PKEY_Document_Template
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: (FMTID_SummaryInformation) F29F85E0-4FF9-1068-AB91-08002B27B3D9, 7 (PIDSI_TEMPLATE)
-//
-//  
-DEFINE_PROPERTYKEY(PKEY_Document_Template, 0xF29F85E0, 0x4FF9, 0x1068, 0xAB, 0x91, 0x08, 0x00, 0x2B, 0x27, 0xB3, 0xD9, 7);
-
-//  Name:     System.Document.TotalEditingTime -- PKEY_Document_TotalEditingTime
-//  Type:     UInt64 -- VT_UI8
-//  FormatID: (FMTID_SummaryInformation) F29F85E0-4FF9-1068-AB91-08002B27B3D9, 10 (PIDSI_EDITTIME)
-//
-//  100ns units, not milliseconds. VT_FILETIME for IPropertySetStorage handlers (legacy)
-DEFINE_PROPERTYKEY(PKEY_Document_TotalEditingTime, 0xF29F85E0, 0x4FF9, 0x1068, 0xAB, 0x91, 0x08, 0x00, 0x2B, 0x27, 0xB3, 0xD9, 10);
-
-//  Name:     System.Document.Version -- PKEY_Document_Version
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: (FMTID_DocumentSummaryInformation) D5CDD502-2E9C-101B-9397-08002B2CF9AE, 29
-DEFINE_PROPERTYKEY(PKEY_Document_Version, 0xD5CDD502, 0x2E9C, 0x101B, 0x93, 0x97, 0x08, 0x00, 0x2B, 0x2C, 0xF9, 0xAE, 29);
-
-//  Name:     System.Document.WordCount -- PKEY_Document_WordCount
-//  Type:     Int32 -- VT_I4
-//  FormatID: (FMTID_SummaryInformation) F29F85E0-4FF9-1068-AB91-08002B27B3D9, 15 (PIDSI_WORDCOUNT)
-//
-//  
-DEFINE_PROPERTYKEY(PKEY_Document_WordCount, 0xF29F85E0, 0x4FF9, 0x1068, 0xAB, 0x91, 0x08, 0x00, 0x2B, 0x27, 0xB3, 0xD9, 15);
-
- 
- 
-//-----------------------------------------------------------------------------
-// DRM properties
-
-//  Name:     System.DRM.DatePlayExpires -- PKEY_DRM_DatePlayExpires
-//  Type:     DateTime -- VT_FILETIME  (For variants: VT_DATE)
-//  FormatID: (FMTID_DRM) AEAC19E4-89AE-4508-B9B7-BB867ABEE2ED, 6 (PIDDRSI_PLAYEXPIRES)
-//
-//  Indicates when play expires for digital rights management.
-DEFINE_PROPERTYKEY(PKEY_DRM_DatePlayExpires, 0xAEAC19E4, 0x89AE, 0x4508, 0xB9, 0xB7, 0xBB, 0x86, 0x7A, 0xBE, 0xE2, 0xED, 6);
-
-//  Name:     System.DRM.DatePlayStarts -- PKEY_DRM_DatePlayStarts
-//  Type:     DateTime -- VT_FILETIME  (For variants: VT_DATE)
-//  FormatID: (FMTID_DRM) AEAC19E4-89AE-4508-B9B7-BB867ABEE2ED, 5 (PIDDRSI_PLAYSTARTS)
-//
-//  Indicates when play starts for digital rights management.
-DEFINE_PROPERTYKEY(PKEY_DRM_DatePlayStarts, 0xAEAC19E4, 0x89AE, 0x4508, 0xB9, 0xB7, 0xBB, 0x86, 0x7A, 0xBE, 0xE2, 0xED, 5);
-
-//  Name:     System.DRM.Description -- PKEY_DRM_Description
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: (FMTID_DRM) AEAC19E4-89AE-4508-B9B7-BB867ABEE2ED, 3 (PIDDRSI_DESCRIPTION)
-//
-//  Displays the description for digital rights management.
-DEFINE_PROPERTYKEY(PKEY_DRM_Description, 0xAEAC19E4, 0x89AE, 0x4508, 0xB9, 0xB7, 0xBB, 0x86, 0x7A, 0xBE, 0xE2, 0xED, 3);
-
-//  Name:     System.DRM.IsProtected -- PKEY_DRM_IsProtected
-//  Type:     Boolean -- VT_BOOL
-//  FormatID: (FMTID_DRM) AEAC19E4-89AE-4508-B9B7-BB867ABEE2ED, 2 (PIDDRSI_PROTECTED)
-//
-//  
-DEFINE_PROPERTYKEY(PKEY_DRM_IsProtected, 0xAEAC19E4, 0x89AE, 0x4508, 0xB9, 0xB7, 0xBB, 0x86, 0x7A, 0xBE, 0xE2, 0xED, 2);
-
-//  Name:     System.DRM.PlayCount -- PKEY_DRM_PlayCount
-//  Type:     UInt32 -- VT_UI4
-//  FormatID: (FMTID_DRM) AEAC19E4-89AE-4508-B9B7-BB867ABEE2ED, 4 (PIDDRSI_PLAYCOUNT)
-//
-//  Indicates the play count for digital rights management.
-DEFINE_PROPERTYKEY(PKEY_DRM_PlayCount, 0xAEAC19E4, 0x89AE, 0x4508, 0xB9, 0xB7, 0xBB, 0x86, 0x7A, 0xBE, 0xE2, 0xED, 4);
- 
-//-----------------------------------------------------------------------------
-// GPS properties
-
-//  Name:     System.GPS.Altitude -- PKEY_GPS_Altitude
-//  Type:     Double -- VT_R8
-//  FormatID: 827EDB4F-5B73-44A7-891D-FDFFABEA35CA, 100
-//  
-//  Indicates the altitude based on the reference in PKEY_GPS_AltitudeRef.  Calculated from PKEY_GPS_AltitudeNumerator and 
-//  PKEY_GPS_AltitudeDenominator
-DEFINE_PROPERTYKEY(PKEY_GPS_Altitude, 0x827EDB4F, 0x5B73, 0x44A7, 0x89, 0x1D, 0xFD, 0xFF, 0xAB, 0xEA, 0x35, 0xCA, 100);
-
-//  Name:     System.GPS.AltitudeDenominator -- PKEY_GPS_AltitudeDenominator
-//  Type:     UInt32 -- VT_UI4
-//  FormatID: 78342DCB-E358-4145-AE9A-6BFE4E0F9F51, 100
-//
-//  Denominator of PKEY_GPS_Altitude
-DEFINE_PROPERTYKEY(PKEY_GPS_AltitudeDenominator, 0x78342DCB, 0xE358, 0x4145, 0xAE, 0x9A, 0x6B, 0xFE, 0x4E, 0x0F, 0x9F, 0x51, 100);
-
-//  Name:     System.GPS.AltitudeNumerator -- PKEY_GPS_AltitudeNumerator
-//  Type:     UInt32 -- VT_UI4
-//  FormatID: 2DAD1EB7-816D-40D3-9EC3-C9773BE2AADE, 100
-//
-//  Numerator of PKEY_GPS_Altitude
-DEFINE_PROPERTYKEY(PKEY_GPS_AltitudeNumerator, 0x2DAD1EB7, 0x816D, 0x40D3, 0x9E, 0xC3, 0xC9, 0x77, 0x3B, 0xE2, 0xAA, 0xDE, 100);
-
-//  Name:     System.GPS.AltitudeRef -- PKEY_GPS_AltitudeRef
-//  Type:     Byte -- VT_UI1
-//  FormatID: 46AC629D-75EA-4515-867F-6DC4321C5844, 100
-//
-//  Indicates the reference for the altitude property. (eg: above sea level, below sea level, absolute value)
-DEFINE_PROPERTYKEY(PKEY_GPS_AltitudeRef, 0x46AC629D, 0x75EA, 0x4515, 0x86, 0x7F, 0x6D, 0xC4, 0x32, 0x1C, 0x58, 0x44, 100);
-
-//  Name:     System.GPS.AreaInformation -- PKEY_GPS_AreaInformation
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 972E333E-AC7E-49F1-8ADF-A70D07A9BCAB, 100
-//
-//  Represents the name of the GPS area
-DEFINE_PROPERTYKEY(PKEY_GPS_AreaInformation, 0x972E333E, 0xAC7E, 0x49F1, 0x8A, 0xDF, 0xA7, 0x0D, 0x07, 0xA9, 0xBC, 0xAB, 100);
-
-//  Name:     System.GPS.Date -- PKEY_GPS_Date
-//  Type:     DateTime -- VT_FILETIME  (For variants: VT_DATE)
-//  FormatID: 3602C812-0F3B-45F0-85AD-603468D69423, 100
-//
-//  Date and time of the GPS record
-DEFINE_PROPERTYKEY(PKEY_GPS_Date, 0x3602C812, 0x0F3B, 0x45F0, 0x85, 0xAD, 0x60, 0x34, 0x68, 0xD6, 0x94, 0x23, 100);
-
-//  Name:     System.GPS.DestBearing -- PKEY_GPS_DestBearing
-//  Type:     Double -- VT_R8
-//  FormatID: C66D4B3C-E888-47CC-B99F-9DCA3EE34DEA, 100
-//  
-//  Indicates the bearing to the destination point.  Calculated from PKEY_GPS_DestBearingNumerator and 
-//  PKEY_GPS_DestBearingDenominator.
-DEFINE_PROPERTYKEY(PKEY_GPS_DestBearing, 0xC66D4B3C, 0xE888, 0x47CC, 0xB9, 0x9F, 0x9D, 0xCA, 0x3E, 0xE3, 0x4D, 0xEA, 100);
-
-//  Name:     System.GPS.DestBearingDenominator -- PKEY_GPS_DestBearingDenominator
-//  Type:     UInt32 -- VT_UI4
-//  FormatID: 7ABCF4F8-7C3F-4988-AC91-8D2C2E97ECA5, 100
-//
-//  Denominator of PKEY_GPS_DestBearing
-DEFINE_PROPERTYKEY(PKEY_GPS_DestBearingDenominator, 0x7ABCF4F8, 0x7C3F, 0x4988, 0xAC, 0x91, 0x8D, 0x2C, 0x2E, 0x97, 0xEC, 0xA5, 100);
-
-//  Name:     System.GPS.DestBearingNumerator -- PKEY_GPS_DestBearingNumerator
-//  Type:     UInt32 -- VT_UI4
-//  FormatID: BA3B1DA9-86EE-4B5D-A2A4-A271A429F0CF, 100
-//
-//  Numerator of PKEY_GPS_DestBearing
-DEFINE_PROPERTYKEY(PKEY_GPS_DestBearingNumerator, 0xBA3B1DA9, 0x86EE, 0x4B5D, 0xA2, 0xA4, 0xA2, 0x71, 0xA4, 0x29, 0xF0, 0xCF, 100);
-
-//  Name:     System.GPS.DestBearingRef -- PKEY_GPS_DestBearingRef
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 9AB84393-2A0F-4B75-BB22-7279786977CB, 100
-//
-//  Indicates the reference used for the giving the bearing to the destination point.  (eg: true direction, magnetic direction)
-DEFINE_PROPERTYKEY(PKEY_GPS_DestBearingRef, 0x9AB84393, 0x2A0F, 0x4B75, 0xBB, 0x22, 0x72, 0x79, 0x78, 0x69, 0x77, 0xCB, 100);
-
-//  Name:     System.GPS.DestDistance -- PKEY_GPS_DestDistance
-//  Type:     Double -- VT_R8
-//  FormatID: A93EAE04-6804-4F24-AC81-09B266452118, 100
-//  
-//  Indicates the distance to the destination point.  Calculated from PKEY_GPS_DestDistanceNumerator and 
-//  PKEY_GPS_DestDistanceDenominator.
-DEFINE_PROPERTYKEY(PKEY_GPS_DestDistance, 0xA93EAE04, 0x6804, 0x4F24, 0xAC, 0x81, 0x09, 0xB2, 0x66, 0x45, 0x21, 0x18, 100);
-
-//  Name:     System.GPS.DestDistanceDenominator -- PKEY_GPS_DestDistanceDenominator
-//  Type:     UInt32 -- VT_UI4
-//  FormatID: 9BC2C99B-AC71-4127-9D1C-2596D0D7DCB7, 100
-//
-//  Denominator of PKEY_GPS_DestDistance
-DEFINE_PROPERTYKEY(PKEY_GPS_DestDistanceDenominator, 0x9BC2C99B, 0xAC71, 0x4127, 0x9D, 0x1C, 0x25, 0x96, 0xD0, 0xD7, 0xDC, 0xB7, 100);
-
-//  Name:     System.GPS.DestDistanceNumerator -- PKEY_GPS_DestDistanceNumerator
-//  Type:     UInt32 -- VT_UI4
-//  FormatID: 2BDA47DA-08C6-4FE1-80BC-A72FC517C5D0, 100
-//
-//  Numerator of PKEY_GPS_DestDistance
-DEFINE_PROPERTYKEY(PKEY_GPS_DestDistanceNumerator, 0x2BDA47DA, 0x08C6, 0x4FE1, 0x80, 0xBC, 0xA7, 0x2F, 0xC5, 0x17, 0xC5, 0xD0, 100);
-
-//  Name:     System.GPS.DestDistanceRef -- PKEY_GPS_DestDistanceRef
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: ED4DF2D3-8695-450B-856F-F5C1C53ACB66, 100
-//
-//  Indicates the unit used to express the distance to the destination.  (eg: kilometers, miles, knots)
-DEFINE_PROPERTYKEY(PKEY_GPS_DestDistanceRef, 0xED4DF2D3, 0x8695, 0x450B, 0x85, 0x6F, 0xF5, 0xC1, 0xC5, 0x3A, 0xCB, 0x66, 100);
-
-//  Name:     System.GPS.DestLatitude -- PKEY_GPS_DestLatitude
-//  Type:     Multivalue Double -- VT_VECTOR | VT_R8  (For variants: VT_ARRAY | VT_R8)
-//  FormatID: 9D1D7CC5-5C39-451C-86B3-928E2D18CC47, 100
-//  
-//  Indicates the latitude of the destination point.  This is an array of three values.  Index 0 is the degrees, index 1 
-//  is the minutes, index 2 is the seconds.  Each is calculated from the values in PKEY_GPS_DestLatitudeNumerator and 
-//  PKEY_GPS_DestLatitudeDenominator.
-DEFINE_PROPERTYKEY(PKEY_GPS_DestLatitude, 0x9D1D7CC5, 0x5C39, 0x451C, 0x86, 0xB3, 0x92, 0x8E, 0x2D, 0x18, 0xCC, 0x47, 100);
-
-//  Name:     System.GPS.DestLatitudeDenominator -- PKEY_GPS_DestLatitudeDenominator
-//  Type:     Multivalue UInt32 -- VT_VECTOR | VT_UI4  (For variants: VT_ARRAY | VT_UI4)
-//  FormatID: 3A372292-7FCA-49A7-99D5-E47BB2D4E7AB, 100
-//
-//  Denominator of PKEY_GPS_DestLatitude
-DEFINE_PROPERTYKEY(PKEY_GPS_DestLatitudeDenominator, 0x3A372292, 0x7FCA, 0x49A7, 0x99, 0xD5, 0xE4, 0x7B, 0xB2, 0xD4, 0xE7, 0xAB, 100);
-
-//  Name:     System.GPS.DestLatitudeNumerator -- PKEY_GPS_DestLatitudeNumerator
-//  Type:     Multivalue UInt32 -- VT_VECTOR | VT_UI4  (For variants: VT_ARRAY | VT_UI4)
-//  FormatID: ECF4B6F6-D5A6-433C-BB92-4076650FC890, 100
-//
-//  Numerator of PKEY_GPS_DestLatitude
-DEFINE_PROPERTYKEY(PKEY_GPS_DestLatitudeNumerator, 0xECF4B6F6, 0xD5A6, 0x433C, 0xBB, 0x92, 0x40, 0x76, 0x65, 0x0F, 0xC8, 0x90, 100);
-
-//  Name:     System.GPS.DestLatitudeRef -- PKEY_GPS_DestLatitudeRef
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: CEA820B9-CE61-4885-A128-005D9087C192, 100
-//
-//  Indicates whether the latitude destination point is north or south latitude
-DEFINE_PROPERTYKEY(PKEY_GPS_DestLatitudeRef, 0xCEA820B9, 0xCE61, 0x4885, 0xA1, 0x28, 0x00, 0x5D, 0x90, 0x87, 0xC1, 0x92, 100);
-
-//  Name:     System.GPS.DestLongitude -- PKEY_GPS_DestLongitude
-//  Type:     Multivalue Double -- VT_VECTOR | VT_R8  (For variants: VT_ARRAY | VT_R8)
-//  FormatID: 47A96261-CB4C-4807-8AD3-40B9D9DBC6BC, 100
-//  
-//  Indicates the latitude of the destination point.  This is an array of three values.  Index 0 is the degrees, index 1 
-//  is the minutes, index 2 is the seconds.  Each is calculated from the values in PKEY_GPS_DestLongitudeNumerator and 
-//  PKEY_GPS_DestLongitudeDenominator.
-DEFINE_PROPERTYKEY(PKEY_GPS_DestLongitude, 0x47A96261, 0xCB4C, 0x4807, 0x8A, 0xD3, 0x40, 0xB9, 0xD9, 0xDB, 0xC6, 0xBC, 100);
-
-//  Name:     System.GPS.DestLongitudeDenominator -- PKEY_GPS_DestLongitudeDenominator
-//  Type:     Multivalue UInt32 -- VT_VECTOR | VT_UI4  (For variants: VT_ARRAY | VT_UI4)
-//  FormatID: 425D69E5-48AD-4900-8D80-6EB6B8D0AC86, 100
-//
-//  Denominator of PKEY_GPS_DestLongitude
-DEFINE_PROPERTYKEY(PKEY_GPS_DestLongitudeDenominator, 0x425D69E5, 0x48AD, 0x4900, 0x8D, 0x80, 0x6E, 0xB6, 0xB8, 0xD0, 0xAC, 0x86, 100);
-
-//  Name:     System.GPS.DestLongitudeNumerator -- PKEY_GPS_DestLongitudeNumerator
-//  Type:     Multivalue UInt32 -- VT_VECTOR | VT_UI4  (For variants: VT_ARRAY | VT_UI4)
-//  FormatID: A3250282-FB6D-48D5-9A89-DBCACE75CCCF, 100
-//
-//  Numerator of PKEY_GPS_DestLongitude
-DEFINE_PROPERTYKEY(PKEY_GPS_DestLongitudeNumerator, 0xA3250282, 0xFB6D, 0x48D5, 0x9A, 0x89, 0xDB, 0xCA, 0xCE, 0x75, 0xCC, 0xCF, 100);
-
-//  Name:     System.GPS.DestLongitudeRef -- PKEY_GPS_DestLongitudeRef
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 182C1EA6-7C1C-4083-AB4B-AC6C9F4ED128, 100
-//
-//  Indicates whether the longitude destination point is east or west longitude
-DEFINE_PROPERTYKEY(PKEY_GPS_DestLongitudeRef, 0x182C1EA6, 0x7C1C, 0x4083, 0xAB, 0x4B, 0xAC, 0x6C, 0x9F, 0x4E, 0xD1, 0x28, 100);
-
-//  Name:     System.GPS.Differential -- PKEY_GPS_Differential
-//  Type:     UInt16 -- VT_UI2
-//  FormatID: AAF4EE25-BD3B-4DD7-BFC4-47F77BB00F6D, 100
-//
-//  Indicates whether differential correction was applied to the GPS receiver
-DEFINE_PROPERTYKEY(PKEY_GPS_Differential, 0xAAF4EE25, 0xBD3B, 0x4DD7, 0xBF, 0xC4, 0x47, 0xF7, 0x7B, 0xB0, 0x0F, 0x6D, 100);
-
-//  Name:     System.GPS.DOP -- PKEY_GPS_DOP
-//  Type:     Double -- VT_R8
-//  FormatID: 0CF8FB02-1837-42F1-A697-A7017AA289B9, 100
-//
-//  Indicates the GPS DOP (data degree of precision).  Calculated from PKEY_GPS_DOPNumerator and PKEY_GPS_DOPDenominator
-DEFINE_PROPERTYKEY(PKEY_GPS_DOP, 0x0CF8FB02, 0x1837, 0x42F1, 0xA6, 0x97, 0xA7, 0x01, 0x7A, 0xA2, 0x89, 0xB9, 100);
-
-//  Name:     System.GPS.DOPDenominator -- PKEY_GPS_DOPDenominator
-//  Type:     UInt32 -- VT_UI4
-//  FormatID: A0BE94C5-50BA-487B-BD35-0654BE8881ED, 100
-//
-//  Denominator of PKEY_GPS_DOP
-DEFINE_PROPERTYKEY(PKEY_GPS_DOPDenominator, 0xA0BE94C5, 0x50BA, 0x487B, 0xBD, 0x35, 0x06, 0x54, 0xBE, 0x88, 0x81, 0xED, 100);
-
-//  Name:     System.GPS.DOPNumerator -- PKEY_GPS_DOPNumerator
-//  Type:     UInt32 -- VT_UI4
-//  FormatID: 47166B16-364F-4AA0-9F31-E2AB3DF449C3, 100
-//
-//  Numerator of PKEY_GPS_DOP
-DEFINE_PROPERTYKEY(PKEY_GPS_DOPNumerator, 0x47166B16, 0x364F, 0x4AA0, 0x9F, 0x31, 0xE2, 0xAB, 0x3D, 0xF4, 0x49, 0xC3, 100);
-
-//  Name:     System.GPS.ImgDirection -- PKEY_GPS_ImgDirection
-//  Type:     Double -- VT_R8
-//  FormatID: 16473C91-D017-4ED9-BA4D-B6BAA55DBCF8, 100
-//  
-//  Indicates direction of the image when it was captured.  Calculated from PKEY_GPS_ImgDirectionNumerator and 
-//  PKEY_GPS_ImgDirectionDenominator.
-DEFINE_PROPERTYKEY(PKEY_GPS_ImgDirection, 0x16473C91, 0xD017, 0x4ED9, 0xBA, 0x4D, 0xB6, 0xBA, 0xA5, 0x5D, 0xBC, 0xF8, 100);
-
-//  Name:     System.GPS.ImgDirectionDenominator -- PKEY_GPS_ImgDirectionDenominator
-//  Type:     UInt32 -- VT_UI4
-//  FormatID: 10B24595-41A2-4E20-93C2-5761C1395F32, 100
-//
-//  Denominator of PKEY_GPS_ImgDirection
-DEFINE_PROPERTYKEY(PKEY_GPS_ImgDirectionDenominator, 0x10B24595, 0x41A2, 0x4E20, 0x93, 0xC2, 0x57, 0x61, 0xC1, 0x39, 0x5F, 0x32, 100);
-
-//  Name:     System.GPS.ImgDirectionNumerator -- PKEY_GPS_ImgDirectionNumerator
-//  Type:     UInt32 -- VT_UI4
-//  FormatID: DC5877C7-225F-45F7-BAC7-E81334B6130A, 100
-//
-//  Numerator of PKEY_GPS_ImgDirection
-DEFINE_PROPERTYKEY(PKEY_GPS_ImgDirectionNumerator, 0xDC5877C7, 0x225F, 0x45F7, 0xBA, 0xC7, 0xE8, 0x13, 0x34, 0xB6, 0x13, 0x0A, 100);
-
-//  Name:     System.GPS.ImgDirectionRef -- PKEY_GPS_ImgDirectionRef
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: A4AAA5B7-1AD0-445F-811A-0F8F6E67F6B5, 100
-//
-//  Indicates reference for giving the direction of the image when it was captured.  (eg: true direction, magnetic direction)
-DEFINE_PROPERTYKEY(PKEY_GPS_ImgDirectionRef, 0xA4AAA5B7, 0x1AD0, 0x445F, 0x81, 0x1A, 0x0F, 0x8F, 0x6E, 0x67, 0xF6, 0xB5, 100);
-
-//  Name:     System.GPS.Latitude -- PKEY_GPS_Latitude
-//  Type:     Multivalue Double -- VT_VECTOR | VT_R8  (For variants: VT_ARRAY | VT_R8)
-//  FormatID: 8727CFFF-4868-4EC6-AD5B-81B98521D1AB, 100
-//  
-//  Indicates the latitude.  This is an array of three values.  Index 0 is the degrees, index 1 is the minutes, index 2 
-//  is the seconds.  Each is calculated from the values in PKEY_GPS_LatitudeNumerator and PKEY_GPS_LatitudeDenominator.
-DEFINE_PROPERTYKEY(PKEY_GPS_Latitude, 0x8727CFFF, 0x4868, 0x4EC6, 0xAD, 0x5B, 0x81, 0xB9, 0x85, 0x21, 0xD1, 0xAB, 100);
-
-//  Name:     System.GPS.LatitudeDenominator -- PKEY_GPS_LatitudeDenominator
-//  Type:     Multivalue UInt32 -- VT_VECTOR | VT_UI4  (For variants: VT_ARRAY | VT_UI4)
-//  FormatID: 16E634EE-2BFF-497B-BD8A-4341AD39EEB9, 100
-//
-//  Denominator of PKEY_GPS_Latitude
-DEFINE_PROPERTYKEY(PKEY_GPS_LatitudeDenominator, 0x16E634EE, 0x2BFF, 0x497B, 0xBD, 0x8A, 0x43, 0x41, 0xAD, 0x39, 0xEE, 0xB9, 100);
-
-//  Name:     System.GPS.LatitudeNumerator -- PKEY_GPS_LatitudeNumerator
-//  Type:     Multivalue UInt32 -- VT_VECTOR | VT_UI4  (For variants: VT_ARRAY | VT_UI4)
-//  FormatID: 7DDAAAD1-CCC8-41AE-B750-B2CB8031AEA2, 100
-//
-//  Numerator of PKEY_GPS_Latitude
-DEFINE_PROPERTYKEY(PKEY_GPS_LatitudeNumerator, 0x7DDAAAD1, 0xCCC8, 0x41AE, 0xB7, 0x50, 0xB2, 0xCB, 0x80, 0x31, 0xAE, 0xA2, 100);
-
-//  Name:     System.GPS.LatitudeRef -- PKEY_GPS_LatitudeRef
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 029C0252-5B86-46C7-ACA0-2769FFC8E3D4, 100
-//
-//  Indicates whether latitude is north or south latitude 
-DEFINE_PROPERTYKEY(PKEY_GPS_LatitudeRef, 0x029C0252, 0x5B86, 0x46C7, 0xAC, 0xA0, 0x27, 0x69, 0xFF, 0xC8, 0xE3, 0xD4, 100);
-
-//  Name:     System.GPS.Longitude -- PKEY_GPS_Longitude
-//  Type:     Multivalue Double -- VT_VECTOR | VT_R8  (For variants: VT_ARRAY | VT_R8)
-//  FormatID: C4C4DBB2-B593-466B-BBDA-D03D27D5E43A, 100
-//  
-//  Indicates the longitude.  This is an array of three values.  Index 0 is the degrees, index 1 is the minutes, index 2 
-//  is the seconds.  Each is calculated from the values in PKEY_GPS_LongitudeNumerator and PKEY_GPS_LongitudeDenominator.
-DEFINE_PROPERTYKEY(PKEY_GPS_Longitude, 0xC4C4DBB2, 0xB593, 0x466B, 0xBB, 0xDA, 0xD0, 0x3D, 0x27, 0xD5, 0xE4, 0x3A, 100);
-
-//  Name:     System.GPS.LongitudeDenominator -- PKEY_GPS_LongitudeDenominator
-//  Type:     Multivalue UInt32 -- VT_VECTOR | VT_UI4  (For variants: VT_ARRAY | VT_UI4)
-//  FormatID: BE6E176C-4534-4D2C-ACE5-31DEDAC1606B, 100
-//
-//  Denominator of PKEY_GPS_Longitude
-DEFINE_PROPERTYKEY(PKEY_GPS_LongitudeDenominator, 0xBE6E176C, 0x4534, 0x4D2C, 0xAC, 0xE5, 0x31, 0xDE, 0xDA, 0xC1, 0x60, 0x6B, 100);
-
-//  Name:     System.GPS.LongitudeNumerator -- PKEY_GPS_LongitudeNumerator
-//  Type:     Multivalue UInt32 -- VT_VECTOR | VT_UI4  (For variants: VT_ARRAY | VT_UI4)
-//  FormatID: 02B0F689-A914-4E45-821D-1DDA452ED2C4, 100
-//
-//  Numerator of PKEY_GPS_Longitude
-DEFINE_PROPERTYKEY(PKEY_GPS_LongitudeNumerator, 0x02B0F689, 0xA914, 0x4E45, 0x82, 0x1D, 0x1D, 0xDA, 0x45, 0x2E, 0xD2, 0xC4, 100);
-
-//  Name:     System.GPS.LongitudeRef -- PKEY_GPS_LongitudeRef
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 33DCF22B-28D5-464C-8035-1EE9EFD25278, 100
-//
-//  Indicates whether longitude is east or west longitude
-DEFINE_PROPERTYKEY(PKEY_GPS_LongitudeRef, 0x33DCF22B, 0x28D5, 0x464C, 0x80, 0x35, 0x1E, 0xE9, 0xEF, 0xD2, 0x52, 0x78, 100);
-
-//  Name:     System.GPS.MapDatum -- PKEY_GPS_MapDatum
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 2CA2DAE6-EDDC-407D-BEF1-773942ABFA95, 100
-//
-//  Indicates the geodetic survey data used by the GPS receiver
-DEFINE_PROPERTYKEY(PKEY_GPS_MapDatum, 0x2CA2DAE6, 0xEDDC, 0x407D, 0xBE, 0xF1, 0x77, 0x39, 0x42, 0xAB, 0xFA, 0x95, 100);
-
-//  Name:     System.GPS.MeasureMode -- PKEY_GPS_MeasureMode
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: A015ED5D-AAEA-4D58-8A86-3C586920EA0B, 100
-//
-//  Indicates the GPS measurement mode.  (eg: 2-dimensional, 3-dimensional)
-DEFINE_PROPERTYKEY(PKEY_GPS_MeasureMode, 0xA015ED5D, 0xAAEA, 0x4D58, 0x8A, 0x86, 0x3C, 0x58, 0x69, 0x20, 0xEA, 0x0B, 100);
-
-//  Name:     System.GPS.ProcessingMethod -- PKEY_GPS_ProcessingMethod
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 59D49E61-840F-4AA9-A939-E2099B7F6399, 100
-//
-//  Indicates the name of the method used for location finding
-DEFINE_PROPERTYKEY(PKEY_GPS_ProcessingMethod, 0x59D49E61, 0x840F, 0x4AA9, 0xA9, 0x39, 0xE2, 0x09, 0x9B, 0x7F, 0x63, 0x99, 100);
-
-//  Name:     System.GPS.Satellites -- PKEY_GPS_Satellites
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 467EE575-1F25-4557-AD4E-B8B58B0D9C15, 100
-//
-//  Indicates the GPS satellites used for measurements
-DEFINE_PROPERTYKEY(PKEY_GPS_Satellites, 0x467EE575, 0x1F25, 0x4557, 0xAD, 0x4E, 0xB8, 0xB5, 0x8B, 0x0D, 0x9C, 0x15, 100);
-
-//  Name:     System.GPS.Speed -- PKEY_GPS_Speed
-//  Type:     Double -- VT_R8
-//  FormatID: DA5D0862-6E76-4E1B-BABD-70021BD25494, 100
-//  
-//  Indicates the speed of the GPS receiver movement.  Calculated from PKEY_GPS_SpeedNumerator and 
-//  PKEY_GPS_SpeedDenominator.
-DEFINE_PROPERTYKEY(PKEY_GPS_Speed, 0xDA5D0862, 0x6E76, 0x4E1B, 0xBA, 0xBD, 0x70, 0x02, 0x1B, 0xD2, 0x54, 0x94, 100);
-
-//  Name:     System.GPS.SpeedDenominator -- PKEY_GPS_SpeedDenominator
-//  Type:     UInt32 -- VT_UI4
-//  FormatID: 7D122D5A-AE5E-4335-8841-D71E7CE72F53, 100
-//
-//  Denominator of PKEY_GPS_Speed
-DEFINE_PROPERTYKEY(PKEY_GPS_SpeedDenominator, 0x7D122D5A, 0xAE5E, 0x4335, 0x88, 0x41, 0xD7, 0x1E, 0x7C, 0xE7, 0x2F, 0x53, 100);
-
-//  Name:     System.GPS.SpeedNumerator -- PKEY_GPS_SpeedNumerator
-//  Type:     UInt32 -- VT_UI4
-//  FormatID: ACC9CE3D-C213-4942-8B48-6D0820F21C6D, 100
-//
-//  Numerator of PKEY_GPS_Speed
-DEFINE_PROPERTYKEY(PKEY_GPS_SpeedNumerator, 0xACC9CE3D, 0xC213, 0x4942, 0x8B, 0x48, 0x6D, 0x08, 0x20, 0xF2, 0x1C, 0x6D, 100);
-
-//  Name:     System.GPS.SpeedRef -- PKEY_GPS_SpeedRef
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: ECF7F4C9-544F-4D6D-9D98-8AD79ADAF453, 100
-//  
-//  Indicates the unit used to express the speed of the GPS receiver movement.  (eg: kilometers per hour, 
-//  miles per hour, knots).
-DEFINE_PROPERTYKEY(PKEY_GPS_SpeedRef, 0xECF7F4C9, 0x544F, 0x4D6D, 0x9D, 0x98, 0x8A, 0xD7, 0x9A, 0xDA, 0xF4, 0x53, 100);
-
-//  Name:     System.GPS.Status -- PKEY_GPS_Status
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 125491F4-818F-46B2-91B5-D537753617B2, 100
-//  
-//  Indicates the status of the GPS receiver when the image was recorded.  (eg: measurement in progress, 
-//  measurement interoperability).
-DEFINE_PROPERTYKEY(PKEY_GPS_Status, 0x125491F4, 0x818F, 0x46B2, 0x91, 0xB5, 0xD5, 0x37, 0x75, 0x36, 0x17, 0xB2, 100);
-
-//  Name:     System.GPS.Track -- PKEY_GPS_Track
-//  Type:     Double -- VT_R8
-//  FormatID: 76C09943-7C33-49E3-9E7E-CDBA872CFADA, 100
-//  
-//  Indicates the direction of the GPS receiver movement.  Calculated from PKEY_GPS_TrackNumerator and 
-//  PKEY_GPS_TrackDenominator.
-DEFINE_PROPERTYKEY(PKEY_GPS_Track, 0x76C09943, 0x7C33, 0x49E3, 0x9E, 0x7E, 0xCD, 0xBA, 0x87, 0x2C, 0xFA, 0xDA, 100);
-
-//  Name:     System.GPS.TrackDenominator -- PKEY_GPS_TrackDenominator
-//  Type:     UInt32 -- VT_UI4
-//  FormatID: C8D1920C-01F6-40C0-AC86-2F3A4AD00770, 100
-//
-//  Denominator of PKEY_GPS_Track
-DEFINE_PROPERTYKEY(PKEY_GPS_TrackDenominator, 0xC8D1920C, 0x01F6, 0x40C0, 0xAC, 0x86, 0x2F, 0x3A, 0x4A, 0xD0, 0x07, 0x70, 100);
-
-//  Name:     System.GPS.TrackNumerator -- PKEY_GPS_TrackNumerator
-//  Type:     UInt32 -- VT_UI4
-//  FormatID: 702926F4-44A6-43E1-AE71-45627116893B, 100
-//
-//  Numerator of PKEY_GPS_Track
-DEFINE_PROPERTYKEY(PKEY_GPS_TrackNumerator, 0x702926F4, 0x44A6, 0x43E1, 0xAE, 0x71, 0x45, 0x62, 0x71, 0x16, 0x89, 0x3B, 100);
-
-//  Name:     System.GPS.TrackRef -- PKEY_GPS_TrackRef
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 35DBE6FE-44C3-4400-AAAE-D2C799C407E8, 100
-//
-//  Indicates reference for the direction of the GPS receiver movement.  (eg: true direction, magnetic direction)
-DEFINE_PROPERTYKEY(PKEY_GPS_TrackRef, 0x35DBE6FE, 0x44C3, 0x4400, 0xAA, 0xAE, 0xD2, 0xC7, 0x99, 0xC4, 0x07, 0xE8, 100);
-
-//  Name:     System.GPS.VersionID -- PKEY_GPS_VersionID
-//  Type:     Buffer -- VT_VECTOR | VT_UI1  (For variants: VT_ARRAY | VT_UI1)
-//  FormatID: 22704DA4-C6B2-4A99-8E56-F16DF8C92599, 100
-//
-//  Indicates the version of the GPS information
-DEFINE_PROPERTYKEY(PKEY_GPS_VersionID, 0x22704DA4, 0xC6B2, 0x4A99, 0x8E, 0x56, 0xF1, 0x6D, 0xF8, 0xC9, 0x25, 0x99, 100);
- 
-//-----------------------------------------------------------------------------
-// Image properties
-
-
-
-//  Name:     System.Image.BitDepth -- PKEY_Image_BitDepth
-//  Type:     UInt32 -- VT_UI4
-//  FormatID: (PSGUID_IMAGESUMMARYINFORMATION) 6444048F-4C8B-11D1-8B70-080036B11A03, 7 (PIDISI_BITDEPTH)
-//
-//  
-DEFINE_PROPERTYKEY(PKEY_Image_BitDepth, 0x6444048F, 0x4C8B, 0x11D1, 0x8B, 0x70, 0x08, 0x00, 0x36, 0xB1, 0x1A, 0x03, 7);
-
-//  Name:     System.Image.ColorSpace -- PKEY_Image_ColorSpace
-//  Type:     UInt16 -- VT_UI2
-//  FormatID: (FMTID_ImageProperties) 14B81DA1-0135-4D31-96D9-6CBFC9671A99, 40961
-//
-//  PropertyTagExifColorSpace
-DEFINE_PROPERTYKEY(PKEY_Image_ColorSpace, 0x14B81DA1, 0x0135, 0x4D31, 0x96, 0xD9, 0x6C, 0xBF, 0xC9, 0x67, 0x1A, 0x99, 40961);
-
-// Possible discrete values for PKEY_Image_ColorSpace are:
-#define IMAGE_COLORSPACE_SRGB               1u
-#define IMAGE_COLORSPACE_UNCALIBRATED       0xFFFFu
-
-//  Name:     System.Image.CompressedBitsPerPixel -- PKEY_Image_CompressedBitsPerPixel
-//  Type:     Double -- VT_R8
-//  FormatID: 364B6FA9-37AB-482A-BE2B-AE02F60D4318, 100
-//
-//  Calculated from PKEY_Image_CompressedBitsPerPixelNumerator and PKEY_Image_CompressedBitsPerPixelDenominator.
-DEFINE_PROPERTYKEY(PKEY_Image_CompressedBitsPerPixel, 0x364B6FA9, 0x37AB, 0x482A, 0xBE, 0x2B, 0xAE, 0x02, 0xF6, 0x0D, 0x43, 0x18, 100);
-
-//  Name:     System.Image.CompressedBitsPerPixelDenominator -- PKEY_Image_CompressedBitsPerPixelDenominator
-//  Type:     UInt32 -- VT_UI4
-//  FormatID: 1F8844E1-24AD-4508-9DFD-5326A415CE02, 100
-//
-//  Denominator of PKEY_Image_CompressedBitsPerPixel.
-DEFINE_PROPERTYKEY(PKEY_Image_CompressedBitsPerPixelDenominator, 0x1F8844E1, 0x24AD, 0x4508, 0x9D, 0xFD, 0x53, 0x26, 0xA4, 0x15, 0xCE, 0x02, 100);
-
-//  Name:     System.Image.CompressedBitsPerPixelNumerator -- PKEY_Image_CompressedBitsPerPixelNumerator
-//  Type:     UInt32 -- VT_UI4
-//  FormatID: D21A7148-D32C-4624-8900-277210F79C0F, 100
-//
-//  Numerator of PKEY_Image_CompressedBitsPerPixel.
-DEFINE_PROPERTYKEY(PKEY_Image_CompressedBitsPerPixelNumerator, 0xD21A7148, 0xD32C, 0x4624, 0x89, 0x00, 0x27, 0x72, 0x10, 0xF7, 0x9C, 0x0F, 100);
-
-//  Name:     System.Image.Compression -- PKEY_Image_Compression
-//  Type:     UInt16 -- VT_UI2
-//  FormatID: (FMTID_ImageProperties) 14B81DA1-0135-4D31-96D9-6CBFC9671A99, 259
-//
-//  Indicates the image compression level.  PropertyTagCompression.
-DEFINE_PROPERTYKEY(PKEY_Image_Compression, 0x14B81DA1, 0x0135, 0x4D31, 0x96, 0xD9, 0x6C, 0xBF, 0xC9, 0x67, 0x1A, 0x99, 259);
-
-// Possible discrete values for PKEY_Image_Compression are:
-#define IMAGE_COMPRESSION_UNCOMPRESSED      1u
-#define IMAGE_COMPRESSION_CCITT_T3          2u
-#define IMAGE_COMPRESSION_CCITT_T4          3u
-#define IMAGE_COMPRESSION_CCITT_T6          4u
-#define IMAGE_COMPRESSION_LZW               5u
-#define IMAGE_COMPRESSION_JPEG              6u
-#define IMAGE_COMPRESSION_PACKBITS          32773u
-
-//  Name:     System.Image.CompressionText -- PKEY_Image_CompressionText
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 3F08E66F-2F44-4BB9-A682-AC35D2562322, 100
-//  
-//  This is the user-friendly form of System.Image.Compression.  Not intended to be parsed 
-//  programmatically.
-DEFINE_PROPERTYKEY(PKEY_Image_CompressionText, 0x3F08E66F, 0x2F44, 0x4BB9, 0xA6, 0x82, 0xAC, 0x35, 0xD2, 0x56, 0x23, 0x22, 100);
-
-//  Name:     System.Image.Dimensions -- PKEY_Image_Dimensions
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: (PSGUID_IMAGESUMMARYINFORMATION) 6444048F-4C8B-11D1-8B70-080036B11A03, 13 (PIDISI_DIMENSIONS)
-//
-//  Indicates the dimensions of the image.
-DEFINE_PROPERTYKEY(PKEY_Image_Dimensions, 0x6444048F, 0x4C8B, 0x11D1, 0x8B, 0x70, 0x08, 0x00, 0x36, 0xB1, 0x1A, 0x03, 13);
-
-//  Name:     System.Image.HorizontalResolution -- PKEY_Image_HorizontalResolution
-//  Type:     Double -- VT_R8
-//  FormatID: (PSGUID_IMAGESUMMARYINFORMATION) 6444048F-4C8B-11D1-8B70-080036B11A03, 5 (PIDISI_RESOLUTIONX)
-//
-//  
-DEFINE_PROPERTYKEY(PKEY_Image_HorizontalResolution, 0x6444048F, 0x4C8B, 0x11D1, 0x8B, 0x70, 0x08, 0x00, 0x36, 0xB1, 0x1A, 0x03, 5);
-
-//  Name:     System.Image.HorizontalSize -- PKEY_Image_HorizontalSize
-//  Type:     UInt32 -- VT_UI4
-//  FormatID: (PSGUID_IMAGESUMMARYINFORMATION) 6444048F-4C8B-11D1-8B70-080036B11A03, 3 (PIDISI_CX)
-//
-//  
-DEFINE_PROPERTYKEY(PKEY_Image_HorizontalSize, 0x6444048F, 0x4C8B, 0x11D1, 0x8B, 0x70, 0x08, 0x00, 0x36, 0xB1, 0x1A, 0x03, 3);
-
-//  Name:     System.Image.ImageID -- PKEY_Image_ImageID
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 10DABE05-32AA-4C29-BF1A-63E2D220587F, 100
-DEFINE_PROPERTYKEY(PKEY_Image_ImageID, 0x10DABE05, 0x32AA, 0x4C29, 0xBF, 0x1A, 0x63, 0xE2, 0xD2, 0x20, 0x58, 0x7F, 100);
-
-//  Name:     System.Image.ResolutionUnit -- PKEY_Image_ResolutionUnit
-//  Type:     Int16 -- VT_I2
-//  FormatID: 19B51FA6-1F92-4A5C-AB48-7DF0ABD67444, 100
-DEFINE_PROPERTYKEY(PKEY_Image_ResolutionUnit, 0x19B51FA6, 0x1F92, 0x4A5C, 0xAB, 0x48, 0x7D, 0xF0, 0xAB, 0xD6, 0x74, 0x44, 100);
-
-//  Name:     System.Image.VerticalResolution -- PKEY_Image_VerticalResolution
-//  Type:     Double -- VT_R8
-//  FormatID: (PSGUID_IMAGESUMMARYINFORMATION) 6444048F-4C8B-11D1-8B70-080036B11A03, 6 (PIDISI_RESOLUTIONY)
-//
-//  
-DEFINE_PROPERTYKEY(PKEY_Image_VerticalResolution, 0x6444048F, 0x4C8B, 0x11D1, 0x8B, 0x70, 0x08, 0x00, 0x36, 0xB1, 0x1A, 0x03, 6);
-
-//  Name:     System.Image.VerticalSize -- PKEY_Image_VerticalSize
-//  Type:     UInt32 -- VT_UI4
-//  FormatID: (PSGUID_IMAGESUMMARYINFORMATION) 6444048F-4C8B-11D1-8B70-080036B11A03, 4 (PIDISI_CY)
-//
-//  
-DEFINE_PROPERTYKEY(PKEY_Image_VerticalSize, 0x6444048F, 0x4C8B, 0x11D1, 0x8B, 0x70, 0x08, 0x00, 0x36, 0xB1, 0x1A, 0x03, 4);
-
- 
- 
-//-----------------------------------------------------------------------------
-// Journal properties
-
-//  Name:     System.Journal.Contacts -- PKEY_Journal_Contacts
-//  Type:     Multivalue String -- VT_VECTOR | VT_LPWSTR  (For variants: VT_ARRAY | VT_BSTR)
-//  FormatID: DEA7C82C-1D89-4A66-9427-A4E3DEBABCB1, 100
-DEFINE_PROPERTYKEY(PKEY_Journal_Contacts, 0xDEA7C82C, 0x1D89, 0x4A66, 0x94, 0x27, 0xA4, 0xE3, 0xDE, 0xBA, 0xBC, 0xB1, 100);
-
-//  Name:     System.Journal.EntryType -- PKEY_Journal_EntryType
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 95BEB1FC-326D-4644-B396-CD3ED90E6DDF, 100
-DEFINE_PROPERTYKEY(PKEY_Journal_EntryType, 0x95BEB1FC, 0x326D, 0x4644, 0xB3, 0x96, 0xCD, 0x3E, 0xD9, 0x0E, 0x6D, 0xDF, 100);
- 
-//-----------------------------------------------------------------------------
-// Link properties
-
-
-
-//  Name:     System.Link.Comment -- PKEY_Link_Comment
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: (PSGUID_LINK) B9B4B3FC-2B51-4A42-B5D8-324146AFCF25, 5
-DEFINE_PROPERTYKEY(PKEY_Link_Comment, 0xB9B4B3FC, 0x2B51, 0x4A42, 0xB5, 0xD8, 0x32, 0x41, 0x46, 0xAF, 0xCF, 0x25, 5);
-
-//  Name:     System.Link.DateVisited -- PKEY_Link_DateVisited
-//  Type:     DateTime -- VT_FILETIME  (For variants: VT_DATE)
-//  FormatID: 5CBF2787-48CF-4208-B90E-EE5E5D420294, 23  (PKEYs relating to URLs.  Used by IE History.)
-DEFINE_PROPERTYKEY(PKEY_Link_DateVisited, 0x5CBF2787, 0x48CF, 0x4208, 0xB9, 0x0E, 0xEE, 0x5E, 0x5D, 0x42, 0x02, 0x94, 23);
-
-//  Name:     System.Link.Description -- PKEY_Link_Description
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 5CBF2787-48CF-4208-B90E-EE5E5D420294, 21  (PKEYs relating to URLs.  Used by IE History.)
-DEFINE_PROPERTYKEY(PKEY_Link_Description, 0x5CBF2787, 0x48CF, 0x4208, 0xB9, 0x0E, 0xEE, 0x5E, 0x5D, 0x42, 0x02, 0x94, 21);
-
-//  Name:     System.Link.Status -- PKEY_Link_Status
-//  Type:     Int32 -- VT_I4
-//  FormatID: (PSGUID_LINK) B9B4B3FC-2B51-4A42-B5D8-324146AFCF25, 3 (PID_LINK_TARGET_TYPE)
-//
-//  
-DEFINE_PROPERTYKEY(PKEY_Link_Status, 0xB9B4B3FC, 0x2B51, 0x4A42, 0xB5, 0xD8, 0x32, 0x41, 0x46, 0xAF, 0xCF, 0x25, 3);
-
-// Possible discrete values for PKEY_Link_Status are:
-#define LINK_STATUS_RESOLVED                1l
-#define LINK_STATUS_BROKEN                  2l
-
-//  Name:     System.Link.TargetExtension -- PKEY_Link_TargetExtension
-//  Type:     Multivalue String -- VT_VECTOR | VT_LPWSTR  (For variants: VT_ARRAY | VT_BSTR)
-//  FormatID: 7A7D76F4-B630-4BD7-95FF-37CC51A975C9, 2
-//
-//  The file extension of the link target.  See System.File.Extension
-DEFINE_PROPERTYKEY(PKEY_Link_TargetExtension, 0x7A7D76F4, 0xB630, 0x4BD7, 0x95, 0xFF, 0x37, 0xCC, 0x51, 0xA9, 0x75, 0xC9, 2);
-
-//  Name:     System.Link.TargetParsingPath -- PKEY_Link_TargetParsingPath
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: (PSGUID_LINK) B9B4B3FC-2B51-4A42-B5D8-324146AFCF25, 2 (PID_LINK_TARGET)
-//  
-//  This is the shell namespace path to the target of the link item.  This path may be passed to 
-//  SHParseDisplayName to parse the path to the correct shell folder.
-//  
-//  If the target item is a file, the value is identical to System.ItemPathDisplay.
-//  
-//  If the target item cannot be accessed through the shell namespace, this value is VT_EMPTY.
-DEFINE_PROPERTYKEY(PKEY_Link_TargetParsingPath, 0xB9B4B3FC, 0x2B51, 0x4A42, 0xB5, 0xD8, 0x32, 0x41, 0x46, 0xAF, 0xCF, 0x25, 2);
-
-//  Name:     System.Link.TargetSFGAOFlags -- PKEY_Link_TargetSFGAOFlags
-//  Type:     UInt32 -- VT_UI4
-//  FormatID: (PSGUID_LINK) B9B4B3FC-2B51-4A42-B5D8-324146AFCF25, 8
-//  
-//  IShellFolder::GetAttributesOf flags for the target of a link, with SFGAO_PKEYSFGAOMASK 
-//  attributes masked out.
-DEFINE_PROPERTYKEY(PKEY_Link_TargetSFGAOFlags, 0xB9B4B3FC, 0x2B51, 0x4A42, 0xB5, 0xD8, 0x32, 0x41, 0x46, 0xAF, 0xCF, 0x25, 8);
- 
-//-----------------------------------------------------------------------------
-// Media properties
-
-
-
-//  Name:     System.Media.AuthorUrl -- PKEY_Media_AuthorUrl
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) 64440492-4C8B-11D1-8B70-080036B11A03, 32 (PIDMSI_AUTHOR_URL)
-//
-//  
-DEFINE_PROPERTYKEY(PKEY_Media_AuthorUrl, 0x64440492, 0x4C8B, 0x11D1, 0x8B, 0x70, 0x08, 0x00, 0x36, 0xB1, 0x1A, 0x03, 32);
-
-//  Name:     System.Media.AverageLevel -- PKEY_Media_AverageLevel
-//  Type:     UInt32 -- VT_UI4
-//  FormatID: 09EDD5B6-B301-43C5-9990-D00302EFFD46, 100
-DEFINE_PROPERTYKEY(PKEY_Media_AverageLevel, 0x09EDD5B6, 0xB301, 0x43C5, 0x99, 0x90, 0xD0, 0x03, 0x02, 0xEF, 0xFD, 0x46, 100);
-
-//  Name:     System.Media.ClassPrimaryID -- PKEY_Media_ClassPrimaryID
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) 64440492-4C8B-11D1-8B70-080036B11A03, 13 (PIDMSI_CLASS_PRIMARY_ID)
-//
-//  
-DEFINE_PROPERTYKEY(PKEY_Media_ClassPrimaryID, 0x64440492, 0x4C8B, 0x11D1, 0x8B, 0x70, 0x08, 0x00, 0x36, 0xB1, 0x1A, 0x03, 13);
-
-//  Name:     System.Media.ClassSecondaryID -- PKEY_Media_ClassSecondaryID
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) 64440492-4C8B-11D1-8B70-080036B11A03, 14 (PIDMSI_CLASS_SECONDARY_ID)
-//
-//  
-DEFINE_PROPERTYKEY(PKEY_Media_ClassSecondaryID, 0x64440492, 0x4C8B, 0x11D1, 0x8B, 0x70, 0x08, 0x00, 0x36, 0xB1, 0x1A, 0x03, 14);
-
-//  Name:     System.Media.CollectionGroupID -- PKEY_Media_CollectionGroupID
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) 64440492-4C8B-11D1-8B70-080036B11A03, 24 (PIDMSI_COLLECTION_GROUP_ID)
-//
-//  
-DEFINE_PROPERTYKEY(PKEY_Media_CollectionGroupID, 0x64440492, 0x4C8B, 0x11D1, 0x8B, 0x70, 0x08, 0x00, 0x36, 0xB1, 0x1A, 0x03, 24);
-
-//  Name:     System.Media.CollectionID -- PKEY_Media_CollectionID
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) 64440492-4C8B-11D1-8B70-080036B11A03, 25 (PIDMSI_COLLECTION_ID)
-//
-//  
-DEFINE_PROPERTYKEY(PKEY_Media_CollectionID, 0x64440492, 0x4C8B, 0x11D1, 0x8B, 0x70, 0x08, 0x00, 0x36, 0xB1, 0x1A, 0x03, 25);
-
-//  Name:     System.Media.ContentDistributor -- PKEY_Media_ContentDistributor
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) 64440492-4C8B-11D1-8B70-080036B11A03, 18 (PIDMSI_CONTENTDISTRIBUTOR)
-//
-//  
-DEFINE_PROPERTYKEY(PKEY_Media_ContentDistributor, 0x64440492, 0x4C8B, 0x11D1, 0x8B, 0x70, 0x08, 0x00, 0x36, 0xB1, 0x1A, 0x03, 18);
-
-//  Name:     System.Media.ContentID -- PKEY_Media_ContentID
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) 64440492-4C8B-11D1-8B70-080036B11A03, 26 (PIDMSI_CONTENT_ID)
-//
-//  
-DEFINE_PROPERTYKEY(PKEY_Media_ContentID, 0x64440492, 0x4C8B, 0x11D1, 0x8B, 0x70, 0x08, 0x00, 0x36, 0xB1, 0x1A, 0x03, 26);
-
-//  Name:     System.Media.CreatorApplication -- PKEY_Media_CreatorApplication
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) 64440492-4C8B-11D1-8B70-080036B11A03, 27 (PIDMSI_TOOL_NAME)
-//
-//  
-DEFINE_PROPERTYKEY(PKEY_Media_CreatorApplication, 0x64440492, 0x4C8B, 0x11D1, 0x8B, 0x70, 0x08, 0x00, 0x36, 0xB1, 0x1A, 0x03, 27);
-
-//  Name:     System.Media.CreatorApplicationVersion -- PKEY_Media_CreatorApplicationVersion
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) 64440492-4C8B-11D1-8B70-080036B11A03, 28 (PIDMSI_TOOL_VERSION)
-//
-//  
-DEFINE_PROPERTYKEY(PKEY_Media_CreatorApplicationVersion, 0x64440492, 0x4C8B, 0x11D1, 0x8B, 0x70, 0x08, 0x00, 0x36, 0xB1, 0x1A, 0x03, 28);
-
-//  Name:     System.Media.DateEncoded -- PKEY_Media_DateEncoded
-//  Type:     DateTime -- VT_FILETIME  (For variants: VT_DATE)
-//  FormatID: 2E4B640D-5019-46D8-8881-55414CC5CAA0, 100
-//
-//  DateTime is in UTC (in the doc, not file system).
-DEFINE_PROPERTYKEY(PKEY_Media_DateEncoded, 0x2E4B640D, 0x5019, 0x46D8, 0x88, 0x81, 0x55, 0x41, 0x4C, 0xC5, 0xCA, 0xA0, 100);
-
-//  Name:     System.Media.DateReleased -- PKEY_Media_DateReleased
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: DE41CC29-6971-4290-B472-F59F2E2F31E2, 100
-DEFINE_PROPERTYKEY(PKEY_Media_DateReleased, 0xDE41CC29, 0x6971, 0x4290, 0xB4, 0x72, 0xF5, 0x9F, 0x2E, 0x2F, 0x31, 0xE2, 100);
-
-//  Name:     System.Media.Duration -- PKEY_Media_Duration
-//  Type:     UInt64 -- VT_UI8
-//  FormatID: (FMTID_AudioSummaryInformation) 64440490-4C8B-11D1-8B70-080036B11A03, 3 (PIDASI_TIMELENGTH)
-//
-//  100ns units, not milliseconds
-DEFINE_PROPERTYKEY(PKEY_Media_Duration, 0x64440490, 0x4C8B, 0x11D1, 0x8B, 0x70, 0x08, 0x00, 0x36, 0xB1, 0x1A, 0x03, 3);
-
-//  Name:     System.Media.DVDID -- PKEY_Media_DVDID
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) 64440492-4C8B-11D1-8B70-080036B11A03, 15 (PIDMSI_DVDID)
-//
-//  
-DEFINE_PROPERTYKEY(PKEY_Media_DVDID, 0x64440492, 0x4C8B, 0x11D1, 0x8B, 0x70, 0x08, 0x00, 0x36, 0xB1, 0x1A, 0x03, 15);
-
-//  Name:     System.Media.EncodedBy -- PKEY_Media_EncodedBy
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) 64440492-4C8B-11D1-8B70-080036B11A03, 36 (PIDMSI_ENCODED_BY)
-//
-//  
-DEFINE_PROPERTYKEY(PKEY_Media_EncodedBy, 0x64440492, 0x4C8B, 0x11D1, 0x8B, 0x70, 0x08, 0x00, 0x36, 0xB1, 0x1A, 0x03, 36);
-
-//  Name:     System.Media.EncodingSettings -- PKEY_Media_EncodingSettings
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) 64440492-4C8B-11D1-8B70-080036B11A03, 37 (PIDMSI_ENCODING_SETTINGS)
-//
-//  
-DEFINE_PROPERTYKEY(PKEY_Media_EncodingSettings, 0x64440492, 0x4C8B, 0x11D1, 0x8B, 0x70, 0x08, 0x00, 0x36, 0xB1, 0x1A, 0x03, 37);
-
-//  Name:     System.Media.FrameCount -- PKEY_Media_FrameCount
-//  Type:     UInt32 -- VT_UI4
-//  FormatID: (PSGUID_IMAGESUMMARYINFORMATION) 6444048F-4C8B-11D1-8B70-080036B11A03, 12 (PIDISI_FRAMECOUNT)
-//
-//  Indicates the frame count for the image.
-DEFINE_PROPERTYKEY(PKEY_Media_FrameCount, 0x6444048F, 0x4C8B, 0x11D1, 0x8B, 0x70, 0x08, 0x00, 0x36, 0xB1, 0x1A, 0x03, 12);
-
-//  Name:     System.Media.MCDI -- PKEY_Media_MCDI
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) 64440492-4C8B-11D1-8B70-080036B11A03, 16 (PIDMSI_MCDI)
-//
-//  
-DEFINE_PROPERTYKEY(PKEY_Media_MCDI, 0x64440492, 0x4C8B, 0x11D1, 0x8B, 0x70, 0x08, 0x00, 0x36, 0xB1, 0x1A, 0x03, 16);
-
-//  Name:     System.Media.MetadataContentProvider -- PKEY_Media_MetadataContentProvider
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) 64440492-4C8B-11D1-8B70-080036B11A03, 17 (PIDMSI_PROVIDER)
-//
-//  
-DEFINE_PROPERTYKEY(PKEY_Media_MetadataContentProvider, 0x64440492, 0x4C8B, 0x11D1, 0x8B, 0x70, 0x08, 0x00, 0x36, 0xB1, 0x1A, 0x03, 17);
-
-//  Name:     System.Media.Producer -- PKEY_Media_Producer
-//  Type:     Multivalue String -- VT_VECTOR | VT_LPWSTR  (For variants: VT_ARRAY | VT_BSTR)
-//  FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) 64440492-4C8B-11D1-8B70-080036B11A03, 22 (PIDMSI_PRODUCER)
-//
-//  
-DEFINE_PROPERTYKEY(PKEY_Media_Producer, 0x64440492, 0x4C8B, 0x11D1, 0x8B, 0x70, 0x08, 0x00, 0x36, 0xB1, 0x1A, 0x03, 22);
-
-//  Name:     System.Media.PromotionUrl -- PKEY_Media_PromotionUrl
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) 64440492-4C8B-11D1-8B70-080036B11A03, 33 (PIDMSI_PROMOTION_URL)
-//
-//  
-DEFINE_PROPERTYKEY(PKEY_Media_PromotionUrl, 0x64440492, 0x4C8B, 0x11D1, 0x8B, 0x70, 0x08, 0x00, 0x36, 0xB1, 0x1A, 0x03, 33);
-
-//  Name:     System.Media.ProtectionType -- PKEY_Media_ProtectionType
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) 64440492-4C8B-11D1-8B70-080036B11A03, 38
-//  
-//  If media is protected, how is it protected?
-DEFINE_PROPERTYKEY(PKEY_Media_ProtectionType, 0x64440492, 0x4C8B, 0x11D1, 0x8B, 0x70, 0x08, 0x00, 0x36, 0xB1, 0x1A, 0x03, 38);
-
-//  Name:     System.Media.ProviderRating -- PKEY_Media_ProviderRating
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) 64440492-4C8B-11D1-8B70-080036B11A03, 39
-//  
-//  Rating (0 - 99) supplied by metadata provider
-DEFINE_PROPERTYKEY(PKEY_Media_ProviderRating, 0x64440492, 0x4C8B, 0x11D1, 0x8B, 0x70, 0x08, 0x00, 0x36, 0xB1, 0x1A, 0x03, 39);
-
-//  Name:     System.Media.ProviderStyle -- PKEY_Media_ProviderStyle
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) 64440492-4C8B-11D1-8B70-080036B11A03, 40
-//  
-//  Style of music or video, supplied by metadata provider
-DEFINE_PROPERTYKEY(PKEY_Media_ProviderStyle, 0x64440492, 0x4C8B, 0x11D1, 0x8B, 0x70, 0x08, 0x00, 0x36, 0xB1, 0x1A, 0x03, 40);
-
-//  Name:     System.Media.Publisher -- PKEY_Media_Publisher
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) 64440492-4C8B-11D1-8B70-080036B11A03, 30 (PIDMSI_PUBLISHER)
-//
-//  
-DEFINE_PROPERTYKEY(PKEY_Media_Publisher, 0x64440492, 0x4C8B, 0x11D1, 0x8B, 0x70, 0x08, 0x00, 0x36, 0xB1, 0x1A, 0x03, 30);
-
-//  Name:     System.Media.SubscriptionContentId -- PKEY_Media_SubscriptionContentId
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 9AEBAE7A-9644-487D-A92C-657585ED751A, 100
-DEFINE_PROPERTYKEY(PKEY_Media_SubscriptionContentId, 0x9AEBAE7A, 0x9644, 0x487D, 0xA9, 0x2C, 0x65, 0x75, 0x85, 0xED, 0x75, 0x1A, 100);
-
-//  Name:     System.Media.SubTitle -- PKEY_Media_SubTitle
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: (FMTID_MUSIC) 56A3372E-CE9C-11D2-9F0E-006097C686F6, 38 (PIDSI_MUSIC_SUB_TITLE)
-//
-//  
-DEFINE_PROPERTYKEY(PKEY_Media_SubTitle, 0x56A3372E, 0xCE9C, 0x11D2, 0x9F, 0x0E, 0x00, 0x60, 0x97, 0xC6, 0x86, 0xF6, 38);
-
-//  Name:     System.Media.UniqueFileIdentifier -- PKEY_Media_UniqueFileIdentifier
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) 64440492-4C8B-11D1-8B70-080036B11A03, 35 (PIDMSI_UNIQUE_FILE_IDENTIFIER)
-//
-//  
-DEFINE_PROPERTYKEY(PKEY_Media_UniqueFileIdentifier, 0x64440492, 0x4C8B, 0x11D1, 0x8B, 0x70, 0x08, 0x00, 0x36, 0xB1, 0x1A, 0x03, 35);
-
-//  Name:     System.Media.UserNoAutoInfo -- PKEY_Media_UserNoAutoInfo
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) 64440492-4C8B-11D1-8B70-080036B11A03, 41
-//  
-//  If true, do NOT alter this file's metadata. Set by user.
-DEFINE_PROPERTYKEY(PKEY_Media_UserNoAutoInfo, 0x64440492, 0x4C8B, 0x11D1, 0x8B, 0x70, 0x08, 0x00, 0x36, 0xB1, 0x1A, 0x03, 41);
-
-//  Name:     System.Media.UserWebUrl -- PKEY_Media_UserWebUrl
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) 64440492-4C8B-11D1-8B70-080036B11A03, 34 (PIDMSI_USER_WEB_URL)
-//
-//  
-DEFINE_PROPERTYKEY(PKEY_Media_UserWebUrl, 0x64440492, 0x4C8B, 0x11D1, 0x8B, 0x70, 0x08, 0x00, 0x36, 0xB1, 0x1A, 0x03, 34);
-
-//  Name:     System.Media.Writer -- PKEY_Media_Writer
-//  Type:     Multivalue String -- VT_VECTOR | VT_LPWSTR  (For variants: VT_ARRAY | VT_BSTR)
-//  FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) 64440492-4C8B-11D1-8B70-080036B11A03, 23 (PIDMSI_WRITER)
-//
-//  
-DEFINE_PROPERTYKEY(PKEY_Media_Writer, 0x64440492, 0x4C8B, 0x11D1, 0x8B, 0x70, 0x08, 0x00, 0x36, 0xB1, 0x1A, 0x03, 23);
-
-//  Name:     System.Media.Year -- PKEY_Media_Year
-//  Type:     UInt32 -- VT_UI4
-//  FormatID: (FMTID_MUSIC) 56A3372E-CE9C-11D2-9F0E-006097C686F6, 5 (PIDSI_MUSIC_YEAR)
-//
-//  
-DEFINE_PROPERTYKEY(PKEY_Media_Year, 0x56A3372E, 0xCE9C, 0x11D2, 0x9F, 0x0E, 0x00, 0x60, 0x97, 0xC6, 0x86, 0xF6, 5);
- 
-//-----------------------------------------------------------------------------
-// Message properties
-
-
-
-//  Name:     System.Message.AttachmentContents -- PKEY_Message_AttachmentContents
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 3143BF7C-80A8-4854-8880-E2E40189BDD0, 100
-DEFINE_PROPERTYKEY(PKEY_Message_AttachmentContents, 0x3143BF7C, 0x80A8, 0x4854, 0x88, 0x80, 0xE2, 0xE4, 0x01, 0x89, 0xBD, 0xD0, 100);
-
-//  Name:     System.Message.AttachmentNames -- PKEY_Message_AttachmentNames
-//  Type:     Multivalue String -- VT_VECTOR | VT_LPWSTR  (For variants: VT_ARRAY | VT_BSTR)
-//  FormatID: E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD, 21
-//
-//  The names of the attachments in a message
-DEFINE_PROPERTYKEY(PKEY_Message_AttachmentNames, 0xE3E0584C, 0xB788, 0x4A5A, 0xBB, 0x20, 0x7F, 0x5A, 0x44, 0xC9, 0xAC, 0xDD, 21);
-
-//  Name:     System.Message.BccAddress -- PKEY_Message_BccAddress
-//  Type:     Multivalue String -- VT_VECTOR | VT_LPWSTR  (For variants: VT_ARRAY | VT_BSTR)
-//  FormatID: E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD, 2
-//
-//  Addresses in Bcc: field
-DEFINE_PROPERTYKEY(PKEY_Message_BccAddress, 0xE3E0584C, 0xB788, 0x4A5A, 0xBB, 0x20, 0x7F, 0x5A, 0x44, 0xC9, 0xAC, 0xDD, 2);
-
-//  Name:     System.Message.BccName -- PKEY_Message_BccName
-//  Type:     Multivalue String -- VT_VECTOR | VT_LPWSTR  (For variants: VT_ARRAY | VT_BSTR)
-//  FormatID: E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD, 3
-//
-//  person names in Bcc: field
-DEFINE_PROPERTYKEY(PKEY_Message_BccName, 0xE3E0584C, 0xB788, 0x4A5A, 0xBB, 0x20, 0x7F, 0x5A, 0x44, 0xC9, 0xAC, 0xDD, 3);
-
-//  Name:     System.Message.CcAddress -- PKEY_Message_CcAddress
-//  Type:     Multivalue String -- VT_VECTOR | VT_LPWSTR  (For variants: VT_ARRAY | VT_BSTR)
-//  FormatID: E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD, 4
-//
-//  Addresses in Cc: field
-DEFINE_PROPERTYKEY(PKEY_Message_CcAddress, 0xE3E0584C, 0xB788, 0x4A5A, 0xBB, 0x20, 0x7F, 0x5A, 0x44, 0xC9, 0xAC, 0xDD, 4);
-
-//  Name:     System.Message.CcName -- PKEY_Message_CcName
-//  Type:     Multivalue String -- VT_VECTOR | VT_LPWSTR  (For variants: VT_ARRAY | VT_BSTR)
-//  FormatID: E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD, 5
-//
-//  person names in Cc: field
-DEFINE_PROPERTYKEY(PKEY_Message_CcName, 0xE3E0584C, 0xB788, 0x4A5A, 0xBB, 0x20, 0x7F, 0x5A, 0x44, 0xC9, 0xAC, 0xDD, 5);
-
-//  Name:     System.Message.ConversationID -- PKEY_Message_ConversationID
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: DC8F80BD-AF1E-4289-85B6-3DFC1B493992, 100
-DEFINE_PROPERTYKEY(PKEY_Message_ConversationID, 0xDC8F80BD, 0xAF1E, 0x4289, 0x85, 0xB6, 0x3D, 0xFC, 0x1B, 0x49, 0x39, 0x92, 100);
-
-//  Name:     System.Message.ConversationIndex -- PKEY_Message_ConversationIndex
-//  Type:     Buffer -- VT_VECTOR | VT_UI1  (For variants: VT_ARRAY | VT_UI1)
-//  FormatID: DC8F80BD-AF1E-4289-85B6-3DFC1B493992, 101
-//  
-//  
-DEFINE_PROPERTYKEY(PKEY_Message_ConversationIndex, 0xDC8F80BD, 0xAF1E, 0x4289, 0x85, 0xB6, 0x3D, 0xFC, 0x1B, 0x49, 0x39, 0x92, 101);
-
-//  Name:     System.Message.DateReceived -- PKEY_Message_DateReceived
-//  Type:     DateTime -- VT_FILETIME  (For variants: VT_DATE)
-//  FormatID: E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD, 20
-//
-//  Date and Time communication was received
-DEFINE_PROPERTYKEY(PKEY_Message_DateReceived, 0xE3E0584C, 0xB788, 0x4A5A, 0xBB, 0x20, 0x7F, 0x5A, 0x44, 0xC9, 0xAC, 0xDD, 20);
-
-//  Name:     System.Message.DateSent -- PKEY_Message_DateSent
-//  Type:     DateTime -- VT_FILETIME  (For variants: VT_DATE)
-//  FormatID: E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD, 19
-//
-//  Date and Time communication was sent
-DEFINE_PROPERTYKEY(PKEY_Message_DateSent, 0xE3E0584C, 0xB788, 0x4A5A, 0xBB, 0x20, 0x7F, 0x5A, 0x44, 0xC9, 0xAC, 0xDD, 19);
-
-//  Name:     System.Message.FromAddress -- PKEY_Message_FromAddress
-//  Type:     Multivalue String -- VT_VECTOR | VT_LPWSTR  (For variants: VT_ARRAY | VT_BSTR)
-//  FormatID: E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD, 13
-DEFINE_PROPERTYKEY(PKEY_Message_FromAddress, 0xE3E0584C, 0xB788, 0x4A5A, 0xBB, 0x20, 0x7F, 0x5A, 0x44, 0xC9, 0xAC, 0xDD, 13);
-
-//  Name:     System.Message.FromName -- PKEY_Message_FromName
-//  Type:     Multivalue String -- VT_VECTOR | VT_LPWSTR  (For variants: VT_ARRAY | VT_BSTR)
-//  FormatID: E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD, 14
-//
-//  Address in from field as person name
-DEFINE_PROPERTYKEY(PKEY_Message_FromName, 0xE3E0584C, 0xB788, 0x4A5A, 0xBB, 0x20, 0x7F, 0x5A, 0x44, 0xC9, 0xAC, 0xDD, 14);
-
-//  Name:     System.Message.HasAttachments -- PKEY_Message_HasAttachments
-//  Type:     Boolean -- VT_BOOL
-//  FormatID: 9C1FCF74-2D97-41BA-B4AE-CB2E3661A6E4, 8
-//
-//  
-DEFINE_PROPERTYKEY(PKEY_Message_HasAttachments, 0x9C1FCF74, 0x2D97, 0x41BA, 0xB4, 0xAE, 0xCB, 0x2E, 0x36, 0x61, 0xA6, 0xE4, 8);
-
-//  Name:     System.Message.IsFwdOrReply -- PKEY_Message_IsFwdOrReply
-//  Type:     Int32 -- VT_I4
-//  FormatID: 9A9BC088-4F6D-469E-9919-E705412040F9, 100
-DEFINE_PROPERTYKEY(PKEY_Message_IsFwdOrReply, 0x9A9BC088, 0x4F6D, 0x469E, 0x99, 0x19, 0xE7, 0x05, 0x41, 0x20, 0x40, 0xF9, 100);
-
-//  Name:     System.Message.MessageClass -- PKEY_Message_MessageClass
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: CD9ED458-08CE-418F-A70E-F912C7BB9C5C, 103
-//  
-//  What type of outlook msg this is (meeting, task, mail, etc.)
-DEFINE_PROPERTYKEY(PKEY_Message_MessageClass, 0xCD9ED458, 0x08CE, 0x418F, 0xA7, 0x0E, 0xF9, 0x12, 0xC7, 0xBB, 0x9C, 0x5C, 103);
-
-//  Name:     System.Message.SenderAddress -- PKEY_Message_SenderAddress
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 0BE1C8E7-1981-4676-AE14-FDD78F05A6E7, 100
-DEFINE_PROPERTYKEY(PKEY_Message_SenderAddress, 0x0BE1C8E7, 0x1981, 0x4676, 0xAE, 0x14, 0xFD, 0xD7, 0x8F, 0x05, 0xA6, 0xE7, 100);
-
-//  Name:     System.Message.SenderName -- PKEY_Message_SenderName
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 0DA41CFA-D224-4A18-AE2F-596158DB4B3A, 100
-DEFINE_PROPERTYKEY(PKEY_Message_SenderName, 0x0DA41CFA, 0xD224, 0x4A18, 0xAE, 0x2F, 0x59, 0x61, 0x58, 0xDB, 0x4B, 0x3A, 100);
-
-//  Name:     System.Message.Store -- PKEY_Message_Store
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD, 15
-//
-//  The store (aka protocol handler) FILE, MAIL, OUTLOOKEXPRESS
-DEFINE_PROPERTYKEY(PKEY_Message_Store, 0xE3E0584C, 0xB788, 0x4A5A, 0xBB, 0x20, 0x7F, 0x5A, 0x44, 0xC9, 0xAC, 0xDD, 15);
-
-//  Name:     System.Message.ToAddress -- PKEY_Message_ToAddress
-//  Type:     Multivalue String -- VT_VECTOR | VT_LPWSTR  (For variants: VT_ARRAY | VT_BSTR)
-//  FormatID: E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD, 16
-//
-//  Addresses in To: field
-DEFINE_PROPERTYKEY(PKEY_Message_ToAddress, 0xE3E0584C, 0xB788, 0x4A5A, 0xBB, 0x20, 0x7F, 0x5A, 0x44, 0xC9, 0xAC, 0xDD, 16);
-
-//  Name:     System.Message.ToDoTitle -- PKEY_Message_ToDoTitle
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: BCCC8A3C-8CEF-42E5-9B1C-C69079398BC7, 100
-DEFINE_PROPERTYKEY(PKEY_Message_ToDoTitle, 0xBCCC8A3C, 0x8CEF, 0x42E5, 0x9B, 0x1C, 0xC6, 0x90, 0x79, 0x39, 0x8B, 0xC7, 100);
-
-//  Name:     System.Message.ToName -- PKEY_Message_ToName
-//  Type:     Multivalue String -- VT_VECTOR | VT_LPWSTR  (For variants: VT_ARRAY | VT_BSTR)
-//  FormatID: E3E0584C-B788-4A5A-BB20-7F5A44C9ACDD, 17
-//
-//  Person names in To: field
-DEFINE_PROPERTYKEY(PKEY_Message_ToName, 0xE3E0584C, 0xB788, 0x4A5A, 0xBB, 0x20, 0x7F, 0x5A, 0x44, 0xC9, 0xAC, 0xDD, 17);
- 
-//-----------------------------------------------------------------------------
-// Music properties
-
-//  Name:     System.Music.AlbumArtist -- PKEY_Music_AlbumArtist
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: (FMTID_MUSIC) 56A3372E-CE9C-11D2-9F0E-006097C686F6, 13 (PIDSI_MUSIC_ALBUM_ARTIST)
-//
-//  
-DEFINE_PROPERTYKEY(PKEY_Music_AlbumArtist, 0x56A3372E, 0xCE9C, 0x11D2, 0x9F, 0x0E, 0x00, 0x60, 0x97, 0xC6, 0x86, 0xF6, 13);
-
-//  Name:     System.Music.AlbumTitle -- PKEY_Music_AlbumTitle
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: (FMTID_MUSIC) 56A3372E-CE9C-11D2-9F0E-006097C686F6, 4 (PIDSI_MUSIC_ALBUM)
-//
-//  
-DEFINE_PROPERTYKEY(PKEY_Music_AlbumTitle, 0x56A3372E, 0xCE9C, 0x11D2, 0x9F, 0x0E, 0x00, 0x60, 0x97, 0xC6, 0x86, 0xF6, 4);
-
-//  Name:     System.Music.Artist -- PKEY_Music_Artist
-//  Type:     Multivalue String -- VT_VECTOR | VT_LPWSTR  (For variants: VT_ARRAY | VT_BSTR)
-//  FormatID: (FMTID_MUSIC) 56A3372E-CE9C-11D2-9F0E-006097C686F6, 2 (PIDSI_MUSIC_ARTIST)
-//
-//  
-DEFINE_PROPERTYKEY(PKEY_Music_Artist, 0x56A3372E, 0xCE9C, 0x11D2, 0x9F, 0x0E, 0x00, 0x60, 0x97, 0xC6, 0x86, 0xF6, 2);
-
-//  Name:     System.Music.BeatsPerMinute -- PKEY_Music_BeatsPerMinute
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: (FMTID_MUSIC) 56A3372E-CE9C-11D2-9F0E-006097C686F6, 35 (PIDSI_MUSIC_BEATS_PER_MINUTE)
-//
-//  
-DEFINE_PROPERTYKEY(PKEY_Music_BeatsPerMinute, 0x56A3372E, 0xCE9C, 0x11D2, 0x9F, 0x0E, 0x00, 0x60, 0x97, 0xC6, 0x86, 0xF6, 35);
-
-//  Name:     System.Music.Composer -- PKEY_Music_Composer
-//  Type:     Multivalue String -- VT_VECTOR | VT_LPWSTR  (For variants: VT_ARRAY | VT_BSTR)
-//  FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) 64440492-4C8B-11D1-8B70-080036B11A03, 19 (PIDMSI_COMPOSER)
-//
-//  
-DEFINE_PROPERTYKEY(PKEY_Music_Composer, 0x64440492, 0x4C8B, 0x11D1, 0x8B, 0x70, 0x08, 0x00, 0x36, 0xB1, 0x1A, 0x03, 19);
-
-//  Name:     System.Music.Conductor -- PKEY_Music_Conductor
-//  Type:     Multivalue String -- VT_VECTOR | VT_LPWSTR  (For variants: VT_ARRAY | VT_BSTR)
-//  FormatID: (FMTID_MUSIC) 56A3372E-CE9C-11D2-9F0E-006097C686F6, 36 (PIDSI_MUSIC_CONDUCTOR)
-//
-//  
-DEFINE_PROPERTYKEY(PKEY_Music_Conductor, 0x56A3372E, 0xCE9C, 0x11D2, 0x9F, 0x0E, 0x00, 0x60, 0x97, 0xC6, 0x86, 0xF6, 36);
-
-//  Name:     System.Music.ContentGroupDescription -- PKEY_Music_ContentGroupDescription
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: (FMTID_MUSIC) 56A3372E-CE9C-11D2-9F0E-006097C686F6, 33 (PIDSI_MUSIC_CONTENT_GROUP_DESCRIPTION)
-//
-//  
-DEFINE_PROPERTYKEY(PKEY_Music_ContentGroupDescription, 0x56A3372E, 0xCE9C, 0x11D2, 0x9F, 0x0E, 0x00, 0x60, 0x97, 0xC6, 0x86, 0xF6, 33);
-
-//  Name:     System.Music.Genre -- PKEY_Music_Genre
-//  Type:     Multivalue String -- VT_VECTOR | VT_LPWSTR  (For variants: VT_ARRAY | VT_BSTR)
-//  FormatID: (FMTID_MUSIC) 56A3372E-CE9C-11D2-9F0E-006097C686F6, 11 (PIDSI_MUSIC_GENRE)
-//
-//  
-DEFINE_PROPERTYKEY(PKEY_Music_Genre, 0x56A3372E, 0xCE9C, 0x11D2, 0x9F, 0x0E, 0x00, 0x60, 0x97, 0xC6, 0x86, 0xF6, 11);
-
-//  Name:     System.Music.InitialKey -- PKEY_Music_InitialKey
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: (FMTID_MUSIC) 56A3372E-CE9C-11D2-9F0E-006097C686F6, 34 (PIDSI_MUSIC_INITIAL_KEY)
-//
-//  
-DEFINE_PROPERTYKEY(PKEY_Music_InitialKey, 0x56A3372E, 0xCE9C, 0x11D2, 0x9F, 0x0E, 0x00, 0x60, 0x97, 0xC6, 0x86, 0xF6, 34);
-
-//  Name:     System.Music.Lyrics -- PKEY_Music_Lyrics
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: (FMTID_MUSIC) 56A3372E-CE9C-11D2-9F0E-006097C686F6, 12 (PIDSI_MUSIC_LYRICS)
-//
-//  
-DEFINE_PROPERTYKEY(PKEY_Music_Lyrics, 0x56A3372E, 0xCE9C, 0x11D2, 0x9F, 0x0E, 0x00, 0x60, 0x97, 0xC6, 0x86, 0xF6, 12);
-
-//  Name:     System.Music.Mood -- PKEY_Music_Mood
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: (FMTID_MUSIC) 56A3372E-CE9C-11D2-9F0E-006097C686F6, 39 (PIDSI_MUSIC_MOOD)
-//
-//  
-DEFINE_PROPERTYKEY(PKEY_Music_Mood, 0x56A3372E, 0xCE9C, 0x11D2, 0x9F, 0x0E, 0x00, 0x60, 0x97, 0xC6, 0x86, 0xF6, 39);
-
-//  Name:     System.Music.PartOfSet -- PKEY_Music_PartOfSet
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: (FMTID_MUSIC) 56A3372E-CE9C-11D2-9F0E-006097C686F6, 37 (PIDSI_MUSIC_PART_OF_SET)
-//
-//  
-DEFINE_PROPERTYKEY(PKEY_Music_PartOfSet, 0x56A3372E, 0xCE9C, 0x11D2, 0x9F, 0x0E, 0x00, 0x60, 0x97, 0xC6, 0x86, 0xF6, 37);
-
-//  Name:     System.Music.Period -- PKEY_Music_Period
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) 64440492-4C8B-11D1-8B70-080036B11A03, 31 (PIDMSI_PERIOD)
-//
-//  
-DEFINE_PROPERTYKEY(PKEY_Music_Period, 0x64440492, 0x4C8B, 0x11D1, 0x8B, 0x70, 0x08, 0x00, 0x36, 0xB1, 0x1A, 0x03, 31);
-
-//  Name:     System.Music.SynchronizedLyrics -- PKEY_Music_SynchronizedLyrics
-//  Type:     Blob -- VT_BLOB
-//  FormatID: 6B223B6A-162E-4AA9-B39F-05D678FC6D77, 100
-DEFINE_PROPERTYKEY(PKEY_Music_SynchronizedLyrics, 0x6B223B6A, 0x162E, 0x4AA9, 0xB3, 0x9F, 0x05, 0xD6, 0x78, 0xFC, 0x6D, 0x77, 100);
-
-//  Name:     System.Music.TrackNumber -- PKEY_Music_TrackNumber
-//  Type:     UInt32 -- VT_UI4
-//  FormatID: (FMTID_MUSIC) 56A3372E-CE9C-11D2-9F0E-006097C686F6, 7 (PIDSI_MUSIC_TRACK)
-//
-//  
-DEFINE_PROPERTYKEY(PKEY_Music_TrackNumber, 0x56A3372E, 0xCE9C, 0x11D2, 0x9F, 0x0E, 0x00, 0x60, 0x97, 0xC6, 0x86, 0xF6, 7);
-
- 
- 
-//-----------------------------------------------------------------------------
-// Note properties
-
-//  Name:     System.Note.Color -- PKEY_Note_Color
-//  Type:     UInt16 -- VT_UI2
-//  FormatID: 4776CAFA-BCE4-4CB1-A23E-265E76D8EB11, 100
-DEFINE_PROPERTYKEY(PKEY_Note_Color, 0x4776CAFA, 0xBCE4, 0x4CB1, 0xA2, 0x3E, 0x26, 0x5E, 0x76, 0xD8, 0xEB, 0x11, 100);
-
-// Possible discrete values for PKEY_Note_Color are:
-#define NOTE_COLOR_BLUE                     0u
-#define NOTE_COLOR_GREEN                    1u
-#define NOTE_COLOR_PINK                     2u
-#define NOTE_COLOR_YELLOW                   3u
-#define NOTE_COLOR_WHITE                    4u
-#define NOTE_COLOR_LIGHTGREEN               5u
-
-//  Name:     System.Note.ColorText -- PKEY_Note_ColorText
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 46B4E8DE-CDB2-440D-885C-1658EB65B914, 100
-//  
-//  This is the user-friendly form of System.Note.Color.  Not intended to be parsed 
-//  programmatically.
-DEFINE_PROPERTYKEY(PKEY_Note_ColorText, 0x46B4E8DE, 0xCDB2, 0x440D, 0x88, 0x5C, 0x16, 0x58, 0xEB, 0x65, 0xB9, 0x14, 100);
- 
-//-----------------------------------------------------------------------------
-// Photo properties
-
-
-
-//  Name:     System.Photo.Aperture -- PKEY_Photo_Aperture
-//  Type:     Double -- VT_R8
-//  FormatID: (FMTID_ImageProperties) 14B81DA1-0135-4D31-96D9-6CBFC9671A99, 37378
-//
-//  PropertyTagExifAperture.  Calculated from PKEY_Photo_ApertureNumerator and PKEY_Photo_ApertureDenominator
-DEFINE_PROPERTYKEY(PKEY_Photo_Aperture, 0x14B81DA1, 0x0135, 0x4D31, 0x96, 0xD9, 0x6C, 0xBF, 0xC9, 0x67, 0x1A, 0x99, 37378);
-
-//  Name:     System.Photo.ApertureDenominator -- PKEY_Photo_ApertureDenominator
-//  Type:     UInt32 -- VT_UI4
-//  FormatID: E1A9A38B-6685-46BD-875E-570DC7AD7320, 100
-//
-//  Denominator of PKEY_Photo_Aperture
-DEFINE_PROPERTYKEY(PKEY_Photo_ApertureDenominator, 0xE1A9A38B, 0x6685, 0x46BD, 0x87, 0x5E, 0x57, 0x0D, 0xC7, 0xAD, 0x73, 0x20, 100);
-
-//  Name:     System.Photo.ApertureNumerator -- PKEY_Photo_ApertureNumerator
-//  Type:     UInt32 -- VT_UI4
-//  FormatID: 0337ECEC-39FB-4581-A0BD-4C4CC51E9914, 100
-//
-//  Numerator of PKEY_Photo_Aperture
-DEFINE_PROPERTYKEY(PKEY_Photo_ApertureNumerator, 0x0337ECEC, 0x39FB, 0x4581, 0xA0, 0xBD, 0x4C, 0x4C, 0xC5, 0x1E, 0x99, 0x14, 100);
-
-//  Name:     System.Photo.Brightness -- PKEY_Photo_Brightness
-//  Type:     Double -- VT_R8
-//  FormatID: 1A701BF6-478C-4361-83AB-3701BB053C58, 100 (PropertyTagExifBrightness)
-//  
-//  This is the brightness of the photo.
-//  
-//  Calculated from PKEY_Photo_BrightnessNumerator and PKEY_Photo_BrightnessDenominator.
-//  
-//  The units are "APEX", normally in the range of -99.99 to 99.99. If the numerator of 
-//  the recorded value is FFFFFFFF.H, "Unknown" should be indicated.
-DEFINE_PROPERTYKEY(PKEY_Photo_Brightness, 0x1A701BF6, 0x478C, 0x4361, 0x83, 0xAB, 0x37, 0x01, 0xBB, 0x05, 0x3C, 0x58, 100);
-
-//  Name:     System.Photo.BrightnessDenominator -- PKEY_Photo_BrightnessDenominator
-//  Type:     UInt32 -- VT_UI4
-//  FormatID: 6EBE6946-2321-440A-90F0-C043EFD32476, 100
-//
-//  Denominator of PKEY_Photo_Brightness
-DEFINE_PROPERTYKEY(PKEY_Photo_BrightnessDenominator, 0x6EBE6946, 0x2321, 0x440A, 0x90, 0xF0, 0xC0, 0x43, 0xEF, 0xD3, 0x24, 0x76, 100);
-
-//  Name:     System.Photo.BrightnessNumerator -- PKEY_Photo_BrightnessNumerator
-//  Type:     UInt32 -- VT_UI4
-//  FormatID: 9E7D118F-B314-45A0-8CFB-D654B917C9E9, 100
-//
-//  Numerator of PKEY_Photo_Brightness
-DEFINE_PROPERTYKEY(PKEY_Photo_BrightnessNumerator, 0x9E7D118F, 0xB314, 0x45A0, 0x8C, 0xFB, 0xD6, 0x54, 0xB9, 0x17, 0xC9, 0xE9, 100);
-
-//  Name:     System.Photo.CameraManufacturer -- PKEY_Photo_CameraManufacturer
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: (FMTID_ImageProperties) 14B81DA1-0135-4D31-96D9-6CBFC9671A99, 271 (PropertyTagEquipMake)
-//
-//  
-DEFINE_PROPERTYKEY(PKEY_Photo_CameraManufacturer, 0x14B81DA1, 0x0135, 0x4D31, 0x96, 0xD9, 0x6C, 0xBF, 0xC9, 0x67, 0x1A, 0x99, 271);
-
-//  Name:     System.Photo.CameraModel -- PKEY_Photo_CameraModel
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: (FMTID_ImageProperties) 14B81DA1-0135-4D31-96D9-6CBFC9671A99, 272 (PropertyTagEquipModel)
-//
-//  
-DEFINE_PROPERTYKEY(PKEY_Photo_CameraModel, 0x14B81DA1, 0x0135, 0x4D31, 0x96, 0xD9, 0x6C, 0xBF, 0xC9, 0x67, 0x1A, 0x99, 272);
-
-//  Name:     System.Photo.CameraSerialNumber -- PKEY_Photo_CameraSerialNumber
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: (FMTID_ImageProperties) 14B81DA1-0135-4D31-96D9-6CBFC9671A99, 273
-//
-//  Serial number of camera that produced this photo
-DEFINE_PROPERTYKEY(PKEY_Photo_CameraSerialNumber, 0x14B81DA1, 0x0135, 0x4D31, 0x96, 0xD9, 0x6C, 0xBF, 0xC9, 0x67, 0x1A, 0x99, 273);
-
-//  Name:     System.Photo.Contrast -- PKEY_Photo_Contrast
-//  Type:     UInt32 -- VT_UI4
-//  FormatID: 2A785BA9-8D23-4DED-82E6-60A350C86A10, 100
-//  
-//  This indicates the direction of contrast processing applied by the camera 
-//  when the image was shot.
-DEFINE_PROPERTYKEY(PKEY_Photo_Contrast, 0x2A785BA9, 0x8D23, 0x4DED, 0x82, 0xE6, 0x60, 0xA3, 0x50, 0xC8, 0x6A, 0x10, 100);
-
-// Possible discrete values for PKEY_Photo_Contrast are:
-#define PHOTO_CONTRAST_NORMAL               0ul
-#define PHOTO_CONTRAST_SOFT                 1ul
-#define PHOTO_CONTRAST_HARD                 2ul
-
-//  Name:     System.Photo.ContrastText -- PKEY_Photo_ContrastText
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 59DDE9F2-5253-40EA-9A8B-479E96C6249A, 100
-//  
-//  This is the user-friendly form of System.Photo.Contrast.  Not intended to be parsed 
-//  programmatically.
-DEFINE_PROPERTYKEY(PKEY_Photo_ContrastText, 0x59DDE9F2, 0x5253, 0x40EA, 0x9A, 0x8B, 0x47, 0x9E, 0x96, 0xC6, 0x24, 0x9A, 100);
-
-//  Name:     System.Photo.DateTaken -- PKEY_Photo_DateTaken
-//  Type:     DateTime -- VT_FILETIME  (For variants: VT_DATE)
-//  FormatID: (FMTID_ImageProperties) 14B81DA1-0135-4D31-96D9-6CBFC9671A99, 36867
-//
-//  PropertyTagExifDTOrig
-DEFINE_PROPERTYKEY(PKEY_Photo_DateTaken, 0x14B81DA1, 0x0135, 0x4D31, 0x96, 0xD9, 0x6C, 0xBF, 0xC9, 0x67, 0x1A, 0x99, 36867);
-
-//  Name:     System.Photo.DigitalZoom -- PKEY_Photo_DigitalZoom
-//  Type:     Double -- VT_R8
-//  FormatID: F85BF840-A925-4BC2-B0C4-8E36B598679E, 100
-//
-//  PropertyTagExifDigitalZoom.  Calculated from PKEY_Photo_DigitalZoomNumerator and PKEY_Photo_DigitalZoomDenominator
-DEFINE_PROPERTYKEY(PKEY_Photo_DigitalZoom, 0xF85BF840, 0xA925, 0x4BC2, 0xB0, 0xC4, 0x8E, 0x36, 0xB5, 0x98, 0x67, 0x9E, 100);
-
-//  Name:     System.Photo.DigitalZoomDenominator -- PKEY_Photo_DigitalZoomDenominator
-//  Type:     UInt32 -- VT_UI4
-//  FormatID: 745BAF0E-E5C1-4CFB-8A1B-D031A0A52393, 100
-//
-//  Denominator of PKEY_Photo_DigitalZoom
-DEFINE_PROPERTYKEY(PKEY_Photo_DigitalZoomDenominator, 0x745BAF0E, 0xE5C1, 0x4CFB, 0x8A, 0x1B, 0xD0, 0x31, 0xA0, 0xA5, 0x23, 0x93, 100);
-
-//  Name:     System.Photo.DigitalZoomNumerator -- PKEY_Photo_DigitalZoomNumerator
-//  Type:     UInt32 -- VT_UI4
-//  FormatID: 16CBB924-6500-473B-A5BE-F1599BCBE413, 100
-//
-//  Numerator of PKEY_Photo_DigitalZoom
-DEFINE_PROPERTYKEY(PKEY_Photo_DigitalZoomNumerator, 0x16CBB924, 0x6500, 0x473B, 0xA5, 0xBE, 0xF1, 0x59, 0x9B, 0xCB, 0xE4, 0x13, 100);
-
-//  Name:     System.Photo.Event -- PKEY_Photo_Event
-//  Type:     Multivalue String -- VT_VECTOR | VT_LPWSTR  (For variants: VT_ARRAY | VT_BSTR)
-//  FormatID: (FMTID_ImageProperties) 14B81DA1-0135-4D31-96D9-6CBFC9671A99, 18248
-//
-//  The event at which the photo was taken
-DEFINE_PROPERTYKEY(PKEY_Photo_Event, 0x14B81DA1, 0x0135, 0x4D31, 0x96, 0xD9, 0x6C, 0xBF, 0xC9, 0x67, 0x1A, 0x99, 18248);
-
-//  Name:     System.Photo.EXIFVersion -- PKEY_Photo_EXIFVersion
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: D35F743A-EB2E-47F2-A286-844132CB1427, 100
-//
-//  The EXIF version.
-DEFINE_PROPERTYKEY(PKEY_Photo_EXIFVersion, 0xD35F743A, 0xEB2E, 0x47F2, 0xA2, 0x86, 0x84, 0x41, 0x32, 0xCB, 0x14, 0x27, 100);
-
-//  Name:     System.Photo.ExposureBias -- PKEY_Photo_ExposureBias
-//  Type:     Double -- VT_R8
-//  FormatID: (FMTID_ImageProperties) 14B81DA1-0135-4D31-96D9-6CBFC9671A99, 37380
-//
-//  PropertyTagExifExposureBias.  Calculated from PKEY_Photo_ExposureBiasNumerator and PKEY_Photo_ExposureBiasDenominator
-DEFINE_PROPERTYKEY(PKEY_Photo_ExposureBias, 0x14B81DA1, 0x0135, 0x4D31, 0x96, 0xD9, 0x6C, 0xBF, 0xC9, 0x67, 0x1A, 0x99, 37380);
-
-//  Name:     System.Photo.ExposureBiasDenominator -- PKEY_Photo_ExposureBiasDenominator
-//  Type:     Int32 -- VT_I4
-//  FormatID: AB205E50-04B7-461C-A18C-2F233836E627, 100
-//
-//  Denominator of PKEY_Photo_ExposureBias
-DEFINE_PROPERTYKEY(PKEY_Photo_ExposureBiasDenominator, 0xAB205E50, 0x04B7, 0x461C, 0xA1, 0x8C, 0x2F, 0x23, 0x38, 0x36, 0xE6, 0x27, 100);
-
-//  Name:     System.Photo.ExposureBiasNumerator -- PKEY_Photo_ExposureBiasNumerator
-//  Type:     Int32 -- VT_I4
-//  FormatID: 738BF284-1D87-420B-92CF-5834BF6EF9ED, 100
-//
-//  Numerator of PKEY_Photo_ExposureBias
-DEFINE_PROPERTYKEY(PKEY_Photo_ExposureBiasNumerator, 0x738BF284, 0x1D87, 0x420B, 0x92, 0xCF, 0x58, 0x34, 0xBF, 0x6E, 0xF9, 0xED, 100);
-
-//  Name:     System.Photo.ExposureIndex -- PKEY_Photo_ExposureIndex
-//  Type:     Double -- VT_R8
-//  FormatID: 967B5AF8-995A-46ED-9E11-35B3C5B9782D, 100
-//
-//  PropertyTagExifExposureIndex.  Calculated from PKEY_Photo_ExposureIndexNumerator and PKEY_Photo_ExposureIndexDenominator
-DEFINE_PROPERTYKEY(PKEY_Photo_ExposureIndex, 0x967B5AF8, 0x995A, 0x46ED, 0x9E, 0x11, 0x35, 0xB3, 0xC5, 0xB9, 0x78, 0x2D, 100);
-
-//  Name:     System.Photo.ExposureIndexDenominator -- PKEY_Photo_ExposureIndexDenominator
-//  Type:     UInt32 -- VT_UI4
-//  FormatID: 93112F89-C28B-492F-8A9D-4BE2062CEE8A, 100
-//
-//  Denominator of PKEY_Photo_ExposureIndex
-DEFINE_PROPERTYKEY(PKEY_Photo_ExposureIndexDenominator, 0x93112F89, 0xC28B, 0x492F, 0x8A, 0x9D, 0x4B, 0xE2, 0x06, 0x2C, 0xEE, 0x8A, 100);
-
-//  Name:     System.Photo.ExposureIndexNumerator -- PKEY_Photo_ExposureIndexNumerator
-//  Type:     UInt32 -- VT_UI4
-//  FormatID: CDEDCF30-8919-44DF-8F4C-4EB2FFDB8D89, 100
-//
-//  Numerator of PKEY_Photo_ExposureIndex
-DEFINE_PROPERTYKEY(PKEY_Photo_ExposureIndexNumerator, 0xCDEDCF30, 0x8919, 0x44DF, 0x8F, 0x4C, 0x4E, 0xB2, 0xFF, 0xDB, 0x8D, 0x89, 100);
-
-//  Name:     System.Photo.ExposureProgram -- PKEY_Photo_ExposureProgram
-//  Type:     UInt32 -- VT_UI4
-//  FormatID: (FMTID_ImageProperties) 14B81DA1-0135-4D31-96D9-6CBFC9671A99, 34850 (PropertyTagExifExposureProg)
-//
-//  
-DEFINE_PROPERTYKEY(PKEY_Photo_ExposureProgram, 0x14B81DA1, 0x0135, 0x4D31, 0x96, 0xD9, 0x6C, 0xBF, 0xC9, 0x67, 0x1A, 0x99, 34850);
-
-// Possible discrete values for PKEY_Photo_ExposureProgram are:
-#define PHOTO_EXPOSUREPROGRAM_UNKNOWN       0ul
-#define PHOTO_EXPOSUREPROGRAM_MANUAL        1ul
-#define PHOTO_EXPOSUREPROGRAM_NORMAL        2ul
-#define PHOTO_EXPOSUREPROGRAM_APERTURE      3ul
-#define PHOTO_EXPOSUREPROGRAM_SHUTTER       4ul
-#define PHOTO_EXPOSUREPROGRAM_CREATIVE      5ul
-#define PHOTO_EXPOSUREPROGRAM_ACTION        6ul
-#define PHOTO_EXPOSUREPROGRAM_PORTRAIT      7ul
-#define PHOTO_EXPOSUREPROGRAM_LANDSCAPE     8ul
-
-//  Name:     System.Photo.ExposureProgramText -- PKEY_Photo_ExposureProgramText
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: FEC690B7-5F30-4646-AE47-4CAAFBA884A3, 100
-//  
-//  This is the user-friendly form of System.Photo.ExposureProgram.  Not intended to be parsed 
-//  programmatically.
-DEFINE_PROPERTYKEY(PKEY_Photo_ExposureProgramText, 0xFEC690B7, 0x5F30, 0x4646, 0xAE, 0x47, 0x4C, 0xAA, 0xFB, 0xA8, 0x84, 0xA3, 100);
-
-//  Name:     System.Photo.ExposureTime -- PKEY_Photo_ExposureTime
-//  Type:     Double -- VT_R8
-//  FormatID: (FMTID_ImageProperties) 14B81DA1-0135-4D31-96D9-6CBFC9671A99, 33434
-//
-//  PropertyTagExifExposureTime.  Calculated from  PKEY_Photo_ExposureTimeNumerator and PKEY_Photo_ExposureTimeDenominator
-DEFINE_PROPERTYKEY(PKEY_Photo_ExposureTime, 0x14B81DA1, 0x0135, 0x4D31, 0x96, 0xD9, 0x6C, 0xBF, 0xC9, 0x67, 0x1A, 0x99, 33434);
-
-//  Name:     System.Photo.ExposureTimeDenominator -- PKEY_Photo_ExposureTimeDenominator
-//  Type:     UInt32 -- VT_UI4
-//  FormatID: 55E98597-AD16-42E0-B624-21599A199838, 100
-//
-//  Denominator of PKEY_Photo_ExposureTime
-DEFINE_PROPERTYKEY(PKEY_Photo_ExposureTimeDenominator, 0x55E98597, 0xAD16, 0x42E0, 0xB6, 0x24, 0x21, 0x59, 0x9A, 0x19, 0x98, 0x38, 100);
-
-//  Name:     System.Photo.ExposureTimeNumerator -- PKEY_Photo_ExposureTimeNumerator
-//  Type:     UInt32 -- VT_UI4
-//  FormatID: 257E44E2-9031-4323-AC38-85C552871B2E, 100
-//
-//  Numerator of PKEY_Photo_ExposureTime
-DEFINE_PROPERTYKEY(PKEY_Photo_ExposureTimeNumerator, 0x257E44E2, 0x9031, 0x4323, 0xAC, 0x38, 0x85, 0xC5, 0x52, 0x87, 0x1B, 0x2E, 100);
-
-//  Name:     System.Photo.Flash -- PKEY_Photo_Flash
-//  Type:     Byte -- VT_UI1
-//  FormatID: (FMTID_ImageProperties) 14B81DA1-0135-4D31-96D9-6CBFC9671A99, 37385
-//
-//  PropertyTagExifFlash
-DEFINE_PROPERTYKEY(PKEY_Photo_Flash, 0x14B81DA1, 0x0135, 0x4D31, 0x96, 0xD9, 0x6C, 0xBF, 0xC9, 0x67, 0x1A, 0x99, 37385);
-
-// Possible discrete values for PKEY_Photo_Flash are:
-#define PHOTO_FLASH_NONE                    0
-#define PHOTO_FLASH_FLASH                   1
-#define PHOTO_FLASH_WITHOUTSTROBE           5
-#define PHOTO_FLASH_WITHSTROBE              7
-
-//  Name:     System.Photo.FlashEnergy -- PKEY_Photo_FlashEnergy
-//  Type:     Double -- VT_R8
-//  FormatID: (FMTID_ImageProperties) 14B81DA1-0135-4D31-96D9-6CBFC9671A99, 41483
-//
-//  PropertyTagExifFlashEnergy.  Calculated from PKEY_Photo_FlashEnergyNumerator and PKEY_Photo_FlashEnergyDenominator
-DEFINE_PROPERTYKEY(PKEY_Photo_FlashEnergy, 0x14B81DA1, 0x0135, 0x4D31, 0x96, 0xD9, 0x6C, 0xBF, 0xC9, 0x67, 0x1A, 0x99, 41483);
-
-//  Name:     System.Photo.FlashEnergyDenominator -- PKEY_Photo_FlashEnergyDenominator
-//  Type:     UInt32 -- VT_UI4
-//  FormatID: D7B61C70-6323-49CD-A5FC-C84277162C97, 100
-//
-//  Denominator of PKEY_Photo_FlashEnergy
-DEFINE_PROPERTYKEY(PKEY_Photo_FlashEnergyDenominator, 0xD7B61C70, 0x6323, 0x49CD, 0xA5, 0xFC, 0xC8, 0x42, 0x77, 0x16, 0x2C, 0x97, 100);
-
-//  Name:     System.Photo.FlashEnergyNumerator -- PKEY_Photo_FlashEnergyNumerator
-//  Type:     UInt32 -- VT_UI4
-//  FormatID: FCAD3D3D-0858-400F-AAA3-2F66CCE2A6BC, 100
-//
-//  Numerator of PKEY_Photo_FlashEnergy
-DEFINE_PROPERTYKEY(PKEY_Photo_FlashEnergyNumerator, 0xFCAD3D3D, 0x0858, 0x400F, 0xAA, 0xA3, 0x2F, 0x66, 0xCC, 0xE2, 0xA6, 0xBC, 100);
-
-//  Name:     System.Photo.FlashManufacturer -- PKEY_Photo_FlashManufacturer
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: AABAF6C9-E0C5-4719-8585-57B103E584FE, 100
-DEFINE_PROPERTYKEY(PKEY_Photo_FlashManufacturer, 0xAABAF6C9, 0xE0C5, 0x4719, 0x85, 0x85, 0x57, 0xB1, 0x03, 0xE5, 0x84, 0xFE, 100);
-
-//  Name:     System.Photo.FlashModel -- PKEY_Photo_FlashModel
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: FE83BB35-4D1A-42E2-916B-06F3E1AF719E, 100
-DEFINE_PROPERTYKEY(PKEY_Photo_FlashModel, 0xFE83BB35, 0x4D1A, 0x42E2, 0x91, 0x6B, 0x06, 0xF3, 0xE1, 0xAF, 0x71, 0x9E, 100);
-
-//  Name:     System.Photo.FlashText -- PKEY_Photo_FlashText
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 6B8B68F6-200B-47EA-8D25-D8050F57339F, 100
-//  
-//  This is the user-friendly form of System.Photo.Flash.  Not intended to be parsed 
-//  programmatically.
-DEFINE_PROPERTYKEY(PKEY_Photo_FlashText, 0x6B8B68F6, 0x200B, 0x47EA, 0x8D, 0x25, 0xD8, 0x05, 0x0F, 0x57, 0x33, 0x9F, 100);
-
-//  Name:     System.Photo.FNumber -- PKEY_Photo_FNumber
-//  Type:     Double -- VT_R8
-//  FormatID: (FMTID_ImageProperties) 14B81DA1-0135-4D31-96D9-6CBFC9671A99, 33437
-//
-//  PropertyTagExifFNumber.  Calculated from PKEY_Photo_FNumberNumerator and PKEY_Photo_FNumberDenominator
-DEFINE_PROPERTYKEY(PKEY_Photo_FNumber, 0x14B81DA1, 0x0135, 0x4D31, 0x96, 0xD9, 0x6C, 0xBF, 0xC9, 0x67, 0x1A, 0x99, 33437);
-
-//  Name:     System.Photo.FNumberDenominator -- PKEY_Photo_FNumberDenominator
-//  Type:     UInt32 -- VT_UI4
-//  FormatID: E92A2496-223B-4463-A4E3-30EABBA79D80, 100
-//
-//  Denominator of PKEY_Photo_FNumber
-DEFINE_PROPERTYKEY(PKEY_Photo_FNumberDenominator, 0xE92A2496, 0x223B, 0x4463, 0xA4, 0xE3, 0x30, 0xEA, 0xBB, 0xA7, 0x9D, 0x80, 100);
-
-//  Name:     System.Photo.FNumberNumerator -- PKEY_Photo_FNumberNumerator
-//  Type:     UInt32 -- VT_UI4
-//  FormatID: 1B97738A-FDFC-462F-9D93-1957E08BE90C, 100
-//
-//  Numerator of PKEY_Photo_FNumber
-DEFINE_PROPERTYKEY(PKEY_Photo_FNumberNumerator, 0x1B97738A, 0xFDFC, 0x462F, 0x9D, 0x93, 0x19, 0x57, 0xE0, 0x8B, 0xE9, 0x0C, 100);
-
-//  Name:     System.Photo.FocalLength -- PKEY_Photo_FocalLength
-//  Type:     Double -- VT_R8
-//  FormatID: (FMTID_ImageProperties) 14B81DA1-0135-4D31-96D9-6CBFC9671A99, 37386
-//
-//  PropertyTagExifFocalLength.  Calculated from PKEY_Photo_FocalLengthNumerator and PKEY_Photo_FocalLengthDenominator
-DEFINE_PROPERTYKEY(PKEY_Photo_FocalLength, 0x14B81DA1, 0x0135, 0x4D31, 0x96, 0xD9, 0x6C, 0xBF, 0xC9, 0x67, 0x1A, 0x99, 37386);
-
-//  Name:     System.Photo.FocalLengthDenominator -- PKEY_Photo_FocalLengthDenominator
-//  Type:     UInt32 -- VT_UI4
-//  FormatID: 305BC615-DCA1-44A5-9FD4-10C0BA79412E, 100
-//
-//  Denominator of PKEY_Photo_FocalLength
-DEFINE_PROPERTYKEY(PKEY_Photo_FocalLengthDenominator, 0x305BC615, 0xDCA1, 0x44A5, 0x9F, 0xD4, 0x10, 0xC0, 0xBA, 0x79, 0x41, 0x2E, 100);
-
-//  Name:     System.Photo.FocalLengthInFilm -- PKEY_Photo_FocalLengthInFilm
-//  Type:     UInt16 -- VT_UI2
-//  FormatID: A0E74609-B84D-4F49-B860-462BD9971F98, 100
-DEFINE_PROPERTYKEY(PKEY_Photo_FocalLengthInFilm, 0xA0E74609, 0xB84D, 0x4F49, 0xB8, 0x60, 0x46, 0x2B, 0xD9, 0x97, 0x1F, 0x98, 100);
-
-//  Name:     System.Photo.FocalLengthNumerator -- PKEY_Photo_FocalLengthNumerator
-//  Type:     UInt32 -- VT_UI4
-//  FormatID: 776B6B3B-1E3D-4B0C-9A0E-8FBAF2A8492A, 100
-//
-//  Numerator of PKEY_Photo_FocalLength
-DEFINE_PROPERTYKEY(PKEY_Photo_FocalLengthNumerator, 0x776B6B3B, 0x1E3D, 0x4B0C, 0x9A, 0x0E, 0x8F, 0xBA, 0xF2, 0xA8, 0x49, 0x2A, 100);
-
-//  Name:     System.Photo.FocalPlaneXResolution -- PKEY_Photo_FocalPlaneXResolution
-//  Type:     Double -- VT_R8
-//  FormatID: CFC08D97-C6F7-4484-89DD-EBEF4356FE76, 100
-//  
-//  PropertyTagExifFocalXRes.  Calculated from PKEY_Photo_FocalPlaneXResolutionNumerator and 
-//  PKEY_Photo_FocalPlaneXResolutionDenominator.
-DEFINE_PROPERTYKEY(PKEY_Photo_FocalPlaneXResolution, 0xCFC08D97, 0xC6F7, 0x4484, 0x89, 0xDD, 0xEB, 0xEF, 0x43, 0x56, 0xFE, 0x76, 100);
-
-//  Name:     System.Photo.FocalPlaneXResolutionDenominator -- PKEY_Photo_FocalPlaneXResolutionDenominator
-//  Type:     UInt32 -- VT_UI4
-//  FormatID: 0933F3F5-4786-4F46-A8E8-D64DD37FA521, 100
-//
-//  Denominator of PKEY_Photo_FocalPlaneXResolution
-DEFINE_PROPERTYKEY(PKEY_Photo_FocalPlaneXResolutionDenominator, 0x0933F3F5, 0x4786, 0x4F46, 0xA8, 0xE8, 0xD6, 0x4D, 0xD3, 0x7F, 0xA5, 0x21, 100);
-
-//  Name:     System.Photo.FocalPlaneXResolutionNumerator -- PKEY_Photo_FocalPlaneXResolutionNumerator
-//  Type:     UInt32 -- VT_UI4
-//  FormatID: DCCB10AF-B4E2-4B88-95F9-031B4D5AB490, 100
-//
-//  Numerator of PKEY_Photo_FocalPlaneXResolution
-DEFINE_PROPERTYKEY(PKEY_Photo_FocalPlaneXResolutionNumerator, 0xDCCB10AF, 0xB4E2, 0x4B88, 0x95, 0xF9, 0x03, 0x1B, 0x4D, 0x5A, 0xB4, 0x90, 100);
-
-//  Name:     System.Photo.FocalPlaneYResolution -- PKEY_Photo_FocalPlaneYResolution
-//  Type:     Double -- VT_R8
-//  FormatID: 4FFFE4D0-914F-4AC4-8D6F-C9C61DE169B1, 100
-//  
-//  PropertyTagExifFocalYRes.  Calculated from PKEY_Photo_FocalPlaneYResolutionNumerator and 
-//  PKEY_Photo_FocalPlaneYResolutionDenominator.
-DEFINE_PROPERTYKEY(PKEY_Photo_FocalPlaneYResolution, 0x4FFFE4D0, 0x914F, 0x4AC4, 0x8D, 0x6F, 0xC9, 0xC6, 0x1D, 0xE1, 0x69, 0xB1, 100);
-
-//  Name:     System.Photo.FocalPlaneYResolutionDenominator -- PKEY_Photo_FocalPlaneYResolutionDenominator
-//  Type:     UInt32 -- VT_UI4
-//  FormatID: 1D6179A6-A876-4031-B013-3347B2B64DC8, 100
-//
-//  Denominator of PKEY_Photo_FocalPlaneYResolution
-DEFINE_PROPERTYKEY(PKEY_Photo_FocalPlaneYResolutionDenominator, 0x1D6179A6, 0xA876, 0x4031, 0xB0, 0x13, 0x33, 0x47, 0xB2, 0xB6, 0x4D, 0xC8, 100);
-
-//  Name:     System.Photo.FocalPlaneYResolutionNumerator -- PKEY_Photo_FocalPlaneYResolutionNumerator
-//  Type:     UInt32 -- VT_UI4
-//  FormatID: A2E541C5-4440-4BA8-867E-75CFC06828CD, 100
-//
-//  Numerator of PKEY_Photo_FocalPlaneYResolution
-DEFINE_PROPERTYKEY(PKEY_Photo_FocalPlaneYResolutionNumerator, 0xA2E541C5, 0x4440, 0x4BA8, 0x86, 0x7E, 0x75, 0xCF, 0xC0, 0x68, 0x28, 0xCD, 100);
-
-//  Name:     System.Photo.GainControl -- PKEY_Photo_GainControl
-//  Type:     Double -- VT_R8
-//  FormatID: FA304789-00C7-4D80-904A-1E4DCC7265AA, 100 (PropertyTagExifGainControl)
-//  
-//  This indicates the degree of overall image gain adjustment.
-//  
-//  Calculated from PKEY_Photo_GainControlNumerator and PKEY_Photo_GainControlDenominator.
-DEFINE_PROPERTYKEY(PKEY_Photo_GainControl, 0xFA304789, 0x00C7, 0x4D80, 0x90, 0x4A, 0x1E, 0x4D, 0xCC, 0x72, 0x65, 0xAA, 100);
-
-// Possible discrete values for PKEY_Photo_GainControl are:
-#define PHOTO_GAINCONTROL_NONE              0.0
-#define PHOTO_GAINCONTROL_LOWGAINUP         1.0
-#define PHOTO_GAINCONTROL_HIGHGAINUP        2.0
-#define PHOTO_GAINCONTROL_LOWGAINDOWN       3.0
-#define PHOTO_GAINCONTROL_HIGHGAINDOWN      4.0
-
-//  Name:     System.Photo.GainControlDenominator -- PKEY_Photo_GainControlDenominator
-//  Type:     UInt32 -- VT_UI4
-//  FormatID: 42864DFD-9DA4-4F77-BDED-4AAD7B256735, 100
-//
-//  Denominator of PKEY_Photo_GainControl
-DEFINE_PROPERTYKEY(PKEY_Photo_GainControlDenominator, 0x42864DFD, 0x9DA4, 0x4F77, 0xBD, 0xED, 0x4A, 0xAD, 0x7B, 0x25, 0x67, 0x35, 100);
-
-//  Name:     System.Photo.GainControlNumerator -- PKEY_Photo_GainControlNumerator
-//  Type:     UInt32 -- VT_UI4
-//  FormatID: 8E8ECF7C-B7B8-4EB8-A63F-0EE715C96F9E, 100
-//
-//  Numerator of PKEY_Photo_GainControl
-DEFINE_PROPERTYKEY(PKEY_Photo_GainControlNumerator, 0x8E8ECF7C, 0xB7B8, 0x4EB8, 0xA6, 0x3F, 0x0E, 0xE7, 0x15, 0xC9, 0x6F, 0x9E, 100);
-
-//  Name:     System.Photo.GainControlText -- PKEY_Photo_GainControlText
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: C06238B2-0BF9-4279-A723-25856715CB9D, 100
-//  
-//  This is the user-friendly form of System.Photo.GainControl.  Not intended to be parsed 
-//  programmatically.
-DEFINE_PROPERTYKEY(PKEY_Photo_GainControlText, 0xC06238B2, 0x0BF9, 0x4279, 0xA7, 0x23, 0x25, 0x85, 0x67, 0x15, 0xCB, 0x9D, 100);
-
-//  Name:     System.Photo.ISOSpeed -- PKEY_Photo_ISOSpeed
-//  Type:     UInt16 -- VT_UI2
-//  FormatID: (FMTID_ImageProperties) 14B81DA1-0135-4D31-96D9-6CBFC9671A99, 34855
-//
-//  PropertyTagExifISOSpeed
-DEFINE_PROPERTYKEY(PKEY_Photo_ISOSpeed, 0x14B81DA1, 0x0135, 0x4D31, 0x96, 0xD9, 0x6C, 0xBF, 0xC9, 0x67, 0x1A, 0x99, 34855);
-
-//  Name:     System.Photo.LensManufacturer -- PKEY_Photo_LensManufacturer
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: E6DDCAF7-29C5-4F0A-9A68-D19412EC7090, 100
-DEFINE_PROPERTYKEY(PKEY_Photo_LensManufacturer, 0xE6DDCAF7, 0x29C5, 0x4F0A, 0x9A, 0x68, 0xD1, 0x94, 0x12, 0xEC, 0x70, 0x90, 100);
-
-//  Name:     System.Photo.LensModel -- PKEY_Photo_LensModel
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: E1277516-2B5F-4869-89B1-2E585BD38B7A, 100
-DEFINE_PROPERTYKEY(PKEY_Photo_LensModel, 0xE1277516, 0x2B5F, 0x4869, 0x89, 0xB1, 0x2E, 0x58, 0x5B, 0xD3, 0x8B, 0x7A, 100);
-
-//  Name:     System.Photo.LightSource -- PKEY_Photo_LightSource
-//  Type:     UInt32 -- VT_UI4
-//  FormatID: (FMTID_ImageProperties) 14B81DA1-0135-4D31-96D9-6CBFC9671A99, 37384
-//
-//  PropertyTagExifLightSource
-DEFINE_PROPERTYKEY(PKEY_Photo_LightSource, 0x14B81DA1, 0x0135, 0x4D31, 0x96, 0xD9, 0x6C, 0xBF, 0xC9, 0x67, 0x1A, 0x99, 37384);
-
-// Possible discrete values for PKEY_Photo_LightSource are:
-#define PHOTO_LIGHTSOURCE_UNKNOWN           0ul
-#define PHOTO_LIGHTSOURCE_DAYLIGHT          1ul
-#define PHOTO_LIGHTSOURCE_FLUORESCENT       2ul
-#define PHOTO_LIGHTSOURCE_TUNGSTEN          3ul
-#define PHOTO_LIGHTSOURCE_STANDARD_A        17ul
-#define PHOTO_LIGHTSOURCE_STANDARD_B        18ul
-#define PHOTO_LIGHTSOURCE_STANDARD_C        19ul
-#define PHOTO_LIGHTSOURCE_D55               20ul
-#define PHOTO_LIGHTSOURCE_D65               21ul
-#define PHOTO_LIGHTSOURCE_D75               22ul
-
-//  Name:     System.Photo.MakerNote -- PKEY_Photo_MakerNote
-//  Type:     Buffer -- VT_VECTOR | VT_UI1  (For variants: VT_ARRAY | VT_UI1)
-//  FormatID: FA303353-B659-4052-85E9-BCAC79549B84, 100
-DEFINE_PROPERTYKEY(PKEY_Photo_MakerNote, 0xFA303353, 0xB659, 0x4052, 0x85, 0xE9, 0xBC, 0xAC, 0x79, 0x54, 0x9B, 0x84, 100);
-
-//  Name:     System.Photo.MakerNoteOffset -- PKEY_Photo_MakerNoteOffset
-//  Type:     UInt64 -- VT_UI8
-//  FormatID: 813F4124-34E6-4D17-AB3E-6B1F3C2247A1, 100
-DEFINE_PROPERTYKEY(PKEY_Photo_MakerNoteOffset, 0x813F4124, 0x34E6, 0x4D17, 0xAB, 0x3E, 0x6B, 0x1F, 0x3C, 0x22, 0x47, 0xA1, 100);
-
-//  Name:     System.Photo.MaxAperture -- PKEY_Photo_MaxAperture
-//  Type:     Double -- VT_R8
-//  FormatID: 08F6D7C2-E3F2-44FC-AF1E-5AA5C81A2D3E, 100
-//
-//  Calculated from PKEY_Photo_MaxApertureNumerator and PKEY_Photo_MaxApertureDenominator
-DEFINE_PROPERTYKEY(PKEY_Photo_MaxAperture, 0x08F6D7C2, 0xE3F2, 0x44FC, 0xAF, 0x1E, 0x5A, 0xA5, 0xC8, 0x1A, 0x2D, 0x3E, 100);
-
-//  Name:     System.Photo.MaxApertureDenominator -- PKEY_Photo_MaxApertureDenominator
-//  Type:     UInt32 -- VT_UI4
-//  FormatID: C77724D4-601F-46C5-9B89-C53F93BCEB77, 100
-//
-//  Denominator of PKEY_Photo_MaxAperture
-DEFINE_PROPERTYKEY(PKEY_Photo_MaxApertureDenominator, 0xC77724D4, 0x601F, 0x46C5, 0x9B, 0x89, 0xC5, 0x3F, 0x93, 0xBC, 0xEB, 0x77, 100);
-
-//  Name:     System.Photo.MaxApertureNumerator -- PKEY_Photo_MaxApertureNumerator
-//  Type:     UInt32 -- VT_UI4
-//  FormatID: C107E191-A459-44C5-9AE6-B952AD4B906D, 100
-//
-//  Numerator of PKEY_Photo_MaxAperture
-DEFINE_PROPERTYKEY(PKEY_Photo_MaxApertureNumerator, 0xC107E191, 0xA459, 0x44C5, 0x9A, 0xE6, 0xB9, 0x52, 0xAD, 0x4B, 0x90, 0x6D, 100);
-
-//  Name:     System.Photo.MeteringMode -- PKEY_Photo_MeteringMode
-//  Type:     UInt16 -- VT_UI2
-//  FormatID: (FMTID_ImageProperties) 14B81DA1-0135-4D31-96D9-6CBFC9671A99, 37383
-//
-//  PropertyTagExifMeteringMode
-DEFINE_PROPERTYKEY(PKEY_Photo_MeteringMode, 0x14B81DA1, 0x0135, 0x4D31, 0x96, 0xD9, 0x6C, 0xBF, 0xC9, 0x67, 0x1A, 0x99, 37383);
-
-// Possible discrete values for PKEY_Photo_MeteringMode are:
-#define PHOTO_METERINGMODE_UNKNOWN          0u
-#define PHOTO_METERINGMODE_AVERAGE          1u
-#define PHOTO_METERINGMODE_CENTER           2u
-#define PHOTO_METERINGMODE_SPOT             3u
-#define PHOTO_METERINGMODE_MULTISPOT        4u
-#define PHOTO_METERINGMODE_PATTERN          5u
-#define PHOTO_METERINGMODE_PARTIAL          6u
-
-//  Name:     System.Photo.MeteringModeText -- PKEY_Photo_MeteringModeText
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: F628FD8C-7BA8-465A-A65B-C5AA79263A9E, 100
-//  
-//  This is the user-friendly form of System.Photo.MeteringMode.  Not intended to be parsed 
-//  programmatically.
-DEFINE_PROPERTYKEY(PKEY_Photo_MeteringModeText, 0xF628FD8C, 0x7BA8, 0x465A, 0xA6, 0x5B, 0xC5, 0xAA, 0x79, 0x26, 0x3A, 0x9E, 100);
-
-//  Name:     System.Photo.Orientation -- PKEY_Photo_Orientation
-//  Type:     UInt16 -- VT_UI2
-//  FormatID: (FMTID_ImageProperties) 14B81DA1-0135-4D31-96D9-6CBFC9671A99, 274 (PropertyTagOrientation)
-//  
-//  This is the image orientation viewed in terms of rows and columns.
-DEFINE_PROPERTYKEY(PKEY_Photo_Orientation, 0x14B81DA1, 0x0135, 0x4D31, 0x96, 0xD9, 0x6C, 0xBF, 0xC9, 0x67, 0x1A, 0x99, 274);
-
-// Possible discrete values for PKEY_Photo_Orientation are:
-#define PHOTO_ORIENTATION_NORMAL            1u
-#define PHOTO_ORIENTATION_FLIPHORIZONTAL    2u
-#define PHOTO_ORIENTATION_ROTATE180         3u
-#define PHOTO_ORIENTATION_FLIPVERTICAL      4u
-#define PHOTO_ORIENTATION_TRANSPOSE         5u
-#define PHOTO_ORIENTATION_ROTATE270         6u
-#define PHOTO_ORIENTATION_TRANSVERSE        7u
-#define PHOTO_ORIENTATION_ROTATE90          8u
-
-//  Name:     System.Photo.OrientationText -- PKEY_Photo_OrientationText
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: A9EA193C-C511-498A-A06B-58E2776DCC28, 100
-//  
-//  This is the user-friendly form of System.Photo.Orientation.  Not intended to be parsed 
-//  programmatically.
-DEFINE_PROPERTYKEY(PKEY_Photo_OrientationText, 0xA9EA193C, 0xC511, 0x498A, 0xA0, 0x6B, 0x58, 0xE2, 0x77, 0x6D, 0xCC, 0x28, 100);
-
-//  Name:     System.Photo.PhotometricInterpretation -- PKEY_Photo_PhotometricInterpretation
-//  Type:     UInt16 -- VT_UI2
-//  FormatID: 341796F1-1DF9-4B1C-A564-91BDEFA43877, 100
-//  
-//  This is the pixel composition. In JPEG compressed data, a JPEG marker is used 
-//  instead of this property.
-DEFINE_PROPERTYKEY(PKEY_Photo_PhotometricInterpretation, 0x341796F1, 0x1DF9, 0x4B1C, 0xA5, 0x64, 0x91, 0xBD, 0xEF, 0xA4, 0x38, 0x77, 100);
-
-// Possible discrete values for PKEY_Photo_PhotometricInterpretation are:
-#define PHOTO_PHOTOMETRIC_RGB               2u
-#define PHOTO_PHOTOMETRIC_YCBCR             6u
-
-//  Name:     System.Photo.PhotometricInterpretationText -- PKEY_Photo_PhotometricInterpretationText
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 821437D6-9EAB-4765-A589-3B1CBBD22A61, 100
-//  
-//  This is the user-friendly form of System.Photo.PhotometricInterpretation.  Not intended to be parsed 
-//  programmatically.
-DEFINE_PROPERTYKEY(PKEY_Photo_PhotometricInterpretationText, 0x821437D6, 0x9EAB, 0x4765, 0xA5, 0x89, 0x3B, 0x1C, 0xBB, 0xD2, 0x2A, 0x61, 100);
-
-//  Name:     System.Photo.ProgramMode -- PKEY_Photo_ProgramMode
-//  Type:     UInt32 -- VT_UI4
-//  FormatID: 6D217F6D-3F6A-4825-B470-5F03CA2FBE9B, 100
-//  
-//  This is the class of the program used by the camera to set exposure when the 
-//  picture is taken.
-DEFINE_PROPERTYKEY(PKEY_Photo_ProgramMode, 0x6D217F6D, 0x3F6A, 0x4825, 0xB4, 0x70, 0x5F, 0x03, 0xCA, 0x2F, 0xBE, 0x9B, 100);
-
-// Possible discrete values for PKEY_Photo_ProgramMode are:
-#define PHOTO_PROGRAMMODE_NOTDEFINED        0ul
-#define PHOTO_PROGRAMMODE_MANUAL            1ul
-#define PHOTO_PROGRAMMODE_NORMAL            2ul
-#define PHOTO_PROGRAMMODE_APERTURE          3ul
-#define PHOTO_PROGRAMMODE_SHUTTER           4ul
-#define PHOTO_PROGRAMMODE_CREATIVE          5ul
-#define PHOTO_PROGRAMMODE_ACTION            6ul
-#define PHOTO_PROGRAMMODE_PORTRAIT          7ul
-#define PHOTO_PROGRAMMODE_LANDSCAPE         8ul
-
-//  Name:     System.Photo.ProgramModeText -- PKEY_Photo_ProgramModeText
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 7FE3AA27-2648-42F3-89B0-454E5CB150C3, 100
-//  
-//  This is the user-friendly form of System.Photo.ProgramMode.  Not intended to be parsed 
-//  programmatically.
-DEFINE_PROPERTYKEY(PKEY_Photo_ProgramModeText, 0x7FE3AA27, 0x2648, 0x42F3, 0x89, 0xB0, 0x45, 0x4E, 0x5C, 0xB1, 0x50, 0xC3, 100);
-
-//  Name:     System.Photo.RelatedSoundFile -- PKEY_Photo_RelatedSoundFile
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 318A6B45-087F-4DC2-B8CC-05359551FC9E, 100
-DEFINE_PROPERTYKEY(PKEY_Photo_RelatedSoundFile, 0x318A6B45, 0x087F, 0x4DC2, 0xB8, 0xCC, 0x05, 0x35, 0x95, 0x51, 0xFC, 0x9E, 100);
-
-//  Name:     System.Photo.Saturation -- PKEY_Photo_Saturation
-//  Type:     UInt32 -- VT_UI4
-//  FormatID: 49237325-A95A-4F67-B211-816B2D45D2E0, 100
-//  
-//  This indicates the direction of saturation processing applied by the camera when 
-//  the image was shot.
-DEFINE_PROPERTYKEY(PKEY_Photo_Saturation, 0x49237325, 0xA95A, 0x4F67, 0xB2, 0x11, 0x81, 0x6B, 0x2D, 0x45, 0xD2, 0xE0, 100);
-
-// Possible discrete values for PKEY_Photo_Saturation are:
-#define PHOTO_SATURATION_NORMAL             0ul
-#define PHOTO_SATURATION_LOW                1ul
-#define PHOTO_SATURATION_HIGH               2ul
-
-//  Name:     System.Photo.SaturationText -- PKEY_Photo_SaturationText
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 61478C08-B600-4A84-BBE4-E99C45F0A072, 100
-//  
-//  This is the user-friendly form of System.Photo.Saturation.  Not intended to be parsed 
-//  programmatically.
-DEFINE_PROPERTYKEY(PKEY_Photo_SaturationText, 0x61478C08, 0xB600, 0x4A84, 0xBB, 0xE4, 0xE9, 0x9C, 0x45, 0xF0, 0xA0, 0x72, 100);
-
-//  Name:     System.Photo.Sharpness -- PKEY_Photo_Sharpness
-//  Type:     UInt32 -- VT_UI4
-//  FormatID: FC6976DB-8349-4970-AE97-B3C5316A08F0, 100
-//  
-//  This indicates the direction of sharpness processing applied by the camera when 
-//  the image was shot.
-DEFINE_PROPERTYKEY(PKEY_Photo_Sharpness, 0xFC6976DB, 0x8349, 0x4970, 0xAE, 0x97, 0xB3, 0xC5, 0x31, 0x6A, 0x08, 0xF0, 100);
-
-// Possible discrete values for PKEY_Photo_Sharpness are:
-#define PHOTO_SHARPNESS_NORMAL              0ul
-#define PHOTO_SHARPNESS_SOFT                1ul
-#define PHOTO_SHARPNESS_HARD                2ul
-
-//  Name:     System.Photo.SharpnessText -- PKEY_Photo_SharpnessText
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 51EC3F47-DD50-421D-8769-334F50424B1E, 100
-//  
-//  This is the user-friendly form of System.Photo.Sharpness.  Not intended to be parsed 
-//  programmatically.
-DEFINE_PROPERTYKEY(PKEY_Photo_SharpnessText, 0x51EC3F47, 0xDD50, 0x421D, 0x87, 0x69, 0x33, 0x4F, 0x50, 0x42, 0x4B, 0x1E, 100);
-
-//  Name:     System.Photo.ShutterSpeed -- PKEY_Photo_ShutterSpeed
-//  Type:     Double -- VT_R8
-//  FormatID: (FMTID_ImageProperties) 14B81DA1-0135-4D31-96D9-6CBFC9671A99, 37377
-//
-//  PropertyTagExifShutterSpeed.  Calculated from PKEY_Photo_ShutterSpeedNumerator and PKEY_Photo_ShutterSpeedDenominator
-DEFINE_PROPERTYKEY(PKEY_Photo_ShutterSpeed, 0x14B81DA1, 0x0135, 0x4D31, 0x96, 0xD9, 0x6C, 0xBF, 0xC9, 0x67, 0x1A, 0x99, 37377);
-
-//  Name:     System.Photo.ShutterSpeedDenominator -- PKEY_Photo_ShutterSpeedDenominator
-//  Type:     Int32 -- VT_I4
-//  FormatID: E13D8975-81C7-4948-AE3F-37CAE11E8FF7, 100
-//
-//  Denominator of PKEY_Photo_ShutterSpeed
-DEFINE_PROPERTYKEY(PKEY_Photo_ShutterSpeedDenominator, 0xE13D8975, 0x81C7, 0x4948, 0xAE, 0x3F, 0x37, 0xCA, 0xE1, 0x1E, 0x8F, 0xF7, 100);
-
-//  Name:     System.Photo.ShutterSpeedNumerator -- PKEY_Photo_ShutterSpeedNumerator
-//  Type:     Int32 -- VT_I4
-//  FormatID: 16EA4042-D6F4-4BCA-8349-7C78D30FB333, 100
-//
-//  Numerator of PKEY_Photo_ShutterSpeed
-DEFINE_PROPERTYKEY(PKEY_Photo_ShutterSpeedNumerator, 0x16EA4042, 0xD6F4, 0x4BCA, 0x83, 0x49, 0x7C, 0x78, 0xD3, 0x0F, 0xB3, 0x33, 100);
-
-//  Name:     System.Photo.SubjectDistance -- PKEY_Photo_SubjectDistance
-//  Type:     Double -- VT_R8
-//  FormatID: (FMTID_ImageProperties) 14B81DA1-0135-4D31-96D9-6CBFC9671A99, 37382
-//
-//  PropertyTagExifSubjectDist.  Calculated from PKEY_Photo_SubjectDistanceNumerator and PKEY_Photo_SubjectDistanceDenominator
-DEFINE_PROPERTYKEY(PKEY_Photo_SubjectDistance, 0x14B81DA1, 0x0135, 0x4D31, 0x96, 0xD9, 0x6C, 0xBF, 0xC9, 0x67, 0x1A, 0x99, 37382);
-
-//  Name:     System.Photo.SubjectDistanceDenominator -- PKEY_Photo_SubjectDistanceDenominator
-//  Type:     UInt32 -- VT_UI4
-//  FormatID: 0C840A88-B043-466D-9766-D4B26DA3FA77, 100
-//
-//  Denominator of PKEY_Photo_SubjectDistance
-DEFINE_PROPERTYKEY(PKEY_Photo_SubjectDistanceDenominator, 0x0C840A88, 0xB043, 0x466D, 0x97, 0x66, 0xD4, 0xB2, 0x6D, 0xA3, 0xFA, 0x77, 100);
-
-//  Name:     System.Photo.SubjectDistanceNumerator -- PKEY_Photo_SubjectDistanceNumerator
-//  Type:     UInt32 -- VT_UI4
-//  FormatID: 8AF4961C-F526-43E5-AA81-DB768219178D, 100
-//
-//  Numerator of PKEY_Photo_SubjectDistance
-DEFINE_PROPERTYKEY(PKEY_Photo_SubjectDistanceNumerator, 0x8AF4961C, 0xF526, 0x43E5, 0xAA, 0x81, 0xDB, 0x76, 0x82, 0x19, 0x17, 0x8D, 100);
-
-//  Name:     System.Photo.TranscodedForSync -- PKEY_Photo_TranscodedForSync
-//  Type:     Boolean -- VT_BOOL
-//  FormatID: 9A8EBB75-6458-4E82-BACB-35C0095B03BB, 100
-DEFINE_PROPERTYKEY(PKEY_Photo_TranscodedForSync, 0x9A8EBB75, 0x6458, 0x4E82, 0xBA, 0xCB, 0x35, 0xC0, 0x09, 0x5B, 0x03, 0xBB, 100);
-
-//  Name:     System.Photo.WhiteBalance -- PKEY_Photo_WhiteBalance
-//  Type:     UInt32 -- VT_UI4
-//  FormatID: EE3D3D8A-5381-4CFA-B13B-AAF66B5F4EC9, 100
-//  
-//  This indicates the white balance mode set when the image was shot.
-DEFINE_PROPERTYKEY(PKEY_Photo_WhiteBalance, 0xEE3D3D8A, 0x5381, 0x4CFA, 0xB1, 0x3B, 0xAA, 0xF6, 0x6B, 0x5F, 0x4E, 0xC9, 100);
-
-// Possible discrete values for PKEY_Photo_WhiteBalance are:
-#define PHOTO_WHITEBALANCE_AUTO             0ul
-#define PHOTO_WHITEBALANCE_MANUAL           1ul
-
-//  Name:     System.Photo.WhiteBalanceText -- PKEY_Photo_WhiteBalanceText
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 6336B95E-C7A7-426D-86FD-7AE3D39C84B4, 100
-//  
-//  This is the user-friendly form of System.Photo.WhiteBalance.  Not intended to be parsed 
-//  programmatically.
-DEFINE_PROPERTYKEY(PKEY_Photo_WhiteBalanceText, 0x6336B95E, 0xC7A7, 0x426D, 0x86, 0xFD, 0x7A, 0xE3, 0xD3, 0x9C, 0x84, 0xB4, 100);
- 
-//-----------------------------------------------------------------------------
-// PropGroup properties
-
-//  Name:     System.PropGroup.Advanced -- PKEY_PropGroup_Advanced
-//  Type:     Null -- VT_NULL
-//  FormatID: 900A403B-097B-4B95-8AE2-071FDAEEB118, 100
-DEFINE_PROPERTYKEY(PKEY_PropGroup_Advanced, 0x900A403B, 0x097B, 0x4B95, 0x8A, 0xE2, 0x07, 0x1F, 0xDA, 0xEE, 0xB1, 0x18, 100);
-
-//  Name:     System.PropGroup.Audio -- PKEY_PropGroup_Audio
-//  Type:     Null -- VT_NULL
-//  FormatID: 2804D469-788F-48AA-8570-71B9C187E138, 100
-DEFINE_PROPERTYKEY(PKEY_PropGroup_Audio, 0x2804D469, 0x788F, 0x48AA, 0x85, 0x70, 0x71, 0xB9, 0xC1, 0x87, 0xE1, 0x38, 100);
-
-//  Name:     System.PropGroup.Calendar -- PKEY_PropGroup_Calendar
-//  Type:     Null -- VT_NULL
-//  FormatID: 9973D2B5-BFD8-438A-BA94-5349B293181A, 100
-DEFINE_PROPERTYKEY(PKEY_PropGroup_Calendar, 0x9973D2B5, 0xBFD8, 0x438A, 0xBA, 0x94, 0x53, 0x49, 0xB2, 0x93, 0x18, 0x1A, 100);
-
-//  Name:     System.PropGroup.Camera -- PKEY_PropGroup_Camera
-//  Type:     Null -- VT_NULL
-//  FormatID: DE00DE32-547E-4981-AD4B-542F2E9007D8, 100
-DEFINE_PROPERTYKEY(PKEY_PropGroup_Camera, 0xDE00DE32, 0x547E, 0x4981, 0xAD, 0x4B, 0x54, 0x2F, 0x2E, 0x90, 0x07, 0xD8, 100);
-
-//  Name:     System.PropGroup.Contact -- PKEY_PropGroup_Contact
-//  Type:     Null -- VT_NULL
-//  FormatID: DF975FD3-250A-4004-858F-34E29A3E37AA, 100
-DEFINE_PROPERTYKEY(PKEY_PropGroup_Contact, 0xDF975FD3, 0x250A, 0x4004, 0x85, 0x8F, 0x34, 0xE2, 0x9A, 0x3E, 0x37, 0xAA, 100);
-
-//  Name:     System.PropGroup.Content -- PKEY_PropGroup_Content
-//  Type:     Null -- VT_NULL
-//  FormatID: D0DAB0BA-368A-4050-A882-6C010FD19A4F, 100
-DEFINE_PROPERTYKEY(PKEY_PropGroup_Content, 0xD0DAB0BA, 0x368A, 0x4050, 0xA8, 0x82, 0x6C, 0x01, 0x0F, 0xD1, 0x9A, 0x4F, 100);
-
-//  Name:     System.PropGroup.Description -- PKEY_PropGroup_Description
-//  Type:     Null -- VT_NULL
-//  FormatID: 8969B275-9475-4E00-A887-FF93B8B41E44, 100
-DEFINE_PROPERTYKEY(PKEY_PropGroup_Description, 0x8969B275, 0x9475, 0x4E00, 0xA8, 0x87, 0xFF, 0x93, 0xB8, 0xB4, 0x1E, 0x44, 100);
-
-//  Name:     System.PropGroup.FileSystem -- PKEY_PropGroup_FileSystem
-//  Type:     Null -- VT_NULL
-//  FormatID: E3A7D2C1-80FC-4B40-8F34-30EA111BDC2E, 100
-DEFINE_PROPERTYKEY(PKEY_PropGroup_FileSystem, 0xE3A7D2C1, 0x80FC, 0x4B40, 0x8F, 0x34, 0x30, 0xEA, 0x11, 0x1B, 0xDC, 0x2E, 100);
-
-//  Name:     System.PropGroup.General -- PKEY_PropGroup_General
-//  Type:     Null -- VT_NULL
-//  FormatID: CC301630-B192-4C22-B372-9F4C6D338E07, 100
-DEFINE_PROPERTYKEY(PKEY_PropGroup_General, 0xCC301630, 0xB192, 0x4C22, 0xB3, 0x72, 0x9F, 0x4C, 0x6D, 0x33, 0x8E, 0x07, 100);
-
-//  Name:     System.PropGroup.GPS -- PKEY_PropGroup_GPS
-//  Type:     Null -- VT_NULL
-//  FormatID: F3713ADA-90E3-4E11-AAE5-FDC17685B9BE, 100
-DEFINE_PROPERTYKEY(PKEY_PropGroup_GPS, 0xF3713ADA, 0x90E3, 0x4E11, 0xAA, 0xE5, 0xFD, 0xC1, 0x76, 0x85, 0xB9, 0xBE, 100);
-
-//  Name:     System.PropGroup.Image -- PKEY_PropGroup_Image
-//  Type:     Null -- VT_NULL
-//  FormatID: E3690A87-0FA8-4A2A-9A9F-FCE8827055AC, 100
-DEFINE_PROPERTYKEY(PKEY_PropGroup_Image, 0xE3690A87, 0x0FA8, 0x4A2A, 0x9A, 0x9F, 0xFC, 0xE8, 0x82, 0x70, 0x55, 0xAC, 100);
-
-//  Name:     System.PropGroup.Media -- PKEY_PropGroup_Media
-//  Type:     Null -- VT_NULL
-//  FormatID: 61872CF7-6B5E-4B4B-AC2D-59DA84459248, 100
-DEFINE_PROPERTYKEY(PKEY_PropGroup_Media, 0x61872CF7, 0x6B5E, 0x4B4B, 0xAC, 0x2D, 0x59, 0xDA, 0x84, 0x45, 0x92, 0x48, 100);
-
-//  Name:     System.PropGroup.MediaAdvanced -- PKEY_PropGroup_MediaAdvanced
-//  Type:     Null -- VT_NULL
-//  FormatID: 8859A284-DE7E-4642-99BA-D431D044B1EC, 100
-DEFINE_PROPERTYKEY(PKEY_PropGroup_MediaAdvanced, 0x8859A284, 0xDE7E, 0x4642, 0x99, 0xBA, 0xD4, 0x31, 0xD0, 0x44, 0xB1, 0xEC, 100);
-
-//  Name:     System.PropGroup.Message -- PKEY_PropGroup_Message
-//  Type:     Null -- VT_NULL
-//  FormatID: 7FD7259D-16B4-4135-9F97-7C96ECD2FA9E, 100
-DEFINE_PROPERTYKEY(PKEY_PropGroup_Message, 0x7FD7259D, 0x16B4, 0x4135, 0x9F, 0x97, 0x7C, 0x96, 0xEC, 0xD2, 0xFA, 0x9E, 100);
-
-//  Name:     System.PropGroup.Music -- PKEY_PropGroup_Music
-//  Type:     Null -- VT_NULL
-//  FormatID: 68DD6094-7216-40F1-A029-43FE7127043F, 100
-DEFINE_PROPERTYKEY(PKEY_PropGroup_Music, 0x68DD6094, 0x7216, 0x40F1, 0xA0, 0x29, 0x43, 0xFE, 0x71, 0x27, 0x04, 0x3F, 100);
-
-//  Name:     System.PropGroup.Origin -- PKEY_PropGroup_Origin
-//  Type:     Null -- VT_NULL
-//  FormatID: 2598D2FB-5569-4367-95DF-5CD3A177E1A5, 100
-DEFINE_PROPERTYKEY(PKEY_PropGroup_Origin, 0x2598D2FB, 0x5569, 0x4367, 0x95, 0xDF, 0x5C, 0xD3, 0xA1, 0x77, 0xE1, 0xA5, 100);
-
-//  Name:     System.PropGroup.PhotoAdvanced -- PKEY_PropGroup_PhotoAdvanced
-//  Type:     Null -- VT_NULL
-//  FormatID: 0CB2BF5A-9EE7-4A86-8222-F01E07FDADAF, 100
-DEFINE_PROPERTYKEY(PKEY_PropGroup_PhotoAdvanced, 0x0CB2BF5A, 0x9EE7, 0x4A86, 0x82, 0x22, 0xF0, 0x1E, 0x07, 0xFD, 0xAD, 0xAF, 100);
-
-//  Name:     System.PropGroup.RecordedTV -- PKEY_PropGroup_RecordedTV
-//  Type:     Null -- VT_NULL
-//  FormatID: E7B33238-6584-4170-A5C0-AC25EFD9DA56, 100
-DEFINE_PROPERTYKEY(PKEY_PropGroup_RecordedTV, 0xE7B33238, 0x6584, 0x4170, 0xA5, 0xC0, 0xAC, 0x25, 0xEF, 0xD9, 0xDA, 0x56, 100);
-
-//  Name:     System.PropGroup.Video -- PKEY_PropGroup_Video
-//  Type:     Null -- VT_NULL
-//  FormatID: BEBE0920-7671-4C54-A3EB-49FDDFC191EE, 100
-DEFINE_PROPERTYKEY(PKEY_PropGroup_Video, 0xBEBE0920, 0x7671, 0x4C54, 0xA3, 0xEB, 0x49, 0xFD, 0xDF, 0xC1, 0x91, 0xEE, 100);
- 
-//-----------------------------------------------------------------------------
-// PropList properties
-
-
-
-//  Name:     System.PropList.ConflictPrompt -- PKEY_PropList_ConflictPrompt
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: C9944A21-A406-48FE-8225-AEC7E24C211B, 11
-//  
-//  The list of properties to show in the file operation conflict resolution dialog. Properties with empty 
-//  values will not be displayed. Register under the regvalue of "ConflictPrompt".
-DEFINE_PROPERTYKEY(PKEY_PropList_ConflictPrompt, 0xC9944A21, 0xA406, 0x48FE, 0x82, 0x25, 0xAE, 0xC7, 0xE2, 0x4C, 0x21, 0x1B, 11);
-
-//  Name:     System.PropList.ExtendedTileInfo -- PKEY_PropList_ExtendedTileInfo
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: C9944A21-A406-48FE-8225-AEC7E24C211B, 9
-//  
-//  The list of properties to show in the listview on extended tiles. Register under the regvalue of 
-//  "ExtendedTileInfo".
-DEFINE_PROPERTYKEY(PKEY_PropList_ExtendedTileInfo, 0xC9944A21, 0xA406, 0x48FE, 0x82, 0x25, 0xAE, 0xC7, 0xE2, 0x4C, 0x21, 0x1B, 9);
-
-//  Name:     System.PropList.FileOperationPrompt -- PKEY_PropList_FileOperationPrompt
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: C9944A21-A406-48FE-8225-AEC7E24C211B, 10
-//  
-//  The list of properties to show in the file operation confirmation dialog. Properties with empty values 
-//  will not be displayed. If this list is not specified, then the InfoTip property list is used instead. 
-//  Register under the regvalue of "FileOperationPrompt".
-DEFINE_PROPERTYKEY(PKEY_PropList_FileOperationPrompt, 0xC9944A21, 0xA406, 0x48FE, 0x82, 0x25, 0xAE, 0xC7, 0xE2, 0x4C, 0x21, 0x1B, 10);
-
-//  Name:     System.PropList.FullDetails -- PKEY_PropList_FullDetails
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: C9944A21-A406-48FE-8225-AEC7E24C211B, 2
-//  
-//  The list of all the properties to show in the details page.  Property groups can be included in this list 
-//  in order to more easily organize the UI.  Register under the regvalue of "FullDetails".
-DEFINE_PROPERTYKEY(PKEY_PropList_FullDetails, 0xC9944A21, 0xA406, 0x48FE, 0x82, 0x25, 0xAE, 0xC7, 0xE2, 0x4C, 0x21, 0x1B, 2);
-
-//  Name:     System.PropList.InfoTip -- PKEY_PropList_InfoTip
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: C9944A21-A406-48FE-8225-AEC7E24C211B, 4 (PID_PROPLIST_INFOTIP)
-//  
-//  The list of properties to show in the infotip. Properties with empty values will not be displayed. Register 
-//  under the regvalue of "InfoTip".
-DEFINE_PROPERTYKEY(PKEY_PropList_InfoTip, 0xC9944A21, 0xA406, 0x48FE, 0x82, 0x25, 0xAE, 0xC7, 0xE2, 0x4C, 0x21, 0x1B, 4);
-
-//  Name:     System.PropList.NonPersonal -- PKEY_PropList_NonPersonal
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 49D1091F-082E-493F-B23F-D2308AA9668C, 100
-//  
-//  The list of properties that are considered 'non-personal'. When told to remove all non-personal properties 
-//  from a given file, the system will leave these particular properties untouched. Register under the regvalue 
-//  of "NonPersonal".
-DEFINE_PROPERTYKEY(PKEY_PropList_NonPersonal, 0x49D1091F, 0x082E, 0x493F, 0xB2, 0x3F, 0xD2, 0x30, 0x8A, 0xA9, 0x66, 0x8C, 100);
-
-//  Name:     System.PropList.PreviewDetails -- PKEY_PropList_PreviewDetails
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: C9944A21-A406-48FE-8225-AEC7E24C211B, 8
-//
-//  The list of properties to display in the preview pane.  Register under the regvalue of "PreviewDetails".
-DEFINE_PROPERTYKEY(PKEY_PropList_PreviewDetails, 0xC9944A21, 0xA406, 0x48FE, 0x82, 0x25, 0xAE, 0xC7, 0xE2, 0x4C, 0x21, 0x1B, 8);
-
-//  Name:     System.PropList.PreviewTitle -- PKEY_PropList_PreviewTitle
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: C9944A21-A406-48FE-8225-AEC7E24C211B, 6
-//  
-//  The one or two properties to display in the preview pane title section.  The optional second property is 
-//  displayed as a subtitle.  Register under the regvalue of "PreviewTitle".
-DEFINE_PROPERTYKEY(PKEY_PropList_PreviewTitle, 0xC9944A21, 0xA406, 0x48FE, 0x82, 0x25, 0xAE, 0xC7, 0xE2, 0x4C, 0x21, 0x1B, 6);
-
-//  Name:     System.PropList.QuickTip -- PKEY_PropList_QuickTip
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: C9944A21-A406-48FE-8225-AEC7E24C211B, 5 (PID_PROPLIST_QUICKTIP)
-//  
-//  The list of properties to show in the infotip when the item is on a slow network. Properties with empty 
-//  values will not be displayed. Register under the regvalue of "QuickTip".
-DEFINE_PROPERTYKEY(PKEY_PropList_QuickTip, 0xC9944A21, 0xA406, 0x48FE, 0x82, 0x25, 0xAE, 0xC7, 0xE2, 0x4C, 0x21, 0x1B, 5);
-
-//  Name:     System.PropList.TileInfo -- PKEY_PropList_TileInfo
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: C9944A21-A406-48FE-8225-AEC7E24C211B, 3 (PID_PROPLIST_TILEINFO)
-//  
-//  The list of properties to show in the listview on tiles. Register under the regvalue of "TileInfo".
-DEFINE_PROPERTYKEY(PKEY_PropList_TileInfo, 0xC9944A21, 0xA406, 0x48FE, 0x82, 0x25, 0xAE, 0xC7, 0xE2, 0x4C, 0x21, 0x1B, 3);
-
-//  Name:     System.PropList.XPDetailsPanel -- PKEY_PropList_XPDetailsPanel
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: (FMTID_WebView) F2275480-F782-4291-BD94-F13693513AEC, 0 (PID_DISPLAY_PROPERTIES)
-//
-//  The list of properties to display in the XP webview details panel. Obsolete.
-DEFINE_PROPERTYKEY(PKEY_PropList_XPDetailsPanel, 0xF2275480, 0xF782, 0x4291, 0xBD, 0x94, 0xF1, 0x36, 0x93, 0x51, 0x3A, 0xEC, 0);
- 
-//-----------------------------------------------------------------------------
-// RecordedTV properties
-
-
-
-//  Name:     System.RecordedTV.ChannelNumber -- PKEY_RecordedTV_ChannelNumber
-//  Type:     UInt32 -- VT_UI4
-//  FormatID: 6D748DE2-8D38-4CC3-AC60-F009B057C557, 7
-//
-//  Example: 42
-DEFINE_PROPERTYKEY(PKEY_RecordedTV_ChannelNumber, 0x6D748DE2, 0x8D38, 0x4CC3, 0xAC, 0x60, 0xF0, 0x09, 0xB0, 0x57, 0xC5, 0x57, 7);
-
-//  Name:     System.RecordedTV.Credits -- PKEY_RecordedTV_Credits
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 6D748DE2-8D38-4CC3-AC60-F009B057C557, 4
-//
-//  Example: "Don Messick/Frank Welker/Casey Kasem/Heather North/Nicole Jaffe;;;"
-DEFINE_PROPERTYKEY(PKEY_RecordedTV_Credits, 0x6D748DE2, 0x8D38, 0x4CC3, 0xAC, 0x60, 0xF0, 0x09, 0xB0, 0x57, 0xC5, 0x57, 4);
-
-//  Name:     System.RecordedTV.DateContentExpires -- PKEY_RecordedTV_DateContentExpires
-//  Type:     DateTime -- VT_FILETIME  (For variants: VT_DATE)
-//  FormatID: 6D748DE2-8D38-4CC3-AC60-F009B057C557, 15
-DEFINE_PROPERTYKEY(PKEY_RecordedTV_DateContentExpires, 0x6D748DE2, 0x8D38, 0x4CC3, 0xAC, 0x60, 0xF0, 0x09, 0xB0, 0x57, 0xC5, 0x57, 15);
-
-//  Name:     System.RecordedTV.EpisodeName -- PKEY_RecordedTV_EpisodeName
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 6D748DE2-8D38-4CC3-AC60-F009B057C557, 2
-//
-//  Example: "Nowhere to Hyde"
-DEFINE_PROPERTYKEY(PKEY_RecordedTV_EpisodeName, 0x6D748DE2, 0x8D38, 0x4CC3, 0xAC, 0x60, 0xF0, 0x09, 0xB0, 0x57, 0xC5, 0x57, 2);
-
-//  Name:     System.RecordedTV.IsATSCContent -- PKEY_RecordedTV_IsATSCContent
-//  Type:     Boolean -- VT_BOOL
-//  FormatID: 6D748DE2-8D38-4CC3-AC60-F009B057C557, 16
-DEFINE_PROPERTYKEY(PKEY_RecordedTV_IsATSCContent, 0x6D748DE2, 0x8D38, 0x4CC3, 0xAC, 0x60, 0xF0, 0x09, 0xB0, 0x57, 0xC5, 0x57, 16);
-
-//  Name:     System.RecordedTV.IsClosedCaptioningAvailable -- PKEY_RecordedTV_IsClosedCaptioningAvailable
-//  Type:     Boolean -- VT_BOOL
-//  FormatID: 6D748DE2-8D38-4CC3-AC60-F009B057C557, 12
-DEFINE_PROPERTYKEY(PKEY_RecordedTV_IsClosedCaptioningAvailable, 0x6D748DE2, 0x8D38, 0x4CC3, 0xAC, 0x60, 0xF0, 0x09, 0xB0, 0x57, 0xC5, 0x57, 12);
-
-//  Name:     System.RecordedTV.IsDTVContent -- PKEY_RecordedTV_IsDTVContent
-//  Type:     Boolean -- VT_BOOL
-//  FormatID: 6D748DE2-8D38-4CC3-AC60-F009B057C557, 17
-DEFINE_PROPERTYKEY(PKEY_RecordedTV_IsDTVContent, 0x6D748DE2, 0x8D38, 0x4CC3, 0xAC, 0x60, 0xF0, 0x09, 0xB0, 0x57, 0xC5, 0x57, 17);
-
-//  Name:     System.RecordedTV.IsHDContent -- PKEY_RecordedTV_IsHDContent
-//  Type:     Boolean -- VT_BOOL
-//  FormatID: 6D748DE2-8D38-4CC3-AC60-F009B057C557, 18
-DEFINE_PROPERTYKEY(PKEY_RecordedTV_IsHDContent, 0x6D748DE2, 0x8D38, 0x4CC3, 0xAC, 0x60, 0xF0, 0x09, 0xB0, 0x57, 0xC5, 0x57, 18);
-
-//  Name:     System.RecordedTV.IsRepeatBroadcast -- PKEY_RecordedTV_IsRepeatBroadcast
-//  Type:     Boolean -- VT_BOOL
-//  FormatID: 6D748DE2-8D38-4CC3-AC60-F009B057C557, 13
-DEFINE_PROPERTYKEY(PKEY_RecordedTV_IsRepeatBroadcast, 0x6D748DE2, 0x8D38, 0x4CC3, 0xAC, 0x60, 0xF0, 0x09, 0xB0, 0x57, 0xC5, 0x57, 13);
-
-//  Name:     System.RecordedTV.IsSAP -- PKEY_RecordedTV_IsSAP
-//  Type:     Boolean -- VT_BOOL
-//  FormatID: 6D748DE2-8D38-4CC3-AC60-F009B057C557, 14
-DEFINE_PROPERTYKEY(PKEY_RecordedTV_IsSAP, 0x6D748DE2, 0x8D38, 0x4CC3, 0xAC, 0x60, 0xF0, 0x09, 0xB0, 0x57, 0xC5, 0x57, 14);
-
-//  Name:     System.RecordedTV.NetworkAffiliation -- PKEY_RecordedTV_NetworkAffiliation
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 2C53C813-FB63-4E22-A1AB-0B331CA1E273, 100
-DEFINE_PROPERTYKEY(PKEY_RecordedTV_NetworkAffiliation, 0x2C53C813, 0xFB63, 0x4E22, 0xA1, 0xAB, 0x0B, 0x33, 0x1C, 0xA1, 0xE2, 0x73, 100);
-
-//  Name:     System.RecordedTV.OriginalBroadcastDate -- PKEY_RecordedTV_OriginalBroadcastDate
-//  Type:     DateTime -- VT_FILETIME  (For variants: VT_DATE)
-//  FormatID: 4684FE97-8765-4842-9C13-F006447B178C, 100
-DEFINE_PROPERTYKEY(PKEY_RecordedTV_OriginalBroadcastDate, 0x4684FE97, 0x8765, 0x4842, 0x9C, 0x13, 0xF0, 0x06, 0x44, 0x7B, 0x17, 0x8C, 100);
-
-//  Name:     System.RecordedTV.ProgramDescription -- PKEY_RecordedTV_ProgramDescription
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 6D748DE2-8D38-4CC3-AC60-F009B057C557, 3
-DEFINE_PROPERTYKEY(PKEY_RecordedTV_ProgramDescription, 0x6D748DE2, 0x8D38, 0x4CC3, 0xAC, 0x60, 0xF0, 0x09, 0xB0, 0x57, 0xC5, 0x57, 3);
-
-//  Name:     System.RecordedTV.RecordingTime -- PKEY_RecordedTV_RecordingTime
-//  Type:     DateTime -- VT_FILETIME  (For variants: VT_DATE)
-//  FormatID: A5477F61-7A82-4ECA-9DDE-98B69B2479B3, 100
-DEFINE_PROPERTYKEY(PKEY_RecordedTV_RecordingTime, 0xA5477F61, 0x7A82, 0x4ECA, 0x9D, 0xDE, 0x98, 0xB6, 0x9B, 0x24, 0x79, 0xB3, 100);
-
-//  Name:     System.RecordedTV.StationCallSign -- PKEY_RecordedTV_StationCallSign
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 6D748DE2-8D38-4CC3-AC60-F009B057C557, 5
-//
-//  Example: "TOONP"
-DEFINE_PROPERTYKEY(PKEY_RecordedTV_StationCallSign, 0x6D748DE2, 0x8D38, 0x4CC3, 0xAC, 0x60, 0xF0, 0x09, 0xB0, 0x57, 0xC5, 0x57, 5);
-
-//  Name:     System.RecordedTV.StationName -- PKEY_RecordedTV_StationName
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 1B5439E7-EBA1-4AF8-BDD7-7AF1D4549493, 100
-DEFINE_PROPERTYKEY(PKEY_RecordedTV_StationName, 0x1B5439E7, 0xEBA1, 0x4AF8, 0xBD, 0xD7, 0x7A, 0xF1, 0xD4, 0x54, 0x94, 0x93, 100);
- 
-//-----------------------------------------------------------------------------
-// Search properties
-
-
-
-//  Name:     System.Search.AutoSummary -- PKEY_Search_AutoSummary
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 560C36C0-503A-11CF-BAA1-00004C752A9A, 2
-//
-//  General Summary of the document.
-DEFINE_PROPERTYKEY(PKEY_Search_AutoSummary, 0x560C36C0, 0x503A, 0x11CF, 0xBA, 0xA1, 0x00, 0x00, 0x4C, 0x75, 0x2A, 0x9A, 2);
-
-//  Name:     System.Search.ContainerHash -- PKEY_Search_ContainerHash
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: BCEEE283-35DF-4D53-826A-F36A3EEFC6BE, 100
-//
-//  Hash code used to identify attachments to be deleted based on a common container url
-DEFINE_PROPERTYKEY(PKEY_Search_ContainerHash, 0xBCEEE283, 0x35DF, 0x4D53, 0x82, 0x6A, 0xF3, 0x6A, 0x3E, 0xEF, 0xC6, 0xBE, 100);
-
-//  Name:     System.Search.Contents -- PKEY_Search_Contents
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: (FMTID_Storage) B725F130-47EF-101A-A5F1-02608C9EEBAC, 19 (PID_STG_CONTENTS)
-//  
-//  The contents of the item. This property is for query restrictions only; it cannot be retrieved in a 
-//  query result. The Indexing Service friendly name is 'contents'.
-DEFINE_PROPERTYKEY(PKEY_Search_Contents, 0xB725F130, 0x47EF, 0x101A, 0xA5, 0xF1, 0x02, 0x60, 0x8C, 0x9E, 0xEB, 0xAC, 19);
-
-//  Name:     System.Search.EntryID -- PKEY_Search_EntryID
-//  Type:     Int32 -- VT_I4
-//  FormatID: (FMTID_Query) 49691C90-7E17-101A-A91C-08002B2ECDA9, 5 (PROPID_QUERY_WORKID)
-//  
-//  The entry ID for an item within a given catalog in the Windows Search Index.
-//  This value may be recycled, and therefore is not considered unique over time.
-DEFINE_PROPERTYKEY(PKEY_Search_EntryID, 0x49691C90, 0x7E17, 0x101A, 0xA9, 0x1C, 0x08, 0x00, 0x2B, 0x2E, 0xCD, 0xA9, 5);
-
-//  Name:     System.Search.GatherTime -- PKEY_Search_GatherTime
-//  Type:     DateTime -- VT_FILETIME  (For variants: VT_DATE)
-//  FormatID: 0B63E350-9CCC-11D0-BCDB-00805FCCCE04, 8
-//
-//  The Datetime that the Windows Search Gatherer process last pushed properties of this document to the Windows Search Gatherer Plugins.
-DEFINE_PROPERTYKEY(PKEY_Search_GatherTime, 0x0B63E350, 0x9CCC, 0x11D0, 0xBC, 0xDB, 0x00, 0x80, 0x5F, 0xCC, 0xCE, 0x04, 8);
-
-//  Name:     System.Search.IsClosedDirectory -- PKEY_Search_IsClosedDirectory
-//  Type:     Boolean -- VT_BOOL
-//  FormatID: 0B63E343-9CCC-11D0-BCDB-00805FCCCE04, 23
-//
-//  If this property is emitted with a value of TRUE, then it indicates that this URL's last modified time applies to all of it's children, and if this URL is deleted then all of it's children are deleted as well.  For example, this would be emitted as TRUE when emitting the URL of an email so that all attachments are tied to the last modified time of that email.
-DEFINE_PROPERTYKEY(PKEY_Search_IsClosedDirectory, 0x0B63E343, 0x9CCC, 0x11D0, 0xBC, 0xDB, 0x00, 0x80, 0x5F, 0xCC, 0xCE, 0x04, 23);
-
-//  Name:     System.Search.IsFullyContained -- PKEY_Search_IsFullyContained
-//  Type:     Boolean -- VT_BOOL
-//  FormatID: 0B63E343-9CCC-11D0-BCDB-00805FCCCE04, 24
-//
-//  Any child URL of a URL which has System.Search.IsClosedDirectory=TRUE must emit System.Search.IsFullyContained=TRUE.  This ensures that the URL is not deleted at the end of a crawl because it hasn't been visited (which is the normal mechanism for detecting deletes).  For example an email attachment would emit this property
-DEFINE_PROPERTYKEY(PKEY_Search_IsFullyContained, 0x0B63E343, 0x9CCC, 0x11D0, 0xBC, 0xDB, 0x00, 0x80, 0x5F, 0xCC, 0xCE, 0x04, 24);
-
-//  Name:     System.Search.QueryFocusedSummary -- PKEY_Search_QueryFocusedSummary
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 560C36C0-503A-11CF-BAA1-00004C752A9A, 3
-//
-//  Query Focused Summary of the document.
-DEFINE_PROPERTYKEY(PKEY_Search_QueryFocusedSummary, 0x560C36C0, 0x503A, 0x11CF, 0xBA, 0xA1, 0x00, 0x00, 0x4C, 0x75, 0x2A, 0x9A, 3);
-
-//  Name:     System.Search.Rank -- PKEY_Search_Rank
-//  Type:     Int32 -- VT_I4
-//  FormatID: (FMTID_Query) 49691C90-7E17-101A-A91C-08002B2ECDA9, 3 (PROPID_QUERY_RANK)
-//  
-//  Relevance rank of row. Ranges from 0-1000. Larger numbers = better matches.  Query-time only, not 
-//  defined in Search schema, retrievable but not searchable.
-DEFINE_PROPERTYKEY(PKEY_Search_Rank, 0x49691C90, 0x7E17, 0x101A, 0xA9, 0x1C, 0x08, 0x00, 0x2B, 0x2E, 0xCD, 0xA9, 3);
-
-//  Name:     System.Search.Store -- PKEY_Search_Store
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: A06992B3-8CAF-4ED7-A547-B259E32AC9FC, 100
-//
-//  The identifier for the protocol handler that produced this item. (E.g. MAPI, CSC, FILE etc.)
-DEFINE_PROPERTYKEY(PKEY_Search_Store, 0xA06992B3, 0x8CAF, 0x4ED7, 0xA5, 0x47, 0xB2, 0x59, 0xE3, 0x2A, 0xC9, 0xFC, 100);
-
-//  Name:     System.Search.UrlToIndex -- PKEY_Search_UrlToIndex
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 0B63E343-9CCC-11D0-BCDB-00805FCCCE04, 2
-//
-//  This property should be emitted by a container IFilter for each child URL within the container.  The children will eventually be crawled by the indexer if they are within scope.
-DEFINE_PROPERTYKEY(PKEY_Search_UrlToIndex, 0x0B63E343, 0x9CCC, 0x11D0, 0xBC, 0xDB, 0x00, 0x80, 0x5F, 0xCC, 0xCE, 0x04, 2);
-
-//  Name:     System.Search.UrlToIndexWithModificationTime -- PKEY_Search_UrlToIndexWithModificationTime
-//  Type:     Multivalue Any -- VT_VECTOR | VT_NULL  (For variants: VT_ARRAY | VT_NULL)
-//  FormatID: 0B63E343-9CCC-11D0-BCDB-00805FCCCE04, 12
-//
-//  This property is the same as System.Search.UrlToIndex except that it includes the time the URL was last modified.  This is an optimization for the indexer as it doesn't have to call back into the protocol handler to ask for this information to determine if the content needs to be indexed again.  The property is a vector with two elements, a VT_LPWSTR with the URL and a VT_FILETIME for the last modified time.
-DEFINE_PROPERTYKEY(PKEY_Search_UrlToIndexWithModificationTime, 0x0B63E343, 0x9CCC, 0x11D0, 0xBC, 0xDB, 0x00, 0x80, 0x5F, 0xCC, 0xCE, 0x04, 12);
- 
-//-----------------------------------------------------------------------------
-// Shell properties
-
-
-
-//  Name:     System.DescriptionID -- PKEY_DescriptionID
-//  Type:     Buffer -- VT_VECTOR | VT_UI1  (For variants: VT_ARRAY | VT_UI1)
-//  FormatID: (FMTID_ShellDetails) 28636AA6-953D-11D2-B5D6-00C04FD918D0, 2 (PID_DESCRIPTIONID)
-//
-//  The contents of a SHDESCRIPTIONID structure as a buffer of bytes.
-DEFINE_PROPERTYKEY(PKEY_DescriptionID, 0x28636AA6, 0x953D, 0x11D2, 0xB5, 0xD6, 0x00, 0xC0, 0x4F, 0xD9, 0x18, 0xD0, 2);
-
-//  Name:     System.Link.TargetSFGAOFlagsStrings -- PKEY_Link_TargetSFGAOFlagsStrings
-//  Type:     Multivalue String -- VT_VECTOR | VT_LPWSTR  (For variants: VT_ARRAY | VT_BSTR)
-//  FormatID: D6942081-D53B-443D-AD47-5E059D9CD27A, 3
-//  
-//  Expresses the SFGAO flags of a link as string values and is used as a query optimization.  See 
-//  PKEY_Shell_SFGAOFlagsStrings for possible values of this.
-DEFINE_PROPERTYKEY(PKEY_Link_TargetSFGAOFlagsStrings, 0xD6942081, 0xD53B, 0x443D, 0xAD, 0x47, 0x5E, 0x05, 0x9D, 0x9C, 0xD2, 0x7A, 3);
-
-//  Name:     System.Link.TargetUrl -- PKEY_Link_TargetUrl
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 5CBF2787-48CF-4208-B90E-EE5E5D420294, 2  (PKEYs relating to URLs.  Used by IE History.)
-DEFINE_PROPERTYKEY(PKEY_Link_TargetUrl, 0x5CBF2787, 0x48CF, 0x4208, 0xB9, 0x0E, 0xEE, 0x5E, 0x5D, 0x42, 0x02, 0x94, 2);
-
-//  Name:     System.Shell.SFGAOFlagsStrings -- PKEY_Shell_SFGAOFlagsStrings
-//  Type:     Multivalue String -- VT_VECTOR | VT_LPWSTR  (For variants: VT_ARRAY | VT_BSTR)
-//  FormatID: D6942081-D53B-443D-AD47-5E059D9CD27A, 2
-//
-//  Expresses the SFGAO flags as string values and is used as a query optimization.
-DEFINE_PROPERTYKEY(PKEY_Shell_SFGAOFlagsStrings, 0xD6942081, 0xD53B, 0x443D, 0xAD, 0x47, 0x5E, 0x05, 0x9D, 0x9C, 0xD2, 0x7A, 2);
-
-// Possible discrete values for PKEY_Shell_SFGAOFlagsStrings are:
-#define SFGAOSTR_FILESYS                    L"filesys"               // SFGAO_FILESYSTEM
-#define SFGAOSTR_FILEANC                    L"fileanc"               // SFGAO_FILESYSANCESTOR
-#define SFGAOSTR_STORAGEANC                 L"storageanc"               // SFGAO_STORAGEANCESTOR
-#define SFGAOSTR_STREAM                     L"stream"               // SFGAO_STREAM
-#define SFGAOSTR_LINK                       L"link"               // SFGAO_LINK
-#define SFGAOSTR_HIDDEN                     L"hidden"               // SFGAO_HIDDEN
-#define SFGAOSTR_FOLDER                     L"folder"               // SFGAO_FOLDER
-#define SFGAOSTR_NONENUM                    L"nonenum"               // SFGAO_NONENUMERATED
-#define SFGAOSTR_BROWSABLE                  L"browsable"               // SFGAO_BROWSABLE
- 
-//-----------------------------------------------------------------------------
-// Software properties
-
-
-
-//  Name:     System.Software.DateLastUsed -- PKEY_Software_DateLastUsed
-//  Type:     DateTime -- VT_FILETIME  (For variants: VT_DATE)
-//  FormatID: 841E4F90-FF59-4D16-8947-E81BBFFAB36D, 16
-//  
-//  
-DEFINE_PROPERTYKEY(PKEY_Software_DateLastUsed, 0x841E4F90, 0xFF59, 0x4D16, 0x89, 0x47, 0xE8, 0x1B, 0xBF, 0xFA, 0xB3, 0x6D, 16);
-
-//  Name:     System.Software.ProductName -- PKEY_Software_ProductName
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: (PSFMTID_VERSION) 0CEF7D53-FA64-11D1-A203-0000F81FEDEE, 7
-//  
-//  
-DEFINE_PROPERTYKEY(PKEY_Software_ProductName, 0x0CEF7D53, 0xFA64, 0x11D1, 0xA2, 0x03, 0x00, 0x00, 0xF8, 0x1F, 0xED, 0xEE, 7);
- 
-//-----------------------------------------------------------------------------
-// Sync properties
-
-
-
-//  Name:     System.Sync.Comments -- PKEY_Sync_Comments
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 7BD5533E-AF15-44DB-B8C8-BD6624E1D032, 13
-DEFINE_PROPERTYKEY(PKEY_Sync_Comments, 0x7BD5533E, 0xAF15, 0x44DB, 0xB8, 0xC8, 0xBD, 0x66, 0x24, 0xE1, 0xD0, 0x32, 13);
-
-//  Name:     System.Sync.ConflictDescription -- PKEY_Sync_ConflictDescription
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: CE50C159-2FB8-41FD-BE68-D3E042E274BC, 4
-DEFINE_PROPERTYKEY(PKEY_Sync_ConflictDescription, 0xCE50C159, 0x2FB8, 0x41FD, 0xBE, 0x68, 0xD3, 0xE0, 0x42, 0xE2, 0x74, 0xBC, 4);
-
-//  Name:     System.Sync.ConflictFirstLocation -- PKEY_Sync_ConflictFirstLocation
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: CE50C159-2FB8-41FD-BE68-D3E042E274BC, 6
-DEFINE_PROPERTYKEY(PKEY_Sync_ConflictFirstLocation, 0xCE50C159, 0x2FB8, 0x41FD, 0xBE, 0x68, 0xD3, 0xE0, 0x42, 0xE2, 0x74, 0xBC, 6);
-
-//  Name:     System.Sync.ConflictSecondLocation -- PKEY_Sync_ConflictSecondLocation
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: CE50C159-2FB8-41FD-BE68-D3E042E274BC, 7
-DEFINE_PROPERTYKEY(PKEY_Sync_ConflictSecondLocation, 0xCE50C159, 0x2FB8, 0x41FD, 0xBE, 0x68, 0xD3, 0xE0, 0x42, 0xE2, 0x74, 0xBC, 7);
-
-//  Name:     System.Sync.HandlerCollectionID -- PKEY_Sync_HandlerCollectionID
-//  Type:     Guid -- VT_CLSID
-//  FormatID: 7BD5533E-AF15-44DB-B8C8-BD6624E1D032, 2
-DEFINE_PROPERTYKEY(PKEY_Sync_HandlerCollectionID, 0x7BD5533E, 0xAF15, 0x44DB, 0xB8, 0xC8, 0xBD, 0x66, 0x24, 0xE1, 0xD0, 0x32, 2);
-
-//  Name:     System.Sync.HandlerID -- PKEY_Sync_HandlerID
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 7BD5533E-AF15-44DB-B8C8-BD6624E1D032, 3
-DEFINE_PROPERTYKEY(PKEY_Sync_HandlerID, 0x7BD5533E, 0xAF15, 0x44DB, 0xB8, 0xC8, 0xBD, 0x66, 0x24, 0xE1, 0xD0, 0x32, 3);
-
-//  Name:     System.Sync.HandlerName -- PKEY_Sync_HandlerName
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: CE50C159-2FB8-41FD-BE68-D3E042E274BC, 2
-DEFINE_PROPERTYKEY(PKEY_Sync_HandlerName, 0xCE50C159, 0x2FB8, 0x41FD, 0xBE, 0x68, 0xD3, 0xE0, 0x42, 0xE2, 0x74, 0xBC, 2);
-
-//  Name:     System.Sync.HandlerType -- PKEY_Sync_HandlerType
-//  Type:     UInt32 -- VT_UI4
-//  FormatID: 7BD5533E-AF15-44DB-B8C8-BD6624E1D032, 8
-//  
-//  
-DEFINE_PROPERTYKEY(PKEY_Sync_HandlerType, 0x7BD5533E, 0xAF15, 0x44DB, 0xB8, 0xC8, 0xBD, 0x66, 0x24, 0xE1, 0xD0, 0x32, 8);
-
-// Possible discrete values for PKEY_Sync_HandlerType are:
-#define SYNC_HANDLERTYPE_OTHER              0ul
-#define SYNC_HANDLERTYPE_PROGRAMS           1ul
-#define SYNC_HANDLERTYPE_DEVICES            2ul
-#define SYNC_HANDLERTYPE_FOLDERS            3ul
-#define SYNC_HANDLERTYPE_WEBSERVICES        4ul
-#define SYNC_HANDLERTYPE_COMPUTERS          5ul
-
-//  Name:     System.Sync.HandlerTypeLabel -- PKEY_Sync_HandlerTypeLabel
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 7BD5533E-AF15-44DB-B8C8-BD6624E1D032, 9
-//  
-//  
-DEFINE_PROPERTYKEY(PKEY_Sync_HandlerTypeLabel, 0x7BD5533E, 0xAF15, 0x44DB, 0xB8, 0xC8, 0xBD, 0x66, 0x24, 0xE1, 0xD0, 0x32, 9);
-
-//  Name:     System.Sync.ItemID -- PKEY_Sync_ItemID
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 7BD5533E-AF15-44DB-B8C8-BD6624E1D032, 6
-DEFINE_PROPERTYKEY(PKEY_Sync_ItemID, 0x7BD5533E, 0xAF15, 0x44DB, 0xB8, 0xC8, 0xBD, 0x66, 0x24, 0xE1, 0xD0, 0x32, 6);
-
-//  Name:     System.Sync.ItemName -- PKEY_Sync_ItemName
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: CE50C159-2FB8-41FD-BE68-D3E042E274BC, 3
-DEFINE_PROPERTYKEY(PKEY_Sync_ItemName, 0xCE50C159, 0x2FB8, 0x41FD, 0xBE, 0x68, 0xD3, 0xE0, 0x42, 0xE2, 0x74, 0xBC, 3);
- 
-//-----------------------------------------------------------------------------
-// Task properties
-
-//  Name:     System.Task.BillingInformation -- PKEY_Task_BillingInformation
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: D37D52C6-261C-4303-82B3-08B926AC6F12, 100
-DEFINE_PROPERTYKEY(PKEY_Task_BillingInformation, 0xD37D52C6, 0x261C, 0x4303, 0x82, 0xB3, 0x08, 0xB9, 0x26, 0xAC, 0x6F, 0x12, 100);
-
-//  Name:     System.Task.CompletionStatus -- PKEY_Task_CompletionStatus
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 084D8A0A-E6D5-40DE-BF1F-C8820E7C877C, 100
-DEFINE_PROPERTYKEY(PKEY_Task_CompletionStatus, 0x084D8A0A, 0xE6D5, 0x40DE, 0xBF, 0x1F, 0xC8, 0x82, 0x0E, 0x7C, 0x87, 0x7C, 100);
-
-//  Name:     System.Task.Owner -- PKEY_Task_Owner
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: 08C7CC5F-60F2-4494-AD75-55E3E0B5ADD0, 100
-DEFINE_PROPERTYKEY(PKEY_Task_Owner, 0x08C7CC5F, 0x60F2, 0x4494, 0xAD, 0x75, 0x55, 0xE3, 0xE0, 0xB5, 0xAD, 0xD0, 100);
-
- 
- 
-//-----------------------------------------------------------------------------
-// Video properties
-
-//  Name:     System.Video.Compression -- PKEY_Video_Compression
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: (FMTID_VideoSummaryInformation) 64440491-4C8B-11D1-8B70-080036B11A03, 10 (PIDVSI_COMPRESSION)
-//
-//  Indicates the level of compression for the video stream.  "Compression".
-DEFINE_PROPERTYKEY(PKEY_Video_Compression, 0x64440491, 0x4C8B, 0x11D1, 0x8B, 0x70, 0x08, 0x00, 0x36, 0xB1, 0x1A, 0x03, 10);
-
-//  Name:     System.Video.Director -- PKEY_Video_Director
-//  Type:     Multivalue String -- VT_VECTOR | VT_LPWSTR  (For variants: VT_ARRAY | VT_BSTR)
-//  FormatID: (PSGUID_MEDIAFILESUMMARYINFORMATION) 64440492-4C8B-11D1-8B70-080036B11A03, 20 (PIDMSI_DIRECTOR)
-//
-//  
-DEFINE_PROPERTYKEY(PKEY_Video_Director, 0x64440492, 0x4C8B, 0x11D1, 0x8B, 0x70, 0x08, 0x00, 0x36, 0xB1, 0x1A, 0x03, 20);
-
-//  Name:     System.Video.EncodingBitrate -- PKEY_Video_EncodingBitrate
-//  Type:     UInt32 -- VT_UI4
-//  FormatID: (FMTID_VideoSummaryInformation) 64440491-4C8B-11D1-8B70-080036B11A03, 8 (PIDVSI_DATA_RATE)
-//
-//  Indicates the data rate in "bits per second" for the video stream. "DataRate".
-DEFINE_PROPERTYKEY(PKEY_Video_EncodingBitrate, 0x64440491, 0x4C8B, 0x11D1, 0x8B, 0x70, 0x08, 0x00, 0x36, 0xB1, 0x1A, 0x03, 8);
-
-//  Name:     System.Video.FourCC -- PKEY_Video_FourCC
-//  Type:     UInt32 -- VT_UI4
-//  FormatID: (FMTID_VideoSummaryInformation) 64440491-4C8B-11D1-8B70-080036B11A03, 44
-//  
-//  Indicates the 4CC for the video stream.
-DEFINE_PROPERTYKEY(PKEY_Video_FourCC, 0x64440491, 0x4C8B, 0x11D1, 0x8B, 0x70, 0x08, 0x00, 0x36, 0xB1, 0x1A, 0x03, 44);
-
-//  Name:     System.Video.FrameHeight -- PKEY_Video_FrameHeight
-//  Type:     UInt32 -- VT_UI4
-//  FormatID: (FMTID_VideoSummaryInformation) 64440491-4C8B-11D1-8B70-080036B11A03, 4
-//
-//  Indicates the frame height for the video stream.
-DEFINE_PROPERTYKEY(PKEY_Video_FrameHeight, 0x64440491, 0x4C8B, 0x11D1, 0x8B, 0x70, 0x08, 0x00, 0x36, 0xB1, 0x1A, 0x03, 4);
-
-//  Name:     System.Video.FrameRate -- PKEY_Video_FrameRate
-//  Type:     UInt32 -- VT_UI4
-//  FormatID: (FMTID_VideoSummaryInformation) 64440491-4C8B-11D1-8B70-080036B11A03, 6 (PIDVSI_FRAME_RATE)
-//
-//  Indicates the frame rate in "frames per millisecond" for the video stream.  "FrameRate".
-DEFINE_PROPERTYKEY(PKEY_Video_FrameRate, 0x64440491, 0x4C8B, 0x11D1, 0x8B, 0x70, 0x08, 0x00, 0x36, 0xB1, 0x1A, 0x03, 6);
-
-//  Name:     System.Video.FrameWidth -- PKEY_Video_FrameWidth
-//  Type:     UInt32 -- VT_UI4
-//  FormatID: (FMTID_VideoSummaryInformation) 64440491-4C8B-11D1-8B70-080036B11A03, 3
-//
-//  Indicates the frame width for the video stream.
-DEFINE_PROPERTYKEY(PKEY_Video_FrameWidth, 0x64440491, 0x4C8B, 0x11D1, 0x8B, 0x70, 0x08, 0x00, 0x36, 0xB1, 0x1A, 0x03, 3);
-
-//  Name:     System.Video.HorizontalAspectRatio -- PKEY_Video_HorizontalAspectRatio
-//  Type:     UInt32 -- VT_UI4
-//  FormatID: (FMTID_VideoSummaryInformation) 64440491-4C8B-11D1-8B70-080036B11A03, 42
-//  
-//  Indicates the horizontal portion of the aspect ratio. The X portion of XX:YY,
-//  like 16:9.
-DEFINE_PROPERTYKEY(PKEY_Video_HorizontalAspectRatio, 0x64440491, 0x4C8B, 0x11D1, 0x8B, 0x70, 0x08, 0x00, 0x36, 0xB1, 0x1A, 0x03, 42);
-
-//  Name:     System.Video.SampleSize -- PKEY_Video_SampleSize
-//  Type:     UInt32 -- VT_UI4
-//  FormatID: (FMTID_VideoSummaryInformation) 64440491-4C8B-11D1-8B70-080036B11A03, 9 (PIDVSI_SAMPLE_SIZE)
-//
-//  Indicates the sample size in bits for the video stream.  "SampleSize".
-DEFINE_PROPERTYKEY(PKEY_Video_SampleSize, 0x64440491, 0x4C8B, 0x11D1, 0x8B, 0x70, 0x08, 0x00, 0x36, 0xB1, 0x1A, 0x03, 9);
-
-//  Name:     System.Video.StreamName -- PKEY_Video_StreamName
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: (FMTID_VideoSummaryInformation) 64440491-4C8B-11D1-8B70-080036B11A03, 2 (PIDVSI_STREAM_NAME)
-//
-//  Indicates the name for the video stream. "StreamName".
-DEFINE_PROPERTYKEY(PKEY_Video_StreamName, 0x64440491, 0x4C8B, 0x11D1, 0x8B, 0x70, 0x08, 0x00, 0x36, 0xB1, 0x1A, 0x03, 2);
-
-//  Name:     System.Video.StreamNumber -- PKEY_Video_StreamNumber
-//  Type:     UInt16 -- VT_UI2
-//  FormatID: (FMTID_VideoSummaryInformation) 64440491-4C8B-11D1-8B70-080036B11A03, 11 (PIDVSI_STREAM_NUMBER)
-//
-//  "Stream Number".
-DEFINE_PROPERTYKEY(PKEY_Video_StreamNumber, 0x64440491, 0x4C8B, 0x11D1, 0x8B, 0x70, 0x08, 0x00, 0x36, 0xB1, 0x1A, 0x03, 11);
-
-//  Name:     System.Video.TotalBitrate -- PKEY_Video_TotalBitrate
-//  Type:     UInt32 -- VT_UI4
-//  FormatID: (FMTID_VideoSummaryInformation) 64440491-4C8B-11D1-8B70-080036B11A03, 43 (PIDVSI_TOTAL_BITRATE)
-//
-//  Indicates the total data rate in "bits per second" for all video and audio streams.
-DEFINE_PROPERTYKEY(PKEY_Video_TotalBitrate, 0x64440491, 0x4C8B, 0x11D1, 0x8B, 0x70, 0x08, 0x00, 0x36, 0xB1, 0x1A, 0x03, 43);
-
-//  Name:     System.Video.VerticalAspectRatio -- PKEY_Video_VerticalAspectRatio
-//  Type:     UInt32 -- VT_UI4
-//  FormatID: (FMTID_VideoSummaryInformation) 64440491-4C8B-11D1-8B70-080036B11A03, 45
-//  
-//  Indicates the vertical portion of the aspect ratio. The Y portion of 
-//  XX:YY, like 16:9.
-DEFINE_PROPERTYKEY(PKEY_Video_VerticalAspectRatio, 0x64440491, 0x4C8B, 0x11D1, 0x8B, 0x70, 0x08, 0x00, 0x36, 0xB1, 0x1A, 0x03, 45);
-
- 
- 
-//-----------------------------------------------------------------------------
-// Volume properties
-
-//  Name:     System.Volume.FileSystem -- PKEY_Volume_FileSystem
-//  Type:     String -- VT_LPWSTR  (For variants: VT_BSTR)
-//  FormatID: (FMTID_Volume) 9B174B35-40FF-11D2-A27E-00C04FC30871, 4 (PID_VOLUME_FILESYSTEM)  (Filesystem Volume Properties)
-//
-//  Indicates the filesystem of the volume.
-DEFINE_PROPERTYKEY(PKEY_Volume_FileSystem, 0x9B174B35, 0x40FF, 0x11D2, 0xA2, 0x7E, 0x00, 0xC0, 0x4F, 0xC3, 0x08, 0x71, 4);
-
-//  Name:     System.Volume.IsMappedDrive -- PKEY_Volume_IsMappedDrive
-//  Type:     Boolean -- VT_BOOL
-//  FormatID: 149C0B69-2C2D-48FC-808F-D318D78C4636, 2
-DEFINE_PROPERTYKEY(PKEY_Volume_IsMappedDrive, 0x149C0B69, 0x2C2D, 0x48FC, 0x80, 0x8F, 0xD3, 0x18, 0xD7, 0x8C, 0x46, 0x36, 2);
-
-//  Name:     System.Volume.IsRoot -- PKEY_Volume_IsRoot
-//  Type:     Boolean -- VT_BOOL
-//  FormatID: (FMTID_Volume) 9B174B35-40FF-11D2-A27E-00C04FC30871, 10  (Filesystem Volume Properties)
-//
-//  
-DEFINE_PROPERTYKEY(PKEY_Volume_IsRoot, 0x9B174B35, 0x40FF, 0x11D2, 0xA2, 0x7E, 0x00, 0xC0, 0x4F, 0xC3, 0x08, 0x71, 10);
-
-#endif  /* _INC_PROPKEY */
-
-
diff --git a/src/hostapi/wasapi/mingw-include/propkeydef.h b/src/hostapi/wasapi/mingw-include/propkeydef.h
index 65fcb87..a361044 100644
--- a/src/hostapi/wasapi/mingw-include/propkeydef.h
+++ b/src/hostapi/wasapi/mingw-include/propkeydef.h
@@ -1,26 +1,26 @@
-#ifndef PID_FIRST_USABLE
-#define PID_FIRST_USABLE 2
-#endif
-
-#ifndef REFPROPERTYKEY
-#ifdef __cplusplus
-#define REFPROPERTYKEY const PROPERTYKEY &
-#else // !__cplusplus
-#define REFPROPERTYKEY const PROPERTYKEY * __MIDL_CONST
-#endif // __cplusplus
-#endif //REFPROPERTYKEY
-
-#ifdef DEFINE_PROPERTYKEY
-#undef DEFINE_PROPERTYKEY
-#endif
-
-#ifdef INITGUID
-#define DEFINE_PROPERTYKEY(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8, pid) EXTERN_C const PROPERTYKEY DECLSPEC_SELECTANY name = { { l, w1, w2, { b1, b2,  b3,  b4,  b5,  b6,  b7,  b8 } }, pid }
-#else
-#define DEFINE_PROPERTYKEY(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8, pid) EXTERN_C const PROPERTYKEY name
-#endif // INITGUID
-
-#ifndef IsEqualPropertyKey
-#define IsEqualPropertyKey(a, b)   (((a).pid == (b).pid) && IsEqualIID((a).fmtid, (b).fmtid) )
-#endif  // IsEqualPropertyKey
-
+#ifndef PID_FIRST_USABLE
+#define PID_FIRST_USABLE 2
+#endif
+
+#ifndef REFPROPERTYKEY
+#ifdef __cplusplus
+#define REFPROPERTYKEY const PROPERTYKEY &
+#else // !__cplusplus
+#define REFPROPERTYKEY const PROPERTYKEY * __MIDL_CONST
+#endif // __cplusplus
+#endif //REFPROPERTYKEY
+
+#ifdef DEFINE_PROPERTYKEY
+#undef DEFINE_PROPERTYKEY
+#endif
+
+#ifdef INITGUID
+#define DEFINE_PROPERTYKEY(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8, pid) EXTERN_C const PROPERTYKEY DECLSPEC_SELECTANY name = { { l, w1, w2, { b1, b2,  b3,  b4,  b5,  b6,  b7,  b8 } }, pid }
+#else
+#define DEFINE_PROPERTYKEY(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8, pid) EXTERN_C const PROPERTYKEY name
+#endif // INITGUID
+
+#ifndef IsEqualPropertyKey
+#define IsEqualPropertyKey(a, b)   (((a).pid == (b).pid) && IsEqualIID((a).fmtid, (b).fmtid) )
+#endif  // IsEqualPropertyKey
+
diff --git a/src/hostapi/wasapi/mingw-include/propsys.h b/src/hostapi/wasapi/mingw-include/propsys.h
index 5c1312c..5ed5608 100644
--- a/src/hostapi/wasapi/mingw-include/propsys.h
+++ b/src/hostapi/wasapi/mingw-include/propsys.h
@@ -1,3605 +1,3605 @@
-
-
-/* this ALWAYS GENERATED file contains the definitions for the interfaces */
-
-
- /* File created by MIDL compiler version 7.00.0499 */
-/* Compiler settings for propsys.idl:
-    Oicf, W1, Zp8, env=Win32 (32b run)
-    protocol : dce , ms_ext, c_ext, robust
-    error checks: allocation ref bounds_check enum stub_data 
-    VC __declspec() decoration level: 
-         __declspec(uuid()), __declspec(selectany), __declspec(novtable)
-         DECLSPEC_UUID(), MIDL_INTERFACE()
-*/
-//@@MIDL_FILE_HEADING(  )
-
-#pragma warning( disable: 4049 )  /* more than 64k source lines */
-
-
-/* verify that the <rpcndr.h> version is high enough to compile this file*/
-#ifndef __REQUIRED_RPCNDR_H_VERSION__
-#define __REQUIRED_RPCNDR_H_VERSION__ 475
-#endif
-
-/* verify that the <rpcsal.h> version is high enough to compile this file*/
-#ifndef __REQUIRED_RPCSAL_H_VERSION__
-#define __REQUIRED_RPCSAL_H_VERSION__ 100
-#endif
-
-#include "rpc.h"
-#include "rpcndr.h"
-
-#ifndef __RPCNDR_H_VERSION__
-#error this stub requires an updated version of <rpcndr.h>
-#endif // __RPCNDR_H_VERSION__
-
-#ifndef COM_NO_WINDOWS_H
-#include "windows.h"
-#include "ole2.h"
-#endif /*COM_NO_WINDOWS_H*/
-
-#ifndef __propsys_h__
-#define __propsys_h__
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-#pragma once
-#endif
-
-/* Forward Declarations */ 
-
-#ifndef __IInitializeWithFile_FWD_DEFINED__
-#define __IInitializeWithFile_FWD_DEFINED__
-typedef interface IInitializeWithFile IInitializeWithFile;
-#endif 	/* __IInitializeWithFile_FWD_DEFINED__ */
-
-
-#ifndef __IInitializeWithStream_FWD_DEFINED__
-#define __IInitializeWithStream_FWD_DEFINED__
-typedef interface IInitializeWithStream IInitializeWithStream;
-#endif 	/* __IInitializeWithStream_FWD_DEFINED__ */
-
-
-#ifndef __IPropertyStore_FWD_DEFINED__
-#define __IPropertyStore_FWD_DEFINED__
-typedef interface IPropertyStore IPropertyStore;
-#endif 	/* __IPropertyStore_FWD_DEFINED__ */
-
-
-#ifndef __INamedPropertyStore_FWD_DEFINED__
-#define __INamedPropertyStore_FWD_DEFINED__
-typedef interface INamedPropertyStore INamedPropertyStore;
-#endif 	/* __INamedPropertyStore_FWD_DEFINED__ */
-
-
-#ifndef __IObjectWithPropertyKey_FWD_DEFINED__
-#define __IObjectWithPropertyKey_FWD_DEFINED__
-typedef interface IObjectWithPropertyKey IObjectWithPropertyKey;
-#endif 	/* __IObjectWithPropertyKey_FWD_DEFINED__ */
-
-
-#ifndef __IPropertyChange_FWD_DEFINED__
-#define __IPropertyChange_FWD_DEFINED__
-typedef interface IPropertyChange IPropertyChange;
-#endif 	/* __IPropertyChange_FWD_DEFINED__ */
-
-
-#ifndef __IPropertyChangeArray_FWD_DEFINED__
-#define __IPropertyChangeArray_FWD_DEFINED__
-typedef interface IPropertyChangeArray IPropertyChangeArray;
-#endif 	/* __IPropertyChangeArray_FWD_DEFINED__ */
-
-
-#ifndef __IPropertyStoreCapabilities_FWD_DEFINED__
-#define __IPropertyStoreCapabilities_FWD_DEFINED__
-typedef interface IPropertyStoreCapabilities IPropertyStoreCapabilities;
-#endif 	/* __IPropertyStoreCapabilities_FWD_DEFINED__ */
-
-
-#ifndef __IPropertyStoreCache_FWD_DEFINED__
-#define __IPropertyStoreCache_FWD_DEFINED__
-typedef interface IPropertyStoreCache IPropertyStoreCache;
-#endif 	/* __IPropertyStoreCache_FWD_DEFINED__ */
-
-
-#ifndef __IPropertyEnumType_FWD_DEFINED__
-#define __IPropertyEnumType_FWD_DEFINED__
-typedef interface IPropertyEnumType IPropertyEnumType;
-#endif 	/* __IPropertyEnumType_FWD_DEFINED__ */
-
-
-#ifndef __IPropertyEnumTypeList_FWD_DEFINED__
-#define __IPropertyEnumTypeList_FWD_DEFINED__
-typedef interface IPropertyEnumTypeList IPropertyEnumTypeList;
-#endif 	/* __IPropertyEnumTypeList_FWD_DEFINED__ */
-
-
-#ifndef __IPropertyDescription_FWD_DEFINED__
-#define __IPropertyDescription_FWD_DEFINED__
-typedef interface IPropertyDescription IPropertyDescription;
-#endif 	/* __IPropertyDescription_FWD_DEFINED__ */
-
-
-#ifndef __IPropertyDescriptionAliasInfo_FWD_DEFINED__
-#define __IPropertyDescriptionAliasInfo_FWD_DEFINED__
-typedef interface IPropertyDescriptionAliasInfo IPropertyDescriptionAliasInfo;
-#endif 	/* __IPropertyDescriptionAliasInfo_FWD_DEFINED__ */
-
-
-#ifndef __IPropertyDescriptionSearchInfo_FWD_DEFINED__
-#define __IPropertyDescriptionSearchInfo_FWD_DEFINED__
-typedef interface IPropertyDescriptionSearchInfo IPropertyDescriptionSearchInfo;
-#endif 	/* __IPropertyDescriptionSearchInfo_FWD_DEFINED__ */
-
-
-#ifndef __IPropertySystem_FWD_DEFINED__
-#define __IPropertySystem_FWD_DEFINED__
-typedef interface IPropertySystem IPropertySystem;
-#endif 	/* __IPropertySystem_FWD_DEFINED__ */
-
-
-#ifndef __IPropertyDescriptionList_FWD_DEFINED__
-#define __IPropertyDescriptionList_FWD_DEFINED__
-typedef interface IPropertyDescriptionList IPropertyDescriptionList;
-#endif 	/* __IPropertyDescriptionList_FWD_DEFINED__ */
-
-
-#ifndef __IPropertyStoreFactory_FWD_DEFINED__
-#define __IPropertyStoreFactory_FWD_DEFINED__
-typedef interface IPropertyStoreFactory IPropertyStoreFactory;
-#endif 	/* __IPropertyStoreFactory_FWD_DEFINED__ */
-
-
-#ifndef __IDelayedPropertyStoreFactory_FWD_DEFINED__
-#define __IDelayedPropertyStoreFactory_FWD_DEFINED__
-typedef interface IDelayedPropertyStoreFactory IDelayedPropertyStoreFactory;
-#endif 	/* __IDelayedPropertyStoreFactory_FWD_DEFINED__ */
-
-
-#ifndef __IPersistSerializedPropStorage_FWD_DEFINED__
-#define __IPersistSerializedPropStorage_FWD_DEFINED__
-typedef interface IPersistSerializedPropStorage IPersistSerializedPropStorage;
-#endif 	/* __IPersistSerializedPropStorage_FWD_DEFINED__ */
-
-
-#ifndef __IPropertySystemChangeNotify_FWD_DEFINED__
-#define __IPropertySystemChangeNotify_FWD_DEFINED__
-typedef interface IPropertySystemChangeNotify IPropertySystemChangeNotify;
-#endif 	/* __IPropertySystemChangeNotify_FWD_DEFINED__ */
-
-
-#ifndef __ICreateObject_FWD_DEFINED__
-#define __ICreateObject_FWD_DEFINED__
-typedef interface ICreateObject ICreateObject;
-#endif 	/* __ICreateObject_FWD_DEFINED__ */
-
-
-#ifndef __InMemoryPropertyStore_FWD_DEFINED__
-#define __InMemoryPropertyStore_FWD_DEFINED__
-
-#ifdef __cplusplus
-typedef class InMemoryPropertyStore InMemoryPropertyStore;
-#else
-typedef struct InMemoryPropertyStore InMemoryPropertyStore;
-#endif /* __cplusplus */
-
-#endif 	/* __InMemoryPropertyStore_FWD_DEFINED__ */
-
-
-#ifndef __PropertySystem_FWD_DEFINED__
-#define __PropertySystem_FWD_DEFINED__
-
-#ifdef __cplusplus
-typedef class PropertySystem PropertySystem;
-#else
-typedef struct PropertySystem PropertySystem;
-#endif /* __cplusplus */
-
-#endif 	/* __PropertySystem_FWD_DEFINED__ */
-
-
-/* header files for imported files */
-#include "objidl.h"
-#include "oleidl.h"
-#include "ocidl.h"
-#include "shtypes.h"
-#include "structuredquery.h"
-
-#ifdef __cplusplus
-extern "C"{
-#endif 
-
-
-/* interface __MIDL_itf_propsys_0000_0000 */
-/* [local] */ 
-
-#ifndef PSSTDAPI
-#if defined(_PROPSYS_)
-#define PSSTDAPI          STDAPI
-#define PSSTDAPI_(type)   STDAPI_(type)
-#else
-#define PSSTDAPI          EXTERN_C DECLSPEC_IMPORT HRESULT STDAPICALLTYPE
-#define PSSTDAPI_(type)   EXTERN_C DECLSPEC_IMPORT type STDAPICALLTYPE
-#endif
-#endif // PSSTDAPI
-#if 0
-typedef PROPERTYKEY *REFPROPERTYKEY;
-
-#endif // 0
-#include <propkeydef.h>
-
-
-extern RPC_IF_HANDLE __MIDL_itf_propsys_0000_0000_v0_0_c_ifspec;
-extern RPC_IF_HANDLE __MIDL_itf_propsys_0000_0000_v0_0_s_ifspec;
-
-#ifndef __IInitializeWithFile_INTERFACE_DEFINED__
-#define __IInitializeWithFile_INTERFACE_DEFINED__
-
-/* interface IInitializeWithFile */
-/* [unique][object][uuid] */ 
-
-
-EXTERN_C const IID IID_IInitializeWithFile;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("b7d14566-0509-4cce-a71f-0a554233bd9b")
-    IInitializeWithFile : public IUnknown
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE Initialize( 
-            /* [string][in] */ __RPC__in LPCWSTR pszFilePath,
-            /* [in] */ DWORD grfMode) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IInitializeWithFileVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IInitializeWithFile * This,
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IInitializeWithFile * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IInitializeWithFile * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *Initialize )( 
-            IInitializeWithFile * This,
-            /* [string][in] */ __RPC__in LPCWSTR pszFilePath,
-            /* [in] */ DWORD grfMode);
-        
-        END_INTERFACE
-    } IInitializeWithFileVtbl;
-
-    interface IInitializeWithFile
-    {
-        CONST_VTBL struct IInitializeWithFileVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IInitializeWithFile_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IInitializeWithFile_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IInitializeWithFile_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IInitializeWithFile_Initialize(This,pszFilePath,grfMode)	\
-    ( (This)->lpVtbl -> Initialize(This,pszFilePath,grfMode) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IInitializeWithFile_INTERFACE_DEFINED__ */
-
-
-#ifndef __IInitializeWithStream_INTERFACE_DEFINED__
-#define __IInitializeWithStream_INTERFACE_DEFINED__
-
-/* interface IInitializeWithStream */
-/* [unique][object][uuid] */ 
-
-
-EXTERN_C const IID IID_IInitializeWithStream;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("b824b49d-22ac-4161-ac8a-9916e8fa3f7f")
-    IInitializeWithStream : public IUnknown
-    {
-    public:
-        virtual /* [local] */ HRESULT STDMETHODCALLTYPE Initialize( 
-            /* [in] */ IStream *pstream,
-            /* [in] */ DWORD grfMode) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IInitializeWithStreamVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IInitializeWithStream * This,
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IInitializeWithStream * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IInitializeWithStream * This);
-        
-        /* [local] */ HRESULT ( STDMETHODCALLTYPE *Initialize )( 
-            IInitializeWithStream * This,
-            /* [in] */ IStream *pstream,
-            /* [in] */ DWORD grfMode);
-        
-        END_INTERFACE
-    } IInitializeWithStreamVtbl;
-
-    interface IInitializeWithStream
-    {
-        CONST_VTBL struct IInitializeWithStreamVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IInitializeWithStream_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IInitializeWithStream_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IInitializeWithStream_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IInitializeWithStream_Initialize(This,pstream,grfMode)	\
-    ( (This)->lpVtbl -> Initialize(This,pstream,grfMode) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-/* [call_as] */ HRESULT STDMETHODCALLTYPE IInitializeWithStream_RemoteInitialize_Proxy( 
-    IInitializeWithStream * This,
-    /* [in] */ __RPC__in_opt IStream *pstream,
-    /* [in] */ DWORD grfMode);
-
-
-void __RPC_STUB IInitializeWithStream_RemoteInitialize_Stub(
-    IRpcStubBuffer *This,
-    IRpcChannelBuffer *_pRpcChannelBuffer,
-    PRPC_MESSAGE _pRpcMessage,
-    DWORD *_pdwStubPhase);
-
-
-
-#endif 	/* __IInitializeWithStream_INTERFACE_DEFINED__ */
-
-
-#ifndef __IPropertyStore_INTERFACE_DEFINED__
-#define __IPropertyStore_INTERFACE_DEFINED__
-
-/* interface IPropertyStore */
-/* [unique][object][helpstring][uuid] */ 
-
-
-EXTERN_C const IID IID_IPropertyStore;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("886d8eeb-8cf2-4446-8d02-cdba1dbdcf99")
-    IPropertyStore : public IUnknown
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE GetCount( 
-            /* [out] */ __RPC__out DWORD *cProps) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetAt( 
-            /* [in] */ DWORD iProp,
-            /* [out] */ __RPC__out PROPERTYKEY *pkey) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetValue( 
-            /* [in] */ __RPC__in REFPROPERTYKEY key,
-            /* [out] */ __RPC__out PROPVARIANT *pv) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE SetValue( 
-            /* [in] */ __RPC__in REFPROPERTYKEY key,
-            /* [in] */ __RPC__in REFPROPVARIANT propvar) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE Commit( void) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IPropertyStoreVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IPropertyStore * This,
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IPropertyStore * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IPropertyStore * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetCount )( 
-            IPropertyStore * This,
-            /* [out] */ __RPC__out DWORD *cProps);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetAt )( 
-            IPropertyStore * This,
-            /* [in] */ DWORD iProp,
-            /* [out] */ __RPC__out PROPERTYKEY *pkey);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetValue )( 
-            IPropertyStore * This,
-            /* [in] */ __RPC__in REFPROPERTYKEY key,
-            /* [out] */ __RPC__out PROPVARIANT *pv);
-        
-        HRESULT ( STDMETHODCALLTYPE *SetValue )( 
-            IPropertyStore * This,
-            /* [in] */ __RPC__in REFPROPERTYKEY key,
-            /* [in] */ __RPC__in REFPROPVARIANT propvar);
-        
-        HRESULT ( STDMETHODCALLTYPE *Commit )( 
-            IPropertyStore * This);
-        
-        END_INTERFACE
-    } IPropertyStoreVtbl;
-
-    interface IPropertyStore
-    {
-        CONST_VTBL struct IPropertyStoreVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IPropertyStore_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IPropertyStore_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IPropertyStore_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IPropertyStore_GetCount(This,cProps)	\
-    ( (This)->lpVtbl -> GetCount(This,cProps) ) 
-
-#define IPropertyStore_GetAt(This,iProp,pkey)	\
-    ( (This)->lpVtbl -> GetAt(This,iProp,pkey) ) 
-
-#define IPropertyStore_GetValue(This,key,pv)	\
-    ( (This)->lpVtbl -> GetValue(This,key,pv) ) 
-
-#define IPropertyStore_SetValue(This,key,propvar)	\
-    ( (This)->lpVtbl -> SetValue(This,key,propvar) ) 
-
-#define IPropertyStore_Commit(This)	\
-    ( (This)->lpVtbl -> Commit(This) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IPropertyStore_INTERFACE_DEFINED__ */
-
-
-/* interface __MIDL_itf_propsys_0000_0003 */
-/* [local] */ 
-
-typedef /* [unique] */  __RPC_unique_pointer IPropertyStore *LPPROPERTYSTORE;
-
-
-
-extern RPC_IF_HANDLE __MIDL_itf_propsys_0000_0003_v0_0_c_ifspec;
-extern RPC_IF_HANDLE __MIDL_itf_propsys_0000_0003_v0_0_s_ifspec;
-
-#ifndef __INamedPropertyStore_INTERFACE_DEFINED__
-#define __INamedPropertyStore_INTERFACE_DEFINED__
-
-/* interface INamedPropertyStore */
-/* [unique][object][uuid] */ 
-
-
-EXTERN_C const IID IID_INamedPropertyStore;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("71604b0f-97b0-4764-8577-2f13e98a1422")
-    INamedPropertyStore : public IUnknown
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE GetNamedValue( 
-            /* [string][in] */ __RPC__in LPCWSTR pszName,
-            /* [out] */ __RPC__out PROPVARIANT *ppropvar) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE SetNamedValue( 
-            /* [string][in] */ __RPC__in LPCWSTR pszName,
-            /* [in] */ __RPC__in REFPROPVARIANT propvar) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetNameCount( 
-            /* [out] */ __RPC__out DWORD *pdwCount) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetNameAt( 
-            /* [in] */ DWORD iProp,
-            /* [out] */ __RPC__deref_out_opt BSTR *pbstrName) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct INamedPropertyStoreVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            INamedPropertyStore * This,
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            INamedPropertyStore * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            INamedPropertyStore * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetNamedValue )( 
-            INamedPropertyStore * This,
-            /* [string][in] */ __RPC__in LPCWSTR pszName,
-            /* [out] */ __RPC__out PROPVARIANT *ppropvar);
-        
-        HRESULT ( STDMETHODCALLTYPE *SetNamedValue )( 
-            INamedPropertyStore * This,
-            /* [string][in] */ __RPC__in LPCWSTR pszName,
-            /* [in] */ __RPC__in REFPROPVARIANT propvar);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetNameCount )( 
-            INamedPropertyStore * This,
-            /* [out] */ __RPC__out DWORD *pdwCount);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetNameAt )( 
-            INamedPropertyStore * This,
-            /* [in] */ DWORD iProp,
-            /* [out] */ __RPC__deref_out_opt BSTR *pbstrName);
-        
-        END_INTERFACE
-    } INamedPropertyStoreVtbl;
-
-    interface INamedPropertyStore
-    {
-        CONST_VTBL struct INamedPropertyStoreVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define INamedPropertyStore_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define INamedPropertyStore_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define INamedPropertyStore_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define INamedPropertyStore_GetNamedValue(This,pszName,ppropvar)	\
-    ( (This)->lpVtbl -> GetNamedValue(This,pszName,ppropvar) ) 
-
-#define INamedPropertyStore_SetNamedValue(This,pszName,propvar)	\
-    ( (This)->lpVtbl -> SetNamedValue(This,pszName,propvar) ) 
-
-#define INamedPropertyStore_GetNameCount(This,pdwCount)	\
-    ( (This)->lpVtbl -> GetNameCount(This,pdwCount) ) 
-
-#define INamedPropertyStore_GetNameAt(This,iProp,pbstrName)	\
-    ( (This)->lpVtbl -> GetNameAt(This,iProp,pbstrName) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __INamedPropertyStore_INTERFACE_DEFINED__ */
-
-
-/* interface __MIDL_itf_propsys_0000_0004 */
-/* [local] */ 
-
-/* [v1_enum] */ 
-enum tagGETPROPERTYSTOREFLAGS
-    {	GPS_DEFAULT	= 0,
-	GPS_HANDLERPROPERTIESONLY	= 0x1,
-	GPS_READWRITE	= 0x2,
-	GPS_TEMPORARY	= 0x4,
-	GPS_FASTPROPERTIESONLY	= 0x8,
-	GPS_OPENSLOWITEM	= 0x10,
-	GPS_DELAYCREATION	= 0x20,
-	GPS_BESTEFFORT	= 0x40,
-	GPS_MASK_VALID	= 0x7f
-    } ;
-typedef int GETPROPERTYSTOREFLAGS;
-
-
-
-extern RPC_IF_HANDLE __MIDL_itf_propsys_0000_0004_v0_0_c_ifspec;
-extern RPC_IF_HANDLE __MIDL_itf_propsys_0000_0004_v0_0_s_ifspec;
-
-#ifndef __IObjectWithPropertyKey_INTERFACE_DEFINED__
-#define __IObjectWithPropertyKey_INTERFACE_DEFINED__
-
-/* interface IObjectWithPropertyKey */
-/* [uuid][object] */ 
-
-
-EXTERN_C const IID IID_IObjectWithPropertyKey;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("fc0ca0a7-c316-4fd2-9031-3e628e6d4f23")
-    IObjectWithPropertyKey : public IUnknown
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE SetPropertyKey( 
-            /* [in] */ __RPC__in REFPROPERTYKEY key) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetPropertyKey( 
-            /* [out] */ __RPC__out PROPERTYKEY *pkey) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IObjectWithPropertyKeyVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IObjectWithPropertyKey * This,
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IObjectWithPropertyKey * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IObjectWithPropertyKey * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *SetPropertyKey )( 
-            IObjectWithPropertyKey * This,
-            /* [in] */ __RPC__in REFPROPERTYKEY key);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetPropertyKey )( 
-            IObjectWithPropertyKey * This,
-            /* [out] */ __RPC__out PROPERTYKEY *pkey);
-        
-        END_INTERFACE
-    } IObjectWithPropertyKeyVtbl;
-
-    interface IObjectWithPropertyKey
-    {
-        CONST_VTBL struct IObjectWithPropertyKeyVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IObjectWithPropertyKey_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IObjectWithPropertyKey_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IObjectWithPropertyKey_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IObjectWithPropertyKey_SetPropertyKey(This,key)	\
-    ( (This)->lpVtbl -> SetPropertyKey(This,key) ) 
-
-#define IObjectWithPropertyKey_GetPropertyKey(This,pkey)	\
-    ( (This)->lpVtbl -> GetPropertyKey(This,pkey) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IObjectWithPropertyKey_INTERFACE_DEFINED__ */
-
-
-/* interface __MIDL_itf_propsys_0000_0005 */
-/* [local] */ 
-
-typedef /* [v1_enum] */ 
-enum tagPKA_FLAGS
-    {	PKA_SET	= 0,
-	PKA_APPEND	= ( PKA_SET + 1 ) ,
-	PKA_DELETE	= ( PKA_APPEND + 1 ) 
-    } 	PKA_FLAGS;
-
-
-
-extern RPC_IF_HANDLE __MIDL_itf_propsys_0000_0005_v0_0_c_ifspec;
-extern RPC_IF_HANDLE __MIDL_itf_propsys_0000_0005_v0_0_s_ifspec;
-
-#ifndef __IPropertyChange_INTERFACE_DEFINED__
-#define __IPropertyChange_INTERFACE_DEFINED__
-
-/* interface IPropertyChange */
-/* [unique][object][uuid] */ 
-
-
-EXTERN_C const IID IID_IPropertyChange;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("f917bc8a-1bba-4478-a245-1bde03eb9431")
-    IPropertyChange : public IObjectWithPropertyKey
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE ApplyToPropVariant( 
-            /* [in] */ __RPC__in REFPROPVARIANT propvarIn,
-            /* [out] */ __RPC__out PROPVARIANT *ppropvarOut) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IPropertyChangeVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IPropertyChange * This,
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IPropertyChange * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IPropertyChange * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *SetPropertyKey )( 
-            IPropertyChange * This,
-            /* [in] */ __RPC__in REFPROPERTYKEY key);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetPropertyKey )( 
-            IPropertyChange * This,
-            /* [out] */ __RPC__out PROPERTYKEY *pkey);
-        
-        HRESULT ( STDMETHODCALLTYPE *ApplyToPropVariant )( 
-            IPropertyChange * This,
-            /* [in] */ __RPC__in REFPROPVARIANT propvarIn,
-            /* [out] */ __RPC__out PROPVARIANT *ppropvarOut);
-        
-        END_INTERFACE
-    } IPropertyChangeVtbl;
-
-    interface IPropertyChange
-    {
-        CONST_VTBL struct IPropertyChangeVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IPropertyChange_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IPropertyChange_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IPropertyChange_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IPropertyChange_SetPropertyKey(This,key)	\
-    ( (This)->lpVtbl -> SetPropertyKey(This,key) ) 
-
-#define IPropertyChange_GetPropertyKey(This,pkey)	\
-    ( (This)->lpVtbl -> GetPropertyKey(This,pkey) ) 
-
-
-#define IPropertyChange_ApplyToPropVariant(This,propvarIn,ppropvarOut)	\
-    ( (This)->lpVtbl -> ApplyToPropVariant(This,propvarIn,ppropvarOut) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IPropertyChange_INTERFACE_DEFINED__ */
-
-
-#ifndef __IPropertyChangeArray_INTERFACE_DEFINED__
-#define __IPropertyChangeArray_INTERFACE_DEFINED__
-
-/* interface IPropertyChangeArray */
-/* [unique][object][uuid] */ 
-
-
-EXTERN_C const IID IID_IPropertyChangeArray;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("380f5cad-1b5e-42f2-805d-637fd392d31e")
-    IPropertyChangeArray : public IUnknown
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE GetCount( 
-            /* [out] */ __RPC__out UINT *pcOperations) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetAt( 
-            /* [in] */ UINT iIndex,
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][out] */ __RPC__deref_out_opt void **ppv) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE InsertAt( 
-            /* [in] */ UINT iIndex,
-            /* [in] */ __RPC__in_opt IPropertyChange *ppropChange) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE Append( 
-            /* [in] */ __RPC__in_opt IPropertyChange *ppropChange) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE AppendOrReplace( 
-            /* [in] */ __RPC__in_opt IPropertyChange *ppropChange) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE RemoveAt( 
-            /* [in] */ UINT iIndex) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE IsKeyInArray( 
-            /* [in] */ __RPC__in REFPROPERTYKEY key) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IPropertyChangeArrayVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IPropertyChangeArray * This,
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IPropertyChangeArray * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IPropertyChangeArray * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetCount )( 
-            IPropertyChangeArray * This,
-            /* [out] */ __RPC__out UINT *pcOperations);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetAt )( 
-            IPropertyChangeArray * This,
-            /* [in] */ UINT iIndex,
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][out] */ __RPC__deref_out_opt void **ppv);
-        
-        HRESULT ( STDMETHODCALLTYPE *InsertAt )( 
-            IPropertyChangeArray * This,
-            /* [in] */ UINT iIndex,
-            /* [in] */ __RPC__in_opt IPropertyChange *ppropChange);
-        
-        HRESULT ( STDMETHODCALLTYPE *Append )( 
-            IPropertyChangeArray * This,
-            /* [in] */ __RPC__in_opt IPropertyChange *ppropChange);
-        
-        HRESULT ( STDMETHODCALLTYPE *AppendOrReplace )( 
-            IPropertyChangeArray * This,
-            /* [in] */ __RPC__in_opt IPropertyChange *ppropChange);
-        
-        HRESULT ( STDMETHODCALLTYPE *RemoveAt )( 
-            IPropertyChangeArray * This,
-            /* [in] */ UINT iIndex);
-        
-        HRESULT ( STDMETHODCALLTYPE *IsKeyInArray )( 
-            IPropertyChangeArray * This,
-            /* [in] */ __RPC__in REFPROPERTYKEY key);
-        
-        END_INTERFACE
-    } IPropertyChangeArrayVtbl;
-
-    interface IPropertyChangeArray
-    {
-        CONST_VTBL struct IPropertyChangeArrayVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IPropertyChangeArray_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IPropertyChangeArray_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IPropertyChangeArray_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IPropertyChangeArray_GetCount(This,pcOperations)	\
-    ( (This)->lpVtbl -> GetCount(This,pcOperations) ) 
-
-#define IPropertyChangeArray_GetAt(This,iIndex,riid,ppv)	\
-    ( (This)->lpVtbl -> GetAt(This,iIndex,riid,ppv) ) 
-
-#define IPropertyChangeArray_InsertAt(This,iIndex,ppropChange)	\
-    ( (This)->lpVtbl -> InsertAt(This,iIndex,ppropChange) ) 
-
-#define IPropertyChangeArray_Append(This,ppropChange)	\
-    ( (This)->lpVtbl -> Append(This,ppropChange) ) 
-
-#define IPropertyChangeArray_AppendOrReplace(This,ppropChange)	\
-    ( (This)->lpVtbl -> AppendOrReplace(This,ppropChange) ) 
-
-#define IPropertyChangeArray_RemoveAt(This,iIndex)	\
-    ( (This)->lpVtbl -> RemoveAt(This,iIndex) ) 
-
-#define IPropertyChangeArray_IsKeyInArray(This,key)	\
-    ( (This)->lpVtbl -> IsKeyInArray(This,key) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IPropertyChangeArray_INTERFACE_DEFINED__ */
-
-
-#ifndef __IPropertyStoreCapabilities_INTERFACE_DEFINED__
-#define __IPropertyStoreCapabilities_INTERFACE_DEFINED__
-
-/* interface IPropertyStoreCapabilities */
-/* [unique][object][uuid] */ 
-
-
-EXTERN_C const IID IID_IPropertyStoreCapabilities;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("c8e2d566-186e-4d49-bf41-6909ead56acc")
-    IPropertyStoreCapabilities : public IUnknown
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE IsPropertyWritable( 
-            /* [in] */ __RPC__in REFPROPERTYKEY key) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IPropertyStoreCapabilitiesVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IPropertyStoreCapabilities * This,
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IPropertyStoreCapabilities * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IPropertyStoreCapabilities * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *IsPropertyWritable )( 
-            IPropertyStoreCapabilities * This,
-            /* [in] */ __RPC__in REFPROPERTYKEY key);
-        
-        END_INTERFACE
-    } IPropertyStoreCapabilitiesVtbl;
-
-    interface IPropertyStoreCapabilities
-    {
-        CONST_VTBL struct IPropertyStoreCapabilitiesVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IPropertyStoreCapabilities_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IPropertyStoreCapabilities_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IPropertyStoreCapabilities_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IPropertyStoreCapabilities_IsPropertyWritable(This,key)	\
-    ( (This)->lpVtbl -> IsPropertyWritable(This,key) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IPropertyStoreCapabilities_INTERFACE_DEFINED__ */
-
-
-#ifndef __IPropertyStoreCache_INTERFACE_DEFINED__
-#define __IPropertyStoreCache_INTERFACE_DEFINED__
-
-/* interface IPropertyStoreCache */
-/* [unique][object][uuid] */ 
-
-typedef /* [v1_enum] */ 
-enum _PSC_STATE
-    {	PSC_NORMAL	= 0,
-	PSC_NOTINSOURCE	= 1,
-	PSC_DIRTY	= 2,
-	PSC_READONLY	= 3
-    } 	PSC_STATE;
-
-
-EXTERN_C const IID IID_IPropertyStoreCache;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("3017056d-9a91-4e90-937d-746c72abbf4f")
-    IPropertyStoreCache : public IPropertyStore
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE GetState( 
-            /* [in] */ __RPC__in REFPROPERTYKEY key,
-            /* [out] */ __RPC__out PSC_STATE *pstate) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetValueAndState( 
-            /* [in] */ __RPC__in REFPROPERTYKEY key,
-            /* [out] */ __RPC__out PROPVARIANT *ppropvar,
-            /* [out] */ __RPC__out PSC_STATE *pstate) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE SetState( 
-            /* [in] */ __RPC__in REFPROPERTYKEY key,
-            /* [in] */ PSC_STATE state) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE SetValueAndState( 
-            /* [in] */ __RPC__in REFPROPERTYKEY key,
-            /* [unique][in] */ __RPC__in_opt const PROPVARIANT *ppropvar,
-            /* [in] */ PSC_STATE state) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IPropertyStoreCacheVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IPropertyStoreCache * This,
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IPropertyStoreCache * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IPropertyStoreCache * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetCount )( 
-            IPropertyStoreCache * This,
-            /* [out] */ __RPC__out DWORD *cProps);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetAt )( 
-            IPropertyStoreCache * This,
-            /* [in] */ DWORD iProp,
-            /* [out] */ __RPC__out PROPERTYKEY *pkey);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetValue )( 
-            IPropertyStoreCache * This,
-            /* [in] */ __RPC__in REFPROPERTYKEY key,
-            /* [out] */ __RPC__out PROPVARIANT *pv);
-        
-        HRESULT ( STDMETHODCALLTYPE *SetValue )( 
-            IPropertyStoreCache * This,
-            /* [in] */ __RPC__in REFPROPERTYKEY key,
-            /* [in] */ __RPC__in REFPROPVARIANT propvar);
-        
-        HRESULT ( STDMETHODCALLTYPE *Commit )( 
-            IPropertyStoreCache * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetState )( 
-            IPropertyStoreCache * This,
-            /* [in] */ __RPC__in REFPROPERTYKEY key,
-            /* [out] */ __RPC__out PSC_STATE *pstate);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetValueAndState )( 
-            IPropertyStoreCache * This,
-            /* [in] */ __RPC__in REFPROPERTYKEY key,
-            /* [out] */ __RPC__out PROPVARIANT *ppropvar,
-            /* [out] */ __RPC__out PSC_STATE *pstate);
-        
-        HRESULT ( STDMETHODCALLTYPE *SetState )( 
-            IPropertyStoreCache * This,
-            /* [in] */ __RPC__in REFPROPERTYKEY key,
-            /* [in] */ PSC_STATE state);
-        
-        HRESULT ( STDMETHODCALLTYPE *SetValueAndState )( 
-            IPropertyStoreCache * This,
-            /* [in] */ __RPC__in REFPROPERTYKEY key,
-            /* [unique][in] */ __RPC__in_opt const PROPVARIANT *ppropvar,
-            /* [in] */ PSC_STATE state);
-        
-        END_INTERFACE
-    } IPropertyStoreCacheVtbl;
-
-    interface IPropertyStoreCache
-    {
-        CONST_VTBL struct IPropertyStoreCacheVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IPropertyStoreCache_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IPropertyStoreCache_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IPropertyStoreCache_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IPropertyStoreCache_GetCount(This,cProps)	\
-    ( (This)->lpVtbl -> GetCount(This,cProps) ) 
-
-#define IPropertyStoreCache_GetAt(This,iProp,pkey)	\
-    ( (This)->lpVtbl -> GetAt(This,iProp,pkey) ) 
-
-#define IPropertyStoreCache_GetValue(This,key,pv)	\
-    ( (This)->lpVtbl -> GetValue(This,key,pv) ) 
-
-#define IPropertyStoreCache_SetValue(This,key,propvar)	\
-    ( (This)->lpVtbl -> SetValue(This,key,propvar) ) 
-
-#define IPropertyStoreCache_Commit(This)	\
-    ( (This)->lpVtbl -> Commit(This) ) 
-
-
-#define IPropertyStoreCache_GetState(This,key,pstate)	\
-    ( (This)->lpVtbl -> GetState(This,key,pstate) ) 
-
-#define IPropertyStoreCache_GetValueAndState(This,key,ppropvar,pstate)	\
-    ( (This)->lpVtbl -> GetValueAndState(This,key,ppropvar,pstate) ) 
-
-#define IPropertyStoreCache_SetState(This,key,state)	\
-    ( (This)->lpVtbl -> SetState(This,key,state) ) 
-
-#define IPropertyStoreCache_SetValueAndState(This,key,ppropvar,state)	\
-    ( (This)->lpVtbl -> SetValueAndState(This,key,ppropvar,state) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IPropertyStoreCache_INTERFACE_DEFINED__ */
-
-
-#ifndef __IPropertyEnumType_INTERFACE_DEFINED__
-#define __IPropertyEnumType_INTERFACE_DEFINED__
-
-/* interface IPropertyEnumType */
-/* [unique][object][uuid] */ 
-
-/* [v1_enum] */ 
-enum tagPROPENUMTYPE
-    {	PET_DISCRETEVALUE	= 0,
-	PET_RANGEDVALUE	= 1,
-	PET_DEFAULTVALUE	= 2,
-	PET_ENDRANGE	= 3
-    } ;
-typedef enum tagPROPENUMTYPE PROPENUMTYPE;
-
-
-EXTERN_C const IID IID_IPropertyEnumType;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("11e1fbf9-2d56-4a6b-8db3-7cd193a471f2")
-    IPropertyEnumType : public IUnknown
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE GetEnumType( 
-            /* [out] */ __RPC__out PROPENUMTYPE *penumtype) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetValue( 
-            /* [out] */ __RPC__out PROPVARIANT *ppropvar) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetRangeMinValue( 
-            /* [out] */ __RPC__out PROPVARIANT *ppropvarMin) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetRangeSetValue( 
-            /* [out] */ __RPC__out PROPVARIANT *ppropvarSet) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetDisplayText( 
-            /* [out] */ __RPC__deref_out_opt LPWSTR *ppszDisplay) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IPropertyEnumTypeVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IPropertyEnumType * This,
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IPropertyEnumType * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IPropertyEnumType * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetEnumType )( 
-            IPropertyEnumType * This,
-            /* [out] */ __RPC__out PROPENUMTYPE *penumtype);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetValue )( 
-            IPropertyEnumType * This,
-            /* [out] */ __RPC__out PROPVARIANT *ppropvar);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetRangeMinValue )( 
-            IPropertyEnumType * This,
-            /* [out] */ __RPC__out PROPVARIANT *ppropvarMin);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetRangeSetValue )( 
-            IPropertyEnumType * This,
-            /* [out] */ __RPC__out PROPVARIANT *ppropvarSet);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetDisplayText )( 
-            IPropertyEnumType * This,
-            /* [out] */ __RPC__deref_out_opt LPWSTR *ppszDisplay);
-        
-        END_INTERFACE
-    } IPropertyEnumTypeVtbl;
-
-    interface IPropertyEnumType
-    {
-        CONST_VTBL struct IPropertyEnumTypeVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IPropertyEnumType_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IPropertyEnumType_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IPropertyEnumType_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IPropertyEnumType_GetEnumType(This,penumtype)	\
-    ( (This)->lpVtbl -> GetEnumType(This,penumtype) ) 
-
-#define IPropertyEnumType_GetValue(This,ppropvar)	\
-    ( (This)->lpVtbl -> GetValue(This,ppropvar) ) 
-
-#define IPropertyEnumType_GetRangeMinValue(This,ppropvarMin)	\
-    ( (This)->lpVtbl -> GetRangeMinValue(This,ppropvarMin) ) 
-
-#define IPropertyEnumType_GetRangeSetValue(This,ppropvarSet)	\
-    ( (This)->lpVtbl -> GetRangeSetValue(This,ppropvarSet) ) 
-
-#define IPropertyEnumType_GetDisplayText(This,ppszDisplay)	\
-    ( (This)->lpVtbl -> GetDisplayText(This,ppszDisplay) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IPropertyEnumType_INTERFACE_DEFINED__ */
-
-
-#ifndef __IPropertyEnumTypeList_INTERFACE_DEFINED__
-#define __IPropertyEnumTypeList_INTERFACE_DEFINED__
-
-/* interface IPropertyEnumTypeList */
-/* [unique][object][uuid] */ 
-
-
-EXTERN_C const IID IID_IPropertyEnumTypeList;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("a99400f4-3d84-4557-94ba-1242fb2cc9a6")
-    IPropertyEnumTypeList : public IUnknown
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE GetCount( 
-            /* [out] */ __RPC__out UINT *pctypes) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetAt( 
-            /* [in] */ UINT itype,
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][out] */ __RPC__deref_out_opt void **ppv) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetConditionAt( 
-            /* [in] */ UINT nIndex,
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][out] */ __RPC__deref_out_opt void **ppv) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE FindMatchingIndex( 
-            /* [in] */ __RPC__in REFPROPVARIANT propvarCmp,
-            /* [out] */ __RPC__out UINT *pnIndex) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IPropertyEnumTypeListVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IPropertyEnumTypeList * This,
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IPropertyEnumTypeList * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IPropertyEnumTypeList * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetCount )( 
-            IPropertyEnumTypeList * This,
-            /* [out] */ __RPC__out UINT *pctypes);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetAt )( 
-            IPropertyEnumTypeList * This,
-            /* [in] */ UINT itype,
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][out] */ __RPC__deref_out_opt void **ppv);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetConditionAt )( 
-            IPropertyEnumTypeList * This,
-            /* [in] */ UINT nIndex,
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][out] */ __RPC__deref_out_opt void **ppv);
-        
-        HRESULT ( STDMETHODCALLTYPE *FindMatchingIndex )( 
-            IPropertyEnumTypeList * This,
-            /* [in] */ __RPC__in REFPROPVARIANT propvarCmp,
-            /* [out] */ __RPC__out UINT *pnIndex);
-        
-        END_INTERFACE
-    } IPropertyEnumTypeListVtbl;
-
-    interface IPropertyEnumTypeList
-    {
-        CONST_VTBL struct IPropertyEnumTypeListVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IPropertyEnumTypeList_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IPropertyEnumTypeList_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IPropertyEnumTypeList_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IPropertyEnumTypeList_GetCount(This,pctypes)	\
-    ( (This)->lpVtbl -> GetCount(This,pctypes) ) 
-
-#define IPropertyEnumTypeList_GetAt(This,itype,riid,ppv)	\
-    ( (This)->lpVtbl -> GetAt(This,itype,riid,ppv) ) 
-
-#define IPropertyEnumTypeList_GetConditionAt(This,nIndex,riid,ppv)	\
-    ( (This)->lpVtbl -> GetConditionAt(This,nIndex,riid,ppv) ) 
-
-#define IPropertyEnumTypeList_FindMatchingIndex(This,propvarCmp,pnIndex)	\
-    ( (This)->lpVtbl -> FindMatchingIndex(This,propvarCmp,pnIndex) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IPropertyEnumTypeList_INTERFACE_DEFINED__ */
-
-
-#ifndef __IPropertyDescription_INTERFACE_DEFINED__
-#define __IPropertyDescription_INTERFACE_DEFINED__
-
-/* interface IPropertyDescription */
-/* [unique][object][uuid] */ 
-
-/* [v1_enum] */ 
-enum tagPROPDESC_TYPE_FLAGS
-    {	PDTF_DEFAULT	= 0,
-	PDTF_MULTIPLEVALUES	= 0x1,
-	PDTF_ISINNATE	= 0x2,
-	PDTF_ISGROUP	= 0x4,
-	PDTF_CANGROUPBY	= 0x8,
-	PDTF_CANSTACKBY	= 0x10,
-	PDTF_ISTREEPROPERTY	= 0x20,
-	PDTF_INCLUDEINFULLTEXTQUERY	= 0x40,
-	PDTF_ISVIEWABLE	= 0x80,
-	PDTF_ISQUERYABLE	= 0x100,
-	PDTF_ISSYSTEMPROPERTY	= 0x80000000,
-	PDTF_MASK_ALL	= 0x800001ff
-    } ;
-typedef int PROPDESC_TYPE_FLAGS;
-
-/* [v1_enum] */ 
-enum tagPROPDESC_VIEW_FLAGS
-    {	PDVF_DEFAULT	= 0,
-	PDVF_CENTERALIGN	= 0x1,
-	PDVF_RIGHTALIGN	= 0x2,
-	PDVF_BEGINNEWGROUP	= 0x4,
-	PDVF_FILLAREA	= 0x8,
-	PDVF_SORTDESCENDING	= 0x10,
-	PDVF_SHOWONLYIFPRESENT	= 0x20,
-	PDVF_SHOWBYDEFAULT	= 0x40,
-	PDVF_SHOWINPRIMARYLIST	= 0x80,
-	PDVF_SHOWINSECONDARYLIST	= 0x100,
-	PDVF_HIDELABEL	= 0x200,
-	PDVF_HIDDEN	= 0x800,
-	PDVF_CANWRAP	= 0x1000,
-	PDVF_MASK_ALL	= 0x1bff
-    } ;
-typedef int PROPDESC_VIEW_FLAGS;
-
-/* [v1_enum] */ 
-enum tagPROPDESC_DISPLAYTYPE
-    {	PDDT_STRING	= 0,
-	PDDT_NUMBER	= 1,
-	PDDT_BOOLEAN	= 2,
-	PDDT_DATETIME	= 3,
-	PDDT_ENUMERATED	= 4
-    } ;
-typedef enum tagPROPDESC_DISPLAYTYPE PROPDESC_DISPLAYTYPE;
-
-/* [v1_enum] */ 
-enum tagPROPDESC_GROUPING_RANGE
-    {	PDGR_DISCRETE	= 0,
-	PDGR_ALPHANUMERIC	= 1,
-	PDGR_SIZE	= 2,
-	PDGR_DYNAMIC	= 3,
-	PDGR_DATE	= 4,
-	PDGR_PERCENT	= 5,
-	PDGR_ENUMERATED	= 6
-    } ;
-typedef enum tagPROPDESC_GROUPING_RANGE PROPDESC_GROUPING_RANGE;
-
-/* [v1_enum] */ 
-enum tagPROPDESC_FORMAT_FLAGS
-    {	PDFF_DEFAULT	= 0,
-	PDFF_PREFIXNAME	= 0x1,
-	PDFF_FILENAME	= 0x2,
-	PDFF_ALWAYSKB	= 0x4,
-	PDFF_RESERVED_RIGHTTOLEFT	= 0x8,
-	PDFF_SHORTTIME	= 0x10,
-	PDFF_LONGTIME	= 0x20,
-	PDFF_HIDETIME	= 0x40,
-	PDFF_SHORTDATE	= 0x80,
-	PDFF_LONGDATE	= 0x100,
-	PDFF_HIDEDATE	= 0x200,
-	PDFF_RELATIVEDATE	= 0x400,
-	PDFF_USEEDITINVITATION	= 0x800,
-	PDFF_READONLY	= 0x1000,
-	PDFF_NOAUTOREADINGORDER	= 0x2000
-    } ;
-typedef int PROPDESC_FORMAT_FLAGS;
-
-/* [v1_enum] */ 
-enum tagPROPDESC_SORTDESCRIPTION
-    {	PDSD_GENERAL	= 0,
-	PDSD_A_Z	= 1,
-	PDSD_LOWEST_HIGHEST	= 2,
-	PDSD_SMALLEST_BIGGEST	= 3,
-	PDSD_OLDEST_NEWEST	= 4
-    } ;
-typedef enum tagPROPDESC_SORTDESCRIPTION PROPDESC_SORTDESCRIPTION;
-
-/* [v1_enum] */ 
-enum tagPROPDESC_RELATIVEDESCRIPTION_TYPE
-    {	PDRDT_GENERAL	= 0,
-	PDRDT_DATE	= 1,
-	PDRDT_SIZE	= 2,
-	PDRDT_COUNT	= 3,
-	PDRDT_REVISION	= 4,
-	PDRDT_LENGTH	= 5,
-	PDRDT_DURATION	= 6,
-	PDRDT_SPEED	= 7,
-	PDRDT_RATE	= 8,
-	PDRDT_RATING	= 9,
-	PDRDT_PRIORITY	= 10
-    } ;
-typedef enum tagPROPDESC_RELATIVEDESCRIPTION_TYPE PROPDESC_RELATIVEDESCRIPTION_TYPE;
-
-/* [v1_enum] */ 
-enum tagPROPDESC_AGGREGATION_TYPE
-    {	PDAT_DEFAULT	= 0,
-	PDAT_FIRST	= 1,
-	PDAT_SUM	= 2,
-	PDAT_AVERAGE	= 3,
-	PDAT_DATERANGE	= 4,
-	PDAT_UNION	= 5,
-	PDAT_MAX	= 6,
-	PDAT_MIN	= 7
-    } ;
-typedef enum tagPROPDESC_AGGREGATION_TYPE PROPDESC_AGGREGATION_TYPE;
-
-/* [v1_enum] */ 
-enum tagPROPDESC_CONDITION_TYPE
-    {	PDCOT_NONE	= 0,
-	PDCOT_STRING	= 1,
-	PDCOT_SIZE	= 2,
-	PDCOT_DATETIME	= 3,
-	PDCOT_BOOLEAN	= 4,
-	PDCOT_NUMBER	= 5
-    } ;
-typedef enum tagPROPDESC_CONDITION_TYPE PROPDESC_CONDITION_TYPE;
-
-
-EXTERN_C const IID IID_IPropertyDescription;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("6f79d558-3e96-4549-a1d1-7d75d2288814")
-    IPropertyDescription : public IUnknown
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE GetPropertyKey( 
-            /* [out] */ __RPC__out PROPERTYKEY *pkey) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetCanonicalName( 
-            /* [string][out] */ __RPC__deref_out_opt_string LPWSTR *ppszName) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetPropertyType( 
-            /* [out] */ __RPC__out VARTYPE *pvartype) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetDisplayName( 
-            /* [string][out] */ __RPC__deref_out_opt_string LPWSTR *ppszName) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetEditInvitation( 
-            /* [string][out] */ __RPC__deref_out_opt_string LPWSTR *ppszInvite) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetTypeFlags( 
-            /* [in] */ PROPDESC_TYPE_FLAGS mask,
-            /* [out] */ __RPC__out PROPDESC_TYPE_FLAGS *ppdtFlags) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetViewFlags( 
-            /* [out] */ __RPC__out PROPDESC_VIEW_FLAGS *ppdvFlags) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetDefaultColumnWidth( 
-            /* [out] */ __RPC__out UINT *pcxChars) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetDisplayType( 
-            /* [out] */ __RPC__out PROPDESC_DISPLAYTYPE *pdisplaytype) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetColumnState( 
-            /* [out] */ __RPC__out SHCOLSTATEF *pcsFlags) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetGroupingRange( 
-            /* [out] */ __RPC__out PROPDESC_GROUPING_RANGE *pgr) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetRelativeDescriptionType( 
-            /* [out] */ __RPC__out PROPDESC_RELATIVEDESCRIPTION_TYPE *prdt) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetRelativeDescription( 
-            /* [in] */ __RPC__in REFPROPVARIANT propvar1,
-            /* [in] */ __RPC__in REFPROPVARIANT propvar2,
-            /* [string][out] */ __RPC__deref_out_opt_string LPWSTR *ppszDesc1,
-            /* [string][out] */ __RPC__deref_out_opt_string LPWSTR *ppszDesc2) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetSortDescription( 
-            /* [out] */ __RPC__out PROPDESC_SORTDESCRIPTION *psd) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetSortDescriptionLabel( 
-            /* [in] */ BOOL fDescending,
-            /* [string][out] */ __RPC__deref_out_opt_string LPWSTR *ppszDescription) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetAggregationType( 
-            /* [out] */ __RPC__out PROPDESC_AGGREGATION_TYPE *paggtype) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetConditionType( 
-            /* [out] */ __RPC__out PROPDESC_CONDITION_TYPE *pcontype,
-            /* [out] */ __RPC__out CONDITION_OPERATION *popDefault) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetEnumTypeList( 
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][out] */ __RPC__deref_out_opt void **ppv) = 0;
-        
-        virtual /* [local] */ HRESULT STDMETHODCALLTYPE CoerceToCanonicalValue( 
-            /* [out][in] */ PROPVARIANT *ppropvar) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE FormatForDisplay( 
-            /* [in] */ __RPC__in REFPROPVARIANT propvar,
-            /* [in] */ PROPDESC_FORMAT_FLAGS pdfFlags,
-            /* [string][out] */ __RPC__deref_out_opt_string LPWSTR *ppszDisplay) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE IsValueCanonical( 
-            /* [in] */ __RPC__in REFPROPVARIANT propvar) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IPropertyDescriptionVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IPropertyDescription * This,
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IPropertyDescription * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IPropertyDescription * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetPropertyKey )( 
-            IPropertyDescription * This,
-            /* [out] */ __RPC__out PROPERTYKEY *pkey);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetCanonicalName )( 
-            IPropertyDescription * This,
-            /* [string][out] */ __RPC__deref_out_opt_string LPWSTR *ppszName);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetPropertyType )( 
-            IPropertyDescription * This,
-            /* [out] */ __RPC__out VARTYPE *pvartype);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetDisplayName )( 
-            IPropertyDescription * This,
-            /* [string][out] */ __RPC__deref_out_opt_string LPWSTR *ppszName);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetEditInvitation )( 
-            IPropertyDescription * This,
-            /* [string][out] */ __RPC__deref_out_opt_string LPWSTR *ppszInvite);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetTypeFlags )( 
-            IPropertyDescription * This,
-            /* [in] */ PROPDESC_TYPE_FLAGS mask,
-            /* [out] */ __RPC__out PROPDESC_TYPE_FLAGS *ppdtFlags);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetViewFlags )( 
-            IPropertyDescription * This,
-            /* [out] */ __RPC__out PROPDESC_VIEW_FLAGS *ppdvFlags);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetDefaultColumnWidth )( 
-            IPropertyDescription * This,
-            /* [out] */ __RPC__out UINT *pcxChars);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetDisplayType )( 
-            IPropertyDescription * This,
-            /* [out] */ __RPC__out PROPDESC_DISPLAYTYPE *pdisplaytype);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetColumnState )( 
-            IPropertyDescription * This,
-            /* [out] */ __RPC__out SHCOLSTATEF *pcsFlags);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetGroupingRange )( 
-            IPropertyDescription * This,
-            /* [out] */ __RPC__out PROPDESC_GROUPING_RANGE *pgr);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetRelativeDescriptionType )( 
-            IPropertyDescription * This,
-            /* [out] */ __RPC__out PROPDESC_RELATIVEDESCRIPTION_TYPE *prdt);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetRelativeDescription )( 
-            IPropertyDescription * This,
-            /* [in] */ __RPC__in REFPROPVARIANT propvar1,
-            /* [in] */ __RPC__in REFPROPVARIANT propvar2,
-            /* [string][out] */ __RPC__deref_out_opt_string LPWSTR *ppszDesc1,
-            /* [string][out] */ __RPC__deref_out_opt_string LPWSTR *ppszDesc2);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetSortDescription )( 
-            IPropertyDescription * This,
-            /* [out] */ __RPC__out PROPDESC_SORTDESCRIPTION *psd);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetSortDescriptionLabel )( 
-            IPropertyDescription * This,
-            /* [in] */ BOOL fDescending,
-            /* [string][out] */ __RPC__deref_out_opt_string LPWSTR *ppszDescription);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetAggregationType )( 
-            IPropertyDescription * This,
-            /* [out] */ __RPC__out PROPDESC_AGGREGATION_TYPE *paggtype);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetConditionType )( 
-            IPropertyDescription * This,
-            /* [out] */ __RPC__out PROPDESC_CONDITION_TYPE *pcontype,
-            /* [out] */ __RPC__out CONDITION_OPERATION *popDefault);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetEnumTypeList )( 
-            IPropertyDescription * This,
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][out] */ __RPC__deref_out_opt void **ppv);
-        
-        /* [local] */ HRESULT ( STDMETHODCALLTYPE *CoerceToCanonicalValue )( 
-            IPropertyDescription * This,
-            /* [out][in] */ PROPVARIANT *ppropvar);
-        
-        HRESULT ( STDMETHODCALLTYPE *FormatForDisplay )( 
-            IPropertyDescription * This,
-            /* [in] */ __RPC__in REFPROPVARIANT propvar,
-            /* [in] */ PROPDESC_FORMAT_FLAGS pdfFlags,
-            /* [string][out] */ __RPC__deref_out_opt_string LPWSTR *ppszDisplay);
-        
-        HRESULT ( STDMETHODCALLTYPE *IsValueCanonical )( 
-            IPropertyDescription * This,
-            /* [in] */ __RPC__in REFPROPVARIANT propvar);
-        
-        END_INTERFACE
-    } IPropertyDescriptionVtbl;
-
-    interface IPropertyDescription
-    {
-        CONST_VTBL struct IPropertyDescriptionVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IPropertyDescription_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IPropertyDescription_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IPropertyDescription_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IPropertyDescription_GetPropertyKey(This,pkey)	\
-    ( (This)->lpVtbl -> GetPropertyKey(This,pkey) ) 
-
-#define IPropertyDescription_GetCanonicalName(This,ppszName)	\
-    ( (This)->lpVtbl -> GetCanonicalName(This,ppszName) ) 
-
-#define IPropertyDescription_GetPropertyType(This,pvartype)	\
-    ( (This)->lpVtbl -> GetPropertyType(This,pvartype) ) 
-
-#define IPropertyDescription_GetDisplayName(This,ppszName)	\
-    ( (This)->lpVtbl -> GetDisplayName(This,ppszName) ) 
-
-#define IPropertyDescription_GetEditInvitation(This,ppszInvite)	\
-    ( (This)->lpVtbl -> GetEditInvitation(This,ppszInvite) ) 
-
-#define IPropertyDescription_GetTypeFlags(This,mask,ppdtFlags)	\
-    ( (This)->lpVtbl -> GetTypeFlags(This,mask,ppdtFlags) ) 
-
-#define IPropertyDescription_GetViewFlags(This,ppdvFlags)	\
-    ( (This)->lpVtbl -> GetViewFlags(This,ppdvFlags) ) 
-
-#define IPropertyDescription_GetDefaultColumnWidth(This,pcxChars)	\
-    ( (This)->lpVtbl -> GetDefaultColumnWidth(This,pcxChars) ) 
-
-#define IPropertyDescription_GetDisplayType(This,pdisplaytype)	\
-    ( (This)->lpVtbl -> GetDisplayType(This,pdisplaytype) ) 
-
-#define IPropertyDescription_GetColumnState(This,pcsFlags)	\
-    ( (This)->lpVtbl -> GetColumnState(This,pcsFlags) ) 
-
-#define IPropertyDescription_GetGroupingRange(This,pgr)	\
-    ( (This)->lpVtbl -> GetGroupingRange(This,pgr) ) 
-
-#define IPropertyDescription_GetRelativeDescriptionType(This,prdt)	\
-    ( (This)->lpVtbl -> GetRelativeDescriptionType(This,prdt) ) 
-
-#define IPropertyDescription_GetRelativeDescription(This,propvar1,propvar2,ppszDesc1,ppszDesc2)	\
-    ( (This)->lpVtbl -> GetRelativeDescription(This,propvar1,propvar2,ppszDesc1,ppszDesc2) ) 
-
-#define IPropertyDescription_GetSortDescription(This,psd)	\
-    ( (This)->lpVtbl -> GetSortDescription(This,psd) ) 
-
-#define IPropertyDescription_GetSortDescriptionLabel(This,fDescending,ppszDescription)	\
-    ( (This)->lpVtbl -> GetSortDescriptionLabel(This,fDescending,ppszDescription) ) 
-
-#define IPropertyDescription_GetAggregationType(This,paggtype)	\
-    ( (This)->lpVtbl -> GetAggregationType(This,paggtype) ) 
-
-#define IPropertyDescription_GetConditionType(This,pcontype,popDefault)	\
-    ( (This)->lpVtbl -> GetConditionType(This,pcontype,popDefault) ) 
-
-#define IPropertyDescription_GetEnumTypeList(This,riid,ppv)	\
-    ( (This)->lpVtbl -> GetEnumTypeList(This,riid,ppv) ) 
-
-#define IPropertyDescription_CoerceToCanonicalValue(This,ppropvar)	\
-    ( (This)->lpVtbl -> CoerceToCanonicalValue(This,ppropvar) ) 
-
-#define IPropertyDescription_FormatForDisplay(This,propvar,pdfFlags,ppszDisplay)	\
-    ( (This)->lpVtbl -> FormatForDisplay(This,propvar,pdfFlags,ppszDisplay) ) 
-
-#define IPropertyDescription_IsValueCanonical(This,propvar)	\
-    ( (This)->lpVtbl -> IsValueCanonical(This,propvar) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-/* [call_as] */ HRESULT STDMETHODCALLTYPE IPropertyDescription_RemoteCoerceToCanonicalValue_Proxy( 
-    IPropertyDescription * This,
-    /* [in] */ __RPC__in REFPROPVARIANT propvar,
-    /* [out] */ __RPC__out PROPVARIANT *ppropvar);
-
-
-void __RPC_STUB IPropertyDescription_RemoteCoerceToCanonicalValue_Stub(
-    IRpcStubBuffer *This,
-    IRpcChannelBuffer *_pRpcChannelBuffer,
-    PRPC_MESSAGE _pRpcMessage,
-    DWORD *_pdwStubPhase);
-
-
-
-#endif 	/* __IPropertyDescription_INTERFACE_DEFINED__ */
-
-
-#ifndef __IPropertyDescriptionAliasInfo_INTERFACE_DEFINED__
-#define __IPropertyDescriptionAliasInfo_INTERFACE_DEFINED__
-
-/* interface IPropertyDescriptionAliasInfo */
-/* [unique][object][uuid] */ 
-
-
-EXTERN_C const IID IID_IPropertyDescriptionAliasInfo;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("f67104fc-2af9-46fd-b32d-243c1404f3d1")
-    IPropertyDescriptionAliasInfo : public IPropertyDescription
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE GetSortByAlias( 
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][out] */ __RPC__deref_out_opt void **ppv) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetAdditionalSortByAliases( 
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][out] */ __RPC__deref_out_opt void **ppv) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IPropertyDescriptionAliasInfoVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IPropertyDescriptionAliasInfo * This,
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IPropertyDescriptionAliasInfo * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IPropertyDescriptionAliasInfo * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetPropertyKey )( 
-            IPropertyDescriptionAliasInfo * This,
-            /* [out] */ __RPC__out PROPERTYKEY *pkey);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetCanonicalName )( 
-            IPropertyDescriptionAliasInfo * This,
-            /* [string][out] */ __RPC__deref_out_opt_string LPWSTR *ppszName);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetPropertyType )( 
-            IPropertyDescriptionAliasInfo * This,
-            /* [out] */ __RPC__out VARTYPE *pvartype);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetDisplayName )( 
-            IPropertyDescriptionAliasInfo * This,
-            /* [string][out] */ __RPC__deref_out_opt_string LPWSTR *ppszName);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetEditInvitation )( 
-            IPropertyDescriptionAliasInfo * This,
-            /* [string][out] */ __RPC__deref_out_opt_string LPWSTR *ppszInvite);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetTypeFlags )( 
-            IPropertyDescriptionAliasInfo * This,
-            /* [in] */ PROPDESC_TYPE_FLAGS mask,
-            /* [out] */ __RPC__out PROPDESC_TYPE_FLAGS *ppdtFlags);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetViewFlags )( 
-            IPropertyDescriptionAliasInfo * This,
-            /* [out] */ __RPC__out PROPDESC_VIEW_FLAGS *ppdvFlags);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetDefaultColumnWidth )( 
-            IPropertyDescriptionAliasInfo * This,
-            /* [out] */ __RPC__out UINT *pcxChars);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetDisplayType )( 
-            IPropertyDescriptionAliasInfo * This,
-            /* [out] */ __RPC__out PROPDESC_DISPLAYTYPE *pdisplaytype);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetColumnState )( 
-            IPropertyDescriptionAliasInfo * This,
-            /* [out] */ __RPC__out SHCOLSTATEF *pcsFlags);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetGroupingRange )( 
-            IPropertyDescriptionAliasInfo * This,
-            /* [out] */ __RPC__out PROPDESC_GROUPING_RANGE *pgr);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetRelativeDescriptionType )( 
-            IPropertyDescriptionAliasInfo * This,
-            /* [out] */ __RPC__out PROPDESC_RELATIVEDESCRIPTION_TYPE *prdt);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetRelativeDescription )( 
-            IPropertyDescriptionAliasInfo * This,
-            /* [in] */ __RPC__in REFPROPVARIANT propvar1,
-            /* [in] */ __RPC__in REFPROPVARIANT propvar2,
-            /* [string][out] */ __RPC__deref_out_opt_string LPWSTR *ppszDesc1,
-            /* [string][out] */ __RPC__deref_out_opt_string LPWSTR *ppszDesc2);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetSortDescription )( 
-            IPropertyDescriptionAliasInfo * This,
-            /* [out] */ __RPC__out PROPDESC_SORTDESCRIPTION *psd);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetSortDescriptionLabel )( 
-            IPropertyDescriptionAliasInfo * This,
-            /* [in] */ BOOL fDescending,
-            /* [string][out] */ __RPC__deref_out_opt_string LPWSTR *ppszDescription);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetAggregationType )( 
-            IPropertyDescriptionAliasInfo * This,
-            /* [out] */ __RPC__out PROPDESC_AGGREGATION_TYPE *paggtype);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetConditionType )( 
-            IPropertyDescriptionAliasInfo * This,
-            /* [out] */ __RPC__out PROPDESC_CONDITION_TYPE *pcontype,
-            /* [out] */ __RPC__out CONDITION_OPERATION *popDefault);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetEnumTypeList )( 
-            IPropertyDescriptionAliasInfo * This,
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][out] */ __RPC__deref_out_opt void **ppv);
-        
-        /* [local] */ HRESULT ( STDMETHODCALLTYPE *CoerceToCanonicalValue )( 
-            IPropertyDescriptionAliasInfo * This,
-            /* [out][in] */ PROPVARIANT *ppropvar);
-        
-        HRESULT ( STDMETHODCALLTYPE *FormatForDisplay )( 
-            IPropertyDescriptionAliasInfo * This,
-            /* [in] */ __RPC__in REFPROPVARIANT propvar,
-            /* [in] */ PROPDESC_FORMAT_FLAGS pdfFlags,
-            /* [string][out] */ __RPC__deref_out_opt_string LPWSTR *ppszDisplay);
-        
-        HRESULT ( STDMETHODCALLTYPE *IsValueCanonical )( 
-            IPropertyDescriptionAliasInfo * This,
-            /* [in] */ __RPC__in REFPROPVARIANT propvar);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetSortByAlias )( 
-            IPropertyDescriptionAliasInfo * This,
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][out] */ __RPC__deref_out_opt void **ppv);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetAdditionalSortByAliases )( 
-            IPropertyDescriptionAliasInfo * This,
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][out] */ __RPC__deref_out_opt void **ppv);
-        
-        END_INTERFACE
-    } IPropertyDescriptionAliasInfoVtbl;
-
-    interface IPropertyDescriptionAliasInfo
-    {
-        CONST_VTBL struct IPropertyDescriptionAliasInfoVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IPropertyDescriptionAliasInfo_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IPropertyDescriptionAliasInfo_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IPropertyDescriptionAliasInfo_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IPropertyDescriptionAliasInfo_GetPropertyKey(This,pkey)	\
-    ( (This)->lpVtbl -> GetPropertyKey(This,pkey) ) 
-
-#define IPropertyDescriptionAliasInfo_GetCanonicalName(This,ppszName)	\
-    ( (This)->lpVtbl -> GetCanonicalName(This,ppszName) ) 
-
-#define IPropertyDescriptionAliasInfo_GetPropertyType(This,pvartype)	\
-    ( (This)->lpVtbl -> GetPropertyType(This,pvartype) ) 
-
-#define IPropertyDescriptionAliasInfo_GetDisplayName(This,ppszName)	\
-    ( (This)->lpVtbl -> GetDisplayName(This,ppszName) ) 
-
-#define IPropertyDescriptionAliasInfo_GetEditInvitation(This,ppszInvite)	\
-    ( (This)->lpVtbl -> GetEditInvitation(This,ppszInvite) ) 
-
-#define IPropertyDescriptionAliasInfo_GetTypeFlags(This,mask,ppdtFlags)	\
-    ( (This)->lpVtbl -> GetTypeFlags(This,mask,ppdtFlags) ) 
-
-#define IPropertyDescriptionAliasInfo_GetViewFlags(This,ppdvFlags)	\
-    ( (This)->lpVtbl -> GetViewFlags(This,ppdvFlags) ) 
-
-#define IPropertyDescriptionAliasInfo_GetDefaultColumnWidth(This,pcxChars)	\
-    ( (This)->lpVtbl -> GetDefaultColumnWidth(This,pcxChars) ) 
-
-#define IPropertyDescriptionAliasInfo_GetDisplayType(This,pdisplaytype)	\
-    ( (This)->lpVtbl -> GetDisplayType(This,pdisplaytype) ) 
-
-#define IPropertyDescriptionAliasInfo_GetColumnState(This,pcsFlags)	\
-    ( (This)->lpVtbl -> GetColumnState(This,pcsFlags) ) 
-
-#define IPropertyDescriptionAliasInfo_GetGroupingRange(This,pgr)	\
-    ( (This)->lpVtbl -> GetGroupingRange(This,pgr) ) 
-
-#define IPropertyDescriptionAliasInfo_GetRelativeDescriptionType(This,prdt)	\
-    ( (This)->lpVtbl -> GetRelativeDescriptionType(This,prdt) ) 
-
-#define IPropertyDescriptionAliasInfo_GetRelativeDescription(This,propvar1,propvar2,ppszDesc1,ppszDesc2)	\
-    ( (This)->lpVtbl -> GetRelativeDescription(This,propvar1,propvar2,ppszDesc1,ppszDesc2) ) 
-
-#define IPropertyDescriptionAliasInfo_GetSortDescription(This,psd)	\
-    ( (This)->lpVtbl -> GetSortDescription(This,psd) ) 
-
-#define IPropertyDescriptionAliasInfo_GetSortDescriptionLabel(This,fDescending,ppszDescription)	\
-    ( (This)->lpVtbl -> GetSortDescriptionLabel(This,fDescending,ppszDescription) ) 
-
-#define IPropertyDescriptionAliasInfo_GetAggregationType(This,paggtype)	\
-    ( (This)->lpVtbl -> GetAggregationType(This,paggtype) ) 
-
-#define IPropertyDescriptionAliasInfo_GetConditionType(This,pcontype,popDefault)	\
-    ( (This)->lpVtbl -> GetConditionType(This,pcontype,popDefault) ) 
-
-#define IPropertyDescriptionAliasInfo_GetEnumTypeList(This,riid,ppv)	\
-    ( (This)->lpVtbl -> GetEnumTypeList(This,riid,ppv) ) 
-
-#define IPropertyDescriptionAliasInfo_CoerceToCanonicalValue(This,ppropvar)	\
-    ( (This)->lpVtbl -> CoerceToCanonicalValue(This,ppropvar) ) 
-
-#define IPropertyDescriptionAliasInfo_FormatForDisplay(This,propvar,pdfFlags,ppszDisplay)	\
-    ( (This)->lpVtbl -> FormatForDisplay(This,propvar,pdfFlags,ppszDisplay) ) 
-
-#define IPropertyDescriptionAliasInfo_IsValueCanonical(This,propvar)	\
-    ( (This)->lpVtbl -> IsValueCanonical(This,propvar) ) 
-
-
-#define IPropertyDescriptionAliasInfo_GetSortByAlias(This,riid,ppv)	\
-    ( (This)->lpVtbl -> GetSortByAlias(This,riid,ppv) ) 
-
-#define IPropertyDescriptionAliasInfo_GetAdditionalSortByAliases(This,riid,ppv)	\
-    ( (This)->lpVtbl -> GetAdditionalSortByAliases(This,riid,ppv) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IPropertyDescriptionAliasInfo_INTERFACE_DEFINED__ */
-
-
-#ifndef __IPropertyDescriptionSearchInfo_INTERFACE_DEFINED__
-#define __IPropertyDescriptionSearchInfo_INTERFACE_DEFINED__
-
-/* interface IPropertyDescriptionSearchInfo */
-/* [unique][object][uuid] */ 
-
-/* [v1_enum] */ 
-enum tagPROPDESC_SEARCHINFO_FLAGS
-    {	PDSIF_DEFAULT	= 0,
-	PDSIF_ININVERTEDINDEX	= 0x1,
-	PDSIF_ISCOLUMN	= 0x2,
-	PDSIF_ISCOLUMNSPARSE	= 0x4
-    } ;
-typedef int PROPDESC_SEARCHINFO_FLAGS;
-
-typedef /* [v1_enum] */ 
-enum tagPROPDESC_COLUMNINDEX_TYPE
-    {	PDCIT_NONE	= 0,
-	PDCIT_ONDISK	= 1,
-	PDCIT_INMEMORY	= 2
-    } 	PROPDESC_COLUMNINDEX_TYPE;
-
-
-EXTERN_C const IID IID_IPropertyDescriptionSearchInfo;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("078f91bd-29a2-440f-924e-46a291524520")
-    IPropertyDescriptionSearchInfo : public IPropertyDescription
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE GetSearchInfoFlags( 
-            /* [out] */ __RPC__out PROPDESC_SEARCHINFO_FLAGS *ppdsiFlags) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetColumnIndexType( 
-            /* [out] */ __RPC__out PROPDESC_COLUMNINDEX_TYPE *ppdciType) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetProjectionString( 
-            /* [out] */ __RPC__deref_out_opt LPWSTR *ppszProjection) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetMaxSize( 
-            /* [out] */ __RPC__out UINT *pcbMaxSize) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IPropertyDescriptionSearchInfoVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IPropertyDescriptionSearchInfo * This,
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IPropertyDescriptionSearchInfo * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IPropertyDescriptionSearchInfo * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetPropertyKey )( 
-            IPropertyDescriptionSearchInfo * This,
-            /* [out] */ __RPC__out PROPERTYKEY *pkey);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetCanonicalName )( 
-            IPropertyDescriptionSearchInfo * This,
-            /* [string][out] */ __RPC__deref_out_opt_string LPWSTR *ppszName);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetPropertyType )( 
-            IPropertyDescriptionSearchInfo * This,
-            /* [out] */ __RPC__out VARTYPE *pvartype);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetDisplayName )( 
-            IPropertyDescriptionSearchInfo * This,
-            /* [string][out] */ __RPC__deref_out_opt_string LPWSTR *ppszName);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetEditInvitation )( 
-            IPropertyDescriptionSearchInfo * This,
-            /* [string][out] */ __RPC__deref_out_opt_string LPWSTR *ppszInvite);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetTypeFlags )( 
-            IPropertyDescriptionSearchInfo * This,
-            /* [in] */ PROPDESC_TYPE_FLAGS mask,
-            /* [out] */ __RPC__out PROPDESC_TYPE_FLAGS *ppdtFlags);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetViewFlags )( 
-            IPropertyDescriptionSearchInfo * This,
-            /* [out] */ __RPC__out PROPDESC_VIEW_FLAGS *ppdvFlags);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetDefaultColumnWidth )( 
-            IPropertyDescriptionSearchInfo * This,
-            /* [out] */ __RPC__out UINT *pcxChars);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetDisplayType )( 
-            IPropertyDescriptionSearchInfo * This,
-            /* [out] */ __RPC__out PROPDESC_DISPLAYTYPE *pdisplaytype);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetColumnState )( 
-            IPropertyDescriptionSearchInfo * This,
-            /* [out] */ __RPC__out SHCOLSTATEF *pcsFlags);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetGroupingRange )( 
-            IPropertyDescriptionSearchInfo * This,
-            /* [out] */ __RPC__out PROPDESC_GROUPING_RANGE *pgr);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetRelativeDescriptionType )( 
-            IPropertyDescriptionSearchInfo * This,
-            /* [out] */ __RPC__out PROPDESC_RELATIVEDESCRIPTION_TYPE *prdt);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetRelativeDescription )( 
-            IPropertyDescriptionSearchInfo * This,
-            /* [in] */ __RPC__in REFPROPVARIANT propvar1,
-            /* [in] */ __RPC__in REFPROPVARIANT propvar2,
-            /* [string][out] */ __RPC__deref_out_opt_string LPWSTR *ppszDesc1,
-            /* [string][out] */ __RPC__deref_out_opt_string LPWSTR *ppszDesc2);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetSortDescription )( 
-            IPropertyDescriptionSearchInfo * This,
-            /* [out] */ __RPC__out PROPDESC_SORTDESCRIPTION *psd);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetSortDescriptionLabel )( 
-            IPropertyDescriptionSearchInfo * This,
-            /* [in] */ BOOL fDescending,
-            /* [string][out] */ __RPC__deref_out_opt_string LPWSTR *ppszDescription);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetAggregationType )( 
-            IPropertyDescriptionSearchInfo * This,
-            /* [out] */ __RPC__out PROPDESC_AGGREGATION_TYPE *paggtype);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetConditionType )( 
-            IPropertyDescriptionSearchInfo * This,
-            /* [out] */ __RPC__out PROPDESC_CONDITION_TYPE *pcontype,
-            /* [out] */ __RPC__out CONDITION_OPERATION *popDefault);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetEnumTypeList )( 
-            IPropertyDescriptionSearchInfo * This,
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][out] */ __RPC__deref_out_opt void **ppv);
-        
-        /* [local] */ HRESULT ( STDMETHODCALLTYPE *CoerceToCanonicalValue )( 
-            IPropertyDescriptionSearchInfo * This,
-            /* [out][in] */ PROPVARIANT *ppropvar);
-        
-        HRESULT ( STDMETHODCALLTYPE *FormatForDisplay )( 
-            IPropertyDescriptionSearchInfo * This,
-            /* [in] */ __RPC__in REFPROPVARIANT propvar,
-            /* [in] */ PROPDESC_FORMAT_FLAGS pdfFlags,
-            /* [string][out] */ __RPC__deref_out_opt_string LPWSTR *ppszDisplay);
-        
-        HRESULT ( STDMETHODCALLTYPE *IsValueCanonical )( 
-            IPropertyDescriptionSearchInfo * This,
-            /* [in] */ __RPC__in REFPROPVARIANT propvar);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetSearchInfoFlags )( 
-            IPropertyDescriptionSearchInfo * This,
-            /* [out] */ __RPC__out PROPDESC_SEARCHINFO_FLAGS *ppdsiFlags);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetColumnIndexType )( 
-            IPropertyDescriptionSearchInfo * This,
-            /* [out] */ __RPC__out PROPDESC_COLUMNINDEX_TYPE *ppdciType);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetProjectionString )( 
-            IPropertyDescriptionSearchInfo * This,
-            /* [out] */ __RPC__deref_out_opt LPWSTR *ppszProjection);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetMaxSize )( 
-            IPropertyDescriptionSearchInfo * This,
-            /* [out] */ __RPC__out UINT *pcbMaxSize);
-        
-        END_INTERFACE
-    } IPropertyDescriptionSearchInfoVtbl;
-
-    interface IPropertyDescriptionSearchInfo
-    {
-        CONST_VTBL struct IPropertyDescriptionSearchInfoVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IPropertyDescriptionSearchInfo_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IPropertyDescriptionSearchInfo_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IPropertyDescriptionSearchInfo_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IPropertyDescriptionSearchInfo_GetPropertyKey(This,pkey)	\
-    ( (This)->lpVtbl -> GetPropertyKey(This,pkey) ) 
-
-#define IPropertyDescriptionSearchInfo_GetCanonicalName(This,ppszName)	\
-    ( (This)->lpVtbl -> GetCanonicalName(This,ppszName) ) 
-
-#define IPropertyDescriptionSearchInfo_GetPropertyType(This,pvartype)	\
-    ( (This)->lpVtbl -> GetPropertyType(This,pvartype) ) 
-
-#define IPropertyDescriptionSearchInfo_GetDisplayName(This,ppszName)	\
-    ( (This)->lpVtbl -> GetDisplayName(This,ppszName) ) 
-
-#define IPropertyDescriptionSearchInfo_GetEditInvitation(This,ppszInvite)	\
-    ( (This)->lpVtbl -> GetEditInvitation(This,ppszInvite) ) 
-
-#define IPropertyDescriptionSearchInfo_GetTypeFlags(This,mask,ppdtFlags)	\
-    ( (This)->lpVtbl -> GetTypeFlags(This,mask,ppdtFlags) ) 
-
-#define IPropertyDescriptionSearchInfo_GetViewFlags(This,ppdvFlags)	\
-    ( (This)->lpVtbl -> GetViewFlags(This,ppdvFlags) ) 
-
-#define IPropertyDescriptionSearchInfo_GetDefaultColumnWidth(This,pcxChars)	\
-    ( (This)->lpVtbl -> GetDefaultColumnWidth(This,pcxChars) ) 
-
-#define IPropertyDescriptionSearchInfo_GetDisplayType(This,pdisplaytype)	\
-    ( (This)->lpVtbl -> GetDisplayType(This,pdisplaytype) ) 
-
-#define IPropertyDescriptionSearchInfo_GetColumnState(This,pcsFlags)	\
-    ( (This)->lpVtbl -> GetColumnState(This,pcsFlags) ) 
-
-#define IPropertyDescriptionSearchInfo_GetGroupingRange(This,pgr)	\
-    ( (This)->lpVtbl -> GetGroupingRange(This,pgr) ) 
-
-#define IPropertyDescriptionSearchInfo_GetRelativeDescriptionType(This,prdt)	\
-    ( (This)->lpVtbl -> GetRelativeDescriptionType(This,prdt) ) 
-
-#define IPropertyDescriptionSearchInfo_GetRelativeDescription(This,propvar1,propvar2,ppszDesc1,ppszDesc2)	\
-    ( (This)->lpVtbl -> GetRelativeDescription(This,propvar1,propvar2,ppszDesc1,ppszDesc2) ) 
-
-#define IPropertyDescriptionSearchInfo_GetSortDescription(This,psd)	\
-    ( (This)->lpVtbl -> GetSortDescription(This,psd) ) 
-
-#define IPropertyDescriptionSearchInfo_GetSortDescriptionLabel(This,fDescending,ppszDescription)	\
-    ( (This)->lpVtbl -> GetSortDescriptionLabel(This,fDescending,ppszDescription) ) 
-
-#define IPropertyDescriptionSearchInfo_GetAggregationType(This,paggtype)	\
-    ( (This)->lpVtbl -> GetAggregationType(This,paggtype) ) 
-
-#define IPropertyDescriptionSearchInfo_GetConditionType(This,pcontype,popDefault)	\
-    ( (This)->lpVtbl -> GetConditionType(This,pcontype,popDefault) ) 
-
-#define IPropertyDescriptionSearchInfo_GetEnumTypeList(This,riid,ppv)	\
-    ( (This)->lpVtbl -> GetEnumTypeList(This,riid,ppv) ) 
-
-#define IPropertyDescriptionSearchInfo_CoerceToCanonicalValue(This,ppropvar)	\
-    ( (This)->lpVtbl -> CoerceToCanonicalValue(This,ppropvar) ) 
-
-#define IPropertyDescriptionSearchInfo_FormatForDisplay(This,propvar,pdfFlags,ppszDisplay)	\
-    ( (This)->lpVtbl -> FormatForDisplay(This,propvar,pdfFlags,ppszDisplay) ) 
-
-#define IPropertyDescriptionSearchInfo_IsValueCanonical(This,propvar)	\
-    ( (This)->lpVtbl -> IsValueCanonical(This,propvar) ) 
-
-
-#define IPropertyDescriptionSearchInfo_GetSearchInfoFlags(This,ppdsiFlags)	\
-    ( (This)->lpVtbl -> GetSearchInfoFlags(This,ppdsiFlags) ) 
-
-#define IPropertyDescriptionSearchInfo_GetColumnIndexType(This,ppdciType)	\
-    ( (This)->lpVtbl -> GetColumnIndexType(This,ppdciType) ) 
-
-#define IPropertyDescriptionSearchInfo_GetProjectionString(This,ppszProjection)	\
-    ( (This)->lpVtbl -> GetProjectionString(This,ppszProjection) ) 
-
-#define IPropertyDescriptionSearchInfo_GetMaxSize(This,pcbMaxSize)	\
-    ( (This)->lpVtbl -> GetMaxSize(This,pcbMaxSize) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IPropertyDescriptionSearchInfo_INTERFACE_DEFINED__ */
-
-
-/* interface __MIDL_itf_propsys_0000_0014 */
-/* [local] */ 
-
-/* [v1_enum] */ 
-enum tagPROPDESC_ENUMFILTER
-    {	PDEF_ALL	= 0,
-	PDEF_SYSTEM	= 1,
-	PDEF_NONSYSTEM	= 2,
-	PDEF_VIEWABLE	= 3,
-	PDEF_QUERYABLE	= 4,
-	PDEF_INFULLTEXTQUERY	= 5,
-	PDEF_COLUMN	= 6
-    } ;
-typedef enum tagPROPDESC_ENUMFILTER PROPDESC_ENUMFILTER;
-
-
-
-extern RPC_IF_HANDLE __MIDL_itf_propsys_0000_0014_v0_0_c_ifspec;
-extern RPC_IF_HANDLE __MIDL_itf_propsys_0000_0014_v0_0_s_ifspec;
-
-#ifndef __IPropertySystem_INTERFACE_DEFINED__
-#define __IPropertySystem_INTERFACE_DEFINED__
-
-/* interface IPropertySystem */
-/* [unique][object][uuid] */ 
-
-
-EXTERN_C const IID IID_IPropertySystem;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("ca724e8a-c3e6-442b-88a4-6fb0db8035a3")
-    IPropertySystem : public IUnknown
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE GetPropertyDescription( 
-            /* [in] */ __RPC__in REFPROPERTYKEY propkey,
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][out] */ __RPC__deref_out_opt void **ppv) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetPropertyDescriptionByName( 
-            /* [string][in] */ __RPC__in LPCWSTR pszCanonicalName,
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][out] */ __RPC__deref_out_opt void **ppv) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetPropertyDescriptionListFromString( 
-            /* [string][in] */ __RPC__in LPCWSTR pszPropList,
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][out] */ __RPC__deref_out_opt void **ppv) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE EnumeratePropertyDescriptions( 
-            /* [in] */ PROPDESC_ENUMFILTER filterOn,
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][out] */ __RPC__deref_out_opt void **ppv) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE FormatForDisplay( 
-            /* [in] */ __RPC__in REFPROPERTYKEY key,
-            /* [in] */ __RPC__in REFPROPVARIANT propvar,
-            /* [in] */ PROPDESC_FORMAT_FLAGS pdff,
-            /* [size_is][string][out] */ __RPC__out_ecount_full_string(cchText) LPWSTR pszText,
-            /* [in] */ DWORD cchText) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE FormatForDisplayAlloc( 
-            /* [in] */ __RPC__in REFPROPERTYKEY key,
-            /* [in] */ __RPC__in REFPROPVARIANT propvar,
-            /* [in] */ PROPDESC_FORMAT_FLAGS pdff,
-            /* [string][out] */ __RPC__deref_out_opt_string LPWSTR *ppszDisplay) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE RegisterPropertySchema( 
-            /* [string][in] */ __RPC__in LPCWSTR pszPath) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE UnregisterPropertySchema( 
-            /* [string][in] */ __RPC__in LPCWSTR pszPath) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE RefreshPropertySchema( void) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IPropertySystemVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IPropertySystem * This,
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IPropertySystem * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IPropertySystem * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetPropertyDescription )( 
-            IPropertySystem * This,
-            /* [in] */ __RPC__in REFPROPERTYKEY propkey,
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][out] */ __RPC__deref_out_opt void **ppv);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetPropertyDescriptionByName )( 
-            IPropertySystem * This,
-            /* [string][in] */ __RPC__in LPCWSTR pszCanonicalName,
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][out] */ __RPC__deref_out_opt void **ppv);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetPropertyDescriptionListFromString )( 
-            IPropertySystem * This,
-            /* [string][in] */ __RPC__in LPCWSTR pszPropList,
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][out] */ __RPC__deref_out_opt void **ppv);
-        
-        HRESULT ( STDMETHODCALLTYPE *EnumeratePropertyDescriptions )( 
-            IPropertySystem * This,
-            /* [in] */ PROPDESC_ENUMFILTER filterOn,
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][out] */ __RPC__deref_out_opt void **ppv);
-        
-        HRESULT ( STDMETHODCALLTYPE *FormatForDisplay )( 
-            IPropertySystem * This,
-            /* [in] */ __RPC__in REFPROPERTYKEY key,
-            /* [in] */ __RPC__in REFPROPVARIANT propvar,
-            /* [in] */ PROPDESC_FORMAT_FLAGS pdff,
-            /* [size_is][string][out] */ __RPC__out_ecount_full_string(cchText) LPWSTR pszText,
-            /* [in] */ DWORD cchText);
-        
-        HRESULT ( STDMETHODCALLTYPE *FormatForDisplayAlloc )( 
-            IPropertySystem * This,
-            /* [in] */ __RPC__in REFPROPERTYKEY key,
-            /* [in] */ __RPC__in REFPROPVARIANT propvar,
-            /* [in] */ PROPDESC_FORMAT_FLAGS pdff,
-            /* [string][out] */ __RPC__deref_out_opt_string LPWSTR *ppszDisplay);
-        
-        HRESULT ( STDMETHODCALLTYPE *RegisterPropertySchema )( 
-            IPropertySystem * This,
-            /* [string][in] */ __RPC__in LPCWSTR pszPath);
-        
-        HRESULT ( STDMETHODCALLTYPE *UnregisterPropertySchema )( 
-            IPropertySystem * This,
-            /* [string][in] */ __RPC__in LPCWSTR pszPath);
-        
-        HRESULT ( STDMETHODCALLTYPE *RefreshPropertySchema )( 
-            IPropertySystem * This);
-        
-        END_INTERFACE
-    } IPropertySystemVtbl;
-
-    interface IPropertySystem
-    {
-        CONST_VTBL struct IPropertySystemVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IPropertySystem_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IPropertySystem_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IPropertySystem_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IPropertySystem_GetPropertyDescription(This,propkey,riid,ppv)	\
-    ( (This)->lpVtbl -> GetPropertyDescription(This,propkey,riid,ppv) ) 
-
-#define IPropertySystem_GetPropertyDescriptionByName(This,pszCanonicalName,riid,ppv)	\
-    ( (This)->lpVtbl -> GetPropertyDescriptionByName(This,pszCanonicalName,riid,ppv) ) 
-
-#define IPropertySystem_GetPropertyDescriptionListFromString(This,pszPropList,riid,ppv)	\
-    ( (This)->lpVtbl -> GetPropertyDescriptionListFromString(This,pszPropList,riid,ppv) ) 
-
-#define IPropertySystem_EnumeratePropertyDescriptions(This,filterOn,riid,ppv)	\
-    ( (This)->lpVtbl -> EnumeratePropertyDescriptions(This,filterOn,riid,ppv) ) 
-
-#define IPropertySystem_FormatForDisplay(This,key,propvar,pdff,pszText,cchText)	\
-    ( (This)->lpVtbl -> FormatForDisplay(This,key,propvar,pdff,pszText,cchText) ) 
-
-#define IPropertySystem_FormatForDisplayAlloc(This,key,propvar,pdff,ppszDisplay)	\
-    ( (This)->lpVtbl -> FormatForDisplayAlloc(This,key,propvar,pdff,ppszDisplay) ) 
-
-#define IPropertySystem_RegisterPropertySchema(This,pszPath)	\
-    ( (This)->lpVtbl -> RegisterPropertySchema(This,pszPath) ) 
-
-#define IPropertySystem_UnregisterPropertySchema(This,pszPath)	\
-    ( (This)->lpVtbl -> UnregisterPropertySchema(This,pszPath) ) 
-
-#define IPropertySystem_RefreshPropertySchema(This)	\
-    ( (This)->lpVtbl -> RefreshPropertySchema(This) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IPropertySystem_INTERFACE_DEFINED__ */
-
-
-#ifndef __IPropertyDescriptionList_INTERFACE_DEFINED__
-#define __IPropertyDescriptionList_INTERFACE_DEFINED__
-
-/* interface IPropertyDescriptionList */
-/* [unique][object][uuid] */ 
-
-
-EXTERN_C const IID IID_IPropertyDescriptionList;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("1f9fc1d0-c39b-4b26-817f-011967d3440e")
-    IPropertyDescriptionList : public IUnknown
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE GetCount( 
-            /* [out] */ __RPC__out UINT *pcElem) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetAt( 
-            /* [in] */ UINT iElem,
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][out] */ __RPC__deref_out_opt void **ppv) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IPropertyDescriptionListVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IPropertyDescriptionList * This,
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IPropertyDescriptionList * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IPropertyDescriptionList * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetCount )( 
-            IPropertyDescriptionList * This,
-            /* [out] */ __RPC__out UINT *pcElem);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetAt )( 
-            IPropertyDescriptionList * This,
-            /* [in] */ UINT iElem,
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][out] */ __RPC__deref_out_opt void **ppv);
-        
-        END_INTERFACE
-    } IPropertyDescriptionListVtbl;
-
-    interface IPropertyDescriptionList
-    {
-        CONST_VTBL struct IPropertyDescriptionListVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IPropertyDescriptionList_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IPropertyDescriptionList_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IPropertyDescriptionList_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IPropertyDescriptionList_GetCount(This,pcElem)	\
-    ( (This)->lpVtbl -> GetCount(This,pcElem) ) 
-
-#define IPropertyDescriptionList_GetAt(This,iElem,riid,ppv)	\
-    ( (This)->lpVtbl -> GetAt(This,iElem,riid,ppv) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IPropertyDescriptionList_INTERFACE_DEFINED__ */
-
-
-#ifndef __IPropertyStoreFactory_INTERFACE_DEFINED__
-#define __IPropertyStoreFactory_INTERFACE_DEFINED__
-
-/* interface IPropertyStoreFactory */
-/* [unique][object][uuid] */ 
-
-
-EXTERN_C const IID IID_IPropertyStoreFactory;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("bc110b6d-57e8-4148-a9c6-91015ab2f3a5")
-    IPropertyStoreFactory : public IUnknown
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE GetPropertyStore( 
-            /* [in] */ GETPROPERTYSTOREFLAGS flags,
-            /* [unique][in] */ __RPC__in_opt IUnknown *pUnkFactory,
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][out] */ __RPC__deref_out_opt void **ppv) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetPropertyStoreForKeys( 
-            /* [unique][in] */ __RPC__in_opt const PROPERTYKEY *rgKeys,
-            /* [in] */ UINT cKeys,
-            /* [in] */ GETPROPERTYSTOREFLAGS flags,
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][out] */ __RPC__deref_out_opt void **ppv) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IPropertyStoreFactoryVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IPropertyStoreFactory * This,
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IPropertyStoreFactory * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IPropertyStoreFactory * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetPropertyStore )( 
-            IPropertyStoreFactory * This,
-            /* [in] */ GETPROPERTYSTOREFLAGS flags,
-            /* [unique][in] */ __RPC__in_opt IUnknown *pUnkFactory,
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][out] */ __RPC__deref_out_opt void **ppv);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetPropertyStoreForKeys )( 
-            IPropertyStoreFactory * This,
-            /* [unique][in] */ __RPC__in_opt const PROPERTYKEY *rgKeys,
-            /* [in] */ UINT cKeys,
-            /* [in] */ GETPROPERTYSTOREFLAGS flags,
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][out] */ __RPC__deref_out_opt void **ppv);
-        
-        END_INTERFACE
-    } IPropertyStoreFactoryVtbl;
-
-    interface IPropertyStoreFactory
-    {
-        CONST_VTBL struct IPropertyStoreFactoryVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IPropertyStoreFactory_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IPropertyStoreFactory_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IPropertyStoreFactory_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IPropertyStoreFactory_GetPropertyStore(This,flags,pUnkFactory,riid,ppv)	\
-    ( (This)->lpVtbl -> GetPropertyStore(This,flags,pUnkFactory,riid,ppv) ) 
-
-#define IPropertyStoreFactory_GetPropertyStoreForKeys(This,rgKeys,cKeys,flags,riid,ppv)	\
-    ( (This)->lpVtbl -> GetPropertyStoreForKeys(This,rgKeys,cKeys,flags,riid,ppv) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IPropertyStoreFactory_INTERFACE_DEFINED__ */
-
-
-#ifndef __IDelayedPropertyStoreFactory_INTERFACE_DEFINED__
-#define __IDelayedPropertyStoreFactory_INTERFACE_DEFINED__
-
-/* interface IDelayedPropertyStoreFactory */
-/* [unique][object][uuid] */ 
-
-
-EXTERN_C const IID IID_IDelayedPropertyStoreFactory;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("40d4577f-e237-4bdb-bd69-58f089431b6a")
-    IDelayedPropertyStoreFactory : public IPropertyStoreFactory
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE GetDelayedPropertyStore( 
-            /* [in] */ GETPROPERTYSTOREFLAGS flags,
-            /* [in] */ DWORD dwStoreId,
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][out] */ __RPC__deref_out_opt void **ppv) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IDelayedPropertyStoreFactoryVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IDelayedPropertyStoreFactory * This,
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IDelayedPropertyStoreFactory * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IDelayedPropertyStoreFactory * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetPropertyStore )( 
-            IDelayedPropertyStoreFactory * This,
-            /* [in] */ GETPROPERTYSTOREFLAGS flags,
-            /* [unique][in] */ __RPC__in_opt IUnknown *pUnkFactory,
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][out] */ __RPC__deref_out_opt void **ppv);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetPropertyStoreForKeys )( 
-            IDelayedPropertyStoreFactory * This,
-            /* [unique][in] */ __RPC__in_opt const PROPERTYKEY *rgKeys,
-            /* [in] */ UINT cKeys,
-            /* [in] */ GETPROPERTYSTOREFLAGS flags,
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][out] */ __RPC__deref_out_opt void **ppv);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetDelayedPropertyStore )( 
-            IDelayedPropertyStoreFactory * This,
-            /* [in] */ GETPROPERTYSTOREFLAGS flags,
-            /* [in] */ DWORD dwStoreId,
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][out] */ __RPC__deref_out_opt void **ppv);
-        
-        END_INTERFACE
-    } IDelayedPropertyStoreFactoryVtbl;
-
-    interface IDelayedPropertyStoreFactory
-    {
-        CONST_VTBL struct IDelayedPropertyStoreFactoryVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IDelayedPropertyStoreFactory_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IDelayedPropertyStoreFactory_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IDelayedPropertyStoreFactory_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IDelayedPropertyStoreFactory_GetPropertyStore(This,flags,pUnkFactory,riid,ppv)	\
-    ( (This)->lpVtbl -> GetPropertyStore(This,flags,pUnkFactory,riid,ppv) ) 
-
-#define IDelayedPropertyStoreFactory_GetPropertyStoreForKeys(This,rgKeys,cKeys,flags,riid,ppv)	\
-    ( (This)->lpVtbl -> GetPropertyStoreForKeys(This,rgKeys,cKeys,flags,riid,ppv) ) 
-
-
-#define IDelayedPropertyStoreFactory_GetDelayedPropertyStore(This,flags,dwStoreId,riid,ppv)	\
-    ( (This)->lpVtbl -> GetDelayedPropertyStore(This,flags,dwStoreId,riid,ppv) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IDelayedPropertyStoreFactory_INTERFACE_DEFINED__ */
-
-
-/* interface __MIDL_itf_propsys_0000_0018 */
-/* [local] */ 
-
-/* [v1_enum] */ 
-enum tagPERSIST_SPROPSTORE_FLAGS
-    {	FPSPS_READONLY	= 0x1
-    } ;
-typedef int PERSIST_SPROPSTORE_FLAGS;
-
-typedef struct tagSERIALIZEDPROPSTORAGE SERIALIZEDPROPSTORAGE;
-
-typedef SERIALIZEDPROPSTORAGE __unaligned *PUSERIALIZEDPROPSTORAGE;
-
-typedef const SERIALIZEDPROPSTORAGE __unaligned *PCUSERIALIZEDPROPSTORAGE;
-
-
-
-extern RPC_IF_HANDLE __MIDL_itf_propsys_0000_0018_v0_0_c_ifspec;
-extern RPC_IF_HANDLE __MIDL_itf_propsys_0000_0018_v0_0_s_ifspec;
-
-#ifndef __IPersistSerializedPropStorage_INTERFACE_DEFINED__
-#define __IPersistSerializedPropStorage_INTERFACE_DEFINED__
-
-/* interface IPersistSerializedPropStorage */
-/* [object][local][unique][uuid] */ 
-
-
-EXTERN_C const IID IID_IPersistSerializedPropStorage;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("e318ad57-0aa0-450f-aca5-6fab7103d917")
-    IPersistSerializedPropStorage : public IUnknown
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE SetFlags( 
-            /* [in] */ PERSIST_SPROPSTORE_FLAGS flags) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE SetPropertyStorage( 
-            /* [in] */ 
-            __in_bcount(cb)  PCUSERIALIZEDPROPSTORAGE psps,
-            /* [in] */ 
-            __in  DWORD cb) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetPropertyStorage( 
-            /* [out] */ 
-            __deref_out_bcount(*pcb)  SERIALIZEDPROPSTORAGE **ppsps,
-            /* [out] */ 
-            __out  DWORD *pcb) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IPersistSerializedPropStorageVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IPersistSerializedPropStorage * This,
-            /* [in] */ REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IPersistSerializedPropStorage * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IPersistSerializedPropStorage * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *SetFlags )( 
-            IPersistSerializedPropStorage * This,
-            /* [in] */ PERSIST_SPROPSTORE_FLAGS flags);
-        
-        HRESULT ( STDMETHODCALLTYPE *SetPropertyStorage )( 
-            IPersistSerializedPropStorage * This,
-            /* [in] */ 
-            __in_bcount(cb)  PCUSERIALIZEDPROPSTORAGE psps,
-            /* [in] */ 
-            __in  DWORD cb);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetPropertyStorage )( 
-            IPersistSerializedPropStorage * This,
-            /* [out] */ 
-            __deref_out_bcount(*pcb)  SERIALIZEDPROPSTORAGE **ppsps,
-            /* [out] */ 
-            __out  DWORD *pcb);
-        
-        END_INTERFACE
-    } IPersistSerializedPropStorageVtbl;
-
-    interface IPersistSerializedPropStorage
-    {
-        CONST_VTBL struct IPersistSerializedPropStorageVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IPersistSerializedPropStorage_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IPersistSerializedPropStorage_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IPersistSerializedPropStorage_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IPersistSerializedPropStorage_SetFlags(This,flags)	\
-    ( (This)->lpVtbl -> SetFlags(This,flags) ) 
-
-#define IPersistSerializedPropStorage_SetPropertyStorage(This,psps,cb)	\
-    ( (This)->lpVtbl -> SetPropertyStorage(This,psps,cb) ) 
-
-#define IPersistSerializedPropStorage_GetPropertyStorage(This,ppsps,pcb)	\
-    ( (This)->lpVtbl -> GetPropertyStorage(This,ppsps,pcb) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IPersistSerializedPropStorage_INTERFACE_DEFINED__ */
-
-
-#ifndef __IPropertySystemChangeNotify_INTERFACE_DEFINED__
-#define __IPropertySystemChangeNotify_INTERFACE_DEFINED__
-
-/* interface IPropertySystemChangeNotify */
-/* [unique][object][uuid] */ 
-
-
-EXTERN_C const IID IID_IPropertySystemChangeNotify;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("fa955fd9-38be-4879-a6ce-824cf52d609f")
-    IPropertySystemChangeNotify : public IUnknown
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE SchemaRefreshed( void) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IPropertySystemChangeNotifyVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IPropertySystemChangeNotify * This,
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IPropertySystemChangeNotify * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IPropertySystemChangeNotify * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *SchemaRefreshed )( 
-            IPropertySystemChangeNotify * This);
-        
-        END_INTERFACE
-    } IPropertySystemChangeNotifyVtbl;
-
-    interface IPropertySystemChangeNotify
-    {
-        CONST_VTBL struct IPropertySystemChangeNotifyVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IPropertySystemChangeNotify_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IPropertySystemChangeNotify_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IPropertySystemChangeNotify_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IPropertySystemChangeNotify_SchemaRefreshed(This)	\
-    ( (This)->lpVtbl -> SchemaRefreshed(This) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IPropertySystemChangeNotify_INTERFACE_DEFINED__ */
-
-
-#ifndef __ICreateObject_INTERFACE_DEFINED__
-#define __ICreateObject_INTERFACE_DEFINED__
-
-/* interface ICreateObject */
-/* [object][unique][uuid] */ 
-
-
-EXTERN_C const IID IID_ICreateObject;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("75121952-e0d0-43e5-9380-1d80483acf72")
-    ICreateObject : public IUnknown
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE CreateObject( 
-            /* [in] */ __RPC__in REFCLSID clsid,
-            /* [unique][in] */ __RPC__in_opt IUnknown *pUnkOuter,
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][out] */ __RPC__deref_out_opt void **ppv) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct ICreateObjectVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            ICreateObject * This,
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            ICreateObject * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            ICreateObject * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *CreateObject )( 
-            ICreateObject * This,
-            /* [in] */ __RPC__in REFCLSID clsid,
-            /* [unique][in] */ __RPC__in_opt IUnknown *pUnkOuter,
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][out] */ __RPC__deref_out_opt void **ppv);
-        
-        END_INTERFACE
-    } ICreateObjectVtbl;
-
-    interface ICreateObject
-    {
-        CONST_VTBL struct ICreateObjectVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define ICreateObject_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define ICreateObject_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define ICreateObject_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define ICreateObject_CreateObject(This,clsid,pUnkOuter,riid,ppv)	\
-    ( (This)->lpVtbl -> CreateObject(This,clsid,pUnkOuter,riid,ppv) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __ICreateObject_INTERFACE_DEFINED__ */
-
-
-/* interface __MIDL_itf_propsys_0000_0021 */
-/* [local] */ 
-
-// Format a property value for display purposes
-PSSTDAPI PSFormatForDisplay(
-    __in REFPROPERTYKEY propkey,
-    __in REFPROPVARIANT propvar,
-    __in PROPDESC_FORMAT_FLAGS pdfFlags,
-    __out_ecount(cchText) LPWSTR pwszText,
-    __in DWORD cchText);
-
-PSSTDAPI PSFormatForDisplayAlloc(
-    __in REFPROPERTYKEY key,
-    __in REFPROPVARIANT propvar,
-    __in PROPDESC_FORMAT_FLAGS pdff,
-    __deref_out PWSTR *ppszDisplay);
-
-PSSTDAPI PSFormatPropertyValue(
-    __in IPropertyStore *pps,
-    __in IPropertyDescription *ppd,
-    __in PROPDESC_FORMAT_FLAGS pdff,
-    __deref_out LPWSTR *ppszDisplay);
-
-
-#define PKEY_PIDSTR_MAX     10   // will take care of any long integer value
-#define GUIDSTRING_MAX      (1 + 8 + 1 + 4 + 1 + 4 + 1 + 4 + 1 + 12 + 1 + 1)  // "{12345678-1234-1234-1234-123456789012}"
-#define PKEYSTR_MAX         (GUIDSTRING_MAX + 1 + PKEY_PIDSTR_MAX)
-
-// Convert a PROPERTYKEY to and from a PWSTR
-PSSTDAPI PSStringFromPropertyKey(
-    __in REFPROPERTYKEY pkey,
-    __out_ecount(cch) LPWSTR psz,
-    __in UINT cch);
-
-PSSTDAPI PSPropertyKeyFromString(
-    __in LPCWSTR pszString,
-    __out PROPERTYKEY *pkey);
-
-
-// Creates an in-memory property store
-// Returns an IPropertyStore, IPersistSerializedPropStorage, and related interfaces interface
-PSSTDAPI PSCreateMemoryPropertyStore(
-    __in REFIID riid,
-    __deref_out void **ppv);
-
-
-// Create a read-only, delay-bind multiplexing property store
-// Returns an IPropertyStore interface or related interfaces
-PSSTDAPI PSCreateDelayedMultiplexPropertyStore(
-    __in GETPROPERTYSTOREFLAGS flags,
-    __in IDelayedPropertyStoreFactory *pdpsf,
-    __in_ecount(cStores) const DWORD *rgStoreIds,
-    __in DWORD cStores,
-    __in REFIID riid,
-    __deref_out void **ppv);
-
-
-// Create a read-only property store from one or more sources (which each must support either IPropertyStore or IPropertySetStorage)
-// Returns an IPropertyStore interface or related interfaces
-PSSTDAPI PSCreateMultiplexPropertyStore(
-    __in_ecount(cStores) IUnknown **prgpunkStores,
-    __in DWORD cStores,
-    __in REFIID riid,
-    __deref_out void **ppv);
-
-
-// Create a container for IPropertyChanges
-// Returns an IPropertyChangeArray interface
-PSSTDAPI PSCreatePropertyChangeArray(
-    __in_ecount_opt(cChanges) const PROPERTYKEY *rgpropkey,
-    __in_ecount_opt(cChanges) const PKA_FLAGS *rgflags,
-    __in_ecount_opt(cChanges) const PROPVARIANT *rgpropvar,
-    __in UINT cChanges,
-    __in REFIID riid,
-    __deref_out void **ppv);
-
-
-// Create a simple property change
-// Returns an IPropertyChange interface
-PSSTDAPI PSCreateSimplePropertyChange(
-    __in PKA_FLAGS flags,
-    __in REFPROPERTYKEY key,
-    __in REFPROPVARIANT propvar,
-    __in REFIID riid,
-    __deref_out void **ppv);
-
-
-// Get a property description
-// Returns an IPropertyDescription interface
-PSSTDAPI PSGetPropertyDescription(
-    __in REFPROPERTYKEY propkey,
-    __in REFIID riid,
-    __deref_out void **ppv);
-
-PSSTDAPI PSGetPropertyDescriptionByName(
-    __in LPCWSTR pszCanonicalName,
-    __in REFIID riid,
-    __deref_out void **ppv);
-
-
-// Lookup a per-machine registered file property handler
-PSSTDAPI PSLookupPropertyHandlerCLSID(
-    __in PCWSTR pszFilePath,
-    __out CLSID *pclsid);
-// Get a property handler, on Vista or downlevel to XP
-// punkItem is a shell item created with an SHCreateItemXXX API
-// Returns an IPropertyStore
-PSSTDAPI PSGetItemPropertyHandler(
-    __in IUnknown *punkItem,
-    __in BOOL fReadWrite,
-    __in REFIID riid,
-    __deref_out void **ppv);
-
-
-// Get a property handler, on Vista or downlevel to XP
-// punkItem is a shell item created with an SHCreateItemXXX API
-// punkCreateObject supports ICreateObject
-// Returns an IPropertyStore
-PSSTDAPI PSGetItemPropertyHandlerWithCreateObject(
-    __in IUnknown *punkItem,
-    __in BOOL fReadWrite,
-    __in IUnknown *punkCreateObject,
-    __in REFIID riid,
-    __deref_out void **ppv);
-
-
-// Get or set a property value from a store
-PSSTDAPI PSGetPropertyValue(
-    __in IPropertyStore *pps,
-    __in IPropertyDescription *ppd,
-    __out PROPVARIANT *ppropvar);
-
-PSSTDAPI PSSetPropertyValue(
-    __in IPropertyStore *pps,
-    __in IPropertyDescription *ppd,
-    __in REFPROPVARIANT propvar);
-
-
-// Interact with the set of property descriptions
-PSSTDAPI PSRegisterPropertySchema(
-    __in PCWSTR pszPath);
-
-PSSTDAPI PSUnregisterPropertySchema(
-    __in PCWSTR pszPath);
-
-PSSTDAPI PSRefreshPropertySchema();
-
-// Returns either: IPropertyDescriptionList or IEnumUnknown interfaces
-PSSTDAPI PSEnumeratePropertyDescriptions(
-    __in PROPDESC_ENUMFILTER filterOn,
-    __in REFIID riid,
-    __deref_out void **ppv);
-
-
-// Convert between a PROPERTYKEY and its canonical name
-PSSTDAPI PSGetPropertyKeyFromName(
-    __in PCWSTR pszName,
-    __out PROPERTYKEY *ppropkey);
-
-PSSTDAPI PSGetNameFromPropertyKey(
-    __in REFPROPERTYKEY propkey,
-    __deref_out PWSTR *ppszCanonicalName);
-
-
-// Coerce and canonicalize a property value
-PSSTDAPI PSCoerceToCanonicalValue(
-    __in REFPROPERTYKEY key,
-    __inout PROPVARIANT *ppropvar);
-
-
-// Convert a 'prop:' string into a list of property descriptions
-// Returns an IPropertyDescriptionList interface
-PSSTDAPI PSGetPropertyDescriptionListFromString(
-    __in LPCWSTR pszPropList,
-    __in REFIID riid,
-    __deref_out void **ppv);
-
-
-// Wrap an IPropertySetStorage interface in an IPropertyStore interface
-// Returns an IPropertyStore or related interface
-PSSTDAPI PSCreatePropertyStoreFromPropertySetStorage(
-    __in IPropertySetStorage *ppss,
-    DWORD grfMode,
-    REFIID riid,
-    __deref_out void **ppv);
-
-
-// punkSource must support IPropertyStore or IPropertySetStorage
-// On success, the returned ppv is guaranteed to support IPropertyStore.
-// If punkSource already supports IPropertyStore, no wrapper is created.
-PSSTDAPI PSCreatePropertyStoreFromObject(
-    __in IUnknown *punk,
-    __in DWORD grfMode,
-    __in REFIID riid,
-    __deref_out void **ppv);
-
-
-// punkSource must support IPropertyStore
-// riid may be IPropertyStore, IPropertySetStorage, IPropertyStoreCapabilities, or IObjectProvider
-PSSTDAPI PSCreateAdapterFromPropertyStore(
-    __in IPropertyStore *pps,
-    __in REFIID riid,
-    __deref_out void **ppv);
-
-
-// Talk to the property system using an interface
-// Returns an IPropertySystem interface
-PSSTDAPI PSGetPropertySystem(
-    __in REFIID riid,
-    __deref_out void **ppv);
-
-
-// Obtain a value from serialized property storage
-PSSTDAPI PSGetPropertyFromPropertyStorage(
-    __in_bcount(cb) PCUSERIALIZEDPROPSTORAGE psps, 
-    __in DWORD cb, 
-    __in REFPROPERTYKEY rpkey, 
-    __out PROPVARIANT *ppropvar);
-
-
-// Obtain a named value from serialized property storage
-PSSTDAPI PSGetNamedPropertyFromPropertyStorage(
-    __in_bcount(cb) PCUSERIALIZEDPROPSTORAGE psps, 
-    __in DWORD cb, 
-    __in LPCWSTR pszName, 
-    __out PROPVARIANT *ppropvar);
-
-
-
-
-extern RPC_IF_HANDLE __MIDL_itf_propsys_0000_0021_v0_0_c_ifspec;
-extern RPC_IF_HANDLE __MIDL_itf_propsys_0000_0021_v0_0_s_ifspec;
-
-
-#ifndef __PropSysObjects_LIBRARY_DEFINED__
-#define __PropSysObjects_LIBRARY_DEFINED__
-
-/* library PropSysObjects */
-/* [version][lcid][uuid] */ 
-
-
-EXTERN_C const IID LIBID_PropSysObjects;
-
-EXTERN_C const CLSID CLSID_InMemoryPropertyStore;
-
-#ifdef __cplusplus
-
-class DECLSPEC_UUID("9a02e012-6303-4e1e-b9a1-630f802592c5")
-InMemoryPropertyStore;
-#endif
-
-EXTERN_C const CLSID CLSID_PropertySystem;
-
-#ifdef __cplusplus
-
-class DECLSPEC_UUID("b8967f85-58ae-4f46-9fb2-5d7904798f4b")
-PropertySystem;
-#endif
-#endif /* __PropSysObjects_LIBRARY_DEFINED__ */
-
-/* Additional Prototypes for ALL interfaces */
-
-unsigned long             __RPC_USER  BSTR_UserSize(     unsigned long *, unsigned long            , BSTR * ); 
-unsigned char * __RPC_USER  BSTR_UserMarshal(  unsigned long *, unsigned char *, BSTR * ); 
-unsigned char * __RPC_USER  BSTR_UserUnmarshal(unsigned long *, unsigned char *, BSTR * ); 
-void                      __RPC_USER  BSTR_UserFree(     unsigned long *, BSTR * ); 
-
-unsigned long             __RPC_USER  LPSAFEARRAY_UserSize(     unsigned long *, unsigned long            , LPSAFEARRAY * ); 
-unsigned char * __RPC_USER  LPSAFEARRAY_UserMarshal(  unsigned long *, unsigned char *, LPSAFEARRAY * ); 
-unsigned char * __RPC_USER  LPSAFEARRAY_UserUnmarshal(unsigned long *, unsigned char *, LPSAFEARRAY * ); 
-void                      __RPC_USER  LPSAFEARRAY_UserFree(     unsigned long *, LPSAFEARRAY * ); 
-
-unsigned long             __RPC_USER  BSTR_UserSize64(     unsigned long *, unsigned long            , BSTR * ); 
-unsigned char * __RPC_USER  BSTR_UserMarshal64(  unsigned long *, unsigned char *, BSTR * ); 
-unsigned char * __RPC_USER  BSTR_UserUnmarshal64(unsigned long *, unsigned char *, BSTR * ); 
-void                      __RPC_USER  BSTR_UserFree64(     unsigned long *, BSTR * ); 
-
-unsigned long             __RPC_USER  LPSAFEARRAY_UserSize64(     unsigned long *, unsigned long            , LPSAFEARRAY * ); 
-unsigned char * __RPC_USER  LPSAFEARRAY_UserMarshal64(  unsigned long *, unsigned char *, LPSAFEARRAY * ); 
-unsigned char * __RPC_USER  LPSAFEARRAY_UserUnmarshal64(unsigned long *, unsigned char *, LPSAFEARRAY * ); 
-void                      __RPC_USER  LPSAFEARRAY_UserFree64(     unsigned long *, LPSAFEARRAY * ); 
-
-/* [local] */ HRESULT STDMETHODCALLTYPE IInitializeWithStream_Initialize_Proxy( 
-    IInitializeWithStream * This,
-    /* [in] */ IStream *pstream,
-    /* [in] */ DWORD grfMode);
-
-
-/* [call_as] */ HRESULT STDMETHODCALLTYPE IInitializeWithStream_Initialize_Stub( 
-    IInitializeWithStream * This,
-    /* [in] */ __RPC__in_opt IStream *pstream,
-    /* [in] */ DWORD grfMode);
-
-/* [local] */ HRESULT STDMETHODCALLTYPE IPropertyDescription_CoerceToCanonicalValue_Proxy( 
-    IPropertyDescription * This,
-    /* [out][in] */ PROPVARIANT *ppropvar);
-
-
-/* [call_as] */ HRESULT STDMETHODCALLTYPE IPropertyDescription_CoerceToCanonicalValue_Stub( 
-    IPropertyDescription * This,
-    /* [in] */ __RPC__in REFPROPVARIANT propvar,
-    /* [out] */ __RPC__out PROPVARIANT *ppropvar);
-
-
-
-/* end of Additional Prototypes */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
-
-
+
+
+/* this ALWAYS GENERATED file contains the definitions for the interfaces */
+
+
+ /* File created by MIDL compiler version 7.00.0499 */
+/* Compiler settings for propsys.idl:
+    Oicf, W1, Zp8, env=Win32 (32b run)
+    protocol : dce , ms_ext, c_ext, robust
+    error checks: allocation ref bounds_check enum stub_data 
+    VC __declspec() decoration level: 
+         __declspec(uuid()), __declspec(selectany), __declspec(novtable)
+         DECLSPEC_UUID(), MIDL_INTERFACE()
+*/
+//@@MIDL_FILE_HEADING(  )
+
+#pragma warning( disable: 4049 )  /* more than 64k source lines */
+
+
+/* verify that the <rpcndr.h> version is high enough to compile this file*/
+#ifndef __REQUIRED_RPCNDR_H_VERSION__
+#define __REQUIRED_RPCNDR_H_VERSION__ 475
+#endif
+
+/* verify that the <rpcsal.h> version is high enough to compile this file*/
+#ifndef __REQUIRED_RPCSAL_H_VERSION__
+#define __REQUIRED_RPCSAL_H_VERSION__ 100
+#endif
+
+#include "rpc.h"
+#include "rpcndr.h"
+
+#ifndef __RPCNDR_H_VERSION__
+#error this stub requires an updated version of <rpcndr.h>
+#endif // __RPCNDR_H_VERSION__
+
+#ifndef COM_NO_WINDOWS_H
+#include "windows.h"
+#include "ole2.h"
+#endif /*COM_NO_WINDOWS_H*/
+
+#ifndef __propsys_h__
+#define __propsys_h__
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+#pragma once
+#endif
+
+/* Forward Declarations */ 
+
+#ifndef __IInitializeWithFile_FWD_DEFINED__
+#define __IInitializeWithFile_FWD_DEFINED__
+typedef interface IInitializeWithFile IInitializeWithFile;
+#endif 	/* __IInitializeWithFile_FWD_DEFINED__ */
+
+
+#ifndef __IInitializeWithStream_FWD_DEFINED__
+#define __IInitializeWithStream_FWD_DEFINED__
+typedef interface IInitializeWithStream IInitializeWithStream;
+#endif 	/* __IInitializeWithStream_FWD_DEFINED__ */
+
+
+#ifndef __IPropertyStore_FWD_DEFINED__
+#define __IPropertyStore_FWD_DEFINED__
+typedef interface IPropertyStore IPropertyStore;
+#endif 	/* __IPropertyStore_FWD_DEFINED__ */
+
+
+#ifndef __INamedPropertyStore_FWD_DEFINED__
+#define __INamedPropertyStore_FWD_DEFINED__
+typedef interface INamedPropertyStore INamedPropertyStore;
+#endif 	/* __INamedPropertyStore_FWD_DEFINED__ */
+
+
+#ifndef __IObjectWithPropertyKey_FWD_DEFINED__
+#define __IObjectWithPropertyKey_FWD_DEFINED__
+typedef interface IObjectWithPropertyKey IObjectWithPropertyKey;
+#endif 	/* __IObjectWithPropertyKey_FWD_DEFINED__ */
+
+
+#ifndef __IPropertyChange_FWD_DEFINED__
+#define __IPropertyChange_FWD_DEFINED__
+typedef interface IPropertyChange IPropertyChange;
+#endif 	/* __IPropertyChange_FWD_DEFINED__ */
+
+
+#ifndef __IPropertyChangeArray_FWD_DEFINED__
+#define __IPropertyChangeArray_FWD_DEFINED__
+typedef interface IPropertyChangeArray IPropertyChangeArray;
+#endif 	/* __IPropertyChangeArray_FWD_DEFINED__ */
+
+
+#ifndef __IPropertyStoreCapabilities_FWD_DEFINED__
+#define __IPropertyStoreCapabilities_FWD_DEFINED__
+typedef interface IPropertyStoreCapabilities IPropertyStoreCapabilities;
+#endif 	/* __IPropertyStoreCapabilities_FWD_DEFINED__ */
+
+
+#ifndef __IPropertyStoreCache_FWD_DEFINED__
+#define __IPropertyStoreCache_FWD_DEFINED__
+typedef interface IPropertyStoreCache IPropertyStoreCache;
+#endif 	/* __IPropertyStoreCache_FWD_DEFINED__ */
+
+
+#ifndef __IPropertyEnumType_FWD_DEFINED__
+#define __IPropertyEnumType_FWD_DEFINED__
+typedef interface IPropertyEnumType IPropertyEnumType;
+#endif 	/* __IPropertyEnumType_FWD_DEFINED__ */
+
+
+#ifndef __IPropertyEnumTypeList_FWD_DEFINED__
+#define __IPropertyEnumTypeList_FWD_DEFINED__
+typedef interface IPropertyEnumTypeList IPropertyEnumTypeList;
+#endif 	/* __IPropertyEnumTypeList_FWD_DEFINED__ */
+
+
+#ifndef __IPropertyDescription_FWD_DEFINED__
+#define __IPropertyDescription_FWD_DEFINED__
+typedef interface IPropertyDescription IPropertyDescription;
+#endif 	/* __IPropertyDescription_FWD_DEFINED__ */
+
+
+#ifndef __IPropertyDescriptionAliasInfo_FWD_DEFINED__
+#define __IPropertyDescriptionAliasInfo_FWD_DEFINED__
+typedef interface IPropertyDescriptionAliasInfo IPropertyDescriptionAliasInfo;
+#endif 	/* __IPropertyDescriptionAliasInfo_FWD_DEFINED__ */
+
+
+#ifndef __IPropertyDescriptionSearchInfo_FWD_DEFINED__
+#define __IPropertyDescriptionSearchInfo_FWD_DEFINED__
+typedef interface IPropertyDescriptionSearchInfo IPropertyDescriptionSearchInfo;
+#endif 	/* __IPropertyDescriptionSearchInfo_FWD_DEFINED__ */
+
+
+#ifndef __IPropertySystem_FWD_DEFINED__
+#define __IPropertySystem_FWD_DEFINED__
+typedef interface IPropertySystem IPropertySystem;
+#endif 	/* __IPropertySystem_FWD_DEFINED__ */
+
+
+#ifndef __IPropertyDescriptionList_FWD_DEFINED__
+#define __IPropertyDescriptionList_FWD_DEFINED__
+typedef interface IPropertyDescriptionList IPropertyDescriptionList;
+#endif 	/* __IPropertyDescriptionList_FWD_DEFINED__ */
+
+
+#ifndef __IPropertyStoreFactory_FWD_DEFINED__
+#define __IPropertyStoreFactory_FWD_DEFINED__
+typedef interface IPropertyStoreFactory IPropertyStoreFactory;
+#endif 	/* __IPropertyStoreFactory_FWD_DEFINED__ */
+
+
+#ifndef __IDelayedPropertyStoreFactory_FWD_DEFINED__
+#define __IDelayedPropertyStoreFactory_FWD_DEFINED__
+typedef interface IDelayedPropertyStoreFactory IDelayedPropertyStoreFactory;
+#endif 	/* __IDelayedPropertyStoreFactory_FWD_DEFINED__ */
+
+
+#ifndef __IPersistSerializedPropStorage_FWD_DEFINED__
+#define __IPersistSerializedPropStorage_FWD_DEFINED__
+typedef interface IPersistSerializedPropStorage IPersistSerializedPropStorage;
+#endif 	/* __IPersistSerializedPropStorage_FWD_DEFINED__ */
+
+
+#ifndef __IPropertySystemChangeNotify_FWD_DEFINED__
+#define __IPropertySystemChangeNotify_FWD_DEFINED__
+typedef interface IPropertySystemChangeNotify IPropertySystemChangeNotify;
+#endif 	/* __IPropertySystemChangeNotify_FWD_DEFINED__ */
+
+
+#ifndef __ICreateObject_FWD_DEFINED__
+#define __ICreateObject_FWD_DEFINED__
+typedef interface ICreateObject ICreateObject;
+#endif 	/* __ICreateObject_FWD_DEFINED__ */
+
+
+#ifndef __InMemoryPropertyStore_FWD_DEFINED__
+#define __InMemoryPropertyStore_FWD_DEFINED__
+
+#ifdef __cplusplus
+typedef class InMemoryPropertyStore InMemoryPropertyStore;
+#else
+typedef struct InMemoryPropertyStore InMemoryPropertyStore;
+#endif /* __cplusplus */
+
+#endif 	/* __InMemoryPropertyStore_FWD_DEFINED__ */
+
+
+#ifndef __PropertySystem_FWD_DEFINED__
+#define __PropertySystem_FWD_DEFINED__
+
+#ifdef __cplusplus
+typedef class PropertySystem PropertySystem;
+#else
+typedef struct PropertySystem PropertySystem;
+#endif /* __cplusplus */
+
+#endif 	/* __PropertySystem_FWD_DEFINED__ */
+
+
+/* header files for imported files */
+#include "objidl.h"
+#include "oleidl.h"
+#include "ocidl.h"
+#include "shtypes.h"
+#include "structuredquery.h"
+
+#ifdef __cplusplus
+extern "C"{
+#endif 
+
+
+/* interface __MIDL_itf_propsys_0000_0000 */
+/* [local] */ 
+
+#ifndef PSSTDAPI
+#if defined(_PROPSYS_)
+#define PSSTDAPI          STDAPI
+#define PSSTDAPI_(type)   STDAPI_(type)
+#else
+#define PSSTDAPI          EXTERN_C DECLSPEC_IMPORT HRESULT STDAPICALLTYPE
+#define PSSTDAPI_(type)   EXTERN_C DECLSPEC_IMPORT type STDAPICALLTYPE
+#endif
+#endif // PSSTDAPI
+#if 0
+typedef PROPERTYKEY *REFPROPERTYKEY;
+
+#endif // 0
+#include <propkeydef.h>
+
+
+extern RPC_IF_HANDLE __MIDL_itf_propsys_0000_0000_v0_0_c_ifspec;
+extern RPC_IF_HANDLE __MIDL_itf_propsys_0000_0000_v0_0_s_ifspec;
+
+#ifndef __IInitializeWithFile_INTERFACE_DEFINED__
+#define __IInitializeWithFile_INTERFACE_DEFINED__
+
+/* interface IInitializeWithFile */
+/* [unique][object][uuid] */ 
+
+
+EXTERN_C const IID IID_IInitializeWithFile;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("b7d14566-0509-4cce-a71f-0a554233bd9b")
+    IInitializeWithFile : public IUnknown
+    {
+    public:
+        virtual HRESULT STDMETHODCALLTYPE Initialize( 
+            /* [string][in] */ __RPC__in LPCWSTR pszFilePath,
+            /* [in] */ DWORD grfMode) = 0;
+        
+    };
+    
+#else 	/* C style interface */
+
+    typedef struct IInitializeWithFileVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            IInitializeWithFile * This,
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][out] */ 
+            __RPC__deref_out  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            IInitializeWithFile * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            IInitializeWithFile * This);
+        
+        HRESULT ( STDMETHODCALLTYPE *Initialize )( 
+            IInitializeWithFile * This,
+            /* [string][in] */ __RPC__in LPCWSTR pszFilePath,
+            /* [in] */ DWORD grfMode);
+        
+        END_INTERFACE
+    } IInitializeWithFileVtbl;
+
+    interface IInitializeWithFile
+    {
+        CONST_VTBL struct IInitializeWithFileVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define IInitializeWithFile_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define IInitializeWithFile_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define IInitializeWithFile_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define IInitializeWithFile_Initialize(This,pszFilePath,grfMode)	\
+    ( (This)->lpVtbl -> Initialize(This,pszFilePath,grfMode) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __IInitializeWithFile_INTERFACE_DEFINED__ */
+
+
+#ifndef __IInitializeWithStream_INTERFACE_DEFINED__
+#define __IInitializeWithStream_INTERFACE_DEFINED__
+
+/* interface IInitializeWithStream */
+/* [unique][object][uuid] */ 
+
+
+EXTERN_C const IID IID_IInitializeWithStream;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("b824b49d-22ac-4161-ac8a-9916e8fa3f7f")
+    IInitializeWithStream : public IUnknown
+    {
+    public:
+        virtual /* [local] */ HRESULT STDMETHODCALLTYPE Initialize( 
+            /* [in] */ IStream *pstream,
+            /* [in] */ DWORD grfMode) = 0;
+        
+    };
+    
+#else 	/* C style interface */
+
+    typedef struct IInitializeWithStreamVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            IInitializeWithStream * This,
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][out] */ 
+            __RPC__deref_out  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            IInitializeWithStream * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            IInitializeWithStream * This);
+        
+        /* [local] */ HRESULT ( STDMETHODCALLTYPE *Initialize )( 
+            IInitializeWithStream * This,
+            /* [in] */ IStream *pstream,
+            /* [in] */ DWORD grfMode);
+        
+        END_INTERFACE
+    } IInitializeWithStreamVtbl;
+
+    interface IInitializeWithStream
+    {
+        CONST_VTBL struct IInitializeWithStreamVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define IInitializeWithStream_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define IInitializeWithStream_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define IInitializeWithStream_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define IInitializeWithStream_Initialize(This,pstream,grfMode)	\
+    ( (This)->lpVtbl -> Initialize(This,pstream,grfMode) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+/* [call_as] */ HRESULT STDMETHODCALLTYPE IInitializeWithStream_RemoteInitialize_Proxy( 
+    IInitializeWithStream * This,
+    /* [in] */ __RPC__in_opt IStream *pstream,
+    /* [in] */ DWORD grfMode);
+
+
+void __RPC_STUB IInitializeWithStream_RemoteInitialize_Stub(
+    IRpcStubBuffer *This,
+    IRpcChannelBuffer *_pRpcChannelBuffer,
+    PRPC_MESSAGE _pRpcMessage,
+    DWORD *_pdwStubPhase);
+
+
+
+#endif 	/* __IInitializeWithStream_INTERFACE_DEFINED__ */
+
+
+#ifndef __IPropertyStore_INTERFACE_DEFINED__
+#define __IPropertyStore_INTERFACE_DEFINED__
+
+/* interface IPropertyStore */
+/* [unique][object][helpstring][uuid] */ 
+
+
+EXTERN_C const IID IID_IPropertyStore;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("886d8eeb-8cf2-4446-8d02-cdba1dbdcf99")
+    IPropertyStore : public IUnknown
+    {
+    public:
+        virtual HRESULT STDMETHODCALLTYPE GetCount( 
+            /* [out] */ __RPC__out DWORD *cProps) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE GetAt( 
+            /* [in] */ DWORD iProp,
+            /* [out] */ __RPC__out PROPERTYKEY *pkey) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE GetValue( 
+            /* [in] */ __RPC__in REFPROPERTYKEY key,
+            /* [out] */ __RPC__out PROPVARIANT *pv) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE SetValue( 
+            /* [in] */ __RPC__in REFPROPERTYKEY key,
+            /* [in] */ __RPC__in REFPROPVARIANT propvar) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE Commit( void) = 0;
+        
+    };
+    
+#else 	/* C style interface */
+
+    typedef struct IPropertyStoreVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            IPropertyStore * This,
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][out] */ 
+            __RPC__deref_out  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            IPropertyStore * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            IPropertyStore * This);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetCount )( 
+            IPropertyStore * This,
+            /* [out] */ __RPC__out DWORD *cProps);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetAt )( 
+            IPropertyStore * This,
+            /* [in] */ DWORD iProp,
+            /* [out] */ __RPC__out PROPERTYKEY *pkey);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetValue )( 
+            IPropertyStore * This,
+            /* [in] */ __RPC__in REFPROPERTYKEY key,
+            /* [out] */ __RPC__out PROPVARIANT *pv);
+        
+        HRESULT ( STDMETHODCALLTYPE *SetValue )( 
+            IPropertyStore * This,
+            /* [in] */ __RPC__in REFPROPERTYKEY key,
+            /* [in] */ __RPC__in REFPROPVARIANT propvar);
+        
+        HRESULT ( STDMETHODCALLTYPE *Commit )( 
+            IPropertyStore * This);
+        
+        END_INTERFACE
+    } IPropertyStoreVtbl;
+
+    interface IPropertyStore
+    {
+        CONST_VTBL struct IPropertyStoreVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define IPropertyStore_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define IPropertyStore_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define IPropertyStore_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define IPropertyStore_GetCount(This,cProps)	\
+    ( (This)->lpVtbl -> GetCount(This,cProps) ) 
+
+#define IPropertyStore_GetAt(This,iProp,pkey)	\
+    ( (This)->lpVtbl -> GetAt(This,iProp,pkey) ) 
+
+#define IPropertyStore_GetValue(This,key,pv)	\
+    ( (This)->lpVtbl -> GetValue(This,key,pv) ) 
+
+#define IPropertyStore_SetValue(This,key,propvar)	\
+    ( (This)->lpVtbl -> SetValue(This,key,propvar) ) 
+
+#define IPropertyStore_Commit(This)	\
+    ( (This)->lpVtbl -> Commit(This) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __IPropertyStore_INTERFACE_DEFINED__ */
+
+
+/* interface __MIDL_itf_propsys_0000_0003 */
+/* [local] */ 
+
+typedef /* [unique] */  __RPC_unique_pointer IPropertyStore *LPPROPERTYSTORE;
+
+
+
+extern RPC_IF_HANDLE __MIDL_itf_propsys_0000_0003_v0_0_c_ifspec;
+extern RPC_IF_HANDLE __MIDL_itf_propsys_0000_0003_v0_0_s_ifspec;
+
+#ifndef __INamedPropertyStore_INTERFACE_DEFINED__
+#define __INamedPropertyStore_INTERFACE_DEFINED__
+
+/* interface INamedPropertyStore */
+/* [unique][object][uuid] */ 
+
+
+EXTERN_C const IID IID_INamedPropertyStore;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("71604b0f-97b0-4764-8577-2f13e98a1422")
+    INamedPropertyStore : public IUnknown
+    {
+    public:
+        virtual HRESULT STDMETHODCALLTYPE GetNamedValue( 
+            /* [string][in] */ __RPC__in LPCWSTR pszName,
+            /* [out] */ __RPC__out PROPVARIANT *ppropvar) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE SetNamedValue( 
+            /* [string][in] */ __RPC__in LPCWSTR pszName,
+            /* [in] */ __RPC__in REFPROPVARIANT propvar) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE GetNameCount( 
+            /* [out] */ __RPC__out DWORD *pdwCount) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE GetNameAt( 
+            /* [in] */ DWORD iProp,
+            /* [out] */ __RPC__deref_out_opt BSTR *pbstrName) = 0;
+        
+    };
+    
+#else 	/* C style interface */
+
+    typedef struct INamedPropertyStoreVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            INamedPropertyStore * This,
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][out] */ 
+            __RPC__deref_out  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            INamedPropertyStore * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            INamedPropertyStore * This);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetNamedValue )( 
+            INamedPropertyStore * This,
+            /* [string][in] */ __RPC__in LPCWSTR pszName,
+            /* [out] */ __RPC__out PROPVARIANT *ppropvar);
+        
+        HRESULT ( STDMETHODCALLTYPE *SetNamedValue )( 
+            INamedPropertyStore * This,
+            /* [string][in] */ __RPC__in LPCWSTR pszName,
+            /* [in] */ __RPC__in REFPROPVARIANT propvar);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetNameCount )( 
+            INamedPropertyStore * This,
+            /* [out] */ __RPC__out DWORD *pdwCount);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetNameAt )( 
+            INamedPropertyStore * This,
+            /* [in] */ DWORD iProp,
+            /* [out] */ __RPC__deref_out_opt BSTR *pbstrName);
+        
+        END_INTERFACE
+    } INamedPropertyStoreVtbl;
+
+    interface INamedPropertyStore
+    {
+        CONST_VTBL struct INamedPropertyStoreVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define INamedPropertyStore_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define INamedPropertyStore_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define INamedPropertyStore_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define INamedPropertyStore_GetNamedValue(This,pszName,ppropvar)	\
+    ( (This)->lpVtbl -> GetNamedValue(This,pszName,ppropvar) ) 
+
+#define INamedPropertyStore_SetNamedValue(This,pszName,propvar)	\
+    ( (This)->lpVtbl -> SetNamedValue(This,pszName,propvar) ) 
+
+#define INamedPropertyStore_GetNameCount(This,pdwCount)	\
+    ( (This)->lpVtbl -> GetNameCount(This,pdwCount) ) 
+
+#define INamedPropertyStore_GetNameAt(This,iProp,pbstrName)	\
+    ( (This)->lpVtbl -> GetNameAt(This,iProp,pbstrName) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __INamedPropertyStore_INTERFACE_DEFINED__ */
+
+
+/* interface __MIDL_itf_propsys_0000_0004 */
+/* [local] */ 
+
+/* [v1_enum] */ 
+enum tagGETPROPERTYSTOREFLAGS
+    {	GPS_DEFAULT	= 0,
+	GPS_HANDLERPROPERTIESONLY	= 0x1,
+	GPS_READWRITE	= 0x2,
+	GPS_TEMPORARY	= 0x4,
+	GPS_FASTPROPERTIESONLY	= 0x8,
+	GPS_OPENSLOWITEM	= 0x10,
+	GPS_DELAYCREATION	= 0x20,
+	GPS_BESTEFFORT	= 0x40,
+	GPS_MASK_VALID	= 0x7f
+    } ;
+typedef int GETPROPERTYSTOREFLAGS;
+
+
+
+extern RPC_IF_HANDLE __MIDL_itf_propsys_0000_0004_v0_0_c_ifspec;
+extern RPC_IF_HANDLE __MIDL_itf_propsys_0000_0004_v0_0_s_ifspec;
+
+#ifndef __IObjectWithPropertyKey_INTERFACE_DEFINED__
+#define __IObjectWithPropertyKey_INTERFACE_DEFINED__
+
+/* interface IObjectWithPropertyKey */
+/* [uuid][object] */ 
+
+
+EXTERN_C const IID IID_IObjectWithPropertyKey;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("fc0ca0a7-c316-4fd2-9031-3e628e6d4f23")
+    IObjectWithPropertyKey : public IUnknown
+    {
+    public:
+        virtual HRESULT STDMETHODCALLTYPE SetPropertyKey( 
+            /* [in] */ __RPC__in REFPROPERTYKEY key) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE GetPropertyKey( 
+            /* [out] */ __RPC__out PROPERTYKEY *pkey) = 0;
+        
+    };
+    
+#else 	/* C style interface */
+
+    typedef struct IObjectWithPropertyKeyVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            IObjectWithPropertyKey * This,
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][out] */ 
+            __RPC__deref_out  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            IObjectWithPropertyKey * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            IObjectWithPropertyKey * This);
+        
+        HRESULT ( STDMETHODCALLTYPE *SetPropertyKey )( 
+            IObjectWithPropertyKey * This,
+            /* [in] */ __RPC__in REFPROPERTYKEY key);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetPropertyKey )( 
+            IObjectWithPropertyKey * This,
+            /* [out] */ __RPC__out PROPERTYKEY *pkey);
+        
+        END_INTERFACE
+    } IObjectWithPropertyKeyVtbl;
+
+    interface IObjectWithPropertyKey
+    {
+        CONST_VTBL struct IObjectWithPropertyKeyVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define IObjectWithPropertyKey_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define IObjectWithPropertyKey_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define IObjectWithPropertyKey_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define IObjectWithPropertyKey_SetPropertyKey(This,key)	\
+    ( (This)->lpVtbl -> SetPropertyKey(This,key) ) 
+
+#define IObjectWithPropertyKey_GetPropertyKey(This,pkey)	\
+    ( (This)->lpVtbl -> GetPropertyKey(This,pkey) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __IObjectWithPropertyKey_INTERFACE_DEFINED__ */
+
+
+/* interface __MIDL_itf_propsys_0000_0005 */
+/* [local] */ 
+
+typedef /* [v1_enum] */ 
+enum tagPKA_FLAGS
+    {	PKA_SET	= 0,
+	PKA_APPEND	= ( PKA_SET + 1 ) ,
+	PKA_DELETE	= ( PKA_APPEND + 1 ) 
+    } 	PKA_FLAGS;
+
+
+
+extern RPC_IF_HANDLE __MIDL_itf_propsys_0000_0005_v0_0_c_ifspec;
+extern RPC_IF_HANDLE __MIDL_itf_propsys_0000_0005_v0_0_s_ifspec;
+
+#ifndef __IPropertyChange_INTERFACE_DEFINED__
+#define __IPropertyChange_INTERFACE_DEFINED__
+
+/* interface IPropertyChange */
+/* [unique][object][uuid] */ 
+
+
+EXTERN_C const IID IID_IPropertyChange;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("f917bc8a-1bba-4478-a245-1bde03eb9431")
+    IPropertyChange : public IObjectWithPropertyKey
+    {
+    public:
+        virtual HRESULT STDMETHODCALLTYPE ApplyToPropVariant( 
+            /* [in] */ __RPC__in REFPROPVARIANT propvarIn,
+            /* [out] */ __RPC__out PROPVARIANT *ppropvarOut) = 0;
+        
+    };
+    
+#else 	/* C style interface */
+
+    typedef struct IPropertyChangeVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            IPropertyChange * This,
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][out] */ 
+            __RPC__deref_out  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            IPropertyChange * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            IPropertyChange * This);
+        
+        HRESULT ( STDMETHODCALLTYPE *SetPropertyKey )( 
+            IPropertyChange * This,
+            /* [in] */ __RPC__in REFPROPERTYKEY key);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetPropertyKey )( 
+            IPropertyChange * This,
+            /* [out] */ __RPC__out PROPERTYKEY *pkey);
+        
+        HRESULT ( STDMETHODCALLTYPE *ApplyToPropVariant )( 
+            IPropertyChange * This,
+            /* [in] */ __RPC__in REFPROPVARIANT propvarIn,
+            /* [out] */ __RPC__out PROPVARIANT *ppropvarOut);
+        
+        END_INTERFACE
+    } IPropertyChangeVtbl;
+
+    interface IPropertyChange
+    {
+        CONST_VTBL struct IPropertyChangeVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define IPropertyChange_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define IPropertyChange_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define IPropertyChange_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define IPropertyChange_SetPropertyKey(This,key)	\
+    ( (This)->lpVtbl -> SetPropertyKey(This,key) ) 
+
+#define IPropertyChange_GetPropertyKey(This,pkey)	\
+    ( (This)->lpVtbl -> GetPropertyKey(This,pkey) ) 
+
+
+#define IPropertyChange_ApplyToPropVariant(This,propvarIn,ppropvarOut)	\
+    ( (This)->lpVtbl -> ApplyToPropVariant(This,propvarIn,ppropvarOut) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __IPropertyChange_INTERFACE_DEFINED__ */
+
+
+#ifndef __IPropertyChangeArray_INTERFACE_DEFINED__
+#define __IPropertyChangeArray_INTERFACE_DEFINED__
+
+/* interface IPropertyChangeArray */
+/* [unique][object][uuid] */ 
+
+
+EXTERN_C const IID IID_IPropertyChangeArray;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("380f5cad-1b5e-42f2-805d-637fd392d31e")
+    IPropertyChangeArray : public IUnknown
+    {
+    public:
+        virtual HRESULT STDMETHODCALLTYPE GetCount( 
+            /* [out] */ __RPC__out UINT *pcOperations) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE GetAt( 
+            /* [in] */ UINT iIndex,
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][out] */ __RPC__deref_out_opt void **ppv) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE InsertAt( 
+            /* [in] */ UINT iIndex,
+            /* [in] */ __RPC__in_opt IPropertyChange *ppropChange) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE Append( 
+            /* [in] */ __RPC__in_opt IPropertyChange *ppropChange) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE AppendOrReplace( 
+            /* [in] */ __RPC__in_opt IPropertyChange *ppropChange) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE RemoveAt( 
+            /* [in] */ UINT iIndex) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE IsKeyInArray( 
+            /* [in] */ __RPC__in REFPROPERTYKEY key) = 0;
+        
+    };
+    
+#else 	/* C style interface */
+
+    typedef struct IPropertyChangeArrayVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            IPropertyChangeArray * This,
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][out] */ 
+            __RPC__deref_out  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            IPropertyChangeArray * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            IPropertyChangeArray * This);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetCount )( 
+            IPropertyChangeArray * This,
+            /* [out] */ __RPC__out UINT *pcOperations);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetAt )( 
+            IPropertyChangeArray * This,
+            /* [in] */ UINT iIndex,
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][out] */ __RPC__deref_out_opt void **ppv);
+        
+        HRESULT ( STDMETHODCALLTYPE *InsertAt )( 
+            IPropertyChangeArray * This,
+            /* [in] */ UINT iIndex,
+            /* [in] */ __RPC__in_opt IPropertyChange *ppropChange);
+        
+        HRESULT ( STDMETHODCALLTYPE *Append )( 
+            IPropertyChangeArray * This,
+            /* [in] */ __RPC__in_opt IPropertyChange *ppropChange);
+        
+        HRESULT ( STDMETHODCALLTYPE *AppendOrReplace )( 
+            IPropertyChangeArray * This,
+            /* [in] */ __RPC__in_opt IPropertyChange *ppropChange);
+        
+        HRESULT ( STDMETHODCALLTYPE *RemoveAt )( 
+            IPropertyChangeArray * This,
+            /* [in] */ UINT iIndex);
+        
+        HRESULT ( STDMETHODCALLTYPE *IsKeyInArray )( 
+            IPropertyChangeArray * This,
+            /* [in] */ __RPC__in REFPROPERTYKEY key);
+        
+        END_INTERFACE
+    } IPropertyChangeArrayVtbl;
+
+    interface IPropertyChangeArray
+    {
+        CONST_VTBL struct IPropertyChangeArrayVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define IPropertyChangeArray_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define IPropertyChangeArray_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define IPropertyChangeArray_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define IPropertyChangeArray_GetCount(This,pcOperations)	\
+    ( (This)->lpVtbl -> GetCount(This,pcOperations) ) 
+
+#define IPropertyChangeArray_GetAt(This,iIndex,riid,ppv)	\
+    ( (This)->lpVtbl -> GetAt(This,iIndex,riid,ppv) ) 
+
+#define IPropertyChangeArray_InsertAt(This,iIndex,ppropChange)	\
+    ( (This)->lpVtbl -> InsertAt(This,iIndex,ppropChange) ) 
+
+#define IPropertyChangeArray_Append(This,ppropChange)	\
+    ( (This)->lpVtbl -> Append(This,ppropChange) ) 
+
+#define IPropertyChangeArray_AppendOrReplace(This,ppropChange)	\
+    ( (This)->lpVtbl -> AppendOrReplace(This,ppropChange) ) 
+
+#define IPropertyChangeArray_RemoveAt(This,iIndex)	\
+    ( (This)->lpVtbl -> RemoveAt(This,iIndex) ) 
+
+#define IPropertyChangeArray_IsKeyInArray(This,key)	\
+    ( (This)->lpVtbl -> IsKeyInArray(This,key) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __IPropertyChangeArray_INTERFACE_DEFINED__ */
+
+
+#ifndef __IPropertyStoreCapabilities_INTERFACE_DEFINED__
+#define __IPropertyStoreCapabilities_INTERFACE_DEFINED__
+
+/* interface IPropertyStoreCapabilities */
+/* [unique][object][uuid] */ 
+
+
+EXTERN_C const IID IID_IPropertyStoreCapabilities;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("c8e2d566-186e-4d49-bf41-6909ead56acc")
+    IPropertyStoreCapabilities : public IUnknown
+    {
+    public:
+        virtual HRESULT STDMETHODCALLTYPE IsPropertyWritable( 
+            /* [in] */ __RPC__in REFPROPERTYKEY key) = 0;
+        
+    };
+    
+#else 	/* C style interface */
+
+    typedef struct IPropertyStoreCapabilitiesVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            IPropertyStoreCapabilities * This,
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][out] */ 
+            __RPC__deref_out  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            IPropertyStoreCapabilities * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            IPropertyStoreCapabilities * This);
+        
+        HRESULT ( STDMETHODCALLTYPE *IsPropertyWritable )( 
+            IPropertyStoreCapabilities * This,
+            /* [in] */ __RPC__in REFPROPERTYKEY key);
+        
+        END_INTERFACE
+    } IPropertyStoreCapabilitiesVtbl;
+
+    interface IPropertyStoreCapabilities
+    {
+        CONST_VTBL struct IPropertyStoreCapabilitiesVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define IPropertyStoreCapabilities_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define IPropertyStoreCapabilities_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define IPropertyStoreCapabilities_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define IPropertyStoreCapabilities_IsPropertyWritable(This,key)	\
+    ( (This)->lpVtbl -> IsPropertyWritable(This,key) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __IPropertyStoreCapabilities_INTERFACE_DEFINED__ */
+
+
+#ifndef __IPropertyStoreCache_INTERFACE_DEFINED__
+#define __IPropertyStoreCache_INTERFACE_DEFINED__
+
+/* interface IPropertyStoreCache */
+/* [unique][object][uuid] */ 
+
+typedef /* [v1_enum] */ 
+enum _PSC_STATE
+    {	PSC_NORMAL	= 0,
+	PSC_NOTINSOURCE	= 1,
+	PSC_DIRTY	= 2,
+	PSC_READONLY	= 3
+    } 	PSC_STATE;
+
+
+EXTERN_C const IID IID_IPropertyStoreCache;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("3017056d-9a91-4e90-937d-746c72abbf4f")
+    IPropertyStoreCache : public IPropertyStore
+    {
+    public:
+        virtual HRESULT STDMETHODCALLTYPE GetState( 
+            /* [in] */ __RPC__in REFPROPERTYKEY key,
+            /* [out] */ __RPC__out PSC_STATE *pstate) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE GetValueAndState( 
+            /* [in] */ __RPC__in REFPROPERTYKEY key,
+            /* [out] */ __RPC__out PROPVARIANT *ppropvar,
+            /* [out] */ __RPC__out PSC_STATE *pstate) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE SetState( 
+            /* [in] */ __RPC__in REFPROPERTYKEY key,
+            /* [in] */ PSC_STATE state) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE SetValueAndState( 
+            /* [in] */ __RPC__in REFPROPERTYKEY key,
+            /* [unique][in] */ __RPC__in_opt const PROPVARIANT *ppropvar,
+            /* [in] */ PSC_STATE state) = 0;
+        
+    };
+    
+#else 	/* C style interface */
+
+    typedef struct IPropertyStoreCacheVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            IPropertyStoreCache * This,
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][out] */ 
+            __RPC__deref_out  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            IPropertyStoreCache * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            IPropertyStoreCache * This);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetCount )( 
+            IPropertyStoreCache * This,
+            /* [out] */ __RPC__out DWORD *cProps);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetAt )( 
+            IPropertyStoreCache * This,
+            /* [in] */ DWORD iProp,
+            /* [out] */ __RPC__out PROPERTYKEY *pkey);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetValue )( 
+            IPropertyStoreCache * This,
+            /* [in] */ __RPC__in REFPROPERTYKEY key,
+            /* [out] */ __RPC__out PROPVARIANT *pv);
+        
+        HRESULT ( STDMETHODCALLTYPE *SetValue )( 
+            IPropertyStoreCache * This,
+            /* [in] */ __RPC__in REFPROPERTYKEY key,
+            /* [in] */ __RPC__in REFPROPVARIANT propvar);
+        
+        HRESULT ( STDMETHODCALLTYPE *Commit )( 
+            IPropertyStoreCache * This);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetState )( 
+            IPropertyStoreCache * This,
+            /* [in] */ __RPC__in REFPROPERTYKEY key,
+            /* [out] */ __RPC__out PSC_STATE *pstate);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetValueAndState )( 
+            IPropertyStoreCache * This,
+            /* [in] */ __RPC__in REFPROPERTYKEY key,
+            /* [out] */ __RPC__out PROPVARIANT *ppropvar,
+            /* [out] */ __RPC__out PSC_STATE *pstate);
+        
+        HRESULT ( STDMETHODCALLTYPE *SetState )( 
+            IPropertyStoreCache * This,
+            /* [in] */ __RPC__in REFPROPERTYKEY key,
+            /* [in] */ PSC_STATE state);
+        
+        HRESULT ( STDMETHODCALLTYPE *SetValueAndState )( 
+            IPropertyStoreCache * This,
+            /* [in] */ __RPC__in REFPROPERTYKEY key,
+            /* [unique][in] */ __RPC__in_opt const PROPVARIANT *ppropvar,
+            /* [in] */ PSC_STATE state);
+        
+        END_INTERFACE
+    } IPropertyStoreCacheVtbl;
+
+    interface IPropertyStoreCache
+    {
+        CONST_VTBL struct IPropertyStoreCacheVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define IPropertyStoreCache_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define IPropertyStoreCache_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define IPropertyStoreCache_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define IPropertyStoreCache_GetCount(This,cProps)	\
+    ( (This)->lpVtbl -> GetCount(This,cProps) ) 
+
+#define IPropertyStoreCache_GetAt(This,iProp,pkey)	\
+    ( (This)->lpVtbl -> GetAt(This,iProp,pkey) ) 
+
+#define IPropertyStoreCache_GetValue(This,key,pv)	\
+    ( (This)->lpVtbl -> GetValue(This,key,pv) ) 
+
+#define IPropertyStoreCache_SetValue(This,key,propvar)	\
+    ( (This)->lpVtbl -> SetValue(This,key,propvar) ) 
+
+#define IPropertyStoreCache_Commit(This)	\
+    ( (This)->lpVtbl -> Commit(This) ) 
+
+
+#define IPropertyStoreCache_GetState(This,key,pstate)	\
+    ( (This)->lpVtbl -> GetState(This,key,pstate) ) 
+
+#define IPropertyStoreCache_GetValueAndState(This,key,ppropvar,pstate)	\
+    ( (This)->lpVtbl -> GetValueAndState(This,key,ppropvar,pstate) ) 
+
+#define IPropertyStoreCache_SetState(This,key,state)	\
+    ( (This)->lpVtbl -> SetState(This,key,state) ) 
+
+#define IPropertyStoreCache_SetValueAndState(This,key,ppropvar,state)	\
+    ( (This)->lpVtbl -> SetValueAndState(This,key,ppropvar,state) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __IPropertyStoreCache_INTERFACE_DEFINED__ */
+
+
+#ifndef __IPropertyEnumType_INTERFACE_DEFINED__
+#define __IPropertyEnumType_INTERFACE_DEFINED__
+
+/* interface IPropertyEnumType */
+/* [unique][object][uuid] */ 
+
+/* [v1_enum] */ 
+enum tagPROPENUMTYPE
+    {	PET_DISCRETEVALUE	= 0,
+	PET_RANGEDVALUE	= 1,
+	PET_DEFAULTVALUE	= 2,
+	PET_ENDRANGE	= 3
+    } ;
+typedef enum tagPROPENUMTYPE PROPENUMTYPE;
+
+
+EXTERN_C const IID IID_IPropertyEnumType;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("11e1fbf9-2d56-4a6b-8db3-7cd193a471f2")
+    IPropertyEnumType : public IUnknown
+    {
+    public:
+        virtual HRESULT STDMETHODCALLTYPE GetEnumType( 
+            /* [out] */ __RPC__out PROPENUMTYPE *penumtype) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE GetValue( 
+            /* [out] */ __RPC__out PROPVARIANT *ppropvar) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE GetRangeMinValue( 
+            /* [out] */ __RPC__out PROPVARIANT *ppropvarMin) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE GetRangeSetValue( 
+            /* [out] */ __RPC__out PROPVARIANT *ppropvarSet) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE GetDisplayText( 
+            /* [out] */ __RPC__deref_out_opt LPWSTR *ppszDisplay) = 0;
+        
+    };
+    
+#else 	/* C style interface */
+
+    typedef struct IPropertyEnumTypeVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            IPropertyEnumType * This,
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][out] */ 
+            __RPC__deref_out  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            IPropertyEnumType * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            IPropertyEnumType * This);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetEnumType )( 
+            IPropertyEnumType * This,
+            /* [out] */ __RPC__out PROPENUMTYPE *penumtype);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetValue )( 
+            IPropertyEnumType * This,
+            /* [out] */ __RPC__out PROPVARIANT *ppropvar);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetRangeMinValue )( 
+            IPropertyEnumType * This,
+            /* [out] */ __RPC__out PROPVARIANT *ppropvarMin);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetRangeSetValue )( 
+            IPropertyEnumType * This,
+            /* [out] */ __RPC__out PROPVARIANT *ppropvarSet);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetDisplayText )( 
+            IPropertyEnumType * This,
+            /* [out] */ __RPC__deref_out_opt LPWSTR *ppszDisplay);
+        
+        END_INTERFACE
+    } IPropertyEnumTypeVtbl;
+
+    interface IPropertyEnumType
+    {
+        CONST_VTBL struct IPropertyEnumTypeVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define IPropertyEnumType_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define IPropertyEnumType_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define IPropertyEnumType_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define IPropertyEnumType_GetEnumType(This,penumtype)	\
+    ( (This)->lpVtbl -> GetEnumType(This,penumtype) ) 
+
+#define IPropertyEnumType_GetValue(This,ppropvar)	\
+    ( (This)->lpVtbl -> GetValue(This,ppropvar) ) 
+
+#define IPropertyEnumType_GetRangeMinValue(This,ppropvarMin)	\
+    ( (This)->lpVtbl -> GetRangeMinValue(This,ppropvarMin) ) 
+
+#define IPropertyEnumType_GetRangeSetValue(This,ppropvarSet)	\
+    ( (This)->lpVtbl -> GetRangeSetValue(This,ppropvarSet) ) 
+
+#define IPropertyEnumType_GetDisplayText(This,ppszDisplay)	\
+    ( (This)->lpVtbl -> GetDisplayText(This,ppszDisplay) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __IPropertyEnumType_INTERFACE_DEFINED__ */
+
+
+#ifndef __IPropertyEnumTypeList_INTERFACE_DEFINED__
+#define __IPropertyEnumTypeList_INTERFACE_DEFINED__
+
+/* interface IPropertyEnumTypeList */
+/* [unique][object][uuid] */ 
+
+
+EXTERN_C const IID IID_IPropertyEnumTypeList;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("a99400f4-3d84-4557-94ba-1242fb2cc9a6")
+    IPropertyEnumTypeList : public IUnknown
+    {
+    public:
+        virtual HRESULT STDMETHODCALLTYPE GetCount( 
+            /* [out] */ __RPC__out UINT *pctypes) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE GetAt( 
+            /* [in] */ UINT itype,
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][out] */ __RPC__deref_out_opt void **ppv) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE GetConditionAt( 
+            /* [in] */ UINT nIndex,
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][out] */ __RPC__deref_out_opt void **ppv) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE FindMatchingIndex( 
+            /* [in] */ __RPC__in REFPROPVARIANT propvarCmp,
+            /* [out] */ __RPC__out UINT *pnIndex) = 0;
+        
+    };
+    
+#else 	/* C style interface */
+
+    typedef struct IPropertyEnumTypeListVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            IPropertyEnumTypeList * This,
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][out] */ 
+            __RPC__deref_out  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            IPropertyEnumTypeList * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            IPropertyEnumTypeList * This);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetCount )( 
+            IPropertyEnumTypeList * This,
+            /* [out] */ __RPC__out UINT *pctypes);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetAt )( 
+            IPropertyEnumTypeList * This,
+            /* [in] */ UINT itype,
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][out] */ __RPC__deref_out_opt void **ppv);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetConditionAt )( 
+            IPropertyEnumTypeList * This,
+            /* [in] */ UINT nIndex,
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][out] */ __RPC__deref_out_opt void **ppv);
+        
+        HRESULT ( STDMETHODCALLTYPE *FindMatchingIndex )( 
+            IPropertyEnumTypeList * This,
+            /* [in] */ __RPC__in REFPROPVARIANT propvarCmp,
+            /* [out] */ __RPC__out UINT *pnIndex);
+        
+        END_INTERFACE
+    } IPropertyEnumTypeListVtbl;
+
+    interface IPropertyEnumTypeList
+    {
+        CONST_VTBL struct IPropertyEnumTypeListVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define IPropertyEnumTypeList_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define IPropertyEnumTypeList_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define IPropertyEnumTypeList_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define IPropertyEnumTypeList_GetCount(This,pctypes)	\
+    ( (This)->lpVtbl -> GetCount(This,pctypes) ) 
+
+#define IPropertyEnumTypeList_GetAt(This,itype,riid,ppv)	\
+    ( (This)->lpVtbl -> GetAt(This,itype,riid,ppv) ) 
+
+#define IPropertyEnumTypeList_GetConditionAt(This,nIndex,riid,ppv)	\
+    ( (This)->lpVtbl -> GetConditionAt(This,nIndex,riid,ppv) ) 
+
+#define IPropertyEnumTypeList_FindMatchingIndex(This,propvarCmp,pnIndex)	\
+    ( (This)->lpVtbl -> FindMatchingIndex(This,propvarCmp,pnIndex) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __IPropertyEnumTypeList_INTERFACE_DEFINED__ */
+
+
+#ifndef __IPropertyDescription_INTERFACE_DEFINED__
+#define __IPropertyDescription_INTERFACE_DEFINED__
+
+/* interface IPropertyDescription */
+/* [unique][object][uuid] */ 
+
+/* [v1_enum] */ 
+enum tagPROPDESC_TYPE_FLAGS
+    {	PDTF_DEFAULT	= 0,
+	PDTF_MULTIPLEVALUES	= 0x1,
+	PDTF_ISINNATE	= 0x2,
+	PDTF_ISGROUP	= 0x4,
+	PDTF_CANGROUPBY	= 0x8,
+	PDTF_CANSTACKBY	= 0x10,
+	PDTF_ISTREEPROPERTY	= 0x20,
+	PDTF_INCLUDEINFULLTEXTQUERY	= 0x40,
+	PDTF_ISVIEWABLE	= 0x80,
+	PDTF_ISQUERYABLE	= 0x100,
+	PDTF_ISSYSTEMPROPERTY	= 0x80000000,
+	PDTF_MASK_ALL	= 0x800001ff
+    } ;
+typedef int PROPDESC_TYPE_FLAGS;
+
+/* [v1_enum] */ 
+enum tagPROPDESC_VIEW_FLAGS
+    {	PDVF_DEFAULT	= 0,
+	PDVF_CENTERALIGN	= 0x1,
+	PDVF_RIGHTALIGN	= 0x2,
+	PDVF_BEGINNEWGROUP	= 0x4,
+	PDVF_FILLAREA	= 0x8,
+	PDVF_SORTDESCENDING	= 0x10,
+	PDVF_SHOWONLYIFPRESENT	= 0x20,
+	PDVF_SHOWBYDEFAULT	= 0x40,
+	PDVF_SHOWINPRIMARYLIST	= 0x80,
+	PDVF_SHOWINSECONDARYLIST	= 0x100,
+	PDVF_HIDELABEL	= 0x200,
+	PDVF_HIDDEN	= 0x800,
+	PDVF_CANWRAP	= 0x1000,
+	PDVF_MASK_ALL	= 0x1bff
+    } ;
+typedef int PROPDESC_VIEW_FLAGS;
+
+/* [v1_enum] */ 
+enum tagPROPDESC_DISPLAYTYPE
+    {	PDDT_STRING	= 0,
+	PDDT_NUMBER	= 1,
+	PDDT_BOOLEAN	= 2,
+	PDDT_DATETIME	= 3,
+	PDDT_ENUMERATED	= 4
+    } ;
+typedef enum tagPROPDESC_DISPLAYTYPE PROPDESC_DISPLAYTYPE;
+
+/* [v1_enum] */ 
+enum tagPROPDESC_GROUPING_RANGE
+    {	PDGR_DISCRETE	= 0,
+	PDGR_ALPHANUMERIC	= 1,
+	PDGR_SIZE	= 2,
+	PDGR_DYNAMIC	= 3,
+	PDGR_DATE	= 4,
+	PDGR_PERCENT	= 5,
+	PDGR_ENUMERATED	= 6
+    } ;
+typedef enum tagPROPDESC_GROUPING_RANGE PROPDESC_GROUPING_RANGE;
+
+/* [v1_enum] */ 
+enum tagPROPDESC_FORMAT_FLAGS
+    {	PDFF_DEFAULT	= 0,
+	PDFF_PREFIXNAME	= 0x1,
+	PDFF_FILENAME	= 0x2,
+	PDFF_ALWAYSKB	= 0x4,
+	PDFF_RESERVED_RIGHTTOLEFT	= 0x8,
+	PDFF_SHORTTIME	= 0x10,
+	PDFF_LONGTIME	= 0x20,
+	PDFF_HIDETIME	= 0x40,
+	PDFF_SHORTDATE	= 0x80,
+	PDFF_LONGDATE	= 0x100,
+	PDFF_HIDEDATE	= 0x200,
+	PDFF_RELATIVEDATE	= 0x400,
+	PDFF_USEEDITINVITATION	= 0x800,
+	PDFF_READONLY	= 0x1000,
+	PDFF_NOAUTOREADINGORDER	= 0x2000
+    } ;
+typedef int PROPDESC_FORMAT_FLAGS;
+
+/* [v1_enum] */ 
+enum tagPROPDESC_SORTDESCRIPTION
+    {	PDSD_GENERAL	= 0,
+	PDSD_A_Z	= 1,
+	PDSD_LOWEST_HIGHEST	= 2,
+	PDSD_SMALLEST_BIGGEST	= 3,
+	PDSD_OLDEST_NEWEST	= 4
+    } ;
+typedef enum tagPROPDESC_SORTDESCRIPTION PROPDESC_SORTDESCRIPTION;
+
+/* [v1_enum] */ 
+enum tagPROPDESC_RELATIVEDESCRIPTION_TYPE
+    {	PDRDT_GENERAL	= 0,
+	PDRDT_DATE	= 1,
+	PDRDT_SIZE	= 2,
+	PDRDT_COUNT	= 3,
+	PDRDT_REVISION	= 4,
+	PDRDT_LENGTH	= 5,
+	PDRDT_DURATION	= 6,
+	PDRDT_SPEED	= 7,
+	PDRDT_RATE	= 8,
+	PDRDT_RATING	= 9,
+	PDRDT_PRIORITY	= 10
+    } ;
+typedef enum tagPROPDESC_RELATIVEDESCRIPTION_TYPE PROPDESC_RELATIVEDESCRIPTION_TYPE;
+
+/* [v1_enum] */ 
+enum tagPROPDESC_AGGREGATION_TYPE
+    {	PDAT_DEFAULT	= 0,
+	PDAT_FIRST	= 1,
+	PDAT_SUM	= 2,
+	PDAT_AVERAGE	= 3,
+	PDAT_DATERANGE	= 4,
+	PDAT_UNION	= 5,
+	PDAT_MAX	= 6,
+	PDAT_MIN	= 7
+    } ;
+typedef enum tagPROPDESC_AGGREGATION_TYPE PROPDESC_AGGREGATION_TYPE;
+
+/* [v1_enum] */ 
+enum tagPROPDESC_CONDITION_TYPE
+    {	PDCOT_NONE	= 0,
+	PDCOT_STRING	= 1,
+	PDCOT_SIZE	= 2,
+	PDCOT_DATETIME	= 3,
+	PDCOT_BOOLEAN	= 4,
+	PDCOT_NUMBER	= 5
+    } ;
+typedef enum tagPROPDESC_CONDITION_TYPE PROPDESC_CONDITION_TYPE;
+
+
+EXTERN_C const IID IID_IPropertyDescription;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("6f79d558-3e96-4549-a1d1-7d75d2288814")
+    IPropertyDescription : public IUnknown
+    {
+    public:
+        virtual HRESULT STDMETHODCALLTYPE GetPropertyKey( 
+            /* [out] */ __RPC__out PROPERTYKEY *pkey) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE GetCanonicalName( 
+            /* [string][out] */ __RPC__deref_out_opt_string LPWSTR *ppszName) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE GetPropertyType( 
+            /* [out] */ __RPC__out VARTYPE *pvartype) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE GetDisplayName( 
+            /* [string][out] */ __RPC__deref_out_opt_string LPWSTR *ppszName) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE GetEditInvitation( 
+            /* [string][out] */ __RPC__deref_out_opt_string LPWSTR *ppszInvite) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE GetTypeFlags( 
+            /* [in] */ PROPDESC_TYPE_FLAGS mask,
+            /* [out] */ __RPC__out PROPDESC_TYPE_FLAGS *ppdtFlags) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE GetViewFlags( 
+            /* [out] */ __RPC__out PROPDESC_VIEW_FLAGS *ppdvFlags) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE GetDefaultColumnWidth( 
+            /* [out] */ __RPC__out UINT *pcxChars) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE GetDisplayType( 
+            /* [out] */ __RPC__out PROPDESC_DISPLAYTYPE *pdisplaytype) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE GetColumnState( 
+            /* [out] */ __RPC__out SHCOLSTATEF *pcsFlags) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE GetGroupingRange( 
+            /* [out] */ __RPC__out PROPDESC_GROUPING_RANGE *pgr) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE GetRelativeDescriptionType( 
+            /* [out] */ __RPC__out PROPDESC_RELATIVEDESCRIPTION_TYPE *prdt) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE GetRelativeDescription( 
+            /* [in] */ __RPC__in REFPROPVARIANT propvar1,
+            /* [in] */ __RPC__in REFPROPVARIANT propvar2,
+            /* [string][out] */ __RPC__deref_out_opt_string LPWSTR *ppszDesc1,
+            /* [string][out] */ __RPC__deref_out_opt_string LPWSTR *ppszDesc2) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE GetSortDescription( 
+            /* [out] */ __RPC__out PROPDESC_SORTDESCRIPTION *psd) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE GetSortDescriptionLabel( 
+            /* [in] */ BOOL fDescending,
+            /* [string][out] */ __RPC__deref_out_opt_string LPWSTR *ppszDescription) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE GetAggregationType( 
+            /* [out] */ __RPC__out PROPDESC_AGGREGATION_TYPE *paggtype) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE GetConditionType( 
+            /* [out] */ __RPC__out PROPDESC_CONDITION_TYPE *pcontype,
+            /* [out] */ __RPC__out CONDITION_OPERATION *popDefault) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE GetEnumTypeList( 
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][out] */ __RPC__deref_out_opt void **ppv) = 0;
+        
+        virtual /* [local] */ HRESULT STDMETHODCALLTYPE CoerceToCanonicalValue( 
+            /* [out][in] */ PROPVARIANT *ppropvar) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE FormatForDisplay( 
+            /* [in] */ __RPC__in REFPROPVARIANT propvar,
+            /* [in] */ PROPDESC_FORMAT_FLAGS pdfFlags,
+            /* [string][out] */ __RPC__deref_out_opt_string LPWSTR *ppszDisplay) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE IsValueCanonical( 
+            /* [in] */ __RPC__in REFPROPVARIANT propvar) = 0;
+        
+    };
+    
+#else 	/* C style interface */
+
+    typedef struct IPropertyDescriptionVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            IPropertyDescription * This,
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][out] */ 
+            __RPC__deref_out  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            IPropertyDescription * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            IPropertyDescription * This);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetPropertyKey )( 
+            IPropertyDescription * This,
+            /* [out] */ __RPC__out PROPERTYKEY *pkey);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetCanonicalName )( 
+            IPropertyDescription * This,
+            /* [string][out] */ __RPC__deref_out_opt_string LPWSTR *ppszName);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetPropertyType )( 
+            IPropertyDescription * This,
+            /* [out] */ __RPC__out VARTYPE *pvartype);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetDisplayName )( 
+            IPropertyDescription * This,
+            /* [string][out] */ __RPC__deref_out_opt_string LPWSTR *ppszName);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetEditInvitation )( 
+            IPropertyDescription * This,
+            /* [string][out] */ __RPC__deref_out_opt_string LPWSTR *ppszInvite);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetTypeFlags )( 
+            IPropertyDescription * This,
+            /* [in] */ PROPDESC_TYPE_FLAGS mask,
+            /* [out] */ __RPC__out PROPDESC_TYPE_FLAGS *ppdtFlags);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetViewFlags )( 
+            IPropertyDescription * This,
+            /* [out] */ __RPC__out PROPDESC_VIEW_FLAGS *ppdvFlags);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetDefaultColumnWidth )( 
+            IPropertyDescription * This,
+            /* [out] */ __RPC__out UINT *pcxChars);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetDisplayType )( 
+            IPropertyDescription * This,
+            /* [out] */ __RPC__out PROPDESC_DISPLAYTYPE *pdisplaytype);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetColumnState )( 
+            IPropertyDescription * This,
+            /* [out] */ __RPC__out SHCOLSTATEF *pcsFlags);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetGroupingRange )( 
+            IPropertyDescription * This,
+            /* [out] */ __RPC__out PROPDESC_GROUPING_RANGE *pgr);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetRelativeDescriptionType )( 
+            IPropertyDescription * This,
+            /* [out] */ __RPC__out PROPDESC_RELATIVEDESCRIPTION_TYPE *prdt);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetRelativeDescription )( 
+            IPropertyDescription * This,
+            /* [in] */ __RPC__in REFPROPVARIANT propvar1,
+            /* [in] */ __RPC__in REFPROPVARIANT propvar2,
+            /* [string][out] */ __RPC__deref_out_opt_string LPWSTR *ppszDesc1,
+            /* [string][out] */ __RPC__deref_out_opt_string LPWSTR *ppszDesc2);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetSortDescription )( 
+            IPropertyDescription * This,
+            /* [out] */ __RPC__out PROPDESC_SORTDESCRIPTION *psd);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetSortDescriptionLabel )( 
+            IPropertyDescription * This,
+            /* [in] */ BOOL fDescending,
+            /* [string][out] */ __RPC__deref_out_opt_string LPWSTR *ppszDescription);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetAggregationType )( 
+            IPropertyDescription * This,
+            /* [out] */ __RPC__out PROPDESC_AGGREGATION_TYPE *paggtype);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetConditionType )( 
+            IPropertyDescription * This,
+            /* [out] */ __RPC__out PROPDESC_CONDITION_TYPE *pcontype,
+            /* [out] */ __RPC__out CONDITION_OPERATION *popDefault);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetEnumTypeList )( 
+            IPropertyDescription * This,
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][out] */ __RPC__deref_out_opt void **ppv);
+        
+        /* [local] */ HRESULT ( STDMETHODCALLTYPE *CoerceToCanonicalValue )( 
+            IPropertyDescription * This,
+            /* [out][in] */ PROPVARIANT *ppropvar);
+        
+        HRESULT ( STDMETHODCALLTYPE *FormatForDisplay )( 
+            IPropertyDescription * This,
+            /* [in] */ __RPC__in REFPROPVARIANT propvar,
+            /* [in] */ PROPDESC_FORMAT_FLAGS pdfFlags,
+            /* [string][out] */ __RPC__deref_out_opt_string LPWSTR *ppszDisplay);
+        
+        HRESULT ( STDMETHODCALLTYPE *IsValueCanonical )( 
+            IPropertyDescription * This,
+            /* [in] */ __RPC__in REFPROPVARIANT propvar);
+        
+        END_INTERFACE
+    } IPropertyDescriptionVtbl;
+
+    interface IPropertyDescription
+    {
+        CONST_VTBL struct IPropertyDescriptionVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define IPropertyDescription_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define IPropertyDescription_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define IPropertyDescription_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define IPropertyDescription_GetPropertyKey(This,pkey)	\
+    ( (This)->lpVtbl -> GetPropertyKey(This,pkey) ) 
+
+#define IPropertyDescription_GetCanonicalName(This,ppszName)	\
+    ( (This)->lpVtbl -> GetCanonicalName(This,ppszName) ) 
+
+#define IPropertyDescription_GetPropertyType(This,pvartype)	\
+    ( (This)->lpVtbl -> GetPropertyType(This,pvartype) ) 
+
+#define IPropertyDescription_GetDisplayName(This,ppszName)	\
+    ( (This)->lpVtbl -> GetDisplayName(This,ppszName) ) 
+
+#define IPropertyDescription_GetEditInvitation(This,ppszInvite)	\
+    ( (This)->lpVtbl -> GetEditInvitation(This,ppszInvite) ) 
+
+#define IPropertyDescription_GetTypeFlags(This,mask,ppdtFlags)	\
+    ( (This)->lpVtbl -> GetTypeFlags(This,mask,ppdtFlags) ) 
+
+#define IPropertyDescription_GetViewFlags(This,ppdvFlags)	\
+    ( (This)->lpVtbl -> GetViewFlags(This,ppdvFlags) ) 
+
+#define IPropertyDescription_GetDefaultColumnWidth(This,pcxChars)	\
+    ( (This)->lpVtbl -> GetDefaultColumnWidth(This,pcxChars) ) 
+
+#define IPropertyDescription_GetDisplayType(This,pdisplaytype)	\
+    ( (This)->lpVtbl -> GetDisplayType(This,pdisplaytype) ) 
+
+#define IPropertyDescription_GetColumnState(This,pcsFlags)	\
+    ( (This)->lpVtbl -> GetColumnState(This,pcsFlags) ) 
+
+#define IPropertyDescription_GetGroupingRange(This,pgr)	\
+    ( (This)->lpVtbl -> GetGroupingRange(This,pgr) ) 
+
+#define IPropertyDescription_GetRelativeDescriptionType(This,prdt)	\
+    ( (This)->lpVtbl -> GetRelativeDescriptionType(This,prdt) ) 
+
+#define IPropertyDescription_GetRelativeDescription(This,propvar1,propvar2,ppszDesc1,ppszDesc2)	\
+    ( (This)->lpVtbl -> GetRelativeDescription(This,propvar1,propvar2,ppszDesc1,ppszDesc2) ) 
+
+#define IPropertyDescription_GetSortDescription(This,psd)	\
+    ( (This)->lpVtbl -> GetSortDescription(This,psd) ) 
+
+#define IPropertyDescription_GetSortDescriptionLabel(This,fDescending,ppszDescription)	\
+    ( (This)->lpVtbl -> GetSortDescriptionLabel(This,fDescending,ppszDescription) ) 
+
+#define IPropertyDescription_GetAggregationType(This,paggtype)	\
+    ( (This)->lpVtbl -> GetAggregationType(This,paggtype) ) 
+
+#define IPropertyDescription_GetConditionType(This,pcontype,popDefault)	\
+    ( (This)->lpVtbl -> GetConditionType(This,pcontype,popDefault) ) 
+
+#define IPropertyDescription_GetEnumTypeList(This,riid,ppv)	\
+    ( (This)->lpVtbl -> GetEnumTypeList(This,riid,ppv) ) 
+
+#define IPropertyDescription_CoerceToCanonicalValue(This,ppropvar)	\
+    ( (This)->lpVtbl -> CoerceToCanonicalValue(This,ppropvar) ) 
+
+#define IPropertyDescription_FormatForDisplay(This,propvar,pdfFlags,ppszDisplay)	\
+    ( (This)->lpVtbl -> FormatForDisplay(This,propvar,pdfFlags,ppszDisplay) ) 
+
+#define IPropertyDescription_IsValueCanonical(This,propvar)	\
+    ( (This)->lpVtbl -> IsValueCanonical(This,propvar) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+/* [call_as] */ HRESULT STDMETHODCALLTYPE IPropertyDescription_RemoteCoerceToCanonicalValue_Proxy( 
+    IPropertyDescription * This,
+    /* [in] */ __RPC__in REFPROPVARIANT propvar,
+    /* [out] */ __RPC__out PROPVARIANT *ppropvar);
+
+
+void __RPC_STUB IPropertyDescription_RemoteCoerceToCanonicalValue_Stub(
+    IRpcStubBuffer *This,
+    IRpcChannelBuffer *_pRpcChannelBuffer,
+    PRPC_MESSAGE _pRpcMessage,
+    DWORD *_pdwStubPhase);
+
+
+
+#endif 	/* __IPropertyDescription_INTERFACE_DEFINED__ */
+
+
+#ifndef __IPropertyDescriptionAliasInfo_INTERFACE_DEFINED__
+#define __IPropertyDescriptionAliasInfo_INTERFACE_DEFINED__
+
+/* interface IPropertyDescriptionAliasInfo */
+/* [unique][object][uuid] */ 
+
+
+EXTERN_C const IID IID_IPropertyDescriptionAliasInfo;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("f67104fc-2af9-46fd-b32d-243c1404f3d1")
+    IPropertyDescriptionAliasInfo : public IPropertyDescription
+    {
+    public:
+        virtual HRESULT STDMETHODCALLTYPE GetSortByAlias( 
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][out] */ __RPC__deref_out_opt void **ppv) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE GetAdditionalSortByAliases( 
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][out] */ __RPC__deref_out_opt void **ppv) = 0;
+        
+    };
+    
+#else 	/* C style interface */
+
+    typedef struct IPropertyDescriptionAliasInfoVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            IPropertyDescriptionAliasInfo * This,
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][out] */ 
+            __RPC__deref_out  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            IPropertyDescriptionAliasInfo * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            IPropertyDescriptionAliasInfo * This);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetPropertyKey )( 
+            IPropertyDescriptionAliasInfo * This,
+            /* [out] */ __RPC__out PROPERTYKEY *pkey);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetCanonicalName )( 
+            IPropertyDescriptionAliasInfo * This,
+            /* [string][out] */ __RPC__deref_out_opt_string LPWSTR *ppszName);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetPropertyType )( 
+            IPropertyDescriptionAliasInfo * This,
+            /* [out] */ __RPC__out VARTYPE *pvartype);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetDisplayName )( 
+            IPropertyDescriptionAliasInfo * This,
+            /* [string][out] */ __RPC__deref_out_opt_string LPWSTR *ppszName);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetEditInvitation )( 
+            IPropertyDescriptionAliasInfo * This,
+            /* [string][out] */ __RPC__deref_out_opt_string LPWSTR *ppszInvite);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetTypeFlags )( 
+            IPropertyDescriptionAliasInfo * This,
+            /* [in] */ PROPDESC_TYPE_FLAGS mask,
+            /* [out] */ __RPC__out PROPDESC_TYPE_FLAGS *ppdtFlags);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetViewFlags )( 
+            IPropertyDescriptionAliasInfo * This,
+            /* [out] */ __RPC__out PROPDESC_VIEW_FLAGS *ppdvFlags);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetDefaultColumnWidth )( 
+            IPropertyDescriptionAliasInfo * This,
+            /* [out] */ __RPC__out UINT *pcxChars);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetDisplayType )( 
+            IPropertyDescriptionAliasInfo * This,
+            /* [out] */ __RPC__out PROPDESC_DISPLAYTYPE *pdisplaytype);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetColumnState )( 
+            IPropertyDescriptionAliasInfo * This,
+            /* [out] */ __RPC__out SHCOLSTATEF *pcsFlags);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetGroupingRange )( 
+            IPropertyDescriptionAliasInfo * This,
+            /* [out] */ __RPC__out PROPDESC_GROUPING_RANGE *pgr);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetRelativeDescriptionType )( 
+            IPropertyDescriptionAliasInfo * This,
+            /* [out] */ __RPC__out PROPDESC_RELATIVEDESCRIPTION_TYPE *prdt);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetRelativeDescription )( 
+            IPropertyDescriptionAliasInfo * This,
+            /* [in] */ __RPC__in REFPROPVARIANT propvar1,
+            /* [in] */ __RPC__in REFPROPVARIANT propvar2,
+            /* [string][out] */ __RPC__deref_out_opt_string LPWSTR *ppszDesc1,
+            /* [string][out] */ __RPC__deref_out_opt_string LPWSTR *ppszDesc2);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetSortDescription )( 
+            IPropertyDescriptionAliasInfo * This,
+            /* [out] */ __RPC__out PROPDESC_SORTDESCRIPTION *psd);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetSortDescriptionLabel )( 
+            IPropertyDescriptionAliasInfo * This,
+            /* [in] */ BOOL fDescending,
+            /* [string][out] */ __RPC__deref_out_opt_string LPWSTR *ppszDescription);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetAggregationType )( 
+            IPropertyDescriptionAliasInfo * This,
+            /* [out] */ __RPC__out PROPDESC_AGGREGATION_TYPE *paggtype);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetConditionType )( 
+            IPropertyDescriptionAliasInfo * This,
+            /* [out] */ __RPC__out PROPDESC_CONDITION_TYPE *pcontype,
+            /* [out] */ __RPC__out CONDITION_OPERATION *popDefault);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetEnumTypeList )( 
+            IPropertyDescriptionAliasInfo * This,
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][out] */ __RPC__deref_out_opt void **ppv);
+        
+        /* [local] */ HRESULT ( STDMETHODCALLTYPE *CoerceToCanonicalValue )( 
+            IPropertyDescriptionAliasInfo * This,
+            /* [out][in] */ PROPVARIANT *ppropvar);
+        
+        HRESULT ( STDMETHODCALLTYPE *FormatForDisplay )( 
+            IPropertyDescriptionAliasInfo * This,
+            /* [in] */ __RPC__in REFPROPVARIANT propvar,
+            /* [in] */ PROPDESC_FORMAT_FLAGS pdfFlags,
+            /* [string][out] */ __RPC__deref_out_opt_string LPWSTR *ppszDisplay);
+        
+        HRESULT ( STDMETHODCALLTYPE *IsValueCanonical )( 
+            IPropertyDescriptionAliasInfo * This,
+            /* [in] */ __RPC__in REFPROPVARIANT propvar);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetSortByAlias )( 
+            IPropertyDescriptionAliasInfo * This,
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][out] */ __RPC__deref_out_opt void **ppv);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetAdditionalSortByAliases )( 
+            IPropertyDescriptionAliasInfo * This,
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][out] */ __RPC__deref_out_opt void **ppv);
+        
+        END_INTERFACE
+    } IPropertyDescriptionAliasInfoVtbl;
+
+    interface IPropertyDescriptionAliasInfo
+    {
+        CONST_VTBL struct IPropertyDescriptionAliasInfoVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define IPropertyDescriptionAliasInfo_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define IPropertyDescriptionAliasInfo_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define IPropertyDescriptionAliasInfo_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define IPropertyDescriptionAliasInfo_GetPropertyKey(This,pkey)	\
+    ( (This)->lpVtbl -> GetPropertyKey(This,pkey) ) 
+
+#define IPropertyDescriptionAliasInfo_GetCanonicalName(This,ppszName)	\
+    ( (This)->lpVtbl -> GetCanonicalName(This,ppszName) ) 
+
+#define IPropertyDescriptionAliasInfo_GetPropertyType(This,pvartype)	\
+    ( (This)->lpVtbl -> GetPropertyType(This,pvartype) ) 
+
+#define IPropertyDescriptionAliasInfo_GetDisplayName(This,ppszName)	\
+    ( (This)->lpVtbl -> GetDisplayName(This,ppszName) ) 
+
+#define IPropertyDescriptionAliasInfo_GetEditInvitation(This,ppszInvite)	\
+    ( (This)->lpVtbl -> GetEditInvitation(This,ppszInvite) ) 
+
+#define IPropertyDescriptionAliasInfo_GetTypeFlags(This,mask,ppdtFlags)	\
+    ( (This)->lpVtbl -> GetTypeFlags(This,mask,ppdtFlags) ) 
+
+#define IPropertyDescriptionAliasInfo_GetViewFlags(This,ppdvFlags)	\
+    ( (This)->lpVtbl -> GetViewFlags(This,ppdvFlags) ) 
+
+#define IPropertyDescriptionAliasInfo_GetDefaultColumnWidth(This,pcxChars)	\
+    ( (This)->lpVtbl -> GetDefaultColumnWidth(This,pcxChars) ) 
+
+#define IPropertyDescriptionAliasInfo_GetDisplayType(This,pdisplaytype)	\
+    ( (This)->lpVtbl -> GetDisplayType(This,pdisplaytype) ) 
+
+#define IPropertyDescriptionAliasInfo_GetColumnState(This,pcsFlags)	\
+    ( (This)->lpVtbl -> GetColumnState(This,pcsFlags) ) 
+
+#define IPropertyDescriptionAliasInfo_GetGroupingRange(This,pgr)	\
+    ( (This)->lpVtbl -> GetGroupingRange(This,pgr) ) 
+
+#define IPropertyDescriptionAliasInfo_GetRelativeDescriptionType(This,prdt)	\
+    ( (This)->lpVtbl -> GetRelativeDescriptionType(This,prdt) ) 
+
+#define IPropertyDescriptionAliasInfo_GetRelativeDescription(This,propvar1,propvar2,ppszDesc1,ppszDesc2)	\
+    ( (This)->lpVtbl -> GetRelativeDescription(This,propvar1,propvar2,ppszDesc1,ppszDesc2) ) 
+
+#define IPropertyDescriptionAliasInfo_GetSortDescription(This,psd)	\
+    ( (This)->lpVtbl -> GetSortDescription(This,psd) ) 
+
+#define IPropertyDescriptionAliasInfo_GetSortDescriptionLabel(This,fDescending,ppszDescription)	\
+    ( (This)->lpVtbl -> GetSortDescriptionLabel(This,fDescending,ppszDescription) ) 
+
+#define IPropertyDescriptionAliasInfo_GetAggregationType(This,paggtype)	\
+    ( (This)->lpVtbl -> GetAggregationType(This,paggtype) ) 
+
+#define IPropertyDescriptionAliasInfo_GetConditionType(This,pcontype,popDefault)	\
+    ( (This)->lpVtbl -> GetConditionType(This,pcontype,popDefault) ) 
+
+#define IPropertyDescriptionAliasInfo_GetEnumTypeList(This,riid,ppv)	\
+    ( (This)->lpVtbl -> GetEnumTypeList(This,riid,ppv) ) 
+
+#define IPropertyDescriptionAliasInfo_CoerceToCanonicalValue(This,ppropvar)	\
+    ( (This)->lpVtbl -> CoerceToCanonicalValue(This,ppropvar) ) 
+
+#define IPropertyDescriptionAliasInfo_FormatForDisplay(This,propvar,pdfFlags,ppszDisplay)	\
+    ( (This)->lpVtbl -> FormatForDisplay(This,propvar,pdfFlags,ppszDisplay) ) 
+
+#define IPropertyDescriptionAliasInfo_IsValueCanonical(This,propvar)	\
+    ( (This)->lpVtbl -> IsValueCanonical(This,propvar) ) 
+
+
+#define IPropertyDescriptionAliasInfo_GetSortByAlias(This,riid,ppv)	\
+    ( (This)->lpVtbl -> GetSortByAlias(This,riid,ppv) ) 
+
+#define IPropertyDescriptionAliasInfo_GetAdditionalSortByAliases(This,riid,ppv)	\
+    ( (This)->lpVtbl -> GetAdditionalSortByAliases(This,riid,ppv) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __IPropertyDescriptionAliasInfo_INTERFACE_DEFINED__ */
+
+
+#ifndef __IPropertyDescriptionSearchInfo_INTERFACE_DEFINED__
+#define __IPropertyDescriptionSearchInfo_INTERFACE_DEFINED__
+
+/* interface IPropertyDescriptionSearchInfo */
+/* [unique][object][uuid] */ 
+
+/* [v1_enum] */ 
+enum tagPROPDESC_SEARCHINFO_FLAGS
+    {	PDSIF_DEFAULT	= 0,
+	PDSIF_ININVERTEDINDEX	= 0x1,
+	PDSIF_ISCOLUMN	= 0x2,
+	PDSIF_ISCOLUMNSPARSE	= 0x4
+    } ;
+typedef int PROPDESC_SEARCHINFO_FLAGS;
+
+typedef /* [v1_enum] */ 
+enum tagPROPDESC_COLUMNINDEX_TYPE
+    {	PDCIT_NONE	= 0,
+	PDCIT_ONDISK	= 1,
+	PDCIT_INMEMORY	= 2
+    } 	PROPDESC_COLUMNINDEX_TYPE;
+
+
+EXTERN_C const IID IID_IPropertyDescriptionSearchInfo;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("078f91bd-29a2-440f-924e-46a291524520")
+    IPropertyDescriptionSearchInfo : public IPropertyDescription
+    {
+    public:
+        virtual HRESULT STDMETHODCALLTYPE GetSearchInfoFlags( 
+            /* [out] */ __RPC__out PROPDESC_SEARCHINFO_FLAGS *ppdsiFlags) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE GetColumnIndexType( 
+            /* [out] */ __RPC__out PROPDESC_COLUMNINDEX_TYPE *ppdciType) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE GetProjectionString( 
+            /* [out] */ __RPC__deref_out_opt LPWSTR *ppszProjection) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE GetMaxSize( 
+            /* [out] */ __RPC__out UINT *pcbMaxSize) = 0;
+        
+    };
+    
+#else 	/* C style interface */
+
+    typedef struct IPropertyDescriptionSearchInfoVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            IPropertyDescriptionSearchInfo * This,
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][out] */ 
+            __RPC__deref_out  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            IPropertyDescriptionSearchInfo * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            IPropertyDescriptionSearchInfo * This);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetPropertyKey )( 
+            IPropertyDescriptionSearchInfo * This,
+            /* [out] */ __RPC__out PROPERTYKEY *pkey);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetCanonicalName )( 
+            IPropertyDescriptionSearchInfo * This,
+            /* [string][out] */ __RPC__deref_out_opt_string LPWSTR *ppszName);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetPropertyType )( 
+            IPropertyDescriptionSearchInfo * This,
+            /* [out] */ __RPC__out VARTYPE *pvartype);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetDisplayName )( 
+            IPropertyDescriptionSearchInfo * This,
+            /* [string][out] */ __RPC__deref_out_opt_string LPWSTR *ppszName);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetEditInvitation )( 
+            IPropertyDescriptionSearchInfo * This,
+            /* [string][out] */ __RPC__deref_out_opt_string LPWSTR *ppszInvite);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetTypeFlags )( 
+            IPropertyDescriptionSearchInfo * This,
+            /* [in] */ PROPDESC_TYPE_FLAGS mask,
+            /* [out] */ __RPC__out PROPDESC_TYPE_FLAGS *ppdtFlags);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetViewFlags )( 
+            IPropertyDescriptionSearchInfo * This,
+            /* [out] */ __RPC__out PROPDESC_VIEW_FLAGS *ppdvFlags);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetDefaultColumnWidth )( 
+            IPropertyDescriptionSearchInfo * This,
+            /* [out] */ __RPC__out UINT *pcxChars);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetDisplayType )( 
+            IPropertyDescriptionSearchInfo * This,
+            /* [out] */ __RPC__out PROPDESC_DISPLAYTYPE *pdisplaytype);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetColumnState )( 
+            IPropertyDescriptionSearchInfo * This,
+            /* [out] */ __RPC__out SHCOLSTATEF *pcsFlags);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetGroupingRange )( 
+            IPropertyDescriptionSearchInfo * This,
+            /* [out] */ __RPC__out PROPDESC_GROUPING_RANGE *pgr);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetRelativeDescriptionType )( 
+            IPropertyDescriptionSearchInfo * This,
+            /* [out] */ __RPC__out PROPDESC_RELATIVEDESCRIPTION_TYPE *prdt);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetRelativeDescription )( 
+            IPropertyDescriptionSearchInfo * This,
+            /* [in] */ __RPC__in REFPROPVARIANT propvar1,
+            /* [in] */ __RPC__in REFPROPVARIANT propvar2,
+            /* [string][out] */ __RPC__deref_out_opt_string LPWSTR *ppszDesc1,
+            /* [string][out] */ __RPC__deref_out_opt_string LPWSTR *ppszDesc2);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetSortDescription )( 
+            IPropertyDescriptionSearchInfo * This,
+            /* [out] */ __RPC__out PROPDESC_SORTDESCRIPTION *psd);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetSortDescriptionLabel )( 
+            IPropertyDescriptionSearchInfo * This,
+            /* [in] */ BOOL fDescending,
+            /* [string][out] */ __RPC__deref_out_opt_string LPWSTR *ppszDescription);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetAggregationType )( 
+            IPropertyDescriptionSearchInfo * This,
+            /* [out] */ __RPC__out PROPDESC_AGGREGATION_TYPE *paggtype);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetConditionType )( 
+            IPropertyDescriptionSearchInfo * This,
+            /* [out] */ __RPC__out PROPDESC_CONDITION_TYPE *pcontype,
+            /* [out] */ __RPC__out CONDITION_OPERATION *popDefault);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetEnumTypeList )( 
+            IPropertyDescriptionSearchInfo * This,
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][out] */ __RPC__deref_out_opt void **ppv);
+        
+        /* [local] */ HRESULT ( STDMETHODCALLTYPE *CoerceToCanonicalValue )( 
+            IPropertyDescriptionSearchInfo * This,
+            /* [out][in] */ PROPVARIANT *ppropvar);
+        
+        HRESULT ( STDMETHODCALLTYPE *FormatForDisplay )( 
+            IPropertyDescriptionSearchInfo * This,
+            /* [in] */ __RPC__in REFPROPVARIANT propvar,
+            /* [in] */ PROPDESC_FORMAT_FLAGS pdfFlags,
+            /* [string][out] */ __RPC__deref_out_opt_string LPWSTR *ppszDisplay);
+        
+        HRESULT ( STDMETHODCALLTYPE *IsValueCanonical )( 
+            IPropertyDescriptionSearchInfo * This,
+            /* [in] */ __RPC__in REFPROPVARIANT propvar);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetSearchInfoFlags )( 
+            IPropertyDescriptionSearchInfo * This,
+            /* [out] */ __RPC__out PROPDESC_SEARCHINFO_FLAGS *ppdsiFlags);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetColumnIndexType )( 
+            IPropertyDescriptionSearchInfo * This,
+            /* [out] */ __RPC__out PROPDESC_COLUMNINDEX_TYPE *ppdciType);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetProjectionString )( 
+            IPropertyDescriptionSearchInfo * This,
+            /* [out] */ __RPC__deref_out_opt LPWSTR *ppszProjection);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetMaxSize )( 
+            IPropertyDescriptionSearchInfo * This,
+            /* [out] */ __RPC__out UINT *pcbMaxSize);
+        
+        END_INTERFACE
+    } IPropertyDescriptionSearchInfoVtbl;
+
+    interface IPropertyDescriptionSearchInfo
+    {
+        CONST_VTBL struct IPropertyDescriptionSearchInfoVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define IPropertyDescriptionSearchInfo_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define IPropertyDescriptionSearchInfo_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define IPropertyDescriptionSearchInfo_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define IPropertyDescriptionSearchInfo_GetPropertyKey(This,pkey)	\
+    ( (This)->lpVtbl -> GetPropertyKey(This,pkey) ) 
+
+#define IPropertyDescriptionSearchInfo_GetCanonicalName(This,ppszName)	\
+    ( (This)->lpVtbl -> GetCanonicalName(This,ppszName) ) 
+
+#define IPropertyDescriptionSearchInfo_GetPropertyType(This,pvartype)	\
+    ( (This)->lpVtbl -> GetPropertyType(This,pvartype) ) 
+
+#define IPropertyDescriptionSearchInfo_GetDisplayName(This,ppszName)	\
+    ( (This)->lpVtbl -> GetDisplayName(This,ppszName) ) 
+
+#define IPropertyDescriptionSearchInfo_GetEditInvitation(This,ppszInvite)	\
+    ( (This)->lpVtbl -> GetEditInvitation(This,ppszInvite) ) 
+
+#define IPropertyDescriptionSearchInfo_GetTypeFlags(This,mask,ppdtFlags)	\
+    ( (This)->lpVtbl -> GetTypeFlags(This,mask,ppdtFlags) ) 
+
+#define IPropertyDescriptionSearchInfo_GetViewFlags(This,ppdvFlags)	\
+    ( (This)->lpVtbl -> GetViewFlags(This,ppdvFlags) ) 
+
+#define IPropertyDescriptionSearchInfo_GetDefaultColumnWidth(This,pcxChars)	\
+    ( (This)->lpVtbl -> GetDefaultColumnWidth(This,pcxChars) ) 
+
+#define IPropertyDescriptionSearchInfo_GetDisplayType(This,pdisplaytype)	\
+    ( (This)->lpVtbl -> GetDisplayType(This,pdisplaytype) ) 
+
+#define IPropertyDescriptionSearchInfo_GetColumnState(This,pcsFlags)	\
+    ( (This)->lpVtbl -> GetColumnState(This,pcsFlags) ) 
+
+#define IPropertyDescriptionSearchInfo_GetGroupingRange(This,pgr)	\
+    ( (This)->lpVtbl -> GetGroupingRange(This,pgr) ) 
+
+#define IPropertyDescriptionSearchInfo_GetRelativeDescriptionType(This,prdt)	\
+    ( (This)->lpVtbl -> GetRelativeDescriptionType(This,prdt) ) 
+
+#define IPropertyDescriptionSearchInfo_GetRelativeDescription(This,propvar1,propvar2,ppszDesc1,ppszDesc2)	\
+    ( (This)->lpVtbl -> GetRelativeDescription(This,propvar1,propvar2,ppszDesc1,ppszDesc2) ) 
+
+#define IPropertyDescriptionSearchInfo_GetSortDescription(This,psd)	\
+    ( (This)->lpVtbl -> GetSortDescription(This,psd) ) 
+
+#define IPropertyDescriptionSearchInfo_GetSortDescriptionLabel(This,fDescending,ppszDescription)	\
+    ( (This)->lpVtbl -> GetSortDescriptionLabel(This,fDescending,ppszDescription) ) 
+
+#define IPropertyDescriptionSearchInfo_GetAggregationType(This,paggtype)	\
+    ( (This)->lpVtbl -> GetAggregationType(This,paggtype) ) 
+
+#define IPropertyDescriptionSearchInfo_GetConditionType(This,pcontype,popDefault)	\
+    ( (This)->lpVtbl -> GetConditionType(This,pcontype,popDefault) ) 
+
+#define IPropertyDescriptionSearchInfo_GetEnumTypeList(This,riid,ppv)	\
+    ( (This)->lpVtbl -> GetEnumTypeList(This,riid,ppv) ) 
+
+#define IPropertyDescriptionSearchInfo_CoerceToCanonicalValue(This,ppropvar)	\
+    ( (This)->lpVtbl -> CoerceToCanonicalValue(This,ppropvar) ) 
+
+#define IPropertyDescriptionSearchInfo_FormatForDisplay(This,propvar,pdfFlags,ppszDisplay)	\
+    ( (This)->lpVtbl -> FormatForDisplay(This,propvar,pdfFlags,ppszDisplay) ) 
+
+#define IPropertyDescriptionSearchInfo_IsValueCanonical(This,propvar)	\
+    ( (This)->lpVtbl -> IsValueCanonical(This,propvar) ) 
+
+
+#define IPropertyDescriptionSearchInfo_GetSearchInfoFlags(This,ppdsiFlags)	\
+    ( (This)->lpVtbl -> GetSearchInfoFlags(This,ppdsiFlags) ) 
+
+#define IPropertyDescriptionSearchInfo_GetColumnIndexType(This,ppdciType)	\
+    ( (This)->lpVtbl -> GetColumnIndexType(This,ppdciType) ) 
+
+#define IPropertyDescriptionSearchInfo_GetProjectionString(This,ppszProjection)	\
+    ( (This)->lpVtbl -> GetProjectionString(This,ppszProjection) ) 
+
+#define IPropertyDescriptionSearchInfo_GetMaxSize(This,pcbMaxSize)	\
+    ( (This)->lpVtbl -> GetMaxSize(This,pcbMaxSize) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __IPropertyDescriptionSearchInfo_INTERFACE_DEFINED__ */
+
+
+/* interface __MIDL_itf_propsys_0000_0014 */
+/* [local] */ 
+
+/* [v1_enum] */ 
+enum tagPROPDESC_ENUMFILTER
+    {	PDEF_ALL	= 0,
+	PDEF_SYSTEM	= 1,
+	PDEF_NONSYSTEM	= 2,
+	PDEF_VIEWABLE	= 3,
+	PDEF_QUERYABLE	= 4,
+	PDEF_INFULLTEXTQUERY	= 5,
+	PDEF_COLUMN	= 6
+    } ;
+typedef enum tagPROPDESC_ENUMFILTER PROPDESC_ENUMFILTER;
+
+
+
+extern RPC_IF_HANDLE __MIDL_itf_propsys_0000_0014_v0_0_c_ifspec;
+extern RPC_IF_HANDLE __MIDL_itf_propsys_0000_0014_v0_0_s_ifspec;
+
+#ifndef __IPropertySystem_INTERFACE_DEFINED__
+#define __IPropertySystem_INTERFACE_DEFINED__
+
+/* interface IPropertySystem */
+/* [unique][object][uuid] */ 
+
+
+EXTERN_C const IID IID_IPropertySystem;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("ca724e8a-c3e6-442b-88a4-6fb0db8035a3")
+    IPropertySystem : public IUnknown
+    {
+    public:
+        virtual HRESULT STDMETHODCALLTYPE GetPropertyDescription( 
+            /* [in] */ __RPC__in REFPROPERTYKEY propkey,
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][out] */ __RPC__deref_out_opt void **ppv) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE GetPropertyDescriptionByName( 
+            /* [string][in] */ __RPC__in LPCWSTR pszCanonicalName,
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][out] */ __RPC__deref_out_opt void **ppv) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE GetPropertyDescriptionListFromString( 
+            /* [string][in] */ __RPC__in LPCWSTR pszPropList,
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][out] */ __RPC__deref_out_opt void **ppv) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE EnumeratePropertyDescriptions( 
+            /* [in] */ PROPDESC_ENUMFILTER filterOn,
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][out] */ __RPC__deref_out_opt void **ppv) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE FormatForDisplay( 
+            /* [in] */ __RPC__in REFPROPERTYKEY key,
+            /* [in] */ __RPC__in REFPROPVARIANT propvar,
+            /* [in] */ PROPDESC_FORMAT_FLAGS pdff,
+            /* [size_is][string][out] */ __RPC__out_ecount_full_string(cchText) LPWSTR pszText,
+            /* [in] */ DWORD cchText) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE FormatForDisplayAlloc( 
+            /* [in] */ __RPC__in REFPROPERTYKEY key,
+            /* [in] */ __RPC__in REFPROPVARIANT propvar,
+            /* [in] */ PROPDESC_FORMAT_FLAGS pdff,
+            /* [string][out] */ __RPC__deref_out_opt_string LPWSTR *ppszDisplay) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE RegisterPropertySchema( 
+            /* [string][in] */ __RPC__in LPCWSTR pszPath) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE UnregisterPropertySchema( 
+            /* [string][in] */ __RPC__in LPCWSTR pszPath) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE RefreshPropertySchema( void) = 0;
+        
+    };
+    
+#else 	/* C style interface */
+
+    typedef struct IPropertySystemVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            IPropertySystem * This,
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][out] */ 
+            __RPC__deref_out  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            IPropertySystem * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            IPropertySystem * This);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetPropertyDescription )( 
+            IPropertySystem * This,
+            /* [in] */ __RPC__in REFPROPERTYKEY propkey,
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][out] */ __RPC__deref_out_opt void **ppv);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetPropertyDescriptionByName )( 
+            IPropertySystem * This,
+            /* [string][in] */ __RPC__in LPCWSTR pszCanonicalName,
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][out] */ __RPC__deref_out_opt void **ppv);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetPropertyDescriptionListFromString )( 
+            IPropertySystem * This,
+            /* [string][in] */ __RPC__in LPCWSTR pszPropList,
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][out] */ __RPC__deref_out_opt void **ppv);
+        
+        HRESULT ( STDMETHODCALLTYPE *EnumeratePropertyDescriptions )( 
+            IPropertySystem * This,
+            /* [in] */ PROPDESC_ENUMFILTER filterOn,
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][out] */ __RPC__deref_out_opt void **ppv);
+        
+        HRESULT ( STDMETHODCALLTYPE *FormatForDisplay )( 
+            IPropertySystem * This,
+            /* [in] */ __RPC__in REFPROPERTYKEY key,
+            /* [in] */ __RPC__in REFPROPVARIANT propvar,
+            /* [in] */ PROPDESC_FORMAT_FLAGS pdff,
+            /* [size_is][string][out] */ __RPC__out_ecount_full_string(cchText) LPWSTR pszText,
+            /* [in] */ DWORD cchText);
+        
+        HRESULT ( STDMETHODCALLTYPE *FormatForDisplayAlloc )( 
+            IPropertySystem * This,
+            /* [in] */ __RPC__in REFPROPERTYKEY key,
+            /* [in] */ __RPC__in REFPROPVARIANT propvar,
+            /* [in] */ PROPDESC_FORMAT_FLAGS pdff,
+            /* [string][out] */ __RPC__deref_out_opt_string LPWSTR *ppszDisplay);
+        
+        HRESULT ( STDMETHODCALLTYPE *RegisterPropertySchema )( 
+            IPropertySystem * This,
+            /* [string][in] */ __RPC__in LPCWSTR pszPath);
+        
+        HRESULT ( STDMETHODCALLTYPE *UnregisterPropertySchema )( 
+            IPropertySystem * This,
+            /* [string][in] */ __RPC__in LPCWSTR pszPath);
+        
+        HRESULT ( STDMETHODCALLTYPE *RefreshPropertySchema )( 
+            IPropertySystem * This);
+        
+        END_INTERFACE
+    } IPropertySystemVtbl;
+
+    interface IPropertySystem
+    {
+        CONST_VTBL struct IPropertySystemVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define IPropertySystem_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define IPropertySystem_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define IPropertySystem_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define IPropertySystem_GetPropertyDescription(This,propkey,riid,ppv)	\
+    ( (This)->lpVtbl -> GetPropertyDescription(This,propkey,riid,ppv) ) 
+
+#define IPropertySystem_GetPropertyDescriptionByName(This,pszCanonicalName,riid,ppv)	\
+    ( (This)->lpVtbl -> GetPropertyDescriptionByName(This,pszCanonicalName,riid,ppv) ) 
+
+#define IPropertySystem_GetPropertyDescriptionListFromString(This,pszPropList,riid,ppv)	\
+    ( (This)->lpVtbl -> GetPropertyDescriptionListFromString(This,pszPropList,riid,ppv) ) 
+
+#define IPropertySystem_EnumeratePropertyDescriptions(This,filterOn,riid,ppv)	\
+    ( (This)->lpVtbl -> EnumeratePropertyDescriptions(This,filterOn,riid,ppv) ) 
+
+#define IPropertySystem_FormatForDisplay(This,key,propvar,pdff,pszText,cchText)	\
+    ( (This)->lpVtbl -> FormatForDisplay(This,key,propvar,pdff,pszText,cchText) ) 
+
+#define IPropertySystem_FormatForDisplayAlloc(This,key,propvar,pdff,ppszDisplay)	\
+    ( (This)->lpVtbl -> FormatForDisplayAlloc(This,key,propvar,pdff,ppszDisplay) ) 
+
+#define IPropertySystem_RegisterPropertySchema(This,pszPath)	\
+    ( (This)->lpVtbl -> RegisterPropertySchema(This,pszPath) ) 
+
+#define IPropertySystem_UnregisterPropertySchema(This,pszPath)	\
+    ( (This)->lpVtbl -> UnregisterPropertySchema(This,pszPath) ) 
+
+#define IPropertySystem_RefreshPropertySchema(This)	\
+    ( (This)->lpVtbl -> RefreshPropertySchema(This) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __IPropertySystem_INTERFACE_DEFINED__ */
+
+
+#ifndef __IPropertyDescriptionList_INTERFACE_DEFINED__
+#define __IPropertyDescriptionList_INTERFACE_DEFINED__
+
+/* interface IPropertyDescriptionList */
+/* [unique][object][uuid] */ 
+
+
+EXTERN_C const IID IID_IPropertyDescriptionList;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("1f9fc1d0-c39b-4b26-817f-011967d3440e")
+    IPropertyDescriptionList : public IUnknown
+    {
+    public:
+        virtual HRESULT STDMETHODCALLTYPE GetCount( 
+            /* [out] */ __RPC__out UINT *pcElem) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE GetAt( 
+            /* [in] */ UINT iElem,
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][out] */ __RPC__deref_out_opt void **ppv) = 0;
+        
+    };
+    
+#else 	/* C style interface */
+
+    typedef struct IPropertyDescriptionListVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            IPropertyDescriptionList * This,
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][out] */ 
+            __RPC__deref_out  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            IPropertyDescriptionList * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            IPropertyDescriptionList * This);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetCount )( 
+            IPropertyDescriptionList * This,
+            /* [out] */ __RPC__out UINT *pcElem);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetAt )( 
+            IPropertyDescriptionList * This,
+            /* [in] */ UINT iElem,
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][out] */ __RPC__deref_out_opt void **ppv);
+        
+        END_INTERFACE
+    } IPropertyDescriptionListVtbl;
+
+    interface IPropertyDescriptionList
+    {
+        CONST_VTBL struct IPropertyDescriptionListVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define IPropertyDescriptionList_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define IPropertyDescriptionList_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define IPropertyDescriptionList_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define IPropertyDescriptionList_GetCount(This,pcElem)	\
+    ( (This)->lpVtbl -> GetCount(This,pcElem) ) 
+
+#define IPropertyDescriptionList_GetAt(This,iElem,riid,ppv)	\
+    ( (This)->lpVtbl -> GetAt(This,iElem,riid,ppv) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __IPropertyDescriptionList_INTERFACE_DEFINED__ */
+
+
+#ifndef __IPropertyStoreFactory_INTERFACE_DEFINED__
+#define __IPropertyStoreFactory_INTERFACE_DEFINED__
+
+/* interface IPropertyStoreFactory */
+/* [unique][object][uuid] */ 
+
+
+EXTERN_C const IID IID_IPropertyStoreFactory;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("bc110b6d-57e8-4148-a9c6-91015ab2f3a5")
+    IPropertyStoreFactory : public IUnknown
+    {
+    public:
+        virtual HRESULT STDMETHODCALLTYPE GetPropertyStore( 
+            /* [in] */ GETPROPERTYSTOREFLAGS flags,
+            /* [unique][in] */ __RPC__in_opt IUnknown *pUnkFactory,
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][out] */ __RPC__deref_out_opt void **ppv) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE GetPropertyStoreForKeys( 
+            /* [unique][in] */ __RPC__in_opt const PROPERTYKEY *rgKeys,
+            /* [in] */ UINT cKeys,
+            /* [in] */ GETPROPERTYSTOREFLAGS flags,
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][out] */ __RPC__deref_out_opt void **ppv) = 0;
+        
+    };
+    
+#else 	/* C style interface */
+
+    typedef struct IPropertyStoreFactoryVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            IPropertyStoreFactory * This,
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][out] */ 
+            __RPC__deref_out  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            IPropertyStoreFactory * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            IPropertyStoreFactory * This);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetPropertyStore )( 
+            IPropertyStoreFactory * This,
+            /* [in] */ GETPROPERTYSTOREFLAGS flags,
+            /* [unique][in] */ __RPC__in_opt IUnknown *pUnkFactory,
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][out] */ __RPC__deref_out_opt void **ppv);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetPropertyStoreForKeys )( 
+            IPropertyStoreFactory * This,
+            /* [unique][in] */ __RPC__in_opt const PROPERTYKEY *rgKeys,
+            /* [in] */ UINT cKeys,
+            /* [in] */ GETPROPERTYSTOREFLAGS flags,
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][out] */ __RPC__deref_out_opt void **ppv);
+        
+        END_INTERFACE
+    } IPropertyStoreFactoryVtbl;
+
+    interface IPropertyStoreFactory
+    {
+        CONST_VTBL struct IPropertyStoreFactoryVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define IPropertyStoreFactory_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define IPropertyStoreFactory_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define IPropertyStoreFactory_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define IPropertyStoreFactory_GetPropertyStore(This,flags,pUnkFactory,riid,ppv)	\
+    ( (This)->lpVtbl -> GetPropertyStore(This,flags,pUnkFactory,riid,ppv) ) 
+
+#define IPropertyStoreFactory_GetPropertyStoreForKeys(This,rgKeys,cKeys,flags,riid,ppv)	\
+    ( (This)->lpVtbl -> GetPropertyStoreForKeys(This,rgKeys,cKeys,flags,riid,ppv) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __IPropertyStoreFactory_INTERFACE_DEFINED__ */
+
+
+#ifndef __IDelayedPropertyStoreFactory_INTERFACE_DEFINED__
+#define __IDelayedPropertyStoreFactory_INTERFACE_DEFINED__
+
+/* interface IDelayedPropertyStoreFactory */
+/* [unique][object][uuid] */ 
+
+
+EXTERN_C const IID IID_IDelayedPropertyStoreFactory;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("40d4577f-e237-4bdb-bd69-58f089431b6a")
+    IDelayedPropertyStoreFactory : public IPropertyStoreFactory
+    {
+    public:
+        virtual HRESULT STDMETHODCALLTYPE GetDelayedPropertyStore( 
+            /* [in] */ GETPROPERTYSTOREFLAGS flags,
+            /* [in] */ DWORD dwStoreId,
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][out] */ __RPC__deref_out_opt void **ppv) = 0;
+        
+    };
+    
+#else 	/* C style interface */
+
+    typedef struct IDelayedPropertyStoreFactoryVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            IDelayedPropertyStoreFactory * This,
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][out] */ 
+            __RPC__deref_out  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            IDelayedPropertyStoreFactory * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            IDelayedPropertyStoreFactory * This);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetPropertyStore )( 
+            IDelayedPropertyStoreFactory * This,
+            /* [in] */ GETPROPERTYSTOREFLAGS flags,
+            /* [unique][in] */ __RPC__in_opt IUnknown *pUnkFactory,
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][out] */ __RPC__deref_out_opt void **ppv);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetPropertyStoreForKeys )( 
+            IDelayedPropertyStoreFactory * This,
+            /* [unique][in] */ __RPC__in_opt const PROPERTYKEY *rgKeys,
+            /* [in] */ UINT cKeys,
+            /* [in] */ GETPROPERTYSTOREFLAGS flags,
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][out] */ __RPC__deref_out_opt void **ppv);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetDelayedPropertyStore )( 
+            IDelayedPropertyStoreFactory * This,
+            /* [in] */ GETPROPERTYSTOREFLAGS flags,
+            /* [in] */ DWORD dwStoreId,
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][out] */ __RPC__deref_out_opt void **ppv);
+        
+        END_INTERFACE
+    } IDelayedPropertyStoreFactoryVtbl;
+
+    interface IDelayedPropertyStoreFactory
+    {
+        CONST_VTBL struct IDelayedPropertyStoreFactoryVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define IDelayedPropertyStoreFactory_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define IDelayedPropertyStoreFactory_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define IDelayedPropertyStoreFactory_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define IDelayedPropertyStoreFactory_GetPropertyStore(This,flags,pUnkFactory,riid,ppv)	\
+    ( (This)->lpVtbl -> GetPropertyStore(This,flags,pUnkFactory,riid,ppv) ) 
+
+#define IDelayedPropertyStoreFactory_GetPropertyStoreForKeys(This,rgKeys,cKeys,flags,riid,ppv)	\
+    ( (This)->lpVtbl -> GetPropertyStoreForKeys(This,rgKeys,cKeys,flags,riid,ppv) ) 
+
+
+#define IDelayedPropertyStoreFactory_GetDelayedPropertyStore(This,flags,dwStoreId,riid,ppv)	\
+    ( (This)->lpVtbl -> GetDelayedPropertyStore(This,flags,dwStoreId,riid,ppv) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __IDelayedPropertyStoreFactory_INTERFACE_DEFINED__ */
+
+
+/* interface __MIDL_itf_propsys_0000_0018 */
+/* [local] */ 
+
+/* [v1_enum] */ 
+enum tagPERSIST_SPROPSTORE_FLAGS
+    {	FPSPS_READONLY	= 0x1
+    } ;
+typedef int PERSIST_SPROPSTORE_FLAGS;
+
+typedef struct tagSERIALIZEDPROPSTORAGE SERIALIZEDPROPSTORAGE;
+
+typedef SERIALIZEDPROPSTORAGE __unaligned *PUSERIALIZEDPROPSTORAGE;
+
+typedef const SERIALIZEDPROPSTORAGE __unaligned *PCUSERIALIZEDPROPSTORAGE;
+
+
+
+extern RPC_IF_HANDLE __MIDL_itf_propsys_0000_0018_v0_0_c_ifspec;
+extern RPC_IF_HANDLE __MIDL_itf_propsys_0000_0018_v0_0_s_ifspec;
+
+#ifndef __IPersistSerializedPropStorage_INTERFACE_DEFINED__
+#define __IPersistSerializedPropStorage_INTERFACE_DEFINED__
+
+/* interface IPersistSerializedPropStorage */
+/* [object][local][unique][uuid] */ 
+
+
+EXTERN_C const IID IID_IPersistSerializedPropStorage;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("e318ad57-0aa0-450f-aca5-6fab7103d917")
+    IPersistSerializedPropStorage : public IUnknown
+    {
+    public:
+        virtual HRESULT STDMETHODCALLTYPE SetFlags( 
+            /* [in] */ PERSIST_SPROPSTORE_FLAGS flags) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE SetPropertyStorage( 
+            /* [in] */ 
+            __in_bcount(cb)  PCUSERIALIZEDPROPSTORAGE psps,
+            /* [in] */ 
+            __in  DWORD cb) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE GetPropertyStorage( 
+            /* [out] */ 
+            __deref_out_bcount(*pcb)  SERIALIZEDPROPSTORAGE **ppsps,
+            /* [out] */ 
+            __out  DWORD *pcb) = 0;
+        
+    };
+    
+#else 	/* C style interface */
+
+    typedef struct IPersistSerializedPropStorageVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            IPersistSerializedPropStorage * This,
+            /* [in] */ REFIID riid,
+            /* [iid_is][out] */ 
+            __RPC__deref_out  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            IPersistSerializedPropStorage * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            IPersistSerializedPropStorage * This);
+        
+        HRESULT ( STDMETHODCALLTYPE *SetFlags )( 
+            IPersistSerializedPropStorage * This,
+            /* [in] */ PERSIST_SPROPSTORE_FLAGS flags);
+        
+        HRESULT ( STDMETHODCALLTYPE *SetPropertyStorage )( 
+            IPersistSerializedPropStorage * This,
+            /* [in] */ 
+            __in_bcount(cb)  PCUSERIALIZEDPROPSTORAGE psps,
+            /* [in] */ 
+            __in  DWORD cb);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetPropertyStorage )( 
+            IPersistSerializedPropStorage * This,
+            /* [out] */ 
+            __deref_out_bcount(*pcb)  SERIALIZEDPROPSTORAGE **ppsps,
+            /* [out] */ 
+            __out  DWORD *pcb);
+        
+        END_INTERFACE
+    } IPersistSerializedPropStorageVtbl;
+
+    interface IPersistSerializedPropStorage
+    {
+        CONST_VTBL struct IPersistSerializedPropStorageVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define IPersistSerializedPropStorage_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define IPersistSerializedPropStorage_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define IPersistSerializedPropStorage_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define IPersistSerializedPropStorage_SetFlags(This,flags)	\
+    ( (This)->lpVtbl -> SetFlags(This,flags) ) 
+
+#define IPersistSerializedPropStorage_SetPropertyStorage(This,psps,cb)	\
+    ( (This)->lpVtbl -> SetPropertyStorage(This,psps,cb) ) 
+
+#define IPersistSerializedPropStorage_GetPropertyStorage(This,ppsps,pcb)	\
+    ( (This)->lpVtbl -> GetPropertyStorage(This,ppsps,pcb) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __IPersistSerializedPropStorage_INTERFACE_DEFINED__ */
+
+
+#ifndef __IPropertySystemChangeNotify_INTERFACE_DEFINED__
+#define __IPropertySystemChangeNotify_INTERFACE_DEFINED__
+
+/* interface IPropertySystemChangeNotify */
+/* [unique][object][uuid] */ 
+
+
+EXTERN_C const IID IID_IPropertySystemChangeNotify;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("fa955fd9-38be-4879-a6ce-824cf52d609f")
+    IPropertySystemChangeNotify : public IUnknown
+    {
+    public:
+        virtual HRESULT STDMETHODCALLTYPE SchemaRefreshed( void) = 0;
+        
+    };
+    
+#else 	/* C style interface */
+
+    typedef struct IPropertySystemChangeNotifyVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            IPropertySystemChangeNotify * This,
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][out] */ 
+            __RPC__deref_out  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            IPropertySystemChangeNotify * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            IPropertySystemChangeNotify * This);
+        
+        HRESULT ( STDMETHODCALLTYPE *SchemaRefreshed )( 
+            IPropertySystemChangeNotify * This);
+        
+        END_INTERFACE
+    } IPropertySystemChangeNotifyVtbl;
+
+    interface IPropertySystemChangeNotify
+    {
+        CONST_VTBL struct IPropertySystemChangeNotifyVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define IPropertySystemChangeNotify_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define IPropertySystemChangeNotify_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define IPropertySystemChangeNotify_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define IPropertySystemChangeNotify_SchemaRefreshed(This)	\
+    ( (This)->lpVtbl -> SchemaRefreshed(This) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __IPropertySystemChangeNotify_INTERFACE_DEFINED__ */
+
+
+#ifndef __ICreateObject_INTERFACE_DEFINED__
+#define __ICreateObject_INTERFACE_DEFINED__
+
+/* interface ICreateObject */
+/* [object][unique][uuid] */ 
+
+
+EXTERN_C const IID IID_ICreateObject;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("75121952-e0d0-43e5-9380-1d80483acf72")
+    ICreateObject : public IUnknown
+    {
+    public:
+        virtual HRESULT STDMETHODCALLTYPE CreateObject( 
+            /* [in] */ __RPC__in REFCLSID clsid,
+            /* [unique][in] */ __RPC__in_opt IUnknown *pUnkOuter,
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][out] */ __RPC__deref_out_opt void **ppv) = 0;
+        
+    };
+    
+#else 	/* C style interface */
+
+    typedef struct ICreateObjectVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            ICreateObject * This,
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][out] */ 
+            __RPC__deref_out  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            ICreateObject * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            ICreateObject * This);
+        
+        HRESULT ( STDMETHODCALLTYPE *CreateObject )( 
+            ICreateObject * This,
+            /* [in] */ __RPC__in REFCLSID clsid,
+            /* [unique][in] */ __RPC__in_opt IUnknown *pUnkOuter,
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][out] */ __RPC__deref_out_opt void **ppv);
+        
+        END_INTERFACE
+    } ICreateObjectVtbl;
+
+    interface ICreateObject
+    {
+        CONST_VTBL struct ICreateObjectVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define ICreateObject_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define ICreateObject_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define ICreateObject_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define ICreateObject_CreateObject(This,clsid,pUnkOuter,riid,ppv)	\
+    ( (This)->lpVtbl -> CreateObject(This,clsid,pUnkOuter,riid,ppv) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __ICreateObject_INTERFACE_DEFINED__ */
+
+
+/* interface __MIDL_itf_propsys_0000_0021 */
+/* [local] */ 
+
+// Format a property value for display purposes
+PSSTDAPI PSFormatForDisplay(
+    __in REFPROPERTYKEY propkey,
+    __in REFPROPVARIANT propvar,
+    __in PROPDESC_FORMAT_FLAGS pdfFlags,
+    __out_ecount(cchText) LPWSTR pwszText,
+    __in DWORD cchText);
+
+PSSTDAPI PSFormatForDisplayAlloc(
+    __in REFPROPERTYKEY key,
+    __in REFPROPVARIANT propvar,
+    __in PROPDESC_FORMAT_FLAGS pdff,
+    __deref_out PWSTR *ppszDisplay);
+
+PSSTDAPI PSFormatPropertyValue(
+    __in IPropertyStore *pps,
+    __in IPropertyDescription *ppd,
+    __in PROPDESC_FORMAT_FLAGS pdff,
+    __deref_out LPWSTR *ppszDisplay);
+
+
+#define PKEY_PIDSTR_MAX     10   // will take care of any long integer value
+#define GUIDSTRING_MAX      (1 + 8 + 1 + 4 + 1 + 4 + 1 + 4 + 1 + 12 + 1 + 1)  // "{12345678-1234-1234-1234-123456789012}"
+#define PKEYSTR_MAX         (GUIDSTRING_MAX + 1 + PKEY_PIDSTR_MAX)
+
+// Convert a PROPERTYKEY to and from a PWSTR
+PSSTDAPI PSStringFromPropertyKey(
+    __in REFPROPERTYKEY pkey,
+    __out_ecount(cch) LPWSTR psz,
+    __in UINT cch);
+
+PSSTDAPI PSPropertyKeyFromString(
+    __in LPCWSTR pszString,
+    __out PROPERTYKEY *pkey);
+
+
+// Creates an in-memory property store
+// Returns an IPropertyStore, IPersistSerializedPropStorage, and related interfaces interface
+PSSTDAPI PSCreateMemoryPropertyStore(
+    __in REFIID riid,
+    __deref_out void **ppv);
+
+
+// Create a read-only, delay-bind multiplexing property store
+// Returns an IPropertyStore interface or related interfaces
+PSSTDAPI PSCreateDelayedMultiplexPropertyStore(
+    __in GETPROPERTYSTOREFLAGS flags,
+    __in IDelayedPropertyStoreFactory *pdpsf,
+    __in_ecount(cStores) const DWORD *rgStoreIds,
+    __in DWORD cStores,
+    __in REFIID riid,
+    __deref_out void **ppv);
+
+
+// Create a read-only property store from one or more sources (which each must support either IPropertyStore or IPropertySetStorage)
+// Returns an IPropertyStore interface or related interfaces
+PSSTDAPI PSCreateMultiplexPropertyStore(
+    __in_ecount(cStores) IUnknown **prgpunkStores,
+    __in DWORD cStores,
+    __in REFIID riid,
+    __deref_out void **ppv);
+
+
+// Create a container for IPropertyChanges
+// Returns an IPropertyChangeArray interface
+PSSTDAPI PSCreatePropertyChangeArray(
+    __in_ecount_opt(cChanges) const PROPERTYKEY *rgpropkey,
+    __in_ecount_opt(cChanges) const PKA_FLAGS *rgflags,
+    __in_ecount_opt(cChanges) const PROPVARIANT *rgpropvar,
+    __in UINT cChanges,
+    __in REFIID riid,
+    __deref_out void **ppv);
+
+
+// Create a simple property change
+// Returns an IPropertyChange interface
+PSSTDAPI PSCreateSimplePropertyChange(
+    __in PKA_FLAGS flags,
+    __in REFPROPERTYKEY key,
+    __in REFPROPVARIANT propvar,
+    __in REFIID riid,
+    __deref_out void **ppv);
+
+
+// Get a property description
+// Returns an IPropertyDescription interface
+PSSTDAPI PSGetPropertyDescription(
+    __in REFPROPERTYKEY propkey,
+    __in REFIID riid,
+    __deref_out void **ppv);
+
+PSSTDAPI PSGetPropertyDescriptionByName(
+    __in LPCWSTR pszCanonicalName,
+    __in REFIID riid,
+    __deref_out void **ppv);
+
+
+// Lookup a per-machine registered file property handler
+PSSTDAPI PSLookupPropertyHandlerCLSID(
+    __in PCWSTR pszFilePath,
+    __out CLSID *pclsid);
+// Get a property handler, on Vista or downlevel to XP
+// punkItem is a shell item created with an SHCreateItemXXX API
+// Returns an IPropertyStore
+PSSTDAPI PSGetItemPropertyHandler(
+    __in IUnknown *punkItem,
+    __in BOOL fReadWrite,
+    __in REFIID riid,
+    __deref_out void **ppv);
+
+
+// Get a property handler, on Vista or downlevel to XP
+// punkItem is a shell item created with an SHCreateItemXXX API
+// punkCreateObject supports ICreateObject
+// Returns an IPropertyStore
+PSSTDAPI PSGetItemPropertyHandlerWithCreateObject(
+    __in IUnknown *punkItem,
+    __in BOOL fReadWrite,
+    __in IUnknown *punkCreateObject,
+    __in REFIID riid,
+    __deref_out void **ppv);
+
+
+// Get or set a property value from a store
+PSSTDAPI PSGetPropertyValue(
+    __in IPropertyStore *pps,
+    __in IPropertyDescription *ppd,
+    __out PROPVARIANT *ppropvar);
+
+PSSTDAPI PSSetPropertyValue(
+    __in IPropertyStore *pps,
+    __in IPropertyDescription *ppd,
+    __in REFPROPVARIANT propvar);
+
+
+// Interact with the set of property descriptions
+PSSTDAPI PSRegisterPropertySchema(
+    __in PCWSTR pszPath);
+
+PSSTDAPI PSUnregisterPropertySchema(
+    __in PCWSTR pszPath);
+
+PSSTDAPI PSRefreshPropertySchema();
+
+// Returns either: IPropertyDescriptionList or IEnumUnknown interfaces
+PSSTDAPI PSEnumeratePropertyDescriptions(
+    __in PROPDESC_ENUMFILTER filterOn,
+    __in REFIID riid,
+    __deref_out void **ppv);
+
+
+// Convert between a PROPERTYKEY and its canonical name
+PSSTDAPI PSGetPropertyKeyFromName(
+    __in PCWSTR pszName,
+    __out PROPERTYKEY *ppropkey);
+
+PSSTDAPI PSGetNameFromPropertyKey(
+    __in REFPROPERTYKEY propkey,
+    __deref_out PWSTR *ppszCanonicalName);
+
+
+// Coerce and canonicalize a property value
+PSSTDAPI PSCoerceToCanonicalValue(
+    __in REFPROPERTYKEY key,
+    __inout PROPVARIANT *ppropvar);
+
+
+// Convert a 'prop:' string into a list of property descriptions
+// Returns an IPropertyDescriptionList interface
+PSSTDAPI PSGetPropertyDescriptionListFromString(
+    __in LPCWSTR pszPropList,
+    __in REFIID riid,
+    __deref_out void **ppv);
+
+
+// Wrap an IPropertySetStorage interface in an IPropertyStore interface
+// Returns an IPropertyStore or related interface
+PSSTDAPI PSCreatePropertyStoreFromPropertySetStorage(
+    __in IPropertySetStorage *ppss,
+    DWORD grfMode,
+    REFIID riid,
+    __deref_out void **ppv);
+
+
+// punkSource must support IPropertyStore or IPropertySetStorage
+// On success, the returned ppv is guaranteed to support IPropertyStore.
+// If punkSource already supports IPropertyStore, no wrapper is created.
+PSSTDAPI PSCreatePropertyStoreFromObject(
+    __in IUnknown *punk,
+    __in DWORD grfMode,
+    __in REFIID riid,
+    __deref_out void **ppv);
+
+
+// punkSource must support IPropertyStore
+// riid may be IPropertyStore, IPropertySetStorage, IPropertyStoreCapabilities, or IObjectProvider
+PSSTDAPI PSCreateAdapterFromPropertyStore(
+    __in IPropertyStore *pps,
+    __in REFIID riid,
+    __deref_out void **ppv);
+
+
+// Talk to the property system using an interface
+// Returns an IPropertySystem interface
+PSSTDAPI PSGetPropertySystem(
+    __in REFIID riid,
+    __deref_out void **ppv);
+
+
+// Obtain a value from serialized property storage
+PSSTDAPI PSGetPropertyFromPropertyStorage(
+    __in_bcount(cb) PCUSERIALIZEDPROPSTORAGE psps, 
+    __in DWORD cb, 
+    __in REFPROPERTYKEY rpkey, 
+    __out PROPVARIANT *ppropvar);
+
+
+// Obtain a named value from serialized property storage
+PSSTDAPI PSGetNamedPropertyFromPropertyStorage(
+    __in_bcount(cb) PCUSERIALIZEDPROPSTORAGE psps, 
+    __in DWORD cb, 
+    __in LPCWSTR pszName, 
+    __out PROPVARIANT *ppropvar);
+
+
+
+
+extern RPC_IF_HANDLE __MIDL_itf_propsys_0000_0021_v0_0_c_ifspec;
+extern RPC_IF_HANDLE __MIDL_itf_propsys_0000_0021_v0_0_s_ifspec;
+
+
+#ifndef __PropSysObjects_LIBRARY_DEFINED__
+#define __PropSysObjects_LIBRARY_DEFINED__
+
+/* library PropSysObjects */
+/* [version][lcid][uuid] */ 
+
+
+EXTERN_C const IID LIBID_PropSysObjects;
+
+EXTERN_C const CLSID CLSID_InMemoryPropertyStore;
+
+#ifdef __cplusplus
+
+class DECLSPEC_UUID("9a02e012-6303-4e1e-b9a1-630f802592c5")
+InMemoryPropertyStore;
+#endif
+
+EXTERN_C const CLSID CLSID_PropertySystem;
+
+#ifdef __cplusplus
+
+class DECLSPEC_UUID("b8967f85-58ae-4f46-9fb2-5d7904798f4b")
+PropertySystem;
+#endif
+#endif /* __PropSysObjects_LIBRARY_DEFINED__ */
+
+/* Additional Prototypes for ALL interfaces */
+
+unsigned long             __RPC_USER  BSTR_UserSize(     unsigned long *, unsigned long            , BSTR * ); 
+unsigned char * __RPC_USER  BSTR_UserMarshal(  unsigned long *, unsigned char *, BSTR * ); 
+unsigned char * __RPC_USER  BSTR_UserUnmarshal(unsigned long *, unsigned char *, BSTR * ); 
+void                      __RPC_USER  BSTR_UserFree(     unsigned long *, BSTR * ); 
+
+unsigned long             __RPC_USER  LPSAFEARRAY_UserSize(     unsigned long *, unsigned long            , LPSAFEARRAY * ); 
+unsigned char * __RPC_USER  LPSAFEARRAY_UserMarshal(  unsigned long *, unsigned char *, LPSAFEARRAY * ); 
+unsigned char * __RPC_USER  LPSAFEARRAY_UserUnmarshal(unsigned long *, unsigned char *, LPSAFEARRAY * ); 
+void                      __RPC_USER  LPSAFEARRAY_UserFree(     unsigned long *, LPSAFEARRAY * ); 
+
+unsigned long             __RPC_USER  BSTR_UserSize64(     unsigned long *, unsigned long            , BSTR * ); 
+unsigned char * __RPC_USER  BSTR_UserMarshal64(  unsigned long *, unsigned char *, BSTR * ); 
+unsigned char * __RPC_USER  BSTR_UserUnmarshal64(unsigned long *, unsigned char *, BSTR * ); 
+void                      __RPC_USER  BSTR_UserFree64(     unsigned long *, BSTR * ); 
+
+unsigned long             __RPC_USER  LPSAFEARRAY_UserSize64(     unsigned long *, unsigned long            , LPSAFEARRAY * ); 
+unsigned char * __RPC_USER  LPSAFEARRAY_UserMarshal64(  unsigned long *, unsigned char *, LPSAFEARRAY * ); 
+unsigned char * __RPC_USER  LPSAFEARRAY_UserUnmarshal64(unsigned long *, unsigned char *, LPSAFEARRAY * ); 
+void                      __RPC_USER  LPSAFEARRAY_UserFree64(     unsigned long *, LPSAFEARRAY * ); 
+
+/* [local] */ HRESULT STDMETHODCALLTYPE IInitializeWithStream_Initialize_Proxy( 
+    IInitializeWithStream * This,
+    /* [in] */ IStream *pstream,
+    /* [in] */ DWORD grfMode);
+
+
+/* [call_as] */ HRESULT STDMETHODCALLTYPE IInitializeWithStream_Initialize_Stub( 
+    IInitializeWithStream * This,
+    /* [in] */ __RPC__in_opt IStream *pstream,
+    /* [in] */ DWORD grfMode);
+
+/* [local] */ HRESULT STDMETHODCALLTYPE IPropertyDescription_CoerceToCanonicalValue_Proxy( 
+    IPropertyDescription * This,
+    /* [out][in] */ PROPVARIANT *ppropvar);
+
+
+/* [call_as] */ HRESULT STDMETHODCALLTYPE IPropertyDescription_CoerceToCanonicalValue_Stub( 
+    IPropertyDescription * This,
+    /* [in] */ __RPC__in REFPROPVARIANT propvar,
+    /* [out] */ __RPC__out PROPVARIANT *ppropvar);
+
+
+
+/* end of Additional Prototypes */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+
+
diff --git a/src/hostapi/wasapi/mingw-include/rpcsal.h b/src/hostapi/wasapi/mingw-include/rpcsal.h
index 70adbc6..ba9836a 100644
--- a/src/hostapi/wasapi/mingw-include/rpcsal.h
+++ b/src/hostapi/wasapi/mingw-include/rpcsal.h
@@ -1,113 +1,113 @@
-#pragma once
-
-#if __GNUC__ >=3
-#pragma GCC system_header
-#endif
-
-#define RPC_range(min,max)
-
-#define __RPC__in           
-#define __RPC__in_string
-#define __RPC__in_opt_string
-#define __RPC__deref_opt_in_opt
-#define __RPC__opt_in_opt_string
-#define __RPC__in_ecount(size) 
-#define __RPC__in_ecount_full(size)
-#define __RPC__in_ecount_full_string(size)
-#define __RPC__in_ecount_part(size, length)
-#define __RPC__in_ecount_full_opt(size)
-#define __RPC__in_ecount_full_opt_string(size)
-#define __RPC__inout_ecount_full_opt_string(size)
-#define __RPC__in_ecount_part_opt(size, length)
-
-#define __RPC__deref_in 
-#define __RPC__deref_in_string
-#define __RPC__deref_opt_in
-#define __RPC__deref_in_opt
-#define __RPC__deref_in_ecount(size) 
-#define __RPC__deref_in_ecount_part(size, length) 
-#define __RPC__deref_in_ecount_full(size) 
-#define __RPC__deref_in_ecount_full_opt(size)
-#define __RPC__deref_in_ecount_full_string(size)
-#define __RPC__deref_in_ecount_full_opt_string(size)
-#define __RPC__deref_in_ecount_opt(size) 
-#define __RPC__deref_in_ecount_opt_string(size)
-#define __RPC__deref_in_ecount_part_opt(size, length) 
-
-// [out]
-#define __RPC__out     
-#define __RPC__out_ecount(size) 
-#define __RPC__out_ecount_part(size, length) 
-#define __RPC__out_ecount_full(size)
-#define __RPC__out_ecount_full_string(size)
-
-// [in,out] 
-#define __RPC__inout                                   
-#define __RPC__inout_string
-#define __RPC__opt_inout
-#define __RPC__inout_ecount(size)                     
-#define __RPC__inout_ecount_part(size, length)    
-#define __RPC__inout_ecount_full(size)          
-#define __RPC__inout_ecount_full_string(size)          
-
-// [in,unique] 
-#define __RPC__in_opt       
-#define __RPC__in_ecount_opt(size)   
-
-
-// [in,out,unique] 
-#define __RPC__inout_opt    
-#define __RPC__inout_ecount_opt(size)  
-#define __RPC__inout_ecount_part_opt(size, length) 
-#define __RPC__inout_ecount_full_opt(size)     
-#define __RPC__inout_ecount_full_string(size)
-
-// [out] **
-#define __RPC__deref_out   
-#define __RPC__deref_out_string
-#define __RPC__deref_out_opt 
-#define __RPC__deref_out_opt_string
-#define __RPC__deref_out_ecount(size) 
-#define __RPC__deref_out_ecount_part(size, length) 
-#define __RPC__deref_out_ecount_full(size)  
-#define __RPC__deref_out_ecount_full_string(size)
-
-
-// [in,out] **, second pointer decoration. 
-#define __RPC__deref_inout    
-#define __RPC__deref_inout_string
-#define __RPC__deref_inout_opt 
-#define __RPC__deref_inout_opt_string
-#define __RPC__deref_inout_ecount_full(size)
-#define __RPC__deref_inout_ecount_full_string(size)
-#define __RPC__deref_inout_ecount_opt(size) 
-#define __RPC__deref_inout_ecount_part_opt(size, length) 
-#define __RPC__deref_inout_ecount_full_opt(size) 
-#define __RPC__deref_inout_ecount_full_opt_string(size) 
-
-// #define __RPC_out_opt    out_opt is not allowed in rpc
-
-// [in,out,unique] 
-#define __RPC__deref_opt_inout  
-#define __RPC__deref_opt_inout_string
-#define __RPC__deref_opt_inout_ecount(size)     
-#define __RPC__deref_opt_inout_ecount_part(size, length) 
-#define __RPC__deref_opt_inout_ecount_full(size) 
-#define __RPC__deref_opt_inout_ecount_full_string(size)
-
-#define __RPC__deref_out_ecount_opt(size) 
-#define __RPC__deref_out_ecount_part_opt(size, length) 
-#define __RPC__deref_out_ecount_full_opt(size) 
-#define __RPC__deref_out_ecount_full_opt_string(size)
-
-#define __RPC__deref_opt_inout_opt      
-#define __RPC__deref_opt_inout_opt_string
-#define __RPC__deref_opt_inout_ecount_opt(size)   
-#define __RPC__deref_opt_inout_ecount_part_opt(size, length) 
-#define __RPC__deref_opt_inout_ecount_full_opt(size) 
-#define __RPC__deref_opt_inout_ecount_full_opt_string(size) 
-
-#define __RPC_full_pointer  
-#define __RPC_unique_pointer
-#define __RPC_ref_pointer
-#define __RPC_string                               
+#pragma once
+
+#if __GNUC__ >=3
+#pragma GCC system_header
+#endif
+
+#define RPC_range(min,max)
+
+#define __RPC__in           
+#define __RPC__in_string
+#define __RPC__in_opt_string
+#define __RPC__deref_opt_in_opt
+#define __RPC__opt_in_opt_string
+#define __RPC__in_ecount(size) 
+#define __RPC__in_ecount_full(size)
+#define __RPC__in_ecount_full_string(size)
+#define __RPC__in_ecount_part(size, length)
+#define __RPC__in_ecount_full_opt(size)
+#define __RPC__in_ecount_full_opt_string(size)
+#define __RPC__inout_ecount_full_opt_string(size)
+#define __RPC__in_ecount_part_opt(size, length)
+
+#define __RPC__deref_in 
+#define __RPC__deref_in_string
+#define __RPC__deref_opt_in
+#define __RPC__deref_in_opt
+#define __RPC__deref_in_ecount(size) 
+#define __RPC__deref_in_ecount_part(size, length) 
+#define __RPC__deref_in_ecount_full(size) 
+#define __RPC__deref_in_ecount_full_opt(size)
+#define __RPC__deref_in_ecount_full_string(size)
+#define __RPC__deref_in_ecount_full_opt_string(size)
+#define __RPC__deref_in_ecount_opt(size) 
+#define __RPC__deref_in_ecount_opt_string(size)
+#define __RPC__deref_in_ecount_part_opt(size, length) 
+
+// [out]
+#define __RPC__out     
+#define __RPC__out_ecount(size) 
+#define __RPC__out_ecount_part(size, length) 
+#define __RPC__out_ecount_full(size)
+#define __RPC__out_ecount_full_string(size)
+
+// [in,out] 
+#define __RPC__inout                                   
+#define __RPC__inout_string
+#define __RPC__opt_inout
+#define __RPC__inout_ecount(size)                     
+#define __RPC__inout_ecount_part(size, length)    
+#define __RPC__inout_ecount_full(size)          
+#define __RPC__inout_ecount_full_string(size)          
+
+// [in,unique] 
+#define __RPC__in_opt       
+#define __RPC__in_ecount_opt(size)   
+
+
+// [in,out,unique] 
+#define __RPC__inout_opt    
+#define __RPC__inout_ecount_opt(size)  
+#define __RPC__inout_ecount_part_opt(size, length) 
+#define __RPC__inout_ecount_full_opt(size)     
+#define __RPC__inout_ecount_full_string(size)
+
+// [out] **
+#define __RPC__deref_out   
+#define __RPC__deref_out_string
+#define __RPC__deref_out_opt 
+#define __RPC__deref_out_opt_string
+#define __RPC__deref_out_ecount(size) 
+#define __RPC__deref_out_ecount_part(size, length) 
+#define __RPC__deref_out_ecount_full(size)  
+#define __RPC__deref_out_ecount_full_string(size)
+
+
+// [in,out] **, second pointer decoration. 
+#define __RPC__deref_inout    
+#define __RPC__deref_inout_string
+#define __RPC__deref_inout_opt 
+#define __RPC__deref_inout_opt_string
+#define __RPC__deref_inout_ecount_full(size)
+#define __RPC__deref_inout_ecount_full_string(size)
+#define __RPC__deref_inout_ecount_opt(size) 
+#define __RPC__deref_inout_ecount_part_opt(size, length) 
+#define __RPC__deref_inout_ecount_full_opt(size) 
+#define __RPC__deref_inout_ecount_full_opt_string(size) 
+
+// #define __RPC_out_opt    out_opt is not allowed in rpc
+
+// [in,out,unique] 
+#define __RPC__deref_opt_inout  
+#define __RPC__deref_opt_inout_string
+#define __RPC__deref_opt_inout_ecount(size)     
+#define __RPC__deref_opt_inout_ecount_part(size, length) 
+#define __RPC__deref_opt_inout_ecount_full(size) 
+#define __RPC__deref_opt_inout_ecount_full_string(size)
+
+#define __RPC__deref_out_ecount_opt(size) 
+#define __RPC__deref_out_ecount_part_opt(size, length) 
+#define __RPC__deref_out_ecount_full_opt(size) 
+#define __RPC__deref_out_ecount_full_opt_string(size)
+
+#define __RPC__deref_opt_inout_opt      
+#define __RPC__deref_opt_inout_opt_string
+#define __RPC__deref_opt_inout_ecount_opt(size)   
+#define __RPC__deref_opt_inout_ecount_part_opt(size, length) 
+#define __RPC__deref_opt_inout_ecount_full_opt(size) 
+#define __RPC__deref_opt_inout_ecount_full_opt_string(size) 
+
+#define __RPC_full_pointer  
+#define __RPC_unique_pointer
+#define __RPC_ref_pointer
+#define __RPC_string                               
diff --git a/src/hostapi/wasapi/mingw-include/sal.h b/src/hostapi/wasapi/mingw-include/sal.h
index d7b99fc..3f99ab9 100644
--- a/src/hostapi/wasapi/mingw-include/sal.h
+++ b/src/hostapi/wasapi/mingw-include/sal.h
@@ -1,252 +1,252 @@
-#pragma once
-
-#if __GNUC__ >=3
-#pragma GCC system_header
-#endif
-
-/*#define __null*/ // << Conflicts with GCC internal type __null
-#define __notnull
-#define __maybenull
-#define __readonly
-#define __notreadonly
-#define __maybereadonly
-#define __valid
-#define __notvalid
-#define __maybevalid
-#define __readableTo(extent)
-#define __elem_readableTo(size)
-#define __byte_readableTo(size)
-#define __writableTo(size)
-#define __elem_writableTo(size)
-#define __byte_writableTo(size)
-#define __deref
-#define __pre
-#define __post
-#define __precond(expr)
-#define __postcond(expr)
-#define __exceptthat
-#define __execeptthat
-#define __inner_success(expr)
-#define __inner_checkReturn
-#define __inner_typefix(ctype)
-#define __inner_override
-#define __inner_callback
-#define __inner_blocksOn(resource)
-#define __inner_fallthrough_dec
-#define __inner_fallthrough
-#define __refparam
-#define __inner_control_entrypoint(category)
-#define __inner_data_entrypoint(category)
-
-#define __ecount(size)
-#define __bcount(size)
-#define __in
-#define __in_ecount(size)
-#define __in_bcount(size)
-#define __in_z
-#define __in_ecount_z(size)
-#define __in_bcount_z(size)
-#define __in_nz
-#define __in_ecount_nz(size)
-#define __in_bcount_nz(size)
-#define __out
-#define __out_ecount(size)
-#define __out_bcount(size)
-#define __out_ecount_part(size,length)
-#define __out_bcount_part(size,length)
-#define __out_ecount_full(size)
-#define __out_bcount_full(size)
-#define __out_z
-#define __out_z_opt
-#define __out_ecount_z(size)
-#define __out_bcount_z(size)
-#define __out_ecount_part_z(size,length)
-#define __out_bcount_part_z(size,length)
-#define __out_ecount_full_z(size)
-#define __out_bcount_full_z(size)
-#define __out_nz
-#define __out_nz_opt
-#define __out_ecount_nz(size)
-#define __out_bcount_nz(size)
-#define __inout
-#define __inout_ecount(size)
-#define __inout_bcount(size)
-#define __inout_ecount_part(size,length)
-#define __inout_bcount_part(size,length)
-#define __inout_ecount_full(size)
-#define __inout_bcount_full(size)
-#define __inout_z
-#define __inout_ecount_z(size)
-#define __inout_bcount_z(size)
-#define __inout_nz
-#define __inout_ecount_nz(size)
-#define __inout_bcount_nz(size)
-#define __ecount_opt(size)
-#define __bcount_opt(size)
-#define __in_opt
-#define __in_ecount_opt(size)
-#define __in_bcount_opt(size)
-#define __in_z_opt
-#define __in_ecount_z_opt(size)
-#define __in_bcount_z_opt(size)
-#define __in_nz_opt
-#define __in_ecount_nz_opt(size)
-#define __in_bcount_nz_opt(size)
-#define __out_opt
-#define __out_ecount_opt(size)
-#define __out_bcount_opt(size)
-#define __out_ecount_part_opt(size,length)
-#define __out_bcount_part_opt(size,length)
-#define __out_ecount_full_opt(size)
-#define __out_bcount_full_opt(size)
-#define __out_ecount_z_opt(size)
-#define __out_bcount_z_opt(size)
-#define __out_ecount_part_z_opt(size,length)
-#define __out_bcount_part_z_opt(size,length)
-#define __out_ecount_full_z_opt(size)
-#define __out_bcount_full_z_opt(size)
-#define __out_ecount_nz_opt(size)
-#define __out_bcount_nz_opt(size)
-#define __inout_opt
-#define __inout_ecount_opt(size)
-#define __inout_bcount_opt(size)
-#define __inout_ecount_part_opt(size,length)
-#define __inout_bcount_part_opt(size,length)
-#define __inout_ecount_full_opt(size)
-#define __inout_bcount_full_opt(size)
-#define __inout_z_opt
-#define __inout_ecount_z_opt(size)
-#define __inout_ecount_z_opt(size)
-#define __inout_bcount_z_opt(size)
-#define __inout_nz_opt
-#define __inout_ecount_nz_opt(size)
-#define __inout_bcount_nz_opt(size)
-#define __deref_ecount(size)
-#define __deref_bcount(size)
-#define __deref_out
-#define __deref_out_ecount(size)
-#define __deref_out_bcount(size)
-#define __deref_out_ecount_part(size,length)
-#define __deref_out_bcount_part(size,length)
-#define __deref_out_ecount_full(size)
-#define __deref_out_bcount_full(size)
-#define __deref_out_z
-#define __deref_out_ecount_z(size)
-#define __deref_out_bcount_z(size)
-#define __deref_out_nz
-#define __deref_out_ecount_nz(size)
-#define __deref_out_bcount_nz(size)
-#define __deref_inout
-#define __deref_inout_z
-#define __deref_inout_ecount(size)
-#define __deref_inout_bcount(size)
-#define __deref_inout_ecount_part(size,length)
-#define __deref_inout_bcount_part(size,length)
-#define __deref_inout_ecount_full(size)
-#define __deref_inout_bcount_full(size)
-#define __deref_inout_z
-#define __deref_inout_ecount_z(size)
-#define __deref_inout_bcount_z(size)
-#define __deref_inout_nz
-#define __deref_inout_ecount_nz(size)
-#define __deref_inout_bcount_nz(size)
-#define __deref_ecount_opt(size)
-#define __deref_bcount_opt(size)
-#define __deref_out_opt
-#define __deref_out_ecount_opt(size)
-#define __deref_out_bcount_opt(size)
-#define __deref_out_ecount_part_opt(size,length)
-#define __deref_out_bcount_part_opt(size,length)
-#define __deref_out_ecount_full_opt(size)
-#define __deref_out_bcount_full_opt(size)
-#define __deref_out_z_opt
-#define __deref_out_ecount_z_opt(size)
-#define __deref_out_bcount_z_opt(size)
-#define __deref_out_nz_opt
-#define __deref_out_ecount_nz_opt(size)
-#define __deref_out_bcount_nz_opt(size)
-#define __deref_inout_opt
-#define __deref_inout_ecount_opt(size)
-#define __deref_inout_bcount_opt(size)
-#define __deref_inout_ecount_part_opt(size,length)
-#define __deref_inout_bcount_part_opt(size,length)
-#define __deref_inout_ecount_full_opt(size)
-#define __deref_inout_bcount_full_opt(size)
-#define __deref_inout_z_opt
-#define __deref_inout_ecount_z_opt(size)
-#define __deref_inout_bcount_z_opt(size)
-#define __deref_inout_nz_opt
-#define __deref_inout_ecount_nz_opt(size)
-#define __deref_inout_bcount_nz_opt(size)
-#define __deref_opt_ecount(size)
-#define __deref_opt_bcount(size)
-#define __deref_opt_out
-#define __deref_opt_out_z
-#define __deref_opt_out_ecount(size)
-#define __deref_opt_out_bcount(size)
-#define __deref_opt_out_ecount_part(size,length)
-#define __deref_opt_out_bcount_part(size,length)
-#define __deref_opt_out_ecount_full(size)
-#define __deref_opt_out_bcount_full(size)
-#define __deref_opt_inout
-#define __deref_opt_inout_ecount(size)
-#define __deref_opt_inout_bcount(size)
-#define __deref_opt_inout_ecount_part(size,length)
-#define __deref_opt_inout_bcount_part(size,length)
-#define __deref_opt_inout_ecount_full(size)
-#define __deref_opt_inout_bcount_full(size)
-#define __deref_opt_inout_z
-#define __deref_opt_inout_ecount_z(size)
-#define __deref_opt_inout_bcount_z(size)
-#define __deref_opt_inout_nz
-#define __deref_opt_inout_ecount_nz(size)
-#define __deref_opt_inout_bcount_nz(size)
-#define __deref_opt_ecount_opt(size)
-#define __deref_opt_bcount_opt(size)
-#define __deref_opt_out_opt
-#define __deref_opt_out_ecount_opt(size)
-#define __deref_opt_out_bcount_opt(size)
-#define __deref_opt_out_ecount_part_opt(size,length)
-#define __deref_opt_out_bcount_part_opt(size,length)
-#define __deref_opt_out_ecount_full_opt(size)
-#define __deref_opt_out_bcount_full_opt(size)
-#define __deref_opt_out_z_opt
-#define __deref_opt_out_ecount_z_opt(size)
-#define __deref_opt_out_bcount_z_opt(size)
-#define __deref_opt_out_nz_opt
-#define __deref_opt_out_ecount_nz_opt(size)
-#define __deref_opt_out_bcount_nz_opt(size)
-#define __deref_opt_inout_opt
-#define __deref_opt_inout_ecount_opt(size)
-#define __deref_opt_inout_bcount_opt(size)
-#define __deref_opt_inout_ecount_part_opt(size,length)
-#define __deref_opt_inout_bcount_part_opt(size,length)
-#define __deref_opt_inout_ecount_full_opt(size)
-#define __deref_opt_inout_bcount_full_opt(size)
-#define __deref_opt_inout_z_opt
-#define __deref_opt_inout_ecount_z_opt(size)
-#define __deref_opt_inout_bcount_z_opt(size)
-#define __deref_opt_inout_nz_opt
-#define __deref_opt_inout_ecount_nz_opt(size)
-#define __deref_opt_inout_bcount_nz_opt(size)
-
-#define __success(expr)
-#define __nullterminated
-#define __nullnullterminated
-#define __reserved
-#define __checkReturn
-#define __typefix(ctype)
-#define __override
-#define __callback
-#define __format_string
-#define __blocksOn(resource)
-#define __control_entrypoint(category)
-#define __data_entrypoint(category)
-
-#ifndef __fallthrough
-    #define __fallthrough __inner_fallthrough
-#endif
-
-#ifndef __analysis_assume
-    #define __analysis_assume(expr)
-#endif
+#pragma once
+
+#if __GNUC__ >=3
+#pragma GCC system_header
+#endif
+
+/*#define __null*/ // << Conflicts with GCC internal type __null
+#define __notnull
+#define __maybenull
+#define __readonly
+#define __notreadonly
+#define __maybereadonly
+#define __valid
+#define __notvalid
+#define __maybevalid
+#define __readableTo(extent)
+#define __elem_readableTo(size)
+#define __byte_readableTo(size)
+#define __writableTo(size)
+#define __elem_writableTo(size)
+#define __byte_writableTo(size)
+#define __deref
+#define __pre
+#define __post
+#define __precond(expr)
+#define __postcond(expr)
+#define __exceptthat
+#define __execeptthat
+#define __inner_success(expr)
+#define __inner_checkReturn
+#define __inner_typefix(ctype)
+#define __inner_override
+#define __inner_callback
+#define __inner_blocksOn(resource)
+#define __inner_fallthrough_dec
+#define __inner_fallthrough
+#define __refparam
+#define __inner_control_entrypoint(category)
+#define __inner_data_entrypoint(category)
+
+#define __ecount(size)
+#define __bcount(size)
+#define __in
+#define __in_ecount(size)
+#define __in_bcount(size)
+#define __in_z
+#define __in_ecount_z(size)
+#define __in_bcount_z(size)
+#define __in_nz
+#define __in_ecount_nz(size)
+#define __in_bcount_nz(size)
+#define __out
+#define __out_ecount(size)
+#define __out_bcount(size)
+#define __out_ecount_part(size,length)
+#define __out_bcount_part(size,length)
+#define __out_ecount_full(size)
+#define __out_bcount_full(size)
+#define __out_z
+#define __out_z_opt
+#define __out_ecount_z(size)
+#define __out_bcount_z(size)
+#define __out_ecount_part_z(size,length)
+#define __out_bcount_part_z(size,length)
+#define __out_ecount_full_z(size)
+#define __out_bcount_full_z(size)
+#define __out_nz
+#define __out_nz_opt
+#define __out_ecount_nz(size)
+#define __out_bcount_nz(size)
+#define __inout
+#define __inout_ecount(size)
+#define __inout_bcount(size)
+#define __inout_ecount_part(size,length)
+#define __inout_bcount_part(size,length)
+#define __inout_ecount_full(size)
+#define __inout_bcount_full(size)
+#define __inout_z
+#define __inout_ecount_z(size)
+#define __inout_bcount_z(size)
+#define __inout_nz
+#define __inout_ecount_nz(size)
+#define __inout_bcount_nz(size)
+#define __ecount_opt(size)
+#define __bcount_opt(size)
+#define __in_opt
+#define __in_ecount_opt(size)
+#define __in_bcount_opt(size)
+#define __in_z_opt
+#define __in_ecount_z_opt(size)
+#define __in_bcount_z_opt(size)
+#define __in_nz_opt
+#define __in_ecount_nz_opt(size)
+#define __in_bcount_nz_opt(size)
+#define __out_opt
+#define __out_ecount_opt(size)
+#define __out_bcount_opt(size)
+#define __out_ecount_part_opt(size,length)
+#define __out_bcount_part_opt(size,length)
+#define __out_ecount_full_opt(size)
+#define __out_bcount_full_opt(size)
+#define __out_ecount_z_opt(size)
+#define __out_bcount_z_opt(size)
+#define __out_ecount_part_z_opt(size,length)
+#define __out_bcount_part_z_opt(size,length)
+#define __out_ecount_full_z_opt(size)
+#define __out_bcount_full_z_opt(size)
+#define __out_ecount_nz_opt(size)
+#define __out_bcount_nz_opt(size)
+#define __inout_opt
+#define __inout_ecount_opt(size)
+#define __inout_bcount_opt(size)
+#define __inout_ecount_part_opt(size,length)
+#define __inout_bcount_part_opt(size,length)
+#define __inout_ecount_full_opt(size)
+#define __inout_bcount_full_opt(size)
+#define __inout_z_opt
+#define __inout_ecount_z_opt(size)
+#define __inout_ecount_z_opt(size)
+#define __inout_bcount_z_opt(size)
+#define __inout_nz_opt
+#define __inout_ecount_nz_opt(size)
+#define __inout_bcount_nz_opt(size)
+#define __deref_ecount(size)
+#define __deref_bcount(size)
+#define __deref_out
+#define __deref_out_ecount(size)
+#define __deref_out_bcount(size)
+#define __deref_out_ecount_part(size,length)
+#define __deref_out_bcount_part(size,length)
+#define __deref_out_ecount_full(size)
+#define __deref_out_bcount_full(size)
+#define __deref_out_z
+#define __deref_out_ecount_z(size)
+#define __deref_out_bcount_z(size)
+#define __deref_out_nz
+#define __deref_out_ecount_nz(size)
+#define __deref_out_bcount_nz(size)
+#define __deref_inout
+#define __deref_inout_z
+#define __deref_inout_ecount(size)
+#define __deref_inout_bcount(size)
+#define __deref_inout_ecount_part(size,length)
+#define __deref_inout_bcount_part(size,length)
+#define __deref_inout_ecount_full(size)
+#define __deref_inout_bcount_full(size)
+#define __deref_inout_z
+#define __deref_inout_ecount_z(size)
+#define __deref_inout_bcount_z(size)
+#define __deref_inout_nz
+#define __deref_inout_ecount_nz(size)
+#define __deref_inout_bcount_nz(size)
+#define __deref_ecount_opt(size)
+#define __deref_bcount_opt(size)
+#define __deref_out_opt
+#define __deref_out_ecount_opt(size)
+#define __deref_out_bcount_opt(size)
+#define __deref_out_ecount_part_opt(size,length)
+#define __deref_out_bcount_part_opt(size,length)
+#define __deref_out_ecount_full_opt(size)
+#define __deref_out_bcount_full_opt(size)
+#define __deref_out_z_opt
+#define __deref_out_ecount_z_opt(size)
+#define __deref_out_bcount_z_opt(size)
+#define __deref_out_nz_opt
+#define __deref_out_ecount_nz_opt(size)
+#define __deref_out_bcount_nz_opt(size)
+#define __deref_inout_opt
+#define __deref_inout_ecount_opt(size)
+#define __deref_inout_bcount_opt(size)
+#define __deref_inout_ecount_part_opt(size,length)
+#define __deref_inout_bcount_part_opt(size,length)
+#define __deref_inout_ecount_full_opt(size)
+#define __deref_inout_bcount_full_opt(size)
+#define __deref_inout_z_opt
+#define __deref_inout_ecount_z_opt(size)
+#define __deref_inout_bcount_z_opt(size)
+#define __deref_inout_nz_opt
+#define __deref_inout_ecount_nz_opt(size)
+#define __deref_inout_bcount_nz_opt(size)
+#define __deref_opt_ecount(size)
+#define __deref_opt_bcount(size)
+#define __deref_opt_out
+#define __deref_opt_out_z
+#define __deref_opt_out_ecount(size)
+#define __deref_opt_out_bcount(size)
+#define __deref_opt_out_ecount_part(size,length)
+#define __deref_opt_out_bcount_part(size,length)
+#define __deref_opt_out_ecount_full(size)
+#define __deref_opt_out_bcount_full(size)
+#define __deref_opt_inout
+#define __deref_opt_inout_ecount(size)
+#define __deref_opt_inout_bcount(size)
+#define __deref_opt_inout_ecount_part(size,length)
+#define __deref_opt_inout_bcount_part(size,length)
+#define __deref_opt_inout_ecount_full(size)
+#define __deref_opt_inout_bcount_full(size)
+#define __deref_opt_inout_z
+#define __deref_opt_inout_ecount_z(size)
+#define __deref_opt_inout_bcount_z(size)
+#define __deref_opt_inout_nz
+#define __deref_opt_inout_ecount_nz(size)
+#define __deref_opt_inout_bcount_nz(size)
+#define __deref_opt_ecount_opt(size)
+#define __deref_opt_bcount_opt(size)
+#define __deref_opt_out_opt
+#define __deref_opt_out_ecount_opt(size)
+#define __deref_opt_out_bcount_opt(size)
+#define __deref_opt_out_ecount_part_opt(size,length)
+#define __deref_opt_out_bcount_part_opt(size,length)
+#define __deref_opt_out_ecount_full_opt(size)
+#define __deref_opt_out_bcount_full_opt(size)
+#define __deref_opt_out_z_opt
+#define __deref_opt_out_ecount_z_opt(size)
+#define __deref_opt_out_bcount_z_opt(size)
+#define __deref_opt_out_nz_opt
+#define __deref_opt_out_ecount_nz_opt(size)
+#define __deref_opt_out_bcount_nz_opt(size)
+#define __deref_opt_inout_opt
+#define __deref_opt_inout_ecount_opt(size)
+#define __deref_opt_inout_bcount_opt(size)
+#define __deref_opt_inout_ecount_part_opt(size,length)
+#define __deref_opt_inout_bcount_part_opt(size,length)
+#define __deref_opt_inout_ecount_full_opt(size)
+#define __deref_opt_inout_bcount_full_opt(size)
+#define __deref_opt_inout_z_opt
+#define __deref_opt_inout_ecount_z_opt(size)
+#define __deref_opt_inout_bcount_z_opt(size)
+#define __deref_opt_inout_nz_opt
+#define __deref_opt_inout_ecount_nz_opt(size)
+#define __deref_opt_inout_bcount_nz_opt(size)
+
+#define __success(expr)
+#define __nullterminated
+#define __nullnullterminated
+#define __reserved
+#define __checkReturn
+#define __typefix(ctype)
+#define __override
+#define __callback
+#define __format_string
+#define __blocksOn(resource)
+#define __control_entrypoint(category)
+#define __data_entrypoint(category)
+
+#ifndef __fallthrough
+    #define __fallthrough __inner_fallthrough
+#endif
+
+#ifndef __analysis_assume
+    #define __analysis_assume(expr)
+#endif
diff --git a/src/hostapi/wasapi/mingw-include/sdkddkver.h b/src/hostapi/wasapi/mingw-include/sdkddkver.h
deleted file mode 100644
index 0e4d207..0000000
--- a/src/hostapi/wasapi/mingw-include/sdkddkver.h
+++ /dev/null
@@ -1,225 +0,0 @@
-/*
-
-Copyright (c) Microsoft Corporation. All rights reserved.
-
-Module Name:
-
-    sdkddkver.h
-
-Abstract:
-
-    Master include file for versioning windows SDK/DDK.
-
-*/
-
-#ifndef _INC_SDKDDKVER
-#define _INC_SDKDDKVER
-
-#pragma once
-
-//
-// _WIN32_WINNT version constants
-//
-#define _WIN32_WINNT_NT4                    0x0400
-#define _WIN32_WINNT_WIN2K                  0x0500
-#define _WIN32_WINNT_WINXP                  0x0501
-#define _WIN32_WINNT_WS03                   0x0502
-#define _WIN32_WINNT_LONGHORN               0x0600
-
-//
-// _WIN32_IE_ version constants
-//
-#define _WIN32_IE_IE20                      0x0200
-#define _WIN32_IE_IE30                      0x0300
-#define _WIN32_IE_IE302                     0x0302
-#define _WIN32_IE_IE40                      0x0400
-#define _WIN32_IE_IE401                     0x0401
-#define _WIN32_IE_IE50                      0x0500
-#define _WIN32_IE_IE501                     0x0501
-#define _WIN32_IE_IE55                      0x0550
-#define _WIN32_IE_IE60                      0x0600
-#define _WIN32_IE_IE60SP1                   0x0601
-#define _WIN32_IE_IE60SP2                   0x0603
-#define _WIN32_IE_IE70                      0x0700
-
-//
-// IE <-> OS version mapping
-//
-// NT4 supports IE versions 2.0 -> 6.0 SP1
-#define _WIN32_IE_NT4                       _WIN32_IE_IE20
-#define _WIN32_IE_NT4SP1                    _WIN32_IE_IE20
-#define _WIN32_IE_NT4SP2                    _WIN32_IE_IE20
-#define _WIN32_IE_NT4SP3                    _WIN32_IE_IE302
-#define _WIN32_IE_NT4SP4                    _WIN32_IE_IE401
-#define _WIN32_IE_NT4SP5                    _WIN32_IE_IE401
-#define _WIN32_IE_NT4SP6                    _WIN32_IE_IE50
-// Win98 supports IE versions 4.01 -> 6.0 SP1
-#define _WIN32_IE_WIN98                     _WIN32_IE_IE401
-// Win98SE supports IE versions 5.0 -> 6.0 SP1
-#define _WIN32_IE_WIN98SE                   _WIN32_IE_IE50
-// WinME supports IE versions 5.5 -> 6.0 SP1
-#define _WIN32_IE_WINME                     _WIN32_IE_IE55
-// Win2k supports IE versions 5.01 -> 6.0 SP1
-#define _WIN32_IE_WIN2K                     _WIN32_IE_IE501
-#define _WIN32_IE_WIN2KSP1                  _WIN32_IE_IE501
-#define _WIN32_IE_WIN2KSP2                  _WIN32_IE_IE501
-#define _WIN32_IE_WIN2KSP3                  _WIN32_IE_IE501
-#define _WIN32_IE_WIN2KSP4                  _WIN32_IE_IE501
-#define _WIN32_IE_XP                        _WIN32_IE_IE60
-#define _WIN32_IE_XPSP1                     _WIN32_IE_IE60SP1
-#define _WIN32_IE_XPSP2                     _WIN32_IE_IE60SP2
-#define _WIN32_IE_WS03                      0x0602
-#define _WIN32_IE_WS03SP1                   _WIN32_IE_IE60SP2
-#define _WIN32_IE_LONGHORN                  _WIN32_IE_IE70
-
-
-//
-// NTDDI version constants
-//
-#define NTDDI_WIN2K                         0x05000000
-#define NTDDI_WIN2KSP1                      0x05000100
-#define NTDDI_WIN2KSP2                      0x05000200
-#define NTDDI_WIN2KSP3                      0x05000300
-#define NTDDI_WIN2KSP4                      0x05000400
-
-#define NTDDI_WINXP                         0x05010000
-#define NTDDI_WINXPSP1                      0x05010100
-#define NTDDI_WINXPSP2                      0x05010200
-
-#define NTDDI_WS03                          0x05020000
-#define NTDDI_WS03SP1                       0x05020100
-
-#define NTDDI_LONGHORN                      0x06000000
-
-//
-// masks for version macros
-//
-#define OSVERSION_MASK      0xFFFF0000
-#define SPVERSION_MASK      0x0000FF00
-#define SUBVERSION_MASK     0x000000FF
-
-
-//
-// macros to extract various version fields from the NTDDI version
-//
-#define OSVER(Version)  ((Version) & OSVERSION_MASK)
-#define SPVER(Version)  (((Version) & SPVERSION_MASK) >> 8)
-#define SUBVER(Version) (((Version) & SUBVERSION_MASK) )
-
-
-#if defined(DECLSPEC_DEPRECATED_DDK)
-
-// deprecate in 2k or later
-#if (NTDDI_VERSION >= NTDDI_WIN2K)
-#define DECLSPEC_DEPRECATED_DDK_WIN2K DECLSPEC_DEPRECATED_DDK
-#else
-#define DECLSPEC_DEPRECATED_DDK_WIN2K
-#endif
-
-// deprecate in XP or later
-#if (NTDDI_VERSION >= NTDDI_WINXP)
-#define DECLSPEC_DEPRECATED_DDK_WINXP DECLSPEC_DEPRECATED_DDK
-#else
-#define DECLSPEC_DEPRECATED_DDK_WINXP
-#endif
-
-// deprecate in WS03 or later
-#if (NTDDI_VERSION >= NTDDI_WS03)
-#define DECLSPEC_DEPRECATED_DDK_WIN2003 DECLSPEC_DEPRECATED_DDK
-#else
-#define DECLSPEC_DEPRECATED_DDK_WIN2003
-#endif
-
-// deprecate in WS03 or later
-#if (NTDDI_VERSION >= NTDDI_LONGHORN)
-#define DECLSPEC_DEPRECATED_DDK_LONGHORN DECLSPEC_DEPRECATED_DDK
-#else
-#define DECLSPEC_DEPRECATED_DDK_LONGHORN
-#endif
-
-#endif // defined(DECLSPEC_DEPRECATED_DDK)
-
-
-//
-// if versions aren't already defined, default to most current
-//
-
-#define NTDDI_VERSION_FROM_WIN32_WINNT2(ver)    ver##0000
-#define NTDDI_VERSION_FROM_WIN32_WINNT(ver)     NTDDI_VERSION_FROM_WIN32_WINNT2(ver)
-
-#if !defined(_WIN32_WINNT) && !defined(_CHICAGO_)
-#define  _WIN32_WINNT   0x0600
-#endif
-
-#ifndef NTDDI_VERSION
-#ifdef _WIN32_WINNT
-// set NTDDI_VERSION based on _WIN32_WINNT
-#define NTDDI_VERSION   NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT)
-#else
-#define NTDDI_VERSION   0x06000000
-#endif
-#endif
-
-#ifndef WINVER
-#ifdef _WIN32_WINNT
-// set WINVER based on _WIN32_WINNT
-#define WINVER          _WIN32_WINNT
-#else
-#define WINVER          0x0600
-#endif
-#endif
-
-#ifndef _WIN32_IE
-#ifdef _WIN32_WINNT
-// set _WIN32_IE based on _WIN32_WINNT
-#if (_WIN32_WINNT <= _WIN32_WINNT_NT4)
-#define _WIN32_IE       _WIN32_IE_IE50
-#elif (_WIN32_WINNT <= _WIN32_WINNT_WIN2K)
-#define _WIN32_IE       _WIN32_IE_IE501
-#elif (_WIN32_WINNT <= _WIN32_WINNT_WINXP)
-#define _WIN32_IE       _WIN32_IE_IE60
-#elif (_WIN32_WINNT <= _WIN32_WINNT_WS03)
-#define _WIN32_IE       0x0602
-#else
-#define _WIN32_IE       0x0700
-#endif
-#else
-#define _WIN32_IE       0x0700
-#endif
-#endif
-
-//
-// Sanity check for compatible versions
-//
-#if defined(_WIN32_WINNT) && !defined(MIDL_PASS) && !defined(RC_INVOKED)
-
-#if (defined(WINVER) && (WINVER < 0x0400) && (_WIN32_WINNT > 0x0400))
-#error WINVER setting conflicts with _WIN32_WINNT setting
-#endif
-
-#if (((OSVERSION_MASK & NTDDI_VERSION) == NTDDI_WIN2K) && (_WIN32_WINNT != _WIN32_WINNT_WIN2K))
-#error NTDDI_VERSION setting conflicts with _WIN32_WINNT setting
-#endif
-
-#if (((OSVERSION_MASK & NTDDI_VERSION) == NTDDI_WINXP) && (_WIN32_WINNT != _WIN32_WINNT_WINXP))
-#error NTDDI_VERSION setting conflicts with _WIN32_WINNT setting
-#endif
-
-#if (((OSVERSION_MASK & NTDDI_VERSION) == NTDDI_WS03) && (_WIN32_WINNT != _WIN32_WINNT_WS03))
-#error NTDDI_VERSION setting conflicts with _WIN32_WINNT setting
-#endif
-
-#if (((OSVERSION_MASK & NTDDI_VERSION) == NTDDI_LONGHORN) && (_WIN32_WINNT != _WIN32_WINNT_LONGHORN))
-#error NTDDI_VERSION setting conflicts with _WIN32_WINNT setting
-#endif
-
-#if ((_WIN32_WINNT < _WIN32_WINNT_WIN2K) && (_WIN32_IE > _WIN32_IE_IE60SP1))
-#error _WIN32_WINNT settings conflicts with _WIN32_IE setting
-#endif
-
-#endif  // defined(_WIN32_WINNT) && !defined(MIDL_PASS) && !defined(_WINRESRC_)
-
-
-#endif  // !_INC_SDKDDKVER
-
-
diff --git a/src/hostapi/wasapi/mingw-include/shtypes.h b/src/hostapi/wasapi/mingw-include/shtypes.h
deleted file mode 100644
index 5106b3f..0000000
--- a/src/hostapi/wasapi/mingw-include/shtypes.h
+++ /dev/null
@@ -1,468 +0,0 @@
-
-
-/* this ALWAYS GENERATED file contains the definitions for the interfaces */
-
-
- /* File created by MIDL compiler version 7.00.0499 */
-/* Compiler settings for shtypes.idl:
-    Oicf, W1, Zp8, env=Win32 (32b run)
-    protocol : dce , ms_ext, c_ext, robust
-    error checks: allocation ref bounds_check enum stub_data 
-    VC __declspec() decoration level: 
-         __declspec(uuid()), __declspec(selectany), __declspec(novtable)
-         DECLSPEC_UUID(), MIDL_INTERFACE()
-*/
-//@@MIDL_FILE_HEADING(  )
-
-#pragma warning( disable: 4049 )  /* more than 64k source lines */
-
-
-/* verify that the <rpcndr.h> version is high enough to compile this file*/
-#ifndef __REQUIRED_RPCNDR_H_VERSION__
-#define __REQUIRED_RPCNDR_H_VERSION__ 500
-#endif
-
-/* verify that the <rpcsal.h> version is high enough to compile this file*/
-#ifndef __REQUIRED_RPCSAL_H_VERSION__
-#define __REQUIRED_RPCSAL_H_VERSION__ 100
-#endif
-
-#include "rpc.h"
-#include "rpcndr.h"
-
-#ifndef __RPCNDR_H_VERSION__
-#error this stub requires an updated version of <rpcndr.h>
-#endif // __RPCNDR_H_VERSION__
-
-
-#ifndef __shtypes_h__
-#define __shtypes_h__
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-#pragma once
-#endif
-
-/* Forward Declarations */ 
-
-/* header files for imported files */
-#include "wtypes.h"
-
-#ifdef __cplusplus
-extern "C"{
-#endif 
-
-
-/* interface __MIDL_itf_shtypes_0000_0000 */
-/* [local] */ 
-
-//+-------------------------------------------------------------------------
-//
-//  Microsoft Windows
-//  Copyright (c) Microsoft Corporation. All rights reserved.
-//
-//--------------------------------------------------------------------------
-//===========================================================================
-//
-// Object identifiers in the explorer's name space (ItemID and IDList)
-//
-//  All the items that the user can browse with the explorer (such as files,
-// directories, servers, work-groups, etc.) has an identifier which is unique
-// among items within the parent folder. Those identifiers are called item
-// IDs (SHITEMID). Since all its parent folders have their own item IDs,
-// any items can be uniquely identified by a list of item IDs, which is called
-// an ID list (ITEMIDLIST).
-//
-//  ID lists are almost always allocated by the task allocator (see some
-// description below as well as OLE 2.0 SDK) and may be passed across
-// some of shell interfaces (such as IShellFolder). Each item ID in an ID list
-// is only meaningful to its parent folder (which has generated it), and all
-// the clients must treat it as an opaque binary data except the first two
-// bytes, which indicates the size of the item ID.
-//
-//  When a shell extension -- which implements the IShellFolder interace --
-// generates an item ID, it may put any information in it, not only the data
-// with that it needs to identifies the item, but also some additional
-// information, which would help implementing some other functions efficiently.
-// For example, the shell's IShellFolder implementation of file system items
-// stores the primary (long) name of a file or a directory as the item
-// identifier, but it also stores its alternative (short) name, size and date
-// etc.
-//
-//  When an ID list is passed to one of shell APIs (such as SHGetPathFromIDList),
-// it is always an absolute path -- relative from the root of the name space,
-// which is the desktop folder. When an ID list is passed to one of IShellFolder
-// member function, it is always a relative path from the folder (unless it
-// is explicitly specified).
-//
-//===========================================================================
-//
-// SHITEMID -- Item ID  (mkid)
-//     USHORT      cb;             // Size of the ID (including cb itself)
-//     BYTE        abID[];         // The item ID (variable length)
-//
-#include <pshpack1.h>
-typedef struct _SHITEMID
-    {
-    USHORT cb;
-    BYTE abID[ 1 ];
-    } 	SHITEMID;
-
-#include <poppack.h>
-#if defined(_M_IX86)
-#define __unaligned
-#endif // __unaligned
-typedef SHITEMID __unaligned *LPSHITEMID;
-
-typedef const SHITEMID __unaligned *LPCSHITEMID;
-
-//
-// ITEMIDLIST -- List if item IDs (combined with 0-terminator)
-//
-#include <pshpack1.h>
-typedef struct _ITEMIDLIST
-    {
-    SHITEMID mkid;
-    } 	ITEMIDLIST;
-
-#if defined(STRICT_TYPED_ITEMIDS) && defined(__cplusplus)
-typedef struct _ITEMIDLIST_RELATIVE : ITEMIDLIST {} ITEMIDLIST_RELATIVE;
-typedef struct _ITEMID_CHILD : ITEMIDLIST_RELATIVE {} ITEMID_CHILD;
-typedef struct _ITEMIDLIST_ABSOLUTE : ITEMIDLIST_RELATIVE {} ITEMIDLIST_ABSOLUTE;
-#else // !(defined(STRICT_TYPED_ITEMIDS) && defined(__cplusplus))
-typedef ITEMIDLIST ITEMIDLIST_RELATIVE;
-
-typedef ITEMIDLIST ITEMID_CHILD;
-
-typedef ITEMIDLIST ITEMIDLIST_ABSOLUTE;
-
-#endif // defined(STRICT_TYPED_ITEMIDS) && defined(__cplusplus)
-#include <poppack.h>
-typedef /* [unique] */  __RPC_unique_pointer BYTE_BLOB *wirePIDL;
-
-typedef /* [wire_marshal] */ ITEMIDLIST __unaligned *LPITEMIDLIST;
-
-typedef /* [wire_marshal] */ const ITEMIDLIST __unaligned *LPCITEMIDLIST;
-
-#if defined(STRICT_TYPED_ITEMIDS) && defined(__cplusplus)
-typedef /* [wire_marshal] */ ITEMIDLIST_ABSOLUTE *PIDLIST_ABSOLUTE;
-
-typedef /* [wire_marshal] */ const ITEMIDLIST_ABSOLUTE *PCIDLIST_ABSOLUTE;
-
-typedef /* [wire_marshal] */ const ITEMIDLIST_ABSOLUTE __unaligned *PCUIDLIST_ABSOLUTE;
-
-typedef /* [wire_marshal] */ ITEMIDLIST_RELATIVE *PIDLIST_RELATIVE;
-
-typedef /* [wire_marshal] */ const ITEMIDLIST_RELATIVE *PCIDLIST_RELATIVE;
-
-typedef /* [wire_marshal] */ ITEMIDLIST_RELATIVE __unaligned *PUIDLIST_RELATIVE;
-
-typedef /* [wire_marshal] */ const ITEMIDLIST_RELATIVE __unaligned *PCUIDLIST_RELATIVE;
-
-typedef /* [wire_marshal] */ ITEMID_CHILD *PITEMID_CHILD;
-
-typedef /* [wire_marshal] */ const ITEMID_CHILD *PCITEMID_CHILD;
-
-typedef /* [wire_marshal] */ ITEMID_CHILD __unaligned *PUITEMID_CHILD;
-
-typedef /* [wire_marshal] */ const ITEMID_CHILD __unaligned *PCUITEMID_CHILD;
-
-typedef const PCUITEMID_CHILD *PCUITEMID_CHILD_ARRAY;
-
-typedef const PCUIDLIST_RELATIVE *PCUIDLIST_RELATIVE_ARRAY;
-
-typedef const PCIDLIST_ABSOLUTE *PCIDLIST_ABSOLUTE_ARRAY;
-
-typedef const PCUIDLIST_ABSOLUTE *PCUIDLIST_ABSOLUTE_ARRAY;
-
-#else // !(defined(STRICT_TYPED_ITEMIDS) && defined(__cplusplus))
-#define PIDLIST_ABSOLUTE         LPITEMIDLIST
-#define PCIDLIST_ABSOLUTE        LPCITEMIDLIST
-#define PCUIDLIST_ABSOLUTE       LPCITEMIDLIST
-#define PIDLIST_RELATIVE         LPITEMIDLIST
-#define PCIDLIST_RELATIVE        LPCITEMIDLIST
-#define PUIDLIST_RELATIVE        LPITEMIDLIST
-#define PCUIDLIST_RELATIVE       LPCITEMIDLIST
-#define PITEMID_CHILD            LPITEMIDLIST
-#define PCITEMID_CHILD           LPCITEMIDLIST
-#define PUITEMID_CHILD           LPITEMIDLIST
-#define PCUITEMID_CHILD          LPCITEMIDLIST
-#define PCUITEMID_CHILD_ARRAY    LPCITEMIDLIST *
-#define PCUIDLIST_RELATIVE_ARRAY LPCITEMIDLIST *
-#define PCIDLIST_ABSOLUTE_ARRAY  LPCITEMIDLIST *
-#define PCUIDLIST_ABSOLUTE_ARRAY LPCITEMIDLIST *
-#endif // defined(STRICT_TYPED_ITEMIDS) && defined(__cplusplus)
-#ifdef MIDL_PASS
-typedef struct _WIN32_FIND_DATAA
-    {
-    DWORD dwFileAttributes;
-    FILETIME ftCreationTime;
-    FILETIME ftLastAccessTime;
-    FILETIME ftLastWriteTime;
-    DWORD nFileSizeHigh;
-    DWORD nFileSizeLow;
-    DWORD dwReserved0;
-    DWORD dwReserved1;
-    CHAR cFileName[ 260 ];
-    CHAR cAlternateFileName[ 14 ];
-    } 	WIN32_FIND_DATAA;
-
-typedef struct _WIN32_FIND_DATAA *PWIN32_FIND_DATAA;
-
-typedef struct _WIN32_FIND_DATAA *LPWIN32_FIND_DATAA;
-
-typedef struct _WIN32_FIND_DATAW
-    {
-    DWORD dwFileAttributes;
-    FILETIME ftCreationTime;
-    FILETIME ftLastAccessTime;
-    FILETIME ftLastWriteTime;
-    DWORD nFileSizeHigh;
-    DWORD nFileSizeLow;
-    DWORD dwReserved0;
-    DWORD dwReserved1;
-    WCHAR cFileName[ 260 ];
-    WCHAR cAlternateFileName[ 14 ];
-    } 	WIN32_FIND_DATAW;
-
-typedef struct _WIN32_FIND_DATAW *PWIN32_FIND_DATAW;
-
-typedef struct _WIN32_FIND_DATAW *LPWIN32_FIND_DATAW;
-
-#endif // MIDL_PASS
-//-------------------------------------------------------------------------
-//
-// struct STRRET
-//
-// structure for returning strings from IShellFolder member functions
-//
-//-------------------------------------------------------------------------
-//
-//  uType indicate which union member to use 
-//    STRRET_WSTR    Use STRRET.pOleStr     must be freed by caller of GetDisplayNameOf
-//    STRRET_OFFSET  Use STRRET.uOffset     Offset into SHITEMID for ANSI string 
-//    STRRET_CSTR    Use STRRET.cStr        ANSI Buffer
-//
-typedef /* [v1_enum] */ 
-enum tagSTRRET_TYPE
-    {	STRRET_WSTR	= 0,
-	STRRET_OFFSET	= 0x1,
-	STRRET_CSTR	= 0x2
-    } 	STRRET_TYPE;
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1200)
-#pragma warning(push)
-#pragma warning(disable:4201) /* nonstandard extension used : nameless struct/union */
-#pragma once
-#endif
-#include <pshpack8.h>
-typedef struct _STRRET
-    {
-    UINT uType;
-    union 
-        {
-        LPWSTR pOleStr;
-        UINT uOffset;
-        char cStr[ 260 ];
-        } 	DUMMYUNIONNAME;
-    } 	STRRET;
-
-#include <poppack.h>
-#if defined(_MSC_VER) && (_MSC_VER >= 1200)
-#pragma warning(pop)
-#endif
-typedef STRRET *LPSTRRET;
-
-//-------------------------------------------------------------------------
-//
-// struct SHELLDETAILS
-//
-// structure for returning strings from IShellDetails
-//
-//-------------------------------------------------------------------------
-//
-//  fmt;            // LVCFMT_* value (header only)
-//  cxChar;         // Number of 'average' characters (header only)
-//  str;            // String information
-//
-#include <pshpack1.h>
-typedef struct _SHELLDETAILS
-    {
-    int fmt;
-    int cxChar;
-    STRRET str;
-    } 	SHELLDETAILS;
-
-typedef struct _SHELLDETAILS *LPSHELLDETAILS;
-
-#include <poppack.h>
-
-#if (_WIN32_IE >= _WIN32_IE_IE60SP2)
-typedef /* [v1_enum] */ 
-enum tagPERCEIVED
-    {	PERCEIVED_TYPE_FIRST	= -3,
-	PERCEIVED_TYPE_CUSTOM	= -3,
-	PERCEIVED_TYPE_UNSPECIFIED	= -2,
-	PERCEIVED_TYPE_FOLDER	= -1,
-	PERCEIVED_TYPE_UNKNOWN	= 0,
-	PERCEIVED_TYPE_TEXT	= 1,
-	PERCEIVED_TYPE_IMAGE	= 2,
-	PERCEIVED_TYPE_AUDIO	= 3,
-	PERCEIVED_TYPE_VIDEO	= 4,
-	PERCEIVED_TYPE_COMPRESSED	= 5,
-	PERCEIVED_TYPE_DOCUMENT	= 6,
-	PERCEIVED_TYPE_SYSTEM	= 7,
-	PERCEIVED_TYPE_APPLICATION	= 8,
-	PERCEIVED_TYPE_GAMEMEDIA	= 9,
-	PERCEIVED_TYPE_CONTACTS	= 10,
-	PERCEIVED_TYPE_LAST	= 10
-    } 	PERCEIVED;
-
-#define PERCEIVEDFLAG_UNDEFINED     0x0000
-#define PERCEIVEDFLAG_SOFTCODED     0x0001
-#define PERCEIVEDFLAG_HARDCODED     0x0002
-#define PERCEIVEDFLAG_NATIVESUPPORT 0x0004
-#define PERCEIVEDFLAG_GDIPLUS       0x0010
-#define PERCEIVEDFLAG_WMSDK         0x0020
-#define PERCEIVEDFLAG_ZIPFOLDER     0x0040
-typedef DWORD PERCEIVEDFLAG;
-
-#endif  // _WIN32_IE_IE60SP2
-
-#if (NTDDI_VERSION >= NTDDI_LONGHORN)
-typedef struct _COMDLG_FILTERSPEC
-    {
-    LPCWSTR pszName;
-    LPCWSTR pszSpec;
-    } 	COMDLG_FILTERSPEC;
-
-typedef struct tagMACHINE_ID
-    {
-    char szName[ 16 ];
-    } 	MACHINE_ID;
-
-typedef struct tagDOMAIN_RELATIVE_OBJECTID
-    {
-    GUID guidVolume;
-    GUID guidObject;
-    } 	DOMAIN_RELATIVE_OBJECTID;
-
-typedef GUID KNOWNFOLDERID;
-
-#if 0
-typedef KNOWNFOLDERID *REFKNOWNFOLDERID;
-
-#endif // 0
-#ifdef __cplusplus
-#define REFKNOWNFOLDERID const KNOWNFOLDERID &
-#else // !__cplusplus
-#define REFKNOWNFOLDERID const KNOWNFOLDERID * __MIDL_CONST
-#endif // __cplusplus
-#endif  // NTDDI_LONGHORN
-typedef GUID FOLDERTYPEID;
-
-#if 0
-typedef FOLDERTYPEID *REFFOLDERTYPEID;
-
-#endif // 0
-#ifdef __cplusplus
-#define REFFOLDERTYPEID const FOLDERTYPEID &
-#else // !__cplusplus
-#define REFFOLDERTYPEID const FOLDERTYPEID * __MIDL_CONST
-#endif // __cplusplus
-typedef GUID TASKOWNERID;
-
-#if 0
-typedef TASKOWNERID *REFTASKOWNERID;
-
-#endif // 0
-#ifdef __cplusplus
-#define REFTASKOWNERID const TASKOWNERID &
-#else // !__cplusplus
-#define REFTASKOWNERID const TASKOWNERID * __MIDL_CONST
-#endif // __cplusplus
-#ifndef LF_FACESIZE
-typedef struct tagLOGFONTA
-    {
-    LONG lfHeight;
-    LONG lfWidth;
-    LONG lfEscapement;
-    LONG lfOrientation;
-    LONG lfWeight;
-    BYTE lfItalic;
-    BYTE lfUnderline;
-    BYTE lfStrikeOut;
-    BYTE lfCharSet;
-    BYTE lfOutPrecision;
-    BYTE lfClipPrecision;
-    BYTE lfQuality;
-    BYTE lfPitchAndFamily;
-    CHAR lfFaceName[ 32 ];
-    } 	LOGFONTA;
-
-typedef struct tagLOGFONTW
-    {
-    LONG lfHeight;
-    LONG lfWidth;
-    LONG lfEscapement;
-    LONG lfOrientation;
-    LONG lfWeight;
-    BYTE lfItalic;
-    BYTE lfUnderline;
-    BYTE lfStrikeOut;
-    BYTE lfCharSet;
-    BYTE lfOutPrecision;
-    BYTE lfClipPrecision;
-    BYTE lfQuality;
-    BYTE lfPitchAndFamily;
-    WCHAR lfFaceName[ 32 ];
-    } 	LOGFONTW;
-
-typedef LOGFONTA LOGFONT;
-
-#endif // LF_FACESIZE
-typedef /* [v1_enum] */ 
-enum tagSHCOLSTATE
-    {	SHCOLSTATE_TYPE_STR	= 0x1,
-	SHCOLSTATE_TYPE_INT	= 0x2,
-	SHCOLSTATE_TYPE_DATE	= 0x3,
-	SHCOLSTATE_TYPEMASK	= 0xf,
-	SHCOLSTATE_ONBYDEFAULT	= 0x10,
-	SHCOLSTATE_SLOW	= 0x20,
-	SHCOLSTATE_EXTENDED	= 0x40,
-	SHCOLSTATE_SECONDARYUI	= 0x80,
-	SHCOLSTATE_HIDDEN	= 0x100,
-	SHCOLSTATE_PREFER_VARCMP	= 0x200,
-	SHCOLSTATE_PREFER_FMTCMP	= 0x400,
-	SHCOLSTATE_NOSORTBYFOLDERNESS	= 0x800,
-	SHCOLSTATE_VIEWONLY	= 0x10000,
-	SHCOLSTATE_BATCHREAD	= 0x20000,
-	SHCOLSTATE_NO_GROUPBY	= 0x40000,
-	SHCOLSTATE_FIXED_WIDTH	= 0x1000,
-	SHCOLSTATE_NODPISCALE	= 0x2000,
-	SHCOLSTATE_FIXED_RATIO	= 0x4000,
-	SHCOLSTATE_DISPLAYMASK	= 0xf000
-    } 	SHCOLSTATE;
-
-typedef DWORD SHCOLSTATEF;
-
-typedef PROPERTYKEY SHCOLUMNID;
-
-typedef const SHCOLUMNID *LPCSHCOLUMNID;
-
-
-
-extern RPC_IF_HANDLE __MIDL_itf_shtypes_0000_0000_v0_0_c_ifspec;
-extern RPC_IF_HANDLE __MIDL_itf_shtypes_0000_0000_v0_0_s_ifspec;
-
-/* Additional Prototypes for ALL interfaces */
-
-/* end of Additional Prototypes */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
-
-
diff --git a/src/hostapi/wasapi/mingw-include/structuredquery.h b/src/hostapi/wasapi/mingw-include/structuredquery.h
index a42ec89..bca20a9 100644
--- a/src/hostapi/wasapi/mingw-include/structuredquery.h
+++ b/src/hostapi/wasapi/mingw-include/structuredquery.h
@@ -1,2478 +1,2478 @@
-
-
-/* this ALWAYS GENERATED file contains the definitions for the interfaces */
-
-
- /* File created by MIDL compiler version 7.00.0499 */
-/* Compiler settings for structuredquery.idl:
-    Oicf, W1, Zp8, env=Win32 (32b run)
-    protocol : dce , ms_ext, c_ext, robust
-    error checks: allocation ref bounds_check enum stub_data 
-    VC __declspec() decoration level: 
-         __declspec(uuid()), __declspec(selectany), __declspec(novtable)
-         DECLSPEC_UUID(), MIDL_INTERFACE()
-*/
-//@@MIDL_FILE_HEADING(  )
-
-#pragma warning( disable: 4049 )  /* more than 64k source lines */
-
-
-/* verify that the <rpcndr.h> version is high enough to compile this file*/
-#ifndef __REQUIRED_RPCNDR_H_VERSION__
-#define __REQUIRED_RPCNDR_H_VERSION__ 475
-#endif
-
-/* verify that the <rpcsal.h> version is high enough to compile this file*/
-#ifndef __REQUIRED_RPCSAL_H_VERSION__
-#define __REQUIRED_RPCSAL_H_VERSION__ 100
-#endif
-
-#include "rpc.h"
-#include "rpcndr.h"
-
-#ifndef __RPCNDR_H_VERSION__
-#error this stub requires an updated version of <rpcndr.h>
-#endif // __RPCNDR_H_VERSION__
-
-#ifndef COM_NO_WINDOWS_H
-#include "windows.h"
-#include "ole2.h"
-#endif /*COM_NO_WINDOWS_H*/
-
-#ifndef __structuredquery_h__
-#define __structuredquery_h__
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-#pragma once
-#endif
-
-/* Forward Declarations */ 
-
-#ifndef __IQueryParser_FWD_DEFINED__
-#define __IQueryParser_FWD_DEFINED__
-typedef interface IQueryParser IQueryParser;
-#endif 	/* __IQueryParser_FWD_DEFINED__ */
-
-
-#ifndef __IConditionFactory_FWD_DEFINED__
-#define __IConditionFactory_FWD_DEFINED__
-typedef interface IConditionFactory IConditionFactory;
-#endif 	/* __IConditionFactory_FWD_DEFINED__ */
-
-
-#ifndef __IQuerySolution_FWD_DEFINED__
-#define __IQuerySolution_FWD_DEFINED__
-typedef interface IQuerySolution IQuerySolution;
-#endif 	/* __IQuerySolution_FWD_DEFINED__ */
-
-
-#ifndef __ICondition_FWD_DEFINED__
-#define __ICondition_FWD_DEFINED__
-typedef interface ICondition ICondition;
-#endif 	/* __ICondition_FWD_DEFINED__ */
-
-
-#ifndef __IConditionGenerator_FWD_DEFINED__
-#define __IConditionGenerator_FWD_DEFINED__
-typedef interface IConditionGenerator IConditionGenerator;
-#endif 	/* __IConditionGenerator_FWD_DEFINED__ */
-
-
-#ifndef __IRichChunk_FWD_DEFINED__
-#define __IRichChunk_FWD_DEFINED__
-typedef interface IRichChunk IRichChunk;
-#endif 	/* __IRichChunk_FWD_DEFINED__ */
-
-
-#ifndef __IInterval_FWD_DEFINED__
-#define __IInterval_FWD_DEFINED__
-typedef interface IInterval IInterval;
-#endif 	/* __IInterval_FWD_DEFINED__ */
-
-
-#ifndef __IMetaData_FWD_DEFINED__
-#define __IMetaData_FWD_DEFINED__
-typedef interface IMetaData IMetaData;
-#endif 	/* __IMetaData_FWD_DEFINED__ */
-
-
-#ifndef __IEntity_FWD_DEFINED__
-#define __IEntity_FWD_DEFINED__
-typedef interface IEntity IEntity;
-#endif 	/* __IEntity_FWD_DEFINED__ */
-
-
-#ifndef __IRelationship_FWD_DEFINED__
-#define __IRelationship_FWD_DEFINED__
-typedef interface IRelationship IRelationship;
-#endif 	/* __IRelationship_FWD_DEFINED__ */
-
-
-#ifndef __INamedEntity_FWD_DEFINED__
-#define __INamedEntity_FWD_DEFINED__
-typedef interface INamedEntity INamedEntity;
-#endif 	/* __INamedEntity_FWD_DEFINED__ */
-
-
-#ifndef __ISchemaProvider_FWD_DEFINED__
-#define __ISchemaProvider_FWD_DEFINED__
-typedef interface ISchemaProvider ISchemaProvider;
-#endif 	/* __ISchemaProvider_FWD_DEFINED__ */
-
-
-#ifndef __ITokenCollection_FWD_DEFINED__
-#define __ITokenCollection_FWD_DEFINED__
-typedef interface ITokenCollection ITokenCollection;
-#endif 	/* __ITokenCollection_FWD_DEFINED__ */
-
-
-#ifndef __INamedEntityCollector_FWD_DEFINED__
-#define __INamedEntityCollector_FWD_DEFINED__
-typedef interface INamedEntityCollector INamedEntityCollector;
-#endif 	/* __INamedEntityCollector_FWD_DEFINED__ */
-
-
-#ifndef __ISchemaLocalizerSupport_FWD_DEFINED__
-#define __ISchemaLocalizerSupport_FWD_DEFINED__
-typedef interface ISchemaLocalizerSupport ISchemaLocalizerSupport;
-#endif 	/* __ISchemaLocalizerSupport_FWD_DEFINED__ */
-
-
-#ifndef __IQueryParserManager_FWD_DEFINED__
-#define __IQueryParserManager_FWD_DEFINED__
-typedef interface IQueryParserManager IQueryParserManager;
-#endif 	/* __IQueryParserManager_FWD_DEFINED__ */
-
-
-#ifndef __QueryParser_FWD_DEFINED__
-#define __QueryParser_FWD_DEFINED__
-
-#ifdef __cplusplus
-typedef class QueryParser QueryParser;
-#else
-typedef struct QueryParser QueryParser;
-#endif /* __cplusplus */
-
-#endif 	/* __QueryParser_FWD_DEFINED__ */
-
-
-#ifndef __NegationCondition_FWD_DEFINED__
-#define __NegationCondition_FWD_DEFINED__
-
-#ifdef __cplusplus
-typedef class NegationCondition NegationCondition;
-#else
-typedef struct NegationCondition NegationCondition;
-#endif /* __cplusplus */
-
-#endif 	/* __NegationCondition_FWD_DEFINED__ */
-
-
-#ifndef __CompoundCondition_FWD_DEFINED__
-#define __CompoundCondition_FWD_DEFINED__
-
-#ifdef __cplusplus
-typedef class CompoundCondition CompoundCondition;
-#else
-typedef struct CompoundCondition CompoundCondition;
-#endif /* __cplusplus */
-
-#endif 	/* __CompoundCondition_FWD_DEFINED__ */
-
-
-#ifndef __LeafCondition_FWD_DEFINED__
-#define __LeafCondition_FWD_DEFINED__
-
-#ifdef __cplusplus
-typedef class LeafCondition LeafCondition;
-#else
-typedef struct LeafCondition LeafCondition;
-#endif /* __cplusplus */
-
-#endif 	/* __LeafCondition_FWD_DEFINED__ */
-
-
-#ifndef __ConditionFactory_FWD_DEFINED__
-#define __ConditionFactory_FWD_DEFINED__
-
-#ifdef __cplusplus
-typedef class ConditionFactory ConditionFactory;
-#else
-typedef struct ConditionFactory ConditionFactory;
-#endif /* __cplusplus */
-
-#endif 	/* __ConditionFactory_FWD_DEFINED__ */
-
-
-#ifndef __Interval_FWD_DEFINED__
-#define __Interval_FWD_DEFINED__
-
-#ifdef __cplusplus
-typedef class Interval Interval;
-#else
-typedef struct Interval Interval;
-#endif /* __cplusplus */
-
-#endif 	/* __Interval_FWD_DEFINED__ */
-
-
-#ifndef __QueryParserManager_FWD_DEFINED__
-#define __QueryParserManager_FWD_DEFINED__
-
-#ifdef __cplusplus
-typedef class QueryParserManager QueryParserManager;
-#else
-typedef struct QueryParserManager QueryParserManager;
-#endif /* __cplusplus */
-
-#endif 	/* __QueryParserManager_FWD_DEFINED__ */
-
-
-/* header files for imported files */
-#include "oaidl.h"
-#include "ocidl.h"
-#include "propidl.h"
-
-#ifdef __cplusplus
-extern "C"{
-#endif 
-
-
-/* interface __MIDL_itf_structuredquery_0000_0000 */
-/* [local] */ 
-
-
-
-
-
-
-
-
-
-
-
-typedef /* [v1_enum] */ 
-enum tagCONDITION_TYPE
-    {	CT_AND_CONDITION	= 0,
-	CT_OR_CONDITION	= ( CT_AND_CONDITION + 1 ) ,
-	CT_NOT_CONDITION	= ( CT_OR_CONDITION + 1 ) ,
-	CT_LEAF_CONDITION	= ( CT_NOT_CONDITION + 1 ) 
-    } 	CONDITION_TYPE;
-
-typedef /* [v1_enum] */ 
-enum tagCONDITION_OPERATION
-    {	COP_IMPLICIT	= 0,
-	COP_EQUAL	= ( COP_IMPLICIT + 1 ) ,
-	COP_NOTEQUAL	= ( COP_EQUAL + 1 ) ,
-	COP_LESSTHAN	= ( COP_NOTEQUAL + 1 ) ,
-	COP_GREATERTHAN	= ( COP_LESSTHAN + 1 ) ,
-	COP_LESSTHANOREQUAL	= ( COP_GREATERTHAN + 1 ) ,
-	COP_GREATERTHANOREQUAL	= ( COP_LESSTHANOREQUAL + 1 ) ,
-	COP_VALUE_STARTSWITH	= ( COP_GREATERTHANOREQUAL + 1 ) ,
-	COP_VALUE_ENDSWITH	= ( COP_VALUE_STARTSWITH + 1 ) ,
-	COP_VALUE_CONTAINS	= ( COP_VALUE_ENDSWITH + 1 ) ,
-	COP_VALUE_NOTCONTAINS	= ( COP_VALUE_CONTAINS + 1 ) ,
-	COP_DOSWILDCARDS	= ( COP_VALUE_NOTCONTAINS + 1 ) ,
-	COP_WORD_EQUAL	= ( COP_DOSWILDCARDS + 1 ) ,
-	COP_WORD_STARTSWITH	= ( COP_WORD_EQUAL + 1 ) ,
-	COP_APPLICATION_SPECIFIC	= ( COP_WORD_STARTSWITH + 1 ) 
-    } 	CONDITION_OPERATION;
-
-typedef /* [v1_enum] */ 
-enum tagSTRUCTURED_QUERY_SINGLE_OPTION
-    {	SQSO_SCHEMA	= 0,
-	SQSO_LOCALE_WORD_BREAKING	= ( SQSO_SCHEMA + 1 ) ,
-	SQSO_WORD_BREAKER	= ( SQSO_LOCALE_WORD_BREAKING + 1 ) ,
-	SQSO_NATURAL_SYNTAX	= ( SQSO_WORD_BREAKER + 1 ) ,
-	SQSO_AUTOMATIC_WILDCARD	= ( SQSO_NATURAL_SYNTAX + 1 ) ,
-	SQSO_TRACE_LEVEL	= ( SQSO_AUTOMATIC_WILDCARD + 1 ) ,
-	SQSO_LANGUAGE_KEYWORDS	= ( SQSO_TRACE_LEVEL + 1 ) 
-    } 	STRUCTURED_QUERY_SINGLE_OPTION;
-
-typedef /* [v1_enum] */ 
-enum tagSTRUCTURED_QUERY_MULTIOPTION
-    {	SQMO_VIRTUAL_PROPERTY	= 0,
-	SQMO_DEFAULT_PROPERTY	= ( SQMO_VIRTUAL_PROPERTY + 1 ) ,
-	SQMO_GENERATOR_FOR_TYPE	= ( SQMO_DEFAULT_PROPERTY + 1 ) 
-    } 	STRUCTURED_QUERY_MULTIOPTION;
-
-typedef /* [v1_enum] */ 
-enum tagSTRUCTURED_QUERY_PARSE_ERROR
-    {	SQPE_NONE	= 0,
-	SQPE_EXTRA_OPENING_PARENTHESIS	= ( SQPE_NONE + 1 ) ,
-	SQPE_EXTRA_CLOSING_PARENTHESIS	= ( SQPE_EXTRA_OPENING_PARENTHESIS + 1 ) ,
-	SQPE_IGNORED_MODIFIER	= ( SQPE_EXTRA_CLOSING_PARENTHESIS + 1 ) ,
-	SQPE_IGNORED_CONNECTOR	= ( SQPE_IGNORED_MODIFIER + 1 ) ,
-	SQPE_IGNORED_KEYWORD	= ( SQPE_IGNORED_CONNECTOR + 1 ) ,
-	SQPE_UNHANDLED	= ( SQPE_IGNORED_KEYWORD + 1 ) 
-    } 	STRUCTURED_QUERY_PARSE_ERROR;
-
-/* [v1_enum] */ 
-enum tagSTRUCTURED_QUERY_RESOLVE_OPTION
-    {	SQRO_DONT_RESOLVE_DATETIME	= 0x1,
-	SQRO_ALWAYS_ONE_INTERVAL	= 0x2,
-	SQRO_DONT_SIMPLIFY_CONDITION_TREES	= 0x4,
-	SQRO_DONT_MAP_RELATIONS	= 0x8,
-	SQRO_DONT_RESOLVE_RANGES	= 0x10,
-	SQRO_DONT_REMOVE_UNRESTRICTED_KEYWORDS	= 0x20,
-	SQRO_DONT_SPLIT_WORDS	= 0x40,
-	SQRO_IGNORE_PHRASE_ORDER	= 0x80
-    } ;
-typedef int STRUCTURED_QUERY_RESOLVE_OPTION;
-
-typedef /* [v1_enum] */ 
-enum tagINTERVAL_LIMIT_KIND
-    {	ILK_EXPLICIT_INCLUDED	= 0,
-	ILK_EXPLICIT_EXCLUDED	= ( ILK_EXPLICIT_INCLUDED + 1 ) ,
-	ILK_NEGATIVE_INFINITY	= ( ILK_EXPLICIT_EXCLUDED + 1 ) ,
-	ILK_POSITIVE_INFINITY	= ( ILK_NEGATIVE_INFINITY + 1 ) 
-    } 	INTERVAL_LIMIT_KIND;
-
-typedef /* [v1_enum] */ 
-enum tagQUERY_PARSER_MANAGER_OPTION
-    {	QPMO_SCHEMA_BINARY_NAME	= 0,
-	QPMO_PRELOCALIZED_SCHEMA_BINARY_PATH	= ( QPMO_SCHEMA_BINARY_NAME + 1 ) ,
-	QPMO_UNLOCALIZED_SCHEMA_BINARY_PATH	= ( QPMO_PRELOCALIZED_SCHEMA_BINARY_PATH + 1 ) ,
-	QPMO_LOCALIZED_SCHEMA_BINARY_PATH	= ( QPMO_UNLOCALIZED_SCHEMA_BINARY_PATH + 1 ) ,
-	QPMO_APPEND_LCID_TO_LOCALIZED_PATH	= ( QPMO_LOCALIZED_SCHEMA_BINARY_PATH + 1 ) ,
-	QPMO_LOCALIZER_SUPPORT	= ( QPMO_APPEND_LCID_TO_LOCALIZED_PATH + 1 ) 
-    } 	QUERY_PARSER_MANAGER_OPTION;
-
-
-
-extern RPC_IF_HANDLE __MIDL_itf_structuredquery_0000_0000_v0_0_c_ifspec;
-extern RPC_IF_HANDLE __MIDL_itf_structuredquery_0000_0000_v0_0_s_ifspec;
-
-#ifndef __IQueryParser_INTERFACE_DEFINED__
-#define __IQueryParser_INTERFACE_DEFINED__
-
-/* interface IQueryParser */
-/* [unique][uuid][object] */ 
-
-
-EXTERN_C const IID IID_IQueryParser;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("2EBDEE67-3505-43f8-9946-EA44ABC8E5B0")
-    IQueryParser : public IUnknown
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE Parse( 
-            /* [in] */ __RPC__in LPCWSTR pszInputString,
-            /* [in] */ __RPC__in_opt IEnumUnknown *pCustomProperties,
-            /* [retval][out] */ __RPC__deref_out_opt IQuerySolution **ppSolution) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE SetOption( 
-            /* [in] */ STRUCTURED_QUERY_SINGLE_OPTION option,
-            /* [in] */ __RPC__in const PROPVARIANT *pOptionValue) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetOption( 
-            /* [in] */ STRUCTURED_QUERY_SINGLE_OPTION option,
-            /* [retval][out] */ __RPC__out PROPVARIANT *pOptionValue) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE SetMultiOption( 
-            /* [in] */ STRUCTURED_QUERY_MULTIOPTION option,
-            /* [in] */ __RPC__in LPCWSTR pszOptionKey,
-            /* [in] */ __RPC__in const PROPVARIANT *pOptionValue) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetSchemaProvider( 
-            /* [retval][out] */ __RPC__deref_out_opt ISchemaProvider **ppSchemaProvider) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE RestateToString( 
-            /* [in] */ __RPC__in_opt ICondition *pCondition,
-            /* [in] */ BOOL fUseEnglish,
-            /* [out] */ __RPC__deref_out_opt LPWSTR *ppszQueryString) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE ParsePropertyValue( 
-            /* [in] */ __RPC__in LPCWSTR pszPropertyName,
-            /* [in] */ __RPC__in LPCWSTR pszInputString,
-            /* [retval][out] */ __RPC__deref_out_opt IQuerySolution **ppSolution) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE RestatePropertyValueToString( 
-            /* [in] */ __RPC__in_opt ICondition *pCondition,
-            /* [in] */ BOOL fUseEnglish,
-            /* [out] */ __RPC__deref_out_opt LPWSTR *ppszPropertyName,
-            /* [out] */ __RPC__deref_out_opt LPWSTR *ppszQueryString) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IQueryParserVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IQueryParser * This,
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IQueryParser * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IQueryParser * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *Parse )( 
-            IQueryParser * This,
-            /* [in] */ __RPC__in LPCWSTR pszInputString,
-            /* [in] */ __RPC__in_opt IEnumUnknown *pCustomProperties,
-            /* [retval][out] */ __RPC__deref_out_opt IQuerySolution **ppSolution);
-        
-        HRESULT ( STDMETHODCALLTYPE *SetOption )( 
-            IQueryParser * This,
-            /* [in] */ STRUCTURED_QUERY_SINGLE_OPTION option,
-            /* [in] */ __RPC__in const PROPVARIANT *pOptionValue);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetOption )( 
-            IQueryParser * This,
-            /* [in] */ STRUCTURED_QUERY_SINGLE_OPTION option,
-            /* [retval][out] */ __RPC__out PROPVARIANT *pOptionValue);
-        
-        HRESULT ( STDMETHODCALLTYPE *SetMultiOption )( 
-            IQueryParser * This,
-            /* [in] */ STRUCTURED_QUERY_MULTIOPTION option,
-            /* [in] */ __RPC__in LPCWSTR pszOptionKey,
-            /* [in] */ __RPC__in const PROPVARIANT *pOptionValue);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetSchemaProvider )( 
-            IQueryParser * This,
-            /* [retval][out] */ __RPC__deref_out_opt ISchemaProvider **ppSchemaProvider);
-        
-        HRESULT ( STDMETHODCALLTYPE *RestateToString )( 
-            IQueryParser * This,
-            /* [in] */ __RPC__in_opt ICondition *pCondition,
-            /* [in] */ BOOL fUseEnglish,
-            /* [out] */ __RPC__deref_out_opt LPWSTR *ppszQueryString);
-        
-        HRESULT ( STDMETHODCALLTYPE *ParsePropertyValue )( 
-            IQueryParser * This,
-            /* [in] */ __RPC__in LPCWSTR pszPropertyName,
-            /* [in] */ __RPC__in LPCWSTR pszInputString,
-            /* [retval][out] */ __RPC__deref_out_opt IQuerySolution **ppSolution);
-        
-        HRESULT ( STDMETHODCALLTYPE *RestatePropertyValueToString )( 
-            IQueryParser * This,
-            /* [in] */ __RPC__in_opt ICondition *pCondition,
-            /* [in] */ BOOL fUseEnglish,
-            /* [out] */ __RPC__deref_out_opt LPWSTR *ppszPropertyName,
-            /* [out] */ __RPC__deref_out_opt LPWSTR *ppszQueryString);
-        
-        END_INTERFACE
-    } IQueryParserVtbl;
-
-    interface IQueryParser
-    {
-        CONST_VTBL struct IQueryParserVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IQueryParser_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IQueryParser_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IQueryParser_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IQueryParser_Parse(This,pszInputString,pCustomProperties,ppSolution)	\
-    ( (This)->lpVtbl -> Parse(This,pszInputString,pCustomProperties,ppSolution) ) 
-
-#define IQueryParser_SetOption(This,option,pOptionValue)	\
-    ( (This)->lpVtbl -> SetOption(This,option,pOptionValue) ) 
-
-#define IQueryParser_GetOption(This,option,pOptionValue)	\
-    ( (This)->lpVtbl -> GetOption(This,option,pOptionValue) ) 
-
-#define IQueryParser_SetMultiOption(This,option,pszOptionKey,pOptionValue)	\
-    ( (This)->lpVtbl -> SetMultiOption(This,option,pszOptionKey,pOptionValue) ) 
-
-#define IQueryParser_GetSchemaProvider(This,ppSchemaProvider)	\
-    ( (This)->lpVtbl -> GetSchemaProvider(This,ppSchemaProvider) ) 
-
-#define IQueryParser_RestateToString(This,pCondition,fUseEnglish,ppszQueryString)	\
-    ( (This)->lpVtbl -> RestateToString(This,pCondition,fUseEnglish,ppszQueryString) ) 
-
-#define IQueryParser_ParsePropertyValue(This,pszPropertyName,pszInputString,ppSolution)	\
-    ( (This)->lpVtbl -> ParsePropertyValue(This,pszPropertyName,pszInputString,ppSolution) ) 
-
-#define IQueryParser_RestatePropertyValueToString(This,pCondition,fUseEnglish,ppszPropertyName,ppszQueryString)	\
-    ( (This)->lpVtbl -> RestatePropertyValueToString(This,pCondition,fUseEnglish,ppszPropertyName,ppszQueryString) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IQueryParser_INTERFACE_DEFINED__ */
-
-
-#ifndef __IConditionFactory_INTERFACE_DEFINED__
-#define __IConditionFactory_INTERFACE_DEFINED__
-
-/* interface IConditionFactory */
-/* [unique][uuid][object] */ 
-
-
-EXTERN_C const IID IID_IConditionFactory;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("A5EFE073-B16F-474f-9F3E-9F8B497A3E08")
-    IConditionFactory : public IUnknown
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE MakeNot( 
-            /* [in] */ __RPC__in_opt ICondition *pSubCondition,
-            /* [in] */ BOOL simplify,
-            /* [retval][out] */ __RPC__deref_out_opt ICondition **ppResultQuery) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE MakeAndOr( 
-            /* [in] */ CONDITION_TYPE nodeType,
-            /* [in] */ __RPC__in_opt IEnumUnknown *pSubConditions,
-            /* [in] */ BOOL simplify,
-            /* [retval][out] */ __RPC__deref_out_opt ICondition **ppResultQuery) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE MakeLeaf( 
-            /* [unique][in] */ __RPC__in_opt LPCWSTR pszPropertyName,
-            /* [in] */ CONDITION_OPERATION op,
-            /* [unique][in] */ __RPC__in_opt LPCWSTR pszValueType,
-            /* [in] */ __RPC__in const PROPVARIANT *pValue,
-            /* [in] */ __RPC__in_opt IRichChunk *pPropertyNameTerm,
-            /* [in] */ __RPC__in_opt IRichChunk *pOperationTerm,
-            /* [in] */ __RPC__in_opt IRichChunk *pValueTerm,
-            /* [in] */ BOOL expand,
-            /* [retval][out] */ __RPC__deref_out_opt ICondition **ppResultQuery) = 0;
-        
-        virtual /* [local] */ HRESULT STDMETHODCALLTYPE Resolve( 
-            /* [in] */ 
-            __in  ICondition *pConditionTree,
-            /* [in] */ 
-            __in  STRUCTURED_QUERY_RESOLVE_OPTION sqro,
-            /* [ref][in] */ 
-            __in_opt  const SYSTEMTIME *pstReferenceTime,
-            /* [retval][out] */ 
-            __out  ICondition **ppResolvedConditionTree) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IConditionFactoryVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IConditionFactory * This,
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IConditionFactory * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IConditionFactory * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *MakeNot )( 
-            IConditionFactory * This,
-            /* [in] */ __RPC__in_opt ICondition *pSubCondition,
-            /* [in] */ BOOL simplify,
-            /* [retval][out] */ __RPC__deref_out_opt ICondition **ppResultQuery);
-        
-        HRESULT ( STDMETHODCALLTYPE *MakeAndOr )( 
-            IConditionFactory * This,
-            /* [in] */ CONDITION_TYPE nodeType,
-            /* [in] */ __RPC__in_opt IEnumUnknown *pSubConditions,
-            /* [in] */ BOOL simplify,
-            /* [retval][out] */ __RPC__deref_out_opt ICondition **ppResultQuery);
-        
-        HRESULT ( STDMETHODCALLTYPE *MakeLeaf )( 
-            IConditionFactory * This,
-            /* [unique][in] */ __RPC__in_opt LPCWSTR pszPropertyName,
-            /* [in] */ CONDITION_OPERATION op,
-            /* [unique][in] */ __RPC__in_opt LPCWSTR pszValueType,
-            /* [in] */ __RPC__in const PROPVARIANT *pValue,
-            /* [in] */ __RPC__in_opt IRichChunk *pPropertyNameTerm,
-            /* [in] */ __RPC__in_opt IRichChunk *pOperationTerm,
-            /* [in] */ __RPC__in_opt IRichChunk *pValueTerm,
-            /* [in] */ BOOL expand,
-            /* [retval][out] */ __RPC__deref_out_opt ICondition **ppResultQuery);
-        
-        /* [local] */ HRESULT ( STDMETHODCALLTYPE *Resolve )( 
-            IConditionFactory * This,
-            /* [in] */ 
-            __in  ICondition *pConditionTree,
-            /* [in] */ 
-            __in  STRUCTURED_QUERY_RESOLVE_OPTION sqro,
-            /* [ref][in] */ 
-            __in_opt  const SYSTEMTIME *pstReferenceTime,
-            /* [retval][out] */ 
-            __out  ICondition **ppResolvedConditionTree);
-        
-        END_INTERFACE
-    } IConditionFactoryVtbl;
-
-    interface IConditionFactory
-    {
-        CONST_VTBL struct IConditionFactoryVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IConditionFactory_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IConditionFactory_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IConditionFactory_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IConditionFactory_MakeNot(This,pSubCondition,simplify,ppResultQuery)	\
-    ( (This)->lpVtbl -> MakeNot(This,pSubCondition,simplify,ppResultQuery) ) 
-
-#define IConditionFactory_MakeAndOr(This,nodeType,pSubConditions,simplify,ppResultQuery)	\
-    ( (This)->lpVtbl -> MakeAndOr(This,nodeType,pSubConditions,simplify,ppResultQuery) ) 
-
-#define IConditionFactory_MakeLeaf(This,pszPropertyName,op,pszValueType,pValue,pPropertyNameTerm,pOperationTerm,pValueTerm,expand,ppResultQuery)	\
-    ( (This)->lpVtbl -> MakeLeaf(This,pszPropertyName,op,pszValueType,pValue,pPropertyNameTerm,pOperationTerm,pValueTerm,expand,ppResultQuery) ) 
-
-#define IConditionFactory_Resolve(This,pConditionTree,sqro,pstReferenceTime,ppResolvedConditionTree)	\
-    ( (This)->lpVtbl -> Resolve(This,pConditionTree,sqro,pstReferenceTime,ppResolvedConditionTree) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IConditionFactory_INTERFACE_DEFINED__ */
-
-
-#ifndef __IQuerySolution_INTERFACE_DEFINED__
-#define __IQuerySolution_INTERFACE_DEFINED__
-
-/* interface IQuerySolution */
-/* [unique][uuid][object] */ 
-
-
-EXTERN_C const IID IID_IQuerySolution;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("D6EBC66B-8921-4193-AFDD-A1789FB7FF57")
-    IQuerySolution : public IConditionFactory
-    {
-    public:
-        virtual /* [local] */ HRESULT STDMETHODCALLTYPE GetQuery( 
-            /* [out] */ 
-            __out_opt  ICondition **ppQueryNode,
-            /* [out] */ 
-            __out_opt  IEntity **ppMainType) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetErrors( 
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][retval][out] */ __RPC__deref_out_opt void **ppParseErrors) = 0;
-        
-        virtual /* [local] */ HRESULT STDMETHODCALLTYPE GetLexicalData( 
-            /* [out] */ 
-            __deref_opt_out  LPWSTR *ppszInputString,
-            /* [out] */ 
-            __out_opt  ITokenCollection **ppTokens,
-            /* [out] */ 
-            __out_opt  LCID *pLocale,
-            /* [out] */ 
-            __out_opt  IUnknown **ppWordBreaker) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IQuerySolutionVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IQuerySolution * This,
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IQuerySolution * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IQuerySolution * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *MakeNot )( 
-            IQuerySolution * This,
-            /* [in] */ __RPC__in_opt ICondition *pSubCondition,
-            /* [in] */ BOOL simplify,
-            /* [retval][out] */ __RPC__deref_out_opt ICondition **ppResultQuery);
-        
-        HRESULT ( STDMETHODCALLTYPE *MakeAndOr )( 
-            IQuerySolution * This,
-            /* [in] */ CONDITION_TYPE nodeType,
-            /* [in] */ __RPC__in_opt IEnumUnknown *pSubConditions,
-            /* [in] */ BOOL simplify,
-            /* [retval][out] */ __RPC__deref_out_opt ICondition **ppResultQuery);
-        
-        HRESULT ( STDMETHODCALLTYPE *MakeLeaf )( 
-            IQuerySolution * This,
-            /* [unique][in] */ __RPC__in_opt LPCWSTR pszPropertyName,
-            /* [in] */ CONDITION_OPERATION op,
-            /* [unique][in] */ __RPC__in_opt LPCWSTR pszValueType,
-            /* [in] */ __RPC__in const PROPVARIANT *pValue,
-            /* [in] */ __RPC__in_opt IRichChunk *pPropertyNameTerm,
-            /* [in] */ __RPC__in_opt IRichChunk *pOperationTerm,
-            /* [in] */ __RPC__in_opt IRichChunk *pValueTerm,
-            /* [in] */ BOOL expand,
-            /* [retval][out] */ __RPC__deref_out_opt ICondition **ppResultQuery);
-        
-        /* [local] */ HRESULT ( STDMETHODCALLTYPE *Resolve )( 
-            IQuerySolution * This,
-            /* [in] */ 
-            __in  ICondition *pConditionTree,
-            /* [in] */ 
-            __in  STRUCTURED_QUERY_RESOLVE_OPTION sqro,
-            /* [ref][in] */ 
-            __in_opt  const SYSTEMTIME *pstReferenceTime,
-            /* [retval][out] */ 
-            __out  ICondition **ppResolvedConditionTree);
-        
-        /* [local] */ HRESULT ( STDMETHODCALLTYPE *GetQuery )( 
-            IQuerySolution * This,
-            /* [out] */ 
-            __out_opt  ICondition **ppQueryNode,
-            /* [out] */ 
-            __out_opt  IEntity **ppMainType);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetErrors )( 
-            IQuerySolution * This,
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][retval][out] */ __RPC__deref_out_opt void **ppParseErrors);
-        
-        /* [local] */ HRESULT ( STDMETHODCALLTYPE *GetLexicalData )( 
-            IQuerySolution * This,
-            /* [out] */ 
-            __deref_opt_out  LPWSTR *ppszInputString,
-            /* [out] */ 
-            __out_opt  ITokenCollection **ppTokens,
-            /* [out] */ 
-            __out_opt  LCID *pLocale,
-            /* [out] */ 
-            __out_opt  IUnknown **ppWordBreaker);
-        
-        END_INTERFACE
-    } IQuerySolutionVtbl;
-
-    interface IQuerySolution
-    {
-        CONST_VTBL struct IQuerySolutionVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IQuerySolution_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IQuerySolution_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IQuerySolution_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IQuerySolution_MakeNot(This,pSubCondition,simplify,ppResultQuery)	\
-    ( (This)->lpVtbl -> MakeNot(This,pSubCondition,simplify,ppResultQuery) ) 
-
-#define IQuerySolution_MakeAndOr(This,nodeType,pSubConditions,simplify,ppResultQuery)	\
-    ( (This)->lpVtbl -> MakeAndOr(This,nodeType,pSubConditions,simplify,ppResultQuery) ) 
-
-#define IQuerySolution_MakeLeaf(This,pszPropertyName,op,pszValueType,pValue,pPropertyNameTerm,pOperationTerm,pValueTerm,expand,ppResultQuery)	\
-    ( (This)->lpVtbl -> MakeLeaf(This,pszPropertyName,op,pszValueType,pValue,pPropertyNameTerm,pOperationTerm,pValueTerm,expand,ppResultQuery) ) 
-
-#define IQuerySolution_Resolve(This,pConditionTree,sqro,pstReferenceTime,ppResolvedConditionTree)	\
-    ( (This)->lpVtbl -> Resolve(This,pConditionTree,sqro,pstReferenceTime,ppResolvedConditionTree) ) 
-
-
-#define IQuerySolution_GetQuery(This,ppQueryNode,ppMainType)	\
-    ( (This)->lpVtbl -> GetQuery(This,ppQueryNode,ppMainType) ) 
-
-#define IQuerySolution_GetErrors(This,riid,ppParseErrors)	\
-    ( (This)->lpVtbl -> GetErrors(This,riid,ppParseErrors) ) 
-
-#define IQuerySolution_GetLexicalData(This,ppszInputString,ppTokens,pLocale,ppWordBreaker)	\
-    ( (This)->lpVtbl -> GetLexicalData(This,ppszInputString,ppTokens,pLocale,ppWordBreaker) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IQuerySolution_INTERFACE_DEFINED__ */
-
-
-#ifndef __ICondition_INTERFACE_DEFINED__
-#define __ICondition_INTERFACE_DEFINED__
-
-/* interface ICondition */
-/* [unique][uuid][object] */ 
-
-
-EXTERN_C const IID IID_ICondition;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("0FC988D4-C935-4b97-A973-46282EA175C8")
-    ICondition : public IPersistStream
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE GetConditionType( 
-            /* [retval][out] */ __RPC__out CONDITION_TYPE *pNodeType) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetSubConditions( 
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][retval][out] */ __RPC__deref_out_opt void **ppv) = 0;
-        
-        virtual /* [local] */ HRESULT STDMETHODCALLTYPE GetComparisonInfo( 
-            /* [out] */ 
-            __deref_opt_out  LPWSTR *ppszPropertyName,
-            /* [out] */ 
-            __out_opt  CONDITION_OPERATION *pOperation,
-            /* [out] */ 
-            __out_opt  PROPVARIANT *pValue) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetValueType( 
-            /* [retval][out] */ __RPC__deref_out_opt LPWSTR *ppszValueTypeName) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetValueNormalization( 
-            /* [retval][out] */ __RPC__deref_out_opt LPWSTR *ppszNormalization) = 0;
-        
-        virtual /* [local] */ HRESULT STDMETHODCALLTYPE GetInputTerms( 
-            /* [out] */ 
-            __out_opt  IRichChunk **ppPropertyTerm,
-            /* [out] */ 
-            __out_opt  IRichChunk **ppOperationTerm,
-            /* [out] */ 
-            __out_opt  IRichChunk **ppValueTerm) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE Clone( 
-            /* [retval][out] */ __RPC__deref_out_opt ICondition **ppc) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IConditionVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            ICondition * This,
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            ICondition * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            ICondition * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetClassID )( 
-            ICondition * This,
-            /* [out] */ __RPC__out CLSID *pClassID);
-        
-        HRESULT ( STDMETHODCALLTYPE *IsDirty )( 
-            ICondition * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *Load )( 
-            ICondition * This,
-            /* [unique][in] */ __RPC__in_opt IStream *pStm);
-        
-        HRESULT ( STDMETHODCALLTYPE *Save )( 
-            ICondition * This,
-            /* [unique][in] */ __RPC__in_opt IStream *pStm,
-            /* [in] */ BOOL fClearDirty);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetSizeMax )( 
-            ICondition * This,
-            /* [out] */ __RPC__out ULARGE_INTEGER *pcbSize);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetConditionType )( 
-            ICondition * This,
-            /* [retval][out] */ __RPC__out CONDITION_TYPE *pNodeType);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetSubConditions )( 
-            ICondition * This,
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][retval][out] */ __RPC__deref_out_opt void **ppv);
-        
-        /* [local] */ HRESULT ( STDMETHODCALLTYPE *GetComparisonInfo )( 
-            ICondition * This,
-            /* [out] */ 
-            __deref_opt_out  LPWSTR *ppszPropertyName,
-            /* [out] */ 
-            __out_opt  CONDITION_OPERATION *pOperation,
-            /* [out] */ 
-            __out_opt  PROPVARIANT *pValue);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetValueType )( 
-            ICondition * This,
-            /* [retval][out] */ __RPC__deref_out_opt LPWSTR *ppszValueTypeName);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetValueNormalization )( 
-            ICondition * This,
-            /* [retval][out] */ __RPC__deref_out_opt LPWSTR *ppszNormalization);
-        
-        /* [local] */ HRESULT ( STDMETHODCALLTYPE *GetInputTerms )( 
-            ICondition * This,
-            /* [out] */ 
-            __out_opt  IRichChunk **ppPropertyTerm,
-            /* [out] */ 
-            __out_opt  IRichChunk **ppOperationTerm,
-            /* [out] */ 
-            __out_opt  IRichChunk **ppValueTerm);
-        
-        HRESULT ( STDMETHODCALLTYPE *Clone )( 
-            ICondition * This,
-            /* [retval][out] */ __RPC__deref_out_opt ICondition **ppc);
-        
-        END_INTERFACE
-    } IConditionVtbl;
-
-    interface ICondition
-    {
-        CONST_VTBL struct IConditionVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define ICondition_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define ICondition_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define ICondition_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define ICondition_GetClassID(This,pClassID)	\
-    ( (This)->lpVtbl -> GetClassID(This,pClassID) ) 
-
-
-#define ICondition_IsDirty(This)	\
-    ( (This)->lpVtbl -> IsDirty(This) ) 
-
-#define ICondition_Load(This,pStm)	\
-    ( (This)->lpVtbl -> Load(This,pStm) ) 
-
-#define ICondition_Save(This,pStm,fClearDirty)	\
-    ( (This)->lpVtbl -> Save(This,pStm,fClearDirty) ) 
-
-#define ICondition_GetSizeMax(This,pcbSize)	\
-    ( (This)->lpVtbl -> GetSizeMax(This,pcbSize) ) 
-
-
-#define ICondition_GetConditionType(This,pNodeType)	\
-    ( (This)->lpVtbl -> GetConditionType(This,pNodeType) ) 
-
-#define ICondition_GetSubConditions(This,riid,ppv)	\
-    ( (This)->lpVtbl -> GetSubConditions(This,riid,ppv) ) 
-
-#define ICondition_GetComparisonInfo(This,ppszPropertyName,pOperation,pValue)	\
-    ( (This)->lpVtbl -> GetComparisonInfo(This,ppszPropertyName,pOperation,pValue) ) 
-
-#define ICondition_GetValueType(This,ppszValueTypeName)	\
-    ( (This)->lpVtbl -> GetValueType(This,ppszValueTypeName) ) 
-
-#define ICondition_GetValueNormalization(This,ppszNormalization)	\
-    ( (This)->lpVtbl -> GetValueNormalization(This,ppszNormalization) ) 
-
-#define ICondition_GetInputTerms(This,ppPropertyTerm,ppOperationTerm,ppValueTerm)	\
-    ( (This)->lpVtbl -> GetInputTerms(This,ppPropertyTerm,ppOperationTerm,ppValueTerm) ) 
-
-#define ICondition_Clone(This,ppc)	\
-    ( (This)->lpVtbl -> Clone(This,ppc) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __ICondition_INTERFACE_DEFINED__ */
-
-
-#ifndef __IConditionGenerator_INTERFACE_DEFINED__
-#define __IConditionGenerator_INTERFACE_DEFINED__
-
-/* interface IConditionGenerator */
-/* [unique][uuid][object] */ 
-
-
-EXTERN_C const IID IID_IConditionGenerator;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("92D2CC58-4386-45a3-B98C-7E0CE64A4117")
-    IConditionGenerator : public IUnknown
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE Initialize( 
-            /* [in] */ __RPC__in_opt ISchemaProvider *pSchemaProvider) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE RecognizeNamedEntities( 
-            /* [in] */ __RPC__in LPCWSTR pszInputString,
-            /* [in] */ LCID lcid,
-            /* [in] */ __RPC__in_opt ITokenCollection *pTokenCollection,
-            /* [out][in] */ __RPC__inout_opt INamedEntityCollector *pNamedEntities) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GenerateForLeaf( 
-            /* [in] */ __RPC__in_opt IConditionFactory *pConditionFactory,
-            /* [unique][in] */ __RPC__in_opt LPCWSTR pszPropertyName,
-            /* [in] */ CONDITION_OPERATION op,
-            /* [unique][in] */ __RPC__in_opt LPCWSTR pszValueType,
-            /* [in] */ __RPC__in LPCWSTR pszValue,
-            /* [unique][in] */ __RPC__in_opt LPCWSTR pszValue2,
-            /* [in] */ __RPC__in_opt IRichChunk *pPropertyNameTerm,
-            /* [in] */ __RPC__in_opt IRichChunk *pOperationTerm,
-            /* [in] */ __RPC__in_opt IRichChunk *pValueTerm,
-            /* [in] */ BOOL automaticWildcard,
-            /* [out] */ __RPC__out BOOL *pNoStringQuery,
-            /* [retval][out] */ __RPC__deref_out_opt ICondition **ppQueryExpression) = 0;
-        
-        virtual /* [local] */ HRESULT STDMETHODCALLTYPE DefaultPhrase( 
-            /* [unique][in] */ LPCWSTR pszValueType,
-            /* [in] */ const PROPVARIANT *ppropvar,
-            /* [in] */ BOOL fUseEnglish,
-            /* [retval][out] */ 
-            __deref_opt_out  LPWSTR *ppszPhrase) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IConditionGeneratorVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IConditionGenerator * This,
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IConditionGenerator * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IConditionGenerator * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *Initialize )( 
-            IConditionGenerator * This,
-            /* [in] */ __RPC__in_opt ISchemaProvider *pSchemaProvider);
-        
-        HRESULT ( STDMETHODCALLTYPE *RecognizeNamedEntities )( 
-            IConditionGenerator * This,
-            /* [in] */ __RPC__in LPCWSTR pszInputString,
-            /* [in] */ LCID lcid,
-            /* [in] */ __RPC__in_opt ITokenCollection *pTokenCollection,
-            /* [out][in] */ __RPC__inout_opt INamedEntityCollector *pNamedEntities);
-        
-        HRESULT ( STDMETHODCALLTYPE *GenerateForLeaf )( 
-            IConditionGenerator * This,
-            /* [in] */ __RPC__in_opt IConditionFactory *pConditionFactory,
-            /* [unique][in] */ __RPC__in_opt LPCWSTR pszPropertyName,
-            /* [in] */ CONDITION_OPERATION op,
-            /* [unique][in] */ __RPC__in_opt LPCWSTR pszValueType,
-            /* [in] */ __RPC__in LPCWSTR pszValue,
-            /* [unique][in] */ __RPC__in_opt LPCWSTR pszValue2,
-            /* [in] */ __RPC__in_opt IRichChunk *pPropertyNameTerm,
-            /* [in] */ __RPC__in_opt IRichChunk *pOperationTerm,
-            /* [in] */ __RPC__in_opt IRichChunk *pValueTerm,
-            /* [in] */ BOOL automaticWildcard,
-            /* [out] */ __RPC__out BOOL *pNoStringQuery,
-            /* [retval][out] */ __RPC__deref_out_opt ICondition **ppQueryExpression);
-        
-        /* [local] */ HRESULT ( STDMETHODCALLTYPE *DefaultPhrase )( 
-            IConditionGenerator * This,
-            /* [unique][in] */ LPCWSTR pszValueType,
-            /* [in] */ const PROPVARIANT *ppropvar,
-            /* [in] */ BOOL fUseEnglish,
-            /* [retval][out] */ 
-            __deref_opt_out  LPWSTR *ppszPhrase);
-        
-        END_INTERFACE
-    } IConditionGeneratorVtbl;
-
-    interface IConditionGenerator
-    {
-        CONST_VTBL struct IConditionGeneratorVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IConditionGenerator_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IConditionGenerator_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IConditionGenerator_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IConditionGenerator_Initialize(This,pSchemaProvider)	\
-    ( (This)->lpVtbl -> Initialize(This,pSchemaProvider) ) 
-
-#define IConditionGenerator_RecognizeNamedEntities(This,pszInputString,lcid,pTokenCollection,pNamedEntities)	\
-    ( (This)->lpVtbl -> RecognizeNamedEntities(This,pszInputString,lcid,pTokenCollection,pNamedEntities) ) 
-
-#define IConditionGenerator_GenerateForLeaf(This,pConditionFactory,pszPropertyName,op,pszValueType,pszValue,pszValue2,pPropertyNameTerm,pOperationTerm,pValueTerm,automaticWildcard,pNoStringQuery,ppQueryExpression)	\
-    ( (This)->lpVtbl -> GenerateForLeaf(This,pConditionFactory,pszPropertyName,op,pszValueType,pszValue,pszValue2,pPropertyNameTerm,pOperationTerm,pValueTerm,automaticWildcard,pNoStringQuery,ppQueryExpression) ) 
-
-#define IConditionGenerator_DefaultPhrase(This,pszValueType,ppropvar,fUseEnglish,ppszPhrase)	\
-    ( (This)->lpVtbl -> DefaultPhrase(This,pszValueType,ppropvar,fUseEnglish,ppszPhrase) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IConditionGenerator_INTERFACE_DEFINED__ */
-
-
-#ifndef __IRichChunk_INTERFACE_DEFINED__
-#define __IRichChunk_INTERFACE_DEFINED__
-
-/* interface IRichChunk */
-/* [unique][uuid][object] */ 
-
-
-EXTERN_C const IID IID_IRichChunk;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("4FDEF69C-DBC9-454e-9910-B34F3C64B510")
-    IRichChunk : public IUnknown
-    {
-    public:
-        virtual /* [local] */ HRESULT STDMETHODCALLTYPE GetData( 
-            /* [out] */ 
-            __out_opt  ULONG *pFirstPos,
-            /* [out] */ 
-            __out_opt  ULONG *pLength,
-            /* [out] */ 
-            __deref_opt_out  LPWSTR *ppsz,
-            /* [out] */ 
-            __out_opt  PROPVARIANT *pValue) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IRichChunkVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IRichChunk * This,
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IRichChunk * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IRichChunk * This);
-        
-        /* [local] */ HRESULT ( STDMETHODCALLTYPE *GetData )( 
-            IRichChunk * This,
-            /* [out] */ 
-            __out_opt  ULONG *pFirstPos,
-            /* [out] */ 
-            __out_opt  ULONG *pLength,
-            /* [out] */ 
-            __deref_opt_out  LPWSTR *ppsz,
-            /* [out] */ 
-            __out_opt  PROPVARIANT *pValue);
-        
-        END_INTERFACE
-    } IRichChunkVtbl;
-
-    interface IRichChunk
-    {
-        CONST_VTBL struct IRichChunkVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IRichChunk_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IRichChunk_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IRichChunk_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IRichChunk_GetData(This,pFirstPos,pLength,ppsz,pValue)	\
-    ( (This)->lpVtbl -> GetData(This,pFirstPos,pLength,ppsz,pValue) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IRichChunk_INTERFACE_DEFINED__ */
-
-
-#ifndef __IInterval_INTERFACE_DEFINED__
-#define __IInterval_INTERFACE_DEFINED__
-
-/* interface IInterval */
-/* [unique][uuid][object] */ 
-
-
-EXTERN_C const IID IID_IInterval;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("6BF0A714-3C18-430b-8B5D-83B1C234D3DB")
-    IInterval : public IUnknown
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE GetLimits( 
-            /* [out] */ __RPC__out INTERVAL_LIMIT_KIND *pilkLower,
-            /* [out] */ __RPC__out PROPVARIANT *ppropvarLower,
-            /* [out] */ __RPC__out INTERVAL_LIMIT_KIND *pilkUpper,
-            /* [out] */ __RPC__out PROPVARIANT *ppropvarUpper) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IIntervalVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IInterval * This,
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IInterval * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IInterval * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetLimits )( 
-            IInterval * This,
-            /* [out] */ __RPC__out INTERVAL_LIMIT_KIND *pilkLower,
-            /* [out] */ __RPC__out PROPVARIANT *ppropvarLower,
-            /* [out] */ __RPC__out INTERVAL_LIMIT_KIND *pilkUpper,
-            /* [out] */ __RPC__out PROPVARIANT *ppropvarUpper);
-        
-        END_INTERFACE
-    } IIntervalVtbl;
-
-    interface IInterval
-    {
-        CONST_VTBL struct IIntervalVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IInterval_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IInterval_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IInterval_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IInterval_GetLimits(This,pilkLower,ppropvarLower,pilkUpper,ppropvarUpper)	\
-    ( (This)->lpVtbl -> GetLimits(This,pilkLower,ppropvarLower,pilkUpper,ppropvarUpper) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IInterval_INTERFACE_DEFINED__ */
-
-
-#ifndef __IMetaData_INTERFACE_DEFINED__
-#define __IMetaData_INTERFACE_DEFINED__
-
-/* interface IMetaData */
-/* [unique][uuid][object][helpstring] */ 
-
-
-EXTERN_C const IID IID_IMetaData;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("780102B0-C43B-4876-BC7B-5E9BA5C88794")
-    IMetaData : public IUnknown
-    {
-    public:
-        virtual /* [local] */ HRESULT STDMETHODCALLTYPE GetData( 
-            /* [out] */ 
-            __deref_opt_out  LPWSTR *ppszKey,
-            /* [out] */ 
-            __deref_opt_out  LPWSTR *ppszValue) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IMetaDataVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IMetaData * This,
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IMetaData * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IMetaData * This);
-        
-        /* [local] */ HRESULT ( STDMETHODCALLTYPE *GetData )( 
-            IMetaData * This,
-            /* [out] */ 
-            __deref_opt_out  LPWSTR *ppszKey,
-            /* [out] */ 
-            __deref_opt_out  LPWSTR *ppszValue);
-        
-        END_INTERFACE
-    } IMetaDataVtbl;
-
-    interface IMetaData
-    {
-        CONST_VTBL struct IMetaDataVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IMetaData_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IMetaData_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IMetaData_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IMetaData_GetData(This,ppszKey,ppszValue)	\
-    ( (This)->lpVtbl -> GetData(This,ppszKey,ppszValue) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IMetaData_INTERFACE_DEFINED__ */
-
-
-/* interface __MIDL_itf_structuredquery_0000_0008 */
-/* [local] */ 
-
-
-
-
-extern RPC_IF_HANDLE __MIDL_itf_structuredquery_0000_0008_v0_0_c_ifspec;
-extern RPC_IF_HANDLE __MIDL_itf_structuredquery_0000_0008_v0_0_s_ifspec;
-
-#ifndef __IEntity_INTERFACE_DEFINED__
-#define __IEntity_INTERFACE_DEFINED__
-
-/* interface IEntity */
-/* [unique][object][uuid][helpstring] */ 
-
-
-EXTERN_C const IID IID_IEntity;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("24264891-E80B-4fd3-B7CE-4FF2FAE8931F")
-    IEntity : public IUnknown
-    {
-    public:
-        virtual /* [local] */ HRESULT STDMETHODCALLTYPE Name( 
-            /* [retval][out] */ 
-            __deref_opt_out  LPWSTR *ppszName) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE Base( 
-            /* [retval][out] */ __RPC__deref_out_opt IEntity **pBaseEntity) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE Relationships( 
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][retval][out] */ __RPC__deref_out_opt void **pRelationships) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetRelationship( 
-            /* [in] */ __RPC__in LPCWSTR pszRelationName,
-            /* [retval][out] */ __RPC__deref_out_opt IRelationship **pRelationship) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE MetaData( 
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][retval][out] */ __RPC__deref_out_opt void **pMetaData) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE NamedEntities( 
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][retval][out] */ __RPC__deref_out_opt void **pNamedEntities) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetNamedEntity( 
-            /* [in] */ __RPC__in LPCWSTR pszValue,
-            /* [retval][out] */ __RPC__deref_out_opt INamedEntity **ppNamedEntity) = 0;
-        
-        virtual /* [local] */ HRESULT STDMETHODCALLTYPE DefaultPhrase( 
-            /* [retval][out] */ 
-            __deref_opt_out  LPWSTR *ppszPhrase) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IEntityVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IEntity * This,
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IEntity * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IEntity * This);
-        
-        /* [local] */ HRESULT ( STDMETHODCALLTYPE *Name )( 
-            IEntity * This,
-            /* [retval][out] */ 
-            __deref_opt_out  LPWSTR *ppszName);
-        
-        HRESULT ( STDMETHODCALLTYPE *Base )( 
-            IEntity * This,
-            /* [retval][out] */ __RPC__deref_out_opt IEntity **pBaseEntity);
-        
-        HRESULT ( STDMETHODCALLTYPE *Relationships )( 
-            IEntity * This,
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][retval][out] */ __RPC__deref_out_opt void **pRelationships);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetRelationship )( 
-            IEntity * This,
-            /* [in] */ __RPC__in LPCWSTR pszRelationName,
-            /* [retval][out] */ __RPC__deref_out_opt IRelationship **pRelationship);
-        
-        HRESULT ( STDMETHODCALLTYPE *MetaData )( 
-            IEntity * This,
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][retval][out] */ __RPC__deref_out_opt void **pMetaData);
-        
-        HRESULT ( STDMETHODCALLTYPE *NamedEntities )( 
-            IEntity * This,
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][retval][out] */ __RPC__deref_out_opt void **pNamedEntities);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetNamedEntity )( 
-            IEntity * This,
-            /* [in] */ __RPC__in LPCWSTR pszValue,
-            /* [retval][out] */ __RPC__deref_out_opt INamedEntity **ppNamedEntity);
-        
-        /* [local] */ HRESULT ( STDMETHODCALLTYPE *DefaultPhrase )( 
-            IEntity * This,
-            /* [retval][out] */ 
-            __deref_opt_out  LPWSTR *ppszPhrase);
-        
-        END_INTERFACE
-    } IEntityVtbl;
-
-    interface IEntity
-    {
-        CONST_VTBL struct IEntityVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IEntity_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IEntity_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IEntity_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IEntity_Name(This,ppszName)	\
-    ( (This)->lpVtbl -> Name(This,ppszName) ) 
-
-#define IEntity_Base(This,pBaseEntity)	\
-    ( (This)->lpVtbl -> Base(This,pBaseEntity) ) 
-
-#define IEntity_Relationships(This,riid,pRelationships)	\
-    ( (This)->lpVtbl -> Relationships(This,riid,pRelationships) ) 
-
-#define IEntity_GetRelationship(This,pszRelationName,pRelationship)	\
-    ( (This)->lpVtbl -> GetRelationship(This,pszRelationName,pRelationship) ) 
-
-#define IEntity_MetaData(This,riid,pMetaData)	\
-    ( (This)->lpVtbl -> MetaData(This,riid,pMetaData) ) 
-
-#define IEntity_NamedEntities(This,riid,pNamedEntities)	\
-    ( (This)->lpVtbl -> NamedEntities(This,riid,pNamedEntities) ) 
-
-#define IEntity_GetNamedEntity(This,pszValue,ppNamedEntity)	\
-    ( (This)->lpVtbl -> GetNamedEntity(This,pszValue,ppNamedEntity) ) 
-
-#define IEntity_DefaultPhrase(This,ppszPhrase)	\
-    ( (This)->lpVtbl -> DefaultPhrase(This,ppszPhrase) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IEntity_INTERFACE_DEFINED__ */
-
-
-#ifndef __IRelationship_INTERFACE_DEFINED__
-#define __IRelationship_INTERFACE_DEFINED__
-
-/* interface IRelationship */
-/* [unique][object][uuid][helpstring] */ 
-
-
-EXTERN_C const IID IID_IRelationship;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("2769280B-5108-498c-9C7F-A51239B63147")
-    IRelationship : public IUnknown
-    {
-    public:
-        virtual /* [local] */ HRESULT STDMETHODCALLTYPE Name( 
-            /* [retval][out] */ 
-            __deref_opt_out  LPWSTR *ppszName) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE IsReal( 
-            /* [retval][out] */ __RPC__out BOOL *pIsReal) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE Destination( 
-            /* [retval][out] */ __RPC__deref_out_opt IEntity **pDestinationEntity) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE MetaData( 
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][retval][out] */ __RPC__deref_out_opt void **pMetaData) = 0;
-        
-        virtual /* [local] */ HRESULT STDMETHODCALLTYPE DefaultPhrase( 
-            /* [retval][out] */ 
-            __deref_opt_out  LPWSTR *ppszPhrase) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IRelationshipVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IRelationship * This,
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IRelationship * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IRelationship * This);
-        
-        /* [local] */ HRESULT ( STDMETHODCALLTYPE *Name )( 
-            IRelationship * This,
-            /* [retval][out] */ 
-            __deref_opt_out  LPWSTR *ppszName);
-        
-        HRESULT ( STDMETHODCALLTYPE *IsReal )( 
-            IRelationship * This,
-            /* [retval][out] */ __RPC__out BOOL *pIsReal);
-        
-        HRESULT ( STDMETHODCALLTYPE *Destination )( 
-            IRelationship * This,
-            /* [retval][out] */ __RPC__deref_out_opt IEntity **pDestinationEntity);
-        
-        HRESULT ( STDMETHODCALLTYPE *MetaData )( 
-            IRelationship * This,
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][retval][out] */ __RPC__deref_out_opt void **pMetaData);
-        
-        /* [local] */ HRESULT ( STDMETHODCALLTYPE *DefaultPhrase )( 
-            IRelationship * This,
-            /* [retval][out] */ 
-            __deref_opt_out  LPWSTR *ppszPhrase);
-        
-        END_INTERFACE
-    } IRelationshipVtbl;
-
-    interface IRelationship
-    {
-        CONST_VTBL struct IRelationshipVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IRelationship_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IRelationship_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IRelationship_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IRelationship_Name(This,ppszName)	\
-    ( (This)->lpVtbl -> Name(This,ppszName) ) 
-
-#define IRelationship_IsReal(This,pIsReal)	\
-    ( (This)->lpVtbl -> IsReal(This,pIsReal) ) 
-
-#define IRelationship_Destination(This,pDestinationEntity)	\
-    ( (This)->lpVtbl -> Destination(This,pDestinationEntity) ) 
-
-#define IRelationship_MetaData(This,riid,pMetaData)	\
-    ( (This)->lpVtbl -> MetaData(This,riid,pMetaData) ) 
-
-#define IRelationship_DefaultPhrase(This,ppszPhrase)	\
-    ( (This)->lpVtbl -> DefaultPhrase(This,ppszPhrase) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IRelationship_INTERFACE_DEFINED__ */
-
-
-#ifndef __INamedEntity_INTERFACE_DEFINED__
-#define __INamedEntity_INTERFACE_DEFINED__
-
-/* interface INamedEntity */
-/* [unique][uuid][object][helpstring] */ 
-
-
-EXTERN_C const IID IID_INamedEntity;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("ABDBD0B1-7D54-49fb-AB5C-BFF4130004CD")
-    INamedEntity : public IUnknown
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE GetValue( 
-            /* [retval][out] */ __RPC__deref_out_opt LPWSTR *ppszValue) = 0;
-        
-        virtual /* [local] */ HRESULT STDMETHODCALLTYPE DefaultPhrase( 
-            /* [retval][out] */ 
-            __deref_opt_out  LPWSTR *ppszPhrase) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct INamedEntityVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            INamedEntity * This,
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            INamedEntity * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            INamedEntity * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetValue )( 
-            INamedEntity * This,
-            /* [retval][out] */ __RPC__deref_out_opt LPWSTR *ppszValue);
-        
-        /* [local] */ HRESULT ( STDMETHODCALLTYPE *DefaultPhrase )( 
-            INamedEntity * This,
-            /* [retval][out] */ 
-            __deref_opt_out  LPWSTR *ppszPhrase);
-        
-        END_INTERFACE
-    } INamedEntityVtbl;
-
-    interface INamedEntity
-    {
-        CONST_VTBL struct INamedEntityVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define INamedEntity_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define INamedEntity_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define INamedEntity_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define INamedEntity_GetValue(This,ppszValue)	\
-    ( (This)->lpVtbl -> GetValue(This,ppszValue) ) 
-
-#define INamedEntity_DefaultPhrase(This,ppszPhrase)	\
-    ( (This)->lpVtbl -> DefaultPhrase(This,ppszPhrase) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __INamedEntity_INTERFACE_DEFINED__ */
-
-
-#ifndef __ISchemaProvider_INTERFACE_DEFINED__
-#define __ISchemaProvider_INTERFACE_DEFINED__
-
-/* interface ISchemaProvider */
-/* [unique][object][uuid][helpstring] */ 
-
-
-EXTERN_C const IID IID_ISchemaProvider;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("8CF89BCB-394C-49b2-AE28-A59DD4ED7F68")
-    ISchemaProvider : public IUnknown
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE Entities( 
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][retval][out] */ __RPC__deref_out_opt void **pEntities) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE RootEntity( 
-            /* [retval][out] */ __RPC__deref_out_opt IEntity **pRootEntity) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE GetEntity( 
-            /* [in] */ __RPC__in LPCWSTR pszEntityName,
-            /* [retval][out] */ __RPC__deref_out_opt IEntity **pEntity) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE MetaData( 
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][retval][out] */ __RPC__deref_out_opt void **pMetaData) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE Localize( 
-            /* [in] */ LCID lcid,
-            /* [in] */ __RPC__in_opt ISchemaLocalizerSupport *pSchemaLocalizerSupport) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE SaveBinary( 
-            /* [in] */ __RPC__in LPCWSTR pszSchemaBinaryPath) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE LookupAuthoredNamedEntity( 
-            /* [in] */ __RPC__in_opt IEntity *pEntity,
-            /* [in] */ __RPC__in LPCWSTR pszInputString,
-            /* [in] */ __RPC__in_opt ITokenCollection *pTokenCollection,
-            /* [in] */ ULONG cTokensBegin,
-            /* [out] */ __RPC__out ULONG *pcTokensLength,
-            /* [out] */ __RPC__deref_out_opt LPWSTR *ppszValue) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct ISchemaProviderVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            ISchemaProvider * This,
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            ISchemaProvider * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            ISchemaProvider * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *Entities )( 
-            ISchemaProvider * This,
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][retval][out] */ __RPC__deref_out_opt void **pEntities);
-        
-        HRESULT ( STDMETHODCALLTYPE *RootEntity )( 
-            ISchemaProvider * This,
-            /* [retval][out] */ __RPC__deref_out_opt IEntity **pRootEntity);
-        
-        HRESULT ( STDMETHODCALLTYPE *GetEntity )( 
-            ISchemaProvider * This,
-            /* [in] */ __RPC__in LPCWSTR pszEntityName,
-            /* [retval][out] */ __RPC__deref_out_opt IEntity **pEntity);
-        
-        HRESULT ( STDMETHODCALLTYPE *MetaData )( 
-            ISchemaProvider * This,
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][retval][out] */ __RPC__deref_out_opt void **pMetaData);
-        
-        HRESULT ( STDMETHODCALLTYPE *Localize )( 
-            ISchemaProvider * This,
-            /* [in] */ LCID lcid,
-            /* [in] */ __RPC__in_opt ISchemaLocalizerSupport *pSchemaLocalizerSupport);
-        
-        HRESULT ( STDMETHODCALLTYPE *SaveBinary )( 
-            ISchemaProvider * This,
-            /* [in] */ __RPC__in LPCWSTR pszSchemaBinaryPath);
-        
-        HRESULT ( STDMETHODCALLTYPE *LookupAuthoredNamedEntity )( 
-            ISchemaProvider * This,
-            /* [in] */ __RPC__in_opt IEntity *pEntity,
-            /* [in] */ __RPC__in LPCWSTR pszInputString,
-            /* [in] */ __RPC__in_opt ITokenCollection *pTokenCollection,
-            /* [in] */ ULONG cTokensBegin,
-            /* [out] */ __RPC__out ULONG *pcTokensLength,
-            /* [out] */ __RPC__deref_out_opt LPWSTR *ppszValue);
-        
-        END_INTERFACE
-    } ISchemaProviderVtbl;
-
-    interface ISchemaProvider
-    {
-        CONST_VTBL struct ISchemaProviderVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define ISchemaProvider_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define ISchemaProvider_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define ISchemaProvider_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define ISchemaProvider_Entities(This,riid,pEntities)	\
-    ( (This)->lpVtbl -> Entities(This,riid,pEntities) ) 
-
-#define ISchemaProvider_RootEntity(This,pRootEntity)	\
-    ( (This)->lpVtbl -> RootEntity(This,pRootEntity) ) 
-
-#define ISchemaProvider_GetEntity(This,pszEntityName,pEntity)	\
-    ( (This)->lpVtbl -> GetEntity(This,pszEntityName,pEntity) ) 
-
-#define ISchemaProvider_MetaData(This,riid,pMetaData)	\
-    ( (This)->lpVtbl -> MetaData(This,riid,pMetaData) ) 
-
-#define ISchemaProvider_Localize(This,lcid,pSchemaLocalizerSupport)	\
-    ( (This)->lpVtbl -> Localize(This,lcid,pSchemaLocalizerSupport) ) 
-
-#define ISchemaProvider_SaveBinary(This,pszSchemaBinaryPath)	\
-    ( (This)->lpVtbl -> SaveBinary(This,pszSchemaBinaryPath) ) 
-
-#define ISchemaProvider_LookupAuthoredNamedEntity(This,pEntity,pszInputString,pTokenCollection,cTokensBegin,pcTokensLength,ppszValue)	\
-    ( (This)->lpVtbl -> LookupAuthoredNamedEntity(This,pEntity,pszInputString,pTokenCollection,cTokensBegin,pcTokensLength,ppszValue) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __ISchemaProvider_INTERFACE_DEFINED__ */
-
-
-#ifndef __ITokenCollection_INTERFACE_DEFINED__
-#define __ITokenCollection_INTERFACE_DEFINED__
-
-/* interface ITokenCollection */
-/* [unique][object][uuid][helpstring] */ 
-
-
-EXTERN_C const IID IID_ITokenCollection;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("22D8B4F2-F577-4adb-A335-C2AE88416FAB")
-    ITokenCollection : public IUnknown
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE NumberOfTokens( 
-            __RPC__in ULONG *pCount) = 0;
-        
-        virtual /* [local] */ HRESULT STDMETHODCALLTYPE GetToken( 
-            /* [in] */ ULONG i,
-            /* [out] */ 
-            __out_opt  ULONG *pBegin,
-            /* [out] */ 
-            __out_opt  ULONG *pLength,
-            /* [out] */ 
-            __deref_opt_out  LPWSTR *ppsz) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct ITokenCollectionVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            ITokenCollection * This,
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            ITokenCollection * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            ITokenCollection * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *NumberOfTokens )( 
-            ITokenCollection * This,
-            __RPC__in ULONG *pCount);
-        
-        /* [local] */ HRESULT ( STDMETHODCALLTYPE *GetToken )( 
-            ITokenCollection * This,
-            /* [in] */ ULONG i,
-            /* [out] */ 
-            __out_opt  ULONG *pBegin,
-            /* [out] */ 
-            __out_opt  ULONG *pLength,
-            /* [out] */ 
-            __deref_opt_out  LPWSTR *ppsz);
-        
-        END_INTERFACE
-    } ITokenCollectionVtbl;
-
-    interface ITokenCollection
-    {
-        CONST_VTBL struct ITokenCollectionVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define ITokenCollection_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define ITokenCollection_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define ITokenCollection_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define ITokenCollection_NumberOfTokens(This,pCount)	\
-    ( (This)->lpVtbl -> NumberOfTokens(This,pCount) ) 
-
-#define ITokenCollection_GetToken(This,i,pBegin,pLength,ppsz)	\
-    ( (This)->lpVtbl -> GetToken(This,i,pBegin,pLength,ppsz) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __ITokenCollection_INTERFACE_DEFINED__ */
-
-
-/* interface __MIDL_itf_structuredquery_0000_0013 */
-/* [local] */ 
-
-typedef /* [public][public][v1_enum] */ 
-enum __MIDL___MIDL_itf_structuredquery_0000_0013_0001
-    {	NEC_LOW	= 0,
-	NEC_MEDIUM	= ( NEC_LOW + 1 ) ,
-	NEC_HIGH	= ( NEC_MEDIUM + 1 ) 
-    } 	NAMED_ENTITY_CERTAINTY;
-
-
-
-extern RPC_IF_HANDLE __MIDL_itf_structuredquery_0000_0013_v0_0_c_ifspec;
-extern RPC_IF_HANDLE __MIDL_itf_structuredquery_0000_0013_v0_0_s_ifspec;
-
-#ifndef __INamedEntityCollector_INTERFACE_DEFINED__
-#define __INamedEntityCollector_INTERFACE_DEFINED__
-
-/* interface INamedEntityCollector */
-/* [unique][object][uuid][helpstring] */ 
-
-
-EXTERN_C const IID IID_INamedEntityCollector;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("AF2440F6-8AFC-47d0-9A7F-396A0ACFB43D")
-    INamedEntityCollector : public IUnknown
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE Add( 
-            /* [in] */ ULONG beginSpan,
-            /* [in] */ ULONG endSpan,
-            /* [in] */ ULONG beginActual,
-            /* [in] */ ULONG endActual,
-            /* [in] */ __RPC__in_opt IEntity *pType,
-            /* [in] */ __RPC__in LPCWSTR pszValue,
-            /* [in] */ NAMED_ENTITY_CERTAINTY certainty) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct INamedEntityCollectorVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            INamedEntityCollector * This,
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            INamedEntityCollector * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            INamedEntityCollector * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *Add )( 
-            INamedEntityCollector * This,
-            /* [in] */ ULONG beginSpan,
-            /* [in] */ ULONG endSpan,
-            /* [in] */ ULONG beginActual,
-            /* [in] */ ULONG endActual,
-            /* [in] */ __RPC__in_opt IEntity *pType,
-            /* [in] */ __RPC__in LPCWSTR pszValue,
-            /* [in] */ NAMED_ENTITY_CERTAINTY certainty);
-        
-        END_INTERFACE
-    } INamedEntityCollectorVtbl;
-
-    interface INamedEntityCollector
-    {
-        CONST_VTBL struct INamedEntityCollectorVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define INamedEntityCollector_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define INamedEntityCollector_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define INamedEntityCollector_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define INamedEntityCollector_Add(This,beginSpan,endSpan,beginActual,endActual,pType,pszValue,certainty)	\
-    ( (This)->lpVtbl -> Add(This,beginSpan,endSpan,beginActual,endActual,pType,pszValue,certainty) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __INamedEntityCollector_INTERFACE_DEFINED__ */
-
-
-#ifndef __ISchemaLocalizerSupport_INTERFACE_DEFINED__
-#define __ISchemaLocalizerSupport_INTERFACE_DEFINED__
-
-/* interface ISchemaLocalizerSupport */
-/* [unique][object][uuid] */ 
-
-
-EXTERN_C const IID IID_ISchemaLocalizerSupport;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("CA3FDCA2-BFBE-4eed-90D7-0CAEF0A1BDA1")
-    ISchemaLocalizerSupport : public IUnknown
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE Localize( 
-            /* [in] */ __RPC__in LPCWSTR pszGlobalString,
-            /* [retval][out] */ __RPC__deref_out_opt LPWSTR *ppszLocalString) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct ISchemaLocalizerSupportVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            ISchemaLocalizerSupport * This,
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            ISchemaLocalizerSupport * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            ISchemaLocalizerSupport * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *Localize )( 
-            ISchemaLocalizerSupport * This,
-            /* [in] */ __RPC__in LPCWSTR pszGlobalString,
-            /* [retval][out] */ __RPC__deref_out_opt LPWSTR *ppszLocalString);
-        
-        END_INTERFACE
-    } ISchemaLocalizerSupportVtbl;
-
-    interface ISchemaLocalizerSupport
-    {
-        CONST_VTBL struct ISchemaLocalizerSupportVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define ISchemaLocalizerSupport_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define ISchemaLocalizerSupport_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define ISchemaLocalizerSupport_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define ISchemaLocalizerSupport_Localize(This,pszGlobalString,ppszLocalString)	\
-    ( (This)->lpVtbl -> Localize(This,pszGlobalString,ppszLocalString) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __ISchemaLocalizerSupport_INTERFACE_DEFINED__ */
-
-
-#ifndef __IQueryParserManager_INTERFACE_DEFINED__
-#define __IQueryParserManager_INTERFACE_DEFINED__
-
-/* interface IQueryParserManager */
-/* [unique][object][uuid] */ 
-
-
-EXTERN_C const IID IID_IQueryParserManager;
-
-#if defined(__cplusplus) && !defined(CINTERFACE)
-    
-    MIDL_INTERFACE("A879E3C4-AF77-44fb-8F37-EBD1487CF920")
-    IQueryParserManager : public IUnknown
-    {
-    public:
-        virtual HRESULT STDMETHODCALLTYPE CreateLoadedParser( 
-            /* [in] */ __RPC__in LPCWSTR pszCatalog,
-            /* [in] */ LANGID langidForKeywords,
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][retval][out] */ __RPC__deref_out_opt void **ppQueryParser) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE InitializeOptions( 
-            /* [in] */ BOOL fUnderstandNQS,
-            /* [in] */ BOOL fAutoWildCard,
-            /* [in] */ __RPC__in_opt IQueryParser *pQueryParser) = 0;
-        
-        virtual HRESULT STDMETHODCALLTYPE SetOption( 
-            /* [in] */ QUERY_PARSER_MANAGER_OPTION option,
-            /* [in] */ __RPC__in const PROPVARIANT *pOptionValue) = 0;
-        
-    };
-    
-#else 	/* C style interface */
-
-    typedef struct IQueryParserManagerVtbl
-    {
-        BEGIN_INTERFACE
-        
-        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
-            IQueryParserManager * This,
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][out] */ 
-            __RPC__deref_out  void **ppvObject);
-        
-        ULONG ( STDMETHODCALLTYPE *AddRef )( 
-            IQueryParserManager * This);
-        
-        ULONG ( STDMETHODCALLTYPE *Release )( 
-            IQueryParserManager * This);
-        
-        HRESULT ( STDMETHODCALLTYPE *CreateLoadedParser )( 
-            IQueryParserManager * This,
-            /* [in] */ __RPC__in LPCWSTR pszCatalog,
-            /* [in] */ LANGID langidForKeywords,
-            /* [in] */ __RPC__in REFIID riid,
-            /* [iid_is][retval][out] */ __RPC__deref_out_opt void **ppQueryParser);
-        
-        HRESULT ( STDMETHODCALLTYPE *InitializeOptions )( 
-            IQueryParserManager * This,
-            /* [in] */ BOOL fUnderstandNQS,
-            /* [in] */ BOOL fAutoWildCard,
-            /* [in] */ __RPC__in_opt IQueryParser *pQueryParser);
-        
-        HRESULT ( STDMETHODCALLTYPE *SetOption )( 
-            IQueryParserManager * This,
-            /* [in] */ QUERY_PARSER_MANAGER_OPTION option,
-            /* [in] */ __RPC__in const PROPVARIANT *pOptionValue);
-        
-        END_INTERFACE
-    } IQueryParserManagerVtbl;
-
-    interface IQueryParserManager
-    {
-        CONST_VTBL struct IQueryParserManagerVtbl *lpVtbl;
-    };
-
-    
-
-#ifdef COBJMACROS
-
-
-#define IQueryParserManager_QueryInterface(This,riid,ppvObject)	\
-    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
-
-#define IQueryParserManager_AddRef(This)	\
-    ( (This)->lpVtbl -> AddRef(This) ) 
-
-#define IQueryParserManager_Release(This)	\
-    ( (This)->lpVtbl -> Release(This) ) 
-
-
-#define IQueryParserManager_CreateLoadedParser(This,pszCatalog,langidForKeywords,riid,ppQueryParser)	\
-    ( (This)->lpVtbl -> CreateLoadedParser(This,pszCatalog,langidForKeywords,riid,ppQueryParser) ) 
-
-#define IQueryParserManager_InitializeOptions(This,fUnderstandNQS,fAutoWildCard,pQueryParser)	\
-    ( (This)->lpVtbl -> InitializeOptions(This,fUnderstandNQS,fAutoWildCard,pQueryParser) ) 
-
-#define IQueryParserManager_SetOption(This,option,pOptionValue)	\
-    ( (This)->lpVtbl -> SetOption(This,option,pOptionValue) ) 
-
-#endif /* COBJMACROS */
-
-
-#endif 	/* C style interface */
-
-
-
-
-#endif 	/* __IQueryParserManager_INTERFACE_DEFINED__ */
-
-
-
-#ifndef __StructuredQuery1_LIBRARY_DEFINED__
-#define __StructuredQuery1_LIBRARY_DEFINED__
-
-/* library StructuredQuery1 */
-/* [version][uuid] */ 
-
-
-EXTERN_C const IID LIBID_StructuredQuery1;
-
-EXTERN_C const CLSID CLSID_QueryParser;
-
-#ifdef __cplusplus
-
-class DECLSPEC_UUID("B72F8FD8-0FAB-4dd9-BDBF-245A6CE1485B")
-QueryParser;
-#endif
-
-EXTERN_C const CLSID CLSID_NegationCondition;
-
-#ifdef __cplusplus
-
-class DECLSPEC_UUID("8DE9C74C-605A-4acd-BEE3-2B222AA2D23D")
-NegationCondition;
-#endif
-
-EXTERN_C const CLSID CLSID_CompoundCondition;
-
-#ifdef __cplusplus
-
-class DECLSPEC_UUID("116F8D13-101E-4fa5-84D4-FF8279381935")
-CompoundCondition;
-#endif
-
-EXTERN_C const CLSID CLSID_LeafCondition;
-
-#ifdef __cplusplus
-
-class DECLSPEC_UUID("52F15C89-5A17-48e1-BBCD-46A3F89C7CC2")
-LeafCondition;
-#endif
-
-EXTERN_C const CLSID CLSID_ConditionFactory;
-
-#ifdef __cplusplus
-
-class DECLSPEC_UUID("E03E85B0-7BE3-4000-BA98-6C13DE9FA486")
-ConditionFactory;
-#endif
-
-EXTERN_C const CLSID CLSID_Interval;
-
-#ifdef __cplusplus
-
-class DECLSPEC_UUID("D957171F-4BF9-4de2-BCD5-C70A7CA55836")
-Interval;
-#endif
-
-EXTERN_C const CLSID CLSID_QueryParserManager;
-
-#ifdef __cplusplus
-
-class DECLSPEC_UUID("5088B39A-29B4-4d9d-8245-4EE289222F66")
-QueryParserManager;
-#endif
-#endif /* __StructuredQuery1_LIBRARY_DEFINED__ */
-
-/* Additional Prototypes for ALL interfaces */
-
-unsigned long             __RPC_USER  BSTR_UserSize(     unsigned long *, unsigned long            , BSTR * ); 
-unsigned char * __RPC_USER  BSTR_UserMarshal(  unsigned long *, unsigned char *, BSTR * ); 
-unsigned char * __RPC_USER  BSTR_UserUnmarshal(unsigned long *, unsigned char *, BSTR * ); 
-void                      __RPC_USER  BSTR_UserFree(     unsigned long *, BSTR * ); 
-
-unsigned long             __RPC_USER  LPSAFEARRAY_UserSize(     unsigned long *, unsigned long            , LPSAFEARRAY * ); 
-unsigned char * __RPC_USER  LPSAFEARRAY_UserMarshal(  unsigned long *, unsigned char *, LPSAFEARRAY * ); 
-unsigned char * __RPC_USER  LPSAFEARRAY_UserUnmarshal(unsigned long *, unsigned char *, LPSAFEARRAY * ); 
-void                      __RPC_USER  LPSAFEARRAY_UserFree(     unsigned long *, LPSAFEARRAY * ); 
-
-/* end of Additional Prototypes */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
-
-
+
+
+/* this ALWAYS GENERATED file contains the definitions for the interfaces */
+
+
+ /* File created by MIDL compiler version 7.00.0499 */
+/* Compiler settings for structuredquery.idl:
+    Oicf, W1, Zp8, env=Win32 (32b run)
+    protocol : dce , ms_ext, c_ext, robust
+    error checks: allocation ref bounds_check enum stub_data 
+    VC __declspec() decoration level: 
+         __declspec(uuid()), __declspec(selectany), __declspec(novtable)
+         DECLSPEC_UUID(), MIDL_INTERFACE()
+*/
+//@@MIDL_FILE_HEADING(  )
+
+#pragma warning( disable: 4049 )  /* more than 64k source lines */
+
+
+/* verify that the <rpcndr.h> version is high enough to compile this file*/
+#ifndef __REQUIRED_RPCNDR_H_VERSION__
+#define __REQUIRED_RPCNDR_H_VERSION__ 475
+#endif
+
+/* verify that the <rpcsal.h> version is high enough to compile this file*/
+#ifndef __REQUIRED_RPCSAL_H_VERSION__
+#define __REQUIRED_RPCSAL_H_VERSION__ 100
+#endif
+
+#include "rpc.h"
+#include "rpcndr.h"
+
+#ifndef __RPCNDR_H_VERSION__
+#error this stub requires an updated version of <rpcndr.h>
+#endif // __RPCNDR_H_VERSION__
+
+#ifndef COM_NO_WINDOWS_H
+#include "windows.h"
+#include "ole2.h"
+#endif /*COM_NO_WINDOWS_H*/
+
+#ifndef __structuredquery_h__
+#define __structuredquery_h__
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+#pragma once
+#endif
+
+/* Forward Declarations */ 
+
+#ifndef __IQueryParser_FWD_DEFINED__
+#define __IQueryParser_FWD_DEFINED__
+typedef interface IQueryParser IQueryParser;
+#endif 	/* __IQueryParser_FWD_DEFINED__ */
+
+
+#ifndef __IConditionFactory_FWD_DEFINED__
+#define __IConditionFactory_FWD_DEFINED__
+typedef interface IConditionFactory IConditionFactory;
+#endif 	/* __IConditionFactory_FWD_DEFINED__ */
+
+
+#ifndef __IQuerySolution_FWD_DEFINED__
+#define __IQuerySolution_FWD_DEFINED__
+typedef interface IQuerySolution IQuerySolution;
+#endif 	/* __IQuerySolution_FWD_DEFINED__ */
+
+
+#ifndef __ICondition_FWD_DEFINED__
+#define __ICondition_FWD_DEFINED__
+typedef interface ICondition ICondition;
+#endif 	/* __ICondition_FWD_DEFINED__ */
+
+
+#ifndef __IConditionGenerator_FWD_DEFINED__
+#define __IConditionGenerator_FWD_DEFINED__
+typedef interface IConditionGenerator IConditionGenerator;
+#endif 	/* __IConditionGenerator_FWD_DEFINED__ */
+
+
+#ifndef __IRichChunk_FWD_DEFINED__
+#define __IRichChunk_FWD_DEFINED__
+typedef interface IRichChunk IRichChunk;
+#endif 	/* __IRichChunk_FWD_DEFINED__ */
+
+
+#ifndef __IInterval_FWD_DEFINED__
+#define __IInterval_FWD_DEFINED__
+typedef interface IInterval IInterval;
+#endif 	/* __IInterval_FWD_DEFINED__ */
+
+
+#ifndef __IMetaData_FWD_DEFINED__
+#define __IMetaData_FWD_DEFINED__
+typedef interface IMetaData IMetaData;
+#endif 	/* __IMetaData_FWD_DEFINED__ */
+
+
+#ifndef __IEntity_FWD_DEFINED__
+#define __IEntity_FWD_DEFINED__
+typedef interface IEntity IEntity;
+#endif 	/* __IEntity_FWD_DEFINED__ */
+
+
+#ifndef __IRelationship_FWD_DEFINED__
+#define __IRelationship_FWD_DEFINED__
+typedef interface IRelationship IRelationship;
+#endif 	/* __IRelationship_FWD_DEFINED__ */
+
+
+#ifndef __INamedEntity_FWD_DEFINED__
+#define __INamedEntity_FWD_DEFINED__
+typedef interface INamedEntity INamedEntity;
+#endif 	/* __INamedEntity_FWD_DEFINED__ */
+
+
+#ifndef __ISchemaProvider_FWD_DEFINED__
+#define __ISchemaProvider_FWD_DEFINED__
+typedef interface ISchemaProvider ISchemaProvider;
+#endif 	/* __ISchemaProvider_FWD_DEFINED__ */
+
+
+#ifndef __ITokenCollection_FWD_DEFINED__
+#define __ITokenCollection_FWD_DEFINED__
+typedef interface ITokenCollection ITokenCollection;
+#endif 	/* __ITokenCollection_FWD_DEFINED__ */
+
+
+#ifndef __INamedEntityCollector_FWD_DEFINED__
+#define __INamedEntityCollector_FWD_DEFINED__
+typedef interface INamedEntityCollector INamedEntityCollector;
+#endif 	/* __INamedEntityCollector_FWD_DEFINED__ */
+
+
+#ifndef __ISchemaLocalizerSupport_FWD_DEFINED__
+#define __ISchemaLocalizerSupport_FWD_DEFINED__
+typedef interface ISchemaLocalizerSupport ISchemaLocalizerSupport;
+#endif 	/* __ISchemaLocalizerSupport_FWD_DEFINED__ */
+
+
+#ifndef __IQueryParserManager_FWD_DEFINED__
+#define __IQueryParserManager_FWD_DEFINED__
+typedef interface IQueryParserManager IQueryParserManager;
+#endif 	/* __IQueryParserManager_FWD_DEFINED__ */
+
+
+#ifndef __QueryParser_FWD_DEFINED__
+#define __QueryParser_FWD_DEFINED__
+
+#ifdef __cplusplus
+typedef class QueryParser QueryParser;
+#else
+typedef struct QueryParser QueryParser;
+#endif /* __cplusplus */
+
+#endif 	/* __QueryParser_FWD_DEFINED__ */
+
+
+#ifndef __NegationCondition_FWD_DEFINED__
+#define __NegationCondition_FWD_DEFINED__
+
+#ifdef __cplusplus
+typedef class NegationCondition NegationCondition;
+#else
+typedef struct NegationCondition NegationCondition;
+#endif /* __cplusplus */
+
+#endif 	/* __NegationCondition_FWD_DEFINED__ */
+
+
+#ifndef __CompoundCondition_FWD_DEFINED__
+#define __CompoundCondition_FWD_DEFINED__
+
+#ifdef __cplusplus
+typedef class CompoundCondition CompoundCondition;
+#else
+typedef struct CompoundCondition CompoundCondition;
+#endif /* __cplusplus */
+
+#endif 	/* __CompoundCondition_FWD_DEFINED__ */
+
+
+#ifndef __LeafCondition_FWD_DEFINED__
+#define __LeafCondition_FWD_DEFINED__
+
+#ifdef __cplusplus
+typedef class LeafCondition LeafCondition;
+#else
+typedef struct LeafCondition LeafCondition;
+#endif /* __cplusplus */
+
+#endif 	/* __LeafCondition_FWD_DEFINED__ */
+
+
+#ifndef __ConditionFactory_FWD_DEFINED__
+#define __ConditionFactory_FWD_DEFINED__
+
+#ifdef __cplusplus
+typedef class ConditionFactory ConditionFactory;
+#else
+typedef struct ConditionFactory ConditionFactory;
+#endif /* __cplusplus */
+
+#endif 	/* __ConditionFactory_FWD_DEFINED__ */
+
+
+#ifndef __Interval_FWD_DEFINED__
+#define __Interval_FWD_DEFINED__
+
+#ifdef __cplusplus
+typedef class Interval Interval;
+#else
+typedef struct Interval Interval;
+#endif /* __cplusplus */
+
+#endif 	/* __Interval_FWD_DEFINED__ */
+
+
+#ifndef __QueryParserManager_FWD_DEFINED__
+#define __QueryParserManager_FWD_DEFINED__
+
+#ifdef __cplusplus
+typedef class QueryParserManager QueryParserManager;
+#else
+typedef struct QueryParserManager QueryParserManager;
+#endif /* __cplusplus */
+
+#endif 	/* __QueryParserManager_FWD_DEFINED__ */
+
+
+/* header files for imported files */
+#include "oaidl.h"
+#include "ocidl.h"
+#include "propidl.h"
+
+#ifdef __cplusplus
+extern "C"{
+#endif 
+
+
+/* interface __MIDL_itf_structuredquery_0000_0000 */
+/* [local] */ 
+
+
+
+
+
+
+
+
+
+
+
+typedef /* [v1_enum] */ 
+enum tagCONDITION_TYPE
+    {	CT_AND_CONDITION	= 0,
+	CT_OR_CONDITION	= ( CT_AND_CONDITION + 1 ) ,
+	CT_NOT_CONDITION	= ( CT_OR_CONDITION + 1 ) ,
+	CT_LEAF_CONDITION	= ( CT_NOT_CONDITION + 1 ) 
+    } 	CONDITION_TYPE;
+
+typedef /* [v1_enum] */ 
+enum tagCONDITION_OPERATION
+    {	COP_IMPLICIT	= 0,
+	COP_EQUAL	= ( COP_IMPLICIT + 1 ) ,
+	COP_NOTEQUAL	= ( COP_EQUAL + 1 ) ,
+	COP_LESSTHAN	= ( COP_NOTEQUAL + 1 ) ,
+	COP_GREATERTHAN	= ( COP_LESSTHAN + 1 ) ,
+	COP_LESSTHANOREQUAL	= ( COP_GREATERTHAN + 1 ) ,
+	COP_GREATERTHANOREQUAL	= ( COP_LESSTHANOREQUAL + 1 ) ,
+	COP_VALUE_STARTSWITH	= ( COP_GREATERTHANOREQUAL + 1 ) ,
+	COP_VALUE_ENDSWITH	= ( COP_VALUE_STARTSWITH + 1 ) ,
+	COP_VALUE_CONTAINS	= ( COP_VALUE_ENDSWITH + 1 ) ,
+	COP_VALUE_NOTCONTAINS	= ( COP_VALUE_CONTAINS + 1 ) ,
+	COP_DOSWILDCARDS	= ( COP_VALUE_NOTCONTAINS + 1 ) ,
+	COP_WORD_EQUAL	= ( COP_DOSWILDCARDS + 1 ) ,
+	COP_WORD_STARTSWITH	= ( COP_WORD_EQUAL + 1 ) ,
+	COP_APPLICATION_SPECIFIC	= ( COP_WORD_STARTSWITH + 1 ) 
+    } 	CONDITION_OPERATION;
+
+typedef /* [v1_enum] */ 
+enum tagSTRUCTURED_QUERY_SINGLE_OPTION
+    {	SQSO_SCHEMA	= 0,
+	SQSO_LOCALE_WORD_BREAKING	= ( SQSO_SCHEMA + 1 ) ,
+	SQSO_WORD_BREAKER	= ( SQSO_LOCALE_WORD_BREAKING + 1 ) ,
+	SQSO_NATURAL_SYNTAX	= ( SQSO_WORD_BREAKER + 1 ) ,
+	SQSO_AUTOMATIC_WILDCARD	= ( SQSO_NATURAL_SYNTAX + 1 ) ,
+	SQSO_TRACE_LEVEL	= ( SQSO_AUTOMATIC_WILDCARD + 1 ) ,
+	SQSO_LANGUAGE_KEYWORDS	= ( SQSO_TRACE_LEVEL + 1 ) 
+    } 	STRUCTURED_QUERY_SINGLE_OPTION;
+
+typedef /* [v1_enum] */ 
+enum tagSTRUCTURED_QUERY_MULTIOPTION
+    {	SQMO_VIRTUAL_PROPERTY	= 0,
+	SQMO_DEFAULT_PROPERTY	= ( SQMO_VIRTUAL_PROPERTY + 1 ) ,
+	SQMO_GENERATOR_FOR_TYPE	= ( SQMO_DEFAULT_PROPERTY + 1 ) 
+    } 	STRUCTURED_QUERY_MULTIOPTION;
+
+typedef /* [v1_enum] */ 
+enum tagSTRUCTURED_QUERY_PARSE_ERROR
+    {	SQPE_NONE	= 0,
+	SQPE_EXTRA_OPENING_PARENTHESIS	= ( SQPE_NONE + 1 ) ,
+	SQPE_EXTRA_CLOSING_PARENTHESIS	= ( SQPE_EXTRA_OPENING_PARENTHESIS + 1 ) ,
+	SQPE_IGNORED_MODIFIER	= ( SQPE_EXTRA_CLOSING_PARENTHESIS + 1 ) ,
+	SQPE_IGNORED_CONNECTOR	= ( SQPE_IGNORED_MODIFIER + 1 ) ,
+	SQPE_IGNORED_KEYWORD	= ( SQPE_IGNORED_CONNECTOR + 1 ) ,
+	SQPE_UNHANDLED	= ( SQPE_IGNORED_KEYWORD + 1 ) 
+    } 	STRUCTURED_QUERY_PARSE_ERROR;
+
+/* [v1_enum] */ 
+enum tagSTRUCTURED_QUERY_RESOLVE_OPTION
+    {	SQRO_DONT_RESOLVE_DATETIME	= 0x1,
+	SQRO_ALWAYS_ONE_INTERVAL	= 0x2,
+	SQRO_DONT_SIMPLIFY_CONDITION_TREES	= 0x4,
+	SQRO_DONT_MAP_RELATIONS	= 0x8,
+	SQRO_DONT_RESOLVE_RANGES	= 0x10,
+	SQRO_DONT_REMOVE_UNRESTRICTED_KEYWORDS	= 0x20,
+	SQRO_DONT_SPLIT_WORDS	= 0x40,
+	SQRO_IGNORE_PHRASE_ORDER	= 0x80
+    } ;
+typedef int STRUCTURED_QUERY_RESOLVE_OPTION;
+
+typedef /* [v1_enum] */ 
+enum tagINTERVAL_LIMIT_KIND
+    {	ILK_EXPLICIT_INCLUDED	= 0,
+	ILK_EXPLICIT_EXCLUDED	= ( ILK_EXPLICIT_INCLUDED + 1 ) ,
+	ILK_NEGATIVE_INFINITY	= ( ILK_EXPLICIT_EXCLUDED + 1 ) ,
+	ILK_POSITIVE_INFINITY	= ( ILK_NEGATIVE_INFINITY + 1 ) 
+    } 	INTERVAL_LIMIT_KIND;
+
+typedef /* [v1_enum] */ 
+enum tagQUERY_PARSER_MANAGER_OPTION
+    {	QPMO_SCHEMA_BINARY_NAME	= 0,
+	QPMO_PRELOCALIZED_SCHEMA_BINARY_PATH	= ( QPMO_SCHEMA_BINARY_NAME + 1 ) ,
+	QPMO_UNLOCALIZED_SCHEMA_BINARY_PATH	= ( QPMO_PRELOCALIZED_SCHEMA_BINARY_PATH + 1 ) ,
+	QPMO_LOCALIZED_SCHEMA_BINARY_PATH	= ( QPMO_UNLOCALIZED_SCHEMA_BINARY_PATH + 1 ) ,
+	QPMO_APPEND_LCID_TO_LOCALIZED_PATH	= ( QPMO_LOCALIZED_SCHEMA_BINARY_PATH + 1 ) ,
+	QPMO_LOCALIZER_SUPPORT	= ( QPMO_APPEND_LCID_TO_LOCALIZED_PATH + 1 ) 
+    } 	QUERY_PARSER_MANAGER_OPTION;
+
+
+
+extern RPC_IF_HANDLE __MIDL_itf_structuredquery_0000_0000_v0_0_c_ifspec;
+extern RPC_IF_HANDLE __MIDL_itf_structuredquery_0000_0000_v0_0_s_ifspec;
+
+#ifndef __IQueryParser_INTERFACE_DEFINED__
+#define __IQueryParser_INTERFACE_DEFINED__
+
+/* interface IQueryParser */
+/* [unique][uuid][object] */ 
+
+
+EXTERN_C const IID IID_IQueryParser;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("2EBDEE67-3505-43f8-9946-EA44ABC8E5B0")
+    IQueryParser : public IUnknown
+    {
+    public:
+        virtual HRESULT STDMETHODCALLTYPE Parse( 
+            /* [in] */ __RPC__in LPCWSTR pszInputString,
+            /* [in] */ __RPC__in_opt IEnumUnknown *pCustomProperties,
+            /* [retval][out] */ __RPC__deref_out_opt IQuerySolution **ppSolution) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE SetOption( 
+            /* [in] */ STRUCTURED_QUERY_SINGLE_OPTION option,
+            /* [in] */ __RPC__in const PROPVARIANT *pOptionValue) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE GetOption( 
+            /* [in] */ STRUCTURED_QUERY_SINGLE_OPTION option,
+            /* [retval][out] */ __RPC__out PROPVARIANT *pOptionValue) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE SetMultiOption( 
+            /* [in] */ STRUCTURED_QUERY_MULTIOPTION option,
+            /* [in] */ __RPC__in LPCWSTR pszOptionKey,
+            /* [in] */ __RPC__in const PROPVARIANT *pOptionValue) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE GetSchemaProvider( 
+            /* [retval][out] */ __RPC__deref_out_opt ISchemaProvider **ppSchemaProvider) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE RestateToString( 
+            /* [in] */ __RPC__in_opt ICondition *pCondition,
+            /* [in] */ BOOL fUseEnglish,
+            /* [out] */ __RPC__deref_out_opt LPWSTR *ppszQueryString) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE ParsePropertyValue( 
+            /* [in] */ __RPC__in LPCWSTR pszPropertyName,
+            /* [in] */ __RPC__in LPCWSTR pszInputString,
+            /* [retval][out] */ __RPC__deref_out_opt IQuerySolution **ppSolution) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE RestatePropertyValueToString( 
+            /* [in] */ __RPC__in_opt ICondition *pCondition,
+            /* [in] */ BOOL fUseEnglish,
+            /* [out] */ __RPC__deref_out_opt LPWSTR *ppszPropertyName,
+            /* [out] */ __RPC__deref_out_opt LPWSTR *ppszQueryString) = 0;
+        
+    };
+    
+#else 	/* C style interface */
+
+    typedef struct IQueryParserVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            IQueryParser * This,
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][out] */ 
+            __RPC__deref_out  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            IQueryParser * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            IQueryParser * This);
+        
+        HRESULT ( STDMETHODCALLTYPE *Parse )( 
+            IQueryParser * This,
+            /* [in] */ __RPC__in LPCWSTR pszInputString,
+            /* [in] */ __RPC__in_opt IEnumUnknown *pCustomProperties,
+            /* [retval][out] */ __RPC__deref_out_opt IQuerySolution **ppSolution);
+        
+        HRESULT ( STDMETHODCALLTYPE *SetOption )( 
+            IQueryParser * This,
+            /* [in] */ STRUCTURED_QUERY_SINGLE_OPTION option,
+            /* [in] */ __RPC__in const PROPVARIANT *pOptionValue);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetOption )( 
+            IQueryParser * This,
+            /* [in] */ STRUCTURED_QUERY_SINGLE_OPTION option,
+            /* [retval][out] */ __RPC__out PROPVARIANT *pOptionValue);
+        
+        HRESULT ( STDMETHODCALLTYPE *SetMultiOption )( 
+            IQueryParser * This,
+            /* [in] */ STRUCTURED_QUERY_MULTIOPTION option,
+            /* [in] */ __RPC__in LPCWSTR pszOptionKey,
+            /* [in] */ __RPC__in const PROPVARIANT *pOptionValue);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetSchemaProvider )( 
+            IQueryParser * This,
+            /* [retval][out] */ __RPC__deref_out_opt ISchemaProvider **ppSchemaProvider);
+        
+        HRESULT ( STDMETHODCALLTYPE *RestateToString )( 
+            IQueryParser * This,
+            /* [in] */ __RPC__in_opt ICondition *pCondition,
+            /* [in] */ BOOL fUseEnglish,
+            /* [out] */ __RPC__deref_out_opt LPWSTR *ppszQueryString);
+        
+        HRESULT ( STDMETHODCALLTYPE *ParsePropertyValue )( 
+            IQueryParser * This,
+            /* [in] */ __RPC__in LPCWSTR pszPropertyName,
+            /* [in] */ __RPC__in LPCWSTR pszInputString,
+            /* [retval][out] */ __RPC__deref_out_opt IQuerySolution **ppSolution);
+        
+        HRESULT ( STDMETHODCALLTYPE *RestatePropertyValueToString )( 
+            IQueryParser * This,
+            /* [in] */ __RPC__in_opt ICondition *pCondition,
+            /* [in] */ BOOL fUseEnglish,
+            /* [out] */ __RPC__deref_out_opt LPWSTR *ppszPropertyName,
+            /* [out] */ __RPC__deref_out_opt LPWSTR *ppszQueryString);
+        
+        END_INTERFACE
+    } IQueryParserVtbl;
+
+    interface IQueryParser
+    {
+        CONST_VTBL struct IQueryParserVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define IQueryParser_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define IQueryParser_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define IQueryParser_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define IQueryParser_Parse(This,pszInputString,pCustomProperties,ppSolution)	\
+    ( (This)->lpVtbl -> Parse(This,pszInputString,pCustomProperties,ppSolution) ) 
+
+#define IQueryParser_SetOption(This,option,pOptionValue)	\
+    ( (This)->lpVtbl -> SetOption(This,option,pOptionValue) ) 
+
+#define IQueryParser_GetOption(This,option,pOptionValue)	\
+    ( (This)->lpVtbl -> GetOption(This,option,pOptionValue) ) 
+
+#define IQueryParser_SetMultiOption(This,option,pszOptionKey,pOptionValue)	\
+    ( (This)->lpVtbl -> SetMultiOption(This,option,pszOptionKey,pOptionValue) ) 
+
+#define IQueryParser_GetSchemaProvider(This,ppSchemaProvider)	\
+    ( (This)->lpVtbl -> GetSchemaProvider(This,ppSchemaProvider) ) 
+
+#define IQueryParser_RestateToString(This,pCondition,fUseEnglish,ppszQueryString)	\
+    ( (This)->lpVtbl -> RestateToString(This,pCondition,fUseEnglish,ppszQueryString) ) 
+
+#define IQueryParser_ParsePropertyValue(This,pszPropertyName,pszInputString,ppSolution)	\
+    ( (This)->lpVtbl -> ParsePropertyValue(This,pszPropertyName,pszInputString,ppSolution) ) 
+
+#define IQueryParser_RestatePropertyValueToString(This,pCondition,fUseEnglish,ppszPropertyName,ppszQueryString)	\
+    ( (This)->lpVtbl -> RestatePropertyValueToString(This,pCondition,fUseEnglish,ppszPropertyName,ppszQueryString) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __IQueryParser_INTERFACE_DEFINED__ */
+
+
+#ifndef __IConditionFactory_INTERFACE_DEFINED__
+#define __IConditionFactory_INTERFACE_DEFINED__
+
+/* interface IConditionFactory */
+/* [unique][uuid][object] */ 
+
+
+EXTERN_C const IID IID_IConditionFactory;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("A5EFE073-B16F-474f-9F3E-9F8B497A3E08")
+    IConditionFactory : public IUnknown
+    {
+    public:
+        virtual HRESULT STDMETHODCALLTYPE MakeNot( 
+            /* [in] */ __RPC__in_opt ICondition *pSubCondition,
+            /* [in] */ BOOL simplify,
+            /* [retval][out] */ __RPC__deref_out_opt ICondition **ppResultQuery) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE MakeAndOr( 
+            /* [in] */ CONDITION_TYPE nodeType,
+            /* [in] */ __RPC__in_opt IEnumUnknown *pSubConditions,
+            /* [in] */ BOOL simplify,
+            /* [retval][out] */ __RPC__deref_out_opt ICondition **ppResultQuery) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE MakeLeaf( 
+            /* [unique][in] */ __RPC__in_opt LPCWSTR pszPropertyName,
+            /* [in] */ CONDITION_OPERATION op,
+            /* [unique][in] */ __RPC__in_opt LPCWSTR pszValueType,
+            /* [in] */ __RPC__in const PROPVARIANT *pValue,
+            /* [in] */ __RPC__in_opt IRichChunk *pPropertyNameTerm,
+            /* [in] */ __RPC__in_opt IRichChunk *pOperationTerm,
+            /* [in] */ __RPC__in_opt IRichChunk *pValueTerm,
+            /* [in] */ BOOL expand,
+            /* [retval][out] */ __RPC__deref_out_opt ICondition **ppResultQuery) = 0;
+        
+        virtual /* [local] */ HRESULT STDMETHODCALLTYPE Resolve( 
+            /* [in] */ 
+            __in  ICondition *pConditionTree,
+            /* [in] */ 
+            __in  STRUCTURED_QUERY_RESOLVE_OPTION sqro,
+            /* [ref][in] */ 
+            __in_opt  const SYSTEMTIME *pstReferenceTime,
+            /* [retval][out] */ 
+            __out  ICondition **ppResolvedConditionTree) = 0;
+        
+    };
+    
+#else 	/* C style interface */
+
+    typedef struct IConditionFactoryVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            IConditionFactory * This,
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][out] */ 
+            __RPC__deref_out  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            IConditionFactory * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            IConditionFactory * This);
+        
+        HRESULT ( STDMETHODCALLTYPE *MakeNot )( 
+            IConditionFactory * This,
+            /* [in] */ __RPC__in_opt ICondition *pSubCondition,
+            /* [in] */ BOOL simplify,
+            /* [retval][out] */ __RPC__deref_out_opt ICondition **ppResultQuery);
+        
+        HRESULT ( STDMETHODCALLTYPE *MakeAndOr )( 
+            IConditionFactory * This,
+            /* [in] */ CONDITION_TYPE nodeType,
+            /* [in] */ __RPC__in_opt IEnumUnknown *pSubConditions,
+            /* [in] */ BOOL simplify,
+            /* [retval][out] */ __RPC__deref_out_opt ICondition **ppResultQuery);
+        
+        HRESULT ( STDMETHODCALLTYPE *MakeLeaf )( 
+            IConditionFactory * This,
+            /* [unique][in] */ __RPC__in_opt LPCWSTR pszPropertyName,
+            /* [in] */ CONDITION_OPERATION op,
+            /* [unique][in] */ __RPC__in_opt LPCWSTR pszValueType,
+            /* [in] */ __RPC__in const PROPVARIANT *pValue,
+            /* [in] */ __RPC__in_opt IRichChunk *pPropertyNameTerm,
+            /* [in] */ __RPC__in_opt IRichChunk *pOperationTerm,
+            /* [in] */ __RPC__in_opt IRichChunk *pValueTerm,
+            /* [in] */ BOOL expand,
+            /* [retval][out] */ __RPC__deref_out_opt ICondition **ppResultQuery);
+        
+        /* [local] */ HRESULT ( STDMETHODCALLTYPE *Resolve )( 
+            IConditionFactory * This,
+            /* [in] */ 
+            __in  ICondition *pConditionTree,
+            /* [in] */ 
+            __in  STRUCTURED_QUERY_RESOLVE_OPTION sqro,
+            /* [ref][in] */ 
+            __in_opt  const SYSTEMTIME *pstReferenceTime,
+            /* [retval][out] */ 
+            __out  ICondition **ppResolvedConditionTree);
+        
+        END_INTERFACE
+    } IConditionFactoryVtbl;
+
+    interface IConditionFactory
+    {
+        CONST_VTBL struct IConditionFactoryVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define IConditionFactory_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define IConditionFactory_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define IConditionFactory_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define IConditionFactory_MakeNot(This,pSubCondition,simplify,ppResultQuery)	\
+    ( (This)->lpVtbl -> MakeNot(This,pSubCondition,simplify,ppResultQuery) ) 
+
+#define IConditionFactory_MakeAndOr(This,nodeType,pSubConditions,simplify,ppResultQuery)	\
+    ( (This)->lpVtbl -> MakeAndOr(This,nodeType,pSubConditions,simplify,ppResultQuery) ) 
+
+#define IConditionFactory_MakeLeaf(This,pszPropertyName,op,pszValueType,pValue,pPropertyNameTerm,pOperationTerm,pValueTerm,expand,ppResultQuery)	\
+    ( (This)->lpVtbl -> MakeLeaf(This,pszPropertyName,op,pszValueType,pValue,pPropertyNameTerm,pOperationTerm,pValueTerm,expand,ppResultQuery) ) 
+
+#define IConditionFactory_Resolve(This,pConditionTree,sqro,pstReferenceTime,ppResolvedConditionTree)	\
+    ( (This)->lpVtbl -> Resolve(This,pConditionTree,sqro,pstReferenceTime,ppResolvedConditionTree) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __IConditionFactory_INTERFACE_DEFINED__ */
+
+
+#ifndef __IQuerySolution_INTERFACE_DEFINED__
+#define __IQuerySolution_INTERFACE_DEFINED__
+
+/* interface IQuerySolution */
+/* [unique][uuid][object] */ 
+
+
+EXTERN_C const IID IID_IQuerySolution;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("D6EBC66B-8921-4193-AFDD-A1789FB7FF57")
+    IQuerySolution : public IConditionFactory
+    {
+    public:
+        virtual /* [local] */ HRESULT STDMETHODCALLTYPE GetQuery( 
+            /* [out] */ 
+            __out_opt  ICondition **ppQueryNode,
+            /* [out] */ 
+            __out_opt  IEntity **ppMainType) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE GetErrors( 
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][retval][out] */ __RPC__deref_out_opt void **ppParseErrors) = 0;
+        
+        virtual /* [local] */ HRESULT STDMETHODCALLTYPE GetLexicalData( 
+            /* [out] */ 
+            __deref_opt_out  LPWSTR *ppszInputString,
+            /* [out] */ 
+            __out_opt  ITokenCollection **ppTokens,
+            /* [out] */ 
+            __out_opt  LCID *pLocale,
+            /* [out] */ 
+            __out_opt  IUnknown **ppWordBreaker) = 0;
+        
+    };
+    
+#else 	/* C style interface */
+
+    typedef struct IQuerySolutionVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            IQuerySolution * This,
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][out] */ 
+            __RPC__deref_out  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            IQuerySolution * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            IQuerySolution * This);
+        
+        HRESULT ( STDMETHODCALLTYPE *MakeNot )( 
+            IQuerySolution * This,
+            /* [in] */ __RPC__in_opt ICondition *pSubCondition,
+            /* [in] */ BOOL simplify,
+            /* [retval][out] */ __RPC__deref_out_opt ICondition **ppResultQuery);
+        
+        HRESULT ( STDMETHODCALLTYPE *MakeAndOr )( 
+            IQuerySolution * This,
+            /* [in] */ CONDITION_TYPE nodeType,
+            /* [in] */ __RPC__in_opt IEnumUnknown *pSubConditions,
+            /* [in] */ BOOL simplify,
+            /* [retval][out] */ __RPC__deref_out_opt ICondition **ppResultQuery);
+        
+        HRESULT ( STDMETHODCALLTYPE *MakeLeaf )( 
+            IQuerySolution * This,
+            /* [unique][in] */ __RPC__in_opt LPCWSTR pszPropertyName,
+            /* [in] */ CONDITION_OPERATION op,
+            /* [unique][in] */ __RPC__in_opt LPCWSTR pszValueType,
+            /* [in] */ __RPC__in const PROPVARIANT *pValue,
+            /* [in] */ __RPC__in_opt IRichChunk *pPropertyNameTerm,
+            /* [in] */ __RPC__in_opt IRichChunk *pOperationTerm,
+            /* [in] */ __RPC__in_opt IRichChunk *pValueTerm,
+            /* [in] */ BOOL expand,
+            /* [retval][out] */ __RPC__deref_out_opt ICondition **ppResultQuery);
+        
+        /* [local] */ HRESULT ( STDMETHODCALLTYPE *Resolve )( 
+            IQuerySolution * This,
+            /* [in] */ 
+            __in  ICondition *pConditionTree,
+            /* [in] */ 
+            __in  STRUCTURED_QUERY_RESOLVE_OPTION sqro,
+            /* [ref][in] */ 
+            __in_opt  const SYSTEMTIME *pstReferenceTime,
+            /* [retval][out] */ 
+            __out  ICondition **ppResolvedConditionTree);
+        
+        /* [local] */ HRESULT ( STDMETHODCALLTYPE *GetQuery )( 
+            IQuerySolution * This,
+            /* [out] */ 
+            __out_opt  ICondition **ppQueryNode,
+            /* [out] */ 
+            __out_opt  IEntity **ppMainType);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetErrors )( 
+            IQuerySolution * This,
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][retval][out] */ __RPC__deref_out_opt void **ppParseErrors);
+        
+        /* [local] */ HRESULT ( STDMETHODCALLTYPE *GetLexicalData )( 
+            IQuerySolution * This,
+            /* [out] */ 
+            __deref_opt_out  LPWSTR *ppszInputString,
+            /* [out] */ 
+            __out_opt  ITokenCollection **ppTokens,
+            /* [out] */ 
+            __out_opt  LCID *pLocale,
+            /* [out] */ 
+            __out_opt  IUnknown **ppWordBreaker);
+        
+        END_INTERFACE
+    } IQuerySolutionVtbl;
+
+    interface IQuerySolution
+    {
+        CONST_VTBL struct IQuerySolutionVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define IQuerySolution_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define IQuerySolution_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define IQuerySolution_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define IQuerySolution_MakeNot(This,pSubCondition,simplify,ppResultQuery)	\
+    ( (This)->lpVtbl -> MakeNot(This,pSubCondition,simplify,ppResultQuery) ) 
+
+#define IQuerySolution_MakeAndOr(This,nodeType,pSubConditions,simplify,ppResultQuery)	\
+    ( (This)->lpVtbl -> MakeAndOr(This,nodeType,pSubConditions,simplify,ppResultQuery) ) 
+
+#define IQuerySolution_MakeLeaf(This,pszPropertyName,op,pszValueType,pValue,pPropertyNameTerm,pOperationTerm,pValueTerm,expand,ppResultQuery)	\
+    ( (This)->lpVtbl -> MakeLeaf(This,pszPropertyName,op,pszValueType,pValue,pPropertyNameTerm,pOperationTerm,pValueTerm,expand,ppResultQuery) ) 
+
+#define IQuerySolution_Resolve(This,pConditionTree,sqro,pstReferenceTime,ppResolvedConditionTree)	\
+    ( (This)->lpVtbl -> Resolve(This,pConditionTree,sqro,pstReferenceTime,ppResolvedConditionTree) ) 
+
+
+#define IQuerySolution_GetQuery(This,ppQueryNode,ppMainType)	\
+    ( (This)->lpVtbl -> GetQuery(This,ppQueryNode,ppMainType) ) 
+
+#define IQuerySolution_GetErrors(This,riid,ppParseErrors)	\
+    ( (This)->lpVtbl -> GetErrors(This,riid,ppParseErrors) ) 
+
+#define IQuerySolution_GetLexicalData(This,ppszInputString,ppTokens,pLocale,ppWordBreaker)	\
+    ( (This)->lpVtbl -> GetLexicalData(This,ppszInputString,ppTokens,pLocale,ppWordBreaker) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __IQuerySolution_INTERFACE_DEFINED__ */
+
+
+#ifndef __ICondition_INTERFACE_DEFINED__
+#define __ICondition_INTERFACE_DEFINED__
+
+/* interface ICondition */
+/* [unique][uuid][object] */ 
+
+
+EXTERN_C const IID IID_ICondition;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("0FC988D4-C935-4b97-A973-46282EA175C8")
+    ICondition : public IPersistStream
+    {
+    public:
+        virtual HRESULT STDMETHODCALLTYPE GetConditionType( 
+            /* [retval][out] */ __RPC__out CONDITION_TYPE *pNodeType) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE GetSubConditions( 
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][retval][out] */ __RPC__deref_out_opt void **ppv) = 0;
+        
+        virtual /* [local] */ HRESULT STDMETHODCALLTYPE GetComparisonInfo( 
+            /* [out] */ 
+            __deref_opt_out  LPWSTR *ppszPropertyName,
+            /* [out] */ 
+            __out_opt  CONDITION_OPERATION *pOperation,
+            /* [out] */ 
+            __out_opt  PROPVARIANT *pValue) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE GetValueType( 
+            /* [retval][out] */ __RPC__deref_out_opt LPWSTR *ppszValueTypeName) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE GetValueNormalization( 
+            /* [retval][out] */ __RPC__deref_out_opt LPWSTR *ppszNormalization) = 0;
+        
+        virtual /* [local] */ HRESULT STDMETHODCALLTYPE GetInputTerms( 
+            /* [out] */ 
+            __out_opt  IRichChunk **ppPropertyTerm,
+            /* [out] */ 
+            __out_opt  IRichChunk **ppOperationTerm,
+            /* [out] */ 
+            __out_opt  IRichChunk **ppValueTerm) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE Clone( 
+            /* [retval][out] */ __RPC__deref_out_opt ICondition **ppc) = 0;
+        
+    };
+    
+#else 	/* C style interface */
+
+    typedef struct IConditionVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            ICondition * This,
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][out] */ 
+            __RPC__deref_out  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            ICondition * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            ICondition * This);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetClassID )( 
+            ICondition * This,
+            /* [out] */ __RPC__out CLSID *pClassID);
+        
+        HRESULT ( STDMETHODCALLTYPE *IsDirty )( 
+            ICondition * This);
+        
+        HRESULT ( STDMETHODCALLTYPE *Load )( 
+            ICondition * This,
+            /* [unique][in] */ __RPC__in_opt IStream *pStm);
+        
+        HRESULT ( STDMETHODCALLTYPE *Save )( 
+            ICondition * This,
+            /* [unique][in] */ __RPC__in_opt IStream *pStm,
+            /* [in] */ BOOL fClearDirty);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetSizeMax )( 
+            ICondition * This,
+            /* [out] */ __RPC__out ULARGE_INTEGER *pcbSize);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetConditionType )( 
+            ICondition * This,
+            /* [retval][out] */ __RPC__out CONDITION_TYPE *pNodeType);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetSubConditions )( 
+            ICondition * This,
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][retval][out] */ __RPC__deref_out_opt void **ppv);
+        
+        /* [local] */ HRESULT ( STDMETHODCALLTYPE *GetComparisonInfo )( 
+            ICondition * This,
+            /* [out] */ 
+            __deref_opt_out  LPWSTR *ppszPropertyName,
+            /* [out] */ 
+            __out_opt  CONDITION_OPERATION *pOperation,
+            /* [out] */ 
+            __out_opt  PROPVARIANT *pValue);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetValueType )( 
+            ICondition * This,
+            /* [retval][out] */ __RPC__deref_out_opt LPWSTR *ppszValueTypeName);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetValueNormalization )( 
+            ICondition * This,
+            /* [retval][out] */ __RPC__deref_out_opt LPWSTR *ppszNormalization);
+        
+        /* [local] */ HRESULT ( STDMETHODCALLTYPE *GetInputTerms )( 
+            ICondition * This,
+            /* [out] */ 
+            __out_opt  IRichChunk **ppPropertyTerm,
+            /* [out] */ 
+            __out_opt  IRichChunk **ppOperationTerm,
+            /* [out] */ 
+            __out_opt  IRichChunk **ppValueTerm);
+        
+        HRESULT ( STDMETHODCALLTYPE *Clone )( 
+            ICondition * This,
+            /* [retval][out] */ __RPC__deref_out_opt ICondition **ppc);
+        
+        END_INTERFACE
+    } IConditionVtbl;
+
+    interface ICondition
+    {
+        CONST_VTBL struct IConditionVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define ICondition_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define ICondition_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define ICondition_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define ICondition_GetClassID(This,pClassID)	\
+    ( (This)->lpVtbl -> GetClassID(This,pClassID) ) 
+
+
+#define ICondition_IsDirty(This)	\
+    ( (This)->lpVtbl -> IsDirty(This) ) 
+
+#define ICondition_Load(This,pStm)	\
+    ( (This)->lpVtbl -> Load(This,pStm) ) 
+
+#define ICondition_Save(This,pStm,fClearDirty)	\
+    ( (This)->lpVtbl -> Save(This,pStm,fClearDirty) ) 
+
+#define ICondition_GetSizeMax(This,pcbSize)	\
+    ( (This)->lpVtbl -> GetSizeMax(This,pcbSize) ) 
+
+
+#define ICondition_GetConditionType(This,pNodeType)	\
+    ( (This)->lpVtbl -> GetConditionType(This,pNodeType) ) 
+
+#define ICondition_GetSubConditions(This,riid,ppv)	\
+    ( (This)->lpVtbl -> GetSubConditions(This,riid,ppv) ) 
+
+#define ICondition_GetComparisonInfo(This,ppszPropertyName,pOperation,pValue)	\
+    ( (This)->lpVtbl -> GetComparisonInfo(This,ppszPropertyName,pOperation,pValue) ) 
+
+#define ICondition_GetValueType(This,ppszValueTypeName)	\
+    ( (This)->lpVtbl -> GetValueType(This,ppszValueTypeName) ) 
+
+#define ICondition_GetValueNormalization(This,ppszNormalization)	\
+    ( (This)->lpVtbl -> GetValueNormalization(This,ppszNormalization) ) 
+
+#define ICondition_GetInputTerms(This,ppPropertyTerm,ppOperationTerm,ppValueTerm)	\
+    ( (This)->lpVtbl -> GetInputTerms(This,ppPropertyTerm,ppOperationTerm,ppValueTerm) ) 
+
+#define ICondition_Clone(This,ppc)	\
+    ( (This)->lpVtbl -> Clone(This,ppc) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __ICondition_INTERFACE_DEFINED__ */
+
+
+#ifndef __IConditionGenerator_INTERFACE_DEFINED__
+#define __IConditionGenerator_INTERFACE_DEFINED__
+
+/* interface IConditionGenerator */
+/* [unique][uuid][object] */ 
+
+
+EXTERN_C const IID IID_IConditionGenerator;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("92D2CC58-4386-45a3-B98C-7E0CE64A4117")
+    IConditionGenerator : public IUnknown
+    {
+    public:
+        virtual HRESULT STDMETHODCALLTYPE Initialize( 
+            /* [in] */ __RPC__in_opt ISchemaProvider *pSchemaProvider) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE RecognizeNamedEntities( 
+            /* [in] */ __RPC__in LPCWSTR pszInputString,
+            /* [in] */ LCID lcid,
+            /* [in] */ __RPC__in_opt ITokenCollection *pTokenCollection,
+            /* [out][in] */ __RPC__inout_opt INamedEntityCollector *pNamedEntities) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE GenerateForLeaf( 
+            /* [in] */ __RPC__in_opt IConditionFactory *pConditionFactory,
+            /* [unique][in] */ __RPC__in_opt LPCWSTR pszPropertyName,
+            /* [in] */ CONDITION_OPERATION op,
+            /* [unique][in] */ __RPC__in_opt LPCWSTR pszValueType,
+            /* [in] */ __RPC__in LPCWSTR pszValue,
+            /* [unique][in] */ __RPC__in_opt LPCWSTR pszValue2,
+            /* [in] */ __RPC__in_opt IRichChunk *pPropertyNameTerm,
+            /* [in] */ __RPC__in_opt IRichChunk *pOperationTerm,
+            /* [in] */ __RPC__in_opt IRichChunk *pValueTerm,
+            /* [in] */ BOOL automaticWildcard,
+            /* [out] */ __RPC__out BOOL *pNoStringQuery,
+            /* [retval][out] */ __RPC__deref_out_opt ICondition **ppQueryExpression) = 0;
+        
+        virtual /* [local] */ HRESULT STDMETHODCALLTYPE DefaultPhrase( 
+            /* [unique][in] */ LPCWSTR pszValueType,
+            /* [in] */ const PROPVARIANT *ppropvar,
+            /* [in] */ BOOL fUseEnglish,
+            /* [retval][out] */ 
+            __deref_opt_out  LPWSTR *ppszPhrase) = 0;
+        
+    };
+    
+#else 	/* C style interface */
+
+    typedef struct IConditionGeneratorVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            IConditionGenerator * This,
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][out] */ 
+            __RPC__deref_out  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            IConditionGenerator * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            IConditionGenerator * This);
+        
+        HRESULT ( STDMETHODCALLTYPE *Initialize )( 
+            IConditionGenerator * This,
+            /* [in] */ __RPC__in_opt ISchemaProvider *pSchemaProvider);
+        
+        HRESULT ( STDMETHODCALLTYPE *RecognizeNamedEntities )( 
+            IConditionGenerator * This,
+            /* [in] */ __RPC__in LPCWSTR pszInputString,
+            /* [in] */ LCID lcid,
+            /* [in] */ __RPC__in_opt ITokenCollection *pTokenCollection,
+            /* [out][in] */ __RPC__inout_opt INamedEntityCollector *pNamedEntities);
+        
+        HRESULT ( STDMETHODCALLTYPE *GenerateForLeaf )( 
+            IConditionGenerator * This,
+            /* [in] */ __RPC__in_opt IConditionFactory *pConditionFactory,
+            /* [unique][in] */ __RPC__in_opt LPCWSTR pszPropertyName,
+            /* [in] */ CONDITION_OPERATION op,
+            /* [unique][in] */ __RPC__in_opt LPCWSTR pszValueType,
+            /* [in] */ __RPC__in LPCWSTR pszValue,
+            /* [unique][in] */ __RPC__in_opt LPCWSTR pszValue2,
+            /* [in] */ __RPC__in_opt IRichChunk *pPropertyNameTerm,
+            /* [in] */ __RPC__in_opt IRichChunk *pOperationTerm,
+            /* [in] */ __RPC__in_opt IRichChunk *pValueTerm,
+            /* [in] */ BOOL automaticWildcard,
+            /* [out] */ __RPC__out BOOL *pNoStringQuery,
+            /* [retval][out] */ __RPC__deref_out_opt ICondition **ppQueryExpression);
+        
+        /* [local] */ HRESULT ( STDMETHODCALLTYPE *DefaultPhrase )( 
+            IConditionGenerator * This,
+            /* [unique][in] */ LPCWSTR pszValueType,
+            /* [in] */ const PROPVARIANT *ppropvar,
+            /* [in] */ BOOL fUseEnglish,
+            /* [retval][out] */ 
+            __deref_opt_out  LPWSTR *ppszPhrase);
+        
+        END_INTERFACE
+    } IConditionGeneratorVtbl;
+
+    interface IConditionGenerator
+    {
+        CONST_VTBL struct IConditionGeneratorVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define IConditionGenerator_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define IConditionGenerator_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define IConditionGenerator_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define IConditionGenerator_Initialize(This,pSchemaProvider)	\
+    ( (This)->lpVtbl -> Initialize(This,pSchemaProvider) ) 
+
+#define IConditionGenerator_RecognizeNamedEntities(This,pszInputString,lcid,pTokenCollection,pNamedEntities)	\
+    ( (This)->lpVtbl -> RecognizeNamedEntities(This,pszInputString,lcid,pTokenCollection,pNamedEntities) ) 
+
+#define IConditionGenerator_GenerateForLeaf(This,pConditionFactory,pszPropertyName,op,pszValueType,pszValue,pszValue2,pPropertyNameTerm,pOperationTerm,pValueTerm,automaticWildcard,pNoStringQuery,ppQueryExpression)	\
+    ( (This)->lpVtbl -> GenerateForLeaf(This,pConditionFactory,pszPropertyName,op,pszValueType,pszValue,pszValue2,pPropertyNameTerm,pOperationTerm,pValueTerm,automaticWildcard,pNoStringQuery,ppQueryExpression) ) 
+
+#define IConditionGenerator_DefaultPhrase(This,pszValueType,ppropvar,fUseEnglish,ppszPhrase)	\
+    ( (This)->lpVtbl -> DefaultPhrase(This,pszValueType,ppropvar,fUseEnglish,ppszPhrase) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __IConditionGenerator_INTERFACE_DEFINED__ */
+
+
+#ifndef __IRichChunk_INTERFACE_DEFINED__
+#define __IRichChunk_INTERFACE_DEFINED__
+
+/* interface IRichChunk */
+/* [unique][uuid][object] */ 
+
+
+EXTERN_C const IID IID_IRichChunk;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("4FDEF69C-DBC9-454e-9910-B34F3C64B510")
+    IRichChunk : public IUnknown
+    {
+    public:
+        virtual /* [local] */ HRESULT STDMETHODCALLTYPE GetData( 
+            /* [out] */ 
+            __out_opt  ULONG *pFirstPos,
+            /* [out] */ 
+            __out_opt  ULONG *pLength,
+            /* [out] */ 
+            __deref_opt_out  LPWSTR *ppsz,
+            /* [out] */ 
+            __out_opt  PROPVARIANT *pValue) = 0;
+        
+    };
+    
+#else 	/* C style interface */
+
+    typedef struct IRichChunkVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            IRichChunk * This,
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][out] */ 
+            __RPC__deref_out  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            IRichChunk * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            IRichChunk * This);
+        
+        /* [local] */ HRESULT ( STDMETHODCALLTYPE *GetData )( 
+            IRichChunk * This,
+            /* [out] */ 
+            __out_opt  ULONG *pFirstPos,
+            /* [out] */ 
+            __out_opt  ULONG *pLength,
+            /* [out] */ 
+            __deref_opt_out  LPWSTR *ppsz,
+            /* [out] */ 
+            __out_opt  PROPVARIANT *pValue);
+        
+        END_INTERFACE
+    } IRichChunkVtbl;
+
+    interface IRichChunk
+    {
+        CONST_VTBL struct IRichChunkVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define IRichChunk_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define IRichChunk_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define IRichChunk_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define IRichChunk_GetData(This,pFirstPos,pLength,ppsz,pValue)	\
+    ( (This)->lpVtbl -> GetData(This,pFirstPos,pLength,ppsz,pValue) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __IRichChunk_INTERFACE_DEFINED__ */
+
+
+#ifndef __IInterval_INTERFACE_DEFINED__
+#define __IInterval_INTERFACE_DEFINED__
+
+/* interface IInterval */
+/* [unique][uuid][object] */ 
+
+
+EXTERN_C const IID IID_IInterval;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("6BF0A714-3C18-430b-8B5D-83B1C234D3DB")
+    IInterval : public IUnknown
+    {
+    public:
+        virtual HRESULT STDMETHODCALLTYPE GetLimits( 
+            /* [out] */ __RPC__out INTERVAL_LIMIT_KIND *pilkLower,
+            /* [out] */ __RPC__out PROPVARIANT *ppropvarLower,
+            /* [out] */ __RPC__out INTERVAL_LIMIT_KIND *pilkUpper,
+            /* [out] */ __RPC__out PROPVARIANT *ppropvarUpper) = 0;
+        
+    };
+    
+#else 	/* C style interface */
+
+    typedef struct IIntervalVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            IInterval * This,
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][out] */ 
+            __RPC__deref_out  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            IInterval * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            IInterval * This);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetLimits )( 
+            IInterval * This,
+            /* [out] */ __RPC__out INTERVAL_LIMIT_KIND *pilkLower,
+            /* [out] */ __RPC__out PROPVARIANT *ppropvarLower,
+            /* [out] */ __RPC__out INTERVAL_LIMIT_KIND *pilkUpper,
+            /* [out] */ __RPC__out PROPVARIANT *ppropvarUpper);
+        
+        END_INTERFACE
+    } IIntervalVtbl;
+
+    interface IInterval
+    {
+        CONST_VTBL struct IIntervalVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define IInterval_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define IInterval_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define IInterval_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define IInterval_GetLimits(This,pilkLower,ppropvarLower,pilkUpper,ppropvarUpper)	\
+    ( (This)->lpVtbl -> GetLimits(This,pilkLower,ppropvarLower,pilkUpper,ppropvarUpper) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __IInterval_INTERFACE_DEFINED__ */
+
+
+#ifndef __IMetaData_INTERFACE_DEFINED__
+#define __IMetaData_INTERFACE_DEFINED__
+
+/* interface IMetaData */
+/* [unique][uuid][object][helpstring] */ 
+
+
+EXTERN_C const IID IID_IMetaData;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("780102B0-C43B-4876-BC7B-5E9BA5C88794")
+    IMetaData : public IUnknown
+    {
+    public:
+        virtual /* [local] */ HRESULT STDMETHODCALLTYPE GetData( 
+            /* [out] */ 
+            __deref_opt_out  LPWSTR *ppszKey,
+            /* [out] */ 
+            __deref_opt_out  LPWSTR *ppszValue) = 0;
+        
+    };
+    
+#else 	/* C style interface */
+
+    typedef struct IMetaDataVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            IMetaData * This,
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][out] */ 
+            __RPC__deref_out  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            IMetaData * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            IMetaData * This);
+        
+        /* [local] */ HRESULT ( STDMETHODCALLTYPE *GetData )( 
+            IMetaData * This,
+            /* [out] */ 
+            __deref_opt_out  LPWSTR *ppszKey,
+            /* [out] */ 
+            __deref_opt_out  LPWSTR *ppszValue);
+        
+        END_INTERFACE
+    } IMetaDataVtbl;
+
+    interface IMetaData
+    {
+        CONST_VTBL struct IMetaDataVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define IMetaData_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define IMetaData_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define IMetaData_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define IMetaData_GetData(This,ppszKey,ppszValue)	\
+    ( (This)->lpVtbl -> GetData(This,ppszKey,ppszValue) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __IMetaData_INTERFACE_DEFINED__ */
+
+
+/* interface __MIDL_itf_structuredquery_0000_0008 */
+/* [local] */ 
+
+
+
+
+extern RPC_IF_HANDLE __MIDL_itf_structuredquery_0000_0008_v0_0_c_ifspec;
+extern RPC_IF_HANDLE __MIDL_itf_structuredquery_0000_0008_v0_0_s_ifspec;
+
+#ifndef __IEntity_INTERFACE_DEFINED__
+#define __IEntity_INTERFACE_DEFINED__
+
+/* interface IEntity */
+/* [unique][object][uuid][helpstring] */ 
+
+
+EXTERN_C const IID IID_IEntity;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("24264891-E80B-4fd3-B7CE-4FF2FAE8931F")
+    IEntity : public IUnknown
+    {
+    public:
+        virtual /* [local] */ HRESULT STDMETHODCALLTYPE Name( 
+            /* [retval][out] */ 
+            __deref_opt_out  LPWSTR *ppszName) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE Base( 
+            /* [retval][out] */ __RPC__deref_out_opt IEntity **pBaseEntity) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE Relationships( 
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][retval][out] */ __RPC__deref_out_opt void **pRelationships) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE GetRelationship( 
+            /* [in] */ __RPC__in LPCWSTR pszRelationName,
+            /* [retval][out] */ __RPC__deref_out_opt IRelationship **pRelationship) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE MetaData( 
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][retval][out] */ __RPC__deref_out_opt void **pMetaData) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE NamedEntities( 
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][retval][out] */ __RPC__deref_out_opt void **pNamedEntities) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE GetNamedEntity( 
+            /* [in] */ __RPC__in LPCWSTR pszValue,
+            /* [retval][out] */ __RPC__deref_out_opt INamedEntity **ppNamedEntity) = 0;
+        
+        virtual /* [local] */ HRESULT STDMETHODCALLTYPE DefaultPhrase( 
+            /* [retval][out] */ 
+            __deref_opt_out  LPWSTR *ppszPhrase) = 0;
+        
+    };
+    
+#else 	/* C style interface */
+
+    typedef struct IEntityVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            IEntity * This,
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][out] */ 
+            __RPC__deref_out  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            IEntity * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            IEntity * This);
+        
+        /* [local] */ HRESULT ( STDMETHODCALLTYPE *Name )( 
+            IEntity * This,
+            /* [retval][out] */ 
+            __deref_opt_out  LPWSTR *ppszName);
+        
+        HRESULT ( STDMETHODCALLTYPE *Base )( 
+            IEntity * This,
+            /* [retval][out] */ __RPC__deref_out_opt IEntity **pBaseEntity);
+        
+        HRESULT ( STDMETHODCALLTYPE *Relationships )( 
+            IEntity * This,
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][retval][out] */ __RPC__deref_out_opt void **pRelationships);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetRelationship )( 
+            IEntity * This,
+            /* [in] */ __RPC__in LPCWSTR pszRelationName,
+            /* [retval][out] */ __RPC__deref_out_opt IRelationship **pRelationship);
+        
+        HRESULT ( STDMETHODCALLTYPE *MetaData )( 
+            IEntity * This,
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][retval][out] */ __RPC__deref_out_opt void **pMetaData);
+        
+        HRESULT ( STDMETHODCALLTYPE *NamedEntities )( 
+            IEntity * This,
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][retval][out] */ __RPC__deref_out_opt void **pNamedEntities);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetNamedEntity )( 
+            IEntity * This,
+            /* [in] */ __RPC__in LPCWSTR pszValue,
+            /* [retval][out] */ __RPC__deref_out_opt INamedEntity **ppNamedEntity);
+        
+        /* [local] */ HRESULT ( STDMETHODCALLTYPE *DefaultPhrase )( 
+            IEntity * This,
+            /* [retval][out] */ 
+            __deref_opt_out  LPWSTR *ppszPhrase);
+        
+        END_INTERFACE
+    } IEntityVtbl;
+
+    interface IEntity
+    {
+        CONST_VTBL struct IEntityVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define IEntity_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define IEntity_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define IEntity_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define IEntity_Name(This,ppszName)	\
+    ( (This)->lpVtbl -> Name(This,ppszName) ) 
+
+#define IEntity_Base(This,pBaseEntity)	\
+    ( (This)->lpVtbl -> Base(This,pBaseEntity) ) 
+
+#define IEntity_Relationships(This,riid,pRelationships)	\
+    ( (This)->lpVtbl -> Relationships(This,riid,pRelationships) ) 
+
+#define IEntity_GetRelationship(This,pszRelationName,pRelationship)	\
+    ( (This)->lpVtbl -> GetRelationship(This,pszRelationName,pRelationship) ) 
+
+#define IEntity_MetaData(This,riid,pMetaData)	\
+    ( (This)->lpVtbl -> MetaData(This,riid,pMetaData) ) 
+
+#define IEntity_NamedEntities(This,riid,pNamedEntities)	\
+    ( (This)->lpVtbl -> NamedEntities(This,riid,pNamedEntities) ) 
+
+#define IEntity_GetNamedEntity(This,pszValue,ppNamedEntity)	\
+    ( (This)->lpVtbl -> GetNamedEntity(This,pszValue,ppNamedEntity) ) 
+
+#define IEntity_DefaultPhrase(This,ppszPhrase)	\
+    ( (This)->lpVtbl -> DefaultPhrase(This,ppszPhrase) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __IEntity_INTERFACE_DEFINED__ */
+
+
+#ifndef __IRelationship_INTERFACE_DEFINED__
+#define __IRelationship_INTERFACE_DEFINED__
+
+/* interface IRelationship */
+/* [unique][object][uuid][helpstring] */ 
+
+
+EXTERN_C const IID IID_IRelationship;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("2769280B-5108-498c-9C7F-A51239B63147")
+    IRelationship : public IUnknown
+    {
+    public:
+        virtual /* [local] */ HRESULT STDMETHODCALLTYPE Name( 
+            /* [retval][out] */ 
+            __deref_opt_out  LPWSTR *ppszName) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE IsReal( 
+            /* [retval][out] */ __RPC__out BOOL *pIsReal) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE Destination( 
+            /* [retval][out] */ __RPC__deref_out_opt IEntity **pDestinationEntity) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE MetaData( 
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][retval][out] */ __RPC__deref_out_opt void **pMetaData) = 0;
+        
+        virtual /* [local] */ HRESULT STDMETHODCALLTYPE DefaultPhrase( 
+            /* [retval][out] */ 
+            __deref_opt_out  LPWSTR *ppszPhrase) = 0;
+        
+    };
+    
+#else 	/* C style interface */
+
+    typedef struct IRelationshipVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            IRelationship * This,
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][out] */ 
+            __RPC__deref_out  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            IRelationship * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            IRelationship * This);
+        
+        /* [local] */ HRESULT ( STDMETHODCALLTYPE *Name )( 
+            IRelationship * This,
+            /* [retval][out] */ 
+            __deref_opt_out  LPWSTR *ppszName);
+        
+        HRESULT ( STDMETHODCALLTYPE *IsReal )( 
+            IRelationship * This,
+            /* [retval][out] */ __RPC__out BOOL *pIsReal);
+        
+        HRESULT ( STDMETHODCALLTYPE *Destination )( 
+            IRelationship * This,
+            /* [retval][out] */ __RPC__deref_out_opt IEntity **pDestinationEntity);
+        
+        HRESULT ( STDMETHODCALLTYPE *MetaData )( 
+            IRelationship * This,
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][retval][out] */ __RPC__deref_out_opt void **pMetaData);
+        
+        /* [local] */ HRESULT ( STDMETHODCALLTYPE *DefaultPhrase )( 
+            IRelationship * This,
+            /* [retval][out] */ 
+            __deref_opt_out  LPWSTR *ppszPhrase);
+        
+        END_INTERFACE
+    } IRelationshipVtbl;
+
+    interface IRelationship
+    {
+        CONST_VTBL struct IRelationshipVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define IRelationship_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define IRelationship_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define IRelationship_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define IRelationship_Name(This,ppszName)	\
+    ( (This)->lpVtbl -> Name(This,ppszName) ) 
+
+#define IRelationship_IsReal(This,pIsReal)	\
+    ( (This)->lpVtbl -> IsReal(This,pIsReal) ) 
+
+#define IRelationship_Destination(This,pDestinationEntity)	\
+    ( (This)->lpVtbl -> Destination(This,pDestinationEntity) ) 
+
+#define IRelationship_MetaData(This,riid,pMetaData)	\
+    ( (This)->lpVtbl -> MetaData(This,riid,pMetaData) ) 
+
+#define IRelationship_DefaultPhrase(This,ppszPhrase)	\
+    ( (This)->lpVtbl -> DefaultPhrase(This,ppszPhrase) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __IRelationship_INTERFACE_DEFINED__ */
+
+
+#ifndef __INamedEntity_INTERFACE_DEFINED__
+#define __INamedEntity_INTERFACE_DEFINED__
+
+/* interface INamedEntity */
+/* [unique][uuid][object][helpstring] */ 
+
+
+EXTERN_C const IID IID_INamedEntity;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("ABDBD0B1-7D54-49fb-AB5C-BFF4130004CD")
+    INamedEntity : public IUnknown
+    {
+    public:
+        virtual HRESULT STDMETHODCALLTYPE GetValue( 
+            /* [retval][out] */ __RPC__deref_out_opt LPWSTR *ppszValue) = 0;
+        
+        virtual /* [local] */ HRESULT STDMETHODCALLTYPE DefaultPhrase( 
+            /* [retval][out] */ 
+            __deref_opt_out  LPWSTR *ppszPhrase) = 0;
+        
+    };
+    
+#else 	/* C style interface */
+
+    typedef struct INamedEntityVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            INamedEntity * This,
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][out] */ 
+            __RPC__deref_out  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            INamedEntity * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            INamedEntity * This);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetValue )( 
+            INamedEntity * This,
+            /* [retval][out] */ __RPC__deref_out_opt LPWSTR *ppszValue);
+        
+        /* [local] */ HRESULT ( STDMETHODCALLTYPE *DefaultPhrase )( 
+            INamedEntity * This,
+            /* [retval][out] */ 
+            __deref_opt_out  LPWSTR *ppszPhrase);
+        
+        END_INTERFACE
+    } INamedEntityVtbl;
+
+    interface INamedEntity
+    {
+        CONST_VTBL struct INamedEntityVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define INamedEntity_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define INamedEntity_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define INamedEntity_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define INamedEntity_GetValue(This,ppszValue)	\
+    ( (This)->lpVtbl -> GetValue(This,ppszValue) ) 
+
+#define INamedEntity_DefaultPhrase(This,ppszPhrase)	\
+    ( (This)->lpVtbl -> DefaultPhrase(This,ppszPhrase) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __INamedEntity_INTERFACE_DEFINED__ */
+
+
+#ifndef __ISchemaProvider_INTERFACE_DEFINED__
+#define __ISchemaProvider_INTERFACE_DEFINED__
+
+/* interface ISchemaProvider */
+/* [unique][object][uuid][helpstring] */ 
+
+
+EXTERN_C const IID IID_ISchemaProvider;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("8CF89BCB-394C-49b2-AE28-A59DD4ED7F68")
+    ISchemaProvider : public IUnknown
+    {
+    public:
+        virtual HRESULT STDMETHODCALLTYPE Entities( 
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][retval][out] */ __RPC__deref_out_opt void **pEntities) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE RootEntity( 
+            /* [retval][out] */ __RPC__deref_out_opt IEntity **pRootEntity) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE GetEntity( 
+            /* [in] */ __RPC__in LPCWSTR pszEntityName,
+            /* [retval][out] */ __RPC__deref_out_opt IEntity **pEntity) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE MetaData( 
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][retval][out] */ __RPC__deref_out_opt void **pMetaData) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE Localize( 
+            /* [in] */ LCID lcid,
+            /* [in] */ __RPC__in_opt ISchemaLocalizerSupport *pSchemaLocalizerSupport) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE SaveBinary( 
+            /* [in] */ __RPC__in LPCWSTR pszSchemaBinaryPath) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE LookupAuthoredNamedEntity( 
+            /* [in] */ __RPC__in_opt IEntity *pEntity,
+            /* [in] */ __RPC__in LPCWSTR pszInputString,
+            /* [in] */ __RPC__in_opt ITokenCollection *pTokenCollection,
+            /* [in] */ ULONG cTokensBegin,
+            /* [out] */ __RPC__out ULONG *pcTokensLength,
+            /* [out] */ __RPC__deref_out_opt LPWSTR *ppszValue) = 0;
+        
+    };
+    
+#else 	/* C style interface */
+
+    typedef struct ISchemaProviderVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            ISchemaProvider * This,
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][out] */ 
+            __RPC__deref_out  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            ISchemaProvider * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            ISchemaProvider * This);
+        
+        HRESULT ( STDMETHODCALLTYPE *Entities )( 
+            ISchemaProvider * This,
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][retval][out] */ __RPC__deref_out_opt void **pEntities);
+        
+        HRESULT ( STDMETHODCALLTYPE *RootEntity )( 
+            ISchemaProvider * This,
+            /* [retval][out] */ __RPC__deref_out_opt IEntity **pRootEntity);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetEntity )( 
+            ISchemaProvider * This,
+            /* [in] */ __RPC__in LPCWSTR pszEntityName,
+            /* [retval][out] */ __RPC__deref_out_opt IEntity **pEntity);
+        
+        HRESULT ( STDMETHODCALLTYPE *MetaData )( 
+            ISchemaProvider * This,
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][retval][out] */ __RPC__deref_out_opt void **pMetaData);
+        
+        HRESULT ( STDMETHODCALLTYPE *Localize )( 
+            ISchemaProvider * This,
+            /* [in] */ LCID lcid,
+            /* [in] */ __RPC__in_opt ISchemaLocalizerSupport *pSchemaLocalizerSupport);
+        
+        HRESULT ( STDMETHODCALLTYPE *SaveBinary )( 
+            ISchemaProvider * This,
+            /* [in] */ __RPC__in LPCWSTR pszSchemaBinaryPath);
+        
+        HRESULT ( STDMETHODCALLTYPE *LookupAuthoredNamedEntity )( 
+            ISchemaProvider * This,
+            /* [in] */ __RPC__in_opt IEntity *pEntity,
+            /* [in] */ __RPC__in LPCWSTR pszInputString,
+            /* [in] */ __RPC__in_opt ITokenCollection *pTokenCollection,
+            /* [in] */ ULONG cTokensBegin,
+            /* [out] */ __RPC__out ULONG *pcTokensLength,
+            /* [out] */ __RPC__deref_out_opt LPWSTR *ppszValue);
+        
+        END_INTERFACE
+    } ISchemaProviderVtbl;
+
+    interface ISchemaProvider
+    {
+        CONST_VTBL struct ISchemaProviderVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define ISchemaProvider_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define ISchemaProvider_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define ISchemaProvider_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define ISchemaProvider_Entities(This,riid,pEntities)	\
+    ( (This)->lpVtbl -> Entities(This,riid,pEntities) ) 
+
+#define ISchemaProvider_RootEntity(This,pRootEntity)	\
+    ( (This)->lpVtbl -> RootEntity(This,pRootEntity) ) 
+
+#define ISchemaProvider_GetEntity(This,pszEntityName,pEntity)	\
+    ( (This)->lpVtbl -> GetEntity(This,pszEntityName,pEntity) ) 
+
+#define ISchemaProvider_MetaData(This,riid,pMetaData)	\
+    ( (This)->lpVtbl -> MetaData(This,riid,pMetaData) ) 
+
+#define ISchemaProvider_Localize(This,lcid,pSchemaLocalizerSupport)	\
+    ( (This)->lpVtbl -> Localize(This,lcid,pSchemaLocalizerSupport) ) 
+
+#define ISchemaProvider_SaveBinary(This,pszSchemaBinaryPath)	\
+    ( (This)->lpVtbl -> SaveBinary(This,pszSchemaBinaryPath) ) 
+
+#define ISchemaProvider_LookupAuthoredNamedEntity(This,pEntity,pszInputString,pTokenCollection,cTokensBegin,pcTokensLength,ppszValue)	\
+    ( (This)->lpVtbl -> LookupAuthoredNamedEntity(This,pEntity,pszInputString,pTokenCollection,cTokensBegin,pcTokensLength,ppszValue) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __ISchemaProvider_INTERFACE_DEFINED__ */
+
+
+#ifndef __ITokenCollection_INTERFACE_DEFINED__
+#define __ITokenCollection_INTERFACE_DEFINED__
+
+/* interface ITokenCollection */
+/* [unique][object][uuid][helpstring] */ 
+
+
+EXTERN_C const IID IID_ITokenCollection;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("22D8B4F2-F577-4adb-A335-C2AE88416FAB")
+    ITokenCollection : public IUnknown
+    {
+    public:
+        virtual HRESULT STDMETHODCALLTYPE NumberOfTokens( 
+            __RPC__in ULONG *pCount) = 0;
+        
+        virtual /* [local] */ HRESULT STDMETHODCALLTYPE GetToken( 
+            /* [in] */ ULONG i,
+            /* [out] */ 
+            __out_opt  ULONG *pBegin,
+            /* [out] */ 
+            __out_opt  ULONG *pLength,
+            /* [out] */ 
+            __deref_opt_out  LPWSTR *ppsz) = 0;
+        
+    };
+    
+#else 	/* C style interface */
+
+    typedef struct ITokenCollectionVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            ITokenCollection * This,
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][out] */ 
+            __RPC__deref_out  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            ITokenCollection * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            ITokenCollection * This);
+        
+        HRESULT ( STDMETHODCALLTYPE *NumberOfTokens )( 
+            ITokenCollection * This,
+            __RPC__in ULONG *pCount);
+        
+        /* [local] */ HRESULT ( STDMETHODCALLTYPE *GetToken )( 
+            ITokenCollection * This,
+            /* [in] */ ULONG i,
+            /* [out] */ 
+            __out_opt  ULONG *pBegin,
+            /* [out] */ 
+            __out_opt  ULONG *pLength,
+            /* [out] */ 
+            __deref_opt_out  LPWSTR *ppsz);
+        
+        END_INTERFACE
+    } ITokenCollectionVtbl;
+
+    interface ITokenCollection
+    {
+        CONST_VTBL struct ITokenCollectionVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define ITokenCollection_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define ITokenCollection_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define ITokenCollection_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define ITokenCollection_NumberOfTokens(This,pCount)	\
+    ( (This)->lpVtbl -> NumberOfTokens(This,pCount) ) 
+
+#define ITokenCollection_GetToken(This,i,pBegin,pLength,ppsz)	\
+    ( (This)->lpVtbl -> GetToken(This,i,pBegin,pLength,ppsz) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __ITokenCollection_INTERFACE_DEFINED__ */
+
+
+/* interface __MIDL_itf_structuredquery_0000_0013 */
+/* [local] */ 
+
+typedef /* [public][public][v1_enum] */ 
+enum __MIDL___MIDL_itf_structuredquery_0000_0013_0001
+    {	NEC_LOW	= 0,
+	NEC_MEDIUM	= ( NEC_LOW + 1 ) ,
+	NEC_HIGH	= ( NEC_MEDIUM + 1 ) 
+    } 	NAMED_ENTITY_CERTAINTY;
+
+
+
+extern RPC_IF_HANDLE __MIDL_itf_structuredquery_0000_0013_v0_0_c_ifspec;
+extern RPC_IF_HANDLE __MIDL_itf_structuredquery_0000_0013_v0_0_s_ifspec;
+
+#ifndef __INamedEntityCollector_INTERFACE_DEFINED__
+#define __INamedEntityCollector_INTERFACE_DEFINED__
+
+/* interface INamedEntityCollector */
+/* [unique][object][uuid][helpstring] */ 
+
+
+EXTERN_C const IID IID_INamedEntityCollector;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("AF2440F6-8AFC-47d0-9A7F-396A0ACFB43D")
+    INamedEntityCollector : public IUnknown
+    {
+    public:
+        virtual HRESULT STDMETHODCALLTYPE Add( 
+            /* [in] */ ULONG beginSpan,
+            /* [in] */ ULONG endSpan,
+            /* [in] */ ULONG beginActual,
+            /* [in] */ ULONG endActual,
+            /* [in] */ __RPC__in_opt IEntity *pType,
+            /* [in] */ __RPC__in LPCWSTR pszValue,
+            /* [in] */ NAMED_ENTITY_CERTAINTY certainty) = 0;
+        
+    };
+    
+#else 	/* C style interface */
+
+    typedef struct INamedEntityCollectorVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            INamedEntityCollector * This,
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][out] */ 
+            __RPC__deref_out  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            INamedEntityCollector * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            INamedEntityCollector * This);
+        
+        HRESULT ( STDMETHODCALLTYPE *Add )( 
+            INamedEntityCollector * This,
+            /* [in] */ ULONG beginSpan,
+            /* [in] */ ULONG endSpan,
+            /* [in] */ ULONG beginActual,
+            /* [in] */ ULONG endActual,
+            /* [in] */ __RPC__in_opt IEntity *pType,
+            /* [in] */ __RPC__in LPCWSTR pszValue,
+            /* [in] */ NAMED_ENTITY_CERTAINTY certainty);
+        
+        END_INTERFACE
+    } INamedEntityCollectorVtbl;
+
+    interface INamedEntityCollector
+    {
+        CONST_VTBL struct INamedEntityCollectorVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define INamedEntityCollector_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define INamedEntityCollector_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define INamedEntityCollector_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define INamedEntityCollector_Add(This,beginSpan,endSpan,beginActual,endActual,pType,pszValue,certainty)	\
+    ( (This)->lpVtbl -> Add(This,beginSpan,endSpan,beginActual,endActual,pType,pszValue,certainty) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __INamedEntityCollector_INTERFACE_DEFINED__ */
+
+
+#ifndef __ISchemaLocalizerSupport_INTERFACE_DEFINED__
+#define __ISchemaLocalizerSupport_INTERFACE_DEFINED__
+
+/* interface ISchemaLocalizerSupport */
+/* [unique][object][uuid] */ 
+
+
+EXTERN_C const IID IID_ISchemaLocalizerSupport;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("CA3FDCA2-BFBE-4eed-90D7-0CAEF0A1BDA1")
+    ISchemaLocalizerSupport : public IUnknown
+    {
+    public:
+        virtual HRESULT STDMETHODCALLTYPE Localize( 
+            /* [in] */ __RPC__in LPCWSTR pszGlobalString,
+            /* [retval][out] */ __RPC__deref_out_opt LPWSTR *ppszLocalString) = 0;
+        
+    };
+    
+#else 	/* C style interface */
+
+    typedef struct ISchemaLocalizerSupportVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            ISchemaLocalizerSupport * This,
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][out] */ 
+            __RPC__deref_out  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            ISchemaLocalizerSupport * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            ISchemaLocalizerSupport * This);
+        
+        HRESULT ( STDMETHODCALLTYPE *Localize )( 
+            ISchemaLocalizerSupport * This,
+            /* [in] */ __RPC__in LPCWSTR pszGlobalString,
+            /* [retval][out] */ __RPC__deref_out_opt LPWSTR *ppszLocalString);
+        
+        END_INTERFACE
+    } ISchemaLocalizerSupportVtbl;
+
+    interface ISchemaLocalizerSupport
+    {
+        CONST_VTBL struct ISchemaLocalizerSupportVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define ISchemaLocalizerSupport_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define ISchemaLocalizerSupport_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define ISchemaLocalizerSupport_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define ISchemaLocalizerSupport_Localize(This,pszGlobalString,ppszLocalString)	\
+    ( (This)->lpVtbl -> Localize(This,pszGlobalString,ppszLocalString) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __ISchemaLocalizerSupport_INTERFACE_DEFINED__ */
+
+
+#ifndef __IQueryParserManager_INTERFACE_DEFINED__
+#define __IQueryParserManager_INTERFACE_DEFINED__
+
+/* interface IQueryParserManager */
+/* [unique][object][uuid] */ 
+
+
+EXTERN_C const IID IID_IQueryParserManager;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("A879E3C4-AF77-44fb-8F37-EBD1487CF920")
+    IQueryParserManager : public IUnknown
+    {
+    public:
+        virtual HRESULT STDMETHODCALLTYPE CreateLoadedParser( 
+            /* [in] */ __RPC__in LPCWSTR pszCatalog,
+            /* [in] */ LANGID langidForKeywords,
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][retval][out] */ __RPC__deref_out_opt void **ppQueryParser) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE InitializeOptions( 
+            /* [in] */ BOOL fUnderstandNQS,
+            /* [in] */ BOOL fAutoWildCard,
+            /* [in] */ __RPC__in_opt IQueryParser *pQueryParser) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE SetOption( 
+            /* [in] */ QUERY_PARSER_MANAGER_OPTION option,
+            /* [in] */ __RPC__in const PROPVARIANT *pOptionValue) = 0;
+        
+    };
+    
+#else 	/* C style interface */
+
+    typedef struct IQueryParserManagerVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            IQueryParserManager * This,
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][out] */ 
+            __RPC__deref_out  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            IQueryParserManager * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            IQueryParserManager * This);
+        
+        HRESULT ( STDMETHODCALLTYPE *CreateLoadedParser )( 
+            IQueryParserManager * This,
+            /* [in] */ __RPC__in LPCWSTR pszCatalog,
+            /* [in] */ LANGID langidForKeywords,
+            /* [in] */ __RPC__in REFIID riid,
+            /* [iid_is][retval][out] */ __RPC__deref_out_opt void **ppQueryParser);
+        
+        HRESULT ( STDMETHODCALLTYPE *InitializeOptions )( 
+            IQueryParserManager * This,
+            /* [in] */ BOOL fUnderstandNQS,
+            /* [in] */ BOOL fAutoWildCard,
+            /* [in] */ __RPC__in_opt IQueryParser *pQueryParser);
+        
+        HRESULT ( STDMETHODCALLTYPE *SetOption )( 
+            IQueryParserManager * This,
+            /* [in] */ QUERY_PARSER_MANAGER_OPTION option,
+            /* [in] */ __RPC__in const PROPVARIANT *pOptionValue);
+        
+        END_INTERFACE
+    } IQueryParserManagerVtbl;
+
+    interface IQueryParserManager
+    {
+        CONST_VTBL struct IQueryParserManagerVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define IQueryParserManager_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define IQueryParserManager_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define IQueryParserManager_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define IQueryParserManager_CreateLoadedParser(This,pszCatalog,langidForKeywords,riid,ppQueryParser)	\
+    ( (This)->lpVtbl -> CreateLoadedParser(This,pszCatalog,langidForKeywords,riid,ppQueryParser) ) 
+
+#define IQueryParserManager_InitializeOptions(This,fUnderstandNQS,fAutoWildCard,pQueryParser)	\
+    ( (This)->lpVtbl -> InitializeOptions(This,fUnderstandNQS,fAutoWildCard,pQueryParser) ) 
+
+#define IQueryParserManager_SetOption(This,option,pOptionValue)	\
+    ( (This)->lpVtbl -> SetOption(This,option,pOptionValue) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __IQueryParserManager_INTERFACE_DEFINED__ */
+
+
+
+#ifndef __StructuredQuery1_LIBRARY_DEFINED__
+#define __StructuredQuery1_LIBRARY_DEFINED__
+
+/* library StructuredQuery1 */
+/* [version][uuid] */ 
+
+
+EXTERN_C const IID LIBID_StructuredQuery1;
+
+EXTERN_C const CLSID CLSID_QueryParser;
+
+#ifdef __cplusplus
+
+class DECLSPEC_UUID("B72F8FD8-0FAB-4dd9-BDBF-245A6CE1485B")
+QueryParser;
+#endif
+
+EXTERN_C const CLSID CLSID_NegationCondition;
+
+#ifdef __cplusplus
+
+class DECLSPEC_UUID("8DE9C74C-605A-4acd-BEE3-2B222AA2D23D")
+NegationCondition;
+#endif
+
+EXTERN_C const CLSID CLSID_CompoundCondition;
+
+#ifdef __cplusplus
+
+class DECLSPEC_UUID("116F8D13-101E-4fa5-84D4-FF8279381935")
+CompoundCondition;
+#endif
+
+EXTERN_C const CLSID CLSID_LeafCondition;
+
+#ifdef __cplusplus
+
+class DECLSPEC_UUID("52F15C89-5A17-48e1-BBCD-46A3F89C7CC2")
+LeafCondition;
+#endif
+
+EXTERN_C const CLSID CLSID_ConditionFactory;
+
+#ifdef __cplusplus
+
+class DECLSPEC_UUID("E03E85B0-7BE3-4000-BA98-6C13DE9FA486")
+ConditionFactory;
+#endif
+
+EXTERN_C const CLSID CLSID_Interval;
+
+#ifdef __cplusplus
+
+class DECLSPEC_UUID("D957171F-4BF9-4de2-BCD5-C70A7CA55836")
+Interval;
+#endif
+
+EXTERN_C const CLSID CLSID_QueryParserManager;
+
+#ifdef __cplusplus
+
+class DECLSPEC_UUID("5088B39A-29B4-4d9d-8245-4EE289222F66")
+QueryParserManager;
+#endif
+#endif /* __StructuredQuery1_LIBRARY_DEFINED__ */
+
+/* Additional Prototypes for ALL interfaces */
+
+unsigned long             __RPC_USER  BSTR_UserSize(     unsigned long *, unsigned long            , BSTR * ); 
+unsigned char * __RPC_USER  BSTR_UserMarshal(  unsigned long *, unsigned char *, BSTR * ); 
+unsigned char * __RPC_USER  BSTR_UserUnmarshal(unsigned long *, unsigned char *, BSTR * ); 
+void                      __RPC_USER  BSTR_UserFree(     unsigned long *, BSTR * ); 
+
+unsigned long             __RPC_USER  LPSAFEARRAY_UserSize(     unsigned long *, unsigned long            , LPSAFEARRAY * ); 
+unsigned char * __RPC_USER  LPSAFEARRAY_UserMarshal(  unsigned long *, unsigned char *, LPSAFEARRAY * ); 
+unsigned char * __RPC_USER  LPSAFEARRAY_UserUnmarshal(unsigned long *, unsigned char *, LPSAFEARRAY * ); 
+void                      __RPC_USER  LPSAFEARRAY_UserFree(     unsigned long *, LPSAFEARRAY * ); 
+
+/* end of Additional Prototypes */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+
+
diff --git a/src/hostapi/wasapi/pa_win_wasapi.c b/src/hostapi/wasapi/pa_win_wasapi.c
index aecdd63..b12b91f 100644
--- a/src/hostapi/wasapi/pa_win_wasapi.c
+++ b/src/hostapi/wasapi/pa_win_wasapi.c
@@ -1,5181 +1,5738 @@
-/*
- * Portable Audio I/O Library WASAPI implementation
- * Copyright (c) 2006-2010 David Viens, Dmitry Kostjuchenko
- *
- * Based on the Open Source API proposed by Ross Bencina
- * Copyright (c) 1999-2002 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 hostapi_src
- @brief WASAPI implementation of support for a host API.
- @note pa_wasapi currently requires minimum VC 2005, and the latest Vista SDK
-*/
-
-#define WIN32_LEAN_AND_MEAN // exclude rare headers
-#include <windows.h>
-#include <stdio.h>
-#include <process.h>
-#include <assert.h>
-#include <mmsystem.h>
-#include <mmreg.h>  // must be before other Wasapi headers
-#if defined(_MSC_VER) && (_MSC_VER >= 1400)
-	#include <Avrt.h>
-	#define COBJMACROS
-	#include <Audioclient.h>
-	#include <endpointvolume.h>
-	#define INITGUID // Avoid additional linkage of static libs, excessive code will be optimized out by the compiler
-	#include <mmdeviceapi.h>
-	#include <functiondiscoverykeys.h>
-    #include <devicetopology.h>	// Used to get IKsJackDescription interface
-	#undef INITGUID
-#endif
-#ifndef __MWERKS__
-#include <malloc.h>
-#include <memory.h>
-#endif /* __MWERKS__ */
-
-#include "pa_util.h"
-#include "pa_allocation.h"
-#include "pa_hostapi.h"
-#include "pa_stream.h"
-#include "pa_cpuload.h"
-#include "pa_process.h"
-#include "pa_win_wasapi.h"
-#include "pa_debugprint.h"
-#include "pa_ringbuffer.h"
-
-#include "pa_win_coinitialize.h"
-
-#ifndef NTDDI_VERSION
- 
-    #undef WINVER
-    #undef _WIN32_WINNT
-    #define WINVER       0x0600 // VISTA
-	#define _WIN32_WINNT WINVER
-
-	#ifndef _AVRT_ //<< fix MinGW dummy compile by defining missing type: AVRT_PRIORITY
-        typedef enum _AVRT_PRIORITY
-        {
-            AVRT_PRIORITY_LOW = -1,
-            AVRT_PRIORITY_NORMAL,
-            AVRT_PRIORITY_HIGH,
-            AVRT_PRIORITY_CRITICAL
-        } AVRT_PRIORITY, *PAVRT_PRIORITY;
-	#endif
-
-	#include <basetyps.h> // << for IID/CLSID
-    #include <rpcsal.h>
-    #include <sal.h>
-
-	#ifndef __LPCGUID_DEFINED__
-		#define __LPCGUID_DEFINED__
-		typedef const GUID *LPCGUID;
-	#endif
-
-    #ifndef PROPERTYKEY_DEFINED
-        #define PROPERTYKEY_DEFINED
-        typedef struct _tagpropertykey
-        {
-            GUID fmtid;
-            DWORD pid;
-        } 	PROPERTYKEY;
-    #endif
-
-    #ifdef __midl_proxy
-        #define __MIDL_CONST
-    #else
-        #define __MIDL_CONST const
-    #endif
-
-    #ifdef WIN64
-        #include <wtypes.h>
-        typedef LONG NTSTATUS;
-        #define FASTCALL
-        #include <oleidl.h>
-        #include <objidl.h>
-     #else
-        typedef struct _BYTE_BLOB
-        {
-            unsigned long clSize;
-            unsigned char abData[ 1 ];
-        } 	BYTE_BLOB;
-        typedef /* [unique] */  __RPC_unique_pointer BYTE_BLOB *UP_BYTE_BLOB;
-        typedef LONGLONG REFERENCE_TIME;
-        #define NONAMELESSUNION
-    #endif
-    
-    #ifndef WAVE_FORMAT_IEEE_FLOAT
-        #define WAVE_FORMAT_IEEE_FLOAT 0x0003 // 32-bit floating-point
-    #endif    
-    
-    #ifndef __MINGW_EXTENSION
-        #if defined(__GNUC__) || defined(__GNUG__)
-            #define __MINGW_EXTENSION __extension__
-        #else
-            #define __MINGW_EXTENSION
-        #endif
-    #endif 
-
-    #include <sdkddkver.h>
-    #include <propkeydef.h>
-    #define COBJMACROS
-    #define INITGUID // Avoid additional linkage of static libs, excessive code will be optimized out by the compiler
-    #include <audioclient.h>
-    #include <mmdeviceapi.h>
-    #include <endpointvolume.h>
-    #include <functiondiscoverykeys.h>
-	#include <devicetopology.h>	// Used to get IKsJackDescription interface
-    #undef INITGUID
-
-#endif // NTDDI_VERSION
-
-#ifndef GUID_SECT
-    #define GUID_SECT
-#endif
-
-#define __DEFINE_GUID(n,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) static const GUID n GUID_SECT = {l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}}
-#define __DEFINE_IID(n,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) static const IID n GUID_SECT = {l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}}
-#define __DEFINE_CLSID(n,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) static const CLSID n GUID_SECT = {l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}}
-#define PA_DEFINE_CLSID(className, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
-    __DEFINE_CLSID(pa_CLSID_##className, 0x##l, 0x##w1, 0x##w2, 0x##b1, 0x##b2, 0x##b3, 0x##b4, 0x##b5, 0x##b6, 0x##b7, 0x##b8)
-#define PA_DEFINE_IID(interfaceName, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
-    __DEFINE_IID(pa_IID_##interfaceName, 0x##l, 0x##w1, 0x##w2, 0x##b1, 0x##b2, 0x##b3, 0x##b4, 0x##b5, 0x##b6, 0x##b7, 0x##b8)
-
-// "1CB9AD4C-DBFA-4c32-B178-C2F568A703B2"
-PA_DEFINE_IID(IAudioClient,         1cb9ad4c, dbfa, 4c32, b1, 78, c2, f5, 68, a7, 03, b2);
-// "1BE09788-6894-4089-8586-9A2A6C265AC5"
-PA_DEFINE_IID(IMMEndpoint,          1be09788, 6894, 4089, 85, 86, 9a, 2a, 6c, 26, 5a, c5);
-// "A95664D2-9614-4F35-A746-DE8DB63617E6"
-PA_DEFINE_IID(IMMDeviceEnumerator,  a95664d2, 9614, 4f35, a7, 46, de, 8d, b6, 36, 17, e6);
-// "BCDE0395-E52F-467C-8E3D-C4579291692E"
-PA_DEFINE_CLSID(IMMDeviceEnumerator,bcde0395, e52f, 467c, 8e, 3d, c4, 57, 92, 91, 69, 2e);
-// "F294ACFC-3146-4483-A7BF-ADDCA7C260E2"
-PA_DEFINE_IID(IAudioRenderClient,   f294acfc, 3146, 4483, a7, bf, ad, dc, a7, c2, 60, e2);
-// "C8ADBD64-E71E-48a0-A4DE-185C395CD317"
-PA_DEFINE_IID(IAudioCaptureClient,  c8adbd64, e71e, 48a0, a4, de, 18, 5c, 39, 5c, d3, 17);
-// *2A07407E-6497-4A18-9787-32F79BD0D98F*  Or this??
-PA_DEFINE_IID(IDeviceTopology,      2A07407E, 6497, 4A18, 97, 87, 32, f7, 9b, d0, d9, 8f);
-// *AE2DE0E4-5BCA-4F2D-AA46-5D13F8FDB3A9*
-PA_DEFINE_IID(IPart,                AE2DE0E4, 5BCA, 4F2D, aa, 46, 5d, 13, f8, fd, b3, a9);
-// *4509F757-2D46-4637-8E62-CE7DB944F57B*
-PA_DEFINE_IID(IKsJackDescription,   4509F757, 2D46, 4637, 8e, 62, ce, 7d, b9, 44, f5, 7b);
-// Media formats:
-__DEFINE_GUID(pa_KSDATAFORMAT_SUBTYPE_PCM,        0x00000001, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 );
-__DEFINE_GUID(pa_KSDATAFORMAT_SUBTYPE_ADPCM,      0x00000002, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 );
-__DEFINE_GUID(pa_KSDATAFORMAT_SUBTYPE_IEEE_FLOAT, 0x00000003, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 );
-
-/* use CreateThread for CYGWIN/Windows Mobile, _beginthreadex for all others */
-#if !defined(__CYGWIN__) && !defined(_WIN32_WCE)
-	#define CREATE_THREAD(PROC) (HANDLE)_beginthreadex( NULL, 0, (PROC), stream, 0, &stream->dwThreadId )
-	#define PA_THREAD_FUNC static unsigned WINAPI
-	#define PA_THREAD_ID unsigned
-#else
-	#define CREATE_THREAD(PROC) CreateThread( NULL, 0, (PROC), stream, 0, &stream->dwThreadId )
-	#define PA_THREAD_FUNC static DWORD WINAPI
-	#define PA_THREAD_ID DWORD
-#endif
-
-// Thread function forward decl.
-PA_THREAD_FUNC ProcThreadEvent(void *param);
-PA_THREAD_FUNC ProcThreadPoll(void *param);
-
-// Availabe from Windows 7
-#ifndef AUDCLNT_E_BUFFER_ERROR
-	#define AUDCLNT_E_BUFFER_ERROR AUDCLNT_ERR(0x018)
-#endif
-#ifndef AUDCLNT_E_BUFFER_SIZE_NOT_ALIGNED
-	#define AUDCLNT_E_BUFFER_SIZE_NOT_ALIGNED AUDCLNT_ERR(0x019)
-#endif
-#ifndef AUDCLNT_E_INVALID_DEVICE_PERIOD
-	#define AUDCLNT_E_INVALID_DEVICE_PERIOD AUDCLNT_ERR(0x020)
-#endif
-
-#define MAX_STR_LEN 512
-
-enum { S_INPUT = 0, S_OUTPUT = 1, S_COUNT = 2, S_FULLDUPLEX = 0 };
-
-// Number of packets which compose single contignous buffer. With trial and error it was calculated
-// that WASAPI Input sub-system uses 6 packets per whole buffer. Please provide more information
-// or corrections if available.
-enum { WASAPI_PACKETS_PER_INPUT_BUFFER = 6 };
-
-#define STATIC_ARRAY_SIZE(array) (sizeof(array)/sizeof(array[0]))
-
-#define PRINT(x) PA_DEBUG(x);
-
-#define PA_SKELETON_SET_LAST_HOST_ERROR( errorCode, errorText ) \
-    PaUtil_SetLastHostErrorInfo( paWASAPI, errorCode, errorText )
-
-#define PA_WASAPI__IS_FULLDUPLEX(STREAM) ((STREAM)->in.clientProc && (STREAM)->out.clientProc)
-
-#ifndef IF_FAILED_JUMP
-#define IF_FAILED_JUMP(hr, label) if(FAILED(hr)) goto label;
-#endif
-
-#ifndef IF_FAILED_INTERNAL_ERROR_JUMP
-#define IF_FAILED_INTERNAL_ERROR_JUMP(hr, error, label) if(FAILED(hr)) { error = paInternalError; goto label; }
-#endif
-
-#define SAFE_CLOSE(h) if ((h) != NULL) { CloseHandle((h)); (h) = NULL; }
-#define SAFE_RELEASE(punk) if ((punk) != NULL) { (punk)->lpVtbl->Release((punk)); (punk) = NULL; }
-
-// Mixer function
-typedef void (*MixMonoToStereoF) (void *__to, void *__from, UINT32 count);
-
-// AVRT is the new "multimedia schedulling stuff"
-typedef BOOL   (WINAPI *FAvRtCreateThreadOrderingGroup)  (PHANDLE,PLARGE_INTEGER,GUID*,PLARGE_INTEGER);
-typedef BOOL   (WINAPI *FAvRtDeleteThreadOrderingGroup)  (HANDLE);
-typedef BOOL   (WINAPI *FAvRtWaitOnThreadOrderingGroup)  (HANDLE);
-typedef HANDLE (WINAPI *FAvSetMmThreadCharacteristics)   (LPCSTR,LPDWORD);
-typedef BOOL   (WINAPI *FAvRevertMmThreadCharacteristics)(HANDLE);
-typedef BOOL   (WINAPI *FAvSetMmThreadPriority)          (HANDLE,AVRT_PRIORITY);
-
-static HMODULE hDInputDLL = 0;
-FAvRtCreateThreadOrderingGroup   pAvRtCreateThreadOrderingGroup = NULL;
-FAvRtDeleteThreadOrderingGroup   pAvRtDeleteThreadOrderingGroup = NULL;
-FAvRtWaitOnThreadOrderingGroup   pAvRtWaitOnThreadOrderingGroup = NULL;
-FAvSetMmThreadCharacteristics    pAvSetMmThreadCharacteristics = NULL;
-FAvRevertMmThreadCharacteristics pAvRevertMmThreadCharacteristics = NULL;
-FAvSetMmThreadPriority           pAvSetMmThreadPriority = NULL;
-
-#define _GetProc(fun, type, name)  {                                                        \
-                                        fun = (type) GetProcAddress(hDInputDLL,name);       \
-                                        if (fun == NULL) {                                  \
-                                            PRINT(("GetProcAddr failed for %s" ,name));     \
-                                            return FALSE;                                   \
-                                        }                                                   \
-                                    }                                                       \
-
-// ------------------------------------------------------------------------------------------
-/* prototypes for functions declared in this file */
-#ifdef __cplusplus
-extern "C"
-{
-#endif /* __cplusplus */
-PaError PaWasapi_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiIndex index );
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-// dummy entry point for other compilers and sdks
-// currently built using RC1 SDK (5600)
-//#if _MSC_VER < 1400
-//PaError PaWasapi_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiIndex hostApiIndex )
-//{
-    //return paNoError;
-//}
-//#else
-
-// ------------------------------------------------------------------------------------------
-static void Terminate( struct PaUtilHostApiRepresentation *hostApi );
-static PaError IsFormatSupported( struct PaUtilHostApiRepresentation *hostApi,
-                                  const PaStreamParameters *inputParameters,
-                                  const PaStreamParameters *outputParameters,
-                                  double sampleRate );
-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* stream );
-static PaError StartStream( PaStream *stream );
-static PaError StopStream( PaStream *stream );
-static PaError AbortStream( PaStream *stream );
-static PaError IsStreamStopped( PaStream *s );
-static PaError IsStreamActive( PaStream *stream );
-static PaTime GetStreamTime( PaStream *stream );
-static double GetStreamCpuLoad( PaStream* stream );
-static PaError ReadStream( PaStream* stream, void *buffer, unsigned long frames );
-static PaError WriteStream( PaStream* stream, const void *buffer, unsigned long frames );
-static signed long GetStreamReadAvailable( PaStream* stream );
-static signed long GetStreamWriteAvailable( PaStream* stream );
-
-// ------------------------------------------------------------------------------------------
-/*
- These are fields that can be gathered from IDevice and IAudioDevice PRIOR to Initialize, and
- done in first pass i assume that neither of these will cause the Driver to "load", but again,
- who knows how they implement their stuff
- */
-typedef struct PaWasapiDeviceInfo
-{
-    // Device
-    IMMDevice *device;
-
-	// from GetId
-    WCHAR szDeviceID[MAX_STR_LEN];
-
-	// from GetState
-    DWORD state;
-
-    // Fields filled from IMMEndpoint'sGetDataFlow
-    EDataFlow flow;
-
-    // Fields filled from IAudioDevice (_prior_ to Initialize)
-    // from GetDevicePeriod(
-    REFERENCE_TIME DefaultDevicePeriod;
-    REFERENCE_TIME MinimumDevicePeriod;
-
-    // from GetMixFormat
-    // WAVEFORMATEX *MixFormat;//needs to be CoTaskMemFree'd after use!
-
-	// Default format (setup through Control Panel by user)
-	WAVEFORMATEXTENSIBLE DefaultFormat;
-
-	// Formfactor
-	EndpointFormFactor formFactor;
-}
-PaWasapiDeviceInfo;
-
-// ------------------------------------------------------------------------------------------
-/* PaWasapiHostApiRepresentation - host api datastructure specific to this implementation */
-typedef struct
-{
-    PaUtilHostApiRepresentation inheritedHostApiRep;
-    PaUtilStreamInterface       callbackStreamInterface;
-    PaUtilStreamInterface       blockingStreamInterface;
-
-    PaUtilAllocationGroup      *allocations;
-
-    /* implementation specific data goes here */
-
-    PaWinUtilComInitializationResult comInitializationResult;
-
-    //in case we later need the synch
-    IMMDeviceEnumerator *enumerator;
-
-    //this is the REAL number of devices, whether they are usefull to PA or not!
-    UINT32 deviceCount;
-
-    WCHAR defaultRenderer [MAX_STR_LEN];
-    WCHAR defaultCapturer [MAX_STR_LEN];
-
-    PaWasapiDeviceInfo *devInfo;
-
-	// Is true when WOW64 Vista/7 Workaround is needed
-	BOOL useWOW64Workaround;
-}
-PaWasapiHostApiRepresentation;
-
-// ------------------------------------------------------------------------------------------
-/* PaWasapiAudioClientParams - audio client parameters */
-typedef struct PaWasapiAudioClientParams
-{
-	PaWasapiDeviceInfo *device_info;
-	PaStreamParameters  stream_params;
-	PaWasapiStreamInfo  wasapi_params;
-	UINT32              frames_per_buffer;
-	double              sample_rate;
-	BOOL                blocking;
-	BOOL                full_duplex;
-	BOOL                wow64_workaround;
-}
-PaWasapiAudioClientParams;
-
-// ------------------------------------------------------------------------------------------
-/* PaWasapiStream - a stream data structure specifically for this implementation */
-typedef struct PaWasapiSubStream
-{
-    IAudioClient        *clientParent;
-	IStream				*clientStream;
-	IAudioClient		*clientProc;
-
-    WAVEFORMATEXTENSIBLE wavex;
-    UINT32               bufferSize;
-    REFERENCE_TIME       deviceLatency;
-    REFERENCE_TIME       period;
-	double				 latencySeconds;
-    UINT32				 framesPerHostCallback;
-	AUDCLNT_SHAREMODE    shareMode;
-	UINT32               streamFlags; // AUDCLNT_STREAMFLAGS_EVENTCALLBACK, ...
-	UINT32               flags;
-	PaWasapiAudioClientParams params; //!< parameters
-
-	// Buffers
-	UINT32               buffers;			//!< number of buffers used (from host side)
-	UINT32               framesPerBuffer;	//!< number of frames per 1 buffer
-	BOOL                 userBufferAndHostMatch;
-
-	// Used for Mono >> Stereo workaround, if driver does not support it
-	// (in Exclusive mode WASAPI usually refuses to operate with Mono (1-ch)
-	void                *monoBuffer;	 //!< pointer to buffer
-	UINT32               monoBufferSize; //!< buffer size in bytes
-	MixMonoToStereoF     monoMixer;		 //!< pointer to mixer function
-
-	PaUtilRingBuffer    *tailBuffer;       //!< buffer with trailing sample for blocking mode operations (only for Input)
-	void                *tailBufferMemory; //!< tail buffer memory region
-}
-PaWasapiSubStream;
-
-// ------------------------------------------------------------------------------------------
-/* PaWasapiHostProcessor - redirects processing data */
-typedef struct PaWasapiHostProcessor
-{
-    PaWasapiHostProcessorCallback processor;
-    void *userData;
-}
-PaWasapiHostProcessor;
-
-// ------------------------------------------------------------------------------------------
-typedef struct PaWasapiStream
-{
-	/* IMPLEMENT ME: rename this */
-    PaUtilStreamRepresentation streamRepresentation;
-    PaUtilCpuLoadMeasurer      cpuLoadMeasurer;
-    PaUtilBufferProcessor      bufferProcessor;
-
-    // input
-	PaWasapiSubStream          in;
-    IAudioCaptureClient       *captureClientParent;
-	IStream                   *captureClientStream;
-	IAudioCaptureClient       *captureClient;
-    IAudioEndpointVolume      *inVol;
-
-	// output
-	PaWasapiSubStream          out;
-    IAudioRenderClient        *renderClientParent;
-	IStream                   *renderClientStream;
-	IAudioRenderClient        *renderClient;
-	IAudioEndpointVolume      *outVol;
-
-	// event handles for event-driven processing mode
-	HANDLE event[S_COUNT];
-
-	// buffer mode
-	PaUtilHostBufferSizeMode bufferMode;
-
-	// must be volatile to avoid race condition on user query while
-	// thread is being started
-    volatile BOOL running;
-
-    PA_THREAD_ID dwThreadId;
-    HANDLE hThread;
-	HANDLE hCloseRequest;
-	HANDLE hThreadStart;        //!< signalled by thread on start
-	HANDLE hThreadExit;         //!< signalled by thread on exit
-	HANDLE hBlockingOpStreamRD;
-	HANDLE hBlockingOpStreamWR;
-
-    // Host callback Output overrider
-	PaWasapiHostProcessor hostProcessOverrideOutput;
-
-    // Host callback Input overrider
-	PaWasapiHostProcessor hostProcessOverrideInput;
-
-	// Defines blocking/callback interface used
-	BOOL bBlocking;
-
-	// Av Task (MM thread management)
-	HANDLE hAvTask;
-
-	// Thread priority level
-	PaWasapiThreadPriority nThreadPriority;
-}
-PaWasapiStream;
-
-// Local stream methods
-void _StreamOnStop(PaWasapiStream *stream);
-void _StreamFinish(PaWasapiStream *stream);
-void _StreamCleanup(PaWasapiStream *stream);
-HRESULT _PollGetOutputFramesAvailable(PaWasapiStream *stream, UINT32 *available);
-HRESULT _PollGetInputFramesAvailable(PaWasapiStream *stream, UINT32 *available);
-void *PaWasapi_ReallocateMemory(void *ptr, size_t size);
-void PaWasapi_FreeMemory(void *ptr);
-
-// Local statics
-
-// ------------------------------------------------------------------------------------------
-#define LogHostError(HRES) __LogHostError(HRES, __FUNCTION__, __FILE__, __LINE__)
-static HRESULT __LogHostError(HRESULT res, const char *func, const char *file, int line)
-{
-    const char *text = NULL;
-    switch (res)
-	{
-	case S_OK: return res;
-	case E_POINTER                              :text ="E_POINTER"; break;
-	case E_INVALIDARG                           :text ="E_INVALIDARG"; break;
-
-	case AUDCLNT_E_NOT_INITIALIZED              :text ="AUDCLNT_E_NOT_INITIALIZED"; break;
-	case AUDCLNT_E_ALREADY_INITIALIZED          :text ="AUDCLNT_E_ALREADY_INITIALIZED"; break;
-	case AUDCLNT_E_WRONG_ENDPOINT_TYPE          :text ="AUDCLNT_E_WRONG_ENDPOINT_TYPE"; break;
-	case AUDCLNT_E_DEVICE_INVALIDATED           :text ="AUDCLNT_E_DEVICE_INVALIDATED"; break;
-	case AUDCLNT_E_NOT_STOPPED                  :text ="AUDCLNT_E_NOT_STOPPED"; break;
-	case AUDCLNT_E_BUFFER_TOO_LARGE             :text ="AUDCLNT_E_BUFFER_TOO_LARGE"; break;
-	case AUDCLNT_E_OUT_OF_ORDER                 :text ="AUDCLNT_E_OUT_OF_ORDER"; break;
-	case AUDCLNT_E_UNSUPPORTED_FORMAT           :text ="AUDCLNT_E_UNSUPPORTED_FORMAT"; break;
-	case AUDCLNT_E_INVALID_SIZE                 :text ="AUDCLNT_E_INVALID_SIZE"; break;
-	case AUDCLNT_E_DEVICE_IN_USE                :text ="AUDCLNT_E_DEVICE_IN_USE"; break;
-	case AUDCLNT_E_BUFFER_OPERATION_PENDING     :text ="AUDCLNT_E_BUFFER_OPERATION_PENDING"; break;
-	case AUDCLNT_E_THREAD_NOT_REGISTERED        :text ="AUDCLNT_E_THREAD_NOT_REGISTERED"; break;
-	case AUDCLNT_E_EXCLUSIVE_MODE_NOT_ALLOWED   :text ="AUDCLNT_E_EXCLUSIVE_MODE_NOT_ALLOWED"; break;
-	case AUDCLNT_E_ENDPOINT_CREATE_FAILED       :text ="AUDCLNT_E_ENDPOINT_CREATE_FAILED"; break;
-	case AUDCLNT_E_SERVICE_NOT_RUNNING          :text ="AUDCLNT_E_SERVICE_NOT_RUNNING"; break;
-	case AUDCLNT_E_EVENTHANDLE_NOT_EXPECTED     :text ="AUDCLNT_E_EVENTHANDLE_NOT_EXPECTED"; break;
-	case AUDCLNT_E_EXCLUSIVE_MODE_ONLY          :text ="AUDCLNT_E_EXCLUSIVE_MODE_ONLY"; break;
-	case AUDCLNT_E_BUFDURATION_PERIOD_NOT_EQUAL :text ="AUDCLNT_E_BUFDURATION_PERIOD_NOT_EQUAL"; break;
-	case AUDCLNT_E_EVENTHANDLE_NOT_SET          :text ="AUDCLNT_E_EVENTHANDLE_NOT_SET"; break;
-	case AUDCLNT_E_INCORRECT_BUFFER_SIZE        :text ="AUDCLNT_E_INCORRECT_BUFFER_SIZE"; break;
-	case AUDCLNT_E_BUFFER_SIZE_ERROR            :text ="AUDCLNT_E_BUFFER_SIZE_ERROR"; break;
-	case AUDCLNT_E_CPUUSAGE_EXCEEDED            :text ="AUDCLNT_E_CPUUSAGE_EXCEEDED"; break;
-	case AUDCLNT_E_BUFFER_ERROR					:text ="AUDCLNT_E_BUFFER_ERROR"; break;
-	case AUDCLNT_E_BUFFER_SIZE_NOT_ALIGNED		:text ="AUDCLNT_E_BUFFER_SIZE_NOT_ALIGNED"; break;
-	case AUDCLNT_E_INVALID_DEVICE_PERIOD		:text ="AUDCLNT_E_INVALID_DEVICE_PERIOD"; break;
-
-	case AUDCLNT_S_BUFFER_EMPTY                 :text ="AUDCLNT_S_BUFFER_EMPTY"; break;
-	case AUDCLNT_S_THREAD_ALREADY_REGISTERED    :text ="AUDCLNT_S_THREAD_ALREADY_REGISTERED"; break;
-	case AUDCLNT_S_POSITION_STALLED				:text ="AUDCLNT_S_POSITION_STALLED"; break;
-
-	// other windows common errors:
-	case CO_E_NOTINITIALIZED                    :text ="CO_E_NOTINITIALIZED: you must call CoInitialize() before Pa_OpenStream()"; break;
-
-	default:
-		text = "UNKNOWN ERROR";
-    }
-	PRINT(("WASAPI ERROR HRESULT: 0x%X : %s\n [FUNCTION: %s FILE: %s {LINE: %d}]\n", res, text, func, file, line));
-	PA_SKELETON_SET_LAST_HOST_ERROR(res, text);
-	return res;
-}
-
-// ------------------------------------------------------------------------------------------
-#define LogPaError(PAERR) __LogPaError(PAERR, __FUNCTION__, __FILE__, __LINE__)
-static PaError __LogPaError(PaError err, const char *func, const char *file, int line)
-{
-	if (err == paNoError)
-		return err;
-	PRINT(("WASAPI ERROR PAERROR: %i : %s\n [FUNCTION: %s FILE: %s {LINE: %d}]\n", err, Pa_GetErrorText(err), func, file, line));
-	return err;
-}
-
-// ------------------------------------------------------------------------------------------
-/*! \class ThreadSleepScheduler
-           Allows to emulate thread sleep of less than 1 millisecond under Windows. Scheduler
-		   calculates number of times the thread must run untill next sleep of 1 millisecond.
-		   It does not make thread sleeping for real number of microseconds but rather controls
-		   how many of imaginary microseconds the thread task can allow thread to sleep.
-*/
-typedef struct ThreadIdleScheduler
-{
-	UINT32 m_idle_microseconds; //!< number of microseconds to sleep
-	UINT32 m_next_sleep;        //!< next sleep round
-	UINT32 m_i;					//!< current round iterator position
-	UINT32 m_resolution;		//!< resolution in number of milliseconds
-}
-ThreadIdleScheduler;
-//! Setup scheduler.
-static void ThreadIdleScheduler_Setup(ThreadIdleScheduler *sched, UINT32 resolution, UINT32 microseconds)
-{
-	assert(microseconds != 0);
-	assert(resolution != 0);
-	assert((resolution * 1000) >= microseconds);
-
-	memset(sched, 0, sizeof(*sched));
-
-	sched->m_idle_microseconds = microseconds;
-	sched->m_resolution        = resolution;
-	sched->m_next_sleep        = (resolution * 1000) / microseconds;
-}
-//! Iterate and check if can sleep.
-static UINT32 ThreadIdleScheduler_NextSleep(ThreadIdleScheduler *sched)
-{
-	// advance and check if thread can sleep
-	if (++ sched->m_i == sched->m_next_sleep)
-	{
-		sched->m_i = 0;
-		return sched->m_resolution;
-	}
-	return 0;
-}
-
-// ------------------------------------------------------------------------------------------
-/*static double nano100ToMillis(REFERENCE_TIME ref)
-{
-    //  1 nano = 0.000000001 seconds
-    //100 nano = 0.0000001   seconds
-    //100 nano = 0.0001   milliseconds
-    return ((double)ref)*0.0001;
-}*/
-
-// ------------------------------------------------------------------------------------------
-static double nano100ToSeconds(REFERENCE_TIME ref)
-{
-    //  1 nano = 0.000000001 seconds
-    //100 nano = 0.0000001   seconds
-    //100 nano = 0.0001   milliseconds
-    return ((double)ref)*0.0000001;
-}
-
-// ------------------------------------------------------------------------------------------
-/*static REFERENCE_TIME MillisTonano100(double ref)
-{
-    //  1 nano = 0.000000001 seconds
-    //100 nano = 0.0000001   seconds
-    //100 nano = 0.0001   milliseconds
-    return (REFERENCE_TIME)(ref/0.0001);
-}*/
-
-// ------------------------------------------------------------------------------------------
-static REFERENCE_TIME SecondsTonano100(double ref)
-{
-    //  1 nano = 0.000000001 seconds
-    //100 nano = 0.0000001   seconds
-    //100 nano = 0.0001   milliseconds
-    return (REFERENCE_TIME)(ref/0.0000001);
-}
-
-// ------------------------------------------------------------------------------------------
-// Makes Hns period from frames and sample rate
-static REFERENCE_TIME MakeHnsPeriod(UINT32 nFrames, DWORD nSamplesPerSec)
-{
-	return (REFERENCE_TIME)((10000.0 * 1000 / nSamplesPerSec * nFrames) + 0.5);
-}
-
-// ------------------------------------------------------------------------------------------
-// Converts PaSampleFormat to bits per sample value
-static WORD PaSampleFormatToBitsPerSample(PaSampleFormat format_id)
-{
-	switch (format_id & ~paNonInterleaved)
-	{
-		case paFloat32:
-		case paInt32: return 32;
-		case paInt24: return 24;
-		case paInt16: return 16;
-		case paInt8:
-		case paUInt8: return 8;
-	}
-	return 0;
-}
-
-// ------------------------------------------------------------------------------------------
-// Converts PaSampleFormat to bits per sample value
-/*static WORD PaSampleFormatToBytesPerSample(PaSampleFormat format_id)
-{
-	return PaSampleFormatToBitsPerSample(format_id) >> 3; // 'bits/8'
-}*/
-
-// ------------------------------------------------------------------------------------------
-// Converts Hns period into number of frames
-static UINT32 MakeFramesFromHns(REFERENCE_TIME hnsPeriod, UINT32 nSamplesPerSec)
-{
-    UINT32 nFrames = (UINT32)(	// frames =
-        1.0 * hnsPeriod *		// hns *
-        nSamplesPerSec /		// (frames / s) /
-        1000 /					// (ms / s) /
-        10000					// (hns / s) /
-        + 0.5					// rounding
-    );
-	return nFrames;
-}
-
-// Aligning function type
-typedef UINT32 (*ALIGN_FUNC) (UINT32 v, UINT32 align);
-
-// ------------------------------------------------------------------------------------------
-// Aligns 'v' backwards
-static UINT32 ALIGN_BWD(UINT32 v, UINT32 align)
-{
-	return ((v - (align ? v % align : 0)));
-}
-
-// ------------------------------------------------------------------------------------------
-// Aligns 'v' forward
-static UINT32 ALIGN_FWD(UINT32 v, UINT32 align)
-{
-	UINT32 remainder = (align ? (v % align) : 0);
-	if (remainder == 0)
-		return v;
-	return v + (align - remainder);
-}
-
-// ------------------------------------------------------------------------------------------
-// Get next value power of 2
-UINT32 ALIGN_NEXT_POW2(UINT32 v)
-{
-	UINT32 v2 = 1;
-	while (v > (v2 <<= 1)) { }
-	v = v2;
-	return v;
-}
-
-// ------------------------------------------------------------------------------------------
-// Aligns WASAPI buffer to 128 byte packet boundary. HD Audio will fail to play if buffer
-// is misaligned. This problem was solved in Windows 7 were AUDCLNT_E_BUFFER_SIZE_NOT_ALIGNED
-// is thrown although we must align for Vista anyway.
-static UINT32 AlignFramesPerBuffer(UINT32 nFrames, UINT32 nSamplesPerSec, UINT32 nBlockAlign,
-								   ALIGN_FUNC pAlignFunc)
-{
-#define HDA_PACKET_SIZE (128)
-
-	long frame_bytes = nFrames * nBlockAlign;
-	long packets;
-
-	// align to packet size
-	frame_bytes  = pAlignFunc(frame_bytes, HDA_PACKET_SIZE); // use ALIGN_FWD if bigger but safer period is more desired
-
-	// atlest 1 frame must be available
-	if (frame_bytes < HDA_PACKET_SIZE)
-		frame_bytes = HDA_PACKET_SIZE;
-
-	nFrames      = frame_bytes / nBlockAlign;
-	packets      = frame_bytes / HDA_PACKET_SIZE;
-
-	frame_bytes = packets * HDA_PACKET_SIZE;
-	nFrames     = frame_bytes / nBlockAlign;
-
-	return nFrames;
-
-#undef HDA_PACKET_SIZE
-}
-
-// ------------------------------------------------------------------------------------------
-static UINT32 GetFramesSleepTime(UINT32 nFrames, UINT32 nSamplesPerSec)
-{
-	REFERENCE_TIME nDuration;
-	if (nSamplesPerSec == 0)
-		return 0;
-#define REFTIMES_PER_SEC  10000000
-#define REFTIMES_PER_MILLISEC  10000
-	// Calculate the actual duration of the allocated buffer.
-	nDuration = (REFERENCE_TIME)((double)REFTIMES_PER_SEC * nFrames / nSamplesPerSec);
-	return (UINT32)(nDuration/REFTIMES_PER_MILLISEC/2);
-}
-
-// ------------------------------------------------------------------------------------------
-static UINT32 GetFramesSleepTimeMicroseconds(UINT32 nFrames, UINT32 nSamplesPerSec)
-{
-	REFERENCE_TIME nDuration;
-	if (nSamplesPerSec == 0)
-		return 0;
-#define REFTIMES_PER_SEC  10000000
-#define REFTIMES_PER_MILLISEC  10000
-	// Calculate the actual duration of the allocated buffer.
-	nDuration = (REFERENCE_TIME)((double)REFTIMES_PER_SEC * nFrames / nSamplesPerSec);
-	return (UINT32)(nDuration/10/2);
-}
-
-// ------------------------------------------------------------------------------------------
-static BOOL SetupAVRT()
-{
-    hDInputDLL = LoadLibraryA("avrt.dll");
-    if (hDInputDLL == NULL)
-        return FALSE;
-
-    _GetProc(pAvRtCreateThreadOrderingGroup,  FAvRtCreateThreadOrderingGroup,  "AvRtCreateThreadOrderingGroup");
-    _GetProc(pAvRtDeleteThreadOrderingGroup,  FAvRtDeleteThreadOrderingGroup,  "AvRtDeleteThreadOrderingGroup");
-    _GetProc(pAvRtWaitOnThreadOrderingGroup,  FAvRtWaitOnThreadOrderingGroup,  "AvRtWaitOnThreadOrderingGroup");
-    _GetProc(pAvSetMmThreadCharacteristics,   FAvSetMmThreadCharacteristics,   "AvSetMmThreadCharacteristicsA");
-	_GetProc(pAvRevertMmThreadCharacteristics,FAvRevertMmThreadCharacteristics,"AvRevertMmThreadCharacteristics");
-    _GetProc(pAvSetMmThreadPriority,          FAvSetMmThreadPriority,          "AvSetMmThreadPriority");
-
-	return pAvRtCreateThreadOrderingGroup &&
-		pAvRtDeleteThreadOrderingGroup &&
-		pAvRtWaitOnThreadOrderingGroup &&
-		pAvSetMmThreadCharacteristics &&
-		pAvRevertMmThreadCharacteristics &&
-		pAvSetMmThreadPriority;
-}
-
-// ------------------------------------------------------------------------------------------
-static void CloseAVRT()
-{
-	if (hDInputDLL != NULL)
-		FreeLibrary(hDInputDLL);
-	hDInputDLL = NULL;
-}
-
-// ------------------------------------------------------------------------------------------
-static BOOL IsWow64()
-{
-	// http://msdn.microsoft.com/en-us/library/ms684139(VS.85).aspx
-
-	typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL);
-	LPFN_ISWOW64PROCESS fnIsWow64Process;
-
-    BOOL bIsWow64 = FALSE;
-
-    // IsWow64Process is not available on all supported versions of Windows.
-    // Use GetModuleHandle to get a handle to the DLL that contains the function
-    // and GetProcAddress to get a pointer to the function if available.
-
-    fnIsWow64Process = (LPFN_ISWOW64PROCESS) GetProcAddress(
-        GetModuleHandleA("kernel32"), "IsWow64Process");
-
-    if (fnIsWow64Process == NULL)
-		return FALSE;
-
-    if (!fnIsWow64Process(GetCurrentProcess(), &bIsWow64))
-		return FALSE;
-
-    return bIsWow64;
-}
-
-// ------------------------------------------------------------------------------------------
-typedef enum EWindowsVersion
-{
-	WINDOWS_UNKNOWN			 = 0,
-	WINDOWS_VISTA_SERVER2008 = (1 << 0),
-	WINDOWS_7_SERVER2008R2	 = (1 << 1),
-	WINDOWS_FUTURE           = (1 << 2)
-}
-EWindowsVersion;
-// Defines Windows 7/Windows Server 2008 R2 and up (future versions)
-#define WINDOWS_7_SERVER2008R2_AND_UP (WINDOWS_7_SERVER2008R2|WINDOWS_FUTURE)
-// The function is limited to Vista/7 mostly as we need just to find out Vista/WOW64 combination
-// in order to use WASAPI WOW64 workarounds.
-static UINT32 GetWindowsVersion()
-{
-	static UINT32 version = WINDOWS_UNKNOWN;
-
-	if (version == WINDOWS_UNKNOWN)
-	{
-		DWORD dwVersion = 0;
-		DWORD dwMajorVersion = 0;
-		DWORD dwMinorVersion = 0;
-		DWORD dwBuild = 0;
-
-		typedef DWORD (WINAPI *LPFN_GETVERSION)(VOID);
-		LPFN_GETVERSION fnGetVersion;
-
-		fnGetVersion = (LPFN_GETVERSION) GetProcAddress(GetModuleHandleA("kernel32"), "GetVersion");
-		if (fnGetVersion == NULL)
-			return WINDOWS_UNKNOWN;
-
-		dwVersion = fnGetVersion();
-
-		// Get the Windows version
-		dwMajorVersion = (DWORD)(LOBYTE(LOWORD(dwVersion)));
-		dwMinorVersion = (DWORD)(HIBYTE(LOWORD(dwVersion)));
-
-		// Get the build number
-		if (dwVersion < 0x80000000)
-			dwBuild = (DWORD)(HIWORD(dwVersion));
-
-		switch (dwMajorVersion)
-		{
-		case 0:
-		case 1:
-		case 2:
-		case 3:
-		case 4:
-		case 5:
-			break; // skip lower
-		case 6:
-			switch (dwMinorVersion)
-			{
-			case 0:
-				version |= WINDOWS_VISTA_SERVER2008;
-				break;
-			case 1:
-				version |= WINDOWS_7_SERVER2008R2;
-				break;
-			default:
-				version |= WINDOWS_FUTURE;
-			}
-			break;
-		default:
-			version |= WINDOWS_FUTURE;
-		}
-	}
-
-	return version;
-}
-
-// ------------------------------------------------------------------------------------------
-static BOOL UseWOW64Workaround()
-{
-	// note: WOW64 bug is common to Windows Vista x64, thus we fall back to safe Poll-driven
-	//       method. Windows 7 x64 seems has WOW64 bug fixed.
-
-	return (IsWow64() && (GetWindowsVersion() & WINDOWS_VISTA_SERVER2008));
-}
-
-// ------------------------------------------------------------------------------------------
-typedef enum EMixerDir { MIX_DIR__1TO2, MIX_DIR__2TO1, MIX_DIR__2TO1_L } EMixerDir;
-
-// ------------------------------------------------------------------------------------------
-#define _WASAPI_MONO_TO_STEREO_MIXER_1_TO_2(TYPE)\
-	TYPE * __restrict to   = __to;\
-	TYPE * __restrict from = __from;\
-	TYPE * __restrict end  = from + count;\
-	while (from != end)\
-	{\
-		*to ++ = *from;\
-		*to ++ = *from;\
-		++ from;\
-	}
-
-// ------------------------------------------------------------------------------------------
-#define _WASAPI_MONO_TO_STEREO_MIXER_2_TO_1_FLT32(TYPE)\
-	TYPE * __restrict to   = (TYPE *)__to;\
-	TYPE * __restrict from = (TYPE *)__from;\
-	TYPE * __restrict end  = to + count;\
-	while (to != end)\
-	{\
-		*to ++ = (TYPE)((float)(from[0] + from[1]) * 0.5f);\
-		from += 2;\
-	}
-
-// ------------------------------------------------------------------------------------------
-#define _WASAPI_MONO_TO_STEREO_MIXER_2_TO_1_INT32(TYPE)\
-	TYPE * __restrict to   = (TYPE *)__to;\
-	TYPE * __restrict from = (TYPE *)__from;\
-	TYPE * __restrict end  = to + count;\
-	while (to != end)\
-	{\
-		*to ++ = (TYPE)(((INT32)from[0] + (INT32)from[1]) >> 1);\
-		from += 2;\
-	}
-
-// ------------------------------------------------------------------------------------------
-#define _WASAPI_MONO_TO_STEREO_MIXER_2_TO_1_INT64(TYPE)\
-	TYPE * __restrict to   = (TYPE *)__to;\
-	TYPE * __restrict from = (TYPE *)__from;\
-	TYPE * __restrict end  = to + count;\
-	while (to != end)\
-	{\
-		*to ++ = (TYPE)(((INT64)from[0] + (INT64)from[1]) >> 1);\
-		from += 2;\
-	}
-
-// ------------------------------------------------------------------------------------------
-#define _WASAPI_MONO_TO_STEREO_MIXER_2_TO_1_L(TYPE)\
-	TYPE * __restrict to   = (TYPE *)__to;\
-	TYPE * __restrict from = (TYPE *)__from;\
-	TYPE * __restrict end  = to + count;\
-	while (to != end)\
-	{\
-		*to ++ = from[0];\
-		from += 2;\
-	}
-
-// ------------------------------------------------------------------------------------------
-static void _MixMonoToStereo_1TO2_8(void *__to, void *__from, UINT32 count) { _WASAPI_MONO_TO_STEREO_MIXER_1_TO_2(BYTE); }
-static void _MixMonoToStereo_1TO2_16(void *__to, void *__from, UINT32 count) { _WASAPI_MONO_TO_STEREO_MIXER_1_TO_2(short); }
-static void _MixMonoToStereo_1TO2_24(void *__to, void *__from, UINT32 count) { _WASAPI_MONO_TO_STEREO_MIXER_1_TO_2(int); /* !!! int24 data is contained in 32-bit containers*/ }
-static void _MixMonoToStereo_1TO2_32(void *__to, void *__from, UINT32 count) { _WASAPI_MONO_TO_STEREO_MIXER_1_TO_2(int); }
-static void _MixMonoToStereo_1TO2_32f(void *__to, void *__from, UINT32 count) { _WASAPI_MONO_TO_STEREO_MIXER_1_TO_2(float); }
-
-// ------------------------------------------------------------------------------------------
-static void _MixMonoToStereo_2TO1_8(void *__to, void *__from, UINT32 count) { _WASAPI_MONO_TO_STEREO_MIXER_2_TO_1_INT32(BYTE); }
-static void _MixMonoToStereo_2TO1_16(void *__to, void *__from, UINT32 count) { _WASAPI_MONO_TO_STEREO_MIXER_2_TO_1_INT32(short); }
-static void _MixMonoToStereo_2TO1_24(void *__to, void *__from, UINT32 count) { _WASAPI_MONO_TO_STEREO_MIXER_2_TO_1_INT32(int); /* !!! int24 data is contained in 32-bit containers*/ }
-static void _MixMonoToStereo_2TO1_32(void *__to, void *__from, UINT32 count) { _WASAPI_MONO_TO_STEREO_MIXER_2_TO_1_INT64(int); }
-static void _MixMonoToStereo_2TO1_32f(void *__to, void *__from, UINT32 count) { _WASAPI_MONO_TO_STEREO_MIXER_2_TO_1_FLT32(float); }
-
-// ------------------------------------------------------------------------------------------
-static void _MixMonoToStereo_2TO1_8_L(void *__to, void *__from, UINT32 count) { _WASAPI_MONO_TO_STEREO_MIXER_2_TO_1_L(BYTE); }
-static void _MixMonoToStereo_2TO1_16_L(void *__to, void *__from, UINT32 count) { _WASAPI_MONO_TO_STEREO_MIXER_2_TO_1_L(short); }
-static void _MixMonoToStereo_2TO1_24_L(void *__to, void *__from, UINT32 count) { _WASAPI_MONO_TO_STEREO_MIXER_2_TO_1_L(int); /* !!! int24 data is contained in 32-bit containers*/ }
-static void _MixMonoToStereo_2TO1_32_L(void *__to, void *__from, UINT32 count) { _WASAPI_MONO_TO_STEREO_MIXER_2_TO_1_L(int); }
-static void _MixMonoToStereo_2TO1_32f_L(void *__to, void *__from, UINT32 count) { _WASAPI_MONO_TO_STEREO_MIXER_2_TO_1_L(float); }
-
-// ------------------------------------------------------------------------------------------
-static MixMonoToStereoF _GetMonoToStereoMixer(PaSampleFormat format, EMixerDir dir)
-{
-	switch (dir)
-	{
-	case MIX_DIR__1TO2:
-		switch (format & ~paNonInterleaved)
-		{
-		case paUInt8:	return _MixMonoToStereo_1TO2_8;
-		case paInt16:	return _MixMonoToStereo_1TO2_16;
-		case paInt24:	return _MixMonoToStereo_1TO2_24;
-		case paInt32:	return _MixMonoToStereo_1TO2_32;
-		case paFloat32: return _MixMonoToStereo_1TO2_32f;
-		}
-		break;
-
-	case MIX_DIR__2TO1:
-		switch (format & ~paNonInterleaved)
-		{
-		case paUInt8:	return _MixMonoToStereo_2TO1_8;
-		case paInt16:	return _MixMonoToStereo_2TO1_16;
-		case paInt24:	return _MixMonoToStereo_2TO1_24;
-		case paInt32:	return _MixMonoToStereo_2TO1_32;
-		case paFloat32: return _MixMonoToStereo_2TO1_32f;
-		}
-		break;
-
-	case MIX_DIR__2TO1_L:
-		switch (format & ~paNonInterleaved)
-		{
-		case paUInt8:	return _MixMonoToStereo_2TO1_8_L;
-		case paInt16:	return _MixMonoToStereo_2TO1_16_L;
-		case paInt24:	return _MixMonoToStereo_2TO1_24_L;
-		case paInt32:	return _MixMonoToStereo_2TO1_32_L;
-		case paFloat32: return _MixMonoToStereo_2TO1_32f_L;
-		}
-		break;
-	}
-
-	return NULL;
-}
-
-// ------------------------------------------------------------------------------------------
-PaError PaWasapi_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiIndex hostApiIndex )
-{
-    PaError result = paNoError;
-    PaWasapiHostApiRepresentation *paWasapi;
-    PaDeviceInfo *deviceInfoArray;
-    HRESULT hr = S_OK;
-    IMMDeviceCollection* pEndPoints = NULL;
-	UINT i;
-
-    if (!SetupAVRT())
-	{
-        PRINT(("WASAPI: No AVRT! (not VISTA?)"));
-        return paNoError;
-    }
-
-    paWasapi = (PaWasapiHostApiRepresentation *)PaUtil_AllocateMemory( sizeof(PaWasapiHostApiRepresentation) );
-    if (paWasapi == NULL)
-	{
-        result = paInsufficientMemory;
-        goto error;
-    }
-	
-    memset( paWasapi, 0, sizeof(PaWasapiHostApiRepresentation) ); /* ensure all fields are zeroed. especially paWasapi->allocations */
-
-    result = PaWinUtil_CoInitialize( paWASAPI, &paWasapi->comInitializationResult );
-    if( result != paNoError )
-    {
-        goto error;
-    }
-
-    paWasapi->allocations = PaUtil_CreateAllocationGroup();
-    if (paWasapi->allocations == NULL)
-	{
-        result = paInsufficientMemory;
-        goto error;
-    }
-
-    *hostApi                             = &paWasapi->inheritedHostApiRep;
-    (*hostApi)->info.structVersion		 = 1;
-    (*hostApi)->info.type				 = paWASAPI;
-    (*hostApi)->info.name				 = "Windows WASAPI";
-    (*hostApi)->info.deviceCount		 = 0;
-    (*hostApi)->info.defaultInputDevice	 = paNoDevice;
-    (*hostApi)->info.defaultOutputDevice = paNoDevice;
-
-    paWasapi->enumerator = NULL;
-    hr = CoCreateInstance(&pa_CLSID_IMMDeviceEnumerator, NULL, CLSCTX_INPROC_SERVER,
-             &pa_IID_IMMDeviceEnumerator, (void **)&paWasapi->enumerator);
-    
-	// We need to set the result to a value otherwise we will return paNoError
-	// [IF_FAILED_JUMP(hResult, error);]
-	IF_FAILED_INTERNAL_ERROR_JUMP(hr, result, error);
-
-    // getting default device ids in the eMultimedia "role"
-    {
-        {
-            IMMDevice *defaultRenderer = NULL;
-            hr = IMMDeviceEnumerator_GetDefaultAudioEndpoint(paWasapi->enumerator, eRender, eMultimedia, &defaultRenderer);
-            if (hr != S_OK)
-			{
-				if (hr != E_NOTFOUND) {
-					// We need to set the result to a value otherwise we will return paNoError
-					// [IF_FAILED_JUMP(hResult, error);]
-					IF_FAILED_INTERNAL_ERROR_JUMP(hr, result, error);
-				}
-			}
-			else
-			{
-				WCHAR *pszDeviceId = NULL;
-				hr = IMMDevice_GetId(defaultRenderer, &pszDeviceId);
-				// We need to set the result to a value otherwise we will return paNoError
-				// [IF_FAILED_JUMP(hResult, error);]
-				IF_FAILED_INTERNAL_ERROR_JUMP(hr, result, error);
-				wcsncpy(paWasapi->defaultRenderer, pszDeviceId, MAX_STR_LEN-1);
-				CoTaskMemFree(pszDeviceId);
-				IMMDevice_Release(defaultRenderer);
-			}
-        }
-
-        {
-            IMMDevice *defaultCapturer = NULL;
-            hr = IMMDeviceEnumerator_GetDefaultAudioEndpoint(paWasapi->enumerator, eCapture, eMultimedia, &defaultCapturer);
-            if (hr != S_OK)
-			{
-				if (hr != E_NOTFOUND) {
-					// We need to set the result to a value otherwise we will return paNoError
-					// [IF_FAILED_JUMP(hResult, error);]
-					IF_FAILED_INTERNAL_ERROR_JUMP(hr, result, error);
-				}
-			}
-			else
-			{
-				WCHAR *pszDeviceId = NULL;
-				hr = IMMDevice_GetId(defaultCapturer, &pszDeviceId);
-				// We need to set the result to a value otherwise we will return paNoError
-				// [IF_FAILED_JUMP(hResult, error);]
-				IF_FAILED_INTERNAL_ERROR_JUMP(hr, result, error);
-				wcsncpy(paWasapi->defaultCapturer, pszDeviceId, MAX_STR_LEN-1);
-				CoTaskMemFree(pszDeviceId);
-				IMMDevice_Release(defaultCapturer);
-			}
-        }
-    }
-
-    hr = IMMDeviceEnumerator_EnumAudioEndpoints(paWasapi->enumerator, eAll, DEVICE_STATE_ACTIVE, &pEndPoints);
-	// We need to set the result to a value otherwise we will return paNoError
-	// [IF_FAILED_JUMP(hResult, error);]
-	IF_FAILED_INTERNAL_ERROR_JUMP(hr, result, error);
-
-    hr = IMMDeviceCollection_GetCount(pEndPoints, &paWasapi->deviceCount);
-	// We need to set the result to a value otherwise we will return paNoError
-	// [IF_FAILED_JUMP(hResult, error);]
-	IF_FAILED_INTERNAL_ERROR_JUMP(hr, result, error);
-
-    paWasapi->devInfo = (PaWasapiDeviceInfo *)PaUtil_AllocateMemory(sizeof(PaWasapiDeviceInfo) * paWasapi->deviceCount);
-	for (i = 0; i < paWasapi->deviceCount; ++i)
-		memset(&paWasapi->devInfo[i], 0, sizeof(PaWasapiDeviceInfo));
-
-    if (paWasapi->deviceCount > 0)
-    {
-        (*hostApi)->deviceInfos = (PaDeviceInfo **)PaUtil_GroupAllocateMemory(
-                paWasapi->allocations, sizeof(PaDeviceInfo *) * paWasapi->deviceCount);
-        if ((*hostApi)->deviceInfos == NULL)
-		{
-            result = paInsufficientMemory;
-            goto error;
-        }
-
-        /* allocate all device info structs in a contiguous block */
-        deviceInfoArray = (PaDeviceInfo *)PaUtil_GroupAllocateMemory(
-                paWasapi->allocations, sizeof(PaDeviceInfo) * paWasapi->deviceCount);
-        if (deviceInfoArray == NULL)
-		{
-            result = paInsufficientMemory;
-            goto error;
-        }
-
-        for (i = 0; i < paWasapi->deviceCount; ++i)
-		{
-			DWORD state				  = 0;
-            PaDeviceInfo *deviceInfo  = &deviceInfoArray[i];
-            deviceInfo->structVersion = 2;
-            deviceInfo->hostApi       = hostApiIndex;
-
-			PA_DEBUG(("WASAPI: device idx: %02d\n", i));
-			PA_DEBUG(("WASAPI: ---------------\n"));
-
-            hr = IMMDeviceCollection_Item(pEndPoints, i, &paWasapi->devInfo[i].device);
-			// We need to set the result to a value otherwise we will return paNoError
-			// [IF_FAILED_JUMP(hResult, error);]
-			IF_FAILED_INTERNAL_ERROR_JUMP(hr, result, error);
-
-            // getting ID
-            {
-                WCHAR *pszDeviceId = NULL;
-                hr = IMMDevice_GetId(paWasapi->devInfo[i].device, &pszDeviceId);
-				// We need to set the result to a value otherwise we will return paNoError
-				// [IF_FAILED_JUMP(hr, error);]
-				IF_FAILED_INTERNAL_ERROR_JUMP(hr, result, error);
-                wcsncpy(paWasapi->devInfo[i].szDeviceID, pszDeviceId, MAX_STR_LEN-1);
-                CoTaskMemFree(pszDeviceId);
-
-                if (lstrcmpW(paWasapi->devInfo[i].szDeviceID, paWasapi->defaultCapturer) == 0)
-				{// we found the default input!
-                    (*hostApi)->info.defaultInputDevice = (*hostApi)->info.deviceCount;
-                }
-                if (lstrcmpW(paWasapi->devInfo[i].szDeviceID, paWasapi->defaultRenderer) == 0)
-				{// we found the default output!
-                    (*hostApi)->info.defaultOutputDevice = (*hostApi)->info.deviceCount;
-                }
-            }
-
-            hr = IMMDevice_GetState(paWasapi->devInfo[i].device, &paWasapi->devInfo[i].state);
-			// We need to set the result to a value otherwise we will return paNoError
-			// [IF_FAILED_JUMP(hResult, error);]
-			IF_FAILED_INTERNAL_ERROR_JUMP(hr, result, error);
-
-            if (paWasapi->devInfo[i].state != DEVICE_STATE_ACTIVE)
-			{
-                PRINT(("WASAPI device: %d is not currently available (state:%d)\n",i,state));
-            }
-
-            {
-                IPropertyStore *pProperty;
-                hr = IMMDevice_OpenPropertyStore(paWasapi->devInfo[i].device, STGM_READ, &pProperty);
-				// We need to set the result to a value otherwise we will return paNoError
-				// [IF_FAILED_JUMP(hResult, error);]
-				IF_FAILED_INTERNAL_ERROR_JUMP(hr, result, error);
-
-                // "Friendly" Name
-                {
-					char *deviceName;
-                    PROPVARIANT value;
-                    PropVariantInit(&value);
-                    hr = IPropertyStore_GetValue(pProperty, &PKEY_Device_FriendlyName, &value);
-					// We need to set the result to a value otherwise we will return paNoError
-					// [IF_FAILED_JUMP(hResult, error);]
-					IF_FAILED_INTERNAL_ERROR_JUMP(hr, result, error);
-                    deviceInfo->name = NULL;
-                    deviceName = (char *)PaUtil_GroupAllocateMemory(paWasapi->allocations, MAX_STR_LEN + 1);
-                    if (deviceName == NULL)
-					{
-                        result = paInsufficientMemory;
-                        goto error;
-                    }
-					if (value.pwszVal)
-						WideCharToMultiByte(CP_UTF8, 0, value.pwszVal, (int)wcslen(value.pwszVal), deviceName, MAX_STR_LEN-1, 0, 0);
-					else
-						_snprintf(deviceName, MAX_STR_LEN-1, "baddev%d", i);
-                    deviceInfo->name = deviceName;
-                    PropVariantClear(&value);
-					PA_DEBUG(("WASAPI:%d| name[%s]\n", i, deviceInfo->name));
-                }
-
-                // Default format
-                {
-                    PROPVARIANT value;
-                    PropVariantInit(&value);
-                    hr = IPropertyStore_GetValue(pProperty, &PKEY_AudioEngine_DeviceFormat, &value);
-					// We need to set the result to a value otherwise we will return paNoError
-					// [IF_FAILED_JUMP(hResult, error);]
-					IF_FAILED_INTERNAL_ERROR_JUMP(hr, result, error);
-					memcpy(&paWasapi->devInfo[i].DefaultFormat, value.blob.pBlobData, min(sizeof(paWasapi->devInfo[i].DefaultFormat), value.blob.cbSize));
-                    // cleanup
-                    PropVariantClear(&value);
-                }
-
-                // Formfactor
-                {
-                    PROPVARIANT value;
-                    PropVariantInit(&value);
-                    hr = IPropertyStore_GetValue(pProperty, &PKEY_AudioEndpoint_FormFactor, &value);
-					// We need to set the result to a value otherwise we will return paNoError
-					// [IF_FAILED_JUMP(hResult, error);]
-					IF_FAILED_INTERNAL_ERROR_JUMP(hr, result, error);
-					// set
-					#if defined(DUMMYUNIONNAME) && defined(NONAMELESSUNION)
-						// avoid breaking strict-aliasing rules in such line: (EndpointFormFactor)(*((UINT *)(((WORD *)&value.wReserved3)+1)));
-						UINT v;
-						memcpy(&v, (((WORD *)&value.wReserved3)+1), sizeof(v));
-						paWasapi->devInfo[i].formFactor = (EndpointFormFactor)v;
-					#else
-						paWasapi->devInfo[i].formFactor = (EndpointFormFactor)value.uintVal;
-					#endif
-					PA_DEBUG(("WASAPI:%d| form-factor[%d]\n", i, paWasapi->devInfo[i].formFactor));
-                    // cleanup
-                    PropVariantClear(&value);
-                }
-
-				SAFE_RELEASE(pProperty);
-            }
-
-
-            // Endpoint data
-            {
-                IMMEndpoint *endpoint = NULL;
-                hr = IMMDevice_QueryInterface(paWasapi->devInfo[i].device, &pa_IID_IMMEndpoint, (void **)&endpoint);
-                if (SUCCEEDED(hr))
-				{
-                    hr = IMMEndpoint_GetDataFlow(endpoint, &paWasapi->devInfo[i].flow);
-                    SAFE_RELEASE(endpoint);
-                }
-            }
-
-            // Getting a temporary IAudioClient for more fields
-            // we make sure NOT to call Initialize yet!
-            {
-                IAudioClient *tmpClient = NULL;
-
-                hr = IMMDevice_Activate(paWasapi->devInfo[i].device, &pa_IID_IAudioClient,
-					CLSCTX_INPROC_SERVER, NULL, (void **)&tmpClient);
-				// We need to set the result to a value otherwise we will return paNoError
-				// [IF_FAILED_JUMP(hResult, error);]
-				IF_FAILED_INTERNAL_ERROR_JUMP(hr, result, error);
-
-                hr = IAudioClient_GetDevicePeriod(tmpClient,
-                    &paWasapi->devInfo[i].DefaultDevicePeriod,
-                    &paWasapi->devInfo[i].MinimumDevicePeriod);
-				// We need to set the result to a value otherwise we will return paNoError
-				// [IF_FAILED_JUMP(hResult, error);]
-				IF_FAILED_INTERNAL_ERROR_JUMP(hr, result, error);
-
-                //hr = tmpClient->GetMixFormat(&paWasapi->devInfo[i].MixFormat);
-
-				// Release client
-				SAFE_RELEASE(tmpClient);
-
-				if (hr != S_OK)
-				{
-					//davidv: this happened with my hardware, previously for that same device in DirectSound:
-					//Digital Output (Realtek AC'97 Audio)'s GUID: {0x38f2cf50,0x7b4c,0x4740,0x86,0xeb,0xd4,0x38,0x66,0xd8,0xc8, 0x9f}
-					//so something must be _really_ wrong with this device, TODO handle this better. We kind of need GetMixFormat
-					LogHostError(hr);
-					// We need to set the result to a value otherwise we will return paNoError
-					result = paInternalError;
-					goto error;
-				}
-            }
-
-            // we can now fill in portaudio device data
-            deviceInfo->maxInputChannels  = 0;
-            deviceInfo->maxOutputChannels = 0;
-			deviceInfo->defaultSampleRate = paWasapi->devInfo[i].DefaultFormat.Format.nSamplesPerSec;
-            switch (paWasapi->devInfo[i].flow)
-			{
-			case eRender: {
-                deviceInfo->maxOutputChannels		 = paWasapi->devInfo[i].DefaultFormat.Format.nChannels;
-                deviceInfo->defaultHighOutputLatency = nano100ToSeconds(paWasapi->devInfo[i].DefaultDevicePeriod);
-                deviceInfo->defaultLowOutputLatency  = nano100ToSeconds(paWasapi->devInfo[i].MinimumDevicePeriod);
-				PA_DEBUG(("WASAPI:%d| def.SR[%d] max.CH[%d] latency{hi[%f] lo[%f]}\n", i, (UINT32)deviceInfo->defaultSampleRate,
-					deviceInfo->maxOutputChannels, (float)deviceInfo->defaultHighOutputLatency, (float)deviceInfo->defaultLowOutputLatency));
-				break;}
-			case eCapture: {
-                deviceInfo->maxInputChannels		= paWasapi->devInfo[i].DefaultFormat.Format.nChannels;
-                deviceInfo->defaultHighInputLatency = nano100ToSeconds(paWasapi->devInfo[i].DefaultDevicePeriod);
-                deviceInfo->defaultLowInputLatency  = nano100ToSeconds(paWasapi->devInfo[i].MinimumDevicePeriod);
-				PA_DEBUG(("WASAPI:%d| def.SR[%d] max.CH[%d] latency{hi[%f] lo[%f]}\n", i, (UINT32)deviceInfo->defaultSampleRate,
-					deviceInfo->maxInputChannels, (float)deviceInfo->defaultHighInputLatency, (float)deviceInfo->defaultLowInputLatency));
-				break; }
-            default:
-                PRINT(("WASAPI:%d| bad Data Flow!\n", i));
-				// We need to set the result to a value otherwise we will return paNoError
-				result = paInternalError;
-                //continue; // do not skip from list, allow to initialize
-            break;
-            }
-
-            (*hostApi)->deviceInfos[i] = deviceInfo;
-            ++(*hostApi)->info.deviceCount;
-        }
-    }
-
-    (*hostApi)->Terminate = Terminate;
-    (*hostApi)->OpenStream = OpenStream;
-    (*hostApi)->IsFormatSupported = IsFormatSupported;
-
-    PaUtil_InitializeStreamInterface( &paWasapi->callbackStreamInterface, CloseStream, StartStream,
-                                      StopStream, AbortStream, IsStreamStopped, IsStreamActive,
-                                      GetStreamTime, GetStreamCpuLoad,
-                                      PaUtil_DummyRead, PaUtil_DummyWrite,
-                                      PaUtil_DummyGetReadAvailable, PaUtil_DummyGetWriteAvailable );
-
-    PaUtil_InitializeStreamInterface( &paWasapi->blockingStreamInterface, CloseStream, StartStream,
-                                      StopStream, AbortStream, IsStreamStopped, IsStreamActive,
-                                      GetStreamTime, PaUtil_DummyGetCpuLoad,
-                                      ReadStream, WriteStream, GetStreamReadAvailable, GetStreamWriteAvailable );
-
-
-	// findout if platform workaround is required
-	paWasapi->useWOW64Workaround = UseWOW64Workaround();
-
-    SAFE_RELEASE(pEndPoints);
-
-	PRINT(("WASAPI: initialized ok\n"));
-
-    return paNoError;
-
-error:
-
-	PRINT(("WASAPI: failed %s error[%d|%s]\n", __FUNCTION__, result, Pa_GetErrorText(result)));
-
-    SAFE_RELEASE(pEndPoints);
-
-	Terminate((PaUtilHostApiRepresentation *)paWasapi);
-
-	// Safety if error was not set so that we do not think initialize was a success
-	if (result == paNoError) {
-		result = paInternalError;
-	}
-
-    return result;
-}
-
-// ------------------------------------------------------------------------------------------
-static void Terminate( PaUtilHostApiRepresentation *hostApi )
-{
-	UINT i;
-    PaWasapiHostApiRepresentation *paWasapi = (PaWasapiHostApiRepresentation*)hostApi;
-	if (paWasapi == NULL)
-		return;
-
-	// Release IMMDeviceEnumerator
-    SAFE_RELEASE(paWasapi->enumerator);
-
-    for (i = 0; i < paWasapi->deviceCount; ++i)
-	{
-        PaWasapiDeviceInfo *info = &paWasapi->devInfo[i];
-        SAFE_RELEASE(info->device);
-
-		//if (info->MixFormat)
-        //    CoTaskMemFree(info->MixFormat);
-    }
-    PaUtil_FreeMemory(paWasapi->devInfo);
-
-    if (paWasapi->allocations)
-	{
-        PaUtil_FreeAllAllocations(paWasapi->allocations);
-        PaUtil_DestroyAllocationGroup(paWasapi->allocations);
-    }
-
-    PaWinUtil_CoUninitialize( paWASAPI, &paWasapi->comInitializationResult );
-
-    PaUtil_FreeMemory(paWasapi);
-
-	// Close AVRT
-	CloseAVRT();
-}
-
-// ------------------------------------------------------------------------------------------
-static PaWasapiHostApiRepresentation *_GetHostApi(PaError *_error)
-{
-	PaError error;
-
-	PaUtilHostApiRepresentation *pApi;
-	if ((error = PaUtil_GetHostApiRepresentation(&pApi, paWASAPI)) != paNoError)
-	{
-		if (_error != NULL)
-			(*_error) = error;
-
-		return NULL;
-	}
-	return (PaWasapiHostApiRepresentation *)pApi;
-}
-
-// ------------------------------------------------------------------------------------------
-int PaWasapi_GetDeviceDefaultFormat( void *pFormat, unsigned int nFormatSize, PaDeviceIndex nDevice )
-{
-	PaError ret;
-	PaWasapiHostApiRepresentation *paWasapi;
-	UINT32 size;
-	PaDeviceIndex index;
-
-	if (pFormat == NULL)
-		return paBadBufferPtr;
-	if (nFormatSize <= 0)
-		return paBufferTooSmall;
-
-	// Get API
-	paWasapi = _GetHostApi(&ret);
-	if (paWasapi == NULL)
-		return ret;
-
-	// Get device index
-	ret = PaUtil_DeviceIndexToHostApiDeviceIndex(&index, nDevice, &paWasapi->inheritedHostApiRep);
-    if (ret != paNoError)
-        return ret;
-
-	// Validate index
-	if ((UINT32)index >= paWasapi->deviceCount)
-		return paInvalidDevice;
-
-	size = min(nFormatSize, (UINT32)sizeof(paWasapi->devInfo[ index ].DefaultFormat));
-	memcpy(pFormat, &paWasapi->devInfo[ index ].DefaultFormat, size);
-
-	return size;
-}
-
-// ------------------------------------------------------------------------------------------
-int PaWasapi_GetDeviceRole( PaDeviceIndex nDevice )
-{
-	PaError ret;
-	PaDeviceIndex index;
-
-	// Get API
-	PaWasapiHostApiRepresentation *paWasapi = _GetHostApi(&ret);
-	if (paWasapi == NULL)
-		return paNotInitialized;
-
-	// Get device index
-	ret = PaUtil_DeviceIndexToHostApiDeviceIndex(&index, nDevice, &paWasapi->inheritedHostApiRep);
-    if (ret != paNoError)
-        return ret;
-
-	// Validate index
-	if ((UINT32)index >= paWasapi->deviceCount)
-		return paInvalidDevice;
-
-	return paWasapi->devInfo[ index ].formFactor;
-}
-
-// ------------------------------------------------------------------------------------------
-PaError PaWasapi_GetFramesPerHostBuffer( PaStream *pStream, unsigned int *nInput, unsigned int *nOutput )
-{
-    PaWasapiStream *stream = (PaWasapiStream *)pStream;
-	if (stream == NULL)
-		return paBadStreamPtr;
-
-	if (nInput != NULL)
-		(*nInput) = stream->in.framesPerHostCallback;
-
-	if (nOutput != NULL)
-		(*nOutput) = stream->out.framesPerHostCallback;
-
-	return paNoError;
-}
-
-// ------------------------------------------------------------------------------------------
-static void LogWAVEFORMATEXTENSIBLE(const WAVEFORMATEXTENSIBLE *in)
-{
-    const WAVEFORMATEX *old = (WAVEFORMATEX *)in;
-	switch (old->wFormatTag)
-	{
-	case WAVE_FORMAT_EXTENSIBLE: {
-
-		PRINT(("wFormatTag     =WAVE_FORMAT_EXTENSIBLE\n"));
-
-		if (IsEqualGUID(&in->SubFormat, &pa_KSDATAFORMAT_SUBTYPE_IEEE_FLOAT))
-		{
-			PRINT(("SubFormat      =KSDATAFORMAT_SUBTYPE_IEEE_FLOAT\n"));
-		}
-		else
-		if (IsEqualGUID(&in->SubFormat, &pa_KSDATAFORMAT_SUBTYPE_PCM))
-		{
-			PRINT(("SubFormat      =KSDATAFORMAT_SUBTYPE_PCM\n"));
-		}
-		else
-		{
-			PRINT(("SubFormat      =CUSTOM GUID{%d:%d:%d:%d%d%d%d%d%d%d%d}\n",
-										in->SubFormat.Data1,
-										in->SubFormat.Data2,
-										in->SubFormat.Data3,
-										(int)in->SubFormat.Data4[0],
-										(int)in->SubFormat.Data4[1],
-										(int)in->SubFormat.Data4[2],
-										(int)in->SubFormat.Data4[3],
-										(int)in->SubFormat.Data4[4],
-										(int)in->SubFormat.Data4[5],
-										(int)in->SubFormat.Data4[6],
-										(int)in->SubFormat.Data4[7]));
-		}
-		PRINT(("Samples.wValidBitsPerSample =%d\n",  in->Samples.wValidBitsPerSample));
-		PRINT(("dwChannelMask  =0x%X\n",in->dwChannelMask));
-
-		break; }
-
-	case WAVE_FORMAT_PCM:        PRINT(("wFormatTag     =WAVE_FORMAT_PCM\n")); break;
-	case WAVE_FORMAT_IEEE_FLOAT: PRINT(("wFormatTag     =WAVE_FORMAT_IEEE_FLOAT\n")); break;
-	default: 
-		PRINT(("wFormatTag     =UNKNOWN(%d)\n",old->wFormatTag)); break;
-	}
-
-	PRINT(("nChannels      =%d\n",old->nChannels));
-	PRINT(("nSamplesPerSec =%d\n",old->nSamplesPerSec));
-	PRINT(("nAvgBytesPerSec=%d\n",old->nAvgBytesPerSec));
-	PRINT(("nBlockAlign    =%d\n",old->nBlockAlign));
-	PRINT(("wBitsPerSample =%d\n",old->wBitsPerSample));
-	PRINT(("cbSize         =%d\n",old->cbSize));
-}
-
-// ------------------------------------------------------------------------------------------
-static PaSampleFormat WaveToPaFormat(const WAVEFORMATEXTENSIBLE *in)
-{
-    const WAVEFORMATEX *old = (WAVEFORMATEX *)in;
-
-    switch (old->wFormatTag)
-	{
-    case WAVE_FORMAT_EXTENSIBLE: {
-        if (IsEqualGUID(&in->SubFormat, &pa_KSDATAFORMAT_SUBTYPE_IEEE_FLOAT))
-		{
-            if (in->Samples.wValidBitsPerSample == 32)
-                return paFloat32;
-        }
-        else
-		if (IsEqualGUID(&in->SubFormat, &pa_KSDATAFORMAT_SUBTYPE_PCM))
-		{
-            switch (old->wBitsPerSample)
-			{
-                case 32: return paInt32;
-                case 24: return paInt24;
-                case  8: return paUInt8;
-                case 16: return paInt16;
-            }
-        }
-		break; }
-
-    case WAVE_FORMAT_IEEE_FLOAT:
-		return paFloat32;
-
-    case WAVE_FORMAT_PCM: {
-        switch (old->wBitsPerSample)
-		{
-            case 32: return paInt32;
-            case 24: return paInt24;
-            case  8: return paUInt8;
-            case 16: return paInt16;
-        }
-		break; }
-    }
-
-    return paCustomFormat;
-}
-
-// ------------------------------------------------------------------------------------------
-static PaError MakeWaveFormatFromParams(WAVEFORMATEXTENSIBLE *wavex, const PaStreamParameters *params,
-									double sampleRate)
-{
-	WORD bitsPerSample;
-	WAVEFORMATEX *old;
-	DWORD channelMask = 0;
-	PaWasapiStreamInfo *streamInfo = (PaWasapiStreamInfo *)params->hostApiSpecificStreamInfo;
-
-	// Get user assigned channel mask
-	if ((streamInfo != NULL) && (streamInfo->flags & paWinWasapiUseChannelMask))
-		channelMask = streamInfo->channelMask;
-
-	// Convert PaSampleFormat to bits per sample
-	if ((bitsPerSample = PaSampleFormatToBitsPerSample(params->sampleFormat)) == 0)
-		return paSampleFormatNotSupported;
-
-    memset(wavex, 0, sizeof(*wavex));
-
-    old					 = (WAVEFORMATEX *)wavex;
-    old->nChannels       = (WORD)params->channelCount;
-    old->nSamplesPerSec  = (DWORD)sampleRate;
-	if ((old->wBitsPerSample = bitsPerSample) > 16)
-	{
-		old->wBitsPerSample = 32; // 20 or 24 bits must go in 32 bit containers (ints)
-	}
-    old->nBlockAlign     = (old->nChannels * (old->wBitsPerSample/8));
-    old->nAvgBytesPerSec = (old->nSamplesPerSec * old->nBlockAlign);
-
-    // WAVEFORMATEX
-    if ((params->channelCount <= 2) && ((bitsPerSample == 16) || (bitsPerSample == 8)))
-	{
-        old->cbSize		= 0;
-        old->wFormatTag	= WAVE_FORMAT_PCM;
-    }
-    // WAVEFORMATEXTENSIBLE
-    else
-	{
-        old->wFormatTag = WAVE_FORMAT_EXTENSIBLE;
-        old->cbSize		= sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX);
-
-        if ((params->sampleFormat & ~paNonInterleaved) == paFloat32)
-            wavex->SubFormat = pa_KSDATAFORMAT_SUBTYPE_IEEE_FLOAT;
-        else
-            wavex->SubFormat = pa_KSDATAFORMAT_SUBTYPE_PCM;
-
-        wavex->Samples.wValidBitsPerSample = bitsPerSample; //no extra padding!
-
-		// Set channel mask
-		if (channelMask != 0)
-		{
-			wavex->dwChannelMask = channelMask;
-		}
-		else
-		{
-			switch (params->channelCount)
-			{
-			case 1:  wavex->dwChannelMask = KSAUDIO_SPEAKER_MONO; break;
-			case 2:  wavex->dwChannelMask = KSAUDIO_SPEAKER_STEREO; break;
-			case 3:  wavex->dwChannelMask = KSAUDIO_SPEAKER_STEREO|SPEAKER_LOW_FREQUENCY; break;
-			case 4:  wavex->dwChannelMask = KSAUDIO_SPEAKER_QUAD; break;
-			case 5:  wavex->dwChannelMask = KSAUDIO_SPEAKER_QUAD|SPEAKER_LOW_FREQUENCY; break;
-#ifdef KSAUDIO_SPEAKER_5POINT1_SURROUND
-			case 6:  wavex->dwChannelMask = KSAUDIO_SPEAKER_5POINT1_SURROUND; break;
-#else
-			case 6:  wavex->dwChannelMask = KSAUDIO_SPEAKER_5POINT1; break;
-#endif
-#ifdef KSAUDIO_SPEAKER_5POINT1_SURROUND
-			case 7:  wavex->dwChannelMask = KSAUDIO_SPEAKER_5POINT1_SURROUND|SPEAKER_BACK_CENTER; break;
-#else
-			case 7:  wavex->dwChannelMask = KSAUDIO_SPEAKER_5POINT1|SPEAKER_BACK_CENTER; break;
-#endif	
-#ifdef KSAUDIO_SPEAKER_7POINT1_SURROUND
-			case 8:  wavex->dwChannelMask = KSAUDIO_SPEAKER_7POINT1_SURROUND; break;
-#else
-			case 8:  wavex->dwChannelMask = KSAUDIO_SPEAKER_7POINT1; break;
-#endif
-
-			default: wavex->dwChannelMask = 0;
-			}
-		}
-	}
-    return paNoError;
-}
-
-// ------------------------------------------------------------------------------------------
-/*static void wasapiFillWFEXT( WAVEFORMATEXTENSIBLE* pwfext, PaSampleFormat sampleFormat, double sampleRate, int channelCount)
-{
-    PA_DEBUG(( "sampleFormat = %lx\n" , sampleFormat ));
-    PA_DEBUG(( "sampleRate = %f\n" , sampleRate ));
-    PA_DEBUG(( "chanelCount = %d\n", channelCount ));
-
-    pwfext->Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE;
-    pwfext->Format.nChannels = (WORD)channelCount;
-    pwfext->Format.nSamplesPerSec = (DWORD)sampleRate;
-    if(channelCount == 1)
-        pwfext->dwChannelMask = KSAUDIO_SPEAKER_DIRECTOUT;
-    else
-        pwfext->dwChannelMask = KSAUDIO_SPEAKER_STEREO;
-    if(sampleFormat == paFloat32)
-    {
-        pwfext->Format.nBlockAlign = (WORD)(channelCount * 4);
-        pwfext->Format.wBitsPerSample = 32;
-        pwfext->Format.cbSize = sizeof(WAVEFORMATEXTENSIBLE)-sizeof(WAVEFORMATEX);
-        pwfext->Samples.wValidBitsPerSample = 32;
-        pwfext->SubFormat = pa_KSDATAFORMAT_SUBTYPE_IEEE_FLOAT;
-    }
-    else if(sampleFormat == paInt32)
-    {
-        pwfext->Format.nBlockAlign = (WORD)(channelCount * 4);
-        pwfext->Format.wBitsPerSample = 32;
-        pwfext->Format.cbSize = sizeof(WAVEFORMATEXTENSIBLE)-sizeof(WAVEFORMATEX);
-        pwfext->Samples.wValidBitsPerSample = 32;
-        pwfext->SubFormat = pa_KSDATAFORMAT_SUBTYPE_PCM;
-    }
-    else if(sampleFormat == paInt24)
-    {
-        pwfext->Format.nBlockAlign = (WORD)(channelCount * 4);
-        pwfext->Format.wBitsPerSample = 32; // 24-bit in 32-bit int container
-        pwfext->Format.cbSize = sizeof(WAVEFORMATEXTENSIBLE)-sizeof(WAVEFORMATEX);
-        pwfext->Samples.wValidBitsPerSample = 24;
-        pwfext->SubFormat = pa_KSDATAFORMAT_SUBTYPE_PCM;
-    }
-    else if(sampleFormat == paInt16)
-    {
-        pwfext->Format.nBlockAlign = (WORD)(channelCount * 2);
-        pwfext->Format.wBitsPerSample = 16;
-        pwfext->Format.cbSize = sizeof(WAVEFORMATEXTENSIBLE)-sizeof(WAVEFORMATEX);
-        pwfext->Samples.wValidBitsPerSample = 16;
-        pwfext->SubFormat = pa_KSDATAFORMAT_SUBTYPE_PCM;
-    }
-    pwfext->Format.nAvgBytesPerSec = pwfext->Format.nSamplesPerSec * pwfext->Format.nBlockAlign;
-}*/
-
-// ------------------------------------------------------------------------------------------
-static PaError GetClosestFormat(IAudioClient *myClient, double sampleRate,
-	const PaStreamParameters *_params, AUDCLNT_SHAREMODE shareMode, WAVEFORMATEXTENSIBLE *outWavex,
-	BOOL output)
-{
-	PaError answer                   = paInvalidSampleRate;
-	WAVEFORMATEX *sharedClosestMatch = NULL;
-	HRESULT hr                       = !S_OK;
-	PaStreamParameters params       = (*_params);
-
-	/* It was not noticed that 24-bit Input producing no output while device accepts this format.
-	   To fix this issue let's ask for 32-bits and let PA converters convert host 32-bit data
-	   to 24-bit for user-space. The bug concerns Vista, if Windows 7 supports 24-bits for Input
-	   please report to PortAudio developers to exclude Windows 7.
-	*/
-	/*if ((params.sampleFormat == paInt24) && (output == FALSE))
-		params.sampleFormat = paFloat32;*/ // <<< The silence was due to missing Int32_To_Int24_Dither implementation
-
-    MakeWaveFormatFromParams(outWavex, &params, sampleRate);
-
-	hr = IAudioClient_IsFormatSupported(myClient, shareMode, &outWavex->Format, (shareMode == AUDCLNT_SHAREMODE_SHARED ? &sharedClosestMatch : NULL));
-	if (hr == S_OK)
-		answer = paFormatIsSupported;
-    else
-	if (sharedClosestMatch)
-	{
-		WORD bitsPerSample;
-        WAVEFORMATEXTENSIBLE *ext = (WAVEFORMATEXTENSIBLE*)sharedClosestMatch;
-
-		GUID subf_guid = GUID_NULL;
-		if (sharedClosestMatch->wFormatTag == WAVE_FORMAT_EXTENSIBLE)
-		{
-			memcpy(outWavex, sharedClosestMatch, sizeof(WAVEFORMATEXTENSIBLE));
-			subf_guid = ext->SubFormat;
-		}
-		else
-			memcpy(outWavex, sharedClosestMatch, sizeof(WAVEFORMATEX));
-
-        CoTaskMemFree(sharedClosestMatch);
-
-		// Make supported by default
-		answer = paFormatIsSupported;
-
-		// Validate SampleRate
-		if ((DWORD)sampleRate != outWavex->Format.nSamplesPerSec)
-			return paInvalidSampleRate;
-
-		// Validate Channel count
-		if ((WORD)params.channelCount != outWavex->Format.nChannels)
-		{
-			// If mono, then driver does not support 1 channel, we use internal workaround
-			// of tiny software mixing functionality, e.g. we provide to user buffer 1 channel
-			// but then mix into 2 for device buffer
-			if ((params.channelCount == 1) && (outWavex->Format.nChannels == 2))
-				return paFormatIsSupported;
-			else
-				return paInvalidChannelCount;
-		}
-
-		// Validate Sample format
-		if ((bitsPerSample = PaSampleFormatToBitsPerSample(params.sampleFormat)) == 0)
-			return paSampleFormatNotSupported;
-
-		// Validate Sample format: bit size (WASAPI does not limit 'bit size')
-		//if (bitsPerSample != outWavex->Format.wBitsPerSample)
-		//	return paSampleFormatNotSupported;
-
-		// Validate Sample format: paFloat32 (WASAPI does not limit 'bit type')
-		//if ((params->sampleFormat == paFloat32) && (subf_guid != KSDATAFORMAT_SUBTYPE_IEEE_FLOAT))
-		//	return paSampleFormatNotSupported;
-
-		// Validate Sample format: paInt32 (WASAPI does not limit 'bit type')
-		//if ((params->sampleFormat == paInt32) && (subf_guid != KSDATAFORMAT_SUBTYPE_PCM))
-		//	return paSampleFormatNotSupported;
-	}
-	else
-	{
-		static const int BestToWorst[] = { paFloat32, paInt24, paInt16 };
-		int i;
-
-		// Try combination stereo and we will use built-in mono-stereo mixer then
-		if (params.channelCount == 1)
-		{
-			WAVEFORMATEXTENSIBLE stereo = { 0 };
-
-			PaStreamParameters stereo_params = params;
-			stereo_params.channelCount = 2;
-
-			MakeWaveFormatFromParams(&stereo, &stereo_params, sampleRate);
-
-			hr = IAudioClient_IsFormatSupported(myClient, shareMode, &stereo.Format, (shareMode == AUDCLNT_SHAREMODE_SHARED ? &sharedClosestMatch : NULL));
-			if (hr == S_OK)
-			{
-				memcpy(outWavex, &stereo, sizeof(WAVEFORMATEXTENSIBLE));
-				CoTaskMemFree(sharedClosestMatch);
-				return (answer = paFormatIsSupported);
-			}
-
-			// Try selecting suitable sample type
-			for (i = 0; i < STATIC_ARRAY_SIZE(BestToWorst); ++i)
-			{
-				WAVEFORMATEXTENSIBLE sample = { 0 };
-
-				PaStreamParameters sample_params = stereo_params;
-				sample_params.sampleFormat = BestToWorst[i];
-
-				MakeWaveFormatFromParams(&sample, &sample_params, sampleRate);
-
-				hr = IAudioClient_IsFormatSupported(myClient, shareMode, &sample.Format, (shareMode == AUDCLNT_SHAREMODE_SHARED ? &sharedClosestMatch : NULL));
-				if (hr == S_OK)
-				{
-					memcpy(outWavex, &sample, sizeof(WAVEFORMATEXTENSIBLE));
-					CoTaskMemFree(sharedClosestMatch);
-					return (answer = paFormatIsSupported);
-				}
-			}
-		}
-
-		// Try selecting suitable sample type
-		for (i = 0; i < STATIC_ARRAY_SIZE(BestToWorst); ++i)
-		{
-			WAVEFORMATEXTENSIBLE spfmt = { 0 };
-
-			PaStreamParameters spfmt_params = params;
-			spfmt_params.sampleFormat = BestToWorst[i];
-
-			MakeWaveFormatFromParams(&spfmt, &spfmt_params, sampleRate);
-
-			hr = IAudioClient_IsFormatSupported(myClient, shareMode, &spfmt.Format, (shareMode == AUDCLNT_SHAREMODE_SHARED ? &sharedClosestMatch : NULL));
-			if (hr == S_OK)
-			{
-				memcpy(outWavex, &spfmt, sizeof(WAVEFORMATEXTENSIBLE));
-				CoTaskMemFree(sharedClosestMatch);
-				answer = paFormatIsSupported;
-				break;
-			}
-		}
-
-		// Nothing helped
-		LogHostError(hr);
-	}
-
-	return answer;
-}
-
-// ------------------------------------------------------------------------------------------
-static PaError IsStreamParamsValid(struct PaUtilHostApiRepresentation *hostApi,
-                                   const  PaStreamParameters *inputParameters,
-                                   const  PaStreamParameters *outputParameters,
-                                   double sampleRate)
-{
-	if (hostApi == NULL)
-		return paHostApiNotFound;
-	if ((UINT32)sampleRate == 0)
-		return paInvalidSampleRate;
-
-	if (inputParameters != NULL)
-    {
-        /* all standard sample formats are supported by the buffer adapter,
-            this implementation doesn't support any custom sample formats */
-		if (inputParameters->sampleFormat & paCustomFormat)
-            return paSampleFormatNotSupported;
-
-        /* unless alternate device specification is supported, reject the use of
-            paUseHostApiSpecificDeviceSpecification */
-        if (inputParameters->device == paUseHostApiSpecificDeviceSpecification)
-            return paInvalidDevice;
-
-        /* check that input device can support inputChannelCount */
-        if (inputParameters->channelCount > hostApi->deviceInfos[ inputParameters->device ]->maxInputChannels)
-            return paInvalidChannelCount;
-
-        /* validate inputStreamInfo */
-        if (inputParameters->hostApiSpecificStreamInfo)
-		{
-			PaWasapiStreamInfo *inputStreamInfo = (PaWasapiStreamInfo *)inputParameters->hostApiSpecificStreamInfo;
-	        if ((inputStreamInfo->size != sizeof(PaWasapiStreamInfo)) ||
-	            (inputStreamInfo->version != 1) ||
-                (inputStreamInfo->hostApiType != paWASAPI))
-	        {
-	            return paIncompatibleHostApiSpecificStreamInfo;
-	        }
-		}
-
-        return paNoError;
-    }
-
-    if (outputParameters != NULL)
-    {
-        /* all standard sample formats are supported by the buffer adapter,
-            this implementation doesn't support any custom sample formats */
-        if (outputParameters->sampleFormat & paCustomFormat)
-            return paSampleFormatNotSupported;
-
-        /* unless alternate device specification is supported, reject the use of
-            paUseHostApiSpecificDeviceSpecification */
-        if (outputParameters->device == paUseHostApiSpecificDeviceSpecification)
-            return paInvalidDevice;
-
-        /* check that output device can support outputChannelCount */
-        if (outputParameters->channelCount > hostApi->deviceInfos[ outputParameters->device ]->maxOutputChannels)
-            return paInvalidChannelCount;
-
-        /* validate outputStreamInfo */
-        if(outputParameters->hostApiSpecificStreamInfo)
-        {
-			PaWasapiStreamInfo *outputStreamInfo = (PaWasapiStreamInfo *)outputParameters->hostApiSpecificStreamInfo;
-	        if ((outputStreamInfo->size != sizeof(PaWasapiStreamInfo)) ||
-	            (outputStreamInfo->version != 1) ||
-                (outputStreamInfo->hostApiType != paWASAPI))
-	        {
-	            return paIncompatibleHostApiSpecificStreamInfo;
-	        }
-        }
-
-		return paNoError;
-    }
-
-	return (inputParameters || outputParameters ? paNoError : paInternalError);
-}
-
-// ------------------------------------------------------------------------------------------
-static PaError IsFormatSupported( struct PaUtilHostApiRepresentation *hostApi,
-                                  const  PaStreamParameters *inputParameters,
-                                  const  PaStreamParameters *outputParameters,
-                                  double sampleRate )
-{
-	IAudioClient *tmpClient = NULL;
-	PaWasapiHostApiRepresentation *paWasapi = (PaWasapiHostApiRepresentation*)hostApi;
-	PaWasapiStreamInfo *inputStreamInfo = NULL, *outputStreamInfo = NULL;
-
-	// Validate PaStreamParameters
-	PaError error;
-	if ((error = IsStreamParamsValid(hostApi, inputParameters, outputParameters, sampleRate)) != paNoError)
-		return error;
-
-    if (inputParameters != NULL)
-    {
-		WAVEFORMATEXTENSIBLE wavex;
-		HRESULT hr;
-		PaError answer;
-		AUDCLNT_SHAREMODE shareMode = AUDCLNT_SHAREMODE_SHARED;
-		inputStreamInfo = (PaWasapiStreamInfo *)inputParameters->hostApiSpecificStreamInfo;
-
-		if (inputStreamInfo && (inputStreamInfo->flags & paWinWasapiExclusive))
-			shareMode  = AUDCLNT_SHAREMODE_EXCLUSIVE;
-
-		hr = IMMDevice_Activate(paWasapi->devInfo[inputParameters->device].device,
-			&pa_IID_IAudioClient, CLSCTX_INPROC_SERVER, NULL, (void **)&tmpClient);
-		if (hr != S_OK)
-		{
-			LogHostError(hr);
-			return paInvalidDevice;
-		}
-
-		answer = GetClosestFormat(tmpClient, sampleRate, inputParameters, shareMode, &wavex, FALSE);
-		SAFE_RELEASE(tmpClient);
-
-		if (answer != paFormatIsSupported)
-			return answer;
-    }
-
-    if (outputParameters != NULL)
-    {
-		HRESULT hr;
-		WAVEFORMATEXTENSIBLE wavex;
-		PaError answer;
-		AUDCLNT_SHAREMODE shareMode = AUDCLNT_SHAREMODE_SHARED;
-        outputStreamInfo = (PaWasapiStreamInfo *)outputParameters->hostApiSpecificStreamInfo;
-
-		if (outputStreamInfo && (outputStreamInfo->flags & paWinWasapiExclusive))
-			shareMode  = AUDCLNT_SHAREMODE_EXCLUSIVE;
-
-		hr = IMMDevice_Activate(paWasapi->devInfo[outputParameters->device].device,
-			&pa_IID_IAudioClient, CLSCTX_INPROC_SERVER, NULL, (void **)&tmpClient);
-		if (hr != S_OK)
-		{
-			LogHostError(hr);
-			return paInvalidDevice;
-		}
-
-		answer = GetClosestFormat(tmpClient, sampleRate, outputParameters, shareMode, &wavex, TRUE);
-		SAFE_RELEASE(tmpClient);
-
-		if (answer != paFormatIsSupported)
-			return answer;
-    }
-
-    return paFormatIsSupported;
-}
-
-// ------------------------------------------------------------------------------------------
-static PaUint32 PaUtil_GetFramesPerHostBuffer(PaUint32 userFramesPerBuffer, PaTime suggestedLatency, double sampleRate, PaUint32 TimerJitterMs)
-{
-	PaUint32 frames = userFramesPerBuffer + max( userFramesPerBuffer, (PaUint32)(suggestedLatency * sampleRate) );
-    frames += (PaUint32)((sampleRate * 0.001) * TimerJitterMs);
-	return frames;
-}
-
-// ------------------------------------------------------------------------------------------
-static void _RecalculateBuffersCount(PaWasapiSubStream *sub, UINT32 userFramesPerBuffer, UINT32 framesPerLatency, BOOL fullDuplex)
-{
-	// Count buffers (must be at least 1)
-	sub->buffers = (userFramesPerBuffer ? framesPerLatency / userFramesPerBuffer : 0);
-	if (sub->buffers == 0)
-		sub->buffers = 1;
-
-	// Determine amount of buffers used:
-	// - Full-duplex mode will lead to period difference, thus only 1.
-	// - Input mode, only 1, as WASAPI allows extraction of only 1 packet.
-	// - For Shared mode we use double buffering.
-	if ((sub->shareMode == AUDCLNT_SHAREMODE_EXCLUSIVE) || fullDuplex)
-	{
-		// Exclusive mode does not allow >1 buffers be used for Event interface, e.g. GetBuffer
-		// call must acquire max buffer size and it all must be processed.
-		if (sub->streamFlags & AUDCLNT_STREAMFLAGS_EVENTCALLBACK)
-			sub->userBufferAndHostMatch = 1;
-
-		// Use paUtilBoundedHostBufferSize because exclusive mode will starve and produce
-		// bad quality of audio
-		sub->buffers = 1;
-	}
-}
-
-// ------------------------------------------------------------------------------------------
-static void _CalculateAlignedPeriod(PaWasapiSubStream *pSub, UINT32 *nFramesPerLatency,
-									ALIGN_FUNC pAlignFunc)
-{
-	// Align frames to HD Audio packet size of 128 bytes for Exclusive mode only.
-	// Not aligning on Windows Vista will cause Event timeout, although Windows 7 will
-	// return AUDCLNT_E_BUFFER_SIZE_NOT_ALIGNED error to realign buffer. Aligning is necessary
-	// for Exclusive mode only! when audio data is feeded directly to hardware.
-	if (pSub->shareMode == AUDCLNT_SHAREMODE_EXCLUSIVE)
-	{
-		(*nFramesPerLatency) = AlignFramesPerBuffer((*nFramesPerLatency),
-			pSub->wavex.Format.nSamplesPerSec, pSub->wavex.Format.nBlockAlign, pAlignFunc);
-	}
-
-	// Calculate period
-	pSub->period = MakeHnsPeriod((*nFramesPerLatency), pSub->wavex.Format.nSamplesPerSec);
-}
-
-// ------------------------------------------------------------------------------------------
-static HRESULT CreateAudioClient(PaWasapiStream *pStream, PaWasapiSubStream *pSub, BOOL output, PaError *pa_error)
-{
-	PaError error;
-    HRESULT hr;
-
-	const PaWasapiDeviceInfo *pInfo  = pSub->params.device_info;
-	const PaStreamParameters *params = &pSub->params.stream_params;
-	UINT32 framesPerLatency          = pSub->params.frames_per_buffer;
-	double sampleRate                = pSub->params.sample_rate;
-	BOOL blocking                    = pSub->params.blocking;
-	BOOL fullDuplex                  = pSub->params.full_duplex;
-
-	const UINT32 userFramesPerBuffer = framesPerLatency;
-    IAudioClient *audioClient	     = NULL;
-
-	// Assume default failure due to some reason
-	(*pa_error) = paInvalidDevice;
-
-	// Validate parameters
-    if (!pSub || !pInfo || !params)
-	{
-		(*pa_error) = paBadStreamPtr;
-        return E_POINTER;
-	}
-	if ((UINT32)sampleRate == 0)
-	{
-		(*pa_error) = paInvalidSampleRate;
-        return E_INVALIDARG;
-	}
-
-    // Get the audio client
-    hr = IMMDevice_Activate(pInfo->device, &pa_IID_IAudioClient, CLSCTX_ALL, NULL, (void **)&audioClient);
-	if (hr != S_OK)
-	{
-		(*pa_error) = paInsufficientMemory;
-		LogHostError(hr);
-		goto done;
-	}
-
-	// Get closest format
-	if ((error = GetClosestFormat(audioClient, sampleRate, params, pSub->shareMode, &pSub->wavex, output)) != paFormatIsSupported)
-	{
-		(*pa_error) = error;
-		LogHostError(hr = AUDCLNT_E_UNSUPPORTED_FORMAT);
-		goto done; // fail, format not supported
-	}
-
-	// Check for Mono <<>> Stereo workaround
-	if ((params->channelCount == 1) && (pSub->wavex.Format.nChannels == 2))
-	{
-		/*if (blocking)
-		{
-			LogHostError(hr = AUDCLNT_E_UNSUPPORTED_FORMAT);
-			goto done; // fail, blocking mode not supported
-		}*/
-
-		// select mixer
-		pSub->monoMixer = _GetMonoToStereoMixer(WaveToPaFormat(&pSub->wavex), (pInfo->flow == eRender ? MIX_DIR__1TO2 : MIX_DIR__2TO1_L));
-		if (pSub->monoMixer == NULL)
-		{
-			(*pa_error) = paInvalidChannelCount;
-			LogHostError(hr = AUDCLNT_E_UNSUPPORTED_FORMAT);
-			goto done; // fail, no mixer for format
-		}
-	}
-
-#if 0
-	// Add suggestd latency
-	framesPerLatency += MakeFramesFromHns(SecondsTonano100(params->suggestedLatency), pSub->wavex.Format.nSamplesPerSec);
-#else
-	// Calculate host buffer size
-	if ((pSub->shareMode != AUDCLNT_SHAREMODE_EXCLUSIVE) &&
-		(!pSub->streamFlags || ((pSub->streamFlags & AUDCLNT_STREAMFLAGS_EVENTCALLBACK) == 0)))
-	{
-		framesPerLatency = PaUtil_GetFramesPerHostBuffer(userFramesPerBuffer,
-			params->suggestedLatency, pSub->wavex.Format.nSamplesPerSec, 0/*,
-			(pSub->streamFlags & AUDCLNT_STREAMFLAGS_EVENTCALLBACK ? 0 : 1)*/);
-	}
-	else
-	{
-		REFERENCE_TIME overall;
-
-		// Work 1:1 with user buffer (only polling allows to use >1)
-		framesPerLatency += MakeFramesFromHns(SecondsTonano100(params->suggestedLatency), pSub->wavex.Format.nSamplesPerSec);
-
-		// Use Polling if overall latency is > 5ms as it allows to use 100% CPU in a callback,
-		// or user specified latency parameter
-		overall = MakeHnsPeriod(framesPerLatency, pSub->wavex.Format.nSamplesPerSec);
-		if ((overall >= (106667*2)/*21.33ms*/) || ((INT32)(params->suggestedLatency*100000.0) != 0/*0.01 msec granularity*/))
-		{
-			framesPerLatency = PaUtil_GetFramesPerHostBuffer(userFramesPerBuffer,
-				params->suggestedLatency, pSub->wavex.Format.nSamplesPerSec, 0/*,
-				(streamFlags & AUDCLNT_STREAMFLAGS_EVENTCALLBACK ? 0 : 1)*/);
-
-			// Use Polling interface
-			pSub->streamFlags &= ~AUDCLNT_STREAMFLAGS_EVENTCALLBACK;
-			PRINT(("WASAPI: CreateAudioClient: forcing POLL mode\n"));
-		}
-	}
-#endif
-
-	// For full-duplex output resize buffer to be the same as for input
-	if (output && fullDuplex)
-		framesPerLatency = pStream->in.framesPerHostCallback;
-
-	// Avoid 0 frames
-	if (framesPerLatency == 0)
-		framesPerLatency = MakeFramesFromHns(pInfo->DefaultDevicePeriod, pSub->wavex.Format.nSamplesPerSec);
-
-	// Exclusive Input stream renders data in 6 packets, we must set then the size of
-	// single packet, total buffer size, e.g. required latency will be PacketSize * 6
-	if (!output && (pSub->shareMode == AUDCLNT_SHAREMODE_EXCLUSIVE))
-	{
-		// Do it only for Polling mode
-		if ((pSub->streamFlags & AUDCLNT_STREAMFLAGS_EVENTCALLBACK) == 0)
-		{
-			framesPerLatency /= WASAPI_PACKETS_PER_INPUT_BUFFER;
-		}
-	}
-
-	// Calculate aligned period
-	_CalculateAlignedPeriod(pSub, &framesPerLatency, ALIGN_BWD);
-
-	/*! Enforce min/max period for device in Shared mode to avoid bad audio quality.
-        Avoid doing so for Exclusive mode as alignment will suffer.
-	*/
-	if (pSub->shareMode == AUDCLNT_SHAREMODE_SHARED)
-	{
-		if (pSub->period < pInfo->DefaultDevicePeriod)
-		{
-			pSub->period = pInfo->DefaultDevicePeriod;
-			// Recalculate aligned period
-			framesPerLatency = MakeFramesFromHns(pSub->period, pSub->wavex.Format.nSamplesPerSec);
-			_CalculateAlignedPeriod(pSub, &framesPerLatency, ALIGN_BWD);
-		}
-	}
-	else
-	{
-		if (pSub->period < pInfo->MinimumDevicePeriod)
-		{
-			pSub->period = pInfo->MinimumDevicePeriod;
-			// Recalculate aligned period
-			framesPerLatency = MakeFramesFromHns(pSub->period, pSub->wavex.Format.nSamplesPerSec);
-			_CalculateAlignedPeriod(pSub, &framesPerLatency, ALIGN_FWD);
-		}
-	}
-
-	/*! Windows 7 does not allow to set latency lower than minimal device period and will
-	    return error: AUDCLNT_E_INVALID_DEVICE_PERIOD. Under Vista we enforce the same behavior
-	    manually for unified behavior on all platforms.
-	*/
-	{
-		/*!	AUDCLNT_E_BUFFER_SIZE_ERROR: Applies to Windows 7 and later.
-			Indicates that the buffer duration value requested by an exclusive-mode client is
-			out of range. The requested duration value for pull mode must not be greater than
-			500 milliseconds; for push mode the duration value must not be greater than 2 seconds.
-		*/
-		if (pSub->shareMode == AUDCLNT_SHAREMODE_EXCLUSIVE)
-		{
-			static const REFERENCE_TIME MAX_BUFFER_EVENT_DURATION = 500  * 10000;
-			static const REFERENCE_TIME MAX_BUFFER_POLL_DURATION  = 2000 * 10000;
-
-			if (pSub->streamFlags & AUDCLNT_STREAMFLAGS_EVENTCALLBACK)	// pull mode, max 500ms
-			{
-				if (pSub->period > MAX_BUFFER_EVENT_DURATION)
-				{
-					pSub->period = MAX_BUFFER_EVENT_DURATION;
-					// Recalculate aligned period
-					framesPerLatency = MakeFramesFromHns(pSub->period, pSub->wavex.Format.nSamplesPerSec);
-					_CalculateAlignedPeriod(pSub, &framesPerLatency, ALIGN_BWD);
-				}
-			}
-			else														// push mode, max 2000ms
-			{
-				if (pSub->period > MAX_BUFFER_POLL_DURATION)
-				{
-					pSub->period = MAX_BUFFER_POLL_DURATION;
-					// Recalculate aligned period
-					framesPerLatency = MakeFramesFromHns(pSub->period, pSub->wavex.Format.nSamplesPerSec);
-					_CalculateAlignedPeriod(pSub, &framesPerLatency, ALIGN_BWD);
-				}
-			}
-		}
-	}
-
-	// Open the stream and associate it with an audio session
-    hr = IAudioClient_Initialize(audioClient,
-        pSub->shareMode,
-        pSub->streamFlags,
-		pSub->period,
-		(pSub->shareMode == AUDCLNT_SHAREMODE_EXCLUSIVE ? pSub->period : 0),
-		&pSub->wavex.Format,
-        NULL);
-
-	/*! WASAPI is tricky on large device buffer, sometimes 2000ms can be allocated sometimes
-	    less. There is no known guaranteed level thus we make subsequent tries by decreasing
-		buffer by 100ms per try.
-	*/
-	while ((hr == E_OUTOFMEMORY) && (pSub->period > (100 * 10000)))
-	{
-		PRINT(("WASAPI: CreateAudioClient: decreasing buffer size to %d milliseconds\n", (pSub->period / 10000)));
-
-		// Decrease by 100ms and try again
-		pSub->period -= (100 * 10000);
-
-		// Recalculate aligned period
-		framesPerLatency = MakeFramesFromHns(pSub->period, pSub->wavex.Format.nSamplesPerSec);
-		_CalculateAlignedPeriod(pSub, &framesPerLatency, ALIGN_BWD);
-
-        // Release the previous allocations
-        SAFE_RELEASE(audioClient);
-
-        // Create a new audio client
-        hr = IMMDevice_Activate(pInfo->device, &pa_IID_IAudioClient, CLSCTX_ALL, NULL, (void**)&audioClient);
-    	if (hr != S_OK)
-		{
-			(*pa_error) = paInsufficientMemory;
-			LogHostError(hr);
-			goto done;
-		}
-
-		// Open the stream and associate it with an audio session
-		hr = IAudioClient_Initialize(audioClient,
-			pSub->shareMode,
-			pSub->streamFlags,
-			pSub->period,
-			(pSub->shareMode == AUDCLNT_SHAREMODE_EXCLUSIVE ? pSub->period : 0),
-			&pSub->wavex.Format,
-			NULL);
-	}
-
-	/*! WASAPI buffer size failure. Fallback to using default size.
-	*/
-	if (hr == AUDCLNT_E_BUFFER_SIZE_ERROR)
-	{
-		// Use default
-		pSub->period = pInfo->DefaultDevicePeriod;
-
-		PRINT(("WASAPI: CreateAudioClient: correcting buffer size to device default\n"));
-
-        // Release the previous allocations
-        SAFE_RELEASE(audioClient);
-
-        // Create a new audio client
-        hr = IMMDevice_Activate(pInfo->device, &pa_IID_IAudioClient, CLSCTX_ALL, NULL, (void**)&audioClient);
-    	if (hr != S_OK)
-		{
-			(*pa_error) = paInsufficientMemory;
-			LogHostError(hr);
-			goto done;
-		}
-
-		// Open the stream and associate it with an audio session
-		hr = IAudioClient_Initialize(audioClient,
-			pSub->shareMode,
-			pSub->streamFlags,
-			pSub->period,
-			(pSub->shareMode == AUDCLNT_SHAREMODE_EXCLUSIVE ? pSub->period : 0),
-			&pSub->wavex.Format,
-			NULL);
-	}
-
-    /*! If the requested buffer size is not aligned. Can be triggered by Windows 7 and up.
-	    Should not be be triggered ever as we do align buffers always with _CalculateAlignedPeriod.
-	*/
-    if (hr == AUDCLNT_E_BUFFER_SIZE_NOT_ALIGNED)
-    {
-		UINT32 frames = 0;
-
-        // Get the next aligned frame
-        hr = IAudioClient_GetBufferSize(audioClient, &frames);
-		if (hr != S_OK)
-		{
-			(*pa_error) = paInvalidDevice;
-			LogHostError(hr);
-			goto done;
-		}
-
-		PRINT(("WASAPI: CreateAudioClient: aligning buffer size to % frames\n", frames));
-
-        // Release the previous allocations
-        SAFE_RELEASE(audioClient);
-
-        // Create a new audio client
-        hr = IMMDevice_Activate(pInfo->device, &pa_IID_IAudioClient, CLSCTX_ALL, NULL, (void**)&audioClient);
-    	if (hr != S_OK)
-		{
-			(*pa_error) = paInsufficientMemory;
-			LogHostError(hr);
-			goto done;
-		}
-
-		// Get closest format
-		if ((error = GetClosestFormat(audioClient, sampleRate, params, pSub->shareMode, &pSub->wavex, output)) != paFormatIsSupported)
-		{
-			(*pa_error) = error;
-			LogHostError(hr = AUDCLNT_E_UNSUPPORTED_FORMAT); // fail, format not supported
-			goto done;
-		}
-
-		// Check for Mono >> Stereo workaround
-		if ((params->channelCount == 1) && (pSub->wavex.Format.nChannels == 2))
-		{
-			/*if (blocking)
-			{
-				LogHostError(hr = AUDCLNT_E_UNSUPPORTED_FORMAT);
-				goto done; // fail, blocking mode not supported
-			}*/
-
-			// Select mixer
-			pSub->monoMixer = _GetMonoToStereoMixer(WaveToPaFormat(&pSub->wavex), (pInfo->flow == eRender ? MIX_DIR__1TO2 : MIX_DIR__2TO1_L));
-			if (pSub->monoMixer == NULL)
-			{
-				(*pa_error) = paInvalidChannelCount;
-				LogHostError(hr = AUDCLNT_E_UNSUPPORTED_FORMAT);
-				goto done; // fail, no mixer for format
-			}
-		}
-
-		// Calculate period
-		pSub->period = MakeHnsPeriod(frames, pSub->wavex.Format.nSamplesPerSec);
-
-        // Open the stream and associate it with an audio session
-        hr = IAudioClient_Initialize(audioClient,
-            pSub->shareMode,
-            pSub->streamFlags,
-			pSub->period,
-			(pSub->shareMode == AUDCLNT_SHAREMODE_EXCLUSIVE ? pSub->period : 0),
-            &pSub->wavex.Format,
-            NULL);
-    	if (hr != S_OK)
-		{
-			(*pa_error) = paInvalidDevice;
-			LogHostError(hr);
-			goto done;
-		}
-    }
-    else
-	if (hr != S_OK)
-    {
-		(*pa_error) = paInvalidDevice;
-		LogHostError(hr);
-		goto done;
-    }
-
-    // Set client
-	pSub->clientParent = audioClient;
-    IAudioClient_AddRef(pSub->clientParent);
-
-	// Recalculate buffers count
-	_RecalculateBuffersCount(pSub,
-		userFramesPerBuffer,
-		MakeFramesFromHns(pSub->period, pSub->wavex.Format.nSamplesPerSec),
-		fullDuplex);
-
-	// No error, client is succesfully created
-	(*pa_error) = paNoError;
-
-done:
-
-    // Clean up
-    SAFE_RELEASE(audioClient);
-    return hr;
-}
-
-// ------------------------------------------------------------------------------------------
-static PaError ActivateAudioClientOutput(PaWasapiStream *stream)
-{
-	HRESULT hr;
-	PaError result;
-
-	UINT32 maxBufferSize   = 0;
-	PaTime buffer_latency  = 0;
-	UINT32 framesPerBuffer = stream->out.params.frames_per_buffer;
-
-	// Create Audio client
-	hr = CreateAudioClient(stream, &stream->out, TRUE, &result);
-    if (hr != S_OK)
-	{
-		LogPaError(result);
-		goto error;
-    }
-	LogWAVEFORMATEXTENSIBLE(&stream->out.wavex);
-
-	// Activate volume
-	stream->outVol = NULL;
-    /*hr = info->device->Activate(
-        __uuidof(IAudioEndpointVolume), CLSCTX_INPROC_SERVER, NULL,
-        (void**)&stream->outVol);
-    if (hr != S_OK)
-        return paInvalidDevice;*/
-
-    // Get max possible buffer size to check if it is not less than that we request
-    hr = IAudioClient_GetBufferSize(stream->out.clientParent, &maxBufferSize);
-    if (hr != S_OK)
-	{
-		LogHostError(hr);
-		LogPaError(result = paInvalidDevice);
-		goto error;
-	}
-
-    // Correct buffer to max size if it maxed out result of GetBufferSize
-	stream->out.bufferSize = maxBufferSize;
-
-	// Get interface latency (actually uneeded as we calculate latency from the size
-	// of maxBufferSize).
-    hr = IAudioClient_GetStreamLatency(stream->out.clientParent, &stream->out.deviceLatency);
-    if (hr != S_OK)
-	{
-		LogHostError(hr);
-		LogPaError(result = paInvalidDevice);
-		goto error;
-	}
-	//stream->out.latencySeconds = nano100ToSeconds(stream->out.deviceLatency);
-
-    // Number of frames that are required at each period
-	stream->out.framesPerHostCallback = maxBufferSize;
-
-	// Calculate frames per single buffer, if buffers > 1 then always framesPerBuffer
-	stream->out.framesPerBuffer =
-		(stream->out.userBufferAndHostMatch ? stream->out.framesPerHostCallback : framesPerBuffer);
-
-	// Calculate buffer latency
-	buffer_latency = (PaTime)maxBufferSize / stream->out.wavex.Format.nSamplesPerSec;
-
-	// Append buffer latency to interface latency in shared mode (see GetStreamLatency notes)
-	stream->out.latencySeconds = buffer_latency;
-
-	PRINT(("WASAPI::OpenStream(output): framesPerUser[ %d ] framesPerHost[ %d ] latency[ %.02fms ] exclusive[ %s ] wow64_fix[ %s ] mode[ %s ]\n", (UINT32)framesPerBuffer, (UINT32)stream->out.framesPerHostCallback, (float)(stream->out.latencySeconds*1000.0f), (stream->out.shareMode == AUDCLNT_SHAREMODE_EXCLUSIVE ? "YES" : "NO"), (stream->out.params.wow64_workaround ? "YES" : "NO"), (stream->out.streamFlags & AUDCLNT_STREAMFLAGS_EVENTCALLBACK ? "EVENT" : "POLL")));
-
-	return paNoError;
-
-error:
-
-	return result;
-}
-
-// ------------------------------------------------------------------------------------------
-static PaError ActivateAudioClientInput(PaWasapiStream *stream)
-{
-	HRESULT hr;
-	PaError result;
-
-	UINT32 maxBufferSize   = 0;
-	PaTime buffer_latency  = 0;
-	UINT32 framesPerBuffer = stream->in.params.frames_per_buffer;
-
-	// Create Audio client
-	hr = CreateAudioClient(stream, &stream->in, FALSE, &result);
-    if (hr != S_OK)
-	{
-		LogPaError(result);
-		goto error;
-    }
-	LogWAVEFORMATEXTENSIBLE(&stream->in.wavex);
-
-	// Create volume mgr
-	stream->inVol = NULL;
-    /*hr = info->device->Activate(
-        __uuidof(IAudioEndpointVolume), CLSCTX_INPROC_SERVER, NULL,
-        (void**)&stream->inVol);
-    if (hr != S_OK)
-        return paInvalidDevice;*/
-
-    // Get max possible buffer size to check if it is not less than that we request
-    hr = IAudioClient_GetBufferSize(stream->in.clientParent, &maxBufferSize);
-    if (hr != S_OK)
-	{
-		LogHostError(hr);
-		LogPaError(result = paInvalidDevice);
-		goto error;
-	}
-
-    // Correct buffer to max size if it maxed out result of GetBufferSize
-	stream->in.bufferSize = maxBufferSize;
-
-	// Get interface latency (actually uneeded as we calculate latency from the size
-	// of maxBufferSize).
-    hr = IAudioClient_GetStreamLatency(stream->in.clientParent, &stream->in.deviceLatency);
-    if (hr != S_OK)
-	{
-		LogHostError(hr);
-		LogPaError(result = paInvalidDevice);
-		goto error;
-	}
-	//stream->in.latencySeconds = nano100ToSeconds(stream->in.deviceLatency);
-
-    // Number of frames that are required at each period
-	stream->in.framesPerHostCallback = maxBufferSize;
-
-	// Calculate frames per single buffer, if buffers > 1 then always framesPerBuffer
-	stream->in.framesPerBuffer =
-		(stream->in.userBufferAndHostMatch ? stream->in.framesPerHostCallback : framesPerBuffer);
-
-	// Calculate buffer latency
-	buffer_latency = (PaTime)maxBufferSize / stream->in.wavex.Format.nSamplesPerSec;
-
-	// Append buffer latency to interface latency in shared mode (see GetStreamLatency notes)
-	stream->in.latencySeconds = buffer_latency;
-
-	PRINT(("WASAPI::OpenStream(input): framesPerUser[ %d ] framesPerHost[ %d ] latency[ %.02fms ] exclusive[ %s ] wow64_fix[ %s ] mode[ %s ]\n", (UINT32)framesPerBuffer, (UINT32)stream->in.framesPerHostCallback, (float)(stream->in.latencySeconds*1000.0f), (stream->in.shareMode == AUDCLNT_SHAREMODE_EXCLUSIVE ? "YES" : "NO"), (stream->in.params.wow64_workaround ? "YES" : "NO"), (stream->in.streamFlags & AUDCLNT_STREAMFLAGS_EVENTCALLBACK ? "EVENT" : "POLL")));
-
-	return paNoError;
-
-error:
-
-	return result;
-}
-
-// ------------------------------------------------------------------------------------------
-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;
-	HRESULT hr;
-    PaWasapiHostApiRepresentation *paWasapi = (PaWasapiHostApiRepresentation*)hostApi;
-    PaWasapiStream *stream = NULL;
-    int inputChannelCount, outputChannelCount;
-    PaSampleFormat inputSampleFormat, outputSampleFormat;
-    PaSampleFormat hostInputSampleFormat, hostOutputSampleFormat;
-	PaWasapiStreamInfo *inputStreamInfo = NULL, *outputStreamInfo = NULL;
-	PaWasapiDeviceInfo *info = NULL;
-	ULONG framesPerHostCallback;
-	PaUtilHostBufferSizeMode bufferMode;
-	const BOOL fullDuplex = ((inputParameters != NULL) && (outputParameters != NULL));
-
-	// validate PaStreamParameters
-	if ((result = IsStreamParamsValid(hostApi, inputParameters, outputParameters, sampleRate)) != paNoError)
-		return LogPaError(result);
-
-    // Validate platform specific flags
-    if ((streamFlags & paPlatformSpecificFlags) != 0)
-	{
-		LogPaError(result = paInvalidFlag); /* unexpected platform specific flag */
-		goto error;
-	}
-
-	// Allocate memory for PaWasapiStream
-    if ((stream = (PaWasapiStream *)PaUtil_AllocateMemory(sizeof(PaWasapiStream))) == NULL)
-	{
-        LogPaError(result = paInsufficientMemory);
-        goto error;
-    }
-
-	// Default thread priority is Audio: for exclusive mode we will use Pro Audio.
-	stream->nThreadPriority = eThreadPriorityAudio;
-
-	// Set default number of frames: paFramesPerBufferUnspecified
-	if (framesPerBuffer == paFramesPerBufferUnspecified)
-	{
-		UINT32 framesPerBufferIn  = 0, framesPerBufferOut = 0;
-		if (inputParameters != NULL)
-		{
-			info = &paWasapi->devInfo[inputParameters->device];
-			framesPerBufferIn = MakeFramesFromHns(info->DefaultDevicePeriod, (UINT32)sampleRate);
-		}
-		if (outputParameters != NULL)
-		{
-			info = &paWasapi->devInfo[outputParameters->device];
-			framesPerBufferOut = MakeFramesFromHns(info->DefaultDevicePeriod, (UINT32)sampleRate);
-		}
-		// choosing maximum default size
-		framesPerBuffer = max(framesPerBufferIn, framesPerBufferOut);
-	}
-	if (framesPerBuffer == 0)
-		framesPerBuffer = ((UINT32)sampleRate / 100) * 2;
-
-	// Try create device: Input
-	if (inputParameters != NULL)
-    {
-        inputChannelCount = inputParameters->channelCount;
-        inputSampleFormat = inputParameters->sampleFormat;
-		inputStreamInfo   = (PaWasapiStreamInfo *)inputParameters->hostApiSpecificStreamInfo;
-        info              = &paWasapi->devInfo[inputParameters->device];
-		stream->in.flags  = (inputStreamInfo ? inputStreamInfo->flags : 0);
-
-		// Select Exclusive/Shared mode
-		stream->in.shareMode = AUDCLNT_SHAREMODE_SHARED;
-        if ((inputStreamInfo != NULL) && (inputStreamInfo->flags & paWinWasapiExclusive))
-		{
-			// Boost thread priority
-			stream->nThreadPriority = eThreadPriorityProAudio;
-			// Make Exclusive
-			stream->in.shareMode = AUDCLNT_SHAREMODE_EXCLUSIVE;
-		}
-
-		// If user provided explicit thread priority level, use it
-        if ((inputStreamInfo != NULL) && (inputStreamInfo->flags & paWinWasapiThreadPriority))
-		{
-			if ((inputStreamInfo->threadPriority > eThreadPriorityNone) &&
-				(inputStreamInfo->threadPriority <= eThreadPriorityWindowManager))
-				stream->nThreadPriority = inputStreamInfo->threadPriority;
-		}
-
-		// Choose processing mode
-		stream->in.streamFlags = (stream->in.shareMode == AUDCLNT_SHAREMODE_EXCLUSIVE ? AUDCLNT_STREAMFLAGS_EVENTCALLBACK : 0);
-		if (paWasapi->useWOW64Workaround)
-			stream->in.streamFlags = 0; // polling interface
-		else
-		if (streamCallback == NULL)
-			stream->in.streamFlags = 0; // polling interface
-		else
-		if ((inputStreamInfo != NULL) && (inputStreamInfo->flags & paWinWasapiPolling))
-			stream->in.streamFlags = 0; // polling interface
-		else
-		if (fullDuplex)
-			stream->in.streamFlags = 0; // polling interface is implemented for full-duplex mode also
-
-		// Fill parameters for Audio Client creation
-		stream->in.params.device_info       = info;
-		stream->in.params.stream_params     = (*inputParameters);
-		if (inputStreamInfo != NULL)
-		{
-			stream->in.params.wasapi_params = (*inputStreamInfo);
-			stream->in.params.stream_params.hostApiSpecificStreamInfo = &stream->in.params.wasapi_params;
-		}
-		stream->in.params.frames_per_buffer = framesPerBuffer;
-		stream->in.params.sample_rate       = sampleRate;
-		stream->in.params.blocking          = (streamCallback == NULL);
-		stream->in.params.full_duplex       = fullDuplex;
-		stream->in.params.wow64_workaround  = paWasapi->useWOW64Workaround;
-
-		// Create and activate audio client
-		hr = ActivateAudioClientInput(stream);
-        if (hr != S_OK)
-		{
-			LogPaError(result = paInvalidDevice);
-			goto error;
-        }
-
-		// Get closest format
-        hostInputSampleFormat = PaUtil_SelectClosestAvailableFormat( WaveToPaFormat(&stream->in.wavex), inputSampleFormat );
-
-        // Set user-side custom host processor
-        if ((inputStreamInfo != NULL) &&
-            (inputStreamInfo->flags & paWinWasapiRedirectHostProcessor))
-        {
-            stream->hostProcessOverrideInput.processor = inputStreamInfo->hostProcessorInput;
-            stream->hostProcessOverrideInput.userData = userData;
-        }
-
-		// Only get IAudioCaptureClient input once here instead of getting it at multiple places based on the use
-		hr = IAudioClient_GetService(stream->in.clientParent, &pa_IID_IAudioCaptureClient, (void **)&stream->captureClientParent);
-		if (hr != S_OK)
-		{
-			LogHostError(hr);
-			LogPaError(result = paUnanticipatedHostError);
-			goto error;
-		}
-
-		// Create ring buffer for blocking mode (It is needed because we fetch Input packets, not frames,
-		// and thus we have to save partial packet if such remains unread)
-		if (stream->in.params.blocking == TRUE)
-		{
-			UINT32 bufferFrames = ALIGN_NEXT_POW2((stream->in.framesPerHostCallback / WASAPI_PACKETS_PER_INPUT_BUFFER) * 2);
-			UINT32 frameSize    = stream->in.wavex.Format.nBlockAlign;
-
-			// buffer
-			if ((stream->in.tailBuffer = PaUtil_AllocateMemory(sizeof(PaUtilRingBuffer))) == NULL)
-			{
-				LogPaError(result = paInsufficientMemory);
-				goto error;
-			}
-			memset(stream->in.tailBuffer, 0, sizeof(PaUtilRingBuffer));
-
-			// buffer memory region
-			stream->in.tailBufferMemory = PaUtil_AllocateMemory(frameSize * bufferFrames);
-			if (stream->in.tailBufferMemory == NULL)
-			{
-				LogPaError(result = paInsufficientMemory);
-				goto error;
-			}
-
-			// initialize
-			if (PaUtil_InitializeRingBuffer(stream->in.tailBuffer, frameSize, bufferFrames,	stream->in.tailBufferMemory) != 0)
-			{
-				LogPaError(result = paInternalError);
-				goto error;
-			}
-		}
-	}
-    else
-    {
-        inputChannelCount = 0;
-        inputSampleFormat = hostInputSampleFormat = paInt16; /* Surpress 'uninitialised var' warnings. */
-    }
-
-	// Try create device: Output
-    if (outputParameters != NULL)
-    {
-        outputChannelCount = outputParameters->channelCount;
-        outputSampleFormat = outputParameters->sampleFormat;
-		outputStreamInfo   = (PaWasapiStreamInfo *)outputParameters->hostApiSpecificStreamInfo;
-		info               = &paWasapi->devInfo[outputParameters->device];
-		stream->out.flags  = (outputStreamInfo ? outputStreamInfo->flags : 0);
-
-		// Select Exclusive/Shared mode
-		stream->out.shareMode = AUDCLNT_SHAREMODE_SHARED;
-        if ((outputStreamInfo != NULL) && (outputStreamInfo->flags & paWinWasapiExclusive))
-		{
-			// Boost thread priority
-			stream->nThreadPriority = eThreadPriorityProAudio;
-			// Make Exclusive
-			stream->out.shareMode = AUDCLNT_SHAREMODE_EXCLUSIVE;
-		}
-
-		// If user provided explicit thread priority level, use it
-        if ((outputStreamInfo != NULL) && (outputStreamInfo->flags & paWinWasapiThreadPriority))
-		{
-			if ((outputStreamInfo->threadPriority > eThreadPriorityNone) &&
-				(outputStreamInfo->threadPriority <= eThreadPriorityWindowManager))
-				stream->nThreadPriority = outputStreamInfo->threadPriority;
-		}
-
-		// Choose processing mode
-		stream->out.streamFlags = (stream->out.shareMode == AUDCLNT_SHAREMODE_EXCLUSIVE ? AUDCLNT_STREAMFLAGS_EVENTCALLBACK : 0);
-		if (paWasapi->useWOW64Workaround)
-			stream->out.streamFlags = 0; // polling interface
-		else
-		if (streamCallback == NULL)
-			stream->out.streamFlags = 0; // polling interface
-		else
-		if ((outputStreamInfo != NULL) && (outputStreamInfo->flags & paWinWasapiPolling))
-			stream->out.streamFlags = 0; // polling interface
-		else
-		if (fullDuplex)
-			stream->out.streamFlags = 0; // polling interface is implemented for full-duplex mode also
-
-		// Fill parameters for Audio Client creation
-		stream->out.params.device_info       = info;
-		stream->out.params.stream_params     = (*outputParameters);
-		if (inputStreamInfo != NULL)
-		{
-			stream->out.params.wasapi_params = (*outputStreamInfo);
-			stream->out.params.stream_params.hostApiSpecificStreamInfo = &stream->out.params.wasapi_params;
-		}
-		stream->out.params.frames_per_buffer = framesPerBuffer;
-		stream->out.params.sample_rate       = sampleRate;
-		stream->out.params.blocking          = (streamCallback == NULL);
-		stream->out.params.full_duplex       = fullDuplex;
-		stream->out.params.wow64_workaround  = paWasapi->useWOW64Workaround;
-
-		// Create and activate audio client
-		hr = ActivateAudioClientOutput(stream);
-        if (hr != S_OK)
-		{
-			LogPaError(result = paInvalidDevice);
-			goto error;
-        }
-
-		// Get closest format
-        hostOutputSampleFormat = PaUtil_SelectClosestAvailableFormat( WaveToPaFormat(&stream->out.wavex), outputSampleFormat );
-
-        // Set user-side custom host processor
-        if ((outputStreamInfo != NULL) &&
-            (outputStreamInfo->flags & paWinWasapiRedirectHostProcessor))
-        {
-            stream->hostProcessOverrideOutput.processor = outputStreamInfo->hostProcessorOutput;
-            stream->hostProcessOverrideOutput.userData = userData;
-        }
-
-		// Only get IAudioCaptureClient output once here instead of getting it at multiple places based on the use
-		hr = IAudioClient_GetService(stream->out.clientParent, &pa_IID_IAudioRenderClient, (void **)&stream->renderClientParent);
-		if (hr != S_OK)
-		{
-			LogHostError(hr);
-			LogPaError(result = paUnanticipatedHostError);
-			goto error;
-		}
-	}
-    else
-    {
-        outputChannelCount = 0;
-        outputSampleFormat = hostOutputSampleFormat = paInt16; /* Surpress 'uninitialized var' warnings. */
-    }
-
-	// log full-duplex
-	if (fullDuplex)
-		PRINT(("WASAPI::OpenStream: full-duplex mode\n"));
-
-	// paWinWasapiPolling must be on/or not on both streams
-	if ((inputParameters != NULL) && (outputParameters != NULL))
-	{
-		if ((inputStreamInfo != NULL) && (outputStreamInfo != NULL))
-		{
-			if (((inputStreamInfo->flags & paWinWasapiPolling) &&
-				!(outputStreamInfo->flags & paWinWasapiPolling))
-				||
-				(!(inputStreamInfo->flags & paWinWasapiPolling) &&
-				 (outputStreamInfo->flags & paWinWasapiPolling)))
-			{
-				LogPaError(result = paInvalidFlag);
-				goto error;
-			}
-		}
-	}
-
-	// Initialize stream representation
-    if (streamCallback)
-    {
-		stream->bBlocking = FALSE;
-        PaUtil_InitializeStreamRepresentation(&stream->streamRepresentation,
-                                              &paWasapi->callbackStreamInterface,
-											  streamCallback, userData);
-    }
-    else
-    {
-		stream->bBlocking = TRUE;
-        PaUtil_InitializeStreamRepresentation(&stream->streamRepresentation,
-                                              &paWasapi->blockingStreamInterface,
-											  streamCallback, userData);
-    }
-
-	// Initialize CPU measurer
-    PaUtil_InitializeCpuLoadMeasurer(&stream->cpuLoadMeasurer, sampleRate);
-
-	if (outputParameters && inputParameters)
-	{
-		// serious problem #1 - No, Not a problem, especially concerning Exclusive mode.
-		// Input device in exclusive mode somehow is getting large buffer always, thus we
-		// adjust Output latency to reflect it, thus period will differ but playback will be
-		// normal.
-		/*if (stream->in.period != stream->out.period)
-		{
-			PRINT(("WASAPI: OpenStream: period discrepancy\n"));
-			LogPaError(result = paBadIODeviceCombination);
-			goto error;
-		}*/
-
-		// serious problem #2 - No, Not a problem, as framesPerHostCallback take into account
-		// sample size while it is not a problem for PA full-duplex, we must care of
-		// preriod only!
-		/*if (stream->out.framesPerHostCallback != stream->in.framesPerHostCallback)
-		{
-			PRINT(("WASAPI: OpenStream: framesPerHostCallback discrepancy\n"));
-			goto error;
-		}*/
-	}
-
-	// Calculate frames per host for processor
-	framesPerHostCallback = (outputParameters ? stream->out.framesPerBuffer : stream->in.framesPerBuffer);
-
-	// Choose correct mode of buffer processing:
-	// Exclusive/Shared non paWinWasapiPolling mode: paUtilFixedHostBufferSize - always fixed
-	// Exclusive/Shared paWinWasapiPolling mode: paUtilBoundedHostBufferSize - may vary for Exclusive or Full-duplex
-	bufferMode = paUtilFixedHostBufferSize;
-	if (inputParameters) // !!! WASAPI IAudioCaptureClient::GetBuffer extracts not number of frames but 1 packet, thus we always must adapt
-		bufferMode = paUtilBoundedHostBufferSize;
-	else
-	if (outputParameters)
-	{
-		if ((stream->out.buffers == 1) &&
-			(!stream->out.streamFlags || ((stream->out.streamFlags & AUDCLNT_STREAMFLAGS_EVENTCALLBACK) == 0)))
-			bufferMode = paUtilBoundedHostBufferSize;
-	}
-	stream->bufferMode = bufferMode;
-
-    // Initialize buffer processor
-    result =  PaUtil_InitializeBufferProcessor(
-		&stream->bufferProcessor,
-        inputChannelCount,
-		inputSampleFormat,
-		hostInputSampleFormat,
-        outputChannelCount,
-		outputSampleFormat,
-		hostOutputSampleFormat,
-        sampleRate,
-		streamFlags,
-		framesPerBuffer,
-        framesPerHostCallback,
-		bufferMode,
-        streamCallback,
-		userData);
-    if (result != paNoError)
-	{
-		LogPaError(result);
-        goto error;
-	}
-
-	// Set Input latency
-    stream->streamRepresentation.streamInfo.inputLatency =
-            ((double)PaUtil_GetBufferProcessorInputLatencyFrames(&stream->bufferProcessor) / sampleRate)
-			+ ((inputParameters)?stream->in.latencySeconds : 0);
-
-	// Set Output latency
-    stream->streamRepresentation.streamInfo.outputLatency =
-            ((double)PaUtil_GetBufferProcessorOutputLatencyFrames(&stream->bufferProcessor) / sampleRate)
-			+ ((outputParameters)?stream->out.latencySeconds : 0);
-
-	// Set SR
-    stream->streamRepresentation.streamInfo.sampleRate = sampleRate;
-
-    (*s) = (PaStream *)stream;
-    return result;
-
-error:
-
-    if (stream != NULL)
-		CloseStream(stream);
-
-    return result;
-}
-
-// ------------------------------------------------------------------------------------------
-static PaError CloseStream( PaStream* s )
-{
-    PaError result = paNoError;
-    PaWasapiStream *stream = (PaWasapiStream*)s;
-
-	// abort active stream
-	if (IsStreamActive(s))
-	{
-		result = AbortStream(s);
-	}
-
-    SAFE_RELEASE(stream->captureClientParent);
-    SAFE_RELEASE(stream->renderClientParent);
-    SAFE_RELEASE(stream->out.clientParent);
-    SAFE_RELEASE(stream->in.clientParent);
-	SAFE_RELEASE(stream->inVol);
-	SAFE_RELEASE(stream->outVol);
-
-	CloseHandle(stream->event[S_INPUT]);
-	CloseHandle(stream->event[S_OUTPUT]);
-
-	_StreamCleanup(stream);
-
-	PaWasapi_FreeMemory(stream->in.monoBuffer);
-	PaWasapi_FreeMemory(stream->out.monoBuffer);
-
-	PaUtil_FreeMemory(stream->in.tailBuffer);
-	PaUtil_FreeMemory(stream->in.tailBufferMemory);
-
-	PaUtil_FreeMemory(stream->out.tailBuffer);
-	PaUtil_FreeMemory(stream->out.tailBufferMemory);
-
-    PaUtil_TerminateBufferProcessor(&stream->bufferProcessor);
-    PaUtil_TerminateStreamRepresentation(&stream->streamRepresentation);
-    PaUtil_FreeMemory(stream);
-
-    return result;
-}
-
-// ------------------------------------------------------------------------------------------
-HRESULT UnmarshalSubStreamComPointers(PaWasapiSubStream *substream) 
-{
-	HRESULT hResult = S_OK;
-	HRESULT hFirstBadResult = S_OK;
-	substream->clientProc = NULL;
-
-	// IAudioClient
-	hResult = CoGetInterfaceAndReleaseStream(substream->clientStream, &pa_IID_IAudioClient, (LPVOID*)&substream->clientProc);
-	substream->clientStream = NULL;
-	if (hResult != S_OK) 
-	{
-		hFirstBadResult = (hFirstBadResult == S_OK) ? hResult : hFirstBadResult;
-	}
-
-	return hFirstBadResult;
-}
-
-// ------------------------------------------------------------------------------------------
-HRESULT UnmarshalStreamComPointers(PaWasapiStream *stream) 
-{
-	HRESULT hResult = S_OK;
-	HRESULT hFirstBadResult = S_OK;
-	stream->captureClient = NULL;
-	stream->renderClient = NULL;
-	stream->in.clientProc = NULL;
-	stream->out.clientProc = NULL;
-
-	if (NULL != stream->in.clientParent) 
-	{
-		// SubStream pointers
-		hResult = UnmarshalSubStreamComPointers(&stream->in);
-		if (hResult != S_OK) 
-		{
-			hFirstBadResult = (hFirstBadResult == S_OK) ? hResult : hFirstBadResult;
-		}
-
-		// IAudioCaptureClient
-		hResult = CoGetInterfaceAndReleaseStream(stream->captureClientStream, &pa_IID_IAudioCaptureClient, (LPVOID*)&stream->captureClient);
-		stream->captureClientStream = NULL;
-		if (hResult != S_OK) 
-		{
-			hFirstBadResult = (hFirstBadResult == S_OK) ? hResult : hFirstBadResult;
-		}
-	}
-
-	if (NULL != stream->out.clientParent) 
-	{
-		// SubStream pointers
-		hResult = UnmarshalSubStreamComPointers(&stream->out);
-		if (hResult != S_OK) 
-		{
-			hFirstBadResult = (hFirstBadResult == S_OK) ? hResult : hFirstBadResult;
-		}
-
-		// IAudioRenderClient
-		hResult = CoGetInterfaceAndReleaseStream(stream->renderClientStream, &pa_IID_IAudioRenderClient, (LPVOID*)&stream->renderClient);
-		stream->renderClientStream = NULL;
-		if (hResult != S_OK) 
-		{
-			hFirstBadResult = (hFirstBadResult == S_OK) ? hResult : hFirstBadResult;
-		}
-	}
-
-	return hFirstBadResult;
-}
-
-// -----------------------------------------------------------------------------------------
-void ReleaseUnmarshaledSubComPointers(PaWasapiSubStream *substream) 
-{
-	SAFE_RELEASE(substream->clientProc);
-}
-
-// -----------------------------------------------------------------------------------------
-void ReleaseUnmarshaledComPointers(PaWasapiStream *stream) 
-{
-	// Release AudioClient services first
-	SAFE_RELEASE(stream->captureClient);
-	SAFE_RELEASE(stream->renderClient);
-
-	// Release AudioClients
-	ReleaseUnmarshaledSubComPointers(&stream->in);
-	ReleaseUnmarshaledSubComPointers(&stream->out);
-}
-
-// ------------------------------------------------------------------------------------------
-HRESULT MarshalSubStreamComPointers(PaWasapiSubStream *substream) 
-{
-	HRESULT hResult;
-	substream->clientStream = NULL;
-
-	// IAudioClient
-	hResult = CoMarshalInterThreadInterfaceInStream(&pa_IID_IAudioClient, (LPUNKNOWN)substream->clientParent, &substream->clientStream);
-	if (hResult != S_OK)
-		goto marshal_sub_error;
-
-	return hResult;
-
-	// If marshaling error occurred, make sure to release everything.
-marshal_sub_error:
-
-	UnmarshalSubStreamComPointers(substream);
-	ReleaseUnmarshaledSubComPointers(substream);
-	return hResult;
-}
-
-// ------------------------------------------------------------------------------------------
-HRESULT MarshalStreamComPointers(PaWasapiStream *stream) 
-{
-	HRESULT hResult = S_OK;
-	stream->captureClientStream = NULL;
-	stream->in.clientStream = NULL;
-	stream->renderClientStream = NULL;
-	stream->out.clientStream = NULL;
-
-	if (NULL != stream->in.clientParent) 
-	{
-		// SubStream pointers
-		hResult = MarshalSubStreamComPointers(&stream->in);
-		if (hResult != S_OK) 
-			goto marshal_error;
-
-		// IAudioCaptureClient
-		hResult = CoMarshalInterThreadInterfaceInStream(&pa_IID_IAudioCaptureClient, (LPUNKNOWN)stream->captureClientParent, &stream->captureClientStream);
-		if (hResult != S_OK) 
-			goto marshal_error;
-	}
-
-	if (NULL != stream->out.clientParent) 
-	{
-		// SubStream pointers
-		hResult = MarshalSubStreamComPointers(&stream->out);
-		if (hResult != S_OK) 
-			goto marshal_error;
-
-		// IAudioRenderClient
-		hResult = CoMarshalInterThreadInterfaceInStream(&pa_IID_IAudioRenderClient, (LPUNKNOWN)stream->renderClientParent, &stream->renderClientStream);
-		if (hResult != S_OK) 
-			goto marshal_error;
-	}
-
-	return hResult;
-
-	// If marshaling error occurred, make sure to release everything.
-marshal_error:
-
-	UnmarshalStreamComPointers(stream);
-	ReleaseUnmarshaledComPointers(stream);
-	return hResult;
-}
-
-// ------------------------------------------------------------------------------------------
-static PaError StartStream( PaStream *s )
-{
-	HRESULT hr;
-    PaWasapiStream *stream = (PaWasapiStream*)s;
-	PaError result = paNoError;
-
-	// check if stream is active already
-	if (IsStreamActive(s))
-		return paStreamIsNotStopped;
-
-    PaUtil_ResetBufferProcessor(&stream->bufferProcessor);
-
-	// Cleanup handles (may be necessary if stream was stopped by itself due to error)
-	_StreamCleanup(stream);
-
-	// Create close event
-	if ((stream->hCloseRequest = CreateEvent(NULL, TRUE, FALSE, NULL)) == NULL) 
-	{
-		result = paInsufficientMemory;
-		goto start_error;
-	}
-
-	// Create thread
-	if (!stream->bBlocking)
-	{
-		// Create thread events
-		stream->hThreadStart = CreateEvent(NULL, TRUE, FALSE, NULL);
-		stream->hThreadExit  = CreateEvent(NULL, TRUE, FALSE, NULL);
-		if ((stream->hThreadStart == NULL) || (stream->hThreadExit == NULL))
-		{
-			result = paInsufficientMemory;
-			goto start_error;
-		}
-
-		// Marshal WASAPI interface pointers for safe use in thread created below.
-		if ((hr = MarshalStreamComPointers(stream)) != S_OK) 
-		{
-			PRINT(("Failed marshaling stream COM pointers."));
-			result = paUnanticipatedHostError;
-			goto nonblocking_start_error;
-		}
-
-		if ((stream->in.clientParent  && (stream->in.streamFlags  & AUDCLNT_STREAMFLAGS_EVENTCALLBACK)) ||
-			(stream->out.clientParent && (stream->out.streamFlags & AUDCLNT_STREAMFLAGS_EVENTCALLBACK)))
-		{
-			if ((stream->hThread = CREATE_THREAD(ProcThreadEvent)) == NULL) 
-			{
-				PRINT(("Failed creating thread: ProcThreadEvent."));
-				result = paUnanticipatedHostError;
-				goto nonblocking_start_error;
-			}
-		}
-		else
-		{
-			if ((stream->hThread = CREATE_THREAD(ProcThreadPoll)) == NULL) 
-			{
-				PRINT(("Failed creating thread: ProcThreadPoll."));
-				result = paUnanticipatedHostError;
-				goto nonblocking_start_error;
-			}
-		}
-
-		// Wait for thread to start
-		if (WaitForSingleObject(stream->hThreadStart, 60*1000) == WAIT_TIMEOUT) 
-		{
-			PRINT(("Failed starting thread: timeout."));
-			result = paUnanticipatedHostError;
-			goto nonblocking_start_error;
-		}
-	}
-	else
-	{
-		// Create blocking operation events (non-signaled event means - blocking operation is pending)
-		if (stream->out.clientParent != NULL) 
-		{
-			if ((stream->hBlockingOpStreamWR = CreateEvent(NULL, TRUE, TRUE, NULL)) == NULL) 
-			{
-				result = paInsufficientMemory;
-				goto start_error;
-			}
-		}
-		if (stream->in.clientParent != NULL) 
-		{
-			if ((stream->hBlockingOpStreamRD = CreateEvent(NULL, TRUE, TRUE, NULL)) == NULL) 
-			{
-				result = paInsufficientMemory;
-				goto start_error;
-			}
-		}
-
-		// Initialize event & start INPUT stream
-		if (stream->in.clientParent != NULL)
-		{
-			if ((hr = IAudioClient_Start(stream->in.clientParent)) != S_OK)
-			{
-				LogHostError(hr);
-				result = paUnanticipatedHostError;
-				goto start_error;
-			}
-		}
-
-		// Initialize event & start OUTPUT stream
-		if (stream->out.clientParent != NULL)
-		{
-			// Start
-			if ((hr = IAudioClient_Start(stream->out.clientParent)) != S_OK)
-			{
-				LogHostError(hr);
-				result = paUnanticipatedHostError;
-				goto start_error;
-			}
-		}
-
-		// Set parent to working pointers to use shared functions.
-		stream->captureClient  = stream->captureClientParent;
-		stream->renderClient   = stream->renderClientParent;
-		stream->in.clientProc  = stream->in.clientParent;
-		stream->out.clientProc = stream->out.clientParent;
-
-		// Signal: stream running.
-		stream->running = TRUE;
-	}
-
-    return result;
-
-nonblocking_start_error:
-
-	// Set hThreadExit event to prevent blocking during cleanup
-	SetEvent(stream->hThreadExit);
-	UnmarshalStreamComPointers(stream);
-	ReleaseUnmarshaledComPointers(stream);
-
-start_error:
-
-	StopStream(s);
-	return result;
-}
-
-// ------------------------------------------------------------------------------------------
-void _StreamFinish(PaWasapiStream *stream)
-{
-	// Issue command to thread to stop processing and wait for thread exit
-	if (!stream->bBlocking)
-	{
-		SignalObjectAndWait(stream->hCloseRequest, stream->hThreadExit, INFINITE, FALSE);
-	}
-	else
-	// Blocking mode does not own thread
-	{
-		// Signal close event and wait for each of 2 blocking operations to complete
-		if (stream->out.clientParent)
-			SignalObjectAndWait(stream->hCloseRequest, stream->hBlockingOpStreamWR, INFINITE, TRUE);
-		if (stream->out.clientParent)
-			SignalObjectAndWait(stream->hCloseRequest, stream->hBlockingOpStreamRD, INFINITE, TRUE);
-
-		// Process stop
-		_StreamOnStop(stream);
-	}
-
-	// Cleanup handles
-	_StreamCleanup(stream);
-
-    stream->running = FALSE;
-}
-
-// ------------------------------------------------------------------------------------------
-void _StreamCleanup(PaWasapiStream *stream)
-{
-	// Close thread handles to allow restart
-	SAFE_CLOSE(stream->hThread);
-	SAFE_CLOSE(stream->hThreadStart);
-	SAFE_CLOSE(stream->hThreadExit);
-	SAFE_CLOSE(stream->hCloseRequest);
-	SAFE_CLOSE(stream->hBlockingOpStreamRD);
-	SAFE_CLOSE(stream->hBlockingOpStreamWR);
-}
-
-// ------------------------------------------------------------------------------------------
-static PaError StopStream( PaStream *s )
-{
-	// Finish stream
-	_StreamFinish((PaWasapiStream *)s);
-    return paNoError;
-}
-
-// ------------------------------------------------------------------------------------------
-static PaError AbortStream( PaStream *s )
-{
-	// Finish stream
-	_StreamFinish((PaWasapiStream *)s);
-    return paNoError;
-}
-
-// ------------------------------------------------------------------------------------------
-static PaError IsStreamStopped( PaStream *s )
-{
-	return !((PaWasapiStream *)s)->running;
-}
-
-// ------------------------------------------------------------------------------------------
-static PaError IsStreamActive( PaStream *s )
-{
-    return ((PaWasapiStream *)s)->running;
-}
-
-// ------------------------------------------------------------------------------------------
-static PaTime GetStreamTime( PaStream *s )
-{
-    PaWasapiStream *stream = (PaWasapiStream*)s;
-
-    /* suppress unused variable warnings */
-    (void) stream;
-
-    return PaUtil_GetTime();
-}
-
-// ------------------------------------------------------------------------------------------
-static double GetStreamCpuLoad( PaStream* s )
-{
-	return PaUtil_GetCpuLoad(&((PaWasapiStream *)s)->cpuLoadMeasurer);
-}
-
-// ------------------------------------------------------------------------------------------
-static PaError ReadStream( PaStream* s, void *_buffer, unsigned long frames )
-{
-    PaWasapiStream *stream = (PaWasapiStream*)s;
-
-	HRESULT hr = S_OK;
-	BYTE *user_buffer = (BYTE *)_buffer;
-	BYTE *wasapi_buffer = NULL;
-	DWORD flags = 0;
-	UINT32 i, available, sleep = 0;
-	unsigned long processed;
-	ThreadIdleScheduler sched;
-
-	// validate
-	if (!stream->running)
-		return paStreamIsStopped;
-	if (stream->captureClient == NULL)
-		return paBadStreamPtr;
-
-	// Notify blocking op has begun
-	ResetEvent(stream->hBlockingOpStreamRD);
-
-	// Use thread scheduling for 500 microseconds (emulated) when wait time for frames is less than
-	// 1 milliseconds, emulation helps to normalize CPU consumption and avoids too busy waiting
-	ThreadIdleScheduler_Setup(&sched, 1, 250/* microseconds */);
-
-    // Make a local copy of the user buffer pointer(s), this is necessary
-	// because PaUtil_CopyOutput() advances these pointers every time it is called
-    if (!stream->bufferProcessor.userInputIsInterleaved)
-    {
-		user_buffer = (BYTE *)alloca(sizeof(BYTE *) * stream->bufferProcessor.inputChannelCount);
-        if (user_buffer == NULL)
-            return paInsufficientMemory;
-
-        for (i = 0; i < stream->bufferProcessor.inputChannelCount; ++i)
-            ((BYTE **)user_buffer)[i] = ((BYTE **)_buffer)[i];
-    }
-
-	// Findout if there are tail frames, flush them all before reading hardware
-	if ((available = PaUtil_GetRingBufferReadAvailable(stream->in.tailBuffer)) != 0)
-	{
-		ring_buffer_size_t buf1_size = 0, buf2_size = 0, read, desired;
-		void *buf1 = NULL, *buf2 = NULL;
-
-		// Limit desired to amount of requested frames
-		desired = available;
-		if ((UINT32)desired > frames)
-			desired = frames;
-		
-		// Get pointers to read regions
-		read = PaUtil_GetRingBufferReadRegions(stream->in.tailBuffer, desired, &buf1, &buf1_size, &buf2, &buf2_size);
-
-		if (buf1 != NULL)
-		{
-			// Register available frames to processor
-			PaUtil_SetInputFrameCount(&stream->bufferProcessor, buf1_size);
-
-			// Register host buffer pointer to processor
-			PaUtil_SetInterleavedInputChannels(&stream->bufferProcessor, 0, buf1, stream->bufferProcessor.inputChannelCount);
-
-			// Copy user data to host buffer (with conversion if applicable)
-			processed = PaUtil_CopyInput(&stream->bufferProcessor, (void **)&user_buffer, buf1_size);
-			frames -= processed;
-		}
-
-		if (buf2 != NULL)
-		{
-			// Register available frames to processor
-			PaUtil_SetInputFrameCount(&stream->bufferProcessor, buf2_size);
-
-			// Register host buffer pointer to processor
-			PaUtil_SetInterleavedInputChannels(&stream->bufferProcessor, 0, buf2, stream->bufferProcessor.inputChannelCount);
-
-			// Copy user data to host buffer (with conversion if applicable)
-			processed = PaUtil_CopyInput(&stream->bufferProcessor, (void **)&user_buffer, buf2_size);
-			frames -= processed;
-		}
-
-		// Advance
-		PaUtil_AdvanceRingBufferReadIndex(stream->in.tailBuffer, read);
-	}
-
-	// Read hardware
-	while (frames != 0)
-	{
-		// Check if blocking call must be interrupted
-		if (WaitForSingleObject(stream->hCloseRequest, sleep) != WAIT_TIMEOUT)
-			break;
-
-		// Get available frames (must be finding out available frames before call to IAudioCaptureClient_GetBuffer
-		// othervise audio glitches will occur inExclusive mode as it seems that WASAPI has some scheduling/
-		// processing problems when such busy polling with IAudioCaptureClient_GetBuffer occurs)
-		if ((hr = _PollGetInputFramesAvailable(stream, &available)) != S_OK)
-		{
-			LogHostError(hr);
-			return paUnanticipatedHostError;
-		}
-
-		// Wait for more frames to become available
-		if (available == 0)
-		{
-			// Exclusive mode may require latency of 1 millisecond, thus we shall sleep
-			// around 500 microseconds (emulated) to collect packets in time
-			if (stream->in.shareMode != AUDCLNT_SHAREMODE_EXCLUSIVE)
-			{
-				UINT32 sleep_frames = (frames < stream->in.framesPerHostCallback ? frames : stream->in.framesPerHostCallback);
-
-				sleep  = GetFramesSleepTime(sleep_frames, stream->in.wavex.Format.nSamplesPerSec);
-				sleep /= 4; // wait only for 1/4 of the buffer
-
-				// WASAPI input provides packets, thus expiring packet will result in bad audio
-				// limit waiting time to 2 seconds (will always work for smallest buffer in Shared)
-				if (sleep > 2)
-					sleep = 2;
-
-				// Avoid busy waiting, schedule next 1 millesecond wait
-				if (sleep == 0)
-					sleep = ThreadIdleScheduler_NextSleep(&sched);
-			}
-			else
-			{
-				if ((sleep = ThreadIdleScheduler_NextSleep(&sched)) != 0)
-				{
-					Sleep(sleep);
-					sleep = 0;
-				}
-			}
-
-			continue;
-		}
-
-		// Get the available data in the shared buffer.
-		if ((hr = IAudioCaptureClient_GetBuffer(stream->captureClient, &wasapi_buffer, &available, &flags, NULL, NULL)) != S_OK)
-		{
-			// Buffer size is too small, waiting
-			if (hr != AUDCLNT_S_BUFFER_EMPTY)
-			{
-				LogHostError(hr);
-				goto end;
-			}
-
-			continue;
-		}
-
-		// Register available frames to processor
-        PaUtil_SetInputFrameCount(&stream->bufferProcessor, available);
-
-		// Register host buffer pointer to processor
-        PaUtil_SetInterleavedInputChannels(&stream->bufferProcessor, 0, wasapi_buffer, stream->bufferProcessor.inputChannelCount);
-
-		// Copy user data to host buffer (with conversion if applicable)
-		processed = PaUtil_CopyInput(&stream->bufferProcessor, (void **)&user_buffer, frames);
-		frames -= processed;
-
-		// Save tail into buffer
-		if ((frames == 0) && (available > processed))
-		{
-			UINT32 bytes_processed = processed * stream->in.wavex.Format.nBlockAlign;
-			UINT32 frames_to_save  = available - processed;
-
-			PaUtil_WriteRingBuffer(stream->in.tailBuffer, wasapi_buffer + bytes_processed, frames_to_save);
-		}
-
-		// Release host buffer
-		if ((hr = IAudioCaptureClient_ReleaseBuffer(stream->captureClient, available)) != S_OK)
-		{
-			LogHostError(hr);
-			goto end;
-		}
-	}
-
-end:
-
-	// Notify blocking op has ended
-	SetEvent(stream->hBlockingOpStreamRD);
-
-	return (hr != S_OK ? paUnanticipatedHostError : paNoError);
-}
-
-// ------------------------------------------------------------------------------------------
-static PaError WriteStream( PaStream* s, const void *_buffer, unsigned long frames )
-{
-    PaWasapiStream *stream = (PaWasapiStream*)s;
-
-	//UINT32 frames;
-	const BYTE *user_buffer = (const BYTE *)_buffer;
-	BYTE *wasapi_buffer;
-	HRESULT hr = S_OK;
-	UINT32 i, available, sleep = 0;
-	unsigned long processed;
-	ThreadIdleScheduler sched;
-
-	// validate
-	if (!stream->running)
-		return paStreamIsStopped;
-	if (stream->renderClient == NULL)
-		return paBadStreamPtr;
-
-	// Notify blocking op has begun
-	ResetEvent(stream->hBlockingOpStreamWR);
-
-	// Use thread scheduling for 500 microseconds (emulated) when wait time for frames is less than
-	// 1 milliseconds, emulation helps to normalize CPU consumption and avoids too busy waiting
-	ThreadIdleScheduler_Setup(&sched, 1, 500/* microseconds */);
-
-    // Make a local copy of the user buffer pointer(s), this is necessary
-	// because PaUtil_CopyOutput() advances these pointers every time it is called
-    if (!stream->bufferProcessor.userOutputIsInterleaved)
-    {
-        user_buffer = (const BYTE *)alloca(sizeof(const BYTE *) * stream->bufferProcessor.outputChannelCount);
-        if (user_buffer == NULL)
-            return paInsufficientMemory;
-
-        for (i = 0; i < stream->bufferProcessor.outputChannelCount; ++i)
-            ((const BYTE **)user_buffer)[i] = ((const BYTE **)_buffer)[i];
-    }
-
-	// Blocking (potentially, untill 'frames' are consumed) loop
-	while (frames != 0)
-	{
-		// Check if blocking call must be interrupted
-		if (WaitForSingleObject(stream->hCloseRequest, sleep) != WAIT_TIMEOUT)
-			break;
-
-		// Get frames available
-		if ((hr = _PollGetOutputFramesAvailable(stream, &available)) != S_OK)
-		{
-			LogHostError(hr);
-			goto end;
-		}
-
-		// Wait for more frames to become available
-		if (available == 0)
-		{
-			UINT32 sleep_frames = (frames < stream->out.framesPerHostCallback ? frames : stream->out.framesPerHostCallback);
-
-			sleep  = GetFramesSleepTime(sleep_frames, stream->out.wavex.Format.nSamplesPerSec);
-			sleep /= 2; // wait only for half of the buffer
-
-			// Avoid busy waiting, schedule next 1 millesecond wait
-			if (sleep == 0)
-				sleep = ThreadIdleScheduler_NextSleep(&sched);
-
-			continue;
-		}
-
-		// Keep in 'frmaes' range
-		if (available > frames)
-			available = frames;
-
-		// Get pointer to host buffer
-		if ((hr = IAudioRenderClient_GetBuffer(stream->renderClient, available, &wasapi_buffer)) != S_OK)
-		{
-			// Buffer size is too big, waiting
-			if (hr == AUDCLNT_E_BUFFER_TOO_LARGE)
-				continue;
-
-			LogHostError(hr);
-			goto end;
-		}
-
-		// Keep waiting again (on Vista it was noticed that WASAPI could SOMETIMES return NULL pointer 
-		// to buffer without returning AUDCLNT_E_BUFFER_TOO_LARGE instead)
-		if (wasapi_buffer == NULL)
-			continue;
-
-		// Register available frames to processor
-        PaUtil_SetOutputFrameCount(&stream->bufferProcessor, available);
-
-		// Register host buffer pointer to processor
-        PaUtil_SetInterleavedOutputChannels(&stream->bufferProcessor, 0, wasapi_buffer,	stream->bufferProcessor.outputChannelCount);
-
-		// Copy user data to host buffer (with conversion if applicable), this call will advance
-		// pointer 'user_buffer' to consumed portion of data
-		processed = PaUtil_CopyOutput(&stream->bufferProcessor, (const void **)&user_buffer, frames);
-		frames -= processed;
-
-		// Release host buffer
-		if ((hr = IAudioRenderClient_ReleaseBuffer(stream->renderClient, available, 0)) != S_OK)
-		{
-			LogHostError(hr);
-			goto end;
-		}
-	}
-
-end:
-
-	// Notify blocking op has ended
-	SetEvent(stream->hBlockingOpStreamWR);
-
-	return (hr != S_OK ? paUnanticipatedHostError : paNoError);
-}
-
-unsigned long PaUtil_GetOutputFrameCount( PaUtilBufferProcessor* bp )
-{
-	return bp->hostOutputFrameCount[0];
-}
-
-// ------------------------------------------------------------------------------------------
-static signed long GetStreamReadAvailable( PaStream* s )
-{
-    PaWasapiStream *stream = (PaWasapiStream*)s;
-
-	HRESULT hr;
-	UINT32  available = 0;
-
-	// validate
-	if (!stream->running)
-		return paStreamIsStopped;
-	if (stream->captureClient == NULL)
-		return paBadStreamPtr;
-
-	// available in hardware buffer
-	if ((hr = _PollGetInputFramesAvailable(stream, &available)) != S_OK)
-	{
-		LogHostError(hr);
-		return paUnanticipatedHostError;
-	}
-
-	// available in software tail buffer
-	available += PaUtil_GetRingBufferReadAvailable(stream->in.tailBuffer);
-
-    return available;
-}
-
-// ------------------------------------------------------------------------------------------
-static signed long GetStreamWriteAvailable( PaStream* s )
-{
-    PaWasapiStream *stream = (PaWasapiStream*)s;
-	HRESULT hr;
-	UINT32  available = 0;
-
-	// validate
-	if (!stream->running)
-		return paStreamIsStopped;
-	if (stream->renderClient == NULL)
-		return paBadStreamPtr;
-
-	if ((hr = _PollGetOutputFramesAvailable(stream, &available)) != S_OK)
-	{
-		LogHostError(hr);
-		return paUnanticipatedHostError;
-	}
-
-	return (signed long)available;
-}
-
-
-// ------------------------------------------------------------------------------------------
-static void WaspiHostProcessingLoop( void *inputBuffer,  long inputFrames,
-                                     void *outputBuffer, long outputFrames,
-                                     void *userData )
-{
-    PaWasapiStream *stream = (PaWasapiStream*)userData;
-    PaStreamCallbackTimeInfo timeInfo = {0,0,0};
-	PaStreamCallbackFlags flags = 0;
-    int callbackResult;
-    unsigned long framesProcessed;
-	HRESULT hr;
-	UINT32 pending;
-
-    PaUtil_BeginCpuLoadMeasurement( &stream->cpuLoadMeasurer );
-
-    /*
-		Pa_GetStreamTime:
-            - generate timing information
-            - handle buffer slips
-    */
-	timeInfo.currentTime = PaUtil_GetTime();
-	// Query input latency
-	if (stream->in.clientProc != NULL)
-	{
-		PaTime pending_time;
-		if ((hr = IAudioClient_GetCurrentPadding(stream->in.clientProc, &pending)) == S_OK)
-			pending_time = (PaTime)pending / (PaTime)stream->in.wavex.Format.nSamplesPerSec;
-		else
-			pending_time = (PaTime)stream->in.latencySeconds;
-
-		timeInfo.inputBufferAdcTime = timeInfo.currentTime + pending_time;
-	}
-	// Query output current latency
-	if (stream->out.clientProc != NULL)
-	{
-		PaTime pending_time;
-		if ((hr = IAudioClient_GetCurrentPadding(stream->out.clientProc, &pending)) == S_OK)
-			pending_time = (PaTime)pending / (PaTime)stream->out.wavex.Format.nSamplesPerSec;
-		else
-			pending_time = (PaTime)stream->out.latencySeconds;
-
-		timeInfo.outputBufferDacTime = timeInfo.currentTime + pending_time;
-	}
-
-    /*
-        If you need to byte swap or shift inputBuffer to convert it into a
-        portaudio format, do it here.
-    */
-
-    PaUtil_BeginBufferProcessing( &stream->bufferProcessor, &timeInfo, flags );
-
-    /*
-        depending on whether the host buffers are interleaved, non-interleaved
-        or a mixture, you will want to call PaUtil_SetInterleaved*Channels(),
-        PaUtil_SetNonInterleaved*Channel() or PaUtil_Set*Channel() here.
-    */
-
-    if (stream->bufferProcessor.inputChannelCount > 0)
-    {
-        PaUtil_SetInputFrameCount( &stream->bufferProcessor, inputFrames );
-        PaUtil_SetInterleavedInputChannels( &stream->bufferProcessor,
-            0, /* first channel of inputBuffer is channel 0 */
-            inputBuffer,
-            0 ); /* 0 - use inputChannelCount passed to init buffer processor */
-    }
-
-    if (stream->bufferProcessor.outputChannelCount > 0)
-    {
-        PaUtil_SetOutputFrameCount( &stream->bufferProcessor, outputFrames);
-        PaUtil_SetInterleavedOutputChannels( &stream->bufferProcessor,
-            0, /* first channel of outputBuffer is channel 0 */
-            outputBuffer,
-            0 ); /* 0 - use outputChannelCount passed to init buffer processor */
-    }
-
-    /* you must pass a valid value of callback result to PaUtil_EndBufferProcessing()
-        in general you would pass paContinue for normal operation, and
-        paComplete to drain the buffer processor's internal output buffer.
-        You can check whether the buffer processor's output buffer is empty
-        using PaUtil_IsBufferProcessorOuputEmpty( bufferProcessor )
-    */
-    callbackResult = paContinue;
-    framesProcessed = PaUtil_EndBufferProcessing( &stream->bufferProcessor, &callbackResult );
-
-    /*
-        If you need to byte swap or shift outputBuffer to convert it to
-        host format, do it here.
-    */
-
-	PaUtil_EndCpuLoadMeasurement( &stream->cpuLoadMeasurer, framesProcessed );
-
-    if (callbackResult == paContinue)
-    {
-        /* nothing special to do */
-    }
-    else
-	if (callbackResult == paAbort)
-    {
-		// stop stream
-        SetEvent(stream->hCloseRequest);
-    }
-    else
-    {
-		// stop stream
-        SetEvent(stream->hCloseRequest);
-    }
-}
-
-// ------------------------------------------------------------------------------------------
-HANDLE MMCSS_activate(const char *name)
-{
-    DWORD task_idx = 0;
-    HANDLE hTask = pAvSetMmThreadCharacteristics(name, &task_idx);
-    if (hTask == NULL)
-	{
-        PRINT(("WASAPI: AvSetMmThreadCharacteristics failed!\n"));
-    }
-
-    /*BOOL priority_ok = pAvSetMmThreadPriority(hTask, AVRT_PRIORITY_NORMAL);
-    if (priority_ok == FALSE)
-	{
-        PRINT(("WASAPI: AvSetMmThreadPriority failed!\n"));
-    }*/
-
-	// debug
-    {
-        int    cur_priority		  = GetThreadPriority(GetCurrentThread());
-        DWORD  cur_priority_class = GetPriorityClass(GetCurrentProcess());
-		PRINT(("WASAPI: thread[ priority-0x%X class-0x%X ]\n", cur_priority, cur_priority_class));
-    }
-
-	return hTask;
-}
-
-// ------------------------------------------------------------------------------------------
-void MMCSS_deactivate(HANDLE hTask)
-{
-	if (!hTask)
-		return;
-
-	if (pAvRevertMmThreadCharacteristics(hTask) == FALSE)
-	{
-        PRINT(("WASAPI: AvRevertMmThreadCharacteristics failed!\n"));
-    }
-}
-
-// ------------------------------------------------------------------------------------------
-PaError PaWasapi_ThreadPriorityBoost(void **hTask, PaWasapiThreadPriority nPriorityClass)
-{
-	static const char *mmcs_name[] =
-	{
-		NULL,
-		"Audio",
-		"Capture",
-		"Distribution",
-		"Games",
-		"Playback",
-		"Pro Audio",
-		"Window Manager"
-	};
-	HANDLE task;
-
-	if (hTask == NULL)
-		return paUnanticipatedHostError;
-
-	if ((UINT32)nPriorityClass >= STATIC_ARRAY_SIZE(mmcs_name))
-		return paUnanticipatedHostError;
-
-	task = MMCSS_activate(mmcs_name[nPriorityClass]);
-	if (task == NULL)
-		return paUnanticipatedHostError;
-
-	(*hTask) = task;
-	return paNoError;
-}
-
-// ------------------------------------------------------------------------------------------
-PaError PaWasapi_ThreadPriorityRevert(void *hTask)
-{
-	if (hTask == NULL)
-		return paUnanticipatedHostError;
-
-	MMCSS_deactivate((HANDLE)hTask);
-
-	return paNoError;
-}
-
-// ------------------------------------------------------------------------------------------
-// Described at:
-// http://msdn.microsoft.com/en-us/library/dd371387(v=VS.85).aspx
-
-PaError PaWasapi_GetJackCount(PaDeviceIndex nDevice, int *jcount)
-{
-	PaError ret;
-	HRESULT hr = S_OK;
-	PaDeviceIndex index;
-    IDeviceTopology *pDeviceTopology = NULL;
-    IConnector *pConnFrom = NULL;
-    IConnector *pConnTo = NULL;
-    IPart *pPart = NULL;
-    IKsJackDescription *pJackDesc = NULL;
-	UINT jackCount = 0;
-
-	PaWasapiHostApiRepresentation *paWasapi = _GetHostApi(&ret);
-	if (paWasapi == NULL)
-		return paNotInitialized;
-
-	// Get device index.
-	ret = PaUtil_DeviceIndexToHostApiDeviceIndex(&index, nDevice, &paWasapi->inheritedHostApiRep);
-    if (ret != paNoError)
-        return ret;
-
-	// Validate index.
-	if ((UINT32)index >= paWasapi->deviceCount)
-		return paInvalidDevice;
-
-	// Get the endpoint device's IDeviceTopology interface.
-	hr = IMMDevice_Activate(paWasapi->devInfo[index].device, &pa_IID_IDeviceTopology,
-		CLSCTX_INPROC_SERVER, NULL, (void**)&pDeviceTopology);
-	IF_FAILED_JUMP(hr, error);
-
-    // The device topology for an endpoint device always contains just one connector (connector number 0).
-	hr = IDeviceTopology_GetConnector(pDeviceTopology, 0, &pConnFrom);
-	IF_FAILED_JUMP(hr, error);
-
-    // Step across the connection to the jack on the adapter.
-	hr = IConnector_GetConnectedTo(pConnFrom, &pConnTo);
-    if (HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND) == hr)
-    {
-        // The adapter device is not currently active.
-        hr = E_NOINTERFACE;
-    }
-	IF_FAILED_JUMP(hr, error);
-
-	// Get the connector's IPart interface.
-	hr = IConnector_QueryInterface(pConnTo, &pa_IID_IPart, (void**)&pPart);
-	IF_FAILED_JUMP(hr, error);
-
-	// Activate the connector's IKsJackDescription interface.
-	hr = IPart_Activate(pPart, CLSCTX_INPROC_SERVER, &pa_IID_IKsJackDescription, (void**)&pJackDesc);
-	IF_FAILED_JUMP(hr, error);
-
-	// Return jack count for this device.
-	hr = IKsJackDescription_GetJackCount(pJackDesc, &jackCount);
-	IF_FAILED_JUMP(hr, error);
-
-	// Set.
-	(*jcount) = jackCount;
-
-	// Ok.
-	ret = paNoError;
-
-error:
-
-	SAFE_RELEASE(pDeviceTopology);
-	SAFE_RELEASE(pConnFrom);
-	SAFE_RELEASE(pConnTo);
-	SAFE_RELEASE(pPart);
-	SAFE_RELEASE(pJackDesc);
-
-	LogHostError(hr);
-	return paNoError;
-}
-
-// ------------------------------------------------------------------------------------------
-static PaWasapiJackConnectionType ConvertJackConnectionTypeWASAPIToPA(int connType)
-{
-	switch (connType)
-	{
-		case eConnTypeUnknown:			return eJackConnTypeUnknown;
-#ifdef _KS_
-		case eConnType3Point5mm:		return eJackConnType3Point5mm;
-#else
-		case eConnTypeEighth:		    return eJackConnType3Point5mm;
-#endif
-		case eConnTypeQuarter:			return eJackConnTypeQuarter;
-		case eConnTypeAtapiInternal:	return eJackConnTypeAtapiInternal;
-		case eConnTypeRCA:				return eJackConnTypeRCA;
-		case eConnTypeOptical:			return eJackConnTypeOptical;
-		case eConnTypeOtherDigital:		return eJackConnTypeOtherDigital;
-		case eConnTypeOtherAnalog:		return eJackConnTypeOtherAnalog;
-		case eConnTypeMultichannelAnalogDIN: return eJackConnTypeMultichannelAnalogDIN;
-		case eConnTypeXlrProfessional:	return eJackConnTypeXlrProfessional;
-		case eConnTypeRJ11Modem:		return eJackConnTypeRJ11Modem;
-		case eConnTypeCombination:		return eJackConnTypeCombination;
-	}
-	return eJackConnTypeUnknown;
-}
-
-// ------------------------------------------------------------------------------------------
-static PaWasapiJackGeoLocation ConvertJackGeoLocationWASAPIToPA(int geoLoc)
-{
-	switch (geoLoc)
-	{
-	case eGeoLocRear:				return eJackGeoLocRear;
-	case eGeoLocFront:				return eJackGeoLocFront;
-	case eGeoLocLeft:				return eJackGeoLocLeft;
-	case eGeoLocRight:				return eJackGeoLocRight;
-	case eGeoLocTop:				return eJackGeoLocTop;
-	case eGeoLocBottom:				return eJackGeoLocBottom;
-#ifdef _KS_
-	case eGeoLocRearPanel:			return eJackGeoLocRearPanel;
-#else
-	case eGeoLocRearOPanel:         return eJackGeoLocRearPanel;
-#endif
-	case eGeoLocRiser:				return eJackGeoLocRiser;
-	case eGeoLocInsideMobileLid:	return eJackGeoLocInsideMobileLid;
-	case eGeoLocDrivebay:			return eJackGeoLocDrivebay;
-	case eGeoLocHDMI:				return eJackGeoLocHDMI;
-	case eGeoLocOutsideMobileLid:	return eJackGeoLocOutsideMobileLid;
-	case eGeoLocATAPI:				return eJackGeoLocATAPI;
-	}
-	return eJackGeoLocUnk;
-}
-
-// ------------------------------------------------------------------------------------------
-static PaWasapiJackGenLocation ConvertJackGenLocationWASAPIToPA(int genLoc)
-{
-	switch (genLoc)
-	{
-	case eGenLocPrimaryBox:	return eJackGenLocPrimaryBox;
-	case eGenLocInternal:	return eJackGenLocInternal;
-#ifdef _KS_
-	case eGenLocSeparate:	return eJackGenLocSeparate;
-#else
-	case eGenLocSeperate:	return eJackGenLocSeparate;
-#endif
-	case eGenLocOther:		return eJackGenLocOther;
-	}
-	return eJackGenLocPrimaryBox;
-}
-
-// ------------------------------------------------------------------------------------------
-static PaWasapiJackPortConnection ConvertJackPortConnectionWASAPIToPA(int portConn)
-{
-	switch (portConn)
-	{
-	case ePortConnJack:					return eJackPortConnJack;
-	case ePortConnIntegratedDevice:		return eJackPortConnIntegratedDevice;
-	case ePortConnBothIntegratedAndJack:return eJackPortConnBothIntegratedAndJack;
-	case ePortConnUnknown:				return eJackPortConnUnknown;
-	}
-	return eJackPortConnJack;
-}
-
-// ------------------------------------------------------------------------------------------
-// Described at:
-// http://msdn.microsoft.com/en-us/library/dd371387(v=VS.85).aspx
-
-PaError PaWasapi_GetJackDescription(PaDeviceIndex nDevice, int jindex, PaWasapiJackDescription *pJackDescription)
-{
-	PaError ret;
-	HRESULT hr = S_OK;
-	PaDeviceIndex index;
-    IDeviceTopology *pDeviceTopology = NULL;
-    IConnector *pConnFrom = NULL;
-    IConnector *pConnTo = NULL;
-    IPart *pPart = NULL;
-    IKsJackDescription *pJackDesc = NULL;
-	KSJACK_DESCRIPTION jack = { 0 };
-
-	PaWasapiHostApiRepresentation *paWasapi = _GetHostApi(&ret);
-	if (paWasapi == NULL)
-		return paNotInitialized;
-
-	// Get device index.
-	ret = PaUtil_DeviceIndexToHostApiDeviceIndex(&index, nDevice, &paWasapi->inheritedHostApiRep);
-    if (ret != paNoError)
-        return ret;
-
-	// Validate index.
-	if ((UINT32)index >= paWasapi->deviceCount)
-		return paInvalidDevice;
-
-	// Get the endpoint device's IDeviceTopology interface.
-	hr = IMMDevice_Activate(paWasapi->devInfo[index].device, &pa_IID_IDeviceTopology,
-		CLSCTX_INPROC_SERVER, NULL, (void**)&pDeviceTopology);
-	IF_FAILED_JUMP(hr, error);
-
-    // The device topology for an endpoint device always contains just one connector (connector number 0).
-	hr = IDeviceTopology_GetConnector(pDeviceTopology, 0, &pConnFrom);
-	IF_FAILED_JUMP(hr, error);
-
-    // Step across the connection to the jack on the adapter.
-	hr = IConnector_GetConnectedTo(pConnFrom, &pConnTo);
-    if (HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND) == hr)
-    {
-        // The adapter device is not currently active.
-        hr = E_NOINTERFACE;
-    }
-	IF_FAILED_JUMP(hr, error);
-
-	// Get the connector's IPart interface.
-	hr = IConnector_QueryInterface(pConnTo, &pa_IID_IPart, (void**)&pPart);
-	IF_FAILED_JUMP(hr, error);
-
-	// Activate the connector's IKsJackDescription interface.
-	hr = IPart_Activate(pPart, CLSCTX_INPROC_SERVER, &pa_IID_IKsJackDescription, (void**)&pJackDesc);
-	IF_FAILED_JUMP(hr, error);
-
-	// Test to return jack description struct for index 0.
-	hr = IKsJackDescription_GetJackDescription(pJackDesc, jindex, &jack);
-	IF_FAILED_JUMP(hr, error);
-
-	// Convert WASAPI values to PA format.
-	pJackDescription->channelMapping = jack.ChannelMapping;
-	pJackDescription->color          = jack.Color;
-	pJackDescription->connectionType = ConvertJackConnectionTypeWASAPIToPA(jack.ConnectionType);
-	pJackDescription->genLocation    = ConvertJackGenLocationWASAPIToPA(jack.GenLocation);
-	pJackDescription->geoLocation    = ConvertJackGeoLocationWASAPIToPA(jack.GeoLocation);
-	pJackDescription->isConnected    = jack.IsConnected;
-	pJackDescription->portConnection = ConvertJackPortConnectionWASAPIToPA(jack.PortConnection);
-
-	// Ok.
-	ret = paNoError;
-
-error:
-
-	SAFE_RELEASE(pDeviceTopology);
-	SAFE_RELEASE(pConnFrom);
-	SAFE_RELEASE(pConnTo);
-	SAFE_RELEASE(pPart);
-	SAFE_RELEASE(pJackDesc);
-
-	LogHostError(hr);
-	return ret;
-}
-
-// ------------------------------------------------------------------------------------------
-HRESULT _PollGetOutputFramesAvailable(PaWasapiStream *stream, UINT32 *available)
-{
-	HRESULT hr;
-	UINT32 frames  = stream->out.framesPerHostCallback,
-		   padding = 0;
-
-	(*available) = 0;
-
-	// get read position
-	if ((hr = IAudioClient_GetCurrentPadding(stream->out.clientProc, &padding)) != S_OK)
-		return LogHostError(hr);
-
-	// get available
-	frames -= padding;
-
-	// set
-	(*available) = frames;
-	return hr;
-}
-
-// ------------------------------------------------------------------------------------------
-HRESULT _PollGetInputFramesAvailable(PaWasapiStream *stream, UINT32 *available)
-{
-	HRESULT hr;
-
-	(*available) = 0;
-
-	// GetCurrentPadding() has opposite meaning to Output stream 
-	if ((hr = IAudioClient_GetCurrentPadding(stream->in.clientProc, available)) != S_OK)
-		return LogHostError(hr);
-
-	return hr;
-}
-
-// ------------------------------------------------------------------------------------------
-HRESULT ProcessOutputBuffer(PaWasapiStream *stream, PaWasapiHostProcessor *processor, UINT32 frames)
-{
-	HRESULT hr;
-	BYTE *data = NULL;
-
-	// Get buffer
-	if ((hr = IAudioRenderClient_GetBuffer(stream->renderClient, frames, &data)) != S_OK)
-	{
-		if (stream->out.shareMode == AUDCLNT_SHAREMODE_SHARED)
-		{
-			// Using GetCurrentPadding to overcome AUDCLNT_E_BUFFER_TOO_LARGE in
-			// shared mode results in no sound in Event-driven mode (MSDN does not
-			// document this, or is it WASAPI bug?), thus we better
-			// try to acquire buffer next time when GetBuffer allows to do so.
-#if 0
-			// Get Read position
-			UINT32 padding = 0;
-			hr = IAudioClient_GetCurrentPadding(stream->out.clientProc, &padding);
-			if (hr != S_OK)
-				return LogHostError(hr);
-
-			// Get frames to write
-			frames -= padding;
-			if (frames == 0)
-				return S_OK;
-
-			if ((hr = IAudioRenderClient_GetBuffer(stream->renderClient, frames, &data)) != S_OK)
-				return LogHostError(hr);
-#else
-			if (hr == AUDCLNT_E_BUFFER_TOO_LARGE)
-				return S_OK; // be silent in shared mode, try again next time
-#endif
-		}
-		else
-			return LogHostError(hr);
-	}
-
-	// Process data
-	if (stream->out.monoMixer != NULL)
-	{
-		// expand buffer
-		UINT32 mono_frames_size = frames * (stream->out.wavex.Format.wBitsPerSample / 8);
-		if (mono_frames_size > stream->out.monoBufferSize)
-			stream->out.monoBuffer = PaWasapi_ReallocateMemory(stream->out.monoBuffer, (stream->out.monoBufferSize = mono_frames_size));
-
-		// process
-		processor[S_OUTPUT].processor(NULL, 0, (BYTE *)stream->out.monoBuffer, frames, processor[S_OUTPUT].userData);
-
-		// mix 1 to 2 channels
-		stream->out.monoMixer(data, stream->out.monoBuffer, frames);
-	}
-	else
-	{
-		processor[S_OUTPUT].processor(NULL, 0, data, frames, processor[S_OUTPUT].userData);
-	}
-
-	// Release buffer
-	if ((hr = IAudioRenderClient_ReleaseBuffer(stream->renderClient, frames, 0)) != S_OK)
-		LogHostError(hr);
-
-	return hr;
-}
-
-// ------------------------------------------------------------------------------------------
-HRESULT ProcessInputBuffer(PaWasapiStream *stream, PaWasapiHostProcessor *processor)
-{
-	HRESULT hr = S_OK;
-	UINT32 frames;
-	BYTE *data = NULL;
-	DWORD flags = 0;
-
-	for (;;)
-	{
-		// Check if blocking call must be interrupted
-		if (WaitForSingleObject(stream->hCloseRequest, 0) != WAIT_TIMEOUT)
-			break;
-
-		// Findout if any frames available
-		frames = 0;
-		if ((hr = _PollGetInputFramesAvailable(stream, &frames)) != S_OK)
-			return hr;
-
-		// Empty/consumed buffer
-		if (frames == 0)
-			break;
-
-		// Get the available data in the shared buffer.
-		if ((hr = IAudioCaptureClient_GetBuffer(stream->captureClient, &data, &frames, &flags, NULL, NULL)) != S_OK)
-		{
-			if (hr == AUDCLNT_S_BUFFER_EMPTY)
-			{
-				hr = S_OK;
-				break; // Empty/consumed buffer
-			}
-
-			return LogHostError(hr);
-			break;
-		}
-
-		// Detect silence
-		// if (flags & AUDCLNT_BUFFERFLAGS_SILENT)
-		//	data = NULL;
-
-		// Process data
-		if (stream->in.monoMixer != NULL)
-		{
-			// expand buffer
-			UINT32 mono_frames_size = frames * (stream->in.wavex.Format.wBitsPerSample / 8);
-			if (mono_frames_size > stream->in.monoBufferSize)
-				stream->in.monoBuffer = PaWasapi_ReallocateMemory(stream->in.monoBuffer, (stream->in.monoBufferSize = mono_frames_size));
-
-			// mix 1 to 2 channels
-			stream->in.monoMixer(stream->in.monoBuffer, data, frames);
-
-			// process
-			processor[S_INPUT].processor((BYTE *)stream->in.monoBuffer, frames, NULL, 0, processor[S_INPUT].userData);
-		}
-		else
-		{
-			processor[S_INPUT].processor(data, frames, NULL, 0, processor[S_INPUT].userData);
-		}
-
-		// Release buffer
-		if ((hr = IAudioCaptureClient_ReleaseBuffer(stream->captureClient, frames)) != S_OK)
-			return LogHostError(hr);
-
-		//break;
-	}
-
-	return hr;
-}
-
-// ------------------------------------------------------------------------------------------
-void _StreamOnStop(PaWasapiStream *stream)
-{
-	// Stop INPUT/OUTPUT clients
-	if (!stream->bBlocking) 
-	{
-		if (stream->in.clientProc != NULL)
-			IAudioClient_Stop(stream->in.clientProc);
-		if (stream->out.clientProc != NULL)
-			IAudioClient_Stop(stream->out.clientProc);
-	} 
-	else 
-	{
-		if (stream->in.clientParent != NULL)
-			IAudioClient_Stop(stream->in.clientParent);
-		if (stream->out.clientParent != NULL)
-			IAudioClient_Stop(stream->out.clientParent);
-	}
-
-	// Restore thread priority
-	if (stream->hAvTask != NULL)
-	{
-		PaWasapi_ThreadPriorityRevert(stream->hAvTask);
-		stream->hAvTask = NULL;
-	}
-
-    // Notify
-    if (stream->streamRepresentation.streamFinishedCallback != NULL)
-        stream->streamRepresentation.streamFinishedCallback(stream->streamRepresentation.userData);
-}
-
-// ------------------------------------------------------------------------------------------
-PA_THREAD_FUNC ProcThreadEvent(void *param)
-{
-    PaWasapiHostProcessor processor[S_COUNT];
-	HRESULT hr;
-	DWORD dwResult;
-    PaWasapiStream *stream = (PaWasapiStream *)param;
-	PaWasapiHostProcessor defaultProcessor;
-	BOOL set_event[S_COUNT] = { FALSE, FALSE };
-	BOOL bWaitAllEvents = FALSE;
-	BOOL bThreadComInitialized = FALSE;
-
-	/*
-	If COM is already initialized CoInitialize will either return
-	FALSE, or RPC_E_CHANGED_MODE if it was initialized in a different
-	threading mode. In either case we shouldn't consider it an error
-	but we need to be careful to not call CoUninitialize() if 
-	RPC_E_CHANGED_MODE was returned.
-	*/
-	hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
-	if (FAILED(hr) && (hr != RPC_E_CHANGED_MODE))
-	{
-		PRINT(("WASAPI: failed ProcThreadEvent CoInitialize"));
-		return paUnanticipatedHostError;
-	}
-	if (hr != RPC_E_CHANGED_MODE)
-		bThreadComInitialized = TRUE;
-
-	// Unmarshal stream pointers for safe COM operation
-	hr = UnmarshalStreamComPointers(stream);
-	if (hr != S_OK) {
-		PRINT(("Error unmarshaling stream COM pointers. HRESULT: %i\n", hr));
-		goto thread_end;
-	}
-
-	// Waiting on all events in case of Full-Duplex/Exclusive mode.
-	if ((stream->in.clientProc != NULL) && (stream->out.clientProc != NULL))
-	{
-		bWaitAllEvents = (stream->in.shareMode == AUDCLNT_SHAREMODE_EXCLUSIVE) &&
-			(stream->out.shareMode == AUDCLNT_SHAREMODE_EXCLUSIVE);
-	}
-
-    // Setup data processors
-    defaultProcessor.processor = WaspiHostProcessingLoop;
-    defaultProcessor.userData  = stream;
-    processor[S_INPUT] = (stream->hostProcessOverrideInput.processor != NULL ? stream->hostProcessOverrideInput : defaultProcessor);
-    processor[S_OUTPUT] = (stream->hostProcessOverrideOutput.processor != NULL ? stream->hostProcessOverrideOutput : defaultProcessor);
-
-	// Boost thread priority
-	PaWasapi_ThreadPriorityBoost((void **)&stream->hAvTask, stream->nThreadPriority);
-
-	// Create events
-	if (stream->event[S_OUTPUT] == NULL)
-	{
-		stream->event[S_OUTPUT] = CreateEvent(NULL, FALSE, FALSE, NULL);
-		set_event[S_OUTPUT] = TRUE;
-	}
-	if (stream->event[S_INPUT] == NULL)
-	{
-		stream->event[S_INPUT]  = CreateEvent(NULL, FALSE, FALSE, NULL);
-		set_event[S_INPUT] = TRUE;
-	}
-	if ((stream->event[S_OUTPUT] == NULL) || (stream->event[S_INPUT] == NULL))
-	{
-		PRINT(("WASAPI Thread: failed creating Input/Output event handle\n"));
-		goto thread_error;
-	}
-
-	// Initialize event & start INPUT stream
-	if (stream->in.clientProc)
-	{
-		// Create & set handle
-		if (set_event[S_INPUT])
-		{
-			if ((hr = IAudioClient_SetEventHandle(stream->in.clientProc, stream->event[S_INPUT])) != S_OK)
-			{
-				LogHostError(hr);
-				goto thread_error;
-			}
-		}
-
-		// Start
-		if ((hr = IAudioClient_Start(stream->in.clientProc)) != S_OK)
-		{
-			LogHostError(hr);
-			goto thread_error;
-		}
-	}
-
-	// Initialize event & start OUTPUT stream
-	if (stream->out.clientProc)
-	{
-		// Create & set handle
-		if (set_event[S_OUTPUT])
-		{
-			if ((hr = IAudioClient_SetEventHandle(stream->out.clientProc, stream->event[S_OUTPUT])) != S_OK)
-			{
-				LogHostError(hr);
-				goto thread_error;
-			}
-		}
-
-		// Preload buffer before start
-		if ((hr = ProcessOutputBuffer(stream, processor, stream->out.framesPerBuffer)) != S_OK)
-		{
-			LogHostError(hr);
-			goto thread_error;
-		}
-
-		// Start
-		if ((hr = IAudioClient_Start(stream->out.clientProc)) != S_OK)
-		{
-			LogHostError(hr);
-			goto thread_error;
-		}
-
-	}
-
-	// Signal: stream running
-	stream->running = TRUE;
-
-	// Notify: thread started
-	SetEvent(stream->hThreadStart);
-
-	// Processing Loop
-	for (;;)
-    {
-	    // 10 sec timeout (on timeout stream will auto-stop when processed by WAIT_TIMEOUT case)
-        dwResult = WaitForMultipleObjects(S_COUNT, stream->event, bWaitAllEvents, 10*1000);
-
-		// Check for close event (after wait for buffers to avoid any calls to user
-		// callback when hCloseRequest was set)
-		if (WaitForSingleObject(stream->hCloseRequest, 0) != WAIT_TIMEOUT)
-			break;
-
-		// Process S_INPUT/S_OUTPUT
-		switch (dwResult)
-		{
-		case WAIT_TIMEOUT: {
-			PRINT(("WASAPI Thread: WAIT_TIMEOUT - probably bad audio driver or Vista x64 bug: use paWinWasapiPolling instead\n"));
-			goto thread_end;
-			break; }
-
-		// Input stream
-		case WAIT_OBJECT_0 + S_INPUT: {
-
-            if (stream->captureClient == NULL)
-                break;
-
-			if ((hr = ProcessInputBuffer(stream, processor)) != S_OK)
-			{
-				LogHostError(hr);
-				goto thread_error;
-			}
-
-			break; }
-
-		// Output stream
-		case WAIT_OBJECT_0 + S_OUTPUT: {
-
-            if (stream->renderClient == NULL)
-                break;
-
-			if ((hr = ProcessOutputBuffer(stream, processor, stream->out.framesPerBuffer)) != S_OK)
-			{
-				LogHostError(hr);
-				goto thread_error;
-			}
-
-			break; }
-		}
-	}
-
-thread_end:
-
-	// Process stop
-	_StreamOnStop(stream);
-
-	// Release unmarshaled COM pointers
-	ReleaseUnmarshaledComPointers(stream);
-
-	// Cleanup COM for this thread
-	if (bThreadComInitialized == TRUE)
-		CoUninitialize();
-
-	// Notify: not running
-	stream->running = FALSE;
-
-	// Notify: thread exited
-	SetEvent(stream->hThreadExit);
-
-	return 0;
-
-thread_error:
-
-	// Prevent deadlocking in Pa_StreamStart
-	SetEvent(stream->hThreadStart);
-
-	// Exit
-	goto thread_end;
-}
-
-// ------------------------------------------------------------------------------------------
-PA_THREAD_FUNC ProcThreadPoll(void *param)
-{
-    PaWasapiHostProcessor processor[S_COUNT];
-	HRESULT hr;
-    PaWasapiStream *stream = (PaWasapiStream *)param;
-	PaWasapiHostProcessor defaultProcessor;
-	INT32 i;
-	ThreadIdleScheduler scheduler;
-
-	// Calculate the actual duration of the allocated buffer.
-	DWORD sleep_ms     = 0;
-	DWORD sleep_ms_in;
-	DWORD sleep_ms_out;
-
-	BOOL bThreadComInitialized = FALSE;
-
-	/*
-	If COM is already initialized CoInitialize will either return
-	FALSE, or RPC_E_CHANGED_MODE if it was initialized in a different
-	threading mode. In either case we shouldn't consider it an error
-	but we need to be careful to not call CoUninitialize() if 
-	RPC_E_CHANGED_MODE was returned.
-	*/
-	hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
-	if (FAILED(hr) && (hr != RPC_E_CHANGED_MODE))
-	{
-		PRINT(("WASAPI: failed ProcThreadPoll CoInitialize"));
-		return paUnanticipatedHostError;
-	}
-	if (hr != RPC_E_CHANGED_MODE)
-		bThreadComInitialized = TRUE;
-
-	// Unmarshal stream pointers for safe COM operation
-	hr = UnmarshalStreamComPointers(stream);
-	if (hr != S_OK) 
-	{
-		PRINT(("Error unmarshaling stream COM pointers. HRESULT: %i\n", hr));
-		return 0;
-	}
-
-	// Calculate timeout for next polling attempt.
-	sleep_ms_in  = GetFramesSleepTime(stream->in.framesPerHostCallback/WASAPI_PACKETS_PER_INPUT_BUFFER, stream->in.wavex.Format.nSamplesPerSec);
-	sleep_ms_out = GetFramesSleepTime(stream->out.framesPerBuffer, stream->out.wavex.Format.nSamplesPerSec);
-
-	// WASAPI Input packets tend to expire very easily, let's limit sleep time to 2 milliseconds
-	// for all cases. Please propose better solution if any.
-	if (sleep_ms_in > 2)
-		sleep_ms_in = 2;
-
-	// Adjust polling time for non-paUtilFixedHostBufferSize. Input stream is not adjustable as it is being
-	// polled according its packet length.
-	if (stream->bufferMode != paUtilFixedHostBufferSize)
-	{
-		//sleep_ms_in = GetFramesSleepTime(stream->bufferProcessor.framesPerUserBuffer, stream->in.wavex.Format.nSamplesPerSec);
-		sleep_ms_out = GetFramesSleepTime(stream->bufferProcessor.framesPerUserBuffer, stream->out.wavex.Format.nSamplesPerSec);
-	}
-
-	// Choose smallest
-	if ((sleep_ms_in != 0) && (sleep_ms_out != 0))
-		sleep_ms = min(sleep_ms_in, sleep_ms_out);
-	else
-	{
-		sleep_ms = (sleep_ms_in ? sleep_ms_in : sleep_ms_out);
-	}
-	// Make sure not 0, othervise use ThreadIdleScheduler
-	if (sleep_ms == 0)
-	{
-		sleep_ms_in  = GetFramesSleepTimeMicroseconds(stream->in.framesPerHostCallback/WASAPI_PACKETS_PER_INPUT_BUFFER, stream->in.wavex.Format.nSamplesPerSec);
-		sleep_ms_out = GetFramesSleepTimeMicroseconds(stream->bufferProcessor.framesPerUserBuffer, stream->out.wavex.Format.nSamplesPerSec);
-
-		// Choose smallest
-		if ((sleep_ms_in != 0) && (sleep_ms_out != 0))
-			sleep_ms = min(sleep_ms_in, sleep_ms_out);
-		else
-		{
-			sleep_ms = (sleep_ms_in ? sleep_ms_in : sleep_ms_out);
-		}
-
-		// Setup thread sleep scheduler
-		ThreadIdleScheduler_Setup(&scheduler, 1, sleep_ms/* microseconds here */);
-		sleep_ms = 0;
-	}
-
-    // Setup data processors
-    defaultProcessor.processor = WaspiHostProcessingLoop;
-    defaultProcessor.userData  = stream;
-    processor[S_INPUT] = (stream->hostProcessOverrideInput.processor != NULL ? stream->hostProcessOverrideInput : defaultProcessor);
-    processor[S_OUTPUT] = (stream->hostProcessOverrideOutput.processor != NULL ? stream->hostProcessOverrideOutput : defaultProcessor);
-
-	// Boost thread priority
-	PaWasapi_ThreadPriorityBoost((void **)&stream->hAvTask, stream->nThreadPriority);
-
-	// Initialize event & start INPUT stream
-	if (stream->in.clientProc)
-	{
-		if ((hr = IAudioClient_Start(stream->in.clientProc)) != S_OK)
-		{
-			LogHostError(hr);
-			goto thread_error;
-		}
-	}
-
-	// Initialize event & start OUTPUT stream
-	if (stream->out.clientProc)
-	{
-		// Preload buffer (obligatory, othervise ->Start() will fail), avoid processing
-		// when in full-duplex mode as it requires input processing as well
-		if (!PA_WASAPI__IS_FULLDUPLEX(stream))
-		{
-			UINT32 frames = 0;
-			if ((hr = _PollGetOutputFramesAvailable(stream, &frames)) == S_OK)
-            {
-				if (stream->bufferMode == paUtilFixedHostBufferSize)
-				{
-					if (frames >= stream->out.framesPerBuffer)
-					{
-						frames = stream->out.framesPerBuffer;
-
-						if ((hr = ProcessOutputBuffer(stream, processor, frames)) != S_OK)
-						{
-							LogHostError(hr); // not fatal, just log
-						}
-					}
-				}
-				else
-				{
-					if (frames != 0)
-					{
-						if ((hr = ProcessOutputBuffer(stream, processor, frames)) != S_OK)
-						{
-							LogHostError(hr); // not fatal, just log
-						}
-					}
-				}
-            }
-            else
-			{
-				LogHostError(hr); // not fatal, just log
-			}
-		}
-
-		// Start
-		if ((hr = IAudioClient_Start(stream->out.clientProc)) != S_OK)
-		{
-			LogHostError(hr);
-			goto thread_error;
-		}
-	}
-
-	// Signal: stream running
-	stream->running = TRUE;
-
-	// Notify: thread started
-	SetEvent(stream->hThreadStart);
-
-	if (!PA_WASAPI__IS_FULLDUPLEX(stream))
-	{
-		// Processing Loop
-		UINT32 next_sleep = sleep_ms;
-		while (WaitForSingleObject(stream->hCloseRequest, next_sleep) == WAIT_TIMEOUT)
-		{
-			// Get next sleep time
-			if (sleep_ms == 0)
-			{
-				next_sleep = ThreadIdleScheduler_NextSleep(&scheduler);
-			}
-
-			for (i = 0; i < S_COUNT; ++i)
-			{
-				// Process S_INPUT/S_OUTPUT
-				switch (i)
-				{
-				// Input stream
-				case S_INPUT: {
-
-					if (stream->captureClient == NULL)
-						break;
-
-					if ((hr = ProcessInputBuffer(stream, processor)) != S_OK)
-					{
-						LogHostError(hr);
-						goto thread_error;
-					}
-
-					break; }
-
-				// Output stream
-				case S_OUTPUT: {
-
-					UINT32 frames;
-					if (stream->renderClient == NULL)
-						break;
-
-					// get available frames
-					if ((hr = _PollGetOutputFramesAvailable(stream, &frames)) != S_OK)
-					{
-						LogHostError(hr);
-						goto thread_error;
-					}
-
-					// output
-					if (stream->bufferMode == paUtilFixedHostBufferSize)
-					{
-						while (frames >= stream->out.framesPerBuffer)
-						{
-							if ((hr = ProcessOutputBuffer(stream, processor, stream->out.framesPerBuffer)) != S_OK)
-							{
-								LogHostError(hr);
-								goto thread_error;
-							}
-
-							frames -= stream->out.framesPerBuffer;
-						}
-					}
-					else
-					{
-						if (frames != 0)
-						{
-							if ((hr = ProcessOutputBuffer(stream, processor, frames)) != S_OK)
-							{
-								LogHostError(hr);
-								goto thread_error;
-							}
-						}
-					}
-
-					break; }
-				}
-			}
-		}
-	}
-	else
-	{
-#if 0
-		// Processing Loop
-		while (WaitForSingleObject(stream->hCloseRequest, 1) == WAIT_TIMEOUT)
-		{
-			UINT32 i_frames = 0, i_processed = 0;
-			BYTE *i_data = NULL, *o_data = NULL, *o_data_host = NULL;
-			DWORD i_flags = 0;
-			UINT32 o_frames = 0;
-
-			// get host input buffer
-			if ((hr = IAudioCaptureClient_GetBuffer(stream->captureClient, &i_data, &i_frames, &i_flags, NULL, NULL)) != S_OK)
-			{
-				if (hr == AUDCLNT_S_BUFFER_EMPTY)
-					continue; // no data in capture buffer
-
-				LogHostError(hr);
-				break;
-			}
-
-			// get available frames
-			if ((hr = _PollGetOutputFramesAvailable(stream, &o_frames)) != S_OK)
-			{
-				// release input buffer
-				IAudioCaptureClient_ReleaseBuffer(stream->captureClient, 0);
-
-				LogHostError(hr);
-				break;
-			}
-
-			// process equal ammount of frames
-			if (o_frames >= i_frames)
-			{
-				// process input ammount of frames
-				UINT32 o_processed = i_frames;
-
-				// get host output buffer
-				if ((hr = IAudioRenderClient_GetBuffer(stream->procRCClient, o_processed, &o_data)) == S_OK)
-				{
-					// processed amount of i_frames
-					i_processed = i_frames;
-					o_data_host = o_data;
-
-					// convert output mono
-					if (stream->out.monoMixer)
-					{
-						UINT32 mono_frames_size = o_processed * (stream->out.wavex.Format.wBitsPerSample / 8);
-						// expand buffer
-						if (mono_frames_size > stream->out.monoBufferSize)
-						{
-							stream->out.monoBuffer = PaWasapi_ReallocateMemory(stream->out.monoBuffer, (stream->out.monoBufferSize = mono_frames_size));
-							if (stream->out.monoBuffer == NULL)
-							{
-								// release input buffer
-								IAudioCaptureClient_ReleaseBuffer(stream->captureClient, 0);
-								// release output buffer
-								IAudioRenderClient_ReleaseBuffer(stream->renderClient, 0, 0);
-
-								LogPaError(paInsufficientMemory);
-								break;
-							}
-						}
-
-						// replace buffer pointer
-						o_data = (BYTE *)stream->out.monoBuffer;
-					}
-
-					// convert input mono
-					if (stream->in.monoMixer)
-					{
-						UINT32 mono_frames_size = i_processed * (stream->in.wavex.Format.wBitsPerSample / 8);
-						// expand buffer
-						if (mono_frames_size > stream->in.monoBufferSize)
-						{
-							stream->in.monoBuffer = PaWasapi_ReallocateMemory(stream->in.monoBuffer, (stream->in.monoBufferSize = mono_frames_size));
-							if (stream->in.monoBuffer == NULL)
-							{
-								// release input buffer
-								IAudioCaptureClient_ReleaseBuffer(stream->captureClient, 0);
-								// release output buffer
-								IAudioRenderClient_ReleaseBuffer(stream->renderClient, 0, 0);
-
-								LogPaError(paInsufficientMemory);
-								break;
-							}
-						}
-
-						// mix 2 to 1 input channels
-						stream->in.monoMixer(stream->in.monoBuffer, i_data, i_processed);
-
-						// replace buffer pointer
-						i_data = (BYTE *)stream->in.monoBuffer;
-					}
-
-					// process
-					processor[S_FULLDUPLEX].processor(i_data, i_processed, o_data, o_processed, processor[S_FULLDUPLEX].userData);
-
-					// mix 1 to 2 output channels
-					if (stream->out.monoBuffer)
-						stream->out.monoMixer(o_data_host, stream->out.monoBuffer, o_processed);
-
-					// release host output buffer
-					if ((hr = IAudioRenderClient_ReleaseBuffer(stream->renderClient, o_processed, 0)) != S_OK)
-						LogHostError(hr);
-				}
-				else
-				{
-					if (stream->out.shareMode != AUDCLNT_SHAREMODE_SHARED)
-						LogHostError(hr); // be silent in shared mode, try again next time
-				}
-			}
-
-			// release host input buffer
-			if ((hr = IAudioCaptureClient_ReleaseBuffer(stream->captureClient, i_processed)) != S_OK)
-			{
-				LogHostError(hr);
-				break;
-			}
-		}
-#else
-		// Processing Loop
-		UINT32 next_sleep = sleep_ms;
-		while (WaitForSingleObject(stream->hCloseRequest, next_sleep) == WAIT_TIMEOUT)
-		{
-			UINT32 i_frames = 0, i_processed = 0;
-			BYTE *i_data = NULL, *o_data = NULL, *o_data_host = NULL;
-			DWORD i_flags = 0;
-			UINT32 o_frames = 0;
-
-			// Get next sleep time
-			if (sleep_ms == 0)
-			{
-				next_sleep = ThreadIdleScheduler_NextSleep(&scheduler);
-			}
-
-			// get available frames
-			if ((hr = _PollGetOutputFramesAvailable(stream, &o_frames)) != S_OK)
-			{
-				LogHostError(hr);
-				break;
-			}
-
-			while (o_frames != 0)
-			{
-				// get host input buffer
-				if ((hr = IAudioCaptureClient_GetBuffer(stream->captureClient, &i_data, &i_frames, &i_flags, NULL, NULL)) != S_OK)
-				{
-					if (hr == AUDCLNT_S_BUFFER_EMPTY)
-						break; // no data in capture buffer
-
-					LogHostError(hr);
-					break;
-				}
-
-				// process equal ammount of frames
-				if (o_frames >= i_frames)
-				{
-					// process input ammount of frames
-					UINT32 o_processed = i_frames;
-
-					// get host output buffer
-					if ((hr = IAudioRenderClient_GetBuffer(stream->renderClient, o_processed, &o_data)) == S_OK)
-					{
-						// processed amount of i_frames
-						i_processed = i_frames;
-						o_data_host = o_data;
-
-						// convert output mono
-						if (stream->out.monoMixer)
-						{
-							UINT32 mono_frames_size = o_processed * (stream->out.wavex.Format.wBitsPerSample / 8);
-							// expand buffer
-							if (mono_frames_size > stream->out.monoBufferSize)
-							{
-								stream->out.monoBuffer = PaWasapi_ReallocateMemory(stream->out.monoBuffer, (stream->out.monoBufferSize = mono_frames_size));
-								if (stream->out.monoBuffer == NULL)
-								{
-									// release input buffer
-									IAudioCaptureClient_ReleaseBuffer(stream->captureClient, 0);
-									// release output buffer
-									IAudioRenderClient_ReleaseBuffer(stream->renderClient, 0, 0);
-
-									LogPaError(paInsufficientMemory);
-									goto thread_error;
-								}
-							}
-
-							// replace buffer pointer
-							o_data = (BYTE *)stream->out.monoBuffer;
-						}
-
-						// convert input mono
-						if (stream->in.monoMixer)
-						{
-							UINT32 mono_frames_size = i_processed * (stream->in.wavex.Format.wBitsPerSample / 8);
-							// expand buffer
-							if (mono_frames_size > stream->in.monoBufferSize)
-							{
-								stream->in.monoBuffer = PaWasapi_ReallocateMemory(stream->in.monoBuffer, (stream->in.monoBufferSize = mono_frames_size));
-								if (stream->in.monoBuffer == NULL)
-								{
-									// release input buffer
-									IAudioCaptureClient_ReleaseBuffer(stream->captureClient, 0);
-									// release output buffer
-									IAudioRenderClient_ReleaseBuffer(stream->renderClient, 0, 0);
-
-									LogPaError(paInsufficientMemory);
-									goto thread_error;
-								}
-							}
-
-							// mix 2 to 1 input channels
-							stream->in.monoMixer(stream->in.monoBuffer, i_data, i_processed);
-
-							// replace buffer pointer
-							i_data = (BYTE *)stream->in.monoBuffer;
-						}
-
-						// process
-						processor[S_FULLDUPLEX].processor(i_data, i_processed, o_data, o_processed, processor[S_FULLDUPLEX].userData);
-
-						// mix 1 to 2 output channels
-						if (stream->out.monoBuffer)
-							stream->out.monoMixer(o_data_host, stream->out.monoBuffer, o_processed);
-
-						// release host output buffer
-						if ((hr = IAudioRenderClient_ReleaseBuffer(stream->renderClient, o_processed, 0)) != S_OK)
-							LogHostError(hr);
-
-						o_frames -= o_processed;
-					}
-					else
-					{
-						if (stream->out.shareMode != AUDCLNT_SHAREMODE_SHARED)
-							LogHostError(hr); // be silent in shared mode, try again next time
-					}
-				}
-				else
-				{
-					i_processed = 0;
-					goto fd_release_buffer_in;
-				}
-
-fd_release_buffer_in:
-
-				// release host input buffer
-				if ((hr = IAudioCaptureClient_ReleaseBuffer(stream->captureClient, i_processed)) != S_OK)
-				{
-					LogHostError(hr);
-					break;
-				}
-
-				// break processing, input hasn't been accumulated yet
-				if (i_processed == 0)
-					break;
-			}
-		}
-#endif
-	}
-
-thread_end:
-
-	// Process stop
-	_StreamOnStop(stream);
-
-	// Release unmarshaled COM pointers
-	ReleaseUnmarshaledComPointers(stream);
-
-	// Cleanup COM for this thread
-	if (bThreadComInitialized == TRUE)
-		CoUninitialize();
-
-	// Notify: not running
-	stream->running = FALSE;
-
-	// Notify: thread exited
-	SetEvent(stream->hThreadExit);
-
-	return 0;
-
-thread_error:
-
-	// Prevent deadlocking in Pa_StreamStart
-	SetEvent(stream->hThreadStart);
-
-	// Exit
-	goto thread_end;
-}
-
-// ------------------------------------------------------------------------------------------
-void *PaWasapi_ReallocateMemory(void *ptr, size_t size)
-{
-	return realloc(ptr, size);
-}
-
-// ------------------------------------------------------------------------------------------
-void PaWasapi_FreeMemory(void *ptr)
-{
-	free(ptr);
-}
-
-//#endif //VC 2005
-
-
-
-
-#if 0
-			if(bFirst) {
-				float masteur;
-				hr = stream->outVol->GetMasterVolumeLevelScalar(&masteur);
-				if (hr != S_OK)
-					LogHostError(hr);
-				float chan1, chan2;
-				hr = stream->outVol->GetChannelVolumeLevelScalar(0, &chan1);
-				if (hr != S_OK)
-					LogHostError(hr);
-				hr = stream->outVol->GetChannelVolumeLevelScalar(1, &chan2);
-				if (hr != S_OK)
-					LogHostError(hr);
-
-				BOOL bMute;
-				hr = stream->outVol->GetMute(&bMute);
-				if (hr != S_OK)
-					LogHostError(hr);
-
-				stream->outVol->SetMasterVolumeLevelScalar(0.5, NULL);
-				stream->outVol->SetChannelVolumeLevelScalar(0, 0.5, NULL);
-				stream->outVol->SetChannelVolumeLevelScalar(1, 0.5, NULL);
-				stream->outVol->SetMute(FALSE, NULL);
-				bFirst = FALSE;
-			}
-#endif
+/*
+ * Portable Audio I/O Library WASAPI implementation
+ * Copyright (c) 2006-2010 David Viens, Dmitry Kostjuchenko
+ *
+ * Based on the Open Source API proposed by Ross Bencina
+ * Copyright (c) 1999-2002 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 hostapi_src
+ @brief WASAPI implementation of support for a host API.
+ @note pa_wasapi currently requires minimum VC 2005, and the latest Vista SDK
+*/
+
+#include <windows.h>
+#include <stdio.h>
+#include <process.h>
+#include <assert.h>
+
+// WinRT
+#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP)
+	#define PA_WINRT
+	#define INITGUID
+#endif
+
+// WASAPI
+#include <mmreg.h>  // must be before other Wasapi headers
+#if defined(_MSC_VER) && (_MSC_VER >= 1400)
+	#include <Avrt.h>
+	#define COBJMACROS
+	#include <Audioclient.h>
+	#include <endpointvolume.h>
+	#define INITGUID // Avoid additional linkage of static libs, excessive code will be optimized out by the compiler
+	#include <mmdeviceapi.h>
+	#include <functiondiscoverykeys.h>
+    #include <devicetopology.h>	// Used to get IKsJackDescription interface
+	#undef INITGUID
+#endif
+#ifndef __MWERKS__
+	#include <malloc.h>
+	#include <memory.h>
+#endif
+
+#include "pa_util.h"
+#include "pa_allocation.h"
+#include "pa_hostapi.h"
+#include "pa_stream.h"
+#include "pa_cpuload.h"
+#include "pa_process.h"
+#include "pa_win_wasapi.h"
+#include "pa_debugprint.h"
+#include "pa_ringbuffer.h"
+#include "pa_win_coinitialize.h"
+
+#if !defined(NTDDI_VERSION)
+ 
+    #undef WINVER
+    #undef _WIN32_WINNT
+    #define WINVER       0x0600 // VISTA
+	#define _WIN32_WINNT WINVER
+
+	#ifndef _AVRT_ //<< fix MinGW dummy compile by defining missing type: AVRT_PRIORITY
+        typedef enum _AVRT_PRIORITY
+        {
+            AVRT_PRIORITY_LOW = -1,
+            AVRT_PRIORITY_NORMAL,
+            AVRT_PRIORITY_HIGH,
+            AVRT_PRIORITY_CRITICAL
+        } AVRT_PRIORITY, *PAVRT_PRIORITY;
+	#endif
+
+	#include <basetyps.h> // << for IID/CLSID
+    #include <rpcsal.h>
+    #include <sal.h>
+
+	#ifndef __LPCGUID_DEFINED__
+		#define __LPCGUID_DEFINED__
+		typedef const GUID *LPCGUID;
+	#endif
+
+    #ifndef PROPERTYKEY_DEFINED
+        #define PROPERTYKEY_DEFINED
+        typedef struct _tagpropertykey
+        {
+            GUID fmtid;
+            DWORD pid;
+        } 	PROPERTYKEY;
+    #endif
+
+    #ifdef __midl_proxy
+        #define __MIDL_CONST
+    #else
+        #define __MIDL_CONST const
+    #endif
+
+    #ifdef WIN64
+        #include <wtypes.h>
+        typedef LONG NTSTATUS;
+        #define FASTCALL
+        #include <oleidl.h>
+        #include <objidl.h>
+     #else
+        typedef struct _BYTE_BLOB
+        {
+            unsigned long clSize;
+            unsigned char abData[ 1 ];
+        } 	BYTE_BLOB;
+        typedef /* [unique] */  __RPC_unique_pointer BYTE_BLOB *UP_BYTE_BLOB;
+        typedef LONGLONG REFERENCE_TIME;
+        #define NONAMELESSUNION
+    #endif
+    
+    #ifndef WAVE_FORMAT_IEEE_FLOAT
+        #define WAVE_FORMAT_IEEE_FLOAT 0x0003 // 32-bit floating-point
+    #endif    
+    
+    #ifndef __MINGW_EXTENSION
+        #if defined(__GNUC__) || defined(__GNUG__)
+            #define __MINGW_EXTENSION __extension__
+        #else
+            #define __MINGW_EXTENSION
+        #endif
+    #endif 
+
+    #include <sdkddkver.h>
+    #include <propkeydef.h>
+    #define COBJMACROS
+    #define INITGUID // Avoid additional linkage of static libs, excessive code will be optimized out by the compiler
+    #include <audioclient.h>
+    #include <mmdeviceapi.h>
+    #include <endpointvolume.h>
+    #include <functiondiscoverykeys.h>
+	#include <devicetopology.h>	// Used to get IKsJackDescription interface
+    #undef INITGUID
+
+#endif // NTDDI_VERSION
+
+// Missing declarations for WinRT
+#ifdef PA_WINRT
+
+	#define DEVICE_STATE_ACTIVE 0x00000001
+
+	typedef	enum _EDataFlow
+	{	
+		eRender					= 0,
+		eCapture				= ( eRender + 1 ) ,
+		eAll					= ( eCapture + 1 ) ,
+		EDataFlow_enum_count	= ( eAll + 1 )
+	}
+	EDataFlow;
+
+	typedef enum _EndpointFormFactor
+	{	
+		RemoteNetworkDevice			= 0,
+		Speakers					= ( RemoteNetworkDevice + 1 ) ,
+		LineLevel					= ( Speakers + 1 ) ,
+		Headphones					= ( LineLevel + 1 ) ,
+		Microphone					= ( Headphones + 1 ) ,
+		Headset						= ( Microphone + 1 ) ,
+		Handset						= ( Headset + 1 ) ,
+		UnknownDigitalPassthrough	= ( Handset + 1 ) ,
+		SPDIF						= ( UnknownDigitalPassthrough + 1 ) ,
+		HDMI						= ( SPDIF + 1 ) ,
+		UnknownFormFactor			= ( HDMI + 1 ) 
+	} 	
+	EndpointFormFactor;
+
+#endif
+
+#ifndef GUID_SECT
+    #define GUID_SECT
+#endif
+
+#define __DEFINE_GUID(n,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) static const GUID n GUID_SECT = {l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}}
+#define __DEFINE_IID(n,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) static const IID n GUID_SECT = {l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}}
+#define __DEFINE_CLSID(n,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) static const CLSID n GUID_SECT = {l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}}
+#define PA_DEFINE_CLSID(className, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
+    __DEFINE_CLSID(pa_CLSID_##className, 0x##l, 0x##w1, 0x##w2, 0x##b1, 0x##b2, 0x##b3, 0x##b4, 0x##b5, 0x##b6, 0x##b7, 0x##b8)
+#define PA_DEFINE_IID(interfaceName, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
+    __DEFINE_IID(pa_IID_##interfaceName, 0x##l, 0x##w1, 0x##w2, 0x##b1, 0x##b2, 0x##b3, 0x##b4, 0x##b5, 0x##b6, 0x##b7, 0x##b8)
+
+// "1CB9AD4C-DBFA-4c32-B178-C2F568A703B2"
+PA_DEFINE_IID(IAudioClient,         1cb9ad4c, dbfa, 4c32, b1, 78, c2, f5, 68, a7, 03, b2);
+// "726778CD-F60A-4EDA-82DE-E47610CD78AA"
+PA_DEFINE_IID(IAudioClient2,        726778cd, f60a, 4eda, 82, de, e4, 76, 10, cd, 78, aa);
+// "1BE09788-6894-4089-8586-9A2A6C265AC5"
+PA_DEFINE_IID(IMMEndpoint,          1be09788, 6894, 4089, 85, 86, 9a, 2a, 6c, 26, 5a, c5);
+// "A95664D2-9614-4F35-A746-DE8DB63617E6"
+PA_DEFINE_IID(IMMDeviceEnumerator,  a95664d2, 9614, 4f35, a7, 46, de, 8d, b6, 36, 17, e6);
+// "BCDE0395-E52F-467C-8E3D-C4579291692E"
+PA_DEFINE_CLSID(IMMDeviceEnumerator,bcde0395, e52f, 467c, 8e, 3d, c4, 57, 92, 91, 69, 2e);
+// "F294ACFC-3146-4483-A7BF-ADDCA7C260E2"
+PA_DEFINE_IID(IAudioRenderClient,   f294acfc, 3146, 4483, a7, bf, ad, dc, a7, c2, 60, e2);
+// "C8ADBD64-E71E-48a0-A4DE-185C395CD317"
+PA_DEFINE_IID(IAudioCaptureClient,  c8adbd64, e71e, 48a0, a4, de, 18, 5c, 39, 5c, d3, 17);
+// *2A07407E-6497-4A18-9787-32F79BD0D98F*  Or this??
+PA_DEFINE_IID(IDeviceTopology,      2A07407E, 6497, 4A18, 97, 87, 32, f7, 9b, d0, d9, 8f);
+// *AE2DE0E4-5BCA-4F2D-AA46-5D13F8FDB3A9*
+PA_DEFINE_IID(IPart,                AE2DE0E4, 5BCA, 4F2D, aa, 46, 5d, 13, f8, fd, b3, a9);
+// *4509F757-2D46-4637-8E62-CE7DB944F57B*
+PA_DEFINE_IID(IKsJackDescription,   4509F757, 2D46, 4637, 8e, 62, ce, 7d, b9, 44, f5, 7b);
+
+// Media formats:
+__DEFINE_GUID(pa_KSDATAFORMAT_SUBTYPE_PCM,        0x00000001, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 );
+__DEFINE_GUID(pa_KSDATAFORMAT_SUBTYPE_ADPCM,      0x00000002, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 );
+__DEFINE_GUID(pa_KSDATAFORMAT_SUBTYPE_IEEE_FLOAT, 0x00000003, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 );
+
+#ifdef __IAudioClient2_INTERFACE_DEFINED__
+typedef enum _pa_AUDCLNT_STREAMOPTIONS { 
+	pa_AUDCLNT_STREAMOPTIONS_NONE          = 0x00,
+	pa_AUDCLNT_STREAMOPTIONS_RAW           = 0x01,
+	pa_AUDCLNT_STREAMOPTIONS_MATCH_FORMAT  = 0x02
+} pa_AUDCLNT_STREAMOPTIONS;
+typedef struct _pa_AudioClientProperties {
+	UINT32                   cbSize;
+	BOOL                     bIsOffload;
+	AUDIO_STREAM_CATEGORY    eCategory;
+	pa_AUDCLNT_STREAMOPTIONS Options;
+} pa_AudioClientProperties;
+#define PA_AUDIOCLIENTPROPERTIES_SIZE_CATEGORY (sizeof(pa_AudioClientProperties) - sizeof(pa_AUDCLNT_STREAMOPTIONS))
+#define PA_AUDIOCLIENTPROPERTIES_SIZE_OPTIONS   sizeof(pa_AudioClientProperties)
+#endif // __IAudioClient2_INTERFACE_DEFINED__
+
+/* use CreateThread for CYGWIN/Windows Mobile, _beginthreadex for all others */
+#if !defined(__CYGWIN__) && !defined(_WIN32_WCE)
+	#define CREATE_THREAD(PROC) (HANDLE)_beginthreadex( NULL, 0, (PROC), stream, 0, &stream->dwThreadId )
+	#define PA_THREAD_FUNC static unsigned WINAPI
+	#define PA_THREAD_ID unsigned
+#else
+	#define CREATE_THREAD(PROC) CreateThread( NULL, 0, (PROC), stream, 0, &stream->dwThreadId )
+	#define PA_THREAD_FUNC static DWORD WINAPI
+	#define PA_THREAD_ID DWORD
+#endif
+
+// Thread function forward decl.
+PA_THREAD_FUNC ProcThreadEvent(void *param);
+PA_THREAD_FUNC ProcThreadPoll(void *param);
+
+// Availabe from Windows 7
+#ifndef AUDCLNT_E_BUFFER_ERROR
+	#define AUDCLNT_E_BUFFER_ERROR AUDCLNT_ERR(0x018)
+#endif
+#ifndef AUDCLNT_E_BUFFER_SIZE_NOT_ALIGNED
+	#define AUDCLNT_E_BUFFER_SIZE_NOT_ALIGNED AUDCLNT_ERR(0x019)
+#endif
+#ifndef AUDCLNT_E_INVALID_DEVICE_PERIOD
+	#define AUDCLNT_E_INVALID_DEVICE_PERIOD AUDCLNT_ERR(0x020)
+#endif
+
+#define MAX_STR_LEN 512
+
+enum { S_INPUT = 0, S_OUTPUT = 1, S_COUNT = 2, S_FULLDUPLEX = 0 };
+
+// Number of packets which compose single contignous buffer. With trial and error it was calculated
+// that WASAPI Input sub-system uses 6 packets per whole buffer. Please provide more information
+// or corrections if available.
+enum { WASAPI_PACKETS_PER_INPUT_BUFFER = 6 };
+
+#define STATIC_ARRAY_SIZE(array) (sizeof(array)/sizeof(array[0]))
+
+#define PRINT(x) PA_DEBUG(x);
+
+#define PA_SKELETON_SET_LAST_HOST_ERROR( errorCode, errorText ) \
+    PaUtil_SetLastHostErrorInfo( paWASAPI, errorCode, errorText )
+
+#define PA_WASAPI__IS_FULLDUPLEX(STREAM) ((STREAM)->in.clientProc && (STREAM)->out.clientProc)
+
+#ifndef IF_FAILED_JUMP
+#define IF_FAILED_JUMP(hr, label) if(FAILED(hr)) goto label;
+#endif
+
+#ifndef IF_FAILED_INTERNAL_ERROR_JUMP
+#define IF_FAILED_INTERNAL_ERROR_JUMP(hr, error, label) if(FAILED(hr)) { error = paInternalError; goto label; }
+#endif
+
+#define SAFE_CLOSE(h) if ((h) != NULL) { CloseHandle((h)); (h) = NULL; }
+#define SAFE_RELEASE(punk) if ((punk) != NULL) { (punk)->lpVtbl->Release((punk)); (punk) = NULL; }
+
+// Mixer function
+typedef void (*MixMonoToStereoF) (void *__to, void *__from, UINT32 count);
+
+// AVRT is the new "multimedia schedulling stuff"
+#ifndef PA_WINRT
+typedef BOOL   (WINAPI *FAvRtCreateThreadOrderingGroup)  (PHANDLE,PLARGE_INTEGER,GUID*,PLARGE_INTEGER);
+typedef BOOL   (WINAPI *FAvRtDeleteThreadOrderingGroup)  (HANDLE);
+typedef BOOL   (WINAPI *FAvRtWaitOnThreadOrderingGroup)  (HANDLE);
+typedef HANDLE (WINAPI *FAvSetMmThreadCharacteristics)   (LPCSTR,LPDWORD);
+typedef BOOL   (WINAPI *FAvRevertMmThreadCharacteristics)(HANDLE);
+typedef BOOL   (WINAPI *FAvSetMmThreadPriority)          (HANDLE,AVRT_PRIORITY);
+static HMODULE hDInputDLL = 0;
+FAvRtCreateThreadOrderingGroup   pAvRtCreateThreadOrderingGroup = NULL;
+FAvRtDeleteThreadOrderingGroup   pAvRtDeleteThreadOrderingGroup = NULL;
+FAvRtWaitOnThreadOrderingGroup   pAvRtWaitOnThreadOrderingGroup = NULL;
+FAvSetMmThreadCharacteristics    pAvSetMmThreadCharacteristics = NULL;
+FAvRevertMmThreadCharacteristics pAvRevertMmThreadCharacteristics = NULL;
+FAvSetMmThreadPriority           pAvSetMmThreadPriority = NULL;
+#endif
+
+#define _GetProc(fun, type, name)  {                                                        \
+                                        fun = (type) GetProcAddress(hDInputDLL,name);       \
+                                        if (fun == NULL) {                                  \
+                                            PRINT(("GetProcAddr failed for %s" ,name));     \
+                                            return FALSE;                                   \
+                                        }                                                   \
+                                    }                                                       \
+
+// ------------------------------------------------------------------------------------------
+/* prototypes for functions declared in this file */
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+PaError PaWasapi_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiIndex index );
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+// dummy entry point for other compilers and sdks
+// currently built using RC1 SDK (5600)
+//#if _MSC_VER < 1400
+//PaError PaWasapi_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiIndex hostApiIndex )
+//{
+    //return paNoError;
+//}
+//#else
+
+// ------------------------------------------------------------------------------------------
+static void Terminate( struct PaUtilHostApiRepresentation *hostApi );
+static PaError IsFormatSupported( struct PaUtilHostApiRepresentation *hostApi,
+                                  const PaStreamParameters *inputParameters,
+                                  const PaStreamParameters *outputParameters,
+                                  double sampleRate );
+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* stream );
+static PaError StartStream( PaStream *stream );
+static PaError StopStream( PaStream *stream );
+static PaError AbortStream( PaStream *stream );
+static PaError IsStreamStopped( PaStream *s );
+static PaError IsStreamActive( PaStream *stream );
+static PaTime GetStreamTime( PaStream *stream );
+static double GetStreamCpuLoad( PaStream* stream );
+static PaError ReadStream( PaStream* stream, void *buffer, unsigned long frames );
+static PaError WriteStream( PaStream* stream, const void *buffer, unsigned long frames );
+static signed long GetStreamReadAvailable( PaStream* stream );
+static signed long GetStreamWriteAvailable( PaStream* stream );
+
+// ------------------------------------------------------------------------------------------
+/*
+ These are fields that can be gathered from IDevice and IAudioDevice PRIOR to Initialize, and
+ done in first pass i assume that neither of these will cause the Driver to "load", but again,
+ who knows how they implement their stuff
+ */
+typedef struct PaWasapiDeviceInfo
+{
+    // Device
+#ifndef PA_WINRT
+    IMMDevice *device;
+#endif
+
+	// from GetId
+    WCHAR szDeviceID[MAX_STR_LEN];
+
+	// from GetState
+    DWORD state;
+
+    // Fields filled from IAudioDevice (_prior_ to Initialize)
+    // from GetDevicePeriod(
+    REFERENCE_TIME DefaultDevicePeriod;
+    REFERENCE_TIME MinimumDevicePeriod;
+
+	// Default format (setup through Control Panel by user)
+	WAVEFORMATEXTENSIBLE DefaultFormat;
+
+    // Fields filled from IMMEndpoint'sGetDataFlow
+    EDataFlow flow;
+
+	// Formfactor
+	EndpointFormFactor formFactor;
+}
+PaWasapiDeviceInfo;
+
+// ------------------------------------------------------------------------------------------
+/* PaWasapiHostApiRepresentation - host api datastructure specific to this implementation */
+typedef struct
+{
+    PaUtilHostApiRepresentation inheritedHostApiRep;
+    PaUtilStreamInterface       callbackStreamInterface;
+    PaUtilStreamInterface       blockingStreamInterface;
+
+    PaUtilAllocationGroup      *allocations;
+
+    /* implementation specific data goes here */
+
+    PaWinUtilComInitializationResult comInitializationResult;
+
+    //in case we later need the synch
+#ifndef PA_WINRT
+    IMMDeviceEnumerator *enumerator;
+#endif
+
+    //this is the REAL number of devices, whether they are usefull to PA or not!
+    UINT32 deviceCount;
+
+    WCHAR defaultRenderer [MAX_STR_LEN];
+    WCHAR defaultCapturer [MAX_STR_LEN];
+
+    PaWasapiDeviceInfo *devInfo;
+
+	// Is true when WOW64 Vista/7 Workaround is needed
+	BOOL useWOW64Workaround;
+}
+PaWasapiHostApiRepresentation;
+
+// ------------------------------------------------------------------------------------------
+/* PaWasapiAudioClientParams - audio client parameters */
+typedef struct PaWasapiAudioClientParams
+{
+	PaWasapiDeviceInfo *device_info;
+	PaStreamParameters  stream_params;
+	PaWasapiStreamInfo  wasapi_params;
+	UINT32              frames_per_buffer;
+	double              sample_rate;
+	BOOL                blocking;
+	BOOL                full_duplex;
+	BOOL                wow64_workaround;
+}
+PaWasapiAudioClientParams;
+
+// ------------------------------------------------------------------------------------------
+/* PaWasapiStream - a stream data structure specifically for this implementation */
+typedef struct PaWasapiSubStream
+{
+    IAudioClient        *clientParent;
+#ifndef PA_WINRT
+	IStream				*clientStream;
+#endif
+	IAudioClient		*clientProc;
+
+    WAVEFORMATEXTENSIBLE wavex;
+    UINT32               bufferSize;
+    REFERENCE_TIME       deviceLatency;
+    REFERENCE_TIME       period;
+	double				 latencySeconds;
+    UINT32				 framesPerHostCallback;
+	AUDCLNT_SHAREMODE    shareMode;
+	UINT32               streamFlags; // AUDCLNT_STREAMFLAGS_EVENTCALLBACK, ...
+	UINT32               flags;
+	PaWasapiAudioClientParams params; //!< parameters
+
+	// Buffers
+	UINT32               buffers;			//!< number of buffers used (from host side)
+	UINT32               framesPerBuffer;	//!< number of frames per 1 buffer
+	BOOL                 userBufferAndHostMatch;
+
+	// Used for Mono >> Stereo workaround, if driver does not support it
+	// (in Exclusive mode WASAPI usually refuses to operate with Mono (1-ch)
+	void                *monoBuffer;	 //!< pointer to buffer
+	UINT32               monoBufferSize; //!< buffer size in bytes
+	MixMonoToStereoF     monoMixer;		 //!< pointer to mixer function
+
+	PaUtilRingBuffer    *tailBuffer;       //!< buffer with trailing sample for blocking mode operations (only for Input)
+	void                *tailBufferMemory; //!< tail buffer memory region
+}
+PaWasapiSubStream;
+
+// ------------------------------------------------------------------------------------------
+/* PaWasapiHostProcessor - redirects processing data */
+typedef struct PaWasapiHostProcessor
+{
+    PaWasapiHostProcessorCallback processor;
+    void *userData;
+}
+PaWasapiHostProcessor;
+
+// ------------------------------------------------------------------------------------------
+typedef struct PaWasapiStream
+{
+	/* IMPLEMENT ME: rename this */
+    PaUtilStreamRepresentation streamRepresentation;
+    PaUtilCpuLoadMeasurer      cpuLoadMeasurer;
+    PaUtilBufferProcessor      bufferProcessor;
+
+    // input
+	PaWasapiSubStream          in;
+    IAudioCaptureClient       *captureClientParent;
+#ifndef PA_WINRT
+	IStream                   *captureClientStream;
+#endif
+	IAudioCaptureClient       *captureClient;
+    IAudioEndpointVolume      *inVol;
+
+	// output
+	PaWasapiSubStream          out;
+    IAudioRenderClient        *renderClientParent;
+#ifndef PA_WINRT
+	IStream                   *renderClientStream;
+#endif
+	IAudioRenderClient        *renderClient;
+	IAudioEndpointVolume      *outVol;
+
+	// event handles for event-driven processing mode
+	HANDLE event[S_COUNT];
+
+	// buffer mode
+	PaUtilHostBufferSizeMode bufferMode;
+
+	// must be volatile to avoid race condition on user query while
+	// thread is being started
+    volatile BOOL running;
+
+    PA_THREAD_ID dwThreadId;
+    HANDLE hThread;
+	HANDLE hCloseRequest;
+	HANDLE hThreadStart;        //!< signalled by thread on start
+	HANDLE hThreadExit;         //!< signalled by thread on exit
+	HANDLE hBlockingOpStreamRD;
+	HANDLE hBlockingOpStreamWR;
+
+    // Host callback Output overrider
+	PaWasapiHostProcessor hostProcessOverrideOutput;
+
+    // Host callback Input overrider
+	PaWasapiHostProcessor hostProcessOverrideInput;
+
+	// Defines blocking/callback interface used
+	BOOL bBlocking;
+
+	// Av Task (MM thread management)
+	HANDLE hAvTask;
+
+	// Thread priority level
+	PaWasapiThreadPriority nThreadPriority;
+}
+PaWasapiStream;
+
+// COM marshaling
+static HRESULT MarshalSubStreamComPointers(PaWasapiSubStream *substream);
+static HRESULT MarshalStreamComPointers(PaWasapiStream *stream);
+static HRESULT UnmarshalSubStreamComPointers(PaWasapiSubStream *substream);
+static HRESULT UnmarshalStreamComPointers(PaWasapiStream *stream);
+static void ReleaseUnmarshaledSubComPointers(PaWasapiSubStream *substream);
+static void ReleaseUnmarshaledComPointers(PaWasapiStream *stream);
+
+// Local stream methods
+static void _StreamOnStop(PaWasapiStream *stream);
+static void _StreamFinish(PaWasapiStream *stream);
+static void _StreamCleanup(PaWasapiStream *stream);
+static HRESULT _PollGetOutputFramesAvailable(PaWasapiStream *stream, UINT32 *available);
+static HRESULT _PollGetInputFramesAvailable(PaWasapiStream *stream, UINT32 *available);
+static void *PaWasapi_ReallocateMemory(void *ptr, size_t size);
+static void PaWasapi_FreeMemory(void *ptr);
+
+// Local statics
+
+// ------------------------------------------------------------------------------------------
+#define LogHostError(HRES) __LogHostError(HRES, __FUNCTION__, __FILE__, __LINE__)
+static HRESULT __LogHostError(HRESULT res, const char *func, const char *file, int line)
+{
+    const char *text = NULL;
+    switch (res)
+	{
+	case S_OK: return res;
+	case E_POINTER                              :text ="E_POINTER"; break;
+	case E_INVALIDARG                           :text ="E_INVALIDARG"; break;
+
+	case AUDCLNT_E_NOT_INITIALIZED              :text ="AUDCLNT_E_NOT_INITIALIZED"; break;
+	case AUDCLNT_E_ALREADY_INITIALIZED          :text ="AUDCLNT_E_ALREADY_INITIALIZED"; break;
+	case AUDCLNT_E_WRONG_ENDPOINT_TYPE          :text ="AUDCLNT_E_WRONG_ENDPOINT_TYPE"; break;
+	case AUDCLNT_E_DEVICE_INVALIDATED           :text ="AUDCLNT_E_DEVICE_INVALIDATED"; break;
+	case AUDCLNT_E_NOT_STOPPED                  :text ="AUDCLNT_E_NOT_STOPPED"; break;
+	case AUDCLNT_E_BUFFER_TOO_LARGE             :text ="AUDCLNT_E_BUFFER_TOO_LARGE"; break;
+	case AUDCLNT_E_OUT_OF_ORDER                 :text ="AUDCLNT_E_OUT_OF_ORDER"; break;
+	case AUDCLNT_E_UNSUPPORTED_FORMAT           :text ="AUDCLNT_E_UNSUPPORTED_FORMAT"; break;
+	case AUDCLNT_E_INVALID_SIZE                 :text ="AUDCLNT_E_INVALID_SIZE"; break;
+	case AUDCLNT_E_DEVICE_IN_USE                :text ="AUDCLNT_E_DEVICE_IN_USE"; break;
+	case AUDCLNT_E_BUFFER_OPERATION_PENDING     :text ="AUDCLNT_E_BUFFER_OPERATION_PENDING"; break;
+	case AUDCLNT_E_THREAD_NOT_REGISTERED        :text ="AUDCLNT_E_THREAD_NOT_REGISTERED"; break;
+	case AUDCLNT_E_EXCLUSIVE_MODE_NOT_ALLOWED   :text ="AUDCLNT_E_EXCLUSIVE_MODE_NOT_ALLOWED"; break;
+	case AUDCLNT_E_ENDPOINT_CREATE_FAILED       :text ="AUDCLNT_E_ENDPOINT_CREATE_FAILED"; break;
+	case AUDCLNT_E_SERVICE_NOT_RUNNING          :text ="AUDCLNT_E_SERVICE_NOT_RUNNING"; break;
+	case AUDCLNT_E_EVENTHANDLE_NOT_EXPECTED     :text ="AUDCLNT_E_EVENTHANDLE_NOT_EXPECTED"; break;
+	case AUDCLNT_E_EXCLUSIVE_MODE_ONLY          :text ="AUDCLNT_E_EXCLUSIVE_MODE_ONLY"; break;
+	case AUDCLNT_E_BUFDURATION_PERIOD_NOT_EQUAL :text ="AUDCLNT_E_BUFDURATION_PERIOD_NOT_EQUAL"; break;
+	case AUDCLNT_E_EVENTHANDLE_NOT_SET          :text ="AUDCLNT_E_EVENTHANDLE_NOT_SET"; break;
+	case AUDCLNT_E_INCORRECT_BUFFER_SIZE        :text ="AUDCLNT_E_INCORRECT_BUFFER_SIZE"; break;
+	case AUDCLNT_E_BUFFER_SIZE_ERROR            :text ="AUDCLNT_E_BUFFER_SIZE_ERROR"; break;
+	case AUDCLNT_E_CPUUSAGE_EXCEEDED            :text ="AUDCLNT_E_CPUUSAGE_EXCEEDED"; break;
+	case AUDCLNT_E_BUFFER_ERROR					:text ="AUDCLNT_E_BUFFER_ERROR"; break;
+	case AUDCLNT_E_BUFFER_SIZE_NOT_ALIGNED		:text ="AUDCLNT_E_BUFFER_SIZE_NOT_ALIGNED"; break;
+	case AUDCLNT_E_INVALID_DEVICE_PERIOD		:text ="AUDCLNT_E_INVALID_DEVICE_PERIOD"; break;
+
+	case AUDCLNT_S_BUFFER_EMPTY                 :text ="AUDCLNT_S_BUFFER_EMPTY"; break;
+	case AUDCLNT_S_THREAD_ALREADY_REGISTERED    :text ="AUDCLNT_S_THREAD_ALREADY_REGISTERED"; break;
+	case AUDCLNT_S_POSITION_STALLED				:text ="AUDCLNT_S_POSITION_STALLED"; break;
+
+	// other windows common errors:
+	case CO_E_NOTINITIALIZED                    :text ="CO_E_NOTINITIALIZED: you must call CoInitialize() before Pa_OpenStream()"; break;
+
+	default:
+		text = "UNKNOWN ERROR";
+    }
+	PRINT(("WASAPI ERROR HRESULT: 0x%X : %s\n [FUNCTION: %s FILE: %s {LINE: %d}]\n", res, text, func, file, line));
+	PA_SKELETON_SET_LAST_HOST_ERROR(res, text);
+	return res;
+}
+
+// ------------------------------------------------------------------------------------------
+#define LogPaError(PAERR) __LogPaError(PAERR, __FUNCTION__, __FILE__, __LINE__)
+static PaError __LogPaError(PaError err, const char *func, const char *file, int line)
+{
+	if (err == paNoError)
+		return err;
+	PRINT(("WASAPI ERROR PAERROR: %i : %s\n [FUNCTION: %s FILE: %s {LINE: %d}]\n", err, Pa_GetErrorText(err), func, file, line));
+	return err;
+}
+
+// ------------------------------------------------------------------------------------------
+/*! \class ThreadSleepScheduler
+           Allows to emulate thread sleep of less than 1 millisecond under Windows. Scheduler
+		   calculates number of times the thread must run untill next sleep of 1 millisecond.
+		   It does not make thread sleeping for real number of microseconds but rather controls
+		   how many of imaginary microseconds the thread task can allow thread to sleep.
+*/
+typedef struct ThreadIdleScheduler
+{
+	UINT32 m_idle_microseconds; //!< number of microseconds to sleep
+	UINT32 m_next_sleep;        //!< next sleep round
+	UINT32 m_i;					//!< current round iterator position
+	UINT32 m_resolution;		//!< resolution in number of milliseconds
+}
+ThreadIdleScheduler;
+//! Setup scheduler.
+static void ThreadIdleScheduler_Setup(ThreadIdleScheduler *sched, UINT32 resolution, UINT32 microseconds)
+{
+	assert(microseconds != 0);
+	assert(resolution != 0);
+	assert((resolution * 1000) >= microseconds);
+
+	memset(sched, 0, sizeof(*sched));
+
+	sched->m_idle_microseconds = microseconds;
+	sched->m_resolution        = resolution;
+	sched->m_next_sleep        = (resolution * 1000) / microseconds;
+}
+//! Iterate and check if can sleep.
+static UINT32 ThreadIdleScheduler_NextSleep(ThreadIdleScheduler *sched)
+{
+	// advance and check if thread can sleep
+	if (++ sched->m_i == sched->m_next_sleep)
+	{
+		sched->m_i = 0;
+		return sched->m_resolution;
+	}
+	return 0;
+}
+
+// ------------------------------------------------------------------------------------------
+/*static double nano100ToMillis(REFERENCE_TIME ref)
+{
+    //  1 nano = 0.000000001 seconds
+    //100 nano = 0.0000001   seconds
+    //100 nano = 0.0001   milliseconds
+    return ((double)ref)*0.0001;
+}*/
+
+// ------------------------------------------------------------------------------------------
+static double nano100ToSeconds(REFERENCE_TIME ref)
+{
+    //  1 nano = 0.000000001 seconds
+    //100 nano = 0.0000001   seconds
+    //100 nano = 0.0001   milliseconds
+    return ((double)ref)*0.0000001;
+}
+
+// ------------------------------------------------------------------------------------------
+/*static REFERENCE_TIME MillisTonano100(double ref)
+{
+    //  1 nano = 0.000000001 seconds
+    //100 nano = 0.0000001   seconds
+    //100 nano = 0.0001   milliseconds
+    return (REFERENCE_TIME)(ref/0.0001);
+}*/
+
+// ------------------------------------------------------------------------------------------
+static REFERENCE_TIME SecondsTonano100(double ref)
+{
+    //  1 nano = 0.000000001 seconds
+    //100 nano = 0.0000001   seconds
+    //100 nano = 0.0001   milliseconds
+    return (REFERENCE_TIME)(ref/0.0000001);
+}
+
+// ------------------------------------------------------------------------------------------
+// Makes Hns period from frames and sample rate
+static REFERENCE_TIME MakeHnsPeriod(UINT32 nFrames, DWORD nSamplesPerSec)
+{
+	return (REFERENCE_TIME)((10000.0 * 1000 / nSamplesPerSec * nFrames) + 0.5);
+}
+
+// ------------------------------------------------------------------------------------------
+// Converts PaSampleFormat to bits per sample value
+static WORD PaSampleFormatToBitsPerSample(PaSampleFormat format_id)
+{
+	switch (format_id & ~paNonInterleaved)
+	{
+		case paFloat32:
+		case paInt32: return 32;
+		case paInt24: return 24;
+		case paInt16: return 16;
+		case paInt8:
+		case paUInt8: return 8;
+	}
+	return 0;
+}
+
+// ------------------------------------------------------------------------------------------
+// Converts PaSampleFormat to bits per sample value
+/*static WORD PaSampleFormatToBytesPerSample(PaSampleFormat format_id)
+{
+	return PaSampleFormatToBitsPerSample(format_id) >> 3; // 'bits/8'
+}*/
+
+// ------------------------------------------------------------------------------------------
+// Converts Hns period into number of frames
+static UINT32 MakeFramesFromHns(REFERENCE_TIME hnsPeriod, UINT32 nSamplesPerSec)
+{
+    UINT32 nFrames = (UINT32)(	// frames =
+        1.0 * hnsPeriod *		// hns *
+        nSamplesPerSec /		// (frames / s) /
+        1000 /					// (ms / s) /
+        10000					// (hns / s) /
+        + 0.5					// rounding
+    );
+	return nFrames;
+}
+
+// Aligning function type
+typedef UINT32 (*ALIGN_FUNC) (UINT32 v, UINT32 align);
+
+// ------------------------------------------------------------------------------------------
+// Aligns 'v' backwards
+static UINT32 ALIGN_BWD(UINT32 v, UINT32 align)
+{
+	return ((v - (align ? v % align : 0)));
+}
+
+// ------------------------------------------------------------------------------------------
+// Aligns 'v' forward
+static UINT32 ALIGN_FWD(UINT32 v, UINT32 align)
+{
+	UINT32 remainder = (align ? (v % align) : 0);
+	if (remainder == 0)
+		return v;
+	return v + (align - remainder);
+}
+
+// ------------------------------------------------------------------------------------------
+// Get next value power of 2
+UINT32 ALIGN_NEXT_POW2(UINT32 v)
+{
+	UINT32 v2 = 1;
+	while (v > (v2 <<= 1)) { }
+	v = v2;
+	return v;
+}
+
+// ------------------------------------------------------------------------------------------
+// Aligns WASAPI buffer to 128 byte packet boundary. HD Audio will fail to play if buffer
+// is misaligned. This problem was solved in Windows 7 were AUDCLNT_E_BUFFER_SIZE_NOT_ALIGNED
+// is thrown although we must align for Vista anyway.
+static UINT32 AlignFramesPerBuffer(UINT32 nFrames, UINT32 nSamplesPerSec, UINT32 nBlockAlign,
+								   ALIGN_FUNC pAlignFunc)
+{
+#define HDA_PACKET_SIZE (128)
+
+	long frame_bytes = nFrames * nBlockAlign;
+	long packets;
+	(void)nSamplesPerSec;
+
+	// align to packet size
+	frame_bytes  = pAlignFunc(frame_bytes, HDA_PACKET_SIZE); // use ALIGN_FWD if bigger but safer period is more desired
+
+	// atlest 1 frame must be available
+	if (frame_bytes < HDA_PACKET_SIZE)
+		frame_bytes = HDA_PACKET_SIZE;
+
+	nFrames      = frame_bytes / nBlockAlign;
+	packets      = frame_bytes / HDA_PACKET_SIZE;
+
+	frame_bytes = packets * HDA_PACKET_SIZE;
+	nFrames     = frame_bytes / nBlockAlign;
+
+	return nFrames;
+
+#undef HDA_PACKET_SIZE
+}
+
+// ------------------------------------------------------------------------------------------
+static UINT32 GetFramesSleepTime(UINT32 nFrames, UINT32 nSamplesPerSec)
+{
+	REFERENCE_TIME nDuration;
+	if (nSamplesPerSec == 0)
+		return 0;
+#define REFTIMES_PER_SEC  10000000
+#define REFTIMES_PER_MILLISEC  10000
+	// Calculate the actual duration of the allocated buffer.
+	nDuration = (REFERENCE_TIME)((double)REFTIMES_PER_SEC * nFrames / nSamplesPerSec);
+	return (UINT32)(nDuration/REFTIMES_PER_MILLISEC/2);
+}
+
+// ------------------------------------------------------------------------------------------
+static UINT32 GetFramesSleepTimeMicroseconds(UINT32 nFrames, UINT32 nSamplesPerSec)
+{
+	REFERENCE_TIME nDuration;
+	if (nSamplesPerSec == 0)
+		return 0;
+#define REFTIMES_PER_SEC  10000000
+#define REFTIMES_PER_MILLISEC  10000
+	// Calculate the actual duration of the allocated buffer.
+	nDuration = (REFERENCE_TIME)((double)REFTIMES_PER_SEC * nFrames / nSamplesPerSec);
+	return (UINT32)(nDuration/10/2);
+}
+
+// ------------------------------------------------------------------------------------------
+#ifndef PA_WINRT
+static BOOL SetupAVRT()
+{
+    hDInputDLL = LoadLibraryA("avrt.dll");
+    if (hDInputDLL == NULL)
+        return FALSE;
+
+    _GetProc(pAvRtCreateThreadOrderingGroup,  FAvRtCreateThreadOrderingGroup,  "AvRtCreateThreadOrderingGroup");
+    _GetProc(pAvRtDeleteThreadOrderingGroup,  FAvRtDeleteThreadOrderingGroup,  "AvRtDeleteThreadOrderingGroup");
+    _GetProc(pAvRtWaitOnThreadOrderingGroup,  FAvRtWaitOnThreadOrderingGroup,  "AvRtWaitOnThreadOrderingGroup");
+    _GetProc(pAvSetMmThreadCharacteristics,   FAvSetMmThreadCharacteristics,   "AvSetMmThreadCharacteristicsA");
+	_GetProc(pAvRevertMmThreadCharacteristics,FAvRevertMmThreadCharacteristics,"AvRevertMmThreadCharacteristics");
+    _GetProc(pAvSetMmThreadPriority,          FAvSetMmThreadPriority,          "AvSetMmThreadPriority");
+
+	return pAvRtCreateThreadOrderingGroup &&
+		pAvRtDeleteThreadOrderingGroup &&
+		pAvRtWaitOnThreadOrderingGroup &&
+		pAvSetMmThreadCharacteristics &&
+		pAvRevertMmThreadCharacteristics &&
+		pAvSetMmThreadPriority;
+}
+#endif
+
+// ------------------------------------------------------------------------------------------
+static void CloseAVRT()
+{
+#ifndef PA_WINRT
+	if (hDInputDLL != NULL)
+		FreeLibrary(hDInputDLL);
+	hDInputDLL = NULL;
+#endif
+}
+
+// ------------------------------------------------------------------------------------------
+static BOOL IsWow64()
+{
+#ifndef PA_WINRT
+
+	// http://msdn.microsoft.com/en-us/library/ms684139(VS.85).aspx
+
+	typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL);
+	LPFN_ISWOW64PROCESS fnIsWow64Process;
+
+    BOOL bIsWow64 = FALSE;
+
+    // IsWow64Process is not available on all supported versions of Windows.
+    // Use GetModuleHandle to get a handle to the DLL that contains the function
+    // and GetProcAddress to get a pointer to the function if available.
+
+    fnIsWow64Process = (LPFN_ISWOW64PROCESS) GetProcAddress(
+        GetModuleHandleA("kernel32"), "IsWow64Process");
+
+    if (fnIsWow64Process == NULL)
+		return FALSE;
+
+    if (!fnIsWow64Process(GetCurrentProcess(), &bIsWow64))
+		return FALSE;
+
+    return bIsWow64;
+
+#else
+
+	return FALSE;
+
+#endif
+}
+
+// ------------------------------------------------------------------------------------------
+typedef enum EWindowsVersion
+{
+	WINDOWS_UNKNOWN = 0,
+	WINDOWS_VISTA_SERVER2008,
+	WINDOWS_7_SERVER2008R2,
+	WINDOWS_8_SERVER2012,
+	WINDOWS_8_1_SERVER2012R2,
+	WINDOWS_10_SERVER2016,
+	WINDOWS_FUTURE
+}
+EWindowsVersion;
+// Alternative way for checking Windows version (allows to check version on Windows 8.1 and up)
+#ifndef PA_WINRT
+static BOOL IsWindowsVersionOrGreater(WORD wMajorVersion, WORD wMinorVersion, WORD wServicePackMajor)
+{
+	typedef ULONGLONG (NTAPI *LPFN_VERSETCONDITIONMASK)(ULONGLONG ConditionMask, DWORD TypeMask, BYTE Condition);
+	typedef BOOL (WINAPI *LPFN_VERIFYVERSIONINFO)(LPOSVERSIONINFOEXA lpVersionInformation, DWORD dwTypeMask, DWORDLONG dwlConditionMask);
+
+	LPFN_VERSETCONDITIONMASK fnVerSetConditionMask;
+	LPFN_VERIFYVERSIONINFO fnVerifyVersionInfo;
+	OSVERSIONINFOEXA osvi = { sizeof(osvi), 0, 0, 0, 0, {0}, 0, 0 };
+	DWORDLONG dwlConditionMask;
+
+	fnVerSetConditionMask = (LPFN_VERSETCONDITIONMASK)GetProcAddress(GetModuleHandleA("kernel32"), "VerSetConditionMask");
+	fnVerifyVersionInfo = (LPFN_VERIFYVERSIONINFO)GetProcAddress(GetModuleHandleA("kernel32"), "VerifyVersionInfoA");
+
+	if ((fnVerSetConditionMask == NULL) || (fnVerifyVersionInfo == NULL))
+		return FALSE;
+
+	dwlConditionMask = fnVerSetConditionMask(
+		fnVerSetConditionMask(
+			fnVerSetConditionMask(
+				0, VER_MAJORVERSION,     VER_GREATER_EQUAL),
+				   VER_MINORVERSION,     VER_GREATER_EQUAL),
+				   VER_SERVICEPACKMAJOR, VER_GREATER_EQUAL);
+
+	osvi.dwMajorVersion    = wMajorVersion;
+	osvi.dwMinorVersion    = wMinorVersion;
+	osvi.wServicePackMajor = wServicePackMajor;
+
+	return (fnVerifyVersionInfo(&osvi, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR, dwlConditionMask) != FALSE);
+}
+#endif
+// Get Windows version
+static EWindowsVersion GetWindowsVersion()
+{
+#ifndef PA_WINRT
+	static EWindowsVersion version = WINDOWS_UNKNOWN;
+
+	if (version == WINDOWS_UNKNOWN)
+	{
+		DWORD dwVersion = 0;
+		DWORD dwMajorVersion = 0;
+		DWORD dwMinorVersion = 0;
+		DWORD dwBuild = 0;
+
+		typedef DWORD (WINAPI *LPFN_GETVERSION)(VOID);
+		LPFN_GETVERSION fnGetVersion;
+
+		fnGetVersion = (LPFN_GETVERSION)GetProcAddress(GetModuleHandleA("kernel32"), "GetVersion");
+		if (fnGetVersion != NULL)
+		{
+			PRINT(("WASAPI: getting Windows version with GetVersion()\n"));
+
+			dwVersion = fnGetVersion();
+
+			// Get the Windows version
+			dwMajorVersion = (DWORD)(LOBYTE(LOWORD(dwVersion)));
+			dwMinorVersion = (DWORD)(HIBYTE(LOWORD(dwVersion)));
+
+			// Get the build number
+			if (dwVersion < 0x80000000)
+				dwBuild = (DWORD)(HIWORD(dwVersion));
+
+			switch (dwMajorVersion)
+			{
+			case 0:
+			case 1:
+			case 2:
+			case 3:
+			case 4:
+			case 5:
+				break; // skip lower
+			case 6:
+				switch (dwMinorVersion)
+				{
+				case 0:  version = WINDOWS_VISTA_SERVER2008;	break;
+				case 1:	 version = WINDOWS_7_SERVER2008R2;		break;
+				case 2:	 version = WINDOWS_8_SERVER2012;  		break;
+				case 3:	 version = WINDOWS_8_1_SERVER2012R2;	break;
+				default: version = WINDOWS_FUTURE;				break;
+				}
+				break;
+			case 10:
+				switch (dwMinorVersion)
+				{
+				case 0:	 version = WINDOWS_10_SERVER2016;		break;
+				default: version = WINDOWS_FUTURE;				break;
+				}
+				break;
+			default:
+				version = WINDOWS_FUTURE;
+				break;
+			}
+		}
+		else
+		{
+			PRINT(("WASAPI: getting Windows version with VerifyVersionInfo()\n"));
+
+			if (IsWindowsVersionOrGreater(10, 0, 0))
+				version = WINDOWS_10_SERVER2016;
+			else
+			if (IsWindowsVersionOrGreater(6, 3, 0))
+				version = WINDOWS_8_1_SERVER2012R2;
+			else
+			if (IsWindowsVersionOrGreater(6, 2, 0))
+				version = WINDOWS_8_SERVER2012;
+			else
+			if (IsWindowsVersionOrGreater(6, 1, 0))
+				version = WINDOWS_7_SERVER2008R2;
+			else
+			if (IsWindowsVersionOrGreater(6, 0, 0))
+				version = WINDOWS_VISTA_SERVER2008;
+			else
+				version = WINDOWS_FUTURE;
+		}
+
+		PRINT(("WASAPI: Windows version = %d\n", version));
+	}
+
+	return version;
+#else
+	return WINDOWS_8_SERVER2012;
+#endif
+}
+
+// ------------------------------------------------------------------------------------------
+static BOOL UseWOW64Workaround()
+{
+	// note: WOW64 bug is common to Windows Vista x64, thus we fall back to safe Poll-driven
+	//       method. Windows 7 x64 seems has WOW64 bug fixed.
+
+	return (IsWow64() && (GetWindowsVersion() == WINDOWS_VISTA_SERVER2008));
+}
+
+// ------------------------------------------------------------------------------------------
+static UINT32 GetAudioClientVersion()
+{
+	if (GetWindowsVersion() >= WINDOWS_10_SERVER2016)
+		return 3;
+	else
+	if (GetWindowsVersion() >= WINDOWS_8_SERVER2012)
+		return 2;
+
+	return 1;
+}
+
+// ------------------------------------------------------------------------------------------
+static const IID *GetAudioClientIID()
+{
+	static const IID *cli_iid = NULL;
+	if (cli_iid == NULL)
+	{
+		UINT32 cli_version = GetAudioClientVersion();
+		if (cli_version <= 1)
+		{
+			cli_iid = &pa_IID_IAudioClient;
+		}
+		else
+		{
+			switch (cli_version)
+			{
+			case 3:  cli_iid = &pa_IID_IAudioClient2; cli_version = 2; break; // use IAudioClient2 for Windows 10+ until IAudioClient3 functions are required
+			default: cli_iid = &pa_IID_IAudioClient2; cli_version = 2; break;
+			}
+		}
+
+		PRINT(("WASAPI: IAudioClient version = %d\n", cli_version));
+	}
+
+	return cli_iid;
+}
+
+// ------------------------------------------------------------------------------------------
+typedef enum EMixerDir { MIX_DIR__1TO2, MIX_DIR__2TO1, MIX_DIR__2TO1_L } EMixerDir;
+
+// ------------------------------------------------------------------------------------------
+#define _WASAPI_MONO_TO_STEREO_MIXER_1_TO_2(TYPE)\
+	TYPE * __restrict to   = __to;\
+	TYPE * __restrict from = __from;\
+	TYPE * __restrict end  = from + count;\
+	while (from != end)\
+	{\
+		*to ++ = *from;\
+		*to ++ = *from;\
+		++ from;\
+	}
+
+// ------------------------------------------------------------------------------------------
+#define _WASAPI_MONO_TO_STEREO_MIXER_2_TO_1_FLT32(TYPE)\
+	TYPE * __restrict to   = (TYPE *)__to;\
+	TYPE * __restrict from = (TYPE *)__from;\
+	TYPE * __restrict end  = to + count;\
+	while (to != end)\
+	{\
+		*to ++ = (TYPE)((float)(from[0] + from[1]) * 0.5f);\
+		from += 2;\
+	}
+
+// ------------------------------------------------------------------------------------------
+#define _WASAPI_MONO_TO_STEREO_MIXER_2_TO_1_INT32(TYPE)\
+	TYPE * __restrict to   = (TYPE *)__to;\
+	TYPE * __restrict from = (TYPE *)__from;\
+	TYPE * __restrict end  = to + count;\
+	while (to != end)\
+	{\
+		*to ++ = (TYPE)(((INT32)from[0] + (INT32)from[1]) >> 1);\
+		from += 2;\
+	}
+
+// ------------------------------------------------------------------------------------------
+#define _WASAPI_MONO_TO_STEREO_MIXER_2_TO_1_INT64(TYPE)\
+	TYPE * __restrict to   = (TYPE *)__to;\
+	TYPE * __restrict from = (TYPE *)__from;\
+	TYPE * __restrict end  = to + count;\
+	while (to != end)\
+	{\
+		*to ++ = (TYPE)(((INT64)from[0] + (INT64)from[1]) >> 1);\
+		from += 2;\
+	}
+
+// ------------------------------------------------------------------------------------------
+#define _WASAPI_MONO_TO_STEREO_MIXER_2_TO_1_L(TYPE)\
+	TYPE * __restrict to   = (TYPE *)__to;\
+	TYPE * __restrict from = (TYPE *)__from;\
+	TYPE * __restrict end  = to + count;\
+	while (to != end)\
+	{\
+		*to ++ = from[0];\
+		from += 2;\
+	}
+
+// ------------------------------------------------------------------------------------------
+static void _MixMonoToStereo_1TO2_8(void *__to, void *__from, UINT32 count) { _WASAPI_MONO_TO_STEREO_MIXER_1_TO_2(BYTE); }
+static void _MixMonoToStereo_1TO2_16(void *__to, void *__from, UINT32 count) { _WASAPI_MONO_TO_STEREO_MIXER_1_TO_2(short); }
+static void _MixMonoToStereo_1TO2_24(void *__to, void *__from, UINT32 count) { _WASAPI_MONO_TO_STEREO_MIXER_1_TO_2(int); /* !!! int24 data is contained in 32-bit containers*/ }
+static void _MixMonoToStereo_1TO2_32(void *__to, void *__from, UINT32 count) { _WASAPI_MONO_TO_STEREO_MIXER_1_TO_2(int); }
+static void _MixMonoToStereo_1TO2_32f(void *__to, void *__from, UINT32 count) { _WASAPI_MONO_TO_STEREO_MIXER_1_TO_2(float); }
+
+// ------------------------------------------------------------------------------------------
+static void _MixMonoToStereo_2TO1_8(void *__to, void *__from, UINT32 count) { _WASAPI_MONO_TO_STEREO_MIXER_2_TO_1_INT32(BYTE); }
+static void _MixMonoToStereo_2TO1_16(void *__to, void *__from, UINT32 count) { _WASAPI_MONO_TO_STEREO_MIXER_2_TO_1_INT32(short); }
+static void _MixMonoToStereo_2TO1_24(void *__to, void *__from, UINT32 count) { _WASAPI_MONO_TO_STEREO_MIXER_2_TO_1_INT32(int); /* !!! int24 data is contained in 32-bit containers*/ }
+static void _MixMonoToStereo_2TO1_32(void *__to, void *__from, UINT32 count) { _WASAPI_MONO_TO_STEREO_MIXER_2_TO_1_INT64(int); }
+static void _MixMonoToStereo_2TO1_32f(void *__to, void *__from, UINT32 count) { _WASAPI_MONO_TO_STEREO_MIXER_2_TO_1_FLT32(float); }
+
+// ------------------------------------------------------------------------------------------
+static void _MixMonoToStereo_2TO1_8_L(void *__to, void *__from, UINT32 count) { _WASAPI_MONO_TO_STEREO_MIXER_2_TO_1_L(BYTE); }
+static void _MixMonoToStereo_2TO1_16_L(void *__to, void *__from, UINT32 count) { _WASAPI_MONO_TO_STEREO_MIXER_2_TO_1_L(short); }
+static void _MixMonoToStereo_2TO1_24_L(void *__to, void *__from, UINT32 count) { _WASAPI_MONO_TO_STEREO_MIXER_2_TO_1_L(int); /* !!! int24 data is contained in 32-bit containers*/ }
+static void _MixMonoToStereo_2TO1_32_L(void *__to, void *__from, UINT32 count) { _WASAPI_MONO_TO_STEREO_MIXER_2_TO_1_L(int); }
+static void _MixMonoToStereo_2TO1_32f_L(void *__to, void *__from, UINT32 count) { _WASAPI_MONO_TO_STEREO_MIXER_2_TO_1_L(float); }
+
+// ------------------------------------------------------------------------------------------
+static MixMonoToStereoF _GetMonoToStereoMixer(PaSampleFormat format, EMixerDir dir)
+{
+	switch (dir)
+	{
+	case MIX_DIR__1TO2:
+		switch (format & ~paNonInterleaved)
+		{
+		case paUInt8:	return _MixMonoToStereo_1TO2_8;
+		case paInt16:	return _MixMonoToStereo_1TO2_16;
+		case paInt24:	return _MixMonoToStereo_1TO2_24;
+		case paInt32:	return _MixMonoToStereo_1TO2_32;
+		case paFloat32: return _MixMonoToStereo_1TO2_32f;
+		}
+		break;
+
+	case MIX_DIR__2TO1:
+		switch (format & ~paNonInterleaved)
+		{
+		case paUInt8:	return _MixMonoToStereo_2TO1_8;
+		case paInt16:	return _MixMonoToStereo_2TO1_16;
+		case paInt24:	return _MixMonoToStereo_2TO1_24;
+		case paInt32:	return _MixMonoToStereo_2TO1_32;
+		case paFloat32: return _MixMonoToStereo_2TO1_32f;
+		}
+		break;
+
+	case MIX_DIR__2TO1_L:
+		switch (format & ~paNonInterleaved)
+		{
+		case paUInt8:	return _MixMonoToStereo_2TO1_8_L;
+		case paInt16:	return _MixMonoToStereo_2TO1_16_L;
+		case paInt24:	return _MixMonoToStereo_2TO1_24_L;
+		case paInt32:	return _MixMonoToStereo_2TO1_32_L;
+		case paFloat32: return _MixMonoToStereo_2TO1_32f_L;
+		}
+		break;
+	}
+
+	return NULL;
+}
+
+// ------------------------------------------------------------------------------------------
+#ifdef PA_WINRT
+typedef struct PaActivateAudioInterfaceCompletionHandler
+{
+	IActivateAudioInterfaceCompletionHandler parent;
+	volatile LONG refs;
+	volatile LONG done;
+	struct
+	{
+		const IID *iid;
+		void **obj;
+	}
+	in;
+	struct
+	{
+		HRESULT hr;
+	}
+	out;
+}
+PaActivateAudioInterfaceCompletionHandler;
+
+static HRESULT (STDMETHODCALLTYPE PaActivateAudioInterfaceCompletionHandler_QueryInterface)( 
+    IActivateAudioInterfaceCompletionHandler *This, REFIID riid, void **ppvObject)
+{
+	PaActivateAudioInterfaceCompletionHandler *handler = (PaActivateAudioInterfaceCompletionHandler *)This;
+
+	// From MSDN:
+	// "The IAgileObject interface is a marker interface that indicates that an object 
+	//  is free threaded and can be called from any apartment."
+	if (IsEqualIID(riid, &IID_IUnknown) || 
+		IsEqualIID(riid, &IID_IAgileObject))
+	{
+		IActivateAudioInterfaceCompletionHandler_AddRef((IActivateAudioInterfaceCompletionHandler *)handler);
+		(*ppvObject) = handler;
+		return S_OK;
+	}
+
+	return E_NOINTERFACE;
+}
+        
+static ULONG (STDMETHODCALLTYPE PaActivateAudioInterfaceCompletionHandler_AddRef)( 
+    IActivateAudioInterfaceCompletionHandler *This)
+{
+	PaActivateAudioInterfaceCompletionHandler *handler = (PaActivateAudioInterfaceCompletionHandler *)This;
+
+	return InterlockedIncrement(&handler->refs);
+}
+        
+static ULONG (STDMETHODCALLTYPE PaActivateAudioInterfaceCompletionHandler_Release)( 
+    IActivateAudioInterfaceCompletionHandler *This)
+{
+	PaActivateAudioInterfaceCompletionHandler *handler = (PaActivateAudioInterfaceCompletionHandler *)This;
+	ULONG refs;
+
+	if ((refs = InterlockedDecrement(&handler->refs)) == 0)
+	{
+		PaUtil_FreeMemory(handler->parent.lpVtbl);
+		PaUtil_FreeMemory(handler);
+	}
+
+	return refs;
+}
+        
+static HRESULT (STDMETHODCALLTYPE PaActivateAudioInterfaceCompletionHandler_ActivateCompleted)( 
+    IActivateAudioInterfaceCompletionHandler *This, IActivateAudioInterfaceAsyncOperation *activateOperation)
+{
+	PaActivateAudioInterfaceCompletionHandler *handler = (PaActivateAudioInterfaceCompletionHandler *)This;
+
+    HRESULT hr = S_OK;
+    HRESULT hrActivateResult = S_OK;
+    IUnknown *punkAudioInterface = NULL;
+ 
+    // Check for a successful activation result
+    hr = IActivateAudioInterfaceAsyncOperation_GetActivateResult(activateOperation, &hrActivateResult, &punkAudioInterface);
+    if (SUCCEEDED(hr) && SUCCEEDED(hrActivateResult))
+    {
+        // Get pointer to the requested audio interface
+        IUnknown_QueryInterface(punkAudioInterface, handler->in.iid, handler->in.obj);
+        if ((*handler->in.obj) == NULL)
+            hrActivateResult = E_FAIL;
+	}
+	SAFE_RELEASE(punkAudioInterface);
+
+	if (SUCCEEDED(hr))
+		handler->out.hr = hrActivateResult;
+	else
+		handler->out.hr = hr;
+	
+	// Got client object, stop busy waiting in ActivateAudioInterface
+	InterlockedExchange(&handler->done, TRUE);
+
+	return hr;
+}
+
+static IActivateAudioInterfaceCompletionHandler *CreateActivateAudioInterfaceCompletionHandler(const IID *iid, void **obj)
+{
+	PaActivateAudioInterfaceCompletionHandler *handler = PaUtil_AllocateMemory(sizeof(PaActivateAudioInterfaceCompletionHandler));
+	ZeroMemory(handler, sizeof(*handler));
+	handler->parent.lpVtbl = PaUtil_AllocateMemory(sizeof(*handler->parent.lpVtbl));
+	handler->parent.lpVtbl->QueryInterface    = &PaActivateAudioInterfaceCompletionHandler_QueryInterface;
+	handler->parent.lpVtbl->AddRef            = &PaActivateAudioInterfaceCompletionHandler_AddRef;
+	handler->parent.lpVtbl->Release           = &PaActivateAudioInterfaceCompletionHandler_Release;
+	handler->parent.lpVtbl->ActivateCompleted = &PaActivateAudioInterfaceCompletionHandler_ActivateCompleted;
+	handler->refs = 1;
+	handler->in.iid = iid;
+	handler->in.obj = obj;
+	return (IActivateAudioInterfaceCompletionHandler *)handler;
+}
+#endif
+
+// ------------------------------------------------------------------------------------------
+#ifdef PA_WINRT
+static HRESULT ActivateAudioInterface_WINRT(const PaWasapiDeviceInfo *deviceInfo, const IID *iid, void **obj)
+{
+#define PA_WASAPI_DEVICE_PATH_LEN 64
+	
+	PaError result = paNoError;
+	HRESULT hr = S_OK;
+	IActivateAudioInterfaceAsyncOperation *asyncOp = NULL;
+	IActivateAudioInterfaceCompletionHandler *handler = CreateActivateAudioInterfaceCompletionHandler(iid, obj);
+	PaActivateAudioInterfaceCompletionHandler *handlerImpl = (PaActivateAudioInterfaceCompletionHandler *)handler;
+	OLECHAR devicePath[PA_WASAPI_DEVICE_PATH_LEN] = { 0 };
+
+	// Get device path in form L"{DEVICE_GUID}"
+	switch (deviceInfo->flow)
+	{
+	case eRender:
+		StringFromGUID2(&DEVINTERFACE_AUDIO_RENDER, devicePath, PA_WASAPI_DEVICE_PATH_LEN - 1);
+		break;
+	case eCapture:
+		StringFromGUID2(&DEVINTERFACE_AUDIO_CAPTURE, devicePath, PA_WASAPI_DEVICE_PATH_LEN - 1);
+		break;
+	default:
+		return S_FALSE;
+	}	
+
+	// Async operation will call back to IActivateAudioInterfaceCompletionHandler::ActivateCompleted 
+	// which must be an agile interface implementation
+    hr = ActivateAudioInterfaceAsync(devicePath, iid, NULL, handler, &asyncOp);
+    IF_FAILED_INTERNAL_ERROR_JUMP(hr, result, error);
+
+	// Wait in busy loop for async operation to complete
+	// Use Interlocked API here to ensure that ->done variable is read every time through the loop
+	while (SUCCEEDED(hr) && !InterlockedOr(&handlerImpl->done, 0))
+	{
+		Sleep(1);
+	}
+
+	hr = handlerImpl->out.hr;
+
+error:
+
+	SAFE_RELEASE(asyncOp);
+	SAFE_RELEASE(handler);
+
+    return hr;
+	
+#undef PA_WASAPI_DEVICE_PATH_LEN
+}
+#endif
+
+// ------------------------------------------------------------------------------------------
+static HRESULT ActivateAudioInterface(const PaWasapiDeviceInfo *deviceInfo, IAudioClient **client)
+{
+#ifndef PA_WINRT
+	return IMMDevice_Activate(deviceInfo->device, GetAudioClientIID(), CLSCTX_ALL, NULL, (void **)client);
+#else
+	return ActivateAudioInterface_WINRT(deviceInfo, GetAudioClientIID(), (void **)client);
+#endif
+}
+
+// ------------------------------------------------------------------------------------------
+#ifdef PA_WINRT
+static DWORD SignalObjectAndWait(HANDLE hObjectToSignal, HANDLE hObjectToWaitOn, DWORD dwMilliseconds, BOOL bAlertable)
+{
+	SetEvent(hObjectToSignal);
+	return WaitForSingleObjectEx(hObjectToWaitOn, dwMilliseconds, bAlertable);
+}
+#endif
+
+// ------------------------------------------------------------------------------------------
+PaError PaWasapi_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiIndex hostApiIndex )
+{
+    PaError result = paNoError;
+    PaWasapiHostApiRepresentation *paWasapi;
+    PaDeviceInfo *deviceInfoArray;
+    HRESULT hr = S_OK;
+	UINT i;
+#ifndef PA_WINRT
+    IMMDeviceCollection* pEndPoints = NULL;
+#else
+	WAVEFORMATEX *mixFormat;
+#endif
+
+#ifndef PA_WINRT
+    if (!SetupAVRT())
+	{
+        PRINT(("WASAPI: No AVRT! (not VISTA?)"));
+        return paNoError;
+    }
+#endif
+
+    paWasapi = (PaWasapiHostApiRepresentation *)PaUtil_AllocateMemory( sizeof(PaWasapiHostApiRepresentation) );
+    if (paWasapi == NULL)
+	{
+        result = paInsufficientMemory;
+        goto error;
+    }
+	
+    memset( paWasapi, 0, sizeof(PaWasapiHostApiRepresentation) ); /* ensure all fields are zeroed. especially paWasapi->allocations */
+
+    result = PaWinUtil_CoInitialize( paWASAPI, &paWasapi->comInitializationResult );
+    if( result != paNoError )
+    {
+        goto error;
+    }
+
+    paWasapi->allocations = PaUtil_CreateAllocationGroup();
+    if (paWasapi->allocations == NULL)
+	{
+        result = paInsufficientMemory;
+        goto error;
+    }
+
+    *hostApi                             = &paWasapi->inheritedHostApiRep;
+    (*hostApi)->info.structVersion		 = 1;
+    (*hostApi)->info.type				 = paWASAPI;
+    (*hostApi)->info.name				 = "Windows WASAPI";
+    (*hostApi)->info.deviceCount		 = 0;
+    (*hostApi)->info.defaultInputDevice	 = paNoDevice;
+    (*hostApi)->info.defaultOutputDevice = paNoDevice;
+
+#ifndef PA_WINRT
+    paWasapi->enumerator = NULL;
+    hr = CoCreateInstance(&pa_CLSID_IMMDeviceEnumerator, NULL, CLSCTX_INPROC_SERVER,
+             &pa_IID_IMMDeviceEnumerator, (void **)&paWasapi->enumerator);
+    
+	// We need to set the result to a value otherwise we will return paNoError
+	// [IF_FAILED_JUMP(hResult, error);]
+	IF_FAILED_INTERNAL_ERROR_JUMP(hr, result, error);
+
+    // getting default device ids in the eMultimedia "role"
+    {
+        {
+            IMMDevice *defaultRenderer = NULL;
+            hr = IMMDeviceEnumerator_GetDefaultAudioEndpoint(paWasapi->enumerator, eRender, eMultimedia, &defaultRenderer);
+            if (hr != S_OK)
+			{
+				if (hr != E_NOTFOUND) {
+					// We need to set the result to a value otherwise we will return paNoError
+					// [IF_FAILED_JUMP(hResult, error);]
+					IF_FAILED_INTERNAL_ERROR_JUMP(hr, result, error);
+				}
+			}
+			else
+			{
+				WCHAR *pszDeviceId = NULL;
+				hr = IMMDevice_GetId(defaultRenderer, &pszDeviceId);
+				// We need to set the result to a value otherwise we will return paNoError
+				// [IF_FAILED_JUMP(hResult, error);]
+				IF_FAILED_INTERNAL_ERROR_JUMP(hr, result, error);
+				wcsncpy(paWasapi->defaultRenderer, pszDeviceId, MAX_STR_LEN-1);
+				CoTaskMemFree(pszDeviceId);
+				IMMDevice_Release(defaultRenderer);
+			}
+        }
+
+        {
+            IMMDevice *defaultCapturer = NULL;
+            hr = IMMDeviceEnumerator_GetDefaultAudioEndpoint(paWasapi->enumerator, eCapture, eMultimedia, &defaultCapturer);
+            if (hr != S_OK)
+			{
+				if (hr != E_NOTFOUND) {
+					// We need to set the result to a value otherwise we will return paNoError
+					// [IF_FAILED_JUMP(hResult, error);]
+					IF_FAILED_INTERNAL_ERROR_JUMP(hr, result, error);
+				}
+			}
+			else
+			{
+				WCHAR *pszDeviceId = NULL;
+				hr = IMMDevice_GetId(defaultCapturer, &pszDeviceId);
+				// We need to set the result to a value otherwise we will return paNoError
+				// [IF_FAILED_JUMP(hResult, error);]
+				IF_FAILED_INTERNAL_ERROR_JUMP(hr, result, error);
+				wcsncpy(paWasapi->defaultCapturer, pszDeviceId, MAX_STR_LEN-1);
+				CoTaskMemFree(pszDeviceId);
+				IMMDevice_Release(defaultCapturer);
+			}
+        }
+    }
+
+    hr = IMMDeviceEnumerator_EnumAudioEndpoints(paWasapi->enumerator, eAll, DEVICE_STATE_ACTIVE, &pEndPoints);
+	// We need to set the result to a value otherwise we will return paNoError
+	// [IF_FAILED_JUMP(hResult, error);]
+	IF_FAILED_INTERNAL_ERROR_JUMP(hr, result, error);
+
+    hr = IMMDeviceCollection_GetCount(pEndPoints, &paWasapi->deviceCount);
+	// We need to set the result to a value otherwise we will return paNoError
+	// [IF_FAILED_JUMP(hResult, error);]
+	IF_FAILED_INTERNAL_ERROR_JUMP(hr, result, error);
+
+#else
+	paWasapi->deviceCount = 2;
+#endif
+
+    paWasapi->devInfo = (PaWasapiDeviceInfo *)PaUtil_AllocateMemory(sizeof(PaWasapiDeviceInfo) * paWasapi->deviceCount);
+    if (paWasapi->devInfo == NULL)
+	{
+        result = paInsufficientMemory;
+        goto error;
+    }
+	for (i = 0; i < paWasapi->deviceCount; ++i)
+		memset(&paWasapi->devInfo[i], 0, sizeof(PaWasapiDeviceInfo));
+
+    if (paWasapi->deviceCount > 0)
+    {
+        (*hostApi)->deviceInfos = (PaDeviceInfo **)PaUtil_GroupAllocateMemory(
+                paWasapi->allocations, sizeof(PaDeviceInfo *) * paWasapi->deviceCount);
+        if ((*hostApi)->deviceInfos == NULL)
+		{
+            result = paInsufficientMemory;
+            goto error;
+        }
+
+        /* allocate all device info structs in a contiguous block */
+        deviceInfoArray = (PaDeviceInfo *)PaUtil_GroupAllocateMemory(
+                paWasapi->allocations, sizeof(PaDeviceInfo) * paWasapi->deviceCount);
+        if (deviceInfoArray == NULL)
+		{
+            result = paInsufficientMemory;
+            goto error;
+        }
+
+        for (i = 0; i < paWasapi->deviceCount; ++i)
+		{
+            PaDeviceInfo *deviceInfo  = &deviceInfoArray[i];
+            deviceInfo->structVersion = 2;
+            deviceInfo->hostApi       = hostApiIndex;
+
+			PA_DEBUG(("WASAPI: device idx: %02d\n", i));
+			PA_DEBUG(("WASAPI: ---------------\n"));
+
+		#ifndef PA_WINRT
+            hr = IMMDeviceCollection_Item(pEndPoints, i, &paWasapi->devInfo[i].device);
+			// We need to set the result to a value otherwise we will return paNoError
+			// [IF_FAILED_JUMP(hResult, error);]
+			IF_FAILED_INTERNAL_ERROR_JUMP(hr, result, error);
+
+            // getting ID
+            {
+                WCHAR *pszDeviceId = NULL;
+                hr = IMMDevice_GetId(paWasapi->devInfo[i].device, &pszDeviceId);
+				// We need to set the result to a value otherwise we will return paNoError
+				// [IF_FAILED_JUMP(hr, error);]
+				IF_FAILED_INTERNAL_ERROR_JUMP(hr, result, error);
+                wcsncpy(paWasapi->devInfo[i].szDeviceID, pszDeviceId, MAX_STR_LEN-1);
+                CoTaskMemFree(pszDeviceId);
+
+                if (lstrcmpW(paWasapi->devInfo[i].szDeviceID, paWasapi->defaultCapturer) == 0)
+				{// we found the default input!
+                    (*hostApi)->info.defaultInputDevice = (*hostApi)->info.deviceCount;
+                }
+                if (lstrcmpW(paWasapi->devInfo[i].szDeviceID, paWasapi->defaultRenderer) == 0)
+				{// we found the default output!
+                    (*hostApi)->info.defaultOutputDevice = (*hostApi)->info.deviceCount;
+                }
+            }
+
+            hr = IMMDevice_GetState(paWasapi->devInfo[i].device, &paWasapi->devInfo[i].state);
+			// We need to set the result to a value otherwise we will return paNoError
+			// [IF_FAILED_JUMP(hResult, error);]
+			IF_FAILED_INTERNAL_ERROR_JUMP(hr, result, error);
+
+            if (paWasapi->devInfo[i].state != DEVICE_STATE_ACTIVE)
+			{
+                PRINT(("WASAPI device: %d is not currently available (state:%d)\n", i, paWasapi->devInfo[i].state));
+            }
+
+            {
+                IPropertyStore *pProperty;
+                hr = IMMDevice_OpenPropertyStore(paWasapi->devInfo[i].device, STGM_READ, &pProperty);
+				// We need to set the result to a value otherwise we will return paNoError
+				// [IF_FAILED_JUMP(hResult, error);]
+				IF_FAILED_INTERNAL_ERROR_JUMP(hr, result, error);
+
+                // "Friendly" Name
+                {
+					char *deviceName;
+                    PROPVARIANT value;
+                    PropVariantInit(&value);
+                    hr = IPropertyStore_GetValue(pProperty, &PKEY_Device_FriendlyName, &value);
+					// We need to set the result to a value otherwise we will return paNoError
+					// [IF_FAILED_JUMP(hResult, error);]
+					IF_FAILED_INTERNAL_ERROR_JUMP(hr, result, error);
+                    deviceInfo->name = NULL;
+                    deviceName = (char *)PaUtil_GroupAllocateMemory(paWasapi->allocations, MAX_STR_LEN + 1);
+                    if (deviceName == NULL)
+					{
+                        result = paInsufficientMemory;
+                        goto error;
+                    }
+					if (value.pwszVal)
+						WideCharToMultiByte(CP_UTF8, 0, value.pwszVal, (int)wcslen(value.pwszVal), deviceName, MAX_STR_LEN - 1, 0, 0);
+					else
+						_snprintf(deviceName, MAX_STR_LEN - 1, "baddev%d", i);
+                    deviceInfo->name = deviceName;
+                    PropVariantClear(&value);
+					PA_DEBUG(("WASAPI:%d| name[%s]\n", i, deviceInfo->name));
+                }
+
+                // Default format
+                {
+                    PROPVARIANT value;
+                    PropVariantInit(&value);
+                    hr = IPropertyStore_GetValue(pProperty, &PKEY_AudioEngine_DeviceFormat, &value);
+					// We need to set the result to a value otherwise we will return paNoError
+					// [IF_FAILED_JUMP(hResult, error);]
+					IF_FAILED_INTERNAL_ERROR_JUMP(hr, result, error);
+					memcpy(&paWasapi->devInfo[i].DefaultFormat, value.blob.pBlobData, min(sizeof(paWasapi->devInfo[i].DefaultFormat), value.blob.cbSize));
+                    // cleanup
+                    PropVariantClear(&value);
+                }
+
+                // Formfactor
+                {
+                    PROPVARIANT value;
+                    PropVariantInit(&value);
+                    hr = IPropertyStore_GetValue(pProperty, &PKEY_AudioEndpoint_FormFactor, &value);
+					// We need to set the result to a value otherwise we will return paNoError
+					// [IF_FAILED_JUMP(hResult, error);]
+					IF_FAILED_INTERNAL_ERROR_JUMP(hr, result, error);
+					// set
+					#if defined(DUMMYUNIONNAME) && defined(NONAMELESSUNION)
+						// avoid breaking strict-aliasing rules in such line: (EndpointFormFactor)(*((UINT *)(((WORD *)&value.wReserved3)+1)));
+						UINT v;
+						memcpy(&v, (((WORD *)&value.wReserved3)+1), sizeof(v));
+						paWasapi->devInfo[i].formFactor = (EndpointFormFactor)v;
+					#else
+						paWasapi->devInfo[i].formFactor = (EndpointFormFactor)value.uintVal;
+					#endif
+					PA_DEBUG(("WASAPI:%d| form-factor[%d]\n", i, paWasapi->devInfo[i].formFactor));
+                    // cleanup
+                    PropVariantClear(&value);
+                }
+
+				SAFE_RELEASE(pProperty);
+            }
+			
+            // Endpoint data
+            {
+                IMMEndpoint *endpoint = NULL;
+                hr = IMMDevice_QueryInterface(paWasapi->devInfo[i].device, &pa_IID_IMMEndpoint, (void **)&endpoint);
+                if (SUCCEEDED(hr))
+				{
+                    hr = IMMEndpoint_GetDataFlow(endpoint, &paWasapi->devInfo[i].flow);
+                    SAFE_RELEASE(endpoint);
+                }
+            }
+		#endif
+
+            // Getting a temporary IAudioClient for more fields
+            // we make sure NOT to call Initialize yet!
+            {
+			#ifdef PA_WINRT
+				// Set flow as ActivateAudioInterface depends on it and selects corresponding 
+				// direction for the Audio Client
+				paWasapi->devInfo[i].flow = (i == 0 ? eRender : eCapture);
+			#endif
+
+				// Create temp Audio Client instance to query additional details
+                IAudioClient *tmpClient = NULL;
+                hr = ActivateAudioInterface(&paWasapi->devInfo[i], &tmpClient);
+				// We need to set the result to a value otherwise we will return paNoError
+				// [IF_FAILED_JUMP(hResult, error);]
+				IF_FAILED_INTERNAL_ERROR_JUMP(hr, result, error);
+
+				// Get latency
+                hr = IAudioClient_GetDevicePeriod(tmpClient,
+                    &paWasapi->devInfo[i].DefaultDevicePeriod,
+                    &paWasapi->devInfo[i].MinimumDevicePeriod);
+				if (FAILED(hr))
+				{
+					PA_DEBUG(("WASAPI:%d| failed getting min/default periods by IAudioClient::GetDevicePeriod() with error[%08X], will use 30000/100000 hns\n", i, (UINT32)hr));
+
+					// assign WASAPI common values
+					paWasapi->devInfo[i].DefaultDevicePeriod = 100000;
+					paWasapi->devInfo[i].MinimumDevicePeriod = 30000;
+
+					// ignore error, let continue further without failing with paInternalError
+					hr = S_OK;
+				}
+				
+			#ifdef PA_WINRT
+				// Get mix format which will treat as default device format
+				hr = IAudioClient_GetMixFormat(tmpClient, &mixFormat);
+				if (SUCCEEDED(hr))
+				{
+					// Default device
+					if (i == 0)
+						(*hostApi)->info.defaultOutputDevice = (*hostApi)->info.deviceCount;
+					else
+						(*hostApi)->info.defaultInputDevice = (*hostApi)->info.deviceCount;
+
+					// State
+					paWasapi->devInfo[i].state = DEVICE_STATE_ACTIVE;
+
+					// Default format
+					memcpy(&paWasapi->devInfo[i].DefaultFormat, mixFormat, min(sizeof(paWasapi->devInfo[i].DefaultFormat), sizeof(*mixFormat)));
+					CoTaskMemFree(mixFormat);
+
+					// Form-factor
+					paWasapi->devInfo[i].formFactor = UnknownFormFactor;
+
+					// Name
+                    deviceInfo->name = (char *)PaUtil_GroupAllocateMemory(paWasapi->allocations, MAX_STR_LEN + 1);
+                    if (deviceInfo->name == NULL)
+					{
+						SAFE_RELEASE(tmpClient);
+                        result = paInsufficientMemory;
+                        goto error;
+                    }
+					_snprintf((char *)deviceInfo->name, MAX_STR_LEN - 1, "WASAPI_%s:%d", (i == 0 ? "Output" : "Input"), i);
+					PA_DEBUG(("WASAPI:%d| name[%s]\n", i, deviceInfo->name));
+				}
+			#endif
+
+				// Release tmp client
+				SAFE_RELEASE(tmpClient);
+
+				if (hr != S_OK)
+				{
+					//davidv: this happened with my hardware, previously for that same device in DirectSound:
+					//Digital Output (Realtek AC'97 Audio)'s GUID: {0x38f2cf50,0x7b4c,0x4740,0x86,0xeb,0xd4,0x38,0x66,0xd8,0xc8, 0x9f}
+					//so something must be _really_ wrong with this device, TODO handle this better. We kind of need GetMixFormat
+					LogHostError(hr);
+					// We need to set the result to a value otherwise we will return paNoError
+					result = paInternalError;
+					goto error;
+				}
+            }
+			
+            // we can now fill in portaudio device data
+            deviceInfo->maxInputChannels  = 0;
+            deviceInfo->maxOutputChannels = 0;
+			deviceInfo->defaultSampleRate = paWasapi->devInfo[i].DefaultFormat.Format.nSamplesPerSec;
+            switch (paWasapi->devInfo[i].flow)
+			{
+			case eRender: {
+                deviceInfo->maxOutputChannels		 = paWasapi->devInfo[i].DefaultFormat.Format.nChannels;
+                deviceInfo->defaultHighOutputLatency = nano100ToSeconds(paWasapi->devInfo[i].DefaultDevicePeriod);
+                deviceInfo->defaultLowOutputLatency  = nano100ToSeconds(paWasapi->devInfo[i].MinimumDevicePeriod);
+				PA_DEBUG(("WASAPI:%d| def.SR[%d] max.CH[%d] latency{hi[%f] lo[%f]}\n", i, (UINT32)deviceInfo->defaultSampleRate,
+					deviceInfo->maxOutputChannels, (float)deviceInfo->defaultHighOutputLatency, (float)deviceInfo->defaultLowOutputLatency));
+				break;}
+			case eCapture: {
+                deviceInfo->maxInputChannels		= paWasapi->devInfo[i].DefaultFormat.Format.nChannels;
+                deviceInfo->defaultHighInputLatency = nano100ToSeconds(paWasapi->devInfo[i].DefaultDevicePeriod);
+                deviceInfo->defaultLowInputLatency  = nano100ToSeconds(paWasapi->devInfo[i].MinimumDevicePeriod);
+				PA_DEBUG(("WASAPI:%d| def.SR[%d] max.CH[%d] latency{hi[%f] lo[%f]}\n", i, (UINT32)deviceInfo->defaultSampleRate,
+					deviceInfo->maxInputChannels, (float)deviceInfo->defaultHighInputLatency, (float)deviceInfo->defaultLowInputLatency));
+				break; }
+            default:
+                PRINT(("WASAPI:%d| bad Data Flow!\n", i));
+				// We need to set the result to a value otherwise we will return paNoError
+				result = paInternalError;
+                //continue; // do not skip from list, allow to initialize
+				 break;
+            }
+
+            (*hostApi)->deviceInfos[i] = deviceInfo;
+            ++(*hostApi)->info.deviceCount;
+        }
+    }
+
+    (*hostApi)->Terminate = Terminate;
+    (*hostApi)->OpenStream = OpenStream;
+    (*hostApi)->IsFormatSupported = IsFormatSupported;
+
+    PaUtil_InitializeStreamInterface( &paWasapi->callbackStreamInterface, CloseStream, StartStream,
+                                      StopStream, AbortStream, IsStreamStopped, IsStreamActive,
+                                      GetStreamTime, GetStreamCpuLoad,
+                                      PaUtil_DummyRead, PaUtil_DummyWrite,
+                                      PaUtil_DummyGetReadAvailable, PaUtil_DummyGetWriteAvailable );
+
+    PaUtil_InitializeStreamInterface( &paWasapi->blockingStreamInterface, CloseStream, StartStream,
+                                      StopStream, AbortStream, IsStreamStopped, IsStreamActive,
+                                      GetStreamTime, PaUtil_DummyGetCpuLoad,
+                                      ReadStream, WriteStream, GetStreamReadAvailable, GetStreamWriteAvailable );
+
+
+	// findout if platform workaround is required
+	paWasapi->useWOW64Workaround = UseWOW64Workaround();
+
+#ifndef PA_WINRT
+    SAFE_RELEASE(pEndPoints);
+#endif
+
+	PRINT(("WASAPI: initialized ok\n"));
+
+    return paNoError;
+
+error:
+
+	PRINT(("WASAPI: failed %s error[%d|%s]\n", __FUNCTION__, result, Pa_GetErrorText(result)));
+
+#ifndef PA_WINRT
+    SAFE_RELEASE(pEndPoints);
+#endif
+
+	Terminate((PaUtilHostApiRepresentation *)paWasapi);
+
+	// Safety if error was not set so that we do not think initialize was a success
+	if (result == paNoError) {
+		result = paInternalError;
+	}
+
+    return result;
+}
+
+// ------------------------------------------------------------------------------------------
+static void Terminate( PaUtilHostApiRepresentation *hostApi )
+{
+	UINT i;
+    PaWasapiHostApiRepresentation *paWasapi = (PaWasapiHostApiRepresentation*)hostApi;
+	if (paWasapi == NULL)
+		return;
+
+	// Release IMMDeviceEnumerator
+#ifndef PA_WINRT
+    SAFE_RELEASE(paWasapi->enumerator);
+#endif
+
+	// Release device info bound objects and device info itself
+    for (i = 0; i < paWasapi->deviceCount; ++i)
+	{
+        PaWasapiDeviceInfo *info = &paWasapi->devInfo[i];
+	#ifndef PA_WINRT
+        SAFE_RELEASE(info->device);
+	#else
+		(void)info;
+	#endif
+    }
+    PaUtil_FreeMemory(paWasapi->devInfo);
+
+    if (paWasapi->allocations)
+	{
+        PaUtil_FreeAllAllocations(paWasapi->allocations);
+        PaUtil_DestroyAllocationGroup(paWasapi->allocations);
+    }
+
+    PaWinUtil_CoUninitialize( paWASAPI, &paWasapi->comInitializationResult );
+
+    PaUtil_FreeMemory(paWasapi);
+
+	// Close AVRT
+	CloseAVRT();
+}
+
+// ------------------------------------------------------------------------------------------
+static PaWasapiHostApiRepresentation *_GetHostApi(PaError *_error)
+{
+	PaError error;
+
+	PaUtilHostApiRepresentation *pApi;
+	if ((error = PaUtil_GetHostApiRepresentation(&pApi, paWASAPI)) != paNoError)
+	{
+		if (_error != NULL)
+			(*_error) = error;
+
+		return NULL;
+	}
+	return (PaWasapiHostApiRepresentation *)pApi;
+}
+
+// ------------------------------------------------------------------------------------------
+int PaWasapi_GetDeviceDefaultFormat( void *pFormat, unsigned int nFormatSize, PaDeviceIndex nDevice )
+{
+	PaError ret;
+	PaWasapiHostApiRepresentation *paWasapi;
+	UINT32 size;
+	PaDeviceIndex index;
+
+	if (pFormat == NULL)
+		return paBadBufferPtr;
+	if (nFormatSize <= 0)
+		return paBufferTooSmall;
+
+	// Get API
+	paWasapi = _GetHostApi(&ret);
+	if (paWasapi == NULL)
+		return ret;
+
+	// Get device index
+	ret = PaUtil_DeviceIndexToHostApiDeviceIndex(&index, nDevice, &paWasapi->inheritedHostApiRep);
+    if (ret != paNoError)
+        return ret;
+
+	// Validate index
+	if ((UINT32)index >= paWasapi->deviceCount)
+		return paInvalidDevice;
+
+	size = min(nFormatSize, (UINT32)sizeof(paWasapi->devInfo[ index ].DefaultFormat));
+	memcpy(pFormat, &paWasapi->devInfo[ index ].DefaultFormat, size);
+
+	return size;
+}
+
+// ------------------------------------------------------------------------------------------
+int PaWasapi_GetDeviceRole( PaDeviceIndex nDevice )
+{
+	PaError ret;
+	PaDeviceIndex index;
+
+	// Get API
+	PaWasapiHostApiRepresentation *paWasapi = _GetHostApi(&ret);
+	if (paWasapi == NULL)
+		return paNotInitialized;
+
+	// Get device index
+	ret = PaUtil_DeviceIndexToHostApiDeviceIndex(&index, nDevice, &paWasapi->inheritedHostApiRep);
+    if (ret != paNoError)
+        return ret;
+
+	// Validate index
+	if ((UINT32)index >= paWasapi->deviceCount)
+		return paInvalidDevice;
+
+	return paWasapi->devInfo[ index ].formFactor;
+}
+
+// ------------------------------------------------------------------------------------------
+PaError PaWasapi_GetFramesPerHostBuffer( PaStream *pStream, unsigned int *nInput, unsigned int *nOutput )
+{
+    PaWasapiStream *stream = (PaWasapiStream *)pStream;
+	if (stream == NULL)
+		return paBadStreamPtr;
+
+	if (nInput != NULL)
+		(*nInput) = stream->in.framesPerHostCallback;
+
+	if (nOutput != NULL)
+		(*nOutput) = stream->out.framesPerHostCallback;
+
+	return paNoError;
+}
+
+// ------------------------------------------------------------------------------------------
+static void LogWAVEFORMATEXTENSIBLE(const WAVEFORMATEXTENSIBLE *in)
+{
+    const WAVEFORMATEX *old = (WAVEFORMATEX *)in;
+	switch (old->wFormatTag)
+	{
+	case WAVE_FORMAT_EXTENSIBLE: {
+
+		PRINT(("wFormatTag     =WAVE_FORMAT_EXTENSIBLE\n"));
+
+		if (IsEqualGUID(&in->SubFormat, &pa_KSDATAFORMAT_SUBTYPE_IEEE_FLOAT))
+		{
+			PRINT(("SubFormat      =KSDATAFORMAT_SUBTYPE_IEEE_FLOAT\n"));
+		}
+		else
+		if (IsEqualGUID(&in->SubFormat, &pa_KSDATAFORMAT_SUBTYPE_PCM))
+		{
+			PRINT(("SubFormat      =KSDATAFORMAT_SUBTYPE_PCM\n"));
+		}
+		else
+		{
+			PRINT(("SubFormat      =CUSTOM GUID{%d:%d:%d:%d%d%d%d%d%d%d%d}\n",
+										in->SubFormat.Data1,
+										in->SubFormat.Data2,
+										in->SubFormat.Data3,
+										(int)in->SubFormat.Data4[0],
+										(int)in->SubFormat.Data4[1],
+										(int)in->SubFormat.Data4[2],
+										(int)in->SubFormat.Data4[3],
+										(int)in->SubFormat.Data4[4],
+										(int)in->SubFormat.Data4[5],
+										(int)in->SubFormat.Data4[6],
+										(int)in->SubFormat.Data4[7]));
+		}
+		PRINT(("Samples.wValidBitsPerSample =%d\n",  in->Samples.wValidBitsPerSample));
+		PRINT(("dwChannelMask  =0x%X\n",in->dwChannelMask));
+
+		break; }
+
+	case WAVE_FORMAT_PCM:        PRINT(("wFormatTag     =WAVE_FORMAT_PCM\n")); break;
+	case WAVE_FORMAT_IEEE_FLOAT: PRINT(("wFormatTag     =WAVE_FORMAT_IEEE_FLOAT\n")); break;
+	default: 
+		PRINT(("wFormatTag     =UNKNOWN(%d)\n",old->wFormatTag)); break;
+	}
+
+	PRINT(("nChannels      =%d\n",old->nChannels));
+	PRINT(("nSamplesPerSec =%d\n",old->nSamplesPerSec));
+	PRINT(("nAvgBytesPerSec=%d\n",old->nAvgBytesPerSec));
+	PRINT(("nBlockAlign    =%d\n",old->nBlockAlign));
+	PRINT(("wBitsPerSample =%d\n",old->wBitsPerSample));
+	PRINT(("cbSize         =%d\n",old->cbSize));
+}
+
+// ------------------------------------------------------------------------------------------
+static PaSampleFormat WaveToPaFormat(const WAVEFORMATEXTENSIBLE *in)
+{
+    const WAVEFORMATEX *old = (WAVEFORMATEX *)in;
+
+    switch (old->wFormatTag)
+	{
+    case WAVE_FORMAT_EXTENSIBLE: {
+        if (IsEqualGUID(&in->SubFormat, &pa_KSDATAFORMAT_SUBTYPE_IEEE_FLOAT))
+		{
+            if (in->Samples.wValidBitsPerSample == 32)
+                return paFloat32;
+        }
+        else
+		if (IsEqualGUID(&in->SubFormat, &pa_KSDATAFORMAT_SUBTYPE_PCM))
+		{
+            switch (old->wBitsPerSample)
+			{
+                case 32: return paInt32;
+                case 24: return paInt24;
+                case  8: return paUInt8;
+                case 16: return paInt16;
+            }
+        }
+		break; }
+
+    case WAVE_FORMAT_IEEE_FLOAT:
+		return paFloat32;
+
+    case WAVE_FORMAT_PCM: {
+        switch (old->wBitsPerSample)
+		{
+            case 32: return paInt32;
+            case 24: return paInt24;
+            case  8: return paUInt8;
+            case 16: return paInt16;
+        }
+		break; }
+    }
+
+    return paCustomFormat;
+}
+
+// ------------------------------------------------------------------------------------------
+static PaError MakeWaveFormatFromParams(WAVEFORMATEXTENSIBLE *wavex, const PaStreamParameters *params,
+									double sampleRate)
+{
+	WORD bitsPerSample;
+	WAVEFORMATEX *old;
+	DWORD channelMask = 0;
+	PaWasapiStreamInfo *streamInfo = (PaWasapiStreamInfo *)params->hostApiSpecificStreamInfo;
+
+	// Get user assigned channel mask
+	if ((streamInfo != NULL) && (streamInfo->flags & paWinWasapiUseChannelMask))
+		channelMask = streamInfo->channelMask;
+
+	// Convert PaSampleFormat to bits per sample
+	if ((bitsPerSample = PaSampleFormatToBitsPerSample(params->sampleFormat)) == 0)
+		return paSampleFormatNotSupported;
+
+    memset(wavex, 0, sizeof(*wavex));
+
+    old					 = (WAVEFORMATEX *)wavex;
+    old->nChannels       = (WORD)params->channelCount;
+    old->nSamplesPerSec  = (DWORD)sampleRate;
+	if ((old->wBitsPerSample = bitsPerSample) > 16)
+	{
+		old->wBitsPerSample = 32; // 20 or 24 bits must go in 32 bit containers (ints)
+	}
+    old->nBlockAlign     = (old->nChannels * (old->wBitsPerSample/8));
+    old->nAvgBytesPerSec = (old->nSamplesPerSec * old->nBlockAlign);
+
+    // WAVEFORMATEX
+    if ((params->channelCount <= 2) && ((bitsPerSample == 16) || (bitsPerSample == 8)))
+	{
+        old->cbSize		= 0;
+        old->wFormatTag	= WAVE_FORMAT_PCM;
+    }
+    // WAVEFORMATEXTENSIBLE
+    else
+	{
+        old->wFormatTag = WAVE_FORMAT_EXTENSIBLE;
+        old->cbSize		= sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX);
+
+        if ((params->sampleFormat & ~paNonInterleaved) == paFloat32)
+            wavex->SubFormat = pa_KSDATAFORMAT_SUBTYPE_IEEE_FLOAT;
+        else
+            wavex->SubFormat = pa_KSDATAFORMAT_SUBTYPE_PCM;
+
+        wavex->Samples.wValidBitsPerSample = bitsPerSample; //no extra padding!
+
+		// Set channel mask
+		if (channelMask != 0)
+		{
+			wavex->dwChannelMask = channelMask;
+		}
+		else
+		{
+			switch (params->channelCount)
+			{
+			case 1:  wavex->dwChannelMask = PAWIN_SPEAKER_MONO; break;
+			case 2:  wavex->dwChannelMask = PAWIN_SPEAKER_STEREO; break;
+			case 3:  wavex->dwChannelMask = PAWIN_SPEAKER_STEREO|SPEAKER_LOW_FREQUENCY; break;
+			case 4:  wavex->dwChannelMask = PAWIN_SPEAKER_QUAD; break;
+			case 5:  wavex->dwChannelMask = PAWIN_SPEAKER_QUAD|SPEAKER_LOW_FREQUENCY; break;
+#ifdef PAWIN_SPEAKER_5POINT1_SURROUND
+			case 6:  wavex->dwChannelMask = PAWIN_SPEAKER_5POINT1_SURROUND; break;
+#else
+			case 6:  wavex->dwChannelMask = PAWIN_SPEAKER_5POINT1; break;
+#endif
+#ifdef PAWIN_SPEAKER_5POINT1_SURROUND
+			case 7:  wavex->dwChannelMask = PAWIN_SPEAKER_5POINT1_SURROUND|SPEAKER_BACK_CENTER; break;
+#else
+			case 7:  wavex->dwChannelMask = PAWIN_SPEAKER_5POINT1|SPEAKER_BACK_CENTER; break;
+#endif	
+#ifdef PAWIN_SPEAKER_7POINT1_SURROUND
+			case 8:  wavex->dwChannelMask = PAWIN_SPEAKER_7POINT1_SURROUND; break;
+#else
+			case 8:  wavex->dwChannelMask = PAWIN_SPEAKER_7POINT1; break;
+#endif
+
+			default: wavex->dwChannelMask = 0;
+			}
+		}
+	}
+    return paNoError;
+}
+
+// ------------------------------------------------------------------------------------------
+/*static void wasapiFillWFEXT( WAVEFORMATEXTENSIBLE* pwfext, PaSampleFormat sampleFormat, double sampleRate, int channelCount)
+{
+    PA_DEBUG(( "sampleFormat = %lx\n" , sampleFormat ));
+    PA_DEBUG(( "sampleRate = %f\n" , sampleRate ));
+    PA_DEBUG(( "chanelCount = %d\n", channelCount ));
+
+    pwfext->Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE;
+    pwfext->Format.nChannels = (WORD)channelCount;
+    pwfext->Format.nSamplesPerSec = (DWORD)sampleRate;
+    if(channelCount == 1)
+        pwfext->dwChannelMask = PAWIN_SPEAKER_DIRECTOUT;
+    else
+        pwfext->dwChannelMask = PAWIN_SPEAKER_STEREO;
+    if(sampleFormat == paFloat32)
+    {
+        pwfext->Format.nBlockAlign = (WORD)(channelCount * 4);
+        pwfext->Format.wBitsPerSample = 32;
+        pwfext->Format.cbSize = sizeof(WAVEFORMATEXTENSIBLE)-sizeof(WAVEFORMATEX);
+        pwfext->Samples.wValidBitsPerSample = 32;
+        pwfext->SubFormat = pa_KSDATAFORMAT_SUBTYPE_IEEE_FLOAT;
+    }
+    else if(sampleFormat == paInt32)
+    {
+        pwfext->Format.nBlockAlign = (WORD)(channelCount * 4);
+        pwfext->Format.wBitsPerSample = 32;
+        pwfext->Format.cbSize = sizeof(WAVEFORMATEXTENSIBLE)-sizeof(WAVEFORMATEX);
+        pwfext->Samples.wValidBitsPerSample = 32;
+        pwfext->SubFormat = pa_KSDATAFORMAT_SUBTYPE_PCM;
+    }
+    else if(sampleFormat == paInt24)
+    {
+        pwfext->Format.nBlockAlign = (WORD)(channelCount * 4);
+        pwfext->Format.wBitsPerSample = 32; // 24-bit in 32-bit int container
+        pwfext->Format.cbSize = sizeof(WAVEFORMATEXTENSIBLE)-sizeof(WAVEFORMATEX);
+        pwfext->Samples.wValidBitsPerSample = 24;
+        pwfext->SubFormat = pa_KSDATAFORMAT_SUBTYPE_PCM;
+    }
+    else if(sampleFormat == paInt16)
+    {
+        pwfext->Format.nBlockAlign = (WORD)(channelCount * 2);
+        pwfext->Format.wBitsPerSample = 16;
+        pwfext->Format.cbSize = sizeof(WAVEFORMATEXTENSIBLE)-sizeof(WAVEFORMATEX);
+        pwfext->Samples.wValidBitsPerSample = 16;
+        pwfext->SubFormat = pa_KSDATAFORMAT_SUBTYPE_PCM;
+    }
+    pwfext->Format.nAvgBytesPerSec = pwfext->Format.nSamplesPerSec * pwfext->Format.nBlockAlign;
+}*/
+
+// ------------------------------------------------------------------------------------------
+static PaError GetClosestFormat(IAudioClient *myClient, double sampleRate,
+	const PaStreamParameters *_params, AUDCLNT_SHAREMODE shareMode, WAVEFORMATEXTENSIBLE *outWavex,
+	BOOL output)
+{
+	PaError answer                   = paInvalidSampleRate;
+	WAVEFORMATEX *sharedClosestMatch = NULL;
+	HRESULT hr                       = !S_OK;
+	PaStreamParameters params       = (*_params);
+	(void)output;
+
+	/* It was not noticed that 24-bit Input producing no output while device accepts this format.
+	   To fix this issue let's ask for 32-bits and let PA converters convert host 32-bit data
+	   to 24-bit for user-space. The bug concerns Vista, if Windows 7 supports 24-bits for Input
+	   please report to PortAudio developers to exclude Windows 7.
+	*/
+	/*if ((params.sampleFormat == paInt24) && (output == FALSE))
+		params.sampleFormat = paFloat32;*/ // <<< The silence was due to missing Int32_To_Int24_Dither implementation
+
+    MakeWaveFormatFromParams(outWavex, &params, sampleRate);
+
+	hr = IAudioClient_IsFormatSupported(myClient, shareMode, &outWavex->Format, (shareMode == AUDCLNT_SHAREMODE_SHARED ? &sharedClosestMatch : NULL));
+	if (hr == S_OK)
+		answer = paFormatIsSupported;
+    else
+	if (sharedClosestMatch)
+	{
+		WORD bitsPerSample;
+        WAVEFORMATEXTENSIBLE *ext = (WAVEFORMATEXTENSIBLE*)sharedClosestMatch;
+
+		GUID subf_guid = GUID_NULL;
+		if (sharedClosestMatch->wFormatTag == WAVE_FORMAT_EXTENSIBLE)
+		{
+			memcpy(outWavex, sharedClosestMatch, sizeof(WAVEFORMATEXTENSIBLE));
+			subf_guid = ext->SubFormat;
+		}
+		else
+			memcpy(outWavex, sharedClosestMatch, sizeof(WAVEFORMATEX));
+
+        CoTaskMemFree(sharedClosestMatch);
+
+		// Make supported by default
+		answer = paFormatIsSupported;
+
+		// Validate SampleRate
+		if ((DWORD)sampleRate != outWavex->Format.nSamplesPerSec)
+			return paInvalidSampleRate;
+
+		// Validate Channel count
+		if ((WORD)params.channelCount != outWavex->Format.nChannels)
+		{
+			// If mono, then driver does not support 1 channel, we use internal workaround
+			// of tiny software mixing functionality, e.g. we provide to user buffer 1 channel
+			// but then mix into 2 for device buffer
+			if ((params.channelCount == 1) && (outWavex->Format.nChannels == 2))
+				return paFormatIsSupported;
+			else
+				return paInvalidChannelCount;
+		}
+
+		// Validate Sample format
+		if ((bitsPerSample = PaSampleFormatToBitsPerSample(params.sampleFormat)) == 0)
+			return paSampleFormatNotSupported;
+
+		// Validate Sample format: bit size (WASAPI does not limit 'bit size')
+		//if (bitsPerSample != outWavex->Format.wBitsPerSample)
+		//	return paSampleFormatNotSupported;
+
+		// Validate Sample format: paFloat32 (WASAPI does not limit 'bit type')
+		//if ((params->sampleFormat == paFloat32) && (subf_guid != KSDATAFORMAT_SUBTYPE_IEEE_FLOAT))
+		//	return paSampleFormatNotSupported;
+
+		// Validate Sample format: paInt32 (WASAPI does not limit 'bit type')
+		//if ((params->sampleFormat == paInt32) && (subf_guid != KSDATAFORMAT_SUBTYPE_PCM))
+		//	return paSampleFormatNotSupported;
+	}
+	else
+	{
+		static const int BestToWorst[] = { paFloat32, paInt24, paInt16 };
+		int i;
+
+		// Try combination stereo and we will use built-in mono-stereo mixer then
+		if (params.channelCount == 1)
+		{
+			WAVEFORMATEXTENSIBLE stereo = { 0 };
+
+			PaStreamParameters stereo_params = params;
+			stereo_params.channelCount = 2;
+
+			MakeWaveFormatFromParams(&stereo, &stereo_params, sampleRate);
+
+			hr = IAudioClient_IsFormatSupported(myClient, shareMode, &stereo.Format, (shareMode == AUDCLNT_SHAREMODE_SHARED ? &sharedClosestMatch : NULL));
+			if (hr == S_OK)
+			{
+				memcpy(outWavex, &stereo, sizeof(WAVEFORMATEXTENSIBLE));
+				CoTaskMemFree(sharedClosestMatch);
+				return (answer = paFormatIsSupported);
+			}
+
+			// Try selecting suitable sample type
+			for (i = 0; i < STATIC_ARRAY_SIZE(BestToWorst); ++i)
+			{
+				WAVEFORMATEXTENSIBLE sample = { 0 };
+
+				PaStreamParameters sample_params = stereo_params;
+				sample_params.sampleFormat = BestToWorst[i];
+
+				MakeWaveFormatFromParams(&sample, &sample_params, sampleRate);
+
+				hr = IAudioClient_IsFormatSupported(myClient, shareMode, &sample.Format, (shareMode == AUDCLNT_SHAREMODE_SHARED ? &sharedClosestMatch : NULL));
+				if (hr == S_OK)
+				{
+					memcpy(outWavex, &sample, sizeof(WAVEFORMATEXTENSIBLE));
+					CoTaskMemFree(sharedClosestMatch);
+					return (answer = paFormatIsSupported);
+				}
+			}
+		}
+
+		// Try selecting suitable sample type
+		for (i = 0; i < STATIC_ARRAY_SIZE(BestToWorst); ++i)
+		{
+			WAVEFORMATEXTENSIBLE spfmt = { 0 };
+
+			PaStreamParameters spfmt_params = params;
+			spfmt_params.sampleFormat = BestToWorst[i];
+
+			MakeWaveFormatFromParams(&spfmt, &spfmt_params, sampleRate);
+
+			hr = IAudioClient_IsFormatSupported(myClient, shareMode, &spfmt.Format, (shareMode == AUDCLNT_SHAREMODE_SHARED ? &sharedClosestMatch : NULL));
+			if (hr == S_OK)
+			{
+				memcpy(outWavex, &spfmt, sizeof(WAVEFORMATEXTENSIBLE));
+				CoTaskMemFree(sharedClosestMatch);
+				answer = paFormatIsSupported;
+				break;
+			}
+		}
+
+		// Nothing helped
+		LogHostError(hr);
+	}
+
+	return answer;
+}
+
+// ------------------------------------------------------------------------------------------
+static PaError IsStreamParamsValid(struct PaUtilHostApiRepresentation *hostApi,
+                                   const  PaStreamParameters *inputParameters,
+                                   const  PaStreamParameters *outputParameters,
+                                   double sampleRate)
+{
+	if (hostApi == NULL)
+		return paHostApiNotFound;
+	if ((UINT32)sampleRate == 0)
+		return paInvalidSampleRate;
+
+	if (inputParameters != NULL)
+    {
+        /* all standard sample formats are supported by the buffer adapter,
+            this implementation doesn't support any custom sample formats */
+		if (inputParameters->sampleFormat & paCustomFormat)
+            return paSampleFormatNotSupported;
+
+        /* unless alternate device specification is supported, reject the use of
+            paUseHostApiSpecificDeviceSpecification */
+        if (inputParameters->device == paUseHostApiSpecificDeviceSpecification)
+            return paInvalidDevice;
+
+        /* check that input device can support inputChannelCount */
+        if (inputParameters->channelCount > hostApi->deviceInfos[ inputParameters->device ]->maxInputChannels)
+            return paInvalidChannelCount;
+
+        /* validate inputStreamInfo */
+        if (inputParameters->hostApiSpecificStreamInfo)
+		{
+			PaWasapiStreamInfo *inputStreamInfo = (PaWasapiStreamInfo *)inputParameters->hostApiSpecificStreamInfo;
+	        if ((inputStreamInfo->size != sizeof(PaWasapiStreamInfo)) ||
+	            (inputStreamInfo->version != 1) ||
+                (inputStreamInfo->hostApiType != paWASAPI))
+	        {
+	            return paIncompatibleHostApiSpecificStreamInfo;
+	        }
+		}
+
+        return paNoError;
+    }
+
+    if (outputParameters != NULL)
+    {
+        /* all standard sample formats are supported by the buffer adapter,
+            this implementation doesn't support any custom sample formats */
+        if (outputParameters->sampleFormat & paCustomFormat)
+            return paSampleFormatNotSupported;
+
+        /* unless alternate device specification is supported, reject the use of
+            paUseHostApiSpecificDeviceSpecification */
+        if (outputParameters->device == paUseHostApiSpecificDeviceSpecification)
+            return paInvalidDevice;
+
+        /* check that output device can support outputChannelCount */
+        if (outputParameters->channelCount > hostApi->deviceInfos[ outputParameters->device ]->maxOutputChannels)
+            return paInvalidChannelCount;
+
+        /* validate outputStreamInfo */
+        if(outputParameters->hostApiSpecificStreamInfo)
+        {
+			PaWasapiStreamInfo *outputStreamInfo = (PaWasapiStreamInfo *)outputParameters->hostApiSpecificStreamInfo;
+	        if ((outputStreamInfo->size != sizeof(PaWasapiStreamInfo)) ||
+	            (outputStreamInfo->version != 1) ||
+                (outputStreamInfo->hostApiType != paWASAPI))
+	        {
+	            return paIncompatibleHostApiSpecificStreamInfo;
+	        }
+        }
+
+		return paNoError;
+    }
+
+	return (inputParameters || outputParameters ? paNoError : paInternalError);
+}
+
+// ------------------------------------------------------------------------------------------
+static PaError IsFormatSupported( struct PaUtilHostApiRepresentation *hostApi,
+                                  const  PaStreamParameters *inputParameters,
+                                  const  PaStreamParameters *outputParameters,
+                                  double sampleRate )
+{
+	IAudioClient *tmpClient = NULL;
+	PaWasapiHostApiRepresentation *paWasapi = (PaWasapiHostApiRepresentation*)hostApi;
+	PaWasapiStreamInfo *inputStreamInfo = NULL, *outputStreamInfo = NULL;
+
+	// Validate PaStreamParameters
+	PaError error;
+	if ((error = IsStreamParamsValid(hostApi, inputParameters, outputParameters, sampleRate)) != paNoError)
+		return error;
+
+    if (inputParameters != NULL)
+    {
+		WAVEFORMATEXTENSIBLE wavex;
+		HRESULT hr;
+		PaError answer;
+		AUDCLNT_SHAREMODE shareMode = AUDCLNT_SHAREMODE_SHARED;
+		inputStreamInfo = (PaWasapiStreamInfo *)inputParameters->hostApiSpecificStreamInfo;
+
+		if (inputStreamInfo && (inputStreamInfo->flags & paWinWasapiExclusive))
+			shareMode  = AUDCLNT_SHAREMODE_EXCLUSIVE;
+
+		hr = ActivateAudioInterface(&paWasapi->devInfo[inputParameters->device], &tmpClient);
+		if (hr != S_OK)
+		{
+			LogHostError(hr);
+			return paInvalidDevice;
+		}
+
+		answer = GetClosestFormat(tmpClient, sampleRate, inputParameters, shareMode, &wavex, FALSE);
+		SAFE_RELEASE(tmpClient);
+
+		if (answer != paFormatIsSupported)
+			return answer;
+    }
+
+    if (outputParameters != NULL)
+    {
+		HRESULT hr;
+		WAVEFORMATEXTENSIBLE wavex;
+		PaError answer;
+		AUDCLNT_SHAREMODE shareMode = AUDCLNT_SHAREMODE_SHARED;
+        outputStreamInfo = (PaWasapiStreamInfo *)outputParameters->hostApiSpecificStreamInfo;
+
+		if (outputStreamInfo && (outputStreamInfo->flags & paWinWasapiExclusive))
+			shareMode  = AUDCLNT_SHAREMODE_EXCLUSIVE;
+
+		hr = ActivateAudioInterface(&paWasapi->devInfo[outputParameters->device], &tmpClient);
+		if (hr != S_OK)
+		{
+			LogHostError(hr);
+			return paInvalidDevice;
+		}
+
+		answer = GetClosestFormat(tmpClient, sampleRate, outputParameters, shareMode, &wavex, TRUE);
+		SAFE_RELEASE(tmpClient);
+
+		if (answer != paFormatIsSupported)
+			return answer;
+    }
+
+    return paFormatIsSupported;
+}
+
+// ------------------------------------------------------------------------------------------
+static PaUint32 PaUtil_GetFramesPerHostBuffer(PaUint32 userFramesPerBuffer, PaTime suggestedLatency, double sampleRate, PaUint32 TimerJitterMs)
+{
+	PaUint32 frames = userFramesPerBuffer + max( userFramesPerBuffer, (PaUint32)(suggestedLatency * sampleRate) );
+    frames += (PaUint32)((sampleRate * 0.001) * TimerJitterMs);
+	return frames;
+}
+
+// ------------------------------------------------------------------------------------------
+static void _RecalculateBuffersCount(PaWasapiSubStream *sub, UINT32 userFramesPerBuffer, UINT32 framesPerLatency, BOOL fullDuplex)
+{
+	// Count buffers (must be at least 1)
+	sub->buffers = (userFramesPerBuffer ? framesPerLatency / userFramesPerBuffer : 0);
+	if (sub->buffers == 0)
+		sub->buffers = 1;
+
+	// Determine amount of buffers used:
+	// - Full-duplex mode will lead to period difference, thus only 1.
+	// - Input mode, only 1, as WASAPI allows extraction of only 1 packet.
+	// - For Shared mode we use double buffering.
+	if ((sub->shareMode == AUDCLNT_SHAREMODE_EXCLUSIVE) || fullDuplex)
+	{
+		// Exclusive mode does not allow >1 buffers be used for Event interface, e.g. GetBuffer
+		// call must acquire max buffer size and it all must be processed.
+		if (sub->streamFlags & AUDCLNT_STREAMFLAGS_EVENTCALLBACK)
+			sub->userBufferAndHostMatch = 1;
+
+		// Use paUtilBoundedHostBufferSize because exclusive mode will starve and produce
+		// bad quality of audio
+		sub->buffers = 1;
+	}
+}
+
+// ------------------------------------------------------------------------------------------
+static void _CalculateAlignedPeriod(PaWasapiSubStream *pSub, UINT32 *nFramesPerLatency,
+									ALIGN_FUNC pAlignFunc)
+{
+	// Align frames to HD Audio packet size of 128 bytes for Exclusive mode only.
+	// Not aligning on Windows Vista will cause Event timeout, although Windows 7 will
+	// return AUDCLNT_E_BUFFER_SIZE_NOT_ALIGNED error to realign buffer. Aligning is necessary
+	// for Exclusive mode only! when audio data is feeded directly to hardware.
+	if (pSub->shareMode == AUDCLNT_SHAREMODE_EXCLUSIVE)
+	{
+		(*nFramesPerLatency) = AlignFramesPerBuffer((*nFramesPerLatency),
+			pSub->wavex.Format.nSamplesPerSec, pSub->wavex.Format.nBlockAlign, pAlignFunc);
+	}
+
+	// Calculate period
+	pSub->period = MakeHnsPeriod((*nFramesPerLatency), pSub->wavex.Format.nSamplesPerSec);
+}
+
+// ------------------------------------------------------------------------------------------
+static HRESULT CreateAudioClient(PaWasapiStream *pStream, PaWasapiSubStream *pSub, BOOL output, PaError *pa_error)
+{
+	PaError error;
+    HRESULT hr;
+
+	const PaWasapiDeviceInfo *pInfo  = pSub->params.device_info;
+	const PaStreamParameters *params = &pSub->params.stream_params;
+	UINT32 framesPerLatency          = pSub->params.frames_per_buffer;
+	double sampleRate                = pSub->params.sample_rate;
+	//BOOL blocking                    = pSub->params.blocking;
+	BOOL fullDuplex                  = pSub->params.full_duplex;
+
+	const UINT32 userFramesPerBuffer = framesPerLatency;
+    IAudioClient *audioClient	     = NULL;
+
+	// Assume default failure due to some reason
+	(*pa_error) = paInvalidDevice;
+
+	// Validate parameters
+    if (!pSub || !pInfo || !params)
+	{
+		(*pa_error) = paBadStreamPtr;
+        return E_POINTER;
+	}
+	if ((UINT32)sampleRate == 0)
+	{
+		(*pa_error) = paInvalidSampleRate;
+        return E_INVALIDARG;
+	}
+
+    // Get the audio client
+    hr = ActivateAudioInterface(pInfo, &audioClient);
+	if (hr != S_OK)
+	{
+		(*pa_error) = paInsufficientMemory;
+		LogHostError(hr);
+		goto done;
+	}
+
+	// Get closest format
+	if ((error = GetClosestFormat(audioClient, sampleRate, params, pSub->shareMode, &pSub->wavex, output)) != paFormatIsSupported)
+	{
+		(*pa_error) = error;
+		LogHostError(hr = AUDCLNT_E_UNSUPPORTED_FORMAT);
+		goto done; // fail, format not supported
+	}
+
+	// Check for Mono <<>> Stereo workaround
+	if ((params->channelCount == 1) && (pSub->wavex.Format.nChannels == 2))
+	{
+		/*if (blocking)
+		{
+			LogHostError(hr = AUDCLNT_E_UNSUPPORTED_FORMAT);
+			goto done; // fail, blocking mode not supported
+		}*/
+
+		// select mixer
+		pSub->monoMixer = _GetMonoToStereoMixer(WaveToPaFormat(&pSub->wavex), (pInfo->flow == eRender ? MIX_DIR__1TO2 : MIX_DIR__2TO1_L));
+		if (pSub->monoMixer == NULL)
+		{
+			(*pa_error) = paInvalidChannelCount;
+			LogHostError(hr = AUDCLNT_E_UNSUPPORTED_FORMAT);
+			goto done; // fail, no mixer for format
+		}
+	}
+
+#if 0
+	// Add suggestd latency
+	framesPerLatency += MakeFramesFromHns(SecondsTonano100(params->suggestedLatency), pSub->wavex.Format.nSamplesPerSec);
+#else
+	// Calculate host buffer size
+	if ((pSub->shareMode != AUDCLNT_SHAREMODE_EXCLUSIVE) &&
+		(!pSub->streamFlags || ((pSub->streamFlags & AUDCLNT_STREAMFLAGS_EVENTCALLBACK) == 0)))
+	{
+		framesPerLatency = PaUtil_GetFramesPerHostBuffer(userFramesPerBuffer,
+			params->suggestedLatency, pSub->wavex.Format.nSamplesPerSec, 0/*,
+			(pSub->streamFlags & AUDCLNT_STREAMFLAGS_EVENTCALLBACK ? 0 : 1)*/);
+	}
+	else
+	{
+		REFERENCE_TIME overall;
+
+		// Work 1:1 with user buffer (only polling allows to use >1)
+		framesPerLatency += MakeFramesFromHns(SecondsTonano100(params->suggestedLatency), pSub->wavex.Format.nSamplesPerSec);
+
+		// Use Polling if overall latency is > 5ms as it allows to use 100% CPU in a callback,
+		// or user specified latency parameter
+		overall = MakeHnsPeriod(framesPerLatency, pSub->wavex.Format.nSamplesPerSec);
+		if ((overall >= (106667*2)/*21.33ms*/) || ((INT32)(params->suggestedLatency*100000.0) != 0/*0.01 msec granularity*/))
+		{
+			framesPerLatency = PaUtil_GetFramesPerHostBuffer(userFramesPerBuffer,
+				params->suggestedLatency, pSub->wavex.Format.nSamplesPerSec, 0/*,
+				(streamFlags & AUDCLNT_STREAMFLAGS_EVENTCALLBACK ? 0 : 1)*/);
+
+			// Use Polling interface
+			pSub->streamFlags &= ~AUDCLNT_STREAMFLAGS_EVENTCALLBACK;
+			PRINT(("WASAPI: CreateAudioClient: forcing POLL mode\n"));
+		}
+	}
+#endif
+
+	// For full-duplex output resize buffer to be the same as for input
+	if (output && fullDuplex)
+		framesPerLatency = pStream->in.framesPerHostCallback;
+
+	// Avoid 0 frames
+	if (framesPerLatency == 0)
+		framesPerLatency = MakeFramesFromHns(pInfo->DefaultDevicePeriod, pSub->wavex.Format.nSamplesPerSec);
+
+	// Exclusive Input stream renders data in 6 packets, we must set then the size of
+	// single packet, total buffer size, e.g. required latency will be PacketSize * 6
+	if (!output && (pSub->shareMode == AUDCLNT_SHAREMODE_EXCLUSIVE))
+	{
+		// Do it only for Polling mode
+		if ((pSub->streamFlags & AUDCLNT_STREAMFLAGS_EVENTCALLBACK) == 0)
+		{
+			framesPerLatency /= WASAPI_PACKETS_PER_INPUT_BUFFER;
+		}
+	}
+
+	// Calculate aligned period
+	_CalculateAlignedPeriod(pSub, &framesPerLatency, ALIGN_BWD);
+
+	/*! Enforce min/max period for device in Shared mode to avoid bad audio quality.
+        Avoid doing so for Exclusive mode as alignment will suffer.
+	*/
+	if (pSub->shareMode == AUDCLNT_SHAREMODE_SHARED)
+	{
+		if (pSub->period < pInfo->DefaultDevicePeriod)
+		{
+			pSub->period = pInfo->DefaultDevicePeriod;
+			// Recalculate aligned period
+			framesPerLatency = MakeFramesFromHns(pSub->period, pSub->wavex.Format.nSamplesPerSec);
+			_CalculateAlignedPeriod(pSub, &framesPerLatency, ALIGN_BWD);
+		}
+	}
+	else
+	{
+		if (pSub->period < pInfo->MinimumDevicePeriod)
+		{
+			pSub->period = pInfo->MinimumDevicePeriod;
+			// Recalculate aligned period
+			framesPerLatency = MakeFramesFromHns(pSub->period, pSub->wavex.Format.nSamplesPerSec);
+			_CalculateAlignedPeriod(pSub, &framesPerLatency, ALIGN_FWD);
+		}
+	}
+
+	/*! Windows 7 does not allow to set latency lower than minimal device period and will
+	    return error: AUDCLNT_E_INVALID_DEVICE_PERIOD. Under Vista we enforce the same behavior
+	    manually for unified behavior on all platforms.
+	*/
+	{
+		/*!	AUDCLNT_E_BUFFER_SIZE_ERROR: Applies to Windows 7 and later.
+			Indicates that the buffer duration value requested by an exclusive-mode client is
+			out of range. The requested duration value for pull mode must not be greater than
+			500 milliseconds; for push mode the duration value must not be greater than 2 seconds.
+		*/
+		if (pSub->shareMode == AUDCLNT_SHAREMODE_EXCLUSIVE)
+		{
+			static const REFERENCE_TIME MAX_BUFFER_EVENT_DURATION = 500  * 10000;
+			static const REFERENCE_TIME MAX_BUFFER_POLL_DURATION  = 2000 * 10000;
+
+			if (pSub->streamFlags & AUDCLNT_STREAMFLAGS_EVENTCALLBACK)	// pull mode, max 500ms
+			{
+				if (pSub->period > MAX_BUFFER_EVENT_DURATION)
+				{
+					pSub->period = MAX_BUFFER_EVENT_DURATION;
+					// Recalculate aligned period
+					framesPerLatency = MakeFramesFromHns(pSub->period, pSub->wavex.Format.nSamplesPerSec);
+					_CalculateAlignedPeriod(pSub, &framesPerLatency, ALIGN_BWD);
+				}
+			}
+			else														// push mode, max 2000ms
+			{
+				if (pSub->period > MAX_BUFFER_POLL_DURATION)
+				{
+					pSub->period = MAX_BUFFER_POLL_DURATION;
+					// Recalculate aligned period
+					framesPerLatency = MakeFramesFromHns(pSub->period, pSub->wavex.Format.nSamplesPerSec);
+					_CalculateAlignedPeriod(pSub, &framesPerLatency, ALIGN_BWD);
+				}
+			}
+		}
+	}
+
+	// Set Raw mode (applicable only to IAudioClient2)
+#ifdef __IAudioClient2_INTERFACE_DEFINED__
+	if (GetAudioClientVersion() >= 2)
+	{
+		pa_AudioClientProperties audioProps = { 0 };
+		audioProps.cbSize     = sizeof(pa_AudioClientProperties);
+		audioProps.bIsOffload = FALSE;
+		audioProps.eCategory  = (AUDIO_STREAM_CATEGORY)pSub->params.wasapi_params.streamCategory;
+		switch (pSub->params.wasapi_params.streamOption)
+		{
+		case eStreamOptionRaw:
+			if (GetWindowsVersion() >= WINDOWS_8_1_SERVER2012R2)
+				audioProps.Options = pa_AUDCLNT_STREAMOPTIONS_RAW;
+			break;
+		case eStreamOptionMatchFormat:
+			if (GetWindowsVersion() >= WINDOWS_10_SERVER2016)
+				audioProps.Options = pa_AUDCLNT_STREAMOPTIONS_MATCH_FORMAT;
+			break;
+		}
+
+		hr = IAudioClient2_SetClientProperties((IAudioClient2 *)audioClient, (AudioClientProperties *)&audioProps);
+		if (hr != S_OK)
+		{
+			PRINT(("WASAPI: IAudioClient2_SetClientProperties(Category = %d, Options = %d) failed with error = %08X\n", audioProps.eCategory, audioProps.Options, (UINT32)hr));
+		}
+		else
+		{
+			PRINT(("WASAPI: IAudioClient2 set properties: IsOffload = %d, Category = %d, Options = %d\n", audioProps.bIsOffload, audioProps.eCategory, audioProps.Options));
+		}
+	}
+#endif
+
+	// Open the stream and associate it with an audio session
+    hr = IAudioClient_Initialize(audioClient,
+        pSub->shareMode,
+        pSub->streamFlags,
+		pSub->period,
+		(pSub->shareMode == AUDCLNT_SHAREMODE_EXCLUSIVE ? pSub->period : 0),
+		&pSub->wavex.Format,
+        NULL);
+
+	/*! WASAPI is tricky on large device buffer, sometimes 2000ms can be allocated sometimes
+	    less. There is no known guaranteed level thus we make subsequent tries by decreasing
+		buffer by 100ms per try.
+	*/
+	while ((hr == E_OUTOFMEMORY) && (pSub->period > (100 * 10000)))
+	{
+		PRINT(("WASAPI: CreateAudioClient: decreasing buffer size to %d milliseconds\n", (pSub->period / 10000)));
+
+		// Decrease by 100ms and try again
+		pSub->period -= (100 * 10000);
+
+		// Recalculate aligned period
+		framesPerLatency = MakeFramesFromHns(pSub->period, pSub->wavex.Format.nSamplesPerSec);
+		_CalculateAlignedPeriod(pSub, &framesPerLatency, ALIGN_BWD);
+
+        // Release the previous allocations
+        SAFE_RELEASE(audioClient);
+
+        // Create a new audio client
+        hr = ActivateAudioInterface(pInfo, &audioClient);
+    	if (hr != S_OK)
+		{
+			(*pa_error) = paInsufficientMemory;
+			LogHostError(hr);
+			goto done;
+		}
+
+		// Open the stream and associate it with an audio session
+		hr = IAudioClient_Initialize(audioClient,
+			pSub->shareMode,
+			pSub->streamFlags,
+			pSub->period,
+			(pSub->shareMode == AUDCLNT_SHAREMODE_EXCLUSIVE ? pSub->period : 0),
+			&pSub->wavex.Format,
+			NULL);
+	}
+
+	/*! WASAPI buffer size failure. Fallback to using default size.
+	*/
+	if (hr == AUDCLNT_E_BUFFER_SIZE_ERROR)
+	{
+		// Use default
+		pSub->period = pInfo->DefaultDevicePeriod;
+
+		PRINT(("WASAPI: CreateAudioClient: correcting buffer size to device default\n"));
+
+        // Release the previous allocations
+        SAFE_RELEASE(audioClient);
+
+        // Create a new audio client
+        hr = ActivateAudioInterface(pInfo, &audioClient);
+    	if (hr != S_OK)
+		{
+			(*pa_error) = paInsufficientMemory;
+			LogHostError(hr);
+			goto done;
+		}
+
+		// Open the stream and associate it with an audio session
+		hr = IAudioClient_Initialize(audioClient,
+			pSub->shareMode,
+			pSub->streamFlags,
+			pSub->period,
+			(pSub->shareMode == AUDCLNT_SHAREMODE_EXCLUSIVE ? pSub->period : 0),
+			&pSub->wavex.Format,
+			NULL);
+	}
+
+    /*! If the requested buffer size is not aligned. Can be triggered by Windows 7 and up.
+	    Should not be be triggered ever as we do align buffers always with _CalculateAlignedPeriod.
+	*/
+    if (hr == AUDCLNT_E_BUFFER_SIZE_NOT_ALIGNED)
+    {
+		UINT32 frames = 0;
+
+        // Get the next aligned frame
+        hr = IAudioClient_GetBufferSize(audioClient, &frames);
+		if (hr != S_OK)
+		{
+			(*pa_error) = paInvalidDevice;
+			LogHostError(hr);
+			goto done;
+		}
+
+		PRINT(("WASAPI: CreateAudioClient: aligning buffer size to % frames\n", frames));
+
+        // Release the previous allocations
+        SAFE_RELEASE(audioClient);
+
+        // Create a new audio client
+        hr = ActivateAudioInterface(pInfo, &audioClient);
+    	if (hr != S_OK)
+		{
+			(*pa_error) = paInsufficientMemory;
+			LogHostError(hr);
+			goto done;
+		}
+
+		// Get closest format
+		if ((error = GetClosestFormat(audioClient, sampleRate, params, pSub->shareMode, &pSub->wavex, output)) != paFormatIsSupported)
+		{
+			(*pa_error) = error;
+			LogHostError(hr = AUDCLNT_E_UNSUPPORTED_FORMAT); // fail, format not supported
+			goto done;
+		}
+
+		// Check for Mono >> Stereo workaround
+		if ((params->channelCount == 1) && (pSub->wavex.Format.nChannels == 2))
+		{
+			/*if (blocking)
+			{
+				LogHostError(hr = AUDCLNT_E_UNSUPPORTED_FORMAT);
+				goto done; // fail, blocking mode not supported
+			}*/
+
+			// Select mixer
+			pSub->monoMixer = _GetMonoToStereoMixer(WaveToPaFormat(&pSub->wavex), (pInfo->flow == eRender ? MIX_DIR__1TO2 : MIX_DIR__2TO1_L));
+			if (pSub->monoMixer == NULL)
+			{
+				(*pa_error) = paInvalidChannelCount;
+				LogHostError(hr = AUDCLNT_E_UNSUPPORTED_FORMAT);
+				goto done; // fail, no mixer for format
+			}
+		}
+
+		// Calculate period
+		pSub->period = MakeHnsPeriod(frames, pSub->wavex.Format.nSamplesPerSec);
+
+        // Open the stream and associate it with an audio session
+        hr = IAudioClient_Initialize(audioClient,
+            pSub->shareMode,
+            pSub->streamFlags,
+			pSub->period,
+			(pSub->shareMode == AUDCLNT_SHAREMODE_EXCLUSIVE ? pSub->period : 0),
+            &pSub->wavex.Format,
+            NULL);
+    	if (hr != S_OK)
+		{
+			(*pa_error) = paInvalidDevice;
+			LogHostError(hr);
+			goto done;
+		}
+    }
+    else
+	if (hr != S_OK)
+    {
+		(*pa_error) = paInvalidDevice;
+		LogHostError(hr);
+		goto done;
+    }
+
+    // Set client
+	pSub->clientParent = audioClient;
+    IAudioClient_AddRef(pSub->clientParent);
+
+	// Recalculate buffers count
+	_RecalculateBuffersCount(pSub,
+		userFramesPerBuffer,
+		MakeFramesFromHns(pSub->period, pSub->wavex.Format.nSamplesPerSec),
+		fullDuplex);
+
+	// No error, client is succesfully created
+	(*pa_error) = paNoError;
+
+done:
+
+    // Clean up
+    SAFE_RELEASE(audioClient);
+    return hr;
+}
+
+// ------------------------------------------------------------------------------------------
+static PaError ActivateAudioClientOutput(PaWasapiStream *stream)
+{
+	HRESULT hr;
+	PaError result;
+
+	UINT32 maxBufferSize   = 0;
+	PaTime buffer_latency  = 0;
+	UINT32 framesPerBuffer = stream->out.params.frames_per_buffer;
+
+	// Create Audio client
+	hr = CreateAudioClient(stream, &stream->out, TRUE, &result);
+    if (hr != S_OK)
+	{
+		LogPaError(result);
+		goto error;
+    }
+	LogWAVEFORMATEXTENSIBLE(&stream->out.wavex);
+
+	// Activate volume
+	stream->outVol = NULL;
+    /*hr = info->device->Activate(
+        __uuidof(IAudioEndpointVolume), CLSCTX_INPROC_SERVER, NULL,
+        (void**)&stream->outVol);
+    if (hr != S_OK)
+        return paInvalidDevice;*/
+
+    // Get max possible buffer size to check if it is not less than that we request
+    hr = IAudioClient_GetBufferSize(stream->out.clientParent, &maxBufferSize);
+    if (hr != S_OK)
+	{
+		LogHostError(hr);
+		LogPaError(result = paInvalidDevice);
+		goto error;
+	}
+
+    // Correct buffer to max size if it maxed out result of GetBufferSize
+	stream->out.bufferSize = maxBufferSize;
+
+	// Get interface latency (actually uneeded as we calculate latency from the size
+	// of maxBufferSize).
+    hr = IAudioClient_GetStreamLatency(stream->out.clientParent, &stream->out.deviceLatency);
+    if (hr != S_OK)
+	{
+		LogHostError(hr);
+		LogPaError(result = paInvalidDevice);
+		goto error;
+	}
+	//stream->out.latencySeconds = nano100ToSeconds(stream->out.deviceLatency);
+
+    // Number of frames that are required at each period
+	stream->out.framesPerHostCallback = maxBufferSize;
+
+	// Calculate frames per single buffer, if buffers > 1 then always framesPerBuffer
+	stream->out.framesPerBuffer =
+		(stream->out.userBufferAndHostMatch ? stream->out.framesPerHostCallback : framesPerBuffer);
+
+	// Calculate buffer latency
+	buffer_latency = (PaTime)maxBufferSize / stream->out.wavex.Format.nSamplesPerSec;
+
+	// Append buffer latency to interface latency in shared mode (see GetStreamLatency notes)
+	stream->out.latencySeconds = buffer_latency;
+
+	PRINT(("WASAPI::OpenStream(output): framesPerUser[ %d ] framesPerHost[ %d ] latency[ %.02fms ] exclusive[ %s ] wow64_fix[ %s ] mode[ %s ]\n", (UINT32)framesPerBuffer, (UINT32)stream->out.framesPerHostCallback, (float)(stream->out.latencySeconds*1000.0f), (stream->out.shareMode == AUDCLNT_SHAREMODE_EXCLUSIVE ? "YES" : "NO"), (stream->out.params.wow64_workaround ? "YES" : "NO"), (stream->out.streamFlags & AUDCLNT_STREAMFLAGS_EVENTCALLBACK ? "EVENT" : "POLL")));
+
+	return paNoError;
+
+error:
+
+	return result;
+}
+
+// ------------------------------------------------------------------------------------------
+static PaError ActivateAudioClientInput(PaWasapiStream *stream)
+{
+	HRESULT hr;
+	PaError result;
+
+	UINT32 maxBufferSize   = 0;
+	PaTime buffer_latency  = 0;
+	UINT32 framesPerBuffer = stream->in.params.frames_per_buffer;
+
+	// Create Audio client
+	hr = CreateAudioClient(stream, &stream->in, FALSE, &result);
+    if (hr != S_OK)
+	{
+		LogPaError(result);
+		goto error;
+    }
+	LogWAVEFORMATEXTENSIBLE(&stream->in.wavex);
+
+	// Create volume mgr
+	stream->inVol = NULL;
+    /*hr = info->device->Activate(
+        __uuidof(IAudioEndpointVolume), CLSCTX_INPROC_SERVER, NULL,
+        (void**)&stream->inVol);
+    if (hr != S_OK)
+        return paInvalidDevice;*/
+
+    // Get max possible buffer size to check if it is not less than that we request
+    hr = IAudioClient_GetBufferSize(stream->in.clientParent, &maxBufferSize);
+    if (hr != S_OK)
+	{
+		LogHostError(hr);
+		LogPaError(result = paInvalidDevice);
+		goto error;
+	}
+
+    // Correct buffer to max size if it maxed out result of GetBufferSize
+	stream->in.bufferSize = maxBufferSize;
+
+	// Get interface latency (actually uneeded as we calculate latency from the size
+	// of maxBufferSize).
+    hr = IAudioClient_GetStreamLatency(stream->in.clientParent, &stream->in.deviceLatency);
+    if (hr != S_OK)
+	{
+		LogHostError(hr);
+		LogPaError(result = paInvalidDevice);
+		goto error;
+	}
+	//stream->in.latencySeconds = nano100ToSeconds(stream->in.deviceLatency);
+
+    // Number of frames that are required at each period
+	stream->in.framesPerHostCallback = maxBufferSize;
+
+	// Calculate frames per single buffer, if buffers > 1 then always framesPerBuffer
+	stream->in.framesPerBuffer =
+		(stream->in.userBufferAndHostMatch ? stream->in.framesPerHostCallback : framesPerBuffer);
+
+	// Calculate buffer latency
+	buffer_latency = (PaTime)maxBufferSize / stream->in.wavex.Format.nSamplesPerSec;
+
+	// Append buffer latency to interface latency in shared mode (see GetStreamLatency notes)
+	stream->in.latencySeconds = buffer_latency;
+
+	PRINT(("WASAPI::OpenStream(input): framesPerUser[ %d ] framesPerHost[ %d ] latency[ %.02fms ] exclusive[ %s ] wow64_fix[ %s ] mode[ %s ]\n", (UINT32)framesPerBuffer, (UINT32)stream->in.framesPerHostCallback, (float)(stream->in.latencySeconds*1000.0f), (stream->in.shareMode == AUDCLNT_SHAREMODE_EXCLUSIVE ? "YES" : "NO"), (stream->in.params.wow64_workaround ? "YES" : "NO"), (stream->in.streamFlags & AUDCLNT_STREAMFLAGS_EVENTCALLBACK ? "EVENT" : "POLL")));
+
+	return paNoError;
+
+error:
+
+	return result;
+}
+
+// ------------------------------------------------------------------------------------------
+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;
+	HRESULT hr;
+    PaWasapiHostApiRepresentation *paWasapi = (PaWasapiHostApiRepresentation*)hostApi;
+    PaWasapiStream *stream = NULL;
+    int inputChannelCount, outputChannelCount;
+    PaSampleFormat inputSampleFormat, outputSampleFormat;
+    PaSampleFormat hostInputSampleFormat, hostOutputSampleFormat;
+	PaWasapiStreamInfo *inputStreamInfo = NULL, *outputStreamInfo = NULL;
+	PaWasapiDeviceInfo *info = NULL;
+	ULONG framesPerHostCallback;
+	PaUtilHostBufferSizeMode bufferMode;
+	const BOOL fullDuplex = ((inputParameters != NULL) && (outputParameters != NULL));
+
+	// validate PaStreamParameters
+	if ((result = IsStreamParamsValid(hostApi, inputParameters, outputParameters, sampleRate)) != paNoError)
+		return LogPaError(result);
+
+    // Validate platform specific flags
+    if ((streamFlags & paPlatformSpecificFlags) != 0)
+	{
+		LogPaError(result = paInvalidFlag); /* unexpected platform specific flag */
+		goto error;
+	}
+
+	// Allocate memory for PaWasapiStream
+    if ((stream = (PaWasapiStream *)PaUtil_AllocateMemory(sizeof(PaWasapiStream))) == NULL)
+	{
+        LogPaError(result = paInsufficientMemory);
+        goto error;
+    }
+
+	// Default thread priority is Audio: for exclusive mode we will use Pro Audio.
+	stream->nThreadPriority = eThreadPriorityAudio;
+
+	// Set default number of frames: paFramesPerBufferUnspecified
+	if (framesPerBuffer == paFramesPerBufferUnspecified)
+	{
+		UINT32 framesPerBufferIn  = 0, framesPerBufferOut = 0;
+		if (inputParameters != NULL)
+		{
+			info = &paWasapi->devInfo[inputParameters->device];
+			framesPerBufferIn = MakeFramesFromHns(info->DefaultDevicePeriod, (UINT32)sampleRate);
+		}
+		if (outputParameters != NULL)
+		{
+			info = &paWasapi->devInfo[outputParameters->device];
+			framesPerBufferOut = MakeFramesFromHns(info->DefaultDevicePeriod, (UINT32)sampleRate);
+		}
+		// choosing maximum default size
+		framesPerBuffer = max(framesPerBufferIn, framesPerBufferOut);
+	}
+	if (framesPerBuffer == 0)
+		framesPerBuffer = ((UINT32)sampleRate / 100) * 2;
+
+	// Try create device: Input
+	if (inputParameters != NULL)
+    {
+        inputChannelCount = inputParameters->channelCount;
+        inputSampleFormat = inputParameters->sampleFormat;
+        info              = &paWasapi->devInfo[inputParameters->device];
+
+		// default Shared Mode
+		stream->in.shareMode = AUDCLNT_SHAREMODE_SHARED;
+
+		// PaWasapiStreamInfo
+		if (inputParameters->hostApiSpecificStreamInfo != NULL)
+		{
+			memcpy(&stream->in.params.wasapi_params, inputParameters->hostApiSpecificStreamInfo, min(sizeof(stream->in.params.wasapi_params), ((PaWasapiStreamInfo *)inputParameters->hostApiSpecificStreamInfo)->size));
+			stream->in.params.wasapi_params.size = sizeof(stream->in.params.wasapi_params);
+
+			stream->in.params.stream_params.hostApiSpecificStreamInfo = &stream->in.params.wasapi_params;
+			inputStreamInfo = &stream->in.params.wasapi_params;
+
+			stream->in.flags = inputStreamInfo->flags;
+
+			// Exclusive Mode
+			if (inputStreamInfo->flags & paWinWasapiExclusive)
+			{
+				// Boost thread priority
+				stream->nThreadPriority = eThreadPriorityProAudio;
+				// Make Exclusive
+				stream->in.shareMode = AUDCLNT_SHAREMODE_EXCLUSIVE;
+			}
+
+			// explicit thread priority level
+			if (inputStreamInfo->flags & paWinWasapiThreadPriority)
+			{
+				if ((inputStreamInfo->threadPriority > eThreadPriorityNone) &&
+					(inputStreamInfo->threadPriority <= eThreadPriorityWindowManager))
+					stream->nThreadPriority = inputStreamInfo->threadPriority;
+			}
+		}
+
+		// Choose processing mode
+		stream->in.streamFlags = (stream->in.shareMode == AUDCLNT_SHAREMODE_EXCLUSIVE ? AUDCLNT_STREAMFLAGS_EVENTCALLBACK : 0);
+		if (paWasapi->useWOW64Workaround)
+			stream->in.streamFlags = 0; // polling interface
+		else
+		if (streamCallback == NULL)
+			stream->in.streamFlags = 0; // polling interface
+		else
+		if ((inputStreamInfo != NULL) && (inputStreamInfo->flags & paWinWasapiPolling))
+			stream->in.streamFlags = 0; // polling interface
+		else
+		if (fullDuplex)
+			stream->in.streamFlags = 0; // polling interface is implemented for full-duplex mode also
+
+		// Fill parameters for Audio Client creation
+		stream->in.params.device_info       = info;
+		stream->in.params.stream_params     = (*inputParameters);
+		stream->in.params.frames_per_buffer = framesPerBuffer;
+		stream->in.params.sample_rate       = sampleRate;
+		stream->in.params.blocking          = (streamCallback == NULL);
+		stream->in.params.full_duplex       = fullDuplex;
+		stream->in.params.wow64_workaround  = paWasapi->useWOW64Workaround;
+
+		// Create and activate audio client
+		hr = ActivateAudioClientInput(stream);
+        if (hr != S_OK)
+		{
+			LogPaError(result = paInvalidDevice);
+			goto error;
+        }
+
+		// Get closest format
+        hostInputSampleFormat = PaUtil_SelectClosestAvailableFormat( WaveToPaFormat(&stream->in.wavex), inputSampleFormat );
+
+        // Set user-side custom host processor
+        if ((inputStreamInfo != NULL) &&
+            (inputStreamInfo->flags & paWinWasapiRedirectHostProcessor))
+        {
+            stream->hostProcessOverrideInput.processor = inputStreamInfo->hostProcessorInput;
+            stream->hostProcessOverrideInput.userData = userData;
+        }
+
+		// Only get IAudioCaptureClient input once here instead of getting it at multiple places based on the use
+		hr = IAudioClient_GetService(stream->in.clientParent, &pa_IID_IAudioCaptureClient, (void **)&stream->captureClientParent);
+		if (hr != S_OK)
+		{
+			LogHostError(hr);
+			LogPaError(result = paUnanticipatedHostError);
+			goto error;
+		}
+
+		// Create ring buffer for blocking mode (It is needed because we fetch Input packets, not frames,
+		// and thus we have to save partial packet if such remains unread)
+		if (stream->in.params.blocking == TRUE)
+		{
+			UINT32 bufferFrames = ALIGN_NEXT_POW2((stream->in.framesPerHostCallback / WASAPI_PACKETS_PER_INPUT_BUFFER) * 2);
+			UINT32 frameSize    = stream->in.wavex.Format.nBlockAlign;
+
+			// buffer
+			if ((stream->in.tailBuffer = PaUtil_AllocateMemory(sizeof(PaUtilRingBuffer))) == NULL)
+			{
+				LogPaError(result = paInsufficientMemory);
+				goto error;
+			}
+			memset(stream->in.tailBuffer, 0, sizeof(PaUtilRingBuffer));
+
+			// buffer memory region
+			stream->in.tailBufferMemory = PaUtil_AllocateMemory(frameSize * bufferFrames);
+			if (stream->in.tailBufferMemory == NULL)
+			{
+				LogPaError(result = paInsufficientMemory);
+				goto error;
+			}
+
+			// initialize
+			if (PaUtil_InitializeRingBuffer(stream->in.tailBuffer, frameSize, bufferFrames,	stream->in.tailBufferMemory) != 0)
+			{
+				LogPaError(result = paInternalError);
+				goto error;
+			}
+		}
+	}
+    else
+    {
+        inputChannelCount = 0;
+        inputSampleFormat = hostInputSampleFormat = paInt16; /* Surpress 'uninitialised var' warnings. */
+    }
+
+	// Try create device: Output
+    if (outputParameters != NULL)
+    {
+        outputChannelCount = outputParameters->channelCount;
+        outputSampleFormat = outputParameters->sampleFormat;
+		info               = &paWasapi->devInfo[outputParameters->device];
+
+		// default Shared Mode
+		stream->out.shareMode = AUDCLNT_SHAREMODE_SHARED;
+
+		// set PaWasapiStreamInfo
+		if (outputParameters->hostApiSpecificStreamInfo != NULL)
+		{
+			memcpy(&stream->out.params.wasapi_params, outputParameters->hostApiSpecificStreamInfo, min(sizeof(stream->out.params.wasapi_params), ((PaWasapiStreamInfo *)outputParameters->hostApiSpecificStreamInfo)->size));
+			stream->out.params.wasapi_params.size = sizeof(stream->out.params.wasapi_params);
+
+			stream->out.params.stream_params.hostApiSpecificStreamInfo = &stream->out.params.wasapi_params;
+			outputStreamInfo = &stream->out.params.wasapi_params;
+
+			stream->out.flags = outputStreamInfo->flags;
+
+			// Exclusive Mode
+			if (outputStreamInfo->flags & paWinWasapiExclusive)
+			{
+				// Boost thread priority
+				stream->nThreadPriority = eThreadPriorityProAudio;
+				// Make Exclusive
+				stream->out.shareMode = AUDCLNT_SHAREMODE_EXCLUSIVE;
+			}
+
+			// explicit thread priority level
+			if (outputStreamInfo->flags & paWinWasapiThreadPriority)
+			{
+				if ((outputStreamInfo->threadPriority > eThreadPriorityNone) &&
+					(outputStreamInfo->threadPriority <= eThreadPriorityWindowManager))
+					stream->nThreadPriority = outputStreamInfo->threadPriority;
+			}
+		}
+
+		// Choose processing mode
+		stream->out.streamFlags = (stream->out.shareMode == AUDCLNT_SHAREMODE_EXCLUSIVE ? AUDCLNT_STREAMFLAGS_EVENTCALLBACK : 0);
+		if (paWasapi->useWOW64Workaround)
+			stream->out.streamFlags = 0; // polling interface
+		else
+		if (streamCallback == NULL)
+			stream->out.streamFlags = 0; // polling interface
+		else
+		if ((outputStreamInfo != NULL) && (outputStreamInfo->flags & paWinWasapiPolling))
+			stream->out.streamFlags = 0; // polling interface
+		else
+		if (fullDuplex)
+			stream->out.streamFlags = 0; // polling interface is implemented for full-duplex mode also
+
+		// Fill parameters for Audio Client creation
+		stream->out.params.device_info       = info;
+		stream->out.params.stream_params     = (*outputParameters);
+		stream->out.params.frames_per_buffer = framesPerBuffer;
+		stream->out.params.sample_rate       = sampleRate;
+		stream->out.params.blocking          = (streamCallback == NULL);
+		stream->out.params.full_duplex       = fullDuplex;
+		stream->out.params.wow64_workaround  = paWasapi->useWOW64Workaround;
+
+		// Create and activate audio client
+		hr = ActivateAudioClientOutput(stream);
+        if (hr != S_OK)
+		{
+			LogPaError(result = paInvalidDevice);
+			goto error;
+        }
+
+		// Get closest format
+        hostOutputSampleFormat = PaUtil_SelectClosestAvailableFormat( WaveToPaFormat(&stream->out.wavex), outputSampleFormat );
+
+        // Set user-side custom host processor
+        if ((outputStreamInfo != NULL) &&
+            (outputStreamInfo->flags & paWinWasapiRedirectHostProcessor))
+        {
+            stream->hostProcessOverrideOutput.processor = outputStreamInfo->hostProcessorOutput;
+            stream->hostProcessOverrideOutput.userData = userData;
+        }
+
+		// Only get IAudioCaptureClient output once here instead of getting it at multiple places based on the use
+		hr = IAudioClient_GetService(stream->out.clientParent, &pa_IID_IAudioRenderClient, (void **)&stream->renderClientParent);
+		if (hr != S_OK)
+		{
+			LogHostError(hr);
+			LogPaError(result = paUnanticipatedHostError);
+			goto error;
+		}
+	}
+    else
+    {
+        outputChannelCount = 0;
+        outputSampleFormat = hostOutputSampleFormat = paInt16; /* Surpress 'uninitialized var' warnings. */
+    }
+
+	// log full-duplex
+	if (fullDuplex)
+		PRINT(("WASAPI::OpenStream: full-duplex mode\n"));
+
+	// paWinWasapiPolling must be on/or not on both streams
+	if ((inputParameters != NULL) && (outputParameters != NULL))
+	{
+		if ((inputStreamInfo != NULL) && (outputStreamInfo != NULL))
+		{
+			if (((inputStreamInfo->flags & paWinWasapiPolling) &&
+				!(outputStreamInfo->flags & paWinWasapiPolling))
+				||
+				(!(inputStreamInfo->flags & paWinWasapiPolling) &&
+				 (outputStreamInfo->flags & paWinWasapiPolling)))
+			{
+				LogPaError(result = paInvalidFlag);
+				goto error;
+			}
+		}
+	}
+
+	// Initialize stream representation
+    if (streamCallback)
+    {
+		stream->bBlocking = FALSE;
+        PaUtil_InitializeStreamRepresentation(&stream->streamRepresentation,
+                                              &paWasapi->callbackStreamInterface,
+											  streamCallback, userData);
+    }
+    else
+    {
+		stream->bBlocking = TRUE;
+        PaUtil_InitializeStreamRepresentation(&stream->streamRepresentation,
+                                              &paWasapi->blockingStreamInterface,
+											  streamCallback, userData);
+    }
+
+	// Initialize CPU measurer
+    PaUtil_InitializeCpuLoadMeasurer(&stream->cpuLoadMeasurer, sampleRate);
+
+	if (outputParameters && inputParameters)
+	{
+		// serious problem #1 - No, Not a problem, especially concerning Exclusive mode.
+		// Input device in exclusive mode somehow is getting large buffer always, thus we
+		// adjust Output latency to reflect it, thus period will differ but playback will be
+		// normal.
+		/*if (stream->in.period != stream->out.period)
+		{
+			PRINT(("WASAPI: OpenStream: period discrepancy\n"));
+			LogPaError(result = paBadIODeviceCombination);
+			goto error;
+		}*/
+
+		// serious problem #2 - No, Not a problem, as framesPerHostCallback take into account
+		// sample size while it is not a problem for PA full-duplex, we must care of
+		// preriod only!
+		/*if (stream->out.framesPerHostCallback != stream->in.framesPerHostCallback)
+		{
+			PRINT(("WASAPI: OpenStream: framesPerHostCallback discrepancy\n"));
+			goto error;
+		}*/
+	}
+
+	// Calculate frames per host for processor
+	framesPerHostCallback = (outputParameters ? stream->out.framesPerBuffer : stream->in.framesPerBuffer);
+
+	// Choose correct mode of buffer processing:
+	// Exclusive/Shared non paWinWasapiPolling mode: paUtilFixedHostBufferSize - always fixed
+	// Exclusive/Shared paWinWasapiPolling mode: paUtilBoundedHostBufferSize - may vary for Exclusive or Full-duplex
+	bufferMode = paUtilFixedHostBufferSize;
+	if (inputParameters) // !!! WASAPI IAudioCaptureClient::GetBuffer extracts not number of frames but 1 packet, thus we always must adapt
+		bufferMode = paUtilBoundedHostBufferSize;
+	else
+	if (outputParameters)
+	{
+		if ((stream->out.buffers == 1) &&
+			(!stream->out.streamFlags || ((stream->out.streamFlags & AUDCLNT_STREAMFLAGS_EVENTCALLBACK) == 0)))
+			bufferMode = paUtilBoundedHostBufferSize;
+	}
+	stream->bufferMode = bufferMode;
+
+    // Initialize buffer processor
+    result =  PaUtil_InitializeBufferProcessor(
+		&stream->bufferProcessor,
+        inputChannelCount,
+		inputSampleFormat,
+		hostInputSampleFormat,
+        outputChannelCount,
+		outputSampleFormat,
+		hostOutputSampleFormat,
+        sampleRate,
+		streamFlags,
+		framesPerBuffer,
+        framesPerHostCallback,
+		bufferMode,
+        streamCallback,
+		userData);
+    if (result != paNoError)
+	{
+		LogPaError(result);
+        goto error;
+	}
+
+	// Set Input latency
+    stream->streamRepresentation.streamInfo.inputLatency =
+            ((double)PaUtil_GetBufferProcessorInputLatencyFrames(&stream->bufferProcessor) / sampleRate)
+			+ ((inputParameters)?stream->in.latencySeconds : 0);
+
+	// Set Output latency
+    stream->streamRepresentation.streamInfo.outputLatency =
+            ((double)PaUtil_GetBufferProcessorOutputLatencyFrames(&stream->bufferProcessor) / sampleRate)
+			+ ((outputParameters)?stream->out.latencySeconds : 0);
+
+	// Set SR
+    stream->streamRepresentation.streamInfo.sampleRate = sampleRate;
+
+    (*s) = (PaStream *)stream;
+    return result;
+
+error:
+
+    if (stream != NULL)
+		CloseStream(stream);
+
+    return result;
+}
+
+// ------------------------------------------------------------------------------------------
+static PaError CloseStream( PaStream* s )
+{
+    PaError result = paNoError;
+    PaWasapiStream *stream = (PaWasapiStream*)s;
+
+	// abort active stream
+	if (IsStreamActive(s))
+	{
+		result = AbortStream(s);
+	}
+
+    SAFE_RELEASE(stream->captureClientParent);
+    SAFE_RELEASE(stream->renderClientParent);
+    SAFE_RELEASE(stream->out.clientParent);
+    SAFE_RELEASE(stream->in.clientParent);
+	SAFE_RELEASE(stream->inVol);
+	SAFE_RELEASE(stream->outVol);
+
+	CloseHandle(stream->event[S_INPUT]);
+	CloseHandle(stream->event[S_OUTPUT]);
+
+	_StreamCleanup(stream);
+
+	PaWasapi_FreeMemory(stream->in.monoBuffer);
+	PaWasapi_FreeMemory(stream->out.monoBuffer);
+
+	PaUtil_FreeMemory(stream->in.tailBuffer);
+	PaUtil_FreeMemory(stream->in.tailBufferMemory);
+
+	PaUtil_FreeMemory(stream->out.tailBuffer);
+	PaUtil_FreeMemory(stream->out.tailBufferMemory);
+
+    PaUtil_TerminateBufferProcessor(&stream->bufferProcessor);
+    PaUtil_TerminateStreamRepresentation(&stream->streamRepresentation);
+    PaUtil_FreeMemory(stream);
+
+    return result;
+}
+
+// ------------------------------------------------------------------------------------------
+HRESULT UnmarshalSubStreamComPointers(PaWasapiSubStream *substream) 
+{
+#ifndef PA_WINRT
+	HRESULT hResult = S_OK;
+	HRESULT hFirstBadResult = S_OK;
+	substream->clientProc = NULL;
+
+	// IAudioClient
+	hResult = CoGetInterfaceAndReleaseStream(substream->clientStream, GetAudioClientIID(), (LPVOID*)&substream->clientProc);
+	substream->clientStream = NULL;
+	if (hResult != S_OK) 
+	{
+		hFirstBadResult = (hFirstBadResult == S_OK) ? hResult : hFirstBadResult;
+	}
+
+	return hFirstBadResult;
+
+#else
+	(void)substream;
+	return S_OK;
+#endif
+}
+
+// ------------------------------------------------------------------------------------------
+HRESULT UnmarshalStreamComPointers(PaWasapiStream *stream) 
+{
+#ifndef PA_WINRT
+	HRESULT hResult = S_OK;
+	HRESULT hFirstBadResult = S_OK;
+	stream->captureClient = NULL;
+	stream->renderClient = NULL;
+	stream->in.clientProc = NULL;
+	stream->out.clientProc = NULL;
+
+	if (NULL != stream->in.clientParent) 
+	{
+		// SubStream pointers
+		hResult = UnmarshalSubStreamComPointers(&stream->in);
+		if (hResult != S_OK) 
+		{
+			hFirstBadResult = (hFirstBadResult == S_OK) ? hResult : hFirstBadResult;
+		}
+
+		// IAudioCaptureClient
+		hResult = CoGetInterfaceAndReleaseStream(stream->captureClientStream, &pa_IID_IAudioCaptureClient, (LPVOID*)&stream->captureClient);
+		stream->captureClientStream = NULL;
+		if (hResult != S_OK) 
+		{
+			hFirstBadResult = (hFirstBadResult == S_OK) ? hResult : hFirstBadResult;
+		}
+	}
+
+	if (NULL != stream->out.clientParent) 
+	{
+		// SubStream pointers
+		hResult = UnmarshalSubStreamComPointers(&stream->out);
+		if (hResult != S_OK) 
+		{
+			hFirstBadResult = (hFirstBadResult == S_OK) ? hResult : hFirstBadResult;
+		}
+
+		// IAudioRenderClient
+		hResult = CoGetInterfaceAndReleaseStream(stream->renderClientStream, &pa_IID_IAudioRenderClient, (LPVOID*)&stream->renderClient);
+		stream->renderClientStream = NULL;
+		if (hResult != S_OK) 
+		{
+			hFirstBadResult = (hFirstBadResult == S_OK) ? hResult : hFirstBadResult;
+		}
+	}
+
+	return hFirstBadResult;
+#else
+	if (stream->in.clientParent != NULL)
+	{
+		stream->in.clientProc = stream->in.clientParent;
+		IAudioClient_AddRef(stream->in.clientParent);
+	}
+
+	if (stream->out.clientParent != NULL)
+	{
+		stream->out.clientProc = stream->out.clientParent;
+		IAudioClient_AddRef(stream->out.clientParent);
+	}
+
+	if (stream->renderClientParent != NULL)
+	{
+		stream->renderClient = stream->renderClientParent;
+		IAudioRenderClient_AddRef(stream->renderClientParent);
+	}
+
+	if (stream->captureClientParent != NULL)
+	{
+		stream->captureClient = stream->captureClientParent;
+		IAudioCaptureClient_AddRef(stream->captureClientParent);
+	}
+
+	return S_OK;
+#endif
+}
+
+// -----------------------------------------------------------------------------------------
+void ReleaseUnmarshaledSubComPointers(PaWasapiSubStream *substream) 
+{
+	SAFE_RELEASE(substream->clientProc);
+}
+
+// -----------------------------------------------------------------------------------------
+void ReleaseUnmarshaledComPointers(PaWasapiStream *stream) 
+{
+	// Release AudioClient services first
+	SAFE_RELEASE(stream->captureClient);
+	SAFE_RELEASE(stream->renderClient);
+
+	// Release AudioClients
+	ReleaseUnmarshaledSubComPointers(&stream->in);
+	ReleaseUnmarshaledSubComPointers(&stream->out);
+}
+
+// ------------------------------------------------------------------------------------------
+HRESULT MarshalSubStreamComPointers(PaWasapiSubStream *substream) 
+{
+#ifndef PA_WINRT
+	HRESULT hResult;
+	substream->clientStream = NULL;
+
+	// IAudioClient
+	hResult = CoMarshalInterThreadInterfaceInStream(GetAudioClientIID(), (LPUNKNOWN)substream->clientParent, &substream->clientStream);
+	if (hResult != S_OK)
+		goto marshal_sub_error;
+
+	return hResult;
+
+	// If marshaling error occurred, make sure to release everything.
+marshal_sub_error:
+
+	UnmarshalSubStreamComPointers(substream);
+	ReleaseUnmarshaledSubComPointers(substream);
+	return hResult;
+#else
+	(void)substream;
+	return S_OK;
+#endif
+}
+
+// ------------------------------------------------------------------------------------------
+HRESULT MarshalStreamComPointers(PaWasapiStream *stream) 
+{
+#ifndef PA_WINRT
+	HRESULT hResult = S_OK;
+	stream->captureClientStream = NULL;
+	stream->in.clientStream = NULL;
+	stream->renderClientStream = NULL;
+	stream->out.clientStream = NULL;
+
+	if (NULL != stream->in.clientParent) 
+	{
+		// SubStream pointers
+		hResult = MarshalSubStreamComPointers(&stream->in);
+		if (hResult != S_OK) 
+			goto marshal_error;
+
+		// IAudioCaptureClient
+		hResult = CoMarshalInterThreadInterfaceInStream(&pa_IID_IAudioCaptureClient, (LPUNKNOWN)stream->captureClientParent, &stream->captureClientStream);
+		if (hResult != S_OK) 
+			goto marshal_error;
+	}
+
+	if (NULL != stream->out.clientParent) 
+	{
+		// SubStream pointers
+		hResult = MarshalSubStreamComPointers(&stream->out);
+		if (hResult != S_OK) 
+			goto marshal_error;
+
+		// IAudioRenderClient
+		hResult = CoMarshalInterThreadInterfaceInStream(&pa_IID_IAudioRenderClient, (LPUNKNOWN)stream->renderClientParent, &stream->renderClientStream);
+		if (hResult != S_OK) 
+			goto marshal_error;
+	}
+
+	return hResult;
+
+	// If marshaling error occurred, make sure to release everything.
+marshal_error:
+
+	UnmarshalStreamComPointers(stream);
+	ReleaseUnmarshaledComPointers(stream);
+	return hResult;
+#else
+	(void)stream;
+	return S_OK;
+#endif
+}
+
+// ------------------------------------------------------------------------------------------
+static PaError StartStream( PaStream *s )
+{
+	HRESULT hr;
+    PaWasapiStream *stream = (PaWasapiStream*)s;
+	PaError result = paNoError;
+
+	// check if stream is active already
+	if (IsStreamActive(s))
+		return paStreamIsNotStopped;
+
+    PaUtil_ResetBufferProcessor(&stream->bufferProcessor);
+
+	// Cleanup handles (may be necessary if stream was stopped by itself due to error)
+	_StreamCleanup(stream);
+
+	// Create close event
+	if ((stream->hCloseRequest = CreateEvent(NULL, TRUE, FALSE, NULL)) == NULL) 
+	{
+		result = paInsufficientMemory;
+		goto start_error;
+	}
+
+	// Create thread
+	if (!stream->bBlocking)
+	{
+		// Create thread events
+		stream->hThreadStart = CreateEvent(NULL, TRUE, FALSE, NULL);
+		stream->hThreadExit  = CreateEvent(NULL, TRUE, FALSE, NULL);
+		if ((stream->hThreadStart == NULL) || (stream->hThreadExit == NULL))
+		{
+			result = paInsufficientMemory;
+			goto start_error;
+		}
+
+		// Marshal WASAPI interface pointers for safe use in thread created below.
+		if ((hr = MarshalStreamComPointers(stream)) != S_OK) 
+		{
+			PRINT(("Failed marshaling stream COM pointers."));
+			result = paUnanticipatedHostError;
+			goto nonblocking_start_error;
+		}
+
+		if ((stream->in.clientParent  && (stream->in.streamFlags  & AUDCLNT_STREAMFLAGS_EVENTCALLBACK)) ||
+			(stream->out.clientParent && (stream->out.streamFlags & AUDCLNT_STREAMFLAGS_EVENTCALLBACK)))
+		{
+			if ((stream->hThread = CREATE_THREAD(ProcThreadEvent)) == NULL) 
+			{
+				PRINT(("Failed creating thread: ProcThreadEvent."));
+				result = paUnanticipatedHostError;
+				goto nonblocking_start_error;
+			}
+		}
+		else
+		{
+			if ((stream->hThread = CREATE_THREAD(ProcThreadPoll)) == NULL) 
+			{
+				PRINT(("Failed creating thread: ProcThreadPoll."));
+				result = paUnanticipatedHostError;
+				goto nonblocking_start_error;
+			}
+		}
+
+		// Wait for thread to start
+		if (WaitForSingleObject(stream->hThreadStart, 60*1000) == WAIT_TIMEOUT) 
+		{
+			PRINT(("Failed starting thread: timeout."));
+			result = paUnanticipatedHostError;
+			goto nonblocking_start_error;
+		}
+	}
+	else
+	{
+		// Create blocking operation events (non-signaled event means - blocking operation is pending)
+		if (stream->out.clientParent != NULL) 
+		{
+			if ((stream->hBlockingOpStreamWR = CreateEvent(NULL, TRUE, TRUE, NULL)) == NULL) 
+			{
+				result = paInsufficientMemory;
+				goto start_error;
+			}
+		}
+		if (stream->in.clientParent != NULL) 
+		{
+			if ((stream->hBlockingOpStreamRD = CreateEvent(NULL, TRUE, TRUE, NULL)) == NULL) 
+			{
+				result = paInsufficientMemory;
+				goto start_error;
+			}
+		}
+
+		// Initialize event & start INPUT stream
+		if (stream->in.clientParent != NULL)
+		{
+			if ((hr = IAudioClient_Start(stream->in.clientParent)) != S_OK)
+			{
+				LogHostError(hr);
+				result = paUnanticipatedHostError;
+				goto start_error;
+			}
+		}
+
+		// Initialize event & start OUTPUT stream
+		if (stream->out.clientParent != NULL)
+		{
+			// Start
+			if ((hr = IAudioClient_Start(stream->out.clientParent)) != S_OK)
+			{
+				LogHostError(hr);
+				result = paUnanticipatedHostError;
+				goto start_error;
+			}
+		}
+
+		// Set parent to working pointers to use shared functions.
+		stream->captureClient  = stream->captureClientParent;
+		stream->renderClient   = stream->renderClientParent;
+		stream->in.clientProc  = stream->in.clientParent;
+		stream->out.clientProc = stream->out.clientParent;
+
+		// Signal: stream running.
+		stream->running = TRUE;
+	}
+
+    return result;
+
+nonblocking_start_error:
+
+	// Set hThreadExit event to prevent blocking during cleanup
+	SetEvent(stream->hThreadExit);
+	UnmarshalStreamComPointers(stream);
+	ReleaseUnmarshaledComPointers(stream);
+
+start_error:
+
+	StopStream(s);
+	return result;
+}
+
+// ------------------------------------------------------------------------------------------
+void _StreamFinish(PaWasapiStream *stream)
+{
+	// Issue command to thread to stop processing and wait for thread exit
+	if (!stream->bBlocking)
+	{
+		SignalObjectAndWait(stream->hCloseRequest, stream->hThreadExit, INFINITE, FALSE);
+	}
+	else
+	// Blocking mode does not own thread
+	{
+		// Signal close event and wait for each of 2 blocking operations to complete
+		if (stream->out.clientParent)
+			SignalObjectAndWait(stream->hCloseRequest, stream->hBlockingOpStreamWR, INFINITE, TRUE);
+		if (stream->out.clientParent)
+			SignalObjectAndWait(stream->hCloseRequest, stream->hBlockingOpStreamRD, INFINITE, TRUE);
+
+		// Process stop
+		_StreamOnStop(stream);
+	}
+
+	// Cleanup handles
+	_StreamCleanup(stream);
+
+    stream->running = FALSE;
+}
+
+// ------------------------------------------------------------------------------------------
+void _StreamCleanup(PaWasapiStream *stream)
+{
+	// Close thread handles to allow restart
+	SAFE_CLOSE(stream->hThread);
+	SAFE_CLOSE(stream->hThreadStart);
+	SAFE_CLOSE(stream->hThreadExit);
+	SAFE_CLOSE(stream->hCloseRequest);
+	SAFE_CLOSE(stream->hBlockingOpStreamRD);
+	SAFE_CLOSE(stream->hBlockingOpStreamWR);
+}
+
+// ------------------------------------------------------------------------------------------
+static PaError StopStream( PaStream *s )
+{
+	// Finish stream
+	_StreamFinish((PaWasapiStream *)s);
+    return paNoError;
+}
+
+// ------------------------------------------------------------------------------------------
+static PaError AbortStream( PaStream *s )
+{
+	// Finish stream
+	_StreamFinish((PaWasapiStream *)s);
+    return paNoError;
+}
+
+// ------------------------------------------------------------------------------------------
+static PaError IsStreamStopped( PaStream *s )
+{
+	return !((PaWasapiStream *)s)->running;
+}
+
+// ------------------------------------------------------------------------------------------
+static PaError IsStreamActive( PaStream *s )
+{
+    return ((PaWasapiStream *)s)->running;
+}
+
+// ------------------------------------------------------------------------------------------
+static PaTime GetStreamTime( PaStream *s )
+{
+    PaWasapiStream *stream = (PaWasapiStream*)s;
+
+    /* suppress unused variable warnings */
+    (void) stream;
+
+    return PaUtil_GetTime();
+}
+
+// ------------------------------------------------------------------------------------------
+static double GetStreamCpuLoad( PaStream* s )
+{
+	return PaUtil_GetCpuLoad(&((PaWasapiStream *)s)->cpuLoadMeasurer);
+}
+
+// ------------------------------------------------------------------------------------------
+static PaError ReadStream( PaStream* s, void *_buffer, unsigned long frames )
+{
+    PaWasapiStream *stream = (PaWasapiStream*)s;
+
+	HRESULT hr = S_OK;
+	BYTE *user_buffer = (BYTE *)_buffer;
+	BYTE *wasapi_buffer = NULL;
+	DWORD flags = 0;
+	UINT32 i, available, sleep = 0;
+	unsigned long processed;
+	ThreadIdleScheduler sched;
+
+	// validate
+	if (!stream->running)
+		return paStreamIsStopped;
+	if (stream->captureClient == NULL)
+		return paBadStreamPtr;
+
+	// Notify blocking op has begun
+	ResetEvent(stream->hBlockingOpStreamRD);
+
+	// Use thread scheduling for 500 microseconds (emulated) when wait time for frames is less than
+	// 1 milliseconds, emulation helps to normalize CPU consumption and avoids too busy waiting
+	ThreadIdleScheduler_Setup(&sched, 1, 250/* microseconds */);
+
+    // Make a local copy of the user buffer pointer(s), this is necessary
+	// because PaUtil_CopyOutput() advances these pointers every time it is called
+    if (!stream->bufferProcessor.userInputIsInterleaved)
+    {
+		user_buffer = (BYTE *)alloca(sizeof(BYTE *) * stream->bufferProcessor.inputChannelCount);
+        if (user_buffer == NULL)
+            return paInsufficientMemory;
+
+        for (i = 0; i < stream->bufferProcessor.inputChannelCount; ++i)
+            ((BYTE **)user_buffer)[i] = ((BYTE **)_buffer)[i];
+    }
+
+	// Findout if there are tail frames, flush them all before reading hardware
+	if ((available = PaUtil_GetRingBufferReadAvailable(stream->in.tailBuffer)) != 0)
+	{
+		ring_buffer_size_t buf1_size = 0, buf2_size = 0, read, desired;
+		void *buf1 = NULL, *buf2 = NULL;
+
+		// Limit desired to amount of requested frames
+		desired = available;
+		if ((UINT32)desired > frames)
+			desired = frames;
+		
+		// Get pointers to read regions
+		read = PaUtil_GetRingBufferReadRegions(stream->in.tailBuffer, desired, &buf1, &buf1_size, &buf2, &buf2_size);
+
+		if (buf1 != NULL)
+		{
+			// Register available frames to processor
+			PaUtil_SetInputFrameCount(&stream->bufferProcessor, buf1_size);
+
+			// Register host buffer pointer to processor
+			PaUtil_SetInterleavedInputChannels(&stream->bufferProcessor, 0, buf1, stream->bufferProcessor.inputChannelCount);
+
+			// Copy user data to host buffer (with conversion if applicable)
+			processed = PaUtil_CopyInput(&stream->bufferProcessor, (void **)&user_buffer, buf1_size);
+			frames -= processed;
+		}
+
+		if (buf2 != NULL)
+		{
+			// Register available frames to processor
+			PaUtil_SetInputFrameCount(&stream->bufferProcessor, buf2_size);
+
+			// Register host buffer pointer to processor
+			PaUtil_SetInterleavedInputChannels(&stream->bufferProcessor, 0, buf2, stream->bufferProcessor.inputChannelCount);
+
+			// Copy user data to host buffer (with conversion if applicable)
+			processed = PaUtil_CopyInput(&stream->bufferProcessor, (void **)&user_buffer, buf2_size);
+			frames -= processed;
+		}
+
+		// Advance
+		PaUtil_AdvanceRingBufferReadIndex(stream->in.tailBuffer, read);
+	}
+
+	// Read hardware
+	while (frames != 0)
+	{
+		// Check if blocking call must be interrupted
+		if (WaitForSingleObject(stream->hCloseRequest, sleep) != WAIT_TIMEOUT)
+			break;
+
+		// Get available frames (must be finding out available frames before call to IAudioCaptureClient_GetBuffer
+		// othervise audio glitches will occur inExclusive mode as it seems that WASAPI has some scheduling/
+		// processing problems when such busy polling with IAudioCaptureClient_GetBuffer occurs)
+		if ((hr = _PollGetInputFramesAvailable(stream, &available)) != S_OK)
+		{
+			LogHostError(hr);
+			return paUnanticipatedHostError;
+		}
+
+		// Wait for more frames to become available
+		if (available == 0)
+		{
+			// Exclusive mode may require latency of 1 millisecond, thus we shall sleep
+			// around 500 microseconds (emulated) to collect packets in time
+			if (stream->in.shareMode != AUDCLNT_SHAREMODE_EXCLUSIVE)
+			{
+				UINT32 sleep_frames = (frames < stream->in.framesPerHostCallback ? frames : stream->in.framesPerHostCallback);
+
+				sleep  = GetFramesSleepTime(sleep_frames, stream->in.wavex.Format.nSamplesPerSec);
+				sleep /= 4; // wait only for 1/4 of the buffer
+
+				// WASAPI input provides packets, thus expiring packet will result in bad audio
+				// limit waiting time to 2 seconds (will always work for smallest buffer in Shared)
+				if (sleep > 2)
+					sleep = 2;
+
+				// Avoid busy waiting, schedule next 1 millesecond wait
+				if (sleep == 0)
+					sleep = ThreadIdleScheduler_NextSleep(&sched);
+			}
+			else
+			{
+				if ((sleep = ThreadIdleScheduler_NextSleep(&sched)) != 0)
+				{
+					Sleep(sleep);
+					sleep = 0;
+				}
+			}
+
+			continue;
+		}
+
+		// Get the available data in the shared buffer.
+		if ((hr = IAudioCaptureClient_GetBuffer(stream->captureClient, &wasapi_buffer, &available, &flags, NULL, NULL)) != S_OK)
+		{
+			// Buffer size is too small, waiting
+			if (hr != AUDCLNT_S_BUFFER_EMPTY)
+			{
+				LogHostError(hr);
+				goto end;
+			}
+
+			continue;
+		}
+
+		// Register available frames to processor
+        PaUtil_SetInputFrameCount(&stream->bufferProcessor, available);
+
+		// Register host buffer pointer to processor
+        PaUtil_SetInterleavedInputChannels(&stream->bufferProcessor, 0, wasapi_buffer, stream->bufferProcessor.inputChannelCount);
+
+		// Copy user data to host buffer (with conversion if applicable)
+		processed = PaUtil_CopyInput(&stream->bufferProcessor, (void **)&user_buffer, frames);
+		frames -= processed;
+
+		// Save tail into buffer
+		if ((frames == 0) && (available > processed))
+		{
+			UINT32 bytes_processed = processed * stream->in.wavex.Format.nBlockAlign;
+			UINT32 frames_to_save  = available - processed;
+
+			PaUtil_WriteRingBuffer(stream->in.tailBuffer, wasapi_buffer + bytes_processed, frames_to_save);
+		}
+
+		// Release host buffer
+		if ((hr = IAudioCaptureClient_ReleaseBuffer(stream->captureClient, available)) != S_OK)
+		{
+			LogHostError(hr);
+			goto end;
+		}
+	}
+
+end:
+
+	// Notify blocking op has ended
+	SetEvent(stream->hBlockingOpStreamRD);
+
+	return (hr != S_OK ? paUnanticipatedHostError : paNoError);
+}
+
+// ------------------------------------------------------------------------------------------
+static PaError WriteStream( PaStream* s, const void *_buffer, unsigned long frames )
+{
+    PaWasapiStream *stream = (PaWasapiStream*)s;
+
+	//UINT32 frames;
+	const BYTE *user_buffer = (const BYTE *)_buffer;
+	BYTE *wasapi_buffer;
+	HRESULT hr = S_OK;
+	UINT32 i, available, sleep = 0;
+	unsigned long processed;
+	ThreadIdleScheduler sched;
+
+	// validate
+	if (!stream->running)
+		return paStreamIsStopped;
+	if (stream->renderClient == NULL)
+		return paBadStreamPtr;
+
+	// Notify blocking op has begun
+	ResetEvent(stream->hBlockingOpStreamWR);
+
+	// Use thread scheduling for 500 microseconds (emulated) when wait time for frames is less than
+	// 1 milliseconds, emulation helps to normalize CPU consumption and avoids too busy waiting
+	ThreadIdleScheduler_Setup(&sched, 1, 500/* microseconds */);
+
+    // Make a local copy of the user buffer pointer(s), this is necessary
+	// because PaUtil_CopyOutput() advances these pointers every time it is called
+    if (!stream->bufferProcessor.userOutputIsInterleaved)
+    {
+        user_buffer = (const BYTE *)alloca(sizeof(const BYTE *) * stream->bufferProcessor.outputChannelCount);
+        if (user_buffer == NULL)
+            return paInsufficientMemory;
+
+        for (i = 0; i < stream->bufferProcessor.outputChannelCount; ++i)
+            ((const BYTE **)user_buffer)[i] = ((const BYTE **)_buffer)[i];
+    }
+
+	// Blocking (potentially, untill 'frames' are consumed) loop
+	while (frames != 0)
+	{
+		// Check if blocking call must be interrupted
+		if (WaitForSingleObject(stream->hCloseRequest, sleep) != WAIT_TIMEOUT)
+			break;
+
+		// Get frames available
+		if ((hr = _PollGetOutputFramesAvailable(stream, &available)) != S_OK)
+		{
+			LogHostError(hr);
+			goto end;
+		}
+
+		// Wait for more frames to become available
+		if (available == 0)
+		{
+			UINT32 sleep_frames = (frames < stream->out.framesPerHostCallback ? frames : stream->out.framesPerHostCallback);
+
+			sleep  = GetFramesSleepTime(sleep_frames, stream->out.wavex.Format.nSamplesPerSec);
+			sleep /= 2; // wait only for half of the buffer
+
+			// Avoid busy waiting, schedule next 1 millesecond wait
+			if (sleep == 0)
+				sleep = ThreadIdleScheduler_NextSleep(&sched);
+
+			continue;
+		}
+
+		// Keep in 'frmaes' range
+		if (available > frames)
+			available = frames;
+
+		// Get pointer to host buffer
+		if ((hr = IAudioRenderClient_GetBuffer(stream->renderClient, available, &wasapi_buffer)) != S_OK)
+		{
+			// Buffer size is too big, waiting
+			if (hr == AUDCLNT_E_BUFFER_TOO_LARGE)
+				continue;
+
+			LogHostError(hr);
+			goto end;
+		}
+
+		// Keep waiting again (on Vista it was noticed that WASAPI could SOMETIMES return NULL pointer 
+		// to buffer without returning AUDCLNT_E_BUFFER_TOO_LARGE instead)
+		if (wasapi_buffer == NULL)
+			continue;
+
+		// Register available frames to processor
+        PaUtil_SetOutputFrameCount(&stream->bufferProcessor, available);
+
+		// Register host buffer pointer to processor
+        PaUtil_SetInterleavedOutputChannels(&stream->bufferProcessor, 0, wasapi_buffer,	stream->bufferProcessor.outputChannelCount);
+
+		// Copy user data to host buffer (with conversion if applicable), this call will advance
+		// pointer 'user_buffer' to consumed portion of data
+		processed = PaUtil_CopyOutput(&stream->bufferProcessor, (const void **)&user_buffer, frames);
+		frames -= processed;
+
+		// Release host buffer
+		if ((hr = IAudioRenderClient_ReleaseBuffer(stream->renderClient, available, 0)) != S_OK)
+		{
+			LogHostError(hr);
+			goto end;
+		}
+	}
+
+end:
+
+	// Notify blocking op has ended
+	SetEvent(stream->hBlockingOpStreamWR);
+
+	return (hr != S_OK ? paUnanticipatedHostError : paNoError);
+}
+
+unsigned long PaUtil_GetOutputFrameCount( PaUtilBufferProcessor* bp )
+{
+	return bp->hostOutputFrameCount[0];
+}
+
+// ------------------------------------------------------------------------------------------
+static signed long GetStreamReadAvailable( PaStream* s )
+{
+    PaWasapiStream *stream = (PaWasapiStream*)s;
+
+	HRESULT hr;
+	UINT32  available = 0;
+
+	// validate
+	if (!stream->running)
+		return paStreamIsStopped;
+	if (stream->captureClient == NULL)
+		return paBadStreamPtr;
+
+	// available in hardware buffer
+	if ((hr = _PollGetInputFramesAvailable(stream, &available)) != S_OK)
+	{
+		LogHostError(hr);
+		return paUnanticipatedHostError;
+	}
+
+	// available in software tail buffer
+	available += PaUtil_GetRingBufferReadAvailable(stream->in.tailBuffer);
+
+    return available;
+}
+
+// ------------------------------------------------------------------------------------------
+static signed long GetStreamWriteAvailable( PaStream* s )
+{
+    PaWasapiStream *stream = (PaWasapiStream*)s;
+	HRESULT hr;
+	UINT32  available = 0;
+
+	// validate
+	if (!stream->running)
+		return paStreamIsStopped;
+	if (stream->renderClient == NULL)
+		return paBadStreamPtr;
+
+	if ((hr = _PollGetOutputFramesAvailable(stream, &available)) != S_OK)
+	{
+		LogHostError(hr);
+		return paUnanticipatedHostError;
+	}
+
+	return (signed long)available;
+}
+
+
+// ------------------------------------------------------------------------------------------
+static void WaspiHostProcessingLoop( void *inputBuffer,  long inputFrames,
+                                     void *outputBuffer, long outputFrames,
+                                     void *userData )
+{
+    PaWasapiStream *stream = (PaWasapiStream*)userData;
+    PaStreamCallbackTimeInfo timeInfo = {0,0,0};
+	PaStreamCallbackFlags flags = 0;
+    int callbackResult;
+    unsigned long framesProcessed;
+	HRESULT hr;
+	UINT32 pending;
+
+    PaUtil_BeginCpuLoadMeasurement( &stream->cpuLoadMeasurer );
+
+    /*
+		Pa_GetStreamTime:
+            - generate timing information
+            - handle buffer slips
+    */
+	timeInfo.currentTime = PaUtil_GetTime();
+	// Query input latency
+	if (stream->in.clientProc != NULL)
+	{
+		PaTime pending_time;
+		if ((hr = IAudioClient_GetCurrentPadding(stream->in.clientProc, &pending)) == S_OK)
+			pending_time = (PaTime)pending / (PaTime)stream->in.wavex.Format.nSamplesPerSec;
+		else
+			pending_time = (PaTime)stream->in.latencySeconds;
+
+		timeInfo.inputBufferAdcTime = timeInfo.currentTime + pending_time;
+	}
+	// Query output current latency
+	if (stream->out.clientProc != NULL)
+	{
+		PaTime pending_time;
+		if ((hr = IAudioClient_GetCurrentPadding(stream->out.clientProc, &pending)) == S_OK)
+			pending_time = (PaTime)pending / (PaTime)stream->out.wavex.Format.nSamplesPerSec;
+		else
+			pending_time = (PaTime)stream->out.latencySeconds;
+
+		timeInfo.outputBufferDacTime = timeInfo.currentTime + pending_time;
+	}
+
+    /*
+        If you need to byte swap or shift inputBuffer to convert it into a
+        portaudio format, do it here.
+    */
+
+    PaUtil_BeginBufferProcessing( &stream->bufferProcessor, &timeInfo, flags );
+
+    /*
+        depending on whether the host buffers are interleaved, non-interleaved
+        or a mixture, you will want to call PaUtil_SetInterleaved*Channels(),
+        PaUtil_SetNonInterleaved*Channel() or PaUtil_Set*Channel() here.
+    */
+
+    if (stream->bufferProcessor.inputChannelCount > 0)
+    {
+        PaUtil_SetInputFrameCount( &stream->bufferProcessor, inputFrames );
+        PaUtil_SetInterleavedInputChannels( &stream->bufferProcessor,
+            0, /* first channel of inputBuffer is channel 0 */
+            inputBuffer,
+            0 ); /* 0 - use inputChannelCount passed to init buffer processor */
+    }
+
+    if (stream->bufferProcessor.outputChannelCount > 0)
+    {
+        PaUtil_SetOutputFrameCount( &stream->bufferProcessor, outputFrames);
+        PaUtil_SetInterleavedOutputChannels( &stream->bufferProcessor,
+            0, /* first channel of outputBuffer is channel 0 */
+            outputBuffer,
+            0 ); /* 0 - use outputChannelCount passed to init buffer processor */
+    }
+
+    /* you must pass a valid value of callback result to PaUtil_EndBufferProcessing()
+        in general you would pass paContinue for normal operation, and
+        paComplete to drain the buffer processor's internal output buffer.
+        You can check whether the buffer processor's output buffer is empty
+        using PaUtil_IsBufferProcessorOuputEmpty( bufferProcessor )
+    */
+    callbackResult = paContinue;
+    framesProcessed = PaUtil_EndBufferProcessing( &stream->bufferProcessor, &callbackResult );
+
+    /*
+        If you need to byte swap or shift outputBuffer to convert it to
+        host format, do it here.
+    */
+
+	PaUtil_EndCpuLoadMeasurement( &stream->cpuLoadMeasurer, framesProcessed );
+
+    if (callbackResult == paContinue)
+    {
+        /* nothing special to do */
+    }
+    else
+	if (callbackResult == paAbort)
+    {
+		// stop stream
+        SetEvent(stream->hCloseRequest);
+    }
+    else
+    {
+		// stop stream
+        SetEvent(stream->hCloseRequest);
+    }
+}
+
+// ------------------------------------------------------------------------------------------
+HANDLE MMCSS_activate(const char *name)
+{
+#ifndef PA_WINRT
+    DWORD task_idx = 0;
+    HANDLE hTask = pAvSetMmThreadCharacteristics(name, &task_idx);
+    if (hTask == NULL)
+	{
+        PRINT(("WASAPI: AvSetMmThreadCharacteristics failed!\n"));
+    }
+
+    /*BOOL priority_ok = pAvSetMmThreadPriority(hTask, AVRT_PRIORITY_NORMAL);
+    if (priority_ok == FALSE)
+	{
+        PRINT(("WASAPI: AvSetMmThreadPriority failed!\n"));
+    }*/
+
+	// debug
+    {
+        int    cur_priority		  = GetThreadPriority(GetCurrentThread());
+        DWORD  cur_priority_class = GetPriorityClass(GetCurrentProcess());
+		PRINT(("WASAPI: thread[ priority-0x%X class-0x%X ]\n", cur_priority, cur_priority_class));
+    }
+
+	return hTask;
+#else
+	(void)name;
+	return NULL;
+#endif
+}
+
+// ------------------------------------------------------------------------------------------
+void MMCSS_deactivate(HANDLE hTask)
+{
+	if (!hTask)
+		return;
+
+#ifndef PA_WINRT
+	if (pAvRevertMmThreadCharacteristics(hTask) == FALSE)
+	{
+        PRINT(("WASAPI: AvRevertMmThreadCharacteristics failed!\n"));
+    }
+#endif
+}
+
+// ------------------------------------------------------------------------------------------
+PaError PaWasapi_ThreadPriorityBoost(void **hTask, PaWasapiThreadPriority nPriorityClass)
+{
+	static const char *mmcs_name[] =
+	{
+		NULL,
+		"Audio",
+		"Capture",
+		"Distribution",
+		"Games",
+		"Playback",
+		"Pro Audio",
+		"Window Manager"
+	};
+	HANDLE task;
+
+	if (hTask == NULL)
+		return paUnanticipatedHostError;
+
+	if ((UINT32)nPriorityClass >= STATIC_ARRAY_SIZE(mmcs_name))
+		return paUnanticipatedHostError;
+
+	task = MMCSS_activate(mmcs_name[nPriorityClass]);
+	if (task == NULL)
+		return paUnanticipatedHostError;
+
+	(*hTask) = task;
+	return paNoError;
+}
+
+// ------------------------------------------------------------------------------------------
+PaError PaWasapi_ThreadPriorityRevert(void *hTask)
+{
+	if (hTask == NULL)
+		return paUnanticipatedHostError;
+
+	MMCSS_deactivate((HANDLE)hTask);
+
+	return paNoError;
+}
+
+// ------------------------------------------------------------------------------------------
+// Described at:
+// http://msdn.microsoft.com/en-us/library/dd371387(v=VS.85).aspx
+
+PaError PaWasapi_GetJackCount(PaDeviceIndex nDevice, int *jcount)
+{
+#ifndef PA_WINRT
+	PaError ret;
+	HRESULT hr = S_OK;
+	PaDeviceIndex index;
+    IDeviceTopology *pDeviceTopology = NULL;
+    IConnector *pConnFrom = NULL;
+    IConnector *pConnTo = NULL;
+    IPart *pPart = NULL;
+    IKsJackDescription *pJackDesc = NULL;
+	UINT jackCount = 0;
+
+	PaWasapiHostApiRepresentation *paWasapi = _GetHostApi(&ret);
+	if (paWasapi == NULL)
+		return paNotInitialized;
+
+	// Get device index.
+	ret = PaUtil_DeviceIndexToHostApiDeviceIndex(&index, nDevice, &paWasapi->inheritedHostApiRep);
+    if (ret != paNoError)
+        return ret;
+
+	// Validate index.
+	if ((UINT32)index >= paWasapi->deviceCount)
+		return paInvalidDevice;
+
+	// Get the endpoint device's IDeviceTopology interface.
+	hr = IMMDevice_Activate(paWasapi->devInfo[index].device, &pa_IID_IDeviceTopology,
+		CLSCTX_INPROC_SERVER, NULL, (void**)&pDeviceTopology);
+	IF_FAILED_JUMP(hr, error);
+
+    // The device topology for an endpoint device always contains just one connector (connector number 0).
+	hr = IDeviceTopology_GetConnector(pDeviceTopology, 0, &pConnFrom);
+	IF_FAILED_JUMP(hr, error);
+
+    // Step across the connection to the jack on the adapter.
+	hr = IConnector_GetConnectedTo(pConnFrom, &pConnTo);
+    if (HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND) == hr)
+    {
+        // The adapter device is not currently active.
+        hr = E_NOINTERFACE;
+    }
+	IF_FAILED_JUMP(hr, error);
+
+	// Get the connector's IPart interface.
+	hr = IConnector_QueryInterface(pConnTo, &pa_IID_IPart, (void**)&pPart);
+	IF_FAILED_JUMP(hr, error);
+
+	// Activate the connector's IKsJackDescription interface.
+	hr = IPart_Activate(pPart, CLSCTX_INPROC_SERVER, &pa_IID_IKsJackDescription, (void**)&pJackDesc);
+	IF_FAILED_JUMP(hr, error);
+
+	// Return jack count for this device.
+	hr = IKsJackDescription_GetJackCount(pJackDesc, &jackCount);
+	IF_FAILED_JUMP(hr, error);
+
+	// Set.
+	(*jcount) = jackCount;
+
+	// Ok.
+	ret = paNoError;
+
+error:
+
+	SAFE_RELEASE(pDeviceTopology);
+	SAFE_RELEASE(pConnFrom);
+	SAFE_RELEASE(pConnTo);
+	SAFE_RELEASE(pPart);
+	SAFE_RELEASE(pJackDesc);
+
+	LogHostError(hr);
+	return paNoError;
+#else
+	(void)nDevice;
+	(void)jcount;
+	return paUnanticipatedHostError;
+#endif
+}
+
+// ------------------------------------------------------------------------------------------
+#ifndef PA_WINRT
+static PaWasapiJackConnectionType ConvertJackConnectionTypeWASAPIToPA(int connType)
+{
+	switch (connType)
+	{
+		case eConnTypeUnknown:			return eJackConnTypeUnknown;
+#ifdef _KS_
+		case eConnType3Point5mm:		return eJackConnType3Point5mm;
+#else
+		case eConnTypeEighth:		    return eJackConnType3Point5mm;
+#endif
+		case eConnTypeQuarter:			return eJackConnTypeQuarter;
+		case eConnTypeAtapiInternal:	return eJackConnTypeAtapiInternal;
+		case eConnTypeRCA:				return eJackConnTypeRCA;
+		case eConnTypeOptical:			return eJackConnTypeOptical;
+		case eConnTypeOtherDigital:		return eJackConnTypeOtherDigital;
+		case eConnTypeOtherAnalog:		return eJackConnTypeOtherAnalog;
+		case eConnTypeMultichannelAnalogDIN: return eJackConnTypeMultichannelAnalogDIN;
+		case eConnTypeXlrProfessional:	return eJackConnTypeXlrProfessional;
+		case eConnTypeRJ11Modem:		return eJackConnTypeRJ11Modem;
+		case eConnTypeCombination:		return eJackConnTypeCombination;
+	}
+	return eJackConnTypeUnknown;
+}
+#endif
+
+// ------------------------------------------------------------------------------------------
+#ifndef PA_WINRT
+static PaWasapiJackGeoLocation ConvertJackGeoLocationWASAPIToPA(int geoLoc)
+{
+	switch (geoLoc)
+	{
+	case eGeoLocRear:				return eJackGeoLocRear;
+	case eGeoLocFront:				return eJackGeoLocFront;
+	case eGeoLocLeft:				return eJackGeoLocLeft;
+	case eGeoLocRight:				return eJackGeoLocRight;
+	case eGeoLocTop:				return eJackGeoLocTop;
+	case eGeoLocBottom:				return eJackGeoLocBottom;
+#ifdef _KS_
+	case eGeoLocRearPanel:			return eJackGeoLocRearPanel;
+#else
+	case eGeoLocRearOPanel:         return eJackGeoLocRearPanel;
+#endif
+	case eGeoLocRiser:				return eJackGeoLocRiser;
+	case eGeoLocInsideMobileLid:	return eJackGeoLocInsideMobileLid;
+	case eGeoLocDrivebay:			return eJackGeoLocDrivebay;
+	case eGeoLocHDMI:				return eJackGeoLocHDMI;
+	case eGeoLocOutsideMobileLid:	return eJackGeoLocOutsideMobileLid;
+	case eGeoLocATAPI:				return eJackGeoLocATAPI;
+	}
+	return eJackGeoLocUnk;
+}
+#endif
+
+// ------------------------------------------------------------------------------------------
+#ifndef PA_WINRT
+static PaWasapiJackGenLocation ConvertJackGenLocationWASAPIToPA(int genLoc)
+{
+	switch (genLoc)
+	{
+	case eGenLocPrimaryBox:	return eJackGenLocPrimaryBox;
+	case eGenLocInternal:	return eJackGenLocInternal;
+#ifdef _KS_
+	case eGenLocSeparate:	return eJackGenLocSeparate;
+#else
+	case eGenLocSeperate:	return eJackGenLocSeparate;
+#endif
+	case eGenLocOther:		return eJackGenLocOther;
+	}
+	return eJackGenLocPrimaryBox;
+}
+#endif
+
+// ------------------------------------------------------------------------------------------
+#ifndef PA_WINRT
+static PaWasapiJackPortConnection ConvertJackPortConnectionWASAPIToPA(int portConn)
+{
+	switch (portConn)
+	{
+	case ePortConnJack:					return eJackPortConnJack;
+	case ePortConnIntegratedDevice:		return eJackPortConnIntegratedDevice;
+	case ePortConnBothIntegratedAndJack:return eJackPortConnBothIntegratedAndJack;
+	case ePortConnUnknown:				return eJackPortConnUnknown;
+	}
+	return eJackPortConnJack;
+}
+#endif
+
+// ------------------------------------------------------------------------------------------
+// Described at:
+// http://msdn.microsoft.com/en-us/library/dd371387(v=VS.85).aspx
+
+PaError PaWasapi_GetJackDescription(PaDeviceIndex nDevice, int jindex, PaWasapiJackDescription *pJackDescription)
+{
+#ifndef PA_WINRT
+	PaError ret;
+	HRESULT hr = S_OK;
+	PaDeviceIndex index;
+    IDeviceTopology *pDeviceTopology = NULL;
+    IConnector *pConnFrom = NULL;
+    IConnector *pConnTo = NULL;
+    IPart *pPart = NULL;
+    IKsJackDescription *pJackDesc = NULL;
+	KSJACK_DESCRIPTION jack = { 0 };
+
+	PaWasapiHostApiRepresentation *paWasapi = _GetHostApi(&ret);
+	if (paWasapi == NULL)
+		return paNotInitialized;
+
+	// Get device index.
+	ret = PaUtil_DeviceIndexToHostApiDeviceIndex(&index, nDevice, &paWasapi->inheritedHostApiRep);
+    if (ret != paNoError)
+        return ret;
+
+	// Validate index.
+	if ((UINT32)index >= paWasapi->deviceCount)
+		return paInvalidDevice;
+
+	// Get the endpoint device's IDeviceTopology interface.
+	hr = IMMDevice_Activate(paWasapi->devInfo[index].device, &pa_IID_IDeviceTopology,
+		CLSCTX_INPROC_SERVER, NULL, (void**)&pDeviceTopology);
+	IF_FAILED_JUMP(hr, error);
+
+    // The device topology for an endpoint device always contains just one connector (connector number 0).
+	hr = IDeviceTopology_GetConnector(pDeviceTopology, 0, &pConnFrom);
+	IF_FAILED_JUMP(hr, error);
+
+    // Step across the connection to the jack on the adapter.
+	hr = IConnector_GetConnectedTo(pConnFrom, &pConnTo);
+    if (HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND) == hr)
+    {
+        // The adapter device is not currently active.
+        hr = E_NOINTERFACE;
+    }
+	IF_FAILED_JUMP(hr, error);
+
+	// Get the connector's IPart interface.
+	hr = IConnector_QueryInterface(pConnTo, &pa_IID_IPart, (void**)&pPart);
+	IF_FAILED_JUMP(hr, error);
+
+	// Activate the connector's IKsJackDescription interface.
+	hr = IPart_Activate(pPart, CLSCTX_INPROC_SERVER, &pa_IID_IKsJackDescription, (void**)&pJackDesc);
+	IF_FAILED_JUMP(hr, error);
+
+	// Test to return jack description struct for index 0.
+	hr = IKsJackDescription_GetJackDescription(pJackDesc, jindex, &jack);
+	IF_FAILED_JUMP(hr, error);
+
+	// Convert WASAPI values to PA format.
+	pJackDescription->channelMapping = jack.ChannelMapping;
+	pJackDescription->color          = jack.Color;
+	pJackDescription->connectionType = ConvertJackConnectionTypeWASAPIToPA(jack.ConnectionType);
+	pJackDescription->genLocation    = ConvertJackGenLocationWASAPIToPA(jack.GenLocation);
+	pJackDescription->geoLocation    = ConvertJackGeoLocationWASAPIToPA(jack.GeoLocation);
+	pJackDescription->isConnected    = jack.IsConnected;
+	pJackDescription->portConnection = ConvertJackPortConnectionWASAPIToPA(jack.PortConnection);
+
+	// Ok.
+	ret = paNoError;
+
+error:
+
+	SAFE_RELEASE(pDeviceTopology);
+	SAFE_RELEASE(pConnFrom);
+	SAFE_RELEASE(pConnTo);
+	SAFE_RELEASE(pPart);
+	SAFE_RELEASE(pJackDesc);
+
+	LogHostError(hr);
+	return ret;
+
+#else
+	(void)nDevice;
+	(void)jindex;
+	(void)pJackDescription;
+	return paUnanticipatedHostError;
+#endif
+}
+
+// ------------------------------------------------------------------------------------------
+HRESULT _PollGetOutputFramesAvailable(PaWasapiStream *stream, UINT32 *available)
+{
+	HRESULT hr;
+	UINT32 frames  = stream->out.framesPerHostCallback,
+		   padding = 0;
+
+	(*available) = 0;
+
+	// get read position
+	if ((hr = IAudioClient_GetCurrentPadding(stream->out.clientProc, &padding)) != S_OK)
+		return LogHostError(hr);
+
+	// get available
+	frames -= padding;
+
+	// set
+	(*available) = frames;
+	return hr;
+}
+
+// ------------------------------------------------------------------------------------------
+HRESULT _PollGetInputFramesAvailable(PaWasapiStream *stream, UINT32 *available)
+{
+	HRESULT hr;
+
+	(*available) = 0;
+
+	// GetCurrentPadding() has opposite meaning to Output stream 
+	if ((hr = IAudioClient_GetCurrentPadding(stream->in.clientProc, available)) != S_OK)
+		return LogHostError(hr);
+
+	return hr;
+}
+
+// ------------------------------------------------------------------------------------------
+HRESULT ProcessOutputBuffer(PaWasapiStream *stream, PaWasapiHostProcessor *processor, UINT32 frames)
+{
+	HRESULT hr;
+	BYTE *data = NULL;
+
+	// Get buffer
+	if ((hr = IAudioRenderClient_GetBuffer(stream->renderClient, frames, &data)) != S_OK)
+	{
+		if (stream->out.shareMode == AUDCLNT_SHAREMODE_SHARED)
+		{
+			// Using GetCurrentPadding to overcome AUDCLNT_E_BUFFER_TOO_LARGE in
+			// shared mode results in no sound in Event-driven mode (MSDN does not
+			// document this, or is it WASAPI bug?), thus we better
+			// try to acquire buffer next time when GetBuffer allows to do so.
+#if 0
+			// Get Read position
+			UINT32 padding = 0;
+			hr = IAudioClient_GetCurrentPadding(stream->out.clientProc, &padding);
+			if (hr != S_OK)
+				return LogHostError(hr);
+
+			// Get frames to write
+			frames -= padding;
+			if (frames == 0)
+				return S_OK;
+
+			if ((hr = IAudioRenderClient_GetBuffer(stream->renderClient, frames, &data)) != S_OK)
+				return LogHostError(hr);
+#else
+			if (hr == AUDCLNT_E_BUFFER_TOO_LARGE)
+				return S_OK; // be silent in shared mode, try again next time
+#endif
+		}
+		else
+			return LogHostError(hr);
+	}
+
+	// Process data
+	if (stream->out.monoMixer != NULL)
+	{
+		// expand buffer
+		UINT32 mono_frames_size = frames * (stream->out.wavex.Format.wBitsPerSample / 8);
+		if (mono_frames_size > stream->out.monoBufferSize)
+			stream->out.monoBuffer = PaWasapi_ReallocateMemory(stream->out.monoBuffer, (stream->out.monoBufferSize = mono_frames_size));
+
+		// process
+		processor[S_OUTPUT].processor(NULL, 0, (BYTE *)stream->out.monoBuffer, frames, processor[S_OUTPUT].userData);
+
+		// mix 1 to 2 channels
+		stream->out.monoMixer(data, stream->out.monoBuffer, frames);
+	}
+	else
+	{
+		processor[S_OUTPUT].processor(NULL, 0, data, frames, processor[S_OUTPUT].userData);
+	}
+
+	// Release buffer
+	if ((hr = IAudioRenderClient_ReleaseBuffer(stream->renderClient, frames, 0)) != S_OK)
+		LogHostError(hr);
+
+	return hr;
+}
+
+// ------------------------------------------------------------------------------------------
+HRESULT ProcessInputBuffer(PaWasapiStream *stream, PaWasapiHostProcessor *processor)
+{
+	HRESULT hr = S_OK;
+	UINT32 frames;
+	BYTE *data = NULL;
+	DWORD flags = 0;
+
+	for (;;)
+	{
+		// Check if blocking call must be interrupted
+		if (WaitForSingleObject(stream->hCloseRequest, 0) != WAIT_TIMEOUT)
+			break;
+
+		// Findout if any frames available
+		frames = 0;
+		if ((hr = _PollGetInputFramesAvailable(stream, &frames)) != S_OK)
+			return hr;
+
+		// Empty/consumed buffer
+		if (frames == 0)
+			break;
+
+		// Get the available data in the shared buffer.
+		if ((hr = IAudioCaptureClient_GetBuffer(stream->captureClient, &data, &frames, &flags, NULL, NULL)) != S_OK)
+		{
+			if (hr == AUDCLNT_S_BUFFER_EMPTY)
+			{
+				hr = S_OK;
+				break; // Empty/consumed buffer
+			}
+
+			return LogHostError(hr);
+			break;
+		}
+
+		// Detect silence
+		// if (flags & AUDCLNT_BUFFERFLAGS_SILENT)
+		//	data = NULL;
+
+		// Process data
+		if (stream->in.monoMixer != NULL)
+		{
+			// expand buffer
+			UINT32 mono_frames_size = frames * (stream->in.wavex.Format.wBitsPerSample / 8);
+			if (mono_frames_size > stream->in.monoBufferSize)
+				stream->in.monoBuffer = PaWasapi_ReallocateMemory(stream->in.monoBuffer, (stream->in.monoBufferSize = mono_frames_size));
+
+			// mix 1 to 2 channels
+			stream->in.monoMixer(stream->in.monoBuffer, data, frames);
+
+			// process
+			processor[S_INPUT].processor((BYTE *)stream->in.monoBuffer, frames, NULL, 0, processor[S_INPUT].userData);
+		}
+		else
+		{
+			processor[S_INPUT].processor(data, frames, NULL, 0, processor[S_INPUT].userData);
+		}
+
+		// Release buffer
+		if ((hr = IAudioCaptureClient_ReleaseBuffer(stream->captureClient, frames)) != S_OK)
+			return LogHostError(hr);
+
+		//break;
+	}
+
+	return hr;
+}
+
+// ------------------------------------------------------------------------------------------
+void _StreamOnStop(PaWasapiStream *stream)
+{
+	// Stop INPUT/OUTPUT clients
+	if (!stream->bBlocking) 
+	{
+		if (stream->in.clientProc != NULL)
+			IAudioClient_Stop(stream->in.clientProc);
+		if (stream->out.clientProc != NULL)
+			IAudioClient_Stop(stream->out.clientProc);
+	} 
+	else 
+	{
+		if (stream->in.clientParent != NULL)
+			IAudioClient_Stop(stream->in.clientParent);
+		if (stream->out.clientParent != NULL)
+			IAudioClient_Stop(stream->out.clientParent);
+	}
+
+	// Restore thread priority
+	if (stream->hAvTask != NULL)
+	{
+		PaWasapi_ThreadPriorityRevert(stream->hAvTask);
+		stream->hAvTask = NULL;
+	}
+
+    // Notify
+    if (stream->streamRepresentation.streamFinishedCallback != NULL)
+        stream->streamRepresentation.streamFinishedCallback(stream->streamRepresentation.userData);
+}
+
+// ------------------------------------------------------------------------------------------
+PA_THREAD_FUNC ProcThreadEvent(void *param)
+{
+    PaWasapiHostProcessor processor[S_COUNT];
+	HRESULT hr;
+	DWORD dwResult;
+    PaWasapiStream *stream = (PaWasapiStream *)param;
+	PaWasapiHostProcessor defaultProcessor;
+	BOOL set_event[S_COUNT] = { FALSE, FALSE };
+	BOOL bWaitAllEvents = FALSE;
+	BOOL bThreadComInitialized = FALSE;
+
+	/*
+	If COM is already initialized CoInitialize will either return
+	FALSE, or RPC_E_CHANGED_MODE if it was initialized in a different
+	threading mode. In either case we shouldn't consider it an error
+	but we need to be careful to not call CoUninitialize() if 
+	RPC_E_CHANGED_MODE was returned.
+	*/
+	hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
+	if (FAILED(hr) && (hr != RPC_E_CHANGED_MODE))
+	{
+		PRINT(("WASAPI: failed ProcThreadEvent CoInitialize"));
+		return (UINT32)paUnanticipatedHostError;
+	}
+	if (hr != RPC_E_CHANGED_MODE)
+		bThreadComInitialized = TRUE;
+
+	// Unmarshal stream pointers for safe COM operation
+	hr = UnmarshalStreamComPointers(stream);
+	if (hr != S_OK) {
+		PRINT(("Error unmarshaling stream COM pointers. HRESULT: %i\n", hr));
+		goto thread_end;
+	}
+
+	// Waiting on all events in case of Full-Duplex/Exclusive mode.
+	if ((stream->in.clientProc != NULL) && (stream->out.clientProc != NULL))
+	{
+		bWaitAllEvents = (stream->in.shareMode == AUDCLNT_SHAREMODE_EXCLUSIVE) &&
+			(stream->out.shareMode == AUDCLNT_SHAREMODE_EXCLUSIVE);
+	}
+
+    // Setup data processors
+    defaultProcessor.processor = WaspiHostProcessingLoop;
+    defaultProcessor.userData  = stream;
+    processor[S_INPUT] = (stream->hostProcessOverrideInput.processor != NULL ? stream->hostProcessOverrideInput : defaultProcessor);
+    processor[S_OUTPUT] = (stream->hostProcessOverrideOutput.processor != NULL ? stream->hostProcessOverrideOutput : defaultProcessor);
+
+	// Boost thread priority
+	PaWasapi_ThreadPriorityBoost((void **)&stream->hAvTask, stream->nThreadPriority);
+
+	// Create events
+	if (stream->event[S_OUTPUT] == NULL)
+	{
+		stream->event[S_OUTPUT] = CreateEvent(NULL, FALSE, FALSE, NULL);
+		set_event[S_OUTPUT] = TRUE;
+	}
+	if (stream->event[S_INPUT] == NULL)
+	{
+		stream->event[S_INPUT]  = CreateEvent(NULL, FALSE, FALSE, NULL);
+		set_event[S_INPUT] = TRUE;
+	}
+	if ((stream->event[S_OUTPUT] == NULL) || (stream->event[S_INPUT] == NULL))
+	{
+		PRINT(("WASAPI Thread: failed creating Input/Output event handle\n"));
+		goto thread_error;
+	}
+
+	// Initialize event & start INPUT stream
+	if (stream->in.clientProc)
+	{
+		// Create & set handle
+		if (set_event[S_INPUT])
+		{
+			if ((hr = IAudioClient_SetEventHandle(stream->in.clientProc, stream->event[S_INPUT])) != S_OK)
+			{
+				LogHostError(hr);
+				goto thread_error;
+			}
+		}
+
+		// Start
+		if ((hr = IAudioClient_Start(stream->in.clientProc)) != S_OK)
+		{
+			LogHostError(hr);
+			goto thread_error;
+		}
+	}
+
+	// Initialize event & start OUTPUT stream
+	if (stream->out.clientProc)
+	{
+		// Create & set handle
+		if (set_event[S_OUTPUT])
+		{
+			if ((hr = IAudioClient_SetEventHandle(stream->out.clientProc, stream->event[S_OUTPUT])) != S_OK)
+			{
+				LogHostError(hr);
+				goto thread_error;
+			}
+		}
+
+		// Preload buffer before start
+		if ((hr = ProcessOutputBuffer(stream, processor, stream->out.framesPerBuffer)) != S_OK)
+		{
+			LogHostError(hr);
+			goto thread_error;
+		}
+
+		// Start
+		if ((hr = IAudioClient_Start(stream->out.clientProc)) != S_OK)
+		{
+			LogHostError(hr);
+			goto thread_error;
+		}
+
+	}
+
+	// Signal: stream running
+	stream->running = TRUE;
+
+	// Notify: thread started
+	SetEvent(stream->hThreadStart);
+
+	// Processing Loop
+	for (;;)
+    {
+	    // 10 sec timeout (on timeout stream will auto-stop when processed by WAIT_TIMEOUT case)
+        dwResult = WaitForMultipleObjects(S_COUNT, stream->event, bWaitAllEvents, 10*1000);
+
+		// Check for close event (after wait for buffers to avoid any calls to user
+		// callback when hCloseRequest was set)
+		if (WaitForSingleObject(stream->hCloseRequest, 0) != WAIT_TIMEOUT)
+			break;
+
+		// Process S_INPUT/S_OUTPUT
+		switch (dwResult)
+		{
+		case WAIT_TIMEOUT: {
+			PRINT(("WASAPI Thread: WAIT_TIMEOUT - probably bad audio driver or Vista x64 bug: use paWinWasapiPolling instead\n"));
+			goto thread_end;
+			break; }
+
+		// Input stream
+		case WAIT_OBJECT_0 + S_INPUT: {
+
+            if (stream->captureClient == NULL)
+                break;
+
+			if ((hr = ProcessInputBuffer(stream, processor)) != S_OK)
+			{
+				LogHostError(hr);
+				goto thread_error;
+			}
+
+			break; }
+
+		// Output stream
+		case WAIT_OBJECT_0 + S_OUTPUT: {
+
+            if (stream->renderClient == NULL)
+                break;
+
+			if ((hr = ProcessOutputBuffer(stream, processor, stream->out.framesPerBuffer)) != S_OK)
+			{
+				LogHostError(hr);
+				goto thread_error;
+			}
+
+			break; }
+		}
+	}
+
+thread_end:
+
+	// Process stop
+	_StreamOnStop(stream);
+
+	// Release unmarshaled COM pointers
+	ReleaseUnmarshaledComPointers(stream);
+
+	// Cleanup COM for this thread
+	if (bThreadComInitialized == TRUE)
+		CoUninitialize();
+
+	// Notify: not running
+	stream->running = FALSE;
+
+	// Notify: thread exited
+	SetEvent(stream->hThreadExit);
+
+	return 0;
+
+thread_error:
+
+	// Prevent deadlocking in Pa_StreamStart
+	SetEvent(stream->hThreadStart);
+
+	// Exit
+	goto thread_end;
+}
+
+// ------------------------------------------------------------------------------------------
+PA_THREAD_FUNC ProcThreadPoll(void *param)
+{
+    PaWasapiHostProcessor processor[S_COUNT];
+	HRESULT hr;
+    PaWasapiStream *stream = (PaWasapiStream *)param;
+	PaWasapiHostProcessor defaultProcessor;
+	INT32 i;
+	ThreadIdleScheduler scheduler;
+
+	// Calculate the actual duration of the allocated buffer.
+	DWORD sleep_ms     = 0;
+	DWORD sleep_ms_in;
+	DWORD sleep_ms_out;
+
+	BOOL bThreadComInitialized = FALSE;
+
+	/*
+	If COM is already initialized CoInitialize will either return
+	FALSE, or RPC_E_CHANGED_MODE if it was initialized in a different
+	threading mode. In either case we shouldn't consider it an error
+	but we need to be careful to not call CoUninitialize() if 
+	RPC_E_CHANGED_MODE was returned.
+	*/
+	hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
+	if (FAILED(hr) && (hr != RPC_E_CHANGED_MODE))
+	{
+		PRINT(("WASAPI: failed ProcThreadPoll CoInitialize"));
+		return (UINT32)paUnanticipatedHostError;
+	}
+	if (hr != RPC_E_CHANGED_MODE)
+		bThreadComInitialized = TRUE;
+
+	// Unmarshal stream pointers for safe COM operation
+	hr = UnmarshalStreamComPointers(stream);
+	if (hr != S_OK) 
+	{
+		PRINT(("Error unmarshaling stream COM pointers. HRESULT: %i\n", hr));
+		return 0;
+	}
+
+	// Calculate timeout for next polling attempt.
+	sleep_ms_in  = GetFramesSleepTime(stream->in.framesPerHostCallback/WASAPI_PACKETS_PER_INPUT_BUFFER, stream->in.wavex.Format.nSamplesPerSec);
+	sleep_ms_out = GetFramesSleepTime(stream->out.framesPerBuffer, stream->out.wavex.Format.nSamplesPerSec);
+
+	// WASAPI Input packets tend to expire very easily, let's limit sleep time to 2 milliseconds
+	// for all cases. Please propose better solution if any.
+	if (sleep_ms_in > 2)
+		sleep_ms_in = 2;
+
+	// Adjust polling time for non-paUtilFixedHostBufferSize. Input stream is not adjustable as it is being
+	// polled according its packet length.
+	if (stream->bufferMode != paUtilFixedHostBufferSize)
+	{
+		//sleep_ms_in = GetFramesSleepTime(stream->bufferProcessor.framesPerUserBuffer, stream->in.wavex.Format.nSamplesPerSec);
+		sleep_ms_out = GetFramesSleepTime(stream->bufferProcessor.framesPerUserBuffer, stream->out.wavex.Format.nSamplesPerSec);
+	}
+
+	// Choose smallest
+	if ((sleep_ms_in != 0) && (sleep_ms_out != 0))
+		sleep_ms = min(sleep_ms_in, sleep_ms_out);
+	else
+	{
+		sleep_ms = (sleep_ms_in ? sleep_ms_in : sleep_ms_out);
+	}
+	// Make sure not 0, othervise use ThreadIdleScheduler
+	if (sleep_ms == 0)
+	{
+		sleep_ms_in  = GetFramesSleepTimeMicroseconds(stream->in.framesPerHostCallback/WASAPI_PACKETS_PER_INPUT_BUFFER, stream->in.wavex.Format.nSamplesPerSec);
+		sleep_ms_out = GetFramesSleepTimeMicroseconds(stream->bufferProcessor.framesPerUserBuffer, stream->out.wavex.Format.nSamplesPerSec);
+
+		// Choose smallest
+		if ((sleep_ms_in != 0) && (sleep_ms_out != 0))
+			sleep_ms = min(sleep_ms_in, sleep_ms_out);
+		else
+		{
+			sleep_ms = (sleep_ms_in ? sleep_ms_in : sleep_ms_out);
+		}
+
+		// Setup thread sleep scheduler
+		ThreadIdleScheduler_Setup(&scheduler, 1, sleep_ms/* microseconds here */);
+		sleep_ms = 0;
+	}
+
+    // Setup data processors
+    defaultProcessor.processor = WaspiHostProcessingLoop;
+    defaultProcessor.userData  = stream;
+    processor[S_INPUT] = (stream->hostProcessOverrideInput.processor != NULL ? stream->hostProcessOverrideInput : defaultProcessor);
+    processor[S_OUTPUT] = (stream->hostProcessOverrideOutput.processor != NULL ? stream->hostProcessOverrideOutput : defaultProcessor);
+
+	// Boost thread priority
+	PaWasapi_ThreadPriorityBoost((void **)&stream->hAvTask, stream->nThreadPriority);
+
+	// Initialize event & start INPUT stream
+	if (stream->in.clientProc)
+	{
+		if ((hr = IAudioClient_Start(stream->in.clientProc)) != S_OK)
+		{
+			LogHostError(hr);
+			goto thread_error;
+		}
+	}
+
+	// Initialize event & start OUTPUT stream
+	if (stream->out.clientProc)
+	{
+		// Preload buffer (obligatory, othervise ->Start() will fail), avoid processing
+		// when in full-duplex mode as it requires input processing as well
+		if (!PA_WASAPI__IS_FULLDUPLEX(stream))
+		{
+			UINT32 frames = 0;
+			if ((hr = _PollGetOutputFramesAvailable(stream, &frames)) == S_OK)
+            {
+				if (stream->bufferMode == paUtilFixedHostBufferSize)
+				{
+					if (frames >= stream->out.framesPerBuffer)
+					{
+						frames = stream->out.framesPerBuffer;
+
+						if ((hr = ProcessOutputBuffer(stream, processor, frames)) != S_OK)
+						{
+							LogHostError(hr); // not fatal, just log
+						}
+					}
+				}
+				else
+				{
+					if (frames != 0)
+					{
+						if ((hr = ProcessOutputBuffer(stream, processor, frames)) != S_OK)
+						{
+							LogHostError(hr); // not fatal, just log
+						}
+					}
+				}
+            }
+            else
+			{
+				LogHostError(hr); // not fatal, just log
+			}
+		}
+
+		// Start
+		if ((hr = IAudioClient_Start(stream->out.clientProc)) != S_OK)
+		{
+			LogHostError(hr);
+			goto thread_error;
+		}
+	}
+
+	// Signal: stream running
+	stream->running = TRUE;
+
+	// Notify: thread started
+	SetEvent(stream->hThreadStart);
+
+	if (!PA_WASAPI__IS_FULLDUPLEX(stream))
+	{
+		// Processing Loop
+		UINT32 next_sleep = sleep_ms;
+		while (WaitForSingleObject(stream->hCloseRequest, next_sleep) == WAIT_TIMEOUT)
+		{
+			// Get next sleep time
+			if (sleep_ms == 0)
+			{
+				next_sleep = ThreadIdleScheduler_NextSleep(&scheduler);
+			}
+
+			for (i = 0; i < S_COUNT; ++i)
+			{
+				// Process S_INPUT/S_OUTPUT
+				switch (i)
+				{
+				// Input stream
+				case S_INPUT: {
+
+					if (stream->captureClient == NULL)
+						break;
+
+					if ((hr = ProcessInputBuffer(stream, processor)) != S_OK)
+					{
+						LogHostError(hr);
+						goto thread_error;
+					}
+
+					break; }
+
+				// Output stream
+				case S_OUTPUT: {
+
+					UINT32 frames;
+					if (stream->renderClient == NULL)
+						break;
+
+					// get available frames
+					if ((hr = _PollGetOutputFramesAvailable(stream, &frames)) != S_OK)
+					{
+						LogHostError(hr);
+						goto thread_error;
+					}
+
+					// output
+					if (stream->bufferMode == paUtilFixedHostBufferSize)
+					{
+						while (frames >= stream->out.framesPerBuffer)
+						{
+							if ((hr = ProcessOutputBuffer(stream, processor, stream->out.framesPerBuffer)) != S_OK)
+							{
+								LogHostError(hr);
+								goto thread_error;
+							}
+
+							frames -= stream->out.framesPerBuffer;
+						}
+					}
+					else
+					{
+						if (frames != 0)
+						{
+							if ((hr = ProcessOutputBuffer(stream, processor, frames)) != S_OK)
+							{
+								LogHostError(hr);
+								goto thread_error;
+							}
+						}
+					}
+
+					break; }
+				}
+			}
+		}
+	}
+	else
+	{
+#if 0
+		// Processing Loop
+		while (WaitForSingleObject(stream->hCloseRequest, 1) == WAIT_TIMEOUT)
+		{
+			UINT32 i_frames = 0, i_processed = 0;
+			BYTE *i_data = NULL, *o_data = NULL, *o_data_host = NULL;
+			DWORD i_flags = 0;
+			UINT32 o_frames = 0;
+
+			// get host input buffer
+			if ((hr = IAudioCaptureClient_GetBuffer(stream->captureClient, &i_data, &i_frames, &i_flags, NULL, NULL)) != S_OK)
+			{
+				if (hr == AUDCLNT_S_BUFFER_EMPTY)
+					continue; // no data in capture buffer
+
+				LogHostError(hr);
+				break;
+			}
+
+			// get available frames
+			if ((hr = _PollGetOutputFramesAvailable(stream, &o_frames)) != S_OK)
+			{
+				// release input buffer
+				IAudioCaptureClient_ReleaseBuffer(stream->captureClient, 0);
+
+				LogHostError(hr);
+				break;
+			}
+
+			// process equal ammount of frames
+			if (o_frames >= i_frames)
+			{
+				// process input ammount of frames
+				UINT32 o_processed = i_frames;
+
+				// get host output buffer
+				if ((hr = IAudioRenderClient_GetBuffer(stream->procRCClient, o_processed, &o_data)) == S_OK)
+				{
+					// processed amount of i_frames
+					i_processed = i_frames;
+					o_data_host = o_data;
+
+					// convert output mono
+					if (stream->out.monoMixer)
+					{
+						UINT32 mono_frames_size = o_processed * (stream->out.wavex.Format.wBitsPerSample / 8);
+						// expand buffer
+						if (mono_frames_size > stream->out.monoBufferSize)
+						{
+							stream->out.monoBuffer = PaWasapi_ReallocateMemory(stream->out.monoBuffer, (stream->out.monoBufferSize = mono_frames_size));
+							if (stream->out.monoBuffer == NULL)
+							{
+								// release input buffer
+								IAudioCaptureClient_ReleaseBuffer(stream->captureClient, 0);
+								// release output buffer
+								IAudioRenderClient_ReleaseBuffer(stream->renderClient, 0, 0);
+
+								LogPaError(paInsufficientMemory);
+								break;
+							}
+						}
+
+						// replace buffer pointer
+						o_data = (BYTE *)stream->out.monoBuffer;
+					}
+
+					// convert input mono
+					if (stream->in.monoMixer)
+					{
+						UINT32 mono_frames_size = i_processed * (stream->in.wavex.Format.wBitsPerSample / 8);
+						// expand buffer
+						if (mono_frames_size > stream->in.monoBufferSize)
+						{
+							stream->in.monoBuffer = PaWasapi_ReallocateMemory(stream->in.monoBuffer, (stream->in.monoBufferSize = mono_frames_size));
+							if (stream->in.monoBuffer == NULL)
+							{
+								// release input buffer
+								IAudioCaptureClient_ReleaseBuffer(stream->captureClient, 0);
+								// release output buffer
+								IAudioRenderClient_ReleaseBuffer(stream->renderClient, 0, 0);
+
+								LogPaError(paInsufficientMemory);
+								break;
+							}
+						}
+
+						// mix 2 to 1 input channels
+						stream->in.monoMixer(stream->in.monoBuffer, i_data, i_processed);
+
+						// replace buffer pointer
+						i_data = (BYTE *)stream->in.monoBuffer;
+					}
+
+					// process
+					processor[S_FULLDUPLEX].processor(i_data, i_processed, o_data, o_processed, processor[S_FULLDUPLEX].userData);
+
+					// mix 1 to 2 output channels
+					if (stream->out.monoBuffer)
+						stream->out.monoMixer(o_data_host, stream->out.monoBuffer, o_processed);
+
+					// release host output buffer
+					if ((hr = IAudioRenderClient_ReleaseBuffer(stream->renderClient, o_processed, 0)) != S_OK)
+						LogHostError(hr);
+				}
+				else
+				{
+					if (stream->out.shareMode != AUDCLNT_SHAREMODE_SHARED)
+						LogHostError(hr); // be silent in shared mode, try again next time
+				}
+			}
+
+			// release host input buffer
+			if ((hr = IAudioCaptureClient_ReleaseBuffer(stream->captureClient, i_processed)) != S_OK)
+			{
+				LogHostError(hr);
+				break;
+			}
+		}
+#else
+		// Processing Loop
+		UINT32 next_sleep = sleep_ms;
+		while (WaitForSingleObject(stream->hCloseRequest, next_sleep) == WAIT_TIMEOUT)
+		{
+			UINT32 i_frames = 0, i_processed = 0;
+			BYTE *i_data = NULL, *o_data = NULL, *o_data_host = NULL;
+			DWORD i_flags = 0;
+			UINT32 o_frames = 0;
+
+			// Get next sleep time
+			if (sleep_ms == 0)
+			{
+				next_sleep = ThreadIdleScheduler_NextSleep(&scheduler);
+			}
+
+			// get available frames
+			if ((hr = _PollGetOutputFramesAvailable(stream, &o_frames)) != S_OK)
+			{
+				LogHostError(hr);
+				break;
+			}
+
+			while (o_frames != 0)
+			{
+				// get host input buffer
+				if ((hr = IAudioCaptureClient_GetBuffer(stream->captureClient, &i_data, &i_frames, &i_flags, NULL, NULL)) != S_OK)
+				{
+					if (hr == AUDCLNT_S_BUFFER_EMPTY)
+						break; // no data in capture buffer
+
+					LogHostError(hr);
+					break;
+				}
+
+				// process equal ammount of frames
+				if (o_frames >= i_frames)
+				{
+					// process input ammount of frames
+					UINT32 o_processed = i_frames;
+
+					// get host output buffer
+					if ((hr = IAudioRenderClient_GetBuffer(stream->renderClient, o_processed, &o_data)) == S_OK)
+					{
+						// processed amount of i_frames
+						i_processed = i_frames;
+						o_data_host = o_data;
+
+						// convert output mono
+						if (stream->out.monoMixer)
+						{
+							UINT32 mono_frames_size = o_processed * (stream->out.wavex.Format.wBitsPerSample / 8);
+							// expand buffer
+							if (mono_frames_size > stream->out.monoBufferSize)
+							{
+								stream->out.monoBuffer = PaWasapi_ReallocateMemory(stream->out.monoBuffer, (stream->out.monoBufferSize = mono_frames_size));
+								if (stream->out.monoBuffer == NULL)
+								{
+									// release input buffer
+									IAudioCaptureClient_ReleaseBuffer(stream->captureClient, 0);
+									// release output buffer
+									IAudioRenderClient_ReleaseBuffer(stream->renderClient, 0, 0);
+
+									LogPaError(paInsufficientMemory);
+									goto thread_error;
+								}
+							}
+
+							// replace buffer pointer
+							o_data = (BYTE *)stream->out.monoBuffer;
+						}
+
+						// convert input mono
+						if (stream->in.monoMixer)
+						{
+							UINT32 mono_frames_size = i_processed * (stream->in.wavex.Format.wBitsPerSample / 8);
+							// expand buffer
+							if (mono_frames_size > stream->in.monoBufferSize)
+							{
+								stream->in.monoBuffer = PaWasapi_ReallocateMemory(stream->in.monoBuffer, (stream->in.monoBufferSize = mono_frames_size));
+								if (stream->in.monoBuffer == NULL)
+								{
+									// release input buffer
+									IAudioCaptureClient_ReleaseBuffer(stream->captureClient, 0);
+									// release output buffer
+									IAudioRenderClient_ReleaseBuffer(stream->renderClient, 0, 0);
+
+									LogPaError(paInsufficientMemory);
+									goto thread_error;
+								}
+							}
+
+							// mix 2 to 1 input channels
+							stream->in.monoMixer(stream->in.monoBuffer, i_data, i_processed);
+
+							// replace buffer pointer
+							i_data = (BYTE *)stream->in.monoBuffer;
+						}
+
+						// process
+						processor[S_FULLDUPLEX].processor(i_data, i_processed, o_data, o_processed, processor[S_FULLDUPLEX].userData);
+
+						// mix 1 to 2 output channels
+						if (stream->out.monoBuffer)
+							stream->out.monoMixer(o_data_host, stream->out.monoBuffer, o_processed);
+
+						// release host output buffer
+						if ((hr = IAudioRenderClient_ReleaseBuffer(stream->renderClient, o_processed, 0)) != S_OK)
+							LogHostError(hr);
+
+						o_frames -= o_processed;
+					}
+					else
+					{
+						if (stream->out.shareMode != AUDCLNT_SHAREMODE_SHARED)
+							LogHostError(hr); // be silent in shared mode, try again next time
+					}
+				}
+				else
+				{
+					i_processed = 0;
+					goto fd_release_buffer_in;
+				}
+
+fd_release_buffer_in:
+
+				// release host input buffer
+				if ((hr = IAudioCaptureClient_ReleaseBuffer(stream->captureClient, i_processed)) != S_OK)
+				{
+					LogHostError(hr);
+					break;
+				}
+
+				// break processing, input hasn't been accumulated yet
+				if (i_processed == 0)
+					break;
+			}
+		}
+#endif
+	}
+
+thread_end:
+
+	// Process stop
+	_StreamOnStop(stream);
+
+	// Release unmarshaled COM pointers
+	ReleaseUnmarshaledComPointers(stream);
+
+	// Cleanup COM for this thread
+	if (bThreadComInitialized == TRUE)
+		CoUninitialize();
+
+	// Notify: not running
+	stream->running = FALSE;
+
+	// Notify: thread exited
+	SetEvent(stream->hThreadExit);
+
+	return 0;
+
+thread_error:
+
+	// Prevent deadlocking in Pa_StreamStart
+	SetEvent(stream->hThreadStart);
+
+	// Exit
+	goto thread_end;
+}
+
+// ------------------------------------------------------------------------------------------
+void *PaWasapi_ReallocateMemory(void *ptr, size_t size)
+{
+	return realloc(ptr, size);
+}
+
+// ------------------------------------------------------------------------------------------
+void PaWasapi_FreeMemory(void *ptr)
+{
+	free(ptr);
+}
+
+//#endif //VC 2005
+
+
+
+
+#if 0
+			if(bFirst) {
+				float masteur;
+				hr = stream->outVol->GetMasterVolumeLevelScalar(&masteur);
+				if (hr != S_OK)
+					LogHostError(hr);
+				float chan1, chan2;
+				hr = stream->outVol->GetChannelVolumeLevelScalar(0, &chan1);
+				if (hr != S_OK)
+					LogHostError(hr);
+				hr = stream->outVol->GetChannelVolumeLevelScalar(1, &chan2);
+				if (hr != S_OK)
+					LogHostError(hr);
+
+				BOOL bMute;
+				hr = stream->outVol->GetMute(&bMute);
+				if (hr != S_OK)
+					LogHostError(hr);
+
+				stream->outVol->SetMasterVolumeLevelScalar(0.5, NULL);
+				stream->outVol->SetChannelVolumeLevelScalar(0, 0.5, NULL);
+				stream->outVol->SetChannelVolumeLevelScalar(1, 0.5, NULL);
+				stream->outVol->SetMute(FALSE, NULL);
+				bFirst = FALSE;
+			}
+#endif
diff --git a/src/hostapi/wasapi/readme.txt b/src/hostapi/wasapi/readme.txt
index 7d4082b..0cfa0fa 100644
--- a/src/hostapi/wasapi/readme.txt
+++ b/src/hostapi/wasapi/readme.txt
@@ -1,25 +1,22 @@
-**************
-* WASAPI API *
-**************
-
-----------------------------------------
-Microsoft Visual Studio 2005SP1/2008/10
-----------------------------------------
-No specific actions are needed to compile WASAPI API under Visual Studio.
-You are only required to install min. Windows Vista SDK (v6.0A) prior
-compilation.
-
-----------------------------------------
-MinGW (GCC 32-bit)/ MinGW64 (GCC 64-bit)
-----------------------------------------
-To compile under MinGW you are required to include 'mingw-include' directory
-which contains necessary files with WASAPI API. These files are modified
-in order to be compiled by MinGW compiler. These files are taken from 
-Windows Vista SDK (v6.0A). MinGW compilation is tested and proved to be
-fully working under 32-bit and 64-bit modes.
-MinGW   (32-bit) tested: gcc version 4.4.0 (GCC)
-MinGW64 (64-bit) tested: gcc version 4.4.4 20100226 (prerelease) (GCC)
-
-PortAudio
-/Dmitry Kostjuchenko/
-04.03.2010
\ No newline at end of file
+**************
+* WASAPI API *
+**************
+
+-------------------------------------------
+Microsoft Visual Studio 2005 SP1 and higher
+-------------------------------------------
+No specific action is required to compile WASAPI API under Visual Studio.
+You are only required to install min. Windows Vista SDK (v6.0A) prior
+the compilation. To compile with WASAPI specific functionality for Windows 8
+and higher the min. Windows 8 SDK is required.
+
+----------------------------------------
+MinGW (GCC 32/64-bit)
+----------------------------------------
+To compile with MinGW you are required to include 'mingw-include' directory
+which contains necessary files with WASAPI API. These files are modified
+for the compatibility with MinGW compiler. These files are taken from 
+the Windows Vista SDK (v6.0A). MinGW compilation is tested and proved to be
+fully working.
+MinGW   (32-bit) tested min. version: gcc version 4.4.0 (GCC)
+MinGW64 (64-bit) tested min. version: gcc version 4.4.4 20100226 (prerelease) (GCC)
\ No newline at end of file
diff --git a/src/hostapi/wdmks/pa_win_wdmks.c b/src/hostapi/wdmks/pa_win_wdmks.c
index f969e14..70a48d8 100644
--- a/src/hostapi/wdmks/pa_win_wdmks.c
+++ b/src/hostapi/wdmks/pa_win_wdmks.c
@@ -1,5 +1,5 @@
 /*
-* $Id: pa_win_wdmks.c 1885 2012-12-28 16:54:25Z robiwan $
+* $Id$
 * PortAudio Windows WDM-KS interface
 *
 * Author: Andrew Baldwin, Robert Bielik (WaveRT)
@@ -86,8 +86,17 @@ of a device for the duration of active stream using those devices
 
 #include "pa_win_wdmks.h"
 
+#ifndef DRV_QUERYDEVICEINTERFACE
+#define DRV_QUERYDEVICEINTERFACE     (DRV_RESERVED + 12)
+#endif
+#ifndef DRV_QUERYDEVICEINTERFACESIZE
+#define DRV_QUERYDEVICEINTERFACESIZE (DRV_RESERVED + 13)
+#endif
+
 #include <windows.h>
+#ifndef __GNUC__ /* Fix for ticket #257: MinGW-w64: Inclusion of <winioctl.h> triggers multiple redefinition errors. */
 #include <winioctl.h>
+#endif
 #include <process.h>
 
 #include <math.h>
@@ -506,8 +515,9 @@ static PaError PinRegisterPositionRegister(PaWinWdmPin* pPin);
 static PaError PinRegisterNotificationHandle(PaWinWdmPin* pPin, HANDLE handle);
 static PaError PinUnregisterNotificationHandle(PaWinWdmPin* pPin, HANDLE handle);
 static PaError PinGetHwLatency(PaWinWdmPin* pPin, ULONG* pFifoSize, ULONG* pChipsetDelay, ULONG* pCodecDelay);
-static PaError PinGetAudioPositionDirect(PaWinWdmPin* pPin, ULONG* pPosition);
-static PaError PinGetAudioPositionViaIOCTL(PaWinWdmPin* pPin, ULONG* pPosition);
+static PaError PinGetAudioPositionMemoryMapped(PaWinWdmPin* pPin, ULONG* pPosition);
+static PaError PinGetAudioPositionViaIOCTLRead(PaWinWdmPin* pPin, ULONG* pPosition);
+static PaError PinGetAudioPositionViaIOCTLWrite(PaWinWdmPin* pPin, ULONG* pPosition);
 
 /* Filter management functions */
 static PaWinWdmFilter* FilterNew(PaWDMKSType type, DWORD devNode, const wchar_t* filterName, const wchar_t* friendlyName, PaError* error);
@@ -633,6 +643,16 @@ static BOOL IsDeviceTheSame(const PaWinWdmDeviceInfo* pDev1,
 
 static BOOL IsEarlierThanVista()
 {
+/*
+NOTE: GetVersionEx() is deprecated as of Windows 8.1 and can not be used to reliably detect
+versions of Windows higher than Windows 8 (due to manifest requirements for reporting higher versions).
+Microsoft recommends switching to VerifyVersionInfo (available on Win 2k and later), however GetVersionEx
+is is faster, for now we just disable the deprecation warning.
+See: https://msdn.microsoft.com/en-us/library/windows/desktop/ms724451(v=vs.85).aspx
+See: http://www.codeproject.com/Articles/678606/Part-Overcoming-Windows-s-deprecation-of-GetVe
+*/
+#pragma warning (disable : 4996) /* use of GetVersionEx */
+
     OSVERSIONINFO osvi;
     osvi.dwOSVersionInfoSize = sizeof(osvi);
     if (GetVersionEx(&osvi) && osvi.dwMajorVersion<6)
@@ -640,6 +660,8 @@ static BOOL IsEarlierThanVista()
         return TRUE;
     }
     return FALSE;
+
+#pragma warning (default : 4996)
 }
 
 
@@ -1004,7 +1026,7 @@ static ULONG GetNumberOfConnectionsTo(const KSTOPOLOGY_CONNECTION* pTo, PaWinWdm
     ULONG retval = 0;
     unsigned i;
     const KSTOPOLOGY_CONNECTION* connections = (const KSTOPOLOGY_CONNECTION*)(filter->connections + 1);
-    PA_DEBUG(("GetNumberOfConnectionsTo: Checking %u connections...", filter->connections->Count));
+    PA_DEBUG(("GetNumberOfConnectionsTo: Checking %u connections...\n", filter->connections->Count));
     for (i = 0; i < filter->connections->Count; ++i)
     {
         const KSTOPOLOGY_CONNECTION* pConn = connections + i;
@@ -1014,6 +1036,7 @@ static ULONG GetNumberOfConnectionsTo(const KSTOPOLOGY_CONNECTION* pTo, PaWinWdm
             ++retval;
         }
     }
+    PA_DEBUG(("GetNumberOfConnectionsTo: Returning %d\n", retval));
     return retval;
 }
 
@@ -1023,16 +1046,18 @@ static const KSTOPOLOGY_CONNECTION* FindStartConnectionFrom(ULONG startPin, PaWi
 {
     unsigned i;
     const KSTOPOLOGY_CONNECTION* connections = (const KSTOPOLOGY_CONNECTION*)(filter->connections + 1);
-    PA_DEBUG(("FindStartConnectionFrom: Checking %u connections...", filter->connections->Count));
+    PA_DEBUG(("FindStartConnectionFrom: Startpin %u, Checking %u connections...\n", startPin, filter->connections->Count));
     for (i = 0; i < filter->connections->Count; ++i)
     {
         const KSTOPOLOGY_CONNECTION* pConn = connections + i;
         if (pConn->ToNode == KSFILTER_NODE && pConn->ToNodePin == startPin)
         {
+            PA_DEBUG(("FindStartConnectionFrom: returning %p\n", pConn));
             return pConn;
         }
     }
 
+    PA_DEBUG(("FindStartConnectionFrom: returning NULL\n"));
     assert(FALSE);
     return 0;
 }
@@ -1041,26 +1066,36 @@ static const KSTOPOLOGY_CONNECTION* FindStartConnectionTo(ULONG startPin, PaWinW
 {
     unsigned i;
     const KSTOPOLOGY_CONNECTION* connections = (const KSTOPOLOGY_CONNECTION*)(filter->connections + 1);
-    PA_DEBUG(("FindStartConnectionTo: Checking %u connections...", filter->connections->Count));
+    PA_DEBUG(("FindStartConnectionTo: Startpin %u, Checking %u connections...\n", startPin, filter->connections->Count));
     for (i = 0; i < filter->connections->Count; ++i)
     {
         const KSTOPOLOGY_CONNECTION* pConn = connections + i;
         if (pConn->FromNode == KSFILTER_NODE && pConn->FromNodePin == startPin)
         {
+            PA_DEBUG(("FindStartConnectionTo: returning %p\n", pConn));
             return pConn;
         }
     }
 
+    PA_DEBUG(("FindStartConnectionTo: returning NULL\n"));
     assert(FALSE);
     return 0;
 }
 
 static ULONG GetConnectedPin(ULONG startPin, BOOL forward, PaWinWdmFilter* filter, int muxPosition, ULONG *muxInputPinId, ULONG *muxNodeId)
 {
+    int limit=1000;
     const KSTOPOLOGY_CONNECTION *conn = NULL; 
     TFnGetConnection fnGetConnection = forward ? GetConnectionTo : GetConnectionFrom ;
+    PA_LOGE_;
     while (1)
     {
+        limit--;
+        if (limit == 0) {
+           PA_DEBUG(("GetConnectedPin: LOOP LIMIT REACHED\n"));
+           break;
+        }
+
         if (conn == NULL)
         {
             conn = forward ? FindStartConnectionTo(startPin, filter) : FindStartConnectionFrom(startPin, filter);
@@ -1106,6 +1141,7 @@ static ULONG GetConnectedPin(ULONG startPin, BOOL forward, PaWinWdmFilter* filte
             }
         }
     }
+    PA_LOGL_;
     return KSFILTER_NODE;
 }
 
@@ -1115,6 +1151,7 @@ static void DumpConnectionsAndNodes(PaWinWdmFilter* filter)
     const KSTOPOLOGY_CONNECTION* connections = (const KSTOPOLOGY_CONNECTION*)(filter->connections + 1);
     const GUID* nodes = (const GUID*)(filter->nodes + 1);
 
+    PA_LOGE_;
     PA_DEBUG(("DumpConnectionsAndNodes: connections=%d, nodes=%d\n", filter->connections->Count, filter->nodes->Count));
 
     for (i=0; i < filter->connections->Count; ++i)
@@ -1139,6 +1176,7 @@ static void DumpConnectionsAndNodes(PaWinWdmFilter* filter)
             pConn->Data4[6], pConn->Data4[7]
         ));
     }
+    PA_LOGL_;
 
 }
 
@@ -1188,6 +1226,7 @@ static PaError GetNameFromCategory(const GUID* pGUID, BOOL input, wchar_t* name,
     PaError result = paUnanticipatedHostError;
     USHORT usbTerminalGUID = (USHORT)(pGUID->Data1 - 0xDFF219E0);
 
+    PA_LOGE_;
     if (input && usbTerminalGUID >= 0x301 && usbTerminalGUID < 0x400)
     {
         /* Output terminal name for an input !? Set it to Line! */
@@ -1227,6 +1266,7 @@ static PaError GetNameFromCategory(const GUID* pGUID, BOOL input, wchar_t* name,
     {
         PaWinWDM_SetLastErrorInfo(result, "GetNameFromCategory: usbTerminalGUID = %04X ", usbTerminalGUID);
     }
+    PA_LOGL_;
     return result;
 }
 
@@ -1625,6 +1665,8 @@ static PaWinWdmPin* PinNew(PaWinWdmFilter* parentFilter, unsigned long pinId, Pa
             else
             {
                 KSPIN_PHYSICALCONNECTION* pc = (KSPIN_PHYSICALCONNECTION*)PaUtil_AllocateMemory(cbBytes + 2);
+                ULONG pcPin;
+                wchar_t symbLinkName[MAX_PATH];
                 PA_DEBUG(("PinNew: Physical connection found!\n"));
                 if (pc == NULL)
                 {
@@ -1639,144 +1681,255 @@ static PaWinWdmPin* PinNew(PaWinWdmFilter* parentFilter, unsigned long pinId, Pa
                     cbBytes,
                     NULL
                     );
-                if (result == paNoError)
+
+                pcPin = pc->Pin;
+                wcsncpy(symbLinkName, pc->SymbolicLinkName, MAX_PATH);
+                PaUtil_FreeMemory( pc );
+
+                if (result != paNoError)
                 {
-                    wchar_t symbLinkName[MAX_PATH];
-                    wcsncpy(symbLinkName, pc->SymbolicLinkName, MAX_PATH);
-                    if (symbLinkName[1] == TEXT('?'))
+                    /* Shouldn't happen, but fail if it does */
+                    PA_DEBUG(("PinNew: failed to retrieve physical connection!\n"));
+                    goto error;
+                }
+
+                if (symbLinkName[1] == TEXT('?'))
+                {
+                    symbLinkName[1] = TEXT('\\');
+                }
+
+                if (pin->parentFilter->topologyFilter == NULL)
+                {
+                    PA_DEBUG(("PinNew: Creating topology filter '%S'\n", symbLinkName));
+
+                    pin->parentFilter->topologyFilter = FilterNew(Type_kNotUsed, 0, symbLinkName, L"", &result);
+                    if (pin->parentFilter->topologyFilter == NULL)
                     {
-                        symbLinkName[1] = TEXT('\\');
+                        PA_DEBUG(("PinNew: Failed creating topology filter\n"));
+                        result = paUnanticipatedHostError;
+                        PaWinWDM_SetLastErrorInfo(result, "Failed to create topology filter '%S'", symbLinkName);
+                        goto error;
                     }
 
-                    if (pin->parentFilter->topologyFilter == NULL)
+                    /* Copy info so we have it in device info */
+                    wcsncpy(pin->parentFilter->devInfo.topologyPath, symbLinkName, MAX_PATH);
+                }
+                else
+                {
+                    /* Must be the same */
+                    assert(wcscmp(symbLinkName, pin->parentFilter->topologyFilter->devInfo.filterPath) == 0);
+                }
+
+                PA_DEBUG(("PinNew: Opening topology filter..."));
+
+                result = FilterUse(pin->parentFilter->topologyFilter);
+                if (result == paNoError)
+                {
+                    unsigned long endpointPinId;
+
+                    if (pin->dataFlow == KSPIN_DATAFLOW_IN)
                     {
-                        PA_DEBUG(("PinNew: Creating topology filter '%S'\n", symbLinkName));
+                        /* The "endpointPinId" is what WASAPI looks at for pin names */
+                        GUID category = {0};
+
+                        PA_DEBUG(("PinNew: Checking for output endpoint pin id...\n"));
+
+                        endpointPinId = GetConnectedPin(pcPin, TRUE, pin->parentFilter->topologyFilter, -1, NULL, NULL);
 
-                        pin->parentFilter->topologyFilter = FilterNew(Type_kNotUsed, 0, symbLinkName, L"", &result);
-                        if (pin->parentFilter->topologyFilter == NULL)
+                        if (endpointPinId == KSFILTER_NODE)
                         {
-                            PA_DEBUG(("PinNew: Failed creating topology filter\n"));
                             result = paUnanticipatedHostError;
-                            PaWinWDM_SetLastErrorInfo(result, "Failed to create topology filter '%S'", symbLinkName);
+                            PaWinWDM_SetLastErrorInfo(result, "Failed to get endpoint pin ID on topology filter!");
                             goto error;
                         }
 
-                        /* Copy info so we have it in device info */
-                        wcsncpy(pin->parentFilter->devInfo.topologyPath, symbLinkName, MAX_PATH);
-                    }
-                    else
-                    {
-                        /* Must be the same */
-                        assert(wcscmp(symbLinkName, pin->parentFilter->topologyFilter->devInfo.filterPath) == 0);
-                    }
+                        PA_DEBUG(("PinNew: Found endpoint pin id %u\n", endpointPinId));
 
-                    PA_DEBUG(("PinNew: Opening topology filter..."));
+                        /* Get pin category information */
+                        result = WdmGetPinPropertySimple(pin->parentFilter->topologyFilter->handle,
+                            endpointPinId,
+                            &KSPROPSETID_Pin,
+                            KSPROPERTY_PIN_CATEGORY,
+                            &category,
+                            sizeof(GUID),
+                            NULL);
 
-                    result = FilterUse(pin->parentFilter->topologyFilter);
-                    if (result == paNoError)
-                    {
-                        unsigned long endpointPinId;
-
-                        if (pin->dataFlow == KSPIN_DATAFLOW_IN)
+                        if (result == paNoError)
                         {
-                            /* The "endpointPinId" is what WASAPI looks at for pin names */
-                            GUID category = {0};
+#if !PA_WDMKS_USE_CATEGORY_FOR_PIN_NAMES
+                            wchar_t pinName[MAX_PATH];
 
-                            PA_DEBUG(("PinNew: Checking for output endpoint pin id...\n"));
+                            PA_DEBUG(("PinNew: Getting pin name property..."));
 
-                            endpointPinId = GetConnectedPin(pc->Pin, TRUE, pin->parentFilter->topologyFilter, -1, NULL, NULL);
+                            /* Ok, try pin name also, and favor that if available */
+                            result = WdmGetPinPropertySimple(pin->parentFilter->topologyFilter->handle,
+                                endpointPinId,
+                                &KSPROPSETID_Pin,
+                                KSPROPERTY_PIN_NAME,
+                                pinName,
+                                MAX_PATH,
+                                NULL);
 
-                            if (endpointPinId == KSFILTER_NODE)
+                            if (result == paNoError && wcslen(pinName)>0)
                             {
-                                result = paUnanticipatedHostError;
-                                PaWinWDM_SetLastErrorInfo(result, "Failed to get endpoint pin ID on topology filter!");
-                                goto error;
+                                wcsncpy(pin->friendlyName, pinName, MAX_PATH);
+                            }
+                            else
+#endif
+                            {
+                                result = GetNameFromCategory(&category, (pin->dataFlow == KSPIN_DATAFLOW_OUT), pin->friendlyName, MAX_PATH);
                             }
+                        }
 
-                            PA_DEBUG(("PinNew: Found endpoint pin id %u\n", endpointPinId));
+                        /* Make sure we get a name for the pin */
+                        if (wcslen(pin->friendlyName) == 0)
+                        {
+                            wcscpy(pin->friendlyName, kOutputName);
+                        }
+#ifdef UNICODE
+                        PA_DEBUG(("PinNew: Pin name '%s'\n", pin->friendlyName));
+#else
+                        PA_DEBUG(("PinNew: Pin name '%S'\n", pin->friendlyName));
+#endif                                
 
-                            /* Get pin category information */
-                            result = WdmGetPinPropertySimple(pin->parentFilter->topologyFilter->handle,
-                                endpointPinId,
-                                &KSPROPSETID_Pin,
-                                KSPROPERTY_PIN_CATEGORY,
-                                &category,
-                                sizeof(GUID),
-                                NULL);
+                        /* Set endpoint pin ID (this is the topology INPUT pin, since portmixer will always traverse the
+                        filter in audio streaming direction, see http://msdn.microsoft.com/en-us/library/windows/hardware/ff536331(v=vs.85).aspx
+                        for more information)
+                        */
+                        pin->endpointPinId = pcPin;
+                    }
+                    else
+                    {
+                        unsigned muxCount = 0;
+                        int muxPos = 0;
+                        /* Max 64 multiplexer inputs... sanity check :) */
+                        for (i = 0; i < 64; ++i)
+                        {
+                            ULONG muxNodeIdTest = (unsigned)-1;
+                            PA_DEBUG(("PinNew: Checking for input endpoint pin id (%d)...\n", i));
+
+                            endpointPinId = GetConnectedPin(pcPin,
+                                FALSE,
+                                pin->parentFilter->topologyFilter,
+                                (int)i,
+                                NULL,
+                                &muxNodeIdTest);
 
-                            if (result == paNoError)
+                            if (endpointPinId == KSFILTER_NODE)
                             {
-#if !PA_WDMKS_USE_CATEGORY_FOR_PIN_NAMES
-                                wchar_t pinName[MAX_PATH];
+                                /* We're done */
+                                PA_DEBUG(("PinNew: Done with inputs.\n", endpointPinId));
+                                break;
+                            }
+                            else
+                            {
+                                /* The "endpointPinId" is what WASAPI looks at for pin names */
+                                GUID category = {0};
 
-                                PA_DEBUG(("PinNew: Getting pin name property..."));
+                                PA_DEBUG(("PinNew: Found endpoint pin id %u\n", endpointPinId));
 
-                                /* Ok, try pin name also, and favor that if available */
+                                /* Get pin category information */
                                 result = WdmGetPinPropertySimple(pin->parentFilter->topologyFilter->handle,
                                     endpointPinId,
                                     &KSPROPSETID_Pin,
-                                    KSPROPERTY_PIN_NAME,
-                                    pinName,
-                                    MAX_PATH,
+                                    KSPROPERTY_PIN_CATEGORY,
+                                    &category,
+                                    sizeof(GUID),
                                     NULL);
 
-                                if (result == paNoError && wcslen(pinName)>0)
+                                if (result == paNoError)
                                 {
-                                    wcsncpy(pin->friendlyName, pinName, MAX_PATH);
+                                    if (muxNodeIdTest == (unsigned)-1)
+                                    {
+                                        /* Ok, try pin name, and favor that if available */
+                                        result = WdmGetPinPropertySimple(pin->parentFilter->topologyFilter->handle,
+                                            endpointPinId,
+                                            &KSPROPSETID_Pin,
+                                            KSPROPERTY_PIN_NAME,
+                                            pin->friendlyName,
+                                            MAX_PATH,
+                                            NULL);
+
+                                        if (result != paNoError)
+                                        {
+                                            result = GetNameFromCategory(&category, TRUE, pin->friendlyName, MAX_PATH);
+                                        }
+                                        break;
+                                    }
+                                    else
+                                    {
+                                        result = GetNameFromCategory(&category, TRUE, NULL, 0);
+
+                                        if (result == paNoError)
+                                        {
+                                            ++muxCount;
+                                        }
+                                    }
                                 }
                                 else
-#endif
                                 {
-                                    result = GetNameFromCategory(&category, (pin->dataFlow == KSPIN_DATAFLOW_OUT), pin->friendlyName, MAX_PATH);
+                                    PA_DEBUG(("PinNew: Failed to get pin category"));
                                 }
+                            }
+                        }
 
-                                if (wcslen(pin->friendlyName) == 0)
-                                {
-                                    wcscpy(pin->friendlyName, L"Output");
-                                }
+                        if (muxCount == 0)
+                        {
+                            pin->endpointPinId = endpointPinId;
+                            /* Make sure we get a name for the pin */
+                            if (wcslen(pin->friendlyName) == 0)
+                            {
+                                wcscpy(pin->friendlyName, kInputName);
+                            }
 #ifdef UNICODE
-                                PA_DEBUG(("PinNew: Pin name '%s'\n", pin->friendlyName));
+                            PA_DEBUG(("PinNew: Input friendly name '%s'\n", pin->friendlyName));
 #else
-                                PA_DEBUG(("PinNew: Pin name '%S'\n", pin->friendlyName));
-#endif                                
-                            }
-
-                            /* Set endpoint pin ID (this is the topology INPUT pin, since portmixer will always traverse the
-                            filter in audio streaming direction, see http://msdn.microsoft.com/en-us/library/windows/hardware/ff536331(v=vs.85).aspx
-                            for more information)
-                            */
-                            pin->endpointPinId = pc->Pin;
+                            PA_DEBUG(("PinNew: Input friendly name '%S'\n", pin->friendlyName));
+#endif
                         }
-                        else
+                        else // muxCount > 0
                         {
-                            unsigned muxCount = 0;
-                            int muxPos = 0;
-                            /* Max 64 multiplexer inputs... sanity check :) */
-                            for (i = 0; i < 64; ++i)
-                            {
-                                ULONG muxNodeIdTest = (unsigned)-1;
-                                PA_DEBUG(("PinNew: Checking for input endpoint pin id (%d)...\n", i));
+                            PA_DEBUG(("PinNew: Setting up %u inputs\n", muxCount));
 
-                                endpointPinId = GetConnectedPin(pc->Pin,
-                                    FALSE,
-                                    pin->parentFilter->topologyFilter,
-                                    (int)i,
-                                    NULL,
-                                    &muxNodeIdTest);
+                            /* Now we redo the operation once known how many multiplexer positions there are */
+                            pin->inputs = (PaWinWdmMuxedInput**)PaUtil_AllocateMemory(muxCount * sizeof(PaWinWdmMuxedInput*));
+                            if (pin->inputs == NULL)
+                            {
+                                FilterRelease(pin->parentFilter->topologyFilter);
+                                result = paInsufficientMemory;
+                                goto error;
+                            }
+                            pin->inputCount = muxCount;
 
+                            for (i = 0; i < muxCount; ++muxPos)
+                            {
+                                PA_DEBUG(("PinNew: Setting up input %u...\n", i));
 
-                                if (endpointPinId == KSFILTER_NODE)
+                                if (pin->inputs[i] == NULL)
                                 {
-                                    /* We're done */
-                                    PA_DEBUG(("PinNew: Done with inputs.\n", endpointPinId));
-                                    break;
+                                    pin->inputs[i] = (PaWinWdmMuxedInput*)PaUtil_AllocateMemory(sizeof(PaWinWdmMuxedInput));
+                                    if (pin->inputs[i] == NULL)
+                                    {
+                                        FilterRelease(pin->parentFilter->topologyFilter);
+                                        result = paInsufficientMemory;
+                                        goto error;
+                                    }
                                 }
-                                else
+
+                                endpointPinId = GetConnectedPin(pcPin,
+                                    FALSE,
+                                    pin->parentFilter->topologyFilter,
+                                    muxPos,
+                                    &pin->inputs[i]->muxPinId, 
+                                    &pin->inputs[i]->muxNodeId);
+
+                                if (endpointPinId != KSFILTER_NODE)
                                 {
                                     /* The "endpointPinId" is what WASAPI looks at for pin names */
                                     GUID category = {0};
 
-                                    PA_DEBUG(("PinNew: Found endpoint pin id %u\n", endpointPinId));
+                                    /* Set input endpoint ID */
+                                    pin->inputs[i]->endpointPinId = endpointPinId;
 
                                     /* Get pin category information */
                                     result = WdmGetPinPropertySimple(pin->parentFilter->topologyFilter->handle,
@@ -1789,146 +1942,41 @@ static PaWinWdmPin* PinNew(PaWinWdmFilter* parentFilter, unsigned long pinId, Pa
 
                                     if (result == paNoError)
                                     {
-                                        if (muxNodeIdTest == (unsigned)-1)
-                                        {
-                                            /* Ok, try pin name, and favor that if available */
-                                            result = WdmGetPinPropertySimple(pin->parentFilter->topologyFilter->handle,
-                                                endpointPinId,
-                                                &KSPROPSETID_Pin,
-                                                KSPROPERTY_PIN_NAME,
-                                                pin->friendlyName,
-                                                MAX_PATH,
-                                                NULL);
-
-                                            if (result != paNoError)
-                                            {
-                                                result = GetNameFromCategory(&category, TRUE, pin->friendlyName, MAX_PATH);
-                                            }
-                                            break;
-                                        }
-                                        else
-                                        {
-                                            result = GetNameFromCategory(&category, TRUE, NULL, 0);
-
-                                            if (result == paNoError)
-                                            {
-                                                ++muxCount;
-                                            }
-                                        }
-                                    }
-                                    else
-                                    {
-                                        PA_DEBUG(("PinNew: Failed to get pin category"));
-                                    }
-                                }
-                            }
-
-                            if (muxCount == 0)
-                            {
-                                pin->endpointPinId = endpointPinId;
-                                /* Make sure we get a name for the pin */
-                                if (wcslen(pin->friendlyName) == 0)
-                                {
-                                    wcscpy(pin->friendlyName, kInputName);
-                                }
-#ifdef UNICODE
-                                PA_DEBUG(("PinNew: Input friendly name '%s'\n", pin->friendlyName));
-#else
-                                PA_DEBUG(("PinNew: Input friendly name '%S'\n", pin->friendlyName));
-#endif
-                            }
-                            else // muxCount > 0
-                            {
-                                PA_DEBUG(("PinNew: Setting up %u inputs\n", muxCount));
-
-                                /* Now we redo the operation once known how many multiplexer positions there are */
-                                pin->inputs = (PaWinWdmMuxedInput**)PaUtil_AllocateMemory(muxCount * sizeof(PaWinWdmMuxedInput*));
-                                if (pin->inputs == NULL)
-                                {
-                                    FilterRelease(pin->parentFilter->topologyFilter);
-                                    result = paInsufficientMemory;
-                                    goto error;
-                                }
-                                pin->inputCount = muxCount;
-
-                                for (i = 0; i < muxCount; ++muxPos)
-                                {
-                                    PA_DEBUG(("PinNew: Setting up input %u...\n", i));
-
-                                    if (pin->inputs[i] == NULL)
-                                    {
-                                        pin->inputs[i] = (PaWinWdmMuxedInput*)PaUtil_AllocateMemory(sizeof(PaWinWdmMuxedInput));
-                                        if (pin->inputs[i] == NULL)
-                                        {
-                                            FilterRelease(pin->parentFilter->topologyFilter);
-                                            result = paInsufficientMemory;
-                                            goto error;
-                                        }
-                                    }
-
-                                    endpointPinId = GetConnectedPin(pc->Pin,
-                                        FALSE,
-                                        pin->parentFilter->topologyFilter,
-                                        muxPos,
-                                        &pin->inputs[i]->muxPinId, 
-                                        &pin->inputs[i]->muxNodeId);
-
-                                    if (endpointPinId != KSFILTER_NODE)
-                                    {
-                                        /* The "endpointPinId" is what WASAPI looks at for pin names */
-                                        GUID category = {0};
-
-                                        /* Set input endpoint ID */
-                                        pin->inputs[i]->endpointPinId = endpointPinId;
-
-                                        /* Get pin category information */
+                                        /* Try pin name first, and if that is not defined, use category instead */
                                         result = WdmGetPinPropertySimple(pin->parentFilter->topologyFilter->handle,
                                             endpointPinId,
                                             &KSPROPSETID_Pin,
-                                            KSPROPERTY_PIN_CATEGORY,
-                                            &category,
-                                            sizeof(GUID),
+                                            KSPROPERTY_PIN_NAME,
+                                            pin->inputs[i]->friendlyName,
+                                            MAX_PATH,
                                             NULL);
 
-                                        if (result == paNoError)
+                                        if (result != paNoError)
                                         {
-                                            /* Try pin name first, and if that is not defined, use category instead */
-                                            result = WdmGetPinPropertySimple(pin->parentFilter->topologyFilter->handle,
-                                                endpointPinId,
-                                                &KSPROPSETID_Pin,
-                                                KSPROPERTY_PIN_NAME,
-                                                pin->inputs[i]->friendlyName,
-                                                MAX_PATH,
-                                                NULL);
-
+                                            result = GetNameFromCategory(&category, TRUE, pin->inputs[i]->friendlyName, MAX_PATH);
                                             if (result != paNoError)
                                             {
-                                                result = GetNameFromCategory(&category, TRUE, pin->inputs[i]->friendlyName, MAX_PATH);
-                                                if (result != paNoError)
-                                                {
-                                                    /* Only specify name, let name hash in ScanDeviceInfos fix postfix enumerators */
-                                                    wcscpy(pin->inputs[i]->friendlyName, kInputName);
-                                                }
+                                                /* Only specify name, let name hash in ScanDeviceInfos fix postfix enumerators */
+                                                wcscpy(pin->inputs[i]->friendlyName, kInputName);
                                             }
+                                        }
 #ifdef UNICODE
-                                            PA_DEBUG(("PinNew: Input (%u) friendly name '%s'\n", i, pin->inputs[i]->friendlyName));
+                                        PA_DEBUG(("PinNew: Input (%u) friendly name '%s'\n", i, pin->inputs[i]->friendlyName));
 #else
-                                            PA_DEBUG(("PinNew: Input (%u) friendly name '%S'\n", i, pin->inputs[i]->friendlyName));
+                                        PA_DEBUG(("PinNew: Input (%u) friendly name '%S'\n", i, pin->inputs[i]->friendlyName));
 #endif
-                                            ++i;
-                                        }
-                                    }
-                                    else
-                                    {
-                                        /* Should never come here! */
-                                        assert(FALSE);
+                                        ++i;
                                     }
                                 }
+                                else
+                                {
+                                    /* Should never come here! */
+                                    assert(FALSE);
+                                }
                             }
                         }
                     }
                 }
-                PaUtil_FreeMemory(pc);
             }
         }
         else
@@ -1958,18 +2006,14 @@ error:
     Error cleanup
     */
 
-    PaUtil_FreeMemory( item );
-    if( pin )
+    if (pin->parentFilter->topologyFilter && pin->parentFilter->topologyFilter->handle != NULL)
     {
-        if (pin->parentFilter->topologyFilter && pin->parentFilter->topologyFilter->handle != NULL)
-        {
-            FilterRelease(pin->parentFilter->topologyFilter);
-        }
-
-        PaUtil_FreeMemory( pin->pinConnect );
-        PaUtil_FreeMemory( pin->dataRangesItem );
-        PaUtil_FreeMemory( pin );
+        FilterRelease(pin->parentFilter->topologyFilter);
     }
+
+    PaUtil_FreeMemory( item );
+    PinFree(pin);
+
     *error = result;
     PA_LOGL_;
     return NULL;
@@ -2221,12 +2265,7 @@ static PaError PinIsFormatSupported(PaWinWdmPin* pin, const WAVEFORMATEX* format
 
         if (pFormatExt != 0)
         {
-            if ( dataRange->MinimumBitsPerSample > pFormatExt->Samples.wValidBitsPerSample )
-            {
-                result = paSampleFormatNotSupported;
-                continue;
-            }
-            if ( dataRange->MaximumBitsPerSample < pFormatExt->Samples.wValidBitsPerSample )
+            if (!IsBitsWithinRange(dataRange, pFormatExt->Samples.wValidBitsPerSample))
             {
                 result = paSampleFormatNotSupported;
                 continue;
@@ -2234,26 +2273,14 @@ static PaError PinIsFormatSupported(PaWinWdmPin* pin, const WAVEFORMATEX* format
         }
         else
         {
-            if( dataRange->MinimumBitsPerSample > format->wBitsPerSample )
-            {
-                result = paSampleFormatNotSupported;
-                continue;
-            }
-
-            if( dataRange->MaximumBitsPerSample < format->wBitsPerSample )
+            if (!IsBitsWithinRange(dataRange, format->wBitsPerSample))
             {
                 result = paSampleFormatNotSupported;
                 continue;
             }
         }
 
-        if( dataRange->MinimumSampleFrequency > format->nSamplesPerSec )
-        {
-            result = paInvalidSampleRate;
-            continue;
-        }
-
-        if( dataRange->MaximumSampleFrequency < format->nSamplesPerSec )
+        if (!IsFrequencyWithinRange(dataRange, format->nSamplesPerSec))
         {
             result = paInvalidSampleRate;
             continue;
@@ -2273,6 +2300,8 @@ static PaError PinQueryNotificationSupport(PaWinWdmPin* pPin, BOOL* pbResult)
     PaError result = paNoError;
     KSPROPERTY propIn;
 
+    PA_LOGE_;
+
     propIn.Set = KSPROPSETID_RtAudio;
     propIn.Id = 8; /* = KSPROPERTY_RTAUDIO_QUERY_NOTIFICATION_SUPPORT */
     propIn.Flags = KSPROPERTY_TYPE_GET;
@@ -2289,8 +2318,8 @@ static PaError PinQueryNotificationSupport(PaWinWdmPin* pPin, BOOL* pbResult)
         PA_DEBUG(("Failed PinQueryNotificationSupport\n"));
     }
 
+    PA_LOGL_;
     return result;
-
 }
 
 static PaError PinGetBufferWithNotification(PaWinWdmPin* pPin, void** pBuffer, DWORD* pRequestedBufSize, BOOL* pbCallMemBarrier)
@@ -2299,6 +2328,8 @@ static PaError PinGetBufferWithNotification(PaWinWdmPin* pPin, void** pBuffer, D
     KSRTAUDIO_BUFFER_PROPERTY_WITH_NOTIFICATION propIn;
     KSRTAUDIO_BUFFER propOut;
 
+    PA_LOGE_;
+
     propIn.BaseAddress = 0;
     propIn.NotificationCount = 2;
     propIn.RequestedBufferSize = *pRequestedBufSize;
@@ -2324,6 +2355,7 @@ static PaError PinGetBufferWithNotification(PaWinWdmPin* pPin, void** pBuffer, D
         PA_DEBUG(("Failed to get buffer with notification\n"));
     }
 
+    PA_LOGL_;
     return result;
 }
 
@@ -2333,6 +2365,8 @@ static PaError PinGetBufferWithoutNotification(PaWinWdmPin* pPin, void** pBuffer
     KSRTAUDIO_BUFFER_PROPERTY propIn;
     KSRTAUDIO_BUFFER propOut;
 
+    PA_LOGE_;
+
     propIn.BaseAddress = NULL;
     propIn.RequestedBufferSize = *pRequestedBufSize;
     propIn.Property.Set = KSPROPSETID_RtAudio;
@@ -2357,6 +2391,7 @@ static PaError PinGetBufferWithoutNotification(PaWinWdmPin* pPin, void** pBuffer
         PA_DEBUG(("Failed to get buffer without notification\n"));
     }
 
+    PA_LOGL_;
     return result;
 }
 
@@ -2374,9 +2409,17 @@ requested buffer size on multiples of 128 bytes:
 static PaError PinGetBuffer(PaWinWdmPin* pPin, void** pBuffer, DWORD* pRequestedBufSize, BOOL* pbCallMemBarrier)
 {
     PaError result = paNoError;
+    int limit = 1000;
+    PA_LOGE_;
 
     while (1)
     {
+        limit--;
+        if (limit == 0) {
+           PA_DEBUG(("PinGetBuffer: LOOP LIMIT REACHED\n"));
+           break;
+        }
+
         if (pPin->pinKsSubType != SubType_kPolled)
         {
             /* In case of unknown (or notification), we try both modes */
@@ -2419,6 +2462,8 @@ static PaError PinGetBuffer(PaWinWdmPin* pPin, void** pBuffer, DWORD* pRequested
         }
     }
 
+    PA_LOGL_;
+
     return result;
 }
 
@@ -2433,7 +2478,7 @@ static PaError PinRegisterPositionRegister(PaWinWdmPin* pPin)
     propIn.BaseAddress = NULL;
     propIn.Property.Set = KSPROPSETID_RtAudio;
     propIn.Property.Id = KSPROPERTY_RTAUDIO_POSITIONREGISTER;
-    propIn.Property.Flags = KSPROPERTY_TYPE_GET;
+    propIn.Property.Flags = KSPROPERTY_TYPE_SET;
 
     result = WdmSyncIoctl(pPin->handle, IOCTL_KS_PROPERTY,
         &propIn,
@@ -2466,7 +2511,7 @@ static PaError PinRegisterNotificationHandle(PaWinWdmPin* pPin, HANDLE handle)
     prop.NotificationEvent = handle;
     prop.Property.Set = KSPROPSETID_RtAudio;
     prop.Property.Id = KSPROPERTY_RTAUDIO_REGISTER_NOTIFICATION_EVENT;
-    prop.Property.Flags = KSPROPERTY_TYPE_GET;
+    prop.Property.Flags = KSPROPERTY_TYPE_SET;
 
     result = WdmSyncIoctl(pPin->handle,
         IOCTL_KS_PROPERTY,
@@ -2497,7 +2542,7 @@ static PaError PinUnregisterNotificationHandle(PaWinWdmPin* pPin, HANDLE handle)
         prop.NotificationEvent = handle;
         prop.Property.Set = KSPROPSETID_RtAudio;
         prop.Property.Id = KSPROPERTY_RTAUDIO_UNREGISTER_NOTIFICATION_EVENT;
-        prop.Property.Flags = KSPROPERTY_TYPE_GET;
+        prop.Property.Flags = KSPROPERTY_TYPE_SET;
 
         result = WdmSyncIoctl(pPin->handle,
             IOCTL_KS_PROPERTY,
@@ -2552,14 +2597,14 @@ static PaError PinGetHwLatency(PaWinWdmPin* pPin, ULONG* pFifoSize, ULONG* pChip
 }
 
 /* This one is used for WaveRT */
-static PaError PinGetAudioPositionDirect(PaWinWdmPin* pPin, ULONG* pPosition)
+static PaError PinGetAudioPositionMemoryMapped(PaWinWdmPin* pPin, ULONG* pPosition)
 {
     *pPosition = (*pPin->positionRegister);
     return paNoError;
 }
 
 /* This one also, but in case the driver hasn't implemented memory mapped access to the position register */
-static PaError PinGetAudioPositionViaIOCTL(PaWinWdmPin* pPin, ULONG* pPosition)
+static PaError PinGetAudioPositionViaIOCTLRead(PaWinWdmPin* pPin, ULONG* pPosition)
 {
     PaError result = paNoError;
     KSPROPERTY propIn;
@@ -2583,7 +2628,41 @@ static PaError PinGetAudioPositionViaIOCTL(PaWinWdmPin* pPin, ULONG* pPosition)
     }
     else
     {
-        PA_DEBUG(("Failed to get audio position!\n"));
+        PA_DEBUG(("Failed to get audio play position!\n"));
+    }
+
+    PA_LOGL_;
+
+    return result;
+
+}
+
+/* This one also, but in case the driver hasn't implemented memory mapped access to the position register */
+static PaError PinGetAudioPositionViaIOCTLWrite(PaWinWdmPin* pPin, ULONG* pPosition)
+{
+    PaError result = paNoError;
+    KSPROPERTY propIn;
+    KSAUDIO_POSITION propOut;
+
+    PA_LOGE_;
+
+    propIn.Set = KSPROPSETID_Audio;
+    propIn.Id = KSPROPERTY_AUDIO_POSITION;
+    propIn.Flags = KSPROPERTY_TYPE_GET;
+
+    result = WdmSyncIoctl(pPin->handle,
+        IOCTL_KS_PROPERTY,
+        &propIn, sizeof(KSPROPERTY),
+        &propOut, sizeof(KSAUDIO_POSITION),
+        NULL);
+
+    if (result == paNoError)
+    {
+        *pPosition = (ULONG)(propOut.WriteOffset);
+    }
+    else
+    {
+        PA_DEBUG(("Failed to get audio write position!\n"));
     }
 
     PA_LOGL_;
@@ -2783,7 +2862,7 @@ error:
         {
             if (filter->pins[pinId])
             {
-                PaUtil_FreeMemory(filter->pins[pinId]);
+                PinFree(filter->pins[pinId]);
                 filter->pins[pinId] = 0;
             }
         }
@@ -2800,7 +2879,6 @@ error:
 */
 static void FilterFree(PaWinWdmFilter* filter)
 {
-    int pinId;
     PA_LOGL_;
     if( filter )
     {
@@ -2810,13 +2888,14 @@ static void FilterFree(PaWinWdmFilter* filter)
             return;
         }
 
-        if (filter->topologyFilter)
+        if ( filter->topologyFilter )
         {
             FilterFree(filter->topologyFilter);
             filter->topologyFilter = 0;
         }
         if ( filter->pins )
         {
+            int pinId;
             for( pinId = 0; pinId < filter->pinCount; pinId++ )
                 PinFree(filter->pins[pinId]);
             PaUtil_FreeMemory( filter->pins );
@@ -3374,6 +3453,10 @@ static PaError ScanDeviceInfos( struct PaUtilHostApiRepresentation *hostApi, PaH
     int filterCount = 0;
     int totalDeviceCount = 0;
     int idxDevice = 0;
+    DWORD defaultInDevPathSize = 0;
+    DWORD defaultOutDevPathSize = 0;
+    wchar_t* defaultInDevPath = 0;
+    wchar_t* defaultOutDevPath = 0;
 
     ppFilters = BuildFilterList( &filterCount, &totalDeviceCount, &result );
     if( result != paNoError )
@@ -3381,11 +3464,24 @@ static PaError ScanDeviceInfos( struct PaUtilHostApiRepresentation *hostApi, PaH
         goto error;
     }
 
+    // Get hold of default device paths for capture & playback
+    if( waveInMessage(0, DRV_QUERYDEVICEINTERFACESIZE, (DWORD_PTR)&defaultInDevPathSize, 0 ) == MMSYSERR_NOERROR )
+    {
+        defaultInDevPath = (wchar_t *)PaUtil_AllocateMemory((defaultInDevPathSize + 1) * sizeof(wchar_t));
+        waveInMessage(0, DRV_QUERYDEVICEINTERFACE, (DWORD_PTR)defaultInDevPath, defaultInDevPathSize);
+    }
+    if( waveOutMessage(0, DRV_QUERYDEVICEINTERFACESIZE, (DWORD_PTR)&defaultOutDevPathSize, 0 ) == MMSYSERR_NOERROR )
+    {
+        defaultOutDevPath = (wchar_t *)PaUtil_AllocateMemory((defaultOutDevPathSize + 1) * sizeof(wchar_t));
+        waveOutMessage(0, DRV_QUERYDEVICEINTERFACE, (DWORD_PTR)defaultOutDevPath, defaultOutDevPathSize);
+    }
+
     if( totalDeviceCount > 0 )
     {
         PaWinWdmDeviceInfo *deviceInfoArray = 0;
         int idxFilter;
         int i;
+        unsigned devIsDefaultIn = 0, devIsDefaultOut = 0;
 
         /* Allocate the out param for all the info we need */
         outArgument = (PaWinWDMScanDeviceInfosResults *) PaUtil_GroupAllocateMemory(
@@ -3440,6 +3536,9 @@ static PaError ScanDeviceInfos( struct PaUtilHostApiRepresentation *hostApi, PaH
                 continue;
             }
 
+            devIsDefaultIn = (defaultInDevPath && (_wcsicmp(pFilter->devInfo.filterPath, defaultInDevPath) == 0));
+            devIsDefaultOut = (defaultOutDevPath && (_wcsicmp(pFilter->devInfo.filterPath, defaultOutDevPath) == 0));
+
             for (i = 0; i < pFilter->pinCount; ++i)
             {
                 unsigned m;
@@ -3501,14 +3600,19 @@ static PaError ScanDeviceInfos( struct PaUtilHostApiRepresentation *hostApi, PaH
                     /* Convert wide char string to utf-8 */
                     WideCharToMultiByte(CP_UTF8, 0, localCompositeName, -1, wdmDeviceInfo->compositeName, MAX_PATH, NULL, NULL);
 
-                    /* NB! WDM/KS has no concept of a full-duplex device, each pin is either an input or and output */
+                    /* NB! WDM/KS has no concept of a full-duplex device, each pin is either an input or an output */
                     if (isInput)
                     {
                         /* INPUT ! */
                         deviceInfo->maxInputChannels  = pin->maxChannels;
                         deviceInfo->maxOutputChannels = 0;
 
-                        if (outArgument->defaultInputDevice == paNoDevice)
+                        /* RoBi NB: Due to the fact that input audio endpoints in Vista (& later OSs) can be the same device, but with
+                           different input mux settings, there might be a discrepancy between the default input device chosen, and
+                           that which will be used by Portaudio. Not much to do about that unfortunately.
+                        */
+                        if ((defaultInDevPath == 0 || devIsDefaultIn) &&
+                             outArgument->defaultInputDevice == paNoDevice)
                         {
                             outArgument->defaultInputDevice = idxDevice;
                         }
@@ -3519,7 +3623,8 @@ static PaError ScanDeviceInfos( struct PaUtilHostApiRepresentation *hostApi, PaH
                         deviceInfo->maxInputChannels  = 0;
                         deviceInfo->maxOutputChannels = pin->maxChannels;
 
-                        if (outArgument->defaultOutputDevice == paNoDevice)
+                        if ((defaultOutDevPath == 0 || devIsDefaultOut) &&
+                            outArgument->defaultOutputDevice == paNoDevice)
                         {
                             outArgument->defaultOutputDevice = idxDevice;
                         }
@@ -4159,7 +4264,8 @@ static unsigned NextPowerOf2(unsigned val)
 
 static PaError ValidateSpecificStreamParameters(
     const PaStreamParameters *streamParameters,
-    const PaWinWDMKSInfo *streamInfo)
+    const PaWinWDMKSInfo *streamInfo,
+    unsigned isInput)
 {
     if( streamInfo )
     {
@@ -4170,6 +4276,12 @@ static PaError ValidateSpecificStreamParameters(
             return paIncompatibleHostApiSpecificStreamInfo;
         }
 
+        if (!!(streamInfo->flags & ~(paWinWDMKSOverrideFramesize | paWinWDMKSUseGivenChannelMask)))
+        {
+            PA_DEBUG(("Stream parameters: non supported flags set"));
+            return paIncompatibleHostApiSpecificStreamInfo;
+        }
+
         if (streamInfo->noOfPackets != 0 &&
             (streamInfo->noOfPackets < 2 || streamInfo->noOfPackets > 8))
         {
@@ -4177,6 +4289,21 @@ static PaError ValidateSpecificStreamParameters(
             return paIncompatibleHostApiSpecificStreamInfo;
         }
 
+        if (streamInfo->flags & paWinWDMKSUseGivenChannelMask)
+        {
+            if (isInput)
+            {
+                PA_DEBUG(("Stream parameters: Channels mask setting not supported for input stream"));
+                return paIncompatibleHostApiSpecificStreamInfo;
+            }
+
+            if (streamInfo->channelMask & PAWIN_SPEAKER_RESERVED)
+            {
+                PA_DEBUG(("Stream parameters: Given channels mask 0x%08X not supported", streamInfo->channelMask));
+                return paIncompatibleHostApiSpecificStreamInfo;
+            }
+        }
+
     }
 
     return paNoError;
@@ -4184,6 +4311,7 @@ static PaError ValidateSpecificStreamParameters(
 
 
 
+
 /* see pa_hostapi.h for a list of validity guarantees made about OpenStream parameters */
 
 static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
@@ -4231,7 +4359,7 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
         }
 
         /* validate inputStreamInfo */
-        result = ValidateSpecificStreamParameters(inputParameters, inputParameters->hostApiSpecificStreamInfo);
+        result = ValidateSpecificStreamParameters(inputParameters, inputParameters->hostApiSpecificStreamInfo, 1 );
         if(result != paNoError)
         {
             PaWinWDM_SetLastErrorInfo(result, "Host API stream info not supported (in)");
@@ -4266,7 +4394,7 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
         }
 
         /* validate outputStreamInfo */
-        result = ValidateSpecificStreamParameters( outputParameters, outputParameters->hostApiSpecificStreamInfo );
+        result = ValidateSpecificStreamParameters( outputParameters, outputParameters->hostApiSpecificStreamInfo, 0 );
         if (result != paNoError)
         {
             PaWinWDM_SetLastErrorInfo(result, "Host API stream info not supported (out)");
@@ -4471,8 +4599,16 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
         PaWinWdmFilter* pFilter;
         PaWinWdmDeviceInfo* pDeviceInfo;
         PaWinWdmPin* pPin;
+        PaWinWDMKSInfo* pInfo = (PaWinWDMKSInfo*)(outputParameters->hostApiSpecificStreamInfo);
         unsigned validBitsPerSample = 0;
         PaWinWaveFormatChannelMask channelMask = PaWin_DefaultChannelMask( userOutputChannels );
+        if (pInfo && (pInfo->flags & paWinWDMKSUseGivenChannelMask))
+        {
+            PA_DEBUG(("Using channelMask 0x%08X instead of default 0x%08X\n",
+                pInfo->channelMask,
+                channelMask));
+            channelMask = pInfo->channelMask;
+        }
 
         result = paSampleFormatNotSupported;
         pDeviceInfo = (PaWinWdmDeviceInfo*)wdmHostApi->inheritedHostApiRep.deviceInfos[outputParameters->device];
@@ -4960,8 +5096,8 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
                 if (result != paNoError)
                 {
                     unsigned long pos = 0xdeadc0de;
-                    PA_DEBUG(("Failed to register capture position register, using PinGetAudioPositionViaIOCTL\n"));
-                    stream->capture.pPin->fnAudioPosition = PinGetAudioPositionViaIOCTL;
+                    PA_DEBUG(("Failed to register capture position register, using PinGetAudioPositionViaIOCTLWrite\n"));
+                    stream->capture.pPin->fnAudioPosition = PinGetAudioPositionViaIOCTLWrite;
                     /* Test position function */
                     result = (stream->capture.pPin->fnAudioPosition)(stream->capture.pPin, &pos);
                     if (result != paNoError || pos != 0x0)
@@ -4974,7 +5110,7 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
                 }
                 else
                 {
-                    stream->capture.pPin->fnAudioPosition = PinGetAudioPositionDirect;
+                    stream->capture.pPin->fnAudioPosition = PinGetAudioPositionMemoryMapped;
                 }
             }
             break;
@@ -5082,8 +5218,8 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
                 if (result != paNoError)
                 {
                     unsigned long pos = 0xdeadc0de;
-                    PA_DEBUG(("Failed to register rendering position register, using PinGetAudioPositionViaIOCTL\n"));
-                    stream->render.pPin->fnAudioPosition = PinGetAudioPositionViaIOCTL;
+                    PA_DEBUG(("Failed to register rendering position register, using PinGetAudioPositionViaIOCTLRead\n"));
+                    stream->render.pPin->fnAudioPosition = PinGetAudioPositionViaIOCTLRead;
                     /* Test position function */
                     result = (stream->render.pPin->fnAudioPosition)(stream->render.pPin, &pos);
                     if (result != paNoError || pos != 0x0)
@@ -5096,7 +5232,7 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
                 }
                 else
                 {
-                    stream->render.pPin->fnAudioPosition = PinGetAudioPositionDirect;
+                    stream->render.pPin->fnAudioPosition = PinGetAudioPositionMemoryMapped;
                 }
             }
             break;
diff --git a/src/hostapi/wmme/pa_win_wmme.c b/src/hostapi/wmme/pa_win_wmme.c
index 7c9f5f9..422c867 100644
--- a/src/hostapi/wmme/pa_win_wmme.c
+++ b/src/hostapi/wmme/pa_win_wmme.c
@@ -1,5 +1,5 @@
 /*
- * $Id: pa_win_wmme.c 1874 2012-10-31 06:20:59Z rbencina $
+ * $Id$
  * pa_win_wmme.c
  * Implementation of PortAudio for Windows MultiMedia Extensions (WMME)       
  *                                                                                         
@@ -62,7 +62,7 @@
 */
 
 /** @file
-	@ingroup hostapi_src
+    @ingroup hostapi_src
 
     @brief Win32 host API implementation for the Windows MultiMedia Extensions (WMME) audio API.
 */
@@ -86,6 +86,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <limits.h>
 #include <math.h>
 #include <windows.h>
 #include <mmsystem.h>
@@ -201,31 +202,52 @@
 static const char constInputMapperSuffix_[] = " - Input";
 static const char constOutputMapperSuffix_[] = " - Output";
 
-/*
-copies TCHAR string to explicit char string
-*/
-char *StrTCpyToC(char *to, const TCHAR *from)
+/********************************************************************/
+
+/* Copy null-terminated TCHAR string to explicit char string using UTF8 encoding */
+static char *CopyTCharStringToUtf8CString(char *destination, size_t destLengthBytes, const TCHAR *source)
 {
 #if !defined(_UNICODE) && !defined(UNICODE)
-	return strcpy(to, from);
+    return strcpy(destination, source);
 #else
-	int count = wcslen(from);
-	if (count != 0)
-		if (WideCharToMultiByte(CP_ACP, 0, from, count, to, count, NULL, NULL) == 0)
-			return NULL;
-	return to;
+    /* The cbMultiByte parameter ["destLengthBytes" below] is:
+    """
+    Size, in bytes, of the buffer indicated by lpMultiByteStr ["destination" below]. 
+    If this parameter is set to 0, the function returns the required buffer 
+    size for lpMultiByteStr and makes no use of the output parameter itself.
+    """
+    Source: WideCharToMultiByte at MSDN:
+    http://msdn.microsoft.com/en-us/library/windows/desktop/dd374130(v=vs.85).aspx
+    */
+    int intDestLengthBytes; /* cbMultiByte */
+    /* intDestLengthBytes is an int, destLengthBytes is a size_t. Ensure that we don't overflow
+    intDestLengthBytes by only using at most INT_MAX bytes of destination buffer.
+    */
+    if (destLengthBytes < INT_MAX)
+    {
+#pragma warning (disable : 4267) /* "conversion from 'size_t' to 'int', possible loss of data" */
+        intDestLengthBytes = (int)destLengthBytes; /* destLengthBytes is guaranteed < INT_MAX here */
+#pragma warning (default : 4267)
+    }
+    else
+    {
+        intDestLengthBytes = INT_MAX;
+    }
+    
+    if (WideCharToMultiByte(CP_UTF8, 0, source, -1, destination, /*cbMultiByte=*/intDestLengthBytes, NULL, NULL) == 0)
+        return NULL;
+    return destination;
 #endif
 }
 
-/*
-returns length of TCHAR string
-*/
-size_t StrTLen(const TCHAR *str)
+/* returns required length (in bytes) of destination buffer when 
+   converting TCHAR string to UTF8 bytes, not including the terminating null. */
+static size_t TCharStringLen(const TCHAR *str)
 {
 #if !defined(_UNICODE) && !defined(UNICODE)
-	return strlen(str);
+    return strlen(str);
 #else
-	return wcslen(str);	
+    return WideCharToMultiByte(CP_UTF8, 0, str, -1, NULL, 0, NULL, NULL);	
 #endif
 }
 
@@ -491,7 +513,7 @@ static UINT LocalDeviceIndexToWinMmeDeviceId( PaWinMmeHostApiRepresentation *hos
 {
     assert( device >= 0 && device < hostApi->inputDeviceCount + hostApi->outputDeviceCount );
 
-	return hostApi->winMmeDeviceIds[ device ];
+    return hostApi->winMmeDeviceIds[ device ];
 }
 
 
@@ -686,6 +708,7 @@ static PaError InitializeInputDeviceInfo( PaWinMmeHostApiRepresentation *winMmeH
     MMRESULT mmresult;
     WAVEINCAPS wic;
     PaDeviceInfo *deviceInfo = &winMmeDeviceInfo->inheritedDeviceInfo;
+    size_t len;
     
     *success = 0;
 
@@ -705,31 +728,35 @@ static PaError InitializeInputDeviceInfo( PaWinMmeHostApiRepresentation *winMmeH
         return paNoError;
     }           
 
+    /* NOTE: the WAVEOUTCAPS.szPname is a null-terminated array of 32 characters,
+        so we are limited to displaying only the first 31 characters of the device name. */
     if( winMmeInputDeviceId == WAVE_MAPPER )
     {
+        len = TCharStringLen( wic.szPname ) + 1 + sizeof(constInputMapperSuffix_);
         /* Append I/O suffix to WAVE_MAPPER device. */
-        deviceName = (char *)PaUtil_GroupAllocateMemory(
+        deviceName = (char*)PaUtil_GroupAllocateMemory(
                     winMmeHostApi->allocations,
-					(long) (StrTLen( wic.szPname ) + 1 + sizeof(constInputMapperSuffix_)) );
+                    (long)len );
         if( !deviceName )
         {
             result = paInsufficientMemory;
             goto error;
         }
-        StrTCpyToC( deviceName, wic.szPname );
+        CopyTCharStringToUtf8CString( deviceName, len, wic.szPname );
         strcat( deviceName, constInputMapperSuffix_ );
     }
     else
     {
+        len = TCharStringLen( wic.szPname ) + 1;
         deviceName = (char*)PaUtil_GroupAllocateMemory(
-                    winMmeHostApi->allocations, 
-					(long) (StrTLen( wic.szPname ) + 1) );
+                    winMmeHostApi->allocations,
+                    (long)len );
         if( !deviceName )
         {
             result = paInsufficientMemory;
             goto error;
         }
-        StrTCpyToC( deviceName, wic.szPname  );
+        CopyTCharStringToUtf8CString( deviceName, len, wic.szPname  );
     }
     deviceInfo->name = deviceName;
 
@@ -811,6 +838,7 @@ static PaError InitializeOutputDeviceInfo( PaWinMmeHostApiRepresentation *winMme
     MMRESULT mmresult;
     WAVEOUTCAPS woc;
     PaDeviceInfo *deviceInfo = &winMmeDeviceInfo->inheritedDeviceInfo;
+    size_t len;
 #ifdef PAWIN_USE_WDMKS_DEVICE_INFO
     int wdmksDeviceOutputChannelCountIsKnown;
 #endif
@@ -833,31 +861,35 @@ static PaError InitializeOutputDeviceInfo( PaWinMmeHostApiRepresentation *winMme
         return paNoError;
     }
 
+    /* NOTE: the WAVEOUTCAPS.szPname is a null-terminated array of 32 characters,
+        so we are limited to displaying only the first 31 characters of the device name. */
     if( winMmeOutputDeviceId == WAVE_MAPPER )
     {
         /* Append I/O suffix to WAVE_MAPPER device. */
-        deviceName = (char *)PaUtil_GroupAllocateMemory(
+        len = TCharStringLen( woc.szPname ) + 1 + sizeof(constOutputMapperSuffix_);
+        deviceName = (char*)PaUtil_GroupAllocateMemory(
                     winMmeHostApi->allocations, 
-					(long) (StrTLen( woc.szPname ) + 1 + sizeof(constOutputMapperSuffix_)) );
+                    (long)len );
         if( !deviceName )
         {
             result = paInsufficientMemory;
             goto error;
         }
-        StrTCpyToC( deviceName, woc.szPname );
+        CopyTCharStringToUtf8CString( deviceName, len, woc.szPname );
         strcat( deviceName, constOutputMapperSuffix_ );
     }
     else
     {
+        len = TCharStringLen( woc.szPname ) + 1;
         deviceName = (char*)PaUtil_GroupAllocateMemory(
                     winMmeHostApi->allocations, 
-					(long) (StrTLen( woc.szPname ) + 1) );
+                    (long)len );
         if( !deviceName )
         {
             result = paInsufficientMemory;
             goto error;
         }
-        StrTCpyToC( deviceName, woc.szPname  );
+        CopyTCharStringToUtf8CString( deviceName, len, woc.szPname );
     }
     deviceInfo->name = deviceName;
 
@@ -882,7 +914,7 @@ static PaError InitializeOutputDeviceInfo( PaWinMmeHostApiRepresentation *winMme
 
 #ifdef PAWIN_USE_WDMKS_DEVICE_INFO
     wdmksDeviceOutputChannelCountIsKnown = QueryWaveOutKSFilterMaxChannels( 
-			winMmeOutputDeviceId, &deviceInfo->maxOutputChannels );
+            winMmeOutputDeviceId, &deviceInfo->maxOutputChannels );
     if( wdmksDeviceOutputChannelCountIsKnown && !winMmeDeviceInfo->deviceOutputChannelCountIsKnown )
         winMmeDeviceInfo->deviceOutputChannelCountIsKnown = 1;
 #endif /* PAWIN_USE_WDMKS_DEVICE_INFO */
@@ -901,9 +933,19 @@ error:
 
 static void GetDefaultLatencies( PaTime *defaultLowLatency, PaTime *defaultHighLatency )
 {
+/*
+NOTE: GetVersionEx() is deprecated as of Windows 8.1 and can not be used to reliably detect
+versions of Windows higher than Windows 8 (due to manifest requirements for reporting higher versions).
+Microsoft recommends switching to VerifyVersionInfo (available on Win 2k and later), however GetVersionEx
+is is faster, for now we just disable the deprecation warning.
+See: https://msdn.microsoft.com/en-us/library/windows/desktop/ms724451(v=vs.85).aspx
+See: http://www.codeproject.com/Articles/678606/Part-Overcoming-Windows-s-deprecation-of-GetVe
+*/
+#pragma warning (disable : 4996) /* use of GetVersionEx */
+
     OSVERSIONINFO osvi;
     osvi.dwOSVersionInfoSize = sizeof( osvi );
-	GetVersionEx( &osvi );
+    GetVersionEx( &osvi );
 
     /* Check for NT */
     if( (osvi.dwMajorVersion == 4) && (osvi.dwPlatformId == 2) )
@@ -920,6 +962,8 @@ static void GetDefaultLatencies( PaTime *defaultLowLatency, PaTime *defaultHighL
     }     
 
     *defaultHighLatency = *defaultLowLatency * 2;
+
+#pragma warning (default : 4996)
 }
 
 
@@ -983,11 +1027,11 @@ PaError PaWinMme_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiInd
 
     inputDeviceCount = waveInGetNumDevs();
     if( inputDeviceCount > 0 )
-    	maximumPossibleDeviceCount += inputDeviceCount + 1;	/* assume there is a WAVE_MAPPER */
+        maximumPossibleDeviceCount += inputDeviceCount + 1;	/* assume there is a WAVE_MAPPER */
 
     outputDeviceCount = waveOutGetNumDevs();
     if( outputDeviceCount > 0 )
-	    maximumPossibleDeviceCount += outputDeviceCount + 1;	/* assume there is a WAVE_MAPPER */
+        maximumPossibleDeviceCount += outputDeviceCount + 1;	/* assume there is a WAVE_MAPPER */
 
 
     if( maximumPossibleDeviceCount > 0 ){
@@ -2157,29 +2201,29 @@ static PaError ValidateWinMmeSpecificStreamInfo(
         char *throttleProcessingThreadOnOverload,
         unsigned long *deviceCount )
 {
-	if( streamInfo )
-	{
-	    if( streamInfo->size != sizeof( PaWinMmeStreamInfo )
-	            || streamInfo->version != 1 )
-	    {
-	        return paIncompatibleHostApiSpecificStreamInfo;
-	    }
+    if( streamInfo )
+    {
+        if( streamInfo->size != sizeof( PaWinMmeStreamInfo )
+                || streamInfo->version != 1 )
+        {
+            return paIncompatibleHostApiSpecificStreamInfo;
+        }
 
         *winMmeSpecificFlags = streamInfo->flags;
 
-	    if( streamInfo->flags & paWinMmeDontThrottleOverloadedProcessingThread )
-	        *throttleProcessingThreadOnOverload = 0;
+        if( streamInfo->flags & paWinMmeDontThrottleOverloadedProcessingThread )
+            *throttleProcessingThreadOnOverload = 0;
             
-	    if( streamInfo->flags & paWinMmeUseMultipleDevices )
-	    {
-	        if( streamParameters->device != paUseHostApiSpecificDeviceSpecification )
-	            return paInvalidDevice;
-	
-			*deviceCount = streamInfo->deviceCount;
-		}	
-	}
+        if( streamInfo->flags & paWinMmeUseMultipleDevices )
+        {
+            if( streamParameters->device != paUseHostApiSpecificDeviceSpecification )
+                return paInvalidDevice;
+    
+            *deviceCount = streamInfo->deviceCount;
+        }	
+    }
 
-	return paNoError;
+    return paNoError;
 }
 
 static PaError RetrieveDevicesFromStreamParameters(
@@ -2194,34 +2238,34 @@ static PaError RetrieveDevicesFromStreamParameters(
     int totalChannelCount;
     PaDeviceIndex hostApiDevice;
     
-	if( streamInfo && streamInfo->flags & paWinMmeUseMultipleDevices )
-	{
-		totalChannelCount = 0;
-	    for( i=0; i < deviceCount; ++i )
-	    {
-	        /* validate that the device number is within range */
-	        result = PaUtil_DeviceIndexToHostApiDeviceIndex( &hostApiDevice,
-	                        streamInfo->devices[i].device, hostApi );
-	        if( result != paNoError )
-	            return result;
-	        
-	        devices[i].device = hostApiDevice;
-	        devices[i].channelCount = streamInfo->devices[i].channelCount;
-	
-	        totalChannelCount += devices[i].channelCount;
-	    }
-	
-	    if( totalChannelCount != streamParameters->channelCount )
-	    {
-	        /* channelCount must match total channels specified by multiple devices */
-	        return paInvalidChannelCount; /* REVIEW use of this error code */
-	    }
-	}	
-	else
-	{		
-	    devices[0].device = streamParameters->device;
-	    devices[0].channelCount = streamParameters->channelCount;
-	}
+    if( streamInfo && streamInfo->flags & paWinMmeUseMultipleDevices )
+    {
+        totalChannelCount = 0;
+        for( i=0; i < deviceCount; ++i )
+        {
+            /* validate that the device number is within range */
+            result = PaUtil_DeviceIndexToHostApiDeviceIndex( &hostApiDevice,
+                            streamInfo->devices[i].device, hostApi );
+            if( result != paNoError )
+                return result;
+            
+            devices[i].device = hostApiDevice;
+            devices[i].channelCount = streamInfo->devices[i].channelCount;
+    
+            totalChannelCount += devices[i].channelCount;
+        }
+    
+        if( totalChannelCount != streamParameters->channelCount )
+        {
+            /* channelCount must match total channels specified by multiple devices */
+            return paInvalidChannelCount; /* REVIEW use of this error code */
+        }
+    }	
+    else
+    {		
+        devices[0].device = streamParameters->device;
+        devices[0].channelCount = streamParameters->channelCount;
+    }
 
     return result;
 }
@@ -2235,10 +2279,10 @@ static PaError ValidateInputChannelCounts(
     PaWinMmeDeviceInfo *inputDeviceInfo;
     PaError paerror;
 
-	for( i=0; i < deviceCount; ++i )
-	{
+    for( i=0; i < deviceCount; ++i )
+    {
         if( devices[i].channelCount < 1 )
-        	return paInvalidChannelCount;
+            return paInvalidChannelCount;
 
         inputDeviceInfo = 
                 (PaWinMmeDeviceInfo*)hostApi->deviceInfos[ devices[i].device ];
@@ -2246,7 +2290,7 @@ static PaError ValidateInputChannelCounts(
         paerror = IsInputChannelCountSupported( inputDeviceInfo, devices[i].channelCount );
         if( paerror != paNoError )
             return paerror;
-	}
+    }
 
     return paNoError;
 }
@@ -2260,10 +2304,10 @@ static PaError ValidateOutputChannelCounts(
     PaWinMmeDeviceInfo *outputDeviceInfo;
     PaError paerror;
 
-	for( i=0; i < deviceCount; ++i )
-	{
+    for( i=0; i < deviceCount; ++i )
+    {
         if( devices[i].channelCount < 1 )
-        	return paInvalidChannelCount;
+            return paInvalidChannelCount;
 
         outputDeviceInfo = 
                 (PaWinMmeDeviceInfo*)hostApi->deviceInfos[ devices[i].device ];
@@ -2271,7 +2315,7 @@ static PaError ValidateOutputChannelCounts(
         paerror = IsOutputChannelCountSupported( outputDeviceInfo, devices[i].channelCount );
         if( paerror != paNoError )
             return paerror;
-	}
+    }
 
     return paNoError;
 }
@@ -2320,28 +2364,28 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
     
     if( inputParameters )
     {
-		inputChannelCount = inputParameters->channelCount;
+        inputChannelCount = inputParameters->channelCount;
         inputSampleFormat = inputParameters->sampleFormat;
         suggestedInputLatency = inputParameters->suggestedLatency;
 
-      	inputDeviceCount = 1;
+        inputDeviceCount = 1;
 
-		/* validate input hostApiSpecificStreamInfo */
+        /* validate input hostApiSpecificStreamInfo */
         inputStreamInfo = (PaWinMmeStreamInfo*)inputParameters->hostApiSpecificStreamInfo;
-		result = ValidateWinMmeSpecificStreamInfo( inputParameters, inputStreamInfo,
+        result = ValidateWinMmeSpecificStreamInfo( inputParameters, inputStreamInfo,
                 &winMmeSpecificInputFlags,
-				&throttleProcessingThreadOnOverload,
-				&inputDeviceCount );
-		if( result != paNoError ) return result;
+                &throttleProcessingThreadOnOverload,
+                &inputDeviceCount );
+        if( result != paNoError ) return result;
 
-		inputDevices = (PaWinMmeDeviceAndChannelCount*)alloca( sizeof(PaWinMmeDeviceAndChannelCount) * inputDeviceCount );
+        inputDevices = (PaWinMmeDeviceAndChannelCount*)alloca( sizeof(PaWinMmeDeviceAndChannelCount) * inputDeviceCount );
         if( !inputDevices ) return paInsufficientMemory;
 
-		result = RetrieveDevicesFromStreamParameters( hostApi, inputParameters, inputStreamInfo, inputDevices, inputDeviceCount );
-		if( result != paNoError ) return result;
+        result = RetrieveDevicesFromStreamParameters( hostApi, inputParameters, inputStreamInfo, inputDevices, inputDeviceCount );
+        if( result != paNoError ) return result;
 
-		result = ValidateInputChannelCounts( hostApi, inputDevices, inputDeviceCount );
-		if( result != paNoError ) return result;
+        result = ValidateInputChannelCounts( hostApi, inputDevices, inputDeviceCount );
+        if( result != paNoError ) return result;
 
         hostInputSampleFormat =
             PaUtil_SelectClosestAvailableFormat( paInt16 /* native formats */, inputSampleFormat );
@@ -2357,7 +2401,7 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
             else
                 inputChannelMask = PaWin_DefaultChannelMask( inputDevices[0].channelCount );
         }
-	}
+    }
     else
     {
         inputChannelCount = 0;
@@ -2376,22 +2420,22 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
 
         outputDeviceCount = 1;
 
-		/* validate output hostApiSpecificStreamInfo */
+        /* validate output hostApiSpecificStreamInfo */
         outputStreamInfo = (PaWinMmeStreamInfo*)outputParameters->hostApiSpecificStreamInfo;
-		result = ValidateWinMmeSpecificStreamInfo( outputParameters, outputStreamInfo,
+        result = ValidateWinMmeSpecificStreamInfo( outputParameters, outputStreamInfo,
                 &winMmeSpecificOutputFlags,
-				&throttleProcessingThreadOnOverload,
-				&outputDeviceCount );
-		if( result != paNoError ) return result;
+                &throttleProcessingThreadOnOverload,
+                &outputDeviceCount );
+        if( result != paNoError ) return result;
 
-		outputDevices = (PaWinMmeDeviceAndChannelCount*)alloca( sizeof(PaWinMmeDeviceAndChannelCount) * outputDeviceCount );
+        outputDevices = (PaWinMmeDeviceAndChannelCount*)alloca( sizeof(PaWinMmeDeviceAndChannelCount) * outputDeviceCount );
         if( !outputDevices ) return paInsufficientMemory;
 
-		result = RetrieveDevicesFromStreamParameters( hostApi, outputParameters, outputStreamInfo, outputDevices, outputDeviceCount );
-		if( result != paNoError ) return result;
+        result = RetrieveDevicesFromStreamParameters( hostApi, outputParameters, outputStreamInfo, outputDevices, outputDeviceCount );
+        if( result != paNoError ) return result;
 
-		result = ValidateOutputChannelCounts( hostApi, outputDevices, outputDeviceCount );
-		if( result != paNoError ) return result;
+        result = ValidateOutputChannelCounts( hostApi, outputDevices, outputDeviceCount );
+        if( result != paNoError ) return result;
 
         hostOutputSampleFormat =
             PaUtil_SelectClosestAvailableFormat( paInt16 /* native formats */, outputSampleFormat );
@@ -3219,9 +3263,9 @@ static PaError StartStream( PaStream *s )
     MMRESULT mmresult;
     unsigned int i, j;
     int callbackResult;
-	unsigned int channel;
- 	unsigned long framesProcessed;
-	PaStreamCallbackTimeInfo timeInfo = {0,0,0}; /** @todo implement this for stream priming */
+    unsigned int channel;
+    unsigned long framesProcessed;
+    PaStreamCallbackTimeInfo timeInfo = {0,0,0}; /** @todo implement this for stream priming */
     
     PaUtil_ResetBufferProcessor( &stream->bufferProcessor );
     
diff --git a/src/os/unix/pa_unix_hostapis.c b/src/os/unix/pa_unix_hostapis.c
index 4399b87..a9b4a05 100644
--- a/src/os/unix/pa_unix_hostapis.c
+++ b/src/os/unix/pa_unix_hostapis.c
@@ -1,5 +1,5 @@
 /*
- * $Id: pa_unix_hostapis.c 1740 2011-08-25 07:17:48Z philburk $
+ * $Id$
  * Portable Audio I/O Library UNIX initialization table
  *
  * Based on the Open Source API proposed by Ross Bencina
diff --git a/src/os/unix/pa_unix_util.c b/src/os/unix/pa_unix_util.c
index 18f806c..17664ea 100644
--- a/src/os/unix/pa_unix_util.c
+++ b/src/os/unix/pa_unix_util.c
@@ -1,5 +1,5 @@
 /*
- * $Id: pa_unix_util.c 1510 2010-06-10 08:05:29Z dmitrykos $
+ * $Id$
  * Portable Audio I/O Library
  * UNIX platform-specific support functions
  *
diff --git a/src/os/unix/pa_unix_util.h b/src/os/unix/pa_unix_util.h
index e900f87..d73c99c 100644
--- a/src/os/unix/pa_unix_util.h
+++ b/src/os/unix/pa_unix_util.h
@@ -1,5 +1,5 @@
 /*
- * $Id: pa_unix_util.h 1241 2007-07-23 20:08:31Z aknudsen $
+ * $Id$
  * Portable Audio I/O Library
  * UNIX platform-specific support functions
  *
diff --git a/src/os/win/pa_win_coinitialize.c b/src/os/win/pa_win_coinitialize.c
index e15b145..c4c6dde 100644
--- a/src/os/win/pa_win_coinitialize.c
+++ b/src/os/win/pa_win_coinitialize.c
@@ -1,144 +1,148 @@
-/*
- * Microsoft COM initialization routines
- * Copyright (c) 1999-2011 Ross Bencina, Dmitry Kostjuchenko
- *
- * Based on the Open Source API proposed by Ross Bencina
- * 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.
- */
-
-/** @file
- @ingroup win_src
-
- @brief Microsoft COM initialization routines.
-*/
-
-#include <windows.h>
-#include <objbase.h>
-
-#include "portaudio.h"
-#include "pa_util.h"
-#include "pa_debugprint.h"
-
-#include "pa_win_coinitialize.h"
-
-
-#if (defined(WIN32) && (defined(_MSC_VER) && (_MSC_VER >= 1200))) && !defined(_WIN32_WCE) /* MSC version 6 and above */
-#pragma comment( lib, "ole32.lib" )
-#endif
-
-
-/* use some special bit patterns here to try to guard against uninitialized memory errors */
-#define PAWINUTIL_COM_INITIALIZED       (0xb38f)
-#define PAWINUTIL_COM_NOT_INITIALIZED   (0xf1cd)
-
-
-PaError PaWinUtil_CoInitialize( PaHostApiTypeId hostApiType, PaWinUtilComInitializationResult *comInitializationResult )
-{
-    HRESULT hr;
-
-    comInitializationResult->state = PAWINUTIL_COM_NOT_INITIALIZED;
-
-    /*
-        If COM is already initialized CoInitialize will either return
-        FALSE, or RPC_E_CHANGED_MODE if it was initialised in a different
-        threading mode. In either case we shouldn't consider it an error
-        but we need to be careful to not call CoUninitialize() if 
-        RPC_E_CHANGED_MODE was returned.
-    */
-
-    hr = CoInitialize(0); /* use legacy-safe equivalent to CoInitializeEx(NULL, COINIT_APARTMENTTHREADED) */
-    if( FAILED(hr) && hr != RPC_E_CHANGED_MODE )
-    {
-        PA_DEBUG(("CoInitialize(0) failed. hr=%d\n", hr));
-
-        if( hr == E_OUTOFMEMORY )
-            return paInsufficientMemory;
-
-        {
-            char *lpMsgBuf;
-            FormatMessage(
-                FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
-                NULL,
-                hr,
-                MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
-                (LPTSTR) &lpMsgBuf,
-                0,
-                NULL
-            );
-            PaUtil_SetLastHostErrorInfo( hostApiType, hr, lpMsgBuf );
-            LocalFree( lpMsgBuf );
-        }
-
-        return paUnanticipatedHostError;
-    }
-
-    if( hr != RPC_E_CHANGED_MODE )
-    {
-        comInitializationResult->state = PAWINUTIL_COM_INITIALIZED;
-
-        /*
-            Memorize calling thread id and report warning on Uninitialize if 
-            calling thread is different as CoInitialize must match CoUninitialize 
-            in the same thread.
-        */
-        comInitializationResult->initializingThreadId = GetCurrentThreadId();
-    }
-
-    return paNoError;
-}
-
-
-void PaWinUtil_CoUninitialize( PaHostApiTypeId hostApiType, PaWinUtilComInitializationResult *comInitializationResult )
-{
-    if( comInitializationResult->state != PAWINUTIL_COM_NOT_INITIALIZED
-            && comInitializationResult->state != PAWINUTIL_COM_INITIALIZED ){
-    
-        PA_DEBUG(("ERROR: PaWinUtil_CoUninitialize called without calling PaWinUtil_CoInitialize\n"));
-    }
-
-    if( comInitializationResult->state == PAWINUTIL_COM_INITIALIZED )
-    {
-        DWORD currentThreadId = GetCurrentThreadId();
-		if( comInitializationResult->initializingThreadId != currentThreadId )
-		{
-			PA_DEBUG(("ERROR: failed PaWinUtil_CoUninitialize calling thread[%d] does not match initializing thread[%d]\n",
-				currentThreadId, comInitializationResult->initializingThreadId));
-		}
-		else
-		{
-			CoUninitialize();
-
-            comInitializationResult->state = PAWINUTIL_COM_NOT_INITIALIZED;
-		}
-    }
+/*
+ * Microsoft COM initialization routines
+ * Copyright (c) 1999-2011 Ross Bencina, Dmitry Kostjuchenko
+ *
+ * Based on the Open Source API proposed by Ross Bencina
+ * 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.
+ */
+
+/** @file
+ @ingroup win_src
+
+ @brief Microsoft COM initialization routines.
+*/
+
+#include <windows.h>
+#include <objbase.h>
+
+#include "portaudio.h"
+#include "pa_util.h"
+#include "pa_debugprint.h"
+
+#include "pa_win_coinitialize.h"
+
+
+#if (defined(WIN32) && (defined(_MSC_VER) && (_MSC_VER >= 1200))) && !defined(_WIN32_WCE) && !(defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP)) /* MSC version 6 and above */
+#pragma comment( lib, "ole32.lib" )
+#endif
+
+
+/* use some special bit patterns here to try to guard against uninitialized memory errors */
+#define PAWINUTIL_COM_INITIALIZED       (0xb38f)
+#define PAWINUTIL_COM_NOT_INITIALIZED   (0xf1cd)
+
+
+PaError PaWinUtil_CoInitialize( PaHostApiTypeId hostApiType, PaWinUtilComInitializationResult *comInitializationResult )
+{
+    HRESULT hr;
+
+    comInitializationResult->state = PAWINUTIL_COM_NOT_INITIALIZED;
+
+    /*
+        If COM is already initialized CoInitialize will either return
+        FALSE, or RPC_E_CHANGED_MODE if it was initialised in a different
+        threading mode. In either case we shouldn't consider it an error
+        but we need to be careful to not call CoUninitialize() if 
+        RPC_E_CHANGED_MODE was returned.
+    */
+
+#if !defined(WINAPI_FAMILY) || (WINAPI_FAMILY != WINAPI_FAMILY_APP)
+    hr = CoInitialize(0); /* use legacy-safe equivalent to CoInitializeEx(NULL, COINIT_APARTMENTTHREADED) */
+#else
+	hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
+#endif
+    if( FAILED(hr) && hr != RPC_E_CHANGED_MODE )
+    {
+        PA_DEBUG(("CoInitialize(0) failed. hr=%d\n", hr));
+
+        if( hr == E_OUTOFMEMORY )
+            return paInsufficientMemory;
+
+        {
+            char *lpMsgBuf;
+            FormatMessage(
+                FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
+                NULL,
+                hr,
+                MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+                (LPTSTR) &lpMsgBuf,
+                0,
+                NULL
+            );
+            PaUtil_SetLastHostErrorInfo( hostApiType, hr, lpMsgBuf );
+            LocalFree( lpMsgBuf );
+        }
+
+        return paUnanticipatedHostError;
+    }
+
+    if( hr != RPC_E_CHANGED_MODE )
+    {
+        comInitializationResult->state = PAWINUTIL_COM_INITIALIZED;
+
+        /*
+            Memorize calling thread id and report warning on Uninitialize if 
+            calling thread is different as CoInitialize must match CoUninitialize 
+            in the same thread.
+        */
+        comInitializationResult->initializingThreadId = GetCurrentThreadId();
+    }
+
+    return paNoError;
+}
+
+
+void PaWinUtil_CoUninitialize( PaHostApiTypeId hostApiType, PaWinUtilComInitializationResult *comInitializationResult )
+{
+    if( comInitializationResult->state != PAWINUTIL_COM_NOT_INITIALIZED
+            && comInitializationResult->state != PAWINUTIL_COM_INITIALIZED ){
+    
+        PA_DEBUG(("ERROR: PaWinUtil_CoUninitialize called without calling PaWinUtil_CoInitialize\n"));
+    }
+
+    if( comInitializationResult->state == PAWINUTIL_COM_INITIALIZED )
+    {
+        DWORD currentThreadId = GetCurrentThreadId();
+		if( comInitializationResult->initializingThreadId != currentThreadId )
+		{
+			PA_DEBUG(("ERROR: failed PaWinUtil_CoUninitialize calling thread[%d] does not match initializing thread[%d]\n",
+				currentThreadId, comInitializationResult->initializingThreadId));
+		}
+		else
+		{
+			CoUninitialize();
+
+            comInitializationResult->state = PAWINUTIL_COM_NOT_INITIALIZED;
+		}
+    }
 }
\ No newline at end of file
diff --git a/src/os/win/pa_win_coinitialize.h b/src/os/win/pa_win_coinitialize.h
index a76337c..687ab83 100644
--- a/src/os/win/pa_win_coinitialize.h
+++ b/src/os/win/pa_win_coinitialize.h
@@ -1,94 +1,94 @@
-/*
- * Microsoft COM initialization routines
- * 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.
- */
-
-/** @file
- @ingroup win_src
-
- @brief Microsoft COM initialization routines.
-*/
-
-#ifndef PA_WIN_COINITIALIZE_H
-#define PA_WIN_COINITIALIZE_H
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif /* __cplusplus */
-
-
-/**
- @brief Data type used to hold the result of an attempt to initialize COM
-    using PaWinUtil_CoInitialize. Must be retained between a call to 
-    PaWinUtil_CoInitialize and a matching call to PaWinUtil_CoUninitialize.
-*/
-typedef struct PaWinUtilComInitializationResult{
-    int state;
-    int initializingThreadId;
-} PaWinUtilComInitializationResult;
-
-
-/**
- @brief Initialize Microsoft COM subsystem on the current thread.
-
- @param hostApiType the host API type id of the caller. Used for error reporting.
-
- @param comInitializationResult An output parameter. The value pointed to by 
-        this parameter stores information required by PaWinUtil_CoUninitialize 
-        to correctly uninitialize COM. The value should be retained and later 
-        passed to PaWinUtil_CoUninitialize.
-
- If PaWinUtil_CoInitialize returns paNoError, the caller must later call
- PaWinUtil_CoUninitialize once.
-*/
-PaError PaWinUtil_CoInitialize( PaHostApiTypeId hostApiType, PaWinUtilComInitializationResult *comInitializationResult );
-
-
-/**
- @brief Uninitialize the Microsoft COM subsystem on the current thread using 
- the result of a previous call to PaWinUtil_CoInitialize. Must be called on the same
- thread as PaWinUtil_CoInitialize.
-
- @param hostApiType the host API type id of the caller. Used for error reporting.
-
- @param comInitializationResult An input parameter. A pointer to a value previously
- initialized by a call to PaWinUtil_CoInitialize.
-*/
-void PaWinUtil_CoUninitialize( PaHostApiTypeId hostApiType, PaWinUtilComInitializationResult *comInitializationResult );
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-#endif /* PA_WIN_COINITIALIZE_H */
+/*
+ * Microsoft COM initialization routines
+ * 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.
+ */
+
+/** @file
+ @ingroup win_src
+
+ @brief Microsoft COM initialization routines.
+*/
+
+#ifndef PA_WIN_COINITIALIZE_H
+#define PA_WIN_COINITIALIZE_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+
+/**
+ @brief Data type used to hold the result of an attempt to initialize COM
+    using PaWinUtil_CoInitialize. Must be retained between a call to 
+    PaWinUtil_CoInitialize and a matching call to PaWinUtil_CoUninitialize.
+*/
+typedef struct PaWinUtilComInitializationResult{
+    int state;
+    int initializingThreadId;
+} PaWinUtilComInitializationResult;
+
+
+/**
+ @brief Initialize Microsoft COM subsystem on the current thread.
+
+ @param hostApiType the host API type id of the caller. Used for error reporting.
+
+ @param comInitializationResult An output parameter. The value pointed to by 
+        this parameter stores information required by PaWinUtil_CoUninitialize 
+        to correctly uninitialize COM. The value should be retained and later 
+        passed to PaWinUtil_CoUninitialize.
+
+ If PaWinUtil_CoInitialize returns paNoError, the caller must later call
+ PaWinUtil_CoUninitialize once.
+*/
+PaError PaWinUtil_CoInitialize( PaHostApiTypeId hostApiType, PaWinUtilComInitializationResult *comInitializationResult );
+
+
+/**
+ @brief Uninitialize the Microsoft COM subsystem on the current thread using 
+ the result of a previous call to PaWinUtil_CoInitialize. Must be called on the same
+ thread as PaWinUtil_CoInitialize.
+
+ @param hostApiType the host API type id of the caller. Used for error reporting.
+
+ @param comInitializationResult An input parameter. A pointer to a value previously
+ initialized by a call to PaWinUtil_CoInitialize.
+*/
+void PaWinUtil_CoUninitialize( PaHostApiTypeId hostApiType, PaWinUtilComInitializationResult *comInitializationResult );
+
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+#endif /* PA_WIN_COINITIALIZE_H */
diff --git a/src/os/win/pa_win_hostapis.c b/src/os/win/pa_win_hostapis.c
index 5d22438..9c9927a 100644
--- a/src/os/win/pa_win_hostapis.c
+++ b/src/os/win/pa_win_hostapis.c
@@ -1,5 +1,5 @@
 /*
- * $Id: pa_win_hostapis.c 1728 2011-08-18 03:31:51Z rossb $
+ * $Id$
  * Portable Audio I/O Library Windows initialization table
  *
  * Based on the Open Source API proposed by Ross Bencina
diff --git a/src/os/win/pa_win_util.c b/src/os/win/pa_win_util.c
index a9c55d0..1cd3525 100644
--- a/src/os/win/pa_win_util.c
+++ b/src/os/win/pa_win_util.c
@@ -1,5 +1,5 @@
 /*
- * $Id: pa_win_util.c 1584 2011-02-02 18:58:17Z rossb $
+ * $Id$
  * Portable Audio I/O Library
  * Win32 platform-specific support functions
  *
@@ -44,14 +44,17 @@
 */
  
 #include <windows.h>
-#include <mmsystem.h> /* for timeGetTime() */
 
-#include "pa_util.h"
-
-#if (defined(WIN32) && (defined(_MSC_VER) && (_MSC_VER >= 1200))) && !defined(_WIN32_WCE) /* MSC version 6 and above */
-#pragma comment( lib, "winmm.lib" )
+#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP)
+	#include <sys/timeb.h> /* for _ftime_s() */
+#else
+	#include <mmsystem.h> /* for timeGetTime() */
+	#if (defined(WIN32) && (defined(_MSC_VER) && (_MSC_VER >= 1200))) && !defined(_WIN32_WCE) /* MSC version 6 and above */
+	#pragma comment( lib, "winmm.lib" )
+	#endif
 #endif
 
+#include "pa_util.h"
 
 /*
    Track memory allocations to avoid leaks.
@@ -144,8 +147,12 @@ double PaUtil_GetTime( void )
     }
     else
     {
-#ifndef UNDER_CE    	
+#ifndef UNDER_CE
+	#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP)
+        return GetTickCount64() * .001;
+	#else
         return timeGetTime() * .001;
+	#endif
 #else
         return GetTickCount() * .001;
 #endif                
diff --git a/src/os/win/pa_win_waveformat.c b/src/os/win/pa_win_waveformat.c
index 2eb2334..bd5addd 100644
--- a/src/os/win/pa_win_waveformat.c
+++ b/src/os/win/pa_win_waveformat.c
@@ -1,158 +1,162 @@
-/*
- * 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.
- */
-
-#include <windows.h>
-#include <mmsystem.h>
-
-#include "portaudio.h"
-#include "pa_win_waveformat.h"
-
-
-#if !defined(WAVE_FORMAT_EXTENSIBLE)
-#define  WAVE_FORMAT_EXTENSIBLE         0xFFFE
-#endif
-
-static GUID pawin_ksDataFormatSubtypeGuidBase = 
-	{ (USHORT)(WAVE_FORMAT_PCM), 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 };
-
-
-int PaWin_SampleFormatToLinearWaveFormatTag( PaSampleFormat sampleFormat )
-{
-    if( sampleFormat == paFloat32 )
-        return PAWIN_WAVE_FORMAT_IEEE_FLOAT;
-    
-    return PAWIN_WAVE_FORMAT_PCM;
-}
-
-
-void PaWin_InitializeWaveFormatEx( PaWinWaveFormat *waveFormat, 
-		int numChannels, PaSampleFormat sampleFormat, int waveFormatTag, double sampleRate )
-{
-	WAVEFORMATEX *waveFormatEx = (WAVEFORMATEX*)waveFormat;
-    int bytesPerSample = Pa_GetSampleSize(sampleFormat);
-	unsigned long bytesPerFrame = numChannels * bytesPerSample;
-	
-    waveFormatEx->wFormatTag = waveFormatTag;
-	waveFormatEx->nChannels = (WORD)numChannels;
-	waveFormatEx->nSamplesPerSec = (DWORD)sampleRate;
-	waveFormatEx->nAvgBytesPerSec = waveFormatEx->nSamplesPerSec * bytesPerFrame;
-	waveFormatEx->nBlockAlign = (WORD)bytesPerFrame;
-	waveFormatEx->wBitsPerSample = bytesPerSample * 8;
-	waveFormatEx->cbSize = 0;
-}
-
-
-void PaWin_InitializeWaveFormatExtensible( PaWinWaveFormat *waveFormat, 
-		int numChannels, PaSampleFormat sampleFormat, int waveFormatTag, double sampleRate,
-		PaWinWaveFormatChannelMask channelMask )
-{
-	WAVEFORMATEX *waveFormatEx = (WAVEFORMATEX*)waveFormat;
-    int bytesPerSample = Pa_GetSampleSize(sampleFormat);
-	unsigned long bytesPerFrame = numChannels * bytesPerSample;
-    GUID guid;
-
-	waveFormatEx->wFormatTag = WAVE_FORMAT_EXTENSIBLE;
-	waveFormatEx->nChannels = (WORD)numChannels;
-	waveFormatEx->nSamplesPerSec = (DWORD)sampleRate;
-	waveFormatEx->nAvgBytesPerSec = waveFormatEx->nSamplesPerSec * bytesPerFrame;
-	waveFormatEx->nBlockAlign = (WORD)bytesPerFrame;
-	waveFormatEx->wBitsPerSample = bytesPerSample * 8;
-	waveFormatEx->cbSize = 22;
-
-	*((WORD*)&waveFormat->fields[PAWIN_INDEXOF_WVALIDBITSPERSAMPLE]) =
-			waveFormatEx->wBitsPerSample;
-
-	*((DWORD*)&waveFormat->fields[PAWIN_INDEXOF_DWCHANNELMASK]) = channelMask;
-		
-    guid = pawin_ksDataFormatSubtypeGuidBase;
-    guid.Data1 = (USHORT)waveFormatTag;
-    *((GUID*)&waveFormat->fields[PAWIN_INDEXOF_SUBFORMAT]) = guid;
-}
-
-PaWinWaveFormatChannelMask PaWin_DefaultChannelMask( int numChannels )
-{
-	switch( numChannels ){
-		case 1:
-			return PAWIN_SPEAKER_MONO;
-		case 2:
-			return PAWIN_SPEAKER_STEREO; 
-		case 3:
-            return PAWIN_SPEAKER_FRONT_LEFT | PAWIN_SPEAKER_FRONT_CENTER | PAWIN_SPEAKER_FRONT_RIGHT;
-		case 4:
-			return PAWIN_SPEAKER_QUAD;
-		case 5:
-            return PAWIN_SPEAKER_QUAD | PAWIN_SPEAKER_FRONT_CENTER;
-		case 6:
-            /* The meaning of the PAWIN_SPEAKER_5POINT1 flag has changed over time:
-                http://msdn2.microsoft.com/en-us/library/aa474707.aspx
-               We use PAWIN_SPEAKER_5POINT1 (not PAWIN_SPEAKER_5POINT1_SURROUND)
-               because on some cards (eg Audigy) PAWIN_SPEAKER_5POINT1_SURROUND 
-               results in a virtual mixdown placing the rear output in the 
-               front _and_ rear speakers.
-            */
-			return PAWIN_SPEAKER_5POINT1; 
-        /* case 7: */
-		case 8:
-            /* RoBi: PAWIN_SPEAKER_7POINT1_SURROUND fits normal surround sound setups better than PAWIN_SPEAKER_7POINT1, f.i. NVidia HDMI Audio
-               output is silent on channels 5&6 with NVidia drivers, and channel 7&8 with Micrsoft HD Audio driver using PAWIN_SPEAKER_7POINT1. 
-               With PAWIN_SPEAKER_7POINT1_SURROUND both setups work OK. */
-			return PAWIN_SPEAKER_7POINT1_SURROUND;
-	}
-
-    /* Apparently some Audigy drivers will output silence 
-       if the direct-out constant (0) is used. So this is not ideal.    
-
-       RoBi 2012-12-19: Also, NVidia driver seem to output garbage instead. Again not very ideal.
-    */
-	return  PAWIN_SPEAKER_DIRECTOUT;
-
-    /* Note that Alec Rogers proposed the following as an alternate method to 
-        generate the default channel mask, however it doesn't seem to be an improvement
-        over the above, since some drivers will matrix outputs mapping to non-present
-        speakers accross multiple physical speakers.
-
-        if(nChannels==1) {
-            pwfFormat->dwChannelMask = SPEAKER_FRONT_CENTER;
-        }
-        else {
-            pwfFormat->dwChannelMask = 0;
-            for(i=0; i<nChannels; i++)
-                pwfFormat->dwChannelMask = (pwfFormat->dwChannelMask << 1) | 0x1;
-        }
-    */
-}
+/*
+ * 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.
+ */
+
+#include <windows.h>
+#include <mmsystem.h>
+#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP)
+    #include <mmreg.h> /* for WAVEFORMATEX */
+#endif
+
+#include "portaudio.h"
+#include "pa_win_waveformat.h"
+
+
+#if !defined(WAVE_FORMAT_EXTENSIBLE)
+#define  WAVE_FORMAT_EXTENSIBLE         0xFFFE
+#endif
+
+
+static GUID pawin_ksDataFormatSubtypeGuidBase = 
+	{ (USHORT)(WAVE_FORMAT_PCM), 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 };
+
+
+int PaWin_SampleFormatToLinearWaveFormatTag( PaSampleFormat sampleFormat )
+{
+    if( sampleFormat == paFloat32 )
+        return PAWIN_WAVE_FORMAT_IEEE_FLOAT;
+    
+    return PAWIN_WAVE_FORMAT_PCM;
+}
+
+
+void PaWin_InitializeWaveFormatEx( PaWinWaveFormat *waveFormat, 
+		int numChannels, PaSampleFormat sampleFormat, int waveFormatTag, double sampleRate )
+{
+	WAVEFORMATEX *waveFormatEx = (WAVEFORMATEX*)waveFormat;
+    int bytesPerSample = Pa_GetSampleSize(sampleFormat);
+	unsigned long bytesPerFrame = numChannels * bytesPerSample;
+	
+    waveFormatEx->wFormatTag = waveFormatTag;
+	waveFormatEx->nChannels = (WORD)numChannels;
+	waveFormatEx->nSamplesPerSec = (DWORD)sampleRate;
+	waveFormatEx->nAvgBytesPerSec = waveFormatEx->nSamplesPerSec * bytesPerFrame;
+	waveFormatEx->nBlockAlign = (WORD)bytesPerFrame;
+	waveFormatEx->wBitsPerSample = bytesPerSample * 8;
+	waveFormatEx->cbSize = 0;
+}
+
+
+void PaWin_InitializeWaveFormatExtensible( PaWinWaveFormat *waveFormat, 
+		int numChannels, PaSampleFormat sampleFormat, int waveFormatTag, double sampleRate,
+		PaWinWaveFormatChannelMask channelMask )
+{
+	WAVEFORMATEX *waveFormatEx = (WAVEFORMATEX*)waveFormat;
+    int bytesPerSample = Pa_GetSampleSize(sampleFormat);
+	unsigned long bytesPerFrame = numChannels * bytesPerSample;
+    GUID guid;
+
+	waveFormatEx->wFormatTag = WAVE_FORMAT_EXTENSIBLE;
+	waveFormatEx->nChannels = (WORD)numChannels;
+	waveFormatEx->nSamplesPerSec = (DWORD)sampleRate;
+	waveFormatEx->nAvgBytesPerSec = waveFormatEx->nSamplesPerSec * bytesPerFrame;
+	waveFormatEx->nBlockAlign = (WORD)bytesPerFrame;
+	waveFormatEx->wBitsPerSample = bytesPerSample * 8;
+	waveFormatEx->cbSize = 22;
+
+	*((WORD*)&waveFormat->fields[PAWIN_INDEXOF_WVALIDBITSPERSAMPLE]) =
+			waveFormatEx->wBitsPerSample;
+
+	*((DWORD*)&waveFormat->fields[PAWIN_INDEXOF_DWCHANNELMASK]) = channelMask;
+		
+    guid = pawin_ksDataFormatSubtypeGuidBase;
+    guid.Data1 = (USHORT)waveFormatTag;
+    *((GUID*)&waveFormat->fields[PAWIN_INDEXOF_SUBFORMAT]) = guid;
+}
+
+PaWinWaveFormatChannelMask PaWin_DefaultChannelMask( int numChannels )
+{
+	switch( numChannels ){
+		case 1:
+			return PAWIN_SPEAKER_MONO;
+		case 2:
+			return PAWIN_SPEAKER_STEREO; 
+		case 3:
+            return PAWIN_SPEAKER_FRONT_LEFT | PAWIN_SPEAKER_FRONT_CENTER | PAWIN_SPEAKER_FRONT_RIGHT;
+		case 4:
+			return PAWIN_SPEAKER_QUAD;
+		case 5:
+            return PAWIN_SPEAKER_QUAD | PAWIN_SPEAKER_FRONT_CENTER;
+		case 6:
+            /* The meaning of the PAWIN_SPEAKER_5POINT1 flag has changed over time:
+                http://msdn2.microsoft.com/en-us/library/aa474707.aspx
+               We use PAWIN_SPEAKER_5POINT1 (not PAWIN_SPEAKER_5POINT1_SURROUND)
+               because on some cards (eg Audigy) PAWIN_SPEAKER_5POINT1_SURROUND 
+               results in a virtual mixdown placing the rear output in the 
+               front _and_ rear speakers.
+            */
+			return PAWIN_SPEAKER_5POINT1; 
+        /* case 7: */
+		case 8:
+            /* RoBi: PAWIN_SPEAKER_7POINT1_SURROUND fits normal surround sound setups better than PAWIN_SPEAKER_7POINT1, f.i. NVidia HDMI Audio
+               output is silent on channels 5&6 with NVidia drivers, and channel 7&8 with Micrsoft HD Audio driver using PAWIN_SPEAKER_7POINT1. 
+               With PAWIN_SPEAKER_7POINT1_SURROUND both setups work OK. */
+			return PAWIN_SPEAKER_7POINT1_SURROUND;
+	}
+
+    /* Apparently some Audigy drivers will output silence 
+       if the direct-out constant (0) is used. So this is not ideal.    
+
+       RoBi 2012-12-19: Also, NVidia driver seem to output garbage instead. Again not very ideal.
+    */
+	return  PAWIN_SPEAKER_DIRECTOUT;
+
+    /* Note that Alec Rogers proposed the following as an alternate method to 
+        generate the default channel mask, however it doesn't seem to be an improvement
+        over the above, since some drivers will matrix outputs mapping to non-present
+        speakers accross multiple physical speakers.
+
+        if(nChannels==1) {
+            pwfFormat->dwChannelMask = SPEAKER_FRONT_CENTER;
+        }
+        else {
+            pwfFormat->dwChannelMask = 0;
+            for(i=0; i<nChannels; i++)
+                pwfFormat->dwChannelMask = (pwfFormat->dwChannelMask << 1) | 0x1;
+        }
+    */
+}
diff --git a/src/os/win/pa_win_wdmks_utils.c b/src/os/win/pa_win_wdmks_utils.c
index 47e4f10..4bd067a 100644
--- a/src/os/win/pa_win_wdmks_utils.c
+++ b/src/os/win/pa_win_wdmks_utils.c
@@ -1,308 +1,309 @@
-/*
- * PortAudio Portable Real-Time Audio Library
- * Windows WDM KS utilities
- *
- * Copyright (c) 1999 - 2007 Andrew Baldwin, 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 <windows.h>
-#include <mmreg.h>
-#ifndef WAVE_FORMAT_IEEE_FLOAT
-    #define WAVE_FORMAT_IEEE_FLOAT 0x0003   // MinGW32 does not define this
-#endif    
-#ifndef _WAVEFORMATEXTENSIBLE_
-    #define _WAVEFORMATEXTENSIBLE_          // MinGW32 does not define this
-#endif
-#ifndef _INC_MMREG
-    #define _INC_MMREG                      // for STATIC_KSDATAFORMAT_SUBTYPE_IEEE_FLOAT
-#endif
-#include <winioctl.h>						// MinGW32 does not define this automatically
-
-#if defined(__GNUC__)
-
-#include "../../hostapi/wasapi/mingw-include/ks.h"
-#include "../../hostapi/wasapi/mingw-include/ksmedia.h"
-
-#else
-
-#include <ks.h>
-#include <ksmedia.h>
-
-#endif
-
-#include <stdio.h>                          // just for some development printfs
-
-#include "portaudio.h"
-#include "pa_util.h"
-#include "pa_win_wdmks_utils.h"
-
-#if !defined(PA_WDMKS_NO_KSGUID_LIB) && !defined(PAWIN_WDMKS_NO_KSGUID_LIB) && !defined(__GNUC__)
-    #if (defined(WIN32) && (defined(_MSC_VER) && (_MSC_VER >= 1200))) /* MSC version 6 and above */
-        #pragma comment( lib, "ksguid.lib" )
-    #endif
-    #define pa_KSDATAFORMAT_TYPE_AUDIO            KSDATAFORMAT_TYPE_AUDIO
-    #define pa_KSDATAFORMAT_SUBTYPE_IEEE_FLOAT    KSDATAFORMAT_SUBTYPE_IEEE_FLOAT
-    #define pa_KSDATAFORMAT_SUBTYPE_PCM           KSDATAFORMAT_SUBTYPE_PCM
-    #define pa_KSDATAFORMAT_SUBTYPE_WAVEFORMATEX  KSDATAFORMAT_SUBTYPE_WAVEFORMATEX
-    #define pa_KSMEDIUMSETID_Standard             KSMEDIUMSETID_Standard
-    #define pa_KSINTERFACESETID_Standard          KSINTERFACESETID_Standard
-    #define pa_KSPROPSETID_Pin                    KSPROPSETID_Pin
-#else
-    static const GUID pa_KSDATAFORMAT_TYPE_AUDIO            = { STATIC_KSDATAFORMAT_TYPE_AUDIO };
-    static const GUID pa_KSDATAFORMAT_SUBTYPE_IEEE_FLOAT    = { STATIC_KSDATAFORMAT_SUBTYPE_IEEE_FLOAT };
-    static const GUID pa_KSDATAFORMAT_SUBTYPE_PCM           = { STATIC_KSDATAFORMAT_SUBTYPE_PCM };
-    static const GUID pa_KSDATAFORMAT_SUBTYPE_WAVEFORMATEX  = { STATIC_KSDATAFORMAT_SUBTYPE_WAVEFORMATEX };
-    static const GUID pa_KSMEDIUMSETID_Standard             = { STATIC_KSMEDIUMSETID_Standard };
-    static const GUID pa_KSINTERFACESETID_Standard          = { STATIC_KSINTERFACESETID_Standard };
-    static const GUID pa_KSPROPSETID_Pin                    = { STATIC_KSPROPSETID_Pin };
-#endif
-
-
-#define pa_IS_VALID_WAVEFORMATEX_GUID(Guid)\
-    (!memcmp(((PUSHORT)&pa_KSDATAFORMAT_SUBTYPE_WAVEFORMATEX) + 1, ((PUSHORT)(Guid)) + 1, sizeof(GUID) - sizeof(USHORT)))
-
-
-
-static PaError WdmGetPinPropertySimple(
-    HANDLE  handle,
-    unsigned long pinId,
-    unsigned long property,
-    void* value,
-    unsigned long valueSize )
-{
-    DWORD bytesReturned;
-    KSP_PIN ksPProp;
-    ksPProp.Property.Set = pa_KSPROPSETID_Pin;
-    ksPProp.Property.Id = property;
-    ksPProp.Property.Flags = KSPROPERTY_TYPE_GET;
-    ksPProp.PinId = pinId;
-    ksPProp.Reserved = 0;
-
-    if( DeviceIoControl( handle, IOCTL_KS_PROPERTY, &ksPProp, sizeof(KSP_PIN),
-            value, valueSize, &bytesReturned, NULL ) == 0 || bytesReturned != valueSize )
-    {
-        return paUnanticipatedHostError;
-    }
-    else
-    {
-        return paNoError;
-    }
-}
-
-
-static PaError WdmGetPinPropertyMulti(
-    HANDLE handle,
-    unsigned long pinId,
-    unsigned long property,
-    KSMULTIPLE_ITEM** ksMultipleItem)
-{
-    unsigned long multipleItemSize = 0;
-    KSP_PIN ksPProp;
-    DWORD bytesReturned;
-
-    *ksMultipleItem = 0;
-
-    ksPProp.Property.Set = pa_KSPROPSETID_Pin;
-    ksPProp.Property.Id = property;
-    ksPProp.Property.Flags = KSPROPERTY_TYPE_GET;
-    ksPProp.PinId = pinId;
-    ksPProp.Reserved = 0;
-
-    if( DeviceIoControl( handle, IOCTL_KS_PROPERTY, &ksPProp.Property,
-            sizeof(KSP_PIN), NULL, 0, &multipleItemSize, NULL ) == 0 && GetLastError() != ERROR_MORE_DATA )
-    {
-        return paUnanticipatedHostError;
-    }
-
-    *ksMultipleItem = (KSMULTIPLE_ITEM*)PaUtil_AllocateMemory( multipleItemSize );
-    if( !*ksMultipleItem )
-    {
-        return paInsufficientMemory;
-    }
-
-    if( DeviceIoControl( handle, IOCTL_KS_PROPERTY, &ksPProp, sizeof(KSP_PIN),
-            (void*)*ksMultipleItem,  multipleItemSize, &bytesReturned, NULL ) == 0 || bytesReturned != multipleItemSize )
-    {
-        PaUtil_FreeMemory( ksMultipleItem );
-        return paUnanticipatedHostError;
-    }
-
-    return paNoError;
-}
-
-
-static int GetKSFilterPinCount( HANDLE deviceHandle )
-{
-    DWORD result;
-
-    if( WdmGetPinPropertySimple( deviceHandle, 0, KSPROPERTY_PIN_CTYPES, &result, sizeof(result) ) == paNoError ){
-        return result;
-    }else{
-        return 0;
-    }
-}
-
-
-static KSPIN_COMMUNICATION GetKSFilterPinPropertyCommunication( HANDLE deviceHandle, int pinId )
-{
-    KSPIN_COMMUNICATION result;
-
-    if( WdmGetPinPropertySimple( deviceHandle, pinId, KSPROPERTY_PIN_COMMUNICATION, &result, sizeof(result) ) == paNoError ){
-        return result;
-    }else{
-        return KSPIN_COMMUNICATION_NONE;
-    }
-}
-
-
-static KSPIN_DATAFLOW GetKSFilterPinPropertyDataflow( HANDLE deviceHandle, int pinId )
-{
-    KSPIN_DATAFLOW result;
-
-    if( WdmGetPinPropertySimple( deviceHandle, pinId, KSPROPERTY_PIN_DATAFLOW, &result, sizeof(result) ) == paNoError ){
-        return result;
-    }else{
-        return (KSPIN_DATAFLOW)0;
-    }
-}
-
-
-static int KSFilterPinPropertyIdentifiersInclude( 
-        HANDLE deviceHandle, int pinId, unsigned long property, const GUID *identifierSet, unsigned long identifierId  )
-{
-    KSMULTIPLE_ITEM* item = NULL;
-    KSIDENTIFIER* identifier;
-    int i;
-    int result = 0;
-
-    if( WdmGetPinPropertyMulti( deviceHandle, pinId, property, &item) != paNoError )
-        return 0;
-    
-    identifier = (KSIDENTIFIER*)(item+1);
-
-    for( i = 0; i < (int)item->Count; i++ )
-    {
-        if( !memcmp( (void*)&identifier[i].Set, (void*)identifierSet, sizeof( GUID ) ) &&
-           ( identifier[i].Id == identifierId ) )
-        {
-            result = 1;
-            break;
-        }
-    }
-
-    PaUtil_FreeMemory( item );
-
-    return result;
-}
-
-
-/* return the maximum channel count supported by any pin on the device. 
-   if isInput is non-zero we query input pins, otherwise output pins.
-*/
-int PaWin_WDMKS_QueryFilterMaximumChannelCount( void *wcharDevicePath, int isInput )
-{
-    HANDLE deviceHandle;
-	ULONG i;
-    int pinCount, pinId;
-    int result = 0;
-    KSPIN_DATAFLOW requiredDataflowDirection = (isInput ? KSPIN_DATAFLOW_OUT : KSPIN_DATAFLOW_IN );
-    
-    if( !wcharDevicePath )
-        return 0;
-
-    deviceHandle = CreateFileW( (LPCWSTR)wcharDevicePath, FILE_SHARE_READ|FILE_SHARE_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL );
-    if( deviceHandle == INVALID_HANDLE_VALUE )
-        return 0;
-
-    pinCount = GetKSFilterPinCount( deviceHandle );
-    for( pinId = 0; pinId < pinCount; ++pinId )
-    {
-        KSPIN_COMMUNICATION communication = GetKSFilterPinPropertyCommunication( deviceHandle, pinId );
-        KSPIN_DATAFLOW dataflow = GetKSFilterPinPropertyDataflow( deviceHandle, pinId );
-        if( ( dataflow == requiredDataflowDirection ) &&
-                (( communication == KSPIN_COMMUNICATION_SINK) ||
-                 ( communication == KSPIN_COMMUNICATION_BOTH)) 
-             && ( KSFilterPinPropertyIdentifiersInclude( deviceHandle, pinId, 
-                    KSPROPERTY_PIN_INTERFACES, &pa_KSINTERFACESETID_Standard, KSINTERFACE_STANDARD_STREAMING )
-                || KSFilterPinPropertyIdentifiersInclude( deviceHandle, pinId, 
-                    KSPROPERTY_PIN_INTERFACES, &pa_KSINTERFACESETID_Standard, KSINTERFACE_STANDARD_LOOPED_STREAMING ) )
-             && KSFilterPinPropertyIdentifiersInclude( deviceHandle, pinId, 
-                    KSPROPERTY_PIN_MEDIUMS, &pa_KSMEDIUMSETID_Standard, KSMEDIUM_STANDARD_DEVIO ) )
-         {
-            KSMULTIPLE_ITEM* item = NULL;
-            if( WdmGetPinPropertyMulti( deviceHandle, pinId, KSPROPERTY_PIN_DATARANGES, &item ) == paNoError )
-            {
-                KSDATARANGE *dataRange = (KSDATARANGE*)(item+1);
-
-                for( i=0; i < item->Count; ++i ){
-
-                    if( pa_IS_VALID_WAVEFORMATEX_GUID(&dataRange->SubFormat)
-                            || memcmp( (void*)&dataRange->SubFormat, (void*)&pa_KSDATAFORMAT_SUBTYPE_PCM, sizeof(GUID) ) == 0
-                            || memcmp( (void*)&dataRange->SubFormat, (void*)&pa_KSDATAFORMAT_SUBTYPE_IEEE_FLOAT, sizeof(GUID) ) == 0
-                            || ( ( memcmp( (void*)&dataRange->MajorFormat, (void*)&pa_KSDATAFORMAT_TYPE_AUDIO, sizeof(GUID) ) == 0 )
-                                && ( memcmp( (void*)&dataRange->SubFormat, (void*)&KSDATAFORMAT_SUBTYPE_WILDCARD, sizeof(GUID) ) == 0 ) ) )
-                    {
-                        KSDATARANGE_AUDIO *dataRangeAudio = (KSDATARANGE_AUDIO*)dataRange;
-                        
-                        /*
-                        printf( ">>> %d %d %d %d %S\n", isInput, dataflow, communication, dataRangeAudio->MaximumChannels, devicePath );
-                       
-                        if( memcmp((void*)&dataRange->Specifier, (void*)&KSDATAFORMAT_SPECIFIER_WAVEFORMATEX, sizeof(GUID) ) == 0 )
-                            printf( "\tspecifier: KSDATAFORMAT_SPECIFIER_WAVEFORMATEX\n" );
-                        else if( memcmp((void*)&dataRange->Specifier, (void*)&KSDATAFORMAT_SPECIFIER_DSOUND, sizeof(GUID) ) == 0 )
-                            printf( "\tspecifier: KSDATAFORMAT_SPECIFIER_DSOUND\n" );
-                        else if( memcmp((void*)&dataRange->Specifier, (void*)&KSDATAFORMAT_SPECIFIER_WILDCARD, sizeof(GUID) ) == 0 )
-                            printf( "\tspecifier: KSDATAFORMAT_SPECIFIER_WILDCARD\n" );
-                        else
-                            printf( "\tspecifier: ?\n" );
-                        */
-
-                        /*
-                            We assume that very high values for MaximumChannels are not useful and indicate
-                            that the driver isn't prepared to tell us the real number of channels which it supports.
-                        */
-                        if( dataRangeAudio->MaximumChannels  < 0xFFFFUL && (int)dataRangeAudio->MaximumChannels > result )
-                            result = (int)dataRangeAudio->MaximumChannels;
-                    }
-                    
-                    dataRange = (KSDATARANGE*)( ((char*)dataRange) + dataRange->FormatSize);
-                }
-
-                PaUtil_FreeMemory( item );
-            }
-        }
-    }
-    
-    CloseHandle( deviceHandle );
-    return result;
-}
+/*
+ * PortAudio Portable Real-Time Audio Library
+ * Windows WDM KS utilities
+ *
+ * Copyright (c) 1999 - 2007 Andrew Baldwin, 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 <windows.h>
+#include <mmreg.h>
+#ifndef WAVE_FORMAT_IEEE_FLOAT
+    #define WAVE_FORMAT_IEEE_FLOAT 0x0003   // MinGW32 does not define this
+#endif    
+#ifndef _WAVEFORMATEXTENSIBLE_
+    #define _WAVEFORMATEXTENSIBLE_          // MinGW32 does not define this
+#endif
+#ifndef _INC_MMREG
+    #define _INC_MMREG                      // for STATIC_KSDATAFORMAT_SUBTYPE_IEEE_FLOAT
+#endif
+#include <winioctl.h>						// MinGW32 does not define this automatically
+
+#if defined(__GNUC__)
+
+#include "../../hostapi/wasapi/mingw-include/ks.h"
+#include "../../hostapi/wasapi/mingw-include/ksmedia.h"
+
+#else
+
+#include <ks.h>
+#include <ksmedia.h>
+
+#endif
+
+#include <stdio.h>                          // just for some development printfs
+
+#include "portaudio.h"
+#include "pa_util.h"
+#include "pa_win_wdmks_utils.h"
+
+
+/* PortAudio-local instances of GUIDs previously sourced from ksguid.lib */
+
+/* GUID KSDATAFORMAT_TYPE_AUDIO */
+static const GUID pa_KSDATAFORMAT_TYPE_AUDIO = { STATIC_KSDATAFORMAT_TYPE_AUDIO };
+
+/* GUID KSDATAFORMAT_SUBTYPE_IEEE_FLOAT */
+static const GUID pa_KSDATAFORMAT_SUBTYPE_IEEE_FLOAT = { STATIC_KSDATAFORMAT_SUBTYPE_IEEE_FLOAT };
+
+/* GUID KSDATAFORMAT_SUBTYPE_PCM */
+static const GUID pa_KSDATAFORMAT_SUBTYPE_PCM = { STATIC_KSDATAFORMAT_SUBTYPE_PCM };
+
+/* GUID KSDATAFORMAT_SUBTYPE_WAVEFORMATEX */
+static const GUID pa_KSDATAFORMAT_SUBTYPE_WAVEFORMATEX = { STATIC_KSDATAFORMAT_SUBTYPE_WAVEFORMATEX };
+
+/* GUID KSMEDIUMSETID_Standard */
+static const GUID pa_KSMEDIUMSETID_Standard = { STATIC_KSMEDIUMSETID_Standard };
+
+/* GUID KSINTERFACESETID_Standard */
+static const GUID pa_KSINTERFACESETID_Standard = { STATIC_KSINTERFACESETID_Standard };
+
+/* GUID KSPROPSETID_Pin */
+static const GUID pa_KSPROPSETID_Pin = { STATIC_KSPROPSETID_Pin };
+
+#define pa_IS_VALID_WAVEFORMATEX_GUID(Guid)\
+    (!memcmp(((PUSHORT)&pa_KSDATAFORMAT_SUBTYPE_WAVEFORMATEX) + 1, ((PUSHORT)(Guid)) + 1, sizeof(GUID) - sizeof(USHORT)))
+
+
+static PaError WdmGetPinPropertySimple(
+    HANDLE  handle,
+    unsigned long pinId,
+    unsigned long property,
+    void* value,
+    unsigned long valueSize )
+{
+    DWORD bytesReturned;
+    KSP_PIN ksPProp;
+    ksPProp.Property.Set = pa_KSPROPSETID_Pin;
+    ksPProp.Property.Id = property;
+    ksPProp.Property.Flags = KSPROPERTY_TYPE_GET;
+    ksPProp.PinId = pinId;
+    ksPProp.Reserved = 0;
+
+    if( DeviceIoControl( handle, IOCTL_KS_PROPERTY, &ksPProp, sizeof(KSP_PIN),
+            value, valueSize, &bytesReturned, NULL ) == 0 || bytesReturned != valueSize )
+    {
+        return paUnanticipatedHostError;
+    }
+    else
+    {
+        return paNoError;
+    }
+}
+
+
+static PaError WdmGetPinPropertyMulti(
+    HANDLE handle,
+    unsigned long pinId,
+    unsigned long property,
+    KSMULTIPLE_ITEM** ksMultipleItem)
+{
+    unsigned long multipleItemSize = 0;
+    KSP_PIN ksPProp;
+    DWORD bytesReturned;
+
+    *ksMultipleItem = 0;
+
+    ksPProp.Property.Set = pa_KSPROPSETID_Pin;
+    ksPProp.Property.Id = property;
+    ksPProp.Property.Flags = KSPROPERTY_TYPE_GET;
+    ksPProp.PinId = pinId;
+    ksPProp.Reserved = 0;
+
+    if( DeviceIoControl( handle, IOCTL_KS_PROPERTY, &ksPProp.Property,
+            sizeof(KSP_PIN), NULL, 0, &multipleItemSize, NULL ) == 0 && GetLastError() != ERROR_MORE_DATA )
+    {
+        return paUnanticipatedHostError;
+    }
+
+    *ksMultipleItem = (KSMULTIPLE_ITEM*)PaUtil_AllocateMemory( multipleItemSize );
+    if( !*ksMultipleItem )
+    {
+        return paInsufficientMemory;
+    }
+
+    if( DeviceIoControl( handle, IOCTL_KS_PROPERTY, &ksPProp, sizeof(KSP_PIN),
+            (void*)*ksMultipleItem,  multipleItemSize, &bytesReturned, NULL ) == 0 || bytesReturned != multipleItemSize )
+    {
+        PaUtil_FreeMemory( ksMultipleItem );
+        return paUnanticipatedHostError;
+    }
+
+    return paNoError;
+}
+
+
+static int GetKSFilterPinCount( HANDLE deviceHandle )
+{
+    DWORD result;
+
+    if( WdmGetPinPropertySimple( deviceHandle, 0, KSPROPERTY_PIN_CTYPES, &result, sizeof(result) ) == paNoError ){
+        return result;
+    }else{
+        return 0;
+    }
+}
+
+
+static KSPIN_COMMUNICATION GetKSFilterPinPropertyCommunication( HANDLE deviceHandle, int pinId )
+{
+    KSPIN_COMMUNICATION result;
+
+    if( WdmGetPinPropertySimple( deviceHandle, pinId, KSPROPERTY_PIN_COMMUNICATION, &result, sizeof(result) ) == paNoError ){
+        return result;
+    }else{
+        return KSPIN_COMMUNICATION_NONE;
+    }
+}
+
+
+static KSPIN_DATAFLOW GetKSFilterPinPropertyDataflow( HANDLE deviceHandle, int pinId )
+{
+    KSPIN_DATAFLOW result;
+
+    if( WdmGetPinPropertySimple( deviceHandle, pinId, KSPROPERTY_PIN_DATAFLOW, &result, sizeof(result) ) == paNoError ){
+        return result;
+    }else{
+        return (KSPIN_DATAFLOW)0;
+    }
+}
+
+
+static int KSFilterPinPropertyIdentifiersInclude( 
+        HANDLE deviceHandle, int pinId, unsigned long property, const GUID *identifierSet, unsigned long identifierId  )
+{
+    KSMULTIPLE_ITEM* item = NULL;
+    KSIDENTIFIER* identifier;
+    int i;
+    int result = 0;
+
+    if( WdmGetPinPropertyMulti( deviceHandle, pinId, property, &item) != paNoError )
+        return 0;
+    
+    identifier = (KSIDENTIFIER*)(item+1);
+
+    for( i = 0; i < (int)item->Count; i++ )
+    {
+        if( !memcmp( (void*)&identifier[i].Set, (void*)identifierSet, sizeof( GUID ) ) &&
+           ( identifier[i].Id == identifierId ) )
+        {
+            result = 1;
+            break;
+        }
+    }
+
+    PaUtil_FreeMemory( item );
+
+    return result;
+}
+
+
+/* return the maximum channel count supported by any pin on the device. 
+   if isInput is non-zero we query input pins, otherwise output pins.
+*/
+int PaWin_WDMKS_QueryFilterMaximumChannelCount( void *wcharDevicePath, int isInput )
+{
+    HANDLE deviceHandle;
+	ULONG i;
+    int pinCount, pinId;
+    int result = 0;
+    KSPIN_DATAFLOW requiredDataflowDirection = (isInput ? KSPIN_DATAFLOW_OUT : KSPIN_DATAFLOW_IN );
+    
+    if( !wcharDevicePath )
+        return 0;
+
+    deviceHandle = CreateFileW( (LPCWSTR)wcharDevicePath, FILE_SHARE_READ|FILE_SHARE_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL );
+    if( deviceHandle == INVALID_HANDLE_VALUE )
+        return 0;
+
+    pinCount = GetKSFilterPinCount( deviceHandle );
+    for( pinId = 0; pinId < pinCount; ++pinId )
+    {
+        KSPIN_COMMUNICATION communication = GetKSFilterPinPropertyCommunication( deviceHandle, pinId );
+        KSPIN_DATAFLOW dataflow = GetKSFilterPinPropertyDataflow( deviceHandle, pinId );
+        if( ( dataflow == requiredDataflowDirection ) &&
+                (( communication == KSPIN_COMMUNICATION_SINK) ||
+                 ( communication == KSPIN_COMMUNICATION_BOTH)) 
+             && ( KSFilterPinPropertyIdentifiersInclude( deviceHandle, pinId, 
+                    KSPROPERTY_PIN_INTERFACES, &pa_KSINTERFACESETID_Standard, KSINTERFACE_STANDARD_STREAMING )
+                || KSFilterPinPropertyIdentifiersInclude( deviceHandle, pinId, 
+                    KSPROPERTY_PIN_INTERFACES, &pa_KSINTERFACESETID_Standard, KSINTERFACE_STANDARD_LOOPED_STREAMING ) )
+             && KSFilterPinPropertyIdentifiersInclude( deviceHandle, pinId, 
+                    KSPROPERTY_PIN_MEDIUMS, &pa_KSMEDIUMSETID_Standard, KSMEDIUM_STANDARD_DEVIO ) )
+         {
+            KSMULTIPLE_ITEM* item = NULL;
+            if( WdmGetPinPropertyMulti( deviceHandle, pinId, KSPROPERTY_PIN_DATARANGES, &item ) == paNoError )
+            {
+                KSDATARANGE *dataRange = (KSDATARANGE*)(item+1);
+
+                for( i=0; i < item->Count; ++i ){
+
+                    if( pa_IS_VALID_WAVEFORMATEX_GUID(&dataRange->SubFormat)
+                            || memcmp( (void*)&dataRange->SubFormat, (void*)&pa_KSDATAFORMAT_SUBTYPE_PCM, sizeof(GUID) ) == 0
+                            || memcmp( (void*)&dataRange->SubFormat, (void*)&pa_KSDATAFORMAT_SUBTYPE_IEEE_FLOAT, sizeof(GUID) ) == 0
+                            || ( ( memcmp( (void*)&dataRange->MajorFormat, (void*)&pa_KSDATAFORMAT_TYPE_AUDIO, sizeof(GUID) ) == 0 )
+                                && ( memcmp( (void*)&dataRange->SubFormat, (void*)&KSDATAFORMAT_SUBTYPE_WILDCARD, sizeof(GUID) ) == 0 ) ) )
+                    {
+                        KSDATARANGE_AUDIO *dataRangeAudio = (KSDATARANGE_AUDIO*)dataRange;
+                        
+                        /*
+                        printf( ">>> %d %d %d %d %S\n", isInput, dataflow, communication, dataRangeAudio->MaximumChannels, devicePath );
+                       
+                        if( memcmp((void*)&dataRange->Specifier, (void*)&KSDATAFORMAT_SPECIFIER_WAVEFORMATEX, sizeof(GUID) ) == 0 )
+                            printf( "\tspecifier: KSDATAFORMAT_SPECIFIER_WAVEFORMATEX\n" );
+                        else if( memcmp((void*)&dataRange->Specifier, (void*)&KSDATAFORMAT_SPECIFIER_DSOUND, sizeof(GUID) ) == 0 )
+                            printf( "\tspecifier: KSDATAFORMAT_SPECIFIER_DSOUND\n" );
+                        else if( memcmp((void*)&dataRange->Specifier, (void*)&KSDATAFORMAT_SPECIFIER_WILDCARD, sizeof(GUID) ) == 0 )
+                            printf( "\tspecifier: KSDATAFORMAT_SPECIFIER_WILDCARD\n" );
+                        else
+                            printf( "\tspecifier: ?\n" );
+                        */
+
+                        /*
+                            We assume that very high values for MaximumChannels are not useful and indicate
+                            that the driver isn't prepared to tell us the real number of channels which it supports.
+                        */
+                        if( dataRangeAudio->MaximumChannels  < 0xFFFFUL && (int)dataRangeAudio->MaximumChannels > result )
+                            result = (int)dataRangeAudio->MaximumChannels;
+                    }
+                    
+                    dataRange = (KSDATARANGE*)( ((char*)dataRange) + dataRange->FormatSize);
+                }
+
+                PaUtil_FreeMemory( item );
+            }
+        }
+    }
+    
+    CloseHandle( deviceHandle );
+    return result;
+}
diff --git a/src/os/win/pa_win_wdmks_utils.h b/src/os/win/pa_win_wdmks_utils.h
index f54035f..b8e923a 100644
--- a/src/os/win/pa_win_wdmks_utils.h
+++ b/src/os/win/pa_win_wdmks_utils.h
@@ -1,65 +1,65 @@
-#ifndef PA_WIN_WDMKS_UTILS_H
-#define PA_WIN_WDMKS_UTILS_H
-
-/*
- * PortAudio Portable Real-Time Audio Library
- * Windows WDM KS utilities
- *
- * Copyright (c) 1999 - 2007 Ross Bencina, Andrew Baldwin
- *
- * 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
- @brief Utilities for working with the Windows WDM KS API
-*/
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
-    Query for the maximum number of channels supported by any pin of the
-    specified device. Returns 0 if the query fails for any reason.
-
-    @param wcharDevicePath A system level PnP interface path, supplied as a WCHAR unicode string.
-    Declard as void* to avoid introducing a dependency on wchar_t here.
-
-    @param isInput A flag specifying whether to query for input (non-zero) or output (zero) channels.
-*/
-int PaWin_WDMKS_QueryFilterMaximumChannelCount( void *wcharDevicePath, int isInput );
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
+#ifndef PA_WIN_WDMKS_UTILS_H
+#define PA_WIN_WDMKS_UTILS_H
+
+/*
+ * PortAudio Portable Real-Time Audio Library
+ * Windows WDM KS utilities
+ *
+ * Copyright (c) 1999 - 2007 Ross Bencina, Andrew Baldwin
+ *
+ * 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
+ @brief Utilities for working with the Windows WDM KS API
+*/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+    Query for the maximum number of channels supported by any pin of the
+    specified device. Returns 0 if the query fails for any reason.
+
+    @param wcharDevicePath A system level PnP interface path, supplied as a WCHAR unicode string.
+    Declard as void* to avoid introducing a dependency on wchar_t here.
+
+    @param isInput A flag specifying whether to query for input (non-zero) or output (zero) channels.
+*/
+int PaWin_WDMKS_QueryFilterMaximumChannelCount( void *wcharDevicePath, int isInput );
+
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
 #endif /* PA_WIN_WDMKS_UTILS_H */
\ No newline at end of file
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 67dfac6..973568f 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -4,6 +4,10 @@
 MACRO(ADD_TEST appl_name)
    ADD_EXECUTABLE(${appl_name} "${appl_name}.c")
    TARGET_LINK_LIBRARIES(${appl_name} portaudio_static)
+   SET_TARGET_PROPERTIES(${appl_name}
+      PROPERTIES
+      FOLDER "Test"
+   )
 ENDMACRO(ADD_TEST)
 
 ADD_TEST(patest_longsine)
diff --git a/test/pa_minlat.c b/test/pa_minlat.c
index 995d608..0106cf3 100644
--- a/test/pa_minlat.c
+++ b/test/pa_minlat.c
@@ -5,7 +5,7 @@
 	@author Phil Burk  http://www.softsynth.com
 */
 /*
- * $Id: pa_minlat.c 1612 2011-02-28 23:56:48Z philburk $
+ * $Id$
  *
  * This program uses the PortAudio Portable Audio Library.
  * For more information see: http://www.portaudio.com
diff --git a/test/patest1.c b/test/patest1.c
index 9f0fc8a..a0fae47 100644
--- a/test/patest1.c
+++ b/test/patest1.c
@@ -4,7 +4,7 @@
 	@author Ross Bencina <rossb at audiomulch.com>
 */
 /*
- * $Id: patest1.c 1368 2008-03-01 00:38:27Z rossb $
+ * $Id$
  *
  * This program uses the PortAudio Portable Audio Library.
  * For more information see: http://www.portaudio.com
diff --git a/test/patest_buffer.c b/test/patest_buffer.c
index 44e9afb..830b3ac 100644
--- a/test/patest_buffer.c
+++ b/test/patest_buffer.c
@@ -4,7 +4,7 @@
 	@author Phil Burk  http://www.softsynth.com
 */
 /*
- * $Id: patest_buffer.c 1368 2008-03-01 00:38:27Z rossb $
+ * $Id$
  *
  * This program uses the PortAudio Portable Audio Library.
  * For more information see: http://www.portaudio.com
diff --git a/test/patest_callbackstop.c b/test/patest_callbackstop.c
index a3b9a94..bd6e829 100644
--- a/test/patest_callbackstop.c
+++ b/test/patest_callbackstop.c
@@ -4,7 +4,7 @@
 	@author Ross Bencina <rossb at audiomulch.com>
 */
 /*
- * $Id: patest_callbackstop.c 1368 2008-03-01 00:38:27Z rossb $
+ * $Id$
  *
  * This program uses the PortAudio Portable Audio Library.
  * For more information see: http://www.portaudio.com/
diff --git a/test/patest_clip.c b/test/patest_clip.c
index 2633795..e86d0ac 100644
--- a/test/patest_clip.c
+++ b/test/patest_clip.c
@@ -6,7 +6,7 @@
 	@author Phil Burk  http://www.softsynth.com
 */
 /*
- * $Id: patest_clip.c 1368 2008-03-01 00:38:27Z rossb $
+ * $Id$
  *
  * This program uses the PortAudio Portable Audio Library.
  * For more information see: http://www.portaudio.com
diff --git a/test/patest_converters.c b/test/patest_converters.c
index 9681110..1474a71 100644
--- a/test/patest_converters.c
+++ b/test/patest_converters.c
@@ -1,395 +1,395 @@
-/** @file patest_converters.c
-	@ingroup test_src
-	@brief Tests the converter functions in pa_converters.c
-	@author Ross Bencina <rossb at audiomulch.com>
-
-    Link with pa_dither.c and pa_converters.c
-
-    see http://www.portaudio.com/trac/wiki/V19ConvertersStatus for a discussion of this.
-*/
-/*
- * $Id: $
- *
- * This program uses the PortAudio Portable Audio Library.
- * For more information see: http://www.portaudio.com/
- * Copyright (c) 1999-2008 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 <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-
-#include "portaudio.h"
-#include "pa_converters.h"
-#include "pa_dither.h"
-#include "pa_types.h"
-#include "pa_endianness.h"
-
-#ifndef M_PI
-#define M_PI  (3.14159265)
-#endif
-
-#define MAX_PER_CHANNEL_FRAME_COUNT     (2048)
-#define MAX_CHANNEL_COUNT               (8)
-
-
-#define SAMPLE_FORMAT_COUNT (6)
-
-static PaSampleFormat sampleFormats_[ SAMPLE_FORMAT_COUNT ] = 
-    { paFloat32, paInt32, paInt24, paInt16, paInt8, paUInt8 }; /* all standard PA sample formats */
-
-static const char* sampleFormatNames_[SAMPLE_FORMAT_COUNT] = 
-    { "paFloat32", "paInt32", "paInt24", "paInt16", "paInt8", "paUInt8" };
-
-
-static const char* abbreviatedSampleFormatNames_[SAMPLE_FORMAT_COUNT] = 
-    { "f32", "i32", "i24", "i16", " i8", "ui8" };
-
-
-PaError My_Pa_GetSampleSize( PaSampleFormat format );
-
-/*
-    available flags are paClipOff and paDitherOff
-    clipping is usually applied for float -> int conversions
-    dither is usually applied for all downconversions (ie anything but 8bit->8bit conversions
-*/
-
-static int CanClip( PaSampleFormat sourceFormat, PaSampleFormat destinationFormat )
-{
-    if( sourceFormat == paFloat32 && destinationFormat != sourceFormat )
-        return 1;
-    else
-        return 0;
-}
-
-static int CanDither( PaSampleFormat sourceFormat, PaSampleFormat destinationFormat )
-{
-    if( sourceFormat < destinationFormat && sourceFormat != paInt8 )
-        return 1;
-    else
-        return 0;
-}
-
-static void GenerateOneCycleSineReference( double *out, int frameCount, int strideFrames )
-{
-    int i;
-    for( i=0; i < frameCount; ++i ){
-        *out = sin( ((double)i/(double)frameCount) * 2. * M_PI );
-        out += strideFrames;
-    }
-}
-
-
-static void GenerateOneCycleSine( PaSampleFormat format, void *buffer, int frameCount, int strideFrames )
-{
-    switch( format ){
-
-        case paFloat32:
-            {
-                int i;
-                float *out = (float*)buffer;
-                for( i=0; i < frameCount; ++i ){
-                    *out = (float).9 * sin( ((double)i/(double)frameCount) * 2. * M_PI );
-                    out += strideFrames;
-                }
-            }
-            break;
-        case paInt32:
-            {
-                int i;
-                PaInt32 *out = (PaInt32*)buffer;
-                for( i=0; i < frameCount; ++i ){
-                    *out = (PaInt32)(.9 * sin( ((double)i/(double)frameCount) * 2. * M_PI ) * 0x7FFFFFFF);
-                    out += strideFrames;
-                }
-            }
-            break;
-        case paInt24:
-            {
-                int i;
-                unsigned char *out = (unsigned char*)buffer;
-                for( i=0; i < frameCount; ++i ){
-                    signed long temp = (PaInt32)(.9 * sin( ((double)i/(double)frameCount) * 2. * M_PI ) * 0x7FFFFFFF);
-                    
-                    #if defined(PA_LITTLE_ENDIAN)
-                            out[0] = (unsigned char)(temp >> 8) & 0xFF;
-                            out[1] = (unsigned char)(temp >> 16) & 0xFF;
-                            out[2] = (unsigned char)(temp >> 24) & 0xFF;
-                    #elif defined(PA_BIG_ENDIAN)
-                            out[0] = (unsigned char)(temp >> 24) & 0xFF;
-                            out[1] = (unsigned char)(temp >> 16) & 0xFF;
-                            out[2] = (unsigned char)(temp >> 8) & 0xFF;
-                    #endif
-                    out += 3;
-                }
-            }
-            break;
-        case paInt16:
-            {
-                int i;
-                PaInt16 *out = (PaInt16*)buffer;
-                for( i=0; i < frameCount; ++i ){
-                    *out = (PaInt16)(.9 * sin( ((double)i/(double)frameCount) * 2. * M_PI ) * 0x7FFF );
-                    out += strideFrames;
-                }
-            }
-            break;
-        case paInt8:
-            {
-                int i;
-                signed char *out = (signed char*)buffer;
-                for( i=0; i < frameCount; ++i ){
-                    *out = (signed char)(.9 * sin( ((double)i/(double)frameCount) * 2. * M_PI ) * 0x7F );
-                    out += strideFrames;
-                }
-            }
-            break;
-        case paUInt8:
-            {
-                int i;
-                unsigned char *out = (unsigned char*)buffer;
-                for( i=0; i < frameCount; ++i ){
-                    *out = (unsigned char)( .5 * (1. + (.9 * sin( ((double)i/(double)frameCount) * 2. * M_PI ))) * 0xFF  );
-                    out += strideFrames;
-                }
-            }
-            break;
-    }
-}
-
-int TestNonZeroPresent( void *buffer, int size )
-{
-    char *p = (char*)buffer;
-    int i;
-
-    for( i=0; i < size; ++i ){
-    
-        if( *p != 0 )
-            return 1;
-        ++p;
-    }   
-
-    return 0;
-}
-
-float MaximumAbsDifference( float* sourceBuffer, float* referenceBuffer, int count )
-{
-    float result = 0;
-    float difference;
-    while( count-- ){
-        difference = fabs( *sourceBuffer++ - *referenceBuffer++ );
-        if( difference > result )
-            result = difference;
-    }
-
-    return result;
-}  
-
-int main( const char **argv, int argc )
-{
-    PaUtilTriangularDitherGenerator ditherState;
-    PaUtilConverter *converter;
-    void *destinationBuffer, *sourceBuffer;
-    double *referenceBuffer;
-    int sourceFormatIndex, destinationFormatIndex;
-    PaSampleFormat sourceFormat, destinationFormat;
-    PaStreamFlags flags;
-    int passFailMatrix[SAMPLE_FORMAT_COUNT][SAMPLE_FORMAT_COUNT]; // [source][destination]
-    float noiseAmplitudeMatrix[SAMPLE_FORMAT_COUNT][SAMPLE_FORMAT_COUNT]; // [source][destination]
-    float amp;
-
-#define FLAG_COMBINATION_COUNT (4)
-    PaStreamFlags flagCombinations[FLAG_COMBINATION_COUNT] = { paNoFlag, paClipOff, paDitherOff, paClipOff | paDitherOff };
-    const char *flagCombinationNames[FLAG_COMBINATION_COUNT] = { "paNoFlag", "paClipOff", "paDitherOff", "paClipOff | paDitherOff" };
-    int flagCombinationIndex;
-
-    PaUtil_InitializeTriangularDitherState( &ditherState );
-
-    /* allocate more than enough space, we use sizeof(float) but we need to fit any 32 bit datum */
-
-    destinationBuffer = (void*)malloc( MAX_PER_CHANNEL_FRAME_COUNT * MAX_CHANNEL_COUNT * sizeof(float) );
-    sourceBuffer = (void*)malloc( MAX_PER_CHANNEL_FRAME_COUNT * MAX_CHANNEL_COUNT * sizeof(float) );
-    referenceBuffer = (void*)malloc( MAX_PER_CHANNEL_FRAME_COUNT * MAX_CHANNEL_COUNT * sizeof(float) );
-
-
-    /* the first round of tests simply iterates through the buffer combinations testing
-        that putting something in gives something out */
-
-    printf( "= Sine wave in, something out =\n" );
-
-    printf( "\n" );
-
-    GenerateOneCycleSine( paFloat32, referenceBuffer, MAX_PER_CHANNEL_FRAME_COUNT, 1 );
-
-    for( flagCombinationIndex = 0; flagCombinationIndex < FLAG_COMBINATION_COUNT; ++flagCombinationIndex ){
-        flags = flagCombinations[flagCombinationIndex];
-
-        printf( "\n" );
-        printf( "== flags = %s ==\n", flagCombinationNames[flagCombinationIndex] );
-
-        for( sourceFormatIndex = 0; sourceFormatIndex < SAMPLE_FORMAT_COUNT; ++sourceFormatIndex ){
-            for( destinationFormatIndex = 0; destinationFormatIndex < SAMPLE_FORMAT_COUNT; ++destinationFormatIndex ){
-                sourceFormat = sampleFormats_[sourceFormatIndex];
-                destinationFormat = sampleFormats_[destinationFormatIndex];
-                //printf( "%s -> %s ", sampleFormatNames_[ sourceFormatIndex ], sampleFormatNames_[ destinationFormatIndex ] );
-
-                converter = PaUtil_SelectConverter( sourceFormat, destinationFormat, flags );
-
-                /* source is a sinewave */
-                GenerateOneCycleSine( sourceFormat, sourceBuffer, MAX_PER_CHANNEL_FRAME_COUNT, 1 );
-
-                /* zero destination */
-                memset( destinationBuffer, 0, MAX_PER_CHANNEL_FRAME_COUNT * My_Pa_GetSampleSize( destinationFormat ) );
-
-                (*converter)( destinationBuffer, 1, sourceBuffer, 1, MAX_PER_CHANNEL_FRAME_COUNT, &ditherState );
-
-    /*
-    Other ways we could test this would be:
-        - pass a constant, check for a constant (wouldn't work with dither)
-        - pass alternating +/-, check for the same...
-    */
-                if( TestNonZeroPresent( destinationBuffer, MAX_PER_CHANNEL_FRAME_COUNT * My_Pa_GetSampleSize( destinationFormat ) ) ){
-                    //printf( "PASSED\n" );
-                    passFailMatrix[sourceFormatIndex][destinationFormatIndex] = 1;
-                }else{
-                    //printf( "FAILED\n" );
-                    passFailMatrix[sourceFormatIndex][destinationFormatIndex] = 0;
-                }
-
-                
-                /* try to measure the noise floor (comparing output signal to a float32 sine wave) */
-
-                if( passFailMatrix[sourceFormatIndex][destinationFormatIndex] ){
-
-                    /* convert destination back to paFloat32 into source */
-                    converter = PaUtil_SelectConverter( destinationFormat, paFloat32, paNoFlag );
-
-                    memset( sourceBuffer, 0, MAX_PER_CHANNEL_FRAME_COUNT * My_Pa_GetSampleSize( paFloat32 ) );
-                    (*converter)( sourceBuffer, 1, destinationBuffer, 1, MAX_PER_CHANNEL_FRAME_COUNT, &ditherState );
-
-                    if( TestNonZeroPresent( sourceBuffer, MAX_PER_CHANNEL_FRAME_COUNT * My_Pa_GetSampleSize( paFloat32 ) ) ){
-    
-                        noiseAmplitudeMatrix[sourceFormatIndex][destinationFormatIndex] = MaximumAbsDifference( (float*)sourceBuffer, (float*)referenceBuffer, MAX_PER_CHANNEL_FRAME_COUNT );
-                        
-                    }else{
-                        /* can't test noise floor because there is no conversion from dest format to float available */
-                        noiseAmplitudeMatrix[sourceFormatIndex][destinationFormatIndex] = -1; // mark as failed
-                    }
-                }else{
-                    noiseAmplitudeMatrix[sourceFormatIndex][destinationFormatIndex] = -1; // mark as failed
-                }
-            }
-        }
-
-        printf( "\n" );
-        printf( "=== Output contains non-zero data ===\n" );
-        printf( "Key: . - pass, X - fail\n" );
-        printf( "{{{\n" ); // trac preformated text tag
-        printf( "in|  out:    " );
-        for( destinationFormatIndex = 0; destinationFormatIndex < SAMPLE_FORMAT_COUNT; ++destinationFormatIndex ){
-            printf( "  %s   ", abbreviatedSampleFormatNames_[destinationFormatIndex] );
-        }
-        printf( "\n" );
-
-        for( sourceFormatIndex = 0; sourceFormatIndex < SAMPLE_FORMAT_COUNT; ++sourceFormatIndex ){
-            printf( "%s         ", abbreviatedSampleFormatNames_[sourceFormatIndex] );
-            for( destinationFormatIndex = 0; destinationFormatIndex < SAMPLE_FORMAT_COUNT; ++destinationFormatIndex ){
-                printf( "   %s   ", (passFailMatrix[sourceFormatIndex][destinationFormatIndex])? " ." : " X" );
-            }
-            printf( "\n" );
-        }
-        printf( "}}}\n" ); // trac preformated text tag
-
-        printf( "\n" );
-        printf( "=== Combined dynamic range (src->dest->float32) ===\n" );
-        printf( "Key: Noise amplitude in dBfs, X - fail (either above failed or dest->float32 failed)\n" );
-        printf( "{{{\n" ); // trac preformated text tag
-        printf( "in|  out:    " );
-        for( destinationFormatIndex = 0; destinationFormatIndex < SAMPLE_FORMAT_COUNT; ++destinationFormatIndex ){
-            printf( "  %s   ", abbreviatedSampleFormatNames_[destinationFormatIndex] );
-        }
-        printf( "\n" );
-
-        for( sourceFormatIndex = 0; sourceFormatIndex < SAMPLE_FORMAT_COUNT; ++sourceFormatIndex ){
-            printf( " %s       ", abbreviatedSampleFormatNames_[sourceFormatIndex] );
-            for( destinationFormatIndex = 0; destinationFormatIndex < SAMPLE_FORMAT_COUNT; ++destinationFormatIndex ){
-                amp = noiseAmplitudeMatrix[sourceFormatIndex][destinationFormatIndex];
-                if( amp < 0. )
-                    printf( "    X   " );
-                else
-                    printf( " % 6.1f ", 20.*log10(amp) );
-            }
-            printf( "\n" );
-        }
-        printf( "}}}\n" ); // trac preformated text tag
-    }
-
-
-    free( destinationBuffer );
-    free( sourceBuffer );
-    free( referenceBuffer );
-}
-
-// copied here for now otherwise we need to include the world just for this function.
-PaError My_Pa_GetSampleSize( PaSampleFormat format )
-{
-    int result;
-
-    switch( format & ~paNonInterleaved )
-    {
-
-    case paUInt8:
-    case paInt8:
-        result = 1;
-        break;
-
-    case paInt16:
-        result = 2;
-        break;
-
-    case paInt24:
-        result = 3;
-        break;
-
-    case paFloat32:
-    case paInt32:
-        result = 4;
-        break;
-
-    default:
-        result = paSampleFormatNotSupported;
-        break;
-    }
-
-    return (PaError) result;
-}
+/** @file patest_converters.c
+	@ingroup test_src
+	@brief Tests the converter functions in pa_converters.c
+	@author Ross Bencina <rossb at audiomulch.com>
+
+    Link with pa_dither.c and pa_converters.c
+
+    see http://www.portaudio.com/trac/wiki/V19ConvertersStatus for a discussion of this.
+*/
+/*
+ * $Id: $
+ *
+ * This program uses the PortAudio Portable Audio Library.
+ * For more information see: http://www.portaudio.com/
+ * Copyright (c) 1999-2008 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 <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+
+#include "portaudio.h"
+#include "pa_converters.h"
+#include "pa_dither.h"
+#include "pa_types.h"
+#include "pa_endianness.h"
+
+#ifndef M_PI
+#define M_PI  (3.14159265)
+#endif
+
+#define MAX_PER_CHANNEL_FRAME_COUNT     (2048)
+#define MAX_CHANNEL_COUNT               (8)
+
+
+#define SAMPLE_FORMAT_COUNT (6)
+
+static PaSampleFormat sampleFormats_[ SAMPLE_FORMAT_COUNT ] = 
+    { paFloat32, paInt32, paInt24, paInt16, paInt8, paUInt8 }; /* all standard PA sample formats */
+
+static const char* sampleFormatNames_[SAMPLE_FORMAT_COUNT] = 
+    { "paFloat32", "paInt32", "paInt24", "paInt16", "paInt8", "paUInt8" };
+
+
+static const char* abbreviatedSampleFormatNames_[SAMPLE_FORMAT_COUNT] = 
+    { "f32", "i32", "i24", "i16", " i8", "ui8" };
+
+
+PaError My_Pa_GetSampleSize( PaSampleFormat format );
+
+/*
+    available flags are paClipOff and paDitherOff
+    clipping is usually applied for float -> int conversions
+    dither is usually applied for all downconversions (ie anything but 8bit->8bit conversions
+*/
+
+static int CanClip( PaSampleFormat sourceFormat, PaSampleFormat destinationFormat )
+{
+    if( sourceFormat == paFloat32 && destinationFormat != sourceFormat )
+        return 1;
+    else
+        return 0;
+}
+
+static int CanDither( PaSampleFormat sourceFormat, PaSampleFormat destinationFormat )
+{
+    if( sourceFormat < destinationFormat && sourceFormat != paInt8 )
+        return 1;
+    else
+        return 0;
+}
+
+static void GenerateOneCycleSineReference( double *out, int frameCount, int strideFrames )
+{
+    int i;
+    for( i=0; i < frameCount; ++i ){
+        *out = sin( ((double)i/(double)frameCount) * 2. * M_PI );
+        out += strideFrames;
+    }
+}
+
+
+static void GenerateOneCycleSine( PaSampleFormat format, void *buffer, int frameCount, int strideFrames )
+{
+    switch( format ){
+
+        case paFloat32:
+            {
+                int i;
+                float *out = (float*)buffer;
+                for( i=0; i < frameCount; ++i ){
+                    *out = (float).9 * sin( ((double)i/(double)frameCount) * 2. * M_PI );
+                    out += strideFrames;
+                }
+            }
+            break;
+        case paInt32:
+            {
+                int i;
+                PaInt32 *out = (PaInt32*)buffer;
+                for( i=0; i < frameCount; ++i ){
+                    *out = (PaInt32)(.9 * sin( ((double)i/(double)frameCount) * 2. * M_PI ) * 0x7FFFFFFF);
+                    out += strideFrames;
+                }
+            }
+            break;
+        case paInt24:
+            {
+                int i;
+                unsigned char *out = (unsigned char*)buffer;
+                for( i=0; i < frameCount; ++i ){
+                    signed long temp = (PaInt32)(.9 * sin( ((double)i/(double)frameCount) * 2. * M_PI ) * 0x7FFFFFFF);
+                    
+                    #if defined(PA_LITTLE_ENDIAN)
+                            out[0] = (unsigned char)(temp >> 8) & 0xFF;
+                            out[1] = (unsigned char)(temp >> 16) & 0xFF;
+                            out[2] = (unsigned char)(temp >> 24) & 0xFF;
+                    #elif defined(PA_BIG_ENDIAN)
+                            out[0] = (unsigned char)(temp >> 24) & 0xFF;
+                            out[1] = (unsigned char)(temp >> 16) & 0xFF;
+                            out[2] = (unsigned char)(temp >> 8) & 0xFF;
+                    #endif
+                    out += 3;
+                }
+            }
+            break;
+        case paInt16:
+            {
+                int i;
+                PaInt16 *out = (PaInt16*)buffer;
+                for( i=0; i < frameCount; ++i ){
+                    *out = (PaInt16)(.9 * sin( ((double)i/(double)frameCount) * 2. * M_PI ) * 0x7FFF );
+                    out += strideFrames;
+                }
+            }
+            break;
+        case paInt8:
+            {
+                int i;
+                signed char *out = (signed char*)buffer;
+                for( i=0; i < frameCount; ++i ){
+                    *out = (signed char)(.9 * sin( ((double)i/(double)frameCount) * 2. * M_PI ) * 0x7F );
+                    out += strideFrames;
+                }
+            }
+            break;
+        case paUInt8:
+            {
+                int i;
+                unsigned char *out = (unsigned char*)buffer;
+                for( i=0; i < frameCount; ++i ){
+                    *out = (unsigned char)( .5 * (1. + (.9 * sin( ((double)i/(double)frameCount) * 2. * M_PI ))) * 0xFF  );
+                    out += strideFrames;
+                }
+            }
+            break;
+    }
+}
+
+int TestNonZeroPresent( void *buffer, int size )
+{
+    char *p = (char*)buffer;
+    int i;
+
+    for( i=0; i < size; ++i ){
+    
+        if( *p != 0 )
+            return 1;
+        ++p;
+    }   
+
+    return 0;
+}
+
+float MaximumAbsDifference( float* sourceBuffer, float* referenceBuffer, int count )
+{
+    float result = 0;
+    float difference;
+    while( count-- ){
+        difference = fabs( *sourceBuffer++ - *referenceBuffer++ );
+        if( difference > result )
+            result = difference;
+    }
+
+    return result;
+}  
+
+int main( const char **argv, int argc )
+{
+    PaUtilTriangularDitherGenerator ditherState;
+    PaUtilConverter *converter;
+    void *destinationBuffer, *sourceBuffer;
+    double *referenceBuffer;
+    int sourceFormatIndex, destinationFormatIndex;
+    PaSampleFormat sourceFormat, destinationFormat;
+    PaStreamFlags flags;
+    int passFailMatrix[SAMPLE_FORMAT_COUNT][SAMPLE_FORMAT_COUNT]; // [source][destination]
+    float noiseAmplitudeMatrix[SAMPLE_FORMAT_COUNT][SAMPLE_FORMAT_COUNT]; // [source][destination]
+    float amp;
+
+#define FLAG_COMBINATION_COUNT (4)
+    PaStreamFlags flagCombinations[FLAG_COMBINATION_COUNT] = { paNoFlag, paClipOff, paDitherOff, paClipOff | paDitherOff };
+    const char *flagCombinationNames[FLAG_COMBINATION_COUNT] = { "paNoFlag", "paClipOff", "paDitherOff", "paClipOff | paDitherOff" };
+    int flagCombinationIndex;
+
+    PaUtil_InitializeTriangularDitherState( &ditherState );
+
+    /* allocate more than enough space, we use sizeof(float) but we need to fit any 32 bit datum */
+
+    destinationBuffer = (void*)malloc( MAX_PER_CHANNEL_FRAME_COUNT * MAX_CHANNEL_COUNT * sizeof(float) );
+    sourceBuffer = (void*)malloc( MAX_PER_CHANNEL_FRAME_COUNT * MAX_CHANNEL_COUNT * sizeof(float) );
+    referenceBuffer = (void*)malloc( MAX_PER_CHANNEL_FRAME_COUNT * MAX_CHANNEL_COUNT * sizeof(float) );
+
+
+    /* the first round of tests simply iterates through the buffer combinations testing
+        that putting something in gives something out */
+
+    printf( "= Sine wave in, something out =\n" );
+
+    printf( "\n" );
+
+    GenerateOneCycleSine( paFloat32, referenceBuffer, MAX_PER_CHANNEL_FRAME_COUNT, 1 );
+
+    for( flagCombinationIndex = 0; flagCombinationIndex < FLAG_COMBINATION_COUNT; ++flagCombinationIndex ){
+        flags = flagCombinations[flagCombinationIndex];
+
+        printf( "\n" );
+        printf( "== flags = %s ==\n", flagCombinationNames[flagCombinationIndex] );
+
+        for( sourceFormatIndex = 0; sourceFormatIndex < SAMPLE_FORMAT_COUNT; ++sourceFormatIndex ){
+            for( destinationFormatIndex = 0; destinationFormatIndex < SAMPLE_FORMAT_COUNT; ++destinationFormatIndex ){
+                sourceFormat = sampleFormats_[sourceFormatIndex];
+                destinationFormat = sampleFormats_[destinationFormatIndex];
+                //printf( "%s -> %s ", sampleFormatNames_[ sourceFormatIndex ], sampleFormatNames_[ destinationFormatIndex ] );
+
+                converter = PaUtil_SelectConverter( sourceFormat, destinationFormat, flags );
+
+                /* source is a sinewave */
+                GenerateOneCycleSine( sourceFormat, sourceBuffer, MAX_PER_CHANNEL_FRAME_COUNT, 1 );
+
+                /* zero destination */
+                memset( destinationBuffer, 0, MAX_PER_CHANNEL_FRAME_COUNT * My_Pa_GetSampleSize( destinationFormat ) );
+
+                (*converter)( destinationBuffer, 1, sourceBuffer, 1, MAX_PER_CHANNEL_FRAME_COUNT, &ditherState );
+
+    /*
+    Other ways we could test this would be:
+        - pass a constant, check for a constant (wouldn't work with dither)
+        - pass alternating +/-, check for the same...
+    */
+                if( TestNonZeroPresent( destinationBuffer, MAX_PER_CHANNEL_FRAME_COUNT * My_Pa_GetSampleSize( destinationFormat ) ) ){
+                    //printf( "PASSED\n" );
+                    passFailMatrix[sourceFormatIndex][destinationFormatIndex] = 1;
+                }else{
+                    //printf( "FAILED\n" );
+                    passFailMatrix[sourceFormatIndex][destinationFormatIndex] = 0;
+                }
+
+                
+                /* try to measure the noise floor (comparing output signal to a float32 sine wave) */
+
+                if( passFailMatrix[sourceFormatIndex][destinationFormatIndex] ){
+
+                    /* convert destination back to paFloat32 into source */
+                    converter = PaUtil_SelectConverter( destinationFormat, paFloat32, paNoFlag );
+
+                    memset( sourceBuffer, 0, MAX_PER_CHANNEL_FRAME_COUNT * My_Pa_GetSampleSize( paFloat32 ) );
+                    (*converter)( sourceBuffer, 1, destinationBuffer, 1, MAX_PER_CHANNEL_FRAME_COUNT, &ditherState );
+
+                    if( TestNonZeroPresent( sourceBuffer, MAX_PER_CHANNEL_FRAME_COUNT * My_Pa_GetSampleSize( paFloat32 ) ) ){
+    
+                        noiseAmplitudeMatrix[sourceFormatIndex][destinationFormatIndex] = MaximumAbsDifference( (float*)sourceBuffer, (float*)referenceBuffer, MAX_PER_CHANNEL_FRAME_COUNT );
+                        
+                    }else{
+                        /* can't test noise floor because there is no conversion from dest format to float available */
+                        noiseAmplitudeMatrix[sourceFormatIndex][destinationFormatIndex] = -1; // mark as failed
+                    }
+                }else{
+                    noiseAmplitudeMatrix[sourceFormatIndex][destinationFormatIndex] = -1; // mark as failed
+                }
+            }
+        }
+
+        printf( "\n" );
+        printf( "=== Output contains non-zero data ===\n" );
+        printf( "Key: . - pass, X - fail\n" );
+        printf( "{{{\n" ); // trac preformated text tag
+        printf( "in|  out:    " );
+        for( destinationFormatIndex = 0; destinationFormatIndex < SAMPLE_FORMAT_COUNT; ++destinationFormatIndex ){
+            printf( "  %s   ", abbreviatedSampleFormatNames_[destinationFormatIndex] );
+        }
+        printf( "\n" );
+
+        for( sourceFormatIndex = 0; sourceFormatIndex < SAMPLE_FORMAT_COUNT; ++sourceFormatIndex ){
+            printf( "%s         ", abbreviatedSampleFormatNames_[sourceFormatIndex] );
+            for( destinationFormatIndex = 0; destinationFormatIndex < SAMPLE_FORMAT_COUNT; ++destinationFormatIndex ){
+                printf( "   %s   ", (passFailMatrix[sourceFormatIndex][destinationFormatIndex])? " ." : " X" );
+            }
+            printf( "\n" );
+        }
+        printf( "}}}\n" ); // trac preformated text tag
+
+        printf( "\n" );
+        printf( "=== Combined dynamic range (src->dest->float32) ===\n" );
+        printf( "Key: Noise amplitude in dBfs, X - fail (either above failed or dest->float32 failed)\n" );
+        printf( "{{{\n" ); // trac preformated text tag
+        printf( "in|  out:    " );
+        for( destinationFormatIndex = 0; destinationFormatIndex < SAMPLE_FORMAT_COUNT; ++destinationFormatIndex ){
+            printf( "  %s   ", abbreviatedSampleFormatNames_[destinationFormatIndex] );
+        }
+        printf( "\n" );
+
+        for( sourceFormatIndex = 0; sourceFormatIndex < SAMPLE_FORMAT_COUNT; ++sourceFormatIndex ){
+            printf( " %s       ", abbreviatedSampleFormatNames_[sourceFormatIndex] );
+            for( destinationFormatIndex = 0; destinationFormatIndex < SAMPLE_FORMAT_COUNT; ++destinationFormatIndex ){
+                amp = noiseAmplitudeMatrix[sourceFormatIndex][destinationFormatIndex];
+                if( amp < 0. )
+                    printf( "    X   " );
+                else
+                    printf( " % 6.1f ", 20.*log10(amp) );
+            }
+            printf( "\n" );
+        }
+        printf( "}}}\n" ); // trac preformated text tag
+    }
+
+
+    free( destinationBuffer );
+    free( sourceBuffer );
+    free( referenceBuffer );
+}
+
+// copied here for now otherwise we need to include the world just for this function.
+PaError My_Pa_GetSampleSize( PaSampleFormat format )
+{
+    int result;
+
+    switch( format & ~paNonInterleaved )
+    {
+
+    case paUInt8:
+    case paInt8:
+        result = 1;
+        break;
+
+    case paInt16:
+        result = 2;
+        break;
+
+    case paInt24:
+        result = 3;
+        break;
+
+    case paFloat32:
+    case paInt32:
+        result = 4;
+        break;
+
+    default:
+        result = paSampleFormatNotSupported;
+        break;
+    }
+
+    return (PaError) result;
+}
diff --git a/test/patest_dither.c b/test/patest_dither.c
index ac50320..e694c8b 100644
--- a/test/patest_dither.c
+++ b/test/patest_dither.c
@@ -7,7 +7,7 @@
 	@author Phil Burk  http://www.softsynth.com
 */
 /*
- * $Id: patest_dither.c 1368 2008-03-01 00:38:27Z rossb $
+ * $Id$
  *
  * This program uses the PortAudio Portable Audio Library.
  * For more information see: http://www.portaudio.com
diff --git a/test/patest_dsound_find_best_latency_params.c b/test/patest_dsound_find_best_latency_params.c
index d56049d..2c6fc73 100644
--- a/test/patest_dsound_find_best_latency_params.c
+++ b/test/patest_dsound_find_best_latency_params.c
@@ -1,514 +1,514 @@
-/*
- * $Id: $
- * Portable Audio I/O Library
- * Windows DirectSound low level buffer user guided parameters search
- *
- * Copyright (c) 2010-2011 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 <stdio.h>
-#include <time.h>
-#include <math.h>
-
-#define  _WIN32_WINNT 0x0501 /* for GetNativeSystemInfo */ 
-#include <windows.h>
-//#include <mmsystem.h>   /* required when using pa_win_wmme.h */
-
-#include <conio.h>      /* for _getch */
-
-
-#include "portaudio.h"
-#include "pa_win_ds.h"
-
-
-#define DEFAULT_SAMPLE_RATE             (44100.)
-
-#ifndef M_PI
-#define M_PI  (3.14159265)
-#endif
-
-#define TABLE_SIZE              (2048)
-
-#define CHANNEL_COUNT           (2)
-
-
-/*******************************************************************/
-/* functions to query and print Windows version information */
-
-typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL);
-
-LPFN_ISWOW64PROCESS fnIsWow64Process;
-
-static BOOL IsWow64()
-{
-    BOOL bIsWow64 = FALSE;
-
-    //IsWow64Process is not available on all supported versions of Windows.
-    //Use GetModuleHandle to get a handle to the DLL that contains the function
-    //and GetProcAddress to get a pointer to the function if available.
-
-    fnIsWow64Process = (LPFN_ISWOW64PROCESS) GetProcAddress(
-        GetModuleHandle(TEXT("kernel32")),"IsWow64Process" );
-
-    if(NULL != fnIsWow64Process)
-    {
-        if (!fnIsWow64Process(GetCurrentProcess(),&bIsWow64))
-        {
-            //handle error
-        }
-    }
-    return bIsWow64;
-}
-
-static void printWindowsVersionInfo( FILE *fp )
-{
-    OSVERSIONINFOEX osVersionInfoEx;
-    SYSTEM_INFO systemInfo;
-    const char *osName = "Unknown";
-    const char *osProductType = "";
-    const char *processorArchitecture = "Unknown";
-
-    memset( &osVersionInfoEx, 0, sizeof(OSVERSIONINFOEX) );
-    osVersionInfoEx.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
-    GetVersionEx( &osVersionInfoEx );
-
-    
-    if( osVersionInfoEx.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS ){
-        switch( osVersionInfoEx.dwMinorVersion ){
-            case 0: osName = "Windows 95"; break;
-            case 10: osName = "Windows 98"; break;  // could also be 98SE (I've seen code discriminate based 
-                                                    // on osInfo.Version.Revision.ToString() == "2222A")
-            case 90: osName = "Windows Me"; break;
-        }
-    }else if( osVersionInfoEx.dwPlatformId == VER_PLATFORM_WIN32_NT ){
-        switch( osVersionInfoEx.dwMajorVersion ){
-            case 3: osName = "Windows NT 3.51"; break;
-            case 4: osName = "Windows NT 4.0"; break;
-            case 5: switch( osVersionInfoEx.dwMinorVersion ){
-                        case 0: osName = "Windows 2000"; break;
-                        case 1: osName = "Windows XP"; break;
-                        case 2:
-                            if( osVersionInfoEx.wSuiteMask & 0x00008000 /*VER_SUITE_WH_SERVER*/ ){
-                                osName = "Windows Home Server";
-                            }else{
-                                if( osVersionInfoEx.wProductType == VER_NT_WORKSTATION ){
-                                    osName = "Windows XP Professional x64 Edition (?)";
-                                }else{
-                                    if( GetSystemMetrics(/*SM_SERVERR2*/89) == 0 )
-                                        osName = "Windows Server 2003";
-                                    else
-                                        osName = "Windows Server 2003 R2";
-                                }
-                            }break;
-                    }break;
-            case 6:switch( osVersionInfoEx.dwMinorVersion ){
-                        case 0: 
-                            if( osVersionInfoEx.wProductType == VER_NT_WORKSTATION )
-                                osName = "Windows Vista";
-                            else
-                                osName = "Windows Server 2008";
-                            break;
-                        case 1: 
-                            if( osVersionInfoEx.wProductType == VER_NT_WORKSTATION )
-                                osName = "Windows 7";
-                            else
-                                osName = "Windows Server 2008 R2";
-                            break;
-                    }break;
-        }
-    }
-
-    if(osVersionInfoEx.dwMajorVersion == 4)
-    {
-        if(osVersionInfoEx.wProductType == VER_NT_WORKSTATION)
-            osProductType = "Workstation";
-        else if(osVersionInfoEx.wProductType == VER_NT_SERVER)
-            osProductType = "Server";
-    }
-    else if(osVersionInfoEx.dwMajorVersion == 5)
-    {
-        if(osVersionInfoEx.wProductType == VER_NT_WORKSTATION)
-        {
-            if((osVersionInfoEx.wSuiteMask & VER_SUITE_PERSONAL) == VER_SUITE_PERSONAL)
-                osProductType = "Home Edition"; // Windows XP Home Edition
-            else
-                osProductType = "Professional"; // Windows XP / Windows 2000 Professional
-        }
-        else if(osVersionInfoEx.wProductType == VER_NT_SERVER)
-        {
-            if(osVersionInfoEx.dwMinorVersion == 0) 
-            {
-                if((osVersionInfoEx.wSuiteMask & VER_SUITE_DATACENTER) == VER_SUITE_DATACENTER)
-                    osProductType = "Datacenter Server"; // Windows 2000 Datacenter Server
-                else if((osVersionInfoEx.wSuiteMask & VER_SUITE_ENTERPRISE) == VER_SUITE_ENTERPRISE)
-                    osProductType = "Advanced Server"; // Windows 2000 Advanced Server
-                else
-                    osProductType = "Server"; // Windows 2000 Server
-            }
-        }
-        else
-        {
-            if((osVersionInfoEx.wSuiteMask & VER_SUITE_DATACENTER) == VER_SUITE_DATACENTER)
-                osProductType = "Datacenter Edition"; // Windows Server 2003 Datacenter Edition
-            else if((osVersionInfoEx.wSuiteMask & VER_SUITE_ENTERPRISE) == VER_SUITE_ENTERPRISE)
-                osProductType = "Enterprise Edition"; // Windows Server 2003 Enterprise Edition
-            else if((osVersionInfoEx.wSuiteMask & VER_SUITE_BLADE) == VER_SUITE_BLADE)
-                osProductType = "Web Edition"; // Windows Server 2003 Web Edition
-            else
-                osProductType = "Standard Edition"; // Windows Server 2003 Standard Edition
-        }
-    }
-
-    memset( &systemInfo, 0, sizeof(SYSTEM_INFO) );
-    GetNativeSystemInfo( &systemInfo );
-
-    if( systemInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_INTEL )
-        processorArchitecture = "x86";
-    else if( systemInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64 )
-        processorArchitecture = "x64";
-    else if( systemInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_IA64 )
-        processorArchitecture = "Itanium";
-
-
-    fprintf( fp, "OS name and edition: %s %s\n", osName, osProductType );
-    fprintf( fp, "OS version: %d.%d.%d %S\n", 
-                osVersionInfoEx.dwMajorVersion, osVersionInfoEx.dwMinorVersion, 
-                osVersionInfoEx.dwBuildNumber, osVersionInfoEx.szCSDVersion );
-    fprintf( fp, "Processor architecture: %s\n", processorArchitecture );
-    fprintf( fp, "WoW64 process: %s\n", IsWow64() ? "Yes" : "No" );
-}
-
-static void printTimeAndDate( FILE *fp )
-{
-    struct tm *local;
-    time_t t;
-
-    t = time(NULL);
-    local = localtime(&t);
-    fprintf(fp, "Local time and date: %s", asctime(local));
-    local = gmtime(&t);
-    fprintf(fp, "UTC time and date: %s", asctime(local));
-}
-
-/*******************************************************************/
-
-typedef struct
-{
-    float sine[TABLE_SIZE];
-	double phase;
-    double phaseIncrement;
-    volatile int fadeIn;
-    volatile int fadeOut;
-    double amp;
-}
-paTestData;
-
-static paTestData data;
-
-/* 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; i<framesPerBuffer; i++ )
-    {
-        float x = data->sine[(int)data->phase];
-        data->phase += data->phaseIncrement;
-        if( data->phase >= TABLE_SIZE ){
-			data->phase -= TABLE_SIZE;
-		}
-
-        x *= data->amp;
-        if( data->fadeIn ){
-            data->amp += .001;
-            if( data->amp >= 1. )
-                data->fadeIn = 0;
-        }else if( data->fadeOut ){
-            if( data->amp > 0 )
-                data->amp -= .001;
-        }
-
-		for( j = 0; j < CHANNEL_COUNT; ++j ){
-            *out++ = x;
-		}
-	}
-    
-    if( data->amp > 0 )
-        return paContinue;
-    else
-        return paComplete;
-}
-
-
-#define YES     1
-#define NO      0
-
-
-static int playUntilKeyPress( int deviceIndex, float sampleRate, 
-                             int framesPerUserBuffer, int framesPerDSoundBuffer )
-{
-    PaStreamParameters outputParameters;
-    PaWinDirectSoundStreamInfo directSoundStreamInfo;
-    PaStream *stream;
-    PaError err;
-    int c;
-
-    outputParameters.device = deviceIndex;
-    outputParameters.channelCount = CHANNEL_COUNT;
-    outputParameters.sampleFormat = paFloat32; /* 32 bit floating point processing */
-    outputParameters.suggestedLatency = 0; /*Pa_GetDeviceInfo( outputParameters.device )->defaultLowOutputLatency;*/
-    outputParameters.hostApiSpecificStreamInfo = NULL;
-
-    directSoundStreamInfo.size = sizeof(PaWinDirectSoundStreamInfo);
-    directSoundStreamInfo.hostApiType = paDirectSound; 
-    directSoundStreamInfo.version = 2;
-    directSoundStreamInfo.flags = paWinDirectSoundUseLowLevelLatencyParameters;
-    directSoundStreamInfo.framesPerBuffer = framesPerDSoundBuffer;
-    outputParameters.hostApiSpecificStreamInfo = &directSoundStreamInfo;
-
-    err = Pa_OpenStream(
-              &stream,
-              NULL, /* no input */
-              &outputParameters,
-              sampleRate,
-              framesPerUserBuffer,
-              paClipOff | paPrimeOutputBuffersUsingStreamCallback,      /* we won't output out of range samples so don't bother clipping them */
-              patestCallback,
-              &data );
-    if( err != paNoError ) goto error;
-
-    data.amp = 0;
-    data.fadeIn = 1;
-    data.fadeOut = 0;
-    data.phase = 0;
-    data.phaseIncrement = 15 + ((rand()%100) / 10); // randomise pitch
-
-    err = Pa_StartStream( stream );
-    if( err != paNoError ) goto error;
-
-
-    do{
-        printf( "Trying buffer size %d.\nIf it sounds smooth (without clicks or glitches) press 'y', if it sounds bad press 'n' ('q' to quit)\n", framesPerDSoundBuffer );
-        c = tolower(_getch());
-        if( c == 'q' ){
-            Pa_Terminate();
-            exit(0);
-        }
-    }while( c != 'y' && c != 'n' );
-
-    data.fadeOut = 1;
-    while( Pa_IsStreamActive(stream) == 1 )
-        Pa_Sleep( 100 );
-
-    err = Pa_StopStream( stream );
-    if( err != paNoError ) goto error;
-
-    err = Pa_CloseStream( stream );
-    if( err != paNoError ) goto error;
-
-    return (c == 'y') ? YES : NO;
-
-error:
-    return err;
-}
-
-/*******************************************************************/
-static void usage( int dsoundHostApiIndex )
-{
-    int i;
-
-    fprintf( stderr, "PortAudio DirectSound output latency user guided test\n" );
-    fprintf( stderr, "Usage: x.exe dsound-device-index [sampleRate]\n" );
-    fprintf( stderr, "Invalid device index. Use one of these:\n" );
-    for( i=0; i < Pa_GetDeviceCount(); ++i ){
-
-        if( Pa_GetDeviceInfo(i)->hostApi == dsoundHostApiIndex && Pa_GetDeviceInfo(i)->maxOutputChannels > 0  )
-            fprintf( stderr, "%d (%s)\n", i, Pa_GetDeviceInfo(i)->name );
-    }
-    Pa_Terminate();
-    exit(-1);
-}
-
-/*
-    ideas: 
-        o- could be testing with 80% CPU load
-        o- could test with different channel counts
-*/
-
-int main(int argc, char* argv[])
-{
-    PaError err;
-    int i;
-    int deviceIndex;
-    int dsoundBufferSize, smallestWorkingBufferSize;
-    int smallestWorkingBufferingLatencyFrames;
-    int min, max, mid;
-    int testResult;
-    FILE *resultsFp;
-    int dsoundHostApiIndex;
-    const PaHostApiInfo *dsoundHostApiInfo;
-    double sampleRate = DEFAULT_SAMPLE_RATE;
-
-    err = Pa_Initialize();
-    if( err != paNoError ) goto error;
-
-    dsoundHostApiIndex = Pa_HostApiTypeIdToHostApiIndex( paDirectSound );
-    dsoundHostApiInfo = Pa_GetHostApiInfo( dsoundHostApiIndex );
-
-    if( argc > 3 )
-        usage(dsoundHostApiIndex);
-
-	deviceIndex = dsoundHostApiInfo->defaultOutputDevice;
-	if( argc >= 2 ){
-        deviceIndex = -1;
-		if( sscanf( argv[1], "%d", &deviceIndex ) != 1 )
-            usage(dsoundHostApiInfo);
-        if( deviceIndex < 0 || deviceIndex >= Pa_GetDeviceCount() || Pa_GetDeviceInfo(deviceIndex)->hostApi != dsoundHostApiIndex ){
-            usage(dsoundHostApiInfo);
-        }
-	}
-
-    printf( "Using device id %d (%s)\n", deviceIndex, Pa_GetDeviceInfo(deviceIndex)->name );
-
-    if( argc >= 3 ){
-        if( sscanf( argv[2], "%lf", &sampleRate ) != 1 )
-            usage(dsoundHostApiIndex);
-    }
-
-    printf( "Testing with sample rate %f.\n", (float)sampleRate );
-
- 
-
-    /* initialise sinusoidal wavetable */
-    for( i=0; i<TABLE_SIZE; i++ )
-    {
-        data.sine[i] = (float) sin( ((double)i/(double)TABLE_SIZE) * M_PI * 2. );
-    }
-
-	data.phase = 0;
-
-    resultsFp = fopen( "results.txt", "at" );
-    fprintf( resultsFp, "*** DirectSound smallest working output buffer sizes\n" );
-
-    printTimeAndDate( resultsFp );
-    printWindowsVersionInfo( resultsFp );
-    
-    fprintf( resultsFp, "audio device: %s\n", Pa_GetDeviceInfo( deviceIndex )->name );
-    fflush( resultsFp );
-
-    fprintf( resultsFp, "Sample rate: %f\n", (float)sampleRate );
-    fprintf( resultsFp, "Smallest working buffer size (frames), Smallest working buffering latency (frames), Smallest working buffering latency (Seconds)\n" );
-
-
-    /*
-        Binary search after Niklaus Wirth
-        from http://en.wikipedia.org/wiki/Binary_search_algorithm#The_algorithm
-     */
-    min = 1;
-    max = (int)(sampleRate * .3);   /* we assume that this size works 300ms */
-    smallestWorkingBufferSize = 0;
-
-    do{
-        mid = min + ((max - min) / 2);
-
-        dsoundBufferSize = mid;
-        testResult = playUntilKeyPress( deviceIndex, sampleRate, 0, dsoundBufferSize );
-
-        if( testResult == YES ){
-            max = mid - 1;
-            smallestWorkingBufferSize = dsoundBufferSize;
-        }else{
-            min = mid + 1;
-        }
-         
-    }while( (min <= max) && (testResult == YES || testResult == NO) );
-
-    smallestWorkingBufferingLatencyFrames = smallestWorkingBufferSize; /* not strictly true, but we're using an unspecified callback size, so kind of */
-
-    printf( "Smallest working buffer size is: %d\n", smallestWorkingBufferSize );
-    printf( "Corresponding to buffering latency of %d frames, or %f seconds.\n", smallestWorkingBufferingLatencyFrames, smallestWorkingBufferingLatencyFrames / sampleRate );
-
-    fprintf( resultsFp, "%d, %d, %f\n", smallestWorkingBufferSize, smallestWorkingBufferingLatencyFrames, smallestWorkingBufferingLatencyFrames / sampleRate );
-    fflush( resultsFp );
-
-
-    /* power of 2 test. iterate to the smallest power of two that works */
-
-    smallestWorkingBufferSize = 0;
-    dsoundBufferSize = 64;
-
-    do{
-        testResult = playUntilKeyPress( deviceIndex, sampleRate, 0, dsoundBufferSize );
-
-        if( testResult == YES ){
-            smallestWorkingBufferSize = dsoundBufferSize;
-        }else{
-            dsoundBufferSize *= 2;
-        }
-
-    }while( (dsoundBufferSize <= (int)(sampleRate * .3)) && testResult == NO );
-    
-    smallestWorkingBufferingLatencyFrames = smallestWorkingBufferSize; /* not strictly true, but we're using an unspecified callback size, so kind of */
-
-    fprintf( resultsFp, "%d, %d, %f\n", smallestWorkingBufferSize, smallestWorkingBufferingLatencyFrames, smallestWorkingBufferingLatencyFrames / sampleRate );
-    fflush( resultsFp );
-
-
-    fprintf( resultsFp, "###\n" );
-    fclose( resultsFp );
-    
-    Pa_Terminate();
-    printf("Test finished.\n");
-    
-    return err;
-error:
-    Pa_Terminate();
-    fprintf( stderr, "An error occurred while using the PortAudio stream\n" );
-    fprintf( stderr, "Error number: %d\n", err );
-    fprintf( stderr, "Error message: %s\n", Pa_GetErrorText( err ) );
-    return err;
-}
-
+/*
+ * $Id: $
+ * Portable Audio I/O Library
+ * Windows DirectSound low level buffer user guided parameters search
+ *
+ * Copyright (c) 2010-2011 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 <stdio.h>
+#include <time.h>
+#include <math.h>
+
+#define  _WIN32_WINNT 0x0501 /* for GetNativeSystemInfo */ 
+#include <windows.h>
+//#include <mmsystem.h>   /* required when using pa_win_wmme.h */
+
+#include <conio.h>      /* for _getch */
+
+
+#include "portaudio.h"
+#include "pa_win_ds.h"
+
+
+#define DEFAULT_SAMPLE_RATE             (44100.)
+
+#ifndef M_PI
+#define M_PI  (3.14159265)
+#endif
+
+#define TABLE_SIZE              (2048)
+
+#define CHANNEL_COUNT           (2)
+
+
+/*******************************************************************/
+/* functions to query and print Windows version information */
+
+typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL);
+
+LPFN_ISWOW64PROCESS fnIsWow64Process;
+
+static BOOL IsWow64()
+{
+    BOOL bIsWow64 = FALSE;
+
+    //IsWow64Process is not available on all supported versions of Windows.
+    //Use GetModuleHandle to get a handle to the DLL that contains the function
+    //and GetProcAddress to get a pointer to the function if available.
+
+    fnIsWow64Process = (LPFN_ISWOW64PROCESS) GetProcAddress(
+        GetModuleHandle(TEXT("kernel32")),"IsWow64Process" );
+
+    if(NULL != fnIsWow64Process)
+    {
+        if (!fnIsWow64Process(GetCurrentProcess(),&bIsWow64))
+        {
+            //handle error
+        }
+    }
+    return bIsWow64;
+}
+
+static void printWindowsVersionInfo( FILE *fp )
+{
+    OSVERSIONINFOEX osVersionInfoEx;
+    SYSTEM_INFO systemInfo;
+    const char *osName = "Unknown";
+    const char *osProductType = "";
+    const char *processorArchitecture = "Unknown";
+
+    memset( &osVersionInfoEx, 0, sizeof(OSVERSIONINFOEX) );
+    osVersionInfoEx.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
+    GetVersionEx( &osVersionInfoEx );
+
+    
+    if( osVersionInfoEx.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS ){
+        switch( osVersionInfoEx.dwMinorVersion ){
+            case 0: osName = "Windows 95"; break;
+            case 10: osName = "Windows 98"; break;  // could also be 98SE (I've seen code discriminate based 
+                                                    // on osInfo.Version.Revision.ToString() == "2222A")
+            case 90: osName = "Windows Me"; break;
+        }
+    }else if( osVersionInfoEx.dwPlatformId == VER_PLATFORM_WIN32_NT ){
+        switch( osVersionInfoEx.dwMajorVersion ){
+            case 3: osName = "Windows NT 3.51"; break;
+            case 4: osName = "Windows NT 4.0"; break;
+            case 5: switch( osVersionInfoEx.dwMinorVersion ){
+                        case 0: osName = "Windows 2000"; break;
+                        case 1: osName = "Windows XP"; break;
+                        case 2:
+                            if( osVersionInfoEx.wSuiteMask & 0x00008000 /*VER_SUITE_WH_SERVER*/ ){
+                                osName = "Windows Home Server";
+                            }else{
+                                if( osVersionInfoEx.wProductType == VER_NT_WORKSTATION ){
+                                    osName = "Windows XP Professional x64 Edition (?)";
+                                }else{
+                                    if( GetSystemMetrics(/*SM_SERVERR2*/89) == 0 )
+                                        osName = "Windows Server 2003";
+                                    else
+                                        osName = "Windows Server 2003 R2";
+                                }
+                            }break;
+                    }break;
+            case 6:switch( osVersionInfoEx.dwMinorVersion ){
+                        case 0: 
+                            if( osVersionInfoEx.wProductType == VER_NT_WORKSTATION )
+                                osName = "Windows Vista";
+                            else
+                                osName = "Windows Server 2008";
+                            break;
+                        case 1: 
+                            if( osVersionInfoEx.wProductType == VER_NT_WORKSTATION )
+                                osName = "Windows 7";
+                            else
+                                osName = "Windows Server 2008 R2";
+                            break;
+                    }break;
+        }
+    }
+
+    if(osVersionInfoEx.dwMajorVersion == 4)
+    {
+        if(osVersionInfoEx.wProductType == VER_NT_WORKSTATION)
+            osProductType = "Workstation";
+        else if(osVersionInfoEx.wProductType == VER_NT_SERVER)
+            osProductType = "Server";
+    }
+    else if(osVersionInfoEx.dwMajorVersion == 5)
+    {
+        if(osVersionInfoEx.wProductType == VER_NT_WORKSTATION)
+        {
+            if((osVersionInfoEx.wSuiteMask & VER_SUITE_PERSONAL) == VER_SUITE_PERSONAL)
+                osProductType = "Home Edition"; // Windows XP Home Edition
+            else
+                osProductType = "Professional"; // Windows XP / Windows 2000 Professional
+        }
+        else if(osVersionInfoEx.wProductType == VER_NT_SERVER)
+        {
+            if(osVersionInfoEx.dwMinorVersion == 0) 
+            {
+                if((osVersionInfoEx.wSuiteMask & VER_SUITE_DATACENTER) == VER_SUITE_DATACENTER)
+                    osProductType = "Datacenter Server"; // Windows 2000 Datacenter Server
+                else if((osVersionInfoEx.wSuiteMask & VER_SUITE_ENTERPRISE) == VER_SUITE_ENTERPRISE)
+                    osProductType = "Advanced Server"; // Windows 2000 Advanced Server
+                else
+                    osProductType = "Server"; // Windows 2000 Server
+            }
+        }
+        else
+        {
+            if((osVersionInfoEx.wSuiteMask & VER_SUITE_DATACENTER) == VER_SUITE_DATACENTER)
+                osProductType = "Datacenter Edition"; // Windows Server 2003 Datacenter Edition
+            else if((osVersionInfoEx.wSuiteMask & VER_SUITE_ENTERPRISE) == VER_SUITE_ENTERPRISE)
+                osProductType = "Enterprise Edition"; // Windows Server 2003 Enterprise Edition
+            else if((osVersionInfoEx.wSuiteMask & VER_SUITE_BLADE) == VER_SUITE_BLADE)
+                osProductType = "Web Edition"; // Windows Server 2003 Web Edition
+            else
+                osProductType = "Standard Edition"; // Windows Server 2003 Standard Edition
+        }
+    }
+
+    memset( &systemInfo, 0, sizeof(SYSTEM_INFO) );
+    GetNativeSystemInfo( &systemInfo );
+
+    if( systemInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_INTEL )
+        processorArchitecture = "x86";
+    else if( systemInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64 )
+        processorArchitecture = "x64";
+    else if( systemInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_IA64 )
+        processorArchitecture = "Itanium";
+
+
+    fprintf( fp, "OS name and edition: %s %s\n", osName, osProductType );
+    fprintf( fp, "OS version: %d.%d.%d %S\n", 
+                osVersionInfoEx.dwMajorVersion, osVersionInfoEx.dwMinorVersion, 
+                osVersionInfoEx.dwBuildNumber, osVersionInfoEx.szCSDVersion );
+    fprintf( fp, "Processor architecture: %s\n", processorArchitecture );
+    fprintf( fp, "WoW64 process: %s\n", IsWow64() ? "Yes" : "No" );
+}
+
+static void printTimeAndDate( FILE *fp )
+{
+    struct tm *local;
+    time_t t;
+
+    t = time(NULL);
+    local = localtime(&t);
+    fprintf(fp, "Local time and date: %s", asctime(local));
+    local = gmtime(&t);
+    fprintf(fp, "UTC time and date: %s", asctime(local));
+}
+
+/*******************************************************************/
+
+typedef struct
+{
+    float sine[TABLE_SIZE];
+	double phase;
+    double phaseIncrement;
+    volatile int fadeIn;
+    volatile int fadeOut;
+    double amp;
+}
+paTestData;
+
+static paTestData data;
+
+/* 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; i<framesPerBuffer; i++ )
+    {
+        float x = data->sine[(int)data->phase];
+        data->phase += data->phaseIncrement;
+        if( data->phase >= TABLE_SIZE ){
+			data->phase -= TABLE_SIZE;
+		}
+
+        x *= data->amp;
+        if( data->fadeIn ){
+            data->amp += .001;
+            if( data->amp >= 1. )
+                data->fadeIn = 0;
+        }else if( data->fadeOut ){
+            if( data->amp > 0 )
+                data->amp -= .001;
+        }
+
+		for( j = 0; j < CHANNEL_COUNT; ++j ){
+            *out++ = x;
+		}
+	}
+    
+    if( data->amp > 0 )
+        return paContinue;
+    else
+        return paComplete;
+}
+
+
+#define YES     1
+#define NO      0
+
+
+static int playUntilKeyPress( int deviceIndex, float sampleRate, 
+                             int framesPerUserBuffer, int framesPerDSoundBuffer )
+{
+    PaStreamParameters outputParameters;
+    PaWinDirectSoundStreamInfo directSoundStreamInfo;
+    PaStream *stream;
+    PaError err;
+    int c;
+
+    outputParameters.device = deviceIndex;
+    outputParameters.channelCount = CHANNEL_COUNT;
+    outputParameters.sampleFormat = paFloat32; /* 32 bit floating point processing */
+    outputParameters.suggestedLatency = 0; /*Pa_GetDeviceInfo( outputParameters.device )->defaultLowOutputLatency;*/
+    outputParameters.hostApiSpecificStreamInfo = NULL;
+
+    directSoundStreamInfo.size = sizeof(PaWinDirectSoundStreamInfo);
+    directSoundStreamInfo.hostApiType = paDirectSound; 
+    directSoundStreamInfo.version = 2;
+    directSoundStreamInfo.flags = paWinDirectSoundUseLowLevelLatencyParameters;
+    directSoundStreamInfo.framesPerBuffer = framesPerDSoundBuffer;
+    outputParameters.hostApiSpecificStreamInfo = &directSoundStreamInfo;
+
+    err = Pa_OpenStream(
+              &stream,
+              NULL, /* no input */
+              &outputParameters,
+              sampleRate,
+              framesPerUserBuffer,
+              paClipOff | paPrimeOutputBuffersUsingStreamCallback,      /* we won't output out of range samples so don't bother clipping them */
+              patestCallback,
+              &data );
+    if( err != paNoError ) goto error;
+
+    data.amp = 0;
+    data.fadeIn = 1;
+    data.fadeOut = 0;
+    data.phase = 0;
+    data.phaseIncrement = 15 + ((rand()%100) / 10); // randomise pitch
+
+    err = Pa_StartStream( stream );
+    if( err != paNoError ) goto error;
+
+
+    do{
+        printf( "Trying buffer size %d.\nIf it sounds smooth (without clicks or glitches) press 'y', if it sounds bad press 'n' ('q' to quit)\n", framesPerDSoundBuffer );
+        c = tolower(_getch());
+        if( c == 'q' ){
+            Pa_Terminate();
+            exit(0);
+        }
+    }while( c != 'y' && c != 'n' );
+
+    data.fadeOut = 1;
+    while( Pa_IsStreamActive(stream) == 1 )
+        Pa_Sleep( 100 );
+
+    err = Pa_StopStream( stream );
+    if( err != paNoError ) goto error;
+
+    err = Pa_CloseStream( stream );
+    if( err != paNoError ) goto error;
+
+    return (c == 'y') ? YES : NO;
+
+error:
+    return err;
+}
+
+/*******************************************************************/
+static void usage( int dsoundHostApiIndex )
+{
+    int i;
+
+    fprintf( stderr, "PortAudio DirectSound output latency user guided test\n" );
+    fprintf( stderr, "Usage: x.exe dsound-device-index [sampleRate]\n" );
+    fprintf( stderr, "Invalid device index. Use one of these:\n" );
+    for( i=0; i < Pa_GetDeviceCount(); ++i ){
+
+        if( Pa_GetDeviceInfo(i)->hostApi == dsoundHostApiIndex && Pa_GetDeviceInfo(i)->maxOutputChannels > 0  )
+            fprintf( stderr, "%d (%s)\n", i, Pa_GetDeviceInfo(i)->name );
+    }
+    Pa_Terminate();
+    exit(-1);
+}
+
+/*
+    ideas: 
+        o- could be testing with 80% CPU load
+        o- could test with different channel counts
+*/
+
+int main(int argc, char* argv[])
+{
+    PaError err;
+    int i;
+    int deviceIndex;
+    int dsoundBufferSize, smallestWorkingBufferSize;
+    int smallestWorkingBufferingLatencyFrames;
+    int min, max, mid;
+    int testResult;
+    FILE *resultsFp;
+    int dsoundHostApiIndex;
+    const PaHostApiInfo *dsoundHostApiInfo;
+    double sampleRate = DEFAULT_SAMPLE_RATE;
+
+    err = Pa_Initialize();
+    if( err != paNoError ) goto error;
+
+    dsoundHostApiIndex = Pa_HostApiTypeIdToHostApiIndex( paDirectSound );
+    dsoundHostApiInfo = Pa_GetHostApiInfo( dsoundHostApiIndex );
+
+    if( argc > 3 )
+        usage(dsoundHostApiIndex);
+
+	deviceIndex = dsoundHostApiInfo->defaultOutputDevice;
+	if( argc >= 2 ){
+        deviceIndex = -1;
+		if( sscanf( argv[1], "%d", &deviceIndex ) != 1 )
+            usage(dsoundHostApiInfo);
+        if( deviceIndex < 0 || deviceIndex >= Pa_GetDeviceCount() || Pa_GetDeviceInfo(deviceIndex)->hostApi != dsoundHostApiIndex ){
+            usage(dsoundHostApiInfo);
+        }
+	}
+
+    printf( "Using device id %d (%s)\n", deviceIndex, Pa_GetDeviceInfo(deviceIndex)->name );
+
+    if( argc >= 3 ){
+        if( sscanf( argv[2], "%lf", &sampleRate ) != 1 )
+            usage(dsoundHostApiIndex);
+    }
+
+    printf( "Testing with sample rate %f.\n", (float)sampleRate );
+
+ 
+
+    /* initialise sinusoidal wavetable */
+    for( i=0; i<TABLE_SIZE; i++ )
+    {
+        data.sine[i] = (float) sin( ((double)i/(double)TABLE_SIZE) * M_PI * 2. );
+    }
+
+	data.phase = 0;
+
+    resultsFp = fopen( "results.txt", "at" );
+    fprintf( resultsFp, "*** DirectSound smallest working output buffer sizes\n" );
+
+    printTimeAndDate( resultsFp );
+    printWindowsVersionInfo( resultsFp );
+    
+    fprintf( resultsFp, "audio device: %s\n", Pa_GetDeviceInfo( deviceIndex )->name );
+    fflush( resultsFp );
+
+    fprintf( resultsFp, "Sample rate: %f\n", (float)sampleRate );
+    fprintf( resultsFp, "Smallest working buffer size (frames), Smallest working buffering latency (frames), Smallest working buffering latency (Seconds)\n" );
+
+
+    /*
+        Binary search after Niklaus Wirth
+        from http://en.wikipedia.org/wiki/Binary_search_algorithm#The_algorithm
+     */
+    min = 1;
+    max = (int)(sampleRate * .3);   /* we assume that this size works 300ms */
+    smallestWorkingBufferSize = 0;
+
+    do{
+        mid = min + ((max - min) / 2);
+
+        dsoundBufferSize = mid;
+        testResult = playUntilKeyPress( deviceIndex, sampleRate, 0, dsoundBufferSize );
+
+        if( testResult == YES ){
+            max = mid - 1;
+            smallestWorkingBufferSize = dsoundBufferSize;
+        }else{
+            min = mid + 1;
+        }
+         
+    }while( (min <= max) && (testResult == YES || testResult == NO) );
+
+    smallestWorkingBufferingLatencyFrames = smallestWorkingBufferSize; /* not strictly true, but we're using an unspecified callback size, so kind of */
+
+    printf( "Smallest working buffer size is: %d\n", smallestWorkingBufferSize );
+    printf( "Corresponding to buffering latency of %d frames, or %f seconds.\n", smallestWorkingBufferingLatencyFrames, smallestWorkingBufferingLatencyFrames / sampleRate );
+
+    fprintf( resultsFp, "%d, %d, %f\n", smallestWorkingBufferSize, smallestWorkingBufferingLatencyFrames, smallestWorkingBufferingLatencyFrames / sampleRate );
+    fflush( resultsFp );
+
+
+    /* power of 2 test. iterate to the smallest power of two that works */
+
+    smallestWorkingBufferSize = 0;
+    dsoundBufferSize = 64;
+
+    do{
+        testResult = playUntilKeyPress( deviceIndex, sampleRate, 0, dsoundBufferSize );
+
+        if( testResult == YES ){
+            smallestWorkingBufferSize = dsoundBufferSize;
+        }else{
+            dsoundBufferSize *= 2;
+        }
+
+    }while( (dsoundBufferSize <= (int)(sampleRate * .3)) && testResult == NO );
+    
+    smallestWorkingBufferingLatencyFrames = smallestWorkingBufferSize; /* not strictly true, but we're using an unspecified callback size, so kind of */
+
+    fprintf( resultsFp, "%d, %d, %f\n", smallestWorkingBufferSize, smallestWorkingBufferingLatencyFrames, smallestWorkingBufferingLatencyFrames / sampleRate );
+    fflush( resultsFp );
+
+
+    fprintf( resultsFp, "###\n" );
+    fclose( resultsFp );
+    
+    Pa_Terminate();
+    printf("Test finished.\n");
+    
+    return err;
+error:
+    Pa_Terminate();
+    fprintf( stderr, "An error occurred 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/test/patest_dsound_low_level_latency_params.c b/test/patest_dsound_low_level_latency_params.c
index 24e2066..a1e7c7e 100644
--- a/test/patest_dsound_low_level_latency_params.c
+++ b/test/patest_dsound_low_level_latency_params.c
@@ -1,187 +1,187 @@
-/*
- * $Id: $
- * Portable Audio I/O Library
- * Windows DirectSound low level buffer parameters test
- *
- * Copyright (c) 2011 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 <stdio.h>
-#include <math.h>
-
-#include "portaudio.h"
-#include "pa_win_ds.h"
-
-#define NUM_SECONDS         (6)
-#define SAMPLE_RATE         (44100)
-
-#define DSOUND_FRAMES_PER_HOST_BUFFER  (256*2) //(440*10)
-
-#define FRAMES_PER_BUFFER   256
-
-#ifndef M_PI
-#define M_PI  (3.14159265)
-#endif
-
-#define TABLE_SIZE          (2048)
-
-#define CHANNEL_COUNT       (2)
-
-
-typedef struct
-{
-    float sine[TABLE_SIZE];
-	double 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 )
-{
-    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; i<framesPerBuffer; i++ )
-    {
-        float x = data->sine[(int)data->phase];
-        data->phase += 20;
-        if( data->phase >= TABLE_SIZE ){
-			data->phase -= TABLE_SIZE;
-		}
-
-		for( j = 0; j < CHANNEL_COUNT; ++j ){
-            *out++ = x;
-		}
-	}
-    
-    return paContinue;
-}
-
-/*******************************************************************/
-int main(int argc, char* argv[])
-{
-    PaStreamParameters outputParameters;
-    PaWinDirectSoundStreamInfo dsoundStreamInfo;
-    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( paDirectSound ) )->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; i<TABLE_SIZE; i++ )
-    {
-        data.sine[i] = (float) sin( ((double)i/(double)TABLE_SIZE) * M_PI * 2. );
-    }
-
-	data.phase = 0;
-
-    outputParameters.device = deviceIndex;
-    outputParameters.channelCount = CHANNEL_COUNT;
-    outputParameters.sampleFormat = paFloat32; /* 32 bit floating point processing */
-    outputParameters.suggestedLatency = 0; /*Pa_GetDeviceInfo( outputParameters.device )->defaultLowOutputLatency;*/
-    outputParameters.hostApiSpecificStreamInfo = NULL;
-
-    dsoundStreamInfo.size = sizeof(PaWinDirectSoundStreamInfo);
-    dsoundStreamInfo.hostApiType = paDirectSound; 
-    dsoundStreamInfo.version = 2;
-    dsoundStreamInfo.flags = paWinDirectSoundUseLowLevelLatencyParameters;
-    dsoundStreamInfo.framesPerBuffer = DSOUND_FRAMES_PER_HOST_BUFFER;
-    outputParameters.hostApiSpecificStreamInfo = &dsoundStreamInfo;
-   
-
-	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;
-}
-
+/*
+ * $Id: $
+ * Portable Audio I/O Library
+ * Windows DirectSound low level buffer parameters test
+ *
+ * Copyright (c) 2011 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 <stdio.h>
+#include <math.h>
+
+#include "portaudio.h"
+#include "pa_win_ds.h"
+
+#define NUM_SECONDS         (6)
+#define SAMPLE_RATE         (44100)
+
+#define DSOUND_FRAMES_PER_HOST_BUFFER  (256*2) //(440*10)
+
+#define FRAMES_PER_BUFFER   256
+
+#ifndef M_PI
+#define M_PI  (3.14159265)
+#endif
+
+#define TABLE_SIZE          (2048)
+
+#define CHANNEL_COUNT       (2)
+
+
+typedef struct
+{
+    float sine[TABLE_SIZE];
+	double 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 )
+{
+    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; i<framesPerBuffer; i++ )
+    {
+        float x = data->sine[(int)data->phase];
+        data->phase += 20;
+        if( data->phase >= TABLE_SIZE ){
+			data->phase -= TABLE_SIZE;
+		}
+
+		for( j = 0; j < CHANNEL_COUNT; ++j ){
+            *out++ = x;
+		}
+	}
+    
+    return paContinue;
+}
+
+/*******************************************************************/
+int main(int argc, char* argv[])
+{
+    PaStreamParameters outputParameters;
+    PaWinDirectSoundStreamInfo dsoundStreamInfo;
+    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( paDirectSound ) )->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; i<TABLE_SIZE; i++ )
+    {
+        data.sine[i] = (float) sin( ((double)i/(double)TABLE_SIZE) * M_PI * 2. );
+    }
+
+	data.phase = 0;
+
+    outputParameters.device = deviceIndex;
+    outputParameters.channelCount = CHANNEL_COUNT;
+    outputParameters.sampleFormat = paFloat32; /* 32 bit floating point processing */
+    outputParameters.suggestedLatency = 0; /*Pa_GetDeviceInfo( outputParameters.device )->defaultLowOutputLatency;*/
+    outputParameters.hostApiSpecificStreamInfo = NULL;
+
+    dsoundStreamInfo.size = sizeof(PaWinDirectSoundStreamInfo);
+    dsoundStreamInfo.hostApiType = paDirectSound; 
+    dsoundStreamInfo.version = 2;
+    dsoundStreamInfo.flags = paWinDirectSoundUseLowLevelLatencyParameters;
+    dsoundStreamInfo.framesPerBuffer = DSOUND_FRAMES_PER_HOST_BUFFER;
+    outputParameters.hostApiSpecificStreamInfo = &dsoundStreamInfo;
+   
+
+	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/test/patest_dsound_surround.c b/test/patest_dsound_surround.c
index 4536529..3ffd151 100644
--- a/test/patest_dsound_surround.c
+++ b/test/patest_dsound_surround.c
@@ -1,205 +1,205 @@
-/*
- * $Id: $
- * Portable Audio I/O Library
- * Windows DirectSound 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 <stdio.h>
-#include <math.h>
-
-#include <windows.h>    /* required when using pa_win_wmme.h */
-#include <mmsystem.h>   /* required when using pa_win_wmme.h */
-
-#include "portaudio.h"
-#include "pa_win_ds.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; i<framesPerBuffer; i++ )
-    {
-		for( j = 0; j < CHANNEL_COUNT; ++j ){
-			if( j == data->currentChannel && 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;
-    PaWinDirectSoundStreamInfo directSoundStreamInfo;
-    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( paDirectSound ) )->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; i<TABLE_SIZE; i++ )
-    {
-        data.sine[i] = (float) sin( ((double)i/(double)TABLE_SIZE) * M_PI * 2. );
-    }
-
-	data.phase = 0;
-	data.currentChannel = 0;
-	data.cycleCount = 0;
-
-    outputParameters.device = deviceIndex;
-    outputParameters.channelCount = CHANNEL_COUNT;
-    outputParameters.sampleFormat = paFloat32; /* 32 bit floating point processing */
-    outputParameters.suggestedLatency = Pa_GetDeviceInfo( outputParameters.device )->defaultLowOutputLatency;
-    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 */
-    directSoundStreamInfo.size = sizeof(PaWinDirectSoundStreamInfo);
-    directSoundStreamInfo.hostApiType = paDirectSound; 
-    directSoundStreamInfo.version = 1;
-    directSoundStreamInfo.flags = paWinDirectSoundUseChannelMask;
-    directSoundStreamInfo.channelMask = PAWIN_SPEAKER_5POINT1; /* request 5.1 output format */
-    outputParameters.hostApiSpecificStreamInfo = &directSoundStreamInfo;
-
-	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;
-}
-
+/*
+ * $Id: $
+ * Portable Audio I/O Library
+ * Windows DirectSound 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 <stdio.h>
+#include <math.h>
+
+#include <windows.h>    /* required when using pa_win_wmme.h */
+#include <mmsystem.h>   /* required when using pa_win_wmme.h */
+
+#include "portaudio.h"
+#include "pa_win_ds.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; i<framesPerBuffer; i++ )
+    {
+		for( j = 0; j < CHANNEL_COUNT; ++j ){
+			if( j == data->currentChannel && 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;
+    PaWinDirectSoundStreamInfo directSoundStreamInfo;
+    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( paDirectSound ) )->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; i<TABLE_SIZE; i++ )
+    {
+        data.sine[i] = (float) sin( ((double)i/(double)TABLE_SIZE) * M_PI * 2. );
+    }
+
+	data.phase = 0;
+	data.currentChannel = 0;
+	data.cycleCount = 0;
+
+    outputParameters.device = deviceIndex;
+    outputParameters.channelCount = CHANNEL_COUNT;
+    outputParameters.sampleFormat = paFloat32; /* 32 bit floating point processing */
+    outputParameters.suggestedLatency = Pa_GetDeviceInfo( outputParameters.device )->defaultLowOutputLatency;
+    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 */
+    directSoundStreamInfo.size = sizeof(PaWinDirectSoundStreamInfo);
+    directSoundStreamInfo.hostApiType = paDirectSound; 
+    directSoundStreamInfo.version = 1;
+    directSoundStreamInfo.flags = paWinDirectSoundUseChannelMask;
+    directSoundStreamInfo.channelMask = PAWIN_SPEAKER_5POINT1; /* request 5.1 output format */
+    outputParameters.hostApiSpecificStreamInfo = &directSoundStreamInfo;
+
+	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/test/patest_hang.c b/test/patest_hang.c
index fd2cda3..6bda629 100644
--- a/test/patest_hang.c
+++ b/test/patest_hang.c
@@ -5,7 +5,7 @@
 	@author Phil Burk <philburk at softsynth.com>
 */
 /*
- * $Id: patest_hang.c 1368 2008-03-01 00:38:27Z rossb $
+ * $Id$
  *
  * This program uses the PortAudio Portable Audio Library.
  * For more information see: http://www.portaudio.com
diff --git a/test/patest_in_overflow.c b/test/patest_in_overflow.c
index 9904d2c..1f2a837 100644
--- a/test/patest_in_overflow.c
+++ b/test/patest_in_overflow.c
@@ -11,7 +11,7 @@
 	@author Phil Burk <philburk at softsynth.com>
 */
 /*
- * $Id: patest_in_overflow.c 1368 2008-03-01 00:38:27Z rossb $
+ * $Id$
  *
  * This program uses the PortAudio Portable Audio Library.
  * For more information see: http://www.portaudio.com
diff --git a/test/patest_jack_wasapi.c b/test/patest_jack_wasapi.c
index fed1b05..f01297a 100644
--- a/test/patest_jack_wasapi.c
+++ b/test/patest_jack_wasapi.c
@@ -1,343 +1,343 @@
-/** @file pa_test_jack_wasapi.c
-	@ingroup test_src
-	@brief Print out jack information for WASAPI endpoints
-	@author Reid Bishop <rbish at attglobal.net>
-*/
-/*
- * $Id: pa_test_jack_wasapi.c 1368 2008-03-01 00:38:27Z rbishop $
- *
- * This program uses the PortAudio Portable Audio Library.
- * For more information see: http://www.portaudio.com/
- * Copyright (c) 1999-2010 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 <stdio.h>
-#include "portaudio.h"
-#include "pa_win_wasapi.h"
-
-
-/*
-* Helper function to determine if a given enum is present in mask variable
-*
-*/
-static int IsInMask(int val, int val2)
-{
-	return ((val & val2) == val2);
-}
-
-/*
-* This routine enumerates through the ChannelMapping for the IJackDescription
-*/
-
-static void EnumIJackChannels(int channelMapping)
-{
-	printf("Channel Mapping: ");
-	if(channelMapping == PAWIN_SPEAKER_DIRECTOUT)
-	{
-		printf("DIRECTOUT\n");
-		return;
-	}
-	if(IsInMask(channelMapping, PAWIN_SPEAKER_FRONT_LEFT))
-		printf("FRONT_LEFT, ");
-	if(IsInMask(channelMapping, PAWIN_SPEAKER_FRONT_RIGHT))
-		printf("FRONT_RIGHT, ");
-	if(IsInMask(channelMapping, PAWIN_SPEAKER_FRONT_CENTER))
-		printf("FRONT_CENTER, ");
-	if(IsInMask(channelMapping, PAWIN_SPEAKER_LOW_FREQUENCY))
-		printf("LOW_FREQUENCY, ");
-	if(IsInMask(channelMapping, PAWIN_SPEAKER_BACK_LEFT))
-		printf("BACK_LEFT, ");
-	if(IsInMask(channelMapping,PAWIN_SPEAKER_BACK_RIGHT))
-		printf("BACK_RIGHT, ");
-	if(IsInMask(channelMapping, PAWIN_SPEAKER_FRONT_LEFT_OF_CENTER))
-		printf("FRONT_LEFT_OF_CENTER, ");
-	if(IsInMask(channelMapping, PAWIN_SPEAKER_FRONT_RIGHT_OF_CENTER))
-		printf("FRONT_RIGHT_OF_CENTER, ");
-	if(IsInMask(channelMapping, PAWIN_SPEAKER_BACK_CENTER))
-		printf("BACK_CENTER, ");
-	if(IsInMask(channelMapping,PAWIN_SPEAKER_SIDE_LEFT))
-		printf("SIDE_LEFT, ");
-	if(IsInMask(channelMapping,PAWIN_SPEAKER_SIDE_RIGHT))
-		printf("SIDE_RIGHT, ");
-	if(IsInMask(channelMapping, PAWIN_SPEAKER_TOP_CENTER))
-		printf("TOP_CENTER, ");
-	if(IsInMask(channelMapping, PAWIN_SPEAKER_TOP_FRONT_LEFT))
-		printf("TOP_FRONT_LEFT, ");
-	if(IsInMask(channelMapping, PAWIN_SPEAKER_TOP_FRONT_CENTER))
-		printf("TOP_FRONT_CENTER, ");
-	if(IsInMask(channelMapping, PAWIN_SPEAKER_TOP_FRONT_RIGHT))
-		printf("TOP_FRONT_RIGHT, ");
-	if(IsInMask(channelMapping, PAWIN_SPEAKER_TOP_BACK_LEFT))
-		printf("TOP_BACK_LEFT, ");
-	if(IsInMask(channelMapping, PAWIN_SPEAKER_TOP_BACK_CENTER))
-		printf("TOP_BACK_CENTER, ");
-	if(IsInMask(channelMapping, PAWIN_SPEAKER_TOP_BACK_RIGHT))
-		printf("TOP_BACK_RIGHT, ");
-
-	printf("\n");
-}
-
-/*
-* This routine enumerates through the Jack Connection Types enums for IJackDescription
-*/
-static void EnumIJackConnectionType(int cType)
-{
-	printf("Connection Type: ");
-	switch(cType)
-	{
-		case eJackConnTypeUnknown:
-			printf("eJackConnTypeUnknown");
-			break;
-		case eJackConnType3Point5mm:
-			printf("eJackConnType3Point5mm");
-			break;
-		case eJackConnTypeQuarter:
-			printf("eJackConnTypeQuarter");
-			break;
-		case eJackConnTypeAtapiInternal:
-			printf("eJackConnTypeAtapiInternal");
-			break;
-		case eJackConnTypeRCA:
-			printf("eJackConnTypeRCA");
-			break;
-		case eJackConnTypeOptical:
-			printf("eJackConnTypeOptical");
-			break;
-		case eJackConnTypeOtherDigital:
-			printf("eJackConnTypeOtherDigital");
-			break;
-		case eJackConnTypeOtherAnalog:
-			printf("eJackConnTypeOtherAnalog");
-			break;
-		case eJackConnTypeMultichannelAnalogDIN:
-			printf("eJackConnTypeMultichannelAnalogDIN");
-			break;
-		case eJackConnTypeXlrProfessional:
-			printf("eJackConnTypeXlrProfessional");
-			break;
-		case eJackConnTypeRJ11Modem:
-			printf("eJackConnTypeRJ11Modem");
-			break;
-		case eJackConnTypeCombination:
-			printf("eJackConnTypeCombination");
-			break;
-	}
-	printf("\n");
-}
-
-/*
-* This routine enumerates through the GeoLocation enums for the IJackDescription
-*/
-static void EnumIJackGeoLocation(int iVal)
-{
-	printf("Geometric Location: ");
-	switch(iVal)
-	{
-	case eJackGeoLocRear:
-		printf("eJackGeoLocRear");
-		break;
-	case eJackGeoLocFront:
-		printf("eJackGeoLocFront");
-		break;
-	case eJackGeoLocLeft:
-		printf("eJackGeoLocLeft");
-		break;
-	case eJackGeoLocRight:
-		printf("eJackGeoLocRight");
-		break;
-	case eJackGeoLocTop:
-		printf("eJackGeoLocTop");
-		break;
-	case eJackGeoLocBottom:
-		printf("eJackGeoLocBottom");
-		break;
-	case eJackGeoLocRearPanel:
-		printf("eJackGeoLocRearPanel");
-		break;
-	case eJackGeoLocRiser:
-		printf("eJackGeoLocRiser");
-		break;
-	case eJackGeoLocInsideMobileLid:
-		printf("eJackGeoLocInsideMobileLid");
-		break;
-	case eJackGeoLocDrivebay:
-		printf("eJackGeoLocDrivebay");
-		break;
-	case eJackGeoLocHDMI:
-		printf("eJackGeoLocHDMI");
-		break;
-	case eJackGeoLocOutsideMobileLid:
-		printf("eJackGeoLocOutsideMobileLid");
-		break;
-	case eJackGeoLocATAPI:
-		printf("eJackGeoLocATAPI");
-		break;
-	}
-	printf("\n");
-}
-
-/*
-* This routine enumerates through the GenLocation enums for the IJackDescription
-*/
-static void EnumIJackGenLocation(int iVal)
-{
-	printf("General Location: ");
-	switch(iVal)
-	{
-		case eJackGenLocPrimaryBox:
-			printf("eJackGenLocPrimaryBox");
-			break;
-		case eJackGenLocInternal:
-			printf("eJackGenLocInternal");
-			break;
-		case eJackGenLocSeparate:
-			printf("eJackGenLocSeparate");
-			break;
-		case eJackGenLocOther:
-			printf("eJackGenLocOther");
-			break;
-	}
-	printf("\n");
-}
-
-/*
-* This routine enumerates through the PortConnection enums for the IJackDescription
-*/
-static void EnumIJackPortConnection(int iVal)
-{
-	printf("Port Type: ");
-	switch(iVal)
-	{
-		case eJackPortConnJack:
-			printf("eJackPortConnJack");
-			break;
-		case eJackPortConnIntegratedDevice:
-			printf("eJackPortConnIntegratedDevice");
-			break;
-		case eJackPortConnBothIntegratedAndJack:
-			printf("eJackPortConnBothIntegratedAndJack");
-			break;
-		case eJackPortConnUnknown:
-			printf("eJackPortConnUnknown");
-			break;
-	}
-	printf("\n");
-}
-
-/*
-* This routine retrieves and parses the KSJACK_DESCRIPTION structure for
-* the provided device ID.
-*/
-static PaError GetJackInformation(int deviceId)
-{
-    PaError err;
-	int i;
-	int jackCount = 0;
-	PaWasapiJackDescription jackDesc;
-
-	err = PaWasapi_GetJackCount(deviceId, &jackCount);
-	if( err != paNoError ) return err;
-
-	fprintf( stderr,"Number of Jacks: %d \n", jackCount );
-
-	for( i = 0; i<jackCount; i++ )
-	{
-		fprintf( stderr,"Jack #%d:\n", i );
-
-		err = PaWasapi_GetJackDescription(deviceId, i, &jackDesc);
-		if( err != paNoError ) 
-		{
-			fprintf( stderr,"Failed getting description." );
-			continue;
-		}
-		else
-		{
-			printf("Is connected: %s\n",(jackDesc.isConnected)?"true":"false");
-			EnumIJackChannels(jackDesc.channelMapping);
-			EnumIJackConnectionType(jackDesc.connectionType);
-			EnumIJackGeoLocation(jackDesc.geoLocation);
-			EnumIJackGenLocation(jackDesc.genLocation);
-			EnumIJackPortConnection(jackDesc.portConnection);
-			printf("Jack Color: 0x%06X\n", jackDesc.color);
-			printf("\n");
-		}
-	}
-	return 0;
-}
-
-
-/*******************************************************************/
-int main(void);
-int main(void)
-{
-    PaError err;
-	const PaDeviceInfo *device;
-    int i;
-	int jackCount = 0;
-	int isInput = 0;
-
-	printf("PortAudio Test: WASAPI Jack Configuratin");
-    err = Pa_Initialize();
-    if( err != paNoError ) goto error;
-
-	/* Find all WASAPI devices */
-	for( i = 0; i < Pa_GetDeviceCount(); ++i )
-	{
-		device = Pa_GetDeviceInfo(i);
-		if( Pa_GetDeviceInfo(i)->hostApi == Pa_HostApiTypeIdToHostApiIndex(paWASAPI) )
-		{
-			if( device->maxOutputChannels == 0 )
-			{
-				isInput = 1;
-			}
-			printf("------------------------------------------\n");
-			printf("Device: %s",device->name);
-			if(isInput)
-				printf("  (Input) %d Channels\n",device->maxInputChannels);
-			else
-				printf("  (Output) %d Channels\n",device->maxOutputChannels);
-			// Try to see if this WASAPI device can provide Jack information
-			err = GetJackInformation(i);
-			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 pa_test_jack_wasapi.c
+	@ingroup test_src
+	@brief Print out jack information for WASAPI endpoints
+	@author Reid Bishop <rbish at attglobal.net>
+*/
+/*
+ * $Id: pa_test_jack_wasapi.c 1368 2008-03-01 00:38:27Z rbishop $
+ *
+ * This program uses the PortAudio Portable Audio Library.
+ * For more information see: http://www.portaudio.com/
+ * Copyright (c) 1999-2010 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 <stdio.h>
+#include "portaudio.h"
+#include "pa_win_wasapi.h"
+
+
+/*
+* Helper function to determine if a given enum is present in mask variable
+*
+*/
+static int IsInMask(int val, int val2)
+{
+	return ((val & val2) == val2);
+}
+
+/*
+* This routine enumerates through the ChannelMapping for the IJackDescription
+*/
+
+static void EnumIJackChannels(int channelMapping)
+{
+	printf("Channel Mapping: ");
+	if(channelMapping == PAWIN_SPEAKER_DIRECTOUT)
+	{
+		printf("DIRECTOUT\n");
+		return;
+	}
+	if(IsInMask(channelMapping, PAWIN_SPEAKER_FRONT_LEFT))
+		printf("FRONT_LEFT, ");
+	if(IsInMask(channelMapping, PAWIN_SPEAKER_FRONT_RIGHT))
+		printf("FRONT_RIGHT, ");
+	if(IsInMask(channelMapping, PAWIN_SPEAKER_FRONT_CENTER))
+		printf("FRONT_CENTER, ");
+	if(IsInMask(channelMapping, PAWIN_SPEAKER_LOW_FREQUENCY))
+		printf("LOW_FREQUENCY, ");
+	if(IsInMask(channelMapping, PAWIN_SPEAKER_BACK_LEFT))
+		printf("BACK_LEFT, ");
+	if(IsInMask(channelMapping,PAWIN_SPEAKER_BACK_RIGHT))
+		printf("BACK_RIGHT, ");
+	if(IsInMask(channelMapping, PAWIN_SPEAKER_FRONT_LEFT_OF_CENTER))
+		printf("FRONT_LEFT_OF_CENTER, ");
+	if(IsInMask(channelMapping, PAWIN_SPEAKER_FRONT_RIGHT_OF_CENTER))
+		printf("FRONT_RIGHT_OF_CENTER, ");
+	if(IsInMask(channelMapping, PAWIN_SPEAKER_BACK_CENTER))
+		printf("BACK_CENTER, ");
+	if(IsInMask(channelMapping,PAWIN_SPEAKER_SIDE_LEFT))
+		printf("SIDE_LEFT, ");
+	if(IsInMask(channelMapping,PAWIN_SPEAKER_SIDE_RIGHT))
+		printf("SIDE_RIGHT, ");
+	if(IsInMask(channelMapping, PAWIN_SPEAKER_TOP_CENTER))
+		printf("TOP_CENTER, ");
+	if(IsInMask(channelMapping, PAWIN_SPEAKER_TOP_FRONT_LEFT))
+		printf("TOP_FRONT_LEFT, ");
+	if(IsInMask(channelMapping, PAWIN_SPEAKER_TOP_FRONT_CENTER))
+		printf("TOP_FRONT_CENTER, ");
+	if(IsInMask(channelMapping, PAWIN_SPEAKER_TOP_FRONT_RIGHT))
+		printf("TOP_FRONT_RIGHT, ");
+	if(IsInMask(channelMapping, PAWIN_SPEAKER_TOP_BACK_LEFT))
+		printf("TOP_BACK_LEFT, ");
+	if(IsInMask(channelMapping, PAWIN_SPEAKER_TOP_BACK_CENTER))
+		printf("TOP_BACK_CENTER, ");
+	if(IsInMask(channelMapping, PAWIN_SPEAKER_TOP_BACK_RIGHT))
+		printf("TOP_BACK_RIGHT, ");
+
+	printf("\n");
+}
+
+/*
+* This routine enumerates through the Jack Connection Types enums for IJackDescription
+*/
+static void EnumIJackConnectionType(int cType)
+{
+	printf("Connection Type: ");
+	switch(cType)
+	{
+		case eJackConnTypeUnknown:
+			printf("eJackConnTypeUnknown");
+			break;
+		case eJackConnType3Point5mm:
+			printf("eJackConnType3Point5mm");
+			break;
+		case eJackConnTypeQuarter:
+			printf("eJackConnTypeQuarter");
+			break;
+		case eJackConnTypeAtapiInternal:
+			printf("eJackConnTypeAtapiInternal");
+			break;
+		case eJackConnTypeRCA:
+			printf("eJackConnTypeRCA");
+			break;
+		case eJackConnTypeOptical:
+			printf("eJackConnTypeOptical");
+			break;
+		case eJackConnTypeOtherDigital:
+			printf("eJackConnTypeOtherDigital");
+			break;
+		case eJackConnTypeOtherAnalog:
+			printf("eJackConnTypeOtherAnalog");
+			break;
+		case eJackConnTypeMultichannelAnalogDIN:
+			printf("eJackConnTypeMultichannelAnalogDIN");
+			break;
+		case eJackConnTypeXlrProfessional:
+			printf("eJackConnTypeXlrProfessional");
+			break;
+		case eJackConnTypeRJ11Modem:
+			printf("eJackConnTypeRJ11Modem");
+			break;
+		case eJackConnTypeCombination:
+			printf("eJackConnTypeCombination");
+			break;
+	}
+	printf("\n");
+}
+
+/*
+* This routine enumerates through the GeoLocation enums for the IJackDescription
+*/
+static void EnumIJackGeoLocation(int iVal)
+{
+	printf("Geometric Location: ");
+	switch(iVal)
+	{
+	case eJackGeoLocRear:
+		printf("eJackGeoLocRear");
+		break;
+	case eJackGeoLocFront:
+		printf("eJackGeoLocFront");
+		break;
+	case eJackGeoLocLeft:
+		printf("eJackGeoLocLeft");
+		break;
+	case eJackGeoLocRight:
+		printf("eJackGeoLocRight");
+		break;
+	case eJackGeoLocTop:
+		printf("eJackGeoLocTop");
+		break;
+	case eJackGeoLocBottom:
+		printf("eJackGeoLocBottom");
+		break;
+	case eJackGeoLocRearPanel:
+		printf("eJackGeoLocRearPanel");
+		break;
+	case eJackGeoLocRiser:
+		printf("eJackGeoLocRiser");
+		break;
+	case eJackGeoLocInsideMobileLid:
+		printf("eJackGeoLocInsideMobileLid");
+		break;
+	case eJackGeoLocDrivebay:
+		printf("eJackGeoLocDrivebay");
+		break;
+	case eJackGeoLocHDMI:
+		printf("eJackGeoLocHDMI");
+		break;
+	case eJackGeoLocOutsideMobileLid:
+		printf("eJackGeoLocOutsideMobileLid");
+		break;
+	case eJackGeoLocATAPI:
+		printf("eJackGeoLocATAPI");
+		break;
+	}
+	printf("\n");
+}
+
+/*
+* This routine enumerates through the GenLocation enums for the IJackDescription
+*/
+static void EnumIJackGenLocation(int iVal)
+{
+	printf("General Location: ");
+	switch(iVal)
+	{
+		case eJackGenLocPrimaryBox:
+			printf("eJackGenLocPrimaryBox");
+			break;
+		case eJackGenLocInternal:
+			printf("eJackGenLocInternal");
+			break;
+		case eJackGenLocSeparate:
+			printf("eJackGenLocSeparate");
+			break;
+		case eJackGenLocOther:
+			printf("eJackGenLocOther");
+			break;
+	}
+	printf("\n");
+}
+
+/*
+* This routine enumerates through the PortConnection enums for the IJackDescription
+*/
+static void EnumIJackPortConnection(int iVal)
+{
+	printf("Port Type: ");
+	switch(iVal)
+	{
+		case eJackPortConnJack:
+			printf("eJackPortConnJack");
+			break;
+		case eJackPortConnIntegratedDevice:
+			printf("eJackPortConnIntegratedDevice");
+			break;
+		case eJackPortConnBothIntegratedAndJack:
+			printf("eJackPortConnBothIntegratedAndJack");
+			break;
+		case eJackPortConnUnknown:
+			printf("eJackPortConnUnknown");
+			break;
+	}
+	printf("\n");
+}
+
+/*
+* This routine retrieves and parses the KSJACK_DESCRIPTION structure for
+* the provided device ID.
+*/
+static PaError GetJackInformation(int deviceId)
+{
+    PaError err;
+	int i;
+	int jackCount = 0;
+	PaWasapiJackDescription jackDesc;
+
+	err = PaWasapi_GetJackCount(deviceId, &jackCount);
+	if( err != paNoError ) return err;
+
+	fprintf( stderr,"Number of Jacks: %d \n", jackCount );
+
+	for( i = 0; i<jackCount; i++ )
+	{
+		fprintf( stderr,"Jack #%d:\n", i );
+
+		err = PaWasapi_GetJackDescription(deviceId, i, &jackDesc);
+		if( err != paNoError ) 
+		{
+			fprintf( stderr,"Failed getting description." );
+			continue;
+		}
+		else
+		{
+			printf("Is connected: %s\n",(jackDesc.isConnected)?"true":"false");
+			EnumIJackChannels(jackDesc.channelMapping);
+			EnumIJackConnectionType(jackDesc.connectionType);
+			EnumIJackGeoLocation(jackDesc.geoLocation);
+			EnumIJackGenLocation(jackDesc.genLocation);
+			EnumIJackPortConnection(jackDesc.portConnection);
+			printf("Jack Color: 0x%06X\n", jackDesc.color);
+			printf("\n");
+		}
+	}
+	return 0;
+}
+
+
+/*******************************************************************/
+int main(void);
+int main(void)
+{
+    PaError err;
+	const PaDeviceInfo *device;
+    int i;
+	int jackCount = 0;
+	int isInput = 0;
+
+	printf("PortAudio Test: WASAPI Jack Configuratin");
+    err = Pa_Initialize();
+    if( err != paNoError ) goto error;
+
+	/* Find all WASAPI devices */
+	for( i = 0; i < Pa_GetDeviceCount(); ++i )
+	{
+		device = Pa_GetDeviceInfo(i);
+		if( Pa_GetDeviceInfo(i)->hostApi == Pa_HostApiTypeIdToHostApiIndex(paWASAPI) )
+		{
+			if( device->maxOutputChannels == 0 )
+			{
+				isInput = 1;
+			}
+			printf("------------------------------------------\n");
+			printf("Device: %s",device->name);
+			if(isInput)
+				printf("  (Input) %d Channels\n",device->maxInputChannels);
+			else
+				printf("  (Output) %d Channels\n",device->maxOutputChannels);
+			// Try to see if this WASAPI device can provide Jack information
+			err = GetJackInformation(i);
+			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/test/patest_latency.c b/test/patest_latency.c
index 652d971..bbc6fe6 100644
--- a/test/patest_latency.c
+++ b/test/patest_latency.c
@@ -5,7 +5,7 @@
 	@author Phil Burk <philburk at softsynth.com>, and Darren Gibbs
 */
 /*
- * $Id: patest_latency.c 1368 2008-03-01 00:38:27Z rossb $
+ * $Id$
  *
  * This program uses the PortAudio Portable Audio Library.
  * For more information see: http://www.portaudio.com
diff --git a/test/patest_leftright.c b/test/patest_leftright.c
index 9d5ada3..33ccf12 100644
--- a/test/patest_leftright.c
+++ b/test/patest_leftright.c
@@ -9,7 +9,7 @@
 	@author Phil Burk <philburk at softsynth.com>
 */
 /*
- * $Id: patest_leftright.c 1609 2011-02-27 00:06:07Z philburk $
+ * $Id$
  *
  * This program uses the PortAudio Portable Audio Library.
  * For more information see: http://www.portaudio.com
diff --git a/test/patest_longsine.c b/test/patest_longsine.c
index d839644..3eba0ce 100644
--- a/test/patest_longsine.c
+++ b/test/patest_longsine.c
@@ -4,7 +4,7 @@
 	@author Phil Burk  http://www.softsynth.com
 */
 /*
- * $Id: patest_longsine.c 1368 2008-03-01 00:38:27Z rossb $
+ * $Id$
  *
  * This program uses the PortAudio Portable Audio Library.
  * For more information see: http://www.portaudio.com
diff --git a/test/patest_many.c b/test/patest_many.c
index 1145dde..083fdb4 100644
--- a/test/patest_many.c
+++ b/test/patest_many.c
@@ -4,7 +4,7 @@
 	@author Phil Burk  http://www.softsynth.com
 */
 /*
- * $Id: patest_many.c 1368 2008-03-01 00:38:27Z rossb $
+ * $Id$
  *
  * This program uses the PortAudio Portable Audio Library.
  * For more information see: http://www.portaudio.com
diff --git a/test/patest_maxsines.c b/test/patest_maxsines.c
index cfac858..49db8d2 100644
--- a/test/patest_maxsines.c
+++ b/test/patest_maxsines.c
@@ -5,7 +5,7 @@
 	@author Phil Burk <philburk at softsynth.com>
 */
 /*
- * $Id: patest_maxsines.c 1368 2008-03-01 00:38:27Z rossb $
+ * $Id$
  *
  * This program uses the PortAudio Portable Audio Library.
  * For more information see: http://www.portaudio.com
@@ -46,8 +46,8 @@
 #include <math.h>
 #include "portaudio.h"
 
-#define MAX_SINES     (500)
-#define MAX_USAGE     (0.8)
+#define MAX_SINES     (2000)
+#define MAX_USAGE     (0.5)
 #define SAMPLE_RATE   (44100)
 #define FREQ_TO_PHASE_INC(freq)   (freq/(float)SAMPLE_RATE)
 
@@ -60,7 +60,7 @@
 #endif
 #define TWOPI (M_PI * 2.0)
 
-#define TABLE_SIZE   (512)
+#define TABLE_SIZE   (1024)
 
 typedef struct paTestData
 {
@@ -70,7 +70,7 @@ typedef struct paTestData
 }
 paTestData;
 
-/* Convert phase between and 1.0 to sine value
+/* Convert phase between 0.0 and 1.0 to sine value
  * using linear interpolation.
  */
 float LookupSine( paTestData *data, float phase );
@@ -187,14 +187,14 @@ int main(void)
 
     /* Play an increasing number of sine waves until we hit MAX_USAGE */
     do  {
-        data.numSines++;
+        data.numSines += 10;
         Pa_Sleep(200);
         load = Pa_GetStreamCpuLoad(stream);
         printf("numSines = %d, CPU load = %f\n", data.numSines, load );
         fflush(stdout);
         } while((load < MAX_USAGE) && (data.numSines < MAX_SINES));
 
-    Pa_Sleep(2000);     /* Stay for 2 seconds around 80% CPU. */
+    Pa_Sleep(2000);     /* Stay for 2 seconds at max CPU. */
 
     err = Pa_StopStream( stream );
     if( err != paNoError )
diff --git a/test/patest_mono.c b/test/patest_mono.c
index 7fb4909..40c9d64 100644
--- a/test/patest_mono.c
+++ b/test/patest_mono.c
@@ -4,7 +4,7 @@
 	@author Phil Burk  http://www.softsynth.com
 */
 /*
- * $Id: patest_mono.c 1915 2014-01-16 17:51:26Z philburk $
+ * $Id$
  *
  * Authors:
  *    Ross Bencina <rossb at audiomulch.com>
diff --git a/test/patest_multi_sine.c b/test/patest_multi_sine.c
index c8f990f..2b11bfc 100644
--- a/test/patest_multi_sine.c
+++ b/test/patest_multi_sine.c
@@ -4,7 +4,7 @@
 	@author Phil Burk  http://www.softsynth.com
 */
 /*
- * $Id: patest_multi_sine.c 1368 2008-03-01 00:38:27Z rossb $
+ * $Id$
  *
  * This program uses the PortAudio Portable Audio Library.
  * For more information see: http://www.portaudio.com
@@ -47,7 +47,7 @@
 #include "portaudio.h"
 
 #define SAMPLE_RATE       (44100)
-#define FRAMES_PER_BUFFER (256)
+#define FRAMES_PER_BUFFER (128)
 #define FREQ_INCR         (300.0 / SAMPLE_RATE)
 #define MAX_CHANNELS      (64)
 
diff --git a/test/patest_out_underflow.c b/test/patest_out_underflow.c
index ad9fdc8..dee90f8 100644
--- a/test/patest_out_underflow.c
+++ b/test/patest_out_underflow.c
@@ -6,7 +6,7 @@
 	@author Phil Burk <philburk at softsynth.com>
 */
 /*
- * $Id: patest_out_underflow.c 1609 2011-02-27 00:06:07Z philburk $
+ * $Id$
  *
  * This program uses the PortAudio Portable Audio Library.
  * For more information see: http://www.portaudio.com
@@ -85,8 +85,9 @@ static int patestCallback( const void *inputBuffer, void *outputBuffer,
 
 
     if( data->countUnderflows && (statusFlags & paOutputUnderflow) )
+    {
         data->outputUnderflowCount++;
-
+    }
     for( i=0; i<framesPerBuffer; i++ )
     {
         float output = 0.0;
@@ -121,9 +122,11 @@ int main(void)
     PaStream *stream;
     PaError err;
     int safeSineCount, stressedSineCount;
+    int sineCount;
     int safeUnderflowCount, stressedUnderflowCount;
     paTestData data = {0};
     double load;
+    double suggestedLatency;
 
 
     printf("PortAudio Test: output sine waves, count underflows. SR = %d, BufSize = %d. MAX_LOAD = %f\n",
@@ -139,7 +142,8 @@ int main(void)
     }
     outputParameters.channelCount = 1;                      /* mono output */
     outputParameters.sampleFormat = paFloat32;              /* 32 bit floating point output */
-    outputParameters.suggestedLatency = Pa_GetDeviceInfo( outputParameters.device )->defaultLowOutputLatency;
+    suggestedLatency = Pa_GetDeviceInfo( outputParameters.device )->defaultLowOutputLatency;
+    outputParameters.suggestedLatency = suggestedLatency;
     outputParameters.hostApiSpecificStreamInfo = NULL;
 
     err = Pa_OpenStream(
@@ -160,24 +164,23 @@ int main(void)
     /* Determine number of sines required to get to 50% */
     do
     {        
-		Pa_Sleep( 100 );
+        Pa_Sleep( 100 );
 
         load = Pa_GetStreamCpuLoad( stream );
         printf("sineCount = %d, CPU load = %f\n", data.sineCount, load );
 		
-		if( load < 0.3 )
-		{
-			data.sineCount += 10;
-		}
-		else if( load < 0.4 )
-		{
-			data.sineCount += 2;
-		}
-		else
-		{
-			data.sineCount += 1;
-		}
-		
+        if( load < 0.3 )
+        {
+            data.sineCount += 10;
+        }
+        else if( load < 0.4 )
+        {
+            data.sineCount += 2;
+        }
+        else
+        {
+            data.sineCount += 1;
+        }
     }
     while( load < 0.5 && data.sineCount < (MAX_SINES-1));
 
@@ -187,16 +190,18 @@ int main(void)
     stressedSineCount = (int) (2.0 * data.sineCount * MAX_LOAD );
     if( stressedSineCount > MAX_SINES )
         stressedSineCount = MAX_SINES;
-    for( ; data.sineCount < stressedSineCount; data.sineCount+=4 )
+    sineCount = data.sineCount;
+    for( ; sineCount < stressedSineCount; sineCount+=4 )
     {
+        data.sineCount = sineCount;
         Pa_Sleep( 100 );
         load = Pa_GetStreamCpuLoad( stream );
-        printf("STRESSING: sineCount = %d, CPU load = %f\n", data.sineCount, load );
+        printf("STRESSING: sineCount = %d, CPU load = %f\n", sineCount, load );
     }
     
-    printf("Counting underflows for 5 seconds.\n");
+    printf("Counting underflows for 2 seconds.\n");
     data.countUnderflows = 1;
-    Pa_Sleep( 5000 );
+    Pa_Sleep( 2000 );
 
     stressedUnderflowCount = data.outputUnderflowCount;
 
@@ -225,12 +230,16 @@ int main(void)
     
     Pa_Terminate();
 
+    printf("suggestedLatency = %f\n", suggestedLatency);
+
+    // Report pass or fail
     if( stressedUnderflowCount == 0 )
-        printf("Test failed, no output underflows detected under stress.\n");
-    else if( safeUnderflowCount != 0 )
-        printf("Test failed, %d unexpected underflows detected under safe load.\n", safeUnderflowCount);
+        printf("Test FAILED, no output underflows detected under stress.\n");
     else
-        printf("Test passed, %d expected output underflows detected under stress, 0 unexpected underflows detected under safe load.\n", stressedUnderflowCount );
+        printf("Test %s, %d expected output underflows detected under stress, "
+               "%d unexpected underflows detected under safe load.\n",
+               (safeUnderflowCount == 0) ? "PASSED" : "FAILED",
+               stressedUnderflowCount, safeUnderflowCount );
 
     return err;
 error:
diff --git a/test/patest_prime.c b/test/patest_prime.c
index cf7dfbe..045757e 100644
--- a/test/patest_prime.c
+++ b/test/patest_prime.c
@@ -5,7 +5,7 @@
 */
 
 /*
- * $Id: patest_prime.c 1371 2008-03-11 14:27:26Z bjornroche $
+ * $Id$
  *
  * This program uses the PortAudio Portable Audio Library.
  * For more information see: http://www.portaudio.com
diff --git a/test/patest_read_record.c b/test/patest_read_record.c
index 471ffa6..e8e5561 100644
--- a/test/patest_read_record.c
+++ b/test/patest_read_record.c
@@ -6,7 +6,7 @@
     @author Ross Bencina rossb at audiomulch.com
 */
 /*
- * $Id: patest_read_record.c 1368 2008-03-01 00:38:27Z rossb $
+ * $Id$
  *
  * This program uses the PortAudio Portable Audio Library.
  * For more information see: http://www.portaudio.com
diff --git a/test/patest_ringmix.c b/test/patest_ringmix.c
index 6f1432e..2b365fb 100644
--- a/test/patest_ringmix.c
+++ b/test/patest_ringmix.c
@@ -3,7 +3,7 @@
 	@brief Ring modulate inputs to left output, mix inputs to right output.
 */
 /*
- * $Id: patest_ringmix.c 1097 2006-08-26 08:27:53Z rossb $ 
+ * $Id$ 
  *
  * This program uses the PortAudio Portable Audio Library.
  * For more information see: http://www.portaudio.com
diff --git a/test/patest_sine8.c b/test/patest_sine8.c
index 9175129..c00319a 100644
--- a/test/patest_sine8.c
+++ b/test/patest_sine8.c
@@ -4,7 +4,7 @@
 	@author Ross Bencina <rossb at audiomulch.com>
 */
 /*
- * $Id: patest_sine8.c 1748 2011-09-01 22:08:32Z philburk $
+ * $Id$
  *
  * This program uses the PortAudio Portable Audio Library.
  * For more information see: http://www.portaudio.com
diff --git a/test/patest_sine_formats.c b/test/patest_sine_formats.c
index 22bfa59..5d01155 100644
--- a/test/patest_sine_formats.c
+++ b/test/patest_sine_formats.c
@@ -4,7 +4,7 @@
 	@author Phil Burk
 */
 /*
- * $Id: patest_sine_formats.c 1097 2006-08-26 08:27:53Z rossb $
+ * $Id$
  *
  * This program uses the PortAudio Portable Audio Library.
  * For more information see: http://www.portaudio.com
diff --git a/test/patest_sine_time.c b/test/patest_sine_time.c
index 3382d88..0d6a1da 100644
--- a/test/patest_sine_time.c
+++ b/test/patest_sine_time.c
@@ -6,7 +6,7 @@
 	@author Phil Burk <philburk at softsynth.com>
 */
 /*
- * $Id: patest_sine_time.c 1368 2008-03-01 00:38:27Z rossb $
+ * $Id$
  *
  * This program uses the PortAudio Portable Audio Library.
  * For more information see: http://www.portaudio.com
diff --git a/test/patest_start_stop.c b/test/patest_start_stop.c
index c07d42e..cf82b67 100644
--- a/test/patest_start_stop.c
+++ b/test/patest_start_stop.c
@@ -6,7 +6,7 @@
 	@author Phil Burk <philburk at softsynth.com>
 */
 /*
- * $Id: patest_start_stop.c 1447 2010-01-24 12:35:36Z rossb $
+ * $Id$
  *
  * This program uses the PortAudio Portable Audio Library.
  * For more information see: http://www.portaudio.com/
diff --git a/test/patest_stop.c b/test/patest_stop.c
index dc0eeed..bc417cc 100644
--- a/test/patest_stop.c
+++ b/test/patest_stop.c
@@ -14,7 +14,7 @@
 	@author Phil Burk <philburk at softsynth.com>
 */
 /*
- * $Id: patest_stop.c 1368 2008-03-01 00:38:27Z rossb $
+ * $Id$
  *
  * This program uses the PortAudio Portable Audio Library.
  * For more information see: http://www.portaudio.com
diff --git a/test/patest_stop_playout.c b/test/patest_stop_playout.c
index c61c3f4..9a451eb 100644
--- a/test/patest_stop_playout.c
+++ b/test/patest_stop_playout.c
@@ -6,7 +6,7 @@
 	@author Ross Bencina <rossb at audiomulch.com>
 */
 /*
- * $Id: patest_stop_playout.c 1446 2010-01-24 12:27:31Z rossb $
+ * $Id$
  *
  * This program uses the PortAudio Portable Audio Library.
  * For more information see: http://www.portaudio.com/
diff --git a/test/patest_suggested_vs_streaminfo_latency.c b/test/patest_suggested_vs_streaminfo_latency.c
index 12996cc..0b7f21d 100644
--- a/test/patest_suggested_vs_streaminfo_latency.c
+++ b/test/patest_suggested_vs_streaminfo_latency.c
@@ -1,269 +1,269 @@
-/** @file patest_suggested_vs_streaminfo_latency.c
-	@ingroup test_src
-	@brief Print suggested vs. PaStreamInfo reported actual latency
-	@author Ross Bencina <rossb at audiomulch.com>
-
-	Opens streams with a sequence of suggested latency values 
-	from 0 to 2 seconds in .5ms intervals and gathers the resulting actual 
-	latency values. Output a csv file and graph suggested vs. actual. Run 
-	with framesPerBuffer unspecified, powers of 2 and multiples of 50 and 
-	prime number buffer sizes.
-*/
-/*
- * $Id: patest_sine.c 1368 2008-03-01 00:38:27Z rossb $
- *
- * 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 <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include "portaudio.h"
-
-#define SAMPLE_RATE             (44100)
-#define FRAMES_PER_BUFFER       2//(128)
-#define NUM_CHANNELS            (2)
-
-#define SUGGESTED_LATENCY_START_SECONDS     (0.0)
-#define SUGGESTED_LATENCY_END_SECONDS       (2.0)
-#define SUGGESTED_LATENCY_INCREMENT_SECONDS (0.0005) /* half a millisecond increments */
-
-
-/* dummy callback. does nothing. never gets called */
-static int patestCallback( const void *inputBuffer, void *outputBuffer,
-                            unsigned long framesPerBuffer,
-                            const PaStreamCallbackTimeInfo* timeInfo,
-                            PaStreamCallbackFlags statusFlags,
-                            void *userData )
-{
-    return paContinue;
-}
-
-/*******************************************************************/
-static void usage()
-{
-    int i;
-    const PaDeviceInfo *deviceInfo;
-    const char *channelString;
-
-    fprintf( stderr, "PortAudio suggested (requested) vs. resulting (reported) stream latency test\n" );
-    fprintf( stderr, "Usage: x.exe input-device-index output-device-index sample-rate frames-per-buffer\n" );
-    fprintf( stderr, "Use -1 for default device index, or use one of these:\n" );
-    for( i=0; i < Pa_GetDeviceCount(); ++i ){
-        deviceInfo = Pa_GetDeviceInfo(i);
-        if( deviceInfo->maxInputChannels > 0 && deviceInfo->maxOutputChannels > 0 )
-            channelString = "full-duplex";
-        else if( deviceInfo->maxInputChannels > 0 )
-            channelString = "input only";
-        else
-            channelString = "output only";
-
-        fprintf( stderr, "%d (%s, %s, %s)\n", i, deviceInfo->name, Pa_GetHostApiInfo(deviceInfo->hostApi)->name, channelString );
-    }
-    Pa_Terminate();
-    exit(-1);
-}
-
-int main( int argc, const char* argv[] );
-int main( int argc, const char* argv[] )
-{
-    PaStreamParameters inputParameters, outputParameters;
-    PaStream *stream;
-    PaError err;
-    PaTime suggestedLatency;
-    const PaStreamInfo *streamInfo;
-    const PaDeviceInfo *deviceInfo;
-    float sampleRate = SAMPLE_RATE;
-    int framesPerBuffer = FRAMES_PER_BUFFER;
-    err = Pa_Initialize();
-    if( err != paNoError ) goto error;
-
-    if( argc > 1 && strcmp(argv[1],"-h") == 0 )
-        usage();
-
-    if( argc > 3 ){
-        sampleRate = atoi(argv[3]);
-    }
-
-    if( argc > 4 ){
-        framesPerBuffer = atoi(argv[4]);
-    }
-
-    printf("# sample rate=%f, frames per buffer=%d\n", (float)sampleRate, framesPerBuffer );
-
-    inputParameters.device = -1;
-    if( argc > 1 )
-        inputParameters.device = atoi(argv[1]);
-    if( inputParameters.device == -1 ){
-        inputParameters.device = Pa_GetDefaultInputDevice();
-        if (inputParameters.device == paNoDevice) {
-          fprintf(stderr,"Error: No default input device available.\n");
-          goto error;
-        }
-    }else{
-        deviceInfo = Pa_GetDeviceInfo(inputParameters.device);
-        if( !deviceInfo ){
-            fprintf(stderr,"Error: Invalid input device index.\n");
-            usage();
-        }
-        if( deviceInfo->maxInputChannels == 0 ){
-            fprintf(stderr,"Error: Specified input device has no input channels (an output only device?).\n");
-            usage();
-        }
-    }
-    
-    inputParameters.channelCount = NUM_CHANNELS;
-    inputParameters.sampleFormat = paFloat32; /* 32 bit floating point output */
-    inputParameters.hostApiSpecificStreamInfo = NULL;
-
-    deviceInfo = Pa_GetDeviceInfo(inputParameters.device);
-    printf( "# using input device id %d (%s, %s)\n", inputParameters.device, deviceInfo->name, Pa_GetHostApiInfo(deviceInfo->hostApi)->name );
-
-
-    outputParameters.device = -1;
-    if( argc > 2 )
-        outputParameters.device = atoi(argv[2]);
-    if( outputParameters.device == -1 ){
-        outputParameters.device = Pa_GetDefaultOutputDevice();
-        if (outputParameters.device == paNoDevice) {
-          fprintf(stderr,"Error: No default output device available.\n");
-          goto error;
-        }
-    }else{
-        deviceInfo = Pa_GetDeviceInfo(outputParameters.device);
-        if( !deviceInfo ){
-            fprintf(stderr,"Error: Invalid output device index.\n");
-            usage();
-        }
-        if( deviceInfo->maxOutputChannels == 0 ){
-            fprintf(stderr,"Error: Specified output device has no output channels (an input only device?).\n");
-            usage();
-        }
-    }
-
-    outputParameters.channelCount = NUM_CHANNELS;
-    outputParameters.sampleFormat = paFloat32; /* 32 bit floating point output */
-    outputParameters.hostApiSpecificStreamInfo = NULL;
-
-    deviceInfo = Pa_GetDeviceInfo(outputParameters.device);
-    printf( "# using output device id %d (%s, %s)\n", outputParameters.device, deviceInfo->name, Pa_GetHostApiInfo(deviceInfo->hostApi)->name );
-
-
-    printf( "# suggested latency, half duplex PaStreamInfo::outputLatency, half duplex PaStreamInfo::inputLatency, full duplex PaStreamInfo::outputLatency, full duplex PaStreamInfo::inputLatency\n" );
-    suggestedLatency = SUGGESTED_LATENCY_START_SECONDS;
-    while( suggestedLatency <= SUGGESTED_LATENCY_END_SECONDS ){
-
-        outputParameters.suggestedLatency = suggestedLatency;
-        inputParameters.suggestedLatency = suggestedLatency;
-
-        printf( "%f, ", suggestedLatency );
-
-        /* ------------------------------ output ------------------------------ */
-
-        err = Pa_OpenStream(
-                  &stream,
-                  NULL, /* no input */
-                  &outputParameters,
-                  sampleRate,
-                  framesPerBuffer,
-                  paClipOff,      /* we won't output out of range samples so don't bother clipping them */
-                  patestCallback,
-                  0 );
-        if( err != paNoError ) goto error;
-
-        streamInfo = Pa_GetStreamInfo( stream );
-
-        printf( "%f,", streamInfo->outputLatency  );
-
-        err = Pa_CloseStream( stream );
-        if( err != paNoError ) goto error;
-
-        /* ------------------------------ input ------------------------------ */
-
-        err = Pa_OpenStream(
-                  &stream,
-                  &inputParameters, 
-                  NULL, /* no output */
-                  sampleRate,
-                  framesPerBuffer,
-                  paClipOff,      /* we won't output out of range samples so don't bother clipping them */
-                  patestCallback,
-                  0 );
-        if( err != paNoError ) goto error;
-
-        streamInfo = Pa_GetStreamInfo( stream );
-
-        printf( "%f,", streamInfo->inputLatency  );
-
-        err = Pa_CloseStream( stream );
-        if( err != paNoError ) goto error;
-
-        /* ------------------------------ full duplex ------------------------------ */
-
-        err = Pa_OpenStream(
-                  &stream,
-                  &inputParameters, 
-                  &outputParameters,
-                  sampleRate,
-                  framesPerBuffer,
-                  paClipOff,      /* we won't output out of range samples so don't bother clipping them */
-                  patestCallback,
-                  0 );
-        if( err != paNoError ) goto error;
-
-        streamInfo = Pa_GetStreamInfo( stream );
-
-        printf( "%f,%f", streamInfo->outputLatency, streamInfo->inputLatency );
-
-        err = Pa_CloseStream( stream );
-        if( err != paNoError ) goto error;
-
-        /* ------------------------------------------------------------ */
-
-        printf( "\n" );
-        suggestedLatency += SUGGESTED_LATENCY_INCREMENT_SECONDS;
-    }
-
-    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 patest_suggested_vs_streaminfo_latency.c
+	@ingroup test_src
+	@brief Print suggested vs. PaStreamInfo reported actual latency
+	@author Ross Bencina <rossb at audiomulch.com>
+
+	Opens streams with a sequence of suggested latency values 
+	from 0 to 2 seconds in .5ms intervals and gathers the resulting actual 
+	latency values. Output a csv file and graph suggested vs. actual. Run 
+	with framesPerBuffer unspecified, powers of 2 and multiples of 50 and 
+	prime number buffer sizes.
+*/
+/*
+ * $Id: patest_sine.c 1368 2008-03-01 00:38:27Z rossb $
+ *
+ * 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 <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include "portaudio.h"
+
+#define SAMPLE_RATE             (44100)
+#define FRAMES_PER_BUFFER       2//(128)
+#define NUM_CHANNELS            (2)
+
+#define SUGGESTED_LATENCY_START_SECONDS     (0.0)
+#define SUGGESTED_LATENCY_END_SECONDS       (2.0)
+#define SUGGESTED_LATENCY_INCREMENT_SECONDS (0.0005) /* half a millisecond increments */
+
+
+/* dummy callback. does nothing. never gets called */
+static int patestCallback( const void *inputBuffer, void *outputBuffer,
+                            unsigned long framesPerBuffer,
+                            const PaStreamCallbackTimeInfo* timeInfo,
+                            PaStreamCallbackFlags statusFlags,
+                            void *userData )
+{
+    return paContinue;
+}
+
+/*******************************************************************/
+static void usage()
+{
+    int i;
+    const PaDeviceInfo *deviceInfo;
+    const char *channelString;
+
+    fprintf( stderr, "PortAudio suggested (requested) vs. resulting (reported) stream latency test\n" );
+    fprintf( stderr, "Usage: x.exe input-device-index output-device-index sample-rate frames-per-buffer\n" );
+    fprintf( stderr, "Use -1 for default device index, or use one of these:\n" );
+    for( i=0; i < Pa_GetDeviceCount(); ++i ){
+        deviceInfo = Pa_GetDeviceInfo(i);
+        if( deviceInfo->maxInputChannels > 0 && deviceInfo->maxOutputChannels > 0 )
+            channelString = "full-duplex";
+        else if( deviceInfo->maxInputChannels > 0 )
+            channelString = "input only";
+        else
+            channelString = "output only";
+
+        fprintf( stderr, "%d (%s, %s, %s)\n", i, deviceInfo->name, Pa_GetHostApiInfo(deviceInfo->hostApi)->name, channelString );
+    }
+    Pa_Terminate();
+    exit(-1);
+}
+
+int main( int argc, const char* argv[] );
+int main( int argc, const char* argv[] )
+{
+    PaStreamParameters inputParameters, outputParameters;
+    PaStream *stream;
+    PaError err;
+    PaTime suggestedLatency;
+    const PaStreamInfo *streamInfo;
+    const PaDeviceInfo *deviceInfo;
+    float sampleRate = SAMPLE_RATE;
+    int framesPerBuffer = FRAMES_PER_BUFFER;
+    err = Pa_Initialize();
+    if( err != paNoError ) goto error;
+
+    if( argc > 1 && strcmp(argv[1],"-h") == 0 )
+        usage();
+
+    if( argc > 3 ){
+        sampleRate = atoi(argv[3]);
+    }
+
+    if( argc > 4 ){
+        framesPerBuffer = atoi(argv[4]);
+    }
+
+    printf("# sample rate=%f, frames per buffer=%d\n", (float)sampleRate, framesPerBuffer );
+
+    inputParameters.device = -1;
+    if( argc > 1 )
+        inputParameters.device = atoi(argv[1]);
+    if( inputParameters.device == -1 ){
+        inputParameters.device = Pa_GetDefaultInputDevice();
+        if (inputParameters.device == paNoDevice) {
+          fprintf(stderr,"Error: No default input device available.\n");
+          goto error;
+        }
+    }else{
+        deviceInfo = Pa_GetDeviceInfo(inputParameters.device);
+        if( !deviceInfo ){
+            fprintf(stderr,"Error: Invalid input device index.\n");
+            usage();
+        }
+        if( deviceInfo->maxInputChannels == 0 ){
+            fprintf(stderr,"Error: Specified input device has no input channels (an output only device?).\n");
+            usage();
+        }
+    }
+    
+    inputParameters.channelCount = NUM_CHANNELS;
+    inputParameters.sampleFormat = paFloat32; /* 32 bit floating point output */
+    inputParameters.hostApiSpecificStreamInfo = NULL;
+
+    deviceInfo = Pa_GetDeviceInfo(inputParameters.device);
+    printf( "# using input device id %d (%s, %s)\n", inputParameters.device, deviceInfo->name, Pa_GetHostApiInfo(deviceInfo->hostApi)->name );
+
+
+    outputParameters.device = -1;
+    if( argc > 2 )
+        outputParameters.device = atoi(argv[2]);
+    if( outputParameters.device == -1 ){
+        outputParameters.device = Pa_GetDefaultOutputDevice();
+        if (outputParameters.device == paNoDevice) {
+          fprintf(stderr,"Error: No default output device available.\n");
+          goto error;
+        }
+    }else{
+        deviceInfo = Pa_GetDeviceInfo(outputParameters.device);
+        if( !deviceInfo ){
+            fprintf(stderr,"Error: Invalid output device index.\n");
+            usage();
+        }
+        if( deviceInfo->maxOutputChannels == 0 ){
+            fprintf(stderr,"Error: Specified output device has no output channels (an input only device?).\n");
+            usage();
+        }
+    }
+
+    outputParameters.channelCount = NUM_CHANNELS;
+    outputParameters.sampleFormat = paFloat32; /* 32 bit floating point output */
+    outputParameters.hostApiSpecificStreamInfo = NULL;
+
+    deviceInfo = Pa_GetDeviceInfo(outputParameters.device);
+    printf( "# using output device id %d (%s, %s)\n", outputParameters.device, deviceInfo->name, Pa_GetHostApiInfo(deviceInfo->hostApi)->name );
+
+
+    printf( "# suggested latency, half duplex PaStreamInfo::outputLatency, half duplex PaStreamInfo::inputLatency, full duplex PaStreamInfo::outputLatency, full duplex PaStreamInfo::inputLatency\n" );
+    suggestedLatency = SUGGESTED_LATENCY_START_SECONDS;
+    while( suggestedLatency <= SUGGESTED_LATENCY_END_SECONDS ){
+
+        outputParameters.suggestedLatency = suggestedLatency;
+        inputParameters.suggestedLatency = suggestedLatency;
+
+        printf( "%f, ", suggestedLatency );
+
+        /* ------------------------------ output ------------------------------ */
+
+        err = Pa_OpenStream(
+                  &stream,
+                  NULL, /* no input */
+                  &outputParameters,
+                  sampleRate,
+                  framesPerBuffer,
+                  paClipOff,      /* we won't output out of range samples so don't bother clipping them */
+                  patestCallback,
+                  0 );
+        if( err != paNoError ) goto error;
+
+        streamInfo = Pa_GetStreamInfo( stream );
+
+        printf( "%f,", streamInfo->outputLatency  );
+
+        err = Pa_CloseStream( stream );
+        if( err != paNoError ) goto error;
+
+        /* ------------------------------ input ------------------------------ */
+
+        err = Pa_OpenStream(
+                  &stream,
+                  &inputParameters, 
+                  NULL, /* no output */
+                  sampleRate,
+                  framesPerBuffer,
+                  paClipOff,      /* we won't output out of range samples so don't bother clipping them */
+                  patestCallback,
+                  0 );
+        if( err != paNoError ) goto error;
+
+        streamInfo = Pa_GetStreamInfo( stream );
+
+        printf( "%f,", streamInfo->inputLatency  );
+
+        err = Pa_CloseStream( stream );
+        if( err != paNoError ) goto error;
+
+        /* ------------------------------ full duplex ------------------------------ */
+
+        err = Pa_OpenStream(
+                  &stream,
+                  &inputParameters, 
+                  &outputParameters,
+                  sampleRate,
+                  framesPerBuffer,
+                  paClipOff,      /* we won't output out of range samples so don't bother clipping them */
+                  patestCallback,
+                  0 );
+        if( err != paNoError ) goto error;
+
+        streamInfo = Pa_GetStreamInfo( stream );
+
+        printf( "%f,%f", streamInfo->outputLatency, streamInfo->inputLatency );
+
+        err = Pa_CloseStream( stream );
+        if( err != paNoError ) goto error;
+
+        /* ------------------------------------------------------------ */
+
+        printf( "\n" );
+        suggestedLatency += SUGGESTED_LATENCY_INCREMENT_SECONDS;
+    }
+
+    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/test/patest_suggested_vs_streaminfo_latency.py b/test/patest_suggested_vs_streaminfo_latency.py
index 0d1f8e1..46c7434 100644
--- a/test/patest_suggested_vs_streaminfo_latency.py
+++ b/test/patest_suggested_vs_streaminfo_latency.py
@@ -1,150 +1,150 @@
-#!/usr/bin/env python
-"""
-
-Run and graph the results of patest_suggested_vs_streaminfo_latency.c
-
-Requires matplotlib for plotting: http://matplotlib.sourceforge.net/
-
-"""
-import os
-from pylab import *
-import numpy
-from matplotlib.backends.backend_pdf import PdfPages
-
-testExeName = "PATest.exe" # rename to whatever the compiled patest_suggested_vs_streaminfo_latency.c binary is
-dataFileName = "patest_suggested_vs_streaminfo_latency.csv" # code below calls the exe to generate this file
-
-inputDeviceIndex = -1 # -1 means default
-outputDeviceIndex = -1 # -1 means default
-sampleRate = 44100
-pdfFilenameSuffix = "_wmme"
-
-pdfFile = PdfPages("patest_suggested_vs_streaminfo_latency_" + str(sampleRate) + pdfFilenameSuffix +".pdf") #output this pdf file
-
-
-def loadCsvData( dataFileName ):
-    params= ""
-    inputDevice = ""
-    outputDevice = ""
-
-    startLines = file(dataFileName).readlines(1024)
-    for line in startLines:
-        if "output device" in line:
-            outputDevice = line.strip(" \t\n\r#")
-        if "input device" in line:
-            inputDevice = line.strip(" \t\n\r#")
-    params = startLines[0].strip(" \t\n\r#")
-
-    data = numpy.loadtxt(dataFileName, delimiter=",", skiprows=4).transpose()
-
-    class R(object): pass
-    result = R()
-    result.params = params
-    for s in params.split(','):
-        if "sample rate" in s:
-            result.sampleRate = s
-
-    result.inputDevice = inputDevice
-    result.outputDevice = outputDevice
-    result.suggestedLatency = data[0]
-    result.halfDuplexOutputLatency = data[1]
-    result.halfDuplexInputLatency = data[2]
-    result.fullDuplexOutputLatency = data[3]
-    result.fullDuplexInputLatency = data[4]
-    return result;
-
-
-def setFigureTitleAndAxisLabels( framesPerBufferString ):
-    title("PortAudio suggested (requested) vs. resulting (reported) stream latency\n" + framesPerBufferString)
-    ylabel("PaStreamInfo::{input,output}Latency (s)")
-    xlabel("Pa_OpenStream suggestedLatency (s)")
-    grid(True)
-    legend(loc="upper left")
-
-def setDisplayRangeSeconds( maxSeconds ):
-    xlim(0, maxSeconds)
-    ylim(0, maxSeconds)
-
-
-# run the test with different frames per buffer values:
-
-compositeTestFramesPerBufferValues = [0]
-# powers of two
-for i in range (1,11):
-    compositeTestFramesPerBufferValues.append( pow(2,i) )
-
-# multiples of 50
-for i in range (1,20):
-    compositeTestFramesPerBufferValues.append( i * 50 )
-
-# 10ms buffer sizes
-compositeTestFramesPerBufferValues.append( 441 )
-compositeTestFramesPerBufferValues.append( 882 )
-
-# large primes
-#compositeTestFramesPerBufferValues.append( 39209 )
-#compositeTestFramesPerBufferValues.append( 37537 )
-#compositeTestFramesPerBufferValues.append( 26437 )
-
-individualPlotFramesPerBufferValues = [0,64,128,256,512] #output separate plots for these
-
-isFirst = True    
-
-for framesPerBuffer in compositeTestFramesPerBufferValues:
-    commandString = testExeName + " " + str(inputDeviceIndex) + " " + str(outputDeviceIndex) + " " + str(sampleRate) + " " + str(framesPerBuffer) + ' > ' + dataFileName
-    print commandString
-    os.system(commandString)
-
-    d = loadCsvData(dataFileName)
-
-    if isFirst:
-        figure(1) # title sheet
-        gcf().text(0.1, 0.0,
-           "patest_suggested_vs_streaminfo_latency\n%s\n%s\n%s\n"%(d.inputDevice,d.outputDevice,d.sampleRate))
-        pdfFile.savefig()
-        
-        
-    figure(2) # composite plot, includes all compositeTestFramesPerBufferValues
-
-    if isFirst:
-        plot( d.suggestedLatency, d.suggestedLatency, label="Suggested latency" )
-    
-    plot( d.suggestedLatency, d.halfDuplexOutputLatency )
-    plot( d.suggestedLatency, d.halfDuplexInputLatency )
-    plot( d.suggestedLatency, d.fullDuplexOutputLatency )
-    plot( d.suggestedLatency, d.fullDuplexInputLatency )
-
-    if framesPerBuffer in individualPlotFramesPerBufferValues: # individual plots
-        figure( 3 + individualPlotFramesPerBufferValues.index(framesPerBuffer) )
-
-        plot( d.suggestedLatency, d.suggestedLatency, label="Suggested latency" )
-        plot( d.suggestedLatency, d.halfDuplexOutputLatency, label="Half-duplex output latency" )
-        plot( d.suggestedLatency, d.halfDuplexInputLatency, label="Half-duplex input latency" )
-        plot( d.suggestedLatency, d.fullDuplexOutputLatency, label="Full-duplex output latency" )
-        plot( d.suggestedLatency, d.fullDuplexInputLatency, label="Full-duplex input latency" )
-
-        if framesPerBuffer == 0:
-            framesPerBufferText = "paFramesPerBufferUnspecified"
-        else:
-            framesPerBufferText = str(framesPerBuffer)
-        setFigureTitleAndAxisLabels( "user frames per buffer: "+str(framesPerBufferText) )
-        setDisplayRangeSeconds(2.2)
-        pdfFile.savefig()
-        setDisplayRangeSeconds(0.1)
-        setFigureTitleAndAxisLabels( "user frames per buffer: "+str(framesPerBufferText)+" (detail)" )
-        pdfFile.savefig()
-
-    isFirst = False
-
-figure(2)
-setFigureTitleAndAxisLabels( "composite of frames per buffer values:\n"+str(compositeTestFramesPerBufferValues) )
-setDisplayRangeSeconds(2.2)
-pdfFile.savefig()
-setDisplayRangeSeconds(0.1)
-setFigureTitleAndAxisLabels( "composite of frames per buffer values:\n"+str(compositeTestFramesPerBufferValues)+" (detail)" )
-pdfFile.savefig()
-
-pdfFile.close()
-
-#uncomment this to display interactively, otherwise we just output a pdf
-#show()
+#!/usr/bin/env python
+"""
+
+Run and graph the results of patest_suggested_vs_streaminfo_latency.c
+
+Requires matplotlib for plotting: http://matplotlib.sourceforge.net/
+
+"""
+import os
+from pylab import *
+import numpy
+from matplotlib.backends.backend_pdf import PdfPages
+
+testExeName = "PATest.exe" # rename to whatever the compiled patest_suggested_vs_streaminfo_latency.c binary is
+dataFileName = "patest_suggested_vs_streaminfo_latency.csv" # code below calls the exe to generate this file
+
+inputDeviceIndex = -1 # -1 means default
+outputDeviceIndex = -1 # -1 means default
+sampleRate = 44100
+pdfFilenameSuffix = "_wmme"
+
+pdfFile = PdfPages("patest_suggested_vs_streaminfo_latency_" + str(sampleRate) + pdfFilenameSuffix +".pdf") #output this pdf file
+
+
+def loadCsvData( dataFileName ):
+    params= ""
+    inputDevice = ""
+    outputDevice = ""
+
+    startLines = file(dataFileName).readlines(1024)
+    for line in startLines:
+        if "output device" in line:
+            outputDevice = line.strip(" \t\n\r#")
+        if "input device" in line:
+            inputDevice = line.strip(" \t\n\r#")
+    params = startLines[0].strip(" \t\n\r#")
+
+    data = numpy.loadtxt(dataFileName, delimiter=",", skiprows=4).transpose()
+
+    class R(object): pass
+    result = R()
+    result.params = params
+    for s in params.split(','):
+        if "sample rate" in s:
+            result.sampleRate = s
+
+    result.inputDevice = inputDevice
+    result.outputDevice = outputDevice
+    result.suggestedLatency = data[0]
+    result.halfDuplexOutputLatency = data[1]
+    result.halfDuplexInputLatency = data[2]
+    result.fullDuplexOutputLatency = data[3]
+    result.fullDuplexInputLatency = data[4]
+    return result;
+
+
+def setFigureTitleAndAxisLabels( framesPerBufferString ):
+    title("PortAudio suggested (requested) vs. resulting (reported) stream latency\n" + framesPerBufferString)
+    ylabel("PaStreamInfo::{input,output}Latency (s)")
+    xlabel("Pa_OpenStream suggestedLatency (s)")
+    grid(True)
+    legend(loc="upper left")
+
+def setDisplayRangeSeconds( maxSeconds ):
+    xlim(0, maxSeconds)
+    ylim(0, maxSeconds)
+
+
+# run the test with different frames per buffer values:
+
+compositeTestFramesPerBufferValues = [0]
+# powers of two
+for i in range (1,11):
+    compositeTestFramesPerBufferValues.append( pow(2,i) )
+
+# multiples of 50
+for i in range (1,20):
+    compositeTestFramesPerBufferValues.append( i * 50 )
+
+# 10ms buffer sizes
+compositeTestFramesPerBufferValues.append( 441 )
+compositeTestFramesPerBufferValues.append( 882 )
+
+# large primes
+#compositeTestFramesPerBufferValues.append( 39209 )
+#compositeTestFramesPerBufferValues.append( 37537 )
+#compositeTestFramesPerBufferValues.append( 26437 )
+
+individualPlotFramesPerBufferValues = [0,64,128,256,512] #output separate plots for these
+
+isFirst = True    
+
+for framesPerBuffer in compositeTestFramesPerBufferValues:
+    commandString = testExeName + " " + str(inputDeviceIndex) + " " + str(outputDeviceIndex) + " " + str(sampleRate) + " " + str(framesPerBuffer) + ' > ' + dataFileName
+    print commandString
+    os.system(commandString)
+
+    d = loadCsvData(dataFileName)
+
+    if isFirst:
+        figure(1) # title sheet
+        gcf().text(0.1, 0.0,
+           "patest_suggested_vs_streaminfo_latency\n%s\n%s\n%s\n"%(d.inputDevice,d.outputDevice,d.sampleRate))
+        pdfFile.savefig()
+        
+        
+    figure(2) # composite plot, includes all compositeTestFramesPerBufferValues
+
+    if isFirst:
+        plot( d.suggestedLatency, d.suggestedLatency, label="Suggested latency" )
+    
+    plot( d.suggestedLatency, d.halfDuplexOutputLatency )
+    plot( d.suggestedLatency, d.halfDuplexInputLatency )
+    plot( d.suggestedLatency, d.fullDuplexOutputLatency )
+    plot( d.suggestedLatency, d.fullDuplexInputLatency )
+
+    if framesPerBuffer in individualPlotFramesPerBufferValues: # individual plots
+        figure( 3 + individualPlotFramesPerBufferValues.index(framesPerBuffer) )
+
+        plot( d.suggestedLatency, d.suggestedLatency, label="Suggested latency" )
+        plot( d.suggestedLatency, d.halfDuplexOutputLatency, label="Half-duplex output latency" )
+        plot( d.suggestedLatency, d.halfDuplexInputLatency, label="Half-duplex input latency" )
+        plot( d.suggestedLatency, d.fullDuplexOutputLatency, label="Full-duplex output latency" )
+        plot( d.suggestedLatency, d.fullDuplexInputLatency, label="Full-duplex input latency" )
+
+        if framesPerBuffer == 0:
+            framesPerBufferText = "paFramesPerBufferUnspecified"
+        else:
+            framesPerBufferText = str(framesPerBuffer)
+        setFigureTitleAndAxisLabels( "user frames per buffer: "+str(framesPerBufferText) )
+        setDisplayRangeSeconds(2.2)
+        pdfFile.savefig()
+        setDisplayRangeSeconds(0.1)
+        setFigureTitleAndAxisLabels( "user frames per buffer: "+str(framesPerBufferText)+" (detail)" )
+        pdfFile.savefig()
+
+    isFirst = False
+
+figure(2)
+setFigureTitleAndAxisLabels( "composite of frames per buffer values:\n"+str(compositeTestFramesPerBufferValues) )
+setDisplayRangeSeconds(2.2)
+pdfFile.savefig()
+setDisplayRangeSeconds(0.1)
+setFigureTitleAndAxisLabels( "composite of frames per buffer values:\n"+str(compositeTestFramesPerBufferValues)+" (detail)" )
+pdfFile.savefig()
+
+pdfFile.close()
+
+#uncomment this to display interactively, otherwise we just output a pdf
+#show()
diff --git a/test/patest_sync.c b/test/patest_sync.c
index 19839f8..a064be1 100644
--- a/test/patest_sync.c
+++ b/test/patest_sync.c
@@ -16,7 +16,7 @@
 	@author Phil Burk  http://www.softsynth.com
 */
 /*
- * $Id: patest_sync.c 1368 2008-03-01 00:38:27Z rossb $
+ * $Id$
  *
  * This program uses the PortAudio Portable Audio Library.
  * For more information see: http://www.portaudio.com
diff --git a/test/patest_timing.c b/test/patest_timing.c
index f224bfe..ed8a11a 100644
--- a/test/patest_timing.c
+++ b/test/patest_timing.c
@@ -1,173 +1,173 @@
-/** @file patest_timing.c
-	@ingroup test_src
-	@brief Play a sine wave for several seconds, and spits out a ton of timing info while it's at it. Based on patest_sine.c
-	@author Bjorn Roche
-	@author Ross Bencina <rossb at audiomulch.com>
-    @author Phil Burk <philburk at softsynth.com>
-*/
-/*
- * $Id: patest_timing.c 578 2003-09-02 04:17:38Z 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 <stdio.h>
-#include <math.h>
-#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)
-typedef struct
-{
-    PaStream *stream;
-    PaTime start;
-    float sine[TABLE_SIZE];
-    int left_phase;
-    int 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 )
-{
-    paTestData *data = (paTestData*)userData;
-    float *out = (float*)outputBuffer;
-    unsigned long i;
-
-    (void) timeInfo; /* Prevent unused variable warnings. */
-    (void) statusFlags;
-    (void) inputBuffer;
-
-    printf( "Timing info given to callback: Adc: %g, Current: %g, Dac: %g\n",
-            timeInfo->inputBufferAdcTime,
-            timeInfo->currentTime,
-            timeInfo->outputBufferDacTime );
-
-    printf( "getStreamTime() returns: %g\n", Pa_GetStreamTime(data->stream) - data->start );
-    
-    for( i=0; i<framesPerBuffer; i++ )
-    {
-        *out++ = data->sine[data->left_phase];  /* left */
-        *out++ = data->sine[data->right_phase];  /* right */
-        data->left_phase += 1;
-        if( data->left_phase >= TABLE_SIZE ) data->left_phase -= TABLE_SIZE;
-        data->right_phase += 3; /* higher pitch so we can distinguish left and right. */
-        if( data->right_phase >= TABLE_SIZE ) data->right_phase -= TABLE_SIZE;
-    }
-    
-    return paContinue;
-}
-
-/*******************************************************************/
-int main(void);
-int main(void)
-{
-    PaStreamParameters outputParameters;
-    PaStream *stream;
-    PaError err;
-    paTestData data;
-    int i;
-
-    
-    printf("PortAudio Test: output sine wave. SR = %d, BufSize = %d\n", SAMPLE_RATE, FRAMES_PER_BUFFER);
-    
-    /* initialise sinusoidal wavetable */
-    for( i=0; i<TABLE_SIZE; i++ )
-    {
-        data.sine[i] = (float) sin( ((double)i/(double)TABLE_SIZE) * M_PI * 2. );
-    }
-    data.left_phase = data.right_phase = 0;
-    
-    err = Pa_Initialize();
-    if( err != paNoError ) goto error;
-
-    outputParameters.device = Pa_GetDefaultOutputDevice(); /* default output device */
-    outputParameters.channelCount = 2;       /* stereo output */
-    outputParameters.sampleFormat = paFloat32; /* 32 bit floating point output */
-    outputParameters.suggestedLatency = Pa_GetDeviceInfo( outputParameters.device )->defaultLowOutputLatency;
-    outputParameters.hostApiSpecificStreamInfo = NULL;
-
-    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 );
-    data.stream = stream;
-    data.start = Pa_GetStreamTime(stream);
-    if( err != paNoError ) goto error;
-
-    err = Pa_StartStream( stream );
-    data.start = Pa_GetStreamTime(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");
-    printf("The tone should have been heard for about 5 seconds and all the timing info above should report that about 5 seconds elapsed (except Adc, which is undefined since there was no input device opened).\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 patest_timing.c
+	@ingroup test_src
+	@brief Play a sine wave for several seconds, and spits out a ton of timing info while it's at it. Based on patest_sine.c
+	@author Bjorn Roche
+	@author Ross Bencina <rossb at audiomulch.com>
+    @author Phil Burk <philburk at softsynth.com>
+*/
+/*
+ * $Id: patest_timing.c 578 2003-09-02 04:17:38Z 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 <stdio.h>
+#include <math.h>
+#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)
+typedef struct
+{
+    PaStream *stream;
+    PaTime start;
+    float sine[TABLE_SIZE];
+    int left_phase;
+    int 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 )
+{
+    paTestData *data = (paTestData*)userData;
+    float *out = (float*)outputBuffer;
+    unsigned long i;
+
+    (void) timeInfo; /* Prevent unused variable warnings. */
+    (void) statusFlags;
+    (void) inputBuffer;
+
+    printf( "Timing info given to callback: Adc: %g, Current: %g, Dac: %g\n",
+            timeInfo->inputBufferAdcTime,
+            timeInfo->currentTime,
+            timeInfo->outputBufferDacTime );
+
+    printf( "getStreamTime() returns: %g\n", Pa_GetStreamTime(data->stream) - data->start );
+    
+    for( i=0; i<framesPerBuffer; i++ )
+    {
+        *out++ = data->sine[data->left_phase];  /* left */
+        *out++ = data->sine[data->right_phase];  /* right */
+        data->left_phase += 1;
+        if( data->left_phase >= TABLE_SIZE ) data->left_phase -= TABLE_SIZE;
+        data->right_phase += 3; /* higher pitch so we can distinguish left and right. */
+        if( data->right_phase >= TABLE_SIZE ) data->right_phase -= TABLE_SIZE;
+    }
+    
+    return paContinue;
+}
+
+/*******************************************************************/
+int main(void);
+int main(void)
+{
+    PaStreamParameters outputParameters;
+    PaStream *stream;
+    PaError err;
+    paTestData data;
+    int i;
+
+    
+    printf("PortAudio Test: output sine wave. SR = %d, BufSize = %d\n", SAMPLE_RATE, FRAMES_PER_BUFFER);
+    
+    /* initialise sinusoidal wavetable */
+    for( i=0; i<TABLE_SIZE; i++ )
+    {
+        data.sine[i] = (float) sin( ((double)i/(double)TABLE_SIZE) * M_PI * 2. );
+    }
+    data.left_phase = data.right_phase = 0;
+    
+    err = Pa_Initialize();
+    if( err != paNoError ) goto error;
+
+    outputParameters.device = Pa_GetDefaultOutputDevice(); /* default output device */
+    outputParameters.channelCount = 2;       /* stereo output */
+    outputParameters.sampleFormat = paFloat32; /* 32 bit floating point output */
+    outputParameters.suggestedLatency = Pa_GetDeviceInfo( outputParameters.device )->defaultLowOutputLatency;
+    outputParameters.hostApiSpecificStreamInfo = NULL;
+
+    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 );
+    data.stream = stream;
+    data.start = Pa_GetStreamTime(stream);
+    if( err != paNoError ) goto error;
+
+    err = Pa_StartStream( stream );
+    data.start = Pa_GetStreamTime(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");
+    printf("The tone should have been heard for about 5 seconds and all the timing info above should report that about 5 seconds elapsed (except Adc, which is undefined since there was no input device opened).\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/test/patest_toomanysines.c b/test/patest_toomanysines.c
index e3dae32..4722f5e 100644
--- a/test/patest_toomanysines.c
+++ b/test/patest_toomanysines.c
@@ -6,7 +6,7 @@
 	@author Phil Burk <philburk at softsynth.com>
 */
 /*
- * $Id: patest_toomanysines.c 1609 2011-02-27 00:06:07Z philburk $
+ * $Id$
  *
  * This program uses the PortAudio Portable Audio Library.
  * For more information see: http://www.portaudio.com
diff --git a/test/patest_two_rates.c b/test/patest_two_rates.c
index 9bd9242..5a2b178 100644
--- a/test/patest_two_rates.c
+++ b/test/patest_two_rates.c
@@ -4,7 +4,7 @@
 	@author Phil Burk <philburk at softsynth.com>
 */
 /*
- * $Id: patest_two_rates.c 1640 2011-03-07 00:52:47Z philburk $
+ * $Id$
  *
  * Author: Phil Burk  http://www.softsynth.com
  *
diff --git a/test/patest_underflow.c b/test/patest_underflow.c
index 0cb8757..e1726a6 100644
--- a/test/patest_underflow.c
+++ b/test/patest_underflow.c
@@ -6,7 +6,7 @@
 	@author Phil Burk <philburk at softsynth.com>
 */
 /*
- * $Id: patest_underflow.c 1368 2008-03-01 00:38:27Z rossb $
+ * $Id$
  *
  * This program uses the PortAudio Portable Audio Library.
  * For more information see: http://www.portaudio.com
diff --git a/test/patest_unplug.c b/test/patest_unplug.c
new file mode 100644
index 0000000..ba55b7d
--- /dev/null
+++ b/test/patest_unplug.c
@@ -0,0 +1,243 @@
+/** @file patest_unplug.c
+	@ingroup test_src
+	@brief Debug a crash involving unplugging a USB device.
+	@author Phil Burk  http://www.softsynth.com
+*/
+/*
+ * $Id$
+ *
+ * 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 <stdio.h>
+#include <stdlib.h>
+#include <memory.h>
+#include <math.h>
+#include "portaudio.h"
+
+#define NUM_SECONDS   (8)
+#define SAMPLE_RATE   (44100)
+#ifndef M_PI
+#define M_PI  (3.14159265)
+#endif
+#define TABLE_SIZE        (200)
+#define FRAMES_PER_BUFFER  (64)
+#define MAX_CHANNELS        (8)
+
+typedef struct
+{
+    short sine[TABLE_SIZE];
+    int32_t phases[MAX_CHANNELS];
+    int32_t numChannels;
+    int32_t sampsToGo;
+}
+paTestData;
+
+
+static int inputCallback( const void *inputBuffer, void *outputBuffer,
+                          unsigned long framesPerBuffer,
+                          const PaStreamCallbackTimeInfo* timeInfo,
+                          PaStreamCallbackFlags statusFlags,
+                          void *userData )
+{
+    paTestData *data = (paTestData*)userData;
+    int finished = 0;
+    (void) inputBuffer; /* Prevent "unused variable" warnings. */
+    (void) outputBuffer; /* Prevent "unused variable" warnings. */
+
+    data->sampsToGo -= framesPerBuffer;
+    if (data->sampsToGo <= 0)
+    {
+        data->sampsToGo = 0;
+        finished = 1;
+    }
+    return finished;
+}
+
+static int outputCallback( const void *inputBuffer, void *outputBuffer,
+                            unsigned long framesPerBuffer,
+                            const PaStreamCallbackTimeInfo* timeInfo,
+                            PaStreamCallbackFlags statusFlags,
+                            void *userData )
+{
+    paTestData *data = (paTestData*)userData;
+    short *out = (short*)outputBuffer;
+    unsigned int i;
+    int finished = 0;
+    (void) inputBuffer; /* Prevent "unused variable" warnings. */
+
+    for( i=0; i<framesPerBuffer; i++ )
+    {
+        for (int channelIndex = 0; channelIndex < data->numChannels; channelIndex++)
+        {
+            int phase = data->phases[channelIndex];
+            *out++ = data->sine[phase];
+            phase += channelIndex + 2;
+            if( phase >= TABLE_SIZE ) phase -= TABLE_SIZE;
+            data->phases[channelIndex] = phase;
+        }
+    }
+    return finished;
+}
+
+/*******************************************************************/
+int main(int argc, char **args);
+int main(int argc, char **args)
+{
+    PaStreamParameters inputParameters;
+    PaStreamParameters outputParameters;
+    PaStream *inputStream;
+    PaStream *outputStream;
+    const PaDeviceInfo *deviceInfo;
+    PaError err;
+    paTestData data;
+    int i;
+    int totalSamps;
+    int inputDevice = -1;
+    int outputDevice = -1;
+
+    printf("Test unplugging a USB device.\n");
+
+    if( argc > 1 ) {
+       inputDevice = outputDevice = atoi( args[1] );
+       printf("Using device number %d.\n\n", inputDevice );
+    } else {
+       printf("Using default device.\n\n" );
+    }
+
+    memset(&data, 0, sizeof(data));
+
+    /* initialise sinusoidal wavetable */
+    for( i=0; i<TABLE_SIZE; i++ )
+    {
+        data.sine[i] = (short) (32767.0 * sin( ((double)i/(double)TABLE_SIZE) * M_PI * 2. ));
+    }
+    data.numChannels = 2;
+    data.sampsToGo = totalSamps =  NUM_SECONDS * SAMPLE_RATE; /* Play for a few seconds. */
+
+
+    err = Pa_Initialize();
+    if( err != paNoError ) goto error;
+
+    if( inputDevice == -1 )
+        inputParameters.device = Pa_GetDefaultInputDevice(); /* default input device */
+    else
+        inputParameters.device = inputDevice ;
+
+    if (inputParameters.device == paNoDevice) {
+        fprintf(stderr,"Error: No default input device.\n");
+        goto error;
+    }
+
+    if( outputDevice == -1 )
+        outputParameters.device = Pa_GetDefaultOutputDevice(); /* default output device */
+    else
+        outputParameters.device = outputDevice ;
+
+    if (outputParameters.device == paNoDevice) {
+        fprintf(stderr,"Error: No default output device.\n");
+        goto error;
+    }
+
+    inputParameters.channelCount = 2;
+    inputParameters.sampleFormat = paInt16;
+    deviceInfo = Pa_GetDeviceInfo( inputParameters.device );
+    if( deviceInfo == NULL )
+    {
+        fprintf( stderr, "No matching input device.\n" );
+        goto error;
+    }
+    inputParameters.suggestedLatency = deviceInfo->defaultLowInputLatency;
+    inputParameters.hostApiSpecificStreamInfo = NULL;
+    err = Pa_OpenStream(
+                &inputStream,
+                &inputParameters,
+                NULL,
+                SAMPLE_RATE,
+                FRAMES_PER_BUFFER,
+                0,
+                inputCallback,
+                &data );
+    if( err != paNoError ) goto error;
+
+    outputParameters.channelCount = 2;
+    outputParameters.sampleFormat = paInt16;
+    deviceInfo = Pa_GetDeviceInfo( outputParameters.device );
+    if( deviceInfo == NULL )
+    {
+        fprintf( stderr, "No matching output device.\n" );
+        goto error;
+    }
+    outputParameters.suggestedLatency = deviceInfo->defaultLowOutputLatency;
+    outputParameters.hostApiSpecificStreamInfo = NULL;
+    err = Pa_OpenStream(
+                &outputStream,
+                NULL,
+                &outputParameters,
+                SAMPLE_RATE,
+                FRAMES_PER_BUFFER,
+                (paClipOff | paDitherOff),
+                outputCallback,
+                &data );
+    if( err != paNoError ) goto error;
+
+    err = Pa_StartStream( inputStream );
+    if( err != paNoError ) goto error;
+    err = Pa_StartStream( outputStream );
+    if( err != paNoError ) goto error;
+
+    printf("When you hear sound, unplug the USB device.\n");
+    do
+    {
+        Pa_Sleep(500);
+        printf("Frames remaining = %d\n", data.sampsToGo);
+        printf("Pa_IsStreamActive(inputStream) = %d\n", Pa_IsStreamActive(inputStream));
+        printf("Pa_IsStreamActive(outputStream) = %d\n", Pa_IsStreamActive(outputStream));
+    } while( Pa_IsStreamActive(inputStream) && Pa_IsStreamActive(outputStream) );
+
+    err = Pa_CloseStream( inputStream );
+    if( err != paNoError ) goto error;
+    err = Pa_CloseStream( outputStream );
+    if( err != paNoError ) goto error;
+    Pa_Terminate();
+    return paNoError;
+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 ) );
+    fprintf( stderr, "Host Error message: %s\n", Pa_GetLastHostErrorInfo()->errorText );
+    return err;
+}
diff --git a/test/patest_wire.c b/test/patest_wire.c
index 3601ef9..ba3477b 100644
--- a/test/patest_wire.c
+++ b/test/patest_wire.c
@@ -13,7 +13,7 @@
 
 */
 /*
- * $Id: patest_wire.c 1843 2012-06-22 21:58:10Z philburk $
+ * $Id$
  *
  * This program uses the PortAudio Portable Audio Library.
  * For more information see: http://www.portaudio.com
diff --git a/test/patest_wmme_find_best_latency_params.c b/test/patest_wmme_find_best_latency_params.c
index 625cc20..618b97e 100644
--- a/test/patest_wmme_find_best_latency_params.c
+++ b/test/patest_wmme_find_best_latency_params.c
@@ -1,518 +1,518 @@
-/*
- * $Id: $
- * Portable Audio I/O Library
- * Windows MME low level buffer user guided parameters search
- *
- * Copyright (c) 2010 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 <stdio.h>
-#include <time.h>
-#include <math.h>
-
-#define  _WIN32_WINNT 0x0501 /* for GetNativeSystemInfo */ 
-#include <windows.h>    /* required when using pa_win_wmme.h */
-#include <mmsystem.h>   /* required when using pa_win_wmme.h */
-
-#include <conio.h>      /* for _getch */
-
-
-#include "portaudio.h"
-#include "pa_win_wmme.h"
-
-
-#define DEFAULT_SAMPLE_RATE             (44100.)
-
-#ifndef M_PI
-#define M_PI  (3.14159265)
-#endif
-
-#define TABLE_SIZE              (2048)
-
-#define CHANNEL_COUNT           (2)
-
-
-/* seach parameters. we test all buffer counts in this range */
-#define MIN_WMME_BUFFER_COUNT        (2)
-#define MAX_WMME_BUFFER_COUNT        (12)
-
-
-/*******************************************************************/
-/* functions to query and print Windows version information */
-
-typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL);
-
-LPFN_ISWOW64PROCESS fnIsWow64Process;
-
-static BOOL IsWow64()
-{
-    BOOL bIsWow64 = FALSE;
-
-    //IsWow64Process is not available on all supported versions of Windows.
-    //Use GetModuleHandle to get a handle to the DLL that contains the function
-    //and GetProcAddress to get a pointer to the function if available.
-
-    fnIsWow64Process = (LPFN_ISWOW64PROCESS) GetProcAddress(
-        GetModuleHandle(TEXT("kernel32")),"IsWow64Process" );
-
-    if(NULL != fnIsWow64Process)
-    {
-        if (!fnIsWow64Process(GetCurrentProcess(),&bIsWow64))
-        {
-            //handle error
-        }
-    }
-    return bIsWow64;
-}
-
-static void printWindowsVersionInfo( FILE *fp )
-{
-    OSVERSIONINFOEX osVersionInfoEx;
-    SYSTEM_INFO systemInfo;
-    const char *osName = "Unknown";
-    const char *osProductType = "";
-    const char *processorArchitecture = "Unknown";
-
-    memset( &osVersionInfoEx, 0, sizeof(OSVERSIONINFOEX) );
-    osVersionInfoEx.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
-    GetVersionEx( &osVersionInfoEx );
-
-    
-    if( osVersionInfoEx.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS ){
-        switch( osVersionInfoEx.dwMinorVersion ){
-            case 0: osName = "Windows 95"; break;
-            case 10: osName = "Windows 98"; break;  // could also be 98SE (I've seen code discriminate based 
-                                                    // on osInfo.Version.Revision.ToString() == "2222A")
-            case 90: osName = "Windows Me"; break;
-        }
-    }else if( osVersionInfoEx.dwPlatformId == VER_PLATFORM_WIN32_NT ){
-        switch( osVersionInfoEx.dwMajorVersion ){
-            case 3: osName = "Windows NT 3.51"; break;
-            case 4: osName = "Windows NT 4.0"; break;
-            case 5: switch( osVersionInfoEx.dwMinorVersion ){
-                        case 0: osName = "Windows 2000"; break;
-                        case 1: osName = "Windows XP"; break;
-                        case 2:
-                            if( osVersionInfoEx.wSuiteMask & 0x00008000 /*VER_SUITE_WH_SERVER*/ ){
-                                osName = "Windows Home Server";
-                            }else{
-                                if( osVersionInfoEx.wProductType == VER_NT_WORKSTATION ){
-                                    osName = "Windows XP Professional x64 Edition (?)";
-                                }else{
-                                    if( GetSystemMetrics(/*SM_SERVERR2*/89) == 0 )
-                                        osName = "Windows Server 2003";
-                                    else
-                                        osName = "Windows Server 2003 R2";
-                                }
-                            }break;
-                    }break;
-            case 6:switch( osVersionInfoEx.dwMinorVersion ){
-                        case 0: 
-                            if( osVersionInfoEx.wProductType == VER_NT_WORKSTATION )
-                                osName = "Windows Vista";
-                            else
-                                osName = "Windows Server 2008";
-                            break;
-                        case 1: 
-                            if( osVersionInfoEx.wProductType == VER_NT_WORKSTATION )
-                                osName = "Windows 7";
-                            else
-                                osName = "Windows Server 2008 R2";
-                            break;
-                    }break;
-        }
-    }
-
-    if(osVersionInfoEx.dwMajorVersion == 4)
-    {
-        if(osVersionInfoEx.wProductType == VER_NT_WORKSTATION)
-            osProductType = "Workstation";
-        else if(osVersionInfoEx.wProductType == VER_NT_SERVER)
-            osProductType = "Server";
-    }
-    else if(osVersionInfoEx.dwMajorVersion == 5)
-    {
-        if(osVersionInfoEx.wProductType == VER_NT_WORKSTATION)
-        {
-            if((osVersionInfoEx.wSuiteMask & VER_SUITE_PERSONAL) == VER_SUITE_PERSONAL)
-                osProductType = "Home Edition"; // Windows XP Home Edition
-            else
-                osProductType = "Professional"; // Windows XP / Windows 2000 Professional
-        }
-        else if(osVersionInfoEx.wProductType == VER_NT_SERVER)
-        {
-            if(osVersionInfoEx.dwMinorVersion == 0) 
-            {
-                if((osVersionInfoEx.wSuiteMask & VER_SUITE_DATACENTER) == VER_SUITE_DATACENTER)
-                    osProductType = "Datacenter Server"; // Windows 2000 Datacenter Server
-                else if((osVersionInfoEx.wSuiteMask & VER_SUITE_ENTERPRISE) == VER_SUITE_ENTERPRISE)
-                    osProductType = "Advanced Server"; // Windows 2000 Advanced Server
-                else
-                    osProductType = "Server"; // Windows 2000 Server
-            }
-        }
-        else
-        {
-            if((osVersionInfoEx.wSuiteMask & VER_SUITE_DATACENTER) == VER_SUITE_DATACENTER)
-                osProductType = "Datacenter Edition"; // Windows Server 2003 Datacenter Edition
-            else if((osVersionInfoEx.wSuiteMask & VER_SUITE_ENTERPRISE) == VER_SUITE_ENTERPRISE)
-                osProductType = "Enterprise Edition"; // Windows Server 2003 Enterprise Edition
-            else if((osVersionInfoEx.wSuiteMask & VER_SUITE_BLADE) == VER_SUITE_BLADE)
-                osProductType = "Web Edition"; // Windows Server 2003 Web Edition
-            else
-                osProductType = "Standard Edition"; // Windows Server 2003 Standard Edition
-        }
-    }
-
-    memset( &systemInfo, 0, sizeof(SYSTEM_INFO) );
-    GetNativeSystemInfo( &systemInfo );
-
-    if( systemInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_INTEL )
-        processorArchitecture = "x86";
-    else if( systemInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64 )
-        processorArchitecture = "x64";
-    else if( systemInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_IA64 )
-        processorArchitecture = "Itanium";
-
-
-    fprintf( fp, "OS name and edition: %s %s\n", osName, osProductType );
-    fprintf( fp, "OS version: %d.%d.%d %S\n", 
-                osVersionInfoEx.dwMajorVersion, osVersionInfoEx.dwMinorVersion, 
-                osVersionInfoEx.dwBuildNumber, osVersionInfoEx.szCSDVersion );
-    fprintf( fp, "Processor architecture: %s\n", processorArchitecture );
-    fprintf( fp, "WoW64 process: %s\n", IsWow64() ? "Yes" : "No" );
-}
-
-static void printTimeAndDate( FILE *fp )
-{
-    struct tm *local;
-    time_t t;
-
-    t = time(NULL);
-    local = localtime(&t);
-    fprintf(fp, "Local time and date: %s", asctime(local));
-    local = gmtime(&t);
-    fprintf(fp, "UTC time and date: %s", asctime(local));
-}
-
-/*******************************************************************/
-
-typedef struct
-{
-    float sine[TABLE_SIZE];
-	double phase;
-    double phaseIncrement;
-    volatile int fadeIn;
-    volatile int fadeOut;
-    double amp;
-}
-paTestData;
-
-static paTestData data;
-
-/* 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; i<framesPerBuffer; i++ )
-    {
-        float x = data->sine[(int)data->phase];
-        data->phase += data->phaseIncrement;
-        if( data->phase >= TABLE_SIZE ){
-			data->phase -= TABLE_SIZE;
-		}
-
-        x *= data->amp;
-        if( data->fadeIn ){
-            data->amp += .001;
-            if( data->amp >= 1. )
-                data->fadeIn = 0;
-        }else if( data->fadeOut ){
-            if( data->amp > 0 )
-                data->amp -= .001;
-        }
-
-		for( j = 0; j < CHANNEL_COUNT; ++j ){
-            *out++ = x;
-		}
-	}
-    
-    if( data->amp > 0 )
-        return paContinue;
-    else
-        return paComplete;
-}
-
-
-#define YES     1
-#define NO      0
-
-
-static int playUntilKeyPress( int deviceIndex, float sampleRate, 
-                             int framesPerUserBuffer, int framesPerWmmeBuffer, int wmmeBufferCount )
-{
-    PaStreamParameters outputParameters;
-    PaWinMmeStreamInfo wmmeStreamInfo;
-    PaStream *stream;
-    PaError err;
-    int c;
-
-    outputParameters.device = deviceIndex;
-    outputParameters.channelCount = CHANNEL_COUNT;
-    outputParameters.sampleFormat = paFloat32; /* 32 bit floating point processing */
-    outputParameters.suggestedLatency = 0; /*Pa_GetDeviceInfo( outputParameters.device )->defaultLowOutputLatency;*/
-    outputParameters.hostApiSpecificStreamInfo = NULL;
-
-    wmmeStreamInfo.size = sizeof(PaWinMmeStreamInfo);
-    wmmeStreamInfo.hostApiType = paMME; 
-    wmmeStreamInfo.version = 1;
-    wmmeStreamInfo.flags = paWinMmeUseLowLevelLatencyParameters | paWinMmeDontThrottleOverloadedProcessingThread;
-    wmmeStreamInfo.framesPerBuffer = framesPerWmmeBuffer;
-    wmmeStreamInfo.bufferCount = wmmeBufferCount;
-    outputParameters.hostApiSpecificStreamInfo = &wmmeStreamInfo;
-
-    err = Pa_OpenStream(
-              &stream,
-              NULL, /* no input */
-              &outputParameters,
-              sampleRate,
-              framesPerUserBuffer,
-              paClipOff | paPrimeOutputBuffersUsingStreamCallback,      /* we won't output out of range samples so don't bother clipping them */
-              patestCallback,
-              &data );
-    if( err != paNoError ) goto error;
-
-    data.amp = 0;
-    data.fadeIn = 1;
-    data.fadeOut = 0;
-    data.phase = 0;
-    data.phaseIncrement = 15 + ((rand()%100) / 10); // randomise pitch
-
-    err = Pa_StartStream( stream );
-    if( err != paNoError ) goto error;
-
-
-    do{
-        printf( "Trying buffer size %d.\nIf it sounds smooth (without clicks or glitches) press 'y', if it sounds bad press 'n' ('q' to quit)\n", framesPerWmmeBuffer );
-        c = tolower(_getch());
-        if( c == 'q' ){
-            Pa_Terminate();
-            exit(0);
-        }
-    }while( c != 'y' && c != 'n' );
-
-    data.fadeOut = 1;
-    while( Pa_IsStreamActive(stream) == 1 )
-        Pa_Sleep( 100 );
-
-    err = Pa_StopStream( stream );
-    if( err != paNoError ) goto error;
-
-    err = Pa_CloseStream( stream );
-    if( err != paNoError ) goto error;
-
-    return (c == 'y') ? YES : NO;
-
-error:
-    return err;
-}
-
-/*******************************************************************/
-static void usage( int wmmeHostApiIndex )
-{
-    int i;
-
-    fprintf( stderr, "PortAudio WMME output latency user guided test\n" );
-    fprintf( stderr, "Usage: x.exe mme-device-index [sampleRate [min-buffer-count max-buffer-count]]\n" );
-    fprintf( stderr, "Invalid device index. Use one of these:\n" );
-    for( i=0; i < Pa_GetDeviceCount(); ++i ){
-
-        if( Pa_GetDeviceInfo(i)->hostApi == wmmeHostApiIndex && Pa_GetDeviceInfo(i)->maxOutputChannels > 0  )
-            fprintf( stderr, "%d (%s)\n", i, Pa_GetDeviceInfo(i)->name );
-    }
-    Pa_Terminate();
-    exit(-1);
-}
-
-/*
-    ideas: 
-        o- could be testing with 80% CPU load
-        o- could test with different channel counts
-*/
-
-int main(int argc, char* argv[])
-{
-    PaError err;
-    int i;
-    int deviceIndex;
-    int wmmeBufferCount, wmmeBufferSize, smallestWorkingBufferSize;
-    int smallestWorkingBufferingLatencyFrames;
-    int min, max, mid;
-    int testResult;
-    FILE *resultsFp;
-    int wmmeHostApiIndex;
-    const PaHostApiInfo *wmmeHostApiInfo;
-    double sampleRate = DEFAULT_SAMPLE_RATE;
-    int wmmeMinBufferCount = MIN_WMME_BUFFER_COUNT;
-    int wmmeMaxBufferCount = MAX_WMME_BUFFER_COUNT;
-
-    err = Pa_Initialize();
-    if( err != paNoError ) goto error;
-
-    wmmeHostApiIndex = Pa_HostApiTypeIdToHostApiIndex( paMME );
-    wmmeHostApiInfo = Pa_GetHostApiInfo( wmmeHostApiIndex );
-
-    if( argc > 5 )
-        usage(wmmeHostApiIndex);
-
-	deviceIndex = wmmeHostApiInfo->defaultOutputDevice;
-	if( argc >= 2 ){
-        deviceIndex = -1;
-		if( sscanf( argv[1], "%d", &deviceIndex ) != 1 )
-            usage(wmmeHostApiIndex);
-        if( deviceIndex < 0 || deviceIndex >= Pa_GetDeviceCount() || Pa_GetDeviceInfo(deviceIndex)->hostApi != wmmeHostApiIndex ){
-            usage(wmmeHostApiIndex);
-        }
-	}
-
-    printf( "Using device id %d (%s)\n", deviceIndex, Pa_GetDeviceInfo(deviceIndex)->name );
-
-    if( argc >= 3 ){
-        if( sscanf( argv[2], "%lf", &sampleRate ) != 1 )
-            usage(wmmeHostApiIndex);
-    }
-
-    printf( "Testing with sample rate %f.\n", (float)sampleRate );
-
-    if( argc == 4 ){
-        if( sscanf( argv[3], "%d", &wmmeMinBufferCount ) != 1 )
-            usage(wmmeHostApiIndex);
-        wmmeMaxBufferCount = wmmeMinBufferCount;
-    }
-
-    if( argc == 5 ){
-        if( sscanf( argv[3], "%d", &wmmeMinBufferCount ) != 1 )
-            usage(wmmeHostApiIndex);
-        if( sscanf( argv[4], "%d", &wmmeMaxBufferCount ) != 1 )
-            usage(wmmeHostApiIndex);
-    }
-
-    printf( "Testing buffer counts from %d to %d\n", wmmeMinBufferCount, wmmeMaxBufferCount );
-
-
-    /* initialise sinusoidal wavetable */
-    for( i=0; i<TABLE_SIZE; i++ )
-    {
-        data.sine[i] = (float) sin( ((double)i/(double)TABLE_SIZE) * M_PI * 2. );
-    }
-
-	data.phase = 0;
-
-    resultsFp = fopen( "results.txt", "at" );
-    fprintf( resultsFp, "*** WMME smallest working output buffer sizes\n" );
-
-    printTimeAndDate( resultsFp );
-    printWindowsVersionInfo( resultsFp );
-    
-    fprintf( resultsFp, "audio device: %s\n", Pa_GetDeviceInfo( deviceIndex )->name );
-    fflush( resultsFp );
-
-    fprintf( resultsFp, "Sample rate: %f\n", (float)sampleRate );
-    fprintf( resultsFp, "Buffer count, Smallest working buffer size (frames), Smallest working buffering latency (frames), Smallest working buffering latency (Seconds)\n" );
-
-    for( wmmeBufferCount = wmmeMinBufferCount; wmmeBufferCount <= wmmeMaxBufferCount; ++wmmeBufferCount ){
- 
-        printf( "Test %d of %d\n", (wmmeBufferCount - wmmeMinBufferCount) + 1, (wmmeMaxBufferCount-wmmeMinBufferCount) + 1 );
-        printf( "Testing with %d buffers...\n", wmmeBufferCount );
-
-        /*
-            Binary search after Niklaus Wirth
-            from http://en.wikipedia.org/wiki/Binary_search_algorithm#The_algorithm
-         */
-        min = 1;
-        max = (int)((sampleRate * .3) / (wmmeBufferCount-1)); //8192;    /* we assume that this size works 300ms */
-        smallestWorkingBufferSize = 0;
-
-        do{
-            mid = min + ((max - min) / 2);
-
-            wmmeBufferSize = mid;
-            testResult = playUntilKeyPress( deviceIndex, sampleRate, wmmeBufferSize, wmmeBufferSize, wmmeBufferCount );
-
-            if( testResult == YES ){
-                max = mid - 1;
-                smallestWorkingBufferSize = wmmeBufferSize;
-            }else{
-                min = mid + 1;
-            }
-             
-        }while( (min <= max) && (testResult == YES || testResult == NO) );
-
-        smallestWorkingBufferingLatencyFrames = smallestWorkingBufferSize * (wmmeBufferCount - 1);
-
-        printf( "Smallest working buffer size for %d buffers is: %d\n", wmmeBufferCount, smallestWorkingBufferSize );
-        printf( "Corresponding to buffering latency of %d frames, or %f seconds.\n", smallestWorkingBufferingLatencyFrames, smallestWorkingBufferingLatencyFrames / sampleRate );
-
-        fprintf( resultsFp, "%d, %d, %d, %f\n", wmmeBufferCount, smallestWorkingBufferSize, smallestWorkingBufferingLatencyFrames, smallestWorkingBufferingLatencyFrames / sampleRate );
-        fflush( resultsFp );
-    }
-
-    fprintf( resultsFp, "###\n" );
-    fclose( resultsFp );
-    
-    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;
-}
-
+/*
+ * $Id: $
+ * Portable Audio I/O Library
+ * Windows MME low level buffer user guided parameters search
+ *
+ * Copyright (c) 2010 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 <stdio.h>
+#include <time.h>
+#include <math.h>
+
+#define  _WIN32_WINNT 0x0501 /* for GetNativeSystemInfo */ 
+#include <windows.h>    /* required when using pa_win_wmme.h */
+#include <mmsystem.h>   /* required when using pa_win_wmme.h */
+
+#include <conio.h>      /* for _getch */
+
+
+#include "portaudio.h"
+#include "pa_win_wmme.h"
+
+
+#define DEFAULT_SAMPLE_RATE             (44100.)
+
+#ifndef M_PI
+#define M_PI  (3.14159265)
+#endif
+
+#define TABLE_SIZE              (2048)
+
+#define CHANNEL_COUNT           (2)
+
+
+/* seach parameters. we test all buffer counts in this range */
+#define MIN_WMME_BUFFER_COUNT        (2)
+#define MAX_WMME_BUFFER_COUNT        (12)
+
+
+/*******************************************************************/
+/* functions to query and print Windows version information */
+
+typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL);
+
+LPFN_ISWOW64PROCESS fnIsWow64Process;
+
+static BOOL IsWow64()
+{
+    BOOL bIsWow64 = FALSE;
+
+    //IsWow64Process is not available on all supported versions of Windows.
+    //Use GetModuleHandle to get a handle to the DLL that contains the function
+    //and GetProcAddress to get a pointer to the function if available.
+
+    fnIsWow64Process = (LPFN_ISWOW64PROCESS) GetProcAddress(
+        GetModuleHandle(TEXT("kernel32")),"IsWow64Process" );
+
+    if(NULL != fnIsWow64Process)
+    {
+        if (!fnIsWow64Process(GetCurrentProcess(),&bIsWow64))
+        {
+            //handle error
+        }
+    }
+    return bIsWow64;
+}
+
+static void printWindowsVersionInfo( FILE *fp )
+{
+    OSVERSIONINFOEX osVersionInfoEx;
+    SYSTEM_INFO systemInfo;
+    const char *osName = "Unknown";
+    const char *osProductType = "";
+    const char *processorArchitecture = "Unknown";
+
+    memset( &osVersionInfoEx, 0, sizeof(OSVERSIONINFOEX) );
+    osVersionInfoEx.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
+    GetVersionEx( &osVersionInfoEx );
+
+    
+    if( osVersionInfoEx.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS ){
+        switch( osVersionInfoEx.dwMinorVersion ){
+            case 0: osName = "Windows 95"; break;
+            case 10: osName = "Windows 98"; break;  // could also be 98SE (I've seen code discriminate based 
+                                                    // on osInfo.Version.Revision.ToString() == "2222A")
+            case 90: osName = "Windows Me"; break;
+        }
+    }else if( osVersionInfoEx.dwPlatformId == VER_PLATFORM_WIN32_NT ){
+        switch( osVersionInfoEx.dwMajorVersion ){
+            case 3: osName = "Windows NT 3.51"; break;
+            case 4: osName = "Windows NT 4.0"; break;
+            case 5: switch( osVersionInfoEx.dwMinorVersion ){
+                        case 0: osName = "Windows 2000"; break;
+                        case 1: osName = "Windows XP"; break;
+                        case 2:
+                            if( osVersionInfoEx.wSuiteMask & 0x00008000 /*VER_SUITE_WH_SERVER*/ ){
+                                osName = "Windows Home Server";
+                            }else{
+                                if( osVersionInfoEx.wProductType == VER_NT_WORKSTATION ){
+                                    osName = "Windows XP Professional x64 Edition (?)";
+                                }else{
+                                    if( GetSystemMetrics(/*SM_SERVERR2*/89) == 0 )
+                                        osName = "Windows Server 2003";
+                                    else
+                                        osName = "Windows Server 2003 R2";
+                                }
+                            }break;
+                    }break;
+            case 6:switch( osVersionInfoEx.dwMinorVersion ){
+                        case 0: 
+                            if( osVersionInfoEx.wProductType == VER_NT_WORKSTATION )
+                                osName = "Windows Vista";
+                            else
+                                osName = "Windows Server 2008";
+                            break;
+                        case 1: 
+                            if( osVersionInfoEx.wProductType == VER_NT_WORKSTATION )
+                                osName = "Windows 7";
+                            else
+                                osName = "Windows Server 2008 R2";
+                            break;
+                    }break;
+        }
+    }
+
+    if(osVersionInfoEx.dwMajorVersion == 4)
+    {
+        if(osVersionInfoEx.wProductType == VER_NT_WORKSTATION)
+            osProductType = "Workstation";
+        else if(osVersionInfoEx.wProductType == VER_NT_SERVER)
+            osProductType = "Server";
+    }
+    else if(osVersionInfoEx.dwMajorVersion == 5)
+    {
+        if(osVersionInfoEx.wProductType == VER_NT_WORKSTATION)
+        {
+            if((osVersionInfoEx.wSuiteMask & VER_SUITE_PERSONAL) == VER_SUITE_PERSONAL)
+                osProductType = "Home Edition"; // Windows XP Home Edition
+            else
+                osProductType = "Professional"; // Windows XP / Windows 2000 Professional
+        }
+        else if(osVersionInfoEx.wProductType == VER_NT_SERVER)
+        {
+            if(osVersionInfoEx.dwMinorVersion == 0) 
+            {
+                if((osVersionInfoEx.wSuiteMask & VER_SUITE_DATACENTER) == VER_SUITE_DATACENTER)
+                    osProductType = "Datacenter Server"; // Windows 2000 Datacenter Server
+                else if((osVersionInfoEx.wSuiteMask & VER_SUITE_ENTERPRISE) == VER_SUITE_ENTERPRISE)
+                    osProductType = "Advanced Server"; // Windows 2000 Advanced Server
+                else
+                    osProductType = "Server"; // Windows 2000 Server
+            }
+        }
+        else
+        {
+            if((osVersionInfoEx.wSuiteMask & VER_SUITE_DATACENTER) == VER_SUITE_DATACENTER)
+                osProductType = "Datacenter Edition"; // Windows Server 2003 Datacenter Edition
+            else if((osVersionInfoEx.wSuiteMask & VER_SUITE_ENTERPRISE) == VER_SUITE_ENTERPRISE)
+                osProductType = "Enterprise Edition"; // Windows Server 2003 Enterprise Edition
+            else if((osVersionInfoEx.wSuiteMask & VER_SUITE_BLADE) == VER_SUITE_BLADE)
+                osProductType = "Web Edition"; // Windows Server 2003 Web Edition
+            else
+                osProductType = "Standard Edition"; // Windows Server 2003 Standard Edition
+        }
+    }
+
+    memset( &systemInfo, 0, sizeof(SYSTEM_INFO) );
+    GetNativeSystemInfo( &systemInfo );
+
+    if( systemInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_INTEL )
+        processorArchitecture = "x86";
+    else if( systemInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64 )
+        processorArchitecture = "x64";
+    else if( systemInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_IA64 )
+        processorArchitecture = "Itanium";
+
+
+    fprintf( fp, "OS name and edition: %s %s\n", osName, osProductType );
+    fprintf( fp, "OS version: %d.%d.%d %S\n", 
+                osVersionInfoEx.dwMajorVersion, osVersionInfoEx.dwMinorVersion, 
+                osVersionInfoEx.dwBuildNumber, osVersionInfoEx.szCSDVersion );
+    fprintf( fp, "Processor architecture: %s\n", processorArchitecture );
+    fprintf( fp, "WoW64 process: %s\n", IsWow64() ? "Yes" : "No" );
+}
+
+static void printTimeAndDate( FILE *fp )
+{
+    struct tm *local;
+    time_t t;
+
+    t = time(NULL);
+    local = localtime(&t);
+    fprintf(fp, "Local time and date: %s", asctime(local));
+    local = gmtime(&t);
+    fprintf(fp, "UTC time and date: %s", asctime(local));
+}
+
+/*******************************************************************/
+
+typedef struct
+{
+    float sine[TABLE_SIZE];
+	double phase;
+    double phaseIncrement;
+    volatile int fadeIn;
+    volatile int fadeOut;
+    double amp;
+}
+paTestData;
+
+static paTestData data;
+
+/* 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; i<framesPerBuffer; i++ )
+    {
+        float x = data->sine[(int)data->phase];
+        data->phase += data->phaseIncrement;
+        if( data->phase >= TABLE_SIZE ){
+			data->phase -= TABLE_SIZE;
+		}
+
+        x *= data->amp;
+        if( data->fadeIn ){
+            data->amp += .001;
+            if( data->amp >= 1. )
+                data->fadeIn = 0;
+        }else if( data->fadeOut ){
+            if( data->amp > 0 )
+                data->amp -= .001;
+        }
+
+		for( j = 0; j < CHANNEL_COUNT; ++j ){
+            *out++ = x;
+		}
+	}
+    
+    if( data->amp > 0 )
+        return paContinue;
+    else
+        return paComplete;
+}
+
+
+#define YES     1
+#define NO      0
+
+
+static int playUntilKeyPress( int deviceIndex, float sampleRate, 
+                             int framesPerUserBuffer, int framesPerWmmeBuffer, int wmmeBufferCount )
+{
+    PaStreamParameters outputParameters;
+    PaWinMmeStreamInfo wmmeStreamInfo;
+    PaStream *stream;
+    PaError err;
+    int c;
+
+    outputParameters.device = deviceIndex;
+    outputParameters.channelCount = CHANNEL_COUNT;
+    outputParameters.sampleFormat = paFloat32; /* 32 bit floating point processing */
+    outputParameters.suggestedLatency = 0; /*Pa_GetDeviceInfo( outputParameters.device )->defaultLowOutputLatency;*/
+    outputParameters.hostApiSpecificStreamInfo = NULL;
+
+    wmmeStreamInfo.size = sizeof(PaWinMmeStreamInfo);
+    wmmeStreamInfo.hostApiType = paMME; 
+    wmmeStreamInfo.version = 1;
+    wmmeStreamInfo.flags = paWinMmeUseLowLevelLatencyParameters | paWinMmeDontThrottleOverloadedProcessingThread;
+    wmmeStreamInfo.framesPerBuffer = framesPerWmmeBuffer;
+    wmmeStreamInfo.bufferCount = wmmeBufferCount;
+    outputParameters.hostApiSpecificStreamInfo = &wmmeStreamInfo;
+
+    err = Pa_OpenStream(
+              &stream,
+              NULL, /* no input */
+              &outputParameters,
+              sampleRate,
+              framesPerUserBuffer,
+              paClipOff | paPrimeOutputBuffersUsingStreamCallback,      /* we won't output out of range samples so don't bother clipping them */
+              patestCallback,
+              &data );
+    if( err != paNoError ) goto error;
+
+    data.amp = 0;
+    data.fadeIn = 1;
+    data.fadeOut = 0;
+    data.phase = 0;
+    data.phaseIncrement = 15 + ((rand()%100) / 10); // randomise pitch
+
+    err = Pa_StartStream( stream );
+    if( err != paNoError ) goto error;
+
+
+    do{
+        printf( "Trying buffer size %d.\nIf it sounds smooth (without clicks or glitches) press 'y', if it sounds bad press 'n' ('q' to quit)\n", framesPerWmmeBuffer );
+        c = tolower(_getch());
+        if( c == 'q' ){
+            Pa_Terminate();
+            exit(0);
+        }
+    }while( c != 'y' && c != 'n' );
+
+    data.fadeOut = 1;
+    while( Pa_IsStreamActive(stream) == 1 )
+        Pa_Sleep( 100 );
+
+    err = Pa_StopStream( stream );
+    if( err != paNoError ) goto error;
+
+    err = Pa_CloseStream( stream );
+    if( err != paNoError ) goto error;
+
+    return (c == 'y') ? YES : NO;
+
+error:
+    return err;
+}
+
+/*******************************************************************/
+static void usage( int wmmeHostApiIndex )
+{
+    int i;
+
+    fprintf( stderr, "PortAudio WMME output latency user guided test\n" );
+    fprintf( stderr, "Usage: x.exe mme-device-index [sampleRate [min-buffer-count max-buffer-count]]\n" );
+    fprintf( stderr, "Invalid device index. Use one of these:\n" );
+    for( i=0; i < Pa_GetDeviceCount(); ++i ){
+
+        if( Pa_GetDeviceInfo(i)->hostApi == wmmeHostApiIndex && Pa_GetDeviceInfo(i)->maxOutputChannels > 0  )
+            fprintf( stderr, "%d (%s)\n", i, Pa_GetDeviceInfo(i)->name );
+    }
+    Pa_Terminate();
+    exit(-1);
+}
+
+/*
+    ideas: 
+        o- could be testing with 80% CPU load
+        o- could test with different channel counts
+*/
+
+int main(int argc, char* argv[])
+{
+    PaError err;
+    int i;
+    int deviceIndex;
+    int wmmeBufferCount, wmmeBufferSize, smallestWorkingBufferSize;
+    int smallestWorkingBufferingLatencyFrames;
+    int min, max, mid;
+    int testResult;
+    FILE *resultsFp;
+    int wmmeHostApiIndex;
+    const PaHostApiInfo *wmmeHostApiInfo;
+    double sampleRate = DEFAULT_SAMPLE_RATE;
+    int wmmeMinBufferCount = MIN_WMME_BUFFER_COUNT;
+    int wmmeMaxBufferCount = MAX_WMME_BUFFER_COUNT;
+
+    err = Pa_Initialize();
+    if( err != paNoError ) goto error;
+
+    wmmeHostApiIndex = Pa_HostApiTypeIdToHostApiIndex( paMME );
+    wmmeHostApiInfo = Pa_GetHostApiInfo( wmmeHostApiIndex );
+
+    if( argc > 5 )
+        usage(wmmeHostApiIndex);
+
+	deviceIndex = wmmeHostApiInfo->defaultOutputDevice;
+	if( argc >= 2 ){
+        deviceIndex = -1;
+		if( sscanf( argv[1], "%d", &deviceIndex ) != 1 )
+            usage(wmmeHostApiIndex);
+        if( deviceIndex < 0 || deviceIndex >= Pa_GetDeviceCount() || Pa_GetDeviceInfo(deviceIndex)->hostApi != wmmeHostApiIndex ){
+            usage(wmmeHostApiIndex);
+        }
+	}
+
+    printf( "Using device id %d (%s)\n", deviceIndex, Pa_GetDeviceInfo(deviceIndex)->name );
+
+    if( argc >= 3 ){
+        if( sscanf( argv[2], "%lf", &sampleRate ) != 1 )
+            usage(wmmeHostApiIndex);
+    }
+
+    printf( "Testing with sample rate %f.\n", (float)sampleRate );
+
+    if( argc == 4 ){
+        if( sscanf( argv[3], "%d", &wmmeMinBufferCount ) != 1 )
+            usage(wmmeHostApiIndex);
+        wmmeMaxBufferCount = wmmeMinBufferCount;
+    }
+
+    if( argc == 5 ){
+        if( sscanf( argv[3], "%d", &wmmeMinBufferCount ) != 1 )
+            usage(wmmeHostApiIndex);
+        if( sscanf( argv[4], "%d", &wmmeMaxBufferCount ) != 1 )
+            usage(wmmeHostApiIndex);
+    }
+
+    printf( "Testing buffer counts from %d to %d\n", wmmeMinBufferCount, wmmeMaxBufferCount );
+
+
+    /* initialise sinusoidal wavetable */
+    for( i=0; i<TABLE_SIZE; i++ )
+    {
+        data.sine[i] = (float) sin( ((double)i/(double)TABLE_SIZE) * M_PI * 2. );
+    }
+
+	data.phase = 0;
+
+    resultsFp = fopen( "results.txt", "at" );
+    fprintf( resultsFp, "*** WMME smallest working output buffer sizes\n" );
+
+    printTimeAndDate( resultsFp );
+    printWindowsVersionInfo( resultsFp );
+    
+    fprintf( resultsFp, "audio device: %s\n", Pa_GetDeviceInfo( deviceIndex )->name );
+    fflush( resultsFp );
+
+    fprintf( resultsFp, "Sample rate: %f\n", (float)sampleRate );
+    fprintf( resultsFp, "Buffer count, Smallest working buffer size (frames), Smallest working buffering latency (frames), Smallest working buffering latency (Seconds)\n" );
+
+    for( wmmeBufferCount = wmmeMinBufferCount; wmmeBufferCount <= wmmeMaxBufferCount; ++wmmeBufferCount ){
+ 
+        printf( "Test %d of %d\n", (wmmeBufferCount - wmmeMinBufferCount) + 1, (wmmeMaxBufferCount-wmmeMinBufferCount) + 1 );
+        printf( "Testing with %d buffers...\n", wmmeBufferCount );
+
+        /*
+            Binary search after Niklaus Wirth
+            from http://en.wikipedia.org/wiki/Binary_search_algorithm#The_algorithm
+         */
+        min = 1;
+        max = (int)((sampleRate * .3) / (wmmeBufferCount-1)); //8192;    /* we assume that this size works 300ms */
+        smallestWorkingBufferSize = 0;
+
+        do{
+            mid = min + ((max - min) / 2);
+
+            wmmeBufferSize = mid;
+            testResult = playUntilKeyPress( deviceIndex, sampleRate, wmmeBufferSize, wmmeBufferSize, wmmeBufferCount );
+
+            if( testResult == YES ){
+                max = mid - 1;
+                smallestWorkingBufferSize = wmmeBufferSize;
+            }else{
+                min = mid + 1;
+            }
+             
+        }while( (min <= max) && (testResult == YES || testResult == NO) );
+
+        smallestWorkingBufferingLatencyFrames = smallestWorkingBufferSize * (wmmeBufferCount - 1);
+
+        printf( "Smallest working buffer size for %d buffers is: %d\n", wmmeBufferCount, smallestWorkingBufferSize );
+        printf( "Corresponding to buffering latency of %d frames, or %f seconds.\n", smallestWorkingBufferingLatencyFrames, smallestWorkingBufferingLatencyFrames / sampleRate );
+
+        fprintf( resultsFp, "%d, %d, %d, %f\n", wmmeBufferCount, smallestWorkingBufferSize, smallestWorkingBufferingLatencyFrames, smallestWorkingBufferingLatencyFrames / sampleRate );
+        fflush( resultsFp );
+    }
+
+    fprintf( resultsFp, "###\n" );
+    fclose( resultsFp );
+    
+    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/test/patest_wmme_low_level_latency_params.c b/test/patest_wmme_low_level_latency_params.c
index 26f17d2..a28c88b 100644
--- a/test/patest_wmme_low_level_latency_params.c
+++ b/test/patest_wmme_low_level_latency_params.c
@@ -1,192 +1,192 @@
-/*
- * $Id: $
- * Portable Audio I/O Library
- * Windows MME low level buffer parameters 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 <stdio.h>
-#include <math.h>
-
-#include <windows.h>    /* required when using pa_win_wmme.h */
-#include <mmsystem.h>   /* required when using pa_win_wmme.h */
-
-#include "portaudio.h"
-#include "pa_win_wmme.h"
-
-#define NUM_SECONDS         (6)
-#define SAMPLE_RATE         (44100)
-
-#define WMME_FRAMES_PER_BUFFER  (440)
-#define WMME_BUFFER_COUNT       (6)
-
-#define FRAMES_PER_BUFFER   WMME_FRAMES_PER_BUFFER /* hardwire portaudio callback buffer size to WMME buffer size for this test */
-
-#ifndef M_PI
-#define M_PI  (3.14159265)
-#endif
-
-#define TABLE_SIZE          (2048)
-
-#define CHANNEL_COUNT       (2)
-
-
-typedef struct
-{
-    float sine[TABLE_SIZE];
-	double 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 )
-{
-    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; i<framesPerBuffer; i++ )
-    {
-        float x = data->sine[(int)data->phase];
-        data->phase += 20;
-        if( data->phase >= TABLE_SIZE ){
-			data->phase -= TABLE_SIZE;
-		}
-
-		for( j = 0; j < CHANNEL_COUNT; ++j ){
-            *out++ = x;
-		}
-	}
-    
-    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; i<TABLE_SIZE; i++ )
-    {
-        data.sine[i] = (float) sin( ((double)i/(double)TABLE_SIZE) * M_PI * 2. );
-    }
-
-	data.phase = 0;
-
-    outputParameters.device = deviceIndex;
-    outputParameters.channelCount = CHANNEL_COUNT;
-    outputParameters.sampleFormat = paFloat32; /* 32 bit floating point processing */
-    outputParameters.suggestedLatency = 0; /*Pa_GetDeviceInfo( outputParameters.device )->defaultLowOutputLatency;*/
-    outputParameters.hostApiSpecificStreamInfo = NULL;
-
-    wmmeStreamInfo.size = sizeof(PaWinMmeStreamInfo);
-    wmmeStreamInfo.hostApiType = paMME; 
-    wmmeStreamInfo.version = 1;
-    wmmeStreamInfo.flags = paWinMmeUseLowLevelLatencyParameters | paWinMmeDontThrottleOverloadedProcessingThread;
-    wmmeStreamInfo.framesPerBuffer = WMME_FRAMES_PER_BUFFER;
-    wmmeStreamInfo.bufferCount = WMME_BUFFER_COUNT;
-    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;
-}
-
+/*
+ * $Id: $
+ * Portable Audio I/O Library
+ * Windows MME low level buffer parameters 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 <stdio.h>
+#include <math.h>
+
+#include <windows.h>    /* required when using pa_win_wmme.h */
+#include <mmsystem.h>   /* required when using pa_win_wmme.h */
+
+#include "portaudio.h"
+#include "pa_win_wmme.h"
+
+#define NUM_SECONDS         (6)
+#define SAMPLE_RATE         (44100)
+
+#define WMME_FRAMES_PER_BUFFER  (440)
+#define WMME_BUFFER_COUNT       (6)
+
+#define FRAMES_PER_BUFFER   WMME_FRAMES_PER_BUFFER /* hardwire portaudio callback buffer size to WMME buffer size for this test */
+
+#ifndef M_PI
+#define M_PI  (3.14159265)
+#endif
+
+#define TABLE_SIZE          (2048)
+
+#define CHANNEL_COUNT       (2)
+
+
+typedef struct
+{
+    float sine[TABLE_SIZE];
+	double 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 )
+{
+    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; i<framesPerBuffer; i++ )
+    {
+        float x = data->sine[(int)data->phase];
+        data->phase += 20;
+        if( data->phase >= TABLE_SIZE ){
+			data->phase -= TABLE_SIZE;
+		}
+
+		for( j = 0; j < CHANNEL_COUNT; ++j ){
+            *out++ = x;
+		}
+	}
+    
+    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; i<TABLE_SIZE; i++ )
+    {
+        data.sine[i] = (float) sin( ((double)i/(double)TABLE_SIZE) * M_PI * 2. );
+    }
+
+	data.phase = 0;
+
+    outputParameters.device = deviceIndex;
+    outputParameters.channelCount = CHANNEL_COUNT;
+    outputParameters.sampleFormat = paFloat32; /* 32 bit floating point processing */
+    outputParameters.suggestedLatency = 0; /*Pa_GetDeviceInfo( outputParameters.device )->defaultLowOutputLatency;*/
+    outputParameters.hostApiSpecificStreamInfo = NULL;
+
+    wmmeStreamInfo.size = sizeof(PaWinMmeStreamInfo);
+    wmmeStreamInfo.hostApiType = paMME; 
+    wmmeStreamInfo.version = 1;
+    wmmeStreamInfo.flags = paWinMmeUseLowLevelLatencyParameters | paWinMmeDontThrottleOverloadedProcessingThread;
+    wmmeStreamInfo.framesPerBuffer = WMME_FRAMES_PER_BUFFER;
+    wmmeStreamInfo.bufferCount = WMME_BUFFER_COUNT;
+    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/test/patest_write_stop.c b/test/patest_write_stop.c
index 7b05165..243e774 100644
--- a/test/patest_write_stop.c
+++ b/test/patest_write_stop.c
@@ -5,7 +5,7 @@
 	@author Phil Burk
 */
 /*
- * $Id: patest_write_stop.c 1083 2006-08-23 07:30:49Z rossb $
+ * $Id$
  *
  * This program uses the PortAudio Portable Audio Library.
  * For more information see: http://www.portaudio.com/
diff --git a/test/patest_write_stop.c b/test/patest_write_stop_hang_illegal.c
similarity index 58%
copy from test/patest_write_stop.c
copy to test/patest_write_stop_hang_illegal.c
index 7b05165..ed93425 100644
--- a/test/patest_write_stop.c
+++ b/test/patest_write_stop_hang_illegal.c
@@ -1,11 +1,11 @@
-/** @file patest_write_stop.c
-	@brief Play a few seconds of silence followed by a few cycles of a sine wave. Tests to make sure that pa_StopStream() completes playback in blocking I/O
+/** @file patest_write_stop_threads.c
+	@brief Call Pa_StopStream() from another thread to see if PortAudio hangs.
 	@author Bjorn Roche of XO Audio (www.xoaudio.com)
 	@author Ross Bencina
 	@author Phil Burk
 */
 /*
- * $Id: patest_write_stop.c 1083 2006-08-23 07:30:49Z rossb $
+ * $Id$
  *
  * This program uses the PortAudio Portable Audio Library.
  * For more information see: http://www.portaudio.com/
@@ -32,30 +32,65 @@
  */
 
 /*
- * The text above constitutes the entire PortAudio license; however, 
+ * 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 
+ * 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 <stdio.h>
+#include <unistd.h>
 #include <math.h>
+#include <memory.h>
+/* pthread may only be available on Mac and Linux. */
+#include <pthread.h>
 #include "portaudio.h"
 
-#define NUM_SECONDS         (5)
 #define SAMPLE_RATE         (44100)
-#define FRAMES_PER_BUFFER   (1024)
-
-#ifndef M_PI
-#define M_PI  (3.14159265)
-#endif
-
-#define TABLE_SIZE   (200)
+#define FRAMES_PER_BUFFER   (2048)
+
+static float s_buffer[FRAMES_PER_BUFFER][2]; /* stereo output buffer */
+
+/**
+ * WARNING: PortAudio is NOT thread safe. DO NOT call PortAudio
+ * from multiple threads without synchronization. This test uses
+ * PA in an ILLEGAL WAY in order to try to flush out potential hang bugs.
+ * The test calls Pa_WriteStream() and Pa_StopStream() simultaneously
+ * from separate threads in order to try to cause Pa_StopStream() to hang.
+ * In the main thread we write to the stream in a loop.
+ * Then try stopping PA from another thread to see if it hangs.
+ *
+ * @note: Do not expect this test to pass. The test is only here
+ * as a debugging aid for hang bugs. Since this test uses PA in an
+ * illegal way, it may fail for reasons that are not PA bugs.
+ */
 
+/* Wait for awhile then abort the stream. */
+void *stop_thread_proc(void *arg)
+{
+    PaStream *stream = (PaStream *)arg;
+    PaTime time;
+    for (int i = 0; i < 20; i++)
+    {
+        /* ILLEGAL unsynchronised call to PA, see comment above */
+        time = Pa_GetStreamTime( stream );
+        printf("Stream time = %f\n", time);
+        fflush(stdout);
+        usleep(100 * 1000);
+    }
+    printf("Call Pa_StopStream()\n");
+    fflush(stdout);
+    /* ILLEGAL unsynchronised call to PA, see comment above */
+    PaError err = Pa_StopStream( stream );
+    printf("Pa_StopStream() returned %d\n", err);
+    fflush(stdout);
+
+    return stream;
+}
 
 int main(void);
 int main(void)
@@ -63,28 +98,12 @@ int main(void)
     PaStreamParameters outputParameters;
     PaStream *stream;
     PaError err;
-    float buffer[FRAMES_PER_BUFFER][2]; /* stereo output buffer */
-    float sine[TABLE_SIZE]; /* sine wavetable */
-    int left_phase = 0;
-    int right_phase = 0;
-    int left_inc = 1;
-    int right_inc = 3; /* higher pitch so we can distinguish left and right. */
-    int i, j;
-    int bufferCount;
-    const int   framesBy2  = FRAMES_PER_BUFFER >> 1;
-    const float framesBy2f = (float) framesBy2 ;
-
-    
-    printf( "PortAudio Test: output silence, followed by one buffer of a ramped sine wave. SR = %d, BufSize = %d\n",
+    int result;
+    pthread_t thread;
+
+    printf( "PortAudio Test: output silence and stop from another thread. SR = %d, BufSize = %d\n",
             SAMPLE_RATE, FRAMES_PER_BUFFER);
-    
-    /* initialise sinusoidal wavetable */
-    for( i=0; i<TABLE_SIZE; i++ )
-    {
-        sine[i] = (float) sin( ((double)i/(double)TABLE_SIZE) * M_PI * 2. );
-    }
 
-    
     err = Pa_Initialize();
     if( err != paNoError ) goto error;
 
@@ -106,55 +125,39 @@ int main(void)
               NULL ); /* no callback, so no callback userData */
     if( err != paNoError ) goto error;
 
+    result = pthread_create(&thread, NULL /* attributes */, stop_thread_proc, stream);
+
     /* start the stream */
     err = Pa_StartStream( stream );
     if( err != paNoError ) goto error;
 
-    printf("Playing %d seconds of silence followed by one buffer of a ramped sinusoid.\n", NUM_SECONDS );
-
-    bufferCount = ((NUM_SECONDS * SAMPLE_RATE) / FRAMES_PER_BUFFER);
-
     /* clear buffer */
-    for( j=0; j < FRAMES_PER_BUFFER; j++ )
-    {
-        buffer[j][0] = 0;  /* left */
-        buffer[j][1] = 0;  /* right */
-    }
-    /* play the silent buffer a bunch o' times */
-    for( i=0; i < bufferCount; i++ )
-    {
-        err = Pa_WriteStream( stream, buffer, FRAMES_PER_BUFFER );
-        if( err != paNoError ) goto error;
-    }   
-    /* play a non-silent buffer once */
-    for( j=0; j < FRAMES_PER_BUFFER; j++ )
+    memset( s_buffer, 0, sizeof(s_buffer) );
+
+    /* play the silent buffer many times */
+    while( Pa_IsStreamActive(stream) > 0 )
     {
-        float ramp = 1;
-        if( j < framesBy2 )
-           ramp = j / framesBy2f;
-        else
-           ramp = (FRAMES_PER_BUFFER - j) / framesBy2f ;
-
-        buffer[j][0] = sine[left_phase] * ramp;  /* left */
-        buffer[j][1] = sine[right_phase] * ramp;  /* right */
-        left_phase += left_inc;
-        if( left_phase >= TABLE_SIZE ) left_phase -= TABLE_SIZE;
-        right_phase += right_inc;
-        if( right_phase >= TABLE_SIZE ) right_phase -= TABLE_SIZE;
+        err = Pa_WriteStream( stream, s_buffer, FRAMES_PER_BUFFER );
+        printf("Pa_WriteStream returns %d = %s\n", err, Pa_GetErrorText( err ));
+        if( err != paNoError )
+        {
+            err = paNoError;
+            break;
+        };
     }
-    err = Pa_WriteStream( stream, buffer, FRAMES_PER_BUFFER );
-    if( err != paNoError ) goto error;
 
-    /* stop stream, close, and terminate */
-    err = Pa_StopStream( stream );
-    if( err != paNoError ) goto error;
+    printf("Try to join the thread that called Pa_StopStream().\n");
+    result = pthread_join( thread, NULL );
+    printf("pthread_join returned %d\n", result);
 
+    /* close, and terminate */
+    printf("Call Pa_CloseStream\n");
     err = Pa_CloseStream( stream );
     if( err != paNoError ) goto error;
 
     Pa_Terminate();
     printf("Test finished.\n");
-    
+
     return err;
 error:
     Pa_Terminate();
diff --git a/testcvs/changeme.txt b/testcvs/changeme.txt
index 00b9c31..48904b7 100644
--- a/testcvs/changeme.txt
+++ b/testcvs/changeme.txt
@@ -1,4 +1,4 @@
-This is just a dopy little file used to test the CVS repository.
+This is just a dopy little file used to test the source code repository.
 Feel free to trash this file.
 Minor change.
 Another tweak.
@@ -17,3 +17,5 @@ testing
 PLB changing it to see if SVN broken
 Testing from Ubuntu with SVN on Assembla.
 
+5/2/2016 - Now using Git!
+
diff --git a/testcvs/file1.txt b/testcvs/file1.txt
new file mode 100644
index 0000000..a900ec6
--- /dev/null
+++ b/testcvs/file1.txt
@@ -0,0 +1,9 @@
+This is used to test the SVN versioning system.
+
+    $Revision$
+    $Author$
+    $Date$
+    $Id$
+
+After propset svn:keywords
+
diff --git a/testcvs/file2.txt b/testcvs/file2.txt
new file mode 100644
index 0000000..a900ec6
--- /dev/null
+++ b/testcvs/file2.txt
@@ -0,0 +1,9 @@
+This is used to test the SVN versioning system.
+
+    $Revision$
+    $Author$
+    $Date$
+    $Id$
+
+After propset svn:keywords
+
diff --git a/update_gitrevision.sh b/update_gitrevision.sh
new file mode 100755
index 0000000..80d4f3b
--- /dev/null
+++ b/update_gitrevision.sh
@@ -0,0 +1,17 @@
+#!/bin/bash
+#
+# Write the Git commit SHA to an include file.
+# This should be run before compiling code on Linux or Macintosh.
+#
+revision_filename=src/common/pa_gitrevision.h
+
+# Run git first to make sure it is installed before corrupting the
+# include file.
+git rev-parse HEAD
+
+# Update the include file with the current Git revision.
+echo -n "#define PA_GIT_REVISION " > ${revision_filename}
+git rev-parse HEAD >> ${revision_filename}
+
+echo ${revision_filename} now contains
+cat ${revision_filename}

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-voip/portaudio19.git



More information about the Pkg-voip-commits mailing list