KNIEXPORT KNI_RETURNTYPE_VOID
KNIDECL(com_sun_amms_DirectSoundSource3D_nRemovePlayer)
{
    javacall_audio3d_soundsource3d_t *src = getNativePtr(KNIPASSARGS 0);
    KNIPlayerInfo* pKniInfo = (KNIPlayerInfo*)KNI_GetParameterAsInt( 1 );
    javacall_handle player = ( javacall_handle )( pKniInfo->pNativeHandle );
    javacall_result result = JAVACALL_FAIL;

    result = javacall_audio3d_soundsource3d_remove_player( src, player );

    if( result == JAVACALL_INVALID_ARGUMENT )
    {
        KNI_ThrowNew( "java/lang/IllegalArgumentException",
"\nInvalid arguments were passed to the native part of \
SoundSource3D.removePlayer\n"
                );
        KNI_ReturnVoid();
    }

    if( result != JAVACALL_OK )
    {
        KNI_ThrowNew( "java/lang/RuntimeException",
"\nNative error occurred while removing the Player from SoundSource3D\n"
            );
        KNI_ReturnVoid();
    }

    KNI_ReturnVoid();
}
Пример #2
0
/*
 * Class:     org_readium_sdk_android_IRI
 * Method:    getPort
 * Signature: ()I
 */
JNIEXPORT jint JNICALL Java_org_readium_sdk_android_IRI_getPort
		(JNIEnv *env, jobject thiz) {
	// Get the native pointer
	std::shared_ptr<ePub3::IRI> iri(std::static_pointer_cast<ePub3::IRI>(getNativePtr(env, thiz)));

	// Return result
	return (jint) iri->Port();
}
Пример #3
0
/*
 * Class:     org_readium_sdk_android_IRI
 * Method:    isEmpty
 * Signature: ()Z
 */
JNIEXPORT jboolean JNICALL Java_org_readium_sdk_android_IRI_isEmpty
		(JNIEnv *env, jobject thiz) {
	// Get the native pointer
	std::shared_ptr<ePub3::IRI> iri(std::static_pointer_cast<ePub3::IRI>(getNativePtr(env, thiz)));

	// Return result
	return iri->IsEmpty() ? JNI_TRUE : JNI_FALSE;
}
Пример #4
0
/*
 * Class:     org_readium_sdk_android_IRI
 * Method:    toURIString
 * Signature: ()Ljava/lang/String;
 */
JNIEXPORT jstring JNICALL Java_org_readium_sdk_android_IRI_toURIString
		(JNIEnv *env, jobject thiz) {
	// Get the native pointer
	std::shared_ptr<ePub3::IRI> iri(std::static_pointer_cast<ePub3::IRI>(getNativePtr(env, thiz)));

	// Return result
	std::string res = iri->URIString().stl_str();
	return jni::StringUTF(env, res);
}
Пример #5
0
/*
 * Class:     org_readium_sdk_android_IRI
 * Method:    setFragment
 * Signature: (Ljava/lang/String;)V
 */
JNIEXPORT void JNICALL Java_org_readium_sdk_android_IRI_setFragment
		(JNIEnv *env, jobject thiz, jstring fragment) {
	// Get the native pointer
	std::shared_ptr<ePub3::IRI> iri(std::static_pointer_cast<ePub3::IRI>(getNativePtr(env, thiz)));

	// Set it
	std::string val = jni::StringUTF(env, fragment);
	iri->SetFragment(val);
}
KNIEXPORT KNI_RETURNTYPE_VOID
KNIDECL(com_sun_amms_DirectSoundSource3D_finalize)
{
    javacall_audio3d_soundsource3d_t *src = getNativePtr(KNIPASSARGS 0);
    javacall_amms_local_manager_t *mgr = getNativeMgrPtr(KNIPASSARGS 0);

    javacall_amms_local_manager_destroy_sound_source3d( mgr, src );

    KNI_ReturnVoid();
}
Пример #7
0
/*
 * Class:     org_readium_sdk_android_IRI
 * Method:    setCredentials
 * Signature: (Ljava/lang/String;Ljava/lang/String;)V
 */
JNIEXPORT void JNICALL Java_org_readium_sdk_android_IRI_setCredentials
		(JNIEnv *env, jobject thiz, jstring user, jstring pass) {
	// Get the native pointer
	std::shared_ptr<ePub3::IRI> iri(std::static_pointer_cast<ePub3::IRI>(getNativePtr(env, thiz)));

	// Set them
	std::string uval = jni::StringUTF(env, user);
	std::string pval = jni::StringUTF(env, pass);
	iri->SetCredentials(uval, pval);
}
Пример #8
0
/*
 * Class:     org_readium_sdk_android_IRI
 * Method:    getCredentialsPWD
 * Signature: ()Ljava/lang/String;
 */
JNIEXPORT jstring JNICALL Java_org_readium_sdk_android_IRI_getCredentialsPWD
		(JNIEnv *env, jobject thiz) {
	// Get the native pointer
	std::shared_ptr<ePub3::IRI> iri(std::static_pointer_cast<ePub3::IRI>(getNativePtr(env, thiz)));

	// Return result
	ePub3::IRI::IRICredentials cred = iri->Credentials();
	std::string res = cred.second.stl_str();
	return jni::StringUTF(env, res);
}
KNIEXPORT KNI_RETURNTYPE_INT 
KNIDECL(com_sun_amms_DirectSoundSource3D_nGetNumOfSupportedControls)
{
    javacall_audio3d_soundsource3d_t *src = getNativePtr(KNIPASSARGS 0);
    int n = 0;

    javacall_audio3d_soundsource3d_get_controls( src, &n );

    KNI_ReturnInt( ( jint )n );
    
}
KNIEXPORT KNI_RETURNTYPE_INT 
KNIDECL(com_sun_amms_DirectSpectatorImpl_nGetNumOfSupportedControls)
{
    javacall_audio3d_spectator_t *spectator = getNativePtr(KNIPASSARGS 0);
    int n = 0;

    javacall_audio3d_spectator_get_controls( spectator, &n );

    KNI_ReturnInt( ( jint )n );
    
}
Пример #11
0
KNIEXPORT KNI_RETURNTYPE_VOID
KNIDECL(com_sun_amms_DirectSoundSource3D_nGetSupportedControlNames)
{
    javacall_audio3d_soundsource3d_t *src = getNativePtr(KNIPASSARGS 0);
    int n = 0;
    javacall_amms_control_t *control = NULL;

    KNI_StartHandles( 1 );
    KNI_DeclareHandle( names );
    KNI_GetParameterAsObject( 1, names );
    control = javacall_audio3d_soundsource3d_get_controls( src, &n );

    controlsToJavaNamesArray( KNIPASSARGS control, n, names );

    KNI_EndHandles();
    KNI_ReturnVoid();
}
Пример #12
0
KNIEXPORT KNI_RETURNTYPE_INT
KNIDECL(com_sun_amms_DirectSoundSource3D_nGetControlPeer)
{
    javacall_audio3d_soundsource3d_t *src = getNativePtr(KNIPASSARGS 0);
    javacall_amms_control_t *control;
    javacall_amms_control_type_enum_t type;

    getControlTypeFromArg( KNIPASSARGS &type );

    if( type == javacall_amms_eUnknownControl )
    {
        KNI_ReturnInt( NULL );
    }

    control = javacall_audio3d_soundsource3d_get_control( src, type );

    KNI_ReturnInt( ( jint )control );
}
Пример #13
0
/*
 * Class:     org_readium_sdk_android_IRI
 * Method:    getNamespacedString
 * Signature: ()Ljava/lang/String;
 */
JNIEXPORT jstring JNICALL Java_org_readium_sdk_android_IRI_getNamespacedString
		(JNIEnv *env, jobject thiz) {
	// Get the native pointer
	std::shared_ptr<ePub3::IRI> iri(std::static_pointer_cast<ePub3::IRI>(getNativePtr(env, thiz)));

	// Get the result
	std::string res;
	try {
		res = iri->NamespacedString().stl_str();
	}
	catch(std::invalid_argument e) {
		jni::Exception::throwToJava(env, jni::Exception::Generic::IllegalStateException , e.what());
		return NULL;
	}

	// Return result
	return jni::StringUTF(env, res);
}
Пример #14
0
KNIEXPORT KNI_RETURNTYPE_VOID
KNIDECL(com_sun_amms_DirectSoundSource3D_nAddMIDIChannel)
{
    javacall_audio3d_soundsource3d_t *src = getNativePtr(KNIPASSARGS 0);
    KNIPlayerInfo* pKniInfo = (KNIPlayerInfo*)KNI_GetParameterAsInt( 1 );
    javacall_handle player = ( javacall_handle )( pKniInfo->pNativeHandle );
    int channel = KNI_GetParameterAsInt(2);
    javacall_result result = JAVACALL_FAIL;


    result = javacall_audio3d_soundsource3d_add_midi_channel( src, player,
        channel );

    if( result == JAVACALL_INVALID_ARGUMENT )
    {
        KNI_ThrowNew( "java/lang/IllegalArgumentException",
"\nInvalid arguments were passed to native part of \
SoundSource3D.addMIDIChannel\n"
                );
        KNI_ReturnVoid();
    }

    if( result == JAVACALL_NOT_IMPLEMENTED )
    {
        KNI_ThrowNew( "javax/microedition/media/MediaException",
                "\nAdding MIDI Channels to SoundSource3D is not supported\n"
            );
        KNI_ReturnVoid();
    }

    if( result != JAVACALL_OK )
    {
        KNI_ThrowNew( "java/lang/RuntimeException",
"\nNative error occurred while adding the MIDI channel to SoundSource3D \n"
            );
        KNI_ReturnVoid();
    }


    KNI_ReturnVoid();
}
Пример #15
0
void Java_com_libdivecomputer_android_Buffer_delloc(JNIEnv* envPtr, jobject object_Buffer) {
	dc_buffer_t* bufferPtr = (dc_buffer_t*)getNativePtr(envPtr, object_Buffer);
	dc_buffer_free(bufferPtr);
	setNativePtr(envPtr, object_Buffer, NULL);
}