fmod.hpp 34 KB

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