[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.axapta.programming

WaveFormatExtensible 24 bits 48KHz problem with audio player in C#

BarreJ

3/2/2006 8:53:00 PM

Hi,

I've implemented a WaveFormatExtensible for 24 bits 48KHz on low-level audio
player in C# samples at
the following URL:
http://www.codeproject.com/cs/media/cswavplay.asp?df=100&forumid=13779&exp=0&select=1391819#x....
All, playback works fine but there are a blocks alignment problem.
For test I'm playing back a ref wave file PCM 24 bits 48KHz sin 1KHz and I'm
checking it with WaveLabs Demo (free download on Steinberg site).

I'm setting 4 buffers of 65536 Bytes as preconized for my Audio Board (Lynx
AES16).

I think there is a problem on WaveFormatExtensible or buffers controls
methods with this format.

Can someone help me?

Code:
[StructLayout(LayoutKind.Sequential)]
public class WaveFormatExtensible
{
public ushort wFormatTag;
public ushort nChannels;
public uint nSamplesPerSec;
public uint nAvgBytesPerSec;
public ushort nBlockAlign;
public ushort wBitsPerSample;
public ushort cbSize;

public ushort wValidBitsPerSample;
public uint dwChannelMask;
public Guid SubFormat;

public WaveFormatExtensible(uint rate, uint bits, uint channels)
{
wFormatTag = 0xFFFE; //WAVE_FORMAT_EXTENSIBLE
nChannels = (ushort)channels;
nSamplesPerSec = rate;
wBitsPerSample = (ushort)bits;
cbSize = 22;

nBlockAlign = (ushort)(channels * (bits / 8));
nAvgBytesPerSec = nSamplesPerSec * nBlockAlign;

wValidBitsPerSample = wBitsPerSample;
dwChannelMask = 3; //Stereo
SubFormat = new Guid("00000001-0000-0010-8000-00aa00389b71");
}
}