Pulseaudio API로 놀고 있었고 사운드 시스템이 어떻게 작동하는지에 대한 지식이 거의 없기 때문에 마이크를 사용하여 여러 애플리케이션을 사용할 수있는 이유를 실제로 이해하지 못했습니다. 동시에.마이크가 이미 C에서 Linux와 함께 사용되고 있는지 확인하십시오.
또는 더 나은 문구로 : 왜 fprintf
이 호출되지 않는가? 적극적으로 녹음하는 2 개의 응용 프로그램이 있으며 다음 프로그램을 시작합니까?
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <pulse/simple.h>
#include <pulse/error.h>
#define BUFSIZE 1024
int main(int argc, char*argv[]) {
/* The sample type to use */
static const pa_sample_spec ss = {
.format = PA_SAMPLE_S16LE,
.rate = 44100,
.channels = 2
};
pa_simple *s = NULL;
int ret = 1;
int error;
/* Create the recording stream */
if (!(s = pa_simple_new(NULL, argv[0], PA_STREAM_RECORD, NULL, "record", &ss, NULL, NULL, &error)))
fprintf(stderr, __FILE__": pa_simple_new() failed: %s\n", pa_strerror(error));
return 0;
}
답변 해 주셔서 감사합니다. 이미 pulseaudio 웹 페이지에 작성된 API 중 일부를 시도했지만 마이크가 이미 사용되고 있는지 확인하는 방법을 찾지 못했습니다. 일부는 'get_mic_state'또는 'is_mic_recording'과 같습니다 ' – polslinux