2009-08-25 8 views
0

私はvorbis-streamのコンテストをプレイするのにpulseaudioを使用しようとしていますが、問題が発生しています。C++とpulseaudioは "このスコープで宣言されていません"

‘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 

いくつかのコードは以下の通りです:Basicly私はそれを聞いている誰もが指し示すことができれば

#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; 
} 

それはおそらく、いくつかの単純な誤りですが、私は正しい方向に私を、それは素晴らしいだろう!

答えて

5

それらのものは全てsimple.hで定義されているので、あなたのファイルの先頭に新しい#includeを追加している:あなたそんなに

#include <pulse/simple.h> 
+0

おかげ。それを見た後にpulseaudio.hに含まれるすべてのファイルを考えましたが、私はそれを見逃しているに違いありません。ありがとう! –

関連する問題