1818package net .raphimc .noteblocktool .audio .soundsystem .impl ;
1919
2020import net .raphimc .audiomixer .AudioMixer ;
21- import net .raphimc .audiomixer .sound .Sound ;
2221import net .raphimc .audiomixer .sound .source .MonoSound ;
22+ import net .raphimc .audiomixer .sound .source .StaticStereoSound ;
2323
24- import javax .sound .sampled .AudioFormat ;
2524import java .util .Map ;
2625import java .util .concurrent .BrokenBarrierException ;
2726import java .util .concurrent .CyclicBarrier ;
@@ -76,7 +75,7 @@ public synchronized void postTick() {
7675 throw new RuntimeException (e );
7776 }
7877 for (int [] threadSamples : this .threadSamples ) {
79- this .audioMixer .playSound (new StaticSound (threadSamples ));
78+ this .audioMixer .playSound (new StaticStereoSound (threadSamples ));
8079 }
8180 super .postTick ();
8281 if (this .audioMixer .getActiveSounds () != 0 ) {
@@ -99,22 +98,4 @@ public synchronized String getStatusLine() {
9998 return "Sounds: " + mixedSounds + " / " + this .maxSounds + ", " + this .threadPool .getActiveCount () + " threads" ;
10099 }
101100
102- private record StaticSound (int [] samples ) implements Sound {
103-
104- @ Override
105- public void render (final AudioFormat audioFormat , final int [] renderedSamples , final int renderedSamplesLength ) {
106- if (renderedSamplesLength != renderedSamples .length ) {
107- throw new IllegalArgumentException ("Rendered samples length must match the length of the rendered samples array" );
108- }
109-
110- System .arraycopy (this .samples , 0 , renderedSamples , 0 , renderedSamplesLength );
111- }
112-
113- @ Override
114- public boolean isFinished () {
115- return true ;
116- }
117-
118- }
119-
120101}
0 commit comments