orx  1.9
Portable Game Engine
orxSound.h
Go to the documentation of this file.
1 /* Orx - Portable Game Engine
2  *
3  * Copyright (c) 2008-2018 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 _orxSOUND_H_
44 #define _orxSOUND_H_
45 
46 
47 #include "orxInclude.h"
48 #include "sound/orxSoundSystem.h"
49 #include "math/orxVector.h"
50 
51 
54 #define orxSOUND_KZ_RESOURCE_GROUP "Sound"
55 
56 #define orxSOUND_KZ_MASTER_BUS "master"
57 
58 
61 typedef enum __orxSOUND_STATUS_t
62 {
66 
68 
69  orxSOUND_STATUS_NONE = orxENUM_NONE
70 
72 
73 
76 typedef struct __orxSOUND_t orxSOUND;
77 
78 
81 typedef enum __orxSOUND_EVENT_t
82 {
93 
94  orxSOUND_EVENT_NONE = orxENUM_NONE
95 
97 
100 typedef struct __orxSOUND_STREAM_INFO_t
101 {
102  orxU32 u32SampleRate;
106 
109 typedef struct __orxSOUND_STREAM_PACKET_t
110 {
112  orxS16 *as16SampleList;
113  orxBOOL bDiscard;
114  orxFLOAT fTimeStamp;
115  orxS32 s32ID;
116  orxFLOAT fCursor;
119 
122 typedef struct __orxSOUND_EVENT_PAYLOAD_t
123 {
124  union
125  {
128  struct
129  {
130  const orxSTRING zSoundName;
133  } stStream;
134  };
137 
138 
141 extern orxDLLAPI void orxFASTCALL orxSound_Setup();
142 
146 extern orxDLLAPI orxSTATUS orxFASTCALL orxSound_Init();
147 
150 extern orxDLLAPI void orxFASTCALL orxSound_Exit();
151 
152 
156 extern orxDLLAPI orxSOUND *orxFASTCALL orxSound_Create();
157 
162 extern orxDLLAPI orxSOUND *orxFASTCALL orxSound_CreateFromConfig(const orxSTRING _zConfigID);
163 
170 extern orxDLLAPI orxSOUND *orxFASTCALL orxSound_CreateWithEmptyStream(orxU32 _u32ChannelNumber, orxU32 _u32SampleRate, const orxSTRING _zName);
171 
176 extern orxDLLAPI orxSTATUS orxFASTCALL orxSound_Delete(orxSOUND *_pstSound);
177 
181 extern orxDLLAPI orxSTATUS orxFASTCALL orxSound_ClearCache();
182 
183 
191 extern orxDLLAPI orxSOUNDSYSTEM_SAMPLE *orxFASTCALL orxSound_CreateSample(orxU32 _u32ChannelNumber, orxU32 _u32FrameNumber, orxU32 _u32SampleRate, const orxSTRING _zName);
192 
197 extern orxDLLAPI orxSOUNDSYSTEM_SAMPLE *orxFASTCALL orxSound_GetSample(const orxSTRING _zName);
198 
203 extern orxDLLAPI orxSTATUS orxFASTCALL orxSound_DeleteSample(const orxSTRING _zName);
204 
210 extern orxDLLAPI orxSTATUS orxFASTCALL orxSound_LinkSample(orxSOUND *_pstSound, const orxSTRING _zSampleName);
211 
216 extern orxDLLAPI orxSTATUS orxFASTCALL orxSound_UnlinkSample(orxSOUND *_pstSound);
217 
218 
223 extern orxDLLAPI orxBOOL orxFASTCALL orxSound_IsStream(orxSOUND *_pstSound);
224 
225 
230 extern orxDLLAPI orxSTATUS orxFASTCALL orxSound_Play(orxSOUND *_pstSound);
231 
236 extern orxDLLAPI orxSTATUS orxFASTCALL orxSound_Pause(orxSOUND *_pstSound);
237 
242 extern orxDLLAPI orxSTATUS orxFASTCALL orxSound_Stop(orxSOUND *_pstSound);
243 
244 
252 extern orxDLLAPI orxSTATUS orxFASTCALL orxSound_StartRecording(const orxCHAR *_zName, orxBOOL _bWriteToFile, orxU32 _u32SampleRate, orxU32 _u32ChannelNumber);
253 
257 extern orxDLLAPI orxSTATUS orxFASTCALL orxSound_StopRecording();
258 
262 extern orxDLLAPI orxBOOL orxFASTCALL orxSound_HasRecordingSupport();
263 
264 
270 extern orxDLLAPI orxSTATUS orxFASTCALL orxSound_SetVolume(orxSOUND *_pstSound, orxFLOAT _fVolume);
271 
277 extern orxDLLAPI orxSTATUS orxFASTCALL orxSound_SetPitch(orxSOUND *_pstSound, orxFLOAT _fPitch);
278 
284 extern orxDLLAPI orxSTATUS orxFASTCALL orxSound_SetCursor(orxSOUND *_pstSound, orxFLOAT _fCursor);
285 
291 extern orxDLLAPI orxSTATUS orxFASTCALL orxSound_SetPosition(orxSOUND *_pstSound, const orxVECTOR *_pvPosition);
292 
298 extern orxDLLAPI orxSTATUS orxFASTCALL orxSound_SetAttenuation(orxSOUND *_pstSound, orxFLOAT _fAttenuation);
299 
305 extern orxDLLAPI orxSTATUS orxFASTCALL orxSound_SetReferenceDistance(orxSOUND *_pstSound, orxFLOAT _fDistance);
306 
312 extern orxDLLAPI orxSTATUS orxFASTCALL orxSound_Loop(orxSOUND *_pstSound, orxBOOL _bLoop);
313 
314 
319 extern orxDLLAPI orxFLOAT orxFASTCALL orxSound_GetVolume(const orxSOUND *_pstSound);
320 
325 extern orxDLLAPI orxFLOAT orxFASTCALL orxSound_GetPitch(const orxSOUND *_pstSound);
326 
331 extern orxDLLAPI orxFLOAT orxFASTCALL orxSound_GetCursor(const orxSOUND *_pstSound);
332 
338 extern orxDLLAPI orxVECTOR *orxFASTCALL orxSound_GetPosition(const orxSOUND *_pstSound, orxVECTOR *_pvPosition);
339 
344 extern orxDLLAPI orxFLOAT orxFASTCALL orxSound_GetAttenuation(const orxSOUND *_pstSound);
345 
350 extern orxDLLAPI orxFLOAT orxFASTCALL orxSound_GetReferenceDistance(const orxSOUND *_pstSound);
351 
356 extern orxDLLAPI orxBOOL orxFASTCALL orxSound_IsLooping(const orxSOUND *_pstSound);
357 
358 
363 extern orxDLLAPI orxFLOAT orxFASTCALL orxSound_GetDuration(const orxSOUND *_pstSound);
364 
369 extern orxDLLAPI orxSOUND_STATUS orxFASTCALL orxSound_GetStatus(const orxSOUND *_pstSound);
370 
375 extern orxDLLAPI const orxSTRING orxFASTCALL orxSound_GetName(const orxSOUND *_pstSound);
376 
380 extern orxDLLAPI orxU32 orxFASTCALL orxSound_GetMasterBusID();
381 
386 extern orxDLLAPI orxU32 orxFASTCALL orxSound_GetBusID(const orxSOUND *_pstSound);
387 
393 extern orxDLLAPI orxSTATUS orxFASTCALL orxSound_SetBusID(orxSOUND *_pstSound, orxU32 _u32BusID);
394 
400 extern orxDLLAPI orxSOUND *orxFASTCALL orxSound_GetNext(const orxSOUND *_pstSound, orxU32 _u32BusID);
401 
406 extern orxDLLAPI orxU32 orxFASTCALL orxSound_GetBusParent(orxU32 _u32BusID);
407 
412 extern orxDLLAPI orxU32 orxFASTCALL orxSound_GetBusChild(orxU32 _u32BusID);
413 
418 extern orxDLLAPI orxU32 orxFASTCALL orxSound_GetBusSibling(orxU32 _u32BusID);
419 
425 extern orxDLLAPI orxSTATUS orxFASTCALL orxSound_SetBusParent(orxU32 _u32BusID, orxU32 _u32ParentBusID);
426 
431 extern orxDLLAPI orxFLOAT orxFASTCALL orxSound_GetBusVolume(orxU32 _u32BusID);
432 
437 extern orxDLLAPI orxFLOAT orxFASTCALL orxSound_GetBusPitch(orxU32 _u32BusID);
438 
444 extern orxDLLAPI orxSTATUS orxFASTCALL orxSound_SetBusVolume(orxU32 _u32BusID, orxFLOAT _fVolume);
445 
451 extern orxDLLAPI orxSTATUS orxFASTCALL orxSound_SetBusPitch(orxU32 _u32BusID, orxFLOAT _fPitch);
452 
457 extern orxDLLAPI orxFLOAT orxFASTCALL orxSound_GetBusGlobalVolume(orxU32 _u32BusID);
458 
463 extern orxDLLAPI orxFLOAT orxFASTCALL orxSound_GetBusGlobalPitch(orxU32 _u32BusID);
464 
465 #endif /*_orxSOUND_H_*/
466 
orxDLLAPI orxFLOAT orxFASTCALL orxSound_GetAttenuation(const orxSOUND *_pstSound)
orxDLLAPI void orxFASTCALL orxSound_Exit()
orxDLLAPI orxSTATUS orxFASTCALL orxSound_SetBusVolume(orxU32 _u32BusID, orxFLOAT _fVolume)
orxSOUND_STATUS
Definition: orxSound.h:61
orxDLLAPI orxSTATUS orxFASTCALL orxSound_SetReferenceDistance(orxSOUND *_pstSound, orxFLOAT _fDistance)
orxDLLAPI orxSOUND *orxFASTCALL orxSound_CreateFromConfig(const orxSTRING _zConfigID)
orxDLLAPI orxSTATUS orxFASTCALL orxSound_Play(orxSOUND *_pstSound)
orxDLLAPI orxFLOAT orxFASTCALL orxSound_GetReferenceDistance(const orxSOUND *_pstSound)
orxDLLAPI orxU32 orxFASTCALL orxSound_GetBusParent(orxU32 _u32BusID)
orxDLLAPI orxSOUND *orxFASTCALL orxSound_CreateWithEmptyStream(orxU32 _u32ChannelNumber, orxU32 _u32SampleRate, const orxSTRING _zName)
orxDLLAPI orxSOUND *orxFASTCALL orxSound_GetNext(const orxSOUND *_pstSound, orxU32 _u32BusID)
orxDLLAPI orxSTATUS orxFASTCALL orxSound_SetVolume(orxSOUND *_pstSound, orxFLOAT _fVolume)
orxDLLAPI orxSTATUS orxFASTCALL orxSound_DeleteSample(const orxSTRING _zName)
const orxSTRING zSoundName
Definition: orxSound.h:130
orxDLLAPI orxSTATUS orxFASTCALL orxSound_StartRecording(const orxCHAR *_zName, orxBOOL _bWriteToFile, orxU32 _u32SampleRate, orxU32 _u32ChannelNumber)
orxDLLAPI orxSOUNDSYSTEM_SAMPLE *orxFASTCALL orxSound_CreateSample(orxU32 _u32ChannelNumber, orxU32 _u32FrameNumber, orxU32 _u32SampleRate, const orxSTRING _zName)
orxDLLAPI orxSTATUS orxFASTCALL orxSound_Init()
orxDLLAPI orxFLOAT orxFASTCALL orxSound_GetDuration(const orxSOUND *_pstSound)
orxDLLAPI orxSTATUS orxFASTCALL orxSound_Delete(orxSOUND *_pstSound)
orxDLLAPI orxSTATUS orxFASTCALL orxSound_LinkSample(orxSOUND *_pstSound, const orxSTRING _zSampleName)
orxSOUND * pstSound
Definition: orxSound.h:126
orxDLLAPI orxU32 orxFASTCALL orxSound_GetMasterBusID()
orxDLLAPI orxSTATUS orxFASTCALL orxSound_SetPitch(orxSOUND *_pstSound, orxFLOAT _fPitch)
orxDLLAPI orxFLOAT orxFASTCALL orxSound_GetBusVolume(orxU32 _u32BusID)
orxDLLAPI orxSTATUS orxFASTCALL orxSound_SetBusPitch(orxU32 _u32BusID, orxFLOAT _fPitch)
orxDLLAPI orxSOUND_STATUS orxFASTCALL orxSound_GetStatus(const orxSOUND *_pstSound)
orxDLLAPI orxSTATUS orxFASTCALL orxSound_ClearCache()
orxDLLAPI orxBOOL orxFASTCALL orxSound_IsStream(orxSOUND *_pstSound)
orxSOUND_EVENT
Definition: orxSound.h:81
orxDLLAPI orxBOOL orxFASTCALL orxSound_IsLooping(const orxSOUND *_pstSound)
orxDLLAPI orxFLOAT orxFASTCALL orxSound_GetPitch(const orxSOUND *_pstSound)
orxDLLAPI void orxFASTCALL orxSound_Setup()
orxSOUND_STREAM_INFO stInfo
Definition: orxSound.h:131
orxDLLAPI orxSTATUS orxFASTCALL orxSound_SetAttenuation(orxSOUND *_pstSound, orxFLOAT _fAttenuation)
orxU32 u32ChannelNumber
Definition: orxSound.h:103
orxDLLAPI orxU32 orxFASTCALL orxSound_GetBusID(const orxSOUND *_pstSound)
orxDLLAPI orxSOUNDSYSTEM_SAMPLE *orxFASTCALL orxSound_GetSample(const orxSTRING _zName)
orxSTATUS
Definition: orxType.h:243
orxDLLAPI orxFLOAT orxFASTCALL orxSound_GetBusGlobalVolume(orxU32 _u32BusID)
orxDLLAPI orxSTATUS orxFASTCALL orxSound_SetBusParent(orxU32 _u32BusID, orxU32 _u32ParentBusID)
orxDLLAPI orxSTATUS orxFASTCALL orxSound_SetPosition(orxSOUND *_pstSound, const orxVECTOR *_pvPosition)
#define orxDLLAPI
Definition: orxDecl.h:394
orxDLLAPI orxSTATUS orxFASTCALL orxSound_SetCursor(orxSOUND *_pstSound, orxFLOAT _fCursor)
orxSOUND_STREAM_PACKET stPacket
Definition: orxSound.h:132
orxDLLAPI orxSTATUS orxFASTCALL orxSound_Stop(orxSOUND *_pstSound)
orxS16 * as16SampleList
Definition: orxSound.h:112
orxDLLAPI orxFLOAT orxFASTCALL orxSound_GetBusGlobalPitch(orxU32 _u32BusID)
orxDLLAPI orxFLOAT orxFASTCALL orxSound_GetVolume(const orxSOUND *_pstSound)
orxDLLAPI orxSTATUS orxFASTCALL orxSound_Loop(orxSOUND *_pstSound, orxBOOL _bLoop)
orxDLLAPI orxBOOL orxFASTCALL orxSound_HasRecordingSupport()
orxDLLAPI orxVECTOR *orxFASTCALL orxSound_GetPosition(const orxSOUND *_pstSound, orxVECTOR *_pvPosition)
orxDLLAPI orxSTATUS orxFASTCALL orxSound_Pause(orxSOUND *_pstSound)
orxDLLAPI orxU32 orxFASTCALL orxSound_GetBusSibling(orxU32 _u32BusID)
orxDLLAPI orxSTATUS orxFASTCALL orxSound_UnlinkSample(orxSOUND *_pstSound)
orxDLLAPI const orxSTRING orxFASTCALL orxSound_GetName(const orxSOUND *_pstSound)
orxDLLAPI orxSTATUS orxFASTCALL orxSound_StopRecording()
orxDLLAPI orxSTATUS orxFASTCALL orxSound_SetBusID(orxSOUND *_pstSound, orxU32 _u32BusID)
orxDLLAPI orxSOUND *orxFASTCALL orxSound_Create()
orxDLLAPI orxFLOAT orxFASTCALL orxSound_GetCursor(const orxSOUND *_pstSound)
orxDLLAPI orxU32 orxFASTCALL orxSound_GetBusChild(orxU32 _u32BusID)
struct __orxSOUNDSYSTEM_SAMPLE_t orxSOUNDSYSTEM_SAMPLE
orxDLLAPI orxFLOAT orxFASTCALL orxSound_GetBusPitch(orxU32 _u32BusID)
struct __orxSOUND_t orxSOUND
Definition: orxSound.h:76

Generated for orx by doxygen 1.8.11