1 /*
2  * Copyright 2011-2012 Arx Libertatis Team (see the AUTHORS file)
3  *
4  * This file is part of Arx Libertatis.
5  *
6  * Arx Libertatis is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * Arx Libertatis is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with Arx Libertatis.  If not, see <http://www.gnu.org/licenses/>.
18  */
19 /* Based on:
20 ===========================================================================
21 ARX FATALIS GPL Source Code
22 Copyright (C) 1999-2010 Arkane Studios SA, a ZeniMax Media company.
23 
24 This file is part of the Arx Fatalis GPL Source Code ('Arx Fatalis Source Code').
25 
26 Arx Fatalis Source Code is free software: you can redistribute it and/or modify it under the terms of the GNU General Public
27 License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
28 
29 Arx Fatalis Source Code is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
30 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
31 
32 You should have received a copy of the GNU General Public License along with Arx Fatalis Source Code.  If not, see
33 <http://www.gnu.org/licenses/>.
34 
35 In addition, the Arx Fatalis Source Code is also subject to certain additional terms. You should have received a copy of these
36 additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Arx
37 Fatalis Source Code. If not, please request a copy in writing from Arkane Studios at the address below.
38 
39 If you have questions concerning this license or the applicable additional terms, you may contact in writing Arkane Studios, c/o
40 ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
41 ===========================================================================
42 */
43 
44 #ifndef ARX_AUDIO_DSOUND_DSOUNDBACKEND_H
45 #define ARX_AUDIO_DSOUND_DSOUNDBACKEND_H
46 
47 #include "audio/dsound/dsoundfwd.h"
48 
49 #include "audio/AudioBackend.h"
50 #include "audio/AudioTypes.h"
51 #include "audio/AudioResource.h"
52 
53 namespace audio {
54 
55 class DSoundSource;
56 
57 class DSoundBackend : public Backend {
58 
59 public:
60 
61 	DSoundBackend();
62 	~DSoundBackend();
63 
64 	aalError init(bool enableEax);
65 
66 	aalError updateDeferred();
67 
68 	Source * createSource(SampleId sampleId, const Channel & channel);
69 
70 	Source * getSource(SourceId sourceId);
71 
72 	aalError setReverbEnabled(bool enable);
73 
74 	aalError setUnitFactor(float factor);
75 	aalError setRolloffFactor(float factor);
76 
77 	aalError setListenerPosition(const Vec3f & position);
78 	aalError setListenerOrientation(const Vec3f & front, const Vec3f & up);
79 
80 	aalError setListenerEnvironment(const Environment & env);
81 	aalError setRoomRolloffFactor(float factor);
82 
83 	source_iterator sourcesBegin();
84 	source_iterator sourcesEnd();
85 	source_iterator deleteSource(source_iterator it);
86 
87 private:
88 
89 	LPDIRECTSOUND device;
90 	LPDIRECTSOUNDBUFFER primary;
91 	LPDIRECTSOUND3DLISTENER listener;
92 	LPKSPROPERTYSET environment;
93 
94 	ResourceList<DSoundSource> sources;
95 
96 	bool hasEAX;
97 
98 	friend class DSoundSource;
99 };
100 
101 } // namespace audio
102 
103 #endif // ARX_AUDIO_DSOUND_DSOUNDBACKEND_H
104