aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKatja <katjav@users.sourceforge.net>2011-11-16 16:25:00 +0000
committerKatja <katjav@users.sourceforge.net>2011-11-16 16:25:00 +0000
commit1f32b386fcf29b8ee2aa83ce072cde948eac53a0 (patch)
tree429e9be4b70a915f6294c5d457b689898af27255
parent22ef47d0ebbc638554e65a7383ab56fb2bfbc14c (diff)
add unittests to vbap
svn path=/trunk/externals/vbap/; revision=15769
-rw-r--r--Makefile20
-rw-r--r--unittests/define-loudspeaker-unittest.wavbin0 -> 2092 bytes
-rw-r--r--unittests/define_loudspeakers-unittest.pd43
-rw-r--r--unittests/rvbap-unittest.pd75
-rw-r--r--unittests/rvbap-unittest.wavbin0 -> 2092 bytes
-rw-r--r--unittests/vbap-unittest.pd140
-rw-r--r--unittests/vbap-unittest.wavbin0 -> 2092 bytes
-rw-r--r--unittests/vbap.wavbin0 -> 2092 bytes
8 files changed, 274 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index e528b5d..95e4cf5 100644
--- a/Makefile
+++ b/Makefile
@@ -24,7 +24,8 @@ MANUAL =
# automatically included
EXTRA_DIST = define_loudspeakers.h max2pd.h vbap.h makefile.irix so_locations
-
+# unit tests and related files here, in the 'unittests' subfolder
+UNITTESTS = define-loudspeaker-unittest.wav define_loudspeakers-unittest.pd rvbap-unittest.pd rvbap-unittest.wav vbap-unittest.pd vbap-unittest.wav vbap.wav
#------------------------------------------------------------------------------#
#
@@ -237,7 +238,7 @@ SHARED_SOURCE ?= $(shell test ! -e lib$(LIBRARY_NAME).c || \
SHARED_HEADER ?= $(shell test ! -e $(LIBRARY_NAME).h || echo $(LIBRARY_NAME).h)
SHARED_LIB = $(SHARED_SOURCE:.c=.$(SHARED_EXTENSION))
-.PHONY = install libdir_install single_install install-doc install-examples install-manual clean distclean dist etags $(LIBRARY_NAME)
+.PHONY = install libdir_install single_install install-doc install-examples install-manual install-unittests clean distclean dist etags $(LIBRARY_NAME)
all: $(SOURCES:.c=.$(EXTENSION)) $(SHARED_LIB)
@@ -260,7 +261,7 @@ install: libdir_install
# The meta and help files are explicitly installed to make sure they are
# actually there. Those files are not optional, then need to be there.
-libdir_install: $(SOURCES:.c=.$(EXTENSION)) $(SHARED_LIB) install-doc install-examples install-manual
+libdir_install: $(SOURCES:.c=.$(EXTENSION)) $(SHARED_LIB) install-doc install-examples install-manual install-unittests
$(INSTALL_DIR) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
$(INSTALL_DATA) $(LIBRARY_NAME)-meta.pd \
$(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
@@ -278,7 +279,7 @@ libdir_install: $(SOURCES:.c=.$(EXTENSION)) $(SHARED_LIB) install-doc install-ex
$(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
# install library linked as single binary
-single_install: $(LIBRARY_NAME) install-doc install-examples install-manual
+single_install: $(LIBRARY_NAME) install-doc install-examples install-manual install-unittests
$(INSTALL_DIR) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
$(INSTALL_PROGRAM) $(LIBRARY_NAME).$(EXTENSION) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
$(STRIP) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/$(LIBRARY_NAME).$(EXTENSION)
@@ -305,6 +306,12 @@ install-manual:
$(INSTALL_DATA) manual/$$file $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/manual; \
done
+install-unittests:
+ test -z "$(strip $(UNITTESTS))" || \
+ $(INSTALL_DIR) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/unittests && \
+ for file in $(UNITTESTS); do \
+ $(INSTALL_DATA) unittests/$$file $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/unittests; \
+ done
clean:
-rm -f -- $(SOURCES:.c=.o) $(SOURCES_LIB:.c=.o) $(SHARED_SOURCE:.c=.o)
@@ -368,6 +375,11 @@ dist: $(DISTDIR)
for file in $(MANUAL); do \
$(INSTALL_DATA) manual/$$file $(DISTDIR)/manual; \
done
+ test -z "$(strip $(UNITTESTS))" || \
+ $(INSTALL_DIR) $(DISTDIR)/unittests && \
+ for file in $(UNITTESTS); do \
+ $(INSTALL_DATA) unittests/$$file $(DISTDIR)/unittests; \
+ done
tar --exclude-vcs -czpf $(DISTDIR).tar.gz $(DISTDIR)
# make a Debian source package
diff --git a/unittests/define-loudspeaker-unittest.wav b/unittests/define-loudspeaker-unittest.wav
new file mode 100644
index 0000000..d0e52da
--- /dev/null
+++ b/unittests/define-loudspeaker-unittest.wav
Binary files differ
diff --git a/unittests/define_loudspeakers-unittest.pd b/unittests/define_loudspeakers-unittest.pd
new file mode 100644
index 0000000..149d61e
--- /dev/null
+++ b/unittests/define_loudspeakers-unittest.pd
@@ -0,0 +1,43 @@
+#N canvas 177 32 793 647 10;
+#X text 19 210 In two dimensions \, only specify the azimuth. (for
+example "define_loudspeakers 2 -45 45 0 180";
+#X text 20 80 [define_loudspeakers] works with;
+#X obj 252 80 vbap;
+#X text 15 111 Use [define_loudspeakers] to list the speaker positions.
+The example here defines loudspeakers in three dimensions (the first
+parameter). For each speaker \, define its azimuth and elevation. Here
+we have speakers front left and right with no elevation (-45 0 45 0)
+and front and back with 45 degrees of elevation (0 45 180 45). Send
+the data to:;
+#X msg 428 221 ls-directions 3 -30 0 30 0 -90 0 90 0 0 0 -150 0 150
+0 180 45 -45 45 45 45;
+#X msg 411 158 ls-triplets 1 2 7 2 7 8 1 3 7;
+#X text 431 113 If you are not happy with triangle selections of define_loudspeakers
+\, you can define your own. (for experts only);
+#X text 427 268 2-D setup -> only loudspeaker azimuths specified:;
+#X text 426 283 (2 azi1 azi2 azi3 azi4...);
+#X text 425 184 3-D setup -> (azimuth elevation) pairs are specified:
+;
+#X text 423 202 (3 azi1 ele1 azi2 ele2 ...);
+#X text 637 47 a 2D setup;
+#X text 679 77 a 3D setup;
+#X obj 56 355 unit-test-frame;
+#X obj 377 14 t b b b b;
+#X msg 56 322 define-loudspeaker-unittest;
+#X obj 56 296 loadbang;
+#X obj 377 79 vbap/define_loudspeakers 3 -45 0 45 0 0 45 180 45;
+#X obj 394 49 vbap/define_loudspeakers 2 -45 45 0 180;
+#X obj 411 303 vbap/define_loudspeakers 2 -40 0 40 80 130 180 -130
+-80;
+#X connect 4 0 19 0;
+#X connect 5 0 19 0;
+#X connect 13 3 14 0;
+#X connect 14 0 17 0;
+#X connect 14 1 18 0;
+#X connect 14 2 5 0;
+#X connect 14 3 4 0;
+#X connect 15 0 13 0;
+#X connect 16 0 15 0;
+#X connect 17 0 13 1;
+#X connect 18 0 13 1;
+#X connect 19 0 13 1;
diff --git a/unittests/rvbap-unittest.pd b/unittests/rvbap-unittest.pd
new file mode 100644
index 0000000..906b424
--- /dev/null
+++ b/unittests/rvbap-unittest.pd
@@ -0,0 +1,75 @@
+#N canvas 90 22 726 609 10;
+#X obj 38 -190 unit-test-frame;
+#X text 383 -369 azimuth \, elevation \, spread and distance;
+#N canvas 0 22 450 300 tba 0;
+#X obj 143 51 inlet;
+#X obj 96 49 inlet;
+#X obj 191 51 inlet;
+#X obj 238 51 inlet;
+#X obj 173 180 outlet;
+#X obj 61 178 outlet;
+#X obj 221 180 outlet;
+#X obj 268 180 outlet;
+#X obj 126 180 outlet;
+#X obj 96 73 t b a;
+#X obj 143 72 t b a;
+#X obj 191 72 t b a;
+#X obj 238 72 t b a;
+#X connect 0 0 10 0;
+#X connect 1 0 9 0;
+#X connect 2 0 11 0;
+#X connect 3 0 12 0;
+#X connect 9 0 5 0;
+#X connect 9 1 8 0;
+#X connect 10 0 5 0;
+#X connect 10 1 4 0;
+#X connect 11 0 5 0;
+#X connect 11 1 6 0;
+#X connect 12 0 5 0;
+#X connect 12 1 7 0;
+#X restore 407 -341 pd tba;
+#X obj 342 -494 t b b b b;
+#X obj 446 -415 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144
+-1 -1;
+#X msg 407 -385 60;
+#X msg 446 -385 15;
+#X msg 524 -386 20;
+#X obj 38 -248 loadbang;
+#X obj 393 -440 vbap/define_loudspeakers 3 -45 0 45 0 0 45 180 45;
+#X obj 359 -307 vbap/rvbap 0 0;
+#X msg 485 -385 0;
+#X floatatom 379 -212 5 0 0 0 - - -;
+#X floatatom 399 -235 5 0 0 0 - - -;
+#X floatatom 419 -256 5 0 0 0 - - -;
+#X floatatom 440 -280 5 0 0 0 - - -;
+#X obj 359 -464 vbap/define_loudspeakers 3 -45 45 45 45 0 0 180 0;
+#X text 15 -474 In Pd-extended 0.42 \, [rvbap] crashes when using 2
+dimensional setup.;
+#X msg 38 -219 rvbap-unittest;
+#X connect 0 3 3 0;
+#X connect 2 0 10 0;
+#X connect 2 1 10 1;
+#X connect 2 2 10 2;
+#X connect 2 3 10 3;
+#X connect 2 4 10 4;
+#X connect 3 0 4 0;
+#X connect 3 1 16 0;
+#X connect 3 2 4 0;
+#X connect 3 3 9 0;
+#X connect 4 0 5 0;
+#X connect 4 0 6 0;
+#X connect 4 0 11 0;
+#X connect 4 0 7 0;
+#X connect 5 0 2 0;
+#X connect 6 0 2 1;
+#X connect 7 0 2 3;
+#X connect 8 0 18 0;
+#X connect 9 0 10 0;
+#X connect 10 0 0 1;
+#X connect 10 1 12 0;
+#X connect 10 2 13 0;
+#X connect 10 3 14 0;
+#X connect 10 4 15 0;
+#X connect 11 0 2 2;
+#X connect 16 0 10 0;
+#X connect 18 0 0 0;
diff --git a/unittests/rvbap-unittest.wav b/unittests/rvbap-unittest.wav
new file mode 100644
index 0000000..7c54c74
--- /dev/null
+++ b/unittests/rvbap-unittest.wav
Binary files differ
diff --git a/unittests/vbap-unittest.pd b/unittests/vbap-unittest.pd
new file mode 100644
index 0000000..06391a4
--- /dev/null
+++ b/unittests/vbap-unittest.pd
@@ -0,0 +1,140 @@
+#N canvas 225 22 809 680 10;
+#X text 21 122 In two dimensions \, only specify the azimuth. (for
+example "define_loudspeakers 2 -45 45 0 180";
+#X text 417 17 VBAP and define_loudspeakers;
+#X text 22 166 2 For vbap \, give azimuth and elevation for the desired
+location. Bang the first inlet and vbap will output gain-factors for
+each speaker and the actual location produced. This can be different
+from the desired one depending where your speakers are.;
+#X text 418 46 loudspeaker position definition can also be sent directly
+to a vbap object. This changes the setup information only in a single
+vbap object.;
+#X text 419 94 For an example of how to use vbap with [matrix~] from
+zexy-library \, see vbap-demo.pd.;
+#X text 21 22 1 Use the define_loudspeakers object or message to list
+the speaker positions. The example here defines loudspeakers in three
+dimensions (the first parameter). For each speaker \, define its azimuth
+and elevation. Here we have speakers front left and right with no elevation
+(-45 0 45 0) and front and back with 45 degrees of elevation (0 45
+180 45). Send the data to vbap.;
+#N canvas 283 22 628 620 simple 0;
+#X floatatom 159 198 5 0 0 2 - - -;
+#X floatatom 112 425 10 0 0 0 - - -;
+#X floatatom 181 425 10 0 0 0 - - -;
+#X floatatom 209 349 0 0 0 3 actual_azimuth - -;
+#X floatatom 221 315 0 0 0 3 actual_elevation - -;
+#X floatatom 231 294 7 0 0 1 actual_spreading - -;
+#X obj 162 182 hsl 100 13 -180 180 0 1 empty empty azimuth 10 7 0 10
+-262144 -1 -1 1500 1;
+#X floatatom 237 237 5 0 0 2 - - -;
+#X obj 240 220 hsl 100 13 0 100 0 1 empty empty spread 10 7 0 10 -262144
+-1 -1 700 1;
+#X text 130 134 to output updated values;
+#X obj 112 155 metro 100;
+#X obj 112 133 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
+1;
+#X text 197 200 (ignore elevation in 2D \, that's for 3D);
+#X obj 63 524 *~;
+#X obj 92 525 *~;
+#X msg 454 145 dsp 1;
+#X obj 454 169 send pd;
+#X floatatom 250 425 10 0 0 0 - - -;
+#X floatatom 319 425 10 0 0 0 - - -;
+#X obj 123 524 *~;
+#X obj 152 525 *~;
+#X msg 17 48 define_loudspeakers 2 -135 -45 0 45 135;
+#X text 263 37 Define 2D speaker arrangement with speakers at -135
+\, -45 \, 0 \, 45 and 135 degree positions (0 degrees is the center
+front). This is a classic 5.1 setup.;
+#X floatatom 389 425 10 0 0 0 - - -;
+#X obj 72 558 dac~ 1 2 3 4 5;
+#X obj 182 525 *~;
+#X obj 112 267 vbap 0 0 30;
+#X obj 112 376 route 0 1 2 3 4;
+#X obj 13 396 *~ 0.2;
+#X obj 13 374 noise~;
+#X connect 1 0 13 1;
+#X connect 2 0 14 1;
+#X connect 6 0 0 0;
+#X connect 8 0 7 0;
+#X connect 10 0 26 0;
+#X connect 11 0 10 0;
+#X connect 13 0 24 0;
+#X connect 14 0 24 1;
+#X connect 15 0 16 0;
+#X connect 17 0 19 1;
+#X connect 18 0 20 1;
+#X connect 19 0 24 2;
+#X connect 20 0 24 3;
+#X connect 21 0 26 0;
+#X connect 23 0 25 1;
+#X connect 25 0 24 4;
+#X connect 26 0 27 0;
+#X connect 27 0 1 0;
+#X connect 27 1 2 0;
+#X connect 27 2 17 0;
+#X connect 27 3 18 0;
+#X connect 27 4 23 0;
+#X connect 28 0 13 0;
+#X connect 28 0 14 0;
+#X connect 28 0 19 0;
+#X connect 28 0 20 0;
+#X connect 28 0 25 0;
+#X connect 29 0 28 0;
+#X restore 421 139 pd simple 5.1 example;
+#X obj 421 277 vbap/vbap 90 0 30;
+#X obj 100 371 unit-test-frame;
+#X msg 100 342 vbap;
+#X floatatom 454 342 5 0 0 0 - - -;
+#X floatatom 487 322 5 0 0 0 - - -;
+#X floatatom 520 300 5 0 0 0 - - -;
+#X text 22 244 The spread-parameter can be used to prevent a situation
+where sound is coming from one speaker only \, which would make speaker
+positions "visible". The range is 0 to 100;
+#X text 496 344 azimuth;
+#X text 524 324 elevation;
+#X text 556 300 spread;
+#X obj 100 315 loadbang;
+#N canvas 0 22 504 332 define-loudspeakers 0;
+#X msg 51 87 define_loudspeakers 2 -135 -45 0 45 135;
+#X msg 106 121 define_loudspeakers 3 -45 0 45 0 0 45 180 45;
+#X obj 51 21 inlet;
+#X obj 51 284 outlet;
+#X obj 188 283 outlet;
+#X obj 106 148 t b a;
+#X obj 51 112 t b a;
+#X obj 51 53 t b b b b;
+#X obj 161 199 t b a;
+#X obj 208 245 t b a;
+#X msg 161 172 define_loudspeakers 3 -30 0 30 0 0 45 180 45;
+#X msg 207 217 define_loudspeakers 3 -45 0 45 0 0 30 180 30;
+#X connect 0 0 6 0;
+#X connect 1 0 5 0;
+#X connect 2 0 7 0;
+#X connect 5 0 3 0;
+#X connect 5 1 4 0;
+#X connect 6 0 3 0;
+#X connect 6 1 4 0;
+#X connect 7 0 0 0;
+#X connect 7 1 1 0;
+#X connect 7 2 10 0;
+#X connect 7 3 11 0;
+#X connect 8 0 3 0;
+#X connect 8 1 4 0;
+#X connect 9 0 3 0;
+#X connect 9 1 4 0;
+#X connect 10 0 8 0;
+#X connect 11 0 9 0;
+#X restore 421 237 pd define-loudspeakers;
+#X obj 421 208 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144
+-1 -1;
+#X connect 7 0 8 1;
+#X connect 7 1 10 0;
+#X connect 7 2 11 0;
+#X connect 7 3 12 0;
+#X connect 8 3 19 0;
+#X connect 9 0 8 0;
+#X connect 17 0 9 0;
+#X connect 18 0 7 0;
+#X connect 18 1 7 0;
+#X connect 19 0 18 0;
diff --git a/unittests/vbap-unittest.wav b/unittests/vbap-unittest.wav
new file mode 100644
index 0000000..1a92557
--- /dev/null
+++ b/unittests/vbap-unittest.wav
Binary files differ
diff --git a/unittests/vbap.wav b/unittests/vbap.wav
new file mode 100644
index 0000000..9d10273
--- /dev/null
+++ b/unittests/vbap.wav
Binary files differ