Module Name:    src
Committed By:   jmcneill
Date:           Wed Sep  1 21:54:00 UTC 2010

Modified Files:
        src/usr.bin/audiocfg: dtmf.c

Log Message:
use htole16 to ensure that the pcm stream is slinear16_le on big endian hosts


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/audiocfg/dtmf.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/audiocfg/dtmf.c
diff -u src/usr.bin/audiocfg/dtmf.c:1.1 src/usr.bin/audiocfg/dtmf.c:1.2
--- src/usr.bin/audiocfg/dtmf.c:1.1	Wed Sep  1 09:04:16 2010
+++ src/usr.bin/audiocfg/dtmf.c	Wed Sep  1 21:54:00 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: dtmf.c,v 1.1 2010/09/01 09:04:16 jmcneill Exp $ */
+/* $NetBSD: dtmf.c,v 1.2 2010/09/01 21:54:00 jmcneill Exp $ */
 
 /*
  * Copyright (c) 2010 Jared D. McNeill <jmcne...@invisible.ca>
@@ -26,6 +26,8 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include <sys/endian.h>
+
 #include <fcntl.h>
 #include <math.h>
 #include <stdio.h>
@@ -50,9 +52,10 @@
 		for (c = 0; c < channels; c++) {
 			if ((chanmask & (1 << c)) == 0)
 				continue;
-			buf[c] = 
+			buf[c] = htole16(
 			    (sin(i * PI2 * (freq1 / sample_rate)) +
-			     sin(i * PI2 * (freq2 / sample_rate))) * 16383;
+			     sin(i * PI2 * (freq2 / sample_rate))) * 16383
+					);
 		}
 		buf += channels;
 	}

Reply via email to