ASX Version4.13.09

system/main.c

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

/* $Header: /home/eliot/asi/repo/cvsrepo/Repository/apps/asx/examples/system/main.c,v 1.5 2004/08/11 14:13:46 as-age Exp $ */
#include "stdio.h"
#include "stdlib.h"
#include "asx.h"

int main(int argc, char* argv[])
{

    ASX_HANDLE system;
    ASX_ERROR asxError;
    char *pszAsxSubsysVersion;
    char *pszAsxVersion;
    int nAdapters=0;
    char *pszSystem;
    int nLen,nLen1,nLen2;

    printf("AudioScience ASX - System Example\n");

    asxError = ASX_System_Create(ASX_SYSTEM_TYPE_HPI,&system);

    if(asxError)
    {
        int asxSubSystemErrorCode=0;
        char *pszAsxErrorString;
        char *pszAsxSubSystemErrorString;

        ASX_Error_GetLast( system, &asxError, &asxSubSystemErrorCode);

        ASX_Error_GetLastString( system, 0, 0, &nLen1, 0, 0, &nLen2);
        pszAsxErrorString = (char *)malloc(nLen1);
        pszAsxSubSystemErrorString = (char *)malloc(nLen2);
        ASX_Error_GetLastString( system, pszAsxErrorString, nLen1, &nLen1, pszAsxSubSystemErrorString, nLen2, &nLen2);
        printf("Error: #%d, %s - Subsystem Error: #%ld, %s \n", asxError,  pszAsxErrorString,
        asxSubSystemErrorCode, pszAsxSubSystemErrorString );
        getchar();
        free(pszAsxErrorString);
        free(pszAsxSubSystemErrorString);
        return(0);
    }

    asxError = ASX_System_GetVersion(system, 0,0,&nLen1, 0, 0, &nLen2);
    pszAsxVersion = (char *)malloc(nLen1);
    pszAsxSubsysVersion = (char *)malloc(nLen2);
    asxError = ASX_System_GetVersion(system, pszAsxVersion, nLen1, &nLen1, pszAsxSubsysVersion, nLen2, &nLen2);

    asxError = ASX_System_GetName( system, 0,0,&nLen );
    pszSystem = (char *)malloc(nLen);
    asxError = ASX_System_GetName( system, pszSystem,nLen,&nLen );
    printf("System Ver %s\nSubsystem=%s Ver %s\n", pszAsxVersion, pszSystem, pszAsxSubsysVersion);

    asxError = ASX_System_GetAdapterCount(system,&nAdapters);
    printf("There are %d audio adapters in the system \n", nAdapters);

    printf("Press ENTER to exit\n");
    getchar();
    ASX_System_Delete(system);
    free(pszAsxVersion);
    free(pszAsxSubsysVersion);
    free(pszSystem);
    return(0);
}