How to continuously put network PCM data into fmod system


Hi, I tried to use fmod in QT to obtain the PCM data transmitted from TCP and draw it.
However, difficulties were encountered in the real-time transmission of PCM .The PCM data retrieved from the network is stored in QByteArray &buffer,but I have no idea about how to get the buffer into fmod’s system with as little memory footprint as possible.
I have tried as follow, FMOD_SYSTEM and FMOD_CREATESOUNDEXINFO has been declared before.every time the net recieves data, the function will be called.
void AudioPlot::recvData(const QString &ip, const QByteArray &buffer)
result = FMOD_System_CreateSound(system,, FMOD_OPENMEMORY, &exinfo, &sound);
uint bytes, len1, len2;
void *ptr1, *ptr2;
FMOD_Sound_GetLength(sound, &bytes, FMOD_TIMEUNIT_PCMBYTES);
FMOD_Sound_Lock(sound, 0, bytes, &ptr1, &ptr2, &len1, &len2);

    bytes /= 2;
    int step = 1, len = bytes;
    short* ps = (short*)ptr1;
    for (int i = 0, n = 0; n< len; i += step, n++)
        wavAll[n] = ps[i];
    FMOD_Sound_Unlock(sound, ptr1, ptr2, len1, len2);

but didn’t show anything.


Why did you create an FMOD Sound at all? It looks like you have the data, pass it to fmod just to get the data back again and then delete the sound?
I would just cut out the fmod part and iterate through the