<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <meta name="generator" content="Doxygen 1.8.3.1"/> <title>PortAudio: JPortAudio Java Binding</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="dynsections.js"></script> <link href="doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div, it is closed by doxygen! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td style="padding-left: 0.5em;"> <div id="projectname">PortAudio  <span id="projectnumber">2.0</span> </div> </td> </tr> </tbody> </table> </div> <!-- end header part --> <!-- Generated by Doxygen 1.8.3.1 --> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main Page</span></a></li> <li class="current"><a href="pages.html"><span>Related Pages</span></a></li> <li><a href="modules.html"><span>Modules</span></a></li> <li><a href="annotated.html"><span>Data Structures</span></a></li> <li><a href="files.html"><span>Files</span></a></li> </ul> </div> </div><!-- top --> <div class="header"> <div class="headertitle"> <div class="title">JPortAudio Java Binding </div> </div> </div><!--header--> <div class="contents"> <div class="textblock"><p><em>Note: this page has not been reviewed, and may contain errors.</em></p> <h1><a class="anchor" id="java_draft"></a> DRAFT - IN PROGRESS</h1> <p>9/4/12 JPortAudio is very new and should be considered an "alpha" release. The building of JPortAudio will eventually be integrated into the Makefile as an optional build.</p> <p>Currently JPortAudio is only supported for Windows and Macintosh. Please contact us if you want to help with porting Linux.</p> <p>For reference documentation of the JPortAudio API see: <a class="el" href="classcom_1_1portaudio_1_1PortAudio.html">com.portaudio.PortAudio</a></p> <p>For an example see: <a class="el" href="PlaySine_8java.html" title="Example that shows how to play sine waves using JPortAudio.">PlaySine.java</a></p> <h1><a class="anchor" id="java_comp_windows"></a> Building JPortAudio on Windows</h1> <p>Build the Java code using the Eclipse project in "jportaudio". Export as "jportaudio.jar".</p> <p>If you modify the JNI API then you will need to regenerate the JNI .h files using:</p> <div class="fragment"><div class="line">cd bindings/java/scripts</div> <div class="line">make_header.bat</div> </div><!-- fragment --><p>Build the JNI DLL using the Visual Studio 2010 solution in "java/c/build/vs2010/PortAudioJNI".</p> <h1><a class="anchor" id="java_use_windows"></a> Using JPortAudio on Windows</h1> <p>Put the "jportaudio.jar" in the classpath for your application. Place the following libraries where they can be found, typically in the same folder as your application.</p> <ul> <li>portaudio_x86.dll</li> <li>portaudio_x64.dll</li> <li>jportaudio_x86.dll</li> <li>jportaudio_x64.dll</li> </ul> <h1><a class="anchor" id="java_comp_max"></a> Building JPortAudio on Mac</h1> <p>These are notes from building JPortAudio on a Mac with 10.6.8 and XCode 4.</p> <p>I created a target of type 'C' library.</p> <p>I added the regular PortAudio frameworks plus the JavaVM framework.</p> <p>I modified <a class="el" href="com__portaudio__PortAudio_8h_source.html">com_portaudio_PortAudio.h</a> and <a class="el" href="com__portaudio__BlockingStream_8h_source.html">com_portaudio_BlockingStream.h</a> so that jni.h could found.</p> <div class="fragment"><div class="line"><span class="preprocessor">#if defined(__APPLE__)</span></div> <div class="line"><span class="preprocessor"></span><span class="preprocessor">#include <JavaVM/jni.h></span></div> <div class="line"><span class="preprocessor">#else</span></div> <div class="line"><span class="preprocessor"></span><span class="preprocessor">#include <jni.h></span></div> <div class="line"><span class="preprocessor">#endif</span></div> </div><!-- fragment --><p>This is bad because those header files are autogenerated and will be overwritten. We need a better solution for this.</p> <p>I had trouble finding the "libjportaudio.jnilib". So I added a Build Phase that copied the library to "/Users/phil/Library/Java/Extensions".</p> <p>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". </p> </div></div><!-- contents --> <hr size="1"><address style="text-align: right;"><small>Generated for PortAudio by <a href="http://www.doxygen.org/index.html"> <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a>1.8.3.1</small></address> </body> </html>