作者:TomMurra
项目:go-sdl
func LoadWAV(file string) *Chunk {
_file := C.CString(file)
defer C.free(unsafe.Pointer(_file))
_rb := C.CString("rb")
defer C.free(unsafe.Pointer(_rb))
return (*Chunk)(unsafe.Pointer(C.Mix_LoadWAV_RW(C.SDL_RWFromFile(_file, _rb), 1)))
}
作者:swanteschol
项目:codin
func loadSoundFromData(data []Double, sps int) *C.Mix_Chunk {
bytes := util.CreateWavBytes(data, sps)
rwop := C.SDL_RWFromConstMem(unsafe.Pointer(&bytes[0]), C.int(len(bytes)))
chunk := C.Mix_LoadWAV_RW(rwop, 1)
if chunk == nil {
panic(fmt.Sprintf("Unable to load Sound data: %v", util.GetMixError()))
}
return chunk
}
作者:flaz
项目:go-sdl
func LoadWAV_RW(src *sdl.RWops, freesrc bool) (chunk *Chunk, err error) {
_src := (*C.SDL_RWops)(unsafe.Pointer(src))
_freesrc := cint(freesrc)
chunk = (*Chunk)(unsafe.Pointer(C.Mix_LoadWAV_RW(_src, _freesrc)))
if chunk == nil {
err = sdl.GetError()
}
return
}
作者:swanteschol
项目:codin
func loadSound(name string) *C.Mix_Chunk {
cfile, rb := C.CString(name), C.CString("rb")
rwop := C.SDL_RWFromFile(cfile, rb)
C.free(unsafe.Pointer(cfile))
C.free(unsafe.Pointer(rb))
chunk := C.Mix_LoadWAV_RW(rwop, 1)
if chunk == nil {
panic(fmt.Sprintf("Unable to load Sound file (%v): %v", name, util.GetMixError()))
}
return chunk
}
作者:pakoha
项目:Go-SD
func LoadWAV(file string) *Chunk {
cfile := C.CString(file)
cchunk := C.Mix_LoadWAV_RW(C.SDL_RWFromFile(cfile, C.CString("rb")), 1)
C.free(unsafe.Pointer(cfile))
if cchunk == nil {
return nil
}
return &Chunk{cchunk}
}
作者:flaz
项目:go-sdl
func LoadWAV(file string) (chunk *Chunk, err error) {
_file := C.CString(file)
defer C.free(unsafe.Pointer(_file))
_rb := C.CString("rb")
defer C.free(unsafe.Pointer(_rb))
// why doesn't this call Mix_LoadWAV ?
chunk = (*Chunk)(unsafe.Pointer(C.Mix_LoadWAV_RW(C.SDL_RWFromFile(_file, _rb), 1)))
if chunk == nil {
err = sdl.GetError()
}
return
}
作者:beora
项目:fung
func LoadWAV(filename string) (* C.Mix_Chunk) {
rwops := RWFromFile(filename, "r")
if rwops == nil { return nil }
wav := C.Mix_LoadWAV_RW(rwops, C.int(1))
// wav := LoadWAV_RW(rwops, 1)
println(filename, rwops, wav, GetError())
return wav
}
作者:hybridgrou
项目:go-sdl
func LoadWAV(file string) *Chunk {
_file := (C.CString)(file)
return (*Chunk)(unsafe.Pointer(C.Mix_LoadWAV_RW(C.SDL_RWFromFile(_file,
C.CString("rb")), 1)))
}
作者:hybridgrou
项目:go-sdl
func LoadWAV_RW(src *sdl.RWops, freesrc int) *Chunk {
_src := (*C.SDL_RWops)(unsafe.Pointer(src))
_freesrc := (C.int)(freesrc)
return (*Chunk)(unsafe.Pointer(C.Mix_LoadWAV_RW(_src, _freesrc)))
}
作者:beora
项目:fung
// Load a wave file or a music (.mod .s3m .it .xm) file
func LoadWAV_RW(src * C.SDL_RWops, freesrc int) (* C.Mix_Chunk) {
return C.Mix_LoadWAV_RW(src, C.int(freesrc))
}