Hello all!
Sorry for my English!
I don't know, need it to somebody someday or not. But I want to publish my instructions to build "Portaudio stable_v19_20140130" library. In this library available record audio with WASAPI.
Download PortAudio "pa_stable_v19_20140130.tgz"
http://www.portaudio.com/download.html1) Pelles C 8.00 64bit > New project > Win64 Static library (LIB)
Project name: "portaudio".
2) Pelles C compiler option:
2.1) \Ze (Enable Microsoft extensions)
2.2) Runtime library: Multithreaded (LIB)
2.3) Example compiler options: -std:C11 -Tx64-coff -MT -Ot -Ob1 -fp:precise -W1 -Gr -Ze
3) Copy folders "src" and "include" from "portaudio" in archive "pa_stable_v19_20140130.tgz" to project folder.
4) Add source files *.c to project from \src\common; \src\os\win; src\hostapi\wasapi; src\hostapi\wmme
5) Additional Include Directories: \include; \src\common; \src\os\win; src\hostapi\wasapi\mingw-include
5.1) Should be this order:
\include
\src\common
\src\os\win
src\hostapi\wasapi\mingw-include
<Pelles C dir>\Include\Win
<Pelles C dir>\Include
6) Preprocessor Definitions: 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=0
7) Changes in the source files of the library:
7.1) \src\common\pa_debugprint.c
line 77:
#if _MSC_VER
#if defined(_MSC_VER)
7.2) \src\common\pa_memorybarrier.h
7.2.1) First way
line 101:
#elif (_MSC_VER >= 1400) && !defined(_WIN32_WCE)
#elif (_MSC_VER >= 1100) && !defined(_WIN32_WCE)
Comment lines 103-109 (inclusive)
Add after line 109:
#define PaUtil_FullMemoryBarrier() __memory_barrier()
#define PaUtil_ReadMemoryBarrier() __memory_barrier()
#define PaUtil_WriteMemoryBarrier() __memory_barrier()
7.2.2) Other way (
not safety !!!)
Comment lines 115-117 (inclusive)
Add after line 117: (
not safety !!!)
#define PaUtil_FullMemoryBarrier()
#define PaUtil_ReadMemoryBarrier()
#define PaUtil_WriteMemoryBarrier()
7.3) \src\hostapi\wasapi\mingw-include\ksmedia.h
Add after line 823:
#ifndef WINBOOL
#define WINBOOL BOOL
#endif
7.4) \src\hostapi\wasapi\pa_win_wasapi.c
Change 2 lines (3470, 3649) where functions "alloca" to "_alloca"
Change line 52:
#if defined(_MSC_VER) && (_MSC_VER >= 1400)
#if defined(_MSC_VER) && (_MSC_VER >= 1100)
Add after line 520:
#ifndef __FUNCTION__
#define __FUNCTION__ __func__
#endif
7.5) \src\hostapi\wmme\pa_win_wmme.c
Change 4 lines (2337, 2387, 3713, 3819) where functions "alloca" to "_alloca"
For create program with "portaudio.lib":
1) Copy folder "include" from "portaudio" in archive "pa_stable_v19_20140130.tgz" to project folder.
2) Add line to your code:
#include "include/portaudio.h"
3) Pelles C compiler option:
\Ze (Enable Microsoft extensions)
Runtime library: Multithreaded (LIB)
4) Additional library and object files: ole32.lib winmm.lib pomp64.lib uuid.lib portaudio.lib
Everything checked me. Works.
But there are warnings when compiling the library. But the library functions and the audio recording works.
PortAudio documentation:
http://www.portaudio.com/docs.htmlAnd I have a question. How to safely and correctly use the function __memory_barrier() (in 7.2.1 item) ? Thank you all.