/* 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_E_OUT_OF_MEMORY 0x8007000e344#define FAUDIO_E_INVALID_ARG 0x80070057345#define FAUDIO_E_UNSUPPORTED_FORMAT 0x88890008346#define FAUDIO_E_INVALID_CALL 0x88960001347#define FAUDIO_E_DEVICE_INVALIDATED 0x88960004348#define FAPO_E_FORMAT_UNSUPPORTED 0x88970001349350#define FAUDIO_MAX_BUFFER_BYTES 0x80000000351#define FAUDIO_MAX_QUEUED_BUFFERS 64352#define FAUDIO_MAX_AUDIO_CHANNELS 64353#define FAUDIO_MIN_SAMPLE_RATE 1000354#define FAUDIO_MAX_SAMPLE_RATE 200000355#define FAUDIO_MAX_VOLUME_LEVEL 16777216.0f356#define FAUDIO_MIN_FREQ_RATIO (1.0f / 1024.0f)357#define FAUDIO_MAX_FREQ_RATIO 1024.0f358#define FAUDIO_DEFAULT_FREQ_RATIO 2.0f359#define FAUDIO_MAX_FILTER_ONEOVERQ 1.5f360#define FAUDIO_MAX_FILTER_FREQUENCY 1.0f361#define FAUDIO_MAX_LOOP_COUNT 254362363#define FAUDIO_COMMIT_NOW 0364#define FAUDIO_COMMIT_ALL 0365#define FAUDIO_INVALID_OPSET (uint32_t) (-1)366#define FAUDIO_NO_LOOP_REGION 0367#define FAUDIO_LOOP_INFINITE 255368#define FAUDIO_DEFAULT_CHANNELS 0369#define FAUDIO_DEFAULT_SAMPLERATE 0370371#define FAUDIO_DEBUG_ENGINE 0x0001372#define FAUDIO_VOICE_NOPITCH 0x0002373#define FAUDIO_VOICE_NOSRC 0x0004374#define FAUDIO_VOICE_USEFILTER 0x0008375#define FAUDIO_VOICE_MUSIC 0x0010376#define FAUDIO_PLAY_TAILS 0x0020377#define FAUDIO_END_OF_STREAM 0x0040378#define FAUDIO_SEND_USEFILTER 0x0080379#define FAUDIO_VOICE_NOSAMPLESPLAYED 0x0100380#define FAUDIO_1024_QUANTUM 0x8000381382#define FAUDIO_DEFAULT_FILTER_TYPE FAudioLowPassFilter383#define FAUDIO_DEFAULT_FILTER_FREQUENCY FAUDIO_MAX_FILTER_FREQUENCY384#define FAUDIO_DEFAULT_FILTER_ONEOVERQ 1.0f385#define FAUDIO_DEFAULT_FILTER_WETDRYMIX_EXT 1.0f386387#define FAUDIO_LOG_ERRORS 0x0001388#define FAUDIO_LOG_WARNINGS 0x0002389#define FAUDIO_LOG_INFO 0x0004390#define FAUDIO_LOG_DETAIL 0x0008391#define FAUDIO_LOG_API_CALLS 0x0010392#define FAUDIO_LOG_FUNC_CALLS 0x0020393#define FAUDIO_LOG_TIMING 0x0040394#define FAUDIO_LOG_LOCKS 0x0080395#define FAUDIO_LOG_MEMORY 0x0100396#define FAUDIO_LOG_STREAMING 0x1000397398#ifndef _SPEAKER_POSITIONS_399#define SPEAKER_FRONT_LEFT 0x00000001400#define SPEAKER_FRONT_RIGHT 0x00000002401#define SPEAKER_FRONT_CENTER 0x00000004402#define SPEAKER_LOW_FREQUENCY 0x00000008403#define SPEAKER_BACK_LEFT 0x00000010404#define SPEAKER_BACK_RIGHT 0x00000020405#define SPEAKER_FRONT_LEFT_OF_CENTER 0x00000040406#define SPEAKER_FRONT_RIGHT_OF_CENTER 0x00000080407#define SPEAKER_BACK_CENTER 0x00000100408#define SPEAKER_SIDE_LEFT 0x00000200409#define SPEAKER_SIDE_RIGHT 0x00000400410#define SPEAKER_TOP_CENTER 0x00000800411#define SPEAKER_TOP_FRONT_LEFT 0x00001000412#define SPEAKER_TOP_FRONT_CENTER 0x00002000413#define SPEAKER_TOP_FRONT_RIGHT 0x00004000414#define SPEAKER_TOP_BACK_LEFT 0x00008000415#define SPEAKER_TOP_BACK_CENTER 0x00010000416#define SPEAKER_TOP_BACK_RIGHT 0x00020000417#define _SPEAKER_POSITIONS_418#endif419420#ifndef SPEAKER_MONO421#define SPEAKER_MONO SPEAKER_FRONT_CENTER422#define SPEAKER_STEREO (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT)423#define SPEAKER_2POINT1 \424( SPEAKER_FRONT_LEFT | \425SPEAKER_FRONT_RIGHT | \426SPEAKER_LOW_FREQUENCY )427#define SPEAKER_SURROUND \428( SPEAKER_FRONT_LEFT | \429SPEAKER_FRONT_RIGHT | \430SPEAKER_FRONT_CENTER | \431SPEAKER_BACK_CENTER )432#define SPEAKER_QUAD \433( SPEAKER_FRONT_LEFT | \434SPEAKER_FRONT_RIGHT | \435SPEAKER_BACK_LEFT | \436SPEAKER_BACK_RIGHT )437#define SPEAKER_4POINT1 \438( SPEAKER_FRONT_LEFT | \439SPEAKER_FRONT_RIGHT | \440SPEAKER_LOW_FREQUENCY | \441SPEAKER_BACK_LEFT | \442SPEAKER_BACK_RIGHT )443#define SPEAKER_5POINT1 \444( SPEAKER_FRONT_LEFT | \445SPEAKER_FRONT_RIGHT | \446SPEAKER_FRONT_CENTER | \447SPEAKER_LOW_FREQUENCY | \448SPEAKER_BACK_LEFT | \449SPEAKER_BACK_RIGHT )450#define SPEAKER_7POINT1 \451( SPEAKER_FRONT_LEFT | \452SPEAKER_FRONT_RIGHT | \453SPEAKER_FRONT_CENTER | \454SPEAKER_LOW_FREQUENCY | \455SPEAKER_BACK_LEFT | \456SPEAKER_BACK_RIGHT | \457SPEAKER_FRONT_LEFT_OF_CENTER | \458SPEAKER_FRONT_RIGHT_OF_CENTER )459#define SPEAKER_5POINT1_SURROUND \460( SPEAKER_FRONT_LEFT | \461SPEAKER_FRONT_RIGHT | \462SPEAKER_FRONT_CENTER | \463SPEAKER_LOW_FREQUENCY | \464SPEAKER_SIDE_LEFT | \465SPEAKER_SIDE_RIGHT )466#define SPEAKER_7POINT1_SURROUND \467( SPEAKER_FRONT_LEFT | \468SPEAKER_FRONT_RIGHT | \469SPEAKER_FRONT_CENTER | \470SPEAKER_LOW_FREQUENCY | \471SPEAKER_BACK_LEFT | \472SPEAKER_BACK_RIGHT | \473SPEAKER_SIDE_LEFT | \474SPEAKER_SIDE_RIGHT )475#define SPEAKER_XBOX SPEAKER_5POINT1476#endif477478#define FAUDIO_FORMAT_PCM 1479#define FAUDIO_FORMAT_MSADPCM 2480#define FAUDIO_FORMAT_IEEE_FLOAT 3481#define FAUDIO_FORMAT_WMAUDIO2 0x0161482#define FAUDIO_FORMAT_WMAUDIO3 0x0162483#define FAUDIO_FORMAT_WMAUDIO_LOSSLESS 0x0163484#define FAUDIO_FORMAT_XMAUDIO2 0x0166485#define FAUDIO_FORMAT_EXTENSIBLE 0xFFFE486487extern FAudioGUID DATAFORMAT_SUBTYPE_PCM;488extern FAudioGUID DATAFORMAT_SUBTYPE_IEEE_FLOAT;489490/* FAudio Version API */491492#define FAUDIO_TARGET_VERSION 8 /* Targeting compatibility with XAudio 2.8 */493494#define FAUDIO_ABI_VERSION 0495#define FAUDIO_MAJOR_VERSION 25496#define FAUDIO_MINOR_VERSION 9497#define FAUDIO_PATCH_VERSION 0498499#define FAUDIO_COMPILED_VERSION ( \500(FAUDIO_ABI_VERSION * 100 * 100 * 100) + \501(FAUDIO_MAJOR_VERSION * 100 * 100) + \502(FAUDIO_MINOR_VERSION * 100) + \503(FAUDIO_PATCH_VERSION) \504)505506FAUDIOAPI uint32_t FAudioLinkedVersion(void);507508/* FAudio Interface */509510/* This should be your first FAudio call.511*512* ppFAudio: Filled with the FAudio core context.513* Flags: Can be 0 or a combination of FAUDIO_DEBUG_ENGINE and FAUDIO_1024_QUANTUM.514* XAudio2Processor: Set this to FAUDIO_DEFAULT_PROCESSOR.515*516* Returns 0 on success.517*/518FAUDIOAPI uint32_t FAudioCreate(519FAudio **ppFAudio,520uint32_t Flags,521FAudioProcessor XAudio2Processor522);523524/* See "extensions/COMConstructEXT.txt" for more details */525FAUDIOAPI uint32_t FAudioCOMConstructEXT(FAudio **ppFAudio, uint8_t version);526527/* Increments a reference counter. When counter is 0, audio is freed.528* Returns the reference count after incrementing.529*/530FAUDIOAPI uint32_t FAudio_AddRef(FAudio *audio);531532/* Decrements a reference counter. When counter is 0, audio is freed.533* Returns the reference count after decrementing.534*/535FAUDIOAPI uint32_t FAudio_Release(FAudio *audio);536537/* Queries the number of sound devices available for use.538*539* pCount: Filled with the number of available sound devices.540*541* Returns 0 on success.542*/543FAUDIOAPI uint32_t FAudio_GetDeviceCount(FAudio *audio, uint32_t *pCount);544545/* Gets basic information about a sound device.546*547* Index: Can be between 0 and the result of GetDeviceCount.548* pDeviceDetails: Filled with the device information.549*550* Returns 0 on success.551*/552FAUDIOAPI uint32_t FAudio_GetDeviceDetails(553FAudio *audio,554uint32_t Index,555FAudioDeviceDetails *pDeviceDetails556);557558/* You don't actually have to call this, unless you're using the COM APIs.559* See the FAudioCreate API for parameter information.560*/561FAUDIOAPI uint32_t FAudio_Initialize(562FAudio *audio,563uint32_t Flags,564FAudioProcessor XAudio2Processor565);566567/* Register a new set of engine callbacks.568* There is no limit to the number of sets, but expect performance to degrade569* if you have a whole bunch of these. You most likely only need one.570*571* pCallback: The completely-initialized FAudioEngineCallback structure.572*573* Returns 0 on success.574*/575FAUDIOAPI uint32_t FAudio_RegisterForCallbacks(576FAudio *audio,577FAudioEngineCallback *pCallback578);579580/* Remove an active set of engine callbacks.581* This checks the pointer value, NOT the callback values!582*583* pCallback: An FAudioEngineCallback structure previously sent to Register.584*585* Returns 0 on success.586*/587FAUDIOAPI void FAudio_UnregisterForCallbacks(588FAudio *audio,589FAudioEngineCallback *pCallback590);591592/* Creates a "source" voice, used to play back wavedata.593*594* ppSourceVoice: Filled with the source voice pointer.595* pSourceFormat: The input wavedata format, see the documentation for596* FAudioWaveFormatEx.597* Flags: Can be 0 or a mix of the following FAUDIO_VOICE_* flags:598* NOPITCH/NOSRC: Resampling is disabled. If you set this,599* the source format sample rate MUST match600* the output voices' input sample rates.601* Also, SetFrequencyRatio will fail.602* USEFILTER: Enables the use of SetFilterParameters.603* MUSIC: Unsupported.604* MaxFrequencyRatio: AKA your max pitch. This allows us to optimize the size605* of the decode/resample cache sizes. For example, if you606* only expect to raise pitch by a single octave, you can607* set this value to 2.0f. 2.0f is the default value.608* Bounds: [FAUDIO_MIN_FREQ_RATIO, FAUDIO_MAX_FREQ_RATIO].609* pCallback: Voice callbacks, see FAudioVoiceCallback documentation.610* pSendList: List of output voices. If NULL, defaults to master.611* All output voices must have the same sample rate!612* pEffectChain: List of FAPO effects. This value can be NULL.613*614* Returns 0 on success.615*/616FAUDIOAPI uint32_t FAudio_CreateSourceVoice(617FAudio *audio,618FAudioSourceVoice **ppSourceVoice,619const FAudioWaveFormatEx *pSourceFormat,620uint32_t Flags,621float MaxFrequencyRatio,622FAudioVoiceCallback *pCallback,623const FAudioVoiceSends *pSendList,624const FAudioEffectChain *pEffectChain625);626627/* Creates a "submix" voice, used to mix/process input voices.628* The typical use case for this is to perform CPU-intensive tasks on large629* groups of voices all at once. Examples include resampling and FAPO effects.630*631* ppSubmixVoice: Filled with the submix voice pointer.632* InputChannels: Input voices will convert to this channel count.633* InputSampleRate: Input voices will convert to this sample rate.634* Flags: Can be 0 or FAUDIO_VOICE_USEFILTER.635* ProcessingStage: If you have multiple submixes that depend on a specific636* order of processing, you can sort them by setting this637* value to prioritize them. For example, submixes with638* stage 0 will process first, then stage 1, 2, and so on.639* pSendList: List of output voices. If NULL, defaults to master.640* All output voices must have the same sample rate!641* pEffectChain: List of FAPO effects. This value can be NULL.642*643* Returns 0 on success.644*/645FAUDIOAPI uint32_t FAudio_CreateSubmixVoice(646FAudio *audio,647FAudioSubmixVoice **ppSubmixVoice,648uint32_t InputChannels,649uint32_t InputSampleRate,650uint32_t Flags,651uint32_t ProcessingStage,652const FAudioVoiceSends *pSendList,653const FAudioEffectChain *pEffectChain654);655656/* This should be your second FAudio call, unless you care about which device657* you want to use. In that case, see GetDeviceDetails.658*659* ppMasteringVoice: Filled with the mastering voice pointer.660* InputChannels: Device channel count. Can be FAUDIO_DEFAULT_CHANNELS.661* InputSampleRate: Device sample rate. Can be FAUDIO_DEFAULT_SAMPLERATE.662* Flags: This value must be 0.663* DeviceIndex: 0 for the default device. See GetDeviceCount.664* pEffectChain: List of FAPO effects. This value can be NULL.665*666* Returns 0 on success.667*/668FAUDIOAPI uint32_t FAudio_CreateMasteringVoice(669FAudio *audio,670FAudioMasteringVoice **ppMasteringVoice,671uint32_t InputChannels,672uint32_t InputSampleRate,673uint32_t Flags,674uint32_t DeviceIndex,675const FAudioEffectChain *pEffectChain676);677678/* This is the XAudio 2.8+ version of CreateMasteringVoice.679* Right now this doesn't do anything. Don't use this function.680*/681FAUDIOAPI uint32_t FAudio_CreateMasteringVoice8(682FAudio *audio,683FAudioMasteringVoice **ppMasteringVoice,684uint32_t InputChannels,685uint32_t InputSampleRate,686uint32_t Flags,687uint16_t *szDeviceId,688const FAudioEffectChain *pEffectChain,689FAudioStreamCategory StreamCategory690);691692/* Starts the engine, begins processing the audio graph.693* Returns 0 on success.694*/695FAUDIOAPI uint32_t FAudio_StartEngine(FAudio *audio);696697/* Stops the engine and halts all processing.698* The audio device will continue to run, but will produce silence.699* The graph will be frozen until you call StartEngine, where it will then700* resume all processing exactly as it would have had this never been called.701*/702FAUDIOAPI void FAudio_StopEngine(FAudio *audio);703704/* Flushes a batch of FAudio calls compiled with a given "OperationSet" tag.705* This function is based on IXAudio2::CommitChanges from the XAudio2 spec.706* This is useful for pushing calls that need to be done perfectly in sync. For707* example, if you want to play two separate sources at the exact same time, you708* can call FAudioSourceVoice_Start with an OperationSet value of your choice,709* then call CommitChanges with that same value to start the sources together.710*711* OperationSet: Either a value known by you or FAUDIO_COMMIT_ALL712*713* Returns 0 on success.714*/715FAUDIOAPI uint32_t FAudio_CommitOperationSet(716FAudio *audio,717uint32_t OperationSet718);719720/* DO NOT USE THIS FUNCTION OR I SWEAR TO GOD */721FAUDIODEPRECATED("This function will break your program! Use FAudio_CommitOperationSet instead!")722FAUDIOAPI uint32_t FAudio_CommitChanges(FAudio *audio);723724/* Requests various bits of performance information from the engine.725*726* pPerfData: Filled with the data. See FAudioPerformanceData for details.727*/728FAUDIOAPI void FAudio_GetPerformanceData(729FAudio *audio,730FAudioPerformanceData *pPerfData731);732733/* When using a Debug binary, this lets you configure what information gets734* logged to output. Be careful, this can spit out a LOT of text.735*736* pDebugConfiguration: See FAudioDebugConfiguration for details.737* pReserved: Set this to NULL.738*/739FAUDIOAPI void FAudio_SetDebugConfiguration(740FAudio *audio,741FAudioDebugConfiguration *pDebugConfiguration,742void* pReserved743);744745/* Requests the values that determine's the engine's update size.746* For example, a 48KHz engine with a 1024-sample update period would return747* 1024 for the numerator and 48000 for the denominator. With this information,748* you can determine the precise update size in milliseconds.749*750* quantumNumerator - The engine's update size, in sample frames.751* quantumDenominator - The engine's sample rate, in Hz752*/753FAUDIOAPI void FAudio_GetProcessingQuantum(754FAudio *audio,755uint32_t *quantumNumerator,756uint32_t *quantumDenominator757);758759/* FAudioVoice Interface */760761/* Requests basic information about a voice.762*763* pVoiceDetails: See FAudioVoiceDetails for details.764*/765FAUDIOAPI void FAudioVoice_GetVoiceDetails(766FAudioVoice *voice,767FAudioVoiceDetails *pVoiceDetails768);769770/* Change the output voices for this voice.771* This function is invalid for mastering voices.772*773* pSendList: List of output voices. If NULL, defaults to master.774* All output voices must have the same sample rate!775*776* Returns 0 on success.777*/778FAUDIOAPI uint32_t FAudioVoice_SetOutputVoices(779FAudioVoice *voice,780const FAudioVoiceSends *pSendList781);782783/* Change/Remove the effect chain for this voice.784*785* pEffectChain: List of FAPO effects. This value can be NULL.786* Note that the final channel counts for this chain MUST787* match the input/output channel count that was788* determined at voice creation time!789*790* Returns 0 on success.791*/792FAUDIOAPI uint32_t FAudioVoice_SetEffectChain(793FAudioVoice *voice,794const FAudioEffectChain *pEffectChain795);796797/* Enables an effect in the effect chain.798*799* EffectIndex: The index of the effect (based on the chain order).800* OperationSet: See CommitChanges. Default is FAUDIO_COMMIT_NOW.801*802* Returns 0 on success.803*/804FAUDIOAPI uint32_t FAudioVoice_EnableEffect(805FAudioVoice *voice,806uint32_t EffectIndex,807uint32_t OperationSet808);809810/* Disables an effect in the effect chain.811*812* EffectIndex: The index of the effect (based on the chain order).813* OperationSet: See CommitChanges. Default is FAUDIO_COMMIT_NOW.814*815* Returns 0 on success.816*/817FAUDIOAPI uint32_t FAudioVoice_DisableEffect(818FAudioVoice *voice,819uint32_t EffectIndex,820uint32_t OperationSet821);822823/* Queries the enabled/disabled state of an effect in the effect chain.824*825* EffectIndex: The index of the effect (based on the chain order).826* pEnabled: Filled with either 1 (Enabled) or 0 (Disabled).827*828* Returns 0 on success.829*/830FAUDIOAPI void FAudioVoice_GetEffectState(831FAudioVoice *voice,832uint32_t EffectIndex,833int32_t *pEnabled834);835836/* Submits a block of memory to be sent to FAPO::SetParameters.837*838* EffectIndex: The index of the effect (based on the chain order).839* pParameters: The values to be copied and submitted to the FAPO.840* ParametersByteSize: This should match what the FAPO expects!841* OperationSet: See CommitChanges. Default is FAUDIO_COMMIT_NOW.842*843* Returns 0 on success.844*/845FAUDIOAPI uint32_t FAudioVoice_SetEffectParameters(846FAudioVoice *voice,847uint32_t EffectIndex,848const void *pParameters,849uint32_t ParametersByteSize,850uint32_t OperationSet851);852853/* Requests the latest parameters from FAPO::GetParameters.854*855* EffectIndex: The index of the effect (based on the chain order).856* pParameters: Filled with the latest parameter values from the FAPO.857* ParametersByteSize: This should match what the FAPO expects!858*859* Returns 0 on success.860*/861FAUDIOAPI uint32_t FAudioVoice_GetEffectParameters(862FAudioVoice *voice,863uint32_t EffectIndex,864void *pParameters,865uint32_t ParametersByteSize866);867868/* Sets the filter variables for a voice.869* This is only valid on voices with the USEFILTER flag.870*871* pParameters: See FAudioFilterParameters for details.872* OperationSet: See CommitChanges. Default is FAUDIO_COMMIT_NOW.873*874* Returns 0 on success.875*/876FAUDIOAPI uint32_t FAudioVoice_SetFilterParameters(877FAudioVoice *voice,878const FAudioFilterParameters *pParameters,879uint32_t OperationSet880);881882/* Requests the filter variables for a voice.883* This is only valid on voices with the USEFILTER flag.884*885* pParameters: See FAudioFilterParameters for details.886*/887FAUDIOAPI void FAudioVoice_GetFilterParameters(888FAudioVoice *voice,889FAudioFilterParameters *pParameters890);891892/* Sets the filter variables for a voice's output voice.893* This is only valid on sends with the USEFILTER flag.894*895* pDestinationVoice: An output voice from the voice's send list.896* pParameters: See FAudioFilterParameters for details.897* OperationSet: See CommitChanges. Default is FAUDIO_COMMIT_NOW.898*899* Returns 0 on success.900*/901FAUDIOAPI uint32_t FAudioVoice_SetOutputFilterParameters(902FAudioVoice *voice,903FAudioVoice *pDestinationVoice,904const FAudioFilterParameters *pParameters,905uint32_t OperationSet906);907908/* Requests the filter variables for a voice's output voice.909* This is only valid on sends with the USEFILTER flag.910*911* pDestinationVoice: An output voice from the voice's send list.912* pParameters: See FAudioFilterParameters for details.913*/914FAUDIOAPI void FAudioVoice_GetOutputFilterParameters(915FAudioVoice *voice,916FAudioVoice *pDestinationVoice,917FAudioFilterParameters *pParameters918);919920/* Sets the filter variables for a voice.921* This is only valid on voices with the USEFILTER flag.922*923* pParameters: See FAudioFilterParametersEXT for details.924* OperationSet: See CommitChanges. Default is FAUDIO_COMMIT_NOW.925*926* Returns 0 on success.927*/928FAUDIOAPI uint32_t FAudioVoice_SetFilterParametersEXT(929FAudioVoice* voice,930const FAudioFilterParametersEXT* pParameters,931uint32_t OperationSet932);933934/* Requests the filter variables for a voice.935* This is only valid on voices with the USEFILTER flag.936*937* pParameters: See FAudioFilterParametersEXT for details.938*/939FAUDIOAPI void FAudioVoice_GetFilterParametersEXT(940FAudioVoice* voice,941FAudioFilterParametersEXT* pParameters942);943944/* Sets the filter variables for a voice's output voice.945* This is only valid on sends with the USEFILTER flag.946*947* pDestinationVoice: An output voice from the voice's send list.948* pParameters: See FAudioFilterParametersEXT for details.949* OperationSet: See CommitChanges. Default is FAUDIO_COMMIT_NOW.950*951* Returns 0 on success.952*/953FAUDIOAPI uint32_t FAudioVoice_SetOutputFilterParametersEXT(954FAudioVoice* voice,955FAudioVoice* pDestinationVoice,956const FAudioFilterParametersEXT* pParameters,957uint32_t OperationSet958);959960/* Requests the filter variables for a voice's output voice.961* This is only valid on sends with the USEFILTER flag.962*963* pDestinationVoice: An output voice from the voice's send list.964* pParameters: See FAudioFilterParametersEXT for details.965*/966FAUDIOAPI void FAudioVoice_GetOutputFilterParametersEXT(967FAudioVoice* voice,968FAudioVoice* pDestinationVoice,969FAudioFilterParametersEXT* pParameters970);971972/* Sets the global volume of a voice.973*974* Volume: Amplitude ratio. 1.0f is default, 0.0f is silence.975* Note that you can actually set volume < 0.0f!976* Bounds: [-FAUDIO_MAX_VOLUME_LEVEL, FAUDIO_MAX_VOLUME_LEVEL]977* OperationSet: See CommitChanges. Default is FAUDIO_COMMIT_NOW.978*979* Returns 0 on success.980*/981FAUDIOAPI uint32_t FAudioVoice_SetVolume(982FAudioVoice *voice,983float Volume,984uint32_t OperationSet985);986987/* Requests the global volume of a voice.988*989* pVolume: Filled with the current voice amplitude ratio.990*/991FAUDIOAPI void FAudioVoice_GetVolume(992FAudioVoice *voice,993float *pVolume994);995996/* Sets the per-channel volumes of a voice.997*998* Channels: Must match the channel count of this voice!999* pVolumes: Amplitude ratios for each channel. Same as SetVolume.1000* OperationSet: See CommitChanges. Default is FAUDIO_COMMIT_NOW.1001*1002* Returns 0 on success.1003*/1004FAUDIOAPI uint32_t FAudioVoice_SetChannelVolumes(1005FAudioVoice *voice,1006uint32_t Channels,1007const float *pVolumes,1008uint32_t OperationSet1009);10101011/* Requests the per-channel volumes of a voice.1012*1013* Channels: Must match the channel count of this voice!1014* pVolumes: Filled with the current channel amplitude ratios.1015*/1016FAUDIOAPI void FAudioVoice_GetChannelVolumes(1017FAudioVoice *voice,1018uint32_t Channels,1019float *pVolumes1020);10211022/* Sets the volumes of a send's output channels. The matrix is based on the1023* voice's input channels. For example, the default matrix for a 2-channel1024* source and a 2-channel output voice is as follows:1025* [0] = 1.0f; <- Left input, left output1026* [1] = 0.0f; <- Right input, left output1027* [2] = 0.0f; <- Left input, right output1028* [3] = 1.0f; <- Right input, right output1029* This is typically only used for panning or 3D sound (via F3DAudio).1030*1031* pDestinationVoice: An output voice from the voice's send list.1032* SourceChannels: Must match the voice's input channel count!1033* DestinationChannels: Must match the destination's input channel count!1034* pLevelMatrix: A float[SourceChannels * DestinationChannels].1035* OperationSet: See CommitChanges. Default is FAUDIO_COMMIT_NOW.1036*1037* Returns 0 on success.1038*/1039FAUDIOAPI uint32_t FAudioVoice_SetOutputMatrix(1040FAudioVoice *voice,1041FAudioVoice *pDestinationVoice,1042uint32_t SourceChannels,1043uint32_t DestinationChannels,1044const float *pLevelMatrix,1045uint32_t OperationSet1046);10471048/* Gets the volumes of a send's output channels. See SetOutputMatrix.1049*1050* pDestinationVoice: An output voice from the voice's send list.1051* SourceChannels: Must match the voice's input channel count!1052* DestinationChannels: Must match the voice's output channel count!1053* pLevelMatrix: A float[SourceChannels * DestinationChannels].1054*/1055FAUDIOAPI void FAudioVoice_GetOutputMatrix(1056FAudioVoice *voice,1057FAudioVoice *pDestinationVoice,1058uint32_t SourceChannels,1059uint32_t DestinationChannels,1060float *pLevelMatrix1061);10621063/* Removes this voice from the audio graph and frees memory. */1064FAUDIOAPI void FAudioVoice_DestroyVoice(FAudioVoice *voice);10651066/*1067* Returns S_OK on success and E_FAIL if voice could not be destroyed (e. g., because it is in use).1068*/1069FAUDIOAPI uint32_t FAudioVoice_DestroyVoiceSafeEXT(FAudioVoice *voice);10701071/* FAudioSourceVoice Interface */10721073/* Starts processing for a source voice.1074*1075* Flags: Must be 0.1076* OperationSet: See CommitChanges. Default is FAUDIO_COMMIT_NOW.1077*1078* Returns 0 on success.1079*/1080FAUDIOAPI uint32_t FAudioSourceVoice_Start(1081FAudioSourceVoice *voice,1082uint32_t Flags,1083uint32_t OperationSet1084);10851086/* Pauses processing for a source voice. Yes, I said pausing.1087* If you want to _actually_ stop, call FlushSourceBuffers next.1088*1089* Flags: Can be 0 or FAUDIO_PLAY_TAILS, which allows effects to1090* keep emitting output even after processing has stopped.1091* OperationSet: See CommitChanges. Default is FAUDIO_COMMIT_NOW.1092*1093* Returns 0 on success.1094*/1095FAUDIOAPI uint32_t FAudioSourceVoice_Stop(1096FAudioSourceVoice *voice,1097uint32_t Flags,1098uint32_t OperationSet1099);11001101/* Submits a block of wavedata for the source to process.1102*1103* pBuffer: See FAudioBuffer for details.1104* pBufferWMA: See FAudioBufferWMA for details. (Also, don't use WMA.)1105*1106* Returns 0 on success.1107*/1108FAUDIOAPI uint32_t FAudioSourceVoice_SubmitSourceBuffer(1109FAudioSourceVoice *voice,1110const FAudioBuffer *pBuffer,1111const FAudioBufferWMA *pBufferWMA1112);11131114/* Removes all buffers from a source, with a minor exception.1115* If the voice is still playing, the active buffer is left alone.1116* All buffers that are removed will spawn an OnBufferEnd callback.1117*1118* Returns 0 on success.1119*/1120FAUDIOAPI uint32_t FAudioSourceVoice_FlushSourceBuffers(1121FAudioSourceVoice *voice1122);11231124/* Takes the last buffer currently queued and sets the END_OF_STREAM flag.1125*1126* Returns 0 on success.1127*/1128FAUDIOAPI uint32_t FAudioSourceVoice_Discontinuity(1129FAudioSourceVoice *voice1130);11311132/* Sets the loop count of the active buffer to 0.1133*1134* OperationSet: See CommitChanges. Default is FAUDIO_COMMIT_NOW.1135*1136* Returns 0 on success.1137*/1138FAUDIOAPI uint32_t FAudioSourceVoice_ExitLoop(1139FAudioSourceVoice *voice,1140uint32_t OperationSet1141);11421143/* Requests the state and some basic statistics for this source.1144*1145* pVoiceState: See FAudioVoiceState for details.1146* Flags: Can be 0 or FAUDIO_VOICE_NOSAMPLESPLAYED.1147*/1148FAUDIOAPI void FAudioSourceVoice_GetState(1149FAudioSourceVoice *voice,1150FAudioVoiceState *pVoiceState,1151uint32_t Flags1152);11531154/* Sets the frequency ratio (fancy phrase for pitch) of this source.1155*1156* Ratio: The frequency ratio, must be <= MaxFrequencyRatio.1157* OperationSet: See CommitChanges. Default is FAUDIO_COMMIT_NOW.1158*1159* Returns 0 on success.1160*/1161FAUDIOAPI uint32_t FAudioSourceVoice_SetFrequencyRatio(1162FAudioSourceVoice *voice,1163float Ratio,1164uint32_t OperationSet1165);11661167/* Requests the frequency ratio (fancy phrase for pitch) of this source.1168*1169* pRatio: Filled with the frequency ratio.1170*/1171FAUDIOAPI void FAudioSourceVoice_GetFrequencyRatio(1172FAudioSourceVoice *voice,1173float *pRatio1174);11751176/* Resets the core sample rate of this source.1177* You probably don't want this, it's more likely you want SetFrequencyRatio.1178* This is used to recycle voices without having to constantly reallocate them.1179* For example, if you have wavedata that's all float32 mono, but the sample1180* rates are different, you can take a source that was being used for a 48KHz1181* wave and call this so it can be used for a 44.1KHz wave.1182*1183* NewSourceSampleRate: The new sample rate for this source.1184*1185* Returns 0 on success.1186*/1187FAUDIOAPI uint32_t FAudioSourceVoice_SetSourceSampleRate(1188FAudioSourceVoice *voice,1189uint32_t NewSourceSampleRate1190);11911192/* FAudioMasteringVoice Interface */11931194/* Requests the channel mask for the mastering voice.1195* This is typically used with F3DAudioInitialize, but you may find it1196* interesting if you want to see the user's basic speaker layout.1197*1198* pChannelMask: Filled with the channel mask.1199*1200* Returns 0 on success.1201*/1202FAUDIOAPI uint32_t FAudioMasteringVoice_GetChannelMask(1203FAudioMasteringVoice *voice,1204uint32_t *pChannelMask1205);12061207/* FAudioEngineCallback Interface */12081209/* If something horrible happens, this will be called.1210*1211* Error: The error code that spawned this callback.1212*/1213typedef void (FAUDIOCALL * OnCriticalErrorFunc)(1214FAudioEngineCallback *callback,1215uint32_t Error1216);12171218/* This is called at the end of a processing update. */1219typedef void (FAUDIOCALL * OnProcessingPassEndFunc)(1220FAudioEngineCallback *callback1221);12221223/* This is called at the beginning of a processing update. */1224typedef void (FAUDIOCALL * OnProcessingPassStartFunc)(1225FAudioEngineCallback *callback1226);12271228struct FAudioEngineCallback1229{1230OnCriticalErrorFunc OnCriticalError;1231OnProcessingPassEndFunc OnProcessingPassEnd;1232OnProcessingPassStartFunc OnProcessingPassStart;1233};12341235/* FAudioVoiceCallback Interface */12361237/* When a buffer is no longer in use, this is called.1238*1239* pBufferContext: The pContext for the FAudioBuffer in question.1240*/1241typedef void (FAUDIOCALL * OnBufferEndFunc)(1242FAudioVoiceCallback *callback,1243void *pBufferContext1244);12451246/* When a buffer is now being used, this is called.1247*1248* pBufferContext: The pContext for the FAudioBuffer in question.1249*/1250typedef void (FAUDIOCALL * OnBufferStartFunc)(1251FAudioVoiceCallback *callback,1252void *pBufferContext1253);12541255/* When a buffer completes a loop, this is called.1256*1257* pBufferContext: The pContext for the FAudioBuffer in question.1258*/1259typedef void (FAUDIOCALL * OnLoopEndFunc)(1260FAudioVoiceCallback *callback,1261void *pBufferContext1262);12631264/* When a buffer that has the END_OF_STREAM flag is finished, this is called. */1265typedef void (FAUDIOCALL * OnStreamEndFunc)(1266FAudioVoiceCallback *callback1267);12681269/* If something horrible happens to a voice, this is called.1270*1271* pBufferContext: The pContext for the FAudioBuffer in question.1272* Error: The error code that spawned this callback.1273*/1274typedef void (FAUDIOCALL * OnVoiceErrorFunc)(1275FAudioVoiceCallback *callback,1276void *pBufferContext,1277uint32_t Error1278);12791280/* When this voice is done being processed, this is called. */1281typedef void (FAUDIOCALL * OnVoiceProcessingPassEndFunc)(1282FAudioVoiceCallback *callback1283);12841285/* When a voice is about to start being processed, this is called.1286*1287* BytesRequested: The number of bytes needed from the application to1288* complete a full update. For example, if we need 5121289* frames for a whole update, and the voice is a float321290* stereo source, BytesRequired will be 4096.1291*/1292typedef void (FAUDIOCALL * OnVoiceProcessingPassStartFunc)(1293FAudioVoiceCallback *callback,1294uint32_t BytesRequired1295);12961297struct FAudioVoiceCallback1298{1299OnBufferEndFunc OnBufferEnd;1300OnBufferStartFunc OnBufferStart;1301OnLoopEndFunc OnLoopEnd;1302OnStreamEndFunc OnStreamEnd;1303OnVoiceErrorFunc OnVoiceError;1304OnVoiceProcessingPassEndFunc OnVoiceProcessingPassEnd;1305OnVoiceProcessingPassStartFunc OnVoiceProcessingPassStart;1306};13071308/* FAudio Custom Allocator API1309* See "extensions/CustomAllocatorEXT.txt" for more information.1310*/13111312typedef void* (FAUDIOCALL * FAudioMallocFunc)(size_t size);1313typedef void (FAUDIOCALL * FAudioFreeFunc)(void* ptr);1314typedef void* (FAUDIOCALL * FAudioReallocFunc)(void* ptr, size_t size);13151316FAUDIOAPI uint32_t FAudioCreateWithCustomAllocatorEXT(1317FAudio **ppFAudio,1318uint32_t Flags,1319FAudioProcessor XAudio2Processor,1320FAudioMallocFunc customMalloc,1321FAudioFreeFunc customFree,1322FAudioReallocFunc customRealloc1323);1324FAUDIOAPI uint32_t FAudioCOMConstructWithCustomAllocatorEXT(1325FAudio **ppFAudio,1326uint8_t version,1327FAudioMallocFunc customMalloc,1328FAudioFreeFunc customFree,1329FAudioReallocFunc customRealloc1330);13311332/* FAudio Engine Procedure API1333* See "extensions/EngineProcedureEXT.txt" for more information.1334*/1335typedef void (FAUDIOCALL *FAudioEngineCallEXT)(FAudio *audio, float *output);1336typedef void (FAUDIOCALL *FAudioEngineProcedureEXT)(FAudioEngineCallEXT defaultEngineProc, FAudio *audio, float *output, void *user);13371338FAUDIOAPI void FAudio_SetEngineProcedureEXT(1339FAudio *audio,1340FAudioEngineProcedureEXT clientEngineProc,1341void *user1342);134313441345/* FAudio I/O API */13461347#define FAUDIO_SEEK_SET 01348#define FAUDIO_SEEK_CUR 11349#define FAUDIO_SEEK_END 21350#define FAUDIO_EOF -113511352typedef size_t (FAUDIOCALL * FAudio_readfunc)(1353void *data,1354void *dst,1355size_t size,1356size_t count1357);1358typedef int64_t (FAUDIOCALL * FAudio_seekfunc)(1359void *data,1360int64_t offset,1361int whence1362);1363typedef int (FAUDIOCALL * FAudio_closefunc)(1364void *data1365);13661367typedef struct FAudioIOStream1368{1369void *data;1370FAudio_readfunc read;1371FAudio_seekfunc seek;1372FAudio_closefunc close;1373void *lock;1374} FAudioIOStream;13751376FAUDIOAPI FAudioIOStream* FAudio_fopen(const char *path);1377FAUDIOAPI FAudioIOStream* FAudio_memopen(void *mem, int len);1378FAUDIOAPI uint8_t* FAudio_memptr(FAudioIOStream *io, size_t offset);1379FAUDIOAPI void FAudio_close(FAudioIOStream *io);13801381#ifdef __cplusplus1382}1383#endif /* __cplusplus */13841385#endif /* FAUDIO_H */13861387/* vim: set noexpandtab shiftwidth=8 tabstop=8: */138813891390