From 1b0f12b82dd83d86e67432bca6698b5ee2d40579 Mon Sep 17 00:00:00 2001 From: Bill Farmer Date: Tue, 2 Apr 2019 13:43:44 +0100 Subject: [PATCH] Update code --- library/src/main/jni/host_src/eas_hostmm.c | 2 ++ library/src/main/jni/lib_src/eas_chorus.c | 1 + library/src/main/jni/lib_src/eas_dlssynth.c | 1 + library/src/main/jni/lib_src/eas_imaadpcm.c | 3 +++ library/src/main/jni/lib_src/eas_mdls.c | 1 + library/src/main/jni/lib_src/eas_midi.c | 1 + library/src/main/jni/lib_src/eas_mixer.c | 1 + library/src/main/jni/lib_src/eas_ota.c | 5 +++++ library/src/main/jni/lib_src/eas_pcm.c | 1 + library/src/main/jni/lib_src/eas_reverb.c | 1 + library/src/main/jni/lib_src/eas_smf.c | 11 ++++++++--- library/src/main/jni/lib_src/eas_voicemgt.c | 1 + library/src/main/jni/lib_src/eas_wtsynth.c | 4 ++-- library/src/main/jni/lib_src/eas_xmf.c | 16 +++++----------- 14 files changed, 33 insertions(+), 16 deletions(-) diff --git a/library/src/main/jni/host_src/eas_hostmm.c b/library/src/main/jni/host_src/eas_hostmm.c index 97548db..f9dcd86 100644 --- a/library/src/main/jni/host_src/eas_hostmm.c +++ b/library/src/main/jni/host_src/eas_hostmm.c @@ -50,7 +50,9 @@ #include #include #include +#include #include +#include #include #include #include diff --git a/library/src/main/jni/lib_src/eas_chorus.c b/library/src/main/jni/lib_src/eas_chorus.c index af1b63a..4a2c8d0 100644 --- a/library/src/main/jni/lib_src/eas_chorus.c +++ b/library/src/main/jni/lib_src/eas_chorus.c @@ -35,6 +35,7 @@ #include "eas_chorus.h" #include "eas_config.h" #include "eas_host.h" +#include "eas_report.h" /* prototypes for effects interface */ static EAS_RESULT ChorusInit (EAS_DATA_HANDLE pEASData, EAS_VOID_PTR *pInstData); diff --git a/library/src/main/jni/lib_src/eas_dlssynth.c b/library/src/main/jni/lib_src/eas_dlssynth.c index 459adb8..8606a29 100644 --- a/library/src/main/jni/lib_src/eas_dlssynth.c +++ b/library/src/main/jni/lib_src/eas_dlssynth.c @@ -29,6 +29,7 @@ // includes #include "eas_data.h" +#include "eas_report.h" #include "eas_host.h" #include "eas_math.h" #include "eas_synth_protos.h" diff --git a/library/src/main/jni/lib_src/eas_imaadpcm.c b/library/src/main/jni/lib_src/eas_imaadpcm.c index e332478..41280b5 100644 --- a/library/src/main/jni/lib_src/eas_imaadpcm.c +++ b/library/src/main/jni/lib_src/eas_imaadpcm.c @@ -29,6 +29,9 @@ #include "eas_data.h" #include "eas_host.h" +#include "eas_pcm.h" +#include "eas_math.h" +#include "eas_report.h" // #define _DEBUG_IMA_ADPCM_LOCATE diff --git a/library/src/main/jni/lib_src/eas_mdls.c b/library/src/main/jni/lib_src/eas_mdls.c index 8c8a22e..0c1c9f6 100644 --- a/library/src/main/jni/lib_src/eas_mdls.c +++ b/library/src/main/jni/lib_src/eas_mdls.c @@ -122,6 +122,7 @@ #include "eas_math.h" #include "dls.h" #include "dls2.h" +#include "eas_report.h" //2 we should replace log10() function with fixed point routine in ConvertSampleRate() /* lint is choking on the ARM math.h file, so we declare the log10 function here */ diff --git a/library/src/main/jni/lib_src/eas_midi.c b/library/src/main/jni/lib_src/eas_midi.c index 017dfc4..8cb043a 100644 --- a/library/src/main/jni/lib_src/eas_midi.c +++ b/library/src/main/jni/lib_src/eas_midi.c @@ -29,6 +29,7 @@ */ #include "eas_data.h" +#include "eas_report.h" #include "eas_miditypes.h" #include "eas_midi.h" #include "eas_vm_protos.h" diff --git a/library/src/main/jni/lib_src/eas_mixer.c b/library/src/main/jni/lib_src/eas_mixer.c index 4018346..0a839a8 100644 --- a/library/src/main/jni/lib_src/eas_mixer.c +++ b/library/src/main/jni/lib_src/eas_mixer.c @@ -40,6 +40,7 @@ #include "eas_math.h" #include "eas_mixer.h" #include "eas_config.h" +#include "eas_report.h" #ifdef _MAXIMIZER_ENABLED EAS_I32 MaximizerProcess (EAS_VOID_PTR pInstData, EAS_I32 *pSrc, EAS_I32 *pDst, EAS_I32 numSamples); diff --git a/library/src/main/jni/lib_src/eas_ota.c b/library/src/main/jni/lib_src/eas_ota.c index 5bc9062..413d1d3 100644 --- a/library/src/main/jni/lib_src/eas_ota.c +++ b/library/src/main/jni/lib_src/eas_ota.c @@ -27,6 +27,9 @@ *---------------------------------------------------------------------------- */ +#define LOG_TAG "Sonivox" +#include + #include "eas_data.h" #include "eas_miditypes.h" #include "eas_parser.h" @@ -211,6 +214,7 @@ static EAS_RESULT OTA_CheckFileType (S_EAS_DATA *pEASData, EAS_FILE_HANDLE fileH pData->fileOffset = offset; pData->state = EAS_STATE_OPEN; *ppHandle = pData; + ALOGD("%s() OTA file recognized", __func__); break; } @@ -360,6 +364,7 @@ static EAS_RESULT OTA_Event (S_EAS_DATA *pEASData, EAS_VOID_PTR pInstData, EAS_I /* check for loop - don't do infinite loops when locating */ if (pData->loopCount && ((parserMode == eParserModePlay) || (pData->loopCount != OTA_INFINITE_LOOP))) { + ALOGV("%s() loop backwards, loopCount = %d", __func__, pData->loopCount); /* if not infinite loop, decrement loop count */ if (pData->loopCount != OTA_INFINITE_LOOP) pData->loopCount--; diff --git a/library/src/main/jni/lib_src/eas_pcm.c b/library/src/main/jni/lib_src/eas_pcm.c index 2f1b425..ff3f6f9 100644 --- a/library/src/main/jni/lib_src/eas_pcm.c +++ b/library/src/main/jni/lib_src/eas_pcm.c @@ -28,6 +28,7 @@ */ #include "eas_data.h" +#include "eas_report.h" #include "eas_host.h" #include "eas_config.h" #include "eas_parser.h" diff --git a/library/src/main/jni/lib_src/eas_reverb.c b/library/src/main/jni/lib_src/eas_reverb.c index 21b137a..cd5befe 100644 --- a/library/src/main/jni/lib_src/eas_reverb.c +++ b/library/src/main/jni/lib_src/eas_reverb.c @@ -40,6 +40,7 @@ #include "eas_reverb.h" #include "eas_config.h" #include "eas_host.h" +#include "eas_report.h" /* prototypes for effects interface */ static EAS_RESULT ReverbInit (EAS_DATA_HANDLE pEASData, EAS_VOID_PTR *pInstData); diff --git a/library/src/main/jni/lib_src/eas_smf.c b/library/src/main/jni/lib_src/eas_smf.c index fb7aac9..72e89c3 100644 --- a/library/src/main/jni/lib_src/eas_smf.c +++ b/library/src/main/jni/lib_src/eas_smf.c @@ -29,11 +29,13 @@ *---------------------------------------------------------------------------- */ +#define LOG_TAG "Sonivox" #include "log/log.h" #include "eas_data.h" #include "eas_miditypes.h" #include "eas_parser.h" +#include "eas_report.h" #include "eas_host.h" #include "eas_midi.h" #include "eas_config.h" @@ -127,7 +129,8 @@ EAS_RESULT SMF_CheckFileType (S_EAS_DATA *pEASData, EAS_FILE_HANDLE fileHandle, if ((result = EAS_HWReadFile(pEASData->hwInstData, fileHandle, header, sizeof(header), &count)) != EAS_SUCCESS) return result; - /* check for 'MTrk' - return if no match */ + /* check for 'MThd' - If no match then return SUCCESS with NULL handle + * to indicate not an SMF file. */ if ((header[0] != 'M') || (header[1] != 'T') || (header[2] != 'h') || (header[3] != 'd')) return EAS_SUCCESS; } @@ -838,13 +841,15 @@ static EAS_RESULT SMF_ParseMetaEvent (S_EAS_DATA *pEASData, S_SMF_DATA *pSMFData /* prevent a large unsigned length from being treated as a negative length */ if ((EAS_I32) len < 0) { /* note that EAS_I32 is a long, which can be 64-bits on some computers */ - ALOGE("b/68953854 SMF_ParseMetaEvent, negative len = %ld\n", (EAS_I32) len); + ALOGE("%s() negative len = %ld", __func__, (long) len); + android_errorWriteLog(0x534e4554, "68953854"); return EAS_ERROR_FILE_FORMAT; } /* prevent numeric overflow caused by a very large len, assume pos > 0 */ const EAS_I32 EAS_I32_MAX = 0x7FFFFFFF; if ((EAS_I32) len > (EAS_I32_MAX - pos)) { - ALOGE("b/68953854 SMF_ParseMetaEvent, too large len = %ld\n", (EAS_I32) len); + ALOGE("%s() too large len = %ld", __func__, (long) len); + android_errorWriteLog(0x534e4554, "68953854"); return EAS_ERROR_FILE_FORMAT; } diff --git a/library/src/main/jni/lib_src/eas_voicemgt.c b/library/src/main/jni/lib_src/eas_voicemgt.c index b119b5a..1e20e2b 100644 --- a/library/src/main/jni/lib_src/eas_voicemgt.c +++ b/library/src/main/jni/lib_src/eas_voicemgt.c @@ -31,6 +31,7 @@ #include "eas.h" #include "eas_data.h" #include "eas_config.h" +#include "eas_report.h" #include "eas_midictrl.h" #include "eas_host.h" #include "eas_synth_protos.h" diff --git a/library/src/main/jni/lib_src/eas_wtsynth.c b/library/src/main/jni/lib_src/eas_wtsynth.c index 5a3a4a8..8488fe2 100644 --- a/library/src/main/jni/lib_src/eas_wtsynth.c +++ b/library/src/main/jni/lib_src/eas_wtsynth.c @@ -29,11 +29,11 @@ // includes #define LOG_TAG "SYNTH" - #include "log/log.h" #include #include "eas_data.h" +#include "eas_report.h" #include "eas_host.h" #include "eas_math.h" #include "eas_synth_protos.h" @@ -562,7 +562,7 @@ static EAS_BOOL WT_UpdateVoice (S_VOICE_MGR *pVoiceMgr, S_SYNTH *pSynth, S_SYNTH if (temp != 0) { temp = temp << NUM_PHASE_FRAC_BITS; if (intFrame.frame.phaseIncrement > temp) { - ALOGW("%p phaseIncrement=%d", pWTVoice, (int) intFrame.frame.phaseIncrement); + ALOGW("%p phaseIncrement=%d", pWTVoice, (int)intFrame.frame.phaseIncrement); intFrame.frame.phaseIncrement %= temp; } } diff --git a/library/src/main/jni/lib_src/eas_xmf.c b/library/src/main/jni/lib_src/eas_xmf.c index 0586fcb..07ee8f7 100644 --- a/library/src/main/jni/lib_src/eas_xmf.c +++ b/library/src/main/jni/lib_src/eas_xmf.c @@ -67,10 +67,7 @@ static EAS_RESULT XMF_Resume (S_EAS_DATA *pEASData, EAS_VOID_PTR pInstData); static EAS_RESULT XMF_SetData (S_EAS_DATA *pEASData, EAS_VOID_PTR pInstData, EAS_I32 param, EAS_I32 value); static EAS_RESULT XMF_GetData (S_EAS_DATA *pEASData, EAS_VOID_PTR pInstData, EAS_I32 param, EAS_I32 *pValue); static EAS_RESULT XMF_FindFileContents (EAS_HW_DATA_HANDLE hwInstData, S_XMF_DATA *pXMFData); - -static EAS_RESULT -XMF_ReadNode(EAS_HW_DATA_HANDLE hwInstData, S_XMF_DATA *pXMFData, EAS_I32 nodeOffset, - EAS_I32 *pLength, EAS_I32 depth); +static EAS_RESULT XMF_ReadNode (EAS_HW_DATA_HANDLE hwInstData, S_XMF_DATA *pXMFData, EAS_I32 nodeOffset, EAS_I32 *pLength, EAS_I32 depth); static EAS_RESULT XMF_ReadVLQ (EAS_HW_DATA_HANDLE hwInstData, EAS_FILE_HANDLE fileHandle, EAS_I32 *value); @@ -507,7 +504,7 @@ static EAS_RESULT XMF_FindFileContents (EAS_HW_DATA_HANDLE hwInstData, S_XMF_DAT EAS_RESULT result; EAS_I32 value; EAS_I32 length; - EAS_I32 node_depth = 0; + EAS_I32 node_depth = 0 ; /* initialize offsets */ pXMFData->dlsOffset = pXMFData->midiOffset = 0; @@ -556,9 +553,7 @@ static EAS_RESULT XMF_FindFileContents (EAS_HW_DATA_HANDLE hwInstData, S_XMF_DAT * *---------------------------------------------------------------------------- */ -static EAS_RESULT -XMF_ReadNode(EAS_HW_DATA_HANDLE hwInstData, S_XMF_DATA *pXMFData, EAS_I32 nodeOffset, - EAS_I32 *pLength, EAS_I32 depth) +static EAS_RESULT XMF_ReadNode (EAS_HW_DATA_HANDLE hwInstData, S_XMF_DATA *pXMFData, EAS_I32 nodeOffset, EAS_I32 *pLength, EAS_I32 depth) { EAS_RESULT result; EAS_I32 refType; @@ -569,7 +564,7 @@ XMF_ReadNode(EAS_HW_DATA_HANDLE hwInstData, S_XMF_DATA *pXMFData, EAS_I32 nodeOf EAS_U32 chunkType; /* check the depth of current node*/ - if (depth > 100) + if ( depth > 100 ) return EAS_ERROR_FILE_FORMAT; /* seek to start of node */ @@ -666,8 +661,7 @@ XMF_ReadNode(EAS_HW_DATA_HANDLE hwInstData, S_XMF_DATA *pXMFData, EAS_I32 nodeOf return EAS_ERROR_FILE_FORMAT; } - if ((result = XMF_ReadNode(hwInstData, pXMFData, offset, &length, depth + 1)) != - EAS_SUCCESS) + if ((result = XMF_ReadNode(hwInstData, pXMFData, offset, &length, depth+1)) != EAS_SUCCESS) return result; /* seek to start of next item */