Skip to content

Core

Core functionalities of the SDK

Types

Name Description
AmAlignedReal32Buffer Class that handles aligned allocations to support vectorized operations.
AmThreadHandle The AmThreadFunction signature is used to create threads.
AmVersion A structure containing the version number of the library.
AudioBuffer Represents an audio buffer containing multiple channels.
AudioBufferChannel Represents a view to a single channel in an AudioBuffer.
AwaitablePoolTask A pool task that allows a thread to wait until it finishes.
ConsoleLogger The console logger class.
HRIRSphere A 3D sphere of HRIR data.
HRIRSphereDatasetModel The model of the HRIR sphere dataset.
HRIRSphereFileHeaderDescription Provides metadata about an HRIR sphere file.
HRIRSphereVertex A vertex of the HRIR sphere.
Logger The logger class.
Pool Pool tasks scheduler class.
PoolTask Base class for pool tasks.
RefCounter Holds the number of references to an object.
SoundFormat Describe the format of an audio sample.
eAudioSampleFormat Enumerates the list of possible sample formats handled by Amplitude.
eErrorCode Enumerates the list of possible errors encountered by the library.
eHRIRSphereSamplingMode Defines how the HRIR sphere is sampled when doing Ambisonics binauralization.
eLogMessageLevel The level of a log message.
ePanningMode Enumerates the list of available panning modes.
eSpatialization Enumerates the list of available spatialization modes.

Macros

Name Description
AM_CALLBACK Declare a callback function type
AM_UNUSED Helps to avoid compiler warnings about unused values.
amLog Logs a message with the given level.
amLogCritical Logs a critical message.
amLogDebug Logs a debug message.
amLogError Logs an error message.
amLogInfo Logs an informational message.
amLogWarning Logs a warning message.
amLogger The global logger instance.
amVersion Gets the current Amplitude SDK version.

Variables

Name Description
kAm51SurroundChannelCount The number of channels in a 5.1 surround audio source.
kAm71SurroundChannelCount The number of channels in a 7.1 surround audio source.
kAmAirAbsorptionBandCount The number of air absorption bands for attenuation models.
kAmFirstOrderAmbisonicChannelCount The number of channels in first-order ambisonic source.
kAmFixedPointBits The number of bits to shift when processing audio data with floating point values.
kAmFixedPointMask Used to mask the bits when processing audio data with fixed-point values.
kAmFixedPointUnit The unit value for a 32-bit fixed-point audio sample..
kAmInvalidObjectId Invalid Amplitude object ID.
kAmMasterBusId Specifies the value of the "master" bus ID.
kAmMaxSupportedAmbisonicOrder The maximum supported ambisonic order.
kAmMaxSupportedChannelCount The maximum supported channel count for an ambisonic source.
kAmMaxSupportedFrameCount The maximum number of frames that can be processed at once.
kAmMonoChannelCount The number of channels in a mono audio source.
kAmRoomSurfaceCount The number of surfaces in a room.
kAmSecond The number of milliseconds in one second.
kAmSecondOrderAmbisonicChannelCount The number of channels in second-order ambisonic source.
kAmStereoChannelCount The number of channels in a stereo audio source.
kAmThirdOrderAmbisonicChannelCount The number of channels in third-order ambisonic source.
kEpsilon Minimum value where values lower than this are considered to be 0.
kMinFadeDuration The minimum fade duration in milliseconds.

Functions

Name Description
CreateMutex Creates a mutex object.
CreateThread Creates a new thread.
DestroyMutex Destroys a mutex object.
GetCurrentThreadId Gets the handle of the calling thread.
GetTimeMillis Gets the total execution time in milliseconds for the calling thread.
GetVersion Returns the version.
LockMutex Takes ownership of a mutex.
Release Manually stops a thread execution.
Sleep Makes the calling thread sleep for the given amount of milliseconds.
UnlockMutex Releases ownership of a mutex.
Wait Waits for the given thread to stop.

Macro Details

AM_CALLBACK

#define AM_CALLBACK(type, name)

Declare a callback function type

Parameter _type_
Return type of the function
Parameter _name_
Name of the function

Note

This must be followed by the parentheses containing the function arguments declaration

AM_UNUSED

#define AM_UNUSED(x)

Helps to avoid compiler warnings about unused values.

Parameter x
The statement where the return value is not used.

amLog

#define amLog(level, message, ...) \

Logs a message with the given level.

Parameter _level_
The level of the log message.
Parameter _message_
The message to log.
Parameter The
arguments to format the message with.

amLogCritical

#define amLogCritical(message, ...)

Logs a critical message.

Parameter _message_
The message to log.
Parameter The
arguments to format the message with.

amLogDebug

#define amLogDebug(message, ...)

Logs a debug message.

Parameter _message_
The message to log.
Parameter The
arguments to format the message with.

amLogError

#define amLogError(message, ...)

Logs an error message.

Parameter _message_
The message to log.
Parameter The
arguments to format the message with.

amLogInfo

#define amLogInfo(message, ...)

Logs an informational message.

Parameter _message_
The message to log.
Parameter The
arguments to format the message with.

amLogWarning

#define amLogWarning(message, ...)

Logs a warning message.

Parameter _message_
The message to log.
Parameter The
arguments to format the message with.

amLogger

#define amLogger

The global logger instance.

amVersion

#define amVersion

Gets the current Amplitude SDK version.

Variable Details

kAm51SurroundChannelCount

constexpr AmSize kAm51SurroundChannelCount

The number of channels in a 5.1 surround audio source.

kAm71SurroundChannelCount

constexpr AmSize kAm71SurroundChannelCount

The number of channels in a 7.1 surround audio source.

kAmAirAbsorptionBandCount

constexpr AmUInt32 kAmAirAbsorptionBandCount

The number of air absorption bands for attenuation models.

kAmFirstOrderAmbisonicChannelCount

constexpr AmSize kAmFirstOrderAmbisonicChannelCount

The number of channels in first-order ambisonic source.

kAmFixedPointBits

constexpr AmInt32 kAmFixedPointBits

The number of bits to shift when processing audio data with floating point values.

kAmFixedPointMask

constexpr AmInt32 kAmFixedPointMask

Used to mask the bits when processing audio data with fixed-point values.

kAmFixedPointUnit

constexpr AmInt32 kAmFixedPointUnit

The unit value for a 32-bit fixed-point audio sample..

kAmInvalidObjectId

constexpr AmObjectID kAmInvalidObjectId

Invalid Amplitude object ID.

kAmMasterBusId

constexpr AmBusID kAmMasterBusId

Specifies the value of the "master" bus ID.

kAmMaxSupportedAmbisonicOrder

constexpr AmUInt32 kAmMaxSupportedAmbisonicOrder

The maximum supported ambisonic order.

kAmMaxSupportedChannelCount

constexpr AmUInt32 kAmMaxSupportedChannelCount

The maximum supported channel count for an ambisonic source.

kAmMaxSupportedFrameCount

constexpr AmUInt64 kAmMaxSupportedFrameCount

The maximum number of frames that can be processed at once.

kAmMonoChannelCount

constexpr AmSize kAmMonoChannelCount

The number of channels in a mono audio source.

kAmRoomSurfaceCount

constexpr AmSize kAmRoomSurfaceCount

The number of surfaces in a room.

Warning

Only cube-shaped rooms are supported.

kAmSecond

constexpr AmTime kAmSecond

The number of milliseconds in one second.

kAmSecondOrderAmbisonicChannelCount

constexpr AmSize kAmSecondOrderAmbisonicChannelCount

The number of channels in second-order ambisonic source.

kAmStereoChannelCount

constexpr AmSize kAmStereoChannelCount

The number of channels in a stereo audio source.

kAmThirdOrderAmbisonicChannelCount

constexpr AmSize kAmThirdOrderAmbisonicChannelCount

The number of channels in third-order ambisonic source.

kEpsilon

constexpr AmReal32 kEpsilon

Minimum value where values lower than this are considered to be 0.

kMinFadeDuration

constexpr AmTime kMinFadeDuration

The minimum fade duration in milliseconds.

Function Details

CreateMutex

AmMutexHandle CreateMutex(AmUInt64 spinCount = 100)

Creates a mutex object.

A mutex is an object that a thread can acquire, preventing other threads from acquiring it.

To acquire the mutex ownership, you should use LockMutex() with the mutex handle as parameter. To release the ownership, use UnlockMutex() with the mutex handle as parameter.

Parameter spinCount
The number of times the mutex should spin before checking if it's available.

CreateThread

AmThreadHandle CreateThread(AmThreadFunction threadFunction, AmVoidPtr parameter = nullptr)

Creates a new thread.

Parameter threadFunction
The function to run in the thread.
Parameter parameter
An optional shared data to pass to the thread

DestroyMutex

void DestroyMutex(AmMutexHandle handle)

Destroys a mutex object.

Parameter handle
The mutex object handle.

GetCurrentThreadId

AmThreadID GetCurrentThreadId()

Gets the handle of the calling thread.

GetTimeMillis

AmUInt64 GetTimeMillis()

Gets the total execution time in milliseconds for the calling thread.

GetVersion

const AmVersion& GetVersion()

Returns the version.

Return
The current SDK version.

LockMutex

void LockMutex(AmMutexHandle handle)

Takes ownership of a mutex.

Parameter handle
The mutex object handle.

Release

void Release(AmThreadHandle& thread)

Manually stops a thread execution.

Parameter thread
The handle of the thread to stop.

Sleep

void Sleep(AmInt32 milliseconds)

Makes the calling thread sleep for the given amount of milliseconds.

Parameter milliseconds
The amount of time the calling thread should sleep.

UnlockMutex

void UnlockMutex(AmMutexHandle handle)

Releases ownership of a mutex.

Parameter handle
The mutex object handle.

Wait

void Wait(AmThreadHandle thread)

Waits for the given thread to stop.

Parameter thread
The handle of the thread to wait.