1 %module javaupm_mic
2 %include "../upm.i"
3 %include "stdint.i"
4 %include "arrays_java.i"
5 
6 %{
7     #include "mic.h"
8 %}
9 
10 %typemap(jni) (uint16_t *buffer, int len) "jshortArray";
11 %typemap(jtype) (uint16_t *buffer, int len) "short[]";
12 %typemap(jstype) (uint16_t *buffer, int len) "short[]";
13 
14 %typemap(javain) (uint16_t *buffer, int len) "$javainput";
15 
16 %typemap(in) (uint16_t *buffer, int len) {
17         $1 = (uint16_t *) JCALL2(GetShortArrayElements, jenv, $input, NULL);
18         $2 = JCALL1(GetArrayLength, jenv, $input);
19 }
20 
21 %typemap(freearg) (uint16_t *buffer, int len) {
22         JCALL3(ReleaseShortArrayElements, jenv, $input, (jshort *)$1, 0);
23 }
24 
25 %typemap(jni) (int numberOfSamples, uint16_t *buffer) "jshortArray";
26 %typemap(jtype) (int numberOfSamples, uint16_t *buffer) "short[]";
27 %typemap(jstype) (int numberOfSamples, uint16_t *buffer) "short[]";
28 
29 %typemap(javain) (int numberOfSamples, uint16_t *buffer) "$javainput";
30 
31 %typemap(in) (int numberOfSamples, uint16_t *buffer) {
32         $2 = (uint16_t *) JCALL2(GetShortArrayElements, jenv, $input, NULL);
33         $1 = JCALL1(GetArrayLength, jenv, $input);
34 }
35 
36 %typemap(freearg) (int numberOfSamples, uint16_t *buffer) {
37         JCALL3(ReleaseShortArrayElements, jenv, $input, (jshort *)$2, 0);
38 }
39 
40 %include "mic.h"
41