44 package com.portaudio;
63 private long nativeStream;
64 private int inputFormat = -1;
65 private int outputFormat = -1;
81 private native
boolean readFloats(
float[] buffer,
int numFrames );
83 private native
boolean writeFloats(
float[] buffer,
int numFrames );
93 public boolean read(
float[] buffer,
int numFrames )
97 throw new RuntimeException(
98 "Tried to read float samples from a non float stream." );
100 return readFloats( buffer, numFrames );
112 public boolean write(
float[] buffer,
int numFrames )
116 throw new RuntimeException(
117 "Tried to write float samples to a non float stream." );
119 return writeFloats( buffer, numFrames );
122 private native
boolean readShorts(
short[] buffer,
int numFrames );
124 private native
boolean writeShorts(
short[] buffer,
int numFrames );
134 public boolean read(
short[] buffer,
int numFrames )
136 if( inputFormat !=
PortAudio.FORMAT_INT_16 )
138 throw new RuntimeException(
139 "Tried to read short samples from a non short stream." );
141 return readShorts( buffer, numFrames );
152 public boolean write(
short[] buffer,
int numFrames )
154 if( outputFormat !=
PortAudio.FORMAT_INT_16 )
156 throw new RuntimeException(
157 "Tried to write short samples from a non short stream." );
159 return writeShorts( buffer, numFrames );
165 public native
void start();
171 public native
void stop();
176 public native
void abort();
182 public native
void close();
184 public native
boolean isStopped();
186 public native
boolean isActive();
188 public String toString()
190 return "BlockingStream: streamPtr = " + Long.toHexString( nativeStream )
191 +
", inFormat = " + inputFormat +
", outFormat = "
198 public native
double getTime();
200 private native
void getInfo( StreamInfo streamInfo );
202 public StreamInfo getInfo()
204 StreamInfo streamInfo =
new StreamInfo();
205 getInfo( streamInfo );