support Administrator
Joined: January 26 2005 Location: United States Posts: 1666
|
Posted: December 31 2009 at 1:00pm | IP Logged
|
|
|
Hello Geoff,
Quick Note:
When reading wave files, the media engine supports wave file samples using aLaw, uLaw or PCM sample formats. So your wav files should be in one of these three supported formats.
The simplest way to remove the compiler error you have is to create your sample buffer as a generic C# Object array. Instead of using “byte” use “Object” such as:
Code:
// create a new sample buffer.
WaveSampleBuffer = new Object[SamplesPerBuffer];
|
|
|
Then pass this C# buffer to the “GetWaveBuffer()” proc like:
Code:
// Read a single wave buffer block.
WaveFile.GetWaveBuffer(WaveSampleBuffer)
|
|
|
After you call the GetWaveBuffer() proc, your generic Object buffer will take on the type cast of either byte or short depending on if your wav file contained aLaw/uLaw or PCM samples.
There is a common C# code module in the samples that come with the media engine. See the module VoipApplication.cs. This module contains a proc called MusicOnHoldThreadHandler(). In this proc, it calls the wave buffer read procs. Take a look at the code if you want, it will give you an example of how the VOIP code samples read wave buffers from files using C#.
I hope this helps…..
Thank you,
Randal
|