AWECoreOS 8.A.4 User's Guide
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
39 extern "C"
40 {
41 #endif
42 
43 
50  #define TUNING_LOG_ERROR 1
51 
52  #define TUNING_LOG_INFO 2
53 
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)
74 
75  #define AUDIO_RECORDING_NOTIFICATION_XRUNS (1 << 1)
76 
77  #define AUDIO_RECORDING_NOTIFICATION_ALL (AUDIO_RECORDING_NOTIFICATION_ERRORS | AUDIO_RECORDING_NOTIFICATION_XRUNS)
78 
79 
81  typedef struct AWEOSVersionInfo
82  {
83 
84  INT32 tuningVer;
85  char majorVer;
86  INT32 minorVer;
87  INT32 procVer;
88  INT32 buildNumber;
89  const char * textVer;
91 
92 
95  typedef void AWEOSInstance;
96 
105  typedef struct AWEOSConfigParameters
106  {
107 
108  UINT32 *pFastHeapA;
109  UINT32 *pFastHeapB;
110  UINT32 *pSlowHeap;
111  UINT32 fastHeapASize;
112  UINT32 fastHeapBSize;
113  UINT32 slowHeapSize;
114  INT32(*cbAudioStart)(AWEOSInstance *pAWEOS);
115  INT32(*cbAudioStop)(AWEOSInstance *pAWEOS);
116  UINT32 *pPacketBuffer;
117  UINT32 *pReplyBuffer;
119  UINT32 userVersion;
120  float coreSpeed;
121  float profileSpeed;
122  const char *pName;
123  UINT32 numThreads;
124  float sampleRate;
126  UINT32 inChannels;
127  UINT32 outChannels;
128  INT32 instanceId;
130 
150 
163  INT32 aweOS_init(AWEOSInstance **pAWEOS, const AWEOSConfigParameters *aweParams, const void* pModuleDescriptorTable, UINT32 moduleDescriptorTableSize);
164 
178  INT32 aweOS_tuningSocketOpen(AWEOSInstance** pAWEOS, INT32 portNo, UINT32 numInstances);
179 
188 
200  INT32 aweOS_tuningLoggingEnable(AWEOSInstance *pAWEOS, char* path, char* baseName, UINT32 verbosity);
201 
211  INT32 aweOS_loadAWBFromArray(AWEOSInstance *pAWEOS, const UINT32 *pArray, UINT32 arraySize, UINT32 * pErrorOffset);
212 
213 
221  INT32 aweOS_loadAWBFile(AWEOSInstance *pAWEOS, const char *binaryFile, UINT32 *pErrorOffset);
222 
230  INT32 aweOS_layoutGetChannelCount(const AWEOSInstance *pAWEOS, UINT32 *inCount, UINT32 *outCount);
231 
239  INT32 aweOS_layoutGetBlockSize(const AWEOSInstance *pAWEOS, UINT32 *blockSize);
240 
248  INT32 aweOS_layoutGetSampleRate(const AWEOSInstance *pAWEOS, FLOAT32 *sampleRate);
249 
265 
266 
287  INT32 aweOS_audioImportSamples(AWEOSInstance *pAWEOS, void *inSamples, INT32 inStride, INT32 channel, SampleType inType);
288 
311  INT32 aweOS_audioExportSamples(AWEOSInstance *pAWEOS, void *outSamples, INT32 outStride, INT32 channel, SampleType outType);
312 
320  INT32 aweOS_layoutIsValid(const AWEOSInstance *pAWEOS);
321 
328  INT32 aweOS_audioIsStarted(const AWEOSInstance *pAWEOS);
329 
335  const char* aweOS_errorToString(INT32 errorCode);
336 
345 
356  INT32 aweOS_ctrlSetValue(const AWEOSInstance *pAWEOS, UINT32 handle, void *value, INT32 arrayOffset, UINT32 length);
357 
368  INT32 aweOS_ctrlGetValue(const AWEOSInstance *pAWEOS, UINT32 handle, void *value, INT32 arrayOffset, UINT32 length);
369 
386  INT32 aweOS_ctrlSetStatus(const AWEOSInstance *pAWEOS, UINT32 handle, UINT32 *status);
387 
396  INT32 aweOS_ctrlGetStatus(const AWEOSInstance *pAWEOS, UINT32 handle, UINT32 *status);
397 
409  INT32 aweOS_ctrlSetValueMask(const AWEOSInstance *pAWEOS, UINT32 handle, void *value, INT32 arrayOffset, UINT32 length, UINT32 mask);
410 
422  INT32 aweOS_ctrlGetValueMask(const AWEOSInstance *pAWEOS, UINT32 handle, void *value, INT32 arrayOffset, UINT32 length, UINT32 mask);
423 
431  INT32 aweOS_ctrlGetModuleClass(const AWEOSInstance *pAWEOS, UINT32 handle, UINT32 *pClassID);
432 
438  INT32 aweOS_destroy(AWEOSInstance *pAWEOS);
439 
447  INT32 aweOS_setProfilingStatus(AWEOSInstance *pAWEOS, UINT32 enable);
448 
457  INT32 aweOS_getAverageLayoutCycles(AWEOSInstance *pAWEOS, UINT32 idx, UINT32 * averageCycles);
458 
467 
486  INT32 aweOS_audioRecordingEnable(AWEOSInstance * pAWEOS, char* path, char* baseName, UINT32 bufferLength, SampleType sampleType);
487 
497  INT32 aweOS_audioRecordingRegisterNotificationCallback(AWEOSInstance * pAWEOS, recordNotificationCallbackFunction recordNotificationCallback, UINT32 recordNotificationMask);
498 
506 
519  INT32 aweOS_wavFileOpen(const char *file, FLOAT32 *sampleRate, UINT32 *numChannels, UINT32 *sampleSize, UINT32 *numSamples, FILE ** fp);
520 
532  INT32 aweOS_wavFileCreate(const char *file, FLOAT32 sampleRate, UINT32 numChannels, UINT32 sampleSize, FILE ** fp);
533 
542  INT32 aweOS_wavFileWrite(FILE * fp, void * samples, UINT32 numSamples, UINT32 sampleSize);
543 
552  INT32 aweOS_wavFileRead(FILE * fp, void * samples, UINT32 numSamples, UINT32 sampleSize);
553 
559  INT32 aweOS_wavFileClose(FILE * fp);
560 
563 #ifdef __cplusplus
564 }
565 #endif
566 
567 #endif // AWECOREOS_H_
AWEOSAudioRecordNotification::notificationStatus
STATUS notificationStatus
type of notification being reported
Definition: AWECoreOS.h:63
aweOS_getAverageLayoutCycles
INT32 aweOS_getAverageLayoutCycles(AWEOSInstance *pAWEOS, UINT32 idx, UINT32 *averageCycles)
Get the average cycles of a running layout, in units of cycles at profileSpeed.
AWEOSVersionInfo::tuningVer
INT32 tuningVer
Tuning version.
Definition: AWECoreOS.h:84
AWEOSConfigParameters::fundamentalBlockSize
UINT32 fundamentalBlockSize
Fundamental block size of audio driver.
Definition: AWECoreOS.h:125
AWEOSVersionInfo::textVer
const char * textVer
String of form: "AWECoreOS Version 8.A.1.1 -- Build Number 1234".
Definition: AWECoreOS.h:89
AWEOSConfigParameters::pPacketBuffer
UINT32 * pPacketBuffer
Pointer to packet buffer.
Definition: AWECoreOS.h:116
aweOS_tuningSocketClose
void aweOS_tuningSocketClose(AWEOSInstance *pAWEOS)
Close a running integrated TCP tuning socket.
aweOS_ctrlGetValueMask
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.
AWEOSConfigParameters::instanceId
INT32 instanceId
ID number of instance.
Definition: AWECoreOS.h:128
aweOS_ctrlGetStatus
INT32 aweOS_ctrlGetStatus(const AWEOSInstance *pAWEOS, UINT32 handle, UINT32 *status)
Get the status of a module.
ProxyIDs.h
A list of all AWE Server Commands.
aweOS_audioImportSamples
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.
AWEOSVersionInfo
Versioning structure returned by aweOS_getVersion.
Definition: AWECoreOS.h:82
aweOS_layoutGetChannelCount
INT32 aweOS_layoutGetChannelCount(const AWEOSInstance *pAWEOS, UINT32 *inCount, UINT32 *outCount)
Returns the number of input and output channels in the loaded layout.
AWEOSConfigParameters::sampleRate
float sampleRate
Sample rate of audio device.
Definition: AWECoreOS.h:124
recordNotificationCallbackFunction
void(* recordNotificationCallbackFunction)(AWEOSAudioRecordNotification_t *)
Audio recording notification callback type.
Definition: AWECoreOS.h:70
AWEOSVersionInfo::procVer
INT32 procVer
Processor specific version.
Definition: AWECoreOS.h:87
aweOS_audioRecordingDisable
INT32 aweOS_audioRecordingDisable(AWEOSInstance *pAWEOS)
Disable recording of input and output audio of AWEOSInstance.
aweOS_ctrlGetValue
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.
AWEOSConfigParameters::numThreads
UINT32 numThreads
Maximum number of supported sublayouts.
Definition: AWECoreOS.h:123
AWEOSAudioRecordNotification
Audio recording notification callback argument structure.
Definition: AWECoreOS.h:62
aweOS_setProfilingStatus
INT32 aweOS_setProfilingStatus(AWEOSInstance *pAWEOS, UINT32 enable)
Enable or disable the profiling ability of the AWE Core OS Instance.
AWEOSConfigParameters::pName
const char * pName
Name of target.
Definition: AWECoreOS.h:122
AWEOSAudioRecordNotification::xrunTime
FLOAT32 xrunTime
time in seconds of xrun in recording - 0 if error
Definition: AWECoreOS.h:66
AWEOSVersionInfo::majorVer
char majorVer
Major API version (single letter)
Definition: AWECoreOS.h:85
aweOS_wavFileWrite
INT32 aweOS_wavFileWrite(FILE *fp, void *samples, UINT32 numSamples, UINT32 sampleSize)
Write audio data to .wav file created using aweOS_wavFileCreate.
AWEOSAudioRecordNotification_t
struct AWEOSAudioRecordNotification AWEOSAudioRecordNotification_t
Audio recording notification callback argument structure.
aweOS_getVersion
void aweOS_getVersion(AWEOSVersionInfo_t *versionInfo)
Get the version information of the AWE Core OS library.
AWEOSConfigParameters::fastHeapBSize
UINT32 fastHeapBSize
Size of fast heap B in 32-bit words.
Definition: AWECoreOS.h:112
aweOS_ctrlSetValue
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.
aweOS_ctrlGetModuleClass
INT32 aweOS_ctrlGetModuleClass(const AWEOSInstance *pAWEOS, UINT32 handle, UINT32 *pClassID)
Get a module's object class from its handle.
AWEOSConfigParameters::inChannels
UINT32 inChannels
Number of input channels of audio device.
Definition: AWECoreOS.h:126
aweOS_wavFileCreate
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.
Errors.h
A list of all possible Audio Weaver errors and their IDs.
aweOS_wavFileRead
INT32 aweOS_wavFileRead(FILE *fp, void *samples, UINT32 numSamples, UINT32 sampleSize)
Read audio data from .wav file opened using aweOS_wavFileOpen.
AWEOSInstance
void AWEOSInstance
The AWE Core OS Instance instance type.
Definition: AWECoreOS.h:95
aweOS_audioRecordingRegisterNotificationCallback
INT32 aweOS_audioRecordingRegisterNotificationCallback(AWEOSInstance *pAWEOS, recordNotificationCallbackFunction recordNotificationCallback, UINT32 recordNotificationMask)
Register a callback function for audio recording event notificiations.
aweOS_getParamDefaults
INT32 aweOS_getParamDefaults(AWEOSConfigParameters *aweParams)
Populates an AWEOSConfigParameters structure with defaults.
AWEOSConfigParameters::pFastHeapB
UINT32 * pFastHeapB
Pointer to fast heap B.
Definition: AWECoreOS.h:109
AWEOSConfigParameters::profileSpeed
float profileSpeed
Application profiling speed in Hz.
Definition: AWECoreOS.h:121
STATUS
STATUS
Audio recording notification status type.
Definition: AWECoreOS.h:58
aweOS_layoutGetBlockSize
INT32 aweOS_layoutGetBlockSize(const AWEOSInstance *pAWEOS, UINT32 *blockSize)
Returns the block size of the loaded layout.
aweOS_tuningSocketOpen
INT32 aweOS_tuningSocketOpen(AWEOSInstance **pAWEOS, INT32 portNo, UINT32 numInstances)
Initialize and open an integrated TCP/IP tuning interface socket.
AWEOSConfigParameters::pSlowHeap
UINT32 * pSlowHeap
Pointer to slow heap.
Definition: AWECoreOS.h:110
aweOS_ctrlSetStatus
INT32 aweOS_ctrlSetStatus(const AWEOSInstance *pAWEOS, UINT32 handle, UINT32 *status)
Set the status of a module.
AWEOSConfigParameters::packetBufferSize
UINT32 packetBufferSize
Size of packet buffers.
Definition: AWECoreOS.h:118
aweOS_audioExportSamples
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.
AWEOSAudioRecordNotification::xruns
UINT32 xruns
total xruns on recording stream - 0 if error
Definition: AWECoreOS.h:65
aweOS_tuningPacketProcess
INT32 aweOS_tuningPacketProcess(AWEOSInstance *pAWEOS)
Process the packet buffer in the AWEOSInstance.
aweOS_layoutIsValid
INT32 aweOS_layoutIsValid(const AWEOSInstance *pAWEOS)
Determines if a layout is loaded and valid.
AWEOSConfigParameters::cbAudioStop
INT32(* cbAudioStop)(AWEOSInstance *pAWEOS)
Pointer to user created callback function for audio stop commands.
Definition: AWECoreOS.h:115
aweOS_tuningLoggingEnable
INT32 aweOS_tuningLoggingEnable(AWEOSInstance *pAWEOS, char *path, char *baseName, UINT32 verbosity)
Enable logging of the tuning packets sent and received by the AWEOSInstance.
aweOS_ctrlSetValueMask
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.
AWEOSVersionInfo::buildNumber
INT32 buildNumber
Library build number.
Definition: AWECoreOS.h:88
aweOS_init
INT32 aweOS_init(AWEOSInstance **pAWEOS, const AWEOSConfigParameters *aweParams, const void *pModuleDescriptorTable, UINT32 moduleDescriptorTableSize)
Initialize the AWEOSInstance with the specified configuration parameters.
AWEOSConfigParameters::outChannels
UINT32 outChannels
Number of output channels of audio device.
Definition: AWECoreOS.h:127
AWEOSConfigParameters
AWEOSConfigParameters.
Definition: AWECoreOS.h:106
aweOS_loadAWBFromArray
INT32 aweOS_loadAWBFromArray(AWEOSInstance *pAWEOS, const UINT32 *pArray, UINT32 arraySize, UINT32 *pErrorOffset)
Executes packet commands from an in-memory array.
AWEOSConfigParameters::userVersion
UINT32 userVersion
User specified version number.
Definition: AWECoreOS.h:119
aweOS_destroy
INT32 aweOS_destroy(AWEOSInstance *pAWEOS)
Destroys the AWEOSInstance and closes all associated threads.
AWEOSConfigParameters
struct AWEOSConfigParameters AWEOSConfigParameters
AWEOSConfigParameters.
aweOS_errorToString
const char * aweOS_errorToString(INT32 errorCode)
Convert an error code (INT32) to its corresponding error string.
aweOS_layoutGetSampleRate
INT32 aweOS_layoutGetSampleRate(const AWEOSInstance *pAWEOS, FLOAT32 *sampleRate)
Returns the sample rate of the loaded layout.
aweOS_wavFileOpen
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.
AWEOSConfigParameters::slowHeapSize
UINT32 slowHeapSize
Size of slow heap in 32-bit words.
Definition: AWECoreOS.h:113
aweOS_audioPumpAll
INT32 aweOS_audioPumpAll(AWEOSInstance *pAWEOS)
Pump one fundamental block size of audio through the loaded layout and all of its sublayouts.
AWEOSConfigParameters::pFastHeapA
UINT32 * pFastHeapA
Pointer to fast heap A.
Definition: AWECoreOS.h:108
AWEOSConfigParameters::fastHeapASize
UINT32 fastHeapASize
Size of fast heap A in 32-bit words.
Definition: AWECoreOS.h:111
aweOS_audioRecordingEnable
INT32 aweOS_audioRecordingEnable(AWEOSInstance *pAWEOS, char *path, char *baseName, UINT32 bufferLength, SampleType sampleType)
Enables recording of all input and output audio of AWEOSInstance.
AWEOSConfigParameters::cbAudioStart
INT32(* cbAudioStart)(AWEOSInstance *pAWEOS)
Pointer to user created callback function for audio start commands.
Definition: AWECoreOS.h:114
AWEOSVersionInfo::minorVer
INT32 minorVer
Minor API version.
Definition: AWECoreOS.h:86
aweOS_wavFileClose
INT32 aweOS_wavFileClose(FILE *fp)
Close the.wav file opened using aweOS_wavFileOpen or aweOS_wavFileCreate.
aweOS_loadAWBFile
INT32 aweOS_loadAWBFile(AWEOSInstance *pAWEOS, const char *binaryFile, UINT32 *pErrorOffset)
Executes packet commands from an AWB file on the filesystem.
AWEOSAudioRecordNotification::error
INT32 error
error value - 0 if xrun
Definition: AWECoreOS.h:64
AWEOSVersionInfo_t
struct AWEOSVersionInfo AWEOSVersionInfo_t
Versioning structure returned by aweOS_getVersion.
AWEOSConfigParameters::coreSpeed
float coreSpeed
Processor clock speed in Hz.
Definition: AWECoreOS.h:120
AWEOSConfigParameters::pReplyBuffer
UINT32 * pReplyBuffer
Pointer to reply packet buffer.
Definition: AWECoreOS.h:117
aweOS_audioIsStarted
INT32 aweOS_audioIsStarted(const AWEOSInstance *pAWEOS)
Check if this instance has received an Audio Start command.