Re: [sdljava-users] Problem with SDLMixer
Status: Beta
Brought to you by:
ivan_ganza
|
From: Robert S. <the...@gm...> - 2005-01-22 22:44:25
|
Great! That was the problem.
Along with that I fixed the problem with the loading of URLs from the
net (or arbitrary slow locations). The problem with your implementation
was that you asserted that InputStream.available() returns the complete
size of the stream. However available() returns only the amount of bytes
that can be read without blocking.
I fixed BufferUtil.readInputStream() in the following way:
I am reading the parts of the stream into separate ByteBuffers until the
stream is really finished. Afterwards I merge the buffers into one big
buffer and return that.
The implementation uses Channel.newChannel() to retrieve a
ReadableByteChannel which allows a ByteBuffer for its read() method. The
behavior of this method is otherwise the same as InputStream.read(). The
important bit is that -1 is returned when the end of the stream is reached.
I have attached the patch to this mail. Tell me if the list daemon rips
it away to send it to you directly.
If you are using BeanShell try this snippet as a proof of concept:
import sdljava.*;
import sdljava.mixer.*;
SDLMain.init(SDLMain.SDL_INIT_AUDIO);
SDLMixer.openAudio(44100, SDLMixer.AUDIO_S16SYS, 2, 4096);
imc = SDLMixer.loadWAV(new
URL("http://www.barbneal.com/wav/lucy/lucy01.wav"));
SDLMixer.playChannel(0, imc, 0);
However you can add type information and make that a real Java class,
too. :-)
cu
Robert
Btw: Thanks again for reviving the Java binding for SDL. sdljava is the
first library that allows me to do portable sound output in Java without
having to sacrifice other useful Java API (like resource loading system
which is essential for JNLP!).
Ivan Z. Ganza wrote:
> Make sure you have at least SDL Mixer 1.2.6 as the Mix_LoadMUS_RW was
> added for 1.2.6. Its strange though that you were able to compile if
> this function wasn't present.
>
> BTW I've found that loading over the network doesn't work, filebased
> urls are fine though. I need to find an example of the proper way to
> load a byte stream from a URL....
>
> Let me know if this helped.
> -Ivan/
>
> Robert Schuster wrote:
>
>> Hi,
>> I wanted to try the new URL based loading of WAV file and was stopped
>> by this:
>>
>> java.lang.UnsatisfiedLinkError:
>> /home/rob/tmp/lwtest/libsdljava_mixer.so:
>> /home/rob/tmp/lwtest/libsdljava_mixer.so: undefined symbol:
>> Mix_LoadMUS_RW
>> at java.lang.ClassLoader$NativeLibrary.load(Native Method)
>> at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1586)
>> at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1511)
>> at java.lang.Runtime.loadLibrary0(Runtime.java:788)
>> at java.lang.System.loadLibrary(System.java:834)
>> at sdljava.mixer.SDLMixer.<clinit>(SDLMixer.java:1184)
>>
>> I took sdljava from CVS (01.22.05) and compiled all files (using
>> Blackdown 1.4.2 for GNU/Linux).
>>
>> cu
>> Robert
>>
>>
>> -------------------------------------------------------
>> This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
>> Tool for open source databases. Create drag-&-drop reports. Save time
>> by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
>> Download a FREE copy at http://www.intelliview.com/go/osdn_nl
>> _______________________________________________
>> sdljava-users mailing list
>> sdl...@li...
>> https://lists.sourceforge.net/lists/listinfo/sdljava-users
>
>
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
> Tool for open source databases. Create drag-&-drop reports. Save time
> by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
> Download a FREE copy at http://www.intelliview.com/go/osdn_nl
> _______________________________________________
> sdljava-users mailing list
> sdl...@li...
> https://lists.sourceforge.net/lists/listinfo/sdljava-users
>
>
|