Commit e857c254 authored by philburk's avatar philburk

Initial check-in for an experimental Java binding for PortAudio called JPortAudio.

git-svn-id: https://subversion.assembla.com/svn/portaudio/portaudio/trunk@1860 0f58301d-fd10-0410-b4af-bbb618454e57
parent e051faaf
......@@ -84,6 +84,7 @@ WARN_LOGFILE =
#---------------------------------------------------------------------------
INPUT = doc/src \
include \
bindings/java \
examples
FILE_PATTERNS = *.h \
*.c \
......
......@@ -84,6 +84,7 @@ WARN_LOGFILE =
#---------------------------------------------------------------------------
INPUT = doc/src \
include \
bindings/java \
examples \
src \
test \
......

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PortAudioJNI", "PortAudioJNI.vcxproj", "{4024D885-39B0-4C8A-B3E7-BAB4BA08DFBB}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{4024D885-39B0-4C8A-B3E7-BAB4BA08DFBB}.Debug|Win32.ActiveCfg = Debug|Win32
{4024D885-39B0-4C8A-B3E7-BAB4BA08DFBB}.Debug|Win32.Build.0 = Debug|Win32
{4024D885-39B0-4C8A-B3E7-BAB4BA08DFBB}.Debug|x64.ActiveCfg = Debug|x64
{4024D885-39B0-4C8A-B3E7-BAB4BA08DFBB}.Debug|x64.Build.0 = Debug|x64
{4024D885-39B0-4C8A-B3E7-BAB4BA08DFBB}.Release|Win32.ActiveCfg = Release|Win32
{4024D885-39B0-4C8A-B3E7-BAB4BA08DFBB}.Release|Win32.Build.0 = Release|Win32
{4024D885-39B0-4C8A-B3E7-BAB4BA08DFBB}.Release|x64.ActiveCfg = Release|x64
{4024D885-39B0-4C8A-B3E7-BAB4BA08DFBB}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="PortAudioJNI"
ProjectGUID="{4024D885-39B0-4C8A-B3E7-BAB4BA08DFBB}"
RootNamespace="PortAudioJNI"
Keyword="Win32Proj"
TargetFrameworkVersion="196613"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="..\..\..\..\jportaudio"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="C:\glassfish3\jdk\include;C:\glassfish3\jdk\include\win32"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;PORTAUDIOJNI_EXPORTS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;PORTAUDIOJNI_EXPORTS"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="..\..\..\src\com_portaudio_PortAudio.c"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath="..\..\..\src\com_portaudio_PortAudio.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{4024D885-39B0-4C8A-B3E7-BAB4BA08DFBB}</ProjectGuid>
<RootNamespace>PortAudioJNI</RootNamespace>
<Keyword>Win32Proj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\..\..\jportaudio\</OutDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\..\..\..\jportaudio\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\..\..\jportaudio</OutDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\..\..\jportaudio</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">jportaudio_x64</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">jportaudio_x86</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">jportaudio_x86</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">jportaudio_x64</TargetName>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>C:\glassfish3\jdk\include;C:\glassfish3\jdk\include\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;PORTAUDIOJNI_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>C:\Users\phil\Work\portaudio\pasvn\include;C:\glassfish3\jdk\include;C:\glassfish3\jdk\include\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;PORTAUDIOJNI_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;PORTAUDIOJNI_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<AdditionalIncludeDirectories>C:\Users\phil\Work\portaudio\pasvn\include;C:\glassfish3\jdk\include;C:\glassfish3\jdk\include\win32</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;PORTAUDIOJNI_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<AdditionalIncludeDirectories>C:\Users\phil\Work\portaudio\pasvn\include;C:\glassfish3\jdk\include;C:\glassfish3\jdk\include\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\..\src\com_portaudio_BlockingStream.c" />
<ClCompile Include="..\..\..\src\com_portaudio_PortAudio.c" />
<ClCompile Include="..\..\..\src\jpa_tools.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\..\src\com_portaudio_BlockingStream.h" />
<ClInclude Include="..\..\..\src\com_portaudio_PortAudio.h" />
<ClInclude Include="..\..\..\src\jpa_tools.h" />
</ItemGroup>
<ItemGroup>
<Library Include="..\..\..\..\jportaudio\portaudio_x64.lib" />
<Library Include="..\..\..\..\jportaudio\portaudio_x86.lib" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
\ No newline at end of file
/*
* Portable Audio I/O Library
* Java Binding for PortAudio
*
* Based on the Open Source API proposed by Ross Bencina
* Copyright (c) 2008 Ross Bencina
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files
* (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge,
* publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/*
* The text above constitutes the entire PortAudio license; however,
* the PortAudio community also makes the following non-binding requests:
*
* Any person wishing to distribute modifications to the Software is
* requested to send the modifications to the original developer so that
* they can be incorporated into the canonical version. It is also
* requested that these non-binding requests be included along with the
* license above.
*/
#include "com_portaudio_BlockingStream.h"
#include "portaudio.h"
#include "jpa_tools.h"
/*
* Class: com_portaudio_BlockingStream
* Method: getReadAvailable
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_com_portaudio_BlockingStream_getReadAvailable
(JNIEnv *env, jobject blockingStream)
{
PaStream *stream =jpa_GetStreamPointer( env, blockingStream );
if( stream == NULL ) return 0;
return Pa_GetStreamReadAvailable( stream );
}
/*
* Class: com_portaudio_BlockingStream
* Method: getWriteAvailable
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_com_portaudio_BlockingStream_getWriteAvailable
(JNIEnv *env, jobject blockingStream)
{
PaStream *stream =jpa_GetStreamPointer( env, blockingStream );
if( stream == NULL ) return 0;
return Pa_GetStreamWriteAvailable( stream );
}
/*
* Class: com_portaudio_BlockingStream
* Method: writeFloats
* Signature: ([FI)V
*/
JNIEXPORT void JNICALL Java_com_portaudio_BlockingStream_writeFloats
(JNIEnv *env, jobject blockingStream, jfloatArray buffer, jint numFrames)
{
jfloat *carr;
jint err;
PaStream *stream =jpa_GetStreamPointer( env, blockingStream );
if( buffer == NULL )
{
(*env)->ThrowNew( env, (*env)->FindClass(env,"java/lang/RuntimeException"),
"null stream buffer");
return;
}
carr = (*env)->GetFloatArrayElements(env, buffer, NULL);
if (carr == NULL)
{
(*env)->ThrowNew( env, (*env)->FindClass(env,"java/lang/RuntimeException"),
"invalid stream buffer");
return;
}
err = Pa_WriteStream( stream, carr, numFrames );
(*env)->ReleaseFloatArrayElements(env, buffer, carr, 0);
jpa_CheckError( env, err );
}
/*
* Class: com_portaudio_BlockingStream
* Method: readFloats
* Signature: ([FI)V
*/
JNIEXPORT void JNICALL Java_com_portaudio_BlockingStream_readFloats
(JNIEnv *env, jobject blockingStream, jfloatArray buffer, jint numFrames)
{
jfloat *carr;
jint err;
PaStream *stream =jpa_GetStreamPointer( env, blockingStream );
if( buffer == NULL )
{
(*env)->ThrowNew( env, (*env)->FindClass(env,"java/lang/RuntimeException"),
"null stream buffer");
return;
}
carr = (*env)->GetFloatArrayElements(env, buffer, NULL);
if (carr == NULL)
{
(*env)->ThrowNew( env, (*env)->FindClass(env,"java/lang/RuntimeException"),
"invalid stream buffer");
return;
}
err = Pa_ReadStream( stream, carr, numFrames );
(*env)->ReleaseFloatArrayElements(env, buffer, carr, 0);
jpa_CheckError( env, err );
}
/*
* Class: com_portaudio_BlockingStream
* Method: writeShorts
* Signature: ([FI)V
*/
JNIEXPORT void JNICALL Java_com_portaudio_BlockingStream_writeShorts
(JNIEnv *env, jobject blockingStream, jfloatArray buffer, jint numFrames)
{
jshort *carr;
jint err;
PaStream *stream =jpa_GetStreamPointer( env, blockingStream );
if( buffer == NULL )
{
(*env)->ThrowNew( env, (*env)->FindClass(env,"java/lang/RuntimeException"),
"null stream buffer");
return;
}
carr = (*env)->GetShortArrayElements(env, buffer, NULL);
if (carr == NULL)
{
(*env)->ThrowNew( env, (*env)->FindClass(env,"java/lang/RuntimeException"),
"invalid stream buffer");
return;
}
err = Pa_WriteStream( stream, carr, numFrames );
(*env)->ReleaseShortArrayElements(env, buffer, carr, 0);
jpa_CheckError( env, err );
}
/*
* Class: com_portaudio_BlockingStream
* Method: readShorts
* Signature: ([FI)V
*/
JNIEXPORT void JNICALL Java_com_portaudio_BlockingStream_readShorts
(JNIEnv *env, jobject blockingStream, jfloatArray buffer, jint numFrames)
{
jshort *carr;
jint err;
PaStream *stream =jpa_GetStreamPointer( env, blockingStream );
if( buffer == NULL )
{
(*env)->ThrowNew( env, (*env)->FindClass(env,"java/lang/RuntimeException"),
"null stream buffer");
return;
}
carr = (*env)->GetShortArrayElements(env, buffer, NULL);
if (carr == NULL)
{
(*env)->ThrowNew( env, (*env)->FindClass(env,"java/lang/RuntimeException"),
"invalid stream buffer");
return;
}
err = Pa_ReadStream( stream, carr, numFrames );
(*env)->ReleaseShortArrayElements(env, buffer, carr, 0);
jpa_CheckError( env, err );
}
/*
* Class: com_portaudio_BlockingStream
* Method: start
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_com_portaudio_BlockingStream_start
(JNIEnv *env, jobject blockingStream )
{
PaStream *stream = jpa_GetStreamPointer( env, blockingStream );
int err = Pa_StartStream( stream );
jpa_CheckError( env, err );
}
/*
* Class: com_portaudio_BlockingStream
* Method: stop
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_com_portaudio_BlockingStream_stop