[automerger] sonivox: fix hang caused by bad meta-event am: ba9ea23466 am: 3983856ec1 am: 59644944e2 am: f3c51f7f1e am: d2901553df am: b0081b7c58 am: 88510ce7be am: ef8ae5940d am: 52fae8ba07

Change-Id: I2a0529ebc6d7cf717958fb543c7066e0ac68dd0a
diff --git a/Android.bp b/Android.bp
new file mode 100644
index 0000000..0f8f3a4
--- /dev/null
+++ b/Android.bp
@@ -0,0 +1 @@
+subdirs = ["arm-wt-22k"]
diff --git a/Android.mk b/Android.mk
deleted file mode 100644
index 6571161..0000000
--- a/Android.mk
+++ /dev/null
@@ -1 +0,0 @@
-include $(all-subdir-makefiles)
diff --git a/arm-wt-22k/Android.bp b/arm-wt-22k/Android.bp
new file mode 100644
index 0000000..5992542
--- /dev/null
+++ b/arm-wt-22k/Android.bp
@@ -0,0 +1,118 @@
+cc_library_shared {
+    name: "libsonivox",
+    srcs: [
+        "lib_src/eas_chorus.c",
+        "lib_src/eas_chorusdata.c",
+        "lib_src/eas_data.c",
+        "lib_src/eas_dlssynth.c",
+        "lib_src/eas_flog.c",
+        "lib_src/eas_ima_tables.c",
+        "lib_src/eas_imaadpcm.c",
+        "lib_src/eas_imelody.c",
+        "lib_src/eas_imelodydata.c",
+        "lib_src/eas_math.c",
+        "lib_src/eas_mdls.c",
+        "lib_src/eas_midi.c",
+        "lib_src/eas_mididata.c",
+        "lib_src/eas_mixbuf.c",
+        "lib_src/eas_mixer.c",
+        "lib_src/eas_ota.c",
+        "lib_src/eas_otadata.c",
+        "lib_src/eas_pan.c",
+        "lib_src/eas_pcm.c",
+        "lib_src/eas_pcmdata.c",
+        "lib_src/eas_public.c",
+        "lib_src/eas_reverb.c",
+        "lib_src/eas_reverbdata.c",
+        "lib_src/eas_rtttl.c",
+        "lib_src/eas_rtttldata.c",
+        "lib_src/eas_smf.c",
+        "lib_src/eas_smfdata.c",
+        "lib_src/eas_voicemgt.c",
+        "lib_src/eas_wtengine.c",
+        "lib_src/eas_wtsynth.c",
+        "lib_src/eas_xmf.c",
+        "lib_src/eas_xmfdata.c",
+        "lib_src/wt_22khz.c",
+        "lib_src/jet.c",
+        "host_src/eas_config.c",
+        "host_src/eas_hostmm.c",
+        "host_src/eas_report.c",
+
+        // not using these modules
+        //"host_src/eas_main.c",
+        //"host_src/eas_wave.c",
+        //"lib_src/eas_wavefile.c",
+        //"lib_src/eas_wavefiledata.c",
+    ],
+
+    cflags: [
+        "-O2",
+        "-DUNIFIED_DEBUG_MESSAGES",
+        "-DEAS_WT_SYNTH",
+        "-D_IMELODY_PARSER",
+        "-D_RTTTL_PARSER",
+        "-D_OTA_PARSER",
+        "-D_XMF_PARSER",
+        "-DNUM_OUTPUT_CHANNELS=2",
+        "-D_SAMPLE_RATE_22050",
+        "-DMAX_SYNTH_VOICES=64",
+        "-D_8_BIT_SAMPLES",
+        "-D_FILTER_ENABLED",
+        "-DDLS_SYNTHESIZER",
+        "-D_REVERB_ENABLED",
+
+        "-Wno-unused-parameter",
+        "-Werror",
+
+        // not using these options
+        // "-D_WAVE_PARSER",
+        // "-D_IMA_DECODER", // (needed for IMA-ADPCM wave files)
+        // "-D_CHORUS_ENABLED",
+    ],
+
+    local_include_dirs: [
+        "host_src",
+        "lib_src",
+    ],
+    export_include_dirs: ["include"],
+
+    shared_libs: [
+        "liblog",
+    ],
+
+    arch: {
+        arm: {
+            instruction_set: "arm",
+
+            srcs: [
+                "lib_src/ARM-E_filter_gnu.s",
+                "lib_src/ARM-E_interpolate_loop_gnu.s",
+                "lib_src/ARM-E_interpolate_noloop_gnu.s",
+                "lib_src/ARM-E_mastergain_gnu.s",
+                "lib_src/ARM-E_voice_gain_gnu.s",
+            ],
+
+            asflags: [
+                // In order to use #include instead of .include
+                "-xassembler-with-cpp",
+
+                "-Wa,--defsym,SAMPLE_RATE_22050=1",
+                "-Wa,--defsym,STEREO_OUTPUT=1",
+                "-Wa,--defsym,FILTER_ENABLED=1",
+                "-Wa,--defsym,SAMPLES_8_BIT=1",
+            ],
+
+            cflags: [
+                "-DNATIVE_EAS_KERNEL",
+            ],
+
+            // .s files not ported for Clang assembler yet.
+            clang_asflags: ["-no-integrated-as"],
+        },
+        arm64: {
+            // .s files not ported for Clang assembler yet.
+            clang_asflags: ["-no-integrated-as"],
+        },
+    },
+}
diff --git a/arm-wt-22k/Android.mk b/arm-wt-22k/Android.mk
deleted file mode 100644
index b9ea9fd..0000000
--- a/arm-wt-22k/Android.mk
+++ /dev/null
@@ -1,106 +0,0 @@
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES = \
-	lib_src/eas_chorus.c \
-	lib_src/eas_chorusdata.c \
-	lib_src/eas_data.c \
-	lib_src/eas_dlssynth.c \
-	lib_src/eas_flog.c \
-	lib_src/eas_ima_tables.c \
-	lib_src/eas_imaadpcm.c \
-	lib_src/eas_imelody.c \
-	lib_src/eas_imelodydata.c \
-	lib_src/eas_math.c \
-	lib_src/eas_mdls.c \
-	lib_src/eas_midi.c \
-	lib_src/eas_mididata.c \
-	lib_src/eas_mixbuf.c \
-	lib_src/eas_mixer.c \
-	lib_src/eas_ota.c \
-	lib_src/eas_otadata.c \
-	lib_src/eas_pan.c \
-	lib_src/eas_pcm.c \
-	lib_src/eas_pcmdata.c \
-	lib_src/eas_public.c \
-	lib_src/eas_reverb.c \
-	lib_src/eas_reverbdata.c \
-	lib_src/eas_rtttl.c \
-	lib_src/eas_rtttldata.c \
-	lib_src/eas_smf.c \
-	lib_src/eas_smfdata.c \
-	lib_src/eas_voicemgt.c \
-	lib_src/eas_wtengine.c \
-	lib_src/eas_wtsynth.c \
-	lib_src/eas_xmf.c \
-	lib_src/eas_xmfdata.c \
-	lib_src/wt_22khz.c \
-	lib_src/jet.c \
-	host_src/eas_config.c \
-	host_src/eas_hostmm.c \
-	host_src/eas_report.c
-
-# not using these modules
-#	host_src/eas_main.c \
-#	host_src/eas_wave.c \
-#	lib_src/eas_wavefile.c \
-#	lib_src/eas_wavefiledata.c \
-
-LOCAL_CFLAGS+= -O2 -D UNIFIED_DEBUG_MESSAGES -D EAS_WT_SYNTH \
-	-D _IMELODY_PARSER -D _RTTTL_PARSER -D _OTA_PARSER \
-	-D _XMF_PARSER -D NUM_OUTPUT_CHANNELS=2 \
-	-D _SAMPLE_RATE_22050 -D MAX_SYNTH_VOICES=64 \
-	-D _8_BIT_SAMPLES -D _FILTER_ENABLED \
-	-D DLS_SYNTHESIZER \
-	-D _REVERB_ENABLED \
-	-Wno-unused-parameter \
-
-# not using these options
-# -D _WAVE_PARSER
-# -D _IMA_DECODER (needed for IMA-ADPCM wave files)
-# -D _CHORUS_ENABLED
-
-LOCAL_C_INCLUDES:= \
-	$(LOCAL_PATH)/host_src \
-	$(LOCAL_PATH)/lib_src
-
-LOCAL_ARM_MODE := arm
-
-LOCAL_MODULE := libsonivox
-
-LOCAL_COPY_HEADERS_TO := libsonivox
-LOCAL_COPY_HEADERS := \
-	host_src/eas.h \
-	host_src/eas_types.h \
-	host_src/eas_reverb.h \
-	host_src/jet.h
-
-LOCAL_SRC_FILES_arm += \
-	lib_src/ARM-E_filter_gnu.s \
-	lib_src/ARM-E_interpolate_loop_gnu.s \
-	lib_src/ARM-E_interpolate_noloop_gnu.s \
-	lib_src/ARM-E_mastergain_gnu.s \
-	lib_src/ARM-E_voice_gain_gnu.s
-
-asm_flags := \
-	-I $(LOCAL_PATH)/lib_src \
-	--defsym SAMPLE_RATE_22050=1 \
-	--defsym STEREO_OUTPUT=1 \
-	--defsym FILTER_ENABLED=1 \
-	--defsym SAMPLES_8_BIT=1
-
-LOCAL_ASFLAGS_arm := \
-	$(foreach f,$(asm_flags),-Wa,"$(f)")
-
-# .s files not ported for Clang assembler yet.
-LOCAL_CLANG_ASFLAGS_arm += -no-integrated-as
-LOCAL_CLANG_ASFLAGS_arm64 += -no-integrated-as
-
-asm_flags :=
-
-LOCAL_CFLAGS_arm += -D NATIVE_EAS_KERNEL
-
-LOCAL_SHARED_LIBRARIES := \
-	libutils libcutils
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/arm-wt-22k/include/libsonivox/eas.h b/arm-wt-22k/include/libsonivox/eas.h
new file mode 120000
index 0000000..c2c44c8
--- /dev/null
+++ b/arm-wt-22k/include/libsonivox/eas.h
@@ -0,0 +1 @@
+../../host_src/eas.h
\ No newline at end of file
diff --git a/arm-wt-22k/include/libsonivox/eas_reverb.h b/arm-wt-22k/include/libsonivox/eas_reverb.h
new file mode 120000
index 0000000..1fb4c96
--- /dev/null
+++ b/arm-wt-22k/include/libsonivox/eas_reverb.h
@@ -0,0 +1 @@
+../../host_src/eas_reverb.h
\ No newline at end of file
diff --git a/arm-wt-22k/include/libsonivox/eas_types.h b/arm-wt-22k/include/libsonivox/eas_types.h
new file mode 120000
index 0000000..e1e9a71
--- /dev/null
+++ b/arm-wt-22k/include/libsonivox/eas_types.h
@@ -0,0 +1 @@
+../../host_src/eas_types.h
\ No newline at end of file
diff --git a/arm-wt-22k/include/libsonivox/jet.h b/arm-wt-22k/include/libsonivox/jet.h
new file mode 120000
index 0000000..db31fed
--- /dev/null
+++ b/arm-wt-22k/include/libsonivox/jet.h
@@ -0,0 +1 @@
+../../host_src/jet.h
\ No newline at end of file
diff --git a/arm-wt-22k/lib_src/ARM-E_filter_gnu.s b/arm-wt-22k/lib_src/ARM-E_filter_gnu.s
index 871cd7d..859d9a4 100644
--- a/arm-wt-22k/lib_src/ARM-E_filter_gnu.s
+++ b/arm-wt-22k/lib_src/ARM-E_filter_gnu.s
@@ -24,7 +24,7 @@
 @	PASSED IN: r1

 @****************************************************************

 

-	.include	"ARM_synth_constants_gnu.inc"

+	#include	"ARM_synth_constants_gnu.inc"

 

 	.arm

 	.text

diff --git a/arm-wt-22k/lib_src/ARM-E_interpolate_loop_gnu.s b/arm-wt-22k/lib_src/ARM-E_interpolate_loop_gnu.s
index 847a7f0..2529e93 100644
--- a/arm-wt-22k/lib_src/ARM-E_interpolate_loop_gnu.s
+++ b/arm-wt-22k/lib_src/ARM-E_interpolate_loop_gnu.s
@@ -25,7 +25,7 @@
 @	PASSED IN: r1

 @****************************************************************

 

-	.include	"ARM_synth_constants_gnu.inc"

+	#include	"ARM_synth_constants_gnu.inc"

 

 	.arm

 	.text

diff --git a/arm-wt-22k/lib_src/ARM-E_interpolate_noloop_gnu.s b/arm-wt-22k/lib_src/ARM-E_interpolate_noloop_gnu.s
index 6343762..55a0ba7 100644
--- a/arm-wt-22k/lib_src/ARM-E_interpolate_noloop_gnu.s
+++ b/arm-wt-22k/lib_src/ARM-E_interpolate_noloop_gnu.s
@@ -25,7 +25,7 @@
 @	PASSED IN: r1

 @****************************************************************

 

-	.include	"ARM_synth_constants_gnu.inc"

+	#include	"ARM_synth_constants_gnu.inc"

 

 	.arm

 	.text

diff --git a/arm-wt-22k/lib_src/ARM-E_mastergain_gnu.s b/arm-wt-22k/lib_src/ARM-E_mastergain_gnu.s
index b4e905b..f443fbb 100644
--- a/arm-wt-22k/lib_src/ARM-E_mastergain_gnu.s
+++ b/arm-wt-22k/lib_src/ARM-E_mastergain_gnu.s
@@ -35,7 +35,7 @@
 @

 @****************************************************************

 

-	.include	"ARM_synth_constants_gnu.inc"

+	#include	"ARM_synth_constants_gnu.inc"

 

 	.arm

 	.text

diff --git a/arm-wt-22k/lib_src/ARM-E_voice_gain_gnu.s b/arm-wt-22k/lib_src/ARM-E_voice_gain_gnu.s
index 4517a3d..6ca28b2 100644
--- a/arm-wt-22k/lib_src/ARM-E_voice_gain_gnu.s
+++ b/arm-wt-22k/lib_src/ARM-E_voice_gain_gnu.s
@@ -28,7 +28,7 @@
 

 

 

-	.include	"ARM_synth_constants_gnu.inc"

+	#include	"ARM_synth_constants_gnu.inc"

 

 	.arm

 	.text

diff --git a/arm-wt-22k/lib_src/eas_mdls.c b/arm-wt-22k/lib_src/eas_mdls.c
index 3ec24a0..0c1c9f6 100644
--- a/arm-wt-22k/lib_src/eas_mdls.c
+++ b/arm-wt-22k/lib_src/eas_mdls.c
@@ -324,6 +324,7 @@
 
 static const S_DLS_ART_VALUES defaultArt =
 {
+    {
     0,              /* not modified */
     -851,           /* Mod LFO frequency: 5 Hz */
     -7973,          /* Mod LFO delay: 10 milliseconds */
@@ -381,6 +382,7 @@
     1000,           /* Default CC91 to reverb send: 100.0% */
     0,              /* Default chorus send: 0.0% */
     1000            /* Default CC93 to chorus send: 100.0% */
+    }
 };
 
 /*------------------------------------
@@ -567,7 +569,7 @@
     }
 
     /* must have a ptbl chunk */
-    if ((ptblSize == 0) || (ptblSize > DLS_MAX_WAVE_COUNT * sizeof(POOLCUE) + sizeof(POOLTABLE)))
+    if ((ptblSize == 0) || (ptblSize > (EAS_I32) (DLS_MAX_WAVE_COUNT * sizeof(POOLCUE) + sizeof(POOLTABLE))))
     {
         { /* dpp: EAS_ReportEx(_EAS_SEVERITY_ERROR, "No ptbl chunk found"); */ }
         return EAS_ERROR_UNRECOGNIZED_FORMAT;
diff --git a/arm-wt-22k/lib_src/eas_pan.h b/arm-wt-22k/lib_src/eas_pan.h
index cb0a90d..7b3cba5 100644
--- a/arm-wt-22k/lib_src/eas_pan.h
+++ b/arm-wt-22k/lib_src/eas_pan.h
@@ -31,7 +31,7 @@
  *----------------------------------------------------------------------------
 */
 
-#ifndef EAS_PAN_H
+#ifndef _EAS_PAN_H
 #define _EAS_PAN_H
 
 #include "eas_types.h"
@@ -62,5 +62,5 @@
 */
 void EAS_CalcPanControl (EAS_INT pan, EAS_I16 *pGainLeft, EAS_I16 *pGainRight);
 
-#endif
+#endif /* #ifndef _EAS_PAN_H */