Engage Engine API  1.244.9084
Loading...
Searching...
No Matches
EngageAudioDevice.h File Reference

Custom Audio Devices. More...

#include <stdint.h>

Go to the source code of this file.

Macros

#define ENGAGE_API   __attribute__ ((visibility ("default")))
 

Typedefs

typedef int(* PFN_ENGAGE_AUDIO_DEVICE_CTL) (int16_t deviceId, int16_t instanceId, EngageAudioDeviceCtlOp_t op, uintptr_t p1)
 Audio Device Control instance pointer.
 

Enumerations

enum  EngageAudioDeviceCtlOp_t {
  eadCreateInstance = 1 , eadDestroyInstance , eadStart , eadStop ,
  eadPause , eadResume , eadReset , eadRestart
}
 Audio Device Control Operation enum. More...
 

Functions

ENGAGE_API int16_t engageAudioDeviceRegister (const char *jsonConfiguration, PFN_ENGAGE_AUDIO_DEVICE_CTL pfnCtl)
 [SYNC] Registers an Audio Device with the Engine
 
ENGAGE_API int16_t engageAudioDeviceUnregister (int16_t deviceId)
 [SYNC] Unregisters a virtual audio device
 
ENGAGE_API int16_t engageAudioDeviceWriteBuffer (int16_t deviceId, int16_t instanceId, const int16_t *buffer, size_t samples)
 [SYNC] Writes a buffer of audio to the audio device
 
ENGAGE_API int16_t engageAudioDeviceReadBuffer (int16_t deviceId, int16_t instanceId, int16_t *buffer, size_t samples)
 [SYNC] Reads a buffer of audio from the audio device
 

Variables

static const int ENGAGE_AUDIO_DEVICE_RESULT_OK = 0
 Everything is fine.
 
static const int ENGAGE_AUDIO_DEVICE_GENERAL_ERROR = -1
 A general error occurred.
 
static const int ENGAGE_AUDIO_DEVICE_INVALID_CONFIGURATION = -2
 Unable to register device due to invalid configuration.
 
static const int ENGAGE_AUDIO_DEVICE_INVALID_DEVICE_ID = -3
 Invalid deviceId.
 
static const int ENGAGE_AUDIO_DEVICE_INVALID_INSTANCE_ID = -4
 Invalid instanceId.
 
static const int ENGAGE_AUDIO_DEVICE_INVALID_COMBINED_DEVICE_ID_AND_INSTANCE_ID = -5
 Invalid deviceId and instanceId.
 
static const int ENGAGE_AUDIO_DEVICE_INVALID_OPERATION = -6
 An invalid operation has been attempted.
 

Detailed Description

Custom Audio Devices.

TODO: Shaun, can you please review this whole file?

Definition in file EngageAudioDevice.h.

Macro Definition Documentation

◆ ENGAGE_API

#define ENGAGE_API   __attribute__ ((visibility ("default")))

Definition at line 31 of file EngageAudioDevice.h.

Typedef Documentation

◆ PFN_ENGAGE_AUDIO_DEVICE_CTL

typedef int(* PFN_ENGAGE_AUDIO_DEVICE_CTL) (int16_t deviceId, int16_t instanceId, EngageAudioDeviceCtlOp_t op, uintptr_t p1)

Audio Device Control instance pointer.

TODO: Shaun, want to add something?

Definition at line 119 of file EngageAudioDevice.h.

Enumeration Type Documentation

◆ EngageAudioDeviceCtlOp_t

Audio Device Control Operation enum.

More detailed enum description.

Enumerator
eadCreateInstance 

Create an audio device instance.

eadDestroyInstance 

Destroy an audio device instance.

eadStart 

Start playback.

eadStop 

Stop playback.

eadPause 

Pause playback

eadResume 

Resume playback.

eadReset 

Reset an audio device - TODO:Shaun.

eadRestart 

Restart an audio device - TODO:Shaun.

Definition at line 39 of file EngageAudioDevice.h.

Function Documentation

◆ engageAudioDeviceReadBuffer()

ENGAGE_API int16_t engageAudioDeviceReadBuffer ( int16_t deviceId,
int16_t instanceId,
int16_t * buffer,
size_t samples )

[SYNC] Reads a buffer of audio from the audio device

TODO:Shaun, do we need any more details on the size of the buffer and samples calculation?

Parameters
deviceIddevice identifier returned by engageAudioDeviceRegister
instanceIdinstance identifier
bufferPointer to a buffer containing the audio
samplesThe number of samples contained in the buffer
Returns
ENGAGE_AUDIO_DEVICE_RESULT_OK if successful

◆ engageAudioDeviceRegister()

ENGAGE_API int16_t engageAudioDeviceRegister ( const char * jsonConfiguration,
PFN_ENGAGE_AUDIO_DEVICE_CTL pfnCtl )

[SYNC] Registers an Audio Device with the Engine

The jsonConfiguration JSON configuration object contains the configuration for the virtual audio device and the pfnCtl is a pointer to a control structure used to manage the audio device instance.

Parameters
jsonConfigurationpointer to JSON Audio Device configuration object ConfigurationObjects::AudioDeviceDescriptor
pfnCtlpointer to an Audio Device Control instance
See also
PFN_ENGAGE_AUDIO_DEVICE_CTL
Returns
ENGAGE_AUDIO_DEVICE_RESULT_OK if successful TODO:Shaun is this correct>

◆ engageAudioDeviceUnregister()

ENGAGE_API int16_t engageAudioDeviceUnregister ( int16_t deviceId)

[SYNC] Unregisters a virtual audio device

Unregisters the virtual audio device created by engageAudioDeviceRegister

Parameters
deviceIddevice identifier returned engageAudioDeviceRegister
Returns
ENGAGE_AUDIO_DEVICE_RESULT_OK TODO:Shaun

◆ engageAudioDeviceWriteBuffer()

ENGAGE_API int16_t engageAudioDeviceWriteBuffer ( int16_t deviceId,
int16_t instanceId,
const int16_t * buffer,
size_t samples )

[SYNC] Writes a buffer of audio to the audio device

TODO:Shaun, do we need any more details on the size of the buffer and samples calculation?

Parameters
deviceIddevice identifier returned by engageAudioDeviceRegister
instanceIdinstance identifier
bufferPointer to a buffer containing the audio
samplesThe number of samples contained in the buffer
Returns
ENGAGE_AUDIO_DEVICE_RESULT_OK if successful

Variable Documentation

◆ ENGAGE_AUDIO_DEVICE_GENERAL_ERROR

const int ENGAGE_AUDIO_DEVICE_GENERAL_ERROR = -1
static

A general error occurred.

This could be due to a number of reasons. See debug output logs for more information.

Definition at line 77 of file EngageAudioDevice.h.

◆ ENGAGE_AUDIO_DEVICE_INVALID_COMBINED_DEVICE_ID_AND_INSTANCE_ID

const int ENGAGE_AUDIO_DEVICE_INVALID_COMBINED_DEVICE_ID_AND_INSTANCE_ID = -5
static

Invalid deviceId and instanceId.

Both deviceId and instanceId used are no longer valid. See debug output logs for more information.

Definition at line 105 of file EngageAudioDevice.h.

◆ ENGAGE_AUDIO_DEVICE_INVALID_CONFIGURATION

const int ENGAGE_AUDIO_DEVICE_INVALID_CONFIGURATION = -2
static

Unable to register device due to invalid configuration.

This could be due to a number of reasons. See debug output logs for more information.

Definition at line 84 of file EngageAudioDevice.h.

◆ ENGAGE_AUDIO_DEVICE_INVALID_DEVICE_ID

const int ENGAGE_AUDIO_DEVICE_INVALID_DEVICE_ID = -3
static

Invalid deviceId.

The deviceId used is no longer valid. See debug output logs for more information.

Definition at line 91 of file EngageAudioDevice.h.

◆ ENGAGE_AUDIO_DEVICE_INVALID_INSTANCE_ID

const int ENGAGE_AUDIO_DEVICE_INVALID_INSTANCE_ID = -4
static

Invalid instanceId.

The instanceId used is no longer valid. See debug output logs for more information.

Definition at line 98 of file EngageAudioDevice.h.

◆ ENGAGE_AUDIO_DEVICE_INVALID_OPERATION

const int ENGAGE_AUDIO_DEVICE_INVALID_OPERATION = -6
static

An invalid operation has been attempted.

An invalid operation was attempted, please make sure you use a valid operation from EngageAudioDeviceCtlOp_t enum and that the device is in the correct state. See debug output logs for more information.

Definition at line 112 of file EngageAudioDevice.h.

◆ ENGAGE_AUDIO_DEVICE_RESULT_OK

const int ENGAGE_AUDIO_DEVICE_RESULT_OK = 0
static

Everything is fine.

The operation executed without any errors.

Definition at line 70 of file EngageAudioDevice.h.