AWE Core OS 8.B.19 Documentation
AWECoreOS.h
Go to the documentation of this file.
1/*******************************************************************************
2*
3* AWE Core OS API
4* ---------------
5*
6********************************************************************************
7* AWECoreOS.h
8********************************************************************************
9*
10* Description: The AWE Core OS API header file.
11*
12* Copyright: (c) 2007-2021 DSP Concepts, Inc. All rights reserved.
13* 3235 Kifer Road
14* Santa Clara, CA 95054
15*
16*******************************************************************************/
17
23#ifndef AWECOREOS_H_
24#define AWECOREOS_H_
25
26#include "StandardDefs.h"
27#include "stdio.h"
28#include <string.h>
29#include <unistd.h>
30#include <sys/types.h>
31#include <sys/socket.h>
32#include <netinet/in.h>
33#include "Errors.h"
34#include <sched.h>
35#include "ProxyIDs.h"
36#include <semaphore.h>
37
38#ifdef __cplusplus
39extern "C"
40{
41#endif
42
43
50 #define TUNING_LOG_ERROR 1
52 #define TUNING_LOG_INFO 2
54 #define TUNING_LOG_DATA 3
55
56
58 typedef enum {ERROR, INPUT_OVERRUN, OUTPUT_OVERRUN} STATUS;
59
62 {
64 INT32 error;
65 UINT32 xruns;
66 FLOAT32 xrunTime;
68
71
73 #define AUDIO_RECORDING_NOTIFICATION_ERRORS (1 << 0)
75 #define AUDIO_RECORDING_NOTIFICATION_XRUNS (1 << 1)
77 #define AUDIO_RECORDING_NOTIFICATION_ALL (AUDIO_RECORDING_NOTIFICATION_ERRORS | AUDIO_RECORDING_NOTIFICATION_XRUNS)
78
80 typedef struct AWEOSThreadPIDs
81 {
87
89 typedef struct AWEOSVersionInfo
90 {
91
92 INT32 tuningVer;
93 char majorVer;
94 INT32 minorVer;
95 INT32 procVer;
97 const char * textVer;
99
100
103 typedef void AWEOSInstance;
104
114 {
115
116 UINT32 *pFastHeapA;
117 UINT32 *pFastHeapB;
118 UINT32 *pSlowHeap;
122 INT32(*cbAudioStart)(AWEOSInstance *pAWEOS);
123 INT32(*cbAudioStop)(AWEOSInstance *pAWEOS);
125 UINT32 *pReplyBuffer;
127 UINT32 userVersion;
128 float coreSpeed;
130 const char *pName;
131 UINT32 numThreads;
134 UINT32 inChannels;
135 UINT32 outChannels;
138
161
174
186 INT32 aweOS_init(AWEOSInstance **pAWEOS, const AWEOSConfigParameters *aweParams, const void* pModuleDescriptorTable, UINT32 moduleDescriptorTableSize);
187
201 INT32 aweOS_tuningSocketOpen(AWEOSInstance** pAWEOS, INT32 portNo, UINT32 numInstances);
202
211
223 INT32 aweOS_tuningLoggingEnable(AWEOSInstance *pAWEOS, char* path, char* baseName, UINT32 verbosity);
224
235 INT32 aweOS_loadAWBFromArray(AWEOSInstance *pAWEOS, const UINT32 *pArray, UINT32 arraySize, UINT32 * pErrorOffset);
236
237
246 INT32 aweOS_loadAWBFile(AWEOSInstance *pAWEOS, const char *binaryFile, UINT32 *pErrorOffset);
247
255 INT32 aweOS_layoutGetChannelCount(const AWEOSInstance *pAWEOS, UINT32 *inCount, UINT32 *outCount);
256
264 INT32 aweOS_layoutGetBlockSize(const AWEOSInstance *pAWEOS, UINT32 *blockSize);
265
273 INT32 aweOS_layoutGetSampleRate(const AWEOSInstance *pAWEOS, FLOAT32 *sampleRate);
274
290
291
312 INT32 aweOS_audioImportSamples(AWEOSInstance *pAWEOS, void *inSamples, INT32 inStride, INT32 channel, SampleType inType);
313
336 INT32 aweOS_audioExportSamples(AWEOSInstance *pAWEOS, void *outSamples, INT32 outStride, INT32 channel, SampleType outType);
337
345 INT32 aweOS_layoutIsValid(const AWEOSInstance *pAWEOS);
346
354
360 const char* aweOS_errorToString(INT32 errorCode);
361
370
381 INT32 aweOS_ctrlSetValue(const AWEOSInstance *pAWEOS, UINT32 handle, void *value, INT32 arrayOffset, UINT32 length);
382
393 INT32 aweOS_ctrlGetValue(const AWEOSInstance *pAWEOS, UINT32 handle, void *value, INT32 arrayOffset, UINT32 length);
394
411 INT32 aweOS_ctrlSetStatus(const AWEOSInstance *pAWEOS, UINT32 handle, UINT32 *status);
412
421 INT32 aweOS_ctrlGetStatus(const AWEOSInstance *pAWEOS, UINT32 handle, UINT32 *status);
422
434 INT32 aweOS_ctrlSetValueMask(const AWEOSInstance *pAWEOS, UINT32 handle, void *value, INT32 arrayOffset, UINT32 length, UINT32 mask);
435
447 INT32 aweOS_ctrlGetValueMask(const AWEOSInstance *pAWEOS, UINT32 handle, void *value, INT32 arrayOffset, UINT32 length, UINT32 mask);
448
456 INT32 aweOS_ctrlGetModuleClass(const AWEOSInstance *pAWEOS, UINT32 handle, UINT32 *pClassID);
457
464
474 INT32 aweOS_setProfilingStatus(AWEOSInstance *pAWEOS, UINT32 status);
475
484 INT32 aweOS_getAverageLayoutCycles(AWEOSInstance *pAWEOS, UINT32 idx, UINT32 * averageCycles);
485
494
513 INT32 aweOS_audioRecordingEnable(AWEOSInstance * pAWEOS, char* path, char* baseName, UINT32 bufferLength, SampleType sampleType);
514
524 INT32 aweOS_audioRecordingRegisterNotificationCallback(AWEOSInstance * pAWEOS, recordNotificationCallbackFunction recordNotificationCallback, UINT32 recordNotificationMask);
525
533
546 INT32 aweOS_wavFileOpen(const char *file, FLOAT32 *sampleRate, UINT32 *numChannels, UINT32 *sampleSize, UINT32 *numSamples, FILE ** fp);
547
559 INT32 aweOS_wavFileCreate(const char *file, FLOAT32 sampleRate, UINT32 numChannels, UINT32 sampleSize, FILE ** fp);
560
569 INT32 aweOS_wavFileWrite(FILE * fp, void * samples, UINT32 numSamples, UINT32 sampleSize);
570
579 INT32 aweOS_wavFileRead(FILE * fp, void * samples, UINT32 numSamples, UINT32 sampleSize);
580
586 INT32 aweOS_wavFileClose(FILE * fp);
587
596 INT32 aweOS_setInstancesInfo(AWEOSInstance **pInstances, INT32 numInstances);
597
600#ifdef __cplusplus
601}
602#endif
603
604#endif // AWECOREOS_H_
A list of all AWE Server Commands.
A list of all possible Audio Weaver errors and their IDs.
enum _SampleType SampleType
Type of data for I/O.
struct AWEOSVersionInfo AWEOSVersionInfo_t
Versioning structure returned by aweOS_getVersion.
void(* recordNotificationCallbackFunction)(AWEOSAudioRecordNotification_t *)
Audio recording notification callback type.
Definition: AWECoreOS.h:70
struct AWEOSThreadPIDs AWEOSThreadPIDs_t
Internal threading PID structure, meant to be used with aweOS_getThreadPIDs.
STATUS
Audio recording notification status type.
Definition: AWECoreOS.h:58
struct AWEOSAudioRecordNotification AWEOSAudioRecordNotification_t
Audio recording notification callback argument structure.
struct AWEOSConfigParameters AWEOSConfigParameters
AWEOSConfigParameters.
void AWEOSInstance
The AWE Core OS Instance instance type.
Definition: AWECoreOS.h:103
INT32 aweOS_loadAWBFromArray(AWEOSInstance *pAWEOS, const UINT32 *pArray, UINT32 arraySize, UINT32 *pErrorOffset)
Executes packet commands from an in-memory array.
INT32 aweOS_ctrlGetValue(const AWEOSInstance *pAWEOS, UINT32 handle, void *value, INT32 arrayOffset, UINT32 length)
Get a scalar or array value(s) of a module parameter by handle.
INT32 aweOS_ctrlGetModuleClass(const AWEOSInstance *pAWEOS, UINT32 handle, UINT32 *pClassID)
Get a module's object class from its handle.
INT32 aweOS_layoutGetSampleRate(const AWEOSInstance *pAWEOS, FLOAT32 *sampleRate)
Returns the sample rate of the loaded layout.
INT32 aweOS_audioExportSamples(AWEOSInstance *pAWEOS, void *outSamples, INT32 outStride, INT32 channel, SampleType outType)
Export samples to a user buffer from a specific channel of the AWEOSInstance's output pin.
INT32 aweOS_audioPumpAll(AWEOSInstance *pAWEOS)
Pump one fundamental block size of audio through the loaded layout and all of its sublayouts.
INT32 aweOS_audioIsStarted(const AWEOSInstance *pAWEOS)
Check if this instance has received an Audio Start command.
INT32 aweOS_audioRecordingDisable(AWEOSInstance *pAWEOS)
Disable recording of input and output audio of AWEOSInstance.
INT32 aweOS_init(AWEOSInstance **pAWEOS, const AWEOSConfigParameters *aweParams, const void *pModuleDescriptorTable, UINT32 moduleDescriptorTableSize)
Initialize the AWEOSInstance with the specified configuration parameters.
INT32 aweOS_audioRecordingRegisterNotificationCallback(AWEOSInstance *pAWEOS, recordNotificationCallbackFunction recordNotificationCallback, UINT32 recordNotificationMask)
Register a callback function for audio recording event notificiations.
INT32 aweOS_ctrlGetStatus(const AWEOSInstance *pAWEOS, UINT32 handle, UINT32 *status)
Get the status of a module.
INT32 aweOS_wavFileCreate(const char *file, FLOAT32 sampleRate, UINT32 numChannels, UINT32 sampleSize, FILE **fp)
Create a .wav file and populate the header with the passed in arguments.
INT32 aweOS_tuningLoggingEnable(AWEOSInstance *pAWEOS, char *path, char *baseName, UINT32 verbosity)
Enable logging of the tuning packets sent and received by the AWEOSInstance.
INT32 aweOS_ctrlSetStatus(const AWEOSInstance *pAWEOS, UINT32 handle, UINT32 *status)
Set the status of a module.
INT32 aweOS_layoutGetBlockSize(const AWEOSInstance *pAWEOS, UINT32 *blockSize)
Returns the block size of the loaded layout.
INT32 aweOS_wavFileRead(FILE *fp, void *samples, UINT32 numSamples, UINT32 sampleSize)
Read audio data from .wav file opened using aweOS_wavFileOpen.
INT32 aweOS_layoutIsValid(const AWEOSInstance *pAWEOS)
Determines if a layout is loaded and valid.
INT32 aweOS_audioRecordingEnable(AWEOSInstance *pAWEOS, char *path, char *baseName, UINT32 bufferLength, SampleType sampleType)
Enables recording of all input and output audio of AWEOSInstance.
void aweOS_tuningSocketClose(AWEOSInstance *pAWEOS)
Close a running integrated TCP tuning socket.
INT32 aweOS_wavFileWrite(FILE *fp, void *samples, UINT32 numSamples, UINT32 sampleSize)
Write audio data to .wav file created using aweOS_wavFileCreate.
INT32 aweOS_layoutGetChannelCount(const AWEOSInstance *pAWEOS, UINT32 *inCount, UINT32 *outCount)
Returns the number of input and output channels in the loaded layout.
void aweOS_getVersion(AWEOSVersionInfo_t *versionInfo)
Get the version information of the AWE Core OS library.
INT32 aweOS_tuningSocketOpen(AWEOSInstance **pAWEOS, INT32 portNo, UINT32 numInstances)
Initialize and open an integrated TCP/IP tuning interface socket.
INT32 aweOS_setInstancesInfo(AWEOSInstance **pInstances, INT32 numInstances)
Profiling related setup function only intended for systems with multiple AWEOS Instances in a single ...
INT32 aweOS_ctrlSetValueMask(const AWEOSInstance *pAWEOS, UINT32 handle, void *value, INT32 arrayOffset, UINT32 length, UINT32 mask)
Set a scalar or array value(s) of a module variable by handle with mask.
INT32 aweOS_ctrlSetValue(const AWEOSInstance *pAWEOS, UINT32 handle, void *value, INT32 arrayOffset, UINT32 length)
Set a scalar or array value(s) of a module parameter by handle.
INT32 aweOS_ctrlGetValueMask(const AWEOSInstance *pAWEOS, UINT32 handle, void *value, INT32 arrayOffset, UINT32 length, UINT32 mask)
Get a scalar or array value(s) of a module variable by handle with mask.
INT32 aweOS_tuningPacketProcess(AWEOSInstance *pAWEOS)
Process the packet buffer in the AWEOSInstance.
UINT32 aweOS_getThreadPIDs(AWEOSInstance *pAWEOS, AWEOSThreadPIDs_t *threadPIDs)
Return the PIDs of all internally spawned AWE Core OS threads.
INT32 aweOS_destroy(AWEOSInstance **pAWEOS)
Destroys the AWEOSInstance and closes all associated threads.
const char * aweOS_errorToString(INT32 errorCode)
Convert an error code (INT32) to its corresponding error string.
INT32 aweOS_audioImportSamples(AWEOSInstance *pAWEOS, void *inSamples, INT32 inStride, INT32 channel, SampleType inType)
Import samples from an audio buffer to a specific channel of the AWEOSInstance's input pin.
INT32 aweOS_setProfilingStatus(AWEOSInstance *pAWEOS, UINT32 status)
Enable or disable the profiling ability of the AWE Core OS Instance.
INT32 aweOS_wavFileOpen(const char *file, FLOAT32 *sampleRate, UINT32 *numChannels, UINT32 *sampleSize, UINT32 *numSamples, FILE **fp)
Open a .wav file and populate the user arguments with the header information in the file.
INT32 aweOS_getParamDefaults(AWEOSConfigParameters *aweParams)
Populates an AWEOSConfigParameters structure with defaults.
INT32 aweOS_getAverageLayoutCycles(AWEOSInstance *pAWEOS, UINT32 idx, UINT32 *averageCycles)
Get the average cycles of a running layout, in units of cycles at profileSpeed.
INT32 aweOS_wavFileClose(FILE *fp)
Close the.wav file opened using aweOS_wavFileOpen or aweOS_wavFileCreate.
INT32 aweOS_loadAWBFile(AWEOSInstance *pAWEOS, const char *binaryFile, UINT32 *pErrorOffset)
Executes packet commands from an AWB file on the filesystem.
Audio recording notification callback argument structure.
Definition: AWECoreOS.h:62
STATUS notificationStatus
type of notification being reported
Definition: AWECoreOS.h:63
FLOAT32 xrunTime
time in seconds of xrun in recording - 0 if error
Definition: AWECoreOS.h:66
UINT32 xruns
total xruns on recording stream - 0 if error
Definition: AWECoreOS.h:65
INT32 error
error value - 0 if xrun
Definition: AWECoreOS.h:64
Internal threading PID structure, meant to be used with aweOS_getThreadPIDs.
Definition: AWECoreOS.h:81
UINT32 socketThreadPID
PID of the internally created socket (0 if socket is not created).
Definition: AWECoreOS.h:83
UINT32 numPumpThreads
The number of running pump threads.
Definition: AWECoreOS.h:84
UINT32 * pumpThreadPIDs
Pointer to an array of the running pump thread PIDs of size pumpThreadPIDs[numPumpThreads].
Definition: AWECoreOS.h:85
UINT32 workThreadPID
PID of the workThread (the main "heartbeat" of AWECoreOS)
Definition: AWECoreOS.h:82
Versioning structure returned by aweOS_getVersion.
Definition: AWECoreOS.h:90
const char * textVer
String of form: "AWECoreOS Version 8.A.1.1 -- Build Number 1234".
Definition: AWECoreOS.h:97
char majorVer
Major API version (single letter)
Definition: AWECoreOS.h:93
INT32 procVer
Processor specific version.
Definition: AWECoreOS.h:95
INT32 minorVer
Minor API version.
Definition: AWECoreOS.h:94
INT32 tuningVer
Tuning version.
Definition: AWECoreOS.h:92
INT32 buildNumber
Library build number.
Definition: AWECoreOS.h:96
AWEOSConfigParameters.
Definition: AWECoreOS.h:114
UINT32 * pReplyBuffer
Pointer to reply packet buffer.
Definition: AWECoreOS.h:125
float profileSpeed
Application profiling speed in Hz.
Definition: AWECoreOS.h:129
UINT32 fastHeapBSize
Size of fast heap B in 32-bit words.
Definition: AWECoreOS.h:120
UINT32 userVersion
User specified version number.
Definition: AWECoreOS.h:127
UINT32 * pPacketBuffer
Pointer to packet buffer.
Definition: AWECoreOS.h:124
const char * pName
Name of target.
Definition: AWECoreOS.h:130
INT32 instanceId
ID number of instance.
Definition: AWECoreOS.h:136
float coreSpeed
Processor clock speed in Hz.
Definition: AWECoreOS.h:128
UINT32 * pFastHeapA
Pointer to fast heap A.
Definition: AWECoreOS.h:116
UINT32 numThreads
Maximum number of supported sublayouts.
Definition: AWECoreOS.h:131
UINT32 fundamentalBlockSize
Fundamental block size of audio driver.
Definition: AWECoreOS.h:133
UINT32 * pSlowHeap
Pointer to slow heap.
Definition: AWECoreOS.h:118
UINT32 outChannels
Number of output channels of audio device.
Definition: AWECoreOS.h:135
UINT32 packetBufferSize
Size of packet buffers.
Definition: AWECoreOS.h:126
UINT32 slowHeapSize
Size of slow heap in 32-bit words.
Definition: AWECoreOS.h:121
INT32(* cbAudioStop)(AWEOSInstance *pAWEOS)
Pointer to user created callback function for audio stop commands.
Definition: AWECoreOS.h:123
UINT32 * pFastHeapB
Pointer to fast heap B.
Definition: AWECoreOS.h:117
UINT32 fastHeapASize
Size of fast heap A in 32-bit words.
Definition: AWECoreOS.h:119
float sampleRate
Sample rate of audio device.
Definition: AWECoreOS.h:132
UINT32 inChannels
Number of input channels of audio device.
Definition: AWECoreOS.h:134
INT32(* cbAudioStart)(AWEOSInstance *pAWEOS)
Pointer to user created callback function for audio start commands.
Definition: AWECoreOS.h:122