my java stupidity

Bradford Garton garton at c...
Mon Jan 14 16:00:20 EST 2002


Jsyn-ers --

I'm sorry to bug you all with this, but I've really hit the java wall here
at home. I'm sure that I'm simply not aware of how Things Java are done
in this arena. Here's the story:

I want to play back long long soundfiles using jsyn. I understand that in
order to do that, I create a SampleReader_16F2 object and put a
SampleQueueOutputStream object onto the SampleReader's samplePort. Now I
can theoretically read blocks of the soundfile and queue them onto the
SampleQueueOutputStream object using its write() method.

fine. dandy.

Sun's ^%#!^%#@ io.streams *all* seem to want read/write nothing but
char[] or byte[] arrays. SampleQueueOutputStream.write() wants a short[]
array.

I tried encapsulating the FileInputStream in a DataInputStream and calling
the DataInputStream.readShort() method, copying the incoming byte data
into a separate short[] array, but just got noise.

I'm just a "C" sort of guy. I really really really just want to do:

byte [] buffer = new byte[nframes*2];
SampleQueueOutputStream.write((short *)buffer, 0, nframes);
^^^^^^^

but I cain't.

Any advice for the java-impaired?

brad






More information about the JSyn mailing list