0

我正在使用 QNX neutrino RTOS,我是 QNX 的新手。我已经用两个线程之间的一些 IPC 消息设置了我的第一个项目。

我想要做的是有一个线程作为麦克风“驱动程序”,它对来自麦克风的输入进行采样并将其作为 PCM 数据包存储/发送到另一个线程,该线程将其从扬声器中播放出来。

那么,是否有任何音频支持库?,实现录音麦克风输入和扬声器输出的最佳方法是什么?

4

1 回答 1

1

Yes, QNX comes with an audio library.

The audio library is documented starting at this location (6.5 SP1 version): http://www.qnx.com/developers/docs/6.5.0_sp1/index.jsp?topic=%2Fcom.qnx.doc.neutrino_audio%2Fabout.html&cp=13_1

Your qnx system includes a utility (command) called "wave" for playing back a .wav file and "waverec" for recording audio from the microphone and saving it to a .wav file.

You can use the "use wave" and "use waverec" commands for getting information about the supported command line options.

The documentation includes the complete source of the wave and waverec utilities:

wave.c: http://www.qnx.com/developers/docs/6.5.0_sp1/index.jsp?topic=%2Fcom.qnx.doc.neutrino_audio%2Fwavec.html

waverec.c: http://www.qnx.com/developers/docs/6.5.0_sp1/index.jsp?topic=%2Fcom.qnx.doc.neutrino_audio%2Fwaverec.html

The recommended way to start with audio recording and playback is to first have the wave and waverec binaries shipped with the system working. After that build the supplied source, have it working again, then understand it and embed in your application, possibly after stripping it down. (Because the sample is generic and perhaps you want to hard-code certain features that are dynamically configured in the sample).

You need to link against the libasound.so library in order to build the samples. A minimal command-line example (tested) to build wave.c for armlev7 and x86:

ntoarmv7-gcc wave.c -o wave -l asound
ntox86-gcc wave.c -o wave -l asound

If you are building via the IDE then you need to add the library in the appropriate setting.

You are welcome to post here any questions you may have while working with the samples.

于 2014-02-21T16:32:24.957 回答