[Portaudio] paUInt8 and paInt8 always get zero data in audio input CallBack function

奇先生 winland0704 at 126.com
Wed Nov 21 23:29:37 EST 2018



1. Just edit  portaudio/examples/paex_record.c,
change the sample type to paUInt8 or  paInt8:


#define PA_SAMPLE_TYPE  paUInt8
typedef unsigned char SAMPLE;
#define SAMPLE_SILENCE  (128)
#define PRINTF_S_FORMAT "%d"


Build the example, run it, and you will get all zero data in the callback function.
The sound devices have no problem and the micphone is ok too.
It is  a bug in portaudio library.
paInt16 and  paFloat32 get correct data, 
but paUInt8 and paInt8 always get zero data.


2. Test environment
Used souce code: pa_stable_v190600_20161030.tgz
System: WinXP or Win7 
Build environment:  MinGW32  + MSYS
gcc.exe (i686-posix-dwarf-rev2, Built by MinGW-W64 project) 4.9.1


3. Build cmd:  
./configure --prefix=/mingw --enable-static --enable-shared --with-winapi=wmme,directx
make all
make install


4. I write another Qt  example with Qt 5.4.0 MinGW version,


https://gitee.com/qtguide/oscodec/tree/master/examples/ch03/audioin


The QAudioInput class works fine  with 8 bits sampling , 
but portaudio always gets zero data when using 8 bits sampling.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.columbia.edu/pipermail/portaudio/attachments/20181122/e0dbcbf3/attachment.html>


More information about the Portaudio mailing list