C ++ 및 Pulseaudio“이 범위에서 선언되지 않았다”
-
19-09-2019 - |
문제
나는 Pulseaudio를 사용하여 Vorbis-stream의 대회를하기 위해 노력하고 있지만 문제를 일으키고 있습니다. 기본적으로 나는 다음과 같습니다.
‘pa_simple’ was not declared in this scope
‘pa_simple_new’ was not declared in this scope
‘pa_simple_write’ was not declared in this scope
일부 코드는 다음과 같습니다.
#include <pulse/pulseaudio.h>
pa_simple *s;
pa_sample_spec ss;
ss.format = PA_SAMPLE_S16NE;
ss.channels = 2;
ss.rate = 44100;
s = pa_simple_new(
NULL, // Use the default server.
"Fooapp", // Our application's name.
PA_STREAM_PLAYBACK, // Playback
NULL, // Use the default device.
"Music", // Description of our stream.
&ss, // Our sample format.
NULL, // Use default channel map
NULL, // Use default buffering attributes.
NULL, // Ignore error code.
);
while((samples=vorbis_synthesis_pcmout(&vd,&pcm))>0){
int j;
int bout=(samples<convsize?samples:convsize);
cout << "D" << endl;
for(i=0;i<vi.channels;i++){
ogg_int16_t *ptr=convbuffer+i;
float *mono=pcm[i];
for(j=0;j<bout;j++){
int val=floor(mono[j]*32767.f+.5f);
*ptr=val;
ptr+=vi.channels;
}
}
cout << "E" << endl;
#ifdef PulseAudio
pa_simple_write(s,convbuffer,2*vi.channels,NULL);
#else
fwrite(convbuffer,2*vi.channels,bout,output);
#endif
vorbis_synthesis_read(&vd,bout);
cout << "F" << endl;
}
아마도 간단한 오류 일 것입니다. 그러나 누군가가 나를 올바른 방향으로 가리킬 수 있다면 그것은 좋을 것입니다!
해결책
그런 것들은 모두 정의되어 있습니다 단순 .h, 새를 추가하십시오 #include
파일 상단에 :
#include <pulse/simple.h>
제휴하지 않습니다 StackOverflow