Neo  0.5.0
Developer Documentation
SoundContext.h
Go to the documentation of this file.
1 //========================================================================
2 // Copyright (c) 2003-2011 Anael Seghezzi <www.maratis3d.com>
3 //
4 // This software is provided 'as-is', without any express or implied
5 // warranty. In no event will the authors be held liable for any damages
6 // arising from the use of this software.
7 //
8 // Permission is granted to anyone to use this software for any purpose,
9 // including commercial applications, and to alter it and redistribute it
10 // freely, subject to the following restrictions:
11 //
12 // 1. The origin of this software must not be misrepresented; you must not
13 // claim that you wrote the original software. If you use this software
14 // in a product, an acknowledgment in the product documentation would
15 // be appreciated but is not required.
16 //
17 // 2. Altered source versions must be plainly marked as such, and must not
18 // be misrepresented as being the original software.
19 //
20 // 3. This notice may not be removed or altered from any source
21 // distribution.
22 //
23 //========================================================================
24 
25 
26 #ifndef __SOUND_CONTEXT_H
27 #define __SOUND_CONTEXT_H
28 
29 namespace Neo
30 {
31 
33 {
38 };
39 
40 
41 class NEO_CORE_EXPORT SoundContext
42 {
43 public:
44 
45  // destructor
46  virtual ~SoundContext(void){}
47 
48  // init context
49  virtual void initContext(void) = 0;
50 
51  // buffer
52  virtual void createBuffer(unsigned int * bufferId) = 0;
53  virtual void deleteBuffer(unsigned int * bufferId) = 0;
54  virtual void sendBufferSound(unsigned int bufferId, Sound * sound) = 0;
55  virtual void sendBufferData(unsigned int bufferId, SOUND_FORMAT format, void * data, unsigned int size, unsigned int freq) = 0;
56 
57  virtual float getBufferDuration(unsigned int bufferId) = 0;
58 
59  // source
60  virtual void createSource(unsigned int * sourceId, unsigned int bufferId) = 0;
61  virtual void deleteSource(unsigned int * sourceId) = 0;
62 
63  virtual void enableSourceLoop(unsigned int sourceId) = 0;
64  virtual void disableSourceLoop(unsigned int sourceId) = 0;
65 
66  virtual void setSourceRelative(unsigned int sourceId, bool relative) = 0;
67 
68  virtual void setSourceBufferId(unsigned int sourceId, unsigned int bufferId) = 0;
69  virtual void setSourcePosition(unsigned int sourceId, const Vector3 & position) = 0;
70  virtual void setSourceRadius(unsigned int sourceId, float radius) = 0;
71  virtual void setSourcePitch(unsigned int sourceId, float pitch) = 0;
72  virtual void setSourceGain(unsigned int sourceId, float gain) = 0;
73  virtual void setSourceRolloff(unsigned int sourceId, float rolloff) = 0;
74  virtual void setSourceOffset(unsigned int sourceId, float offset) = 0;
75 
76  virtual float getSourceOffset(unsigned int sourceId) = 0;
77 
78  virtual void playSource(unsigned int sourceId) = 0;
79  virtual void pauseSource(unsigned int sourceId) = 0;
80  virtual void stopSource(unsigned int sourceId) = 0;
81  virtual bool isSourcePaused(unsigned int sourceId) = 0;
82  virtual bool isSourcePlaying(unsigned int sourceId) = 0;
83  virtual float getSourceTimePos(unsigned int sourceId) = 0;
84 
85  virtual void queueSourceBuffer(unsigned int sourceId, unsigned int * buffers, unsigned int bufferSize) = 0;
86  virtual void unqueueSourceBuffer(unsigned int sourceId, unsigned int * buffers, unsigned int bufferSize) = 0;
87 
88  virtual unsigned int getSourceBuffersQueued(unsigned int sourceId) = 0;
89  virtual unsigned int getSourceBuffersProcessed(unsigned int sourceId) = 0;
90 
91  // listener
92  virtual void updateListenerPosition(const Vector3 & position, const Vector3 & direction, const Vector3 & up) = 0;
93 };
94 }
95 #endif
Definition: Sound.h:31
Definition: Vector3.h:31
Definition: SoundContext.h:41
virtual ~SoundContext(void)
Definition: SoundContext.h:46
SOUND_FORMAT
Definition: SoundContext.h:32
Definition: SoundContext.h:35
Definition: SoundContext.h:36
Definition: SoundContext.h:34
Definition: SoundContext.h:37
Definition: Color.h:29