SWIGEXPORT jlong JNICALL Java_com_morlunk_jumble_audio_celt11_CELT11JNI_celt_1decoder_1init(JNIEnv *jenv, jclass jcls, jlong jarg1, jint jarg2, jint jarg3, jintArray jarg4) { jlong jresult = 0 ; CELTDecoder *arg1 = (CELTDecoder *) 0 ; int arg2 ; int arg3 ; int *arg4 = (int *) 0 ; int temp4 ; CELTDecoder *result = 0 ; (void)jenv; (void)jcls; arg1 = *(CELTDecoder **)&jarg1; arg2 = (int)jarg2; arg3 = (int)jarg3; { if (!jarg4) { SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "array null"); return 0; } if ((*jenv)->GetArrayLength(jenv, jarg4) == 0) { SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, "Array must contain at least 1 element"); return 0; } temp4 = (int)0; arg4 = &temp4; } result = (CELTDecoder *)celt_decoder_init(arg1,arg2,arg3,arg4); *(CELTDecoder **)&jresult = result; { jint jvalue = (jint)temp4; (*jenv)->SetIntArrayRegion(jenv, jarg4, 0, 1, &jvalue); } return jresult; }
int opus_decoder_init(OpusDecoder *st, opus_int32 Fs, int channels) { void *silk_dec; CELTDecoder *celt_dec; int ret, silkDecSizeBytes; if ((Fs!=48000&&Fs!=24000&&Fs!=16000&&Fs!=12000&&Fs!=8000) || (channels!=1&&channels!=2)) return OPUS_BAD_ARG; OPUS_CLEAR((char*)st, opus_decoder_get_size(channels)); /* Initialize SILK encoder */ ret = silk_Get_Decoder_Size(&silkDecSizeBytes); if (ret) return OPUS_INTERNAL_ERROR; silkDecSizeBytes = align(silkDecSizeBytes); st->silk_dec_offset = align(sizeof(OpusDecoder)); st->celt_dec_offset = st->silk_dec_offset+silkDecSizeBytes; silk_dec = (char*)st+st->silk_dec_offset; celt_dec = (CELTDecoder*)((char*)st+st->celt_dec_offset); st->stream_channels = st->channels = channels; st->Fs = Fs; st->DecControl.API_sampleRate = st->Fs; st->DecControl.nChannelsAPI = st->channels; st->arch = opus_select_arch(); /* Reset decoder */ ret = silk_InitDecoder( silk_dec ); if(ret)return OPUS_INTERNAL_ERROR; /* Initialize CELT decoder */ ret = celt_decoder_init(celt_dec, Fs, channels); if(ret!=OPUS_OK)return OPUS_INTERNAL_ERROR; celt_decoder_ctl(celt_dec, CELT_SET_SIGNALLING(0)); st->prev_mode = 0; st->frame_size = Fs/400; return OPUS_OK; }