08-18-2010, 08:14 PM
(08-18-2010, 07:57 PM)yann Wrote: Note that I'm not playing from xuggler (although their examples do play fine too); the sound is decoded and fed back into PSP memory, so clearly some sound makes it out of the emulator but not all. MediaEngine seems to expect filenames and play on its own, which may not be quite the right timing, and requires somehow acquiring the whole file first. My main problem right now is just that; I have the initial 24K, and don't know how to get the rest. Beyond that, there's the fact that the game won't run, which it did in Windows.
You can easily use the MediaEngine in JPCSP to playback audio data.
You just need something like this in AtracCodec:
Code:
// Initialize the MediaEngine and a new PacketChannel (atChannel in this case).
protected MediaEngine me = new MediaEngine();
protected PacketChannel atChannel = new PacketChannel();
// Under atracSetData and atracAddStreamData:
atChannel.writePacket(address, length);
// Under atracDecodeData:
if(me.getContainer() != null) {
me.step();
} else {
me.init(atChannel.getFilePath());
}
// Under atracResetPlayPosition:
me.getContainer().seekKeyFrame(0, 0, 8);
The file handling you see in the PacketChannel is all internal. It creates a temporary file to act as a buffer (this is due to issues with ByteChannel when operating on large data, but the final goal is to get rid of the temporary file).
You can then obtain all the necessary data (sizes, timestamps) from the MediaEngine instance.
Of course that full integration with sceAtrac3plus needs more work around this, especially in terms of data handling. That's why we're still waiting for the ATRAC3+ codec before starting to work on this.