make render a method of milkdropwindow

This commit is contained in:
filifa 2024-08-24 19:42:45 -05:00
parent 4a9d73ef04
commit 622e85a4f6
1 changed files with 5 additions and 5 deletions

10
main.go
View File

@ -62,7 +62,7 @@ func (m *milkDropWindow) loadPreset(preset string) {
C.projectm_load_preset_file(m.handle, cPreset, false) C.projectm_load_preset_file(m.handle, cPreset, false)
} }
func render(window *sdl.Window, handle C.projectm_handle) (bool, error) { func (m *milkDropWindow) render() (bool, error) {
var audioData [bufSize]int16 var audioData [bufSize]int16
err := binary.Read(os.Stdin, binary.LittleEndian, &audioData) err := binary.Read(os.Stdin, binary.LittleEndian, &audioData)
@ -72,10 +72,10 @@ func render(window *sdl.Window, handle C.projectm_handle) (bool, error) {
return true, err return true, err
} }
C.projectm_pcm_add_int16(handle, (*C.int16_t)(&audioData[0]), C.uint(bufSize), C.PROJECTM_STEREO) C.projectm_pcm_add_int16(m.handle, (*C.int16_t)(&audioData[0]), C.uint(bufSize), C.PROJECTM_STEREO)
C.projectm_opengl_render_frame(handle) C.projectm_opengl_render_frame(m.handle)
window.GLSwap() m.window.GLSwap()
return true, nil return true, nil
} }
@ -128,7 +128,7 @@ func main() {
break break
} }
running, err = render(m.window, m.handle) running, err = m.render()
if err != nil { if err != nil {
panic(err) panic(err)
} }