initial
This commit is contained in:
85
public/phonon/phonon_3d.h
Normal file
85
public/phonon/phonon_3d.h
Normal file
@@ -0,0 +1,85 @@
|
||||
/*
|
||||
Copyright (C) Impulsonic, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef IPL_PHONON_API_3D_H
|
||||
#define IPL_PHONON_API_3D_H
|
||||
|
||||
#include "phonon_common.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* Context */
|
||||
/*************************************************************************/
|
||||
|
||||
IPLAPI IPLerror iplCreate3DContext(IPLGlobalContext globalContext, IPLDspParams dspParams, IPLbyte* hrtfData, IPLhandle* context);
|
||||
IPLAPI IPLvoid iplDestroy3DContext(IPLhandle* context);
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* Panning Effect */
|
||||
/*************************************************************************/
|
||||
|
||||
IPLAPI IPLerror iplCreatePanningEffect(IPLhandle context, IPLAudioFormat inputFormat, IPLAudioFormat outputFormat, IPLhandle* effect);
|
||||
IPLAPI IPLvoid iplDestroyPanningEffect(IPLhandle* effect);
|
||||
IPLAPI IPLvoid iplApplyPanningEffect(IPLhandle effect, IPLAudioBuffer inputAudio, IPLVector3 direction, IPLAudioBuffer outputAudio);
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* Object-Based Binaural Effect */
|
||||
/*************************************************************************/
|
||||
|
||||
/* HRTF interpolation schemes. */
|
||||
typedef enum {
|
||||
IPL_HRTFINTERPOLATION_NEAREST,
|
||||
IPL_HRTFINTERPOLATION_BILINEAR
|
||||
} IPLHrtfInterpolation;
|
||||
|
||||
IPLAPI IPLerror iplCreateBinauralEffect(IPLhandle context, IPLAudioFormat inputFormat, IPLAudioFormat outputFormat, IPLhandle* effect);
|
||||
IPLAPI IPLvoid iplDestroyBinauralEffect(IPLhandle* effect);
|
||||
IPLAPI IPLvoid iplApplyBinauralEffect(IPLhandle effect, IPLAudioBuffer inputAudio, IPLVector3 direction, IPLHrtfInterpolation interpolation, IPLAudioBuffer outputAudio);
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* Virtual Surround Effect */
|
||||
/*************************************************************************/
|
||||
|
||||
IPLAPI IPLerror iplCreateVirtualSurroundEffect(IPLhandle context, IPLAudioFormat inputFormat, IPLAudioFormat outputFormat, IPLhandle* effect);
|
||||
IPLAPI IPLvoid iplDestroyVirtualSurroundEffect(IPLhandle* effect);
|
||||
IPLAPI IPLvoid iplApplyVirtualSurroundEffect(IPLhandle effect, IPLAudioBuffer inputAudio, IPLAudioBuffer outputAudio);
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* Ambisonics Binaural Effect */
|
||||
/*************************************************************************/
|
||||
|
||||
IPLAPI IPLerror iplCreateAmbisonicsBinauralEffect(IPLhandle context, IPLAudioFormat inputFormat, IPLAudioFormat outputFormat, IPLhandle* effect);
|
||||
IPLAPI IPLvoid iplDestroyAmbisonicsBinauralEffect(IPLhandle* effect);
|
||||
IPLAPI IPLvoid iplApplyAmbisonicsBinauralEffect(IPLhandle effect, IPLAudioBuffer inputAudio, IPLAudioBuffer outputAudio);
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* Mixing */
|
||||
/*************************************************************************/
|
||||
|
||||
IPLAPI IPLvoid iplMixAudioBuffers(IPLint32 numBuffers, IPLAudioBuffer* inputAudio, IPLAudioBuffer outputAudio);
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* Format Conversion */
|
||||
/*************************************************************************/
|
||||
|
||||
IPLAPI IPLvoid iplInterleaveAudioBuffer(IPLAudioBuffer inputAudio, IPLAudioBuffer outputAudio);
|
||||
IPLAPI IPLvoid iplDeinterleaveAudioBuffer(IPLAudioBuffer inputAudio, IPLAudioBuffer outputAudio);
|
||||
IPLAPI IPLvoid iplConvertAudioBufferFormat(IPLAudioBuffer inputAudio, IPLAudioBuffer outputAudio);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
163
public/phonon/phonon_common.h
Normal file
163
public/phonon/phonon_common.h
Normal file
@@ -0,0 +1,163 @@
|
||||
/*
|
||||
Copyright (C) Impulsonic, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef IPL_PHONON_API_COMMON_H
|
||||
#define IPL_PHONON_API_COMMON_H
|
||||
|
||||
#if (defined(_WIN32) || defined(_WIN64))
|
||||
#define IPLAPI __declspec(dllexport)
|
||||
#else
|
||||
#define IPLAPI __attribute__((visibility("default")))
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* Basic Data Types */
|
||||
/*************************************************************************/
|
||||
|
||||
/* Elementary data types. */
|
||||
typedef void IPLvoid;
|
||||
typedef char IPLint8;
|
||||
typedef unsigned char IPLuint8;
|
||||
typedef short IPLint16;
|
||||
typedef unsigned short IPLuint16;
|
||||
typedef int IPLint32;
|
||||
typedef unsigned int IPLuint32;
|
||||
typedef long long IPLint64;
|
||||
typedef unsigned long long IPLuint64;
|
||||
typedef float IPLfloat32;
|
||||
typedef double IPLfloat64;
|
||||
typedef unsigned char IPLbyte;
|
||||
typedef size_t IPLsize;
|
||||
typedef char* IPLstring;
|
||||
|
||||
/* Boolean values. */
|
||||
typedef enum {
|
||||
IPL_FALSE,
|
||||
IPL_TRUE
|
||||
} IPLbool;
|
||||
|
||||
/* Opaque object handles. */
|
||||
typedef void* IPLhandle;
|
||||
|
||||
/* Status codes. */
|
||||
typedef enum {
|
||||
IPL_STATUS_SUCCESS,
|
||||
IPL_STATUS_FAILURE,
|
||||
IPL_STATUS_OUTOFMEMORY,
|
||||
IPL_STATUS_INITIALIZATION
|
||||
} IPLerror;
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* Context */
|
||||
/*************************************************************************/
|
||||
|
||||
/* Logger function prototype. */
|
||||
typedef IPLvoid (*IPLLogFunction)(char* message);
|
||||
|
||||
/* Memory allocator function prototypes. */
|
||||
typedef IPLvoid* (*IPLAllocateFunction)(IPLsize, IPLsize);
|
||||
typedef IPLvoid (*IPLFreeFunction)(IPLvoid*);
|
||||
|
||||
/* Context data structure. */
|
||||
typedef struct {
|
||||
IPLLogFunction logCallback;
|
||||
IPLAllocateFunction allocateCallback;
|
||||
IPLFreeFunction freeCallback;
|
||||
} IPLGlobalContext;
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* Geometric Types */
|
||||
/*************************************************************************/
|
||||
|
||||
/* Points in 3D space. */
|
||||
typedef struct {
|
||||
IPLfloat32 x;
|
||||
IPLfloat32 y;
|
||||
IPLfloat32 z;
|
||||
} IPLVector3;
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* Audio Buffers */
|
||||
/*************************************************************************/
|
||||
|
||||
/* Whether the audio buffer is Ambisonics or not. */
|
||||
typedef enum {
|
||||
IPL_CHANNELLAYOUTTYPE_SPEAKERS,
|
||||
IPL_CHANNELLAYOUTTYPE_AMBISONICS
|
||||
} IPLChannelLayoutType;
|
||||
|
||||
/* For speaker-based layouts, the type of layout used. */
|
||||
typedef enum {
|
||||
IPL_CHANNELLAYOUT_MONO,
|
||||
IPL_CHANNELLAYOUT_STEREO,
|
||||
IPL_CHANNELLAYOUT_QUADRAPHONIC,
|
||||
IPL_CHANNELLAYOUT_FIVEPOINTONE,
|
||||
IPL_CHANNELLAYOUT_SEVENPOINTONE,
|
||||
IPL_CHANNELLAYOUT_CUSTOM
|
||||
} IPLChannelLayout;
|
||||
|
||||
/* The different possible orderings of Ambisonics channels. */
|
||||
typedef enum {
|
||||
IPL_AMBISONICSORDERING_FURSEMALHAM,
|
||||
IPL_AMBISONICSORDERING_ACN
|
||||
} IPLAmbisonicsOrdering;
|
||||
|
||||
/* The different possible normalization conventions for Ambisonics. */
|
||||
typedef enum {
|
||||
IPL_AMBISONICSNORMALIZATION_FURSEMALHAM,
|
||||
IPL_AMBISONICSNORMALIZATION_SN3D,
|
||||
IPL_AMBISONICSNORMALIZATION_N3D
|
||||
} IPLAmbisonicsNormalization;
|
||||
|
||||
/* Whether the data is interleaved or deinterleaved. */
|
||||
typedef enum {
|
||||
IPL_CHANNELORDER_INTERLEAVED,
|
||||
IPL_CHANNELORDER_DEINTERLEAVED
|
||||
} IPLChannelOrder;
|
||||
|
||||
/* The format of an audio buffer. */
|
||||
typedef struct {
|
||||
IPLChannelLayoutType channelLayoutType;
|
||||
IPLChannelLayout channelLayout;
|
||||
IPLint32 numSpeakers;
|
||||
IPLVector3* speakerDirections;
|
||||
IPLint32 ambisonicsOrder;
|
||||
IPLAmbisonicsOrdering ambisonicsOrdering;
|
||||
IPLAmbisonicsNormalization ambisonicsNormalization;
|
||||
IPLChannelOrder channelOrder;
|
||||
} IPLAudioFormat;
|
||||
|
||||
/* An audio buffer. */
|
||||
typedef struct {
|
||||
IPLAudioFormat format;
|
||||
IPLint32 numSamples;
|
||||
IPLfloat32* interleavedBuffer;
|
||||
IPLfloat32** deinterleavedBuffer;
|
||||
} IPLAudioBuffer;
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* DSP Parameters */
|
||||
/*************************************************************************/
|
||||
|
||||
/* Properties of the DSP pipeline. */
|
||||
typedef struct {
|
||||
IPLint32 samplingRate;
|
||||
IPLint32 frameSize;
|
||||
} IPLDspParams;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user