/* FAudio - XAudio Reimplementation for FNA1*2* Copyright (c) 2011-2024 Ethan Lee, Luigi Auriemma, and the MonoGame Team3*4* This software is provided 'as-is', without any express or implied warranty.5* In no event will the authors be held liable for any damages arising from6* the use of this software.7*8* Permission is granted to anyone to use this software for any purpose,9* including commercial applications, and to alter it and redistribute it10* freely, subject to the following restrictions:11*12* 1. The origin of this software must not be misrepresented; you must not13* claim that you wrote the original software. If you use this software in a14* product, an acknowledgment in the product documentation would be15* appreciated but is not required.16*17* 2. Altered source versions must be plainly marked as such, and must not be18* misrepresented as being the original software.19*20* 3. This notice may not be removed or altered from any source distribution.21*22* Ethan "flibitijibibo" Lee <[email protected]>23*24*/2526#ifndef FAUDIO_H27#define FAUDIO_H2829#ifdef _WIN3230#define FAUDIOAPI31#define FAUDIOCALL32#else33#define FAUDIOAPI34#define FAUDIOCALL35#endif3637#ifdef _MSC_VER38#define FAUDIODEPRECATED(msg) __declspec(deprecated(msg))39#else40#define FAUDIODEPRECATED(msg) __attribute__((deprecated(msg)))41#endif4243/* -Wpedantic nameless union/struct silencing */44#ifndef FAUDIONAMELESS45#ifdef __GNUC__46#define FAUDIONAMELESS __extension__47#else48#define FAUDIONAMELESS49#endif /* __GNUC__ */50#endif /* FAUDIONAMELESS */5152#include <stdint.h>53#include <stddef.h>5455#ifdef __cplusplus56extern "C" {57#endif /* __cplusplus */5859/* Type Declarations */6061typedef struct FAudio FAudio;62typedef struct FAudioVoice FAudioVoice;63typedef FAudioVoice FAudioSourceVoice;64typedef FAudioVoice FAudioSubmixVoice;65typedef FAudioVoice FAudioMasteringVoice;66typedef struct FAudioEngineCallback FAudioEngineCallback;67typedef struct FAudioVoiceCallback FAudioVoiceCallback;6869/* Enumerations */7071typedef enum FAudioDeviceRole72{73FAudioNotDefaultDevice = 0x0,74FAudioDefaultConsoleDevice = 0x1,75FAudioDefaultMultimediaDevice = 0x2,76FAudioDefaultCommunicationsDevice = 0x4,77FAudioDefaultGameDevice = 0x8,78FAudioGlobalDefaultDevice = 0xF,79FAudioInvalidDeviceRole = ~FAudioGlobalDefaultDevice80} FAudioDeviceRole;8182typedef enum FAudioFilterType83{84FAudioLowPassFilter,85FAudioBandPassFilter,86FAudioHighPassFilter,87FAudioNotchFilter88} FAudioFilterType;8990typedef enum FAudioStreamCategory91{92FAudioStreamCategory_Other,93FAudioStreamCategory_ForegroundOnlyMedia,94FAudioStreamCategory_BackgroundCapableMedia,95FAudioStreamCategory_Communications,96FAudioStreamCategory_Alerts,97FAudioStreamCategory_SoundEffects,98FAudioStreamCategory_GameEffects,99FAudioStreamCategory_GameMedia,100FAudioStreamCategory_GameChat,101FAudioStreamCategory_Speech,102FAudioStreamCategory_Movie,103FAudioStreamCategory_Media104} FAudioStreamCategory;105106/* FIXME: The original enum violates ISO C and is platform specific anyway... */107typedef uint32_t FAudioProcessor;108#define FAUDIO_DEFAULT_PROCESSOR 0xFFFFFFFF109110/* Structures */111112#pragma pack(push, 1)113114typedef struct FAudioGUID115{116uint32_t Data1;117uint16_t Data2;118uint16_t Data3;119uint8_t Data4[8];120} FAudioGUID;121122/* See MSDN:123* https://msdn.microsoft.com/en-us/library/windows/desktop/dd390970%28v=vs.85%29.aspx124*/125typedef struct FAudioWaveFormatEx126{127uint16_t wFormatTag;128uint16_t nChannels;129uint32_t nSamplesPerSec;130uint32_t nAvgBytesPerSec;131uint16_t nBlockAlign;132uint16_t wBitsPerSample;133uint16_t cbSize;134} FAudioWaveFormatEx;135136/* See MSDN:137* https://msdn.microsoft.com/en-us/library/windows/desktop/dd390971(v=vs.85).aspx138*/139typedef struct FAudioWaveFormatExtensible140{141FAudioWaveFormatEx Format;142union143{144uint16_t wValidBitsPerSample;145uint16_t wSamplesPerBlock;146uint16_t wReserved;147} Samples;148uint32_t dwChannelMask;149FAudioGUID SubFormat;150} FAudioWaveFormatExtensible;151152typedef struct FAudioADPCMCoefSet153{154int16_t iCoef1;155int16_t iCoef2;156} FAudioADPCMCoefSet;157158typedef struct FAudioADPCMWaveFormat159{160FAudioWaveFormatEx wfx;161uint16_t wSamplesPerBlock;162uint16_t wNumCoef;163164/* MSVC warns on empty arrays in structs */165#ifdef _MSC_VER166#pragma warning(push)167#pragma warning(disable: 4200)168#endif169170FAudioADPCMCoefSet aCoef[];171/* MSADPCM has 7 coefficient pairs:172* {173* { 256, 0 },174* { 512, -256 },175* { 0, 0 },176* { 192, 64 },177* { 240, 0 },178* { 460, -208 },179* { 392, -232 }180* }181*/182183#ifdef _MSC_VER184#pragma warning(pop)185#endif186} FAudioADPCMWaveFormat;187188typedef struct FAudioDeviceDetails189{190int16_t DeviceID[256]; /* Win32 wchar_t */191int16_t DisplayName[256]; /* Win32 wchar_t */192FAudioDeviceRole Role;193FAudioWaveFormatExtensible OutputFormat;194} FAudioDeviceDetails;195196typedef struct FAudioVoiceDetails197{198uint32_t CreationFlags;199uint32_t ActiveFlags;200uint32_t InputChannels;201uint32_t InputSampleRate;202} FAudioVoiceDetails;203204typedef struct FAudioSendDescriptor205{206uint32_t Flags; /* 0 or FAUDIO_SEND_USEFILTER */207FAudioVoice *pOutputVoice;208} FAudioSendDescriptor;209210typedef struct FAudioVoiceSends211{212uint32_t SendCount;213FAudioSendDescriptor *pSends;214} FAudioVoiceSends;215216#ifndef FAPO_DECL217#define FAPO_DECL218typedef struct FAPO FAPO;219#endif /* FAPO_DECL */220221typedef struct FAudioEffectDescriptor222{223FAPO *pEffect;224int32_t InitialState; /* 1 - Enabled, 0 - Disabled */225uint32_t OutputChannels;226} FAudioEffectDescriptor;227228typedef struct FAudioEffectChain229{230uint32_t EffectCount;231FAudioEffectDescriptor *pEffectDescriptors;232} FAudioEffectChain;233234typedef struct FAudioFilterParameters235{236FAudioFilterType Type;237float Frequency; /* [0, FAUDIO_MAX_FILTER_FREQUENCY] */238float OneOverQ; /* [0, FAUDIO_MAX_FILTER_ONEOVERQ] */239} FAudioFilterParameters;240241typedef struct FAudioFilterParametersEXT242{243FAudioFilterType Type;244float Frequency; /* [0, FAUDIO_MAX_FILTER_FREQUENCY] */245float OneOverQ; /* [0, FAUDIO_MAX_FILTER_ONEOVERQ] */246float WetDryMix; /* [0, 1] */247} FAudioFilterParametersEXT;248249typedef struct FAudioBuffer250{251/* Either 0 or FAUDIO_END_OF_STREAM */252uint32_t Flags;253/* Pointer to wave data, memory block size.254* Note that pAudioData is not copied; FAudio reads directly from your255* pointer! This pointer must be valid until FAudio has finished using256* it, at which point an OnBufferEnd callback will be generated.257*/258uint32_t AudioBytes;259const uint8_t *pAudioData;260/* Play region, in sample frames. */261uint32_t PlayBegin;262uint32_t PlayLength;263/* Loop region, in sample frames.264* This can be used to loop a subregion of the wave instead of looping265* the whole thing, i.e. if you have an intro/outro you can set these266* to loop the middle sections instead. If you don't need this, set both267* values to 0.268*/269uint32_t LoopBegin;270uint32_t LoopLength;271/* [0, FAUDIO_LOOP_INFINITE] */272uint32_t LoopCount;273/* This is sent to callbacks as pBufferContext */274void *pContext;275} FAudioBuffer;276277typedef struct FAudioBufferWMA278{279const uint32_t *pDecodedPacketCumulativeBytes;280uint32_t PacketCount;281} FAudioBufferWMA;282283typedef struct FAudioVoiceState284{285void *pCurrentBufferContext;286uint32_t BuffersQueued;287uint64_t SamplesPlayed;288} FAudioVoiceState;289290typedef struct FAudioPerformanceData291{292uint64_t AudioCyclesSinceLastQuery;293uint64_t TotalCyclesSinceLastQuery;294uint32_t MinimumCyclesPerQuantum;295uint32_t MaximumCyclesPerQuantum;296uint32_t MemoryUsageInBytes;297uint32_t CurrentLatencyInSamples;298uint32_t GlitchesSinceEngineStarted;299uint32_t ActiveSourceVoiceCount;300uint32_t TotalSourceVoiceCount;301uint32_t ActiveSubmixVoiceCount;302uint32_t ActiveResamplerCount;303uint32_t ActiveMatrixMixCount;304uint32_t ActiveXmaSourceVoices;305uint32_t ActiveXmaStreams;306} FAudioPerformanceData;307308typedef struct FAudioDebugConfiguration309{310/* See FAUDIO_LOG_* */311uint32_t TraceMask;312uint32_t BreakMask;313/* 0 or 1 */314int32_t LogThreadID;315int32_t LogFileline;316int32_t LogFunctionName;317int32_t LogTiming;318} FAudioDebugConfiguration;319320#pragma pack(pop)321322/* This ISN'T packed. Strictly speaking it wouldn't have mattered anyway but eh.323* See https://github.com/microsoft/DirectXTK/issues/256324*/325typedef struct FAudioXMA2WaveFormatEx326{327FAudioWaveFormatEx wfx;328uint16_t wNumStreams;329uint32_t dwChannelMask;330uint32_t dwSamplesEncoded;331uint32_t dwBytesPerBlock;332uint32_t dwPlayBegin;333uint32_t dwPlayLength;334uint32_t dwLoopBegin;335uint32_t dwLoopLength;336uint8_t bLoopCount;337uint8_t bEncoderVersion;338uint16_t wBlockCount;339} FAudioXMA2WaveFormat;340341/* Constants */342343#define FAUDIO_OK 0x0344#define FAUDIO_E_FAIL 0x80004005345#define FAUDIO_E_OUT_OF_MEMORY 0x8007000e346#define FAUDIO_E_INVALID_ARG 0x80070057347#define FAUDIO_E_UNSUPPORTED_FORMAT 0x88890008348#define FAUDIO_E_INVALID_CALL 0x88960001349#define FAUDIO_E_DEVICE_INVALIDATED 0x88960004350#define FAPO_E_FORMAT_UNSUPPORTED 0x88970001351352#define FAUDIO_MAX_BUFFER_BYTES 0x80000000353#define FAUDIO_MAX_QUEUED_BUFFERS 64354#define FAUDIO_MAX_AUDIO_CHANNELS 64355#define FAUDIO_MIN_SAMPLE_RATE 1000356#define FAUDIO_MAX_SAMPLE_RATE 200000357#define FAUDIO_MAX_VOLUME_LEVEL 16777216.0f358#define FAUDIO_MIN_FREQ_RATIO (1.0f / 1024.0f)359#define FAUDIO_MAX_FREQ_RATIO 1024.0f360#define FAUDIO_DEFAULT_FREQ_RATIO 2.0f361#define FAUDIO_MAX_FILTER_ONEOVERQ 1.5f362#define FAUDIO_MAX_FILTER_FREQUENCY 1.0f363#define FAUDIO_MAX_LOOP_COUNT 254364365#define FAUDIO_COMMIT_NOW 0366#define FAUDIO_COMMIT_ALL 0367#define FAUDIO_INVALID_OPSET (uint32_t) (-1)368#define FAUDIO_NO_LOOP_REGION 0369#define FAUDIO_LOOP_INFINITE 255370#define FAUDIO_DEFAULT_CHANNELS 0371#define FAUDIO_DEFAULT_SAMPLERATE 0372373#define FAUDIO_DEBUG_ENGINE 0x0001374#define FAUDIO_VOICE_NOPITCH 0x0002375#define FAUDIO_VOICE_NOSRC 0x0004376#define FAUDIO_VOICE_USEFILTER 0x0008377#define FAUDIO_VOICE_MUSIC 0x0010378#define FAUDIO_PLAY_TAILS 0x0020379#define FAUDIO_END_OF_STREAM 0x0040380#define FAUDIO_SEND_USEFILTER 0x0080381#define FAUDIO_VOICE_NOSAMPLESPLAYED 0x0100382#define FAUDIO_1024_QUANTUM 0x8000383384#define FAUDIO_DEFAULT_FILTER_TYPE FAudioLowPassFilter385#define FAUDIO_DEFAULT_FILTER_FREQUENCY FAUDIO_MAX_FILTER_FREQUENCY386#define FAUDIO_DEFAULT_FILTER_ONEOVERQ 1.0f387#define FAUDIO_DEFAULT_FILTER_WETDRYMIX_EXT 1.0f388389#define FAUDIO_LOG_ERRORS 0x0001390#define FAUDIO_LOG_WARNINGS 0x0002391#define FAUDIO_LOG_INFO 0x0004392#define FAUDIO_LOG_DETAIL 0x0008393#define FAUDIO_LOG_API_CALLS 0x0010394#define FAUDIO_LOG_FUNC_CALLS 0x0020395#define FAUDIO_LOG_TIMING 0x0040396#define FAUDIO_LOG_LOCKS 0x0080397#define FAUDIO_LOG_MEMORY 0x0100398#define FAUDIO_LOG_STREAMING 0x1000399400#ifndef _SPEAKER_POSITIONS_401#define SPEAKER_FRONT_LEFT 0x00000001402#define SPEAKER_FRONT_RIGHT 0x00000002403#define SPEAKER_FRONT_CENTER 0x00000004404#define SPEAKER_LOW_FREQUENCY 0x00000008405#define SPEAKER_BACK_LEFT 0x00000010406#define SPEAKER_BACK_RIGHT 0x00000020407#define SPEAKER_FRONT_LEFT_OF_CENTER 0x00000040408#define SPEAKER_FRONT_RIGHT_OF_CENTER 0x00000080409#define SPEAKER_BACK_CENTER 0x00000100410#define SPEAKER_SIDE_LEFT 0x00000200411#define SPEAKER_SIDE_RIGHT 0x00000400412#define SPEAKER_TOP_CENTER 0x00000800413#define SPEAKER_TOP_FRONT_LEFT 0x00001000414#define SPEAKER_TOP_FRONT_CENTER 0x00002000415#define SPEAKER_TOP_FRONT_RIGHT 0x00004000416#define SPEAKER_TOP_BACK_LEFT 0x00008000417#define SPEAKER_TOP_BACK_CENTER 0x00010000418#define SPEAKER_TOP_BACK_RIGHT 0x00020000419#define _SPEAKER_POSITIONS_420#endif421422#ifndef SPEAKER_MONO423#define SPEAKER_MONO SPEAKER_FRONT_CENTER424#define SPEAKER_STEREO (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT)425#define SPEAKER_2POINT1 \426( SPEAKER_FRONT_LEFT | \427SPEAKER_FRONT_RIGHT | \428SPEAKER_LOW_FREQUENCY )429#define SPEAKER_SURROUND \430( SPEAKER_FRONT_LEFT | \431SPEAKER_FRONT_RIGHT | \432SPEAKER_FRONT_CENTER | \433SPEAKER_BACK_CENTER )434#define SPEAKER_QUAD \435( SPEAKER_FRONT_LEFT | \436SPEAKER_FRONT_RIGHT | \437SPEAKER_BACK_LEFT | \438SPEAKER_BACK_RIGHT )439#define SPEAKER_4POINT1 \440( SPEAKER_FRONT_LEFT | \441SPEAKER_FRONT_RIGHT | \442SPEAKER_LOW_FREQUENCY | \443SPEAKER_BACK_LEFT | \444SPEAKER_BACK_RIGHT )445#define SPEAKER_5POINT1 \446( SPEAKER_FRONT_LEFT | \447SPEAKER_FRONT_RIGHT | \448SPEAKER_FRONT_CENTER | \449SPEAKER_LOW_FREQUENCY | \450SPEAKER_BACK_LEFT | \451SPEAKER_BACK_RIGHT )452#define SPEAKER_7POINT1 \453( SPEAKER_FRONT_LEFT | \454SPEAKER_FRONT_RIGHT | \455SPEAKER_FRONT_CENTER | \456SPEAKER_LOW_FREQUENCY | \457SPEAKER_BACK_LEFT | \458SPEAKER_BACK_RIGHT | \459SPEAKER_FRONT_LEFT_OF_CENTER | \460SPEAKER_FRONT_RIGHT_OF_CENTER )461#define SPEAKER_5POINT1_SURROUND \462( SPEAKER_FRONT_LEFT | \463SPEAKER_FRONT_RIGHT | \464SPEAKER_FRONT_CENTER | \465SPEAKER_LOW_FREQUENCY | \466SPEAKER_SIDE_LEFT | \467SPEAKER_SIDE_RIGHT )468#define SPEAKER_7POINT1_SURROUND \469( SPEAKER_FRONT_LEFT | \470SPEAKER_FRONT_RIGHT | \471SPEAKER_FRONT_CENTER | \472SPEAKER_LOW_FREQUENCY | \473SPEAKER_BACK_LEFT | \474SPEAKER_BACK_RIGHT | \475SPEAKER_SIDE_LEFT | \476SPEAKER_SIDE_RIGHT )477#define SPEAKER_XBOX SPEAKER_5POINT1478#endif479480#define FAUDIO_FORMAT_PCM 1481#define FAUDIO_FORMAT_MSADPCM 2482#define FAUDIO_FORMAT_IEEE_FLOAT 3483#define FAUDIO_FORMAT_WMAUDIO2 0x0161484#define FAUDIO_FORMAT_WMAUDIO3 0x0162485#define FAUDIO_FORMAT_WMAUDIO_LOSSLESS 0x0163486#define FAUDIO_FORMAT_XMAUDIO2 0x0166487#define FAUDIO_FORMAT_EXTENSIBLE 0xFFFE488489extern FAudioGUID DATAFORMAT_SUBTYPE_PCM;490extern FAudioGUID DATAFORMAT_SUBTYPE_IEEE_FLOAT;491492/* FAudio Version API */493494#define FAUDIO_TARGET_VERSION 8 /* Targeting compatibility with XAudio 2.8 */495496#define FAUDIO_ABI_VERSION 0497#define FAUDIO_MAJOR_VERSION 26498#define FAUDIO_MINOR_VERSION 2499#define FAUDIO_PATCH_VERSION 0500501#define FAUDIO_COMPILED_VERSION ( \502(FAUDIO_ABI_VERSION * 100 * 100 * 100) + \503(FAUDIO_MAJOR_VERSION * 100 * 100) + \504(FAUDIO_MINOR_VERSION * 100) + \505(FAUDIO_PATCH_VERSION) \506)507508FAUDIOAPI uint32_t FAudioLinkedVersion(void);509510/* FAudio Interface */511512/* This should be your first FAudio call.513*514* ppFAudio: Filled with the FAudio core context.515* Flags: Can be 0 or a combination of FAUDIO_DEBUG_ENGINE and FAUDIO_1024_QUANTUM.516* XAudio2Processor: Set this to FAUDIO_DEFAULT_PROCESSOR.517*518* Returns 0 on success.519*/520FAUDIOAPI uint32_t FAudioCreate(521FAudio **ppFAudio,522uint32_t Flags,523FAudioProcessor XAudio2Processor524);525526/* See "extensions/COMConstructEXT.txt" for more details */527FAUDIOAPI uint32_t FAudioCOMConstructEXT(FAudio **ppFAudio, uint8_t version);528529/* Increments a reference counter. When counter is 0, audio is freed.530* Returns the reference count after incrementing.531*/532FAUDIOAPI uint32_t FAudio_AddRef(FAudio *audio);533534/* Decrements a reference counter. When counter is 0, audio is freed.535* Returns the reference count after decrementing.536*/537FAUDIOAPI uint32_t FAudio_Release(FAudio *audio);538539/* Queries the number of sound devices available for use.540*541* pCount: Filled with the number of available sound devices.542*543* Returns 0 on success.544*/545FAUDIOAPI uint32_t FAudio_GetDeviceCount(FAudio *audio, uint32_t *pCount);546547/* Gets basic information about a sound device.548*549* Index: Can be between 0 and the result of GetDeviceCount.550* pDeviceDetails: Filled with the device information.551*552* Returns 0 on success.553*/554FAUDIOAPI uint32_t FAudio_GetDeviceDetails(555FAudio *audio,556uint32_t Index,557FAudioDeviceDetails *pDeviceDetails558);559560/* You don't actually have to call this, unless you're using the COM APIs.561* See the FAudioCreate API for parameter information.562*/563FAUDIOAPI uint32_t FAudio_Initialize(564FAudio *audio,565uint32_t Flags,566FAudioProcessor XAudio2Processor567);568569/* Register a new set of engine callbacks.570* There is no limit to the number of sets, but expect performance to degrade571* if you have a whole bunch of these. You most likely only need one.572*573* pCallback: The completely-initialized FAudioEngineCallback structure.574*575* Returns 0 on success.576*/577FAUDIOAPI uint32_t FAudio_RegisterForCallbacks(578FAudio *audio,579FAudioEngineCallback *pCallback580);581582/* Remove an active set of engine callbacks.583* This checks the pointer value, NOT the callback values!584*585* pCallback: An FAudioEngineCallback structure previously sent to Register.586*587* Returns 0 on success.588*/589FAUDIOAPI void FAudio_UnregisterForCallbacks(590FAudio *audio,591FAudioEngineCallback *pCallback592);593594/* Creates a "source" voice, used to play back wavedata.595*596* ppSourceVoice: Filled with the source voice pointer.597* pSourceFormat: The input wavedata format, see the documentation for598* FAudioWaveFormatEx.599* Flags: Can be 0 or a mix of the following FAUDIO_VOICE_* flags:600* NOPITCH/NOSRC: Resampling is disabled. If you set this,601* the source format sample rate MUST match602* the output voices' input sample rates.603* Also, SetFrequencyRatio will fail.604* USEFILTER: Enables the use of SetFilterParameters.605* MUSIC: Unsupported.606* MaxFrequencyRatio: AKA your max pitch. This allows us to optimize the size607* of the decode/resample cache sizes. For example, if you608* only expect to raise pitch by a single octave, you can609* set this value to 2.0f. 2.0f is the default value.610* Bounds: [FAUDIO_MIN_FREQ_RATIO, FAUDIO_MAX_FREQ_RATIO].611* pCallback: Voice callbacks, see FAudioVoiceCallback documentation.612* pSendList: List of output voices. If NULL, defaults to master.613* All output voices must have the same sample rate!614* pEffectChain: List of FAPO effects. This value can be NULL.615*616* Returns 0 on success.617*/618FAUDIOAPI uint32_t FAudio_CreateSourceVoice(619FAudio *audio,620FAudioSourceVoice **ppSourceVoice,621const FAudioWaveFormatEx *pSourceFormat,622uint32_t Flags,623float MaxFrequencyRatio,624FAudioVoiceCallback *pCallback,625const FAudioVoiceSends *pSendList,626const FAudioEffectChain *pEffectChain627);628629/* Creates a "submix" voice, used to mix/process input voices.630* The typical use case for this is to perform CPU-intensive tasks on large631* groups of voices all at once. Examples include resampling and FAPO effects.632*633* ppSubmixVoice: Filled with the submix voice pointer.634* InputChannels: Input voices will convert to this channel count.635* InputSampleRate: Input voices will convert to this sample rate.636* Flags: Can be 0 or FAUDIO_VOICE_USEFILTER.637* ProcessingStage: If you have multiple submixes that depend on a specific638* order of processing, you can sort them by setting this639* value to prioritize them. For example, submixes with640* stage 0 will process first, then stage 1, 2, and so on.641* pSendList: List of output voices. If NULL, defaults to master.642* All output voices must have the same sample rate!643* pEffectChain: List of FAPO effects. This value can be NULL.644*645* Returns 0 on success.646*/647FAUDIOAPI uint32_t FAudio_CreateSubmixVoice(648FAudio *audio,649FAudioSubmixVoice **ppSubmixVoice,650uint32_t InputChannels,651uint32_t InputSampleRate,652uint32_t Flags,653uint32_t ProcessingStage,654const FAudioVoiceSends *pSendList,655const FAudioEffectChain *pEffectChain656);657658/* This should be your second FAudio call, unless you care about which device659* you want to use. In that case, see GetDeviceDetails.660*661* ppMasteringVoice: Filled with the mastering voice pointer.662* InputChannels: Device channel count. Can be FAUDIO_DEFAULT_CHANNELS.663* InputSampleRate: Device sample rate. Can be FAUDIO_DEFAULT_SAMPLERATE.664* Flags: This value must be 0.665* DeviceIndex: 0 for the default device. See GetDeviceCount.666* pEffectChain: List of FAPO effects. This value can be NULL.667*668* Returns 0 on success.669*/670FAUDIOAPI uint32_t FAudio_CreateMasteringVoice(671FAudio *audio,672FAudioMasteringVoice **ppMasteringVoice,673uint32_t InputChannels,674uint32_t InputSampleRate,675uint32_t Flags,676uint32_t DeviceIndex,677const FAudioEffectChain *pEffectChain678);679680/* This is the XAudio 2.8+ version of CreateMasteringVoice.681* Right now this doesn't do anything. Don't use this function.682*/683FAUDIOAPI uint32_t FAudio_CreateMasteringVoice8(684FAudio *audio,685FAudioMasteringVoice **ppMasteringVoice,686uint32_t InputChannels,687uint32_t InputSampleRate,688uint32_t Flags,689uint16_t *szDeviceId,690const FAudioEffectChain *pEffectChain,691FAudioStreamCategory StreamCategory692);693694/* Starts the engine, begins processing the audio graph.695* Returns 0 on success.696*/697FAUDIOAPI uint32_t FAudio_StartEngine(FAudio *audio);698699/* Stops the engine and halts all processing.700* The audio device will continue to run, but will produce silence.701* The graph will be frozen until you call StartEngine, where it will then702* resume all processing exactly as it would have had this never been called.703*/704FAUDIOAPI void FAudio_StopEngine(FAudio *audio);705706/* Flushes a batch of FAudio calls compiled with a given "OperationSet" tag.707* This function is based on IXAudio2::CommitChanges from the XAudio2 spec.708* This is useful for pushing calls that need to be done perfectly in sync. For709* example, if you want to play two separate sources at the exact same time, you710* can call FAudioSourceVoice_Start with an OperationSet value of your choice,711* then call CommitChanges with that same value to start the sources together.712*713* OperationSet: Either a value known by you or FAUDIO_COMMIT_ALL714*715* Returns 0 on success.716*/717FAUDIOAPI uint32_t FAudio_CommitOperationSet(718FAudio *audio,719uint32_t OperationSet720);721722/* DO NOT USE THIS FUNCTION OR I SWEAR TO GOD */723FAUDIODEPRECATED("This function will break your program! Use FAudio_CommitOperationSet instead!")724FAUDIOAPI uint32_t FAudio_CommitChanges(FAudio *audio);725726/* Requests various bits of performance information from the engine.727*728* pPerfData: Filled with the data. See FAudioPerformanceData for details.729*/730FAUDIOAPI void FAudio_GetPerformanceData(731FAudio *audio,732FAudioPerformanceData *pPerfData733);734735/* When using a Debug binary, this lets you configure what information gets736* logged to output. Be careful, this can spit out a LOT of text.737*738* pDebugConfiguration: See FAudioDebugConfiguration for details.739* pReserved: Set this to NULL.740*/741FAUDIOAPI void FAudio_SetDebugConfiguration(742FAudio *audio,743FAudioDebugConfiguration *pDebugConfiguration,744void* pReserved745);746747/* Requests the values that determine's the engine's update size.748* For example, a 48KHz engine with a 1024-sample update period would return749* 1024 for the numerator and 48000 for the denominator. With this information,750* you can determine the precise update size in milliseconds.751*752* quantumNumerator - The engine's update size, in sample frames.753* quantumDenominator - The engine's sample rate, in Hz754*/755FAUDIOAPI void FAudio_GetProcessingQuantum(756FAudio *audio,757uint32_t *quantumNumerator,758uint32_t *quantumDenominator759);760761/* FAudioVoice Interface */762763/* Requests basic information about a voice.764*765* pVoiceDetails: See FAudioVoiceDetails for details.766*/767FAUDIOAPI void FAudioVoice_GetVoiceDetails(768FAudioVoice *voice,769FAudioVoiceDetails *pVoiceDetails770);771772/* Change the output voices for this voice.773* This function is invalid for mastering voices.774*775* pSendList: List of output voices. If NULL, defaults to master.776* All output voices must have the same sample rate!777*778* Returns 0 on success.779*/780FAUDIOAPI uint32_t FAudioVoice_SetOutputVoices(781FAudioVoice *voice,782const FAudioVoiceSends *pSendList783);784785/* Change/Remove the effect chain for this voice.786*787* pEffectChain: List of FAPO effects. This value can be NULL.788* Note that the final channel counts for this chain MUST789* match the input/output channel count that was790* determined at voice creation time!791*792* Returns 0 on success.793*/794FAUDIOAPI uint32_t FAudioVoice_SetEffectChain(795FAudioVoice *voice,796const FAudioEffectChain *pEffectChain797);798799/* Enables an effect in the effect chain.800*801* EffectIndex: The index of the effect (based on the chain order).802* OperationSet: See CommitChanges. Default is FAUDIO_COMMIT_NOW.803*804* Returns 0 on success.805*/806FAUDIOAPI uint32_t FAudioVoice_EnableEffect(807FAudioVoice *voice,808uint32_t EffectIndex,809uint32_t OperationSet810);811812/* Disables an effect in the effect chain.813*814* EffectIndex: The index of the effect (based on the chain order).815* OperationSet: See CommitChanges. Default is FAUDIO_COMMIT_NOW.816*817* Returns 0 on success.818*/819FAUDIOAPI uint32_t FAudioVoice_DisableEffect(820FAudioVoice *voice,821uint32_t EffectIndex,822uint32_t OperationSet823);824825/* Queries the enabled/disabled state of an effect in the effect chain.826*827* EffectIndex: The index of the effect (based on the chain order).828* pEnabled: Filled with either 1 (Enabled) or 0 (Disabled).829*830* Returns 0 on success.831*/832FAUDIOAPI void FAudioVoice_GetEffectState(833FAudioVoice *voice,834uint32_t EffectIndex,835int32_t *pEnabled836);837838/* Submits a block of memory to be sent to FAPO::SetParameters.839*840* EffectIndex: The index of the effect (based on the chain order).841* pParameters: The values to be copied and submitted to the FAPO.842* ParametersByteSize: This should match what the FAPO expects!843* OperationSet: See CommitChanges. Default is FAUDIO_COMMIT_NOW.844*845* Returns 0 on success.846*/847FAUDIOAPI uint32_t FAudioVoice_SetEffectParameters(848FAudioVoice *voice,849uint32_t EffectIndex,850const void *pParameters,851uint32_t ParametersByteSize,852uint32_t OperationSet853);854855/* Requests the latest parameters from FAPO::GetParameters.856*857* EffectIndex: The index of the effect (based on the chain order).858* pParameters: Filled with the latest parameter values from the FAPO.859* ParametersByteSize: This should match what the FAPO expects!860*861* Returns 0 on success.862*/863FAUDIOAPI uint32_t FAudioVoice_GetEffectParameters(864FAudioVoice *voice,865uint32_t EffectIndex,866void *pParameters,867uint32_t ParametersByteSize868);869870/* Sets the filter variables for a voice.871* This is only valid on voices with the USEFILTER flag.872*873* pParameters: See FAudioFilterParameters for details.874* OperationSet: See CommitChanges. Default is FAUDIO_COMMIT_NOW.875*876* Returns 0 on success.877*/878FAUDIOAPI uint32_t FAudioVoice_SetFilterParameters(879FAudioVoice *voice,880const FAudioFilterParameters *pParameters,881uint32_t OperationSet882);883884/* Requests the filter variables for a voice.885* This is only valid on voices with the USEFILTER flag.886*887* pParameters: See FAudioFilterParameters for details.888*/889FAUDIOAPI void FAudioVoice_GetFilterParameters(890FAudioVoice *voice,891FAudioFilterParameters *pParameters892);893894/* Sets the filter variables for a voice's output voice.895* This is only valid on sends with the USEFILTER flag.896*897* pDestinationVoice: An output voice from the voice's send list.898* pParameters: See FAudioFilterParameters for details.899* OperationSet: See CommitChanges. Default is FAUDIO_COMMIT_NOW.900*901* Returns 0 on success.902*/903FAUDIOAPI uint32_t FAudioVoice_SetOutputFilterParameters(904FAudioVoice *voice,905FAudioVoice *pDestinationVoice,906const FAudioFilterParameters *pParameters,907uint32_t OperationSet908);909910/* Requests the filter variables for a voice's output voice.911* This is only valid on sends with the USEFILTER flag.912*913* pDestinationVoice: An output voice from the voice's send list.914* pParameters: See FAudioFilterParameters for details.915*/916FAUDIOAPI void FAudioVoice_GetOutputFilterParameters(917FAudioVoice *voice,918FAudioVoice *pDestinationVoice,919FAudioFilterParameters *pParameters920);921922/* Sets the filter variables for a voice.923* This is only valid on voices with the USEFILTER flag.924*925* pParameters: See FAudioFilterParametersEXT for details.926* OperationSet: See CommitChanges. Default is FAUDIO_COMMIT_NOW.927*928* Returns 0 on success.929*/930FAUDIOAPI uint32_t FAudioVoice_SetFilterParametersEXT(931FAudioVoice* voice,932const FAudioFilterParametersEXT* pParameters,933uint32_t OperationSet934);935936/* Requests the filter variables for a voice.937* This is only valid on voices with the USEFILTER flag.938*939* pParameters: See FAudioFilterParametersEXT for details.940*/941FAUDIOAPI void FAudioVoice_GetFilterParametersEXT(942FAudioVoice* voice,943FAudioFilterParametersEXT* pParameters944);945946/* Sets the filter variables for a voice's output voice.947* This is only valid on sends with the USEFILTER flag.948*949* pDestinationVoice: An output voice from the voice's send list.950* pParameters: See FAudioFilterParametersEXT for details.951* OperationSet: See CommitChanges. Default is FAUDIO_COMMIT_NOW.952*953* Returns 0 on success.954*/955FAUDIOAPI uint32_t FAudioVoice_SetOutputFilterParametersEXT(956FAudioVoice* voice,957FAudioVoice* pDestinationVoice,958const FAudioFilterParametersEXT* pParameters,959uint32_t OperationSet960);961962/* Requests the filter variables for a voice's output voice.963* This is only valid on sends with the USEFILTER flag.964*965* pDestinationVoice: An output voice from the voice's send list.966* pParameters: See FAudioFilterParametersEXT for details.967*/968FAUDIOAPI void FAudioVoice_GetOutputFilterParametersEXT(969FAudioVoice* voice,970FAudioVoice* pDestinationVoice,971FAudioFilterParametersEXT* pParameters972);973974/* Sets the global volume of a voice.975*976* Volume: Amplitude ratio. 1.0f is default, 0.0f is silence.977* Note that you can actually set volume < 0.0f!978* Bounds: [-FAUDIO_MAX_VOLUME_LEVEL, FAUDIO_MAX_VOLUME_LEVEL]979* OperationSet: See CommitChanges. Default is FAUDIO_COMMIT_NOW.980*981* Returns 0 on success.982*/983FAUDIOAPI uint32_t FAudioVoice_SetVolume(984FAudioVoice *voice,985float Volume,986uint32_t OperationSet987);988989/* Requests the global volume of a voice.990*991* pVolume: Filled with the current voice amplitude ratio.992*/993FAUDIOAPI void FAudioVoice_GetVolume(994FAudioVoice *voice,995float *pVolume996);997998/* Sets the per-channel volumes of a voice.999*1000* Channels: Must match the channel count of this voice!1001* pVolumes: Amplitude ratios for each channel. Same as SetVolume.1002* OperationSet: See CommitChanges. Default is FAUDIO_COMMIT_NOW.1003*1004* Returns 0 on success.1005*/1006FAUDIOAPI uint32_t FAudioVoice_SetChannelVolumes(1007FAudioVoice *voice,1008uint32_t Channels,1009const float *pVolumes,1010uint32_t OperationSet1011);10121013/* Requests the per-channel volumes of a voice.1014*1015* Channels: Must match the channel count of this voice!1016* pVolumes: Filled with the current channel amplitude ratios.1017*/1018FAUDIOAPI void FAudioVoice_GetChannelVolumes(1019FAudioVoice *voice,1020uint32_t Channels,1021float *pVolumes1022);10231024/* Sets the volumes of a send's output channels. The matrix is based on the1025* voice's input channels. For example, the default matrix for a 2-channel1026* source and a 2-channel output voice is as follows:1027* [0] = 1.0f; <- Left input, left output1028* [1] = 0.0f; <- Right input, left output1029* [2] = 0.0f; <- Left input, right output1030* [3] = 1.0f; <- Right input, right output1031* This is typically only used for panning or 3D sound (via F3DAudio).1032*1033* pDestinationVoice: An output voice from the voice's send list.1034* SourceChannels: Must match the voice's input channel count!1035* DestinationChannels: Must match the destination's input channel count!1036* pLevelMatrix: A float[SourceChannels * DestinationChannels].1037* OperationSet: See CommitChanges. Default is FAUDIO_COMMIT_NOW.1038*1039* Returns 0 on success.1040*/1041FAUDIOAPI uint32_t FAudioVoice_SetOutputMatrix(1042FAudioVoice *voice,1043FAudioVoice *pDestinationVoice,1044uint32_t SourceChannels,1045uint32_t DestinationChannels,1046const float *pLevelMatrix,1047uint32_t OperationSet1048);10491050/* Gets the volumes of a send's output channels. See SetOutputMatrix.1051*1052* pDestinationVoice: An output voice from the voice's send list.1053* SourceChannels: Must match the voice's input channel count!1054* DestinationChannels: Must match the voice's output channel count!1055* pLevelMatrix: A float[SourceChannels * DestinationChannels].1056*/1057FAUDIOAPI void FAudioVoice_GetOutputMatrix(1058FAudioVoice *voice,1059FAudioVoice *pDestinationVoice,1060uint32_t SourceChannels,1061uint32_t DestinationChannels,1062float *pLevelMatrix1063);10641065/* Removes this voice from the audio graph and frees memory. */1066FAUDIOAPI void FAudioVoice_DestroyVoice(FAudioVoice *voice);10671068/*1069* Returns S_OK on success and E_FAIL if voice could not be destroyed (e. g., because it is in use).1070*/1071FAUDIOAPI uint32_t FAudioVoice_DestroyVoiceSafeEXT(FAudioVoice *voice);10721073/* FAudioSourceVoice Interface */10741075/* Starts processing for a source voice.1076*1077* Flags: Must be 0.1078* OperationSet: See CommitChanges. Default is FAUDIO_COMMIT_NOW.1079*1080* Returns 0 on success.1081*/1082FAUDIOAPI uint32_t FAudioSourceVoice_Start(1083FAudioSourceVoice *voice,1084uint32_t Flags,1085uint32_t OperationSet1086);10871088/* Pauses processing for a source voice. Yes, I said pausing.1089* If you want to _actually_ stop, call FlushSourceBuffers next.1090*1091* Flags: Can be 0 or FAUDIO_PLAY_TAILS, which allows effects to1092* keep emitting output even after processing has stopped.1093* OperationSet: See CommitChanges. Default is FAUDIO_COMMIT_NOW.1094*1095* Returns 0 on success.1096*/1097FAUDIOAPI uint32_t FAudioSourceVoice_Stop(1098FAudioSourceVoice *voice,1099uint32_t Flags,1100uint32_t OperationSet1101);11021103/* Submits a block of wavedata for the source to process.1104*1105* pBuffer: See FAudioBuffer for details.1106* pBufferWMA: See FAudioBufferWMA for details. (Also, don't use WMA.)1107*1108* Returns 0 on success.1109*/1110FAUDIOAPI uint32_t FAudioSourceVoice_SubmitSourceBuffer(1111FAudioSourceVoice *voice,1112const FAudioBuffer *pBuffer,1113const FAudioBufferWMA *pBufferWMA1114);11151116/* Removes all buffers from a source, with a minor exception.1117* If the voice is still playing, the active buffer is left alone.1118* All buffers that are removed will spawn an OnBufferEnd callback.1119*1120* Returns 0 on success.1121*/1122FAUDIOAPI uint32_t FAudioSourceVoice_FlushSourceBuffers(1123FAudioSourceVoice *voice1124);11251126/* Takes the last buffer currently queued and sets the END_OF_STREAM flag.1127*1128* Returns 0 on success.1129*/1130FAUDIOAPI uint32_t FAudioSourceVoice_Discontinuity(1131FAudioSourceVoice *voice1132);11331134/* Sets the loop count of the active buffer to 0.1135*1136* OperationSet: See CommitChanges. Default is FAUDIO_COMMIT_NOW.1137*1138* Returns 0 on success.1139*/1140FAUDIOAPI uint32_t FAudioSourceVoice_ExitLoop(1141FAudioSourceVoice *voice,1142uint32_t OperationSet1143);11441145/* Requests the state and some basic statistics for this source.1146*1147* pVoiceState: See FAudioVoiceState for details.1148* Flags: Can be 0 or FAUDIO_VOICE_NOSAMPLESPLAYED.1149*/1150FAUDIOAPI void FAudioSourceVoice_GetState(1151FAudioSourceVoice *voice,1152FAudioVoiceState *pVoiceState,1153uint32_t Flags1154);11551156/* Sets the frequency ratio (fancy phrase for pitch) of this source.1157*1158* Ratio: The frequency ratio, must be <= MaxFrequencyRatio.1159* OperationSet: See CommitChanges. Default is FAUDIO_COMMIT_NOW.1160*1161* Returns 0 on success.1162*/1163FAUDIOAPI uint32_t FAudioSourceVoice_SetFrequencyRatio(1164FAudioSourceVoice *voice,1165float Ratio,1166uint32_t OperationSet1167);11681169/* Requests the frequency ratio (fancy phrase for pitch) of this source.1170*1171* pRatio: Filled with the frequency ratio.1172*/1173FAUDIOAPI void FAudioSourceVoice_GetFrequencyRatio(1174FAudioSourceVoice *voice,1175float *pRatio1176);11771178/* Resets the core sample rate of this source.1179* You probably don't want this, it's more likely you want SetFrequencyRatio.1180* This is used to recycle voices without having to constantly reallocate them.1181* For example, if you have wavedata that's all float32 mono, but the sample1182* rates are different, you can take a source that was being used for a 48KHz1183* wave and call this so it can be used for a 44.1KHz wave.1184*1185* NewSourceSampleRate: The new sample rate for this source.1186*1187* Returns 0 on success.1188*/1189FAUDIOAPI uint32_t FAudioSourceVoice_SetSourceSampleRate(1190FAudioSourceVoice *voice,1191uint32_t NewSourceSampleRate1192);11931194/* FAudioMasteringVoice Interface */11951196/* Requests the channel mask for the mastering voice.1197* This is typically used with F3DAudioInitialize, but you may find it1198* interesting if you want to see the user's basic speaker layout.1199*1200* pChannelMask: Filled with the channel mask.1201*1202* Returns 0 on success.1203*/1204FAUDIOAPI uint32_t FAudioMasteringVoice_GetChannelMask(1205FAudioMasteringVoice *voice,1206uint32_t *pChannelMask1207);12081209/* FAudioEngineCallback Interface */12101211/* If something horrible happens, this will be called.1212*1213* Error: The error code that spawned this callback.1214*/1215typedef void (FAUDIOCALL * OnCriticalErrorFunc)(1216FAudioEngineCallback *callback,1217uint32_t Error1218);12191220/* This is called at the end of a processing update. */1221typedef void (FAUDIOCALL * OnProcessingPassEndFunc)(1222FAudioEngineCallback *callback1223);12241225/* This is called at the beginning of a processing update. */1226typedef void (FAUDIOCALL * OnProcessingPassStartFunc)(1227FAudioEngineCallback *callback1228);12291230struct FAudioEngineCallback1231{1232OnCriticalErrorFunc OnCriticalError;1233OnProcessingPassEndFunc OnProcessingPassEnd;1234OnProcessingPassStartFunc OnProcessingPassStart;1235};12361237/* FAudioVoiceCallback Interface */12381239/* When a buffer is no longer in use, this is called.1240*1241* pBufferContext: The pContext for the FAudioBuffer in question.1242*/1243typedef void (FAUDIOCALL * OnBufferEndFunc)(1244FAudioVoiceCallback *callback,1245void *pBufferContext1246);12471248/* When a buffer is now being used, this is called.1249*1250* pBufferContext: The pContext for the FAudioBuffer in question.1251*/1252typedef void (FAUDIOCALL * OnBufferStartFunc)(1253FAudioVoiceCallback *callback,1254void *pBufferContext1255);12561257/* When a buffer completes a loop, this is called.1258*1259* pBufferContext: The pContext for the FAudioBuffer in question.1260*/1261typedef void (FAUDIOCALL * OnLoopEndFunc)(1262FAudioVoiceCallback *callback,1263void *pBufferContext1264);12651266/* When a buffer that has the END_OF_STREAM flag is finished, this is called. */1267typedef void (FAUDIOCALL * OnStreamEndFunc)(1268FAudioVoiceCallback *callback1269);12701271/* If something horrible happens to a voice, this is called.1272*1273* pBufferContext: The pContext for the FAudioBuffer in question.1274* Error: The error code that spawned this callback.1275*/1276typedef void (FAUDIOCALL * OnVoiceErrorFunc)(1277FAudioVoiceCallback *callback,1278void *pBufferContext,1279uint32_t Error1280);12811282/* When this voice is done being processed, this is called. */1283typedef void (FAUDIOCALL * OnVoiceProcessingPassEndFunc)(1284FAudioVoiceCallback *callback1285);12861287/* When a voice is about to start being processed, this is called.1288*1289* BytesRequested: The number of bytes needed from the application to1290* complete a full update. For example, if we need 5121291* frames for a whole update, and the voice is a float321292* stereo source, BytesRequired will be 4096.1293*/1294typedef void (FAUDIOCALL * OnVoiceProcessingPassStartFunc)(1295FAudioVoiceCallback *callback,1296uint32_t BytesRequired1297);12981299struct FAudioVoiceCallback1300{1301OnBufferEndFunc OnBufferEnd;1302OnBufferStartFunc OnBufferStart;1303OnLoopEndFunc OnLoopEnd;1304OnStreamEndFunc OnStreamEnd;1305OnVoiceErrorFunc OnVoiceError;1306OnVoiceProcessingPassEndFunc OnVoiceProcessingPassEnd;1307OnVoiceProcessingPassStartFunc OnVoiceProcessingPassStart;1308};13091310/* FAudio Custom Allocator API1311* See "extensions/CustomAllocatorEXT.txt" for more information.1312*/13131314typedef void* (FAUDIOCALL * FAudioMallocFunc)(size_t size);1315typedef void (FAUDIOCALL * FAudioFreeFunc)(void* ptr);1316typedef void* (FAUDIOCALL * FAudioReallocFunc)(void* ptr, size_t size);13171318FAUDIOAPI uint32_t FAudioCreateWithCustomAllocatorEXT(1319FAudio **ppFAudio,1320uint32_t Flags,1321FAudioProcessor XAudio2Processor,1322FAudioMallocFunc customMalloc,1323FAudioFreeFunc customFree,1324FAudioReallocFunc customRealloc1325);1326FAUDIOAPI uint32_t FAudioCOMConstructWithCustomAllocatorEXT(1327FAudio **ppFAudio,1328uint8_t version,1329FAudioMallocFunc customMalloc,1330FAudioFreeFunc customFree,1331FAudioReallocFunc customRealloc1332);13331334/* FAudio Engine Procedure API1335* See "extensions/EngineProcedureEXT.txt" for more information.1336*/1337typedef void (FAUDIOCALL *FAudioEngineCallEXT)(FAudio *audio, float *output);1338typedef void (FAUDIOCALL *FAudioEngineProcedureEXT)(FAudioEngineCallEXT defaultEngineProc, FAudio *audio, float *output, void *user);13391340FAUDIOAPI void FAudio_SetEngineProcedureEXT(1341FAudio *audio,1342FAudioEngineProcedureEXT clientEngineProc,1343void *user1344);134513461347/* FAudio I/O API */13481349#define FAUDIO_SEEK_SET 01350#define FAUDIO_SEEK_CUR 11351#define FAUDIO_SEEK_END 21352#define FAUDIO_EOF -113531354typedef size_t (FAUDIOCALL * FAudio_readfunc)(1355void *data,1356void *dst,1357size_t size,1358size_t count1359);1360typedef int64_t (FAUDIOCALL * FAudio_seekfunc)(1361void *data,1362int64_t offset,1363int whence1364);1365typedef int (FAUDIOCALL * FAudio_closefunc)(1366void *data1367);13681369typedef struct FAudioIOStream1370{1371void *data;1372FAudio_readfunc read;1373FAudio_seekfunc seek;1374FAudio_closefunc close;1375void *lock;1376} FAudioIOStream;13771378FAUDIOAPI FAudioIOStream* FAudio_fopen(const char *path);1379FAUDIOAPI FAudioIOStream* FAudio_memopen(void *mem, int len);1380FAUDIOAPI uint8_t* FAudio_memptr(FAudioIOStream *io, size_t offset);1381FAUDIOAPI void FAudio_close(FAudioIOStream *io);13821383#ifdef __cplusplus1384}1385#endif /* __cplusplus */13861387#endif /* FAUDIO_H */13881389/* vim: set noexpandtab shiftwidth=8 tabstop=8: */139013911392