瀏覽代碼

Now finished documenting Sound

Thomas Buck 11 年之前
父節點
當前提交
71b4bcab4f
共有 2 個檔案被更改,包括 36 行新增56 行删除
  1. 24
    28
      src/Sound.cpp
  2. 12
    28
      src/Sound.h

+ 24
- 28
src/Sound.cpp 查看文件

@@ -1,23 +1,12 @@
1
-/* -*- Mode: C++; tab-width: 3; indent-tabs-mode: t; c-basic-offset: 3 -*- */
2
-/*================================================================
1
+/*!
2
+ * \file Sound.cpp
3
+ * \brief This is the audio manager Implementation
3 4
  *
4
- * Project : OpenRaider
5
- * Author  : Mongoose
6
- * Website : http://www.westga.edu/~stu7440/
7
- * Email   : stu7440@westga.edu
8
- * Object  : Sound
9
- * License : No use w/o permission (C) 2001 Mongoose
10
- * Comments: This is the audio manager for OpenRaider
5
+ * Defining UNIT_TEST_SOUND builds Sound class as a console unit test
11 6
  *
12
- *
13
- *           This file was generated using Mongoose's C++
14
- *           template generator script.  <stu7440@westga.edu>
15
- *
16
- *-- History -------------------------------------------------
17
- *
18
- * 2001.05.23:
19
- * Mongoose - Created
20
- =================================================================*/
7
+ * \author Mongoose
8
+ * \author xythobuz
9
+ */
21 10
 
22 11
 #ifdef HAVE_OPENAL
23 12
 #ifdef __APPLE__
@@ -25,10 +14,10 @@
25 14
 #include <OpenAL/alc.h>
26 15
 #include <AL/alut.h>
27 16
 #else
28
-#   include <AL/al.h>
29
-#   include <AL/alc.h>
30
-#   include <AL/alut.h>
31
-#   include <AL/alext.h>
17
+#include <AL/al.h>
18
+#include <AL/alc.h>
19
+#include <AL/alut.h>
20
+#include <AL/alext.h>
32 21
 #endif
33 22
 #endif
34 23
 
@@ -43,7 +32,7 @@
43 32
 #include "Sound.h"
44 33
 
45 34
 #ifdef DEBUG_MEMEORY
46
-#   include "memeory_test.h"
35
+#include "memeory_test.h"
47 36
 #endif
48 37
 
49 38
 
@@ -191,7 +180,9 @@ int Sound::addFile(char *filename, int *source, unsigned int flags)
191 180
 #endif
192 181
 }
193 182
 
194
-
183
+/*!
184
+ * \todo Reimplement, not using deprecated FORMAT specifier
185
+ */
195 186
 int Sound::addWave(unsigned char *wav, int *source, unsigned int flags)
196 187
 {
197 188
 #ifdef HAVE_OPENAL
@@ -230,8 +221,7 @@ int Sound::addWave(unsigned char *wav, int *source, unsigned int flags)
230 221
 		return -2;
231 222
 	}
232 223
 
233
-// This method isn't used yet...
234
-//#warning "AL_FORMAT_WAVE_EXT does not exist on Mac!"
224
+#warning "AL_FORMAT_WAVE_EXT does not exist on Mac!"
235 225
    // alBufferData(mBuffer[mNextBuffer], AL_FORMAT_WAVE_EXT, data, size, freq);
236 226
    alBufferData(mBuffer[mNextBuffer], 0x10002, data, size, freq);
237 227
 
@@ -292,6 +282,12 @@ void Sound::stop(int source)
292 282
 
293 283
 
294 284
 #ifdef UNIT_TEST_SOUND
285
+/*!
286
+ * \brief Sound Unit Test
287
+ * \param argc Number of arguments. Has to be > 1
288
+ * \param argv Argument array. argv[1] will be played as wav file
289
+ * \returns always zero
290
+ */
295 291
 int main(int argc, char* argv[])
296 292
 {
297 293
 	Sound snd;
@@ -305,7 +301,7 @@ int main(int argc, char* argv[])
305 301
 	{
306 302
 		snd.init();
307 303
 		printf("Loading %s\n", argv[1]);
308
-		ret = snd.add(argv[1], &id, SoundFlagsNone);
304
+		ret = snd.addFile(argv[1], &id, SoundFlagsNone);
309 305
 		printf("Load returned %i\n", ret);
310 306
 		printf("Playing %u::%s\n", id, argv[1]);
311 307
 		snd.play(id);
@@ -327,7 +323,7 @@ int main(int argc, char* argv[])
327 323
 			fclose(f);
328 324
 
329 325
 			printf("Loading buffer of %s\n", argv[1]);
330
-			ret = snd.add(buf, &id, SoundFlagsNone);
326
+			ret = snd.addFile(buf, &id, SoundFlagsNone);
331 327
 			printf("Load returned %i\n", ret);
332 328
 			printf("Playing buffer of %u::%s\n", id, argv[1]);
333 329
 			snd.play(id);

+ 12
- 28
src/Sound.h 查看文件

@@ -1,37 +1,19 @@
1
-/* -*- Mode: C++; tab-width: 3; indent-tabs-mode: t; c-basic-offset: 3 -*- */
2
-/*================================================================
1
+/*!
2
+ * \file Sound.h
3
+ * \brief This is the audio manager Header
3 4
  *
4
- * Project : OpenRaider
5
- * Author  : Mongoose
6
- * Website : http://www.westga.edu/~stu7440/
7
- * Email   : stu7440@westga.edu
8
- * Object  : Sound
9
- * License : No use w/o permission (C) 2001 Mongoose
10
- * Comments: This is the audio manager for OpenRaider
5
+ * Defining UNIT_TEST_SOUND builds Sound class as a console unit test
11 6
  *
12
- *
13
- *           This file was generated using Mongoose's C++
14
- *           template generator script.  <stu7440@westga.edu>
15
- *
16
- *-- Test Defines -----------------------------------------------
17
- *
18
- * UNIT_TEST_SOUND - Builds Sound class as a console unit test
19
- *
20
- *-- History ----------------------------------------------------
21
- *
22
- * 2002.09.13:
23
- * Mongoose - API follows new code style guidelines
24
- *
25
- * 2002.01.03:
26
- * Mongoose - Flags use added
27
- *
28
- * 2001.05.23:
29
- * Mongoose - Created
30
- ================================================================*/
7
+ * \author Mongoose
8
+ * \author xythobuz
9
+ */
31 10
 
32 11
 #ifndef __OPENRAIDER_MONGOOSE_SOUND_H_
33 12
 #define __OPENRAIDER_MONGOOSE_SOUND_H_
34 13
 
14
+/*!
15
+ * \brief This is the audio manager for OpenRaider
16
+ */
35 17
 class Sound {
36 18
 public:
37 19
 
@@ -85,6 +67,8 @@ public:
85 67
      * \param source not NULL! Returns new source ID or -1 on error.
86 68
      * \param flags (un)set options. Use SoundFlags enum
87 69
      * \returns 0 for no error or < 0 error flag
70
+     *
71
+     * \todo not yet implemented!
88 72
      */
89 73
     int addWave(unsigned char *wav, int *source, unsigned int flags);
90 74
 

Loading…
取消
儲存