Skip to content

Commit

Permalink
Update code
Browse files Browse the repository at this point in the history
  • Loading branch information
billthefarmer committed Apr 2, 2019
1 parent 88555ba commit 1b0f12b
Show file tree
Hide file tree
Showing 14 changed files with 33 additions and 16 deletions.
2 changes: 2 additions & 0 deletions library/src/main/jni/host_src/eas_hostmm.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <limits.h>
#include <sys/mman.h>
#include <errno.h>
#include <signal.h>
#include <pthread.h>
#include <media/MediaPlayerInterface.h>
Expand Down
1 change: 1 addition & 0 deletions library/src/main/jni/lib_src/eas_chorus.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions library/src/main/jni/lib_src/eas_dlssynth.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
3 changes: 3 additions & 0 deletions library/src/main/jni/lib_src/eas_imaadpcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions library/src/main/jni/lib_src/eas_mdls.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
1 change: 1 addition & 0 deletions library/src/main/jni/lib_src/eas_midi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions library/src/main/jni/lib_src/eas_mixer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
5 changes: 5 additions & 0 deletions library/src/main/jni/lib_src/eas_ota.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
*----------------------------------------------------------------------------
*/

#define LOG_TAG "Sonivox"
#include <log/log.h>

#include "eas_data.h"
#include "eas_miditypes.h"
#include "eas_parser.h"
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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--;
Expand Down
1 change: 1 addition & 0 deletions library/src/main/jni/lib_src/eas_pcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
*/

#include "eas_data.h"
#include "eas_report.h"
#include "eas_host.h"
#include "eas_config.h"
#include "eas_parser.h"
Expand Down
1 change: 1 addition & 0 deletions library/src/main/jni/lib_src/eas_reverb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
11 changes: 8 additions & 3 deletions library/src/main/jni/lib_src/eas_smf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}

Expand Down
1 change: 1 addition & 0 deletions library/src/main/jni/lib_src/eas_voicemgt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions library/src/main/jni/lib_src/eas_wtsynth.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@

// includes
#define LOG_TAG "SYNTH"

#include "log/log.h"
#include <cutils/log.h>

#include "eas_data.h"
#include "eas_report.h"
#include "eas_host.h"
#include "eas_math.h"
#include "eas_synth_protos.h"
Expand Down Expand Up @@ -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;
}
}
Expand Down
16 changes: 5 additions & 11 deletions library/src/main/jni/lib_src/eas_xmf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);


Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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 */
Expand Down Expand Up @@ -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 */
Expand Down

0 comments on commit 1b0f12b

Please sign in to comment.