Im experimenting with this JNI thingy here....
I want to try to make an AudioFormat object (as a jobject of course)
and pass that to java.
In the JNI book from Sun it says that you need to get the class that
you will make instances from (FindClass), get the constructor
(GetMethodID), then finally use NewObject to get the jobject and return
it. Correct me if im wrong
The Constructor i want to use in AudioFormat looks like this:
AudioFormat(AudioFormat.Encoding encoding, float sampleRate, int
sampleSizeInBits, int channels, int frameSize, float frameRate, boolean
bigEndian)
What do i do with the AudioFormat.Encoding argument?
Gordon Beaton - 27 Jan 2006 06:58 GMT
> Im experimenting with this JNI thingy here....
>
[quoted text clipped - 5 lines]
> (GetMethodID), then finally use NewObject to get the jobject and
> return it. Correct me if im wrong
That's about right.
A tip is to use "javap -s MyClass" to determine the correct method and
constructor signatures to use in e.g. GetMethodID().
Note too that you must include any package name when you specify the
class, in a slightly different format than you're used to, e.g.:
jclass cls = (*env)->FindClass(env, "java/lang/String").
> The Constructor i want to use in AudioFormat looks like this:
>
[quoted text clipped - 3 lines]
>
> What do i do with the AudioFormat.Encoding argument?
If you need to pass an object (such as AudioFormat.Encoding) to any
constructor or method, then of course you need to start by creating
(or obtaining) one of those before you can invoke the constructor or
method itself.
/gordon

Signature
[ do not email me copies of your followups ]
g o r d o n + n e w s @ b a l d e r 1 3 . s e
res7cxbi@verizon.net - 28 Jan 2006 02:39 GMT