Programming Information for WiNRADiO G39DDC receiver.

The G39DDC API SDK is implemented as a 32-bit dynamic library (G39DDCAPI.dll). It provides object-oriented and non-object-oriented interfaces to control the G39DDC device. This document describes the object-oriented interface. The G39DDCAPI.dll library exports several functions that make it possible to control G39DDC receivers.

The API is not fully thread-safe so preferrably it should be used in single-threaded applications. It can be used in multi-threaded applications as well, but with some care: One G39DDC receiver can be controlled from a single user thread only.

A C/C++ header file G39DDCAPI.h is a part of the SDK. The API can be used by any 32-bit application under Microsoft Windows 2000, XP, Vista and Windows 7 (including their 64-bit versions).

Block diagram of G39DDC processing chain

Simplified block diagram of G39DDC processing chain
Preselectors Preamplifier Attenuator LO1 LO2 LO3 ADC Noise blanker IF DDC1 frequency shift DDC1 DDC1 stream DDC2 frequency shift DDC2 DDC2 stream DDC2 stream Demodulator filter Signal level Notch filter Gain Pre-processed DDC2 stream Demodulator Audio gain Audio stream Audio filter Filtered audio filter DDC1 frequency shift DDC1 DDC1 stream DDC2 frequency shift DDC2 DDC2 stream DDC2 stream Demodulator filter Signal level Notch filter Gain Pre-processed DDC2 stream Demodulator Audio gain Audio stream Audio filter Filtered audio filter Simplified block diagram of G39DDC processing chain

Using WiNRADiO G39DDC API

Loading API

The G39DDCAPI.dll library can be loaded to the application by two Microsoft Windows API functions. The first one is LoadLibrary and the other one is LoadLibraryEx. After the library is loaded, it is required to get addresses of exported functions. When the API is no longer required in the memory, the FreeLibrary function can be used to unload the API. Before the FreeLibrary is called, all the objects created using CreateInstance function must be freed releasing their interfaces using the Release method, otherwise the application can enter an unpredictable state.

The following source code shows how to load the API.

 

#include <stdio.h>

#include "G39DDCAPI.h"



G39DDCAPI_CREATE_INSTANCE CreateInstance;

HMODULE hAPI;



void main(void)

{  

    //Loading the API

    hAPI=LoadLibrary("G39DDCAPI.dll");



    if(hAPI!=NULL)

    {

        //Retrieving addresses of CreateInstance functions

        CreateInstance=(G39DDCAPI_CREATE_INSTANCE)GetProcAddress(hAPI,"OpenDevice");



        //Here place code that uses the API



        FreeLibrary(hAPI);

    }

    else

    {

        //If the LoadLibrary fails

        printf("Failed to load G39DDCAPI.dll.\n");

    }

}

Enumerating available G39DDC devices

To enumerate available G39DDC devices the API provides an enumeration object. The object has to be created using the CreateInstance function. The following source code in C++ produces list of serial numbers of available G39DDC devices.


#include <stdio.h>

#include "G39DDCAPI.h"



void main(void)

{

 G39DDCAPI_CREATE_INSTANCE CreateInstance;

 HMODULE hAPI;

 IG39DDCDeviceEnumerator *Enumerator=NULL;

 G39DDC_DEVICE_INFO DevInfo;

 UINT32 Index;

 UINT32 Count;



    hAPI=LoadLibrary("G39DDCAPI.dll");



    if(hAPI!=NULL)

    {

        CreateInstance=(G39DDCAPI_CREATE_INSTANCE)GetProcAddress(hAPI,"CreateInstance");



        if(CreateInstance(G39DDC_CLASS_ID_DEVICE_ENUMERATOR,(void**)&Enumerator))

        {

            Enumerator->Enumerate();



            Count=Enumerator->GetCount();

            

            if(Count!=0)

            {

                printf("Available G39DDC devices count=%d:\n",Count);



                for(Index=0;Index<Count;Index++)

                {

                    Enumerator->GetDeviceInfo(Index,&DevInfo,sizeof(DevInfo));

                    printf("%d. SN: %s\n",Index,DevInfo.SerialNumber);

                }

            }

            else

            {

                printf("No available G39DDC device found.\n");

            }



            Enumerator->Release();

        }

        else

        {

            printf("Failed to create enumerator object. Error code=%08X\n",GetLastError());

        }



        FreeLibrary(hAPI);

    }

    else

    {

        printf("Failed to load G39DDCAPI.dll.\n");

    }



    printf("Press enter to exit\n");

    getchar();

}

Opening G39DDC device

The API provides an object to control the G39DDC device. Before the device is open, the object has to be created using the CreateInstance function.

The following source code in C++ shows how to open the first available G39DDC device.


#include <stdio.h>

#include "G39DDCAPI.h"





void main(void)

{  

 G39DDCAPI_CREATE_INSTANCE CreateInstance;

 HMODULE hAPI;

 IG39DDCDevice *Device;

 

    //Loading the API

    hAPI=LoadLibrary("G39DDCAPI.dll");



    if(hAPI!=NULL)

    {

        //Retrieving address of the CreateInstance API functions

        CreateInstance=(G39DDCAPI_CREATE_INSTANCE)GetProcAddress(hAPI,"CreateInstance");

        

        //Creating instance of the device object

        if(CreateInstance(G39DDC_CLASS_ID_DEVICE,(void**)&Device))

        {

            //Opening the first available G39DDC device using predefined G39DDC_OPEN_FIRST constant            

            if(Device->Open(G39DDC_OPEN_FIRST))

            {            

                //Here place code that works with the open G39DDC device            

                

                //Closing device

                Device->Close();

            }

            else

            {

                printf("Failed to open device. Error code=%08X\n",GetLastError());

            }

            

            //Release interface of device object

            Device->Release();

        }

        else

        {

            printf("Failed to create device object. Error code=%08X\n",GetLastError());

        }        



        FreeLibrary(hAPI);

    }

    else

    {

        //If the LoadLibrary fails

        printf("Failed to load G39DDCAPI.dll.\n");

    }

}

Functions

CreateInstance

Creates single object of the specified class and returns interface of the object.

C/C++ declaration

INT32 __stdcall CreateInstance(UINT32 ClassId,PVOID *Interface);

Address retrieval

G39DDCAPI_CREATE_INSTANCE CreateInstance=(G39DDCAPI_CREATE_INSTANCE)GetProcAddress(hAPI,"CreateInstance");

Parameters

ClassId
[in] Specifies class identifier of the object to be created. This parameter must be one of the following:

ValueMeaning
G39DDC_CLASS_ID_DEVICE_ENUMERATORClass identifier of the enumerator object. When the function finished successfully, IG39DDCDeviceEnumerator interface is stored to pointer variable pointed to by the Interface parameter.
G39DDC_CLASS_ID_DEVICEClass identifier of the device object. When the function finished successfully, IG39DDCDevice interface is stored to pointer variable pointed to by the Interface parameter.

Interface
[out] Pointer to a variable that receives interface to newly created object of specified class. This parameter cannot be NULL.

Return value

If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

All the objects created using CreateInstance must be freed releasing their interfaces using Release method before the API is unloaded using the FreeLibrary function.

The CreateInstance function can be called in any user-thread. Returned interface can be used only in the same thread in which its object was created, otherwise the application can become to unpredictable state.


Interfaces

IG39DDCDeviceEnumerator interface

IG39DDCDeviceEnumerator interface is the interface of the enumerator object that is created using the CreateInstance function and that provides enumeration mechanism of available G39DDC devices.


IG39DDCDeviceEnumerator::AddRef

Increases the reference count to the enumerator object.

C/C++ declaration

LONG __stdcall AddRef(void);

Parameters

None

Return value

The method returns resulting reference count.

Remarks

Initial reference count of an object created using CreateInstance function is 1.

IG39DDCDeviceEnumerator::Release

Decrements the reference count of the object. When the reference count reaches zero, the object and all the resources allocated by them are freed and the interface is no longer usable.

C/C++ declaration

LONG __stdcall Release(void);

Parameters

None

Return value

The method returns resulting reference count. If the return value is zero, the object was freed.

IG39DDCDeviceEnumerator::Enumerate

Performs enumeration of available G39DDC devices.

C/C++ declaration

BOOL __stdcall Enumerate(void);

Parameters

None

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

IG39DDCDeviceEnumerator::GetCount

Retrieves number of available G39DDC devices enumerated using the IG39DDCDeviceEnumerator::Enumerate method.

C/C++ declaration

UINT32 __stdcall GetCount(void);

Parameters

None

Return value

The method returns number of available G39DDC devices.

IG39DDCDeviceEnumerator::GetDeviceInfo

Retrieves information about available G39DDC device.

C/C++ declaration

BOOL __stdcall GetDeviceInfo(UINT32 DeviceIndex,G39DDC_DEVICE_INFO *DeviceInfo,UINT32 BufferLength);

Parameters

DeviceIndex
[in] Specifies index of the device. It can vary from zero to one less than the value returned by the IG39DDCDeviceEnumerator::GetCount method.
DeviceInfo
[out] Pointer to a G39DDC_DEVICE_INFO structure to be filled with information about the the device.
BufferLength
[in] Size, in bytes, of the G39DDC_DEVICE_INFO structure.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

IG39DDCDevice interface

IG39DDCDevice interface is an interface of the device object that is created using the CreateInstance function. This interface allows to control selected G39DDC device.


IG39DDCDevice::Open

Opens G39DDC device by its system path and associates the device with the device object given by its interface pointer.

C/C++ declaration

BOOL __stdcall Open(CONST CHAR *DevicePath);

Parameters

DevicePath
[in] Pointer to a null-terminated string that specifies the system path of the G39DDC device to open. The system device path of the device can be obtained from the G39DDC_DEVICE_INFO structure filled by the IG39DDCDeviceEnumerator::GetDeviceInfo method. Instead of the system path, it can be used one of the following values:

ValueMeaning
G39DDC_OPEN_FIRSTThe function opens first available G39DDC device.
G39DDC_OPEN_DEMOThe function opens demo G39DDC device. This allows to work with the API without physical G39DDC device.

Return value

If the method succeeds, the return value non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

Use the IG39DDCDevice::Close method to close currently open G39DDC device associated with the device object.


IG39DDCDevice::Close

Closes currently open G39DDC device associated with the device object and makes the object available for use with another G39DDC device.

C/C++ declaration

void __stdcall Close(void);

Parameters

None

Return value

None

IG39DDCDevice::IsConnected

Checks if the device is still connected to the computer.

C/C++ declaration

BOOL __stdcall IsConnected(void);

Parameters

None

Return value

The method returns non-zero value if the device is still connected.
If the device is disconnected or the method fails return value is zero. To determine if the method failed, call GetLastError. GetLastError returns ERROR_SUCCESS if the device is disconnected or another error code if IsConnected failed.

Remarks

If it is determined the device is disconnected, the IG39DDCDevice::Close should be used.

IG39DDCDevice::GetDeviceInfo

Retrieves information about the G39DDC device.

C/C++ declaration

BOOL __stdcall GetDeviceInfo(G39DDC_DEVICE_INFO *Info,UINT32 BufferLength);

Parameters

Info
[out] Pointer to a G39DDC_DEVICE_INFO structure to be filled with information about the device. This parameter cannot be NULL.
BufferLength
[in] Size in bytes of the G39DDC_DEVICE_INFO structure.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

IG39DDCDevice::SetLED

Sets the front panel LED flashing mode.

C/C++ declaration

BOOL __stdcall SetLED(UINT32 LEDMode);

Parameters

LEDMode
[in] Specifies front panel LED flashing mode. It can be one of the following:

ValueMeaning
G39DDC_FRONT_PANEL_LED_MODE_DIAGDiagnostic flashing.
G39DDC_FRONT_PANEL_LED_MODE_ONAlways on.
G39DDC_FRONT_PANEL_LED_MODE_OFFAlways off.

Return value

If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

Use the IG39DDCDevice::GetLED method to determine current flashing mode of the front panel LED.

A complete list of the diagnostic flashing patterns and their meaning is as follows:

No. Pattern Description Mode
1
        
Off No power
2
        
Long flash, equal gap No connection to computer
3
        
Two short flashes USB connected, radio off
4
        
One short flash followed by a long one USB connected, radio on, ready
5
        
Two short flashes followed by a long one USB connected, driver not installed
6
        
Three short flashes USB connected, driver installed, application not running


IG39DDCDevice::GetLED

Determines current flashing mode of device's front panel LED.

C/C++ declaration

BOOL __stdcall GetLED(UINT32 *LEDMode);

Parameters

LEDMode
[out] Pointer to a variable that receives current flashing mode of device's front panel LED. For list of possible values, see IG39DDCDevice::SetLED. This parameter cannot be NULL.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

IG39DDCDevice::SetPower

Turns the G39DDC device on or off.

C/C++ declaration

BOOL __stdcall SetPower(BOOL Power);

Parameters

Power
[in] Specifies whether to turn on or off the device. If this parameter is non-zero the device is turned on, if it is zero the device is turned off.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

If IG39DDCDevice::SetPower turns the device off, all the running streaming are stopped.

Use the IG39DDCDevice::GetPower method to determine current power state of the device.


IG39DDCDevice::GetPower

Determines whether the device is turned on or off.

C/C++ declaration

BOOL __stdcall GetPower(BOOL *Power);

Parameters

Power
[out] Pointer to a variable that receives current power state of the device. If it is non-zero, the device is turned on. If it is zero the device is turned off. This parameter cannot be NULL.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

IG39DDCDevice::SetFrequency

Sets absolute frequency of the demodulator for given channel.

C/C++ declaration

BOOL __stdcall SetFrequency(UINT32 Channel,UINT64 Frequency);

Parameters

Channel
[in] Specifies channel index. Possible values are: 0, 1.
Frequency
[in] Specifies new absolute frequency of the demodulator in Hz.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

The method sets front-end frequency, relative DDC1, DDC2 and demodulator frequencies so that new absolute frequency of the demodulator is the required one.

Absolute frequency of the demodulator is given by the following formula:

faDEM[i] = fFE + frDDC1[i] + frDDC2[i] + frDEM[i]

Where faDEM[i] is absolute center frequency of the demodulator of i-th channel in Hz, fFE is front-end frequency (see IG39DDCDevice::SetFrontEndFrequency), frDDC1[i] is relative center frequency of the DDC1 in Hz (set using the IG39DDCDevice::SetDDC1Frequency method), frDDC2[i] is relative center frequency of DDC2 of i-th channel in Hz (set using the IG39DDCDevice::SetDDC2Frequency method) and frDEM[i] is relative center frequency of the demodulator of i-th channel in Hz (set using the IG39DDCDevice::SetDemodulatorFrequency method).

Absolute center frequency of the demodulator is the real-world frequency that you are listening to.

Use the IG39DDCDevice::GetFrequency method to retrieve current absolute frequency of the demodulator.


IG39DDCDevice::GetFrequency

Determines absolute frequency of the demodulator for given channel.

C/C++ declaration

BOOL __stdcall GetFrequency(UINT32 Channel,UINT64 *Frequency);

Parameters

Channel
[in] Specifies channel index. Possible values are: 0, 1.
Frequency
[out] Pointer to a variable that receives current absolute frequency of the demodulator. This parameter cannot be NULL.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

Returned value of the variable pointed to by the Frequency parameter is sum of front-end frequency and relative DDC1, DDC2 and demodulator frequencies. For more information, see remarks of the IG39DDCDevice::SetFrequency method.

IG39DDCDevice::SetExternalReference

Enables or disables the use of external reference as the clock source.

C/C++ declaration

BOOL __stdcall SetExternalReference(BOOL Enabled);

Parameters

Enabled
[in] Specifies the desired clock source: nonzero - external reference, zero - internal.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

External reference is optional. If the receiver does not support external reference, IG39DDCDevice::SetExternalReference fails. The following example shows how to determine the receiver supports external reference:

    G39DDC_DEVICE_INFO DeviceInfo;

    IG39DDCDevice *Device;  //Interface of G39DDC device object, created using the CreateInstance function

    

    Device->GetDeviceInfo(&DeviceInfo,sizeof(DeviceInfo));

    

    if(DeviceInfo.HardwareOptions & G39DDC_HARDWARE_OPTIONS_EXTERNAL_REFERENCE)

    {

        //the receiver supports external reference

    }

    else

    {

        //the receiver does not support external reference

    }


IG39DDCDevice::GetExternalReference

Retrieves the current clock source.

C/C++ declaration

BOOL __stdcall GetExternalReference(BOOL *Enabled);

Parameters

Enabled
[out] Pointer to a variable that receives information about the current clock source. If it is non-zero, external reference is used, if it is zero, internal reference is used. This parameter cannot be NULL.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

IG39DDCDevice::SetAttenuator

Sets input attenuator. The attenuator is applied for front-end frequencies (see IG39DDCDevice::SetFrontEndFrequency) below 60 MHz.

C/C++ declaration

BOOL __stdcall SetAttenuator(UINT32 Attenuator);

Parameters

Attenuator
[in] Value that specifies desired attenuation level. The value must be one of the following:

ValueMeaning
G39DDC_ATTENUATOR_0dBNo attenuation.
G39DDC_ATTENUATOR_6dB6 dB attenuation.
G39DDC_ATTENUATOR_12dB12 dB attenuation.
G39DDC_ATTENUATOR_18dB18 dB attenuation.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

Use the IG39DDCDevice::GetAttenuator method to determine current setting of the attenuator.

IG39DDCDevice::GetAttenuator

Retrieves current setting of the attenuator.

C/C++ declaration

BOOL __stdcall GetAttenuator(UINT32 *Attenuator);

Parameters

Attenuator
[out] Pointer to a variable that receives current attenuation. This parameter cannot be NULL.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

IG39DDCDevice::SetPreamplifier

Enables or disables input preamplifier. The preamplifier is applied to front-end frequencies (see IG39DDCDevice::SetFrontEndFrequency) above 50 MHz.

C/C++ declaration

BOOL __stdcall SetPreamplifier(BOOL Preamp);

Parameters

Preamp
[in] Specifies whether to enable or disable preamplifier. If this parameter is non-zero, the preamplifier is enabled. If the parameter is zero, the preamplifier is disabled.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

Use the IG39DDCDevice::GetPreamplifier method to determine current state of the preamplifier.


IG39DDCDevice::GetPreamplifier

Retrieves current state of input preamplifier.

C/C++ declaration

BOOL __stdcall GetPreamplifier(BOOL *Preamp);

Parameters

Preamp
[out] Pointer to a variable that receives current state of the preamplifier. The value is non-zero if the preamplifier is enabled and zero if it is disabled. This parameter cannot be NULL.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

IG39DDCDevice::SetFrontEndFrequency

Sets the frequency of the device's analog front-end.

C/C++ declaration

BOOL __stdcall SetFrontEndFrequency(UINT64 Frequency);

Parameters

Frequency
[in] Specifies new front-end frequency in Hz. The value can be between (including) values provided by the FrontEndMinFrequency and FrontEndMaxFrequency members of the G39DDC_DEVICE_INFO structure. If the specified frequency is not equal to the FrontEndMinFrequency, it has to be multiple of the FrontEndFrequencyStep member of the G39DDC_DEVICE_INFO structure.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

Changing of front-end frequency causes change of absolute frequency of the DDC1, DDC2 and demodulator in each channel.

Use the IG39DDCDevice::GetFrontEndFrequency method to retrieve current front-end frequency.


IG39DDCDevice::GetFrontEndFrequency

Retrieves current front-end frequency.

C/C++ declaration

BOOL __stdcall GetFrontEndFrequency(UINT64 *Frequency);

Parameters

Frequency
[out] Pointer to a variable that receives current current front-end frequency in Hz. This parameter cannot be NULL.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

IG39DDCDevice::SetDithering

Enables or disables ADC dithering.

C/C++ declaration

BOOL __stdcall SetDithering(BOOL Enabled);

Parameters

Enabled
[in] Specifies whether to enable or disable ADC dithering. If this parameter is non-zero, dithering is enabled. If the parameter is zero, dithering is disabled.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

Use the IG39DDCDevice::GetDithering method to determine current state of ADC dithering.

IG39DDCDevice::GetDithering

Retrieves current state of ADC dithering.

C/C++ declaration

BOOL __stdcall GetDithering(BOOL *Enabled);

Parameters

Enabled
[out] Pointer to a variable that receives current state of dithering. The value is non-zero if dithering is enabled and zero if it is disabled. This parameter cannot be NULL.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

IG39DDCDevice::SetADCNoiseBlanker

Enables or disables noise blanker on ADC stream.

C/C++ declaration

BOOL __stdcall SetADCNoiseBlanker(BOOL Enabled);

Parameters

Enabled
[in] Specifies whether to enable or disable noise blanker. If this parameter is non-zero, noise blanker is enabled. If the parameter is zero, noise blanker is disabled.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

Use the IG39DDCDevice::GetADCNoiseBlanker method to determine current state of the noise blanker.

IG39DDCDevice::GetADCNoiseBlanker

Retrieves current ADC noise blanker state.

C/C++ declaration

BOOL __stdcall GetADCNoiseBlanker(BOOL *Enabled);

Parameters

Enabled
[out] Pointer to a variable that receives current state of noise blanker. The value is non-zero if noise blanker is enabled and zero if it is disabled. This parameter cannot be NULL.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

IG39DDCDevice::SetADCNoiseBlankerThreshold

Specifies ADC noise blanker threshold.

C/C++ declaration

BOOL __stdcall SetADCNoiseBlankerThreshold(WORD Threshold);

Parameters

Threshold
[in] Specifies the maximum acceptable input signal. Maximum possible value of threshold is 32767.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

Use the IG39DDCDevice::GetADCNoiseBlankerThreshold method to retrieve current threshold of the noise blanker.

IG39DDCDevice::GetADCNoiseBlankerThreshold

Determines ADC noise blanker threshold.

C/C++ declaration

BOOL __stdcall GetADCNoiseBlankerThreshold(WORD *Threshold);

Parameters

Threshold
[out] Pointer to a variable that receives threshold of ADC noise blanker. This parameter cannot be NULL.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

IG39DDCDevice::SetInverted

Enables or disables frequency spectrum inversion.

C/C++ declaration

BOOL __stdcall SetInverted(BOOL Inverted);

Parameters

Inverted
[in] Specifies whether to enable or disable frequency spectrum inversion. If this parameter is non-zero, IF spectrum is inverted.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

IG39DDCDevice::GetInverted

Retrieves current frequency spectrum inversion setting.

C/C++ declaration

BOOL __stdcall GetInverted(BOOL *Inverted);

Parameters

Inverted
[out] Pointer to a variable that receives non-zero value if the frequency spectrum inversion is enabled, and zero if the inversion is disabled. This parameter cannot be NULL.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

IG39DDCDevice::StartIF

Starts sending of IF snapshots.

C/C++ declaration

BOOL __stdcall StartIF(WORD Period);

Parameters

Period
[in] Specifies time interval in milliseconds how often the IF snapshots are sent to IG39DDCDeviceCallback::G39DDC_IFCallback callback.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

The G39DDC device has to be turned on using the IG39DDCDevice::SetPower method before use of IG39DDCDevice::StartIF, otherwise the IG39DDCDevice::StartIF method fails.

Too low value of the Period parameter can dramatically increase data flow through USB/PCIe which could cause breaking of running streaming.


IG39DDCDevice::StopIF

Stops sending of IF snapshots.

C/C++ declaration

BOOL __stdcall StopIF(void);

Parameters

None

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

The IG39DDCDeviceCallback::G39DDC_IFCallback callback is not called after IG39DDCDevice::StopIF returns.


IG39DDCDevice::GetDDCInfo

Retrieves information about DDC format.

C/C++ declaration

BOOL __stdcall GetDDCInfo(UINT32 DDCTypeIndex,G39DDC_DDC_INFO *Info);

Parameters

DDCTypeIndex
[in] Specifies index of DDC type. For more information, see remarks.
Info
[out] Pointer to a G39DDC_DDC_INFO structure to be filled with information about information of the DDC type.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

Use the IG39DDCDevice::GetDDC1Count method to determine the number of possible DDC types of DDC1. In this case the DDCTypeIndex parameter can vary from zero to one less than the number determined by IG39DDCDevice::GetDDC1Count.

Use the IG39DDCDevice::GetDDC2Count method to determine the number of possible DDC types of DDC2. In this case the DDCTypeIndex parameter can vary from zero to one less than the number determined by IG39DDCDevice::GetDDC2Count.

Use the IG39DDCDevice::GetDDC1 method to determine current DDC type index of DDC1 and the IG39DDCDevice::GetDDC2 method to determine current DDC type of DDC2.


IG39DDCDevice::GetDDC1Count

Retrieves number of DDC types supported by DDC1 for given channel.

C/C++ declaration

BOOL __stdcall GetDDC1Count(UINT32 Channel,UINT32 *Count);

Parameters

Channel
[in] Specifies channel index. Possible values are 0 and 1.
Count
[out] Pointer to a variable that receives number of DDC types. This parameter cannot be NULL.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

IG39DDCDevice::SetDDC1

Sets current DDC type of DDC1 for given channel.

C/C++ declaration

BOOL __stdcall SetDDC1(UINT32 Channel,UINT32 DDCTypeIndex);

Parameters

Channel
[in] Specifies channel index. Possible values are 0 and 1.
DDCTypeIndex
[in] Specifies index of DDC type to be used in DDC1.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

Use the IG39DDCDevice::GetDDC1Count method to determine the number of possible DDC types of DDC1 for given channel. The DDCTypeIndex parameter can vary from zero to one less than the number determined by IG39DDCDevice::GetDDC1Count.

Number of DDC types of DDC1 for second channel (channel index 1) can be reduced. To determine number of available DDC types of DDC1 for second channel use the IG39DDCDevice::GetDDC1Count method with parameter Channel set to 1.

DDC1 streaming must not run when calling IG39DDCDevice::SetDDC1. In other words, DDC1 streaming that is started using the IG39DDCDevice::StartDDC1 method has to be stopped using the IG39DDCDevice::StopDDC1 method before calling of IG39DDCDevice::SetDDC1, otherwise IG39DDCDevice::SetDDC1 fails. The IG39DDCDevice::SetDDC1 method does not start and stop DDC1 streaming, just changes DDC type of DDC1.

Calling of IG39DDCDevice::SetDDC1 can change number of DDC types of DDC2, therefore it is useful to call the IG39DDCDevice::GetDDC2Count method immediately after IG39DDCDevice::SetDDC1.

Calling of IG39DDCDevice::SetDDC1 can change current DDC type of DDC2 and current bandwidth of demodulator filter if current DDC type index of DDC2 is greater than the DDCTypeIndex parameter, so it is useful to call the IG39DDCDevice::GetDDC2 and IG39DDCDevice::GetDemodulatorFilterBandwidth methods immediately after IG39DDCDevice::SetDDC1 to determine current DDC type of DDC2 and current bandwidth of demodulator filter.

Use the IG39DDCDevice::GetDDC1 function to determine current DDC type of the DDC1.


IG39DDCDevice::GetDDC1

Retrieves information about current DDC type of the DDC1 for given channel.

C/C++ declaration

BOOL __stdcall GetDDC1(UINT32 Channel,UINT32 *DDCTypeIndex);

Parameters

Channel
[in] Specifies channel index. Possible values are 0 and 1.
DDCTypeIndex
[out] Pointer to a variable that receives index of current DDC type of the DDC1. Received value can be passed to the IG39DDCDevice::GetDDCInfo method to to retrieve information about current DDC type of the DDC1. This parameter cannot be NULL.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

IG39DDCDevice::SetDDC1Frequency

Sets relative center frequency of DDC1 for given channel.

C/C++ declaration

BOOL __stdcall SetDDC1Frequency(UINT32 Channel,INT32 Frequency);

Parameters

Channel
[in] Specifies channel index. Possible values are 0 and 1.
Frequency
[in] Specifies new center frequency of DDC1 in Hz.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

The frequency is relative to front-end frequency (see IG39DDCDevice::SetFrontEndFrequency), it can be negative. Usable bandwidth at front-end output is specified by the FrontEndWindowWidth member of the G39DDC_DEVICE_INFO structure. The Frequency parameter should vary from (-(INT32)FrontEndWindowWidth/2 + half of current usable bandwidth of DDC1) to (FrontEndWindowWidth/2 - half of current usable bandwidth of DDC1). Use IG39DDCDevice::GetDDC1 and IG39DDCDevice::GetDDCInfo methods to determine current usable bandwidth of the DDC1.

Changing of DDC1 frequency causes change of absolute frequency of the DDC2 and demodulator for given channel.

Absolute frequency of the DDC1 is given by the following formula:

faDDC1[i] = fFE + frDDC1[i]

Where faDDC1[i] is absolute center frequency of DDC1 of i-th channel in Hz, fFE is front-end frequency in Hz (set using the IG39DDCDevice::SetFrontEndFrequency method) and frDDC1[i] is relative center frequency of DDC1 of i-th channel in Hz (set using SetDDC1Frequency).

Changing of DDC1 relative frequency changes absolute frequency of the DDC1 and demodulator in the specified channel.

Use the IG39DDCDevice::GetDDC1Frequency method to determine current relative center frequency of the DDC1 for given channel.

The following example shows how to set absolute DDC1 center frequency of channel 0 to 11.01 MHz:


IG39DDCDevice *Device; //Interface to G39DDC device object, created by CreateInstance function



Device->SetFrontEndFrequency(10000000);

Device->SetDDC1Frequency(0,1010000);


IG39DDCDevice::GetDDC1Frequency

Retrieves current center frequency of DDC1 for given channel.

C/C++ declaration

BOOL __stdcall GetDDC1Frequency(UINT32 Channel,INT32 *Frequency);

Parameters

Channel
[in] Specifies channel index. Possible values are 0 and 1.
Frequency
[out] Pointer to a variable that receives current center frequency of DDC1 in Hz. This parameter cannot be NULL.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

IG39DDCDevice::StartDDC1

Starts DDC1 streaming for given channel.

C/C++ declaration

BOOL __stdcall StartDDC1(UINT32 Channel,UINT32 SamplesPerBuffer);

Parameters

Channel
[in] Specifies channel index. Possible values are 0 and 1.
SamplesPerBuffer
[in] Specifies number of I/Q sample sets in each buffer passed to the the IG39DDCDeviceCallback::G39DDC_DDC1StreamCallback callback. The value has to be multiple of 64 greater than zero. If it is zero, the IG39DDCDevice::StartDDC1 method fails. If it is not multiple of 64 the function rounds it up to nearest multiple of 64.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

The G39DDC device has to be turned on using the IG39DDCDevice::SetPower method before IG39DDCDevice::StartDDC1 is used. Otherwise IG39DDCDevice::StartDDC1 fails.

Sweeping (see IG39DDCDevice::StartSweeping must not be running before IG39DDCDevice::StartDDC1 is used, otherwise IG39DDCDevice::StartDDC1 fails.

If the DDC1 streaming is already running before use of IG39DDCDevice::StartDDC1, IG39DDCDevice::StartDDC1 restarts the streaming except it was previously started with the same SamplesPerBuffer parameter. In this case StartDDC1 does nothing. Restart of DDC1 streaming stops of DDC2 and audio streaming of given channel. StartDDC1 does not restart DDC2 and audio streaming.

If DDC1 playback is running (started using IG39DDCDevice::StartDDC1Playback method) before use of IG39DDCDevice::StartDDC1, IG39DDCDevice::StartDDC1 stops it and starts DDC1 streaming from the device.

Use the IG39DDCDevice::StopDDC1 method to stop DDC1 streaming.

Decreasing value of the SamplesPerBuffer parameter decreases latency and it may increase CPU usage. Increasing value of the SamplesPerBuffer parameter increased latency and it may decrease CPU usage.


IG39DDCDevice::StopDDC1

Stops DDC1 streaming for given channel.

C/C++ declaration

BOOL __stdcall StopDDC1(UINT32 Channel);

Parameters

Channel
[in] Specifies channel index. Possible values are 0 and 1.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

If DDC1 playback is running (started using IG39DDCDevice::StartDDC1Playback) before use of IG39DDCDevice::StopDDC1, the IG39DDCDevice::StopDDC1 method stops it.

The IG39DDCDevice::StopDDC1 method stops all the streaming beyond the DDC1 in processing chain (DDC2 and audio streaming) in specified channel. The streaming in the other channel is not affected

The IG39DDCDeviceCallback::G39DDC_DDC1StreamCallback and IG39DDCDeviceCallback::G39DDC_DDC1PlaybackStreamCallback callbacks are not called after IG39DDCDevice::StopDDC1 returns.


IG39DDCDevice::StartDDC1Playback

Starts DDC1 playback for given channel. It allows to pass previously recorded DDC1 I/Q samples to the processing chain instead of the samples received from the device.

C/C++ declaration

BOOL __stdcall StartDDC1Playback(UINT32 Channel,UINT32 SamplesPerBuffer,UINT32 BitsPerSample);

Parameters

Channel
[in] Specifies channel index. Possible values are 0 and 1.
SamplesPerBuffer
[in] Specifies number of I/Q sample sets in each buffer passed to the IG39DDCDeviceCallback::G39DDC_DDC1PlaybackStreamCallback callback to fill the buffer by the application and to the IG39DDCDeviceCallback::G39DDC_DDC1StreamCallback callback. The value has to be multiple of 64 greater than zero. If it is zero, the IG39DDCDevice::StartDDC1Playback method fails. If it is not multiple of 64 the function rounds it up to nearest multiple of 64.
BitsPerSample
[in] Specifies number of bits per I and Q samples. It is used for both IG39DDCDeviceCallback::G39DDC_DDC1PlaybackStreamCallback and IG39DDCDeviceCallback::G39DDC_DDC1StreamCallback callbacks. The possible value is one of the following:

ValueMeaning
0I and Q samples have default number of bits. It is given by by BitsPerSample member of the G39DDC_DDC_INFO structure which can be retrieved using the IG39DDCDevice::GetDDC1 and IG39DDCDevice::GetDDCInfo methods. Possible values are 16 or 32 bits per sample, signed, little endian.
16I and Q samples have 16 bit (16 bits per I, 16 bits per Q), signed, little endian.
32I and Q samples have 32 bit (32 bits per I, 32 bits per Q), signed, little endian.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

The G39DDC device has to be turned on using IG39DDCDevice::SetPower method before use of IG39DDCDevice::StartDDC1Playback.

The IG39DDCDevice::StartDDC1Playback method stops DDC1 streaming that was previously started by the IG39DDCDevice::StartDDC1 or IG39DDCDevice::StartDDC1Playback method and starts DDC1 playback with new parameters. Stopping of DDC1 streaming stops DDC2 and audio steaming in each channel. IG39DDCDevice::StartDDC1Playback does not restart DDC2 and audio streaming.

Use the IG39DDCDevice::StopDDC1 function to stop DDC1 playback.


IG39DDCDevice::PauseDDC1Playback

Pauses DDC1 playback for given channel.

C/C++ declaration

BOOL __stdcall PauseDDC1Playback(UINT32 Channel);

Parameters

Channel
[in] Specifies channel index. Possible values are 0 and 1.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

If DDC1 playback is not active or it is already paused, IG39DDCDevice::PauseDDC1Playback does nothing.

The IG39DDCDeviceCallback::G39DDC_DDC1PlaybackStreamCallback and IG39DDCDeviceCallback::G39DDC_DDC1StreamCallback callbacks can be invoked once after IG39DDCDevice::PauseDDC1Playback returns. Then they are not called until playback is resumed using the IG39DDCDevice::ResumeDDC1Playback method.


IG39DDCDevice::ResumeDDC1Playback

Resumes paused DDC1 playback for given channel.

C/C++ declaration

BOOL __stdcall ResumeDDC1Playback(UINT32 Channel);

Parameters

Channel
[in] Specifies channel index. Possible values are 0 and 1.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

If DDC1 playback is not active or it is not paused, IG39DDCDevice::ResumeDDC1Playback does nothing.


IG39DDCDevice::GetDDC2Count

Retrieves number of DDC types supported by DDC2 for given channel.

C/C++ declaration

BOOL __stdcall GetDDC2Count(UINT32 Channel,UINT32 *Count);

Parameters

Channel
[in] Specifies channel index. Possible values are 0 and 1.
Count
[out] Pointer to a variable that receives number of DDC types. This parameter cannot be NULL.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

Each channel has its own DDC2, see the block diagram. DDC type of each DDC2 can be different. Number of DDC types of DDC2 depends on DDC1 but maximum is 13 (DDC type index 12). If DDC type index of DDC1 is below 12, maximum of DDC types supported by DDC2 is DDC type index of DDC1 + 1. Changing of DDC type of DDC1 can cause change of DDC type of DDC2 and number of DDC types of DDC2, so it is useful to call IG39DDCDevice::GetDDC2 immediately after the IG39DDCDevice::SetDDC1 method to determine current DDC type of DDC2 if the application needs to know parameters of DDC2.

The BitsPerSample member of the G39DDC_DDC_INFO structure is not used and it can be ignored for DDC2. I and Q samples in buffers passed to the IG39DDCDeviceCallback::G39DDC_DDC2StreamCallback and IG39DDCDeviceCallback::G39DDC_DDC2PreprocessedStreamCallback DDC2 callbacks are always in IEEE float (32 bit, little endian) format.


IG39DDCDevice::SetDDC2

Sets current DDC type of DDC2 for given channel.

C/C++ declaration

BOOL __stdcall SetDDC2(UINT32 Channel,UINT32 DDCTypeIndex);

Parameters

Channel
[in] Specifies channel index. Possible values are 0 and 1.
DDCTypeIndex
[in] Specifies index of DDC type to be used in DDC2.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

Use the IG39DDCDevice::GetDDC2Count method to determine the number of possible DDC types of DDC2 for given channel. The DDCTypeIndex parameter can vary from zero to one less than the number determined by GetDDC2Count.

DDC2 streaming must not run when calling IG39DDCDevice::SetDDC2. In other words, DDC2 streaming that is started using the IG39DDCDevice::StartDDC2 method has to be stopped using the IG39DDCDevice::StopDDC2 method before calling of IG39DDCDevice::SetDDC2, otherwise IG39DDCDevice::SetDDC2 fails. The IG39DDCDevice::SetDDC2 method does not start and stop DDC2 streaming, just changes DDC type of DDC2.

Calling of IG39DDCDevice::SetDDC2 can change current bandwidth of demodulator filter, therefore it is useful to call the IG39DDCDevice::GetDemodulatorFilterBandwidth method immediately after IG39DDCDevice::SetDDC2 to determine current bandwidth of demodulator filter.

Use the IG39DDCDevice::GetDDC2 method to determine current DDC type of the DDC2.


IG39DDCDevice::GetDDC2

Retrieves information about current DDC type of the DDC2 for given channel.

C/C++ declaration

BOOL __stdcall GetDDC2(UINT32 Channel,UINT32 *DDCTypeIndex);

Parameters

DDCTypeIndex
[out] Pointer to a variable that receives index of current DDC type of the DDC2. This parameter cannot be NULL.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

Each channel has its own DDC2, see the block diagram. DDC type of DDC2 in each channel can be different. Number of provided DDC types for DDC2 depends on current DDC type of DDC1. Maximum number of DDC types for DDC2 is 13, maximum DDC type index for DDC2 is 12.

Chanding DDC type index of DDC1 (using the IG39DDCDevice::SetDDC1 method can cause change of number of supported DDC types and current DDC type index for DDC2. Therefore it is useful to call IG39DDCDevice::GetDDC2 and IG39DDCDevice::GetDDCInfo immediately after the IG39DDCDevice::SetDDC1 method.

Returned DDCTypeIndex can be passed to the IG39DDCDevice::GetDDCInfo method. The BitsPerSample member of the G39DDC_DDC_INFO structure is not used and it can be ignored for DDC2. I and Q samples in buffers passed to the IG39DDCDeviceCallback::G39DDC_DDC2StreamCallback and IG39DDCDeviceCallback::G39DDC_DDC2PreprocessedStreamCallback DDC2 callbacks are always in IEEE float (32 bit, little endian) format.


IG39DDCDevice::SetDDC2Frequency

Sets relative center frequency of DDC2 for given channel.

C/C++ declaration

BOOL __stdcall SetDDC2Frequency(UINT32 Channel,INT32 Frequency);

Parameters

Channel
[in] Specifies channel index. Possible values are: 0, 1.
Frequency
[in] Specifies new center frequency of DDC2 in Hz.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

Value of the Frequency parameter is center frequency of the DDC2 relative to center of the DDC1. The value can be negative.

Absolute frequency of the DDC2 is given by the following formula:

faDDC2[i] = fFE + frDDC1[i] + frDDC2[i]

Where faDDC2[i] is absolute center frequency of DDC2 of i-th channel in Hz, fFE is front-end frequency (see IG39DDCDevice::SetFrontEndFrequency), fDDC1[i] is relative center frequency of the DDC1 in Hz (set using the IG39DDCDevice::SetDDC1Frequency method) and frDDC2[i] is relative center frequency of DDC2 of i-th channel in Hz (set using IG39DDCDevice::SetDDC2Frequency).

Changing of DDC2 relative frequency changes absolute frequency of the DDC2 and demodulator in the specified channel.

Use the IG39DDCDevice::GetDDC2Frequency function to determine current relative center frequency of the DDC2 for given channel.

The following example shows how it is possible to set absolute DDC2 center frequency of channel 0 to 11.01 MHz:


IG39DDCDevice *Device; //Interface of the G39DDC device object, created using CreateInstancea, function



//1. method

Device->SetFrontEndFrequency(10000000);

Device->SetDDC1Frequency(0,1000000);

Device->SetDDC2Frequency(0,10000);



//2. method

Device->SetFrontEndFrequency(10000000);

Device->SetDDC1Frequency(0,1010000);

Device->SetDDC2Frequency(0,0);



//2. method

Device->SetFrontEndFrequency(10000000);

Device->SetDDC1Frequency(0,1020000);

Device->SetDDC2Frequency(0,-10000);




IG39DDCDevice::GetDDC2Frequency

Retrieves current relative center frequency of DDC2.

C/C++ declaration

BOOL __stdcall GetDDC2Frequency(UINT32 Channel,INT32 *Frequency);

Parameters

Channel
[in] Specifies channel index. Possible values are: 0, 1.
Frequency
[out] Pointer to a variable that receives current relative center frequency of DDC2 in Hz. The returned value can be negative. See remarks of the IG39DDCDevice::SetDDC2Frequency for information how to calculate absolute center frequency of DDC2. This parameter cannot be NULL.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

IG39DDCDevice::StartDDC2

Starts DDC2 streaming for given channel.

C/C++ declaration

BOOL __stdcall StartDDC2(UINT32 Channel,UINT32 SamplesPerBuffer);

Parameters

Channel
[in] Specifies channel index. Possible values are: 0, 1.
SamplesPerBuffer
[in] Specifies number of I/Q sample sets in each buffer passed to the the IG39DDCDeviceCallback::G39DDC_DDC2StreamCallback and IG39DDCDeviceCallback::G39DDC_DDC2PreprocessedStreamCallback callbacks. The value has to be multiple of 64 greater than zero. If it is zero, the IG39DDCDevice::StartDDC2 method fails. If it is not multiple of 64 the function rounds it up to nearest multiple of 64.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

Before IG39DDCDevice::StartDDC2 is used, the G39DDC device has to be turned on using the IG39DDCDevice::SetPower method and DDC1 streaming has to be started using the IG39DDCDevice::StartDDC1 or IG39DDCDevice::StartDDC1Playback method, otherwise IG39DDCDevice::StartDDC2 fails.

If the DDC2 streaming for given channel is already running, IG39DDCDevice::StartDDC2 restarts it except the streaming was previously started with the same SamplesPerBuffer parameter. In this case StartDDC2 does nothing. Restart of the DDC2 streaming stops audio streaming for give channel. IG39DDCDevice::StartDDC2 does not restart audio streaming.

Use the IG39DDCDevice::StopDDC2 function to stop DDC2 streaming.

Decreasing value of the SamplesPerBuffer parameter decreases latency and it may increase CPU usage. Increasing value of the SamplesPerBuffer parameter increased latency and it may decrease CPU usage.


IG39DDCDevice::StopDDC2

Stops DDC2 streaming for given channel.

C/C++ declaration

BOOL __stdcall StopDDC2(UINT32 Channel);

Parameters

Channel
[in] Specifies channel index. Possible values are: 0, 1.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

If audio streaming for given channel is running, it is stopped too.

If DDC2 streaming is not active, IG39DDCDevice::StopDDC2 does nothing.

The IG39DDCDeviceCallback::G39DDC_DDC2StreamCallback and IG39DDCDeviceCallback::G39DDC_DDC2PreprocessedStreamCallback callbacks are not called after IG39DDCDevice::StopDDC2 returns.


IG39DDCDevice::SetDDC2NoiseBlanker

Enables or disables noise blanker on DDC2 stream for given channel.

C/C++ declaration

BOOL __stdcall SetDDC2NoiseBlanker(UINT32 Channel,BOOL Enabled);

Parameters

Channel
[in] Specifies channel index. Possible values are: 0, 1.
Enabled
[in] Specifies whether to enable or disable noise blanker. If this parameter is non-zero, noise blanker is enabled. If the parameter is zero, noise blanker is disabled.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

Use the IG39DDCDevice::GetDDC2NoiseBlanker method to determine current state of the noise blanker.

IG39DDCDevice::GetDDC2NoiseBlanker

Retrieves current DDC2 noise blanker state of given channel.

C/C++ declaration

BOOL __stdcall GetDDC2NoiseBlanker(UINT32 Channel,BOOL *Enabled);

Parameters

Channel
[in] Specifies channel index. Possible values are: 0, 1.
Enabled
[out] Pointer to a variable that receives current state of noise blanker. The value is non-zero if noise blanker is enabled and zero if it is disabled. This parameter cannot be NULL.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

IG39DDCDevice::SetDDC2NoiseBlankerThreshold

Specifies DDC2 noise blanker threshold for given channel.

C/C++ declaration

BOOL __stdcall SetDDC2NoiseBlankerThreshold(UINT32 Channel,double Threshold);

Parameters

Channel
[in] Specifies channel index. Possible values are: 0, 1.
Threshold
[in] Specifies threshold in %.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

Use the IG39DDCDevice::GetDDC2NoiseBlankerThreshold method to retrieve current threshold of the noise blanker.

IG39DDCDevice::GetDDC2NoiseBlankerThreshold

Retrieves DDC2 noise blanker threshold of given channel.

C/C++ declaration

BOOL __stdcall GetDDC2NoiseBlankerThreshold(UINT32 Channel,double *Threshold);

Parameters

Channel
[in] Specifies channel index. Possible values are: 0, 1.
Threshold
[out] Pointer to a variable that receives threshold of the noise blanker. This parameter cannot be NULL.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

IG39DDCDevice::GetDDC2NoiseBlankerExcessValue

Determines value which indicates percentage ratio between short time average signal level and maximum level.

C/C++ declaration

BOOL __stdcall GetDDC2NoiseBlankerExcessValue(UINT32 Channel,double *Value);

Parameters

Channel
[in] Specifies channel index. Possible values are: 0, 1.
Value
[out] Pointer to a variable that receives current excess value in %. This parameter cannot be NULL.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

IG39DDCDevice::GetSignalLevel

Determines current signal level for given channel.

C/C++ declaration

BOOL __stdcall GetSignalLevel(UINT32 Channel,FLOAT *Peak,FLOAT *RMS);

Parameters

Channel
[in] Specifies channel index. Possible values are: 0, 1.
Peak
[out] Pointer to a variable that receives current signal level (peak) in Volts. This parameter can be NULL if the application does not require this information.
RMS
[out] Pointer to a variable that receives current signal level (RMS) in Volts. This parameter can be NULL if the application does not require this information.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

DDC2 streaming has to be active (started using the IG39DDCDevice::StartDDC2 method) before calling of IG39DDCDevice::GetSignalLevel, otherwise returned peak and RMS signal levels are zero.

Signal level is evaluated from signal after the demodulator filter and before the notch filter (see block diagram), the signal is selected by the demodulator filter.

Signal level is evaluated for each buffer that processed by the demoduletor filter. Buffer size (signal level evaluation rate) is given by the SamplesPerBuffer parameter of the IG39DDCDevice::StartDDC2 method.

The IG39DDCDeviceCallback::G39DDC_DDC2PreprocessedStreamCallback callback provides signal level for each buffer passed the callback, i.e. for each buffer used in signal level evaluation. This provides way to get signal level from each processed buffer without need of pulling it using IG39DDCDevice::GetSignalLevel.

To convert RMS signal level in Volts to power in dBm use the following formulas:

P[W] = (VRMS)2 / R = (VRMS)2 / 50

P[dBm]= 10 * log10( P[W] * 1000 )

Where VRMS is RMS signal level in Volts obtained by IG39DDCDevice::GetSignalLevel, R is G39DDC receiver input impedance (50 Ω), P[W] is power in Watts, P[dBm] is power in dBm and 1000 is conversion coefficient W -> mW.

The following example shows how to obtain current signal level in dBm from channel 0:


#include <stdio.h>

#include <math.h>



IG39DDCDevice *Device; //Interface of the G39DDC device object, created using CreateInstance function

float P_dBm,V_RMS;



Device->GetSignalLevel(,0,NULL,&V_RMS);



P_dBm=10.0*log10(V_RMS*V_RMS*(1000.0/50.0));



printf("Current signal level [RMS]: %.1f dBm\n",P_dBm);


IG39DDCDevice::SetNotchFilter

Enables or disables notch filter for given channel.

C/C++ declaration

BOOL __stdcall SetNotchFilter(UINT32 Channel,UINT32 NotchFilterIndex,BOOL Enabled);

Parameters

Channel
[in] Specifies channel index. Possible values are: 0, 1.
NotchFilterIndex
[in] Specifies notch filter index. Possible values are: 0, 1.
Enabled
[in] Specifies whether to enable or disable notch filter. If this parameter is non-zero, the filter is enabled. If the parameter is zero, the filter is disabled.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

Use the IG39DDCDevice::GetNotchFilter method to determine whether the filter is enabled or disabled.

IG39DDCDevice::GetNotchFilter

Retrieves current notch filter state for given channel.

C/C++ declaration

BOOL __stdcall GetNotchFilter(UINT32 Channel,UINT32 NotchFilterIndex,BOOL *Enabled);

Parameters

Channel
[in] Specifies channel index. Possible values are: 0, 1.
NotchFilterIndex
[in] Specifies notch filter index. Possible values are: 0, 1.
Enabled
[out] Pointer to a variable that receives current state of the notch filter. The value is non-zero if the filter is enabled and zero if it is disabled. This parameter cannot be NULL.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

IG39DDCDevice::SetNotchFilterFrequency

Specifies relative center frequency of the notch filter for given channel.

C/C++ declaration

BOOL __stdcall SetNotchFilterFrequency(UINT32 Channel,UINT32 NotchFilterIndex,INT32 Frequency);

Parameters

Channel
[in] Specifies channel index. Possible values are: 0, 1.
NotchFilterIndex
[in] Specifies notch filter index. Possible values are: 0, 1.
Frequency
[in] Specifies new center frequency of the notch filter in Hz.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

Value of the Frequency parameter is new center frequency of the notch filter relative to center of the DDC2 (see the IG39DDCDevice::SetDDC2Frequency method). The value can be negative.

Use the IG39DDCDevice::GetNotchFilterFrequency method to retrieve current center frequency of the notch filter.


IG39DDCDevice::GetNotchFilterFrequency

Retrieves current relative center frequency of the notch filter.

C/C++ declaration

BOOL __stdcall GetNotchFilterFrequency(UINT32 Channel,UINT32 NotchFilterIndex,INT32 *Frequency);

Parameters

Channel
[in] Specifies channel index. Possible values are: 0, 1.
NotchFilterIndex
[in] Specifies notch filter index. Possible values are: 0, 1.
Frequency
[out] Pointer to a variable that receives current center frequency of the notch filter. This parameter cannot be NULL.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

IG39DDCDevice::SetNotchFilterBandwidth

Specifies bandwidth of the notch filter for given channel.

C/C++ declaration

BOOL __stdcall SetNotchFilterBandwidth(UINT32 Channel,UINT32 NotchFilterIndex,UINT32 Bandwidth);

Parameters

Channel
[in] Specifies channel index. Possible values are: 0, 1.
NotchFilterIndex
[in] Specifies notch filter index. Possible values are: 0, 1.
Bandwidth
[in] Specifies new bandwidth of the notch filter in Hz. The bandwidth can be from range 1 - 3000 Hz.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

Use the IG39DDCDevice::GetNotchFilterBandwidth method to retrieve current bandwidth of the notch filter.


IG39DDCDevice::GetNotchFilterBandwidth

Retrieves current bandwidth of the notch filter for given channel.

C/C++ declaration

BOOL __stdcall GetNotchFilterBandwidth(UINT32 Channel,UINT32 NotchFilterIndex,UINT32 *Bandwidth);

Parameters

Channel
[in] Specifies channel index. Possible values are: 0, 1.
NotchFilterIndex
[in] Specifies notch filter index. Possible values are: 0, 1.
Bandwidth
[out] Pointer to a variable that receives current bandwidth of the notch filter. This parameter cannot be NULL.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

IG39DDCDevice::SetNotchFilterLength

Specifies notch filter length for given channel. The notch filter is implemented as FIR filter. This method specifies number of coefficients used in filtration procedure.

C/C++ declaration

BOOL __stdcall SetNotchFilterLength(UINT32 Channel,UINT32 NotchFilterIndex,UINT32 Length);

Parameters

Channel
[in] Specifies channel index. Possible values are: 0, 1.
NotchFilterIndex
[in] Specifies notch filter index. Possible values are: 0, 1.
Length
[in] Specifies length of the notch filter. The value has to be multiple of 64, greater than or equal to 64 and less than or equal to 32768. If it is not multiple of 64 the function rounds it up to nearest multiple of 64.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

Increasing the filter length increases filter steepness and it may increase CPU usage.

Use the IG39DDCDevice::GetNotchFilterLength function to determine current length of the notch filter.


IG39DDCDevice::GetNotchFilterLength

Retrieves current notch filter length for given channel.

C/C++ declaration

BOOL __stdcall GetNotchFilterLength(UINT32 Channel,UINT32 NotchFilterIndex,UINT32 *Length);

Parameters

Channel
[in] Specifies channel index. Possible values are: 0, 1.
NotchFilterIndex
[in] Specifies notch filter index. Possible values are: 0, 1.
Length
[out] Pointer to a variable that receives current length of the notch filter. This parameter cannot be NULL.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

IG39DDCDevice::SetAGC

Enables or disables AGC for given channel.

C/C++ declaration

BOOL __stdcall SetAGC(UINT32 Channel,BOOL Enabled);

Parameters

Channel
[in] Specifies channel index. Possible values are: 0, 1.
Enabled
[in] Specifies whether to enable or disable AGC. If this parameter is non-zero, the AGC is enabled. If the parameter is zero, the AGC is disabled.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

If the AGC is disabled, the signal is affected by fixed gain specified using the IG39DDCDevice::SetGain method.

Use the IG39DDCDevice::GetAGC method to determine current state of the AGC.


IG39DDCDevice::GetAGC

Retrieves current state of the AGC for given channel.

C/C++ declaration

BOOL __stdcall GetAGC(UINT32 Channel,BOOL *Enabled);

Parameters

Channel
[in] Specifies channel index. Possible values are: 0, 1.
Enabled
[out] Pointer to a variable that receives current state of the AGC. The value is non-zero if the AGC is enabled and zero if it is disabled. This parameter cannot be NULL.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

IG39DDCDevice::SetAGCParams

Sets parameters of the AGC for given channel.

C/C++ declaration

BOOL __stdcall SetAGCParams(UINT32 Channel,double AttackTime,double DecayTime,double ReferenceLevel);

Parameters

Channel
[in] Specifies channel index. Possible values are: 0, 1.
AttackTime
[in] Specifies new attack time of the AGC in seconds.
DecayTime
[in] Specifies new decay time of the AGC in seconds.
ReferenceLevel
[in] Specifies new reference level of the AGC in dB.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

Use the IG39DDCDevice::GetAGCParams method to determine current parameters of the AGC.


IG39DDCDevice::GetAGCParams

Retrieves current parameters of the AGC for given channel.

C/C++ declaration

BOOL __stdcall GetAGCParams(UINT32 Channel,double *AttackTime,double *DecayTime,double *ReferenceLevel);

Parameters

Channel
[in] Specifies channel index. Possible values are: 0, 1.
AttackTime
[out] Pointer to a variable that receives current attack time of the AGC in seconds. This parameter can be NULL if the application does not require this information.
DecayTime
[out] Pointer to a variable that receives current decay time of the AGC in seconds. This parameter can be NULL if the application does not require this information.
ReferenceLevel
[out] Pointer to a variable that receives current reference level of the AGC in dB. This parameter can be NULL if the application does not require this information.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

IG39DDCDevice::SetMaxAGCGain

Sets maximum gain of the AGC for given channel.

C/C++ declaration

BOOL __stdcall SetMaxAGCGain(UINT32 Channel,double MaxGain);

Parameters

Channel
[in] Specifies channel index. Possible values are: 0, 1.
MaxGain
[in] Specifies new maximum gain of the AGC in dB.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

Use the IG39DDCDevice::GetMaxAGCGain method to determine maximum gain of the AGC.


IG39DDCDevice::GetMaxAGCGain

Retrieves current maximum gain of the AGC for given channel.

C/C++ declaration

BOOL __stdcall GetMaxAGCGain(UINT32 Channel,double *MaxGain);

Parameters

Channel
[in] Specifies channel index. Possible values are: 0, 1.
MaxGain
[out] Pointer to a variable that receives current maximum gain of the AGC in dB. This parameter cannot be NULL.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

IG39DDCDevice::SetGain

Sets fixed gain for given channel. This gain is applied to I/Q signal if the AGC is disabled, otherwise it is not used.

C/C++ declaration

BOOL __stdcall SetGain(UINT32 Channel,double Gain);

Parameters

Channel
[in] Specifies channel index. Possible values are: 0, 1.
Gain
[in] Specifies new fixed gain in dB.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

Use the IG39DDCDevice::GetGain function to determine current fixed gain.


IG39DDCDevice::GetGain

Retrieves current fixed gain for given channel.

C/C++ declaration

BOOL __stdcall GetGain(UINT32 Channel,double *Gain);

Parameters

Channel
[in] Specifies channel index. Possible values are: 0, 1.
Gain
[out] Pointer to a variable that receives current fixed gain in dB. This parameter cannot be NULL.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

IG39DDCDevice::GetCurrentGain

Retrieves current gain that is applied to I/Q signal.

C/C++ declaration

BOOL __stdcall GetCurrentGain(UINT32 Channel,double *CurrentGain);

Parameters

Channel
[in] Specifies channel index. Possible values are: 0, 1.
CurrentGain
[out] Pointer to a variable that receives current gain in dB. This parameter cannot be NULL.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

If the AGC is enabled (using the IG39DDCDevice::SetAGC method), the variable pointed to by the CurrentGain parameter is filled by current gain of the AGC. If the AGC is disabled, the variable pointed to by the CurrentGain parameter is filled by fixed gain that is specified using the IG39DDCDevice::SetGain method.

IG39DDCDevice::SetDemodulatorFilterBandwidth

Sets bandwidth of the demodulator filter for given channel.

C/C++ declaration

BOOL __stdcall SetDemodulatorFilterBandwidth(UINT32 Channel,UINT32 Bandwidth);

Parameters

Channel
[in] Specifies channel index. Possible values are: 0, 1.
Bandwidth
[in] Specified new bandwidth of the demodulator filter in Hz. Possible values are from range 1 Hz to current DDC2 bandwidth. Use the IG39DDCDevice::GetDDC2 and IG39DDCDevice::GetDDCInfo methods to retrieve information about current DDC type of DDC2.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

The demodulator filter bandwidth can be changed using the IG39DDCDevice::SetDDC1 method. It can change DDC type of DDC2 and if the current demodulator filter bandwidth is greater than new bandwidth of DDC2, the demodulator filter bandwidth is reduced. So it is useful to call the IG39DDCDevice::GetDemodulatorFilterBandwidth method immediately after IG39DDCDevice::SetDDC1 and IG39DDCDevice::SetDDC2 methods.

IG39DDCDevice::GetDemodulatorFilterBandwidth

Retrieves current demodulator filter bandwidth for given channel.

C/C++ declaration

BOOL __stdcall GetDemodulatorFilterBandwidth(UINT32 Channel,UINT32 *Bandwidth);

Parameters

Channel
[in] Specifies channel index. Possible values are: 0, 1.
Bandwidth
[out] Pointer to a variable that receives current demodulator filter bandwidth. This parameter cannot be NULL.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

IG39DDCDevice::SetDemodulatorFilterShift

Sets demodulator filter shift for given channel.

C/C++ declaration

BOOL __stdcall SetDemodulatorFilterShift(UINT32 Channel,INT32 Shift);

Parameters

Channel
[in] Specifies channel index. Possible values are: 0, 1.
Shift
[in] Specified new shift of the demodulator filter in Hz.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

Value of the Shift parameter is shift in Hz relative to center of the demodulator. This value can be negative.

This function does not change demodulator frequency just shift the filter from demodulator's centre.

Use the IG39DDCDevice::GetDemodulatorFilterShift method to determine current demodulator filter shift.


IG39DDCDevice::GetDemodulatorFilterShift

Retrieves current shift of the demodulator filter for given channel.

C/C++ declaration

BOOL __stdcall GetDemodulatorFilterShift(UINT32 Channel,INT32 *Shift);

Parameters

Channel
[in] Specifies channel index. Possible values are: 0, 1.
Shift
[out] Pointer to a variable that receives current shift of the demodulator. This parameter cannot be NULL.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

IG39DDCDevice::SetDemodulatorFilterLength

Specifies demodulator filter length for given channel. The demodulator filter is implemented as FIR filter. This method specifies number of coefficients used in filtration procedure..

C/C++ declaration

BOOL __stdcall SetDemodulatorFilterLength(UINT32 Channel,UINT32 Length);

Parameters

Channel
[in] Specifies channel index. Possible values are: 0, 1.
Length
[in] Specifies length of the demodulator filter. The value has to be multiple of 64, greater than or equal to 64 and less than or equal to 32768. If it is not multiple of 64 the method rounds it up to nearest multiple of 64..

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

Increasing the filter length increases filter steepness and it may increase CPU usage.

Use the IG39DDCDevice::GetDemodulatorFilterLength function to determine current length of the demodulator filter.


IG39DDCDevice::GetDemodulatorFilterLength

Retrieves current length of the demodulator filter for given channel.

C/C++ declaration

BOOL __stdcall GetDemodulatorFilterLength(UINT32 Channel,UINT32 *Length);

Parameters

Channel
[in] Specifies channel index. Possible values are: 0, 1.
Length
[out] Pointer to a variable that receives current demodulator filter length. This parameter cannot be NULL.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

IG39DDCDevice::SetDemodulatorMode

Sets demodulator mode for given channel.

C/C++ declaration

BOOL __stdcall SetDemodulatorMode(UINT32 Channel,UINT32 Mode);

Parameters

Channel
[in] Specifies channel index. Possible values are: 0, 1.
Mode
[in] Specifies new demodulator mode. This value can be one of the following:

ValueMeaning
G39DDC_MODE_CWContinuous wave
G39DDC_MODE_AMAmplitude modulation
G39DDC_MODE_FMFrequency modulation
G39DDC_MODE_FMWWide-band frequency modulation.
G39DDC_MODE_LSBLower sideband modulation
G39DDC_MODE_USBUpper sideband modulation
G39DDC_MODE_AMSAmplitude modulation
G39DDC_MODE_DSBDouble sideband modulation
G39DDC_MODE_ISBIndependent sideband modulation
G39DDC_MODE_DRMDigital Radio Mondiale

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

DRM demodulation is only available if valid DRM key is loaded using the IG39DDCDevice::SetDRMKey method. More information about obtaining DRM key at http://www.winradio.com/home/drm.htm.

Different between FM and FMW modes is the FMW demodulator does stereo decoding and it is suitable for FM broadcasting. FMW mode is available only if DDC type index of DDC2 is 7 (bandwidth = 100 kHz, sample rate = 125 kHz) or above. IG39DDCDevice::SetDemodulatorMode fails trying to set FMW mode if DDC type index of DDC2 is less than 7. If current demodulator mode is FMW and DDC type index of DDC2 is changed to value below 7 (using IG39DDCDevice::SetDDC2 or IG39DDCDevice::SetDDC1 method), the mode is changed to FM.

Use the IG39DDCDevice::GetDemodulatorMode method to retrieve current demodulator mode.


IG39DDCDevice::GetDemodulatorMode

Retrieves current demodulator mode for given channel.

C/C++ declaration

BOOL __stdcall GetDemodulatorMode(UINT32 Channel,UINT32 *Mode);

Parameters

Channel
[in] Specifies channel index. Possible values are: 0, 1.
Mode
[out] Pointer to a variable that receives current demodulator mode. This parameter cannot be NULL.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

IG39DDCDevice::SetDemodulatorFrequency

Sets relative center frequency of demodulator for given channel.

C/C++ declaration

BOOL __stdcall SetDemodulatorFrequency(UINT32 Channel,INT32 Frequency);

Parameters

Channel
[in] Specifies channel index. Possible values are: 0, 1.
Frequency
[in] Specified new center frequency of the demodulator in Hz.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

Value of the Frequency parameter is center frequency of the demodulator relative to center of the DDC2. The value can be negative.

Absolute frequency of the demodulator is given by the following formula:

faDEM[i] = fFE + frDDC1[i] + frDDC2[i] + frDEM[i]

Where faDEM[i] is absolute center frequency of the demodulator of i-th channel in Hz, fFE is front-end frequency (see IG39DDCDevice::SetFrontEndFrequency), frDDC1[i] is relative center frequency of the DDC1 in Hz (set using the IG39DDCDevice::SetDDC1Frequency method), frDDC2[i] is relative center frequency of DDC2 of i-th channel in Hz (set using the IG39DDCDevice::SetDDC2Frequency) and frDEM[i] is relative center frequency of the demodulator of i-th channel in Hz (set using SetDemodulatorFrequency).

Absolute center frequency of the demodulator is the real-world frequency that you are listening to.

Use the IG39DDCDevice::GetDemodulatorFrequency method to determine current relative center frequency of the demodulator for given channel.

The following example shows four methods how it is possible to set absolute demodulator center frequency of channel 0 to 11.01 MHz:


IG39DDCDevice *Device; //Interface of the G39DDC device object, created using CreateInstance function



//1. method

Device->SetFrontEndFrequency(10000000);

Device->SetDDC1Frequency(0,1010000);

Device->SetDDC2Frequency(0,0);

Device->SetDemodulatorFrequency(0,0);



//2. method

Device->SetFrontEndFrequency(10000000);

Device->SetDDC1Frequency(0,1000000);

Device->SetDDC2Frequency(0,10000);

Device->SetDemodulatorFrequency(0,0);



//3. method

Device->SetFrontEndFrequency(10000000);

Device->SetDDC1Frequency(0,1000000);

Device->SetDDC2Frequency(0,20000);

Device->SetDemodulatorFrequency(0,-10000);



//4. method

Device->SetFrequency(11010000);


IG39DDCDevice::GetDemodulatorFrequency

Retrieves current relative center frequency of the demodulator for given channel.

C/C++ declaration

BOOL __stdcall GetDemodulatorFrequency(UINT32 Channel,INT32 *Frequency);

Parameters

Channel
[in] Specifies channel index. Possible values are: 0, 1.
Frequency
[out] Pointer to a variable that receives current center frequency of the demodulator. This parameter cannot be NULL.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

IG39DDCDevice::SetDemodulatorParam

Sets a parameter of the demodulation for given channel.

C/C++ declaration

BOOL __stdcall SetDemodulatorParam(UINT32 Channel,UINT32 Code,CONST VOID *Buffer,UINT32 BufferSize);

Parameters

Channel
[in] Specifies channel index. Possible values are: 0, 1.
Code
[in] Specifies code of the demodulator parameter to be set by the function. The code can be one of the following:

ValueMeaning
G39DDC_DEMODULATOR_PARAM_AMS_SIDE_BAND

Side band for synchronous AM demodulation.

The Buffer parameter has to be pointer to an UINT32 variable, and the BufferSize parameter has to be sizeof(UINT32).

Value of the variable pointed to by the Buffer parameter can be one of the following:

G39DDC_SIDE_BAND_LOWER
AMS demodulator will use lower sideband

G39DDC_SIDE_BAND_UPPER
AMS demodulator will use upper sideband

G39DDC_SIDE_BAND_BOTH
AMS demodulator will use both side bands.

G39DDC_DEMODULATOR_PARAM_AMS_CAPTURE_RANGE

Capture range of synchronous AM demodulator.

The Buffer parameter has to be pointer to a G39DDC_AMS_CAPTURE_RANGE structure, and the BufferSize parameter has to be sizeof(G39DDC_AMS_CAPTURE_RANGE).

G39DDC_DEMODULATOR_PARAM_CW_FREQUENCY

CW tone frequency

The Buffer parameter has to be pointer to a INT32 variable, and the BufferSize parameter has to be sizeof(INT32).

Value of the variable pointed to by the Buffer parameter is CW tone frequency in Hz.

G39DDC_DEMODULATOR_PARAM_DSB_SIDE_BAND

Side band for DSB demodulation.

The Buffer parameter has to be pointer to an UINT32 variable, and the BufferSize parameter has to be sizeof(UINT32).

Value of the variable pointed to by the Buffer parameter can be one of the following:

G39DDC_SIDE_BAND_LOWER
DSB demodulator will use lower sideband

G39DDC_SIDE_BAND_UPPER
DSB demodulator will use upper sideband

G39DDC_SIDE_BAND_BOTH
DSB demodulator will use both side bands.

G39DDC_DEMODULATOR_PARAM_ISB_SIDE_BAND

Side band for ISB demodulation.

The Buffer parameter has to be pointer to an UINT32 variable, and the BufferSize parameter has to be sizeof(UINT32).

Value of the variable pointed to by the Buffer parameter can be one of the following:

G39DDC_SIDE_BAND_LOWER
ISB demodulator will use lower sideband

G39DDC_SIDE_BAND_UPPER
ISB demodulator will use upper sideband

G39DDC_SIDE_BAND_BOTH
ISB demodulator will use both side bands.

G39DDC_DEMODULATOR_PARAM_DRM_AUDIO_SERVICE

Audio service of DRM demodulator/decoder to be listening to.

The Buffer parameter has to be pointer to an UINT32 variable, and the BufferSize parameter has to be sizeof(UINT32).

Value of the variable pointed to by the Buffer parameter is index of the audio service. Possible value are: 1, 2, 3, 4, where 1 is the first audio service, 2 is the second one, etc. Use the IG39DDCDevice::GetDemodulatorState method with G39DDC_DEMODULATOR_STATE_DRM_STATUS to retrieve information about available audio services for currently received DRM station.

G39DDC_DEMODULATOR_PARAM_DRM_MULTIMEDIA_SERVICE

Multimedia service of DRM demodulator/decoder to be decoded.

The Buffer parameter has to be pointer to an UINT32 variable, and the BufferSize parameter has to be sizeof(UINT32).

Value of the variable pointed to by the Buffer parameter is index of the multimedia service. Possible value are: 1, 2, 3, 4, where 1 is the first multimedia service, 2 is the second one, etc. Use the IG39DDCDevice::GetDemodulatorState method with G39DDC_DEMODULATOR_STATE_DRM_STATUS to retrieve information about available multimedia services for currently received DRM station.

It is required that DRM multimedia player has to be installed to display multimedia content. It is included in G39DDC software installer as optional.

G39DDC_DEMODULATOR_PARAM_FMW_STEREO

Stereo switch of FMW demodulator

The Buffer parameter has to be pointer to a BOOL variable, and the BufferSize parameter has to be sizeof(BOOL).

Value of the variable pointed to by the Buffer parameter is non-zero to enable stereo decoder, zero to disable stereo decoder.

G39DDC_DEMODULATOR_PARAM_FMW_DEEMPHASIS

De-emphasis (FMW demodulator)

The Buffer parameter has to be pointer to a UINT32 variable, and the BufferSize parameter has to be sizeof(UINT32).

Value of the variable pointed to by the Buffer parameter is de-emphasis at demodulator audio output in µs. In North America it is 75 µs, while most of the rest of the world uses 50 µs. If it is zero, the de-emphasis is disabled.

Buffer
[in] Pointer to a buffer containing value of the demodulator parameter the function will set. This parameter cannot be NULL.
BufferSize
[in] Specifies the size of the buffer.

Return value

If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

IG39DDCDevice::GetDemodulatorParam

Retrieves a parameter of the demodulation for given channel.

C/C++ declaration

BOOL __stdcall GetDemodulatorParam(UINT32 Channel,UINT32 Code,VOID *Buffer,UINT32 BufferSize);

Parameters

Channel
[in] Specifies channel index. Possible values are: 0, 1.
Code
[in] Specifies code of the demodulator parameter to be retrieved. For detailed information about available codes see IG39DDCDevice::SetDemodulatorParam.
Buffer
[out] Pointer to a buffer that receives requested parameter. This parameter cannot be NULL.
BufferSize
[in] Specifies the size of the buffer.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

IG39DDCDevice::GetDemodulatorState

Retrieves information about current demodulator state for given channel.

C/C++ declaration

BOOL __stdcall GetDemodulatorState(UINT32 Channel,UINT32 Code,VOID *Buffer,UINT32 BufferSize);

Parameters

Channel
[in] Specifies channel index. Possible values are: 0, 1.
Code
[in] Specifies code of the demodulator state to be retrieved. It can be one of the following:

ValueMeaning
G39DDC_DEMODULATOR_STATE_AMS_LOCK

Lock state of synchronous AM demodulation.

The Buffer parameter has to be pointer to a BOOL variable, and the BufferSize parameter has to be sizeof(BOOL).

Received value is non-zero if synchronous AM demodulator is locked to signal, and zero if it is not locked.

G39DDC_DEMODULATOR_STATE_AMS_FREQUENCY

Frequency in Hz which synchronous AM demodulator is locked to. It is relative to center of the demodulator. It can be negative.

The Buffer parameter has to be pointer to a double variable, and the BufferSize parameter has to be sizeof(double).

G39DDC_DEMODULATOR_STATE_AM_DEPTH

Depth of AM modulation in %.

The Buffer parameter has to be pointer to a double variable, and the BufferSize parameter has to be sizeof(double).

G39DDC_DEMODULATOR_STATE_DSB_LOCK

Lock state of DSB demodulation.

The Buffer parameter has to be pointer to a BOOL variable, and the BufferSize parameter has to be sizeof(BOOL).

Received value is non-zero if DSB demodulator is locked to signal, and zero if it is not locked.

G39DDC_DEMODULATOR_STATE_DSB_FREQUENCY

Frequency in Hz which DSB demodulator is locked to. It is relative to center of the demodulator. It can be negative.

The Buffer parameter has to be pointer to a double variable, and the BufferSize parameter has to be sizeof(double).

G39DDC_DEMODULATOR_STATE_TUNE_ERROR

Estimated tune error in Hz.

The Buffer parameter has to be pointer to an INT32 variable, and the BufferSize parameter has to be sizeof(INT32).

Received value is difference between demodulator frequency and frequency of received signal. Subtract the returned tune error from demodulator frequency to get frequency of the received signal. Tune error is relative to center of the demodulator and it can be negative.

G39DDC_DEMODULATOR_STATE_DRM_STATUS

Status of DRM demodulator/decoder.

The Buffer parameter has to be pointer to a G39DDC_DRM_STATUS structure, and the BufferSize parameter has to be sizeof(G39DDC_DRM_STATUS).

G39DDC_DEMODULATOR_STATE_FM_DEVIATION

Estimated frequency deviation in Hz.

The Buffer parameter has to be pointer to an UINT32 variable, and the BufferSize parameter has to be sizeof(UINT32).

G39DDC_DEMODULATOR_STATE_FMW_STEREO

State of FMW stereo decoder.

The Buffer parameter has to be pointer to a BOOL variable, and the BufferSize parameter has to be sizeof(BOOL).

Received value is non-zero if received signal is stereo (stereo pilot detected), and zero if it is not stereo (stereo pilot is not detected).

Buffer
[out] Pointer to a buffer that receives requested information. This parameter cannot be NULL.
BufferSize
[in] Specifies the size of the buffer.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

IG39DDCDevice::GetAudioSampleRateCount

Retrieves number of audio sample rates supported by the G39DDC.

C/C++ declaration

BOOL __stdcall GetAudioSampleRateCount(UINT32 *Count);

Parameters

Count
[out] Pointer to a variable that receives number of audio sample rates supported by the G39DDC. This parameter cannot be NULL.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

IG39DDCDevice::GetAudioSampleRate

Retrieves audio sample rate by its index.

C/C++ declaration

BOOL __stdcall GetAudioSampleRate(UINT32 Index,UINT32 *SampleRate);

Parameters

Index
[in] Specifies audio sample rate index. This value can vary from 0 to value retrieved by the IG39DDCDevice::GetAudioSampleRateCount - 1.
SampleRate
[out] Pointer to a variable that receives audio sample rate. This parameter cannot be NULL.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

IG39DDCDevice::SetAudio

Sets output audio sample rate.

C/C++ declaration

BOOL __stdcall SetAudio(UINT32 Channel,UINT32 Index);

Parameters

Channel
[in] Specifies channel index. Possible values are: 0, 1.
Index
[in] Specifies audio sample rate index.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

Use the IG39DDCDevice::GetAudioSampleRateCount method to determine the number of possible audio sample rates. The DDCTypeIndex parameter can vary from zero to one less than the number determined by IG39DDCDevice::GetAudioSampleRateCount.

Audio streaming must not run when calling IG39DDCDevice::SetAudio. In other words, audio streaming that is started using the IG39DDCDevice::StartAudio method has to be stopped using the IG39DDCDevice::StopAudio method before calling of IG39DDCDevice::SetAudio, otherwise IG39DDCDevice::SetAudio fails. The IG39DDCDevice::SetAudio method does not start and stop audio streaming, just changes current audio sample rate.

Use the IG39DDCDevice::GetAudio function to determine current audio sample rate index and use the IG39DDCDevice::GetAudioSampleRate to convert the index to sample rate.


IG39DDCDevice::GetAudio

Retrieves audio sample rate index.

C/C++ declaration

BOOL __stdcall GetAudio(UINT32 Channel,UINT32 *SampleRateIndex);

Parameters

Channel
[in] Specifies channel index. Possible values are: 0, 1.
SampleRate
[out] Pointer to a variable that receives current audio sample rate index. This parameter cannot be NULL. Use IG39DDCDevice::GetAudioSampleRate method to convert the index to sample rate.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

IG39DDCDevice::StartAudio

Starts audio streaming for given channel.

C/C++ declaration

BOOL __stdcall StartAudio(UINT32 Channel,UINT32 SamplesPerBuffer);

Parameters

Channel
[in] Specifies channel index. Possible values are: 0, 1.
SamplesPerBuffer
[in] Specifies number of samples in each buffer passed to the the IG39DDCDeviceCallback::G39DDC_AudioStreamCallback callback. The value has to be multiple of 64 greater than zero. If it is zero, the IG39DDCDevice::StartAudio method fails. If it is not multiple of 64 the function rounds it up to nearest multiple of 64.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

Before IG39DDCDevice::StartAudio is used, the G39DDC device has to be turned on using the IG39DDCDevice::SetPower method, DDC1 streaming has to be started using the IG39DDCDevice::StartDDC1 or IG39DDCDevice::StartDDC1Playback method and DDC2 streaming has to be started using the IG39DDCDevice::StartDDC2 method, otherwise IG39DDCDevice::StartAudio fails.

If the audio streaming for given channel is already running, IG39DDCDevice::StartAudio restarts it except the streaming was previously started with the same SamplesPerBuffer parameter. In this case StartAudio does nothing.

Use the IG39DDCDevice::StopAudio method to stop audio streaming.

Decreasing value of the SamplesPerBuffer parameter decreases latency and it may increase CPU usage. Increasing value of the SamplesPerBuffer parameter increased latency and it may decrease CPU usage.


IG39DDCDevice::StopAudio

Stops audio streaming for given channel.

C/C++ declaration

BOOL __stdcall StopAudio(UINT32 Channel);

Parameters

Channel
[in] Specifies channel index. Possible values are: 0, 1.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

If audio streaming is not active, IG39DDCDevice::StopAudio does nothing.

If audio playback (started using the IG39DDCDevice::StartAudioPlayback method) is active, IG39DDCDevice::StopAudio stops it.

The IG39DDCDeviceCallback::G39DDC_AudioStreamCallback and IG39DDCDeviceCallback::G39DDC_AudioPlaybackStreamCallback callbacks are not called after IG39DDCDevice::StopAudio returns.


IG39DDCDevice::StartAudioPlayback

Starts audio playback for given channel. It allows to pass previously recorded audio samples to the processing chain instead of the samples from the demodulator.

C/C++ declaration

BOOL __stdcall StartAudioPlayback(UINT32 Channel,UINT32 SamplesPerBuffer);

Parameters

Channel
[in] Specifies channel index. Possible values are: 0, 1.
SamplesPerBuffer
[in] Specifies number of samples in each buffer passed to the IG39DDCDeviceCallback::G39DDC_AudioPlaybackStreamCallback callback to fill the buffer by the application and to the IG39DDCDeviceCallback::G39DDC_AudioStreamCallback callback function. The value has to be multiple of 64 greater than zero. If it is zero, the IG39DDCDevice::StartAudioPlayback method fails. If it is not multiple of 64 the function rounds it up to nearest multiple of 64.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

The G39DDC device has to be turned on using IG39DDCDevice::SetPower method before use of IG39DDCDevice::StartAudioPlayback.

The IG39DDCDevice::StartAudioPlayback method stops audio streaming that was previously started by the IG39DDCDevice::StartAudio or IG39DDCDevice::StartAudioPlayback method and starts audio playback with new parameters.

Use the IG39DDCDevice::StopAudio method to stop audio playback.


IG39DDCDevice::PauseAudioPlayback

Pauses audio playback for given channel.

C/C++ declaration

BOOL __stdcall PauseAudioPlayback(UINT23 Channel);

Parameters

Channel
[in] Specifies channel index. Possible values are: 0, 1.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

If audio playback is not active or it is already paused, IG39DDCDevice::PauseAudioPlayback does nothing.

The IG39DDCDeviceCallback::G39DDC_AudioPlaybackStreamCallback and IG39DDCDeviceCallback::G39DDC_AudioStreamCallback callbacks can be called once after IG39DDCDevice::PauseAudioPlayback returns. Then they are not called until playback is resumed using the IG39DDCDevice::ResumeAudioPlayback method.


IG39DDCDevice::ResumeAudioPlayback

Resumes paused audio playback for given channel.

C/C++ declaration

BOOL __stdcall ResumeAudioPlayback(UINT32 Channel);

Parameters

Channel
[in] Specifies channel index. Possible values are: 0, 1.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

If audio playback is not active or it is not paused, IG39DDCDevice::ResumeAudioPlayback does nothing.


IG39DDCDevice::SetAudioGain

Sets fixed audio gain for given channel.

C/C++ declaration

BOOL __stdcall SetAudioGain(UINT32 Channel,double Gain);

Parameters

Channel
[in] Specifies channel index. Possible values are: 0, 1.
Gain
[in] Specifies new fixed audio gain in dB.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

If the G39DDC receiver has audio output connector (optional), the IG39DDCDevice::SetAudioGain function affects the audio signal level at this output (see also IG39DDCDevice::SetDAC).

Use the IG39DDCDevice::GetAudioGain method to retrieve current audio gain.


IG39DDCDevice::GetAudioGain

Retrieves current fixed audio gain for given channel.

C/C++ declaration

BOOL __stdcall GetAudioGain(UINT32 Channel,double *Gain);

Parameters

Channel
[in] Specifies channel index. Possible values are: 0, 1.
Gain
[out] Pointer to a variable that receives current fixed gain in dB. This parameter cannot be NULL.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

IG39DDCDevice::SetAudioFilter

Enabled or disables audio filter for given channel.

C/C++ declaration

BOOL __stdcall SetAudioFilter(UINT32 Channel,BOOL Enabled);

Parameters

Channel
[in] Specifies channel index. Possible values are: 0, 1.
Enabled
[in] Specifies whether to enable or disable audio filter. If this parameter is non-zero, the filter is enabled. If the parameter is zero, the filter is disabled.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

Use the IG39DDCDevice::GetAudioFiler method to retrieve current state of the audio filter.


IG39DDCDevice::GetAudioFilter

Retrieves current state of the audio filter for given channel.

C/C++ declaration

BOOL __stdcall GetAudioFilter(UINT32 Channel,BOOL *Enabled);

Parameters

Channel
[in] Specifies channel index. Possible values are: 0, 1.
Enabled
[out] Pointer to a variable that receives current state of the audio filter. The value is non-zero if the filter is enabled and zero if it is disabled. This parameter cannot be NULL.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

IG39DDCDevice::SetAudioFilterParams

Sets parameters of the audio filter for given channel.

C/C++ declaration

BOOL __stdcall SetAudioFilterParams(UINT32 Channel,UINT32 CutOffLow,UINT32 CutOffHigh,double Deemphasis);

Parameters

Channel
[in] Specifies channel index. Possible values are: 0, 1.
CutOffLow
[in] Specifies cut-off low frequency of the filter in Hz. This is the start frequency of filter's passband, it can be from range 0 to 23999 Hz. The value has to be less then the cut-off high frequency specified by the CutOffHigh parameter.
CutOffHigh
[in] Specifies cut-off high frequency of the filter in Hz. This is the end frequency of filter's passband it can be from range 1 - 24000 Hz. The value has to be greater than the cut-off low frequency specified by the CutOffLow parameter.
Deemphasis
[in] Specifies de-emphasis the filter in dB per octave. De-emphasis starts at cut-off low frequency of the filter. This value can be from range -9.9 to 0.0 dB/octave. Zero means the de-emphasis is disabled.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

Use the IG39DDCDevice::GetAudioFilerParams method to retrieve current parameters of the audio filter.

IG39DDCDevice::GetAudioFilterParams

Retrieves current parameters of the audio filter for given channel.

C/C++ declaration

BOOL __stdcall GetAudioFilterParams(UINT32 Channel,UINT32 *CutOffLow,UINT32 *CutOffHigh,double *Deemphasis);

Parameters

Channel
[in] Specifies channel index. Possible values are: 0, 1.
CutOffLow
[out] Pointer to a variable that receives current cut-off low frequency of the filter. This parameter can be NULL if the application does not require this information.
CutOffHigh
[out] Pointer to a variable that receives current cut-off high frequency of the filter. This parameter can be NULL if the application does not require this information.
Deemphasis
[out] Pointer to a variable that receives current de-emphasis setting of the filter. This parameter can be NULL if the application does not require this information.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

IG39DDCDevice::SetAudioFilterLength

Specifies audio filter length for given channel. The audio filter is implemented as FIR filter. This method specifies number of coefficients used in filtration procedure.

C/C++ declaration

BOOL __stdcall SetAudioFilterLength(UINT32 Channel,UINT32 Length);

Parameters

Channel
[in] Specifies channel index. Possible values are: 0, 1.
Length
[in] Specifies length of the audio filter. The value has to be multiple of 64, greater than or equal to 64 and less than or equal to 32768. If it is not multiple of 64 the method rounds it up to nearest multiple of 64.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

Increasing the filter length increases filter steepness and it may increase CPU usage.

Use the IG39DDCDevice::GetAudioFilterLength method to determine current length of the audio filter.


IG39DDCDevice::GetAudioFilterLength

Retrieves current audio filter length for given channel.

C/C++ declaration

BOOL __stdcall GetAudioFilterLength(UINT32 Channel,UINT32 *Length);

Parameters

Channel
[in] Specifies channel index. Possible values are: 0, 1.
Length
[out] Pointer to a variable that receives current length of the audio filter. This parameter cannot be NULL.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

IG39DDCDevice::SetVolume

Sets audio volume for given channel.

C/C++ declaration

BOOL __stdcall SetVolume(UINT32 Channel,BYTE Volume);

Parameters

Channel
[in] Specifies channel index. Possible values are: 0, 1.
Volume
[in] Specifies new volume. The value can vary from 0 to 31, where 31 means maximum volume.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

If the G39DDC receiver has audio output connector (optional), the IG39DDCDevice::SetVolume method affects the audio signal level at this output (see also IG39DDCDevice::SetDAC).

Use the IG39DDCDevice::GetVolume method to retrieve current volume.


IG39DDCDevice::GetVolume

Retrieve current volume for given channel.

C/C++ declaration

BOOL __stdcall GetVolume(UINT32 Channel,BYTE *Volume);

Parameters

Channel
[in] Specifies channel index. Possible values are: 0, 1.
Volume
[out] Pointer to a variable that receives current volume. This parameter cannot be NULL.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

IG39DDCDevice::SetMute

Mutes or unmutes audio.

C/C++ declaration

BOOL __stdcall SetMute(UINT32 Channel,BOOL Mute);

Parameters

Channel
[in] Specifies channel index. Possible values are: 0, 1.
Mute
[in] Specifies whether to mute or unmute audio. If this parameter is non-zero, the audio is muted. If the parameter is zero, the audio is unmuted.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

If the G39DDC receiver has audio output connector (optional), the IG39DDCDevice::SetMute method affects the audio signal at this output (see also IG39DDCDevice::SetDAC).

Use the IG39DDCDevice::GetMute method to retrieve current mute state.


IG39DDCDevice::GetMute

Retrieves current mute state for given channel.

C/C++ declaration

BOOL __stdcall GetMute(UINT32 Channel,BOOL *Mute);

Parameters

Channel
[in] Specifies channel index. Possible values are: 0, 1.
Mute
[out] Pointer to a variable that receives current mute state. This parameter cannot be NULL.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

IG39DDCDevice::SetDAC

Allows to route audio output of each channel to DAC (Digital-to-analog converter). DAC output is connected to audio output connector of the receiver.

C/C++ declaration

BOOL __stdcall SetDAC(UINT32 DAC);

Parameters

DAC
[in] Specifies which channel should be routed to the audio output connector.

BitMeaning
0If it is set, audio output of the channel 0 is routed to the audio output connector.
1If it is set, audio output of the channel 1 is routed to the audio output connector.
2 - 31Reserved. Must be zero.

If both bits (0 and 1) are set, audio outputs of both channels are mixed and routed to the audio output connector.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

The audio output connector is optional. If the receiver does not have audio output connector, SetDAC fails. The following example shows how to determine the receive has audio output connector.

    G39DDC_DEVICE_INFO DeviceInfo;

    IG39DDCDevice *Device;  //Interface of the G39DDC device object, created using CreateInstance function

    

    Device->GetDeviceInfo(&DeviceInfo,sizeof(DeviceInfo));

    

    if(DeviceInfo.HardwareOptions & G39DDC_HARDWARE_OPTIONS_AUDIO_OUTPUT)

    {

        //the receiver has audio output connector

        //route audio output of both channels to the audio output connector

        

        Device->SetDAC(0x01 | 0x02);

    }

    else

    {

        //the receiver does not have audio output connector

    }


IG39DDCDevice::GetDAC

Determines which channel (its audio output) is routed to audio output connector.

C/C++ declaration

BOOL __stdcall GetDAC(UINT32 *DAC);

Parameters

DAC
[out] Pointer to a variable that receives bitwise array which specifies which channel is routed to the audio output connector. For more information, see IG39DDCDevice::SetDAC. This parameter cannot be NULL.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

IG39DDCDevice::StartSweeping

Starts sweeping.

C/C++ declaration

BOOL __stdcall StartSweeping(UINT64 BeginFrequency,UINT64 EndFrequency,UINT64 StartFrequency,WORD SettlingTime,BOOL Forward);

Parameters

BeginFrequency
[in] Specifies the start frequency of the sweeping range in Hz.
EndFrequency
[in] Specifies the end frequency of the sweeping range in Hz.
StartFrequency
[in] Specifies the frequency to start sweeping from. It must be between (including) BeginFrequency and EndFrequency. Use the same value as for BeginFrequency to start sweeping from the beginning of the sweeping range.
SettlingTime
[in] The settling time in milliseconds. It is minimum delay time after tuning before the signal snapshot is taken.
Forward
[in] Specifies sweeping direction. If the value is non-zero, the sweeping runs in loop from the BeginFrequency to the EndFrequency. If the value is zero, the sweeping runs in loop from the EndFrequency to BeginFrequency.

Return value

If the function succeeds, the return value is non-zero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

The G39DDC device has to be turned on using the IG39DDCDevice::SetPower method before IG39DDCDevice::StartSweeping is used, otherwise IG39DDCDevice::StartSweeping fails.

DDC1 streaming (IG39DDCDevice::StartDDC1) in each channel and IF snapshots (IG39DDCDevice::StartIF) must not be running before StartSweeping is used, otherwise StartSweeping fails.

When the sweeping runs, the receiver is tuned sequentially to frequencies from range specified by the BeginFrequency and EndFrequency parameters. The tuning direction is given by the Forward parameter. Tuning step is specified by the FrontEndFrequencyStep member of the G39DDC_DEVICE_INFO structure (see IG39DDCDevice::GetDeviceInfo).

The BeginFrequency has to be less than the EndFrequency.

The BeginFrequency and EndFrequency can be between (including) values provided by the FrontEndMinFrequency and FrontEndMaxFrequency members of the G39DDC_DEVICE_INFO structure.

If value of the BeginFrequency, EndFrequency or StartFrequency is not equal to the FrontEndMinFrequency member of G39DDC_DEVICE_INFO structure, it has to be multiple of the FrontEndFrequencyStep member of G39DDC_DEVICE_INFO structure.

The IG39DDCDeviceCallback::G39DDC_SweepingCallback callback is invoked for each tuned frequency to pass the IF snapshot to the application during sweeping.

Use IG39DDCDevice::StopSweeping method to stop sweeping.


IG39DDCDevice::StopSweeping

Stops sweeping previously started using the IG39DDCDevice::StartSweeping method.

C/C++ declaration

BOOL __stdcall StopSweeping(void);

Parameters

None

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

IG39DDCDevice::GetSpectrumCompensation

Determines compensation data for frequency spectrum computed from DDC1 or DDC2 signal. It is used to convert relative amplitudes in dB to absolutes ones in dBm.

C/C++ declaration

BOOL __stdcall GetSpectrumCompensation(UINT64 FrontEndFrequency,INT32 Shift,UINT32 Bandwidth,FLOAT *Buffer,UINT32 Count);

Parameters

FrontEndFrequency
[in] Specifies front-end frequency in Hz.
Shift
[in] Specifies relative center frequency (in Hz) of the bandwidth given by the Bandwidth parameter. It is relative to front-end frequency given by the FrontEndFrequency parameter. It can be negative.
Bandwidth
[in] Specifies width of requested compensation data in Hz.
Buffer
[out] Pointer to a buffer to be filled with compensation data. This parameter cannot be NULL.
Count
[in] Specifies number of FLOAT items in the buffer pointed to by the Buffer parameter.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

The following example shows how to use the IG39DDCDevice::GetSpectrumCompensation method in IG39DDCDeviceCallback::G39DDC_DDC2StreamCallback callback:




//Let the following is prototype of a function which compute FFT from I/Q signal stored in

//the buffer pointed to be the Input parameter. Result is stored in complex form in the buffer

//pointed to by the Output parameter. Size of the FFT is given be the Size parameter.

//The example uses FFT with size 2048.

void FFT(float *Output,const float *Input,int Size);



#define FFT_SIZE 2048



IG39DDCDevice *Device; //Interface of the G39DDC device object, created using CreateInstance function

UINT64 FrontEndFrequency; //Front-end frequency

INT32 RelDDC2Frequency; //Relative frequency of the DDC2

INT32 RelDDC1Frequency; //Relative frequency of the DDC1

INT32 DDC2Shift; //Total shift of DDC2 from front-end frequency

G39DDC_DDC_INFO DDC2Info; //Information about current DDC type of the DDC2

FLOAT FFTBuffer[2*FFT_SIZE]; //Buffer for FFT result

FLOAT Compensation[FFT_SIZE]; //Buffer for compensation data

UINT32 FirstBin,LastBin; //the first and last bins in the FFT of useful DDC2 band

TMyCallbackObject MyCallbackObject; //instance of TMyCallbackObject class, which is implements from IG39DDCDeviceCallback interface



Code before...



//Retrieve front-end frequency

Device->GetFrontEndFrequency(&FrontEndFrequency);



//Retrieve relative frequency of the DDC1 for channel 0

Device->GetDDC1Frequency(0,&RelDDC1Frequency);



//Retrieve relative frequency of the DDC2 for channel 0

Device->GetDDC2Frequency(0,&RelDDC2Frequency);



//Calculate DDC2 shift

DDC2Shift=RelDDC2Frequency+RelDDC1Frequency;



//Retrieve DDC type information of the DDC2

Device->GetDDC2(NULL,&DDC2Info);



//Retrieve compensation data

Device->GetSpectrumCompensation(FrontEndFrequency,DDC2Shift,DDC2Info.SampleRate,Compensation,FFT_SIZE);

//In this case the Bandwidth parameter is equal to sample rate, because we need compensation data

//for whole DDC2 band not only for usable bandwidth.

//Compensation data have to be updated after change of absolute DDC2 frequency using

//the IG39DDCDevice::SetDDC1Frequency, IG39DDCDevice::SetDDC2Frequency or IG39DDCDevice::SetFrontEndFrequency method.

//In this case a mutual-exclusion synchronization method (for example critical section) should be used 

//if the Compensation buffer would be modified outside the TMyCallbackObject::G39DDC_DDC2StreamCallback callback.



FirstBin=FFT_SIZE*(DDC2Info.SampleRate-DDC2Info.Bandwidth)/2/DDC2Info.SampleRate;

LastBin=FFT_SIZE*(DDC2Info.SampleRate+DDC2Info.Bandwidth)/2/DDC2Info.SampleRate;



Device->SetCallback(&MyCallbackObject);



//Start DDC2 streaming for channel 0

//The SamplesPerBuffer parameter is set to FFT_SIZE which is size of the FFT to simplify

//the example.

Device->StartDDC2(0,2048);



Code after...

    

void __stdcall TMyCallbackObject::G39DDC_DDC2StreamCallback(IG39DDCDevice *Device,UINT32 Channel,CONST FLOAT *Buffer,UINT32 NumberOfSamples)

{

 UINT32 i;

 

    //Compute FFT

    FFT(FFTBuffer,Buffer,FFT_SIZE);

    

    //Converts complex FFT result to dB

    for(i=0;i<FFT_SIZE;i++)

    {

        FFTBuffer[i]=(FLOAT)(10.0*log10(FFTBuffer[i*2]*FFTBuffer[i*2]+FFTBuffer[i*2+1]*FFTBuffer[i*2+1]));

    }

    

    //Apply compensation data to get amplitudes in frequency spectrum in dBm

    for(i=0;i<FFT_SIZE;i++)

    {

        FFTBuffer[i]+=Compensation[i];

    }

    

    //now the FFTBuffer contains amplitudes in dBm

    //Useful band starts at the bin given by the FirstBin variable

    //and ends at the bin given by the LastBin variable.

}




IG39DDCDevice::GetIFSpectrumCompensation

Determines compensation data for frequency spectrum of IF snapshots provided by the IG39DDCDeviceCallback::G39DDC_IFCallback and IG39DDCDeviceCallback::G39DDC_SweepingCallback callbacks.

C/C++ declaration

BOOL __stdcall GetIFSpectrumCompensation(UINT64 FrontEndFrequency,FLOAT *Buffer,UINT32 Count);

Parameters

FrontEndFrequency
[in] Specifies front-end frequency in Hz.
Buffer
[out] Pointer to a buffer to be filled with compensation data. This parameter cannot be NULL.
Count
[in] Specifies number of FLOAT items in the buffer pointed to by the Buffer parameter.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

The following example shows how to use the IG39DDCDevice::GetIFSpectrumCompensation method in IG39DDCDeviceCallback::G39DDC_IFCallback callback:


//Let the following is prototype of a function which compute FFT from real signal stored in

//the buffer pointed to be the Input parameter. Input samples are 16 bit, signed (from -32768 to +32767). Result is stored 

//in complex form in the buffer pointed to by the Output parameter. Size of the FFT is given be 

//the Size parameter. The example uses FFT with size 8192.

void FFT(float *Output,const short *Input,int Size);



#define FFT_SIZE 8192



//half of FFT size, we will use only the lower half of the FFT result with real input

#define FFT_SIZE_2 (FFT_SIZE/2)



//ADC sample rate - 100 MHz

#define ADC_SAMPLE_RATE 100000000



IG39DDCDevice *Device; //Interface to G39DDC device object

UINT64 FrontEndFrequency; //Front-end frequency

FLOAT FFTBuffer[2*FFT_SIZE]; //Buffer for FFT result

FLOAT Compensation[FFT_SIZE_2]; //Buffer for compensation data

UINT32 FirstBin,LastBin; //the first and last bins in the FFT of useful IF band.

TMyCallbackObject MyCallbackObject; //instance of TMyCallbackObject class, which is implements from IG39DDCDeviceCallback interface

G39DDC_DEVICE_INFO DeviceInfo; //Structure which contains device information to determine useful band in the IF snapshot



Code before...



//Retrieve device information

Device->GetDeviceInfo(&DeviceInfo,sizeof(DeviceInfo));



//Retrieve front-end frequency

Device->GetFrontEndFrequency(&FrontEndFrequency);



//Retrieve compensation data. It is required the number of items to be equal to half of FFT size.

Device->GetIFSpectrumCompensation(FrontEndFrequency,Compensation,FFT_SIZE_2);

//Compensation data have to be updated after change of front-end frequency using IG39DDCDevice::SetFrontEndFrequency method.

//In this case a mutual-exclusion synchronization method (for example critical section) should be used 

//if the Compensation buffer would be modified outside the TMyCallbackObject::G39DDC_IFCallback callback.





Device->SetCallback(&MyCallbackObject);



//Start IF with snapshot period 50 ms

Device->StartIF(50);



Code after...

    

void __stdcall TMyCallbackObject::G39DDC_IFCallback(IG39DDCDevice *Device,CONST SHORT *Buffer,UINT32 NumberOfSamples,UINT32 CenterFrequency,WORD Amplitude,UINT32 ADCSampleRate)

{

 UINT32 i;

 UINT32 FirstBin,LastBin;

 

    //Compute FFT

    FFT(FFTBuffer,Buffer,FFT_SIZE);

    

    //Converts complex FFT result to dB, only for the lower half of the result, upper one is the same as lower but inverted 

    for(i=0;i<FFT_SIZE_2;i++)

    {

        FFTBuffer[i]=(FLOAT)(10.0*log10(FFTBuffer[i*2]*FFTBuffer[i*2]+FFTBuffer[i*2+1]*FFTBuffer[i*2+1]));

    }   

    

    //Apply compensation data to get amplitudes in frequency spectrum in dBm

    //We use only the lower half of the FFT result, because the upper one is the same but inverted

    for(i=0;i<FFT_SIZE_2;i++)

    {

        FFTBuffer[i]+=Compensation[i];

    }

           

    //Calculate the first and last bins of the useful band in the FFT result    

    //Center of the band is specified by the CenterFrequency parameter

    FirstBin=FFT_SIZE*(CenterFrequency-DeviceInfo.FrontEndWindowWidth/2)/ADC_SAMPLE_RATE;    

    LastBin=FFT_SIZE*(CenterFrequency+DeviceInfo.FrontEndWindowWidth/2)/ADC_SAMPLE_RATE;

   

    //now the FFTBuffer contains amplitudes in dBm

    //Useful band starts at the bin given by the FirstBin variable

    //and ends at the bin given by the LastBin variable.     

}




IG39DDCDevice::SetCallback

Registers user-defined callback object given by its interface. The API calls methods of the object to pass samples to the application. The object has to implement methods of the IG39DDCDeviceCallback interface.

C/C++ declaration

BOOL __stdcall SetCallback(IG39DDCDeviceCallback *Callback);

Parameters

Callback
[in] Interface to user-defined object to be registered as callback object. If this parameter is NULL, current callback object is unregistered, the API will not call any callback after SetCallback returns.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

IG39DDCDevice::SetDRMKey

Sets directory with DRM key file to unlock DRM demodulator/decoder.

C/C++ declaration

BOOL __stdcall SetDRMKey(CONST CHAR *DRMKeyFileDirectory);

Parameters

DRMKeyFileDirectory
[in] Pointer to a null-terminated string that specifies the directory which contains valid DRM key file.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

If the specfied directory contains valid DRM key file, the key is loaded and the DRM demodulator/decoder is unlocked and available for use, otherwise the method fails.

If the DRM demodulator/decoder is already unlocked, the method does nothing.

Use the IG39DDCDevice::IsDRMUnlocked method to determine whether DRM demodulator/decoder is unlocked or not.

Information about obtaining DRM key at http://www.winradio.com/home/drm.htm.


IG39DDCDevice::IsDRMUnlocked

Determined whether DRM demodulator/decoder is unlocked or not.

C/C++ declaration

BOOL __stdcall IsDRMUnlocked(void);

Parameters

None

Return value

If the method succeeds and the DRM demodulator/decoder is unlocked, the return value is non-zero.
If the method fails or the DRM demodulator/decoder is locked, the return value is zero. To get extended error information, call GetLastError.

IG39DDCDevice::FlushBuffers

Flushes internal buffers and FIFOs in software and hardware parts. It marks specified buffers (filled by any samples) as empty. It can be useful in a scanning engine.

C/C++ declaration

BOOL __stdcall FlushBuffers(UINT32 Channel,UINT32 Flags);

Parameters

Channel
[in] Specifies channel index. It can be 0, 1.
Flags
[in] Specifies which buffers should be flushed. The value can be combination of the following:

ValueMeaning
G39DDC_FLUSH_BUFFERS_IFBuffers which contains IF snapshots samples are flushed. In this case the Channel parameter is ignored.
G39DDC_FLUSH_BUFFERS_DDC1Buffers which contains samples from DDC1 output are flushed.
G39DDC_FLUSH_BUFFERS_DDC2Buffers which contains samples from DDC2 output are flushed.
G39DDC_FLUSH_BUFFERS_AUDIOBuffers which contains samples from audio output are flushed.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

The method is synchronous. When it is finished, specifies buffers are already flushed.

IG39DDCDevice::GetTemperature

Retrieves current internal temperature of the G39DDC device.

C/C++ declaration

BOOL __stdcall GetTemperature(UINT32 *Temperature);

Parameters

Temperature
[out] Pointer to a variable that receives current internal temperature in degrees of Celsius. This parameter cannot be NULL.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

The G39DDC device has to be turned on using the IG39DDCDevice::SetPower method before IG39DDCDevice::GetTemperature is used. Otherwise IG39DDCDevice::GetTemperature fails.


IG39DDCDevice::GetDeviceState

Retrieves current error state of the G39DDC device.

C/C++ declaration

BOOL __stdcall GetDeviceState(UINT32 *State);

Parameters

State
[out] Pointer to a variable that receives current error state of the device. This parameter cannot be NULL.

It is combination of the following values:

ValueMeaning
G39DDC_DEVICE_STATE_TEMP_ERRORCritical temperature detected.
G39DDC_DEVICE_STATE_FAN_ERRORBuilt-in fan error detected. The fun is not operational.
G39DDC_DEVICE_STATE_VCC_ERRORVoltage error detected.
G39DDC_DEVICE_STATE_COMM_ERRORInternal hardware communication error detected.

Return value

If the method succeeds, the return value is non-zero.
If the method fails, the return value is zero. To get extended error information, call GetLastError.

IG39DDCDeviceCallback interface

IG39DDCDeviceCallback interface is an interface of application-defined object that implements methods of the interface. The object is used to receive streamed buffers from the G39DDC device object. See IG39DDCDevice::SetCallback.

Each method of the interface is called in context of thread created by the API. If some shared data are accessed inside callback methods, it is recommended to use a mutual-exclusion synchronization method. The application should not call any G39DDC API function/method from inside method of this interface, otherwise it can cause deadlock or the application can become to unpredictable state.


IG39DDCDeviceCallback::G39DDC_IFCallback

It is called by the API to pass IF snapshots to the application. Sending of IF snapshots is started using the IG39DDCDevice::StartIF method.

C/C++ declaration

void __stdcall G39DDC_IFCallback(IG39DDCDevice *Device,CONST SHORT *Buffer,UINT32 NumberOfSamples,UINT32 CenterFrequency,WORD Amplitude,UINT32 ADCSampleRate);

Parameters

Device
Interface of the device object which called the callback.
Buffer
Pointer to the buffer which contains samples directly received from ADC. Sample rate is 100 MHz, sample is 16 bit signed little endian (values are from range -32768 to +32767).
NumberOfSamples
Specifies number of samples in the buffer pointed to be the Buffer parameter. This is usually 65536.
CenterFrequency
Specifies center frequency of the useful band in received 50 MHz wide snapshot. Not whole 50 MHz band of the snapshot is usable. Usable bandwidth is specified by the FrontEndWindowWidth member of the G39DDC_DEVICE_INFO structure.
Amplitude
Specifies maximum amplitude at ADC output. Measurement of the maximum is started at the end of the previous snapshot to the current one. The possible value is 0 to 32767.
ADCSampleRate
Specifies sample rate of the ADC in Hz. It can be a bit different from 100 MHz.

IG39DDCDeviceCallback::G39DDC_DDC1StreamCallback

It is called by the API to pass I/Q samples from DDC1 to the application. The DDC1 streaming can be started using the IG39DDCDevice::StartDDC1 or IG39DDCDevice::StartDDC1Playback method.

C/C++ declaration

void __stdcall G39DDC_DDC1StreamCallback(IG39DDCDevice *Device,UINT32 Channel,CONST VOID *Buffer,UINT32 NumberOfSamples,UINT32 BitsPerSample);

Parameters

Device
Interface of the device object which called the callback.
Channel
Specifies channel index. It can be 0, 1.
Buffer
Pointer to the buffer which contains I/Q sample sets from DDC1. Sample rate and bits per sample is given by used DDC type, see the SetDDC1 function. One I/Q sample set consists of two samples.
NumberOfSamples
Specifies number of I/Q sample sets in the buffer pointed to by the Buffer parameter. This value is equal to value of the SamplesPerBuffer parameter of the StartDDC1 or StartDDC1Playback function.
BitsPerSample
Specifies number of bits per sample. It is given by DDC type used for DDC1 and it can be 16 or 32. If it is 16, sample is 16 bit integer (32bits per I/Q sample set), signed, little endian, from range -32768 to +32767. If it is 32, sample is 32bit integer (64bits per I/Q sample set), signed, little endian, from range -2147483648 to +2147483647.

IG39DDCDeviceCallback::G39DDC_DDC1PlaybackStreamCallback

It is called by the API to fill the buffer with I/Q samples by the applcation. The DDC1 playback can be started using the IG39DDCDevice::StartDDC1Playback method.

C/C++ declaration

BOOL __stdcall G39DDC_DDC1PlaybackStreamCallback(IG39DDCDevice *Device,UINT32 Channel,VOID *Buffer,UINT32 NumberOfSamples,UINT32 BitsPerSample);

Parameters

Device
Interface of the device object which called the callback.
Channel
Specifies channel index. It can be 0, 1.
Buffer
Pointer to the buffer to be filled with I/Q sample sets. Sample rate and bits per sample is given by used DDC type, see the SetDDC1 function.
NumberOfSamples
Specifies number of I/Q sample sets to be stored to the buffer pointed to by the Buffer parameter. This value is equal to value of the SamplesPerBuffer parameter of the IG39DDCDevice::StartDDC1Playback method. If the application does not have requested number of sample sets, it has to fill the buffer with zeros. One I/Q sample set consists of two samples.
BitsPerSample
Specifies number of bits per sample. It is given by DDC type used for DDC1 and it can be 16 or 32. If it is 16, sample is 16 bit integer (32bits per I/Q sample set), signed, little endian, from range -32768 to +32767. If it is 32, sample is 32bit integer (64bits per I/Q sample set), signed, little endian, from range -2147483648 to +2147483647.

Return value

The application should return non-zero to continue playback. The application should return zero to stop the API to call G39DDC_DDC1PlaybackStreamCallback again. This does not stop DDC1 playback, it has to be done explicitly by the application calling the IG39DDCDevice::StopDDC1 method from the thread in which the device was created using the CreateInstance function. IG39DDCDevice::StopDDC1 must not be called from inside the callback.

IG39DDCDeviceCallback::G39DDC_DDC2StreamCallback

It is called by the API to pass I/Q samples from DDC2 to the application. The DDC2 streaming can be started using the IG39DDCDevice::StartDDC2 method.

C/C++ declaration

void __stdcall G39DDC_DDC2StreamCallback(IG39DDCDevice *Device,UINT32 Channel,CONST FLOAT *Buffer,UINT32 NumberOfSamples);

Parameters

Device
Interface of the device object which called the callback.
Channel
Specifies channel index. It can be 0, 1.
Buffer
Pointer to the buffer which contains I/Q sample sets from DDC2. Sample rate is given by the DDC type of the DDC2. Use the IG39DDCDevice::GetDDC2 method to determine current DDC type of the DDC2. Sample is 32bit IEEE float from range -1.0 to 1.0. One I/Q sample set consists of two samples.
NumberOfSamples
Specifies number of I/Q sample sets in the buffer pointed to by the Buffer parameter. This value is equal to value of the SamplesPerBuffer parameter of the IG39DDCDevice::StartDDC2 method.

IG39DDCDeviceCallback::G39DDC_DDC2PreprocessedStreamCallback

It is called by the API to pass preprocessed I/Q samples from DDC2 to the application. The samples are filtered by the demodulator filter, notch filter and affected by AGC or fixed gain. The DDC2 streaming can be started using the IG39DDCDevice::StartDDC2 method.

C/C++ declaration

void __stdcall G39DDC_DDC2PreprocessedStreamCallback(IG39DDCDevice *Device,UINT32 Channel,

    CONST FLOAT *Buffer,UINT32 NumberOfSamples,FLOAT SlevelPeak,FLOAT SlevelRMS);

Parameters

Device
Interface of the device object which called the callback.
Channel
Specifies channel index. It can be 0, 1.
Buffer
Pointer to the buffer which contains preprocessed I/Q sample sets from DDC2. Sample rate is given by the DDC type of the DDC2. Use the IG39DDCDevice::GetDDC2 method to determine current DDC type of the DDC2. Sample is 32bit IEEE float from range -1.0 to 1.0. One I/Q sample set consists of two samples.
NumberOfSamples
Specifies number of I/Q sample sets in the buffer pointed to by the Buffer parameter. This value is equal to value of the SamplesPerBuffer parameter of the IG39DDCDevice::StartDDC2 method.
SlevelPeak
Specifies peak signal level in Volts evaluated from samples stored in the buffer pointed to by the Buffer parameter.
SlevelRMS
Specifies RMS signal level in Volts evaluated from samples stored in the buffer pointed to by the Buffer parameter. For detailed information how to convert RMS signal level to dBm, see remarks of the IG39DDCDevice::GetSignalLevel method.

IG39DDCDeviceCallback::G39DDC_AudioStreamCallback

It is called by the API to pass audio samples to the application. The audio streaming can be started using the IG39DDCDevice::StartAudio or IG39DDCDevice::StartAudioPlayback method. The callback is invoked three times for each audio buffer (see description of the Type parameter).

C/C++ declaration

void __stdcall G39DDC_AudioStreamCallback(IG39DDCDevice *Device,UINT32 Channel,UINT32 Type,CONST FLOAT *Buffer,UINT32 NumberOfSamples);

Parameters

Device
Interface of the device object which called the callback.
Channel
Specifies channel index. It can be 0, 1.
Type
Specifies type (stage) of audio samples stored in the buffer pointed to by the Buffer parameter. Value of this parameter can be one of the following:

ValueMeaning
0The buffer contains audio samples affected by audio gain (see IG39DDCDevice::SetAudioGain).
1The buffer contains audio samples affected by audio gain and audio filter (see IG39DDCDevice::SetAudioGain and IG39DDCDevice::SetAudioFilter).
2The buffer contains audio samples affected by audio gain, audio filter and volume (see IG39DDCDevice::SetAudioGain, IG39DDCDevice::SetAudioFilter, IG39DDCDevice::SetVolume and IG39DDCDevice::SetMute).
Buffer
Pointer to the buffer which contains samples of audio signal. The signal consists of two channels (interleaved), sample rate is specified by the IG39DDCDevice::SetAudio method, sample is 32bit IEEE float from range -1.0 to 1.0.
NumberOfSamples
Specifies number of samples to be stored in the buffers pointed to by the Buffer parameter. This value is equal to value of the SamplesPerBuffer parameter of the IG39DDCDevice::StartAudio or IG39DDCDevice::StartAudioPlayback method.

IG39DDCDeviceCallback::G39DDC_AudioPlaybackStreamCallback

It is called by the API to fill the buffer with audio samples by the application. The audio playback can be started using the IG39DDCDevice::StartAudioPlayback method.

C/C++ declaration

void __stdcall G39DDC_AudioPlaybackStreamCallback(IG39DDCDevice *Device,UINT32 Channel,FLOAT *Buffer,UINT32 NumberOfSamples);

Parameters

Device
Interface of the device object which called the callback.
Channel
Specifies channel index. It can be 0, 1.
Buffer
Pointer to the buffer to by filled with audio samples. The audio signal is two channel, sample rate is specified by the IG39DDCDevice::SetAudio method, sample is 32bit IEEE float from range -1.0 to 1.0.
NumberOfSamples
Specifies number of samples in the buffer pointed to by the Buffer parameter. This value is equal to value of the SamplesPerBuffer parameter of the IG39DDCDevice::StartAudioPlayback method. If the application does not have requested number of samples, the application has to fill the buffer with zeros.

Return value

The application should return non-zero to continue playback. The application should return zero to stop the API to call G39DDC_AudioPlaybackStreamCallback again. This does not stop audio playback, it has to be done explicitly by the application calling the IG39DDCDevice::StopAudio method from the thread in which the device object was created using the CreateInstance function. IG39DDCDevice::StopAudio must not be called from inside the callback.

IG39DDCDeviceCallback::G39DDC_SweepingCallback

It is called by the API to pass IF snapshots to the application during sweeping. Sending of them is started using the IG39DDCDevice::StartSweeping method.

C/C++ declaration

VOID __stdcall G39DDC_SweepingCallback(IG39DDCDevice *Device,CONST SHORT *Buffer,UINT32 NumberOfSamples,UINT32 CenterFrequency,UINT64 Frequency);

Parameters

Device
Interface of the device object which called the callback.
Buffer
Pointer to the buffer which contains samples directly received from ADC. Sample rate is 100 MHz, sample is 16 bit signed little endian (values are from range -32768 to +32767).
NumberOfSamples
Specifies number of samples in the buffer pointed to be the Buffer parameter. This is usually 65536.
CenterFrequency
Specifies center frequency of the useful band in received 50 MHz wide snapshot. Not whole 50 MHz band of the snapshot is usable. Usable bandwidth is specified by the FrontEndWindowWidth member of the G39DDC_DEVICE_INFO structure.
Frequency
Front-end frequency (in Hz) when the snapshot was made.

Return value

The application should return non-zero to continue sweeping. The application should return zero to stop API to call G39DDC_SweepingCallback again. This does not stop the sweeping, it has to be done explicitly by the application calling the IG39DDCDevice::StopSweeping method from the thread in which the device object was created using the CreateInstance function. IG39DDCDevice::StopSweeping must not be called from inside the callback.

Structures

G39DDC_DEVICE_INFO

Contains information about G39DDC device.

C/C++ declaration


#pragma pack(push,1)



typedef struct

{

    char        DevicePath[MAX_PATH];

    BYTE        InterfaceType;

    CHAR        SerialNumber[9];

    WORD        HWVersion;

    WORD        FWVersion;

    BYTE        EEPROMVersion;

    UINT32      ChannelCount;

    UINT64      FrontEndMinFrequency;

    UINT64      FrontEndMaxFrequency;

    UINT64      FrontEndMaxHFFrequency;

    UINT32      FrontEndFrequencyStep;

    UINT32      FrontEndWindowWidth;

    UINT32      HardwareOptions;

} G39DDC_DEVICE_INFO;



#pragma pack(pop)

Members

DevicePath
Device system path in a null-terminated string. It is used to open the device using object interface.
InterfaceType

Device interface type. The value can be one of the following:

G39DDC_INTERFACE_TYPE_PCIE
The device is connected to the computer via PCI express.

G39DDC_INTERFACE_TYPE_USB
The device is connected to the computer via USB.

SerialNumber
Serial number in null-terminated string.
HWVersion
Version of the hardware.
FWVersion
Version of the firmware.
EEPROMVersion
EEPROM structure version.
ChannelCount
Number of channels. It is equal to 2.
FrontEndMinFrequency
Minimum front-end frequency (in Hz) which can be used in the SetFrontEndFrequency and StartSweeping functions.
FrontEndMaxFrequency
Maximum front-end frequency (in Hz) which can be used in the SetFrontEndFrequency and StartSweeping functions.
FrontEndMaxHFFrequency
Maximum front-end frequency (in Hz) when the front-end is in HF mode.
FrontEndFrequencyStep
Tuning step (in Hz) of the front-end. The frequencies used in the SetFrontEndFrequency and StartSweeping functions have to be multiple of this value. The only exception is if the frequency is equal to FrontEndMinFrequency which need not be multiple if this value.
FrontEndWindowWidth
Useful bandwidth (in Hz) in IF snapshots passed to the IFCallback and SweepingCallback callbacks. Center of the bandwidth is specified by the CenterFrequency parameter of these callbacks.
HardwareOptions
Hardware options. It can be combination of the following values:

ValueMeaning
G39DDC_HARDWARE_OPTIONS_EXTERNAL_REFERENCEThe device supports external reference.
G39DDC_HARDWARE_OPTIONS_AUDIO_OUTPUTThe device has audio output connector.
G39DDC_HARDWARE_OPTIONS_FCCFCC receiver. The receiver does not allow to be tuned to prohibited frequency bands.


G39DDC_DDC_INFO

Contains information about DDC type.

C/C++ declaration


#pragma pack(push,1)



typedef struct

{

    UINT32  SampleRate;

    UINT32  Bandwidth;

    UINT32  BitsPerSample;

} G39DDC_DDC_INFO;



#pragma pack(pop)

Members

SampleRate
Sample rate of I/Q signal in Hz.
Bandwidth
Useful bandwidth in Hz.
BitsPerSample
Number of bits per sample. It can be 16 or 32. It is used to determine bits per sample for DDC1.

G39DDC_AMS_CAPTURE_RANGE

Contains information about DDC type.

C/C++ declaration


#pragma pack(push,1)



typedef struct

{

    UINT32  Tune;

    UINT32  Lock;

} G39DDC_AMS_CAPTURE_RANGE;



#pragma pack(pop)

Members

Tune
Initial capture range in Hz.
Lock
Capture range (in Hz) used when AMS demodulator is locked.

G39DDC_DRM_STATUS

Contains information about DRM demodulator/decoder status.

C/C++ declaration


#pragma pack(push,1)



typedef struct

{

    BOOL            Valid;



    struct

    {

        BOOL        SyncFound;

        BOOL        FACDecoded;

        BOOL        SDCDecoded;

        BOOL        AudioDecoded;

        SHORT       NumberOfAudioFrames;

        SHORT       NumberOfAudioErrors;

    } DecodingState;



    INT32           Mode;

    double          RFBandwidth;

    BYTE            Interleaver;

    SHORT           SDCQam;

    SHORT           MSCQam;

    BYTE            MSCQamType;

    double          CoderateH;

    double          CoderateA;

    double          CoderateB;

    double          EstimatedSNR;

    WCHAR           TextMessage[128 + 1 + 16];

   

    struct

    {

        BYTE        Content;

        WCHAR       DynamicLabel[256];

        WCHAR       Country[256];

        WCHAR       Language[256];

        WCHAR       ProgramType[256];

        double      AudioBitrate;

        double      TextMsgBitrate;

        double      MultimediaBitrate;

        double      DataBitrate;

    } ServiceInfo[4];



    struct

    {

        BOOL        Valid;

        BYTE        AudioCoding;

        BOOL        SBR;

        INT32       AudioMode;

    } AudioDecoderInfo[4];

} G39DDC_DRM_STATUS;



#pragma pack(pop)

Members

Valid
The value is non-zero if content of the structure is valid. It is zero, if content of the structure is not valid.
DecodingState

Structure that contains status of the decoder modules.

Members

SyncFound
Status of the sync detection. It is non-zero if sync detected.
FACDecoded
Status of the FAC decoder. It is non-zero if FAC decoded.
SDCDecoded
Status of the SDC decoder. It is non-zero if SDC decoded.
AudioDecoded
Status of the audio decoder. It is non-zero if audio decoded.
NumberOfAudioFrames
Number of audio frames in the transmission frame. It is -1 if this information is not available.
NumberOfAudioErrors
Number of audio frames that were invalid.
Mode
Used DRM robustness mode. It can be one of the following:

ValueMeaning
G39DDC_DRM_STATE_MODE_NOT_DETERMINED_YETRobustness mode is not determined yet.
G39DDC_DRM_STATE_MODE_ABroadcast is using DRM robustness mode A.
G39DDC_DRM_STATE_MODE_BDRM robustness mode B.
G39DDC_DRM_STATE_MODE_CDRM robustness mode C.
G39DDC_DRM_STATE_MODE_DDRM robustness mode D.

RFBandwidth
Occupied RF bandwidth in kHz. It is zero if it is invalid or this information is not available (yet).
Interleaver
Interleaver length. It can be one of the following:

ValueMeaning
G39DDC_DRM_STATE_INTERLEAVER_LONGLong interleaver used (2 sec).
G39DDC_DRM_STATE_INTERLEAVER_SHORTShort interleaver used (400 msec).

SDCQam
Coding of the SDC (QAM). It is zero if this information is not available (yet).
MSCQam
Coding of the MSC (QAM). It is zero if this information is not available (yet).
MSCQamType
Used QAM coding for the MSC. It can be one of the following:

ValueMeaning
G39DDC_DRM_STATE_QAM_TYPE_STDStandard
G39DDC_DRM_STATE_QAM_TYPE_HIER_SYMHierarchical symmetrical
G39DDC_DRM_STATE_QAM_TYPE_HIER_MIXHierarchical mixed

CoderateH
Used code-rate for hierarchical coding, values less than or equal to zero indicate not available or not used.
CoderateA
Used code-rate for protection level A, values less than or equal to zero indicate indicate not available or not used.
CoderateB
Used code-rate for protection level B, values less than or equal to zero indicate indicate not available or not used.
EstimatedSNR
Estimated SNR in dB of the decoded signal.
TextMessage
Decoded text message for the selected service in 16 bit Unicode null-terminated string.
ServiceInfo

Array of four structures which contain general information on the services.

Members

Content
Type of the service. It can be combination of the following:

ValueMeaning
G39DDC_DRM_STATE_SERVICE_CONTENT_EMPTYGiven service is not used, it contains no data, all other members of the structure are invalid.
G39DDC_DRM_STATE_SERVICE_CONTENT_AUDIOGiven service contains audio data.
G39DDC_DRM_STATE_SERVICE_CONTENT_TEXTMSGGiven service contains text messages.
G39DDC_DRM_STATE_SERVICE_CONTENT_MULTIMEDIAGiven service contains multimedia data.
G39DDC_DRM_STATE_SERVICE_CONTENT_DATAGiven service contains application specific data.

DynamicLabel
16 bit Unicode null-terminated string containing dynamic label of the service.
Country
16 bit Unicode null-terminated string containing the signaled country for this service.
Language
16 bit Unicode null-terminated string containing the signaled language for this service.
ProgramType
16 bit Unicode null-terminated string containing the signaled program type for this service.
AudioBitrate
Data rate for the audio content. It is zero if this information is not available.
TextMsgBitrate
Data rate for the text message content. It is zero if this information is not available.
MultimediaBitrate
Data rate for the multimedia content. It is zero if this information is not available.
DataBitrate
Data rate for the data content. It is zero if this information is not available.
AudioDecoderInfo

Array of four structures which contain audio decoder specific information on the services.

Members

Valid
If it is non-zero, audio decoder information are valid, if it is zero, audio decoder information are invalid and all other members of the structure contain no valid data.
AudioCoding
Used audio coding. It can be one of the following:

ValueMeaning
G39DDC_DRM_STATE_AUDIO_CODING_AACAudio coding for given service is AAC.
G39DDC_DRM_STATE_AUDIO_CODING_CELPAudio coding for given service is CELP.
G39DDC_DRM_STATE_AUDIO_CODING_HVXCAudio coding for given service is HVXC.
G39DDC_DRM_STATE_AUDIO_CODING_RFUReserved for future use.

SBR
If it is non-zero, SBR is used, if it is zero, SBR is not used.
AudioMode
The value depends on audio coding. It can be one of the following:

ValueMeaning
G39DDC_DRM_STATE_AUDIO_MODE_AAC_MONOMono
G39DDC_DRM_STATE_AUDIO_MODE_AAC_PARAM_STEREOParametric stereo
G39DDC_DRM_STATE_AUDIO_MODE_AAC_STEREOStereo
G39DDC_DRM_STATE_AUDIO_MODE_AAC_RFUReserved for future use
G39DDC_DRM_STATE_AUDIO_MODE_CELP_NO_CRCAudio data is without CRC
G39DDC_DRM_STATE_AUDIO_MODE_CELP_CRCCRC used
G39DDC_DRM_STATE_AUDIO_MODE_CELP_RFU_10Reserved for future use
G39DDC_DRM_STATE_AUDIO_MODE_CELP_RFU_11Reserved for future use
G39DDC_DRM_STATE_AUDIO_MODE_HVXC_RFU_00Reserved for future use
G39DDC_DRM_STATE_AUDIO_MODE_HVXC_RFU_01Reserved for future use
G39DDC_DRM_STATE_AUDIO_MODE_HVXC_RFU_10Reserved for future use
G39DDC_DRM_STATE_AUDIO_MODE_HVXC_RFU_11Reserved for future use