소스 검색

Sound Unit Test buildable on Mac

Thomas Buck 11 년 전
부모
커밋
a3c353e3e3
2개의 변경된 파일15개의 추가작업 그리고 8개의 파일을 삭제
  1. 11
    4
      Makefile
  2. 4
    4
      src/Sound.cpp

+ 11
- 4
Makefile 파일 보기

@@ -47,14 +47,18 @@ DEBUG_OBJ=
47 47
 BASE_DEFS += -DHAVE_OPENAL
48 48
 
49 49
 ifeq ($(UNAME),Darwin)
50
-BASE_LIBS += -lalut
51
-BASE_LIBS += -framework OpenAL
50
+AUDIO_LIBS += -lalut
51
+AUDIO_LIBS += -L/opt/local/lib
52
+AUDIO_LIBS += -I/opt/local/include
53
+AUDIO_LIBS += -framework OpenAL
52 54
 BASE_LIBS += -framework OpenGL
53 55
 BASE_LIBS += -framework GLUT
54 56
 else
55
-BASE_LIBS += -lopenal
57
+AUDIO_LIBS += -lopenal
56 58
 endif
57 59
 
60
+BASE_LIBS += $(AUDIO_LIBS)
61
+
58 62
 # libferit, File transfer via HTTP/FTP/etc support
59 63
 LIBFERIT_LIB=/usr/local/lib/libferit.so
60 64
 LIBFERIT=$(shell if test -e $(LIBFERIT_LIB) > /dev/null; then echo yes; fi)
@@ -512,8 +516,11 @@ Network.test:
512 516
 Sound.test:
513 517
 	mkdir -p $(BUILD_TEST_DIR)
514 518
 	$(CC) $(TEST_FLAGS) -DUNIT_TEST_SOUND \
515
-		-DUSING_OPENAL -lopenal \
519
+		-DUSING_OPENAL -DHAVE_OPENAL $(AUDIO_LIBS) \
516 520
 		src/Sound.cpp -o $(BUILD_TEST_DIR)/Sound.test
521
+ifeq ($(UNAME),Darwin)
522
+	install_name_tool -change libalut.0.1.0.dylib /opt/local/lib/libalut.0.1.0.dylib $(BUILD_TEST_DIR)/Sound.test
523
+endif
517 524
 
518 525
 #################################################################
519 526
 

+ 4
- 4
src/Sound.cpp 파일 보기

@@ -301,13 +301,13 @@ int main(int argc, char* argv[])
301 301
 	{
302 302
 		snd.init();
303 303
 		printf("Loading %s\n", argv[1]);
304
-		ret = snd.addFile(argv[1], &id, SoundFlagsNone);
304
+		ret = snd.addFile(argv[1], &id, snd.SoundFlagsNone);
305 305
 		printf("Load returned %i\n", ret);
306 306
 		printf("Playing %u::%s\n", id, argv[1]);
307 307
 		snd.play(id);
308 308
 
309 309
 		printf("Waiting...\n");
310
-		sleep(5);
310
+		sleep(1);
311 311
 
312 312
 		f = fopen(argv[1], "rb");
313 313
 
@@ -323,14 +323,14 @@ int main(int argc, char* argv[])
323 323
 			fclose(f);
324 324
 
325 325
 			printf("Loading buffer of %s\n", argv[1]);
326
-			ret = snd.addFile(buf, &id, SoundFlagsNone);
326
+			ret = snd.addWave(buf, &id, snd.SoundFlagsNone);
327 327
 			printf("Load returned %i\n", ret);
328 328
 			printf("Playing buffer of %u::%s\n", id, argv[1]);
329 329
 			snd.play(id);
330 330
 
331 331
 			delete [] buf;
332 332
 			printf("Waiting...\n");
333
-			sleep(5);
333
+			sleep(1);
334 334
 		}
335 335
 	}
336 336
 	else

Loading…
취소
저장