diff options
-rw-r--r-- | src/main/java/com/morlunk/jumble/audio/AudioInput.java | 2 | ||||
-rw-r--r-- | src/main/java/com/morlunk/jumble/audio/AudioOutputSpeech.java | 31 | ||||
-rw-r--r-- | src/main/java/com/morlunk/jumble/audio/javacpp/CELT11.java | 4 | ||||
-rw-r--r-- | src/main/java/com/morlunk/jumble/audio/javacpp/CELT7.java | 4 | ||||
-rw-r--r-- | src/main/java/com/morlunk/jumble/audio/javacpp/Opus.java | 6 | ||||
-rw-r--r-- | src/main/jni/celt11.cpp | 308 | ||||
-rw-r--r-- | src/main/jni/celt7.cpp | 308 | ||||
-rw-r--r-- | src/main/jni/opus.cpp | 278 | ||||
-rw-r--r-- | src/main/jni/speex.cpp | 478 | ||||
-rwxr-xr-x | src/main/libs/armeabi/libcelt11.so | bin | 156912 -> 156912 bytes | |||
-rwxr-xr-x | src/main/libs/armeabi/libcelt7.so | bin | 148720 -> 148720 bytes | |||
-rwxr-xr-x | src/main/libs/armeabi/libopus.so | bin | 292080 -> 292080 bytes | |||
-rwxr-xr-x | src/main/libs/armeabi/libspeex.so | bin | 211604 -> 211604 bytes |
13 files changed, 700 insertions, 719 deletions
diff --git a/src/main/java/com/morlunk/jumble/audio/AudioInput.java b/src/main/java/com/morlunk/jumble/audio/AudioInput.java index 8991f6d..5c55892 100644 --- a/src/main/java/com/morlunk/jumble/audio/AudioInput.java +++ b/src/main/java/com/morlunk/jumble/audio/AudioInput.java @@ -58,8 +58,6 @@ public class AudioInput extends ProtocolHandler implements Runnable { public void onTalkStateChanged(boolean talking); - // Debug methods - /** * Called after a frame is passed into the speex preprocessor. * @param prob The probability of speech, from 0 to 1. diff --git a/src/main/java/com/morlunk/jumble/audio/AudioOutputSpeech.java b/src/main/java/com/morlunk/jumble/audio/AudioOutputSpeech.java index e98daf5..95f086e 100644 --- a/src/main/java/com/morlunk/jumble/audio/AudioOutputSpeech.java +++ b/src/main/java/com/morlunk/jumble/audio/AudioOutputSpeech.java @@ -29,6 +29,7 @@ import com.morlunk.jumble.model.User; import com.morlunk.jumble.net.JumbleUDPMessageType; import com.morlunk.jumble.net.PacketDataStream; +import java.util.Arrays; import java.util.Queue; import java.util.concurrent.ConcurrentLinkedQueue; @@ -54,7 +55,7 @@ public class AudioOutputSpeech { private float[] mBuffer; private float[] mFadeOut; private float[] mFadeIn; - private Queue<BytePointer> mFrames = new ConcurrentLinkedQueue<BytePointer>(); + private Queue<byte[]> mFrames = new ConcurrentLinkedQueue<byte[]>(); private int mMissCount = 0; private float mAverageAvailable = 0; private boolean mHasTerminator = false; @@ -151,8 +152,7 @@ public class AudioOutputSpeech { if(mBufferFilled >= num) return mLastAlive; - FloatPointer out = new FloatPointer(mAudioBufferSize); - out.fill(0); + float[] out = new float[mAudioBufferSize]; boolean nextAlive = mLastAlive; while(mBufferFilled < num) { @@ -160,7 +160,7 @@ public class AudioOutputSpeech { resizeBuffer(mBufferFilled + mAudioBufferSize); if(!mLastAlive) - out.fill(0); + Arrays.fill(out, 0); else { IntPointer avail = new IntPointer(1); avail.put(0); @@ -207,14 +207,14 @@ public class AudioOutputSpeech { int size = (int) (header & ((1 << 13) - 1)); mHasTerminator = (header & (1 << 13)) > 0; - BytePointer audioData = new BytePointer(pds.dataBlock(size)); + byte[] audioData = pds.dataBlock(size); mFrames.add(audioData); } else { int header; do { header = pds.next() & 0xFF; if(header > 0) - mFrames.add(new BytePointer(pds.dataBlock(header & 0x7f))); + mFrames.add(pds.dataBlock(header & 0x7f)); else mHasTerminator = true; } while ((header & 0x80) > 0 && pds.isValid()); @@ -238,23 +238,23 @@ public class AudioOutputSpeech { } if(!mFrames.isEmpty()) { - BytePointer data = mFrames.poll(); + byte[] data = mFrames.poll(); if(mCodec == JumbleUDPMessageType.UDPVoiceCELTAlpha) { CELT7.celt_decode_float(mCELTAlphaDecoder, data, - data.capacity(), + data.length, out); } else if(mCodec == JumbleUDPMessageType.UDPVoiceCELTBeta) { CELT11.celt_decode_float(mCELTBetaDecoder, data, - data.capacity(), + data.length, out, Audio.FRAME_SIZE); } else if(mCodec == JumbleUDPMessageType.UDPVoiceOpus) { decodedSamples = Opus.opus_decode_float(mOpusDecoder, data, - data.capacity(), + data.length, out, mAudioBufferSize, 0); @@ -266,12 +266,9 @@ public class AudioOutputSpeech { // Speex.speex_decode(mSpeexDecoder, mSpeexBits, out); // } for(int i = 0; i < Audio.FRAME_SIZE; i++) - out.put(i, out.get(i) * (1.0f / 32767.f)); + out[i] *= (1.0f / 32767.f); } - data.deallocate(); - - if(mFrames.isEmpty()) synchronized (mJitterBuffer) { mJitterBuffer.updateDelay(null, new IntPointer(1)); @@ -295,11 +292,11 @@ public class AudioOutputSpeech { if (!nextAlive) { for (int i = 0; i < Audio.FRAME_SIZE; i++) { - out.put(i, out.get(i) * mFadeOut[i]); + out[i] *= mFadeOut[i]; } } else if (ts == 0) { for (int i = 0; i < Audio.FRAME_SIZE; i++) { - out.put(i, out.get(i) * mFadeIn[i]); + out[i] *= mFadeIn[i]; } } @@ -309,7 +306,7 @@ public class AudioOutputSpeech { } } - out.get(mBuffer, mBufferFilled, decodedSamples); + System.arraycopy(out, 0, mBuffer, mBufferFilled, decodedSamples); mBufferFilled += decodedSamples; } diff --git a/src/main/java/com/morlunk/jumble/audio/javacpp/CELT11.java b/src/main/java/com/morlunk/jumble/audio/javacpp/CELT11.java index 66dd219..f2c7cf7 100644 --- a/src/main/java/com/morlunk/jumble/audio/javacpp/CELT11.java +++ b/src/main/java/com/morlunk/jumble/audio/javacpp/CELT11.java @@ -43,8 +43,8 @@ public class CELT11 { public static native void celt_mode_destroy(@Cast("CELTMode*") Pointer mode); public static native @NoDeallocator Pointer celt_decoder_create(int sampleRate, int channels, IntPointer error); - public static native int celt_decode(@Cast("CELTDecoder*") Pointer st, @Cast("const unsigned char*") BytePointer data, int len, ShortPointer pcm, int frameSize); - public static native int celt_decode_float(@Cast("CELTDecoder*") Pointer st, @Cast("const unsigned char*") BytePointer data, int len, FloatPointer pcm, int frameSize); + public static native int celt_decode(@Cast("CELTDecoder*") Pointer st, @Cast("const unsigned char*") byte[] data, int len, short[] pcm, int frameSize); + public static native int celt_decode_float(@Cast("CELTDecoder*") Pointer st, @Cast("const unsigned char*") byte[] data, int len, float[] pcm, int frameSize); public static native int celt_decoder_ctl(@Cast("CELTDecoder*") Pointer st, int request, Pointer val); public static native void celt_decoder_destroy(@Cast("CELTDecoder*") Pointer st); diff --git a/src/main/java/com/morlunk/jumble/audio/javacpp/CELT7.java b/src/main/java/com/morlunk/jumble/audio/javacpp/CELT7.java index dd5b737..e180db4 100644 --- a/src/main/java/com/morlunk/jumble/audio/javacpp/CELT7.java +++ b/src/main/java/com/morlunk/jumble/audio/javacpp/CELT7.java @@ -43,8 +43,8 @@ public class CELT7 { public static native void celt_mode_destroy(@Cast("CELTMode*") Pointer mode); public static native @NoDeallocator Pointer celt_decoder_create(@Cast("CELTMode*") Pointer mode, int channels, IntPointer error); - public static native int celt_decode(@Cast("CELTDecoder*") Pointer st, @Cast("const unsigned char*") BytePointer data, int len, ShortPointer pcm); - public static native int celt_decode_float(@Cast("CELTDecoder*") Pointer st, @Cast("const unsigned char*") BytePointer data, int len, FloatPointer pcm); + public static native int celt_decode(@Cast("CELTDecoder*") Pointer st, @Cast("const unsigned char*") byte[] data, int len, short[] pcm); + public static native int celt_decode_float(@Cast("CELTDecoder*") Pointer st, @Cast("const unsigned char*") byte[] data, int len, float[] pcm); public static native int celt_decoder_ctl(@Cast("CELTDecoder*") Pointer st, int request, Pointer val); public static native void celt_decoder_destroy(@Cast("CELTDecoder*") Pointer st); diff --git a/src/main/java/com/morlunk/jumble/audio/javacpp/Opus.java b/src/main/java/com/morlunk/jumble/audio/javacpp/Opus.java index 962a2f5..df06fb8 100644 --- a/src/main/java/com/morlunk/jumble/audio/javacpp/Opus.java +++ b/src/main/java/com/morlunk/jumble/audio/javacpp/Opus.java @@ -46,8 +46,8 @@ public class Opus { public static native int opus_decoder_get_size(int channels); public static native @NoDeallocator Pointer opus_decoder_create(int fs, int channels, IntPointer error); public static native int opus_decoder_init(@Cast("OpusDecoder*") Pointer st, int fs, int channels); - public static native int opus_decode(@Cast("OpusDecoder*") Pointer st, @Cast("const unsigned char*") BytePointer data, int len, ShortPointer out, int frameSize, int decodeFec); - public static native int opus_decode_float(@Cast("OpusDecoder*") Pointer st, @Cast("const unsigned char*") BytePointer data, int len, FloatPointer out, int frameSize, int decodeFec); + public static native int opus_decode(@Cast("OpusDecoder*") Pointer st, @Cast("const unsigned char*") byte[] data, int len, short[] out, int frameSize, int decodeFec); + public static native int opus_decode_float(@Cast("OpusDecoder*") Pointer st, @Cast("const unsigned char*") byte[] data, int len, float[] out, int frameSize, int decodeFec); //public static native int opus_decoder_ctl(@Cast("OpusDecoder*") Pointer st, int request); public static native void opus_decoder_destroy(@Cast("OpusDecoder*") Pointer st); //public static native int opus_packet_parse(@Cast("const unsigned char*") BytePointer data, int len, ... @@ -62,7 +62,7 @@ public class Opus { public static native @NoDeallocator Pointer opus_encoder_create(int fs, int channels, int application, IntPointer error); public static native int opus_encoder_init(@Cast("OpusEncoder*") Pointer st, int fs, int channels, int application); public static native int opus_encode(@Cast("OpusEncoder*") Pointer st, @Cast("const short*") short[] pcm, int frameSize, @Cast("unsigned char*") byte[] data, int maxDataBytes); - public static native int opus_encode_float(@Cast("OpusEncoder*") Pointer st, @Cast("const float*") FloatPointer pcm, int frameSize, @Cast("unsigned char*") BytePointer data, int maxDataBytes); + public static native int opus_encode_float(@Cast("OpusEncoder*") Pointer st, @Cast("const float*") float[] pcm, int frameSize, @Cast("unsigned char*") byte[] data, int maxDataBytes); public static native void opus_encoder_destroy(@Cast("OpusEncoder*") Pointer st); public static native int opus_encoder_ctl(@Cast("OpusEncoder*") Pointer st, int request, Pointer value); } diff --git a/src/main/jni/celt11.cpp b/src/main/jni/celt11.cpp index 506efda..77fcc22 100644 --- a/src/main/jni/celt11.cpp +++ b/src/main/jni/celt11.cpp @@ -274,14 +274,6 @@ JNIEXPORT void JNICALL Java_com_googlecode_javacpp_Pointer_00024NativeDeallocato -JNIEXPORT void JNICALL Java_com_googlecode_javacpp_Pointer_allocate(JNIEnv* env, jobject obj, jobject arg0) { - char* ptr0 = arg0 == NULL ? NULL : (char*)env->GetDirectBufferAddress(arg0); - void* rptr = ptr0; - jint rcapacity = 1; - env->SetLongField(obj, JavaCPP_addressFID, ptr_to_jlong(rptr)); - env->SetIntField(obj, JavaCPP_limitFID, rcapacity); - env->SetIntField(obj, JavaCPP_capacityFID, rcapacity); -} JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_Pointer_asDirectBuffer(JNIEnv* env, jobject obj) { char* ptr = (char*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); if (ptr == NULL) { @@ -383,8 +375,28 @@ JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_Pointer_memset(JNIEnv* env } return rarg; } +JNIEXPORT void JNICALL Java_com_googlecode_javacpp_Pointer_allocate(JNIEnv* env, jobject obj, jobject arg0) { + char* ptr0 = arg0 == NULL ? NULL : (char*)env->GetDirectBufferAddress(arg0); + void* rptr = ptr0; + jint rcapacity = 1; + env->SetLongField(obj, JavaCPP_addressFID, ptr_to_jlong(rptr)); + env->SetIntField(obj, JavaCPP_limitFID, rcapacity); + env->SetIntField(obj, JavaCPP_capacityFID, rcapacity); +} -JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_BytePointer_get___3BII(JNIEnv* env, jobject obj, jbyteArray arg0, jint arg1, jint arg2) { +JNIEXPORT void JNICALL Java_com_googlecode_javacpp_BytePointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { + if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 3))) { + return; + } + signed char* rptr = new (std::nothrow) signed char[arg0]; + jint rcapacity = arg0; + jvalue args[3]; + args[0].j = ptr_to_jlong(rptr); + args[1].i = rcapacity; + args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_BytePointer_deallocateArray); + env->CallNonvirtualVoidMethodA(obj, JavaCPP_getClass(env, 1), JavaCPP_initMID, args); +} +JNIEXPORT jbyte JNICALL Java_com_googlecode_javacpp_BytePointer_get__I(JNIEnv* env, jobject obj, jint arg0) { signed char* ptr = (signed char*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); if (ptr == NULL) { env->ThrowNew(JavaCPP_getClass(env, 2), "This pointer address is NULL."); @@ -392,13 +404,12 @@ JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_BytePointer_get___3BII(JNI } jint position = env->GetIntField(obj, JavaCPP_positionFID); ptr += position; - signed char* ptr0 = arg0 == NULL ? NULL : (jbyte*)env->GetPrimitiveArrayCritical(arg0, NULL); - jobject rarg = obj; - memcpy(ptr0 + arg1, ptr, arg2 * sizeof(*ptr0)); - if (arg0 != NULL) env->ReleasePrimitiveArrayCritical(arg0, ptr0, 0); + jbyte rarg = 0; + signed char rvalue = ptr[arg0]; + rarg = (jbyte)rvalue; return rarg; } -JNIEXPORT jbyte JNICALL Java_com_googlecode_javacpp_BytePointer_get__I(JNIEnv* env, jobject obj, jint arg0) { +JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_BytePointer_get___3BII(JNIEnv* env, jobject obj, jbyteArray arg0, jint arg1, jint arg2) { signed char* ptr = (signed char*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); if (ptr == NULL) { env->ThrowNew(JavaCPP_getClass(env, 2), "This pointer address is NULL."); @@ -406,9 +417,10 @@ JNIEXPORT jbyte JNICALL Java_com_googlecode_javacpp_BytePointer_get__I(JNIEnv* e } jint position = env->GetIntField(obj, JavaCPP_positionFID); ptr += position; - jbyte rarg = 0; - signed char rvalue = ptr[arg0]; - rarg = (jbyte)rvalue; + signed char* ptr0 = arg0 == NULL ? NULL : (jbyte*)env->GetPrimitiveArrayCritical(arg0, NULL); + jobject rarg = obj; + memcpy(ptr0 + arg1, ptr, arg2 * sizeof(*ptr0)); + if (arg0 != NULL) env->ReleasePrimitiveArrayCritical(arg0, ptr0, 0); return rarg; } JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_BytePointer_put__IB(JNIEnv* env, jobject obj, jint arg0, jbyte arg1) { @@ -437,19 +449,19 @@ JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_BytePointer_put___3BII(JNI if (arg0 != NULL) env->ReleasePrimitiveArrayCritical(arg0, ptr0, 0); return rarg; } -JNIEXPORT void JNICALL Java_com_googlecode_javacpp_BytePointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { - if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 3))) { + +JNIEXPORT void JNICALL Java_com_googlecode_javacpp_ShortPointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { + if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 4))) { return; } - signed char* rptr = new (std::nothrow) signed char[arg0]; + short* rptr = new (std::nothrow) short[arg0]; jint rcapacity = arg0; jvalue args[3]; args[0].j = ptr_to_jlong(rptr); args[1].i = rcapacity; - args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_BytePointer_deallocateArray); + args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_ShortPointer_deallocateArray); env->CallNonvirtualVoidMethodA(obj, JavaCPP_getClass(env, 1), JavaCPP_initMID, args); } - JNIEXPORT jshort JNICALL Java_com_googlecode_javacpp_ShortPointer_get__I(JNIEnv* env, jobject obj, jint arg0) { short* ptr = (short*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); if (ptr == NULL) { @@ -477,7 +489,7 @@ JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_ShortPointer_get___3SII(JN if (arg0 != NULL) env->ReleasePrimitiveArrayCritical(arg0, ptr0, 0); return rarg; } -JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_ShortPointer_put__IS(JNIEnv* env, jobject obj, jint arg0, jshort arg1) { +JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_ShortPointer_put___3SII(JNIEnv* env, jobject obj, jshortArray arg0, jint arg1, jint arg2) { short* ptr = (short*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); if (ptr == NULL) { env->ThrowNew(JavaCPP_getClass(env, 2), "This pointer address is NULL."); @@ -485,11 +497,13 @@ JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_ShortPointer_put__IS(JNIEn } jint position = env->GetIntField(obj, JavaCPP_positionFID); ptr += position; + short* ptr0 = arg0 == NULL ? NULL : (jshort*)env->GetPrimitiveArrayCritical(arg0, NULL); jobject rarg = obj; - ptr[arg0] = arg1; + memcpy(ptr, ptr0 + arg1, arg2 * sizeof(*ptr0)); + if (arg0 != NULL) env->ReleasePrimitiveArrayCritical(arg0, ptr0, 0); return rarg; } -JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_ShortPointer_put___3SII(JNIEnv* env, jobject obj, jshortArray arg0, jint arg1, jint arg2) { +JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_ShortPointer_put__IS(JNIEnv* env, jobject obj, jint arg0, jshort arg1) { short* ptr = (short*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); if (ptr == NULL) { env->ThrowNew(JavaCPP_getClass(env, 2), "This pointer address is NULL."); @@ -497,25 +511,23 @@ JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_ShortPointer_put___3SII(JN } jint position = env->GetIntField(obj, JavaCPP_positionFID); ptr += position; - short* ptr0 = arg0 == NULL ? NULL : (jshort*)env->GetPrimitiveArrayCritical(arg0, NULL); jobject rarg = obj; - memcpy(ptr, ptr0 + arg1, arg2 * sizeof(*ptr0)); - if (arg0 != NULL) env->ReleasePrimitiveArrayCritical(arg0, ptr0, 0); + ptr[arg0] = arg1; return rarg; } -JNIEXPORT void JNICALL Java_com_googlecode_javacpp_ShortPointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { - if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 4))) { + +JNIEXPORT void JNICALL Java_com_googlecode_javacpp_IntPointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { + if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 5))) { return; } - short* rptr = new (std::nothrow) short[arg0]; + int* rptr = new (std::nothrow) int[arg0]; jint rcapacity = arg0; jvalue args[3]; args[0].j = ptr_to_jlong(rptr); args[1].i = rcapacity; - args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_ShortPointer_deallocateArray); + args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_IntPointer_deallocateArray); env->CallNonvirtualVoidMethodA(obj, JavaCPP_getClass(env, 1), JavaCPP_initMID, args); } - JNIEXPORT jint JNICALL Java_com_googlecode_javacpp_IntPointer_get__I(JNIEnv* env, jobject obj, jint arg0) { int* ptr = (int*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); if (ptr == NULL) { @@ -569,19 +581,19 @@ JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_IntPointer_put__II(JNIEnv* ptr[arg0] = arg1; return rarg; } -JNIEXPORT void JNICALL Java_com_googlecode_javacpp_IntPointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { - if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 5))) { + +JNIEXPORT void JNICALL Java_com_googlecode_javacpp_LongPointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { + if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 6))) { return; } - int* rptr = new (std::nothrow) int[arg0]; + jlong* rptr = new (std::nothrow) jlong[arg0]; jint rcapacity = arg0; jvalue args[3]; args[0].j = ptr_to_jlong(rptr); args[1].i = rcapacity; - args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_IntPointer_deallocateArray); + args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_LongPointer_deallocateArray); env->CallNonvirtualVoidMethodA(obj, JavaCPP_getClass(env, 1), JavaCPP_initMID, args); } - JNIEXPORT jlong JNICALL Java_com_googlecode_javacpp_LongPointer_get__I(JNIEnv* env, jobject obj, jint arg0) { jlong* ptr = (jlong*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); if (ptr == NULL) { @@ -609,7 +621,7 @@ JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_LongPointer_get___3JII(JNI if (arg0 != NULL) env->ReleasePrimitiveArrayCritical(arg0, ptr0, 0); return rarg; } -JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_LongPointer_put__IJ(JNIEnv* env, jobject obj, jint arg0, jlong arg1) { +JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_LongPointer_put___3JII(JNIEnv* env, jobject obj, jlongArray arg0, jint arg1, jint arg2) { jlong* ptr = (jlong*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); if (ptr == NULL) { env->ThrowNew(JavaCPP_getClass(env, 2), "This pointer address is NULL."); @@ -617,11 +629,13 @@ JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_LongPointer_put__IJ(JNIEnv } jint position = env->GetIntField(obj, JavaCPP_positionFID); ptr += position; + jlong* ptr0 = arg0 == NULL ? NULL : (jlong*)env->GetPrimitiveArrayCritical(arg0, NULL); jobject rarg = obj; - ptr[arg0] = arg1; + memcpy(ptr, ptr0 + arg1, arg2 * sizeof(*ptr0)); + if (arg0 != NULL) env->ReleasePrimitiveArrayCritical(arg0, ptr0, 0); return rarg; } -JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_LongPointer_put___3JII(JNIEnv* env, jobject obj, jlongArray arg0, jint arg1, jint arg2) { +JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_LongPointer_put__IJ(JNIEnv* env, jobject obj, jint arg0, jlong arg1) { jlong* ptr = (jlong*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); if (ptr == NULL) { env->ThrowNew(JavaCPP_getClass(env, 2), "This pointer address is NULL."); @@ -629,25 +643,23 @@ JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_LongPointer_put___3JII(JNI } jint position = env->GetIntField(obj, JavaCPP_positionFID); ptr += position; - jlong* ptr0 = arg0 == NULL ? NULL : (jlong*)env->GetPrimitiveArrayCritical(arg0, NULL); jobject rarg = obj; - memcpy(ptr, ptr0 + arg1, arg2 * sizeof(*ptr0)); - if (arg0 != NULL) env->ReleasePrimitiveArrayCritical(arg0, ptr0, 0); + ptr[arg0] = arg1; return rarg; } -JNIEXPORT void JNICALL Java_com_googlecode_javacpp_LongPointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { - if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 6))) { + +JNIEXPORT void JNICALL Java_com_googlecode_javacpp_FloatPointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { + if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 7))) { return; } - jlong* rptr = new (std::nothrow) jlong[arg0]; + float* rptr = new (std::nothrow) float[arg0]; jint rcapacity = arg0; jvalue args[3]; args[0].j = ptr_to_jlong(rptr); args[1].i = rcapacity; - args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_LongPointer_deallocateArray); + args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_FloatPointer_deallocateArray); env->CallNonvirtualVoidMethodA(obj, JavaCPP_getClass(env, 1), JavaCPP_initMID, args); } - JNIEXPORT jfloat JNICALL Java_com_googlecode_javacpp_FloatPointer_get__I(JNIEnv* env, jobject obj, jint arg0) { float* ptr = (float*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); if (ptr == NULL) { @@ -675,7 +687,7 @@ JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_FloatPointer_get___3FII(JN if (arg0 != NULL) env->ReleasePrimitiveArrayCritical(arg0, ptr0, 0); return rarg; } -JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_FloatPointer_put__IF(JNIEnv* env, jobject obj, jint arg0, jfloat arg1) { +JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_FloatPointer_put___3FII(JNIEnv* env, jobject obj, jfloatArray arg0, jint arg1, jint arg2) { float* ptr = (float*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); if (ptr == NULL) { env->ThrowNew(JavaCPP_getClass(env, 2), "This pointer address is NULL."); @@ -683,11 +695,13 @@ JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_FloatPointer_put__IF(JNIEn } jint position = env->GetIntField(obj, JavaCPP_positionFID); ptr += position; + float* ptr0 = arg0 == NULL ? NULL : (jfloat*)env->GetPrimitiveArrayCritical(arg0, NULL); jobject rarg = obj; - ptr[arg0] = arg1; + memcpy(ptr, ptr0 + arg1, arg2 * sizeof(*ptr0)); + if (arg0 != NULL) env->ReleasePrimitiveArrayCritical(arg0, ptr0, 0); return rarg; } -JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_FloatPointer_put___3FII(JNIEnv* env, jobject obj, jfloatArray arg0, jint arg1, jint arg2) { +JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_FloatPointer_put__IF(JNIEnv* env, jobject obj, jint arg0, jfloat arg1) { float* ptr = (float*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); if (ptr == NULL) { env->ThrowNew(JavaCPP_getClass(env, 2), "This pointer address is NULL."); @@ -695,25 +709,23 @@ JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_FloatPointer_put___3FII(JN } jint position = env->GetIntField(obj, JavaCPP_positionFID); ptr += position; - float* ptr0 = arg0 == NULL ? NULL : (jfloat*)env->GetPrimitiveArrayCritical(arg0, NULL); jobject rarg = obj; - memcpy(ptr, ptr0 + arg1, arg2 * sizeof(*ptr0)); - if (arg0 != NULL) env->ReleasePrimitiveArrayCritical(arg0, ptr0, 0); + ptr[arg0] = arg1; return rarg; } -JNIEXPORT void JNICALL Java_com_googlecode_javacpp_FloatPointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { - if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 7))) { + +JNIEXPORT void JNICALL Java_com_googlecode_javacpp_DoublePointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { + if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 8))) { return; } - float* rptr = new (std::nothrow) float[arg0]; + double* rptr = new (std::nothrow) double[arg0]; jint rcapacity = arg0; jvalue args[3]; args[0].j = ptr_to_jlong(rptr); args[1].i = rcapacity; - args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_FloatPointer_deallocateArray); + args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_DoublePointer_deallocateArray); env->CallNonvirtualVoidMethodA(obj, JavaCPP_getClass(env, 1), JavaCPP_initMID, args); } - JNIEXPORT jdouble JNICALL Java_com_googlecode_javacpp_DoublePointer_get__I(JNIEnv* env, jobject obj, jint arg0) { double* ptr = (double*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); if (ptr == NULL) { @@ -741,7 +753,7 @@ JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_DoublePointer_get___3DII(J if (arg0 != NULL) env->ReleasePrimitiveArrayCritical(arg0, ptr0, 0); return rarg; } -JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_DoublePointer_put__ID(JNIEnv* env, jobject obj, jint arg0, jdouble arg1) { +JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_DoublePointer_put___3DII(JNIEnv* env, jobject obj, jdoubleArray arg0, jint arg1, jint arg2) { double* ptr = (double*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); if (ptr == NULL) { env->ThrowNew(JavaCPP_getClass(env, 2), "This pointer address is NULL."); @@ -749,11 +761,13 @@ JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_DoublePointer_put__ID(JNIE } jint position = env->GetIntField(obj, JavaCPP_positionFID); ptr += position; + double* ptr0 = arg0 == NULL ? NULL : (jdouble*)env->GetPrimitiveArrayCritical(arg0, NULL); jobject rarg = obj; - ptr[arg0] = arg1; + memcpy(ptr, ptr0 + arg1, arg2 * sizeof(*ptr0)); + if (arg0 != NULL) env->ReleasePrimitiveArrayCritical(arg0, ptr0, 0); return rarg; } -JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_DoublePointer_put___3DII(JNIEnv* env, jobject obj, jdoubleArray arg0, jint arg1, jint arg2) { +JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_DoublePointer_put__ID(JNIEnv* env, jobject obj, jint arg0, jdouble arg1) { double* ptr = (double*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); if (ptr == NULL) { env->ThrowNew(JavaCPP_getClass(env, 2), "This pointer address is NULL."); @@ -761,25 +775,23 @@ JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_DoublePointer_put___3DII(J } jint position = env->GetIntField(obj, JavaCPP_positionFID); ptr += position; - double* ptr0 = arg0 == NULL ? NULL : (jdouble*)env->GetPrimitiveArrayCritical(arg0, NULL); jobject rarg = obj; - memcpy(ptr, ptr0 + arg1, arg2 * sizeof(*ptr0)); - if (arg0 != NULL) env->ReleasePrimitiveArrayCritical(arg0, ptr0, 0); + ptr[arg0] = arg1; return rarg; } -JNIEXPORT void JNICALL Java_com_googlecode_javacpp_DoublePointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { - if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 8))) { + +JNIEXPORT void JNICALL Java_com_googlecode_javacpp_CharPointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { + if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 9))) { return; } - double* rptr = new (std::nothrow) double[arg0]; + unsigned short* rptr = new (std::nothrow) unsigned short[arg0]; jint rcapacity = arg0; jvalue args[3]; args[0].j = ptr_to_jlong(rptr); args[1].i = rcapacity; - args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_DoublePointer_deallocateArray); + args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_CharPointer_deallocateArray); env->CallNonvirtualVoidMethodA(obj, JavaCPP_getClass(env, 1), JavaCPP_initMID, args); } - JNIEXPORT jchar JNICALL Java_com_googlecode_javacpp_CharPointer_get__I(JNIEnv* env, jobject obj, jint arg0) { unsigned short* ptr = (unsigned short*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); if (ptr == NULL) { @@ -833,19 +845,19 @@ JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_CharPointer_put__IC(JNIEnv ptr[arg0] = arg1; return rarg; } -JNIEXPORT void JNICALL Java_com_googlecode_javacpp_CharPointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { - if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 9))) { + +JNIEXPORT void JNICALL Java_com_googlecode_javacpp_PointerPointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { + if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 10))) { return; } - unsigned short* rptr = new (std::nothrow) unsigned short[arg0]; + void** rptr = new (std::nothrow) void*[arg0]; jint rcapacity = arg0; jvalue args[3]; args[0].j = ptr_to_jlong(rptr); args[1].i = rcapacity; - args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_CharPointer_deallocateArray); + args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_PointerPointer_deallocateArray); env->CallNonvirtualVoidMethodA(obj, JavaCPP_getClass(env, 1), JavaCPP_initMID, args); } - JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_PointerPointer_get(JNIEnv* env, jobject obj, jint arg0) { void** ptr = (void**)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); if (ptr == NULL) { @@ -878,19 +890,19 @@ JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_PointerPointer_put(JNIEnv* ptr[arg0] = ptr1; return rarg; } -JNIEXPORT void JNICALL Java_com_googlecode_javacpp_PointerPointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { - if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 10))) { + +JNIEXPORT void JNICALL Java_com_googlecode_javacpp_BoolPointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { + if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 11))) { return; } - void** rptr = new (std::nothrow) void*[arg0]; + bool* rptr = new (std::nothrow) bool[arg0]; jint rcapacity = arg0; jvalue args[3]; args[0].j = ptr_to_jlong(rptr); args[1].i = rcapacity; - args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_PointerPointer_deallocateArray); + args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_BoolPointer_deallocateArray); env->CallNonvirtualVoidMethodA(obj, JavaCPP_getClass(env, 1), JavaCPP_initMID, args); } - JNIEXPORT jboolean JNICALL Java_com_googlecode_javacpp_BoolPointer_get(JNIEnv* env, jobject obj, jint arg0) { bool* ptr = (bool*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); if (ptr == NULL) { @@ -916,19 +928,19 @@ JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_BoolPointer_put(JNIEnv* en ptr[arg0] = (bool)arg1; return rarg; } -JNIEXPORT void JNICALL Java_com_googlecode_javacpp_BoolPointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { - if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 11))) { + +JNIEXPORT void JNICALL Java_com_googlecode_javacpp_CLongPointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { + if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 12))) { return; } - bool* rptr = new (std::nothrow) bool[arg0]; + long* rptr = new (std::nothrow) long[arg0]; jint rcapacity = arg0; jvalue args[3]; args[0].j = ptr_to_jlong(rptr); args[1].i = rcapacity; - args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_BoolPointer_deallocateArray); + args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_CLongPointer_deallocateArray); env->CallNonvirtualVoidMethodA(obj, JavaCPP_getClass(env, 1), JavaCPP_initMID, args); } - JNIEXPORT jlong JNICALL Java_com_googlecode_javacpp_CLongPointer_get(JNIEnv* env, jobject obj, jint arg0) { long* ptr = (long*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); if (ptr == NULL) { @@ -954,19 +966,19 @@ JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_CLongPointer_put(JNIEnv* e ptr[arg0] = (long)arg1; return rarg; } -JNIEXPORT void JNICALL Java_com_googlecode_javacpp_CLongPointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { - if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 12))) { + +JNIEXPORT void JNICALL Java_com_googlecode_javacpp_SizeTPointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { + if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 13))) { return; } - long* rptr = new (std::nothrow) long[arg0]; + size_t* rptr = new (std::nothrow) size_t[arg0]; jint rcapacity = arg0; jvalue args[3]; args[0].j = ptr_to_jlong(rptr); args[1].i = rcapacity; - args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_CLongPointer_deallocateArray); + args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_SizeTPointer_deallocateArray); env->CallNonvirtualVoidMethodA(obj, JavaCPP_getClass(env, 1), JavaCPP_initMID, args); } - JNIEXPORT jlong JNICALL Java_com_googlecode_javacpp_SizeTPointer_get(JNIEnv* env, jobject obj, jint arg0) { size_t* ptr = (size_t*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); if (ptr == NULL) { @@ -992,41 +1004,7 @@ JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_SizeTPointer_put(JNIEnv* e ptr[arg0] = (size_t)arg1; return rarg; } -JNIEXPORT void JNICALL Java_com_googlecode_javacpp_SizeTPointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { - if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 13))) { - return; - } - size_t* rptr = new (std::nothrow) size_t[arg0]; - jint rcapacity = arg0; - jvalue args[3]; - args[0].j = ptr_to_jlong(rptr); - args[1].i = rcapacity; - args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_SizeTPointer_deallocateArray); - env->CallNonvirtualVoidMethodA(obj, JavaCPP_getClass(env, 1), JavaCPP_initMID, args); -} - -JNIEXPORT jobject JNICALL Java_com_morlunk_jumble_audio_javacpp_CELT11_celt_1mode_1create(JNIEnv* env, jclass cls, jint arg0, jint arg1, jobject arg2) { - int* ptr2 = arg2 == NULL ? NULL : (int*)jlong_to_ptr(env->GetLongField(arg2, JavaCPP_addressFID)); - jint position2 = arg2 == NULL ? 0 : env->GetIntField(arg2, JavaCPP_positionFID); - ptr2 += position2; - jobject rarg = NULL; - void* rptr; - jthrowable exc = NULL; - try { - rptr = celt_mode_create(arg0, arg1, ptr2); - if (rptr != NULL) { - rarg = env->AllocObject(JavaCPP_getClass(env, 1)); - env->SetLongField(rarg, JavaCPP_addressFID, ptr_to_jlong(rptr)); - } - } catch (...) { - exc = JavaCPP_handleException(env, 14); - } - if (exc != NULL) { - env->Throw(exc); - } - return rarg; -} JNIEXPORT jint JNICALL Java_com_morlunk_jumble_audio_javacpp_CELT11_celt_1mode_1info(JNIEnv* env, jclass cls, jobject arg0, jint arg1, jobject arg2) { char* ptr0 = arg0 == NULL ? NULL : (char*)jlong_to_ptr(env->GetLongField(arg0, JavaCPP_addressFID)); jint position0 = arg0 == NULL ? 0 : env->GetIntField(arg0, JavaCPP_positionFID); @@ -1048,40 +1026,12 @@ JNIEXPORT jint JNICALL Java_com_morlunk_jumble_audio_javacpp_CELT11_celt_1mode_1 } return rarg; } -JNIEXPORT jint JNICALL Java_com_morlunk_jumble_audio_javacpp_CELT11_celt_1decode(JNIEnv* env, jclass cls, jobject arg0, jobject arg1, jint arg2, jobject arg3, jint arg4) { - char* ptr0 = arg0 == NULL ? NULL : (char*)jlong_to_ptr(env->GetLongField(arg0, JavaCPP_addressFID)); - jint position0 = arg0 == NULL ? 0 : env->GetIntField(arg0, JavaCPP_positionFID); - ptr0 += position0; - signed char* ptr1 = arg1 == NULL ? NULL : (signed char*)jlong_to_ptr(env->GetLongField(arg1, JavaCPP_addressFID)); - jint position1 = arg1 == NULL ? 0 : env->GetIntField(arg1, JavaCPP_positionFID); - ptr1 += position1; - short* ptr3 = arg3 == NULL ? NULL : (short*)jlong_to_ptr(env->GetLongField(arg3, JavaCPP_addressFID)); - jint position3 = arg3 == NULL ? 0 : env->GetIntField(arg3, JavaCPP_positionFID); - ptr3 += position3; - jint rarg = 0; - jthrowable exc = NULL; - try { - int rvalue = celt_decode((CELTDecoder*)ptr0, (const unsigned char*)ptr1, arg2, ptr3, arg4); - rarg = (jint)rvalue; - } catch (...) { - exc = JavaCPP_handleException(env, 14); - } - - if (exc != NULL) { - env->Throw(exc); - } - return rarg; -} -JNIEXPORT jint JNICALL Java_com_morlunk_jumble_audio_javacpp_CELT11_celt_1decode_1float(JNIEnv* env, jclass cls, jobject arg0, jobject arg1, jint arg2, jobject arg3, jint arg4) { +JNIEXPORT jint JNICALL Java_com_morlunk_jumble_audio_javacpp_CELT11_celt_1decode_1float(JNIEnv* env, jclass cls, jobject arg0, jbyteArray arg1, jint arg2, jfloatArray arg3, jint arg4) { char* ptr0 = arg0 == NULL ? NULL : (char*)jlong_to_ptr(env->GetLongField(arg0, JavaCPP_addressFID)); jint position0 = arg0 == NULL ? 0 : env->GetIntField(arg0, JavaCPP_positionFID); ptr0 += position0; - signed char* ptr1 = arg1 == NULL ? NULL : (signed char*)jlong_to_ptr(env->GetLongField(arg1, JavaCPP_addressFID)); - jint position1 = arg1 == NULL ? 0 : env->GetIntField(arg1, JavaCPP_positionFID); - ptr1 += position1; - float* ptr3 = arg3 == NULL ? NULL : (float*)jlong_to_ptr(env->GetLongField(arg3, JavaCPP_addressFID)); - jint position3 = arg3 == NULL ? 0 : env->GetIntField(arg3, JavaCPP_positionFID); - ptr3 += position3; + signed char* ptr1 = arg1 == NULL ? NULL : env->GetByteArrayElements(arg1, NULL); + float* ptr3 = arg3 == NULL ? NULL : env->GetFloatArrayElements(arg3, NULL); jint rarg = 0; jthrowable exc = NULL; try { @@ -1091,6 +1041,8 @@ JNIEXPORT jint JNICALL Java_com_morlunk_jumble_audio_javacpp_CELT11_celt_1decode exc = JavaCPP_handleException(env, 14); } + if (arg1 != NULL) env->ReleaseByteArrayElements(arg1, (jbyte*)ptr1, 0); + if (arg3 != NULL) env->ReleaseFloatArrayElements(arg3, (jfloat*)ptr3, 0); if (exc != NULL) { env->Throw(exc); } @@ -1228,6 +1180,50 @@ JNIEXPORT jobject JNICALL Java_com_morlunk_jumble_audio_javacpp_CELT11_celt_1dec } return rarg; } +JNIEXPORT jint JNICALL Java_com_morlunk_jumble_audio_javacpp_CELT11_celt_1decode(JNIEnv* env, jclass cls, jobject arg0, jbyteArray arg1, jint arg2, jshortArray arg3, jint arg4) { + char* ptr0 = arg0 == NULL ? NULL : (char*)jlong_to_ptr(env->GetLongField(arg0, JavaCPP_addressFID)); + jint position0 = arg0 == NULL ? 0 : env->GetIntField(arg0, JavaCPP_positionFID); + ptr0 += position0; + signed char* ptr1 = arg1 == NULL ? NULL : env->GetByteArrayElements(arg1, NULL); + short* ptr3 = arg3 == NULL ? NULL : env->GetShortArrayElements(arg3, NULL); + jint rarg = 0; + jthrowable exc = NULL; + try { + int rvalue = celt_decode((CELTDecoder*)ptr0, (const unsigned char*)ptr1, arg2, ptr3, arg4); + rarg = (jint)rvalue; + } catch (...) { + exc = JavaCPP_handleException(env, 14); + } + + if (arg1 != NULL) env->ReleaseByteArrayElements(arg1, (jbyte*)ptr1, 0); + if (arg3 != NULL) env->ReleaseShortArrayElements(arg3, (jshort*)ptr3, 0); + if (exc != NULL) { + env->Throw(exc); + } + return rarg; +} +JNIEXPORT jobject JNICALL Java_com_morlunk_jumble_audio_javacpp_CELT11_celt_1mode_1create(JNIEnv* env, jclass cls, jint arg0, jint arg1, jobject arg2) { + int* ptr2 = arg2 == NULL ? NULL : (int*)jlong_to_ptr(env->GetLongField(arg2, JavaCPP_addressFID)); + jint position2 = arg2 == NULL ? 0 : env->GetIntField(arg2, JavaCPP_positionFID); + ptr2 += position2; + jobject rarg = NULL; + void* rptr; + jthrowable exc = NULL; + try { + rptr = celt_mode_create(arg0, arg1, ptr2); + if (rptr != NULL) { + rarg = env->AllocObject(JavaCPP_getClass(env, 1)); + env->SetLongField(rarg, JavaCPP_addressFID, ptr_to_jlong(rptr)); + } + } catch (...) { + exc = JavaCPP_handleException(env, 14); + } + + if (exc != NULL) { + env->Throw(exc); + } + return rarg; +} } diff --git a/src/main/jni/celt7.cpp b/src/main/jni/celt7.cpp index 0f53852..e1d33fd 100644 --- a/src/main/jni/celt7.cpp +++ b/src/main/jni/celt7.cpp @@ -274,14 +274,6 @@ JNIEXPORT void JNICALL Java_com_googlecode_javacpp_Pointer_00024NativeDeallocato -JNIEXPORT void JNICALL Java_com_googlecode_javacpp_Pointer_allocate(JNIEnv* env, jobject obj, jobject arg0) { - char* ptr0 = arg0 == NULL ? NULL : (char*)env->GetDirectBufferAddress(arg0); - void* rptr = ptr0; - jint rcapacity = 1; - env->SetLongField(obj, JavaCPP_addressFID, ptr_to_jlong(rptr)); - env->SetIntField(obj, JavaCPP_limitFID, rcapacity); - env->SetIntField(obj, JavaCPP_capacityFID, rcapacity); -} JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_Pointer_asDirectBuffer(JNIEnv* env, jobject obj) { char* ptr = (char*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); if (ptr == NULL) { @@ -383,8 +375,28 @@ JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_Pointer_memset(JNIEnv* env } return rarg; } +JNIEXPORT void JNICALL Java_com_googlecode_javacpp_Pointer_allocate(JNIEnv* env, jobject obj, jobject arg0) { + char* ptr0 = arg0 == NULL ? NULL : (char*)env->GetDirectBufferAddress(arg0); + void* rptr = ptr0; + jint rcapacity = 1; + env->SetLongField(obj, JavaCPP_addressFID, ptr_to_jlong(rptr)); + env->SetIntField(obj, JavaCPP_limitFID, rcapacity); + env->SetIntField(obj, JavaCPP_capacityFID, rcapacity); +} -JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_BytePointer_get___3BII(JNIEnv* env, jobject obj, jbyteArray arg0, jint arg1, jint arg2) { +JNIEXPORT void JNICALL Java_com_googlecode_javacpp_BytePointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { + if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 3))) { + return; + } + signed char* rptr = new (std::nothrow) signed char[arg0]; + jint rcapacity = arg0; + jvalue args[3]; + args[0].j = ptr_to_jlong(rptr); + args[1].i = rcapacity; + args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_BytePointer_deallocateArray); + env->CallNonvirtualVoidMethodA(obj, JavaCPP_getClass(env, 1), JavaCPP_initMID, args); +} +JNIEXPORT jbyte JNICALL Java_com_googlecode_javacpp_BytePointer_get__I(JNIEnv* env, jobject obj, jint arg0) { signed char* ptr = (signed char*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); if (ptr == NULL) { env->ThrowNew(JavaCPP_getClass(env, 2), "This pointer address is NULL."); @@ -392,13 +404,12 @@ JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_BytePointer_get___3BII(JNI } jint position = env->GetIntField(obj, JavaCPP_positionFID); ptr += position; - signed char* ptr0 = arg0 == NULL ? NULL : (jbyte*)env->GetPrimitiveArrayCritical(arg0, NULL); - jobject rarg = obj; - memcpy(ptr0 + arg1, ptr, arg2 * sizeof(*ptr0)); - if (arg0 != NULL) env->ReleasePrimitiveArrayCritical(arg0, ptr0, 0); + jbyte rarg = 0; + signed char rvalue = ptr[arg0]; + rarg = (jbyte)rvalue; return rarg; } -JNIEXPORT jbyte JNICALL Java_com_googlecode_javacpp_BytePointer_get__I(JNIEnv* env, jobject obj, jint arg0) { +JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_BytePointer_get___3BII(JNIEnv* env, jobject obj, jbyteArray arg0, jint arg1, jint arg2) { signed char* ptr = (signed char*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); if (ptr == NULL) { env->ThrowNew(JavaCPP_getClass(env, 2), "This pointer address is NULL."); @@ -406,9 +417,10 @@ JNIEXPORT jbyte JNICALL Java_com_googlecode_javacpp_BytePointer_get__I(JNIEnv* e } jint position = env->GetIntField(obj, JavaCPP_positionFID); ptr += position; - jbyte rarg = 0; - signed char rvalue = ptr[arg0]; - rarg = (jbyte)rvalue; + signed char* ptr0 = arg0 == NULL ? NULL : (jbyte*)env->GetPrimitiveArrayCritical(arg0, NULL); + jobject rarg = obj; + memcpy(ptr0 + arg1, ptr, arg2 * sizeof(*ptr0)); + if (arg0 != NULL) env->ReleasePrimitiveArrayCritical(arg0, ptr0, 0); return rarg; } JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_BytePointer_put__IB(JNIEnv* env, jobject obj, jint arg0, jbyte arg1) { @@ -437,19 +449,19 @@ JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_BytePointer_put___3BII(JNI if (arg0 != NULL) env->ReleasePrimitiveArrayCritical(arg0, ptr0, 0); return rarg; } -JNIEXPORT void JNICALL Java_com_googlecode_javacpp_BytePointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { - if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 3))) { + +JNIEXPORT void JNICALL Java_com_googlecode_javacpp_ShortPointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { + if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 4))) { return; } - signed char* rptr = new (std::nothrow) signed char[arg0]; + short* rptr = new (std::nothrow) short[arg0]; jint rcapacity = arg0; jvalue args[3]; args[0].j = ptr_to_jlong(rptr); args[1].i = rcapacity; - args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_BytePointer_deallocateArray); + args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_ShortPointer_deallocateArray); env->CallNonvirtualVoidMethodA(obj, JavaCPP_getClass(env, 1), JavaCPP_initMID, args); } - JNIEXPORT jshort JNICALL Java_com_googlecode_javacpp_ShortPointer_get__I(JNIEnv* env, jobject obj, jint arg0) { short* ptr = (short*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); if (ptr == NULL) { @@ -477,7 +489,7 @@ JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_ShortPointer_get___3SII(JN if (arg0 != NULL) env->ReleasePrimitiveArrayCritical(arg0, ptr0, 0); return rarg; } -JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_ShortPointer_put__IS(JNIEnv* env, jobject obj, jint arg0, jshort arg1) { +JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_ShortPointer_put___3SII(JNIEnv* env, jobject obj, jshortArray arg0, jint arg1, jint arg2) { short* ptr = (short*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); if (ptr == NULL) { env->ThrowNew(JavaCPP_getClass(env, 2), "This pointer address is NULL."); @@ -485,11 +497,13 @@ JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_ShortPointer_put__IS(JNIEn } jint position = env->GetIntField(obj, JavaCPP_positionFID); ptr += position; + short* ptr0 = arg0 == NULL ? NULL : (jshort*)env->GetPrimitiveArrayCritical(arg0, NULL); jobject rarg = obj; - ptr[arg0] = arg1; + memcpy(ptr, ptr0 + arg1, arg2 * sizeof(*ptr0)); + if (arg0 != NULL) env->ReleasePrimitiveArrayCritical(arg0, ptr0, 0); return rarg; } -JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_ShortPointer_put___3SII(JNIEnv* env, jobject obj, jshortArray arg0, jint arg1, jint arg2) { +JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_ShortPointer_put__IS(JNIEnv* env, jobject obj, jint arg0, jshort arg1) { short* ptr = (short*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); if (ptr == NULL) { env->ThrowNew(JavaCPP_getClass(env, 2), "This pointer address is NULL."); @@ -497,25 +511,23 @@ JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_ShortPointer_put___3SII(JN } jint position = env->GetIntField(obj, JavaCPP_positionFID); ptr += position; - short* ptr0 = arg0 == NULL ? NULL : (jshort*)env->GetPrimitiveArrayCritical(arg0, NULL); jobject rarg = obj; - memcpy(ptr, ptr0 + arg1, arg2 * sizeof(*ptr0)); - if (arg0 != NULL) env->ReleasePrimitiveArrayCritical(arg0, ptr0, 0); + ptr[arg0] = arg1; return rarg; } -JNIEXPORT void JNICALL Java_com_googlecode_javacpp_ShortPointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { - if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 4))) { + +JNIEXPORT void JNICALL Java_com_googlecode_javacpp_IntPointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { + if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 5))) { return; } - short* rptr = new (std::nothrow) short[arg0]; + int* rptr = new (std::nothrow) int[arg0]; jint rcapacity = arg0; jvalue args[3]; args[0].j = ptr_to_jlong(rptr); args[1].i = rcapacity; - args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_ShortPointer_deallocateArray); + args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_IntPointer_deallocateArray); env->CallNonvirtualVoidMethodA(obj, JavaCPP_getClass(env, 1), JavaCPP_initMID, args); } - JNIEXPORT jint JNICALL Java_com_googlecode_javacpp_IntPointer_get__I(JNIEnv* env, jobject obj, jint arg0) { int* ptr = (int*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); if (ptr == NULL) { @@ -569,19 +581,19 @@ JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_IntPointer_put__II(JNIEnv* ptr[arg0] = arg1; return rarg; } -JNIEXPORT void JNICALL Java_com_googlecode_javacpp_IntPointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { - if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 5))) { + +JNIEXPORT void JNICALL Java_com_googlecode_javacpp_LongPointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { + if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 6))) { return; } - int* rptr = new (std::nothrow) int[arg0]; + jlong* rptr = new (std::nothrow) jlong[arg0]; jint rcapacity = arg0; jvalue args[3]; args[0].j = ptr_to_jlong(rptr); args[1].i = rcapacity; - args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_IntPointer_deallocateArray); + args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_LongPointer_deallocateArray); env->CallNonvirtualVoidMethodA(obj, JavaCPP_getClass(env, 1), JavaCPP_initMID, args); } - JNIEXPORT jlong JNICALL Java_com_googlecode_javacpp_LongPointer_get__I(JNIEnv* env, jobject obj, jint arg0) { jlong* ptr = (jlong*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); if (ptr == NULL) { @@ -609,7 +621,7 @@ JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_LongPointer_get___3JII(JNI if (arg0 != NULL) env->ReleasePrimitiveArrayCritical(arg0, ptr0, 0); return rarg; } -JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_LongPointer_put__IJ(JNIEnv* env, jobject obj, jint arg0, jlong arg1) { +JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_LongPointer_put___3JII(JNIEnv* env, jobject obj, jlongArray arg0, jint arg1, jint arg2) { jlong* ptr = (jlong*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); if (ptr == NULL) { env->ThrowNew(JavaCPP_getClass(env, 2), "This pointer address is NULL."); @@ -617,11 +629,13 @@ JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_LongPointer_put__IJ(JNIEnv } jint position = env->GetIntField(obj, JavaCPP_positionFID); ptr += position; + jlong* ptr0 = arg0 == NULL ? NULL : (jlong*)env->GetPrimitiveArrayCritical(arg0, NULL); jobject rarg = obj; - ptr[arg0] = arg1; + memcpy(ptr, ptr0 + arg1, arg2 * sizeof(*ptr0)); + if (arg0 != NULL) env->ReleasePrimitiveArrayCritical(arg0, ptr0, 0); return rarg; } -JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_LongPointer_put___3JII(JNIEnv* env, jobject obj, jlongArray arg0, jint arg1, jint arg2) { +JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_LongPointer_put__IJ(JNIEnv* env, jobject obj, jint arg0, jlong arg1) { jlong* ptr = (jlong*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); if (ptr == NULL) { env->ThrowNew(JavaCPP_getClass(env, 2), "This pointer address is NULL."); @@ -629,25 +643,23 @@ JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_LongPointer_put___3JII(JNI } jint position = env->GetIntField(obj, JavaCPP_positionFID); ptr += position; - jlong* ptr0 = arg0 == NULL ? NULL : (jlong*)env->GetPrimitiveArrayCritical(arg0, NULL); jobject rarg = obj; - memcpy(ptr, ptr0 + arg1, arg2 * sizeof(*ptr0)); - if (arg0 != NULL) env->ReleasePrimitiveArrayCritical(arg0, ptr0, 0); + ptr[arg0] = arg1; return rarg; } -JNIEXPORT void JNICALL Java_com_googlecode_javacpp_LongPointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { - if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 6))) { + +JNIEXPORT void JNICALL Java_com_googlecode_javacpp_FloatPointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { + if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 7))) { return; } - jlong* rptr = new (std::nothrow) jlong[arg0]; + float* rptr = new (std::nothrow) float[arg0]; jint rcapacity = arg0; jvalue args[3]; args[0].j = ptr_to_jlong(rptr); args[1].i = rcapacity; - args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_LongPointer_deallocateArray); + args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_FloatPointer_deallocateArray); env->CallNonvirtualVoidMethodA(obj, JavaCPP_getClass(env, 1), JavaCPP_initMID, args); } - JNIEXPORT jfloat JNICALL Java_com_googlecode_javacpp_FloatPointer_get__I(JNIEnv* env, jobject obj, jint arg0) { float* ptr = (float*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); if (ptr == NULL) { @@ -675,7 +687,7 @@ JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_FloatPointer_get___3FII(JN if (arg0 != NULL) env->ReleasePrimitiveArrayCritical(arg0, ptr0, 0); return rarg; } -JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_FloatPointer_put__IF(JNIEnv* env, jobject obj, jint arg0, jfloat arg1) { +JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_FloatPointer_put___3FII(JNIEnv* env, jobject obj, jfloatArray arg0, jint arg1, jint arg2) { float* ptr = (float*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); if (ptr == NULL) { env->ThrowNew(JavaCPP_getClass(env, 2), "This pointer address is NULL."); @@ -683,11 +695,13 @@ JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_FloatPointer_put__IF(JNIEn } jint position = env->GetIntField(obj, JavaCPP_positionFID); ptr += position; + float* ptr0 = arg0 == NULL ? NULL : (jfloat*)env->GetPrimitiveArrayCritical(arg0, NULL); jobject rarg = obj; - ptr[arg0] = arg1; + memcpy(ptr, ptr0 + arg1, arg2 * sizeof(*ptr0)); + if (arg0 != NULL) env->ReleasePrimitiveArrayCritical(arg0, ptr0, 0); return rarg; } -JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_FloatPointer_put___3FII(JNIEnv* env, jobject obj, jfloatArray arg0, jint arg1, jint arg2) { +JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_FloatPointer_put__IF(JNIEnv* env, jobject obj, jint arg0, jfloat arg1) { float* ptr = (float*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); if (ptr == NULL) { env->ThrowNew(JavaCPP_getClass(env, 2), "This pointer address is NULL."); @@ -695,25 +709,23 @@ JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_FloatPointer_put___3FII(JN } jint position = env->GetIntField(obj, JavaCPP_positionFID); ptr += position; - float* ptr0 = arg0 == NULL ? NULL : (jfloat*)env->GetPrimitiveArrayCritical(arg0, NULL); jobject rarg = obj; - memcpy(ptr, ptr0 + arg1, arg2 * sizeof(*ptr0)); - if (arg0 != NULL) env->ReleasePrimitiveArrayCritical(arg0, ptr0, 0); + ptr[arg0] = arg1; return rarg; } -JNIEXPORT void JNICALL Java_com_googlecode_javacpp_FloatPointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { - if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 7))) { + +JNIEXPORT void JNICALL Java_com_googlecode_javacpp_DoublePointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { + if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 8))) { return; } - float* rptr = new (std::nothrow) float[arg0]; + double* rptr = new (std::nothrow) double[arg0]; jint rcapacity = arg0; jvalue args[3]; args[0].j = ptr_to_jlong(rptr); args[1].i = rcapacity; - args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_FloatPointer_deallocateArray); + args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_DoublePointer_deallocateArray); env->CallNonvirtualVoidMethodA(obj, JavaCPP_getClass(env, 1), JavaCPP_initMID, args); } - JNIEXPORT jdouble JNICALL Java_com_googlecode_javacpp_DoublePointer_get__I(JNIEnv* env, jobject obj, jint arg0) { double* ptr = (double*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); if (ptr == NULL) { @@ -741,7 +753,7 @@ JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_DoublePointer_get___3DII(J if (arg0 != NULL) env->ReleasePrimitiveArrayCritical(arg0, ptr0, 0); return rarg; } -JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_DoublePointer_put__ID(JNIEnv* env, jobject obj, jint arg0, jdouble arg1) { +JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_DoublePointer_put___3DII(JNIEnv* env, jobject obj, jdoubleArray arg0, jint arg1, jint arg2) { double* ptr = (double*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); if (ptr == NULL) { env->ThrowNew(JavaCPP_getClass(env, 2), "This pointer address is NULL."); @@ -749,11 +761,13 @@ JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_DoublePointer_put__ID(JNIE } jint position = env->GetIntField(obj, JavaCPP_positionFID); ptr += position; + double* ptr0 = arg0 == NULL ? NULL : (jdouble*)env->GetPrimitiveArrayCritical(arg0, NULL); jobject rarg = obj; - ptr[arg0] = arg1; + memcpy(ptr, ptr0 + arg1, arg2 * sizeof(*ptr0)); + if (arg0 != NULL) env->ReleasePrimitiveArrayCritical(arg0, ptr0, 0); return rarg; } -JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_DoublePointer_put___3DII(JNIEnv* env, jobject obj, jdoubleArray arg0, jint arg1, jint arg2) { +JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_DoublePointer_put__ID(JNIEnv* env, jobject obj, jint arg0, jdouble arg1) { double* ptr = (double*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); if (ptr == NULL) { env->ThrowNew(JavaCPP_getClass(env, 2), "This pointer address is NULL."); @@ -761,25 +775,23 @@ JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_DoublePointer_put___3DII(J } jint position = env->GetIntField(obj, JavaCPP_positionFID); ptr += position; - double* ptr0 = arg0 == NULL ? NULL : (jdouble*)env->GetPrimitiveArrayCritical(arg0, NULL); jobject rarg = obj; - memcpy(ptr, ptr0 + arg1, arg2 * sizeof(*ptr0)); - if (arg0 != NULL) env->ReleasePrimitiveArrayCritical(arg0, ptr0, 0); + ptr[arg0] = arg1; return rarg; } -JNIEXPORT void JNICALL Java_com_googlecode_javacpp_DoublePointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { - if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 8))) { + +JNIEXPORT void JNICALL Java_com_googlecode_javacpp_CharPointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { + if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 9))) { return; } - double* rptr = new (std::nothrow) double[arg0]; + unsigned short* rptr = new (std::nothrow) unsigned short[arg0]; jint rcapacity = arg0; jvalue args[3]; args[0].j = ptr_to_jlong(rptr); args[1].i = rcapacity; - args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_DoublePointer_deallocateArray); + args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_CharPointer_deallocateArray); env->CallNonvirtualVoidMethodA(obj, JavaCPP_getClass(env, 1), JavaCPP_initMID, args); } - JNIEXPORT jchar JNICALL Java_com_googlecode_javacpp_CharPointer_get__I(JNIEnv* env, jobject obj, jint arg0) { unsigned short* ptr = (unsigned short*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); if (ptr == NULL) { @@ -833,19 +845,19 @@ JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_CharPointer_put__IC(JNIEnv ptr[arg0] = arg1; return rarg; } -JNIEXPORT void JNICALL Java_com_googlecode_javacpp_CharPointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { - if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 9))) { + +JNIEXPORT void JNICALL Java_com_googlecode_javacpp_PointerPointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { + if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 10))) { return; } - unsigned short* rptr = new (std::nothrow) unsigned short[arg0]; + void** rptr = new (std::nothrow) void*[arg0]; jint rcapacity = arg0; jvalue args[3]; args[0].j = ptr_to_jlong(rptr); args[1].i = rcapacity; - args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_CharPointer_deallocateArray); + args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_PointerPointer_deallocateArray); env->CallNonvirtualVoidMethodA(obj, JavaCPP_getClass(env, 1), JavaCPP_initMID, args); } - JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_PointerPointer_get(JNIEnv* env, jobject obj, jint arg0) { void** ptr = (void**)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); if (ptr == NULL) { @@ -878,19 +890,19 @@ JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_PointerPointer_put(JNIEnv* ptr[arg0] = ptr1; return rarg; } -JNIEXPORT void JNICALL Java_com_googlecode_javacpp_PointerPointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { - if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 10))) { + +JNIEXPORT void JNICALL Java_com_googlecode_javacpp_BoolPointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { + if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 11))) { return; } - void** rptr = new (std::nothrow) void*[arg0]; + bool* rptr = new (std::nothrow) bool[arg0]; jint rcapacity = arg0; jvalue args[3]; args[0].j = ptr_to_jlong(rptr); args[1].i = rcapacity; - args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_PointerPointer_deallocateArray); + args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_BoolPointer_deallocateArray); env->CallNonvirtualVoidMethodA(obj, JavaCPP_getClass(env, 1), JavaCPP_initMID, args); } - JNIEXPORT jboolean JNICALL Java_com_googlecode_javacpp_BoolPointer_get(JNIEnv* env, jobject obj, jint arg0) { bool* ptr = (bool*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); if (ptr == NULL) { @@ -916,19 +928,19 @@ JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_BoolPointer_put(JNIEnv* en ptr[arg0] = (bool)arg1; return rarg; } -JNIEXPORT void JNICALL Java_com_googlecode_javacpp_BoolPointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { - if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 11))) { + +JNIEXPORT void JNICALL Java_com_googlecode_javacpp_CLongPointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { + if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 12))) { return; } - bool* rptr = new (std::nothrow) bool[arg0]; + long* rptr = new (std::nothrow) long[arg0]; jint rcapacity = arg0; jvalue args[3]; args[0].j = ptr_to_jlong(rptr); args[1].i = rcapacity; - args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_BoolPointer_deallocateArray); + args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_CLongPointer_deallocateArray); env->CallNonvirtualVoidMethodA(obj, JavaCPP_getClass(env, 1), JavaCPP_initMID, args); } - JNIEXPORT jlong JNICALL Java_com_googlecode_javacpp_CLongPointer_get(JNIEnv* env, jobject obj, jint arg0) { long* ptr = (long*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); if (ptr == NULL) { @@ -954,19 +966,19 @@ JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_CLongPointer_put(JNIEnv* e ptr[arg0] = (long)arg1; return rarg; } -JNIEXPORT void JNICALL Java_com_googlecode_javacpp_CLongPointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { - if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 12))) { + +JNIEXPORT void JNICALL Java_com_googlecode_javacpp_SizeTPointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { + if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 13))) { return; } - long* rptr = new (std::nothrow) long[arg0]; + size_t* rptr = new (std::nothrow) size_t[arg0]; jint rcapacity = arg0; jvalue args[3]; args[0].j = ptr_to_jlong(rptr); args[1].i = rcapacity; - args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_CLongPointer_deallocateArray); + args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_SizeTPointer_deallocateArray); env->CallNonvirtualVoidMethodA(obj, JavaCPP_getClass(env, 1), JavaCPP_initMID, args); } - JNIEXPORT jlong JNICALL Java_com_googlecode_javacpp_SizeTPointer_get(JNIEnv* env, jobject obj, jint arg0) { size_t* ptr = (size_t*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); if (ptr == NULL) { @@ -992,41 +1004,7 @@ JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_SizeTPointer_put(JNIEnv* e ptr[arg0] = (size_t)arg1; return rarg; } -JNIEXPORT void JNICALL Java_com_googlecode_javacpp_SizeTPointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { - if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 13))) { - return; - } - size_t* rptr = new (std::nothrow) size_t[arg0]; - jint rcapacity = arg0; - jvalue args[3]; - args[0].j = ptr_to_jlong(rptr); - args[1].i = rcapacity; - args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_SizeTPointer_deallocateArray); - env->CallNonvirtualVoidMethodA(obj, JavaCPP_getClass(env, 1), JavaCPP_initMID, args); -} - -JNIEXPORT jobject JNICALL Java_com_morlunk_jumble_audio_javacpp_CELT7_celt_1mode_1create(JNIEnv* env, jclass cls, jint arg0, jint arg1, jobject arg2) { - int* ptr2 = arg2 == NULL ? NULL : (int*)jlong_to_ptr(env->GetLongField(arg2, JavaCPP_addressFID)); - jint position2 = arg2 == NULL ? 0 : env->GetIntField(arg2, JavaCPP_positionFID); - ptr2 += position2; - jobject rarg = NULL; - void* rptr; - jthrowable exc = NULL; - try { - rptr = celt_mode_create(arg0, arg1, ptr2); - if (rptr != NULL) { - rarg = env->AllocObject(JavaCPP_getClass(env, 1)); - env->SetLongField(rarg, JavaCPP_addressFID, ptr_to_jlong(rptr)); - } - } catch (...) { - exc = JavaCPP_handleException(env, 14); - } - if (exc != NULL) { - env->Throw(exc); - } - return rarg; -} JNIEXPORT jint JNICALL Java_com_morlunk_jumble_audio_javacpp_CELT7_celt_1mode_1info(JNIEnv* env, jclass cls, jobject arg0, jint arg1, jobject arg2) { char* ptr0 = arg0 == NULL ? NULL : (char*)jlong_to_ptr(env->GetLongField(arg0, JavaCPP_addressFID)); jint position0 = arg0 == NULL ? 0 : env->GetIntField(arg0, JavaCPP_positionFID); @@ -1048,40 +1026,12 @@ JNIEXPORT jint JNICALL Java_com_morlunk_jumble_audio_javacpp_CELT7_celt_1mode_1i } return rarg; } -JNIEXPORT jint JNICALL Java_com_morlunk_jumble_audio_javacpp_CELT7_celt_1decode(JNIEnv* env, jclass cls, jobject arg0, jobject arg1, jint arg2, jobject arg3) { - char* ptr0 = arg0 == NULL ? NULL : (char*)jlong_to_ptr(env->GetLongField(arg0, JavaCPP_addressFID)); - jint position0 = arg0 == NULL ? 0 : env->GetIntField(arg0, JavaCPP_positionFID); - ptr0 += position0; - signed char* ptr1 = arg1 == NULL ? NULL : (signed char*)jlong_to_ptr(env->GetLongField(arg1, JavaCPP_addressFID)); - jint position1 = arg1 == NULL ? 0 : env->GetIntField(arg1, JavaCPP_positionFID); - ptr1 += position1; - short* ptr3 = arg3 == NULL ? NULL : (short*)jlong_to_ptr(env->GetLongField(arg3, JavaCPP_addressFID)); - jint position3 = arg3 == NULL ? 0 : env->GetIntField(arg3, JavaCPP_positionFID); - ptr3 += position3; - jint rarg = 0; - jthrowable exc = NULL; - try { - int rvalue = celt_decode((CELTDecoder*)ptr0, (const unsigned char*)ptr1, arg2, ptr3); - rarg = (jint)rvalue; - } catch (...) { - exc = JavaCPP_handleException(env, 14); - } - - if (exc != NULL) { - env->Throw(exc); - } - return rarg; -} -JNIEXPORT jint JNICALL Java_com_morlunk_jumble_audio_javacpp_CELT7_celt_1decode_1float(JNIEnv* env, jclass cls, jobject arg0, jobject arg1, jint arg2, jobject arg3) { +JNIEXPORT jint JNICALL Java_com_morlunk_jumble_audio_javacpp_CELT7_celt_1decode_1float(JNIEnv* env, jclass cls, jobject arg0, jbyteArray arg1, jint arg2, jfloatArray arg3) { char* ptr0 = arg0 == NULL ? NULL : (char*)jlong_to_ptr(env->GetLongField(arg0, JavaCPP_addressFID)); jint position0 = arg0 == NULL ? 0 : env->GetIntField(arg0, JavaCPP_positionFID); ptr0 += position0; - signed char* ptr1 = arg1 == NULL ? NULL : (signed char*)jlong_to_ptr(env->GetLongField(arg1, JavaCPP_addressFID)); - jint position1 = arg1 == NULL ? 0 : env->GetIntField(arg1, JavaCPP_positionFID); - ptr1 += position1; - float* ptr3 = arg3 == NULL ? NULL : (float*)jlong_to_ptr(env->GetLongField(arg3, JavaCPP_addressFID)); - jint position3 = arg3 == NULL ? 0 : env->GetIntField(arg3, JavaCPP_positionFID); - ptr3 += position3; + signed char* ptr1 = arg1 == NULL ? NULL : env->GetByteArrayElements(arg1, NULL); + float* ptr3 = arg3 == NULL ? NULL : env->GetFloatArrayElements(arg3, NULL); jint rarg = 0; jthrowable exc = NULL; try { @@ -1091,6 +1041,8 @@ JNIEXPORT jint JNICALL Java_com_morlunk_jumble_audio_javacpp_CELT7_celt_1decode_ exc = JavaCPP_handleException(env, 14); } + if (arg1 != NULL) env->ReleaseByteArrayElements(arg1, (jbyte*)ptr1, 0); + if (arg3 != NULL) env->ReleaseFloatArrayElements(arg3, (jfloat*)ptr3, 0); if (exc != NULL) { env->Throw(exc); } @@ -1240,6 +1192,50 @@ JNIEXPORT jobject JNICALL Java_com_morlunk_jumble_audio_javacpp_CELT7_celt_1deco } return rarg; } +JNIEXPORT jint JNICALL Java_com_morlunk_jumble_audio_javacpp_CELT7_celt_1decode(JNIEnv* env, jclass cls, jobject arg0, jbyteArray arg1, jint arg2, jshortArray arg3) { + char* ptr0 = arg0 == NULL ? NULL : (char*)jlong_to_ptr(env->GetLongField(arg0, JavaCPP_addressFID)); + jint position0 = arg0 == NULL ? 0 : env->GetIntField(arg0, JavaCPP_positionFID); + ptr0 += position0; + signed char* ptr1 = arg1 == NULL ? NULL : env->GetByteArrayElements(arg1, NULL); + short* ptr3 = arg3 == NULL ? NULL : env->GetShortArrayElements(arg3, NULL); + jint rarg = 0; + jthrowable exc = NULL; + try { + int rvalue = celt_decode((CELTDecoder*)ptr0, (const unsigned char*)ptr1, arg2, ptr3); + rarg = (jint)rvalue; + } catch (...) { + exc = JavaCPP_handleException(env, 14); + } + + if (arg1 != NULL) env->ReleaseByteArrayElements(arg1, (jbyte*)ptr1, 0); + if (arg3 != NULL) env->ReleaseShortArrayElements(arg3, (jshort*)ptr3, 0); + if (exc != NULL) { + env->Throw(exc); + } + return rarg; +} +JNIEXPORT jobject JNICALL Java_com_morlunk_jumble_audio_javacpp_CELT7_celt_1mode_1create(JNIEnv* env, jclass cls, jint arg0, jint arg1, jobject arg2) { + int* ptr2 = arg2 == NULL ? NULL : (int*)jlong_to_ptr(env->GetLongField(arg2, JavaCPP_addressFID)); + jint position2 = arg2 == NULL ? 0 : env->GetIntField(arg2, JavaCPP_positionFID); + ptr2 += position2; + jobject rarg = NULL; + void* rptr; + jthrowable exc = NULL; + try { + rptr = celt_mode_create(arg0, arg1, ptr2); + if (rptr != NULL) { + rarg = env->AllocObject(JavaCPP_getClass(env, 1)); + env->SetLongField(rarg, JavaCPP_addressFID, ptr_to_jlong(rptr)); + } + } catch (...) { + exc = JavaCPP_handleException(env, 14); + } + + if (exc != NULL) { + env->Throw(exc); + } + return rarg; +} } diff --git a/src/main/jni/opus.cpp b/src/main/jni/opus.cpp index 9ad5173..a7f06e4 100644 --- a/src/main/jni/opus.cpp +++ b/src/main/jni/opus.cpp @@ -274,14 +274,6 @@ JNIEXPORT void JNICALL Java_com_googlecode_javacpp_Pointer_00024NativeDeallocato -JNIEXPORT void JNICALL Java_com_googlecode_javacpp_Pointer_allocate(JNIEnv* env, jobject obj, jobject arg0) { - char* ptr0 = arg0 == NULL ? NULL : (char*)env->GetDirectBufferAddress(arg0); - void* rptr = ptr0; - jint rcapacity = 1; - env->SetLongField(obj, JavaCPP_addressFID, ptr_to_jlong(rptr)); - env->SetIntField(obj, JavaCPP_limitFID, rcapacity); - env->SetIntField(obj, JavaCPP_capacityFID, rcapacity); -} JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_Pointer_asDirectBuffer(JNIEnv* env, jobject obj) { char* ptr = (char*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); if (ptr == NULL) { @@ -383,8 +375,28 @@ JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_Pointer_memset(JNIEnv* env } return rarg; } +JNIEXPORT void JNICALL Java_com_googlecode_javacpp_Pointer_allocate(JNIEnv* env, jobject obj, jobject arg0) { + char* ptr0 = arg0 == NULL ? NULL : (char*)env->GetDirectBufferAddress(arg0); + void* rptr = ptr0; + jint rcapacity = 1; + env->SetLongField(obj, JavaCPP_addressFID, ptr_to_jlong(rptr)); + env->SetIntField(obj, JavaCPP_limitFID, rcapacity); + env->SetIntField(obj, JavaCPP_capacityFID, rcapacity); +} -JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_BytePointer_get___3BII(JNIEnv* env, jobject obj, jbyteArray arg0, jint arg1, jint arg2) { +JNIEXPORT void JNICALL Java_com_googlecode_javacpp_BytePointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { + if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 3))) { + return; + } + signed char* rptr = new (std::nothrow) signed char[arg0]; + jint rcapacity = arg0; + jvalue args[3]; + args[0].j = ptr_to_jlong(rptr); + args[1].i = rcapacity; + args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_BytePointer_deallocateArray); + env->CallNonvirtualVoidMethodA(obj, JavaCPP_getClass(env, 1), JavaCPP_initMID, args); +} +JNIEXPORT jbyte JNICALL Java_com_googlecode_javacpp_BytePointer_get__I(JNIEnv* env, jobject obj, jint arg0) { signed char* ptr = (signed char*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); if (ptr == NULL) { env->ThrowNew(JavaCPP_getClass(env, 2), "This pointer address is NULL."); @@ -392,13 +404,12 @@ JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_BytePointer_get___3BII(JNI } jint position = env->GetIntField(obj, JavaCPP_positionFID); ptr += position; - signed char* ptr0 = arg0 == NULL ? NULL : (jbyte*)env->GetPrimitiveArrayCritical(arg0, NULL); - jobject rarg = obj; - memcpy(ptr0 + arg1, ptr, arg2 * sizeof(*ptr0)); - if (arg0 != NULL) env->ReleasePrimitiveArrayCritical(arg0, ptr0, 0); + jbyte rarg = 0; + signed char rvalue = ptr[arg0]; + rarg = (jbyte)rvalue; return rarg; } -JNIEXPORT jbyte JNICALL Java_com_googlecode_javacpp_BytePointer_get__I(JNIEnv* env, jobject obj, jint arg0) { +JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_BytePointer_get___3BII(JNIEnv* env, jobject obj, jbyteArray arg0, jint arg1, jint arg2) { signed char* ptr = (signed char*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); if (ptr == NULL) { env->ThrowNew(JavaCPP_getClass(env, 2), "This pointer address is NULL."); @@ -406,9 +417,10 @@ JNIEXPORT jbyte JNICALL Java_com_googlecode_javacpp_BytePointer_get__I(JNIEnv* e } jint position = env->GetIntField(obj, JavaCPP_positionFID); ptr += position; - jbyte rarg = 0; - signed char rvalue = ptr[arg0]; - rarg = (jbyte)rvalue; + signed char* ptr0 = arg0 == NULL ? NULL : (jbyte*)env->GetPrimitiveArrayCritical(arg0, NULL); + jobject rarg = obj; + memcpy(ptr0 + arg1, ptr, arg2 * sizeof(*ptr0)); + if (arg0 != NULL) env->ReleasePrimitiveArrayCritical(arg0, ptr0, 0); return rarg; } JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_BytePointer_put__IB(JNIEnv* env, jobject obj, jint arg0, jbyte arg1) { @@ -437,19 +449,19 @@ JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_BytePointer_put___3BII(JNI if (arg0 != NULL) env->ReleasePrimitiveArrayCritical(arg0, ptr0, 0); return rarg; } -JNIEXPORT void JNICALL Java_com_googlecode_javacpp_BytePointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { - if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 3))) { + +JNIEXPORT void JNICALL Java_com_googlecode_javacpp_ShortPointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { + if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 4))) { return; } - signed char* rptr = new (std::nothrow) signed char[arg0]; + short* rptr = new (std::nothrow) short[arg0]; jint rcapacity = arg0; jvalue args[3]; args[0].j = ptr_to_jlong(rptr); args[1].i = rcapacity; - args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_BytePointer_deallocateArray); + args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_ShortPointer_deallocateArray); env->CallNonvirtualVoidMethodA(obj, JavaCPP_getClass(env, 1), JavaCPP_initMID, args); } - JNIEXPORT jshort JNICALL Java_com_googlecode_javacpp_ShortPointer_get__I(JNIEnv* env, jobject obj, jint arg0) { short* ptr = (short*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); if (ptr == NULL) { @@ -477,7 +489,7 @@ JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_ShortPointer_get___3SII(JN if (arg0 != NULL) env->ReleasePrimitiveArrayCritical(arg0, ptr0, 0); return rarg; } -JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_ShortPointer_put__IS(JNIEnv* env, jobject obj, jint arg0, jshort arg1) { +JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_ShortPointer_put___3SII(JNIEnv* env, jobject obj, jshortArray arg0, jint arg1, jint arg2) { short* ptr = (short*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); if (ptr == NULL) { env->ThrowNew(JavaCPP_getClass(env, 2), "This pointer address is NULL."); @@ -485,11 +497,13 @@ JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_ShortPointer_put__IS(JNIEn } jint position = env->GetIntField(obj, JavaCPP_positionFID); ptr += position; + short* ptr0 = arg0 == NULL ? NULL : (jshort*)env->GetPrimitiveArrayCritical(arg0, NULL); jobject rarg = obj; - ptr[arg0] = arg1; + memcpy(ptr, ptr0 + arg1, arg2 * sizeof(*ptr0)); + if (arg0 != NULL) env->ReleasePrimitiveArrayCritical(arg0, ptr0, 0); return rarg; } -JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_ShortPointer_put___3SII(JNIEnv* env, jobject obj, jshortArray arg0, jint arg1, jint arg2) { +JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_ShortPointer_put__IS(JNIEnv* env, jobject obj, jint arg0, jshort arg1) { short* ptr = (short*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); if (ptr == NULL) { env->ThrowNew(JavaCPP_getClass(env, 2), "This pointer address is NULL."); @@ -497,25 +511,23 @@ JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_ShortPointer_put___3SII(JN } jint position = env->GetIntField(obj, JavaCPP_positionFID); ptr += position; - short* ptr0 = arg0 == NULL ? NULL : (jshort*)env->GetPrimitiveArrayCritical(arg0, NULL); jobject rarg = obj; - memcpy(ptr, ptr0 + arg1, arg2 * sizeof(*ptr0)); - if (arg0 != NULL) env->ReleasePrimitiveArrayCritical(arg0, ptr0, 0); + ptr[arg0] = arg1; return rarg; } -JNIEXPORT void JNICALL Java_com_googlecode_javacpp_ShortPointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { - if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 4))) { + +JNIEXPORT void JNICALL Java_com_googlecode_javacpp_IntPointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { + if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 5))) { return; } - short* rptr = new (std::nothrow) short[arg0]; + int* rptr = new (std::nothrow) int[arg0]; jint rcapacity = arg0; jvalue args[3]; args[0].j = ptr_to_jlong(rptr); args[1].i = rcapacity; - args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_ShortPointer_deallocateArray); + args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_IntPointer_deallocateArray); env->CallNonvirtualVoidMethodA(obj, JavaCPP_getClass(env, 1), JavaCPP_initMID, args); } - JNIEXPORT jint JNICALL Java_com_googlecode_javacpp_IntPointer_get__I(JNIEnv* env, jobject obj, jint arg0) { int* ptr = (int*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); if (ptr == NULL) { @@ -569,19 +581,19 @@ JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_IntPointer_put__II(JNIEnv* ptr[arg0] = arg1; return rarg; } -JNIEXPORT void JNICALL Java_com_googlecode_javacpp_IntPointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { - if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 5))) { + +JNIEXPORT void JNICALL Java_com_googlecode_javacpp_LongPointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { + if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 6))) { return; } - int* rptr = new (std::nothrow) int[arg0]; + jlong* rptr = new (std::nothrow) jlong[arg0]; jint rcapacity = arg0; jvalue args[3]; args[0].j = ptr_to_jlong(rptr); args[1].i = rcapacity; - args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_IntPointer_deallocateArray); + args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_LongPointer_deallocateArray); env->CallNonvirtualVoidMethodA(obj, JavaCPP_getClass(env, 1), JavaCPP_initMID, args); } - JNIEXPORT jlong JNICALL Java_com_googlecode_javacpp_LongPointer_get__I(JNIEnv* env, jobject obj, jint arg0) { jlong* ptr = (jlong*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); if (ptr == NULL) { @@ -609,7 +621,7 @@ JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_LongPointer_get___3JII(JNI if (arg0 != NULL) env->ReleasePrimitiveArrayCritical(arg0, ptr0, 0); return rarg; } -JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_LongPointer_put__IJ(JNIEnv* env, jobject obj, jint arg0, jlong arg1) { +JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_LongPointer_put___3JII(JNIEnv* env, jobject obj, jlongArray arg0, jint arg1, jint arg2) { jlong* ptr = (jlong*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); if (ptr == NULL) { env->ThrowNew(JavaCPP_getClass(env, 2), "This pointer address is NULL."); @@ -617,11 +629,13 @@ JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_LongPointer_put__IJ(JNIEnv } jint position = env->GetIntField(obj, JavaCPP_positionFID); ptr += position; + jlong* ptr0 = arg0 == NULL ? NULL : (jlong*)env->GetPrimitiveArrayCritical(arg0, NULL); jobject rarg = obj; - ptr[arg0] = arg1; + memcpy(ptr, ptr0 + arg1, arg2 * sizeof(*ptr0)); + if (arg0 != NULL) env->ReleasePrimitiveArrayCritical(arg0, ptr0, 0); return rarg; } -JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_LongPointer_put___3JII(JNIEnv* env, jobject obj, jlongArray arg0, jint arg1, jint arg2) { +JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_LongPointer_put__IJ(JNIEnv* env, jobject obj, jint arg0, jlong arg1) { jlong* ptr = (jlong*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); if (ptr == NULL) { env->ThrowNew(JavaCPP_getClass(env, 2), "This pointer address is NULL."); @@ -629,25 +643,23 @@ JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_LongPointer_put___3JII(JNI } jint position = env->GetIntField(obj, JavaCPP_positionFID); ptr += position; - jlong* ptr0 = arg0 == NULL ? NULL : (jlong*)env->GetPrimitiveArrayCritical(arg0, NULL); jobject rarg = obj; - memcpy(ptr, ptr0 + arg1, arg2 * sizeof(*ptr0)); - if (arg0 != NULL) env->ReleasePrimitiveArrayCritical(arg0, ptr0, 0); + ptr[arg0] = arg1; return rarg; } -JNIEXPORT void JNICALL Java_com_googlecode_javacpp_LongPointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { - if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 6))) { + +JNIEXPORT void JNICALL Java_com_googlecode_javacpp_FloatPointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { + if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 7))) { return; } - jlong* rptr = new (std::nothrow) jlong[arg0]; + float* rptr = new (std::nothrow) float[arg0]; jint rcapacity = arg0; jvalue args[3]; args[0].j = ptr_to_jlong(rptr); args[1].i = rcapacity; - args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_LongPointer_deallocateArray); + args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_FloatPointer_deallocateArray); env->CallNonvirtualVoidMethodA(obj, JavaCPP_getClass(env, 1), JavaCPP_initMID, args); } - JNIEXPORT jfloat JNICALL Java_com_googlecode_javacpp_FloatPointer_get__I(JNIEnv* env, jobject obj, jint arg0) { float* ptr = (float*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); if (ptr == NULL) { @@ -675,7 +687,7 @@ JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_FloatPointer_get___3FII(JN if (arg0 != NULL) env->ReleasePrimitiveArrayCritical(arg0, ptr0, 0); return rarg; } -JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_FloatPointer_put__IF(JNIEnv* env, jobject obj, jint arg0, jfloat arg1) { +JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_FloatPointer_put___3FII(JNIEnv* env, jobject obj, jfloatArray arg0, jint arg1, jint arg2) { float* ptr = (float*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); if (ptr == NULL) { env->ThrowNew(JavaCPP_getClass(env, 2), "This pointer address is NULL."); @@ -683,11 +695,13 @@ JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_FloatPointer_put__IF(JNIEn } jint position = env->GetIntField(obj, JavaCPP_positionFID); ptr += position; + float* ptr0 = arg0 == NULL ? NULL : (jfloat*)env->GetPrimitiveArrayCritical(arg0, NULL); jobject rarg = obj; - ptr[arg0] = arg1; + memcpy(ptr, ptr0 + arg1, arg2 * sizeof(*ptr0)); + if (arg0 != NULL) env->ReleasePrimitiveArrayCritical(arg0, ptr0, 0); return rarg; } -JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_FloatPointer_put___3FII(JNIEnv* env, jobject obj, jfloatArray arg0, jint arg1, jint arg2) { +JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_FloatPointer_put__IF(JNIEnv* env, jobject obj, jint arg0, jfloat arg1) { float* ptr = (float*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); if (ptr == NULL) { env->ThrowNew(JavaCPP_getClass(env, 2), "This pointer address is NULL."); @@ -695,25 +709,23 @@ JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_FloatPointer_put___3FII(JN } jint position = env->GetIntField(obj, JavaCPP_positionFID); ptr += position; - float* ptr0 = arg0 == NULL ? NULL : (jfloat*)env->GetPrimitiveArrayCritical(arg0, NULL); jobject rarg = obj; - memcpy(ptr, ptr0 + arg1, arg2 * sizeof(*ptr0)); - if (arg0 != NULL) env->ReleasePrimitiveArrayCritical(arg0, ptr0, 0); + ptr[arg0] = arg1; return rarg; } -JNIEXPORT void JNICALL Java_com_googlecode_javacpp_FloatPointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { - if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 7))) { + +JNIEXPORT void JNICALL Java_com_googlecode_javacpp_DoublePointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { + if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 8))) { return; } - float* rptr = new (std::nothrow) float[arg0]; + double* rptr = new (std::nothrow) double[arg0]; jint rcapacity = arg0; jvalue args[3]; args[0].j = ptr_to_jlong(rptr); args[1].i = rcapacity; - args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_FloatPointer_deallocateArray); + args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_DoublePointer_deallocateArray); env->CallNonvirtualVoidMethodA(obj, JavaCPP_getClass(env, 1), JavaCPP_initMID, args); } - JNIEXPORT jdouble JNICALL Java_com_googlecode_javacpp_DoublePointer_get__I(JNIEnv* env, jobject obj, jint arg0) { double* ptr = (double*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); if (ptr == NULL) { @@ -741,7 +753,7 @@ JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_DoublePointer_get___3DII(J if (arg0 != NULL) env->ReleasePrimitiveArrayCritical(arg0, ptr0, 0); return rarg; } -JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_DoublePointer_put__ID(JNIEnv* env, jobject obj, jint arg0, jdouble arg1) { +JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_DoublePointer_put___3DII(JNIEnv* env, jobject obj, jdoubleArray arg0, jint arg1, jint arg2) { double* ptr = (double*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); if (ptr == NULL) { env->ThrowNew(JavaCPP_getClass(env, 2), "This pointer address is NULL."); @@ -749,11 +761,13 @@ JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_DoublePointer_put__ID(JNIE } jint position = env->GetIntField(obj, JavaCPP_positionFID); ptr += position; + double* ptr0 = arg0 == NULL ? NULL : (jdouble*)env->GetPrimitiveArrayCritical(arg0, NULL); jobject rarg = obj; - ptr[arg0] = arg1; + memcpy(ptr, ptr0 + arg1, arg2 * sizeof(*ptr0)); + if (arg0 != NULL) env->ReleasePrimitiveArrayCritical(arg0, ptr0, 0); return rarg; } -JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_DoublePointer_put___3DII(JNIEnv* env, jobject obj, jdoubleArray arg0, jint arg1, jint arg2) { +JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_DoublePointer_put__ID(JNIEnv* env, jobject obj, jint arg0, jdouble arg1) { double* ptr = (double*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); if (ptr == NULL) { env->ThrowNew(JavaCPP_getClass(env, 2), "This pointer address is NULL."); @@ -761,25 +775,23 @@ JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_DoublePointer_put___3DII(J } jint position = env->GetIntField(obj, JavaCPP_positionFID); ptr += position; - double* ptr0 = arg0 == NULL ? NULL : (jdouble*)env->GetPrimitiveArrayCritical(arg0, NULL); jobject rarg = obj; - memcpy(ptr, ptr0 + arg1, arg2 * sizeof(*ptr0)); - if (arg0 != NULL) env->ReleasePrimitiveArrayCritical(arg0, ptr0, 0); + ptr[arg0] = arg1; return rarg; } -JNIEXPORT void JNICALL Java_com_googlecode_javacpp_DoublePointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { - if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 8))) { + +JNIEXPORT void JNICALL Java_com_googlecode_javacpp_CharPointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { + if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 9))) { return; } - double* rptr = new (std::nothrow) double[arg0]; + unsigned short* rptr = new (std::nothrow) unsigned short[arg0]; jint rcapacity = arg0; jvalue args[3]; args[0].j = ptr_to_jlong(rptr); args[1].i = rcapacity; - args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_DoublePointer_deallocateArray); + args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_CharPointer_deallocateArray); env->CallNonvirtualVoidMethodA(obj, JavaCPP_getClass(env, 1), JavaCPP_initMID, args); } - JNIEXPORT jchar JNICALL Java_com_googlecode_javacpp_CharPointer_get__I(JNIEnv* env, jobject obj, jint arg0) { unsigned short* ptr = (unsigned short*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); if (ptr == NULL) { @@ -833,19 +845,19 @@ JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_CharPointer_put__IC(JNIEnv ptr[arg0] = arg1; return rarg; } -JNIEXPORT void JNICALL Java_com_googlecode_javacpp_CharPointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { - if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 9))) { + +JNIEXPORT void JNICALL Java_com_googlecode_javacpp_PointerPointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { + if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 10))) { return; } - unsigned short* rptr = new (std::nothrow) unsigned short[arg0]; + void** rptr = new (std::nothrow) void*[arg0]; jint rcapacity = arg0; jvalue args[3]; args[0].j = ptr_to_jlong(rptr); args[1].i = rcapacity; - args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_CharPointer_deallocateArray); + args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_PointerPointer_deallocateArray); env->CallNonvirtualVoidMethodA(obj, JavaCPP_getClass(env, 1), JavaCPP_initMID, args); } - JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_PointerPointer_get(JNIEnv* env, jobject obj, jint arg0) { void** ptr = (void**)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); if (ptr == NULL) { @@ -878,19 +890,19 @@ JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_PointerPointer_put(JNIEnv* ptr[arg0] = ptr1; return rarg; } -JNIEXPORT void JNICALL Java_com_googlecode_javacpp_PointerPointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { - if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 10))) { + +JNIEXPORT void JNICALL Java_com_googlecode_javacpp_BoolPointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { + if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 11))) { return; } - void** rptr = new (std::nothrow) void*[arg0]; + bool* rptr = new (std::nothrow) bool[arg0]; jint rcapacity = arg0; jvalue args[3]; args[0].j = ptr_to_jlong(rptr); args[1].i = rcapacity; - args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_PointerPointer_deallocateArray); + args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_BoolPointer_deallocateArray); env->CallNonvirtualVoidMethodA(obj, JavaCPP_getClass(env, 1), JavaCPP_initMID, args); } - JNIEXPORT jboolean JNICALL Java_com_googlecode_javacpp_BoolPointer_get(JNIEnv* env, jobject obj, jint arg0) { bool* ptr = (bool*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); if (ptr == NULL) { @@ -916,19 +928,19 @@ JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_BoolPointer_put(JNIEnv* en ptr[arg0] = (bool)arg1; return rarg; } -JNIEXPORT void JNICALL Java_com_googlecode_javacpp_BoolPointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { - if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 11))) { + +JNIEXPORT void JNICALL Java_com_googlecode_javacpp_CLongPointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { + if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 12))) { return; } - bool* rptr = new (std::nothrow) bool[arg0]; + long* rptr = new (std::nothrow) long[arg0]; jint rcapacity = arg0; jvalue args[3]; args[0].j = ptr_to_jlong(rptr); args[1].i = rcapacity; - args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_BoolPointer_deallocateArray); + args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_CLongPointer_deallocateArray); env->CallNonvirtualVoidMethodA(obj, JavaCPP_getClass(env, 1), JavaCPP_initMID, args); } - JNIEXPORT jlong JNICALL Java_com_googlecode_javacpp_CLongPointer_get(JNIEnv* env, jobject obj, jint arg0) { long* ptr = (long*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); if (ptr == NULL) { @@ -954,19 +966,19 @@ JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_CLongPointer_put(JNIEnv* e ptr[arg0] = (long)arg1; return rarg; } -JNIEXPORT void JNICALL Java_com_googlecode_javacpp_CLongPointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { - if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 12))) { + +JNIEXPORT void JNICALL Java_com_googlecode_javacpp_SizeTPointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { + if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 13))) { return; } - long* rptr = new (std::nothrow) long[arg0]; + size_t* rptr = new (std::nothrow) size_t[arg0]; jint rcapacity = arg0; jvalue args[3]; args[0].j = ptr_to_jlong(rptr); args[1].i = rcapacity; - args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_CLongPointer_deallocateArray); + args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_SizeTPointer_deallocateArray); env->CallNonvirtualVoidMethodA(obj, JavaCPP_getClass(env, 1), JavaCPP_initMID, args); } - JNIEXPORT jlong JNICALL Java_com_googlecode_javacpp_SizeTPointer_get(JNIEnv* env, jobject obj, jint arg0) { size_t* ptr = (size_t*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); if (ptr == NULL) { @@ -992,37 +1004,7 @@ JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_SizeTPointer_put(JNIEnv* e ptr[arg0] = (size_t)arg1; return rarg; } -JNIEXPORT void JNICALL Java_com_googlecode_javacpp_SizeTPointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { - if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 13))) { - return; - } - size_t* rptr = new (std::nothrow) size_t[arg0]; - jint rcapacity = arg0; - jvalue args[3]; - args[0].j = ptr_to_jlong(rptr); - args[1].i = rcapacity; - args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_SizeTPointer_deallocateArray); - env->CallNonvirtualVoidMethodA(obj, JavaCPP_getClass(env, 1), JavaCPP_initMID, args); -} - -JNIEXPORT jint JNICALL Java_com_morlunk_jumble_audio_javacpp_Opus_opus_1packet_1get_1nb_1channels(JNIEnv* env, jclass cls, jobject arg0) { - signed char* ptr0 = arg0 == NULL ? NULL : (signed char*)jlong_to_ptr(env->GetLongField(arg0, JavaCPP_addressFID)); - jint position0 = arg0 == NULL ? 0 : env->GetIntField(arg0, JavaCPP_positionFID); - ptr0 += position0; - jint rarg = 0; - jthrowable exc = NULL; - try { - int rvalue = opus_packet_get_nb_channels((const unsigned char*)ptr0); - rarg = (jint)rvalue; - } catch (...) { - exc = JavaCPP_handleException(env, 14); - } - if (exc != NULL) { - env->Throw(exc); - } - return rarg; -} JNIEXPORT jint JNICALL Java_com_morlunk_jumble_audio_javacpp_Opus_opus_1packet_1get_1nb_1frames(JNIEnv* env, jclass cls, jobject arg0, jint arg1) { signed char* ptr0 = arg0 == NULL ? NULL : (signed char*)jlong_to_ptr(env->GetLongField(arg0, JavaCPP_addressFID)); jint position0 = arg0 == NULL ? 0 : env->GetIntField(arg0, JavaCPP_positionFID); @@ -1136,16 +1118,12 @@ JNIEXPORT jint JNICALL Java_com_morlunk_jumble_audio_javacpp_Opus_opus_1encode(J } return rarg; } -JNIEXPORT jint JNICALL Java_com_morlunk_jumble_audio_javacpp_Opus_opus_1encode_1float(JNIEnv* env, jclass cls, jobject arg0, jobject arg1, jint arg2, jobject arg3, jint arg4) { +JNIEXPORT jint JNICALL Java_com_morlunk_jumble_audio_javacpp_Opus_opus_1encode_1float(JNIEnv* env, jclass cls, jobject arg0, jfloatArray arg1, jint arg2, jbyteArray arg3, jint arg4) { char* ptr0 = arg0 == NULL ? NULL : (char*)jlong_to_ptr(env->GetLongField(arg0, JavaCPP_addressFID)); jint position0 = arg0 == NULL ? 0 : env->GetIntField(arg0, JavaCPP_positionFID); ptr0 += position0; - float* ptr1 = arg1 == NULL ? NULL : (float*)jlong_to_ptr(env->GetLongField(arg1, JavaCPP_addressFID)); - jint position1 = arg1 == NULL ? 0 : env->GetIntField(arg1, JavaCPP_positionFID); - ptr1 += position1; - signed char* ptr3 = arg3 == NULL ? NULL : (signed char*)jlong_to_ptr(env->GetLongField(arg3, JavaCPP_addressFID)); - jint position3 = arg3 == NULL ? 0 : env->GetIntField(arg3, JavaCPP_positionFID); - ptr3 += position3; + float* ptr1 = arg1 == NULL ? NULL : env->GetFloatArrayElements(arg1, NULL); + signed char* ptr3 = arg3 == NULL ? NULL : env->GetByteArrayElements(arg3, NULL); jint rarg = 0; jthrowable exc = NULL; try { @@ -1155,6 +1133,8 @@ JNIEXPORT jint JNICALL Java_com_morlunk_jumble_audio_javacpp_Opus_opus_1encode_1 exc = JavaCPP_handleException(env, 14); } + if (arg1 != NULL) env->ReleaseFloatArrayElements(arg1, (jfloat*)ptr1, 0); + if (arg3 != NULL) env->ReleaseByteArrayElements(arg3, (jbyte*)ptr3, 0); if (exc != NULL) { env->Throw(exc); } @@ -1251,16 +1231,12 @@ JNIEXPORT jint JNICALL Java_com_morlunk_jumble_audio_javacpp_Opus_opus_1decoder_ } return rarg; } -JNIEXPORT jint JNICALL Java_com_morlunk_jumble_audio_javacpp_Opus_opus_1decode(JNIEnv* env, jclass cls, jobject arg0, jobject arg1, jint arg2, jobject arg3, jint arg4, jint arg5) { +JNIEXPORT jint JNICALL Java_com_morlunk_jumble_audio_javacpp_Opus_opus_1decode(JNIEnv* env, jclass cls, jobject arg0, jbyteArray arg1, jint arg2, jshortArray arg3, jint arg4, jint arg5) { char* ptr0 = arg0 == NULL ? NULL : (char*)jlong_to_ptr(env->GetLongField(arg0, JavaCPP_addressFID)); jint position0 = arg0 == NULL ? 0 : env->GetIntField(arg0, JavaCPP_positionFID); ptr0 += position0; - signed char* ptr1 = arg1 == NULL ? NULL : (signed char*)jlong_to_ptr(env->GetLongField(arg1, JavaCPP_addressFID)); - jint position1 = arg1 == NULL ? 0 : env->GetIntField(arg1, JavaCPP_positionFID); - ptr1 += position1; - short* ptr3 = arg3 == NULL ? NULL : (short*)jlong_to_ptr(env->GetLongField(arg3, JavaCPP_addressFID)); - jint position3 = arg3 == NULL ? 0 : env->GetIntField(arg3, JavaCPP_positionFID); - ptr3 += position3; + signed char* ptr1 = arg1 == NULL ? NULL : env->GetByteArrayElements(arg1, NULL); + short* ptr3 = arg3 == NULL ? NULL : env->GetShortArrayElements(arg3, NULL); jint rarg = 0; jthrowable exc = NULL; try { @@ -1270,21 +1246,19 @@ JNIEXPORT jint JNICALL Java_com_morlunk_jumble_audio_javacpp_Opus_opus_1decode(J exc = JavaCPP_handleException(env, 14); } + if (arg1 != NULL) env->ReleaseByteArrayElements(arg1, (jbyte*)ptr1, 0); + if (arg3 != NULL) env->ReleaseShortArrayElements(arg3, (jshort*)ptr3, 0); if (exc != NULL) { env->Throw(exc); } return rarg; } -JNIEXPORT jint JNICALL Java_com_morlunk_jumble_audio_javacpp_Opus_opus_1decode_1float(JNIEnv* env, jclass cls, jobject arg0, jobject arg1, jint arg2, jobject arg3, jint arg4, jint arg5) { +JNIEXPORT jint JNICALL Java_com_morlunk_jumble_audio_javacpp_Opus_opus_1decode_1float(JNIEnv* env, jclass cls, jobject arg0, jbyteArray arg1, jint arg2, jfloatArray arg3, jint arg4, jint arg5) { char* ptr0 = arg0 == NULL ? NULL : (char*)jlong_to_ptr(env->GetLongField(arg0, JavaCPP_addressFID)); jint position0 = arg0 == NULL ? 0 : env->GetIntField(arg0, JavaCPP_positionFID); ptr0 += position0; - signed char* ptr1 = arg1 == NULL ? NULL : (signed char*)jlong_to_ptr(env->GetLongField(arg1, JavaCPP_addressFID)); - jint position1 = arg1 == NULL ? 0 : env->GetIntField(arg1, JavaCPP_positionFID); - ptr1 += position1; - float* ptr3 = arg3 == NULL ? NULL : (float*)jlong_to_ptr(env->GetLongField(arg3, JavaCPP_addressFID)); - jint position3 = arg3 == NULL ? 0 : env->GetIntField(arg3, JavaCPP_positionFID); - ptr3 += position3; + signed char* ptr1 = arg1 == NULL ? NULL : env->GetByteArrayElements(arg1, NULL); + float* ptr3 = arg3 == NULL ? NULL : env->GetFloatArrayElements(arg3, NULL); jint rarg = 0; jthrowable exc = NULL; try { @@ -1294,6 +1268,8 @@ JNIEXPORT jint JNICALL Java_com_morlunk_jumble_audio_javacpp_Opus_opus_1decode_1 exc = JavaCPP_handleException(env, 14); } + if (arg1 != NULL) env->ReleaseByteArrayElements(arg1, (jbyte*)ptr1, 0); + if (arg3 != NULL) env->ReleaseFloatArrayElements(arg3, (jfloat*)ptr3, 0); if (exc != NULL) { env->Throw(exc); } @@ -1350,6 +1326,24 @@ JNIEXPORT jint JNICALL Java_com_morlunk_jumble_audio_javacpp_Opus_opus_1packet_1 } return rarg; } +JNIEXPORT jint JNICALL Java_com_morlunk_jumble_audio_javacpp_Opus_opus_1packet_1get_1nb_1channels(JNIEnv* env, jclass cls, jobject arg0) { + signed char* ptr0 = arg0 == NULL ? NULL : (signed char*)jlong_to_ptr(env->GetLongField(arg0, JavaCPP_addressFID)); + jint position0 = arg0 == NULL ? 0 : env->GetIntField(arg0, JavaCPP_positionFID); + ptr0 += position0; + jint rarg = 0; + jthrowable exc = NULL; + try { + int rvalue = opus_packet_get_nb_channels((const unsigned char*)ptr0); + rarg = (jint)rvalue; + } catch (...) { + exc = JavaCPP_handleException(env, 14); + } + + if (exc != NULL) { + env->Throw(exc); + } + return rarg; +} } diff --git a/src/main/jni/speex.cpp b/src/main/jni/speex.cpp index c8c4974..ae36a1b 100644 --- a/src/main/jni/speex.cpp +++ b/src/main/jni/speex.cpp @@ -191,7 +191,7 @@ JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void* reserved) { { "sizeof" }, { "sizeof" }, { "sizeof" }, - { "sizeof", "len", "timestamp", "data", "sequence", "span" }, + { "sizeof", "timestamp", "data", "sequence", "span", "len" }, { } }; int offsets[16][6] = { { }, @@ -208,7 +208,7 @@ JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void* reserved) { { sizeof(bool) }, { sizeof(long) }, { sizeof(size_t) }, - { sizeof(::_JitterBufferPacket), offsetof(::_JitterBufferPacket,len), offsetof(::_JitterBufferPacket,timestamp), offsetof(::_JitterBufferPacket,data), offsetof(::_JitterBufferPacket,sequence), offsetof(::_JitterBufferPacket,span) }, + { sizeof(::_JitterBufferPacket), offsetof(::_JitterBufferPacket,timestamp), offsetof(::_JitterBufferPacket,data), offsetof(::_JitterBufferPacket,sequence), offsetof(::_JitterBufferPacket,span), offsetof(::_JitterBufferPacket,len) }, { } }; int memberOffsetSizes[16] = { 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6, 0 }; jmethodID putMemberOffsetMID = env->GetStaticMethodID(JavaCPP_getClass(env, 0), "putMemberOffset", "(Ljava/lang/String;Ljava/lang/String;I)V"); @@ -281,14 +281,6 @@ JNIEXPORT void JNICALL Java_com_googlecode_javacpp_Pointer_00024NativeDeallocato -JNIEXPORT void JNICALL Java_com_googlecode_javacpp_Pointer_allocate(JNIEnv* env, jobject obj, jobject arg0) { - char* ptr0 = arg0 == NULL ? NULL : (char*)env->GetDirectBufferAddress(arg0); - void* rptr = ptr0; - jint rcapacity = 1; - env->SetLongField(obj, JavaCPP_addressFID, ptr_to_jlong(rptr)); - env->SetIntField(obj, JavaCPP_limitFID, rcapacity); - env->SetIntField(obj, JavaCPP_capacityFID, rcapacity); -} JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_Pointer_asDirectBuffer(JNIEnv* env, jobject obj) { char* ptr = (char*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); if (ptr == NULL) { @@ -390,8 +382,28 @@ JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_Pointer_memset(JNIEnv* env } return rarg; } +JNIEXPORT void JNICALL Java_com_googlecode_javacpp_Pointer_allocate(JNIEnv* env, jobject obj, jobject arg0) { + char* ptr0 = arg0 == NULL ? NULL : (char*)env->GetDirectBufferAddress(arg0); + void* rptr = ptr0; + jint rcapacity = 1; + env->SetLongField(obj, JavaCPP_addressFID, ptr_to_jlong(rptr)); + env->SetIntField(obj, JavaCPP_limitFID, rcapacity); + env->SetIntField(obj, JavaCPP_capacityFID, rcapacity); +} -JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_BytePointer_get___3BII(JNIEnv* env, jobject obj, jbyteArray arg0, jint arg1, jint arg2) { +JNIEXPORT void JNICALL Java_com_googlecode_javacpp_BytePointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { + if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 3))) { + return; + } + signed char* rptr = new (std::nothrow) signed char[arg0]; + jint rcapacity = arg0; + jvalue args[3]; + args[0].j = ptr_to_jlong(rptr); + args[1].i = rcapacity; + args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_BytePointer_deallocateArray); + env->CallNonvirtualVoidMethodA(obj, JavaCPP_getClass(env, 1), JavaCPP_initMID, args); +} +JNIEXPORT jbyte JNICALL Java_com_googlecode_javacpp_BytePointer_get__I(JNIEnv* env, jobject obj, jint arg0) { signed char* ptr = (signed char*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); if (ptr == NULL) { env->ThrowNew(JavaCPP_getClass(env, 2), "This pointer address is NULL."); @@ -399,13 +411,12 @@ JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_BytePointer_get___3BII(JNI } jint position = env->GetIntField(obj, JavaCPP_positionFID); ptr += position; - signed char* ptr0 = arg0 == NULL ? NULL : (jbyte*)env->GetPrimitiveArrayCritical(arg0, NULL); - jobject rarg = obj; - memcpy(ptr0 + arg1, ptr, arg2 * sizeof(*ptr0)); - if (arg0 != NULL) env->ReleasePrimitiveArrayCritical(arg0, ptr0, 0); + jbyte rarg = 0; + signed char rvalue = ptr[arg0]; + rarg = (jbyte)rvalue; return rarg; } -JNIEXPORT jbyte JNICALL Java_com_googlecode_javacpp_BytePointer_get__I(JNIEnv* env, jobject obj, jint arg0) { +JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_BytePointer_get___3BII(JNIEnv* env, jobject obj, jbyteArray arg0, jint arg1, jint arg2) { signed char* ptr = (signed char*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); if (ptr == NULL) { env->ThrowNew(JavaCPP_getClass(env, 2), "This pointer address is NULL."); @@ -413,9 +424,10 @@ JNIEXPORT jbyte JNICALL Java_com_googlecode_javacpp_BytePointer_get__I(JNIEnv* e } jint position = env->GetIntField(obj, JavaCPP_positionFID); ptr += position; - jbyte rarg = 0; - signed char rvalue = ptr[arg0]; - rarg = (jbyte)rvalue; + signed char* ptr0 = arg0 == NULL ? NULL : (jbyte*)env->GetPrimitiveArrayCritical(arg0, NULL); + jobject rarg = obj; + memcpy(ptr0 + arg1, ptr, arg2 * sizeof(*ptr0)); + if (arg0 != NULL) env->ReleasePrimitiveArrayCritical(arg0, ptr0, 0); return rarg; } JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_BytePointer_put__IB(JNIEnv* env, jobject obj, jint arg0, jbyte arg1) { @@ -444,19 +456,19 @@ JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_BytePointer_put___3BII(JNI if (arg0 != NULL) env->ReleasePrimitiveArrayCritical(arg0, ptr0, 0); return rarg; } -JNIEXPORT void JNICALL Java_com_googlecode_javacpp_BytePointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { - if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 3))) { + +JNIEXPORT void JNICALL Java_com_googlecode_javacpp_ShortPointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { + if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 4))) { return; } - signed char* rptr = new (std::nothrow) signed char[arg0]; + short* rptr = new (std::nothrow) short[arg0]; jint rcapacity = arg0; jvalue args[3]; args[0].j = ptr_to_jlong(rptr); args[1].i = rcapacity; - args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_BytePointer_deallocateArray); + args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_ShortPointer_deallocateArray); env->CallNonvirtualVoidMethodA(obj, JavaCPP_getClass(env, 1), JavaCPP_initMID, args); } - JNIEXPORT jshort JNICALL Java_com_googlecode_javacpp_ShortPointer_get__I(JNIEnv* env, jobject obj, jint arg0) { short* ptr = (short*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); if (ptr == NULL) { @@ -484,7 +496,7 @@ JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_ShortPointer_get___3SII(JN if (arg0 != NULL) env->ReleasePrimitiveArrayCritical(arg0, ptr0, 0); return rarg; } -JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_ShortPointer_put__IS(JNIEnv* env, jobject obj, jint arg0, jshort arg1) { +JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_ShortPointer_put___3SII(JNIEnv* env, jobject obj, jshortArray arg0, jint arg1, jint arg2) { short* ptr = (short*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); if (ptr == NULL) { env->ThrowNew(JavaCPP_getClass(env, 2), "This pointer address is NULL."); @@ -492,11 +504,13 @@ JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_ShortPointer_put__IS(JNIEn } jint position = env->GetIntField(obj, JavaCPP_positionFID); ptr += position; + short* ptr0 = arg0 == NULL ? NULL : (jshort*)env->GetPrimitiveArrayCritical(arg0, NULL); jobject rarg = obj; - ptr[arg0] = arg1; + memcpy(ptr, ptr0 + arg1, arg2 * sizeof(*ptr0)); + if (arg0 != NULL) env->ReleasePrimitiveArrayCritical(arg0, ptr0, 0); return rarg; } -JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_ShortPointer_put___3SII(JNIEnv* env, jobject obj, jshortArray arg0, jint arg1, jint arg2) { +JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_ShortPointer_put__IS(JNIEnv* env, jobject obj, jint arg0, jshort arg1) { short* ptr = (short*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); if (ptr == NULL) { env->ThrowNew(JavaCPP_getClass(env, 2), "This pointer address is NULL."); @@ -504,25 +518,23 @@ JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_ShortPointer_put___3SII(JN } jint position = env->GetIntField(obj, JavaCPP_positionFID); ptr += position; - short* ptr0 = arg0 == NULL ? NULL : (jshort*)env->GetPrimitiveArrayCritical(arg0, NULL); jobject rarg = obj; - memcpy(ptr, ptr0 + arg1, arg2 * sizeof(*ptr0)); - if (arg0 != NULL) env->ReleasePrimitiveArrayCritical(arg0, ptr0, 0); + ptr[arg0] = arg1; return rarg; } -JNIEXPORT void JNICALL Java_com_googlecode_javacpp_ShortPointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { - if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 4))) { + +JNIEXPORT void JNICALL Java_com_googlecode_javacpp_IntPointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { + if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 5))) { return; } - short* rptr = new (std::nothrow) short[arg0]; + int* rptr = new (std::nothrow) int[arg0]; jint rcapacity = arg0; jvalue args[3]; args[0].j = ptr_to_jlong(rptr); args[1].i = rcapacity; - args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_ShortPointer_deallocateArray); + args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_IntPointer_deallocateArray); env->CallNonvirtualVoidMethodA(obj, JavaCPP_getClass(env, 1), JavaCPP_initMID, args); } - JNIEXPORT jint JNICALL Java_com_googlecode_javacpp_IntPointer_get__I(JNIEnv* env, jobject obj, jint arg0) { int* ptr = (int*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); if (ptr == NULL) { @@ -576,19 +588,19 @@ JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_IntPointer_put__II(JNIEnv* ptr[arg0] = arg1; return rarg; } -JNIEXPORT void JNICALL Java_com_googlecode_javacpp_IntPointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { - if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 5))) { + +JNIEXPORT void JNICALL Java_com_googlecode_javacpp_LongPointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { + if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 6))) { return; } - int* rptr = new (std::nothrow) int[arg0]; + jlong* rptr = new (std::nothrow) jlong[arg0]; jint rcapacity = arg0; jvalue args[3]; args[0].j = ptr_to_jlong(rptr); args[1].i = rcapacity; - args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_IntPointer_deallocateArray); + args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_LongPointer_deallocateArray); env->CallNonvirtualVoidMethodA(obj, JavaCPP_getClass(env, 1), JavaCPP_initMID, args); } - JNIEXPORT jlong JNICALL Java_com_googlecode_javacpp_LongPointer_get__I(JNIEnv* env, jobject obj, jint arg0) { jlong* ptr = (jlong*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); if (ptr == NULL) { @@ -616,7 +628,7 @@ JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_LongPointer_get___3JII(JNI if (arg0 != NULL) env->ReleasePrimitiveArrayCritical(arg0, ptr0, 0); return rarg; } -JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_LongPointer_put__IJ(JNIEnv* env, jobject obj, jint arg0, jlong arg1) { +JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_LongPointer_put___3JII(JNIEnv* env, jobject obj, jlongArray arg0, jint arg1, jint arg2) { jlong* ptr = (jlong*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); if (ptr == NULL) { env->ThrowNew(JavaCPP_getClass(env, 2), "This pointer address is NULL."); @@ -624,11 +636,13 @@ JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_LongPointer_put__IJ(JNIEnv } jint position = env->GetIntField(obj, JavaCPP_positionFID); ptr += position; + jlong* ptr0 = arg0 == NULL ? NULL : (jlong*)env->GetPrimitiveArrayCritical(arg0, NULL); jobject rarg = obj; - ptr[arg0] = arg1; + memcpy(ptr, ptr0 + arg1, arg2 * sizeof(*ptr0)); + if (arg0 != NULL) env->ReleasePrimitiveArrayCritical(arg0, ptr0, 0); return rarg; } -JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_LongPointer_put___3JII(JNIEnv* env, jobject obj, jlongArray arg0, jint arg1, jint arg2) { +JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_LongPointer_put__IJ(JNIEnv* env, jobject obj, jint arg0, jlong arg1) { jlong* ptr = (jlong*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); if (ptr == NULL) { env->ThrowNew(JavaCPP_getClass(env, 2), "This pointer address is NULL."); @@ -636,25 +650,23 @@ JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_LongPointer_put___3JII(JNI } jint position = env->GetIntField(obj, JavaCPP_positionFID); ptr += position; - jlong* ptr0 = arg0 == NULL ? NULL : (jlong*)env->GetPrimitiveArrayCritical(arg0, NULL); jobject rarg = obj; - memcpy(ptr, ptr0 + arg1, arg2 * sizeof(*ptr0)); - if (arg0 != NULL) env->ReleasePrimitiveArrayCritical(arg0, ptr0, 0); + ptr[arg0] = arg1; return rarg; } -JNIEXPORT void JNICALL Java_com_googlecode_javacpp_LongPointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { - if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 6))) { + +JNIEXPORT void JNICALL Java_com_googlecode_javacpp_FloatPointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { + if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 7))) { return; } - jlong* rptr = new (std::nothrow) jlong[arg0]; + float* rptr = new (std::nothrow) float[arg0]; jint rcapacity = arg0; jvalue args[3]; args[0].j = ptr_to_jlong(rptr); args[1].i = rcapacity; - args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_LongPointer_deallocateArray); + args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_FloatPointer_deallocateArray); env->CallNonvirtualVoidMethodA(obj, JavaCPP_getClass(env, 1), JavaCPP_initMID, args); } - JNIEXPORT jfloat JNICALL Java_com_googlecode_javacpp_FloatPointer_get__I(JNIEnv* env, jobject obj, jint arg0) { float* ptr = (float*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); if (ptr == NULL) { @@ -682,7 +694,7 @@ JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_FloatPointer_get___3FII(JN if (arg0 != NULL) env->ReleasePrimitiveArrayCritical(arg0, ptr0, 0); return rarg; } -JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_FloatPointer_put__IF(JNIEnv* env, jobject obj, jint arg0, jfloat arg1) { +JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_FloatPointer_put___3FII(JNIEnv* env, jobject obj, jfloatArray arg0, jint arg1, jint arg2) { float* ptr = (float*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); if (ptr == NULL) { env->ThrowNew(JavaCPP_getClass(env, 2), "This pointer address is NULL."); @@ -690,11 +702,13 @@ JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_FloatPointer_put__IF(JNIEn } jint position = env->GetIntField(obj, JavaCPP_positionFID); ptr += position; + float* ptr0 = arg0 == NULL ? NULL : (jfloat*)env->GetPrimitiveArrayCritical(arg0, NULL); jobject rarg = obj; - ptr[arg0] = arg1; + memcpy(ptr, ptr0 + arg1, arg2 * sizeof(*ptr0)); + if (arg0 != NULL) env->ReleasePrimitiveArrayCritical(arg0, ptr0, 0); return rarg; } -JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_FloatPointer_put___3FII(JNIEnv* env, jobject obj, jfloatArray arg0, jint arg1, jint arg2) { +JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_FloatPointer_put__IF(JNIEnv* env, jobject obj, jint arg0, jfloat arg1) { float* ptr = (float*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); if (ptr == NULL) { env->ThrowNew(JavaCPP_getClass(env, 2), "This pointer address is NULL."); @@ -702,25 +716,23 @@ JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_FloatPointer_put___3FII(JN } jint position = env->GetIntField(obj, JavaCPP_positionFID); ptr += position; - float* ptr0 = arg0 == NULL ? NULL : (jfloat*)env->GetPrimitiveArrayCritical(arg0, NULL); jobject rarg = obj; - memcpy(ptr, ptr0 + arg1, arg2 * sizeof(*ptr0)); - if (arg0 != NULL) env->ReleasePrimitiveArrayCritical(arg0, ptr0, 0); + ptr[arg0] = arg1; return rarg; } -JNIEXPORT void JNICALL Java_com_googlecode_javacpp_FloatPointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { - if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 7))) { + +JNIEXPORT void JNICALL Java_com_googlecode_javacpp_DoublePointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { + if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 8))) { return; } - float* rptr = new (std::nothrow) float[arg0]; + double* rptr = new (std::nothrow) double[arg0]; jint rcapacity = arg0; jvalue args[3]; args[0].j = ptr_to_jlong(rptr); args[1].i = rcapacity; - args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_FloatPointer_deallocateArray); + args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_DoublePointer_deallocateArray); env->CallNonvirtualVoidMethodA(obj, JavaCPP_getClass(env, 1), JavaCPP_initMID, args); } - JNIEXPORT jdouble JNICALL Java_com_googlecode_javacpp_DoublePointer_get__I(JNIEnv* env, jobject obj, jint arg0) { double* ptr = (double*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); if (ptr == NULL) { @@ -748,7 +760,7 @@ JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_DoublePointer_get___3DII(J if (arg0 != NULL) env->ReleasePrimitiveArrayCritical(arg0, ptr0, 0); return rarg; } -JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_DoublePointer_put__ID(JNIEnv* env, jobject obj, jint arg0, jdouble arg1) { +JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_DoublePointer_put___3DII(JNIEnv* env, jobject obj, jdoubleArray arg0, jint arg1, jint arg2) { double* ptr = (double*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); if (ptr == NULL) { env->ThrowNew(JavaCPP_getClass(env, 2), "This pointer address is NULL."); @@ -756,11 +768,13 @@ JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_DoublePointer_put__ID(JNIE } jint position = env->GetIntField(obj, JavaCPP_positionFID); ptr += position; + double* ptr0 = arg0 == NULL ? NULL : (jdouble*)env->GetPrimitiveArrayCritical(arg0, NULL); jobject rarg = obj; - ptr[arg0] = arg1; + memcpy(ptr, ptr0 + arg1, arg2 * sizeof(*ptr0)); + if (arg0 != NULL) env->ReleasePrimitiveArrayCritical(arg0, ptr0, 0); return rarg; } -JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_DoublePointer_put___3DII(JNIEnv* env, jobject obj, jdoubleArray arg0, jint arg1, jint arg2) { +JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_DoublePointer_put__ID(JNIEnv* env, jobject obj, jint arg0, jdouble arg1) { double* ptr = (double*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); if (ptr == NULL) { env->ThrowNew(JavaCPP_getClass(env, 2), "This pointer address is NULL."); @@ -768,25 +782,23 @@ JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_DoublePointer_put___3DII(J } jint position = env->GetIntField(obj, JavaCPP_positionFID); ptr += position; - double* ptr0 = arg0 == NULL ? NULL : (jdouble*)env->GetPrimitiveArrayCritical(arg0, NULL); jobject rarg = obj; - memcpy(ptr, ptr0 + arg1, arg2 * sizeof(*ptr0)); - if (arg0 != NULL) env->ReleasePrimitiveArrayCritical(arg0, ptr0, 0); + ptr[arg0] = arg1; return rarg; } -JNIEXPORT void JNICALL Java_com_googlecode_javacpp_DoublePointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { - if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 8))) { + +JNIEXPORT void JNICALL Java_com_googlecode_javacpp_CharPointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { + if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 9))) { return; } - double* rptr = new (std::nothrow) double[arg0]; + unsigned short* rptr = new (std::nothrow) unsigned short[arg0]; jint rcapacity = arg0; jvalue args[3]; args[0].j = ptr_to_jlong(rptr); args[1].i = rcapacity; - args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_DoublePointer_deallocateArray); + args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_CharPointer_deallocateArray); env->CallNonvirtualVoidMethodA(obj, JavaCPP_getClass(env, 1), JavaCPP_initMID, args); } - JNIEXPORT jchar JNICALL Java_com_googlecode_javacpp_CharPointer_get__I(JNIEnv* env, jobject obj, jint arg0) { unsigned short* ptr = (unsigned short*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); if (ptr == NULL) { @@ -840,19 +852,19 @@ JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_CharPointer_put__IC(JNIEnv ptr[arg0] = arg1; return rarg; } -JNIEXPORT void JNICALL Java_com_googlecode_javacpp_CharPointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { - if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 9))) { + +JNIEXPORT void JNICALL Java_com_googlecode_javacpp_PointerPointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { + if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 10))) { return; } - unsigned short* rptr = new (std::nothrow) unsigned short[arg0]; + void** rptr = new (std::nothrow) void*[arg0]; jint rcapacity = arg0; jvalue args[3]; args[0].j = ptr_to_jlong(rptr); args[1].i = rcapacity; - args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_CharPointer_deallocateArray); + args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_PointerPointer_deallocateArray); env->CallNonvirtualVoidMethodA(obj, JavaCPP_getClass(env, 1), JavaCPP_initMID, args); } - JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_PointerPointer_get(JNIEnv* env, jobject obj, jint arg0) { void** ptr = (void**)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); if (ptr == NULL) { @@ -885,19 +897,19 @@ JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_PointerPointer_put(JNIEnv* ptr[arg0] = ptr1; return rarg; } -JNIEXPORT void JNICALL Java_com_googlecode_javacpp_PointerPointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { - if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 10))) { + +JNIEXPORT void JNICALL Java_com_googlecode_javacpp_BoolPointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { + if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 11))) { return; } - void** rptr = new (std::nothrow) void*[arg0]; + bool* rptr = new (std::nothrow) bool[arg0]; jint rcapacity = arg0; jvalue args[3]; args[0].j = ptr_to_jlong(rptr); args[1].i = rcapacity; - args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_PointerPointer_deallocateArray); + args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_BoolPointer_deallocateArray); env->CallNonvirtualVoidMethodA(obj, JavaCPP_getClass(env, 1), JavaCPP_initMID, args); } - JNIEXPORT jboolean JNICALL Java_com_googlecode_javacpp_BoolPointer_get(JNIEnv* env, jobject obj, jint arg0) { bool* ptr = (bool*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); if (ptr == NULL) { @@ -923,19 +935,19 @@ JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_BoolPointer_put(JNIEnv* en ptr[arg0] = (bool)arg1; return rarg; } -JNIEXPORT void JNICALL Java_com_googlecode_javacpp_BoolPointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { - if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 11))) { + +JNIEXPORT void JNICALL Java_com_googlecode_javacpp_CLongPointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { + if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 12))) { return; } - bool* rptr = new (std::nothrow) bool[arg0]; + long* rptr = new (std::nothrow) long[arg0]; jint rcapacity = arg0; jvalue args[3]; args[0].j = ptr_to_jlong(rptr); args[1].i = rcapacity; - args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_BoolPointer_deallocateArray); + args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_CLongPointer_deallocateArray); env->CallNonvirtualVoidMethodA(obj, JavaCPP_getClass(env, 1), JavaCPP_initMID, args); } - JNIEXPORT jlong JNICALL Java_com_googlecode_javacpp_CLongPointer_get(JNIEnv* env, jobject obj, jint arg0) { long* ptr = (long*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); if (ptr == NULL) { @@ -961,19 +973,19 @@ JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_CLongPointer_put(JNIEnv* e ptr[arg0] = (long)arg1; return rarg; } -JNIEXPORT void JNICALL Java_com_googlecode_javacpp_CLongPointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { - if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 12))) { + +JNIEXPORT void JNICALL Java_com_googlecode_javacpp_SizeTPointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { + if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 13))) { return; } - long* rptr = new (std::nothrow) long[arg0]; + size_t* rptr = new (std::nothrow) size_t[arg0]; jint rcapacity = arg0; jvalue args[3]; args[0].j = ptr_to_jlong(rptr); args[1].i = rcapacity; - args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_CLongPointer_deallocateArray); + args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_SizeTPointer_deallocateArray); env->CallNonvirtualVoidMethodA(obj, JavaCPP_getClass(env, 1), JavaCPP_initMID, args); } - JNIEXPORT jlong JNICALL Java_com_googlecode_javacpp_SizeTPointer_get(JNIEnv* env, jobject obj, jint arg0) { size_t* ptr = (size_t*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); if (ptr == NULL) { @@ -999,73 +1011,7 @@ JNIEXPORT jobject JNICALL Java_com_googlecode_javacpp_SizeTPointer_put(JNIEnv* e ptr[arg0] = (size_t)arg1; return rarg; } -JNIEXPORT void JNICALL Java_com_googlecode_javacpp_SizeTPointer_allocateArray(JNIEnv* env, jobject obj, jint arg0) { - if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 13))) { - return; - } - size_t* rptr = new (std::nothrow) size_t[arg0]; - jint rcapacity = arg0; - jvalue args[3]; - args[0].j = ptr_to_jlong(rptr); - args[1].i = rcapacity; - args[2].j = ptr_to_jlong(&JavaCPP_com_googlecode_javacpp_SizeTPointer_deallocateArray); - env->CallNonvirtualVoidMethodA(obj, JavaCPP_getClass(env, 1), JavaCPP_initMID, args); -} - -JNIEXPORT jint JNICALL Java_com_morlunk_jumble_audio_javacpp_Speex_00024JitterBufferPacket_getLength(JNIEnv* env, jobject obj) { - ::_JitterBufferPacket* ptr = (::_JitterBufferPacket*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); - if (ptr == NULL) { - env->ThrowNew(JavaCPP_getClass(env, 2), "This pointer address is NULL."); - return 0; - } - jint position = env->GetIntField(obj, JavaCPP_positionFID); - ptr += position; - jint rarg = 0; - int rvalue = ptr->len; - rarg = (jint)rvalue; - return rarg; -} -JNIEXPORT void JNICALL Java_com_morlunk_jumble_audio_javacpp_Speex_00024JitterBufferPacket_setLength(JNIEnv* env, jobject obj, jint arg0) { - ::_JitterBufferPacket* ptr = (::_JitterBufferPacket*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); - if (ptr == NULL) { - env->ThrowNew(JavaCPP_getClass(env, 2), "This pointer address is NULL."); - return; - } - jint position = env->GetIntField(obj, JavaCPP_positionFID); - ptr += position; - ptr->len = arg0; -} -JNIEXPORT void JNICALL Java_com_morlunk_jumble_audio_javacpp_Speex_00024JitterBufferPacket_allocate(JNIEnv* env, jobject obj) { - if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 14))) { - return; - } - jthrowable exc = NULL; - try { - ::_JitterBufferPacket* rptr = new ::_JitterBufferPacket(); - jint rcapacity = 1; - jvalue args[3]; - args[0].j = ptr_to_jlong(rptr); - args[1].i = rcapacity; - args[2].j = ptr_to_jlong(&JavaCPP_com_morlunk_jumble_audio_javacpp_Speex_00024JitterBufferPacket_deallocate); - env->CallNonvirtualVoidMethodA(obj, JavaCPP_getClass(env, 1), JavaCPP_initMID, args); - } catch (...) { - exc = JavaCPP_handleException(env, 15); - } - if (exc != NULL) { - env->Throw(exc); - } -} -JNIEXPORT void JNICALL Java_com_morlunk_jumble_audio_javacpp_Speex_00024JitterBufferPacket_setTimestamp(JNIEnv* env, jobject obj, jint arg0) { - ::_JitterBufferPacket* ptr = (::_JitterBufferPacket*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); - if (ptr == NULL) { - env->ThrowNew(JavaCPP_getClass(env, 2), "This pointer address is NULL."); - return; - } - jint position = env->GetIntField(obj, JavaCPP_positionFID); - ptr += position; - ptr->timestamp = arg0; -} JNIEXPORT jint JNICALL Java_com_morlunk_jumble_audio_javacpp_Speex_00024JitterBufferPacket_getTimestamp(JNIEnv* env, jobject obj) { ::_JitterBufferPacket* ptr = (::_JitterBufferPacket*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); if (ptr == NULL) { @@ -1155,80 +1101,42 @@ JNIEXPORT void JNICALL Java_com_morlunk_jumble_audio_javacpp_Speex_00024JitterBu ptr += position; ptr->sequence = arg0; } - -JNIEXPORT jobject JNICALL Java_com_morlunk_jumble_audio_javacpp_Speex_speex_1resampler_1init(JNIEnv* env, jclass cls, jint arg0, jint arg1, jint arg2, jint arg3, jobject arg4) { - int* ptr4 = arg4 == NULL ? NULL : (int*)jlong_to_ptr(env->GetLongField(arg4, JavaCPP_addressFID)); - jint position4 = arg4 == NULL ? 0 : env->GetIntField(arg4, JavaCPP_positionFID); - ptr4 += position4; - jobject rarg = NULL; - void* rptr; - jthrowable exc = NULL; - try { - rptr = speex_resampler_init(arg0, arg1, arg2, arg3, ptr4); - if (rptr != NULL) { - rarg = env->AllocObject(JavaCPP_getClass(env, 1)); - env->SetLongField(rarg, JavaCPP_addressFID, ptr_to_jlong(rptr)); - } - } catch (...) { - exc = JavaCPP_handleException(env, 15); - } - - if (exc != NULL) { - env->Throw(exc); +JNIEXPORT jint JNICALL Java_com_morlunk_jumble_audio_javacpp_Speex_00024JitterBufferPacket_getLength(JNIEnv* env, jobject obj) { + ::_JitterBufferPacket* ptr = (::_JitterBufferPacket*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); + if (ptr == NULL) { + env->ThrowNew(JavaCPP_getClass(env, 2), "This pointer address is NULL."); + return 0; } - return rarg; -} -JNIEXPORT jint JNICALL Java_com_morlunk_jumble_audio_javacpp_Speex_speex_1resampler_1process_1int(JNIEnv* env, jclass cls, jobject arg0, jint arg1, jshortArray arg2, jintArray arg3, jshortArray arg4, jintArray arg5) { - char* ptr0 = arg0 == NULL ? NULL : (char*)jlong_to_ptr(env->GetLongField(arg0, JavaCPP_addressFID)); - jint position0 = arg0 == NULL ? 0 : env->GetIntField(arg0, JavaCPP_positionFID); - ptr0 += position0; - short* ptr2 = arg2 == NULL ? NULL : env->GetShortArrayElements(arg2, NULL); - int* ptr3 = arg3 == NULL ? NULL : env->GetIntArrayElements(arg3, NULL); - short* ptr4 = arg4 == NULL ? NULL : env->GetShortArrayElements(arg4, NULL); - int* ptr5 = arg5 == NULL ? NULL : env->GetIntArrayElements(arg5, NULL); + jint position = env->GetIntField(obj, JavaCPP_positionFID); + ptr += position; jint rarg = 0; - jthrowable exc = NULL; - try { - int rvalue = speex_resampler_process_int((SpeexResamplerState*)ptr0, arg1, (short*)ptr2, (unsigned int*)ptr3, (short*)ptr4, (unsigned int*)ptr5); - rarg = (jint)rvalue; - } catch (...) { - exc = JavaCPP_handleException(env, 15); - } - - if (arg2 != NULL) env->ReleaseShortArrayElements(arg2, (jshort*)ptr2, 0); - if (arg3 != NULL) env->ReleaseIntArrayElements(arg3, (jint*)ptr3, 0); - if (arg4 != NULL) env->ReleaseShortArrayElements(arg4, (jshort*)ptr4, 0); - if (arg5 != NULL) env->ReleaseIntArrayElements(arg5, (jint*)ptr5, 0); - if (exc != NULL) { - env->Throw(exc); - } + int rvalue = ptr->len; + rarg = (jint)rvalue; return rarg; } -JNIEXPORT void JNICALL Java_com_morlunk_jumble_audio_javacpp_Speex_speex_1resampler_1destroy(JNIEnv* env, jclass cls, jobject arg0) { - char* ptr0 = arg0 == NULL ? NULL : (char*)jlong_to_ptr(env->GetLongField(arg0, JavaCPP_addressFID)); - jint position0 = arg0 == NULL ? 0 : env->GetIntField(arg0, JavaCPP_positionFID); - ptr0 += position0; - jthrowable exc = NULL; - try { - speex_resampler_destroy((SpeexResamplerState*)ptr0); - } catch (...) { - exc = JavaCPP_handleException(env, 15); - } - - if (exc != NULL) { - env->Throw(exc); +JNIEXPORT void JNICALL Java_com_morlunk_jumble_audio_javacpp_Speex_00024JitterBufferPacket_setLength(JNIEnv* env, jobject obj, jint arg0) { + ::_JitterBufferPacket* ptr = (::_JitterBufferPacket*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); + if (ptr == NULL) { + env->ThrowNew(JavaCPP_getClass(env, 2), "This pointer address is NULL."); + return; } + jint position = env->GetIntField(obj, JavaCPP_positionFID); + ptr += position; + ptr->len = arg0; } -JNIEXPORT jobject JNICALL Java_com_morlunk_jumble_audio_javacpp_Speex_jitter_1buffer_1init(JNIEnv* env, jclass cls, jint arg0) { - jobject rarg = NULL; - void* rptr; +JNIEXPORT void JNICALL Java_com_morlunk_jumble_audio_javacpp_Speex_00024JitterBufferPacket_allocate(JNIEnv* env, jobject obj) { + if (!env->IsSameObject(env->GetObjectClass(obj), JavaCPP_getClass(env, 14))) { + return; + } jthrowable exc = NULL; try { - rptr = jitter_buffer_init(arg0); - if (rptr != NULL) { - rarg = env->AllocObject(JavaCPP_getClass(env, 1)); - env->SetLongField(rarg, JavaCPP_addressFID, ptr_to_jlong(rptr)); - } + ::_JitterBufferPacket* rptr = new ::_JitterBufferPacket(); + jint rcapacity = 1; + jvalue args[3]; + args[0].j = ptr_to_jlong(rptr); + args[1].i = rcapacity; + args[2].j = ptr_to_jlong(&JavaCPP_com_morlunk_jumble_audio_javacpp_Speex_00024JitterBufferPacket_deallocate); + env->CallNonvirtualVoidMethodA(obj, JavaCPP_getClass(env, 1), JavaCPP_initMID, args); } catch (...) { exc = JavaCPP_handleException(env, 15); } @@ -1236,23 +1144,18 @@ JNIEXPORT jobject JNICALL Java_com_morlunk_jumble_audio_javacpp_Speex_jitter_1bu if (exc != NULL) { env->Throw(exc); } - return rarg; } -JNIEXPORT void JNICALL Java_com_morlunk_jumble_audio_javacpp_Speex_jitter_1buffer_1reset(JNIEnv* env, jclass cls, jobject arg0) { - char* ptr0 = arg0 == NULL ? NULL : (char*)jlong_to_ptr(env->GetLongField(arg0, JavaCPP_addressFID)); - jint position0 = arg0 == NULL ? 0 : env->GetIntField(arg0, JavaCPP_positionFID); - ptr0 += position0; - jthrowable exc = NULL; - try { - jitter_buffer_reset((JitterBuffer*)ptr0); - } catch (...) { - exc = JavaCPP_handleException(env, 15); - } - - if (exc != NULL) { - env->Throw(exc); +JNIEXPORT void JNICALL Java_com_morlunk_jumble_audio_javacpp_Speex_00024JitterBufferPacket_setTimestamp(JNIEnv* env, jobject obj, jint arg0) { + ::_JitterBufferPacket* ptr = (::_JitterBufferPacket*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID)); + if (ptr == NULL) { + env->ThrowNew(JavaCPP_getClass(env, 2), "This pointer address is NULL."); + return; } + jint position = env->GetIntField(obj, JavaCPP_positionFID); + ptr += position; + ptr->timestamp = arg0; } + JNIEXPORT void JNICALL Java_com_morlunk_jumble_audio_javacpp_Speex_jitter_1buffer_1destroy(JNIEnv* env, jclass cls, jobject arg0) { char* ptr0 = arg0 == NULL ? NULL : (char*)jlong_to_ptr(env->GetLongField(arg0, JavaCPP_addressFID)); jint position0 = arg0 == NULL ? 0 : env->GetIntField(arg0, JavaCPP_positionFID); @@ -1502,6 +1405,103 @@ JNIEXPORT jint JNICALL Java_com_morlunk_jumble_audio_javacpp_Speex_speex_1prepro } return rarg; } +JNIEXPORT jobject JNICALL Java_com_morlunk_jumble_audio_javacpp_Speex_speex_1resampler_1init(JNIEnv* env, jclass cls, jint arg0, jint arg1, jint arg2, jint arg3, jobject arg4) { + int* ptr4 = arg4 == NULL ? NULL : (int*)jlong_to_ptr(env->GetLongField(arg4, JavaCPP_addressFID)); + jint position4 = arg4 == NULL ? 0 : env->GetIntField(arg4, JavaCPP_positionFID); + ptr4 += position4; + jobject rarg = NULL; + void* rptr; + jthrowable exc = NULL; + try { + rptr = speex_resampler_init(arg0, arg1, arg2, arg3, ptr4); + if (rptr != NULL) { + rarg = env->AllocObject(JavaCPP_getClass(env, 1)); + env->SetLongField(rarg, JavaCPP_addressFID, ptr_to_jlong(rptr)); + } + } catch (...) { + exc = JavaCPP_handleException(env, 15); + } + + if (exc != NULL) { + env->Throw(exc); + } + return rarg; +} +JNIEXPORT jint JNICALL Java_com_morlunk_jumble_audio_javacpp_Speex_speex_1resampler_1process_1int(JNIEnv* env, jclass cls, jobject arg0, jint arg1, jshortArray arg2, jintArray arg3, jshortArray arg4, jintArray arg5) { + char* ptr0 = arg0 == NULL ? NULL : (char*)jlong_to_ptr(env->GetLongField(arg0, JavaCPP_addressFID)); + jint position0 = arg0 == NULL ? 0 : env->GetIntField(arg0, JavaCPP_positionFID); + ptr0 += position0; + short* ptr2 = arg2 == NULL ? NULL : env->GetShortArrayElements(arg2, NULL); + int* ptr3 = arg3 == NULL ? NULL : env->GetIntArrayElements(arg3, NULL); + short* ptr4 = arg4 == NULL ? NULL : env->GetShortArrayElements(arg4, NULL); + int* ptr5 = arg5 == NULL ? NULL : env->GetIntArrayElements(arg5, NULL); + jint rarg = 0; + jthrowable exc = NULL; + try { + int rvalue = speex_resampler_process_int((SpeexResamplerState*)ptr0, arg1, (short*)ptr2, (unsigned int*)ptr3, (short*)ptr4, (unsigned int*)ptr5); + rarg = (jint)rvalue; + } catch (...) { + exc = JavaCPP_handleException(env, 15); + } + + if (arg2 != NULL) env->ReleaseShortArrayElements(arg2, (jshort*)ptr2, 0); + if (arg3 != NULL) env->ReleaseIntArrayElements(arg3, (jint*)ptr3, 0); + if (arg4 != NULL) env->ReleaseShortArrayElements(arg4, (jshort*)ptr4, 0); + if (arg5 != NULL) env->ReleaseIntArrayElements(arg5, (jint*)ptr5, 0); + if (exc != NULL) { + env->Throw(exc); + } + return rarg; +} +JNIEXPORT void JNICALL Java_com_morlunk_jumble_audio_javacpp_Speex_speex_1resampler_1destroy(JNIEnv* env, jclass cls, jobject arg0) { + char* ptr0 = arg0 == NULL ? NULL : (char*)jlong_to_ptr(env->GetLongField(arg0, JavaCPP_addressFID)); + jint position0 = arg0 == NULL ? 0 : env->GetIntField(arg0, JavaCPP_positionFID); + ptr0 += position0; + jthrowable exc = NULL; + try { + speex_resampler_destroy((SpeexResamplerState*)ptr0); + } catch (...) { + exc = JavaCPP_handleException(env, 15); + } + + if (exc != NULL) { + env->Throw(exc); + } +} +JNIEXPORT jobject JNICALL Java_com_morlunk_jumble_audio_javacpp_Speex_jitter_1buffer_1init(JNIEnv* env, jclass cls, jint arg0) { + jobject rarg = NULL; + void* rptr; + jthrowable exc = NULL; + try { + rptr = jitter_buffer_init(arg0); + if (rptr != NULL) { + rarg = env->AllocObject(JavaCPP_getClass(env, 1)); + env->SetLongField(rarg, JavaCPP_addressFID, ptr_to_jlong(rptr)); + } + } catch (...) { + exc = JavaCPP_handleException(env, 15); + } + + if (exc != NULL) { + env->Throw(exc); + } + return rarg; +} +JNIEXPORT void JNICALL Java_com_morlunk_jumble_audio_javacpp_Speex_jitter_1buffer_1reset(JNIEnv* env, jclass cls, jobject arg0) { + char* ptr0 = arg0 == NULL ? NULL : (char*)jlong_to_ptr(env->GetLongField(arg0, JavaCPP_addressFID)); + jint position0 = arg0 == NULL ? 0 : env->GetIntField(arg0, JavaCPP_positionFID); + ptr0 += position0; + jthrowable exc = NULL; + try { + jitter_buffer_reset((JitterBuffer*)ptr0); + } catch (...) { + exc = JavaCPP_handleException(env, 15); + } + + if (exc != NULL) { + env->Throw(exc); + } +} } diff --git a/src/main/libs/armeabi/libcelt11.so b/src/main/libs/armeabi/libcelt11.so Binary files differindex 9656d51..ff84d97 100755 --- a/src/main/libs/armeabi/libcelt11.so +++ b/src/main/libs/armeabi/libcelt11.so diff --git a/src/main/libs/armeabi/libcelt7.so b/src/main/libs/armeabi/libcelt7.so Binary files differindex 924821e..3573f4a 100755 --- a/src/main/libs/armeabi/libcelt7.so +++ b/src/main/libs/armeabi/libcelt7.so diff --git a/src/main/libs/armeabi/libopus.so b/src/main/libs/armeabi/libopus.so Binary files differindex f2c9d53..a61693b 100755 --- a/src/main/libs/armeabi/libopus.so +++ b/src/main/libs/armeabi/libopus.so diff --git a/src/main/libs/armeabi/libspeex.so b/src/main/libs/armeabi/libspeex.so Binary files differindex 979f422..e4db31e 100755 --- a/src/main/libs/armeabi/libspeex.so +++ b/src/main/libs/armeabi/libspeex.so |