Example #1
0
void	SelectComboDevice(void)
{
	int		iRow;

	iRow = pdlg->m_ComboDevice.GetCurSel ( ); 

	InitDeviceInfo ();
}
Example #2
0
void CFX_RenderDevice::SetDeviceDriver(
    std::unique_ptr<RenderDeviceDriverIface> pDriver) {
  m_pDeviceDriver = std::move(pDriver);
  InitDeviceInfo();
}
Example #3
0
// -------------------------------------------------------
DJ_Void EvtHandler(DJ_U32 esrParam)
{
	Acs_Evt_t *			    pAcsEvt = NULL;

	Acs_Dev_List_Head_t * pAcsDevList = NULL;
	Acs_GeneralProc_Data* pGeneral=NULL;

	char		TmpStr[256];
	char *      pStr = NULL;

	pAcsEvt = (Acs_Evt_t *) esrParam;

	DispEventInfo ( pAcsEvt );

	switch ( pAcsEvt->m_s32EventType )
	{
		case XMS_EVT_OPEN_STREAM:
			printf("");
			break;

		case XMS_EVT_QUERY_DEVICE:
			if ( !bStartWorkFlag )
			{
				pAcsDevList = ( Acs_Dev_List_Head_t *) ( (DJ_S8 *)pAcsEvt + sizeof(Acs_Evt_t) );

				//Add or modify device resource to pool when receive the device's event of the state changing
				AddDeviceRes ( pAcsDevList );
			}
			break; 

		case XMS_EVT_QUERY_DEVICE_END:	//get device list completely
			if ( !bStartWorkFlag )
			{
				pGeneral = (Acs_GeneralProc_Data*)FetchEventData(pAcsEvt);
				sprintf ( TmpStr, "Start work. DeviceNum = %d\n", TotalDevRes );
				AddMsg ( MSG_TYPE_OTHER, TmpStr );

				InitDeviceInfo();

				bStartWorkFlag = true;
			}
			break;

		case XMS_EVT_OPEN_DEVICE:
			OpenDeviceOK ( &pAcsEvt->m_DeviceID );						
			break;

		case XMS_EVT_CLOSE_DEVICE:
			CloseDeviceOK ( &pAcsEvt->m_DeviceID );

			pStr = GetString_DeviceAll(&pAcsEvt->m_DeviceID);
			sprintf(TmpStr,"Close devcie evt: %s",pStr);
			AfxMessageBox(TmpStr,NULL,MB_OK);
			break;

		case XMS_EVT_PLAYCSPREQ:
			{
				DJ_S32  r = 0;
				char MsgStr[100]={0};
				CSPPlayDataInfo_t     playCSP={0};
				Acs_CSPDataReq_Data * pCspReq = NULL;
				
				if(g_cspPlay == 0)
				{
					break;
				}

				pCspReq = (Acs_CSPDataReq_Data *)FetchEventData(pAcsEvt);
								
				if(g_cspFp == NULL)
				{
					g_cspFp = fopen(g_szCSPFile,"rb");
				}

				if(feof(g_cspFp))
				{
					fseek(g_cspFp,SEEK_SET,0);
					TRACE("Seek to Set\n");
				}
				
				playCSP.m_u16DataLen = pCspReq->m_u16ReqCspDataLen;
				playCSP.m_u8DataType = XMS_CSPPLAY_DATA_VOC;
				playCSP.m_u8TaskID = (DJ_U8)(GetTickCount() % 128);	
				
				long rr = fread(g_szDataBuf,sizeof(char),playCSP.m_u16DataLen,g_cspFp);
				TRACE("ReqDataLen = %d,sentData=%d\n",pCspReq->m_u16ReqCspDataLen,rr);
				
				r = XMS_ctsSendCSPData(g_acsHandle, &DevOpened[iOpenedIndex1].DevID, &playCSP,g_szDataBuf,NULL);
				if ( r < 0 )
				{
					sprintf ( MsgStr, "X(%d) XMS_ctsPlayCSP() FAIL! (%s)", 
						r, GetString_DeviceAll (&DevOpened[iOpenedIndex1].DevID)  );
					AddMsg ( MSG_TYPE_FUNCTION, MsgStr);
				}
				else
				{
					sprintf ( MsgStr, "XMS_ctsPlayCSP() OK! (%s)", 
						GetString_DeviceAll (&DevOpened[iOpenedIndex1].DevID));
					AddMsg ( MSG_TYPE_FUNCTION, MsgStr );
				}									
			}
			break;
		case XMS_EVT_CONTROLPLAY:
			g_cspPlay = 0;
			break;
		case XMS_EVT_RECORDCSP:
			{
				Acs_MediaCSPProc_Data * pCSPData = NULL;
								
				pCSPData = (Acs_MediaCSPProc_Data *)FetchEventData(pAcsEvt);				
				fwrite(pCSPData->m_u8StreamData,sizeof(char),pCSPData->m_u16DataLen,g_cspFp);				
			}
			break;
		default:
			break;
	}

}
Example #4
0
PaError
PaSndio_Initialize(PaUtilHostApiRepresentation **hostApi, PaHostApiIndex hostApiIndex)
{
	PaSndioHostApiRepresentation *sndioHostApi;
	PaDeviceInfo *info;
	struct sio_hdl *hdl;
	char *audiodevices;
	char *device;
	size_t deviceCount;

	DPR("PaSndio_Initialize: initializing...\n");

	/* unusable APIs should return paNoError and a NULL hostApi */
	*hostApi = NULL;

	sndioHostApi = PaUtil_AllocateMemory(sizeof(PaSndioHostApiRepresentation));
	if (sndioHostApi == NULL)
		return paNoError;

	// Add default device
	info = &sndioHostApi->device_info[0];
	InitDeviceInfo(info, hostApiIndex, SIO_DEVANY);
	sndioHostApi->infos[0] = info;
	deviceCount = 1;

	// Add additional devices as specified in the PA_SNDIO_AUDIODEVICES
	// environment variable as a colon separated list
	sndioHostApi->audiodevices = NULL;
	audiodevices = getenv("PA_SNDIO_AUDIODEVICES");
	if (audiodevices != NULL) {
		sndioHostApi->audiodevices = strdup(audiodevices);
		if (sndioHostApi->audiodevices == NULL)
			return paNoError;

		audiodevices = sndioHostApi->audiodevices;
		while ((device = strsep(&audiodevices, ":")) != NULL &&
			deviceCount < PA_SNDIO_AUDIODEVICES_MAX) {
			if (*device == '\0')
				continue;
			info = &sndioHostApi->device_info[deviceCount];
			InitDeviceInfo(info, hostApiIndex, device);
			sndioHostApi->infos[deviceCount] = info;
			deviceCount++;
		}
	}

	*hostApi = &sndioHostApi->base;
	(*hostApi)->info.structVersion = 1;
	(*hostApi)->info.type = paSndio;
	(*hostApi)->info.name = "sndio";
	(*hostApi)->info.deviceCount = deviceCount;
	(*hostApi)->info.defaultInputDevice = 0;
	(*hostApi)->info.defaultOutputDevice = 0;
	(*hostApi)->deviceInfos = sndioHostApi->infos;
	(*hostApi)->Terminate = Terminate;
	(*hostApi)->OpenStream = OpenStream;
	(*hostApi)->IsFormatSupported = IsFormatSupported;
	
	PaUtil_InitializeStreamInterface(&sndioHostApi->blocking,
	    CloseStream,
	    StartStream,
	    StopStream,
	    AbortStream,
	    IsStreamStopped,
	    IsStreamActive,
	    GetStreamTime,
	    PaUtil_DummyGetCpuLoad,
	    BlockingReadStream,
	    BlockingWriteStream,
	    BlockingGetStreamReadAvailable,
	    BlockingGetStreamWriteAvailable);

	PaUtil_InitializeStreamInterface(&sndioHostApi->callback,
	    CloseStream,
	    StartStream,
	    StopStream,
	    AbortStream,
	    IsStreamStopped,
	    IsStreamActive,
	    GetStreamTime,
	    PaUtil_DummyGetCpuLoad,
	    PaUtil_DummyRead,
	    PaUtil_DummyWrite,
	    PaUtil_DummyGetReadAvailable,
	    PaUtil_DummyGetWriteAvailable);

	DPR("PaSndio_Initialize: done\n");
	return paNoError;
}
Example #5
0
bool	InitSystem(void)
{
	RetCode_t	r;
	char		MsgStr[160];

	pdlg = (CXMSApi_TestDlg	*)theApp.m_pMainWnd;

	// Read From "Config.TXT"
	ReadFromConfig();

	// Init Combo Box
	InitComboBox();

	// Init m_ListMsg
	InitListMsg();

	// Init Conifg's text box
	InitTextBox();

	// init variable used by XMSApi_Test_Func.cpp
	InitVar_Func();

#ifdef	DEBUG_IN_HOME_NOTEBOOK
// ----- for-test-----
	typedef struct {
		Acs_Dev_List_Head_t		head;
		DeviceID_t		dev[32];
	} My_Struct;

	My_Struct	mmm;
	
	mmm.head.m_s32DeviceNum = 4;
	mmm.dev[0].m_s16DeviceMain = XMS_DEVMAIN_VOICE;
	mmm.dev[0].m_s8ModuleID = 1;
	mmm.dev[0].m_s16ChannelID = 1;
	mmm.dev[1].m_s16DeviceMain = XMS_DEVMAIN_VOICE;
	mmm.dev[1].m_s8ModuleID = 1;
	mmm.dev[1].m_s16ChannelID = 2;

	mmm.dev[2].m_s16DeviceMain = XMS_DEVMAIN_INTERFACE_CH;
	mmm.dev[2].m_s16DeviceSub = XMS_DEVSUB_E1_SS7_ISUP;
	mmm.dev[2].m_s8ModuleID = 1;
	mmm.dev[2].m_s16ChannelID = 8;
	mmm.dev[3].m_s16DeviceMain = XMS_DEVMAIN_INTERFACE_CH;
	mmm.dev[3].m_s16DeviceSub = XMS_DEVSUB_E1_SS7_ISUP;
	mmm.dev[3].m_s8ModuleID = 1;
	mmm.dev[3].m_s16ChannelID = 9;
void	AddDeviceRes ( Acs_Dev_List_Head_t *pAcsDevList );

	AddDeviceRes ( &mmm.head );
	InitDeviceInfo();

	bStartWorkFlag = true;

	return true;
// ----- end of for-test -----
#endif
	
	// now open ACS Server
	/*Invoke the acsOpenStream routine to create a connect to server*/
	r = XMS_acsOpenStream ( &g_acsHandle, 
						&cfg_ServerID,
						g_u8UnitID,		// App Unit ID 
						32,				// sendQSize, in K Bytes
						32,				// recvQSize, in K Bytes
						//cfg_s32DebugOn,	// Debug On/Off
						1,
						NULL);

	if ( r < 0 )
	{
		sprintf ( MsgStr, "X(%d) XMS_acsOpenStream(IP Addr : %s, port : %d) FAIL.", 
			r, cfg_ServerID.m_s8ServerIp, cfg_ServerID.m_u32ServerPort );

		MessageBox(NULL, MsgStr, "Init System", MB_OK ) ;
		AddMsg ( MSG_TYPE_FUNCTION, MsgStr );
	}
	else
	{
		sprintf ( MsgStr, "XMS_acsOpenStream(%s,%d) OK!", cfg_ServerID.m_s8ServerIp, cfg_ServerID.m_u32ServerPort );
		AddMsg ( MSG_TYPE_FUNCTION, MsgStr );
	}

	r = XMS_acsSetESR ( g_acsHandle, (EsrFunc)EvtHandler, 0, 1 );
	if ( r < 0 )
	{
		sprintf ( MsgStr, "X(%d) XMS_acsSetESR() FAIL!", r );
		AddMsg ( MSG_TYPE_FUNCTION, MsgStr );
		return false;
	}
	else
	{
		sprintf ( MsgStr, "XMS_acsSetESR() OK!" );
		AddMsg ( MSG_TYPE_FUNCTION, MsgStr );
	}

	XMS_acsGetDeviceList ( g_acsHandle, NULL );

	bStartWorkFlag = false;

	return true;
}