2004-05-23 10:03:07 -04:00
|
|
|
/*
|
2004-06-12 16:28:34 -04:00
|
|
|
* Copyright (c) 2002-2004 LWJGL Project
|
2004-05-23 10:03:07 -04:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions are
|
|
|
|
* met:
|
|
|
|
*
|
|
|
|
* * Redistributions of source code must retain the above copyright
|
2004-06-12 16:28:34 -04:00
|
|
|
* notice, this list of conditions and the following disclaimer.
|
2004-05-23 10:03:07 -04:00
|
|
|
*
|
|
|
|
* * Redistributions in binary form must reproduce the above copyright
|
2004-06-12 16:28:34 -04:00
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
2004-05-23 10:03:07 -04:00
|
|
|
*
|
2004-06-12 16:28:34 -04:00
|
|
|
* * Neither the name of 'LWJGL' nor the names of
|
|
|
|
* its contributors may be used to endorse or promote products derived
|
|
|
|
* from this software without specific prior written permission.
|
2004-05-23 10:03:07 -04:00
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
|
|
|
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
|
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
|
|
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
|
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
|
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
|
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
|
|
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
|
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
|
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
2004-06-09 15:53:45 -04:00
|
|
|
#include "org_lwjgl_fmod3_FMOD.h"
|
|
|
|
#include "extfmod3.h"
|
2004-05-23 10:03:07 -04:00
|
|
|
|
|
|
|
static const char* VERSION = "0.9a";
|
|
|
|
|
|
|
|
/*
|
2004-06-09 15:53:45 -04:00
|
|
|
* Class: org_lwjgl_fmod3_FMOD
|
2004-05-23 10:03:07 -04:00
|
|
|
* Method: getNativeLibraryVersion
|
|
|
|
* Signature: ()Ljava/lang/String;
|
|
|
|
*/
|
2004-06-09 15:53:45 -04:00
|
|
|
JNIEXPORT jstring JNICALL Java_org_lwjgl_fmod3_FMOD_getNativeLibraryVersion(JNIEnv * env, jclass clazz) {
|
2004-05-23 10:03:07 -04:00
|
|
|
return env->NewStringUTF(VERSION);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2004-06-09 15:53:45 -04:00
|
|
|
* Class: org_lwjgl_fmod3_FMOD
|
2004-05-23 10:03:07 -04:00
|
|
|
* Method: nCreate
|
|
|
|
* Signature: ()V
|
|
|
|
*/
|
2004-06-09 15:53:45 -04:00
|
|
|
JNIEXPORT void JNICALL Java_org_lwjgl_fmod3_FMOD_nCreate(JNIEnv *env, jclass clazz, jobjectArray paths) {
|
2004-05-23 15:45:00 -04:00
|
|
|
jsize pathcount = env->GetArrayLength(paths);
|
2004-05-23 10:03:07 -04:00
|
|
|
for(int i=0;i<pathcount;i++) {
|
|
|
|
jstring path = (jstring) env->GetObjectArrayElement(paths, i);
|
|
|
|
char *path_str = (char *) env->GetStringUTFChars(path, NULL);
|
2004-05-23 15:45:00 -04:00
|
|
|
printfDebug("Trying to load fmod_instance from %s\n", path_str);
|
2004-05-31 08:42:09 -04:00
|
|
|
fmod_create(env, path_str);
|
2004-05-23 15:45:00 -04:00
|
|
|
env->ReleaseStringUTFChars(path, path_str);
|
|
|
|
|
|
|
|
if(fmod_instance != NULL) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
throwFMODException(env, "Unable to load fmod library");
|
2004-05-23 10:03:07 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2004-06-09 15:53:45 -04:00
|
|
|
* Class: org_lwjgl_fmod3_FMOD
|
2004-05-23 10:03:07 -04:00
|
|
|
* Method: nDestroy
|
|
|
|
* Signature: ()V
|
|
|
|
*/
|
2004-06-09 15:53:45 -04:00
|
|
|
JNIEXPORT void JNICALL Java_org_lwjgl_fmod3_FMOD_nDestroy(JNIEnv *env, jclass clazz) {
|
2004-05-23 10:03:07 -04:00
|
|
|
fmod_destroy();
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2004-06-09 15:53:45 -04:00
|
|
|
* Class: org_lwjgl_fmod3_FMOD
|
2004-05-23 10:03:07 -04:00
|
|
|
* Method: FMOD_ErrorString
|
|
|
|
* Signature: (I)Ljava/lang/String;
|
|
|
|
*/
|
2004-06-09 15:53:45 -04:00
|
|
|
JNIEXPORT jstring JNICALL Java_org_lwjgl_fmod3_FMOD_FMOD_1ErrorString(JNIEnv *env, jclass clazz, jint errorcode) {
|
2004-05-23 10:03:07 -04:00
|
|
|
return env->NewStringUTF(FMOD_ErrorString(errorcode));
|
2004-05-23 15:45:00 -04:00
|
|
|
}
|