Fix audio bug

This commit is contained in:
NeilClack
2026-03-25 17:17:22 -05:00
parent 8763f70452
commit 205b068fbf
5 changed files with 33 additions and 57 deletions
+8 -3
View File
@@ -37,9 +37,12 @@ package mix
//}
//#endif
import "C"
import "unsafe"
import "reflect"
import "github.com/veandco/go-sdl2/sdl"
import (
"reflect"
"unsafe"
"github.com/veandco/go-sdl2/sdl"
)
// Chunk is the internal format for an audio chunk.
// (https://www.libsdl.org/projects/SDL_mixer/docs/SDL_mixer_85.html)
@@ -212,6 +215,7 @@ func LoadWAV(file string) (chunk *Chunk, err error) {
chunk = (*Chunk)(unsafe.Pointer(C.Mix_LoadWAV_RW(C.SDL_RWFromFile(_file, _rb), 1)))
if chunk == nil {
err = sdl.GetError()
return nil, err
}
return
}
@@ -224,6 +228,7 @@ func LoadMUS(file string) (mus *Music, err error) {
mus = (*Music)(unsafe.Pointer(C.Mix_LoadMUS(_file)))
if mus == nil {
err = sdl.GetError()
return nil, err
}
return
}