Browse Source

Sound Unit Test buildable on Mac

Thomas Buck 11 years ago
parent
commit
a3c353e3e3
2 changed files with 15 additions and 8 deletions
  1. 11
    4
      Makefile
  2. 4
    4
      src/Sound.cpp

+ 11
- 4
Makefile View File

47
 BASE_DEFS += -DHAVE_OPENAL
47
 BASE_DEFS += -DHAVE_OPENAL
48
 
48
 
49
 ifeq ($(UNAME),Darwin)
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
 BASE_LIBS += -framework OpenGL
54
 BASE_LIBS += -framework OpenGL
53
 BASE_LIBS += -framework GLUT
55
 BASE_LIBS += -framework GLUT
54
 else
56
 else
55
-BASE_LIBS += -lopenal
57
+AUDIO_LIBS += -lopenal
56
 endif
58
 endif
57
 
59
 
60
+BASE_LIBS += $(AUDIO_LIBS)
61
+
58
 # libferit, File transfer via HTTP/FTP/etc support
62
 # libferit, File transfer via HTTP/FTP/etc support
59
 LIBFERIT_LIB=/usr/local/lib/libferit.so
63
 LIBFERIT_LIB=/usr/local/lib/libferit.so
60
 LIBFERIT=$(shell if test -e $(LIBFERIT_LIB) > /dev/null; then echo yes; fi)
64
 LIBFERIT=$(shell if test -e $(LIBFERIT_LIB) > /dev/null; then echo yes; fi)
512
 Sound.test:
516
 Sound.test:
513
 	mkdir -p $(BUILD_TEST_DIR)
517
 	mkdir -p $(BUILD_TEST_DIR)
514
 	$(CC) $(TEST_FLAGS) -DUNIT_TEST_SOUND \
518
 	$(CC) $(TEST_FLAGS) -DUNIT_TEST_SOUND \
515
-		-DUSING_OPENAL -lopenal \
519
+		-DUSING_OPENAL -DHAVE_OPENAL $(AUDIO_LIBS) \
516
 		src/Sound.cpp -o $(BUILD_TEST_DIR)/Sound.test
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 View File

301
 	{
301
 	{
302
 		snd.init();
302
 		snd.init();
303
 		printf("Loading %s\n", argv[1]);
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
 		printf("Load returned %i\n", ret);
305
 		printf("Load returned %i\n", ret);
306
 		printf("Playing %u::%s\n", id, argv[1]);
306
 		printf("Playing %u::%s\n", id, argv[1]);
307
 		snd.play(id);
307
 		snd.play(id);
308
 
308
 
309
 		printf("Waiting...\n");
309
 		printf("Waiting...\n");
310
-		sleep(5);
310
+		sleep(1);
311
 
311
 
312
 		f = fopen(argv[1], "rb");
312
 		f = fopen(argv[1], "rb");
313
 
313
 
323
 			fclose(f);
323
 			fclose(f);
324
 
324
 
325
 			printf("Loading buffer of %s\n", argv[1]);
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
 			printf("Load returned %i\n", ret);
327
 			printf("Load returned %i\n", ret);
328
 			printf("Playing buffer of %u::%s\n", id, argv[1]);
328
 			printf("Playing buffer of %u::%s\n", id, argv[1]);
329
 			snd.play(id);
329
 			snd.play(id);
330
 
330
 
331
 			delete [] buf;
331
 			delete [] buf;
332
 			printf("Waiting...\n");
332
 			printf("Waiting...\n");
333
-			sleep(5);
333
+			sleep(1);
334
 		}
334
 		}
335
 	}
335
 	}
336
 	else
336
 	else

Loading…
Cancel
Save