adas.h 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338
  1. #ifndef _ADAS_H_
  2. #define _ADAS_H_
  3. //------------------------------------------------------------------------------------------------
  4. // includes
  5. //------------------------------------------------------------------------------------------------
  6. #include "adas_types.h"
  7. #include "ogg_stream.h"
  8. #include "ogg_io.h"
  9. #include "ac3_stream.h"
  10. #include "alut.h"
  11. #include "eax.h"
  12. #include "al.h"
  13. #include "alc.h"
  14. #ifdef __cplusplus
  15. extern "C"
  16. {
  17. #endif
  18. //Init AnakreoN Digital Sound System:
  19. // Following is a brief description of the 3 different implementations
  20. // that can be created.
  21. //
  22. // DirectSound3D
  23. //
  24. // Uses Direct Sound 3D to render the Open AL audio. This implementation will
  25. // benefit from Direct Sound 3D accelerators like the SB Live ! Applications must
  26. // use this implementation if they wish to use EAX extensions.
  27. //
  28. // DirectSound
  29. //
  30. // This implimentation uses software mixing with output to a
  31. // DSound stereo buffer. This implimentation offers the best
  32. // comprimise of speed and latency for all cards. However, EAX
  33. // extensions will not be available.
  34. //
  35. // Default
  36. //
  37. // This implimentation utilizes software mixing with output to
  38. // mmsystem. It offers the best solution across Win9x and NT
  39. // platforms. It does however offer the highest latency.
  40. void adas_Init(ADAS_INIT_DATA * p_adas_data);
  41. //Release AnakreoN Digital Sound System
  42. void adas_Exit(void);
  43. // Set distance model
  44. int adas_Set_Distance_Model(long Distance_Model);
  45. // Set distance model
  46. int adas_Set_Doppler_Factor(float Doppler_Factor);
  47. // Set distance model
  48. int adas_Set_Doppler_Velocity(float Doppler_Velocity);
  49. // load sound data & init memory
  50. unsigned long adas_Load_First(char *p_Index_File, char *p_File_Name);
  51. unsigned long adas_Load_FirstMemory(char *p_Index_File, void *p_File,
  52. char *p_File_Name);
  53. // load sound data
  54. unsigned long adas_Load_Next(char *p_File_Name);
  55. unsigned long adas_Load_NextMemory(void *p_File, char *p_File_Name);
  56. // releases loaded sound data
  57. void adas_Release_Loaded_Data(void);
  58. // Set Listener Gain
  59. int adas_Set_Listener_Gain(float v);
  60. // Set Listener Position
  61. int adas_Set_Listener_Position(float *v);
  62. // Set Listener Velocity
  63. int adas_Set_Listener_Velocity(float *v);
  64. // Set Listener Orientation
  65. int adas_Set_Listener_Orientation(float *v);
  66. // Get Listener Gain
  67. int adas_Get_Listener_Gain(float *v);
  68. // Get Listener Position
  69. int adas_Get_Listener_Position(float *v);
  70. // Get Listener Velocity
  71. int adas_Get_Listener_Velocity(float *v);
  72. // Get Listener Orientation
  73. int adas_Get_Listener_Orientation(float *v);
  74. // Create Sound Source
  75. int adas_Create_Source(ADAS_SOUND_SOURCE_DATA * p_ssd, void **p_callback);
  76. // queue a sound to source
  77. int adas_Queue_Sound(int Source, int Wave_Index);
  78. // unqueue a sound to source
  79. void adas_Unqueue_Sound(int Source, int Sounds);
  80. // Returns load source of queued buffers in sound source
  81. void adas_Get_Load_Source(int Source, int *p_Load, int Size_of_Load);
  82. // Release sound source
  83. void adas_Release_Source(int Owner, int Type, int Index);
  84. // Pause sound source
  85. void adas_Pause_Source(int Owner, int Type, int Index);
  86. // Resume sound source
  87. void adas_Resume_Source(int Owner, int Type, int Index);
  88. // cheks, if is particular owher playing selected sound data
  89. int adas_Is_Sound_Processed(int Wave_Index, int Owner);
  90. // sel all sources volume (gain)
  91. void adas_Set_All_Source_Volume(float fValue);
  92. // set all listeners parametrs
  93. int adas_Set_All_Listener_Properties(LPEAXLISTENERPROPERTIES lpData);
  94. // set listeners room
  95. int adas_Set_Listener_Room(long lValue);
  96. // set listeners roomHF
  97. int adas_Set_Listener_RoomHF(long lValue);
  98. // set listeners room rolloff
  99. int adas_Set_Listener_Room_Rolloff(float fValue);
  100. // set listeners room decay time
  101. int adas_Set_Listener_Decay_Time(float fValue);
  102. // set listeners room decay HFRatio
  103. int adas_Set_Listener_Decay_HFRatio(float fValue);
  104. // set listeners reflections
  105. int adas_Set_Listener_Reflections(long lValue);
  106. // set listeners reflections delay
  107. int adas_Set_Listener_Reflections_Delay(float fValue);
  108. // set listeners reverb
  109. int adas_Set_Listener_Reverb(LONG lValue);
  110. // set listeners reverb delay
  111. int adas_Set_Listener_Reverb_Delay(float fValue);
  112. // set listeners environment
  113. int adas_Set_Listener_Environment(unsigned long dwValue);
  114. // set listeners environment size
  115. int adas_Set_Listener_Environment_Size(float fValue);
  116. // set listeners environment diffusion
  117. int adas_Set_Listener_Environment_Diffusion(float fValue);
  118. // set listeners air absoprtion
  119. int adas_Set_Listener_Air_Absorption(float fValue);
  120. // set listeners flags
  121. int adas_Set_Listener_Flags(unsigned long dwValue);
  122. // set listeners scale delay time
  123. int adas_Set_Listener_Scale_Decay_Time(int bValue);
  124. // set listeners scale reflections
  125. int adas_Set_Listener_Scale_Reflections(int bValue);
  126. // set listeners scale reflections delay
  127. int adas_Set_Listener_Scale_Reflections_Delay(int bValue);
  128. // set listeners scale reverb
  129. int adas_Set_Listener_Scale_Reverb(int bValue);
  130. // set listeners scale reverb delay
  131. int adas_Set_Listener_Scale_Reverb_Delay(int bValue);
  132. // set listeners clip decayHF
  133. int adas_Set_Listener_Clip_DecayHF(int bValue);
  134. // get all listener properties
  135. int adas_Get_All_Listener_Properties(LPEAXLISTENERPROPERTIES lpData);
  136. // get listener decay time
  137. int adas_Get_Listener_Decay_Time(float *pfValue);
  138. // get listener Reflections
  139. int adas_Get_Listener_Reflections(long *plValue);
  140. // get listener Reflections Delay
  141. int adas_Get_Listener_Reflections_Delay(float *pfValue);
  142. // get listener reverb
  143. int adas_Get_Listener_Reverb(long *plValue);
  144. // get listener reverb delay
  145. int adas_Get_Listener_Reverb_Delay(float *pfValue);
  146. // set listener rolloff
  147. int adas_Set_Listener_Rolloff(float fValue);
  148. // set source properties
  149. void adas_Set_Source_All_Properties(int Owner, int Type, int Index,
  150. LPEAXBUFFERPROPERTIES lpData);
  151. // Set cube position
  152. void adas_Set_Bounding_Object_Position(int Owner, int Type, int Index,
  153. float *v);
  154. // Set sound sources position
  155. void adas_Set_Source_Position(int Owner, int Type, int Index, float *v);
  156. // Set sound sources pitch
  157. void adas_Set_Source_Pitch(int Owner, int Type, int Index, float v);
  158. // Set sound sources gain
  159. void adas_Set_Source_Gain(int Owner, int Type, int Index, float v);
  160. // Set sound sources min. gain
  161. void adas_Set_Source_Min_Gain(int Owner, int Type, int Index, float v);
  162. // Set sound sources max. gain
  163. void adas_Set_Source_Max_Gain(int Owner, int Type, int Index, float v);
  164. // Set sound sources velocity
  165. void adas_Set_Source_Velocity(int Owner, int Type, int Index, float *v);
  166. // set source EAX properties
  167. void adas_Set_Source_lEAXproperty(int Owner, int Type, int Index,
  168. long lValue, ALuint Property);
  169. void adas_Set_Source_fEAXproperty(int Owner, int Type, int Index,
  170. float fValue, ALuint Property);
  171. void adas_Set_Source_dwEAXproperty(int Owner, int Type, int Index,
  172. unsigned long dwValue, ALuint Property);
  173. // set source direct
  174. #define adas_Set_Source_Direct(Owner, Type, Index, lValue) adas_Set_Source_lEAXproperty(Owner, Type, Index, lValue, DSPROPERTY_EAXBUFFER_DIRECT)
  175. // set source directHF
  176. #define adas_Set_Source_DirectHF(Owner, Type, Index, lValue) adas_Set_Source_lEAXproperty(Owner, Type, Index, lValue, DSPROPERTY_EAXBUFFER_DIRECTHF)
  177. // set source room
  178. #define adas_Set_Source_Room(Owner, Type, Index, lValue) adas_Set_Source_lEAXproperty(Owner, Type, Index, lValue, DSPROPERTY_EAXBUFFER_ROOM)
  179. // set source roomHF
  180. #define adas_Set_Source_RoomHF(Owner, Type, Index, lValue) adas_Set_Source_lEAXproperty(Owner, Type, Index, lValue, DSPROPERTY_EAXBUFFER_ROOMHF)
  181. // set source rolloff
  182. #define adas_Set_Source_Rolloff(Owner, Type, Index, fValue) adas_Set_Source_fEAXproperty(Owner, Type, Index, fValue, DSPROPERTY_EAXBUFFER_ROOMROLLOFFFACTOR)
  183. // set source outsideHF volume
  184. #define adas_Set_Source_Outside(Owner, Type, Index, lValue) adas_Set_Source_lEAXproperty(Owner, Type, Index, lValue, DSPROPERTY_EAXBUFFER_OUTSIDEVOLUMEHF)
  185. // set source absorption
  186. #define adas_Set_Source_Absorption(Owner, Type, Index, fValue) adas_Set_Source_fEAXproperty(Owner, Type, Index, fValue, DSPROPERTY_EAXBUFFER_AIRABSORPTIONFACTOR)
  187. // set source flags
  188. #define adas_Set_Source_Flags(Owner, Type, Index, dwValue) adas_Set_Source_dwEAXproperty(Owner, Type, Index, dwValue, DSPROPERTY_EAXBUFFER_FLAGS)
  189. // set source obstruction
  190. #define adas_Set_Source_Obstruction(Owner, Type, Index, lValue) adas_Set_Source_lEAXproperty(Owner, Type, Index, lValue, DSPROPERTY_EAXBUFFER_OBSTRUCTION)
  191. // set source obstructionLF
  192. #define adas_Set_Source_ObstructionLF(Owner, Type, Index, fValue) adas_Set_Source_fEAXproperty(Owner, Type, Index, fValue, DSPROPERTY_EAXBUFFER_OBSTRUCTIONLFRATIO)
  193. // set source occlusion
  194. #define adas_Set_Source_Occlusion(Owner, Type, Index, lValue) adas_Set_Source_lEAXproperty(Owner, Type, Index, lValue, DSPROPERTY_EAXBUFFER_OCCLUSION)
  195. // set source occlusionLF
  196. #define adas_Set_Source_OcclusionLF(Owner, Type, Index, fValue) adas_Set_Source_fEAXproperty(Owner, Type, Index, fValue, DSPROPERTY_EAXBUFFER_OCCLUSIONLFRATIO)
  197. // set source occlusion room
  198. #define adas_Set_Source_Occlusion_Room(Owner, Type, Index, fValue) adas_Set_Source_fEAXproperty(Owner, Type, Index, fValue, DSPROPERTY_EAXBUFFER_OCCLUSIONROOMRATIO)
  199. // set source OPENAL properties
  200. void adas_Set_Source_fOPENALproperty(int Owner, int Type, int Index,
  201. float fValue, ALenum Property);
  202. void adas_Set_Source_vOPENALproperty(int Owner, int Type, int Index,
  203. float *vValue, ALenum Property);
  204. void adas_Set_Source_dwOPENALproperty(int Owner, int Type, int Index,
  205. unsigned long dwValue, ALenum Property);
  206. // set source min distance
  207. #define adas_Set_Source_Min_Distance(Owner, Type, Index, fValue) adas_Set_Source_fOPENALproperty (Owner, Type, Index, fValue, AL_MIN_DISTANCE);
  208. // set source max distance
  209. #define adas_Set_Source_Max_Distance(Owner, Type, Index, fValue) adas_Set_Source_fOPENALproperty (Owner, Type, Index, fValue, AL_MAX_DISTANCE);
  210. // set source reference distance
  211. #define adas_Set_Source_Reference_Distance(Owner, Type, Index, fValue) adas_Set_Source_fOPENALproperty (Owner, Type, Index, fValue, AL_REFERENCE_DISTANCE);
  212. // set source orientation
  213. #define adas_Set_Source_Cone_Orientation(Owner, Type, Index, vValue) adas_Set_Source_vOPENALproperty (Owner, Type, Index, *vValue, AL_DIRECTION);
  214. // set source inside angle
  215. #define adas_Set_Source_Cone_Inside_Angle(Owner, Type, Index, dwValue) adas_Set_Source_dwOPENALproperty (Owner, Type, Index, dwValue, AL_CONE_INNER_ANGLE);
  216. // set source cone outside angle
  217. #define adas_Set_Source_Cone_Outside_Angle(Owner, Type, Index, dwValue) adas_Set_Source_dwOPENALproperty (Owner, Type, Index, dwValue, AL_CONE_OUTER_ANGLE);
  218. // set source cone outside volume
  219. void adas_Set_Source_Cone_Outside_Volume(int Owner, int Type, int Index,
  220. long lValue);
  221. // get source position
  222. int adas_Get_Source_Position(int Index, float *fValue);
  223. // get sound of sound sources
  224. int adas_Query_Sources(void);
  225. // Get error message
  226. int adas_Get_Last_Error(char *p_Text, int Size);
  227. // Get warning message
  228. int adas_Get_Last_Warning(char *p_Text, int Size);
  229. // reset error message
  230. void adas_Reset_Last_Error(void);
  231. //returns version of Anakreon Digital Audio System
  232. void adas_Get_Version(int *piHi, int *piLow);
  233. // get current device context
  234. ALCcontext *adas_Get_Context(void);
  235. // get current device
  236. ALCdevice *adas_Get_Device(void);
  237. #ifdef __cplusplus
  238. }
  239. #endif
  240. #endif