Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/audiocfg use htole16 to ensure that the pcm stream i...
details: https://anonhg.NetBSD.org/src/rev/27a69a54e451
branches: trunk
changeset: 757521:27a69a54e451
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Wed Sep 01 21:54:00 2010 +0000
description:
use htole16 to ensure that the pcm stream is slinear16_le on big endian hosts
diffstat:
usr.bin/audiocfg/dtmf.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diffs (31 lines):
diff -r b2a3983bf93b -r 27a69a54e451 usr.bin/audiocfg/dtmf.c
--- a/usr.bin/audiocfg/dtmf.c Wed Sep 01 21:19:37 2010 +0000
+++ b/usr.bin/audiocfg/dtmf.c Wed Sep 01 21:54:00 2010 +0000
@@ -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 <jmcneill%invisible.ca@localhost>
@@ -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;
}
Home |
Main Index |
Thread Index |
Old Index