Skip to content

Commit

Permalink
Fix Godot's cubic resampling algorithm
Browse files Browse the repository at this point in the history
  • Loading branch information
ellenhp committed Jul 30, 2021
1 parent 57ccfab commit 2d450c6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions servers/audio/audio_stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ void AudioStreamPlaybackResampled::mix(AudioFrame *p_buffer, float p_rate_scale,
AudioFrame y3 = internal_buffer[idx - 0];

float mu2 = mu * mu;
AudioFrame a0 = y3 - y2 - y0 + y1;
AudioFrame a1 = y0 - y1 - a0;
AudioFrame a0 = 3 * y1 - 3 * y2 + y3 - y0;
AudioFrame a1 = 2 * y0 - 5 * y1 + 4 * y2 - y3;
AudioFrame a2 = y2 - y0;
AudioFrame a3 = y1;
AudioFrame a3 = 2 * y1;

p_buffer[i] = (a0 * mu * mu2 + a1 * mu2 + a2 * mu + a3);
p_buffer[i] = (a0 * mu * mu2 + a1 * mu2 + a2 * mu + a3) / 2;

mix_offset += mix_increment;

Expand Down

0 comments on commit 2d450c6

Please sign in to comment.