I am trying to define the TWaveFormatExtensible
type, but I am not sure if am I declaring correctly the Samples
union. Here is the original declaration from header file (Windows SDK 10.0.17763.0):
typedef struct {
WAVEFORMATEX Format;
union {
WORD wValidBitsPerSample; /* bits of precision */
WORD wSamplesPerBlock; /* valid if wBitsPerSample==0 */
WORD wReserved; /* If neither applies, set to zero. */
} Samples;
DWORD dwChannelMask; /* which channels are */
/* present in stream */
GUID SubFormat;
}
And this is what I've tried:
type
TWAVEFORMATEX = record
wFormatTag: Word;
nChannels: LongWord;
nSamplesPerSec: Word;
nAvgBytesPerSec: LongWord;
nBlockAlign: Word;
wBitsPerSample: Word;
cbSize: Word;
end;
TWaveFormatExtensible = record
Format: TWAVEFORMATEX;
dwChannelMask: LongWord;
SubFormat: Integer;
case Word of
0: (wValidBitsPerSample: Word;);
1: (wSamplesPerBlock: Word;);
2: (wReserved: Word;);
end;
But that's not correct. How would one declare a union inside a record structure in Delphi?
WAVEFORMATEXTENSIBLE
. What is stopping you from simply declaring it yourself in your own code? – ThermoelectricitySubFormat
is of typeGUID
(TGUID
in Delphi), notInteger
. And membernChannels
is of typeWORD
andnSamplesPerSec
isDWORD
. Except that you should preferrably use native types, e.g.DWORD
members declare asDWORD
types. – Dragonet