blob: b220bbd24487220efde52f4532bf9ce94faaea11 [file] [log] [blame]
J. Duke319a3b92007-12-01 00:00:00 +00001/*
2 * Copyright 2002-2007 Sun Microsystems, Inc. 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. Sun designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 * CA 95054 USA or visit www.sun.com if you need additional information or
23 * have any 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 */
37JNIEXPORT 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 */
46JNIEXPORT 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 */
59JNIEXPORT 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 */
68JNIEXPORT 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 return 0;
103}