Skip to content

Commit

Permalink
Fixed crash when samples per tick are not even
Browse files Browse the repository at this point in the history
  • Loading branch information
Lenni0451 committed May 9, 2024
1 parent bc9a169 commit d7694e3
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public JavaxSoundSystem(final float playbackSpeed) {

try {
this.sounds = SoundMap.loadInstrumentSamples(FORMAT);
this.samplesPerTick = (int) (FORMAT.getSampleRate() / playbackSpeed * FORMAT.getChannels());
this.samplesPerTick = (int) (FORMAT.getSampleRate() / playbackSpeed) * FORMAT.getChannels();
this.dataLine = AudioSystem.getSourceDataLine(FORMAT);
this.dataLine.open(FORMAT, (int) FORMAT.getSampleRate());
this.dataLine.start();
Expand Down

0 comments on commit d7694e3

Please sign in to comment.