Merge "sonivox: -Wno-unused-parameter." am: 825ad522d5
am: d3bd739763

* commit 'd3bd739763e90807ca36b264972a6fafeecc6ef3':
  sonivox: -Wno-unused-parameter.
diff --git a/arm-wt-22k/lib_src/eas_mdls.c b/arm-wt-22k/lib_src/eas_mdls.c
index b08e24e..e2cb688 100644
--- a/arm-wt-22k/lib_src/eas_mdls.c
+++ b/arm-wt-22k/lib_src/eas_mdls.c
@@ -683,8 +683,10 @@
     }
 
     /* create the default articulation */
-    Convert_art(&dls, &defaultArt, 0);
-    dls.artCount = 1;
+    if (dls.pDLS) {
+        Convert_art(&dls, &defaultArt, 0);
+        dls.artCount = 1;
+    }
 
     /* parse the lins chunk and load instruments */
     dls.regionCount = dls.instCount = 0;
diff --git a/arm-wt-22k/lib_src/eas_voicemgt.c b/arm-wt-22k/lib_src/eas_voicemgt.c
index ab0b776..1e20e2b 100644
--- a/arm-wt-22k/lib_src/eas_voicemgt.c
+++ b/arm-wt-22k/lib_src/eas_voicemgt.c
@@ -835,7 +835,7 @@
         /* when 2 or more channels have the same MIP setting, they
          * share a common voice pool
          */
-        if (pChannel->mip == currentMIP)
+        if (pChannel->mip == currentMIP && currentPool != -1)
             pChannel->pool = (EAS_U8) currentPool;
 
         /* new voice pool */
diff --git a/arm-wt-22k/lib_src/eas_wtsynth.c b/arm-wt-22k/lib_src/eas_wtsynth.c
index 9257951..9fcda7b 100644
--- a/arm-wt-22k/lib_src/eas_wtsynth.c
+++ b/arm-wt-22k/lib_src/eas_wtsynth.c
@@ -571,6 +571,9 @@
 
     if (intFrame.numSamples < 0) intFrame.numSamples = 0;
 
+    if (intFrame.numSamples > BUFFER_SIZE_IN_MONO_SAMPLES)
+        intFrame.numSamples = BUFFER_SIZE_IN_MONO_SAMPLES;
+
 #ifdef EAS_SPLIT_WT_SYNTH
     if (voiceNum < NUM_PRIMARY_VOICES)
     {
diff --git a/arm-wt-22k/lib_src/eas_xmf.c b/arm-wt-22k/lib_src/eas_xmf.c
index 05b329e..830b6e5 100644
--- a/arm-wt-22k/lib_src/eas_xmf.c
+++ b/arm-wt-22k/lib_src/eas_xmf.c
@@ -584,6 +584,9 @@
     if ((result = EAS_HWFilePos(hwInstData, pXMFData->fileHandle, &offset)) != EAS_SUCCESS)
         return result;
 
+    if (offset - nodeOffset > headerLength)
+        return EAS_FAILURE;
+
     /* skip to node contents */
     if ((result = EAS_HWFileSeek(hwInstData, pXMFData->fileHandle, nodeOffset + headerLength)) != EAS_SUCCESS)
         return result;
diff --git a/arm-wt-22k/lib_src/wt_22khz.c b/arm-wt-22k/lib_src/wt_22khz.c
index 6d2c24c..087b100 100644
--- a/arm-wt-22k/lib_src/wt_22khz.c
+++ b/arm-wt-22k/lib_src/wt_22khz.c
@@ -1389,7 +1389,8 @@
  *----------------------------------------------------------------------------
 */
 
-const EAS_SAMPLE eas_samples[] =
+/* NOTE: this array should have size of at least eas_sampleOffsets[last_element] + eas_sampleLengths[last_element] */
+const EAS_SAMPLE eas_samples[0x00033cbd + 20] =
 {
        0,    0,   -3,   -4,   -6,   -8,  -10,  -12,  -12,  -11,   -8,   -3,    3,    7,   10,   14,
       16,   16,   15,   12,    9,    4,   -4,  -12,  -18,  -21,  -21,  -19,  -18,  -15,  -10,   -3,
@@ -14647,6 +14648,7 @@
      127,  127
 };
 
+/* NOTE: update eas_samples when this array is changed */
 const EAS_U32 eas_sampleLengths[] =
 {
     16820, 16708, 16592, 11754, 10954, 10295, 9922, 7489,
@@ -14670,6 +14672,7 @@
     22, 21, 21, 21, 21, 20
 };
 
+/* NOTE: update eas_samples when this array is changed */
 const EAS_U32 eas_sampleOffsets[] =
 {
     0x00000000, 0x000041b4, 0x000082f8, 0x0000c3c8, 0x0000f1b2, 0x00011c7c, 0x000144b3, 0x00016b75,