Loads a sound file stored inside a memory buffer for editing purposes. The sound file can be a stream file or a MOD music file (see the LoadSound method for supported formats).
You can manage how loaded sound will be added to the existing editing session through a previous call to the SetLoadingMode method.
You can limit the range of sound data that will be loaded from the given sound file with a previous call to the SetLoadingRange method.
For loading files in RAW format use the LoadSoundFromRawMemory method.
In case you should need loading a specific single channel of the audio file, use the LoadSoundChannelFromMemory method.
IMPORTANT TOPIC: remember that the memory buffer containing song data must not be moved and needs to be available till the call to the CloseSound method.
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)
' load song from memory buffer and resample its contents at 44100, stereo, 16 bits
ActiveSoundEditor1.LoadSoundFromMemory 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;
// load song from memory buffer and resample its contents at 44100, stereo, 16 bits
m_ctrlActiveEditor.LoadSoundFromMemory (va, iSize);