1 /* |
1 /* |
2 * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
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 |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
39 * Signature: ()Z |
39 * Signature: ()Z |
40 */ |
40 */ |
41 JNIEXPORT jboolean JNICALL Java_com_sun_media_sound_Platform_nIsBigEndian(JNIEnv *env, jclass clss) { |
41 JNIEXPORT jboolean JNICALL Java_com_sun_media_sound_Platform_nIsBigEndian(JNIEnv *env, jclass clss) { |
42 return UTIL_IsBigEndianPlatform(); |
42 return UTIL_IsBigEndianPlatform(); |
43 } |
43 } |
44 |
|
45 /* |
|
46 * Class: com_sun_media_sound_Platform |
|
47 * Method: nGetExtraLibraries |
|
48 * Signature: ()Ljava/lang/String; |
|
49 */ |
|
50 JNIEXPORT jstring JNICALL Java_com_sun_media_sound_Platform_nGetExtraLibraries(JNIEnv *env, jclass clss) { |
|
51 return (*env)->NewStringUTF(env, EXTRA_SOUND_JNI_LIBS); |
|
52 } |
|
53 |
|
54 /* |
|
55 * Class: com_sun_media_sound_Platform |
|
56 * Method: nGetLibraryForFeature |
|
57 * Signature: (I)I |
|
58 */ |
|
59 JNIEXPORT jint JNICALL Java_com_sun_media_sound_Platform_nGetLibraryForFeature |
|
60 (JNIEnv *env, jclass clazz, jint feature) { |
|
61 |
|
62 // for every OS |
|
63 #if X_PLATFORM == X_WINDOWS |
|
64 switch (feature) { |
|
65 case com_sun_media_sound_Platform_FEATURE_MIDIIO: |
|
66 return com_sun_media_sound_Platform_LIB_MAIN; |
|
67 case com_sun_media_sound_Platform_FEATURE_PORTS: |
|
68 return com_sun_media_sound_Platform_LIB_MAIN; |
|
69 case com_sun_media_sound_Platform_FEATURE_DIRECT_AUDIO: |
|
70 return com_sun_media_sound_Platform_LIB_DSOUND; |
|
71 } |
|
72 #endif |
|
73 #if (X_PLATFORM == X_SOLARIS) |
|
74 switch (feature) { |
|
75 case com_sun_media_sound_Platform_FEATURE_MIDIIO: |
|
76 return com_sun_media_sound_Platform_LIB_MAIN; |
|
77 case com_sun_media_sound_Platform_FEATURE_PORTS: |
|
78 return com_sun_media_sound_Platform_LIB_MAIN; |
|
79 case com_sun_media_sound_Platform_FEATURE_DIRECT_AUDIO: |
|
80 return com_sun_media_sound_Platform_LIB_MAIN; |
|
81 } |
|
82 #endif |
|
83 #if (X_PLATFORM == X_LINUX) |
|
84 switch (feature) { |
|
85 case com_sun_media_sound_Platform_FEATURE_MIDIIO: |
|
86 return com_sun_media_sound_Platform_LIB_ALSA; |
|
87 case com_sun_media_sound_Platform_FEATURE_PORTS: |
|
88 return com_sun_media_sound_Platform_LIB_ALSA; |
|
89 case com_sun_media_sound_Platform_FEATURE_DIRECT_AUDIO: |
|
90 return com_sun_media_sound_Platform_LIB_ALSA; |
|
91 } |
|
92 #endif |
|
93 #if (X_PLATFORM == X_MACOSX) |
|
94 switch (feature) { |
|
95 case com_sun_media_sound_Platform_FEATURE_MIDIIO: |
|
96 return com_sun_media_sound_Platform_LIB_MAIN; |
|
97 case com_sun_media_sound_Platform_FEATURE_PORTS: |
|
98 return com_sun_media_sound_Platform_LIB_MAIN; |
|
99 case com_sun_media_sound_Platform_FEATURE_DIRECT_AUDIO: |
|
100 return com_sun_media_sound_Platform_LIB_MAIN; |
|
101 } |
|
102 #endif |
|
103 #if (X_PLATFORM == X_BSD) |
|
104 switch (feature) { |
|
105 case com_sun_media_sound_Platform_FEATURE_MIDIIO: |
|
106 return com_sun_media_sound_Platform_LIB_MAIN; |
|
107 #ifdef __FreeBSD__ |
|
108 case com_sun_media_sound_Platform_FEATURE_PORTS: |
|
109 return com_sun_media_sound_Platform_LIB_ALSA; |
|
110 case com_sun_media_sound_Platform_FEATURE_DIRECT_AUDIO: |
|
111 return com_sun_media_sound_Platform_LIB_ALSA; |
|
112 #else |
|
113 case com_sun_media_sound_Platform_FEATURE_PORTS: |
|
114 return com_sun_media_sound_Platform_LIB_MAIN; |
|
115 case com_sun_media_sound_Platform_FEATURE_DIRECT_AUDIO: |
|
116 // XXXBSD: When native Direct Audio support is ported change |
|
117 // this back to returning com_sun_media_sound_Platform_LIB_MAIN |
|
118 return 0; |
|
119 #endif |
|
120 } |
|
121 #endif |
|
122 return 0; |
|
123 } |
|