Skip to content

Commit

Permalink
8336920: ArithmeticException in javax.sound.sampled.AudioInputStream
Browse files Browse the repository at this point in the history
Reviewed-by: azvegint, prr
  • Loading branch information
Alexander Zuev committed Jan 16, 2025
1 parent bdf6e63 commit 9c430c9
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -58,6 +58,10 @@ public void interpolate(float[] in, float[] in_offset, float in_end,
int p_ix = (int) (ix * (1 << 15));
int p_ix_end = (int) (ix_end * (1 << 15));
int p_pitch = (int) (pitch * (1 << 15));
if (p_pitch == 0) {
// If pitch falls below the minimum assume minimum pitch
p_pitch = 1;
}
// Pitch needs to recalculated
// to ensure no drift between p_ix and ix.
pitch = p_pitch * (1f / (1 << 15));
Expand Down

0 comments on commit 9c430c9

Please sign in to comment.