mirror of
https://github.com/godotengine/godot.git
synced 2024-11-21 19:42:43 +00:00
Merge pull request #83536 from wareya/new_cubic
Optimize cubic hermite algorithm in AudioStreamPlaybackResampled
This commit is contained in:
commit
73a0f6e90f
@ -173,12 +173,12 @@ int AudioStreamPlaybackResampled::mix(AudioFrame *p_buffer, float p_rate_scale,
|
||||
}
|
||||
|
||||
float mu2 = mu * mu;
|
||||
AudioFrame a0 = 3 * y1 - 3 * y2 + y3 - y0;
|
||||
AudioFrame a1 = 2 * y0 - 5 * y1 + 4 * y2 - y3;
|
||||
AudioFrame a2 = y2 - y0;
|
||||
AudioFrame a3 = 2 * y1;
|
||||
float h11 = mu2 * (mu - 1);
|
||||
float z = mu2 - h11;
|
||||
float h01 = z - h11;
|
||||
float h10 = mu - z;
|
||||
|
||||
p_buffer[i] = (a0 * mu * mu2 + a1 * mu2 + a2 * mu + a3) / 2;
|
||||
p_buffer[i] = y1 + (y2 - y1) * h01 + ((y2 - y0) * h10 + (y3 - y1) * h11) * 0.5;
|
||||
|
||||
mix_offset += mix_increment;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user