Esempio n. 1
0
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)))
}
Esempio n. 2
0
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
}
Esempio n. 3
0
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
}
Esempio n. 4
0
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
}
Esempio n. 5
0
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}
}
Esempio n. 6
0
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
}
Esempio n. 7
0
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
}
Esempio n. 8
0
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)))
}
Esempio n. 9
0
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)))
}
Esempio n. 10
0
// 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))
}