system/main.c

This is an example of how to use the ASX System functions.

00001 /* $Header: /Repository/apps/asx/examples/system/main.c,v 1.5 2004/08/11 14:13:46 as-age Exp $ */
00002 #include "stdio.h"
00003 #include "stdlib.h"
00004 #include "asx.h"
00005 
00006 int main(int argc, char* argv[])
00007 {
00008 
00009     ASX_HANDLE system;
00010     ASX_ERROR asxError;
00011     char *pszAsxSubsysVersion;
00012     char *pszAsxVersion;
00013     int nAdapters=0;
00014     char *pszSystem;
00015     int nLen,nLen1,nLen2;
00016 
00017     printf("AudioScience ASX - System Example\n");
00018 
00019     asxError = ASX_System_Create(ASX_SYSTEM_TYPE_HPI,&system);
00020 
00021     if(asxError)
00022     {
00023         int asxSubSystemErrorCode=0;
00024         char *pszAsxErrorString;
00025         char *pszAsxSubSystemErrorString;
00026 
00027         ASX_Error_GetLast( system, &asxError, &asxSubSystemErrorCode);
00028 
00029         ASX_Error_GetLastString( system, 0, 0, &nLen1, 0, 0, &nLen2);
00030         pszAsxErrorString = (char *)malloc(nLen1);
00031         pszAsxSubSystemErrorString = (char *)malloc(nLen2);
00032         ASX_Error_GetLastString( system, pszAsxErrorString, nLen1, &nLen1, pszAsxSubSystemErrorString, nLen2, &nLen2);
00033         printf("Error: #%d, %s - Subsystem Error: #%ld, %s \n", asxError,  pszAsxErrorString,
00034         asxSubSystemErrorCode, pszAsxSubSystemErrorString );
00035         getchar();
00036         free(pszAsxErrorString);
00037         free(pszAsxSubSystemErrorString);
00038         return(0);
00039     }
00040 
00041     asxError = ASX_System_GetVersion(system, 0,0,&nLen1, 0, 0, &nLen2);
00042     pszAsxVersion = (char *)malloc(nLen1);
00043     pszAsxSubsysVersion = (char *)malloc(nLen2);
00044     asxError = ASX_System_GetVersion(system, pszAsxVersion, nLen1, &nLen1, pszAsxSubsysVersion, nLen2, &nLen2);
00045 
00046     asxError = ASX_System_GetName( system, 0,0,&nLen );
00047     pszSystem = (char *)malloc(nLen);
00048     asxError = ASX_System_GetName( system, pszSystem,nLen,&nLen );
00049     printf("System Ver %s\nSubsystem=%s Ver %s\n", pszAsxVersion, pszSystem, pszAsxSubsysVersion);
00050 
00051     asxError = ASX_System_GetAdapterCount(system,&nAdapters);
00052     printf("There are %d audio adapters in the system \n", nAdapters);
00053 
00054     printf("Press ENTER to exit\n");
00055     getchar();
00056     ASX_System_Delete(system);
00057     free(pszAsxVersion);
00058     free(pszAsxSubsysVersion);
00059     free(pszSystem);
00060     return(0);
00061 }

Generated on Tue Nov 18 13:03:40 2008 for ASX by  doxygen 1.4.6-NO