diff -Naur libsndfile-1.0.21/programs/Makefile.am libsndfile-1.0.21-haiku/programs/Makefile.am
--- libsndfile-1.0.21/programs/Makefile.am	2009-12-09 10:56:35.001048576 +0000
+++ libsndfile-1.0.21-haiku/programs/Makefile.am	2010-08-09 17:15:51.864813056 +0000
@@ -16,8 +16,8 @@
 sndfile_info_SOURCES = sndfile-info.c
 sndfile_info_LDADD = $(top_builddir)/src/libsndfile.la
 
-sndfile_play_SOURCES = sndfile-play.c
-sndfile_play_LDADD = $(top_builddir)/src/libsndfile.la $(OS_SPECIFIC_LINKS) $(ALSA_LIBS)
+sndfile_play_SOURCES = sndfile-play-beos.cpp test-sndfile-metadata-set.py
+sndfile_play_LDADD = $(top_builddir)/src/libsndfile.la $(OS_SPECIFIC_LINKS) $(ALSA_LIBS) -lbe -lmedia
 
 sndfile_convert_SOURCES = sndfile-convert.c common.c common.h
 sndfile_convert_LDADD = $(top_builddir)/src/libsndfile.la
diff -Naur libsndfile-1.0.21/programs/sndfile-play-beos.cpp libsndfile-1.0.21-haiku/programs/sndfile-play-beos.cpp
--- libsndfile-1.0.21/programs/sndfile-play-beos.cpp	2009-03-22 19:17:13.066846720 +0000
+++ libsndfile-1.0.21-haiku/programs/sndfile-play-beos.cpp	2010-08-09 16:57:35.000000000 +0000
@@ -30,7 +30,7 @@
 **	BeOS functions for playing a sound.
 */
 
-#if defined (__BEOS__)
+#if defined(__BEOS__) || defined(__HAIKU__)
 
 struct shared_data
 {
@@ -60,7 +60,7 @@
 	{	for (m = readcount ; m < count ; m++)
 			buffer [m] = 0 ;
 		}
-	if (data->sfinfo.pcmbitwidth < 16) 
+	if (readcount > count)
 	{	for (m = 0 ; m < count ; m++)
 			buffer [m] *= 256 ;
 		}
@@ -78,7 +78,7 @@
 
 	for (k = 1 ; k < argc ; k++)
 	{	printf ("Playing %s\n", argv [k]) ;	
-		if (! (data.sndfile = sf_open_read (argv [k], &data.sfinfo)))
+		if (! (data.sndfile = sf_open (argv [k], SFM_READ, &data.sfinfo)))
 		{	sf_perror (NULL) ;
 			continue ;
 			} ;
