PDA

View Full Version : Compile problem using portaudio functions



K4ELO
8th May 2013, 00:52
I'm hoping someone can explain this error to me.
Here's the callback function I'm building in front of the Control class:


static int PaCallback(const void *input, void *output, unsigned long frameCount, const PaStreamCallbackTimeInfo* timeInfo,
PaStreamCallbackFlags statusFlags, void *userData)
{
return 0;
}

Then in the Control class:


void Control :: openAudio()
{
err = Pa_OpenDefaultStream(&stream, 1, 0, paFloat32, ::sRate, 2048, PaCallback, userData);
qDebug() << "pa open err = " << Pa_GetErrorText(err);
}

The compile error is:
C:\Development\QT_Projects\FTdxIF4\Control.cpp:450 : error: cannot convert 'Control::PaCallback' from type 'int (Control::)(const void*, void*, long unsigned int, const PaStreamCallbackTimeInfo*, PaStreamCallbackFlags, void*) {aka int (Control::)(const void*, void*, long unsigned int, const PaStreamCallbackTimeInfo*, long unsigned int, void*)}' to type 'int (*)(const void*, void*, long unsigned int, const PaStreamCallbackTimeInfo*, PaStreamCallbackFlags, void*) {aka int (*)(const void*, void*, long unsigned int, const PaStreamCallbackTimeInfo*, long unsigned int, void*)}'
C:\Development\QT_Projects\FTdxIF4\Control.cpp:-1: At global scope:
C:\Development\QT_Projects\FTdxIF4\Control.cpp:42: warning: 'int PaCallback(const void*, void*, long unsigned int, const PaStreamCallbackTimeInfo*, PaStreamCallbackFlags, void*)' defined but not used [-Wunused-function]

I don't understand as it appears I am calling the callback function correctly.
Can anyone explain this error? Thanks!

amleto
8th May 2013, 01:12
what does this have to do with Qt programming?

It looks like you have a member method 'PaCallback', and a free function PaCallback'?