Re: Javasound recording not working in Eclipse
From: Michael Amling (nospam_at_nospam.com)
Date: 07/14/04
- Next message: Krishna Tyner: "Online Chat: Sun Game Server Technology"
- Previous message: Robert Klemme: "Re: Can you do full-screen editing in Eclipse?"
- In reply to: Charles Fox: "Javasound recording not working in Eclipse"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 14 Jul 2004 02:50:21 GMT
Charles Fox wrote:
> byte[] b = new byte[1000];
> while (true) {
> int ok = m_line.read(b, 0, 1000);
The variable "ok" has a useful value, but you ignore it. If ok<=0,
doesn't that mean end-of-file? Any time ok<1000, you may print up to a
thousand spurious zeros.
> out("read a window");
> //this window would now be passed to Matlab/Octave for analysis.
> // Just print it for now.
> for (int i = 0; i < 1000; i++) {
> System.out.println(b[i]);
> }
> }
At minimum, you should change this to
...
int ok=m_line.read(b, 0, 1000);
if (ok>0) {
out("read a window");
for (int i=0; i<ok; i++) {
System.out.println(b[i]);
}
} else {
// close, break, or something
}
...
--Mike Amling
- Next message: Krishna Tyner: "Online Chat: Sun Game Server Technology"
- Previous message: Robert Klemme: "Re: Can you do full-screen editing in Eclipse?"
- In reply to: Charles Fox: "Javasound recording not working in Eclipse"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]