fmod.hpp 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607
  1. /* ======================================================================================== */
  2. /* FMOD Core API - C++ header file. */
  3. /* Copyright (c), Firelight Technologies Pty, Ltd. 2004-2024. */
  4. /* */
  5. /* Use this header in conjunction with fmod_common.h (which contains all the constants / */
  6. /* callbacks) to develop using the C++ language. */
  7. /* */
  8. /* For more detail visit: */
  9. /* https://fmod.com/docs/2.03/api/core-api.html */
  10. /* ======================================================================================== */
  11. #ifndef _FMOD_HPP
  12. #define _FMOD_HPP
  13. #include "fmod_common.h"
  14. #include "fmod.h"
  15. /*
  16. FMOD Namespace
  17. */
  18. namespace FMOD
  19. {
  20. class System;
  21. class Sound;
  22. class ChannelControl;
  23. class Channel;
  24. class ChannelGroup;
  25. class SoundGroup;
  26. class DSP;
  27. class DSPConnection;
  28. class Geometry;
  29. class Reverb3D;
  30. /*
  31. FMOD global system functions (optional).
  32. */
  33. inline FMOD_RESULT Memory_Initialize (void *poolmem, int poollen, FMOD_MEMORY_ALLOC_CALLBACK useralloc, FMOD_MEMORY_REALLOC_CALLBACK userrealloc, FMOD_MEMORY_FREE_CALLBACK userfree, FMOD_MEMORY_TYPE memtypeflags = FMOD_MEMORY_ALL) { return FMOD_Memory_Initialize(poolmem, poollen, useralloc, userrealloc, userfree, memtypeflags); }
  34. inline FMOD_RESULT Memory_GetStats (int *currentalloced, int *maxalloced, bool blocking = true) { return FMOD_Memory_GetStats(currentalloced, maxalloced, blocking); }
  35. inline FMOD_RESULT Debug_Initialize (FMOD_DEBUG_FLAGS flags, FMOD_DEBUG_MODE mode = FMOD_DEBUG_MODE_TTY, FMOD_DEBUG_CALLBACK callback = 0, const char *filename = 0) { return FMOD_Debug_Initialize(flags, mode, callback, filename); }
  36. inline FMOD_RESULT File_SetDiskBusy (int busy) { return FMOD_File_SetDiskBusy(busy); }
  37. inline FMOD_RESULT File_GetDiskBusy (int *busy) { return FMOD_File_GetDiskBusy(busy); }
  38. inline FMOD_RESULT Thread_SetAttributes (FMOD_THREAD_TYPE type, FMOD_THREAD_AFFINITY affinity = FMOD_THREAD_AFFINITY_GROUP_DEFAULT, FMOD_THREAD_PRIORITY priority = FMOD_THREAD_PRIORITY_DEFAULT, FMOD_THREAD_STACK_SIZE stacksize = FMOD_THREAD_STACK_SIZE_DEFAULT) { return FMOD_Thread_SetAttributes(type, affinity, priority, stacksize); }
  39. /*
  40. FMOD System factory functions.
  41. */
  42. inline FMOD_RESULT System_Create (System **system, unsigned int headerversion = FMOD_VERSION) { return FMOD_System_Create((FMOD_SYSTEM **)system, headerversion); }
  43. /*
  44. 'System' API
  45. */
  46. class System
  47. {
  48. private:
  49. // Constructor made private so user cannot statically instance a System class. System_Create must be used.
  50. System();
  51. System(const System &);
  52. public:
  53. FMOD_RESULT F_API release ();
  54. // Setup functions.
  55. FMOD_RESULT F_API setOutput (FMOD_OUTPUTTYPE output);
  56. FMOD_RESULT F_API getOutput (FMOD_OUTPUTTYPE *output);
  57. FMOD_RESULT F_API getNumDrivers (int *numdrivers);
  58. FMOD_RESULT F_API getDriverInfo (int id, char *name, int namelen, FMOD_GUID *guid, int *systemrate, FMOD_SPEAKERMODE *speakermode, int *speakermodechannels);
  59. FMOD_RESULT F_API setDriver (int driver);
  60. FMOD_RESULT F_API getDriver (int *driver);
  61. FMOD_RESULT F_API setSoftwareChannels (int numsoftwarechannels);
  62. FMOD_RESULT F_API getSoftwareChannels (int *numsoftwarechannels);
  63. FMOD_RESULT F_API setSoftwareFormat (int samplerate, FMOD_SPEAKERMODE speakermode, int numrawspeakers);
  64. FMOD_RESULT F_API getSoftwareFormat (int *samplerate, FMOD_SPEAKERMODE *speakermode, int *numrawspeakers);
  65. FMOD_RESULT F_API setDSPBufferSize (unsigned int bufferlength, int numbuffers);
  66. FMOD_RESULT F_API getDSPBufferSize (unsigned int *bufferlength, int *numbuffers);
  67. FMOD_RESULT F_API setFileSystem (FMOD_FILE_OPEN_CALLBACK useropen, FMOD_FILE_CLOSE_CALLBACK userclose, FMOD_FILE_READ_CALLBACK userread, FMOD_FILE_SEEK_CALLBACK userseek, FMOD_FILE_ASYNCREAD_CALLBACK userasyncread, FMOD_FILE_ASYNCCANCEL_CALLBACK userasynccancel, int blockalign);
  68. FMOD_RESULT F_API attachFileSystem (FMOD_FILE_OPEN_CALLBACK useropen, FMOD_FILE_CLOSE_CALLBACK userclose, FMOD_FILE_READ_CALLBACK userread, FMOD_FILE_SEEK_CALLBACK userseek);
  69. FMOD_RESULT F_API setAdvancedSettings (FMOD_ADVANCEDSETTINGS *settings);
  70. FMOD_RESULT F_API getAdvancedSettings (FMOD_ADVANCEDSETTINGS *settings);
  71. FMOD_RESULT F_API setCallback (FMOD_SYSTEM_CALLBACK callback, FMOD_SYSTEM_CALLBACK_TYPE callbackmask = FMOD_SYSTEM_CALLBACK_ALL);
  72. // Plug-in support.
  73. FMOD_RESULT F_API setPluginPath (const char *path);
  74. FMOD_RESULT F_API loadPlugin (const char *filename, unsigned int *handle, unsigned int priority = 0);
  75. FMOD_RESULT F_API unloadPlugin (unsigned int handle);
  76. FMOD_RESULT F_API getNumNestedPlugins (unsigned int handle, int *count);
  77. FMOD_RESULT F_API getNestedPlugin (unsigned int handle, int index, unsigned int *nestedhandle);
  78. FMOD_RESULT F_API getNumPlugins (FMOD_PLUGINTYPE plugintype, int *numplugins);
  79. FMOD_RESULT F_API getPluginHandle (FMOD_PLUGINTYPE plugintype, int index, unsigned int *handle);
  80. FMOD_RESULT F_API getPluginInfo (unsigned int handle, FMOD_PLUGINTYPE *plugintype, char *name, int namelen, unsigned int *version);
  81. FMOD_RESULT F_API setOutputByPlugin (unsigned int handle);
  82. FMOD_RESULT F_API getOutputByPlugin (unsigned int *handle);
  83. FMOD_RESULT F_API createDSPByPlugin (unsigned int handle, DSP **dsp);
  84. FMOD_RESULT F_API getDSPInfoByPlugin (unsigned int handle, const FMOD_DSP_DESCRIPTION **description);
  85. FMOD_RESULT F_API registerCodec (FMOD_CODEC_DESCRIPTION *description, unsigned int *handle, unsigned int priority = 0);
  86. FMOD_RESULT F_API registerDSP (const FMOD_DSP_DESCRIPTION *description, unsigned int *handle);
  87. FMOD_RESULT F_API registerOutput (const FMOD_OUTPUT_DESCRIPTION *description, unsigned int *handle);
  88. // Init/Close.
  89. FMOD_RESULT F_API init (int maxchannels, FMOD_INITFLAGS flags, void *extradriverdata);
  90. FMOD_RESULT F_API close ();
  91. // General post-init system functions.
  92. FMOD_RESULT F_API update (); /* IMPORTANT! CALL THIS ONCE PER FRAME! */
  93. FMOD_RESULT F_API setSpeakerPosition (FMOD_SPEAKER speaker, float x, float y, bool active);
  94. FMOD_RESULT F_API getSpeakerPosition (FMOD_SPEAKER speaker, float *x, float *y, bool *active);
  95. FMOD_RESULT F_API setStreamBufferSize (unsigned int filebuffersize, FMOD_TIMEUNIT filebuffersizetype);
  96. FMOD_RESULT F_API getStreamBufferSize (unsigned int *filebuffersize, FMOD_TIMEUNIT *filebuffersizetype);
  97. FMOD_RESULT F_API set3DSettings (float dopplerscale, float distancefactor, float rolloffscale);
  98. FMOD_RESULT F_API get3DSettings (float *dopplerscale, float *distancefactor, float *rolloffscale);
  99. FMOD_RESULT F_API set3DNumListeners (int numlisteners);
  100. FMOD_RESULT F_API get3DNumListeners (int *numlisteners);
  101. FMOD_RESULT F_API set3DListenerAttributes (int listener, const FMOD_VECTOR *pos, const FMOD_VECTOR *vel, const FMOD_VECTOR *forward, const FMOD_VECTOR *up);
  102. FMOD_RESULT F_API get3DListenerAttributes (int listener, FMOD_VECTOR *pos, FMOD_VECTOR *vel, FMOD_VECTOR *forward, FMOD_VECTOR *up);
  103. FMOD_RESULT F_API set3DRolloffCallback (FMOD_3D_ROLLOFF_CALLBACK callback);
  104. FMOD_RESULT F_API mixerSuspend ();
  105. FMOD_RESULT F_API mixerResume ();
  106. FMOD_RESULT F_API getDefaultMixMatrix (FMOD_SPEAKERMODE sourcespeakermode, FMOD_SPEAKERMODE targetspeakermode, float *matrix, int matrixhop);
  107. FMOD_RESULT F_API getSpeakerModeChannels (FMOD_SPEAKERMODE mode, int *channels);
  108. // System information functions.
  109. FMOD_RESULT F_API getVersion (unsigned int *version, unsigned int *buildnumber = 0);
  110. FMOD_RESULT F_API getOutputHandle (void **handle);
  111. FMOD_RESULT F_API getChannelsPlaying (int *channels, int *realchannels = 0);
  112. FMOD_RESULT F_API getCPUUsage (FMOD_CPU_USAGE *usage);
  113. FMOD_RESULT F_API getFileUsage (long long *sampleBytesRead, long long *streamBytesRead, long long *otherBytesRead);
  114. // Sound/DSP/Channel/FX creation and retrieval.
  115. FMOD_RESULT F_API createSound (const char *name_or_data, FMOD_MODE mode, FMOD_CREATESOUNDEXINFO *exinfo, Sound **sound);
  116. FMOD_RESULT F_API createStream (const char *name_or_data, FMOD_MODE mode, FMOD_CREATESOUNDEXINFO *exinfo, Sound **sound);
  117. FMOD_RESULT F_API createDSP (const FMOD_DSP_DESCRIPTION *description, DSP **dsp);
  118. FMOD_RESULT F_API createDSPByType (FMOD_DSP_TYPE type, DSP **dsp);
  119. FMOD_RESULT F_API createChannelGroup (const char *name, ChannelGroup **channelgroup);
  120. FMOD_RESULT F_API createSoundGroup (const char *name, SoundGroup **soundgroup);
  121. FMOD_RESULT F_API createReverb3D (Reverb3D **reverb);
  122. FMOD_RESULT F_API playSound (Sound *sound, ChannelGroup *channelgroup, bool paused, Channel **channel);
  123. FMOD_RESULT F_API playDSP (DSP *dsp, ChannelGroup *channelgroup, bool paused, Channel **channel);
  124. FMOD_RESULT F_API getChannel (int channelid, Channel **channel);
  125. FMOD_RESULT F_API getDSPInfoByType (FMOD_DSP_TYPE type, const FMOD_DSP_DESCRIPTION **description);
  126. FMOD_RESULT F_API getMasterChannelGroup (ChannelGroup **channelgroup);
  127. FMOD_RESULT F_API getMasterSoundGroup (SoundGroup **soundgroup);
  128. // Routing to ports.
  129. FMOD_RESULT F_API attachChannelGroupToPort (FMOD_PORT_TYPE portType, FMOD_PORT_INDEX portIndex, ChannelGroup *channelgroup, bool passThru = false);
  130. FMOD_RESULT F_API detachChannelGroupFromPort (ChannelGroup *channelgroup);
  131. // Reverb API.
  132. FMOD_RESULT F_API setReverbProperties (int instance, const FMOD_REVERB_PROPERTIES *prop);
  133. FMOD_RESULT F_API getReverbProperties (int instance, FMOD_REVERB_PROPERTIES *prop);
  134. // System level DSP functionality.
  135. FMOD_RESULT F_API lockDSP ();
  136. FMOD_RESULT F_API unlockDSP ();
  137. // Recording API.
  138. FMOD_RESULT F_API getRecordNumDrivers (int *numdrivers, int *numconnected);
  139. FMOD_RESULT F_API getRecordDriverInfo (int id, char *name, int namelen, FMOD_GUID *guid, int *systemrate, FMOD_SPEAKERMODE *speakermode, int *speakermodechannels, FMOD_DRIVER_STATE *state);
  140. FMOD_RESULT F_API getRecordPosition (int id, unsigned int *position);
  141. FMOD_RESULT F_API recordStart (int id, Sound *sound, bool loop);
  142. FMOD_RESULT F_API recordStop (int id);
  143. FMOD_RESULT F_API isRecording (int id, bool *recording);
  144. // Geometry API.
  145. FMOD_RESULT F_API createGeometry (int maxpolygons, int maxvertices, Geometry **geometry);
  146. FMOD_RESULT F_API setGeometrySettings (float maxworldsize);
  147. FMOD_RESULT F_API getGeometrySettings (float *maxworldsize);
  148. FMOD_RESULT F_API loadGeometry (const void *data, int datasize, Geometry **geometry);
  149. FMOD_RESULT F_API getGeometryOcclusion (const FMOD_VECTOR *listener, const FMOD_VECTOR *source, float *direct, float *reverb);
  150. // Network functions.
  151. FMOD_RESULT F_API setNetworkProxy (const char *proxy);
  152. FMOD_RESULT F_API getNetworkProxy (char *proxy, int proxylen);
  153. FMOD_RESULT F_API setNetworkTimeout (int timeout);
  154. FMOD_RESULT F_API getNetworkTimeout (int *timeout);
  155. // Userdata set/get.
  156. FMOD_RESULT F_API setUserData (void *userdata);
  157. FMOD_RESULT F_API getUserData (void **userdata);
  158. };
  159. /*
  160. 'Sound' API
  161. */
  162. class Sound
  163. {
  164. private:
  165. // Constructor made private so user cannot statically instance a Sound class. Appropriate Sound creation or retrieval function must be used.
  166. Sound();
  167. Sound(const Sound &);
  168. public:
  169. FMOD_RESULT F_API release ();
  170. FMOD_RESULT F_API getSystemObject (System **system);
  171. // Standard sound manipulation functions.
  172. FMOD_RESULT F_API lock (unsigned int offset, unsigned int length, void **ptr1, void **ptr2, unsigned int *len1, unsigned int *len2);
  173. FMOD_RESULT F_API unlock (void *ptr1, void *ptr2, unsigned int len1, unsigned int len2);
  174. FMOD_RESULT F_API setDefaults (float frequency, int priority);
  175. FMOD_RESULT F_API getDefaults (float *frequency, int *priority);
  176. FMOD_RESULT F_API set3DMinMaxDistance (float min, float max);
  177. FMOD_RESULT F_API get3DMinMaxDistance (float *min, float *max);
  178. FMOD_RESULT F_API set3DConeSettings (float insideconeangle, float outsideconeangle, float outsidevolume);
  179. FMOD_RESULT F_API get3DConeSettings (float *insideconeangle, float *outsideconeangle, float *outsidevolume);
  180. FMOD_RESULT F_API set3DCustomRolloff (FMOD_VECTOR *points, int numpoints);
  181. FMOD_RESULT F_API get3DCustomRolloff (FMOD_VECTOR **points, int *numpoints);
  182. FMOD_RESULT F_API getSubSound (int index, Sound **subsound);
  183. FMOD_RESULT F_API getSubSoundParent (Sound **parentsound);
  184. FMOD_RESULT F_API getName (char *name, int namelen);
  185. FMOD_RESULT F_API getLength (unsigned int *length, FMOD_TIMEUNIT lengthtype);
  186. FMOD_RESULT F_API getFormat (FMOD_SOUND_TYPE *type, FMOD_SOUND_FORMAT *format, int *channels, int *bits);
  187. FMOD_RESULT F_API getNumSubSounds (int *numsubsounds);
  188. FMOD_RESULT F_API getNumTags (int *numtags, int *numtagsupdated);
  189. FMOD_RESULT F_API getTag (const char *name, int index, FMOD_TAG *tag);
  190. FMOD_RESULT F_API getOpenState (FMOD_OPENSTATE *openstate, unsigned int *percentbuffered, bool *starving, bool *diskbusy);
  191. FMOD_RESULT F_API readData (void *buffer, unsigned int length, unsigned int *read);
  192. FMOD_RESULT F_API seekData (unsigned int pcm);
  193. FMOD_RESULT F_API setSoundGroup (SoundGroup *soundgroup);
  194. FMOD_RESULT F_API getSoundGroup (SoundGroup **soundgroup);
  195. // Synchronization point API. These points can come from markers embedded in wav files, and can also generate channel callbacks.
  196. FMOD_RESULT F_API getNumSyncPoints (int *numsyncpoints);
  197. FMOD_RESULT F_API getSyncPoint (int index, FMOD_SYNCPOINT **point);
  198. FMOD_RESULT F_API getSyncPointInfo (FMOD_SYNCPOINT *point, char *name, int namelen, unsigned int *offset, FMOD_TIMEUNIT offsettype);
  199. FMOD_RESULT F_API addSyncPoint (unsigned int offset, FMOD_TIMEUNIT offsettype, const char *name, FMOD_SYNCPOINT **point);
  200. FMOD_RESULT F_API deleteSyncPoint (FMOD_SYNCPOINT *point);
  201. // Functions also in Channel class but here they are the 'default' to save having to change it in Channel all the time.
  202. FMOD_RESULT F_API setMode (FMOD_MODE mode);
  203. FMOD_RESULT F_API getMode (FMOD_MODE *mode);
  204. FMOD_RESULT F_API setLoopCount (int loopcount);
  205. FMOD_RESULT F_API getLoopCount (int *loopcount);
  206. FMOD_RESULT F_API setLoopPoints (unsigned int loopstart, FMOD_TIMEUNIT loopstarttype, unsigned int loopend, FMOD_TIMEUNIT loopendtype);
  207. FMOD_RESULT F_API getLoopPoints (unsigned int *loopstart, FMOD_TIMEUNIT loopstarttype, unsigned int *loopend, FMOD_TIMEUNIT loopendtype);
  208. // For MOD/S3M/XM/IT/MID sequenced formats only.
  209. FMOD_RESULT F_API getMusicNumChannels (int *numchannels);
  210. FMOD_RESULT F_API setMusicChannelVolume (int channel, float volume);
  211. FMOD_RESULT F_API getMusicChannelVolume (int channel, float *volume);
  212. FMOD_RESULT F_API setMusicSpeed (float speed);
  213. FMOD_RESULT F_API getMusicSpeed (float *speed);
  214. // Userdata set/get.
  215. FMOD_RESULT F_API setUserData (void *userdata);
  216. FMOD_RESULT F_API getUserData (void **userdata);
  217. };
  218. /*
  219. 'ChannelControl API'. This is a base class for Channel and ChannelGroup so they can share the same functionality. This cannot be used or instansiated explicitly.
  220. */
  221. class ChannelControl
  222. {
  223. private:
  224. // Constructor made private so user cannot statically instance a Control class.
  225. ChannelControl();
  226. ChannelControl(const ChannelControl &);
  227. public:
  228. FMOD_RESULT F_API getSystemObject (System **system);
  229. // General control functionality for Channels and ChannelGroups.
  230. FMOD_RESULT F_API stop ();
  231. FMOD_RESULT F_API setPaused (bool paused);
  232. FMOD_RESULT F_API getPaused (bool *paused);
  233. FMOD_RESULT F_API setVolume (float volume);
  234. FMOD_RESULT F_API getVolume (float *volume);
  235. FMOD_RESULT F_API setVolumeRamp (bool ramp);
  236. FMOD_RESULT F_API getVolumeRamp (bool *ramp);
  237. FMOD_RESULT F_API getAudibility (float *audibility);
  238. FMOD_RESULT F_API setPitch (float pitch);
  239. FMOD_RESULT F_API getPitch (float *pitch);
  240. FMOD_RESULT F_API setMute (bool mute);
  241. FMOD_RESULT F_API getMute (bool *mute);
  242. FMOD_RESULT F_API setReverbProperties (int instance, float wet);
  243. FMOD_RESULT F_API getReverbProperties (int instance, float *wet);
  244. FMOD_RESULT F_API setLowPassGain (float gain);
  245. FMOD_RESULT F_API getLowPassGain (float *gain);
  246. FMOD_RESULT F_API setMode (FMOD_MODE mode);
  247. FMOD_RESULT F_API getMode (FMOD_MODE *mode);
  248. FMOD_RESULT F_API setCallback (FMOD_CHANNELCONTROL_CALLBACK callback);
  249. FMOD_RESULT F_API isPlaying (bool *isplaying);
  250. // Panning and level adjustment.
  251. // Note all 'set' functions alter a final matrix, this is why the only get function is getMixMatrix, to avoid other get functions returning incorrect/obsolete values.
  252. FMOD_RESULT F_API setPan (float pan);
  253. FMOD_RESULT F_API setMixLevelsOutput (float frontleft, float frontright, float center, float lfe, float surroundleft, float surroundright, float backleft, float backright);
  254. FMOD_RESULT F_API setMixLevelsInput (float *levels, int numlevels);
  255. FMOD_RESULT F_API setMixMatrix (float *matrix, int outchannels, int inchannels, int inchannel_hop = 0);
  256. FMOD_RESULT F_API getMixMatrix (float *matrix, int *outchannels, int *inchannels, int inchannel_hop = 0);
  257. // Clock based functionality.
  258. FMOD_RESULT F_API getDSPClock (unsigned long long *dspclock, unsigned long long *parentclock);
  259. FMOD_RESULT F_API setDelay (unsigned long long dspclock_start, unsigned long long dspclock_end, bool stopchannels = true);
  260. FMOD_RESULT F_API getDelay (unsigned long long *dspclock_start, unsigned long long *dspclock_end, bool *stopchannels = 0);
  261. FMOD_RESULT F_API addFadePoint (unsigned long long dspclock, float volume);
  262. FMOD_RESULT F_API setFadePointRamp (unsigned long long dspclock, float volume);
  263. FMOD_RESULT F_API removeFadePoints (unsigned long long dspclock_start, unsigned long long dspclock_end);
  264. FMOD_RESULT F_API getFadePoints (unsigned int *numpoints, unsigned long long *point_dspclock, float *point_volume);
  265. // DSP effects.
  266. FMOD_RESULT F_API getDSP (int index, DSP **dsp);
  267. FMOD_RESULT F_API addDSP (int index, DSP *dsp);
  268. FMOD_RESULT F_API removeDSP (DSP *dsp);
  269. FMOD_RESULT F_API getNumDSPs (int *numdsps);
  270. FMOD_RESULT F_API setDSPIndex (DSP *dsp, int index);
  271. FMOD_RESULT F_API getDSPIndex (DSP *dsp, int *index);
  272. // 3D functionality.
  273. FMOD_RESULT F_API set3DAttributes (const FMOD_VECTOR *pos, const FMOD_VECTOR *vel);
  274. FMOD_RESULT F_API get3DAttributes (FMOD_VECTOR *pos, FMOD_VECTOR *vel);
  275. FMOD_RESULT F_API set3DMinMaxDistance (float mindistance, float maxdistance);
  276. FMOD_RESULT F_API get3DMinMaxDistance (float *mindistance, float *maxdistance);
  277. FMOD_RESULT F_API set3DConeSettings (float insideconeangle, float outsideconeangle, float outsidevolume);
  278. FMOD_RESULT F_API get3DConeSettings (float *insideconeangle, float *outsideconeangle, float *outsidevolume);
  279. FMOD_RESULT F_API set3DConeOrientation (FMOD_VECTOR *orientation);
  280. FMOD_RESULT F_API get3DConeOrientation (FMOD_VECTOR *orientation);
  281. FMOD_RESULT F_API set3DCustomRolloff (FMOD_VECTOR *points, int numpoints);
  282. FMOD_RESULT F_API get3DCustomRolloff (FMOD_VECTOR **points, int *numpoints);
  283. FMOD_RESULT F_API set3DOcclusion (float directocclusion, float reverbocclusion);
  284. FMOD_RESULT F_API get3DOcclusion (float *directocclusion, float *reverbocclusion);
  285. FMOD_RESULT F_API set3DSpread (float angle);
  286. FMOD_RESULT F_API get3DSpread (float *angle);
  287. FMOD_RESULT F_API set3DLevel (float level);
  288. FMOD_RESULT F_API get3DLevel (float *level);
  289. FMOD_RESULT F_API set3DDopplerLevel (float level);
  290. FMOD_RESULT F_API get3DDopplerLevel (float *level);
  291. FMOD_RESULT F_API set3DDistanceFilter (bool custom, float customLevel, float centerFreq);
  292. FMOD_RESULT F_API get3DDistanceFilter (bool *custom, float *customLevel, float *centerFreq);
  293. // Userdata set/get.
  294. FMOD_RESULT F_API setUserData (void *userdata);
  295. FMOD_RESULT F_API getUserData (void **userdata);
  296. };
  297. /*
  298. 'Channel' API.
  299. */
  300. class Channel : public ChannelControl
  301. {
  302. private:
  303. // Constructor made private so user cannot statically instance a Channel class. Appropriate Channel creation or retrieval function must be used.
  304. Channel();
  305. Channel(const Channel &);
  306. public:
  307. // Channel specific control functionality.
  308. FMOD_RESULT F_API setFrequency (float frequency);
  309. FMOD_RESULT F_API getFrequency (float *frequency);
  310. FMOD_RESULT F_API setPriority (int priority);
  311. FMOD_RESULT F_API getPriority (int *priority);
  312. FMOD_RESULT F_API setPosition (unsigned int position, FMOD_TIMEUNIT postype);
  313. FMOD_RESULT F_API getPosition (unsigned int *position, FMOD_TIMEUNIT postype);
  314. FMOD_RESULT F_API setChannelGroup (ChannelGroup *channelgroup);
  315. FMOD_RESULT F_API getChannelGroup (ChannelGroup **channelgroup);
  316. FMOD_RESULT F_API setLoopCount (int loopcount);
  317. FMOD_RESULT F_API getLoopCount (int *loopcount);
  318. FMOD_RESULT F_API setLoopPoints (unsigned int loopstart, FMOD_TIMEUNIT loopstarttype, unsigned int loopend, FMOD_TIMEUNIT loopendtype);
  319. FMOD_RESULT F_API getLoopPoints (unsigned int *loopstart, FMOD_TIMEUNIT loopstarttype, unsigned int *loopend, FMOD_TIMEUNIT loopendtype);
  320. // Information only functions.
  321. FMOD_RESULT F_API isVirtual (bool *isvirtual);
  322. FMOD_RESULT F_API getCurrentSound (Sound **sound);
  323. FMOD_RESULT F_API getIndex (int *index);
  324. };
  325. /*
  326. 'ChannelGroup' API
  327. */
  328. class ChannelGroup : public ChannelControl
  329. {
  330. private:
  331. // Constructor made private so user cannot statically instance a ChannelGroup class. Appropriate ChannelGroup creation or retrieval function must be used.
  332. ChannelGroup();
  333. ChannelGroup(const ChannelGroup &);
  334. public:
  335. FMOD_RESULT F_API release ();
  336. // Nested channel groups.
  337. FMOD_RESULT F_API addGroup (ChannelGroup *group, bool propagatedspclock = true, DSPConnection **connection = 0);
  338. FMOD_RESULT F_API getNumGroups (int *numgroups);
  339. FMOD_RESULT F_API getGroup (int index, ChannelGroup **group);
  340. FMOD_RESULT F_API getParentGroup (ChannelGroup **group);
  341. // Information only functions.
  342. FMOD_RESULT F_API getName (char *name, int namelen);
  343. FMOD_RESULT F_API getNumChannels (int *numchannels);
  344. FMOD_RESULT F_API getChannel (int index, Channel **channel);
  345. };
  346. /*
  347. 'SoundGroup' API
  348. */
  349. class SoundGroup
  350. {
  351. private:
  352. // Constructor made private so user cannot statically instance a SoundGroup class. Appropriate SoundGroup creation or retrieval function must be used.
  353. SoundGroup();
  354. SoundGroup(const SoundGroup &);
  355. public:
  356. FMOD_RESULT F_API release ();
  357. FMOD_RESULT F_API getSystemObject (System **system);
  358. // SoundGroup control functions.
  359. FMOD_RESULT F_API setMaxAudible (int maxaudible);
  360. FMOD_RESULT F_API getMaxAudible (int *maxaudible);
  361. FMOD_RESULT F_API setMaxAudibleBehavior (FMOD_SOUNDGROUP_BEHAVIOR behavior);
  362. FMOD_RESULT F_API getMaxAudibleBehavior (FMOD_SOUNDGROUP_BEHAVIOR *behavior);
  363. FMOD_RESULT F_API setMuteFadeSpeed (float speed);
  364. FMOD_RESULT F_API getMuteFadeSpeed (float *speed);
  365. FMOD_RESULT F_API setVolume (float volume);
  366. FMOD_RESULT F_API getVolume (float *volume);
  367. FMOD_RESULT F_API stop ();
  368. // Information only functions.
  369. FMOD_RESULT F_API getName (char *name, int namelen);
  370. FMOD_RESULT F_API getNumSounds (int *numsounds);
  371. FMOD_RESULT F_API getSound (int index, Sound **sound);
  372. FMOD_RESULT F_API getNumPlaying (int *numplaying);
  373. // Userdata set/get.
  374. FMOD_RESULT F_API setUserData (void *userdata);
  375. FMOD_RESULT F_API getUserData (void **userdata);
  376. };
  377. /*
  378. 'DSP' API
  379. */
  380. class DSP
  381. {
  382. private:
  383. // Constructor made private so user cannot statically instance a DSP class. Appropriate DSP creation or retrieval function must be used.
  384. DSP();
  385. DSP(const DSP &);
  386. public:
  387. FMOD_RESULT F_API release ();
  388. FMOD_RESULT F_API getSystemObject (System **system);
  389. // Connection / disconnection / input and output enumeration.
  390. FMOD_RESULT F_API addInput (DSP *input, DSPConnection **connection = 0, FMOD_DSPCONNECTION_TYPE type = FMOD_DSPCONNECTION_TYPE_STANDARD);
  391. FMOD_RESULT F_API disconnectFrom (DSP *target, DSPConnection *connection = 0);
  392. FMOD_RESULT F_API disconnectAll (bool inputs, bool outputs);
  393. FMOD_RESULT F_API getNumInputs (int *numinputs);
  394. FMOD_RESULT F_API getNumOutputs (int *numoutputs);
  395. FMOD_RESULT F_API getInput (int index, DSP **input, DSPConnection **inputconnection);
  396. FMOD_RESULT F_API getOutput (int index, DSP **output, DSPConnection **outputconnection);
  397. // DSP unit control.
  398. FMOD_RESULT F_API setActive (bool active);
  399. FMOD_RESULT F_API getActive (bool *active);
  400. FMOD_RESULT F_API setBypass (bool bypass);
  401. FMOD_RESULT F_API getBypass (bool *bypass);
  402. FMOD_RESULT F_API setWetDryMix (float prewet, float postwet, float dry);
  403. FMOD_RESULT F_API getWetDryMix (float *prewet, float *postwet, float *dry);
  404. FMOD_RESULT F_API setChannelFormat (FMOD_CHANNELMASK channelmask, int numchannels, FMOD_SPEAKERMODE source_speakermode);
  405. FMOD_RESULT F_API getChannelFormat (FMOD_CHANNELMASK *channelmask, int *numchannels, FMOD_SPEAKERMODE *source_speakermode);
  406. FMOD_RESULT F_API getOutputChannelFormat (FMOD_CHANNELMASK inmask, int inchannels, FMOD_SPEAKERMODE inspeakermode, FMOD_CHANNELMASK *outmask, int *outchannels, FMOD_SPEAKERMODE *outspeakermode);
  407. FMOD_RESULT F_API reset ();
  408. FMOD_RESULT F_API setCallback (FMOD_DSP_CALLBACK callback);
  409. // DSP parameter control.
  410. FMOD_RESULT F_API setParameterFloat (int index, float value);
  411. FMOD_RESULT F_API setParameterInt (int index, int value);
  412. FMOD_RESULT F_API setParameterBool (int index, bool value);
  413. FMOD_RESULT F_API setParameterData (int index, void *data, unsigned int length);
  414. FMOD_RESULT F_API getParameterFloat (int index, float *value, char *valuestr, int valuestrlen);
  415. FMOD_RESULT F_API getParameterInt (int index, int *value, char *valuestr, int valuestrlen);
  416. FMOD_RESULT F_API getParameterBool (int index, bool *value, char *valuestr, int valuestrlen);
  417. FMOD_RESULT F_API getParameterData (int index, void **data, unsigned int *length, char *valuestr, int valuestrlen);
  418. FMOD_RESULT F_API getNumParameters (int *numparams);
  419. FMOD_RESULT F_API getParameterInfo (int index, FMOD_DSP_PARAMETER_DESC **desc);
  420. FMOD_RESULT F_API getDataParameterIndex (int datatype, int *index);
  421. FMOD_RESULT F_API showConfigDialog (void *hwnd, bool show);
  422. // DSP attributes.
  423. FMOD_RESULT F_API getInfo (char *name, unsigned int *version, int *channels, int *configwidth, int *configheight);
  424. FMOD_RESULT F_API getType (FMOD_DSP_TYPE *type);
  425. FMOD_RESULT F_API getIdle (bool *idle);
  426. // Userdata set/get.
  427. FMOD_RESULT F_API setUserData (void *userdata);
  428. FMOD_RESULT F_API getUserData (void **userdata);
  429. // Metering.
  430. FMOD_RESULT F_API setMeteringEnabled (bool inputEnabled, bool outputEnabled);
  431. FMOD_RESULT F_API getMeteringEnabled (bool *inputEnabled, bool *outputEnabled);
  432. FMOD_RESULT F_API getMeteringInfo (FMOD_DSP_METERING_INFO *inputInfo, FMOD_DSP_METERING_INFO *outputInfo);
  433. FMOD_RESULT F_API getCPUUsage (unsigned int *exclusive, unsigned int *inclusive);
  434. };
  435. /*
  436. 'DSPConnection' API
  437. */
  438. class DSPConnection
  439. {
  440. private:
  441. // Constructor made private so user cannot statically instance a DSPConnection class. Appropriate DSPConnection creation or retrieval function must be used.
  442. DSPConnection();
  443. DSPConnection(const DSPConnection &);
  444. public:
  445. FMOD_RESULT F_API getInput (DSP **input);
  446. FMOD_RESULT F_API getOutput (DSP **output);
  447. FMOD_RESULT F_API setMix (float volume);
  448. FMOD_RESULT F_API getMix (float *volume);
  449. FMOD_RESULT F_API setMixMatrix (float *matrix, int outchannels, int inchannels, int inchannel_hop = 0);
  450. FMOD_RESULT F_API getMixMatrix (float *matrix, int *outchannels, int *inchannels, int inchannel_hop = 0);
  451. FMOD_RESULT F_API getType (FMOD_DSPCONNECTION_TYPE *type);
  452. // Userdata set/get.
  453. FMOD_RESULT F_API setUserData (void *userdata);
  454. FMOD_RESULT F_API getUserData (void **userdata);
  455. };
  456. /*
  457. 'Geometry' API
  458. */
  459. class Geometry
  460. {
  461. private:
  462. // Constructor made private so user cannot statically instance a Geometry class. Appropriate Geometry creation or retrieval function must be used.
  463. Geometry();
  464. Geometry(const Geometry &);
  465. public:
  466. FMOD_RESULT F_API release ();
  467. // Polygon manipulation.
  468. FMOD_RESULT F_API addPolygon (float directocclusion, float reverbocclusion, bool doublesided, int numvertices, const FMOD_VECTOR *vertices, int *polygonindex);
  469. FMOD_RESULT F_API getNumPolygons (int *numpolygons);
  470. FMOD_RESULT F_API getMaxPolygons (int *maxpolygons, int *maxvertices);
  471. FMOD_RESULT F_API getPolygonNumVertices (int index, int *numvertices);
  472. FMOD_RESULT F_API setPolygonVertex (int index, int vertexindex, const FMOD_VECTOR *vertex);
  473. FMOD_RESULT F_API getPolygonVertex (int index, int vertexindex, FMOD_VECTOR *vertex);
  474. FMOD_RESULT F_API setPolygonAttributes (int index, float directocclusion, float reverbocclusion, bool doublesided);
  475. FMOD_RESULT F_API getPolygonAttributes (int index, float *directocclusion, float *reverbocclusion, bool *doublesided);
  476. // Object manipulation.
  477. FMOD_RESULT F_API setActive (bool active);
  478. FMOD_RESULT F_API getActive (bool *active);
  479. FMOD_RESULT F_API setRotation (const FMOD_VECTOR *forward, const FMOD_VECTOR *up);
  480. FMOD_RESULT F_API getRotation (FMOD_VECTOR *forward, FMOD_VECTOR *up);
  481. FMOD_RESULT F_API setPosition (const FMOD_VECTOR *position);
  482. FMOD_RESULT F_API getPosition (FMOD_VECTOR *position);
  483. FMOD_RESULT F_API setScale (const FMOD_VECTOR *scale);
  484. FMOD_RESULT F_API getScale (FMOD_VECTOR *scale);
  485. FMOD_RESULT F_API save (void *data, int *datasize);
  486. // Userdata set/get.
  487. FMOD_RESULT F_API setUserData (void *userdata);
  488. FMOD_RESULT F_API getUserData (void **userdata);
  489. };
  490. /*
  491. 'Reverb' API
  492. */
  493. class Reverb3D
  494. {
  495. private:
  496. // Constructor made private so user cannot statically instance a Reverb3D class. Appropriate Reverb creation or retrieval function must be used.
  497. Reverb3D();
  498. Reverb3D(const Reverb3D &);
  499. public:
  500. FMOD_RESULT F_API release ();
  501. // Reverb manipulation.
  502. FMOD_RESULT F_API set3DAttributes (const FMOD_VECTOR *position, float mindistance, float maxdistance);
  503. FMOD_RESULT F_API get3DAttributes (FMOD_VECTOR *position, float *mindistance,float *maxdistance);
  504. FMOD_RESULT F_API setProperties (const FMOD_REVERB_PROPERTIES *properties);
  505. FMOD_RESULT F_API getProperties (FMOD_REVERB_PROPERTIES *properties);
  506. FMOD_RESULT F_API setActive (bool active);
  507. FMOD_RESULT F_API getActive (bool *active);
  508. // Userdata set/get.
  509. FMOD_RESULT F_API setUserData (void *userdata);
  510. FMOD_RESULT F_API getUserData (void **userdata);
  511. };
  512. }
  513. #endif