1 #ifndef __G31DDCAPI_H__
2 #define __G31DDCAPI_H__
3 
4 #ifdef WIN32_LEAN_AND_MEAN
5 
6 #include <basetyps.h>
7 
8 #endif
9 
10 #include <windows.h>
11 
12 #define G31DDC_CLASS_ID_DEVICE_ENUMERATOR  0x7101
13 #define G31DDC_CLASS_ID_DEVICE             0x7102
14 
15 #ifndef __G3XDDC_INTERFACE__
16 #define __G3XDDC_INTERFACE__
17 
18 #define G3XDDC_INTERFACE_TYPE_PCIE    0
19 #define G3XDDC_INTERFACE_TYPE_USB     1
20 
21 #endif //__G3XDDC_INTERFACE__
22 
23 #ifndef __G3XDDC_FRONT_PANEL_LED__
24 #define __G3XDDC_FRONT_PANEL_LED__ 1
25 
26 #define G3XDDC_FRONT_PANEL_LED_MODE_DIAG    0
27 #define G3XDDC_FRONT_PANEL_LED_MODE_ON      1
28 #define G3XDDC_FRONT_PANEL_LED_MODE_OFF     2
29 
30 #endif //__G3XDDC_FRONT_PANEL_LED__
31 
32 #ifndef __G3XDDC_OPEN__
33 #define __G3XDDC_OPEN__ 1
34 
35 #define G3XDDC_OPEN_DEMO   ((CHAR*)0x00000000)
36 #define G3XDDC_OPEN_FIRST  ((CHAR*)0xFFFFFFFF)
37 
38 #endif //__G3XDDC_OPEN__
39 
40 #if !defined(__G3XDDC_MODES__) || __G3XDDC_MODES__<1
41 
42 #undef __G3XDDC_MODES__
43 #define __G3XDDC_MODES__ 1
44 
45 #define G3XDDC_MODE_CW               0
46 #define G3XDDC_MODE_AM               1
47 #define G3XDDC_MODE_FM               2
48 #define G3XDDC_MODE_LSB              4
49 #define G3XDDC_MODE_USB              5
50 #define G3XDDC_MODE_AMS              8
51 #define G3XDDC_MODE_DRM              18
52 
53 #endif //__G3XDDC_MODES__
54 
55 #define G31DDC_MODE_COUNT            7
56 
57 
58 
59 #ifndef __G3XDDC_SIDE_BAND__
60 #define __G3XDDC_SIDE_BAND__ 1
61 
62 #define G3XDDC_SIDE_BAND_LOWER         0x01
63 #define G3XDDC_SIDE_BAND_UPPER         0x02
64 #define G3XDDC_SIDE_BAND_BOTH          (G3XDDC_SIDE_BAND_LOWER|G3XDDC_SIDE_BAND_UPPER)
65 
66 #endif //__G3XDDC_SIDE_BAND__
67 
68 
69 
70 #if !defined(__G3XDDC_DEMODULATOR_PARAMS__) || __G3XDDC_DEMODULATOR_PARAMS__<1
71 
72 #undef __G3XDDC_DEMODULATOR_PARAMS__
73 #define __G3XDDC_DEMODULATOR_PARAMS__ 1
74 
75 #define G3XDDC_DEMODULATOR_PARAM_AMS_SIDE_BAND          0x00000001
76 #define G3XDDC_DEMODULATOR_PARAM_AMS_CAPTURE_RANGE      0x00000002
77 #define G3XDDC_DEMODULATOR_PARAM_CW_FREQUENCY           0x00000003
78 #define G3XDDC_DEMODULATOR_PARAM_DRM_AUDIO_SERVICE      0x00000004
79 #define G3XDDC_DEMODULATOR_PARAM_DRM_MULTIMEDIA_SERVICE 0x00000005
80 
81 #pragma pack(push,1)
82 
83 typedef struct
84 {
85     UINT32  Tune;   //Hz
86     UINT32  Lock;   //Hz
87 } G3XDDC_AMS_CAPTURE_RANGE;
88 
89 #pragma pack(pop)
90 
91 #endif //__G3XDDC_DEMODULATOR_PARAMS__
92 
93 
94 
95 #if !defined(__G3XDDC_DEMODULATOR_STATES__) || __G3XDDC_DEMODULATOR_STATES__<1
96 
97 #undef __G3XDDC_DEMODULATOR_STATES__
98 #define __G3XDDC_DEMODULATOR_STATES__ 1
99 
100 #define G3XDDC_DEMODULATOR_STATE_AMS_LOCK               0x00000001
101 #define G3XDDC_DEMODULATOR_STATE_AMS_FREQUENCY          0x00000002
102 #define G3XDDC_DEMODULATOR_STATE_AM_DEPTH               0x00000003
103 #define G3XDDC_DEMODULATOR_STATE_TUNE_ERROR             0x00000004
104 #define G3XDDC_DEMODULATOR_STATE_DRM_STATUS             0x00000005
105 #define G3XDDC_DEMODULATOR_STATE_FM_DEVIATION           0x00000006
106 
107 #endif //__G3XDDC_DEMODULATOR_STATES__
108 
109 
110 
111 #ifndef __G3XDDC_DRM__
112 #define __G3XDDC_DRM__ 1
113 
114 #define G3XDDC_DRM_STATE_MODE_NOT_DETERMINED_YET       -1
115 #define G3XDDC_DRM_STATE_MODE_A                        0
116 #define G3XDDC_DRM_STATE_MODE_B                        1
117 #define G3XDDC_DRM_STATE_MODE_C                        2
118 #define G3XDDC_DRM_STATE_MODE_D                        3
119 
120 #define G3XDDC_DRM_STATE_INTERLEAVER_LONG              0       //long interleaver used (2 sec)
121 #define G3XDDC_DRM_STATE_INTERLEAVER_SHORT             1       //short interleaver used (400 msec)
122 
123 #define G3XDDC_DRM_STATE_QAM_TYPE_STD                  0       //standard
124 #define G3XDDC_DRM_STATE_QAM_TYPE_HIER_SYM             1       //hierarchical symmetrical
125 #define G3XDDC_DRM_STATE_QAM_TYPE_HIER_MIX             2       //hierarchical mixed
126 
127 #define G3XDDC_DRM_STATE_SERVICE_CONTENT_EMPTY         0x00    //service is not used/contains no data
128 #define G3XDDC_DRM_STATE_SERVICE_CONTENT_AUDIO         0x01    //service contains audio data
129 #define G3XDDC_DRM_STATE_SERVICE_CONTENT_TEXTMSG       0x02    //service contains text messages
130 #define G3XDDC_DRM_STATE_SERVICE_CONTENT_MULTIMEDIA    0x04    //service contains multimedia data
131 #define G3XDDC_DRM_STATE_SERVICE_CONTENT_DATA          0x08    //service contains application specific data
132 
133 #define G3XDDC_DRM_STATE_AUDIO_CODING_AAC              0       //audio coding is AAC
134 #define G3XDDC_DRM_STATE_AUDIO_CODING_CELP             1       //audio coding is CELP
135 #define G3XDDC_DRM_STATE_AUDIO_CODING_HVXC             2       //audio coding is HVXC
136 #define G3XDDC_DRM_STATE_AUDIO_CODING_RFU              3       //reserved for future use
137 
138 #define G3XDDC_DRM_STATE_AUDIO_MODE_AAC_MONO           0       //mono
139 #define G3XDDC_DRM_STATE_AUDIO_MODE_AAC_PARAM_STEREO   1       //parametric stereo
140 #define G3XDDC_DRM_STATE_AUDIO_MODE_AAC_STEREO         2       //stereo
141 #define G3XDDC_DRM_STATE_AUDIO_MODE_AAC_RFU            3       //reserved for future use
142 
143 #define G3XDDC_DRM_STATE_AUDIO_MODE_CELP_NO_CRC        0       //audio data is without CRC
144 #define G3XDDC_DRM_STATE_AUDIO_MODE_CELP_CRC           1       //CRC used
145 #define G3XDDC_DRM_STATE_AUDIO_MODE_CELP_RFU_10        2       //reserved for future use
146 #define G3XDDC_DRM_STATE_AUDIO_MODE_CELP_RFU_11        3       //reserved for future use
147 
148 #define G3XDDC_DRM_STATE_AUDIO_MODE_HVXC_RFU_00        0       //reserved for future use
149 #define G3XDDC_DRM_STATE_AUDIO_MODE_HVXC_RFU_01        1       //reserved for future use
150 #define G3XDDC_DRM_STATE_AUDIO_MODE_HVXC_RFU_10        2       //reserved for future use
151 #define G3XDDC_DRM_STATE_AUDIO_MODE_HVXC_RFU_11        3       //reserved for future use
152 
153 #pragma pack(push,1)
154 
155 typedef struct
156 {
157     BOOL            Valid;                          //entries below are invalid/valid
158 
159     struct
160     {
161         BOOL        SyncFound;
162         BOOL        FACDecoded;
163         BOOL        SDCDecoded;
164         BOOL        AudioDecoded;
165         SHORT       NumberOfAudioFrames;            //-1 if not available
166         SHORT       NumberOfAudioErrors;            //-1 if not available
167     } DecodingState;
168 
169 
170     INT32           Mode;                           //G3XDDC_DRM_STATE_MODE_*
171 	double          RFBandwidth;                    //occupied RF bandwith in kHz, 0 = invalid or information not (yet) available
172     BYTE            Interleaver;                    //G3XDDC_DRM_STATE_INTERLEAVER_*
173     SHORT           SDCQam;                         //coding of the SDC (QAM), 0 = not (yet) available
174     SHORT           MSCQam;                         //coding of the MSC (QAM), 0 = not (yet) available
175     BYTE            MSCQamType;                     //G3XDDC_DRM_STATE_QAM_TYPE_* , used QAM coding for the MSC
176     double          CoderateH;				        //used coderate for hierachical coding,  values <= 0 indicate not available or not used
177     double          CoderateA;				        //used coderate for protection level A,  values <= 0 indicate not available or not used
178     double          CoderateB;				        //used coderate for protection level B,  values <= 0 indicate not available or not used
179     double          EstimatedSNR;			        //estimated SNR in dB of the decoded signal
180     WCHAR           TextMessage[128 + 1 + 16];      //text message containing max. 128 byte text + string termination + max. 16 linebreaks
181 
182     struct
183     {
184         BYTE        Content;				        //G3XDDC_DRM_STATE_SERVICE_CONTENT_*
185         WCHAR       DynamicLabel[256];		        //string containing dynamic label of the service, zero terminated
186         WCHAR       Country[256];			        //string containing the signaled country for this service
187         WCHAR       Language[256];			        //string containing the signaled language for this service
188         WCHAR       ProgramType[256];		        //string containing the signaled program type for this service
189         double      AudioBitrate;			        //data rate for the audio content (0 if not available)
190         double      TextMsgBitrate;			        //data rate for the text message content (0 if not available)
191         double      MultimediaBitrate;		        //data rate for the multimedia content (0 if not available)
192         double      DataBitrate;			        //data rate for the data content (0 if not available)
193     } ServiceInfo[4];
194 
195     struct
196     {
197         BOOL        Valid;                          //audio decoder information valid/invalid, when invalid all other entries of the struct contain no valid data
198         BYTE        AudioCoding;                    //G3XDDC_DRM_STATE_AUDIO_CODING_*
199         BOOL        SBR;                            //SBR used/not used (TRUE/FALSE)
200         INT32       AudioMode;                      //depeding on the audio coding, DRM_STATE_AUDIO_MODE_*
201     } AudioDecoderInfo[4];
202 } G3XDDC_DRM_STATUS;
203 
204 #pragma pack(pop)
205 
206 #endif //__G3XDDC_DRM__
207 
208 
209 #ifndef __G3XDDC_CREATE_INSTANCE__
210 #define __G3XDDC_CREATE_INSTANCE__ 1
211 
212 typedef BOOL (__stdcall *G3XDDCAPI_CREATE_INSTANCE)(UINT32 ClassId,PVOID *Interface);
213 
214 #endif //__G3XDDC_CREATE_INSTANCE__
215 
216 
217 #pragma pack(push,1)
218 
219 typedef struct
220 {
221     CHAR        DevicePath[MAX_PATH];
222     BYTE        InterfaceType;
223     CHAR        SerialNumber[9];
224     UINT32      ChannelCount;
225     UINT32      DDCTypeCount;
226 } G31DDC_DEVICE_INFO;
227 
228 
229 #ifndef __G3XDDC_DDC_INFO__
230 #define __G3XDDC_DDC_INFO__ 1
231 
232 typedef struct
233 {
234     UINT32      SampleRate;
235     UINT32      Bandwidth;
236     UINT32      BitsPerSample;
237 } G3XDDC_DDC_INFO;
238 
239 #endif //__G3XDDC_DDC_INFO__
240 
241 #undef INTERFACE
242 #define INTERFACE IG31DDCDeviceEnumerator
243 
DECLARE_INTERFACE(IG31DDCDeviceEnumerator)244 DECLARE_INTERFACE(IG31DDCDeviceEnumerator)
245 {
246     STDMETHOD_(LONG,AddRef)(THIS) PURE;
247     STDMETHOD_(LONG,Release)(THIS) PURE;
248 
249     STDMETHOD_(BOOL,Enumerate)(THIS) PURE;
250     STDMETHOD_(UINT32,GetCount)(THIS) PURE;
251     STDMETHOD_(BOOL,GetDeviceInfo)(THIS_ UINT32 DeviceIndex,G31DDC_DEVICE_INFO *DeviceInfo,UINT32 BufferLength) PURE;
252 };
253 
254 #undef INTERFACE
255 #define INTERFACE IG31DDCDeviceCallback
256 
257 struct IG31DDCDevice;
258 
DECLARE_INTERFACE(IG31DDCDeviceCallback)259 DECLARE_INTERFACE(IG31DDCDeviceCallback)
260 {
261     STDMETHOD_(VOID,G31DDC_IFCallback)(THIS_ struct IG31DDCDevice *Device,CONST SHORT *Buffer,UINT32 NumberOfSamples,WORD MaxADCAmplitude,UINT32 ADCSamplingRate) PURE;
262     STDMETHOD_(VOID,G31DDC_DDC1StreamCallback)(THIS_ struct IG31DDCDevice *Device,CONST VOID *Buffer,UINT32 NumberOfSamples,UINT32 BitsPerSample) PURE;
263     STDMETHOD_(BOOL,G31DDC_DDC1PlaybackStreamCallback)(THIS_ struct IG31DDCDevice *Device,VOID *Buffer,UINT32 NumberOfSamples,UINT32 BitsPerSample) PURE;
264     STDMETHOD_(VOID,G31DDC_DDC2StreamCallback)(THIS_ struct IG31DDCDevice *Device,UINT32 Channel,CONST FLOAT *Buffer,UINT32 NumberOfSamples) PURE;
265     //SlevelPeak and SlevelRMS are in Volts
266     //to convert SlevelRMS to power in dBm use SlevelRMS_dBm=10.0*log10(SlevelRMS*SlevelRMS/50.0*1000.0); where 50.0 is receiver input impendance, 1000.0 is coefficents to convert Watts to mili Watts
267     STDMETHOD_(VOID,G31DDC_DDC2PreprocessedStreamCallback)(THIS_ struct IG31DDCDevice *Device,UINT32 Channel,CONST FLOAT *Buffer,UINT32 NumberOfSamples,FLOAT SlevelPeak,FLOAT SlevelRMS) PURE;
268     STDMETHOD_(VOID,G31DDC_AudioStreamCallback)(THIS_ struct IG31DDCDevice *Device,UINT32 Channel,CONST FLOAT *Buffer,CONST FLOAT *BufferFiltered,UINT32 NumberOfSamples) PURE;
269     STDMETHOD_(BOOL,G31DDC_AudioPlaybackStreamCallback)(THIS_ struct IG31DDCDevice *Device,UINT32 Channel,FLOAT *Buffer,UINT32 NumberOfSamples) PURE;
270 };
271 
272 #undef INTERFACE
273 #define INTERFACE IG31DDCDevice
274 
275 
DECLARE_INTERFACE(IG31DDCDevice)276 DECLARE_INTERFACE(IG31DDCDevice)
277 {
278     STDMETHOD_(LONG,AddRef)(THIS) PURE;
279     STDMETHOD_(LONG,Release)(THIS) PURE;
280 
281     STDMETHOD_(BOOL,Open)(THIS_ CONST CHAR *DevicePath) PURE;
282     STDMETHOD_(VOID,Close)(THIS) PURE;
283     STDMETHOD_(BOOL,IsOpen)(THIS) PURE;
284 
285     STDMETHOD_(BOOL,IsConnected)(THIS) PURE;
286 
287     STDMETHOD_(VOID,SetCallback)(THIS_ IG31DDCDeviceCallback *Callback) PURE;
288     STDMETHOD_(IG31DDCDeviceCallback*,GetCallback)(THIS) PURE;
289 
290     STDMETHOD_(BOOL,GetDeviceInfo)(THIS_ G31DDC_DEVICE_INFO *Info,UINT32 BufferLength) PURE;
291 
292     STDMETHOD_(BOOL,SetPower)(THIS_ BOOL Power) PURE;
293     STDMETHOD_(BOOL,GetPower)(THIS_ BOOL *Power) PURE;
294 
295     STDMETHOD_(BOOL,SetAttenuator)(THIS_ UINT32 Attenuator) PURE;
296     STDMETHOD_(BOOL,GetAttenuator)(THIS_ UINT32 *Attenuator) PURE;
297 
298     STDMETHOD_(BOOL,SetDithering)(THIS_ BOOL Enabled) PURE;
299     STDMETHOD_(BOOL,GetDithering)(THIS_ BOOL *Enabled) PURE;
300 
301     STDMETHOD_(BOOL,SetMWFilter)(THIS_ BOOL Enabled) PURE;
302     STDMETHOD_(BOOL,GetMWFilter)(THIS_ BOOL *Enabled) PURE;
303 
304     STDMETHOD_(BOOL,SetLED)(THIS_ UINT32 LEDMode) PURE;
305     STDMETHOD_(BOOL,GetLED)(THIS_ UINT32 *LEDMode) PURE;
306 
307     STDMETHOD_(BOOL,SetInverted)(THIS_ BOOL Inverted) PURE;
308     STDMETHOD_(BOOL,GetInverted)(THIS_ BOOL *Inverted) PURE;
309 
310     STDMETHOD_(BOOL,SetADCNoiseBlanker)(THIS_ BOOL Enabled) PURE;
311     STDMETHOD_(BOOL,GetADCNoiseBlanker)(THIS_ BOOL *Enabled) PURE;
312     STDMETHOD_(BOOL,SetADCNoiseBlankerThreshold)(THIS_ UINT16 Enabled) PURE;
313     STDMETHOD_(BOOL,GetADCNoiseBlankerThreshold)(THIS_ UINT16 *Enabled) PURE;
314 
315     STDMETHOD_(BOOL,StartIF)(THIS_ WORD Period) PURE;
316     STDMETHOD_(BOOL,StopIF)(THIS) PURE;
317 
318     STDMETHOD_(BOOL,GetDDCInfo)(THIS_ UINT32 DDCTypeIndex,G3XDDC_DDC_INFO *Info) PURE;
319     STDMETHOD_(BOOL,GetDDC1Count)(THIS_ UINT32 *Count) PURE;
320     STDMETHOD_(BOOL,SetDDC1)(THIS_ UINT32 DDCTypeIndex) PURE;
321     STDMETHOD_(BOOL,GetDDC1)(THIS_ UINT32 *DDCTypeIndex,G3XDDC_DDC_INFO *DDCInfo) PURE;
322 
323     STDMETHOD_(BOOL,StartDDC1)(THIS_ UINT32 SamplesPerBuffer) PURE;
324     STDMETHOD_(BOOL,StopDDC1)(THIS) PURE;
325     STDMETHOD_(BOOL,StartDDC1Playback)(THIS_ UINT32 SamplesPerBuffer,UINT32 BitsPerSample) PURE; //BitsPerSample: 0 - default by DDC Info, 16 or 32
326     STDMETHOD_(BOOL,PauseDDC1Playback)(THIS) PURE;
327     STDMETHOD_(BOOL,ResumeDDC1Playback)(THIS) PURE;
328 
329     STDMETHOD_(BOOL,SetDDC1Frequency)(THIS_ UINT32 Frequency) PURE;
330     STDMETHOD_(BOOL,GetDDC1Frequency)(THIS_ UINT32 *Frequency) PURE;
331 
332     STDMETHOD_(BOOL,GetDDC2)(THIS_ UINT32 *DDCTypeIndex,G3XDDC_DDC_INFO *DDCInfo) PURE;
333     STDMETHOD_(BOOL,StartDDC2)(THIS_ UINT32 Channel,UINT32 SamplesPerBuffer) PURE;
334     STDMETHOD_(BOOL,StopDDC2)(THIS_ UINT32 Channel) PURE;
335 
336     STDMETHOD_(BOOL,SetDDC2Frequency)(THIS_ UINT32 Channel,INT32 Frequency) PURE;
337     STDMETHOD_(BOOL,GetDDC2Frequency)(THIS_ UINT32 Channel,INT32 *Frequency) PURE;
338 
339     STDMETHOD_(BOOL,SetDDC2NoiseBlanker)(THIS_ UINT32 Channel,BOOL Enabled) PURE;
340     STDMETHOD_(BOOL,GetDDC2NoiseBlanker)(THIS_ UINT32 Channel,BOOL *Enabled) PURE;
341     STDMETHOD_(BOOL,SetDDC2NoiseBlankerThreshold)(THIS_ UINT32 Channel,double Threshold) PURE;
342     STDMETHOD_(BOOL,GetDDC2NoiseBlankerThreshold)(THIS_ UINT32 Channel,double *Threshold) PURE;
343     STDMETHOD_(BOOL,GetDDC2NoiseBlankerExcessValue)(THIS_ UINT32 Channel,double *Value) PURE;
344 
345     STDMETHOD_(BOOL,GetSignalLevel)(THIS_ UINT32 Channel,FLOAT *Peak,FLOAT *RMS) PURE;
346 
347     STDMETHOD_(BOOL,SetAGC)(THIS_ UINT32 Channel,BOOL Enabled) PURE;
348     STDMETHOD_(BOOL,GetAGC)(THIS_ UINT32 Channel,BOOL *Enabled) PURE;
349     STDMETHOD_(BOOL,SetAGCParams)(THIS_ UINT32 Channel,double AttackTime,double DecayTime,double ReferenceLevel) PURE;
350     STDMETHOD_(BOOL,GetAGCParams)(THIS_ UINT32 Channel,double *AttackTime,double *DecayTime,double *ReferenceLevel) PURE;
351     STDMETHOD_(BOOL,SetMaxAGCGain)(THIS_ UINT32 Channel,double MaxGain) PURE;
352     STDMETHOD_(BOOL,GetMaxAGCGain)(THIS_ UINT32 Channel,double *MaxGain) PURE;
353     STDMETHOD_(BOOL,SetGain)(THIS_ UINT32 Channel,double Gain) PURE;
354     STDMETHOD_(BOOL,GetGain)(THIS_ UINT32 Channel,double *Gain) PURE;
355     STDMETHOD_(BOOL,GetCurrentGain)(THIS_ UINT32 Channel,double *Gain) PURE;
356 
357     STDMETHOD_(BOOL,SetNotchFilter)(THIS_ UINT32 Channel,BOOL Enabled) PURE;
358     STDMETHOD_(BOOL,GetNotchFilter)(THIS_ UINT32 Channel,BOOL *Enabled) PURE;
359     STDMETHOD_(BOOL,SetNotchFilterFrequency)(THIS_ UINT32 Channel,INT32 Frequency) PURE;
360     STDMETHOD_(BOOL,GetNotchFilterFrequency)(THIS_ UINT32 Channel,INT32 *Frequency) PURE;
361     STDMETHOD_(BOOL,SetNotchFilterBandwidth)(THIS_ UINT32 Channel,UINT32 Bandwidth) PURE;
362     STDMETHOD_(BOOL,GetNotchFilterBandwidth)(THIS_ UINT32 Channel,UINT32 *Bandwidth) PURE;
363     STDMETHOD_(BOOL,SetNotchFilterLength)(THIS_ UINT32 Channel,UINT32 Length) PURE;         //Length: min=64,max=32768,step=64
364     STDMETHOD_(BOOL,GetNotchFilterLength)(THIS_ UINT32 Channel,UINT32 *Length) PURE;
365 
366 
367     STDMETHOD_(BOOL,SetDemodulatorMode)(THIS_ UINT32 Channel,UINT32 Mode) PURE;
368     STDMETHOD_(BOOL,GetDemodulatorMode)(THIS_ UINT32 Channel,UINT32 *Mode) PURE;
369     STDMETHOD_(BOOL,SetDemodulatorFrequency)(THIS_ UINT32 Channel,INT32 Frequency) PURE;
370     STDMETHOD_(BOOL,GetDemodulatorFrequency)(THIS_ UINT32 Channel,INT32 *Frequency) PURE;
371     STDMETHOD_(BOOL,SetDemodulatorFilterBandwidth)(THIS_ UINT32 Channel,UINT32 Bandwidth) PURE;
372     STDMETHOD_(BOOL,GetDemodulatorFilterBandwidth)(THIS_ UINT32 Channel,UINT32 *Bandwidth) PURE;
373     STDMETHOD_(BOOL,SetDemodulatorFilterShift)(THIS_ UINT32 Channel,INT32 Shift) PURE;
374     STDMETHOD_(BOOL,GetDemodulatorFilterShift)(THIS_ UINT32 Channel,INT32 *Shift) PURE;
375     STDMETHOD_(BOOL,SetDemodulatorFilterLength)(THIS_ UINT32 Channel,UINT32 Length) PURE;   //Length: min=64,max=32768,step=64
376     STDMETHOD_(BOOL,GetDemodulatorFilterLength)(THIS_ UINT32 Channel,UINT32 *Length) PURE;
377     STDMETHOD_(BOOL,SetDemodulatorParam)(THIS_ UINT32 Channel,UINT32 Code,CONST VOID *Buffer,UINT32 BufferSize) PURE;
378     STDMETHOD_(BOOL,GetDemodulatorParam)(THIS_ UINT32 Channel,UINT32 Code,VOID *Buffer,UINT32 BufferSize) PURE;
379     STDMETHOD_(BOOL,GetDemodulatorState)(THIS_ UINT32 Channel,UINT32 Code,VOID *Buffer,UINT32 BufferSize) PURE;
380 
381     STDMETHOD_(BOOL,StartAudio)(THIS_ UINT32 Channel,UINT32 SamplesPerBuffer) PURE;
382     STDMETHOD_(BOOL,StopAudio)(THIS_ UINT32 Channel) PURE;
383     STDMETHOD_(BOOL,StartAudioPlayback)(THIS_ UINT32 Channel,UINT32 SamplesPerBuffer) PURE;
384     STDMETHOD_(BOOL,PauseAudioPlayback)(THIS_ UINT32 Channel) PURE;
385     STDMETHOD_(BOOL,ResumeAudioPlayback)(THIS_ UINT32 Channel) PURE;
386     STDMETHOD_(BOOL,SetAudioFilter)(THIS_ UINT32 Channel,BOOL Enabled) PURE;
387     STDMETHOD_(BOOL,GetAudioFilter)(THIS_ UINT32 Channel,BOOL *Enabled) PURE;
388     STDMETHOD_(BOOL,SetAudioFilterParams)(THIS_ UINT32 Channel,UINT32 CutOffLow,UINT32 CutOffHigh,double Deemphasis) PURE;
389     STDMETHOD_(BOOL,GetAudioFilterParams)(THIS_ UINT32 Channel,UINT32 *CutOffLow,UINT32 *CutOffHigh,double *Deemphasis) PURE;
390     STDMETHOD_(BOOL,SetAudioFilterLength)(THIS_ UINT32 Channel,UINT32 Length) PURE;         //Length: min=64,max=32768,step64
391     STDMETHOD_(BOOL,GetAudioFilterLength)(THIS_ UINT32 Channel,UINT32 *Length) PURE;
392     STDMETHOD_(BOOL,SetAudioGain)(THIS_ UINT32 Channel,double Gain) PURE;
393     STDMETHOD_(BOOL,GetAudioGain)(THIS_ UINT32 Channel,double *Gain) PURE;
394 
395     STDMETHOD_(BOOL,SetDRMKey)(THIS_ CONST CHAR *DRMKeyFileDirectory) PURE;
396     STDMETHOD_(BOOL,IsDRMUnlocked)(THIS) PURE;
397 
398     STDMETHOD_(BOOL,GetSpectrumCompensation)(THIS_ UINT64 CenterFrequency,UINT32 Width,FLOAT *Buffer,UINT32 Count) PURE;
399 
400     STDMETHOD_(BOOL,SetFrequency)(THIS_ UINT32 Channel,UINT32 Frequency) PURE;
401     STDMETHOD_(BOOL,GetFrequency)(THIS_ UINT32 Channel,UINT32 *Frequency) PURE;
402 };
403 
404 #pragma pack(pop)
405 
406 //non-object API
407 
408 typedef VOID (__stdcall *G31DDC_IF_CALLBACK)(CONST SHORT *Buffer,UINT32 NumberOfSamples,WORD MaxADCAmplitude,UINT32 ADCSamplingRate,DWORD_PTR UserData);
409 typedef VOID (__stdcall *G31DDC_DDC1_STREAM_CALLBACK)(CONST VOID *Buffer,UINT32 NumberOfSamples,UINT32 BitsPerSample,DWORD_PTR UserData);
410 typedef BOOL (__stdcall *G31DDC_DDC1_PLAYBACK_STREAM_CALLBACK)(VOID *Buffer,UINT32 NumberOfSamples,UINT32 BitsPerSample,DWORD_PTR UserData);
411 typedef VOID (__stdcall *G31DDC_DDC2_STREAM_CALLBACK)(UINT32 Channel,CONST FLOAT *Buffer,UINT32 NumberOfSamples,DWORD_PTR UserData);
412 typedef VOID (__stdcall *G31DDC_DDC2_PREPROCESSED_STREAM_CALLBACK)(UINT32 Channel,CONST FLOAT *Buffer,UINT32 NumberOfSamples,FLOAT SlevelPeak,FLOAT SlevelRMS,DWORD_PTR UserData);
413 typedef VOID (__stdcall *G31DDC_AUDIO_STREAM_CALLBACK)(UINT32 Channel,CONST FLOAT *Buffer,CONST FLOAT *BufferFiltered,UINT32 NumberOfSamples,DWORD_PTR UserData);
414 typedef BOOL (__stdcall *G31DDC_AUDIO_PLAYBACK_STREAM_CALLBACK)(UINT32 Channel,FLOAT *Buffer,UINT32 NumberOfSamples,DWORD_PTR UserData);
415 
416 #pragma pack(push,1)
417 
418 typedef struct
419 {
420     G31DDC_IF_CALLBACK                          IFCallback;
421     G31DDC_DDC1_STREAM_CALLBACK                 DDC1StreamCallback;
422     G31DDC_DDC1_PLAYBACK_STREAM_CALLBACK        DDC1PlaybackStreamCallback;
423     G31DDC_DDC2_STREAM_CALLBACK                 DDC2StreamCallback;
424     G31DDC_DDC2_PREPROCESSED_STREAM_CALLBACK    DDC2PreprocessedStreamCallback;
425     G31DDC_AUDIO_STREAM_CALLBACK                AudioStreamCallback;
426     G31DDC_AUDIO_PLAYBACK_STREAM_CALLBACK       AudioPlaybackStreamCallback;
427 } G31DDC_CALLBACKS;
428 
429 #pragma pack(pop)
430 
431 //GetDeviceList
432 typedef INT32 (__stdcall *G31DDC_GET_DEVICE_LIST)(G31DDC_DEVICE_INFO *DeviceList,UINT32 BufferSize);
433 //OpenDevice
434 typedef INT32(__stdcall *G31DDC_OPEN_DEVICE)(CONST CHAR *SerialNumber);
435 //CloseDevice
436 typedef BOOL (__stdcall *G31DDC_CLOSE_DEVICE)(INT32 hDevice);
437 //IsDeviceConnected
438 typedef BOOL (__stdcall *G31DDC_IS_DEVICE_CONNECTED)(INT32 hDevice);
439 //GetDeviceInfo
440 typedef BOOL (__stdcall *G31DDC_GET_DEVICE_INFO)(INT32 hDevice,G31DDC_DEVICE_INFO *Info,UINT32 BufferLength);
441 //SetPower
442 typedef BOOL (__stdcall *G31DDC_SET_POWER)(INT32 hDevice,BOOL Power);
443 //GetPower
444 typedef BOOL (__stdcall *G31DDC_GET_POWER)(INT32 hDevice,BOOL *Power);
445 //SetAttenuator
446 typedef BOOL (__stdcall *G31DDC_SET_ATTENUATOR)(INT32 hDevice,UINT32 Attenuator);
447 //GetAttenuator
448 typedef BOOL (__stdcall *G31DDC_GET_ATTENUATOR)(INT32 hDevice,UINT32 *Attenuator);
449 //SetDithering
450 typedef BOOL (__stdcall *G31DDC_SET_DITHERING)(INT32 hDevice,BOOL Enabled);
451 //GetDithering
452 typedef BOOL (__stdcall *G31DDC_GET_DITHERING)(INT32 hDevice,BOOL *Enabled);
453 //SetMWFilter
454 typedef BOOL (__stdcall *G31DDC_SET_MW_FILTER)(INT32 hDevice,BOOL Enabled);
455 //GetMWFilter
456 typedef BOOL (__stdcall *G31DDC_GET_MW_FILTER)(INT32 hDevice,BOOL *Enabled);
457 //SetADCNoiseBlanker
458 typedef BOOL (__stdcall *G31DDC_SET_ADC_NOISE_BLANKER)(INT32 hDevice,BOOL Enabled);
459 //GetADCNoiseBlanker
460 typedef BOOL (__stdcall *G31DDC_GET_ADC_NOISE_BLANKER)(INT32 hDevice,BOOL *Enabled);
461 //SetADCNoiseBlankerThreshold
462 typedef BOOL (__stdcall *G31DDC_SET_ADC_NOISE_BLANKER_THRESHOLD)(INT32 hDevice,WORD Threshold);
463 //GetADCNoiseBlankerThreshold
464 typedef BOOL (__stdcall *G31DDC_GET_ADC_NOISE_BLANKER_THRESHOLD)(INT32 hDevice,WORD *Threshold);
465 //SetLED
466 typedef BOOL (__stdcall *G31DDC_SET_LED)(INT32 hDevice,UINT32 LEDMode);
467 //GetLED
468 typedef BOOL (__stdcall *G31DDC_GET_LED)(INT32 hDevice,UINT32 *LEDMode);
469 //SetInverted
470 typedef BOOL (__stdcall *G31DDC_SET_INVERTED)(INT32 hDevice,BOOL Inverted);
471 //GetInverted
472 typedef BOOL (__stdcall *G31DDC_GET_INVERTED)(INT32 hDevice,BOOL *Inverted);
473 //SetDDC2NoiseBlanker
474 typedef BOOL (__stdcall *G31DDC_SET_DDC2_NOISE_BLANKER)(INT32 hDevice,UINT32 Channel,BOOL Enabled);
475 //GetDDC2NoiseBlanker
476 typedef BOOL (__stdcall *G31DDC_GET_DDC2_NOISE_BLANKER)(INT32 hDevice,UINT32 Channel,BOOL *Enabled);
477 //SetDDC2NoiseBlankerThreshold
478 typedef BOOL (__stdcall *G31DDC_SET_DDC2_NOISE_BLANKER_THRESHOLD)(INT32 hDevice,UINT32 Channel,double Threshold);
479 //GetDDC2NoiseBlankerThreshold
480 typedef BOOL (__stdcall *G31DDC_GET_DDC2_NOISE_BLANKER_THRESHOLD)(INT32 hDevice,UINT32 Channel,double *Threshold);
481 //GetDDC2NoiseBlankerExcessValue
482 typedef BOOL (__stdcall *G31DDC_GET_DDC2_NOISE_BLANKER_EXCESS_VALUE)(INT32 hDevice,UINT32 Channel,double *Value);
483 //StartIF
484 typedef BOOL (__stdcall *G31DDC_START_IF)(INT32 hDevice,WORD Period);
485 //StopIF
486 typedef BOOL (__stdcall *G31DDC_STOP_IF)(INT32 hDevice);
487 //GetDDCInfo
488 typedef BOOL (__stdcall *G31DDC_GET_DDC_INFO)(INT32 hDevice,UINT32 DDCTypeIndex,G3XDDC_DDC_INFO *Info);
489 //GetDDC1Count
490 typedef BOOL (__stdcall *G31DDC_GET_DDC1_COUNT)(INT32 hDevice,UINT32 *Count);
491 //SetDDC1
492 typedef BOOL (__stdcall *G31DDC_SET_DDC1)(INT32 hDevice,UINT32 DDCTypeIndex);
493 //GetDDC1
494 typedef BOOL (__stdcall *G31DDC_GET_DDC1)(INT32 hDevice,UINT32 *DDCTypeIndex,G3XDDC_DDC_INFO *DDCInfo);
495 //StartDDC1
496 typedef BOOL (__stdcall *G31DDC_START_DDC1)(INT32 hDevice,UINT32 SamplesPerBuffer);
497 //StopDDC1
498 typedef BOOL (__stdcall *G31DDC_STOP_DDC1)(INT32 hDevice);
499 //StartDDC1Playback
500 typedef BOOL (__stdcall *G31DDC_START_DDC1_PLAYBACK)(INT32 hDevice,UINT32 SamplesPerBuffer,UINT32 BitsPerSample);
501 //PauseDDC1Playback
502 typedef BOOL (__stdcall *G31DDC_PAUSE_DDC1_PLAYBACK)(INT32 hDevice);
503 //ResumeDDC1Playback
504 typedef BOOL (__stdcall *G31DDC_RESUME_DDC1_PLAYBACK)(INT32 hDevice);
505 //SetDDC1Frequency
506 typedef BOOL (__stdcall *G31DDC_SET_DDC1_FREQUENCY)(INT32 hDevice,UINT32 Frequency);
507 //GetDDC1Frequency
508 typedef BOOL (__stdcall *G31DDC_GET_DDC1_FREQUENCY)(INT32 hDevice,UINT32 *Frequency);
509 //GetDDC2
510 typedef BOOL (__stdcall *G31DDC_GET_DDC2)(INT32 hDevice,UINT32 *DDCTypeIndex,G3XDDC_DDC_INFO *DDCInfo);
511 //StartDDC2
512 typedef BOOL (__stdcall *G31DDC_START_DDC2)(INT32 hDevice,UINT32 Channel,UINT32 SamplesPerBuffer);
513 //StopDDC2
514 typedef BOOL (__stdcall *G31DDC_STOP_DDC2)(INT32 hDevice,UINT32 Channel);
515 //SetDDC2Frequency
516 typedef BOOL (__stdcall *G31DDC_SET_DDC2_FREQUENCY)(INT32 hDevice,UINT32 Channel,INT32 Frequency);
517 //GetDDC2Frequency
518 typedef BOOL (__stdcall *G31DDC_GET_DDC2_FREQUENCY)(INT32 hDevice,UINT32 Channel,INT32 *Frequency);
519 //GetSignalLevel
520 typedef BOOL (__stdcall *G31DDC_GET_SIGNAL_LEVEL)(INT32 hDevice,UINT32 Channel,FLOAT *Peak,FLOAT *RMS);
521 //SetAGC
522 typedef BOOL (__stdcall *G31DDC_SET_AGC)(INT32 hDevice,UINT32 Channel,BOOL Enabled);
523 //GetAGC
524 typedef BOOL (__stdcall *G31DDC_GET_AGC)(INT32 hDevice,UINT32 Channel,BOOL *Enabled);
525 //SetAGCParams
526 typedef BOOL (__stdcall *G31DDC_SET_AGC_PARAMS)(INT32 hDevice,UINT32 Channel,double AttackTime,double DecayTime,double ReferenceLevel);
527 //GetAGCParams
528 typedef BOOL (__stdcall *G31DDC_GET_AGC_PARAMS)(INT32 hDevice,UINT32 Channel,double *AttackTime,double *DecayTime,double *ReferenceLevel);
529 //SetMaxAGCGain
530 typedef BOOL (__stdcall *G31DDC_SET_MAX_AGC_GAIN)(INT32 hDevice,UINT32 Channel,double MaxGain);
531 //GetMaxAGCGain
532 typedef BOOL (__stdcall *G31DDC_GET_MAX_AGC_GAIN)(INT32 hDevice,UINT32 Channel,double *MaxGain);
533 //SetGain
534 typedef BOOL (__stdcall *G31DDC_SET_GAIN)(INT32 hDevice,UINT32 Channel,double Gain);
535 //GetGain
536 typedef BOOL (__stdcall *G31DDC_GET_GAIN)(INT32 hDevice,UINT32 Channel,double *Gain);
537 //GetCurrentGain
538 typedef BOOL (__stdcall *G31DDC_GET_CURRENT_GAIN)(INT32 hDevice,UINT32 Channel,double *Gain);
539 //SetNotchFilter
540 typedef BOOL (__stdcall *G31DDC_SET_NOTCH_FILTER)(INT32 hDevice,UINT32 Channel,BOOL Enabled);
541 //GetNotchFilter
542 typedef BOOL (__stdcall *G31DDC_GET_NOTCH_FILTER)(INT32 hDevice,UINT32 Channel,BOOL *Enabled);
543 //SetNotchFilterFrequency
544 typedef BOOL (__stdcall *G31DDC_SET_NOTCH_FILTER_FREQUENCY)(INT32 hDevice,UINT32 Channel,INT32 Frequency);
545 //GetNotchFilterFrequency
546 typedef BOOL (__stdcall *G31DDC_GET_NOTCH_FILTER_FREQUENCY)(INT32 hDevice,UINT32 Channel,INT32 *Frequency);
547 //SetNotchFilterBandwidth
548 typedef BOOL (__stdcall *G31DDC_SET_NOTCH_FILTER_BANDWIDTH)(INT32 hDevice,UINT32 Channel,UINT32 Bandwidth);
549 //GetNotchFilterBandwidth
550 typedef BOOL (__stdcall *G31DDC_GET_NOTCH_FILTER_BANDWIDTH)(INT32 hDevice,UINT32 Channel,UINT32 *Bandwidth);
551 //SetNotchFilterLength
552 typedef BOOL (__stdcall *G31DDC_SET_NOTCH_FILTER_LENGTH)(INT32 hDevice,UINT32 Channel,UINT32 Length);
553 //GetNotchFilterLength
554 typedef BOOL (__stdcall *G31DDC_GET_NOTCH_FILTER_LENGTH)(INT32 hDevice,UINT32 Channel,UINT32 *Length);
555 //SetDemodulatorMode
556 typedef BOOL (__stdcall *G31DDC_SET_DEMODULATOR_MODE)(INT32 hDevice,UINT32 Channel,UINT32 Mode);
557 //GetDemodulatorMode
558 typedef BOOL (__stdcall *G31DDC_GET_DEMODULATOR_MODE)(INT32 hDevice,UINT32 Channel,UINT32 *Mode);
559 //SetDemodulatorFrequency
560 typedef BOOL (__stdcall *G31DDC_SET_DEMODULATOR_FREQUENCY)(INT32 hDevice,UINT32 Channel,INT32 Frequency);
561 //GetDemodulatorFrequency
562 typedef BOOL (__stdcall *G31DDC_GET_DEMODULATOR_FREQUENCY)(INT32 hDevice,UINT32 Channel,INT32 *Frequency);
563 //SetDemodulatorFilterBandwidth
564 typedef BOOL (__stdcall *G31DDC_SET_DEMODULATOR_FILTER_BANDWIDTH)(INT32 hDevice,UINT32 Channel,UINT32 Bandwidth);
565 //GetDemodulatorFilterBandwidth
566 typedef BOOL (__stdcall *G31DDC_GET_DEMODULATOR_FILTER_BANDWIDTH)(INT32 hDevice,UINT32 Channel,UINT32 *Bandwidth);
567 //SetDemodulatorFilterShift
568 typedef BOOL (__stdcall *G31DDC_SET_DEMODULATOR_FILTER_SHIFT)(INT32 hDevice,UINT32 Channel,INT32 Shift);
569 //GetDemodulatorFilterShift
570 typedef BOOL (__stdcall *G31DDC_GET_DEMODULATOR_FILTER_SHIFT)(INT32 hDevice,UINT32 Channel,INT32 *Shift);
571 //SetDemodulatorFilterLength
572 typedef BOOL (__stdcall *G31DDC_SET_DEMODULATOR_FILTER_LENGTH)(INT32 hDevice,UINT32 Channel,UINT32 Length);
573 //GetDemodulatorFilterLength
574 typedef BOOL (__stdcall *G31DDC_GET_DEMODULATOR_FILTER_LENGTH)(INT32 hDevice,UINT32 Channel,UINT32 *Length);
575 //SetDemodulatorParam
576 typedef BOOL (__stdcall *G31DDC_SET_DEMODULATOR_PARAM)(INT32 hDevice,UINT32 Channel,UINT32 Code,CONST VOID *Buffer,UINT32 BufferSize);
577 //GetDemodulatorParam
578 typedef BOOL (__stdcall *G31DDC_GET_DEMODULATOR_PARAM)(INT32 hDevice,UINT32 Channel,UINT32 Code,VOID *Buffer,UINT32 BufferSize);
579 //GetDemodulatorState
580 typedef BOOL (__stdcall *G31DDC_GET_DEMODULATOR_STATE)(INT32 hDevice,UINT32 Channel,UINT32 Code,VOID *Buffer,UINT32 BufferSize);
581 //StartAudio
582 typedef BOOL (__stdcall *G31DDC_START_AUDIO)(INT32 hDevice,UINT32 Channel,UINT32 SamplesPerBuffer);
583 //StopAudio
584 typedef BOOL (__stdcall *G31DDC_STOP_AUDIO)(INT32 hDevice,UINT32 Channel);
585 //StartAudioPlayback
586 typedef BOOL (__stdcall *G31DDC_START_AUDIO_PLAYBACK)(INT32 hDevice,UINT32 Channel,UINT32 SamplesPerBuffer);
587 //PauseAudioPlayback
588 typedef BOOL (__stdcall *G31DDC_PAUSE_AUDIO_PLAYBACK)(INT32 hDevice,UINT32 Channel);
589 //ResumeAudioPlayback
590 typedef BOOL (__stdcall *G31DDC_RESUME_AUDIO_PLAYBACK)(INT32 hDevice,UINT32 Channel);
591 //SetAudioFilter
592 typedef BOOL (__stdcall *G31DDC_SET_AUDIO_FILTER)(INT32 hDevice,UINT32 Channel,BOOL Enabled);
593 //GetAudioFilter
594 typedef BOOL (__stdcall *G31DDC_GET_AUDIO_FILTER)(INT32 hDevice,UINT32 Channel,BOOL *Enabled);
595 //SetAudioFilterParams
596 typedef BOOL (__stdcall *G31DDC_SET_AUDIO_FILTER_PARAMS)(INT32 hDevice,UINT32 Channel,UINT32 CutOffLow,UINT32 CutOffHigh,double Deemphasis);
597 //GetAudioFilterParams
598 typedef BOOL (__stdcall *G31DDC_GET_AUDIO_FILTER_PARAMS)(INT32 hDevice,UINT32 Channel,UINT32 *CutOffLow,UINT32 *CutOffHigh,double *Deemphasis);
599 //SetAudioFilterLength
600 typedef BOOL (__stdcall *G31DDC_SET_AUDIO_FILTER_LENGTH)(INT32 hDevice,UINT32 Channel,UINT32 Length);
601 //GetAudioFilterLength
602 typedef BOOL (__stdcall *G31DDC_GET_AUDIO_FILTER_LENGTH)(INT32 hDevice,UINT32 Channel,UINT32 *Length);
603 //SetAudioGain
604 typedef BOOL (__stdcall *G31DDC_SET_AUDIO_GAIN)(INT32 hDevice,UINT32 Channel,double Gain);
605 //GetAudioGain
606 typedef BOOL (__stdcall *G31DDC_GET_AUDIO_GAIN)(INT32 hDevice,UINT32 Channel,double *Gain);
607 //SetDRMKey
608 typedef BOOL (__stdcall *G31DDC_SET_DRM_KEY)(INT32 hDevice,CONST CHAR *DRMKeyFileDirectory);
609 //IsDRMUnlocked
610 typedef BOOL (__stdcall *G31DDC_IS_DRM_UNLOCKED)(INT32 hDevice);
611 //GetSpectrumCompensation
612 typedef BOOL (__stdcall *G31DDC_GET_SPECTRUM_COMPENSATION)(INT32 hDevice,UINT64 CenterFrequency,UINT32 Width,FLOAT *Buffer,UINT32 Count);
613 //SetFrequency
614 typedef BOOL (__stdcall *G31DDC_SET_FREQUENCY)(INT32 hDevice,UINT32 Channel,UINT32 Frequency);
615 //GetFrequency
616 typedef BOOL (__stdcall *G31DDC_GET_FREQUENCY)(INT32 hDevice,UINT32 Channel,UINT32 *Frequency);
617 //SetCallbacks
618 typedef BOOL (__stdcall *G31DDC_SET_CALLBACKS)(INT32 hDevice,CONST G31DDC_CALLBACKS *Callbacks,DWORD_PTR UserData);
619 
620 
621 #endif
622 
623 
624