Skip to content
This repository was archived by the owner on Jan 6, 2023. It is now read-only.

Commit fdc3627

Browse files
committed
updates readme
1 parent 90218d8 commit fdc3627

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,12 @@ try(Sound sound = new Sound(new BufferedInputStream(Files.newInputStream(path)))
4848

4949
// Another example: getting and decoding a sound from a resource file in your JAR
5050
try(Sound sound = new Sound(new BufferedInputStream(MyClass.class.getResourceAsStream("/mp3/rick_astley.mp3")))) {
51-
5251
// ...
53-
5452
}
5553

5654
```
5755

58-
As expected from an InputStream, the creation of the stream will **not block**, and it is only when reading bytes from the stream, that the processing will take place (for the Sound class, that is the MPEG decoding process). You may get metadata about the sound as soon as you have instantiated it.
56+
As expected from an InputStream, the creation of the stream will not block, and it is only when reading bytes from the stream, that the decoding process will take place. You may get metadata about the sound as soon as you have instantiated it.
5957

6058
Let's have a look at some examples on how to use the decoded raw PCM sound data samples:
6159

@@ -80,6 +78,7 @@ Sound sound = /* ... */;
8078
// Let's store the whole decoded data in an array, because we need the number of samples; it's okay for short sounds
8179
ByteArrayOutputStream os = new ByteArrayOutputStream();
8280
int read = sound.decodeFullyInto(os);
81+
// LWJGL API stuff ...
8382
ByteBuffer data = BufferUtils.createByteBuffer(read);
8483
data.put(os.toByteArray()).flip(); // LWJGL needs a direct buffer, cannot simply wrap the BAOS array
8584
alBufferData(buffer, sound.isStereo() ? AL_FORMAT_STEREO16 : AL_FORMAT_MONO16, data, sound.getSamplingFrequency());

0 commit comments

Comments
 (0)