Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit acf9d06

Browse files
committedMay 4, 2016
This was easy.
1 parent 4336f08 commit acf9d06

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed
 

‎src/main/java/pl/asie/computronics/util/sound/Audio.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ public void play(float x, float y, float z, Queue<Instruction> instructions) {
348348
for(int sample = 0; sample < sampleCount; ++sample) {
349349
for(AudioUtil.State state : process.states) {
350350
int value = ((byte) (state.gate.getValue(process, state) * amplitude)) ^ 0x80;
351-
state.data.add(interner.intern((byte) value));
351+
state.data.write(interner.intern((byte) value));
352352
}
353353
}
354354
process.delay = 0;
@@ -366,7 +366,7 @@ public void play(float x, float y, float z, Queue<Instruction> instructions) {
366366
synchronized(sources) {
367367
for(AudioUtil.State state : process.states) {
368368
ByteBuffer buf = BufferUtils.createByteBuffer(state.data.size());
369-
for(Byte aByte : state.data) {
369+
for(byte aByte : state.data.toByteArray()) {
370370
buf.put(aByte);
371371
}
372372
sources.add(new Source(x, y, z, buf, gain));

‎src/main/java/pl/asie/computronics/util/sound/AudioUtil.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
import com.google.common.collect.ImmutableList;
44
import pl.asie.computronics.reference.Config;
55

6+
import java.io.ByteArrayOutputStream;
67
import java.util.ArrayList;
7-
import java.util.List;
88

99
/**
1010
* @author Vexatos
@@ -177,7 +177,7 @@ public static class State {
177177
public ADSR envelope;
178178

179179
public boolean isFreqMod, isAmpMod;
180-
public final List<Byte> data = new ArrayList<Byte>();
180+
public final ByteArrayOutputStream data = new ByteArrayOutputStream();
181181

182182
public State(int channelIndex) {
183183
this.wave = new Wave();

0 commit comments

Comments
 (0)
Please sign in to comment.