i am wirting codes to playing a voice segment by
calling SndStreamCreate, first i wrote code in OS6
and everything is ok, then i create a 68K project
in PODS, and make some changed to the codes for the
reason of data types and other issues. the Simple
Sound API is called from one C++ class instance like
this:

WavOut.h file:

Err SndCallBack( void *userdata, SndStreamRef channel, void *buffer, UInt32 
numberofframes);

class CWavOut{
    //some other variables and functions...
    void PlayVoice();
}

and in the .cpp file:

void CWavOut::PlayVoice(){
    //load voice data from database and set the user data 
    //structure m_structAudioData...

    //call SndStreamCreate
    m_status = SndStreamCreate( &m_sndStreamRef, sndOutput, 22050, 
        sndInt16Little, sndMono, SndCallBack,                           
&m_structAudioData, 4096, false );

    //if the stream reference is valid, start the stream
    SndStreamStart(...);
}

Err SndCallBack( void *userdata, SndStreamRef channel, void *buffer, UInt32 
numberofframes){
    //fill the buffer using the user data pointer...
    return errNone;
}

the problem is:

1. when start the stream, there will be an OpenSocket error
in the simulator(OS5.4),ignoring it could proceede...

2. after igoring the error, the callback function will be 
called, after handling the buffer filling and return, the
callback will never called again, only one time, it is 
strange, should i add extern "C" in the code for callback
function definition? i ever add that, but it still be called
only one time, what's the problem?

regards!

-- 
For information on using the PalmSource Developer Forums, or to unsubscribe, 
please see http://www.palmos.com/dev/support/forums/

Reply via email to