From 705f704ecf9ac24307238d3bdd16748112f06db6 Mon Sep 17 00:00:00 2001 From: Roi Martin Date: Thu, 27 Mar 2025 09:03:25 +0100 Subject: [PATCH] Change `WaveFormat` and `WaveCrop` signatures to accept a pointer to `Wave` The raylib functions `WaveFormat` and `WaveCrop` accept a pointer to `Wave` because the wave is updated in-place. However, the current Go bindings pass a copy of the wave to the C functions, so it is not updated. This commit changes the signatures of the Go API so they also accept a pointer to `Wave`. --- raylib/raudio.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/raylib/raudio.go b/raylib/raudio.go index ee0aba7..8f6764c 100644 --- a/raylib/raudio.go +++ b/raylib/raudio.go @@ -299,7 +299,7 @@ func SetSoundPan(sound Sound, pan float32) { } // WaveFormat - Convert wave data to desired format -func WaveFormat(wave Wave, sampleRate int32, sampleSize int32, channels int32) { +func WaveFormat(wave *Wave, sampleRate int32, sampleSize int32, channels int32) { cwave := wave.cptr() csampleRate := (C.int)(sampleRate) csampleSize := (C.int)(sampleSize) @@ -316,7 +316,7 @@ func WaveCopy(wave Wave) Wave { } // WaveCrop - Crop a wave to defined frames range -func WaveCrop(wave Wave, initFrame int32, finalFrame int32) { +func WaveCrop(wave *Wave, initFrame int32, finalFrame int32) { cwave := wave.cptr() cinitFrame := (C.int)(initFrame) cfinalFrame := (C.int)(finalFrame)