1 /* gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider.c - DSSI Provider
2 Copyright (C) 2005 Free Software Foundation, Inc.
4 This file is part of GNU Classpath.
6 GNU Classpath is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 GNU Classpath is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU Classpath; see the file COPYING. If not, write to the
18 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 Linking this library statically or dynamically with other modules is
22 making a combined work based on this library. Thus, the terms and
23 conditions of the GNU General Public License cover the whole
26 As a special exception, the copyright holders of this library give you
27 permission to link this library with independent modules to produce an
28 executable, regardless of the license terms of these independent
29 modules, and to copy and distribute the resulting executable under
30 terms of your choice, provided that you also meet, for each linked
31 independent module, the terms and conditions of the license of that
32 module. An independent module is a module which is not derived from
33 or based on this library. If you modify this library, you may extend
34 this exception to your version of the library, but you are not
35 obligated to do so. If you do not wish to do so, delete this
36 exception statement from your version. */
39 #include <gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider.h>
41 #include "dssi_data.h"
44 Java_gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider_dlclose_1
45 (JNIEnv
*env
, jclass clazz
__attribute__((unused
)), jlong sohandle
)
47 dssi_data
*data
= (dssi_data
*) (long) sohandle
;
48 dlclose (data
->dlhandle
);
53 Java_gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider_dlopen_1
54 (JNIEnv
*env
, jclass clazz
__attribute__((unused
)), jstring name
)
58 DSSI_Descriptor_Function fn
;
61 filename
= JCL_jstring_to_cstring (env
, name
);
65 handle
= dlopen(filename
, RTLD_NOW
);
70 fn
= (DSSI_Descriptor_Function
) dlsym(handle
, "dssi_descriptor");
78 data
= (dssi_data
*) JCL_malloc(env
, sizeof(dssi_data
));
79 data
->dlhandle
= handle
;
81 data
->midiEventReadIndex
= 0;
82 data
->midiEventWriteIndex
= 0;
85 JCL_free_cstring (env
, name
, filename
);
86 return PTR_TO_JLONG(data
);
90 Java_gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider_getDSSIHandle_1
91 (JNIEnv
*env
__attribute__((unused
)),
92 jclass clazz
__attribute__((unused
)), jlong handle
, jlong index
)
94 dssi_data
*data
= JLONG_TO_PTR(dssi_data
,handle
);
95 data
->desc
= (data
->fn
)(index
);
96 return PTR_TO_JLONG(data
->desc
);
100 Java_gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider_getDSSIName_1
101 (JNIEnv
*env
, jclass clazz
__attribute__((unused
)), jlong handle
)
103 DSSI_Descriptor
*desc
= JLONG_TO_PTR(DSSI_Descriptor
,handle
);
104 const char *str
= desc
->LADSPA_Plugin
->Name
;
106 return (*env
)->NewStringUTF (env
, str
);
110 Java_gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider_getDSSICopyright_1
111 (JNIEnv
*env
, jclass clazz
__attribute__((unused
)), jlong handle
)
113 DSSI_Descriptor
*desc
= JLONG_TO_PTR(DSSI_Descriptor
,handle
);
114 const char *str
= desc
->LADSPA_Plugin
->Copyright
;
116 return (*env
)->NewStringUTF (env
, str
);
120 Java_gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider_getDSSIVendor_1
121 (JNIEnv
*env
, jclass clazz
__attribute__((unused
)), jlong handle
)
123 DSSI_Descriptor
*desc
= JLONG_TO_PTR(DSSI_Descriptor
,handle
);
124 const char *str
= desc
->LADSPA_Plugin
->Maker
;
126 return (*env
)->NewStringUTF (env
, str
);
130 Java_gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider_getDSSILabel_1
131 (JNIEnv
*env
, jclass clazz
__attribute__((unused
)), jlong handle
)
133 DSSI_Descriptor
*desc
= JLONG_TO_PTR(DSSI_Descriptor
,handle
);
134 const char *str
= desc
->LADSPA_Plugin
->Label
;
136 return (*env
)->NewStringUTF (env
, str
);