Exemplo n.º 1
0
//inner function
int CGtecDevice::GetIndexofFilt()
{
	int numoffilt = 0;
	int index = -1;
	GT_GetNumberOfFilter(&numoffilt);
	FILT *m_pFilt=NULL;
	m_pFilt = new _FILT[numoffilt];
	if(!GT_GetFilterSpec(m_pFilt))
	{
		TRACE("Can't get the FilterSpace!\n");
		return -1;
	}
	int i = 0;
	for(;i<numoffilt;i++)
	{
		if(fabs(m_pFilt[i].fu-m_filterhighpass)<0.0001&&fabs(m_pFilt[i].fo-m_filterlowpass)<0.0001
			&&m_pFilt[i].fs==m_Samplerete&&m_pFilt[i].order==m_filtermodelorder
			&&m_pFilt[i].type==m_filtertype)
		{
			index = i;
			break;
		}
	}
	delete[] m_pFilt;
	TRACE("the Filter order is: %d\n",index);
	return index;
}
Exemplo n.º 2
0
BOOL CGtecDevice::EB_GetFilter(FILT* filt)
{
	if(filt!=NULL)
		return FALSE;
	int filtnum;
	GT_GetNumberOfFilter(&filtnum);
	if(filt==NULL)
		filt = new FILT[filtnum];
	if(!GT_GetFilterSpec(filt))
	{
		return FALSE;
	}
	return TRUE;
}
Exemplo n.º 3
0
void print_info()
{
HANDLE hdev;

 int firstamp=-1;
 // go through all possible USB connectors to find out what we have connected
 for (int cur_amp=0; cur_amp<MAX_USBAMPS; cur_amp++)
  {
  hdev = GT_OpenDevice(cur_amp);
  if (hdev)
     {
     char buf[1000];
     GT_GetSerial(hdev, (LPSTR)buf, 1000);
     printf("Amp found at USB address %d (S/N: %s)\r\n", cur_amp, buf);
     if (firstamp < 0) firstamp=cur_amp;
     GT_CloseDevice(&hdev);
     }
  }

 // no amp detected
 if (firstamp < 0)
    {
    printf("No g.USBamp detected. Aborting ...\r\n");
    return;
    }

 printf("Printing info for first amp (USB address %d)\r\n", firstamp);
 hdev = GT_OpenDevice(firstamp);
 if (hdev)
    {
    // get filter settings
    int nof;
    FILT *filt;
    GT_GetNumberOfFilter(&nof);
    filt = new _FILT[nof];
    printf("\r\nAvailable bandpass filters\r\n");
    printf("===================================\r\n");
    printf("num| hpfr  | lpfreq |  sfr | or | type\r\n");
    printf("===================================\r\n");
    for (int no_filt=0; no_filt<nof; no_filt++)
     {
     GT_GetFilterSpec(filt);
     printf("%03d| %5.2f | %6.1f | %4.0f | %2.0f | %1.0f\r\n", no_filt, filt[no_filt].fu, filt[no_filt].fo, filt[no_filt].fs, filt[no_filt].order, filt[no_filt].type);
     }
    delete filt;
    // get notch filter settings
    GT_GetNumberOfNotch(&nof);
    filt = new _FILT[nof];
    printf("\r\nAvailable notch filters\r\n");
    printf("===================================\r\n");
    printf("num| hpfr  | lpfreq |  sfr | or | type\r\n");
    printf("===================================\r\n");
    for (int no_filt=0; no_filt<nof; no_filt++)
     {
     GT_GetNotchSpec(filt);
     printf("%03d| %5.2f | %6.1f | %4.0f | %2.0f | %1.0f\r\n", no_filt, filt[no_filt].fu, filt[no_filt].fo, filt[no_filt].fs, filt[no_filt].order, filt[no_filt].type);
     }
    delete filt;

    GT_CloseDevice(&hdev);
    }
}