Skip to content

Include/AWECoreOS.h

The AWE Core OS API header file.

Classes

Name
struct AWEOSAudioRecordNotification
Audio recording notification callback argument structure.
struct AWEOSThreadPIDs
Internal threading PID structure, meant to be used with aweOS_getThreadPIDs.
struct AWEOSVersionInfo
Versioning structure returned by aweOS_getVersion.
struct AWEOSConfigParameters
AWEOSConfigParameters.

Source code

/*******************************************************************************
*
*               AWE Core OS API
*               ---------------
*
********************************************************************************
*     AWECoreOS.h
********************************************************************************
*
*     Description:  The AWE Core OS API header file.
*
*     Copyright:    (c) 2007-2021 DSP Concepts, Inc. All rights reserved.
*                   3235 Kifer Road
*                   Santa Clara, CA 95054
*
*******************************************************************************/

#ifndef AWECOREOS_H_
#define AWECOREOS_H_

#include "StandardDefs.h"
#include "stdio.h"
#include <stddef.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include "Errors.h"
#include <sched.h>
#include "ProxyIDs.h"
#include <semaphore.h>

#ifdef __cplusplus
extern "C"
{
#endif


    #define TUNING_LOG_NONE     0
    #define TUNING_LOG_ERROR    1
    #define TUNING_LOG_INFO     2
    #define TUNING_LOG_DATA     3
    #define TUNING_LOG_DEBUG    TUNING_LOG_DATA


    typedef enum {ERROR, INPUT_OVERRUN, OUTPUT_OVERRUN} STATUS;

    typedef struct AWEOSAudioRecordNotification
    {
        STATUS notificationStatus;
        INT32 error;
        UINT32 xruns;
        FLOAT32 xrunTime;
    } AWEOSAudioRecordNotification_t;

    typedef void (*recordNotificationCallbackFunction)(AWEOSAudioRecordNotification_t*);

    #define AUDIO_RECORDING_NOTIFICATION_ERRORS     (1 << 0)
    #define AUDIO_RECORDING_NOTIFICATION_XRUNS      (1 << 1)
    #define AUDIO_RECORDING_NOTIFICATION_ALL        (AUDIO_RECORDING_NOTIFICATION_ERRORS | AUDIO_RECORDING_NOTIFICATION_XRUNS)

    typedef struct AWEOSThreadPIDs
    {
        UINT32 workThreadPID;
        UINT32 socketThreadPID;
        UINT32 numPumpThreads;
        UINT32 *pumpThreadPIDs;
    } AWEOSThreadPIDs_t;

    typedef struct AWEOSVersionInfo
    {

        INT32 tuningVer;
        char majorVer;
        INT32 minorVer;
        INT32 procVer;
        INT32 buildNumber;
        const char * textVer;
    } AWEOSVersionInfo_t;


    typedef void AWEOSInstance;

    typedef struct AWEOSConfigParameters
    {

        UINT32 *pFastHeapA;
        UINT32 *pFastHeapB;
        UINT32 *pSlowHeap;
        UINT32 fastHeapASize;
        UINT32 fastHeapBSize;
        UINT32 slowHeapSize;
        INT32(*cbAudioStart)(AWEOSInstance *pAWEOS);
        INT32(*cbAudioStop)(AWEOSInstance *pAWEOS);
        UINT32 *pPacketBuffer;
        UINT32 *pReplyBuffer;
        UINT32 packetBufferSize;
        UINT32 userVersion;
        float coreSpeed;
        float profileSpeed;
        const char *pName;
        UINT32 numThreads;
        float sampleRate;
        UINT32 fundamentalBlockSize;
        UINT32 inChannels;
        UINT32 outChannels;
        INT32 instanceId;
    } AWEOSConfigParameters;

    UINT32 aweOS_getThreadPIDs(AWEOSInstance *pAWEOS, AWEOSThreadPIDs_t * threadPIDs);

    INT32 aweOS_getParamDefaults(AWEOSConfigParameters *aweParams);

    INT32 aweOS_init(AWEOSInstance **pAWEOS, const AWEOSConfigParameters *aweParams, const void* pModuleDescriptorTable, UINT32 moduleDescriptorTableSize);

    INT32 aweOS_tuningSocketOpen(AWEOSInstance** pAWEOS, INT32 portNo, UINT32 numInstances);

    void aweOS_tuningSocketClose(AWEOSInstance *pAWEOS);

    INT32 aweOS_tuningLoggingEnable(AWEOSInstance *pAWEOS, char* path, char* baseName, UINT32 verbosity);

    INT32 aweOS_loadAWBFromArray(AWEOSInstance *pAWEOS, const UINT32 *pArray, UINT32 arraySize, UINT32 * pErrorOffset);


    INT32 aweOS_loadAWBFile(AWEOSInstance *pAWEOS, const char *binaryFile, UINT32 *pErrorOffset);

    INT32 aweOS_loadSubcanvasAWBfromArray(AWEOSInstance *pAWEOS, UINT32 SubcanvasModObjectID, const UINT32* pCommands, UINT32 arraySize, UINT32* pPos);



    INT32 aweOS_loadSubcanvasAWBfromFile(AWEOSInstance *pAWEOS, UINT32 SubcanvasModObjectID, const char* binaryFile, UINT32* pPos);

    INT32 aweOS_appendModules(AWEOSInstance *pAWEOS, size_t length, const void * const *modules);

    INT32 aweOS_layoutGetChannelCount(const AWEOSInstance *pAWEOS, UINT32 *inCount, UINT32 *outCount);

    INT32 aweOS_layoutGetBlockSize(const AWEOSInstance *pAWEOS, UINT32 *blockSize);

    INT32 aweOS_layoutGetSampleRate(const AWEOSInstance *pAWEOS, FLOAT32 *sampleRate);

    INT32 aweOS_audioPumpAll(AWEOSInstance *pAWEOS);


    INT32 aweOS_audioImportSamples(AWEOSInstance *pAWEOS, void *inSamples, INT32 inStride, INT32 channel, SampleType inType);

    INT32 aweOS_audioExportSamples(AWEOSInstance *pAWEOS, void *outSamples, INT32 outStride, INT32 channel, SampleType outType);

    INT32 aweOS_layoutIsValid(const AWEOSInstance *pAWEOS);

    INT32 aweOS_audioIsStarted(const AWEOSInstance *pAWEOS);

    const char* aweOS_errorToString(INT32 errorCode);

    INT32 aweOS_tuningPacketProcess(AWEOSInstance *pAWEOS);

    INT32 aweOS_ctrlSetValue(const AWEOSInstance *pAWEOS, UINT32 handle, void *value, INT32 arrayOffset, UINT32 length);

    INT32 aweOS_ctrlGetValue(const AWEOSInstance *pAWEOS, UINT32 handle, void *value, INT32 arrayOffset, UINT32 length);

    INT32 aweOS_ctrlSetStatus(const AWEOSInstance *pAWEOS, UINT32 handle, UINT32 *status);

    INT32 aweOS_ctrlGetStatus(const AWEOSInstance *pAWEOS, UINT32 handle, UINT32 *status);

    INT32 aweOS_ctrlSetValueMask(const AWEOSInstance *pAWEOS, UINT32 handle, void *value, INT32 arrayOffset, UINT32 length, UINT32 mask);

    INT32 aweOS_ctrlGetValueMask(const AWEOSInstance *pAWEOS, UINT32 handle, void *value, INT32 arrayOffset, UINT32 length, UINT32 mask);

    INT32 aweOS_ctrlGetModuleClass(const AWEOSInstance *pAWEOS, UINT32 handle, UINT32 *pClassID);

    INT32 aweOS_destroy(AWEOSInstance **pAWEOS);

    INT32 aweOS_setProfilingStatus(AWEOSInstance *pAWEOS, UINT32 status);

    INT32 aweOS_getAverageLayoutCycles(AWEOSInstance *pAWEOS, UINT32 idx, UINT32 * averageCycles);

    void aweOS_getVersion(AWEOSVersionInfo_t * versionInfo);

    INT32 aweOS_audioRecordingEnable(AWEOSInstance * pAWEOS, char* path, char* baseName, UINT32 bufferLength, SampleType sampleType);

    INT32 aweOS_audioRecordingRegisterNotificationCallback(AWEOSInstance * pAWEOS, recordNotificationCallbackFunction recordNotificationCallback, UINT32 recordNotificationMask);

    INT32 aweOS_audioRecordingDisable(AWEOSInstance *pAWEOS);

    INT32 aweOS_wavFileOpen(const char *file, FLOAT32 *sampleRate, UINT32 *numChannels, UINT32 *sampleSize, UINT32 *numSamples, FILE ** fp);

    INT32 aweOS_wavFileCreate(const char *file, FLOAT32 sampleRate, UINT32 numChannels, UINT32 sampleSize, FILE ** fp);

    INT32 aweOS_wavFileWrite(FILE * fp, void * samples, UINT32 numSamples, UINT32 sampleSize);

    INT32 aweOS_wavFileRead(FILE * fp, void * samples, UINT32 numSamples, UINT32 sampleSize);

    INT32 aweOS_wavFileClose(FILE * fp);

    INT32 aweOS_setInstancesInfo(AWEOSInstance **pInstances, INT32 numInstances);

    /*------------------AWEOS LOGGING------------------*/
    #include "AWELoggingDefs.h"

    typedef void (*cbAweOSLogging_t)(AWEOSInstance* pAWEOS, INT32 level, UINT32 type, void* payload, INT32 payloadSizeInBytes);

    INT32 aweOS_registerLoggingCallback(AWEOSInstance* pAWEOS, cbAweOSLogging_t cbAweOSLogging, INT32 logLevel, UINT32 logTypeMask);


    /*------------------AWEOS EVENTS ------------------*/

    typedef INT32(*cbAweOSEventTrigger_t)(AWEOSInstance* pAWEOS, INT32 eventType, UINT32 moduleObjId, void* payload, INT32 payloadSizeInBytes, void* userHandle);


    typedef INT32 (*cbAweOSEventRegister_t)(AWEOSInstance* pAWEOS, INT32 eventType, UINT32 moduleObjId, INT32 payloadSizeInBytes, void** userHandle);

    typedef INT32 (*cbAweOSEventDeregister_t)(AWEOSInstance* pAWEOS, INT32 eventType, UINT32 moduleObjId, void** userHandle);

    INT32 aweOS_registerEventCallbacks(AWEOSInstance* pAWEOS, cbAweOSEventTrigger_t cbAweOSEventTrigger, cbAweOSEventRegister_t cbAweOSEventRegister, cbAweOSEventDeregister_t cbAweOSEventDeregister);

#ifdef __cplusplus
}
#endif

#endif // AWECOREOS_H_