1
1
package pl .asie .computronics .util .sound ;
2
2
3
3
import com .google .common .base .Throwables ;
4
- import com .google .common .collect .Interner ;
5
- import com .google .common .collect .Interners ;
6
4
import cpw .mods .fml .common .FMLCommonHandler ;
7
5
import cpw .mods .fml .common .eventhandler .SubscribeEvent ;
8
6
import cpw .mods .fml .common .gameevent .TickEvent .ClientTickEvent ;
@@ -329,8 +327,6 @@ public static Audio instance() {
329
327
return INSTANCE ;
330
328
}
331
329
332
- private static final Interner <Byte > interner = Interners .newStrongInterner ();
333
-
334
330
public void play (float x , float y , float z , Queue <Instruction > instructions ) {
335
331
Minecraft mc = Minecraft .getMinecraft ();
336
332
float distanceBasedGain = ((float ) Math .max (0 , 1 - mc .thePlayer .getDistance (x , y , z ) / maxDistance ));
@@ -348,7 +344,7 @@ public void play(float x, float y, float z, Queue<Instruction> instructions) {
348
344
for (int sample = 0 ; sample < sampleCount ; ++sample ) {
349
345
for (AudioUtil .State state : process .states ) {
350
346
int value = ((byte ) (state .gate .getValue (process , state ) * amplitude )) ^ 0x80 ;
351
- state .data .add ( interner . intern (( byte ) value ) );
347
+ state .data .write (( byte ) value );
352
348
}
353
349
}
354
350
process .delay = 0 ;
@@ -366,7 +362,7 @@ public void play(float x, float y, float z, Queue<Instruction> instructions) {
366
362
synchronized (sources ) {
367
363
for (AudioUtil .State state : process .states ) {
368
364
ByteBuffer buf = BufferUtils .createByteBuffer (state .data .size ());
369
- for (Byte aByte : state .data ) {
365
+ for (byte aByte : state .data . toByteArray () ) {
370
366
buf .put (aByte );
371
367
}
372
368
sources .add (new Source (x , y , z , buf , gain ));
0 commit comments