Starts a new recording session from a sound contained inside a memory buffer.
The sound contained inside the memory buffer can be in any of the sound formats supported by the StartFromFile method.
Sound files in various RAW formats can be loaded using the StartFromMemoryRaw method.
For details about recording from files see the How to record from files, memory or clipboard section.
Below you can find a couple of samples that demonstrate how to record a sound store inside a memory buffer in Visual Basic 6 and Visual C++ 6: the sound has been taken from a .RES resource file using the "identifier" variable.
Visual Basic 6
' the memory buffer must be declared as global
Dim bytSound() As Byte
Private Sub Command1_Click()
Dim length As Long
bytSound = LoadResData(identifier, 10)
length = UBound(bytSound)
' record sound from memory buffer and resample its contents using the first available format (index '0' is usually 11025, mono, 8 bits)
ActiveSoundRecorder1.RecorderStartFromMemory 0, "c:\output.wav", VarPtr(bytSound(0)), length
Visual C++ 6 with MFC
HINSTANCE hInst = AfxGetResourceHandle();
HRSRC hrsrc = ::FindResource(hInst, MAKEINTRESOURCE (identifier), RT_RCDATA);
HGLOBAL hg = LoadResource(hInst, hrsrc);
BYTE *pRes = (BYTE*) LockResource(hg);
int iSize = ::SizeofResource(hInst, hrsrc);
va.vt = VT_BYREF | VT_UI1;
va.pbVal = (BYTE *) pRes;
// record sound from memory buffer and resample its contents using the first available format (index '0' is usually 11025, mono, 8 bits)
m_ctrlActiveRecorder.RecorderStartFromMemory (0, "c:\\output.wav", va, iSize);