I want to use jFugue to play some MIDI music in an applet. There's a class for the MIDI pattern - Pattern
- and the only method to load the pattern is from a File. Now, I don't know how applets load files and what not, but I am using a framework (PulpCore) that makes loading assets a simple task. If I need to grab an asset from a ZIP catalogue, I can use the Assets
class which provides get()
and getAsStream()
methods. get()
returns the given asset as a ByteArray
, the other as an InputStream
.
I need jFugue to load the pattern from either ByteArray
or InputStream
.
In pseudo-code, I would like to do this:
Pattern.load(new File(Assets.get("mymidifile.midi")));
However there is no File constructor that would take a ByteArray. Suggestions, please?
It's true that jFugue doesn't allow to load anything but a file, which is a shame because nothing prevents from using any other kind of stream:
UPDATE (for loadMidi)