shithub: sox

Download patch

ref: c14d8f1b99b6fd809920a829d9d1f0ac8e98e328
parent: e7c07cb495961d368cffd591f63b5b0ff72d616c
author: cbagwell <cbagwell>
date: Tue Nov 13 22:44:46 EST 2001

Bugfixes to internal GSM support.

--- a/Changelog
+++ b/Changelog
@@ -43,6 +43,7 @@
     left in internal buffers after changing audio format parameters.
   o Fixed problem were play script wasn't installed correctly if you
     build from another directory (pointed out by Mike Castle).
+  o Made GSM support internal to libst (no external library required).
 
 sox-12.17.2
 -----------
--- a/src/gsm/Makefile.in
+++ b/src/gsm/Makefile.in
@@ -19,9 +19,35 @@
 AR      = ar r
 RM	= rm -f
 
+SASR	= -DSASR
+######### Define SASR if >> is a signed arithmetic shift (-1 >> 1 == -1)
+
+MULHACK = -DUSE_FLOAT_MUL
+######### Define this if your host multiplies floats faster than integers,
+######### e.g. on a SPARCstation.
+
+FAST	= -DFAST
+######### Define together with USE_FLOAT_MUL to enable the GSM library's
+######### approximation option for incorrect, but good-enough results.
+
+# LTP_CUT	= -DLTP_CUT
+LTP_CUT	=
+######### Define to enable the GSM library's long-term correlation 
+######### approximation option---faster, but worse; works for
+######### both integer and floating point multiplications.
+######### This flag is still in the experimental stage.
+
+WAV49	= -DWAV49
+#WAV49	=
+######### Define to enable the GSM library's option to pack GSM frames 
+######### in the style used by the WAV #49 format.  If you want to write
+######### a tool that produces .WAV files which contain GSM-encoded data,
+######### define this, and read about the GSM_OPT_WAV49 option in the
+######### manual page on gsm_option(3).
+
 # Build macros.
 
-CFLAGS	= @CFLAGS@ @DEFS@ -I$(top_srcdir)/gsm
+CFLAGS	= @CFLAGS@ @DEFS@ $(SASR) $(MULHAC) $(FAST) $(LTP_CUT) $(WAV49) -I$(top_srcdir)/gsm
 LDFLAGS	= @LDFLAGS@
 LIBS	= @LIBS@
 EXEEXT  = @EXEEXT@
@@ -32,6 +58,7 @@
 GSM_OBJECTS =	add.o		\
 		code.o		\
 		decode.o	\
+		long_term.o     \
 		lpc.o		\
 		preprocess.o	\
 		rpe.o		\
@@ -39,7 +66,9 @@
 		gsm_decode.o	\
 		gsm_encode.o	\
 		gsm_create.o	\
-		short_term.o
+		gsm_option.o    \
+		short_term.o    \
+		table.o
 
 
 LIBOBJS = $(GSM_OBJECTS)
--- /dev/null
+++ b/src/gsm/gsm_option.c
@@ -1,0 +1,68 @@
+/*
+ * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
+ * Universitaet Berlin.  See the accompanying file "COPYRIGHT" for
+ * details.  THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
+ */
+
+/* $Header: /cvsroot/sox/sox/src/gsm/Attic/gsm_option.c,v 1.1 2001/11/14 03:44:46 cbagwell Exp $ */
+
+#include "private.h"
+
+#include "gsm.h"
+
+int gsm_option (gsm r, int opt, int * val)
+{
+	int 	result = -1;
+
+	switch (opt) {
+	case GSM_OPT_LTP_CUT:
+#ifdef 	LTP_CUT
+		result = r->ltp_cut;
+		if (val) r->ltp_cut = *val;
+#endif
+		break;
+
+	case GSM_OPT_VERBOSE:
+#ifndef	NDEBUG
+		result = r->verbose;
+		if (val) r->verbose = *val;
+#endif
+		break;
+
+	case GSM_OPT_FAST:
+
+#if	defined(FAST) && defined(USE_FLOAT_MUL)
+		result = r->fast;
+		if (val) r->fast = !!*val;
+#endif
+		break;
+
+	case GSM_OPT_FRAME_CHAIN:
+
+#ifdef WAV49
+		result = r->frame_chain;
+		if (val) r->frame_chain = *val;
+#endif
+		break;
+
+	case GSM_OPT_FRAME_INDEX:
+
+#ifdef WAV49
+		result = r->frame_index;
+		if (val) r->frame_index = *val;
+#endif
+		break;
+
+	case GSM_OPT_WAV49:
+
+#ifdef WAV49 
+		result = r->wav_fmt;
+		if (val) r->wav_fmt = !!*val;
+#endif
+		break;
+
+	default:
+		break;
+	}
+	return result;
+}