use array

This commit is contained in:
filifa 2024-08-24 16:26:01 -05:00
parent c715f42c71
commit b67aae3289
1 changed files with 4 additions and 4 deletions

View File

@ -49,7 +49,7 @@ func main() {
preset := C.CString("/usr/share/projectM/presets/presets_stock/Zylot - Wisps.milk")
C.projectm_load_preset_file(handle, preset, false)
bufSize := 2048
const bufSize int = 2048
running := true
for running {
@ -61,9 +61,9 @@ func main() {
}
}
audioData := make([]int16, bufSize)
var audioData [bufSize]int16
err = binary.Read(os.Stdin, binary.LittleEndian, audioData)
err = binary.Read(os.Stdin, binary.LittleEndian, &audioData)
if err == io.ErrUnexpectedEOF {
running = false
break
@ -71,7 +71,7 @@ func main() {
panic(err)
}
C.projectm_pcm_add_int16(handle, (*C.int16_t)(&audioData[0]), C.uint(len(audioData)), C.PROJECTM_STEREO)
C.projectm_pcm_add_int16(handle, (*C.int16_t)(&audioData[0]), C.uint(bufSize), C.PROJECTM_STEREO)
C.projectm_opengl_render_frame(handle)
window.GLSwap()