cannam@140
|
1 /**
|
cannam@140
|
2 @page java_binding JPortAudio Java Binding
|
cannam@140
|
3 @ingroup jportaudio
|
cannam@140
|
4
|
cannam@140
|
5 <i>Note: this page has not been reviewed, and may contain errors.</i>
|
cannam@140
|
6
|
cannam@140
|
7 @section java_draft DRAFT - IN PROGRESS
|
cannam@140
|
8
|
cannam@140
|
9 9/4/12 JPortAudio is very new and should be considered an "alpha" release.
|
cannam@140
|
10 The building of JPortAudio will eventually be integrated into the Makefile as an optional build.
|
cannam@140
|
11
|
cannam@140
|
12 Currently JPortAudio is only supported for Windows and Macintosh. Please contact us if you want to help with porting Linux.
|
cannam@140
|
13
|
cannam@140
|
14 For reference documentation of the JPortAudio API see: com.portaudio.PortAudio
|
cannam@140
|
15
|
cannam@140
|
16 For an example see: PlaySine.java
|
cannam@140
|
17
|
cannam@140
|
18 @section java_comp_windows Building JPortAudio on Windows
|
cannam@140
|
19
|
cannam@140
|
20 Build the Java code using the Eclipse project in "jportaudio". Export as "jportaudio.jar".
|
cannam@140
|
21
|
cannam@140
|
22 If you modify the JNI API then you will need to regenerate the JNI .h files using:
|
cannam@140
|
23
|
cannam@140
|
24 @code
|
cannam@140
|
25 cd bindings/java/scripts
|
cannam@140
|
26 make_header.bat
|
cannam@140
|
27 @endcode
|
cannam@140
|
28
|
cannam@140
|
29 Build the JNI DLL using the Visual Studio 2010 solution in "java/c/build/vs2010/PortAudioJNI".
|
cannam@140
|
30
|
cannam@140
|
31 @section java_use_windows Using JPortAudio on Windows
|
cannam@140
|
32
|
cannam@140
|
33 Put the "jportaudio.jar" in the classpath for your application.
|
cannam@140
|
34 Place the following libraries where they can be found, typically in the same folder as your application.
|
cannam@140
|
35
|
cannam@140
|
36 - portaudio_x86.dll
|
cannam@140
|
37 - portaudio_x64.dll
|
cannam@140
|
38 - jportaudio_x86.dll
|
cannam@140
|
39 - jportaudio_x64.dll
|
cannam@140
|
40
|
cannam@140
|
41 @section java_comp_max Building JPortAudio on Mac
|
cannam@140
|
42
|
cannam@140
|
43 These are notes from building JPortAudio on a Mac with 10.6.8 and XCode 4.
|
cannam@140
|
44
|
cannam@140
|
45 I created a target of type 'C' library.
|
cannam@140
|
46
|
cannam@140
|
47 I added the regular PortAudio frameworks plus the JavaVM framework.
|
cannam@140
|
48
|
cannam@140
|
49 I modified com_portaudio_PortAudio.h and com_portaudio_BlockingStream.h so that jni.h could found.
|
cannam@140
|
50
|
cannam@140
|
51 @code
|
cannam@140
|
52 #if defined(__APPLE__)
|
cannam@140
|
53 #include <JavaVM/jni.h>
|
cannam@140
|
54 #else
|
cannam@140
|
55 #include <jni.h>
|
cannam@140
|
56 #endif
|
cannam@140
|
57 @endcode
|
cannam@140
|
58
|
cannam@140
|
59 This is bad because those header files are autogenerated and will be overwritten.
|
cannam@140
|
60 We need a better solution for this.
|
cannam@140
|
61
|
cannam@140
|
62 I had trouble finding the "libjportaudio.jnilib". So I added a Build Phase that copied the library to "/Users/phil/Library/Java/Extensions".
|
cannam@140
|
63
|
cannam@140
|
64 On the Mac we can create a universal library for both 32 and 64-bit JVMs. So in the JAR file I will open "jportaudio" on Apple. ON WIndows I will continue to open "jportaudio_x64" and "jportaudio_x86".
|
cannam@140
|
65 */
|