mirror of
https://github.com/eclipse/upm.git
synced 2025-07-02 01:41:12 +03:00
java: Changed size_t and unsigned int to int in array declarations. Renamed buf to buffer where necesarry. Moved most Java array typemaps to java_buffer.i. Fixed some String buffers.
Signed-off-by: Petre Eftime <petre.p.eftime@intel.com> Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com> Conflicts: src/upm.i
This commit is contained in:

committed by
Mihai Tudor Panu

parent
ab730038fd
commit
2cab79b4c2
@ -7,33 +7,33 @@
|
||||
#include "mic.h"
|
||||
%}
|
||||
|
||||
%typemap(jni) (uint16_t *buffer, unsigned int len) "jshortArray";
|
||||
%typemap(jtype) (uint16_t *buffer, unsigned int len) "short[]";
|
||||
%typemap(jstype) (uint16_t *buffer, unsigned int len) "short[]";
|
||||
%typemap(jni) (uint16_t *buffer, int len) "jshortArray";
|
||||
%typemap(jtype) (uint16_t *buffer, int len) "short[]";
|
||||
%typemap(jstype) (uint16_t *buffer, int len) "short[]";
|
||||
|
||||
%typemap(javain) (uint16_t *buffer, unsigned int len) "$javainput";
|
||||
%typemap(javain) (uint16_t *buffer, int len) "$javainput";
|
||||
|
||||
%typemap(in) (uint16_t *buffer, unsigned int len) {
|
||||
%typemap(in) (uint16_t *buffer, int len) {
|
||||
$1 = (uint16_t *) JCALL2(GetShortArrayElements, jenv, $input, NULL);
|
||||
$2 = JCALL1(GetArrayLength, jenv, $input);
|
||||
}
|
||||
|
||||
%typemap(freearg) (uint16_t *buffer, unsigned int len) {
|
||||
%typemap(freearg) (uint16_t *buffer, int len) {
|
||||
JCALL3(ReleaseShortArrayElements, jenv, $input, (jshort *)$1, 0);
|
||||
}
|
||||
|
||||
%typemap(jni) (unsigned int numberOfSamples, uint16_t *buffer) "jshortArray";
|
||||
%typemap(jtype) (unsigned int numberOfSamples, uint16_t *buffer) "short[]";
|
||||
%typemap(jstype) (unsigned int numberOfSamples, uint16_t *buffer) "short[]";
|
||||
%typemap(jni) (int numberOfSamples, uint16_t *buffer) "jshortArray";
|
||||
%typemap(jtype) (int numberOfSamples, uint16_t *buffer) "short[]";
|
||||
%typemap(jstype) (int numberOfSamples, uint16_t *buffer) "short[]";
|
||||
|
||||
%typemap(javain) (unsigned int numberOfSamples, uint16_t *buffer) "$javainput";
|
||||
%typemap(javain) (int numberOfSamples, uint16_t *buffer) "$javainput";
|
||||
|
||||
%typemap(in) (unsigned int numberOfSamples, uint16_t *buffer) {
|
||||
%typemap(in) (int numberOfSamples, uint16_t *buffer) {
|
||||
$2 = (uint16_t *) JCALL2(GetShortArrayElements, jenv, $input, NULL);
|
||||
$1 = JCALL1(GetArrayLength, jenv, $input);
|
||||
}
|
||||
|
||||
%typemap(freearg) (unsigned int numberOfSamples, uint16_t *buffer) {
|
||||
%typemap(freearg) (int numberOfSamples, uint16_t *buffer) {
|
||||
JCALL3(ReleaseShortArrayElements, jenv, $input, (jshort *)$2, 0);
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@ Microphone::~Microphone() {
|
||||
}
|
||||
|
||||
int
|
||||
Microphone::getSampledWindow (unsigned int freqMS, unsigned int numberOfSamples,
|
||||
Microphone::getSampledWindow (unsigned int freqMS, int numberOfSamples,
|
||||
uint16_t * buffer) {
|
||||
int sampleIdx = 0;
|
||||
|
||||
@ -72,7 +72,7 @@ Microphone::getSampledWindow (unsigned int freqMS, unsigned int numberOfSamples,
|
||||
|
||||
int
|
||||
Microphone::findThreshold (thresholdContext* ctx, unsigned int threshold,
|
||||
uint16_t * buffer, unsigned int len) {
|
||||
uint16_t * buffer, int len) {
|
||||
long sum = 0;
|
||||
for (unsigned int i = 0; i < len; i++) {
|
||||
sum += buffer[i];
|
||||
|
@ -80,7 +80,7 @@ class Microphone {
|
||||
* @param numberOfSamples Number of sample to sample for this window
|
||||
* @param buffer Buffer with sampled data
|
||||
*/
|
||||
int getSampledWindow (unsigned int freqMS, unsigned int numberOfSamples, uint16_t * buffer);
|
||||
int getSampledWindow (unsigned int freqMS, int numberOfSamples, uint16_t * buffer);
|
||||
|
||||
/**
|
||||
* Given the sampled buffer, this method returns TRUE/FALSE if threshold
|
||||
@ -91,7 +91,7 @@ class Microphone {
|
||||
* @param buffer Buffer with samples
|
||||
* @param len Buffer length
|
||||
*/
|
||||
int findThreshold (thresholdContext* ctx, unsigned int threshold, uint16_t * buffer, unsigned int len);
|
||||
int findThreshold (thresholdContext* ctx, unsigned int threshold, uint16_t * buffer, int len);
|
||||
|
||||
/**
|
||||
*
|
||||
|
Reference in New Issue
Block a user