0
我想用PortAudio庫來播放音頻數據。這個音頻數據來自UDP paquets。如何從UPD paquets打開流?
我看到有Pa_OpenDefaultStream()(和Pa_OpenStream(),這是非常相似)函數打開流:
PaStream *stream;
PaError err;
/* Open an audio I/O stream. */
err = Pa_OpenDefaultStream(&stream,
0, /* no input channels */
2, /* stereo output */
paFloat32, /* 32 bit floating point output */
SAMPLE_RATE,
256, /* frames per buffer, i.e. the number
of sample frames that PortAudio will
request from the callback. Many apps
may want to use
paFramesPerBufferUnspecified, which
tells PortAudio to pick the best,
possibly changing, buffer size.*/
patestCallback, /* this is your callback function */
&data); /*This is a pointer that will be passed to
your callback*/
我想我必須用它來打我的paquets但我不知道如何使用它:
- 什麼是第一個參數?
- 爲什麼我必須定義回調函數?
這裏是對PortAudio文檔的鏈接:http://www.portaudio.com/trac/
任何幫助,將不勝感激:)
感謝。
你會如何編寫一個「簡單的回調函數」?我很願意編碼(錄音時聽音頻)。謝謝 – 2010-11-25 00:56:35