Intention: Play back real-time streaming sound when someone is speaking in a microphone of what they say.
Problem: newsound comes back as a NULL pointer.
I checked out the tutorials for recordtodisk and made some modifications to suit the purpose of residing the sample in memory. I’m stumped and now have the flu to compound my pain! Please help.
[code:1l4qdx1q] sound->lock(lastrecordpos * exinfo.numchannels * 2, blocklength * exinfo.numchannels * 2, &ptr1, &ptr2, &len1, &len2); /* * exinfo.numchannels * 2 = stereo 16bit. 1 sample = 4 bytes. */
FMOD::Sound * newsound; memset(&exinfo2, 0, sizeof(FMOD_CREATESOUNDEXINFO)); exinfo2.cbsize = sizeof(FMOD_CREATESOUNDEXINFO); exinfo2.length = len1; FMOD_RESULT result = audio.GetSystem()->createStream((const char *)ptr1, FMOD_2D | FMOD_SOFTWARE | FMOD_OPENMEMORY, &exinfo2, &newsound); /* Unlock the sound to allow FMOD to use it again. */ sound->unlock(ptr1, ptr2, len1, len2);[/code:1l4qdx1q]
- codingsolo asked 10 years ago
Please login first to submit.