1 /* 2 * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 27 #include "Utilities.h" 28 // Platform.java includes 29 #include "com_sun_media_sound_Platform.h" 30 31 32 /* 33 * Class: com_sun_media_sound_Platform 34 * Method: nIsBigEndian 35 * Signature: ()Z 36 */ 37 JNIEXPORT jboolean JNICALL Java_com_sun_media_sound_Platform_nIsBigEndian(JNIEnv *env, jclass clss) { 38 return UTIL_IsBigEndianPlatform(); 39 } 40 41 /* 42 * Class: com_sun_media_sound_Platform 43 * Method: nIsSigned8 44 * Signature: ()Z 45 */ 46 JNIEXPORT jboolean JNICALL Java_com_sun_media_sound_Platform_nIsSigned8(JNIEnv *env, jclass clss) { 47 #if ((X_ARCH == X_SPARC) || (X_ARCH == X_SPARCV9)) 48 return 1; 49 #else 50 return 0; 51 #endif 52 } 53 54 /* 55 * Class: com_sun_media_sound_Platform 56 * Method: nGetExtraLibraries 57 * Signature: ()Ljava/lang/String; 58 */ 59 JNIEXPORT jstring JNICALL Java_com_sun_media_sound_Platform_nGetExtraLibraries(JNIEnv *env, jclass clss) { 60 return (*env)->NewStringUTF(env, EXTRA_SOUND_JNI_LIBS); 61 } 62 63 /* 64 * Class: com_sun_media_sound_Platform 65 * Method: nGetLibraryForFeature 66 * Signature: (I)I 67 */ 68 JNIEXPORT jint JNICALL Java_com_sun_media_sound_Platform_nGetLibraryForFeature 69 (JNIEnv *env, jclass clazz, jint feature) { 70 71 // for every OS 72 #if X_PLATFORM == X_WINDOWS 73 switch (feature) { 74 case com_sun_media_sound_Platform_FEATURE_MIDIIO: 75 return com_sun_media_sound_Platform_LIB_MAIN; 76 case com_sun_media_sound_Platform_FEATURE_PORTS: 77 return com_sun_media_sound_Platform_LIB_MAIN; 78 case com_sun_media_sound_Platform_FEATURE_DIRECT_AUDIO: 79 return com_sun_media_sound_Platform_LIB_DSOUND; 80 } 81 #endif 82 #if (X_PLATFORM == X_SOLARIS) 83 switch (feature) { 84 case com_sun_media_sound_Platform_FEATURE_MIDIIO: 85 return com_sun_media_sound_Platform_LIB_MAIN; 86 case com_sun_media_sound_Platform_FEATURE_PORTS: 87 return com_sun_media_sound_Platform_LIB_MAIN; 88 case com_sun_media_sound_Platform_FEATURE_DIRECT_AUDIO: 89 return com_sun_media_sound_Platform_LIB_MAIN; 90 } 91 #endif 92 #if (X_PLATFORM == X_LINUX) 93 switch (feature) { 94 case com_sun_media_sound_Platform_FEATURE_MIDIIO: 95 return com_sun_media_sound_Platform_LIB_ALSA; 96 case com_sun_media_sound_Platform_FEATURE_PORTS: 97 return com_sun_media_sound_Platform_LIB_ALSA; 98 case com_sun_media_sound_Platform_FEATURE_DIRECT_AUDIO: 99 return com_sun_media_sound_Platform_LIB_ALSA; 100 } 101 #endif 102 #if (X_PLATFORM == X_MACOSX) 103 switch (feature) { 104 case com_sun_media_sound_Platform_FEATURE_MIDIIO: 105 return com_sun_media_sound_Platform_LIB_MAIN; 106 case com_sun_media_sound_Platform_FEATURE_PORTS: 107 return com_sun_media_sound_Platform_LIB_MAIN; 108 case com_sun_media_sound_Platform_FEATURE_DIRECT_AUDIO: 109 return com_sun_media_sound_Platform_LIB_MAIN; 110 } 111 #endif 112 #if (X_PLATFORM == X_BSD) 113 switch (feature) { 114 case com_sun_media_sound_Platform_FEATURE_MIDIIO: 115 return com_sun_media_sound_Platform_LIB_MAIN; 116 #ifdef __FreeBSD__ 117 case com_sun_media_sound_Platform_FEATURE_PORTS: 118 return com_sun_media_sound_Platform_LIB_ALSA; 119 case com_sun_media_sound_Platform_FEATURE_DIRECT_AUDIO: 120 return com_sun_media_sound_Platform_LIB_ALSA; 121 #else 122 case com_sun_media_sound_Platform_FEATURE_PORTS: 123 return com_sun_media_sound_Platform_LIB_MAIN; 124 case com_sun_media_sound_Platform_FEATURE_DIRECT_AUDIO: 125 // XXXBSD: When native Direct Audio support is ported change 126 // this back to returning com_sun_media_sound_Platform_LIB_MAIN 127 return 0; 128 #endif 129 } 130 #endif 131 return 0; 132 }