1 /* ==================================================================================================== */ 2 /* FMOD Ex - output development header file. Copyright (c), Firelight Technologies Pty, Ltd. 2004-2011. */ 3 /* */ 4 /* Use this header if you are wanting to develop your own output plugin to use with */ 5 /* FMOD's output system. With this header you can make your own output plugin that FMOD */ 6 /* can register and use. See the documentation and examples on how to make a working plugin. */ 7 /* */ 8 /* ==================================================================================================== */ 9 10 #ifndef _FMOD_OUTPUT_H 11 #define _FMOD_OUTPUT_H 12 13 #include "fmod.h" 14 15 typedef struct FMOD_OUTPUT_STATE FMOD_OUTPUT_STATE; 16 17 /* 18 Output callbacks 19 */ 20 typedef FMOD_RESULT (F_CALLBACK *FMOD_OUTPUT_GETNUMDRIVERSCALLBACK)(FMOD_OUTPUT_STATE *output_state, int *numdrivers); 21 typedef FMOD_RESULT (F_CALLBACK *FMOD_OUTPUT_GETDRIVERNAMECALLBACK)(FMOD_OUTPUT_STATE *output_state, int id, char *name, int namelen); 22 typedef FMOD_RESULT (F_CALLBACK *FMOD_OUTPUT_GETDRIVERCAPSCALLBACK)(FMOD_OUTPUT_STATE *output_state, int id, FMOD_CAPS *caps); 23 typedef FMOD_RESULT (F_CALLBACK *FMOD_OUTPUT_INITCALLBACK) (FMOD_OUTPUT_STATE *output_state, int selecteddriver, FMOD_INITFLAGS flags, int *outputrate, int outputchannels, FMOD_SOUND_FORMAT *outputformat, int dspbufferlength, int dspnumbuffers, void *extradriverdata); 24 typedef FMOD_RESULT (F_CALLBACK *FMOD_OUTPUT_CLOSECALLBACK) (FMOD_OUTPUT_STATE *output_state); 25 typedef FMOD_RESULT (F_CALLBACK *FMOD_OUTPUT_UPDATECALLBACK) (FMOD_OUTPUT_STATE *output_state); 26 typedef FMOD_RESULT (F_CALLBACK *FMOD_OUTPUT_GETHANDLECALLBACK) (FMOD_OUTPUT_STATE *output_state, void **handle); 27 typedef FMOD_RESULT (F_CALLBACK *FMOD_OUTPUT_GETPOSITIONCALLBACK) (FMOD_OUTPUT_STATE *output_state, unsigned int *pcm); 28 typedef FMOD_RESULT (F_CALLBACK *FMOD_OUTPUT_LOCKCALLBACK) (FMOD_OUTPUT_STATE *output_state, unsigned int offset, unsigned int length, void **ptr1, void **ptr2, unsigned int *len1, unsigned int *len2); 29 typedef FMOD_RESULT (F_CALLBACK *FMOD_OUTPUT_UNLOCKCALLBACK) (FMOD_OUTPUT_STATE *output_state, void *ptr1, void *ptr2, unsigned int len1, unsigned int len2); 30 typedef FMOD_RESULT (F_CALLBACK *FMOD_OUTPUT_READFROMMIXER) (FMOD_OUTPUT_STATE *output_state, void *buffer, unsigned int length); 31 32 33 /* 34 [STRUCTURE] 35 [ 36 [DESCRIPTION] 37 When creating an output, declare one of these and provide the relevant callbacks and name for FMOD to use when it opens and reads a file of this type. 38 39 [REMARKS] 40 Members marked with [in] mean the variable can be written to. The user can set the value. 41 Members marked with [out] mean the variable is modified by FMOD and is for reading purposes only. Do not change this value. 42 43 [PLATFORMS] 44 Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android 45 46 [SEE_ALSO] 47 FMOD_OUTPUT_STATE 48 ] 49 */ 50 typedef struct FMOD_OUTPUT_DESCRIPTION 51 { 52 const char *name; /* [in] Name of the output. */ 53 unsigned int version; /* [in] Plugin writer's version number. */ 54 int polling; /* [in] If TRUE (non zero), this tells FMOD to start a thread and call getposition / lock / unlock for feeding data. If 0, the output is probably callback based, so all the plugin needs to do is call readfrommixer to the appropriate pointer. */ 55 FMOD_OUTPUT_GETNUMDRIVERSCALLBACK getnumdrivers; /* [in] For sound device enumeration. This callback is to give System::getNumDrivers somthing to return. */ 56 FMOD_OUTPUT_GETDRIVERNAMECALLBACK getdrivername; /* [in] For sound device enumeration. This callback is to give System::getDriverName somthing to return. */ 57 FMOD_OUTPUT_GETDRIVERCAPSCALLBACK getdrivercaps; /* [in] For sound device enumeration. This callback is to give System::getDriverCaps somthing to return. */ 58 FMOD_OUTPUT_INITCALLBACK init; /* [in] Initialization function for the output device. This is called from System::init. */ 59 FMOD_OUTPUT_CLOSECALLBACK close; /* [in] Cleanup / close down function for the output device. This is called from System::close. */ 60 FMOD_OUTPUT_UPDATECALLBACK update; /* [in] Update function that is called once a frame by the user. This is called from System::update. */ 61 FMOD_OUTPUT_GETHANDLECALLBACK gethandle; /* [in] This is called from System::getOutputHandle. This is just to return a pointer to the internal system device object that the system may be using.*/ 62 FMOD_OUTPUT_GETPOSITIONCALLBACK getposition; /* [in] This is called from the FMOD software mixer thread if 'polling' = true. This returns a position value in samples so that FMOD knows where and when to fill its buffer. */ 63 FMOD_OUTPUT_LOCKCALLBACK lock; /* [in] This is called from the FMOD software mixer thread if 'polling' = true. This function provides a pointer to data that FMOD can write to when software mixing. */ 64 FMOD_OUTPUT_UNLOCKCALLBACK unlock; /* [in] This is called from the FMOD software mixer thread if 'polling' = true. This optional function accepts the data that has been mixed and copies it or does whatever it needs to before sending it to the hardware. */ 65 } FMOD_OUTPUT_DESCRIPTION; 66 67 68 /* 69 [STRUCTURE] 70 [ 71 [DESCRIPTION] 72 Output plugin structure that is passed into each callback. 73 74 [REMARKS] 75 Members marked with [in] mean the variable can be written to. The user can set the value. 76 Members marked with [out] mean the variable is modified by FMOD and is for reading purposes only. Do not change this value. 77 78 [PLATFORMS] 79 Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android 80 81 [SEE_ALSO] 82 FMOD_OUTPUT_DESCRIPTION 83 ] 84 */ 85 struct FMOD_OUTPUT_STATE 86 { 87 void *plugindata; /* [in] Plugin writer created data the output author wants to attach to this object. */ 88 FMOD_OUTPUT_READFROMMIXER readfrommixer; /* [out] Function to update mixer and write the result to the provided pointer. Used from callback based output only. Polling based output uses lock/unlock/getposition. */ 89 }; 90 91 #endif 92 93 94