buffer = ByteBuffer.allocateDirect(buf.length);
buffer.put(buf);
buffer.flip();
SampleData audioData = new SampleData(new ByteBufferInputStream(buffer), header, sample_name);
samples.put(sample_id, audioData);
sample_id++;
}
sample_id = 1000; // ogg samples use id 1000~?
while(file_offset < filesize) // OGG data
{
buffer = f.getChannel().map(java.nio.channels.FileChannel.MapMode.READ_ONLY, file_offset, 36);
buffer.order(java.nio.ByteOrder.LITTLE_ENDIAN);
file_offset += 36;
byte[] byte_name = new byte[32];
buffer.get(byte_name);
String sample_name = ByteHelper.toString(byte_name);
if(sample_name.lastIndexOf(".") < 0) sample_name += ".ogg";
int sample_size = buffer.getInt();
if(sample_size == 0){ sample_id++; continue; }
buffer = f.getChannel().map(java.nio.channels.FileChannel.MapMode.READ_ONLY, file_offset, sample_size);
buffer.order(java.nio.ByteOrder.LITTLE_ENDIAN);
file_offset += sample_size;
SampleData audioData = new SampleData(new ByteBufferInputStream(buffer), SampleData.Type.OGG, sample_name);
samples.put(sample_id, audioData);
sample_id++;
}
return samples;