func (s *Sound) mix(stream *C.Uint8, sz C.int) { vol := C.int(C.SDL_MIX_MAXVOLUME) left := uintptr(sz) dst := uintptr(unsafe.Pointer(stream)) for left > 0 { data := uintptr(s.data) + uintptr(s.pos) n := uintptr(left) if s.len-s.pos < n { n = s.len - s.pos } C.SDL_MixAudio((*C.Uint8)(unsafe.Pointer(dst)), (*C.Uint8)(unsafe.Pointer(data)), C.Uint32(n), vol) left -= n s.pos += n dst += uintptr(n) if !s.repeat { break } else if s.pos >= s.len { s.pos = 0 } } }
func MixAudio(dst, src *uint8, len_ uint32, volume int) { _dst := (*C.Uint8)(unsafe.Pointer(dst)) _src := (*C.Uint8)(unsafe.Pointer(src)) _len := (C.Uint32)(len_) _volume := (C.int)(volume) C.SDL_MixAudio(_dst, _src, _len, _volume) }
func MixAudio(dst, src []byte, vol int) error { if len(dst) != len(src) { return errors.New("len(dst) != len(src)") } C.SDL_MixAudio( (*C.Uint8)(unsafe.Pointer(&dst[0])), (*C.Uint8)(unsafe.Pointer(&src[0])), C.Uint32(len(dst)), C.int(vol), ) return nil }
// MixAudio (https://wiki.libsdl.org/SDL_MixAudio) func MixAudio(dst, src *uint8, len_ uint32, volume int) { _dst := (*C.Uint8)(unsafe.Pointer(dst)) _src := (*C.Uint8)(unsafe.Pointer(src)) C.SDL_MixAudio(_dst, _src, C.Uint32(len_), C.int(volume)) }
func MixAudio(dst, src []byte, volume int) { C.SDL_MixAudio((*C.Uint8)(unsafe.Pointer(&dst[0])), (*C.Uint8)(unsafe.Pointer(&src[0])), C.Uint32(len(dst)), C.int(volume)) }
func MixAudio(dst, src *C.Uint8, length C.Uint32, volume C.int) { C.SDL_MixAudio(dst, src, length, volume) }