orx  1.14
Portable Game Engine
orxSoundSystem.h
Go to the documentation of this file.
1 /* Orx - Portable Game Engine
2  *
3  * Copyright (c) 2008-2022 Orx-Project
4  *
5  * This software is provided 'as-is', without any express or implied
6  * warranty. In no event will the authors be held liable for any damages
7  * arising from the use of this software.
8  *
9  * Permission is granted to anyone to use this software for any purpose,
10  * including commercial applications, and to alter it and redistribute it
11  * freely, subject to the following restrictions:
12  *
13  * 1. The origin of this software must not be misrepresented; you must not
14  * claim that you wrote the original software. If you use this software
15  * in a product, an acknowledgment in the product documentation would be
16  * appreciated but is not required.
17  *
18  * 2. Altered source versions must be plainly marked as such, and must not be
19  * misrepresented as being the original software.
20  *
21  * 3. This notice may not be removed or altered from any source
22  * distribution.
23  */
24 
43 #ifndef _orxSOUNDSYSTEM_H_
44 #define _orxSOUNDSYSTEM_H_
45 
46 #include "orxInclude.h"
47 #include "math/orxVector.h"
48 #include "plugin/orxPluginCore.h"
49 
50 
51 /***************************************************************************
52  * Structure declaration *
53  ***************************************************************************/
54 
57 typedef struct __orxSOUNDSYSTEM_SOUND_t orxSOUNDSYSTEM_SOUND;
58 typedef struct __orxSOUNDSYSTEM_SAMPLE_t orxSOUNDSYSTEM_SAMPLE;
59 
62 typedef enum __orxSOUNDSYSTEM_STATUS_t
63 {
67 
69 
71 
73 
76 typedef enum __orxSOUND_FILTER_TYPE_t
77 {
88 
90 
92 
94 
97 typedef void (orxFASTCALL *orxSOUND_FILTER_FUNCTION)(orxFLOAT *_afSampleListOut, const orxFLOAT *_afSampleListIn, orxU32 _u32SampleCount, orxU32 _u32ChannelCount, orxU32 _u32SampleRate, orxSTRINGID _stNameID, void *_pContext);
98 
101 typedef struct __orxSOUND_FILTER_DATA_t
102 {
104  orxSTRINGID stNameID;
105 
106  union
107  {
108  struct
109  {
110  orxFLOAT fA0;
111  orxFLOAT fA1;
112  orxFLOAT fA2;
113  orxFLOAT fB0;
114  orxFLOAT fB1;
115  orxFLOAT fB2;
116 
117  } stBiquad;
118 
119  struct
120  {
121  orxFLOAT fFrequency;
122  orxU32 u32Order;
123 
124  } stLowPass;
125 
126  struct
127  {
128  orxFLOAT fFrequency;
129  orxU32 u32Order;
130 
131  } stHighPass;
132 
133  struct
134  {
135  orxFLOAT fFrequency;
136  orxU32 u32Order;
137 
138  } stBandPass;
139 
140  struct
141  {
142  orxFLOAT fFrequency;
143  orxFLOAT fQ;
144  orxFLOAT fGain;
145 
146  } stLowShelf;
147 
148  struct
149  {
150  orxFLOAT fFrequency;
151  orxFLOAT fQ;
152  orxFLOAT fGain;
153 
154  } stHighShelf;
155 
156  struct
157  {
158  orxFLOAT fFrequency;
159  orxFLOAT fQ;
160 
161  } stNotch;
162 
163  struct
164  {
165  orxFLOAT fFrequency;
166  orxFLOAT fQ;
167  orxFLOAT fGain;
168 
169  } stPeaking;
170 
171  struct
172  {
173  orxFLOAT fDelay;
174  orxFLOAT fDecay;
175 
176  } stDelay;
177 
178  struct
179  {
181  void *pContext;
182 
183  } stCustom;
184 
185  };
186 
188 
191 #define orxSOUNDSYSTEM_KZ_CONFIG_SECTION "SoundSystem"
192 #define orxSOUNDSYSTEM_KZ_CONFIG_RATIO "DimensionRatio"
193 #define orxSOUNDSYSTEM_KZ_CONFIG_MUTE_IN_BACKGROUND "MuteInBackground"
194 #define orxSOUNDSYSTEM_KZ_CONFIG_LISTENERS "Listeners"
195 
196 
197 /***************************************************************************
198  * Functions directly implemented by orx core
199  ***************************************************************************/
200 
203 extern orxDLLAPI void orxFASTCALL orxSoundSystem_Setup();
204 
205 
206 /***************************************************************************
207  * Functions extended by plugins
208  ***************************************************************************/
209 
213 extern orxDLLAPI orxSTATUS orxFASTCALL orxSoundSystem_Init();
214 
217 extern orxDLLAPI void orxFASTCALL orxSoundSystem_Exit();
218 
225 extern orxDLLAPI orxSOUNDSYSTEM_SAMPLE *orxFASTCALL orxSoundSystem_CreateSample(orxU32 _u32ChannelNumber, orxU32 _u32FrameNumber, orxU32 _u32SampleRate);
226 
231 extern orxDLLAPI orxSOUNDSYSTEM_SAMPLE *orxFASTCALL orxSoundSystem_LoadSample(const orxSTRING _zFilename);
232 
238 
246 extern orxDLLAPI orxSTATUS orxFASTCALL orxSoundSystem_GetSampleInfo(const orxSOUNDSYSTEM_SAMPLE *_pstSample, orxU32 *_pu32ChannelNumber, orxU32 *_pu32FrameNumber, orxU32 *_pu32SampleRate);
247 
254 extern orxDLLAPI orxSTATUS orxFASTCALL orxSoundSystem_SetSampleData(orxSOUNDSYSTEM_SAMPLE *_pstSample, const orxFLOAT *_afData, orxU32 _u32SampleNumber);
255 
261 extern orxDLLAPI orxSOUNDSYSTEM_SOUND *orxFASTCALL orxSoundSystem_CreateFromSample(orxHANDLE _hUserData, const orxSOUNDSYSTEM_SAMPLE *_pstSample);
262 
269 extern orxDLLAPI orxSOUNDSYSTEM_SOUND *orxFASTCALL orxSoundSystem_CreateStream(orxHANDLE _hUserData, orxU32 _u32ChannelNumber, orxU32 _u32SampleRate);
270 
276 extern orxDLLAPI orxSOUNDSYSTEM_SOUND *orxFASTCALL orxSoundSystem_LoadStream(orxHANDLE _hUserData, const orxSTRING _zFilename);
277 
282 extern orxDLLAPI orxSTATUS orxFASTCALL orxSoundSystem_Delete(orxSOUNDSYSTEM_SOUND *_pstSound);
283 
288 extern orxDLLAPI orxSTATUS orxFASTCALL orxSoundSystem_Play(orxSOUNDSYSTEM_SOUND *_pstSound);
289 
294 extern orxDLLAPI orxSTATUS orxFASTCALL orxSoundSystem_Pause(orxSOUNDSYSTEM_SOUND *_pstSound);
295 
300 extern orxDLLAPI orxSTATUS orxFASTCALL orxSoundSystem_Stop(orxSOUNDSYSTEM_SOUND *_pstSound);
301 
308 extern orxDLLAPI orxSTATUS orxFASTCALL orxSoundSystem_AddFilter(orxSOUNDSYSTEM_SOUND *_pstSound, const orxSOUND_FILTER_DATA *_pstFilterData, orxBOOL _bUseCustomParam);
309 
315 
321 
326 extern orxDLLAPI orxHANDLE orxFASTCALL orxSoundSystem_CreateBus(orxSTRINGID _stBusID);
327 
332 extern orxDLLAPI orxSTATUS orxFASTCALL orxSoundSystem_DeleteBus(orxHANDLE _hBus);
333 
339 extern orxDLLAPI orxSTATUS orxFASTCALL orxSoundSystem_SetBus(orxSOUNDSYSTEM_SOUND *_pstSound, orxHANDLE _hBus);
340 
346 extern orxDLLAPI orxSTATUS orxFASTCALL orxSoundSystem_SetBusParent(orxHANDLE _hBus, orxHANDLE _hParentBus);
347 
354 extern orxDLLAPI orxSTATUS orxFASTCALL orxSoundSystem_AddBusFilter(orxHANDLE _hBus, const orxSOUND_FILTER_DATA *_pstFilterData, orxBOOL _bUseCustomParam);
355 
361 
367 
375 extern orxDLLAPI orxSTATUS orxFASTCALL orxSoundSystem_StartRecording(const orxCHAR *_zName, orxBOOL _bWriteToFile, orxU32 _u32SampleRate, orxU32 _u32ChannelNumber);
376 
381 
385 extern orxDLLAPI orxBOOL orxFASTCALL orxSoundSystem_HasRecordingSupport();
386 
392 extern orxDLLAPI orxSTATUS orxFASTCALL orxSoundSystem_SetVolume(orxSOUNDSYSTEM_SOUND *_pstSound, orxFLOAT _fVolume);
393 
399 extern orxDLLAPI orxSTATUS orxFASTCALL orxSoundSystem_SetPitch(orxSOUNDSYSTEM_SOUND *_pstSound, orxFLOAT _fPitch);
400 
406 extern orxDLLAPI orxSTATUS orxFASTCALL orxSoundSystem_SetTime(orxSOUNDSYSTEM_SOUND *_pstSound, orxFLOAT _fTime);
407 
413 extern orxDLLAPI orxSTATUS orxFASTCALL orxSoundSystem_SetPosition(orxSOUNDSYSTEM_SOUND *_pstSound, const orxVECTOR *_pvPosition);
414 
424 extern orxDLLAPI orxSTATUS orxFASTCALL orxSoundSystem_SetSpatialization(orxSOUNDSYSTEM_SOUND *_pstSound, orxFLOAT _fMinDistance, orxFLOAT _fMaxDistance, orxFLOAT _fMinGain, orxFLOAT _fMaxGain, orxFLOAT _fRollOff);
425 
432 extern orxDLLAPI orxSTATUS orxFASTCALL orxSoundSystem_SetPanning(orxSOUNDSYSTEM_SOUND *_pstSound, orxFLOAT _fPanning, orxBOOL _bMix);
433 
439 extern orxDLLAPI orxSTATUS orxFASTCALL orxSoundSystem_Loop(orxSOUNDSYSTEM_SOUND *_pstSound, orxBOOL _bLoop);
440 
445 extern orxDLLAPI orxFLOAT orxFASTCALL orxSoundSystem_GetVolume(const orxSOUNDSYSTEM_SOUND *_pstSound);
446 
451 extern orxDLLAPI orxFLOAT orxFASTCALL orxSoundSystem_GetPitch(const orxSOUNDSYSTEM_SOUND *_pstSound);
452 
457 extern orxDLLAPI orxFLOAT orxFASTCALL orxSoundSystem_GetTime(const orxSOUNDSYSTEM_SOUND *_pstSound);
458 
464 extern orxDLLAPI orxVECTOR *orxFASTCALL orxSoundSystem_GetPosition(const orxSOUNDSYSTEM_SOUND *_pstSound, orxVECTOR *_pvPosition);
465 
475 extern orxDLLAPI orxSTATUS orxFASTCALL orxSoundSystem_GetSpatialization(const orxSOUNDSYSTEM_SOUND *_pstSound, orxFLOAT *_pfMinDistance, orxFLOAT *_pfMaxDistance, orxFLOAT *_pfMinGain, orxFLOAT *_pfMaxGain, orxFLOAT *_pfRollOff);
476 
483 extern orxDLLAPI orxSTATUS orxFASTCALL orxSoundSystem_GetPanning(const orxSOUNDSYSTEM_SOUND *_pstSound, orxFLOAT *_pfPanning, orxBOOL *_pbMix);
484 
489 extern orxDLLAPI orxBOOL orxFASTCALL orxSoundSystem_IsLooping(const orxSOUNDSYSTEM_SOUND *_pstSound);
490 
495 extern orxDLLAPI orxFLOAT orxFASTCALL orxSoundSystem_GetDuration(const orxSOUNDSYSTEM_SOUND *_pstSound);
496 
502 
507 extern orxDLLAPI orxSTATUS orxFASTCALL orxSoundSystem_SetGlobalVolume(orxFLOAT _fGlobalVolume);
508 
512 extern orxDLLAPI orxFLOAT orxFASTCALL orxSoundSystem_GetGlobalVolume();
513 
517 extern orxDLLAPI orxU32 orxFASTCALL orxSoundSystem_GetListenerCount();
518 
523 extern orxDLLAPI void orxFASTCALL orxSoundSystem_EnableListener(orxU32 _u32ListenerIndex, orxBOOL _bEnable);
524 
529 extern orxDLLAPI orxBOOL orxFASTCALL orxSoundSystem_IsListenerEnabled(orxU32 _u32ListenerIndex);
530 
536 extern orxDLLAPI orxSTATUS orxFASTCALL orxSoundSystem_SetListenerPosition(orxU32 _u32Index, const orxVECTOR *_pvPosition);
537 
543 extern orxDLLAPI orxVECTOR *orxFASTCALL orxSoundSystem_GetListenerPosition(orxU32 _u32Index, orxVECTOR *_pvPosition);
544 
545 #endif /* _orxSOUNDSYSTEM_H_ */
546 
orxDLLAPI orxSTATUS orxFASTCALL orxSoundSystem_Loop(orxSOUNDSYSTEM_SOUND *_pstSound, orxBOOL _bLoop)
orxDLLAPI orxFLOAT orxFASTCALL orxSoundSystem_GetTime(const orxSOUNDSYSTEM_SOUND *_pstSound)
orxDLLAPI orxSTATUS orxFASTCALL orxSoundSystem_Stop(orxSOUNDSYSTEM_SOUND *_pstSound)
orxDLLAPI orxSTATUS orxFASTCALL orxSoundSystem_SetBus(orxSOUNDSYSTEM_SOUND *_pstSound, orxHANDLE _hBus)
orxDLLAPI orxSTATUS orxFASTCALL orxSoundSystem_Play(orxSOUNDSYSTEM_SOUND *_pstSound)
orxDLLAPI orxSTATUS orxFASTCALL orxSoundSystem_RemoveAllFilters(orxSOUNDSYSTEM_SOUND *_pstSound)
orxDLLAPI orxSTATUS orxFASTCALL orxSoundSystem_RemoveLastBusFilter(orxHANDLE _hBus)
orxDLLAPI orxSOUNDSYSTEM_SOUND *orxFASTCALL orxSoundSystem_CreateStream(orxHANDLE _hUserData, orxU32 _u32ChannelNumber, orxU32 _u32SampleRate)
orxDLLAPI orxSTATUS orxFASTCALL orxSoundSystem_GetSampleInfo(const orxSOUNDSYSTEM_SAMPLE *_pstSample, orxU32 *_pu32ChannelNumber, orxU32 *_pu32FrameNumber, orxU32 *_pu32SampleRate)
orxDLLAPI orxSOUNDSYSTEM_SAMPLE *orxFASTCALL orxSoundSystem_LoadSample(const orxSTRING _zFilename)
orxDLLAPI orxSTATUS orxFASTCALL orxSoundSystem_SetBusParent(orxHANDLE _hBus, orxHANDLE _hParentBus)
orxDLLAPI orxVECTOR *orxFASTCALL orxSoundSystem_GetListenerPosition(orxU32 _u32Index, orxVECTOR *_pvPosition)
void(orxFASTCALL * orxSOUND_FILTER_FUNCTION)(orxFLOAT *_afSampleListOut, const orxFLOAT *_afSampleListIn, orxU32 _u32SampleCount, orxU32 _u32ChannelCount, orxU32 _u32SampleRate, orxSTRINGID _stNameID, void *_pContext)
orxDLLAPI void orxFASTCALL orxSoundSystem_Exit()
orxDLLAPI orxSOUNDSYSTEM_SOUND *orxFASTCALL orxSoundSystem_LoadStream(orxHANDLE _hUserData, const orxSTRING _zFilename)
orxDLLAPI orxSTATUS orxFASTCALL orxSoundSystem_SetPosition(orxSOUNDSYSTEM_SOUND *_pstSound, const orxVECTOR *_pvPosition)
orxDLLAPI orxSTATUS orxFASTCALL orxSoundSystem_SetSpatialization(orxSOUNDSYSTEM_SOUND *_pstSound, orxFLOAT _fMinDistance, orxFLOAT _fMaxDistance, orxFLOAT _fMinGain, orxFLOAT _fMaxGain, orxFLOAT _fRollOff)
orxDLLAPI orxVECTOR *orxFASTCALL orxSoundSystem_GetPosition(const orxSOUNDSYSTEM_SOUND *_pstSound, orxVECTOR *_pvPosition)
orxDLLAPI orxSTATUS orxFASTCALL orxSoundSystem_SetVolume(orxSOUNDSYSTEM_SOUND *_pstSound, orxFLOAT _fVolume)
orxDLLAPI orxSTATUS orxFASTCALL orxSoundSystem_SetGlobalVolume(orxFLOAT _fGlobalVolume)
void * orxHANDLE
Definition: orxType.h:166
orxSOUNDSYSTEM_STATUS
orxSOUND_FILTER_FUNCTION pfnCallback
orxDLLAPI orxSTATUS orxFASTCALL orxSoundSystem_SetListenerPosition(orxU32 _u32Index, const orxVECTOR *_pvPosition)
orxDLLAPI orxSTATUS orxFASTCALL orxSoundSystem_DeleteSample(orxSOUNDSYSTEM_SAMPLE *_pstSample)
orxDLLAPI orxFLOAT orxFASTCALL orxSoundSystem_GetVolume(const orxSOUNDSYSTEM_SOUND *_pstSound)
orxDLLAPI orxSTATUS orxFASTCALL orxSoundSystem_RemoveAllBusFilters(orxHANDLE _hBus)
orxDLLAPI orxBOOL orxFASTCALL orxSoundSystem_IsListenerEnabled(orxU32 _u32ListenerIndex)
orxSTATUS
Definition: orxType.h:256
orxDLLAPI orxSOUNDSYSTEM_STATUS orxFASTCALL orxSoundSystem_GetStatus(const orxSOUNDSYSTEM_SOUND *_pstSound)
orxDLLAPI orxSTATUS orxFASTCALL orxSoundSystem_Delete(orxSOUNDSYSTEM_SOUND *_pstSound)
orxDLLAPI orxSTATUS orxFASTCALL orxSoundSystem_GetSpatialization(const orxSOUNDSYSTEM_SOUND *_pstSound, orxFLOAT *_pfMinDistance, orxFLOAT *_pfMaxDistance, orxFLOAT *_pfMinGain, orxFLOAT *_pfMaxGain, orxFLOAT *_pfRollOff)
orxDLLAPI orxSTATUS orxFASTCALL orxSoundSystem_SetTime(orxSOUNDSYSTEM_SOUND *_pstSound, orxFLOAT _fTime)
orxDLLAPI orxHANDLE orxFASTCALL orxSoundSystem_CreateBus(orxSTRINGID _stBusID)
orxDLLAPI orxSTATUS orxFASTCALL orxSoundSystem_Init()
orxDLLAPI orxFLOAT orxFASTCALL orxSoundSystem_GetGlobalVolume()
orxDLLAPI orxSTATUS orxFASTCALL orxSoundSystem_RemoveLastFilter(orxSOUNDSYSTEM_SOUND *_pstSound)
orxDLLAPI orxSTATUS orxFASTCALL orxSoundSystem_Pause(orxSOUNDSYSTEM_SOUND *_pstSound)
typedef void(orxFASTCALL *orxMODULE_EXIT_FUNCTION)()
orxDLLAPI orxSTATUS orxFASTCALL orxSoundSystem_AddFilter(orxSOUNDSYSTEM_SOUND *_pstSound, const orxSOUND_FILTER_DATA *_pstFilterData, orxBOOL _bUseCustomParam)
#define orxDLLAPI
Definition: orxDecl.h:370
orxDLLAPI void orxFASTCALL orxSoundSystem_EnableListener(orxU32 _u32ListenerIndex, orxBOOL _bEnable)
orxDLLAPI orxSTATUS orxFASTCALL orxSoundSystem_AddBusFilter(orxHANDLE _hBus, const orxSOUND_FILTER_DATA *_pstFilterData, orxBOOL _bUseCustomParam)
orxSOUND_FILTER_TYPE
orxDLLAPI orxSTATUS orxFASTCALL orxSoundSystem_StartRecording(const orxCHAR *_zName, orxBOOL _bWriteToFile, orxU32 _u32SampleRate, orxU32 _u32ChannelNumber)
orxDLLAPI orxSTATUS orxFASTCALL orxSoundSystem_GetPanning(const orxSOUNDSYSTEM_SOUND *_pstSound, orxFLOAT *_pfPanning, orxBOOL *_pbMix)
orxDLLAPI orxSTATUS orxFASTCALL orxSoundSystem_SetSampleData(orxSOUNDSYSTEM_SAMPLE *_pstSample, const orxFLOAT *_afData, orxU32 _u32SampleNumber)
orxDLLAPI orxU32 orxFASTCALL orxSoundSystem_GetListenerCount()
orxDLLAPI orxSOUNDSYSTEM_SAMPLE *orxFASTCALL orxSoundSystem_CreateSample(orxU32 _u32ChannelNumber, orxU32 _u32FrameNumber, orxU32 _u32SampleRate)
orxDLLAPI orxBOOL orxFASTCALL orxSoundSystem_IsLooping(const orxSOUNDSYSTEM_SOUND *_pstSound)
orxDLLAPI orxSOUNDSYSTEM_SOUND *orxFASTCALL orxSoundSystem_CreateFromSample(orxHANDLE _hUserData, const orxSOUNDSYSTEM_SAMPLE *_pstSample)
orxDLLAPI orxFLOAT orxFASTCALL orxSoundSystem_GetPitch(const orxSOUNDSYSTEM_SOUND *_pstSound)
orxSOUND_FILTER_TYPE eType
orxDLLAPI orxSTATUS orxFASTCALL orxSoundSystem_SetPanning(orxSOUNDSYSTEM_SOUND *_pstSound, orxFLOAT _fPanning, orxBOOL _bMix)
orxDLLAPI orxSTATUS orxFASTCALL orxSoundSystem_StopRecording()
orxDLLAPI orxSTATUS orxFASTCALL orxSoundSystem_SetPitch(orxSOUNDSYSTEM_SOUND *_pstSound, orxFLOAT _fPitch)
struct __orxSOUNDSYSTEM_SOUND_t orxSOUNDSYSTEM_SOUND
orxDLLAPI orxSTATUS orxFASTCALL orxSoundSystem_DeleteBus(orxHANDLE _hBus)
orxDLLAPI orxBOOL orxFASTCALL orxSoundSystem_HasRecordingSupport()
orxDLLAPI orxFLOAT orxFASTCALL orxSoundSystem_GetDuration(const orxSOUNDSYSTEM_SOUND *_pstSound)
orxDLLAPI void orxFASTCALL orxSoundSystem_Setup()
struct __orxSOUNDSYSTEM_SAMPLE_t orxSOUNDSYSTEM_SAMPLE

Generated for orx by doxygen 1.8.11