Can you please provide sample code:
how to access the memory buffer containing the sound recording in memory? I would like to store it as a byte array in a database.
Hello,
in C# it should be something similar:
byte[] m_buffTemp = null;
// get the pointer in memory and allocate a C# buffer
long pSound = audioSoundRecorder1.RecordedSound.GetMemoryPtr();
Int32 size = audioSoundRecorder1.RecordedSound.GetMemorySize();
m_buffTemp = new byte[size];
// copy from real memory to C# buffer
Marshal.Copy ((IntPtr) pSound, m_buffTemp, 0, size);
// now output the C# buffer into a memory stream
MemoryStream ms = new MemoryStream();
ms.Write(m_buffTemp, 0, size);
// now output the memory stream to a file
FileStream fs = File.OpenWrite("c:\\test.wav");
fs.Write(ms.GetBuffer(), 0, (int) ms.Position);
fs.Close();
In this case, just for simplicity, the memory stream is written to a file but you could do what you prefer with it.
Hope this helps.
Kind Regards
Severino Delaurenti
MultiMedia Soft
Hello,
thank you. It helped a lot, the code worked perfectly.
Best Regards
Laszlo