FloatSampleSource .java

net.minecraft.client.sounds.FloatSampleSource (interface): members: EXPECTED_MAX_FRAME_SIZE, readChunk, readAll, read. imports: FloatConsumer, EnvType.

net.minecraft.client.soundsinterface35 linesclientextends FiniteAudioStream864 B

API Surface (0)

No public/protected methods detected (fields or constants only).

Fields & Constants (1)

EXPECTED_MAX_FRAME_SIZE

Code Graph: Dependencies (2)

Edges (calls / imports / inherits / references) resolved by graphify from the AST. Every chip opens the class source.

Full Source

FloatSampleSource.java35 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.client.sounds;
2
3
import it.unimi.dsi.fastutil.floats.FloatConsumer;
4
import java.io.IOException;
5
import java.nio.ByteBuffer;
6
import net.fabricmc.api.EnvType;
7
import net.fabricmc.api.Environment;
8
9
@Environment(EnvType.CLIENT)
10
public interface FloatSampleSource extends FiniteAudioStream {
11
	int EXPECTED_MAX_FRAME_SIZE = 8192;
12
13
	boolean readChunk(FloatConsumer output) throws IOException;
14
15
	@Override
16
	default ByteBuffer read(final int expectedSize) throws IOException {
17
		ChunkedSampleByteBuf output = new ChunkedSampleByteBuf(expectedSize + 8192);
18
19
		while (this.readChunk(output) && output.size() < expectedSize) {
20
		}
21
22
		return output.get();
23
	}
24
25
	@Override
26
	default ByteBuffer readAll() throws IOException {
27
		ChunkedSampleByteBuf output = new ChunkedSampleByteBuf(16384);
28
29
		while (this.readChunk(output)) {
30
		}
31
32
		return output.get();
33
	}
34
}
35

Decompiled Minecraft 26.3 source of FloatSampleSource (net/minecraft/client/sounds/FloatSampleSource.java) with Mojang official mappings, stored verbatim on the site.