Download ASX User Manual

Transcript
10.8 play/main.c
247
enum asxPLAYER_STATE state;
if(argc<2)
{
printf("Filename to play is a required parameter.\n");
return -1;
}
// create the system
ASX_System_Create(ASX_SYSTEM_TYPE_HPI,&hSystem);
CheckError(hSystem, __LINE__);
ASX_System_SetMessageLogging(hSystem,asxMSG_LOGGING_VERBOSE);
CheckError(hSystem, __LINE__);
// get the adapter
ASX_System_GetAdapter(hSystem,nAdapterToUse,&hAdapter);
CheckError(hAdapter, __LINE__);
ASX_Adapter_GetName(hAdapter,0,0,&nLen);
CheckError(hAdapter, __LINE__);
pszName = (char *)malloc(nLen);
ASX_Adapter_GetName(hAdapter,pszName,nLen,&nLen);
CheckError(hAdapter, __LINE__);
printf("Adapter [%d] is %s \n", nAdapterToUse,pszName);
// get the mixer handle
ASX_Adapter_GetMixer( hAdapter, &hMixer );
CheckError(hAdapter, __LINE__);
// get a player object
asxError = ASX_Mixer_GetControlByNodeTypeAndIndex(
hMixer,
asxNODE_PLAYER,0,
0,0,
asxCONTROL_PLAYER,
&hPlayer);
CheckError(hMixer, __LINE__);
// print out some control details
PrintControlName(hPlayer);
// open the player and pass in the file to be played
ASX_Player_Open( hPlayer, argv[1]);
CheckError(hPlayer, __LINE__);
if(argc>2)
{
printf("Start at offset %s milliseconds\n",argv[2]);
ASX_Player_PreLoad(hPlayer,asxTIMESCALE_MILLISECONDS,strtol(argv[2],&pDum
my,10));
}
// start playing the file at offset 0 seconds.
ASX_Player_Start( hPlayer );
CheckError(hPlayer, __LINE__);
ASX_Player_Format_GetString(hPlayer, &pszFormat);
printf("Playing %s Format %s on Device %s\n",argv[1],pszFormat,pszName);
free(pszName);
#define TEST 1
Generated on Thu Dec 17 2015 10:17:26 for ASX by Doxygen