Akio wrote:
- what is the different between "plughw:0,0", "defalut", "hw:0.0"?
"hw" goes directly to the driver, without any plugins. "plughw" inserts sample rate and/or sample format conversion plugins if the format requested by the application is not supported by the driver. "default" does some additional things, depending on the driver. On most cards, it adds the "dmix" plugin for software mixing.
a. the channel opened is just only one, but If I set the snd_pcm_hw_params_set_access as SND_PCM_ACCESS_RW_NONINTERLEAVED. using snd_pcm_readn and snd_pcm_writen the code will not work. what is the wrong? but if set snd_pcm_hw_params_set_access as SND_PCM_ACCESS_RW_INTERLEAVED and using snd_pcm_readi and snd_pcm_writei. the code work very well. one channel also have data interleave problem?
INTERLEAVED is the only supported format for most stereo sound cards, so it is the setting to be used for mono, too.
NONINTERLEAVED is only used for multichannel streams that are not interleaved.
b. in snd_pcm_open the block flag is set as 0. what is the mode of the operation? blocking or non-blocking?
Blocking.
After long time test. the test procedure is as the following steps:
- capture voice data as PCM data.
- encoded as amr-wb bit stream.
- decoded as PCM data from encoded bit stream.
- playback PCM data.
after 16 hours continue tests, there are some delay, about 800 mili seconds.
You did not specify between what two quantities you've measured the delay, but I guess you mean the relative positions of the playback and capture devices.
The speed of the devices is determined by the hardware. The playback and capture devices will run out of sync if they are not using the same clock. Are the capture and playback devices on different computers?
is there any way to reduce the delay after long time test.
Measure the relative speed of the capture and playback devices, then resample accordingly (or just insert or drop a sample when needed).
- If we want using salsa lib to replace the usage of alsa lib, what do we have to take care?
Plugins for sample rate/format conversion of software mixing are not available, so your application must use a sample format support by the hardware, and only one application can use the device at the same time.
how about the latency and performance between salsa and alsa?
This is the same as when using the "hw" device with alsa-lib. The purpose of salsa is to save memory.
HTH Clemens