Skip to content

Commit

Permalink
Go: updated slicing
Browse files Browse the repository at this point in the history
  • Loading branch information
johanlindfors committed Nov 6, 2023
1 parent 4e877d3 commit 40f03e1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion golang/pkg/chip8/audio.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ const (
//export SineWave
func SineWave(userdata unsafe.Pointer, stream *C.Uint8, length C.int) {
n := int(length)
hdr := reflect.SliceHeader{Data: uintptr(unsafe.Pointer(stream)), Len: n, Cap: n}
hdr := make([]C.Uint8, length)
sh := (*reflect.SliceHeader)(unsafe.Pointer(&hdr))
sh.Data = uintptr(unsafe.Pointer(stream))
buf := *(*[]C.Uint8)(unsafe.Pointer(&hdr))

var phase float64
Expand Down

0 comments on commit 40f03e1

Please sign in to comment.